browser/devtools/webconsole/test/browser_webconsole_bug_770099_bad_policyuri.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* vim:set ts=2 sw=2 sts=2 et: */
     2 /* ***** BEGIN LICENSE BLOCK *****
     3  * Any copyright is dedicated to the Public Domain.
     4  * http://creativecommons.org/publicdomain/zero/1.0/
     5  *
     6  * ***** END LICENSE BLOCK ***** */
     8 // Tests that the Web Console CSP messages are displayed
    10 const TEST_BAD_POLICY_URI = "https://example.com/browser/browser/devtools/webconsole/test/test_bug_770099_bad_policy_uri.html";
    12 let hud = undefined;
    14 function test() {
    15   addTab("data:text/html;charset=utf8,Web Console CSP bad policy URI test");
    16   browser.addEventListener("load", function _onLoad() {
    17     browser.removeEventListener("load", _onLoad, true);
    18     openConsole(null, loadDocument);
    19   }, true);
    20 }
    22 function loadDocument(theHud) {
    23   hud = theHud;
    24   hud.jsterm.clearOutput();
    25   browser.addEventListener("load", onLoad, true);
    26   content.location = TEST_BAD_POLICY_URI;
    27 }
    29 function onLoad(aEvent) {
    30   browser.removeEventListener("load", onLoad, true);
    32   waitForMessages({
    33     webconsole: hud,
    34     messages: [{
    35       text: "can't fetch policy",
    36       category: CATEGORY_SECURITY,
    37       severity: SEVERITY_ERROR,
    38     }],
    39   }).then(finishTest);
    40 }

mercurial