summaryrefslogtreecommitdiffstats
path: root/browser/components/safebrowsing/content/test/browser_bug400731.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
commit6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /browser/components/safebrowsing/content/test/browser_bug400731.js
parentInitial commit. (diff)
downloadthunderbird-upstream.tar.xz
thunderbird-upstream.zip
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/components/safebrowsing/content/test/browser_bug400731.js')
-rw-r--r--browser/components/safebrowsing/content/test/browser_bug400731.js65
1 files changed, 65 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 0000000000..39a048198b
--- /dev/null
+++ b/browser/components/safebrowsing/content/test/browser_bug400731.js
@@ -0,0 +1,65 @@
+/* Check presence of the "Ignore this warning" button */
+
+function checkWarningState() {
+ return SpecialPowers.spawn(gBrowser.selectedBrowser, [], () => {
+ return !!content.document.getElementById("ignore_warning_link");
+ });
+}
+
+add_task(async function testMalware() {
+ await new Promise(resolve => waitForDBInit(resolve));
+
+ await BrowserTestUtils.openNewForegroundTab(gBrowser, "about:blank");
+
+ const url = "http://www.itisatrap.org/firefox/its-an-attack.html";
+ BrowserTestUtils.loadURIString(gBrowser.selectedBrowser, url);
+ await BrowserTestUtils.browserLoaded(
+ gBrowser.selectedBrowser,
+ false,
+ url,
+ true
+ );
+
+ let buttonPresent = await checkWarningState();
+ ok(buttonPresent, "Ignore warning link should be present for malware");
+});
+
+add_task(async function testUnwanted() {
+ Services.prefs.setBoolPref("browser.safebrowsing.allowOverride", false);
+
+ // Now launch the unwanted software test
+ const url = "http://www.itisatrap.org/firefox/unwanted.html";
+ BrowserTestUtils.loadURIString(gBrowser.selectedBrowser, url);
+ await BrowserTestUtils.browserLoaded(
+ gBrowser.selectedBrowser,
+ false,
+ url,
+ true
+ );
+
+ // Confirm that "Ignore this warning" is visible - bug 422410
+ let buttonPresent = await checkWarningState();
+ ok(
+ !buttonPresent,
+ "Ignore warning link should be missing for unwanted software"
+ );
+});
+
+add_task(async function testPhishing() {
+ Services.prefs.setBoolPref("browser.safebrowsing.allowOverride", true);
+
+ // Now launch the phishing test
+ const url = "http://www.itisatrap.org/firefox/its-a-trap.html";
+ BrowserTestUtils.loadURIString(gBrowser.selectedBrowser, url);
+ await BrowserTestUtils.browserLoaded(
+ gBrowser.selectedBrowser,
+ false,
+ url,
+ true
+ );
+
+ let buttonPresent = await checkWarningState();
+ ok(buttonPresent, "Ignore warning link should be present for phishing");
+
+ gBrowser.removeCurrentTab();
+});