|
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 ***** */ |
|
7 |
|
8 // Tests that the Web Console CSP messages are displayed |
|
9 |
|
10 const TEST_BAD_POLICY_URI = "https://example.com/browser/browser/devtools/webconsole/test/test_bug_770099_bad_policy_uri.html"; |
|
11 |
|
12 let hud = undefined; |
|
13 |
|
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 } |
|
21 |
|
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 } |
|
28 |
|
29 function onLoad(aEvent) { |
|
30 browser.removeEventListener("load", onLoad, true); |
|
31 |
|
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 } |