test(core): expect that Edge cannot auto-bootstrap in extensions

This commit is contained in:
Martin Staffa
2017-04-13 12:09:41 +02:00
committed by Martin Staffa
parent 7efed00632
commit 69c3faf405
+22 -4
View File
@@ -1755,8 +1755,7 @@ describe('angular', function() {
};
}
it('should bootstrap from an extension into an extension document for same-origin documents only', function() {
describe('from extensions into extension documents', function() {
// Extension URLs are browser-specific, so we must choose a scheme that is supported by the browser to make
// sure that the URL is properly parsed.
var protocol;
@@ -1773,10 +1772,29 @@ describe('angular', function() {
protocol = 'browserext:'; // Upcoming standard scheme.
}
expect(allowAutoBootstrap(createFakeDoc({src: protocol + '//something'}, protocol))).toBe(true);
expect(allowAutoBootstrap(createFakeDoc({src: protocol + '//something-else'}, protocol))).toBe(false);
if (protocol === 'ms-browser-extension:') {
// Support: Edge 13-15
// In Edge, URLs with protocol 'ms-browser-extension:' return "null" for the origin,
// therefore it's impossible to know if a script is same-origin.
it('should not bootstrap for same-origin documents', function() {
expect(allowAutoBootstrap(createFakeDoc({src: protocol + '//something'}, protocol))).toBe(false);
});
} else {
it('should bootstrap for same-origin documents', function() {
expect(allowAutoBootstrap(createFakeDoc({src: protocol + '//something'}, protocol))).toBe(true);
});
}
it('should not bootstrap for cross-origin documents', function() {
expect(allowAutoBootstrap(createFakeDoc({src: protocol + '//something-else'}, protocol))).toBe(false);
});
});
it('should bootstrap from a script with no source (e.g. src, href or xlink:href attributes)', function() {
expect(allowAutoBootstrap(createFakeDoc({src: null}))).toBe(true);