@@ -1447,33 +1447,41 @@ function getNgAttribute(element, ngAttr) {
1447
1447
1448
1448
function allowAutoBootstrap ( document ) {
1449
1449
var script = document . currentScript ;
1450
- var src = script && script . getAttribute ( 'src' ) ;
1451
1450
1452
- if ( ! src ) {
1451
+ if ( ! script ) {
1452
+ // IE does not have `document.currentScript`
1453
1453
return true ;
1454
1454
}
1455
1455
1456
- var link = document . createElement ( 'a' ) ;
1457
- link . href = src ;
1456
+ var srcs = [ script . getAttribute ( 'src' ) , script . getAttribute ( 'href' ) , script . getAttribute ( 'xlink:href' ) ] ;
1458
1457
1459
- if ( document . location . origin === link . origin ) {
1460
- // Same-origin resources are always allowed, even for non-whitelisted schemes.
1461
- return true ;
1462
- }
1463
- // Disabled bootstrapping unless angular.js was loaded from a known scheme used on the web.
1464
- // This is to prevent angular.js bundled with browser extensions from being used to bypass the
1465
- // content security policy in web pages and other browser extensions.
1466
- switch ( link . protocol ) {
1467
- case 'http:' :
1468
- case 'https:' :
1469
- case 'ftp:' :
1470
- case 'blob:' :
1471
- case 'file:' :
1472
- case 'data:' :
1458
+ return srcs . every ( function ( src ) {
1459
+ if ( ! src ) {
1473
1460
return true ;
1474
- default :
1475
- return false ;
1476
- }
1461
+ }
1462
+
1463
+ var link = document . createElement ( 'a' ) ;
1464
+ link . href = src ;
1465
+
1466
+ if ( document . location . origin === link . origin ) {
1467
+ // Same-origin resources are always allowed, even for non-whitelisted schemes.
1468
+ return true ;
1469
+ }
1470
+ // Disabled bootstrapping unless angular.js was loaded from a known scheme used on the web.
1471
+ // This is to prevent angular.js bundled with browser extensions from being used to bypass the
1472
+ // content security policy in web pages and other browser extensions.
1473
+ switch ( link . protocol ) {
1474
+ case 'http:' :
1475
+ case 'https:' :
1476
+ case 'ftp:' :
1477
+ case 'blob:' :
1478
+ case 'file:' :
1479
+ case 'data:' :
1480
+ return true ;
1481
+ default :
1482
+ return false ;
1483
+ }
1484
+ } ) ;
1477
1485
}
1478
1486
1479
1487
// Cached as it has to run during loading so that document.currentScript is available.
0 commit comments