|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 |
|
4 // Test that autocomplete doesn't break when trying to reach into objects from |
|
5 // a different domain, bug 989025. |
|
6 |
|
7 function test() { |
|
8 let hud; |
|
9 |
|
10 const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-989025-iframe-parent.html"; |
|
11 |
|
12 Task.spawn(function*() { |
|
13 const {tab} = yield loadTab(TEST_URI); |
|
14 hud = yield openConsole(tab); |
|
15 |
|
16 hud.jsterm.execute('document.title'); |
|
17 |
|
18 yield waitForMessages({ |
|
19 webconsole: hud, |
|
20 messages: [{ |
|
21 text: "989025 - iframe parent", |
|
22 category: CATEGORY_OUTPUT, |
|
23 }], |
|
24 }); |
|
25 |
|
26 let autocompleteUpdated = hud.jsterm.once("autocomplete-updated"); |
|
27 |
|
28 hud.jsterm.setInputValue("window[0].document"); |
|
29 executeSoon(() => { |
|
30 EventUtils.synthesizeKey(".", {}); |
|
31 }); |
|
32 |
|
33 yield autocompleteUpdated; |
|
34 |
|
35 hud.jsterm.setInputValue("window[0].document.title"); |
|
36 EventUtils.synthesizeKey("VK_RETURN", {}); |
|
37 |
|
38 yield waitForMessages({ |
|
39 webconsole: hud, |
|
40 messages: [{ |
|
41 text: "Permission denied", |
|
42 category: CATEGORY_OUTPUT, |
|
43 severity: SEVERITY_ERROR, |
|
44 }], |
|
45 }); |
|
46 |
|
47 hud.jsterm.execute("window.location"); |
|
48 |
|
49 yield waitForMessages({ |
|
50 webconsole: hud, |
|
51 messages: [{ |
|
52 text: "test-bug-989025-iframe-parent.html", |
|
53 category: CATEGORY_OUTPUT, |
|
54 }], |
|
55 }); |
|
56 |
|
57 yield closeConsole(tab); |
|
58 }).then(finishTest); |
|
59 } |