@@ -1532,33 +1532,41 @@ function getNgAttribute(element, ngAttr) {
1532
1532
1533
1533
function allowAutoBootstrap ( document ) {
1534
1534
var script = document . currentScript ;
1535
- var src = script && script . getAttribute ( 'src' ) ;
1536
1535
1537
- if ( ! src ) {
1536
+ if ( ! script ) {
1537
+ // IE does not have `document.currentScript`
1538
1538
return true ;
1539
1539
}
1540
1540
1541
- var link = document . createElement ( 'a' ) ;
1542
- link . href = src ;
1541
+ var srcs = [ script . getAttribute ( 'src' ) , script . getAttribute ( 'href' ) , script . getAttribute ( 'xlink:href' ) ] ;
1543
1542
1544
- if ( document . location . origin === link . origin ) {
1545
- // Same-origin resources are always allowed, even for non-whitelisted schemes.
1546
- return true ;
1547
- }
1548
- // Disabled bootstrapping unless angular.js was loaded from a known scheme used on the web.
1549
- // This is to prevent angular.js bundled with browser extensions from being used to bypass the
1550
- // content security policy in web pages and other browser extensions.
1551
- switch ( link . protocol ) {
1552
- case 'http:' :
1553
- case 'https:' :
1554
- case 'ftp:' :
1555
- case 'blob:' :
1556
- case 'file:' :
1557
- case 'data:' :
1543
+ return srcs . every ( function ( src ) {
1544
+ if ( ! src ) {
1558
1545
return true ;
1559
- default :
1560
- return false ;
1561
- }
1546
+ }
1547
+
1548
+ var link = document . createElement ( 'a' ) ;
1549
+ link . href = src ;
1550
+
1551
+ if ( document . location . origin === link . origin ) {
1552
+ // Same-origin resources are always allowed, even for non-whitelisted schemes.
1553
+ return true ;
1554
+ }
1555
+ // Disabled bootstrapping unless angular.js was loaded from a known scheme used on the web.
1556
+ // This is to prevent angular.js bundled with browser extensions from being used to bypass the
1557
+ // content security policy in web pages and other browser extensions.
1558
+ switch ( link . protocol ) {
1559
+ case 'http:' :
1560
+ case 'https:' :
1561
+ case 'ftp:' :
1562
+ case 'blob:' :
1563
+ case 'file:' :
1564
+ case 'data:' :
1565
+ return true ;
1566
+ default :
1567
+ return false ;
1568
+ }
1569
+ } ) ;
1562
1570
}
1563
1571
1564
1572
// Cached as it has to run during loading so that document.currentScript is available.
0 commit comments