michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: // Test that autocomplete doesn't break when trying to reach into objects from michael@0: // a different domain, bug 989025. michael@0: michael@0: function test() { michael@0: let hud; michael@0: michael@0: const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-989025-iframe-parent.html"; michael@0: michael@0: Task.spawn(function*() { michael@0: const {tab} = yield loadTab(TEST_URI); michael@0: hud = yield openConsole(tab); michael@0: michael@0: hud.jsterm.execute('document.title'); michael@0: michael@0: yield waitForMessages({ michael@0: webconsole: hud, michael@0: messages: [{ michael@0: text: "989025 - iframe parent", michael@0: category: CATEGORY_OUTPUT, michael@0: }], michael@0: }); michael@0: michael@0: let autocompleteUpdated = hud.jsterm.once("autocomplete-updated"); michael@0: michael@0: hud.jsterm.setInputValue("window[0].document"); michael@0: executeSoon(() => { michael@0: EventUtils.synthesizeKey(".", {}); michael@0: }); michael@0: michael@0: yield autocompleteUpdated; michael@0: michael@0: hud.jsterm.setInputValue("window[0].document.title"); michael@0: EventUtils.synthesizeKey("VK_RETURN", {}); michael@0: michael@0: yield waitForMessages({ michael@0: webconsole: hud, michael@0: messages: [{ michael@0: text: "Permission denied", michael@0: category: CATEGORY_OUTPUT, michael@0: severity: SEVERITY_ERROR, michael@0: }], michael@0: }); michael@0: michael@0: hud.jsterm.execute("window.location"); michael@0: michael@0: yield waitForMessages({ michael@0: webconsole: hud, michael@0: messages: [{ michael@0: text: "test-bug-989025-iframe-parent.html", michael@0: category: CATEGORY_OUTPUT, michael@0: }], michael@0: }); michael@0: michael@0: yield closeConsole(tab); michael@0: }).then(finishTest); michael@0: }