From 69c3faf40589b4ac9e7fa75f3b4fb83349aba60d Mon Sep 17 00:00:00 2001 From: Martin Staffa Date: Thu, 13 Apr 2017 12:09:41 +0200 Subject: [PATCH] test(core): expect that Edge cannot auto-bootstrap in extensions --- test/AngularSpec.js | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/test/AngularSpec.js b/test/AngularSpec.js index 5e9ef2167..4b6610527 100644 --- a/test/AngularSpec.js +++ b/test/AngularSpec.js @@ -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);