browser/devtools/webconsole/test/browser_webconsole_autocomplete_crossdomain_iframe.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/devtools/webconsole/test/browser_webconsole_autocomplete_crossdomain_iframe.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,59 @@
     1.4 +/* Any copyright is dedicated to the Public Domain.
     1.5 +   http://creativecommons.org/publicdomain/zero/1.0/ */
     1.6 +
     1.7 +// Test that autocomplete doesn't break when trying to reach into objects from
     1.8 +// a different domain, bug 989025.
     1.9 +
    1.10 +function test() {
    1.11 +  let hud;
    1.12 +
    1.13 +  const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-989025-iframe-parent.html";
    1.14 +
    1.15 +  Task.spawn(function*() {
    1.16 +    const {tab} = yield loadTab(TEST_URI);
    1.17 +    hud = yield openConsole(tab);
    1.18 +
    1.19 +    hud.jsterm.execute('document.title');
    1.20 +
    1.21 +    yield waitForMessages({
    1.22 +      webconsole: hud,
    1.23 +      messages: [{
    1.24 +        text: "989025 - iframe parent",
    1.25 +        category: CATEGORY_OUTPUT,
    1.26 +      }],
    1.27 +    });
    1.28 +
    1.29 +    let autocompleteUpdated = hud.jsterm.once("autocomplete-updated");
    1.30 +
    1.31 +    hud.jsterm.setInputValue("window[0].document");
    1.32 +    executeSoon(() => {
    1.33 +      EventUtils.synthesizeKey(".", {});
    1.34 +    });
    1.35 +
    1.36 +    yield autocompleteUpdated;
    1.37 +
    1.38 +    hud.jsterm.setInputValue("window[0].document.title");
    1.39 +    EventUtils.synthesizeKey("VK_RETURN", {});
    1.40 +
    1.41 +    yield waitForMessages({
    1.42 +      webconsole: hud,
    1.43 +      messages: [{
    1.44 +        text: "Permission denied",
    1.45 +        category: CATEGORY_OUTPUT,
    1.46 +        severity: SEVERITY_ERROR,
    1.47 +      }],
    1.48 +    });
    1.49 +
    1.50 +    hud.jsterm.execute("window.location");
    1.51 +
    1.52 +    yield waitForMessages({
    1.53 +      webconsole: hud,
    1.54 +      messages: [{
    1.55 +        text: "test-bug-989025-iframe-parent.html",
    1.56 +        category: CATEGORY_OUTPUT,
    1.57 +      }],
    1.58 +    });
    1.59 +
    1.60 +    yield closeConsole(tab);
    1.61 +  }).then(finishTest);
    1.62 +}

mercurial