Bug 989025 - WebConsole breaks when trying to autocomplete in objects from different domains; r=past

This commit is contained in:
Mihai Sucan
2014-03-27 23:15:29 +02:00
parent 158b74825b
commit 6dc37e3f4a
4 changed files with 75 additions and 1 deletions

View File

@@ -110,6 +110,7 @@ support-files =
test-bug-952277-highlight-nodes-in-vview.html test-bug-952277-highlight-nodes-in-vview.html
test-bug-609872-cd-iframe-parent.html test-bug-609872-cd-iframe-parent.html
test-bug-609872-cd-iframe-child.html test-bug-609872-cd-iframe-child.html
test-bug-989025-iframe-parent.html
[browser_bug664688_sandbox_update_after_navigation.js] [browser_bug664688_sandbox_update_after_navigation.js]
[browser_bug_638949_copy_link_location.js] [browser_bug_638949_copy_link_location.js]
@@ -277,3 +278,4 @@ run-if = os == "mac"
[browser_webconsole_start_netmon_first.js] [browser_webconsole_start_netmon_first.js]
[browser_webconsole_console_trace_duplicates.js] [browser_webconsole_console_trace_duplicates.js]
[browser_webconsole_cd_iframe.js] [browser_webconsole_cd_iframe.js]
[browser_webconsole_autocomplete_crossdomain_iframe.js]

View File

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

View File

@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>test for bug 989025 - iframe parent</title>
<!-- Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ -->
</head>
<body>
<p>test for bug 989025 - iframe parent</p>
<iframe src="http://mochi.test:8888/browser/browser/devtools/webconsole/test/test-bug-609872-cd-iframe-child.html"></iframe>
</body>
</html>

View File

@@ -1098,7 +1098,7 @@ let DebuggerEnvironmentSupport = {
}; };
exports.JSPropertyProvider = JSPropertyProvider; exports.JSPropertyProvider = DevToolsUtils.makeInfallible(JSPropertyProvider);
})(WebConsoleUtils); })(WebConsoleUtils);
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////