browser_jsterm_autocomplete_crossdomain_iframe.js (1369B)
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. See Bug 989025. 6 7 "use strict"; 8 9 const TEST_URI = 10 "https://example.com/browser/devtools/client/webconsole/" + 11 "test/browser/test-iframe-parent.html"; 12 13 add_task(async function () { 14 const hud = await openNewTabAndConsole(TEST_URI); 15 16 await executeAndWaitForResultMessage(hud, "document.title", "iframe parent"); 17 ok(true, "root document's title is accessible"); 18 19 // Make sure we don't throw when trying to autocomplete 20 const autocompleteUpdated = hud.jsterm.once("autocomplete-updated"); 21 setInputValue(hud, "window[0].document"); 22 EventUtils.sendString("."); 23 await autocompleteUpdated; 24 25 setInputValue(hud, "window[0].document.title"); 26 const onPermissionDeniedMessage = waitForMessageByType( 27 hud, 28 "Permission denied", 29 ".error" 30 ); 31 EventUtils.synthesizeKey("KEY_Enter"); 32 const permissionDenied = await onPermissionDeniedMessage; 33 ok( 34 permissionDenied.node.classList.contains("error"), 35 "A message error is shown when trying to inspect window[0]" 36 ); 37 38 await executeAndWaitForResultMessage( 39 hud, 40 "window.location", 41 "test-iframe-parent.html" 42 ); 43 ok(true, "root document's location is accessible"); 44 });