2012-05-21 11:12:37 +00: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-04 20:36:16 +00:00
|
|
|
|
2012-07-28 06:25:11 +00:00
|
|
|
#ifdef MOZ_SAFE_BROWSING
|
|
|
|
var gSafeBrowsing = {
|
2006-07-06 03:50:40 +00:00
|
|
|
|
|
|
|
setReportPhishingMenu: function() {
|
2012-07-28 06:25:11 +00:00
|
|
|
|
2008-08-20 04:11:39 +00:00
|
|
|
// A phishing page will have a specific about:blocked content documentURI
|
2012-09-23 19:09:29 +00:00
|
|
|
var isPhishingPage = content.document.documentURI.startsWith("about:blocked?e=phishingBlocked");
|
2012-07-28 06:25:11 +00:00
|
|
|
|
2008-08-20 04:11:39 +00: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;
|
|
|
|
|
2006-07-06 03:50:40 +00:00
|
|
|
var uri = getBrowser().currentURI;
|
2008-02-26 06:48:55 +00:00
|
|
|
if (uri && (uri.schemeIs("http") || uri.schemeIs("https")))
|
|
|
|
broadcaster.removeAttribute("disabled");
|
|
|
|
else
|
2008-08-20 04:11:39 +00:00
|
|
|
broadcaster.setAttribute("disabled", true);
|
2006-07-06 03:50:40 +00:00
|
|
|
},
|
2008-02-26 06:48:55 +00:00
|
|
|
|
2006-07-06 03:50:40 +00:00
|
|
|
/**
|
2007-02-03 01:22:37 +00:00
|
|
|
* Used to report a phishing page or a false positive
|
2008-10-27 19:36:46 +00:00
|
|
|
* @param name String One of "Phish", "Error", "Malware" or "MalwareError"
|
2006-07-06 03:50:40 +00:00
|
|
|
* @return String the report phishing URL.
|
|
|
|
*/
|
2007-02-03 01:22:37 +00:00
|
|
|
getReportURL: function(name) {
|
2012-07-28 06:25:11 +00:00
|
|
|
var reportUrl = SafeBrowsing.getReportURL(name);
|
2007-02-03 01:22:37 +00:00
|
|
|
|
2013-05-07 01:34:01 +00:00
|
|
|
var pageUri = gBrowser.currentURI.clone();
|
|
|
|
|
|
|
|
// Remove the query to avoid including potentially sensitive data
|
|
|
|
if (pageUri instanceof Ci.nsIURL)
|
|
|
|
pageUri.query = '';
|
|
|
|
|
|
|
|
reportUrl += "&url=" + encodeURIComponent(pageUri.asciiSpec);
|
2006-07-06 03:50:40 +00:00
|
|
|
|
|
|
|
return reportUrl;
|
2006-05-16 01:54:06 +00:00
|
|
|
}
|
|
|
|
}
|
2012-07-28 06:25:11 +00:00
|
|
|
#endif
|