1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/components/sessionstore/test/browser_461743.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,39 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +function test() { 1.9 + /** Test for Bug 461743 **/ 1.10 + 1.11 + waitForExplicitFinish(); 1.12 + 1.13 + let testURL = "http://mochi.test:8888/browser/" + 1.14 + "browser/components/sessionstore/test/browser_461743_sample.html"; 1.15 + 1.16 + let frameCount = 0; 1.17 + let tab = gBrowser.addTab(testURL); 1.18 + tab.linkedBrowser.addEventListener("load", function(aEvent) { 1.19 + // Wait for all frames to load completely. 1.20 + if (frameCount++ < 2) 1.21 + return; 1.22 + tab.linkedBrowser.removeEventListener("load", arguments.callee, true); 1.23 + let tab2 = gBrowser.duplicateTab(tab); 1.24 + tab2.linkedBrowser.addEventListener("461743", function(aEvent) { 1.25 + tab2.linkedBrowser.removeEventListener("461743", arguments.callee, true); 1.26 + is(aEvent.data, "done", "XSS injection was attempted"); 1.27 + 1.28 + executeSoon(function() { 1.29 + let iframes = tab2.linkedBrowser.contentWindow.frames; 1.30 + let innerHTML = iframes[1].document.body.innerHTML; 1.31 + isnot(innerHTML, Components.utils.reportError.toString(), 1.32 + "chrome access denied!"); 1.33 + 1.34 + // Clean up. 1.35 + gBrowser.removeTab(tab2); 1.36 + gBrowser.removeTab(tab); 1.37 + 1.38 + finish(); 1.39 + }); 1.40 + }, true, true); 1.41 + }, true); 1.42 +}