summaryrefslogtreecommitdiffstats
path: root/browser/components/safebrowsing/content/test/browser_bug400731.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /browser/components/safebrowsing/content/test/browser_bug400731.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'browser/components/safebrowsing/content/test/browser_bug400731.js')
-rw-r--r--browser/components/safebrowsing/content/test/browser_bug400731.js58
1 files changed, 58 insertions, 0 deletions
diff --git a/browser/components/safebrowsing/content/test/browser_bug400731.js b/browser/components/safebrowsing/content/test/browser_bug400731.js
new file mode 100644
index 000000000..fac187753
--- /dev/null
+++ b/browser/components/safebrowsing/content/test/browser_bug400731.js
@@ -0,0 +1,58 @@
+/* Check presence of the "Ignore this warning" button */
+
+function onDOMContentLoaded(callback) {
+ function complete({ data }) {
+ mm.removeMessageListener("Test:DOMContentLoaded", complete);
+ callback(data);
+ }
+
+ let mm = gBrowser.selectedBrowser.messageManager;
+ mm.addMessageListener("Test:DOMContentLoaded", complete);
+
+ function contentScript() {
+ let listener = function () {
+ removeEventListener("DOMContentLoaded", listener);
+
+ let button = content.document.getElementById("ignoreWarningButton");
+
+ sendAsyncMessage("Test:DOMContentLoaded", { buttonPresent: !!button });
+ };
+ addEventListener("DOMContentLoaded", listener);
+ }
+ mm.loadFrameScript("data:,(" + contentScript.toString() + ")();", true);
+}
+
+function test() {
+ waitForExplicitFinish();
+
+ gBrowser.selectedTab = gBrowser.addTab("http://www.itisatrap.org/firefox/its-an-attack.html");
+ onDOMContentLoaded(testMalware);
+}
+
+function testMalware(data) {
+ ok(data.buttonPresent, "Ignore warning button should be present for malware");
+
+ Services.prefs.setBoolPref("browser.safebrowsing.allowOverride", false);
+
+ // Now launch the unwanted software test
+ onDOMContentLoaded(testUnwanted);
+ gBrowser.loadURI("http://www.itisatrap.org/firefox/unwanted.html");
+}
+
+function testUnwanted(data) {
+ // Confirm that "Ignore this warning" is visible - bug 422410
+ ok(!data.buttonPresent, "Ignore warning button should be missing for unwanted software");
+
+ Services.prefs.setBoolPref("browser.safebrowsing.allowOverride", true);
+
+ // Now launch the phishing test
+ onDOMContentLoaded(testPhishing);
+ gBrowser.loadURI("http://www.itisatrap.org/firefox/its-a-trap.html");
+}
+
+function testPhishing(data) {
+ ok(data.buttonPresent, "Ignore warning button should be present for phishing");
+
+ gBrowser.removeCurrentTab();
+ finish();
+}