|
1 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
4 |
|
5 /* |
|
6 * Test the fix for bug 441778 to ensure site-specific page zoom doesn't get |
|
7 * modified by sub-document loads of content from a different domain. |
|
8 */ |
|
9 |
|
10 function test() { |
|
11 waitForExplicitFinish(); |
|
12 |
|
13 const TEST_PAGE_URL = 'data:text/html,<body><iframe src=""></iframe></body>'; |
|
14 const TEST_IFRAME_URL = "http://test2.example.org/"; |
|
15 |
|
16 Task.spawn(function () { |
|
17 // Prepare the test tab |
|
18 let tab = gBrowser.addTab(); |
|
19 yield FullZoomHelper.selectTabAndWaitForLocationChange(tab); |
|
20 |
|
21 let testBrowser = tab.linkedBrowser; |
|
22 |
|
23 yield FullZoomHelper.load(tab, TEST_PAGE_URL); |
|
24 |
|
25 // Change the zoom level and then save it so we can compare it to the level |
|
26 // after loading the sub-document. |
|
27 FullZoom.enlarge(); |
|
28 var zoomLevel = ZoomManager.zoom; |
|
29 |
|
30 // Start the sub-document load. |
|
31 let deferred = Promise.defer(); |
|
32 executeSoon(function () { |
|
33 testBrowser.addEventListener("load", function (e) { |
|
34 testBrowser.removeEventListener("load", arguments.callee, true); |
|
35 |
|
36 is(e.target.defaultView.location, TEST_IFRAME_URL, "got the load event for the iframe"); |
|
37 is(ZoomManager.zoom, zoomLevel, "zoom is retained after sub-document load"); |
|
38 |
|
39 FullZoomHelper.removeTabAndWaitForLocationChange(). |
|
40 then(() => deferred.resolve()); |
|
41 }, true); |
|
42 content.document.querySelector("iframe").src = TEST_IFRAME_URL; |
|
43 }); |
|
44 yield deferred.promise; |
|
45 }).then(finish, FullZoomHelper.failAndContinue(finish)); |
|
46 } |