browser/components/sessionstore/test/browser_461743.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 function test() {
     6   /** Test for Bug 461743 **/
     8   waitForExplicitFinish();
    10   let testURL = "http://mochi.test:8888/browser/" +
    11     "browser/components/sessionstore/test/browser_461743_sample.html";
    13   let frameCount = 0;
    14   let tab = gBrowser.addTab(testURL);
    15   tab.linkedBrowser.addEventListener("load", function(aEvent) {
    16     // Wait for all frames to load completely.
    17     if (frameCount++ < 2)
    18       return;
    19     tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
    20     let tab2 = gBrowser.duplicateTab(tab);
    21     tab2.linkedBrowser.addEventListener("461743", function(aEvent) {
    22       tab2.linkedBrowser.removeEventListener("461743", arguments.callee, true);
    23       is(aEvent.data, "done", "XSS injection was attempted");
    25       executeSoon(function() {
    26         let iframes = tab2.linkedBrowser.contentWindow.frames;
    27         let innerHTML = iframes[1].document.body.innerHTML;
    28         isnot(innerHTML, Components.utils.reportError.toString(),
    29               "chrome access denied!");
    31         // Clean up.
    32         gBrowser.removeTab(tab2);
    33         gBrowser.removeTab(tab);
    35         finish();
    36       });
    37     }, true, true);
    38   }, true);
    39 }

mercurial