Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* vim:set ts=2 sw=2 sts=2 et: */ |
michael@0 | 2 | /* ***** BEGIN LICENSE BLOCK ***** |
michael@0 | 3 | * Any copyright is dedicated to the Public Domain. |
michael@0 | 4 | * http://creativecommons.org/publicdomain/zero/1.0/ |
michael@0 | 5 | * |
michael@0 | 6 | * ***** END LICENSE BLOCK ***** */ |
michael@0 | 7 | |
michael@0 | 8 | // Tests that the Web Console CSP messages are displayed |
michael@0 | 9 | |
michael@0 | 10 | const TEST_BAD_POLICY_URI = "https://example.com/browser/browser/devtools/webconsole/test/test_bug_770099_bad_policy_uri.html"; |
michael@0 | 11 | |
michael@0 | 12 | let hud = undefined; |
michael@0 | 13 | |
michael@0 | 14 | function test() { |
michael@0 | 15 | addTab("data:text/html;charset=utf8,Web Console CSP bad policy URI test"); |
michael@0 | 16 | browser.addEventListener("load", function _onLoad() { |
michael@0 | 17 | browser.removeEventListener("load", _onLoad, true); |
michael@0 | 18 | openConsole(null, loadDocument); |
michael@0 | 19 | }, true); |
michael@0 | 20 | } |
michael@0 | 21 | |
michael@0 | 22 | function loadDocument(theHud) { |
michael@0 | 23 | hud = theHud; |
michael@0 | 24 | hud.jsterm.clearOutput(); |
michael@0 | 25 | browser.addEventListener("load", onLoad, true); |
michael@0 | 26 | content.location = TEST_BAD_POLICY_URI; |
michael@0 | 27 | } |
michael@0 | 28 | |
michael@0 | 29 | function onLoad(aEvent) { |
michael@0 | 30 | browser.removeEventListener("load", onLoad, true); |
michael@0 | 31 | |
michael@0 | 32 | waitForMessages({ |
michael@0 | 33 | webconsole: hud, |
michael@0 | 34 | messages: [{ |
michael@0 | 35 | text: "can't fetch policy", |
michael@0 | 36 | category: CATEGORY_SECURITY, |
michael@0 | 37 | severity: SEVERITY_ERROR, |
michael@0 | 38 | }], |
michael@0 | 39 | }).then(finishTest); |
michael@0 | 40 | } |