Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 69c3faf

Browse files
committed
test(core): expect that Edge cannot auto-bootstrap in extensions
1 parent 7efed00 commit 69c3faf

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

test/AngularSpec.js

+22-4
Original file line numberDiff line numberDiff line change
@@ -1755,8 +1755,7 @@ describe('angular', function() {
17551755
};
17561756
}
17571757

1758-
it('should bootstrap from an extension into an extension document for same-origin documents only', function() {
1759-
1758+
describe('from extensions into extension documents', function() {
17601759
// Extension URLs are browser-specific, so we must choose a scheme that is supported by the browser to make
17611760
// sure that the URL is properly parsed.
17621761
var protocol;
@@ -1773,10 +1772,29 @@ describe('angular', function() {
17731772
protocol = 'browserext:'; // Upcoming standard scheme.
17741773
}
17751774

1776-
expect(allowAutoBootstrap(createFakeDoc({src: protocol + '//something'}, protocol))).toBe(true);
1777-
expect(allowAutoBootstrap(createFakeDoc({src: protocol + '//something-else'}, protocol))).toBe(false);
1775+
1776+
if (protocol === 'ms-browser-extension:') {
1777+
// Support: Edge 13-15
1778+
// In Edge, URLs with protocol 'ms-browser-extension:' return "null" for the origin,
1779+
// therefore it's impossible to know if a script is same-origin.
1780+
it('should not bootstrap for same-origin documents', function() {
1781+
expect(allowAutoBootstrap(createFakeDoc({src: protocol + '//something'}, protocol))).toBe(false);
1782+
});
1783+
1784+
} else {
1785+
it('should bootstrap for same-origin documents', function() {
1786+
1787+
expect(allowAutoBootstrap(createFakeDoc({src: protocol + '//something'}, protocol))).toBe(true);
1788+
});
1789+
}
1790+
1791+
it('should not bootstrap for cross-origin documents', function() {
1792+
expect(allowAutoBootstrap(createFakeDoc({src: protocol + '//something-else'}, protocol))).toBe(false);
1793+
});
1794+
17781795
});
17791796

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

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

0 commit comments

Comments
 (0)