browser_461743.js (1542B)
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/. */ 4 5 function test() { 6 /** Test for Bug 461743 */ 7 8 waitForExplicitFinish(); 9 10 let testURL = 11 "http://mochi.test:8888/browser/" + 12 "browser/components/sessionstore/test/browser_461743_sample.html"; 13 14 let frameCount = 0; 15 let tab = BrowserTestUtils.addTab(gBrowser, testURL); 16 tab.linkedBrowser.addEventListener( 17 "load", 18 function loadListener(aEvent) { 19 // Wait for all frames to load completely. 20 if (frameCount++ < 2) { 21 return; 22 } 23 tab.linkedBrowser.removeEventListener("load", loadListener, true); 24 let tab2 = gBrowser.duplicateTab(tab); 25 tab2.linkedBrowser.addEventListener( 26 "461743", 27 function listener() { 28 tab2.linkedBrowser.removeEventListener("461743", listener, true); 29 is(aEvent.data, "done", "XSS injection was attempted"); 30 31 executeSoon(function () { 32 let iframes = tab2.linkedBrowser.contentWindow.frames; 33 let innerHTML = iframes[1].document.body.innerHTML; 34 isnot( 35 innerHTML, 36 Cu.reportError.toString(), 37 "chrome access denied!" 38 ); 39 40 // Clean up. 41 gBrowser.removeTab(tab2); 42 gBrowser.removeTab(tab); 43 44 finish(); 45 }); 46 }, 47 true, 48 true 49 ); 50 }, 51 true 52 ); 53 }