browser/base/content/browser-safebrowsing.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 # This Source Code Form is subject to the terms of the Mozilla Public
     2 # License, v. 2.0. If a copy of the MPL was not distributed with this
     3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
     5 #ifdef MOZ_SAFE_BROWSING
     6 var gSafeBrowsing = {
     8   setReportPhishingMenu: function() {
    10     // A phishing page will have a specific about:blocked content documentURI
    11     var isPhishingPage = content.document.documentURI.startsWith("about:blocked?e=phishingBlocked");
    13     // Show/hide the appropriate menu item.
    14     document.getElementById("menu_HelpPopup_reportPhishingtoolmenu")
    15             .hidden = isPhishingPage;
    16     document.getElementById("menu_HelpPopup_reportPhishingErrortoolmenu")
    17             .hidden = !isPhishingPage;
    19     var broadcasterId = isPhishingPage
    20                         ? "reportPhishingErrorBroadcaster"
    21                         : "reportPhishingBroadcaster";
    23     var broadcaster = document.getElementById(broadcasterId);
    24     if (!broadcaster)
    25       return;
    27     var uri = getBrowser().currentURI;
    28     if (uri && (uri.schemeIs("http") || uri.schemeIs("https")))
    29       broadcaster.removeAttribute("disabled");
    30     else
    31       broadcaster.setAttribute("disabled", true);
    32   },
    34   /**
    35    * Used to report a phishing page or a false positive
    36    * @param name String One of "Phish", "Error", "Malware" or "MalwareError"
    37    * @return String the report phishing URL.
    38    */
    39   getReportURL: function(name) {
    40     var reportUrl = SafeBrowsing.getReportURL(name);
    42     var pageUri = gBrowser.currentURI.clone();
    44     // Remove the query to avoid including potentially sensitive data
    45     if (pageUri instanceof Ci.nsIURL)
    46       pageUri.query = '';
    48     reportUrl += "&url=" + encodeURIComponent(pageUri.asciiSpec);
    50     return reportUrl;
    51   }
    52 }
    53 #endif

mercurial