browser/devtools/webconsole/test/browser_webconsole_autocomplete_crossdomain_iframe.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.

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

mercurial