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.

     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/. */
     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  */
    10 function test() {
    11   waitForExplicitFinish();
    13   const TEST_PAGE_URL = 'data:text/html,<body><iframe src=""></iframe></body>';
    14   const TEST_IFRAME_URL = "http://test2.example.org/";
    16   Task.spawn(function () {
    17     // Prepare the test tab
    18     let tab = gBrowser.addTab();
    19     yield FullZoomHelper.selectTabAndWaitForLocationChange(tab);
    21     let testBrowser = tab.linkedBrowser;
    23     yield FullZoomHelper.load(tab, TEST_PAGE_URL);
    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;
    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);
    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");
    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 }

mercurial