browser/components/safebrowsing/content/test/browser_bug400731.js

Wed, 31 Dec 2014 06:55:46 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:46 +0100
changeset 1
ca08bd8f51b2
permissions
-rw-r--r--

Added tag TORBROWSER_REPLICA for changeset 6474c204b198

     1 /* Check for the intended visibility of the "Ignore this warning" text*/
     3 function test() {
     4   waitForExplicitFinish();
     6   gBrowser.selectedTab = gBrowser.addTab();
     8   // Navigate to malware site.  Can't use an onload listener here since
     9   // error pages don't fire onload.  Also can't register the DOMContentLoaded
    10   // handler here because registering it too soon would mean that we might
    11   // get it for about:blank, and not about:blocked.
    12   gBrowser.addTabsProgressListener({
    13     onLocationChange: function(aTab, aWebProgress, aRequest, aLocation, aFlags) {
    14       if (aFlags & Ci.nsIWebProgressListener.LOCATION_CHANGE_ERROR_PAGE) {
    15         gBrowser.removeTabsProgressListener(this);
    16         window.addEventListener("DOMContentLoaded", testMalware, true);
    17       }
    18     }
    19   });
    20   content.location = "http://www.itisatrap.org/firefox/its-an-attack.html";
    21 }
    23 function testMalware() {
    24   window.removeEventListener("DOMContentLoaded", testMalware, true);
    26   // Confirm that "Ignore this warning" is visible - bug 422410
    27   var el = content.document.getElementById("ignoreWarningButton");
    28   ok(el, "Ignore warning button should be present for malware");
    30   var style = content.getComputedStyle(el, null);
    31   is(style.display, "inline-block", "Ignore Warning button should be display:inline-block for malware");
    33   // Now launch the phishing test
    34   window.addEventListener("DOMContentLoaded", testPhishing, true);
    35   content.location = "http://www.itisatrap.org/firefox/its-a-trap.html";
    36 }
    38 function testPhishing() {
    39   window.removeEventListener("DOMContentLoaded", testPhishing, true);
    41   var el = content.document.getElementById("ignoreWarningButton");
    42   ok(el, "Ignore warning button should be present for phishing");
    44   var style = content.getComputedStyle(el, null);
    45   is(style.display, "inline-block", "Ignore Warning button should be display:inline-block for phishing");
    47   gBrowser.removeCurrentTab();
    48   finish();
    49 }

mercurial