browser/devtools/webconsole/test/browser_webconsole_bug_770099_bad_policyuri.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_bug_770099_bad_policyuri.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,40 @@
     1.4 +/* vim:set ts=2 sw=2 sts=2 et: */
     1.5 +/* ***** BEGIN LICENSE BLOCK *****
     1.6 + * Any copyright is dedicated to the Public Domain.
     1.7 + * http://creativecommons.org/publicdomain/zero/1.0/
     1.8 + *
     1.9 + * ***** END LICENSE BLOCK ***** */
    1.10 +
    1.11 +// Tests that the Web Console CSP messages are displayed
    1.12 +
    1.13 +const TEST_BAD_POLICY_URI = "https://example.com/browser/browser/devtools/webconsole/test/test_bug_770099_bad_policy_uri.html";
    1.14 +
    1.15 +let hud = undefined;
    1.16 +
    1.17 +function test() {
    1.18 +  addTab("data:text/html;charset=utf8,Web Console CSP bad policy URI test");
    1.19 +  browser.addEventListener("load", function _onLoad() {
    1.20 +    browser.removeEventListener("load", _onLoad, true);
    1.21 +    openConsole(null, loadDocument);
    1.22 +  }, true);
    1.23 +}
    1.24 +
    1.25 +function loadDocument(theHud) {
    1.26 +  hud = theHud;
    1.27 +  hud.jsterm.clearOutput();
    1.28 +  browser.addEventListener("load", onLoad, true);
    1.29 +  content.location = TEST_BAD_POLICY_URI;
    1.30 +}
    1.31 +
    1.32 +function onLoad(aEvent) {
    1.33 +  browser.removeEventListener("load", onLoad, true);
    1.34 +
    1.35 +  waitForMessages({
    1.36 +    webconsole: hud,
    1.37 +    messages: [{
    1.38 +      text: "can't fetch policy",
    1.39 +      category: CATEGORY_SECURITY,
    1.40 +      severity: SEVERITY_ERROR,
    1.41 +    }],
    1.42 +  }).then(finishTest);
    1.43 +}

mercurial