michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: /* michael@0: * Test the fix for bug 441778 to ensure site-specific page zoom doesn't get michael@0: * modified by sub-document loads of content from a different domain. michael@0: */ michael@0: michael@0: function test() { michael@0: waitForExplicitFinish(); michael@0: michael@0: const TEST_PAGE_URL = 'data:text/html,
'; michael@0: const TEST_IFRAME_URL = "http://test2.example.org/"; michael@0: michael@0: Task.spawn(function () { michael@0: // Prepare the test tab michael@0: let tab = gBrowser.addTab(); michael@0: yield FullZoomHelper.selectTabAndWaitForLocationChange(tab); michael@0: michael@0: let testBrowser = tab.linkedBrowser; michael@0: michael@0: yield FullZoomHelper.load(tab, TEST_PAGE_URL); michael@0: michael@0: // Change the zoom level and then save it so we can compare it to the level michael@0: // after loading the sub-document. michael@0: FullZoom.enlarge(); michael@0: var zoomLevel = ZoomManager.zoom; michael@0: michael@0: // Start the sub-document load. michael@0: let deferred = Promise.defer(); michael@0: executeSoon(function () { michael@0: testBrowser.addEventListener("load", function (e) { michael@0: testBrowser.removeEventListener("load", arguments.callee, true); michael@0: michael@0: is(e.target.defaultView.location, TEST_IFRAME_URL, "got the load event for the iframe"); michael@0: is(ZoomManager.zoom, zoomLevel, "zoom is retained after sub-document load"); michael@0: michael@0: FullZoomHelper.removeTabAndWaitForLocationChange(). michael@0: then(() => deferred.resolve()); michael@0: }, true); michael@0: content.document.querySelector("iframe").src = TEST_IFRAME_URL; michael@0: }); michael@0: yield deferred.promise; michael@0: }).then(finish, FullZoomHelper.failAndContinue(finish)); michael@0: }