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