2012-05-21 15:12:37 +04:00
|
|
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
2006-05-05 00:36:16 +04:00
|
|
|
|
2012-07-28 10:25:11 +04:00
|
|
|
#ifdef MOZ_SAFE_BROWSING
|
|
|
|
var gSafeBrowsing = {
|
2006-07-06 07:50:40 +04:00
|
|
|
|
|
|
|
setReportPhishingMenu: function() {
|
2008-08-20 08:11:39 +04:00
|
|
|
// A phishing page will have a specific about:blocked content documentURI
|
2014-12-12 05:48:00 +03:00
|
|
|
var uri = gBrowser.currentURI;
|
2014-08-30 03:54:32 +04:00
|
|
|
var isPhishingPage = uri && uri.spec.startsWith("about:blocked?e=phishingBlocked");
|
2012-07-28 10:25:11 +04:00
|
|
|
|
2008-08-20 08:11:39 +04:00
|
|
|
// Show/hide the appropriate menu item.
|
|
|
|
document.getElementById("menu_HelpPopup_reportPhishingtoolmenu")
|
|
|
|
.hidden = isPhishingPage;
|
|
|
|
document.getElementById("menu_HelpPopup_reportPhishingErrortoolmenu")
|
|
|
|
.hidden = !isPhishingPage;
|
|
|
|
|
|
|
|
var broadcasterId = isPhishingPage
|
|
|
|
? "reportPhishingErrorBroadcaster"
|
|
|
|
: "reportPhishingBroadcaster";
|
|
|
|
|
|
|
|
var broadcaster = document.getElementById(broadcasterId);
|
|
|
|
if (!broadcaster)
|
|
|
|
return;
|
|
|
|
|
2008-02-26 09:48:55 +03:00
|
|
|
if (uri && (uri.schemeIs("http") || uri.schemeIs("https")))
|
|
|
|
broadcaster.removeAttribute("disabled");
|
|
|
|
else
|
2008-08-20 08:11:39 +04:00
|
|
|
broadcaster.setAttribute("disabled", true);
|
2006-07-06 07:50:40 +04:00
|
|
|
},
|
2008-02-26 09:48:55 +03:00
|
|
|
|
2006-07-06 07:50:40 +04:00
|
|
|
/**
|
2007-02-03 04:22:37 +03:00
|
|
|
* Used to report a phishing page or a false positive
|
2008-10-27 22:36:46 +03:00
|
|
|
* @param name String One of "Phish", "Error", "Malware" or "MalwareError"
|
2006-07-06 07:50:40 +04:00
|
|
|
* @return String the report phishing URL.
|
|
|
|
*/
|
2007-02-03 04:22:37 +03:00
|
|
|
getReportURL: function(name) {
|
2015-06-16 22:28:42 +03:00
|
|
|
return SafeBrowsing.getReportURL(name, gBrowser.currentURI);
|
2006-05-16 05:54:06 +04:00
|
|
|
}
|
|
|
|
}
|
2012-07-28 10:25:11 +04:00
|
|
|
#endif
|