|
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 = "http://mochi.test:8888/browser/" + |
|
11 "browser/components/sessionstore/test/browser_461743_sample.html"; |
|
12 |
|
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"); |
|
24 |
|
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!"); |
|
30 |
|
31 // Clean up. |
|
32 gBrowser.removeTab(tab2); |
|
33 gBrowser.removeTab(tab); |
|
34 |
|
35 finish(); |
|
36 }); |
|
37 }, true, true); |
|
38 }, true); |
|
39 } |