browser/base/content/test/general/browser_bug441778.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial