Skip to content

Commit 28c0213

Browse files
committed
test(core): expect that Edge cannot auto-bootstrap in extensions
1 parent 8b4d85c commit 28c0213

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

test/AngularSpec.js

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1731,8 +1731,7 @@ describe('angular', function() {
17311731
};
17321732
}
17331733

1734-
it('should bootstrap from an extension into an extension document for same-origin documents only', function() {
1735-
1734+
describe('from extensions into extension documents', function() {
17361735
// Extension URLs are browser-specific, so we must choose a scheme that is supported by the browser to make
17371736
// sure that the URL is properly parsed.
17381737
var protocol;
@@ -1749,10 +1748,29 @@ describe('angular', function() {
17491748
protocol = 'browserext:'; // Upcoming standard scheme.
17501749
}
17511750

1752-
expect(allowAutoBootstrap(createFakeDoc({src: protocol + '//something'}, protocol))).toBe(true);
1753-
expect(allowAutoBootstrap(createFakeDoc({src: protocol + '//something-else'}, protocol))).toBe(false);
1751+
1752+
if (protocol === 'ms-browser-extension:') {
1753+
// Support: Edge 13-15
1754+
// In Edge, URLs with protocol 'ms-browser-extension:' return "null" for the origin,
1755+
// therefore it's impossible to know if a script is same-origin.
1756+
it('should not bootstrap for same-origin documents', function() {
1757+
expect(allowAutoBootstrap(createFakeDoc({src: protocol + '//something'}, protocol))).toBe(false);
1758+
});
1759+
1760+
} else {
1761+
it('should bootstrap for same-origin documents', function() {
1762+
1763+
expect(allowAutoBootstrap(createFakeDoc({src: protocol + '//something'}, protocol))).toBe(true);
1764+
});
1765+
}
1766+
1767+
it('should not bootstrap for cross-origin documents', function() {
1768+
expect(allowAutoBootstrap(createFakeDoc({src: protocol + '//something-else'}, protocol))).toBe(false);
1769+
});
1770+
17541771
});
17551772

1773+
17561774
it('should bootstrap from a script with no source (e.g. src, href or xlink:href attributes)', function() {
17571775

17581776
expect(allowAutoBootstrap(createFakeDoc({src: null}))).toBe(true);

0 commit comments

Comments
 (0)