Bug 400324 - Remove old safebrowsing 'speach bubble' UI code. r=tony, a=damons
@ -64,12 +64,6 @@ SHARED_LIBRARY_LIBS += ../shell/src/$(LIB_PREFIX)shellservice_s.$(LIB_SUFFIX) \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
ifdef MOZ_SAFE_BROWSING
|
||||
REQUIRES += safebrowsing
|
||||
LOCAL_INCLUDES += -I$(srcdir)/../safebrowsing/src
|
||||
SHARED_LIBRARY_LIBS += ../safebrowsing/src/$(LIB_PREFIX)safebrowsing_s.$(LIB_SUFFIX)
|
||||
endif
|
||||
|
||||
EXTRA_DSO_LDOPTS += \
|
||||
$(call EXPAND_LIBNAME_PATH,unicharutil_external_s,$(LIBXUL_DIST)/lib) \
|
||||
$(LIBXUL_DIST)/lib/$(LIB_PREFIX)mozreg_s.$(LIB_SUFFIX) \
|
||||
|
@ -91,12 +91,6 @@
|
||||
#define NS_ABOUTFEEDS_CID \
|
||||
{ 0x12ff56ec, 0x58be, 0x402c, { 0xb0, 0x57, 0x1, 0xf9, 0x61, 0xde, 0x96, 0x9b } }
|
||||
|
||||
#define NS_DOCNAVSTARTPROGRESSLISTENER_CID \
|
||||
{ 0x7baf8179, 0xa4fd, 0x4bc0, { 0xbe, 0x43, 0xa9, 0xb1, 0x22, 0xc5, 0xde, 0xb6 } }
|
||||
|
||||
#define NS_DOCNAVSTARTPROGRESSLISTENER_CONTRACTID \
|
||||
"@mozilla.org/browser/safebrowsing/navstartlistener;1"
|
||||
|
||||
// 6fb0c970-e1b1-11db-8314-0800200c9a66
|
||||
#define NS_PLACESIMPORTEXPORTSERVICE_CID \
|
||||
{ 0x6fb0c970, 0xe1b1, 0x11db, { 0x83, 0x14, 0x08, 0x00, 0x20, 0x0c, 0x9a, 0x66 } }
|
||||
|
@ -69,9 +69,6 @@
|
||||
#include "nsFeedSniffer.h"
|
||||
#include "nsAboutFeeds.h"
|
||||
#include "nsIAboutModule.h"
|
||||
#ifdef MOZ_SAFE_BROWSING
|
||||
#include "nsDocNavStartProgressListener.h"
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -102,9 +99,6 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsCaminoProfileMigrator)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsICabProfileMigrator)
|
||||
#endif
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsFeedSniffer)
|
||||
#ifdef MOZ_SAFE_BROWSING
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDocNavStartProgressListener)
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -142,13 +136,6 @@ static const nsModuleComponentInfo components[] =
|
||||
nsAboutFeeds::Create
|
||||
},
|
||||
|
||||
#ifdef MOZ_SAFE_BROWSING
|
||||
{ "Safe browsing document nav start progress listener",
|
||||
NS_DOCNAVSTARTPROGRESSLISTENER_CID,
|
||||
NS_DOCNAVSTARTPROGRESSLISTENER_CONTRACTID,
|
||||
nsDocNavStartProgressListenerConstructor },
|
||||
#endif
|
||||
|
||||
{ "Profile Migrator",
|
||||
NS_FIREFOX_PROFILEMIGRATOR_CID,
|
||||
NS_PROFILEMIGRATOR_CONTRACTID,
|
||||
|
@ -43,11 +43,7 @@ VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
DIRS = public src
|
||||
|
||||
ifdef ENABLE_TESTS
|
||||
DIRS += tests
|
||||
endif
|
||||
DIRS = src
|
||||
|
||||
ifneq (,$(BUILD_OFFICIAL)$(MOZILLA_OFFICIAL))
|
||||
DEFINES += -DOFFICIAL_BUILD=1
|
||||
|
@ -82,7 +82,6 @@ function PROT_Application() {
|
||||
#endif
|
||||
|
||||
// expose some classes
|
||||
this.PROT_Controller = PROT_Controller;
|
||||
this.PROT_PhishingWarden = PROT_PhishingWarden;
|
||||
this.PROT_MalwareWarden = PROT_MalwareWarden;
|
||||
|
||||
@ -93,6 +92,36 @@ function PROT_Application() {
|
||||
this.wrappedJSObject = this;
|
||||
}
|
||||
|
||||
var gInitialized = false;
|
||||
PROT_Application.prototype.initialize = function() {
|
||||
if (gInitialized)
|
||||
return;
|
||||
gInitialized = true;
|
||||
|
||||
var obs = Cc["@mozilla.org/observer-service;1"].
|
||||
getService(Ci.nsIObserverService);
|
||||
obs.addObserver(this, "xpcom-shutdown", true);
|
||||
|
||||
// XXX: move table names to a pref that we originally will download
|
||||
// from the provider (need to workout protocol details)
|
||||
this.malwareWarden = new PROT_MalwareWarden();
|
||||
this.malwareWarden.registerBlackTable("goog-malware-shavar");
|
||||
this.malwareWarden.maybeToggleUpdateChecking();
|
||||
|
||||
this.phishWarden = new PROT_PhishingWarden();
|
||||
this.phishWarden.registerBlackTable("goog-phish-shavar");
|
||||
this.phishWarden.maybeToggleUpdateChecking();
|
||||
}
|
||||
|
||||
PROT_Application.prototype.observe = function(subject, topic, data) {
|
||||
switch (topic) {
|
||||
case "xpcom-shutdown":
|
||||
this.malwareWarden.shutdown();
|
||||
this.phishWarden.shutdown();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name String The type of url to get (either Phish or Error).
|
||||
* @return String the report phishing URL (localized).
|
||||
@ -121,6 +150,8 @@ PROT_Application.prototype.getURIFlags = function(uri) {
|
||||
|
||||
PROT_Application.prototype.QueryInterface = function(iid) {
|
||||
if (iid.equals(Ci.nsISupports) ||
|
||||
iid.equals(Ci.nsISupportsWeakReference) ||
|
||||
iid.equals(Ci.nsIObserver) ||
|
||||
iid.equals(Ci.nsIAboutModule))
|
||||
return this;
|
||||
|
||||
|
@ -1,590 +0,0 @@
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is Google Safe Browsing.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Google Inc.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2006
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Fritz Schneider <fritz@google.com> (original author)
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
// There is one BrowserView per browser window, and each BrowserView
|
||||
// is responsible for keeping track of problems (phishy documents)
|
||||
// within that window. The BrowserView is also responsible for
|
||||
// figuring out what to do about such problems, for example, whether
|
||||
// the tab with a phishy page is currently showing and therefore if we
|
||||
// should be showing a warning.
|
||||
//
|
||||
// The BrowserView receives information from three places:
|
||||
//
|
||||
// - from the phishing warden. When the phishing warden notices a
|
||||
// problem, it queries all browser views to see which one (if any)
|
||||
// has the Document that is problematic. It then hands the problem
|
||||
// off to the appropriate BrowserView.
|
||||
//
|
||||
// - from the controller. The controller responds to explicit user
|
||||
// actions (tab switches, requests to hide the warning message,
|
||||
// etc.) and let's the BrowserView know about any user action
|
||||
// having to do with the problems it is tracking.
|
||||
//
|
||||
// The BrowserView associates at most one "problem" with each Document
|
||||
// in the browser window. It keeps state about which Documents are
|
||||
// problematic by storing a "problem queue" on each browser (tab).
|
||||
// At most one problematic document per browser (tab) is active
|
||||
// at any time. That is, we show the warning for at most one phishy
|
||||
// document at any one time. If another phishy doc loads in that tab,
|
||||
// it goes onto the end of the queue to be activated only when the
|
||||
// currently active document goes away.
|
||||
//
|
||||
// If we had multiple types of warnings (one for after the page had
|
||||
// loaded, one for when the user clicked a link, etc) here's where
|
||||
// we'd select the appropate one to use. As it stands, we only have
|
||||
// one displayer (an "afterload" displayer). A displayer knows _how_
|
||||
// to display a warning, whereas as the BrowserView knows _what_ and
|
||||
// _when_.
|
||||
//
|
||||
// To keep things (relatively) easy to reason about and efficient (the
|
||||
// phishwarden could be querying us inside a progresslistener
|
||||
// notification, or the controller inside an event handler), we have
|
||||
// the following rules:
|
||||
//
|
||||
// - at most one of a displayer's start() or stop() methods is called
|
||||
// in any iteration (if calling two is required, the second is run in
|
||||
// the next event loop)
|
||||
// - displayers should run their operations synchronously so we don't have
|
||||
// to look two places (here and in the displayer) to see what is happening
|
||||
// when
|
||||
// - displayer actions are run after cleaning up the browser view state
|
||||
// in case they have consequences
|
||||
//
|
||||
// TODO: this could use some redesign, but I don't have time.
|
||||
// TODO: the queue needs to be abstracted, but we want another release fast,
|
||||
// so I'm not going to touch it for the time being
|
||||
// TODO: IDN issues and canonical URLs?
|
||||
// TODO: Perhaps we should blur the page before showing a warning in order
|
||||
// to prevent stray keystrokes?
|
||||
|
||||
/**
|
||||
* The BrowerView is responsible for keeping track of and figuring out
|
||||
* what to do with problems within a single browser window.
|
||||
*
|
||||
* TODO
|
||||
* Unify all browser-related state here. Currently it's split
|
||||
* between two objects, this object and the controller. We could have
|
||||
* this object be solely responsible for UI hide/show decisions, which
|
||||
* would probably make it easier to reason about what's going on.
|
||||
*
|
||||
* TODO
|
||||
* Investigate an alternative model. For example, we could factor out
|
||||
* the problem signaling stuff from the tab/UI logic into a
|
||||
* ProblemRegistry. Attach listeners to new docs/requests as they go
|
||||
* by and have these listeners periodically check in with a
|
||||
* ProblemRegistry to see if they're watching a problematic
|
||||
* doc/request. If so, then have them flag the browser view to be
|
||||
* aware of the problem.
|
||||
*
|
||||
* @constructor
|
||||
* @param tabBrowser Reference to the main tabbrowser we'll use to query
|
||||
* for information about active tabs/browsers.
|
||||
*/
|
||||
function PROT_BrowserView(tabBrowser) {
|
||||
this.debugZone = "browserview";
|
||||
this.tabBrowser_ = tabBrowser;
|
||||
this.doc_ = this.tabBrowser_.ownerDocument;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked by the warden to give us the opportunity to handle a
|
||||
* problem. A problem is signaled once per request for a problem
|
||||
* Document and is handled at most once, so there's no issue with us
|
||||
* "losing" a problem due to multiple concurrently loading Documents
|
||||
* with the same URL.
|
||||
*
|
||||
* @param warden Reference to the warden signalling the problem. We'll
|
||||
* need him to instantiate one of his warning displayers
|
||||
*
|
||||
* @param request The nsIRequest that is problematic
|
||||
*
|
||||
* @returns Boolean indicating whether we handled problem
|
||||
*/
|
||||
PROT_BrowserView.prototype.tryToHandleProblemRequest = function(warden,
|
||||
request) {
|
||||
// XXX: pass around the URL instead of the request. request.name isn't
|
||||
// really supposed to be used and isn't guaranteed to give the URL.
|
||||
var url = request.name;
|
||||
var browsers = this.tabBrowser_.browsers;
|
||||
for (var i = 0; i < browsers.length; i++) {
|
||||
var browser = browsers[i];
|
||||
var doc = browser.contentDocument;
|
||||
|
||||
// We only care about top level documents (and not about frames)
|
||||
if (doc.location.href == url && !this.getProblem_(doc, browser)) {
|
||||
this.isProblemDocument_(browser, doc, warden);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* We're sure a particular Document is problematic, so let's instantiate
|
||||
* a dispalyer for it and add it to the problem queue for the browser.
|
||||
*
|
||||
* @param browser Reference to the browser in which the problem doc resides
|
||||
*
|
||||
* @param doc Reference to the problematic document
|
||||
*
|
||||
* @param warden Reference to the warden signalling the problem.
|
||||
*/
|
||||
PROT_BrowserView.prototype.isProblemDocument_ = function(browser,
|
||||
doc,
|
||||
warden) {
|
||||
|
||||
G_Debug(this, "Document is problem: " + doc.location.href);
|
||||
|
||||
var url = doc.location.href;
|
||||
|
||||
// We only have one type of displayer right now
|
||||
var displayer = new warden.displayers_["afterload"]("Phishing afterload",
|
||||
browser,
|
||||
this.doc_,
|
||||
url);
|
||||
|
||||
// We listen for the problematic document being navigated away from
|
||||
// so we can remove it from the problem queue
|
||||
|
||||
var hideHandler = BindToObject(this.onNavAwayFromProblem_,
|
||||
this,
|
||||
doc,
|
||||
browser);
|
||||
doc.defaultView.addEventListener("pagehide", hideHandler, true);
|
||||
|
||||
// More info than we technically need, but it comes in handy for debugging
|
||||
var problem = {
|
||||
"browser_": browser,
|
||||
"doc_": doc,
|
||||
"displayer_": displayer,
|
||||
"url_": url,
|
||||
"hideHandler_": hideHandler,
|
||||
};
|
||||
var numInQueue = this.queueProblem_(browser, problem);
|
||||
|
||||
// If the queue was empty, schedule us to take something out
|
||||
if (numInQueue == 1)
|
||||
new G_Alarm(BindToObject(this.unqueueNextProblem_, this, browser), 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked when a problematic document is navigated away from.
|
||||
*
|
||||
* @param doc Reference to the problematic Document navigated away from
|
||||
|
||||
* @param browser Reference to the browser in which the problem document
|
||||
* unloaded
|
||||
*/
|
||||
PROT_BrowserView.prototype.onNavAwayFromProblem_ = function(doc, browser) {
|
||||
|
||||
var problem = this.getProblem_(doc, browser);
|
||||
// We want to know if the user navigated away from the phish site
|
||||
// before or after viewing the warning.
|
||||
var message = problem.displayer_.messageShowing_ ? "phishnavaway"
|
||||
: "ignorenavaway";
|
||||
G_Debug(this, "User nav'd away from problem: " + message);
|
||||
(new PROT_Reporter).report(message, problem.url_);
|
||||
|
||||
G_Assert(this, doc === problem.doc_, "State doc not equal to nav away doc?");
|
||||
G_Assert(this, browser === problem.browser_,
|
||||
"State browser not equal to nav away browser?");
|
||||
|
||||
this.problemResolved(browser, doc);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param browser Reference to a browser we'd like to know about
|
||||
*
|
||||
* @returns Boolean indicating if the browser in question has
|
||||
* problematic content
|
||||
*/
|
||||
PROT_BrowserView.prototype.hasProblem = function(browser) {
|
||||
return this.hasNonemptyProblemQueue_(browser);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param browser Reference to a browser we'd like to know about
|
||||
*
|
||||
* @returns Boolean indicating if the browser in question has a
|
||||
* problem (i.e., it has a non-empty problem queue)
|
||||
*/
|
||||
PROT_BrowserView.prototype.hasNonemptyProblemQueue_ = function(browser) {
|
||||
try {
|
||||
return !!browser.PROT_problemState__ &&
|
||||
!!browser.PROT_problemState__.length;
|
||||
} catch(e) {
|
||||
// We could be checking a browser that has just been closed, in
|
||||
// which case its properties will not be valid, causing the above
|
||||
// statement to throw an error. Since this case handled elsewhere,
|
||||
// just return false.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked to indicate that the problem for a particular problematic
|
||||
* document in a browser has been resolved (e.g., by being navigated
|
||||
* away from).
|
||||
*
|
||||
* @param browser Reference to the browser in which resolution is happening
|
||||
*
|
||||
* @param opt_doc Reference to the problematic doc whose problem was resolved
|
||||
* (if absent, assumes the doc assocaited with the currently
|
||||
* active displayer)
|
||||
*/
|
||||
PROT_BrowserView.prototype.problemResolved = function(browser, opt_doc) {
|
||||
var problem;
|
||||
var doc;
|
||||
if (!!opt_doc) {
|
||||
doc = opt_doc;
|
||||
problem = this.getProblem_(doc, browser);
|
||||
} else {
|
||||
problem = this.getCurrentProblem_(browser);
|
||||
doc = problem.doc_;
|
||||
}
|
||||
|
||||
problem.displayer_.done();
|
||||
var wasHead = this.deleteProblemFromQueue_(doc, browser);
|
||||
|
||||
// Peek at the next problem (if any) in the queue for this browser
|
||||
var queueNotEmpty = this.getCurrentProblem_(browser);
|
||||
|
||||
if (wasHead && queueNotEmpty) {
|
||||
G_Debug(this, "More problems pending. Scheduling unqueue.");
|
||||
new G_Alarm(BindToObject(this.unqueueNextProblem_, this, browser), 0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Peek at the top of the problem queue and if there's something there,
|
||||
* make it active.
|
||||
*
|
||||
* @param browser Reference to the browser we should activate a problem
|
||||
* displayer in if one is available
|
||||
*/
|
||||
PROT_BrowserView.prototype.unqueueNextProblem_ = function(browser) {
|
||||
var problem = this.getCurrentProblem_(browser);
|
||||
if (!problem) {
|
||||
G_Debug(this, "No problem in queue; doc nav'd away from? (shrug)");
|
||||
return;
|
||||
}
|
||||
|
||||
// Two problem docs that load in rapid succession could both schedule
|
||||
// themselves to be unqueued before this method is called. So ensure
|
||||
// that the problem at the head of the queue is not, in fact, active.
|
||||
if (!problem.displayer_.isActive()) {
|
||||
|
||||
// It could be the case that the server is really slow to respond,
|
||||
// so there might not yet be anything in the problem Document. If
|
||||
// we show the warning when that's the case, the user will see a
|
||||
// blank document greyed out, and if they cancel the dialog
|
||||
// they'll see the page they're navigating away from because it
|
||||
// hasn't been painted over yet (b/c there's no content for the
|
||||
// problem page). So here we ensure that we have content for the
|
||||
// problem page before showing the dialog.
|
||||
var haveContent = false;
|
||||
try {
|
||||
// This will throw if there's no content yet
|
||||
var h = problem.doc_.defaultView.getComputedStyle(problem.doc_.body, "")
|
||||
.getPropertyValue("height");
|
||||
G_Debug(this, "body height: " + h);
|
||||
|
||||
if (Number(h.substring(0, h.length - 2)))
|
||||
haveContent = true;
|
||||
|
||||
} catch (e) {
|
||||
G_Debug(this, "Masked in unqueuenextproblem: " + e);
|
||||
}
|
||||
|
||||
if (!haveContent) {
|
||||
|
||||
G_Debug(this, "Didn't get computed style. Re-queueing.");
|
||||
|
||||
// One stuck problem document in a page shouldn't prevent us
|
||||
// warning on other problem frames that might be loading or
|
||||
// loaded. So stick the Document that doesn't have content
|
||||
// back at the end of the queue.
|
||||
var p = this.removeProblemFromQueue_(problem.doc_, browser);
|
||||
G_Assert(this, p === problem, "Unqueued wrong problem?");
|
||||
this.queueProblem_(browser, problem);
|
||||
|
||||
// Try again in a bit. This opens us up to a potential
|
||||
// vulnerability (put tons of hanging frames in a page
|
||||
// ahead of your real phishy frame), but the risk at the
|
||||
// moment is really low (plus it is outside our threat
|
||||
// model).
|
||||
new G_Alarm(BindToObject(this.unqueueNextProblem_,
|
||||
this,
|
||||
browser),
|
||||
200 /*ms*/);
|
||||
return;
|
||||
}
|
||||
|
||||
problem.displayer_.start();
|
||||
|
||||
// OK, we have content, but there there is an additional
|
||||
// issue. Due to a bfcache bug, if we show the warning during
|
||||
// paint suppression, the collapsing of the content pane affects
|
||||
// the doc we're naving from :( The symptom is a page with grey
|
||||
// screen on navigation to or from a phishing page (the
|
||||
// contentDocument will have width zero).
|
||||
//
|
||||
// Paint supression lasts at most 250ms from when the parser sees
|
||||
// the body, and the parser sees the body well before it has a
|
||||
// height. We err on the side of caution.
|
||||
//
|
||||
// Thanks to bryner for helping to track the bfcache bug down.
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=319646
|
||||
|
||||
if (this.tabBrowser_.selectedBrowser === browser)
|
||||
new G_Alarm(BindToObject(this.problemBrowserMaybeSelected,
|
||||
this,
|
||||
browser),
|
||||
350 /*ms*/);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function that adds a new problem to the queue of problems pending
|
||||
* on this browser.
|
||||
*
|
||||
* @param browser Browser to which we should add state
|
||||
*
|
||||
* @param problem Object (structure, really) encapsulating the problem
|
||||
*
|
||||
* @returns Number indicating the number of items in the queue (and from
|
||||
* which you can infer whether the recently added item was
|
||||
* placed at the head, and hence should be active.
|
||||
*/
|
||||
PROT_BrowserView.prototype.queueProblem_ = function(browser, problem) {
|
||||
G_Debug(this, "Adding problem state for " + problem.url_);
|
||||
|
||||
if (this.hasNonemptyProblemQueue_(browser))
|
||||
G_Debug(this, "Already has problem state. Queueing this problem...");
|
||||
|
||||
// First problem ever signaled on this browser? Make a new queue!
|
||||
if (browser.PROT_problemState__ == undefined)
|
||||
browser.PROT_problemState__ = [];
|
||||
|
||||
browser.PROT_problemState__.push(problem);
|
||||
return browser.PROT_problemState__.length;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function that removes a problem from the queue and deactivates
|
||||
* it.
|
||||
*
|
||||
* @param doc Reference to the doc for which we should remove state
|
||||
*
|
||||
* @param browser Reference to the browser from which we should remove
|
||||
* state
|
||||
*
|
||||
* @returns Boolean indicating if the remove problem was currently active
|
||||
* (that is, if it was at the head of the queue)
|
||||
*/
|
||||
PROT_BrowserView.prototype.deleteProblemFromQueue_ = function(doc, browser) {
|
||||
G_Debug(this, "Deleting problem state for " + browser);
|
||||
G_Assert(this, !!this.hasNonemptyProblemQueue_(browser),
|
||||
"Browser has no problem state");
|
||||
|
||||
var problem = this.getProblem_(doc, browser);
|
||||
G_Assert(this, !!problem, "Couldnt find state in removeproblemstate???");
|
||||
|
||||
var wasHead = browser.PROT_problemState__[0] === problem;
|
||||
this.removeProblemFromQueue_(doc, browser);
|
||||
|
||||
var hideHandler = problem.hideHandler_;
|
||||
G_Assert(this, !!hideHandler, "No hidehandler in state?");
|
||||
problem.doc_.defaultView.removeEventListener("pagehide",
|
||||
hideHandler,
|
||||
true);
|
||||
return wasHead;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function that removes a problem from the queue but does
|
||||
* NOT deactivate it.
|
||||
*
|
||||
* @param doc Reference to the doc for which we should remove state
|
||||
*
|
||||
* @param browser Reference to the browser from which we should remove
|
||||
* state
|
||||
*
|
||||
* @returns Boolean indicating if the remove problem was currently active
|
||||
* (that is, if it was at the head of the queue)
|
||||
*/
|
||||
PROT_BrowserView.prototype.removeProblemFromQueue_ = function(doc, browser) {
|
||||
G_Debug(this, "Removing problem state for " + browser);
|
||||
G_Assert(this, !!this.hasNonemptyProblemQueue_(browser),
|
||||
"Browser has no problem state");
|
||||
|
||||
var problem = null;
|
||||
// TODO Blech. Let's please have an abstraction here instead.
|
||||
for (var i = 0; i < browser.PROT_problemState__.length; i++)
|
||||
if (browser.PROT_problemState__[i].doc_ === doc) {
|
||||
problem = browser.PROT_problemState__.splice(i, 1)[0];
|
||||
break;
|
||||
}
|
||||
return problem;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve (but do not remove) the problem state for a particular
|
||||
* problematic Document in this browser
|
||||
*
|
||||
* @param doc Reference to the problematic doc to get state for
|
||||
*
|
||||
* @param browser Reference to the browser from which to get state
|
||||
*
|
||||
* @returns Object encapsulating the state we stored, or null if none
|
||||
*/
|
||||
PROT_BrowserView.prototype.getProblem_ = function(doc, browser) {
|
||||
if (!this.hasNonemptyProblemQueue_(browser))
|
||||
return null;
|
||||
|
||||
// TODO Blech. Let's please have an abstraction here instead.
|
||||
for (var i = 0; i < browser.PROT_problemState__.length; i++)
|
||||
if (browser.PROT_problemState__[i].doc_ === doc)
|
||||
return browser.PROT_problemState__[i];
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the problem state for the currently active problem Document
|
||||
* in this browser
|
||||
*
|
||||
* @param browser Reference to the browser from which to get state
|
||||
*
|
||||
* @returns Object encapsulating the state we stored, or null if none
|
||||
*/
|
||||
PROT_BrowserView.prototype.getCurrentProblem_ = function(browser) {
|
||||
return browser.PROT_problemState__[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked by the controller when the user switches tabs away from a problem
|
||||
* tab.
|
||||
*
|
||||
* @param browser Reference to the tab that was switched from
|
||||
*/
|
||||
PROT_BrowserView.prototype.problemBrowserUnselected = function(browser) {
|
||||
var problem = this.getCurrentProblem_(browser);
|
||||
G_Assert(this, !!problem, "Couldn't get state from browser");
|
||||
problem.displayer_.browserUnselected();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if the problem browser is selected, and if so,
|
||||
* tell it it to show its warning.
|
||||
*
|
||||
* @param browser Reference to the browser we wish to check
|
||||
*/
|
||||
PROT_BrowserView.prototype.problemBrowserMaybeSelected = function(browser) {
|
||||
var problem = this.getCurrentProblem_(browser);
|
||||
|
||||
if (this.tabBrowser_.selectedBrowser === browser &&
|
||||
problem &&
|
||||
problem.displayer_.isActive())
|
||||
this.problemBrowserSelected(browser);
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked by the controller when the user switches tabs to a problem tab
|
||||
*
|
||||
* @param browser Reference to the tab that was switched to
|
||||
*/
|
||||
PROT_BrowserView.prototype.problemBrowserSelected = function(browser) {
|
||||
G_Debug(this, "Problem browser selected");
|
||||
var problem = this.getCurrentProblem_(browser);
|
||||
G_Assert(this, !!problem, "No state? But we're selected!");
|
||||
problem.displayer_.browserSelected();
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked by the controller when the user accepts our warning. Passes
|
||||
* the accept through to the message displayer, which knows what to do
|
||||
* (it will be displayer-specific).
|
||||
*
|
||||
* @param browser Reference to the browser for which the user accepted
|
||||
* our warning
|
||||
*/
|
||||
PROT_BrowserView.prototype.acceptAction = function(browser) {
|
||||
var problem = this.getCurrentProblem_(browser);
|
||||
|
||||
// We run the action only after we're completely through processing
|
||||
// this event. We do this because the action could cause state to be
|
||||
// cleared (e.g., by navigating the problem document) that we need
|
||||
// to finish processing the event.
|
||||
|
||||
new G_Alarm(BindToObject(problem.displayer_.acceptAction,
|
||||
problem.displayer_),
|
||||
0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked by the controller when the user declines our
|
||||
* warning. Passes the decline through to the message displayer, which
|
||||
* knows what to do (it will be displayer-specific).
|
||||
*
|
||||
* @param browser Reference to the browser for which the user declined
|
||||
* our warning
|
||||
*/
|
||||
PROT_BrowserView.prototype.declineAction = function(browser) {
|
||||
var problem = this.getCurrentProblem_(browser);
|
||||
G_Assert(this, !!problem, "User declined but no state???");
|
||||
|
||||
// We run the action only after we're completely through processing
|
||||
// this event. We do this because the action could cause state to be
|
||||
// cleared (e.g., by navigating the problem document) that we need
|
||||
// to finish processing the event.
|
||||
|
||||
new G_Alarm(BindToObject(problem.displayer_.declineAction,
|
||||
problem.displayer_),
|
||||
0);
|
||||
}
|
||||
|
||||
/**
|
||||
* The user wants to see the warning message. So let em! At some point when
|
||||
* we have multiple types of warnings, we'll have to mediate them here.
|
||||
*
|
||||
* @param browser Reference to the browser that has the warning the user
|
||||
* wants to see.
|
||||
*/
|
||||
PROT_BrowserView.prototype.explicitShow = function(browser) {
|
||||
var problem = this.getCurrentProblem_(browser);
|
||||
G_Assert(this, !!problem, "Explicit show on browser w/o problem state???");
|
||||
problem.displayer_.explicitShow();
|
||||
}
|
@ -1,203 +0,0 @@
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is Google Safe Browsing.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Google Inc.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2006
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Fritz Schneider <fritz@google.com> (original author)
|
||||
# Simon Bünzli <zeniko@gmail.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
|
||||
// This is our controller -- the thingy that listens to what the user
|
||||
// is doing. There is one controller per browser window, and each has
|
||||
// a BrowserView that manages information about problems within the
|
||||
// window. The controller figures out when the browser might want to
|
||||
// know about something, but the browser view figures out what exactly
|
||||
// to do (and the BrowserView's displayer figures out how to do it).
|
||||
//
|
||||
// For example, the controller might notice that the user has switched
|
||||
// to a tab that has something problematic in it. It would tell its
|
||||
// BrowserView this, and the BrowserView would figure out whether it
|
||||
// is appropriate to show a warning (e.g., perhaps the user previously
|
||||
// dismissed the warning for that problem). If so, the BrowserView tells
|
||||
// the displayer to show the warning. Anyhoo...
|
||||
//
|
||||
// TODO Could move all browser-related hide/show logic into the browser
|
||||
// view. Need to think about this more.
|
||||
|
||||
/**
|
||||
* Handles user actions, translating them into messages to the view
|
||||
*
|
||||
* @constructor
|
||||
* @param win Reference to the Window (browser window context) we should
|
||||
* attach to
|
||||
* @param tabBrowser Reference to the window's main tabbrowser object.
|
||||
* @param phishingWarden Reference to the PhishingWarden we should register
|
||||
* our browserview with
|
||||
*/
|
||||
function PROT_Controller(win, tabBrowser, phishingWarden) {
|
||||
this.debugZone = "controller";
|
||||
|
||||
this.win_ = win;
|
||||
this.phishingWarden_ = phishingWarden;
|
||||
|
||||
// Use this to query preferences
|
||||
this.prefs_ = new G_Preferences();
|
||||
|
||||
// Set us up to receive the events we want.
|
||||
this.tabBrowser_ = tabBrowser;
|
||||
this.onTabSwitchClosure_ = BindToObject(this.onTabSwitch, this);
|
||||
this.tabBrowser_.mTabBox.addEventListener("select", this.onTabSwitchClosure_, true);
|
||||
|
||||
// Used to determine when the user has switched tabs
|
||||
this.lastTab_ = tabBrowser.selectedBrowser;
|
||||
|
||||
// Install our command controllers. These commands are issued from
|
||||
// various places in our UI, including our preferences dialog, the
|
||||
// warning dialog, etc.
|
||||
var commandHandlers = {
|
||||
"safebrowsing-show-warning" :
|
||||
BindToObject(this.onUserShowWarning, this),
|
||||
"safebrowsing-accept-warning" :
|
||||
BindToObject(this.onUserAcceptWarning, this),
|
||||
"safebrowsing-decline-warning" :
|
||||
BindToObject(this.onUserDeclineWarning, this),
|
||||
};
|
||||
|
||||
this.commandController_ = new PROT_CommandController(commandHandlers);
|
||||
this.win_.controllers.appendController(this.commandController_);
|
||||
|
||||
// This guy embodies the logic of when to display warnings
|
||||
// (displayers embody the how).
|
||||
this.browserView_ = new PROT_BrowserView(this.tabBrowser_);
|
||||
|
||||
G_Debug(this, "Controller initialized.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked when the browser window is closing. Do some cleanup.
|
||||
*/
|
||||
PROT_Controller.prototype.shutdown = function(e) {
|
||||
G_Debug(this, "Browser window closing. Shutting controller down.");
|
||||
|
||||
if (this.commandController_) {
|
||||
this.win_.controllers.removeController(this.commandController_);
|
||||
this.commandController_ = null;
|
||||
}
|
||||
|
||||
// No need to drain the browser view's problem queue explicitly; it will
|
||||
// receive pagehides for all the browsers in its queues as they're torn
|
||||
// down, and it will remove them.
|
||||
this.browserView_ = null;
|
||||
|
||||
if (this.tabBrowser_)
|
||||
this.tabBrowser_.mTabBox.removeEventListener("select", this.onTabSwitchClosure_, true);
|
||||
// Break circular refs so we can be gc'ed.
|
||||
this.tabBrowser_ = this.lastTab_ = null;
|
||||
|
||||
this.win_.removeEventListener("unload", this.onShutdown_, false);
|
||||
this.prefs_ = null;
|
||||
|
||||
G_Debug(this, "Controller shut down.");
|
||||
}
|
||||
|
||||
/**
|
||||
* The user clicked the urlbar icon; they want to see the warning message
|
||||
* again.
|
||||
*/
|
||||
PROT_Controller.prototype.onUserShowWarning = function() {
|
||||
var browser = this.tabBrowser_.selectedBrowser;
|
||||
this.browserView_.explicitShow(browser);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deal with a user accepting our warning.
|
||||
*
|
||||
* TODO the warning hide/display instructions here can probably be moved
|
||||
* into the browserview in the future, given its knowledge of when the
|
||||
* problem doc hides/shows.
|
||||
*/
|
||||
PROT_Controller.prototype.onUserAcceptWarning = function() {
|
||||
G_Debug(this, "User accepted warning.");
|
||||
var browser = this.tabBrowser_.selectedBrowser;
|
||||
G_Assert(this, !!browser, "Couldn't get current browser?!?");
|
||||
G_Assert(this, this.browserView_.hasProblem(browser),
|
||||
"User accept fired, but browser doesn't have warning showing?!?");
|
||||
|
||||
this.browserView_.acceptAction(browser);
|
||||
this.browserView_.problemResolved(browser);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deal with a user declining our warning.
|
||||
*
|
||||
* TODO the warning hide/display instructions here can probably be moved
|
||||
* into the browserview in the future, given its knowledge of when the
|
||||
* problem doc hides/shows.
|
||||
*/
|
||||
PROT_Controller.prototype.onUserDeclineWarning = function() {
|
||||
G_Debug(this, "User declined warning.");
|
||||
var browser = this.tabBrowser_.selectedBrowser;
|
||||
G_Assert(this, this.browserView_.hasProblem(browser),
|
||||
"User decline fired, but browser doesn't have warning showing?!?");
|
||||
this.browserView_.declineAction(browser);
|
||||
// We don't call problemResolved() here because all declining does it
|
||||
// hide the message; we still have the urlbar icon showing, giving
|
||||
// the user the ability to bring the warning message back up if they
|
||||
// so desire.
|
||||
}
|
||||
|
||||
/**
|
||||
* Notice tab switches, and display or hide warnings as appropriate.
|
||||
*
|
||||
* TODO this logic can probably move into the browser view at some
|
||||
* point. But one thing at a time.
|
||||
*/
|
||||
PROT_Controller.prototype.onTabSwitch = function(e) {
|
||||
// Filter spurious events
|
||||
// The event target is usually tabs but can be tabpanels when tabs were opened
|
||||
// programatically via tabbrowser.addTab().
|
||||
if (!e.target || (e.target.localName != "tabs" && e.target.localName != "tabpanels"))
|
||||
return;
|
||||
|
||||
var fromBrowser = this.lastTab_;
|
||||
var toBrowser = this.tabBrowser_.selectedBrowser;
|
||||
|
||||
if (fromBrowser != toBrowser) {
|
||||
this.lastTab_ = toBrowser;
|
||||
|
||||
if (this.browserView_.hasProblem(fromBrowser))
|
||||
this.browserView_.problemBrowserUnselected(fromBrowser);
|
||||
|
||||
if (this.browserView_.hasProblem(toBrowser))
|
||||
this.browserView_.problemBrowserSelected(toBrowser);
|
||||
}
|
||||
}
|
@ -1,83 +0,0 @@
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is Google Safe Browsing.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Google Inc.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2006
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Fritz Schneider <fritz@google.com> (original author)
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
|
||||
// Some misc command-related plumbing used by the controller.
|
||||
|
||||
|
||||
/**
|
||||
* A tiny wrapper class for super-simple command handlers.
|
||||
*
|
||||
* @param commandHandlerMap An object containing name/value pairs where
|
||||
* the name is command name (string) and value
|
||||
* is the function to execute for that command
|
||||
*/
|
||||
function PROT_CommandController(commandHandlerMap) {
|
||||
this.debugZone = "commandhandler";
|
||||
this.cmds_ = commandHandlerMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cmd Command to query support for
|
||||
* @returns Boolean indicating if this controller supports cmd
|
||||
*/
|
||||
PROT_CommandController.prototype.supportsCommand = function(cmd) {
|
||||
return (cmd in this.cmds_);
|
||||
}
|
||||
|
||||
/**
|
||||
* Trivial implementation
|
||||
*
|
||||
* @param cmd Command to query status of
|
||||
*/
|
||||
PROT_CommandController.prototype.isCommandEnabled = function(cmd) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute a command
|
||||
*
|
||||
* @param cmd Command to execute
|
||||
*/
|
||||
PROT_CommandController.prototype.doCommand = function(cmd) {
|
||||
return this.cmds_[cmd]();
|
||||
}
|
||||
|
||||
/**
|
||||
* Trivial implementation
|
||||
*/
|
||||
PROT_CommandController.prototype.onEvent = function(cmd) { }
|
||||
|
@ -18,8 +18,7 @@
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Niels Provos <niels@google.com> (original author)d
|
||||
|
||||
# Niels Provos <niels@google.com> (original author)
|
||||
# Fritz Schneider <fritz@google.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
|
@ -1,716 +0,0 @@
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is Google Safe Browsing.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Google Inc.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2006
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Fritz Schneider <fritz@google.com> (original author)
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
|
||||
// Implementation of the warning message we show users when we
|
||||
// notice navigation to a phishing page after it has loaded. The
|
||||
// browser view encapsulates all the hide/show logic, so the displayer
|
||||
// doesn't need to know when to display itself, only how.
|
||||
//
|
||||
// Displayers implement the following interface:
|
||||
//
|
||||
// start() -- fired to initialize the displayer (to make it active). When
|
||||
// called, this displayer starts listening for and responding to
|
||||
// events. At most one displayer per tab should be active at a
|
||||
// time, and start() should be called at most once.
|
||||
// declineAction() -- fired when the user declines the warning.
|
||||
// acceptAction() -- fired when the user declines the warning
|
||||
// explicitShow() -- fired when the user wants to see the warning again
|
||||
// browserSelected() -- the browser is the top tab
|
||||
// browserUnselected() -- the browser is no long the top tab
|
||||
// done() -- clean up. May be called once (even if the displayer wasn't
|
||||
// activated).
|
||||
//
|
||||
// At the moment, all displayers share access to the same xul in
|
||||
// safebrowsing-overlay.xul. Hence the need for at most one displayer
|
||||
// to be active per tab at a time.
|
||||
|
||||
/**
|
||||
* Factory that knows how to create a displayer appropriate to the
|
||||
* user's platform. We use a clunky canvas-based displayer for all
|
||||
* platforms until such time as we can overlay semi-transparent
|
||||
* areas over browser content.
|
||||
*
|
||||
* See the base object for a description of the constructor args
|
||||
*
|
||||
* @constructor
|
||||
*/
|
||||
function PROT_PhishMsgDisplayer(msgDesc, browser, doc, url) {
|
||||
|
||||
// TODO: Change this to return a PhishMsgDisplayerTransp on windows
|
||||
// (and maybe other platforms) when Firefox 2.0 hits.
|
||||
|
||||
return new PROT_PhishMsgDisplayerCanvas(msgDesc, browser, doc, url);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Base class that implements most of the plumbing required to hide
|
||||
* and show a phishing warning. Subclasses implement the actual
|
||||
* showMessage and hideMessage methods.
|
||||
*
|
||||
* This class is not meant to be instantiated directly.
|
||||
*
|
||||
* @param msgDesc String describing the kind of warning this is
|
||||
* @param browser Reference to the browser over which we display the msg
|
||||
* @param doc Reference to the document in which browser is found
|
||||
* @param url String containing url of the problem document
|
||||
* @constructor
|
||||
*/
|
||||
function PROT_PhishMsgDisplayerBase(msgDesc, browser, doc, url) {
|
||||
this.debugZone = "phishdisplayer";
|
||||
this.msgDesc_ = msgDesc; // currently unused
|
||||
this.browser_ = browser;
|
||||
this.doc_ = doc;
|
||||
this.url_ = url;
|
||||
|
||||
// We'll need to manipulate the XUL in safebrowsing-overlay.xul
|
||||
this.messageId_ = "safebrowsing-palm-message";
|
||||
this.messageTailId_ = "safebrowsing-palm-message-tail-container";
|
||||
this.messageContentId_ = "safebrowsing-palm-message-content";
|
||||
this.extendedMessageId_ = "safebrowsing-palm-extended-message";
|
||||
this.showmoreLinkId_ = "safebrowsing-palm-showmore-link";
|
||||
this.faqLinkId_ = "safebrowsing-palm-faq-link";
|
||||
this.urlbarIconId_ = "safebrowsing-urlbar-icon";
|
||||
this.refElementId_ = this.urlbarIconId_;
|
||||
|
||||
// We use this to report user actions to the server
|
||||
this.reporter_ = new PROT_Reporter();
|
||||
|
||||
// The active UI elements in our warning send these commands; bind them
|
||||
// to their handlers but don't register the commands until we start
|
||||
// (because another displayer might be active)
|
||||
this.commandHandlers_ = {
|
||||
"safebrowsing-palm-showmore":
|
||||
BindToObject(this.showMore_, this),
|
||||
};
|
||||
|
||||
this.windowWatcher_ =
|
||||
Components.classes["@mozilla.org/embedcomp/window-watcher;1"]
|
||||
.getService(Components.interfaces.nsIWindowWatcher);
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns The default background color of the browser
|
||||
*/
|
||||
PROT_PhishMsgDisplayerBase.prototype.getBackgroundColor_ = function() {
|
||||
var pref = Components.classes["@mozilla.org/preferences-service;1"].
|
||||
getService(Components.interfaces.nsIPrefBranch);
|
||||
return pref.getCharPref("browser.display.background_color");
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the user declines our warning. Report it!
|
||||
*/
|
||||
PROT_PhishMsgDisplayerBase.prototype.declineAction = function() {
|
||||
G_Debug(this, "User declined warning.");
|
||||
G_Assert(this, this.started_, "Decline on a non-active displayer?");
|
||||
this.reporter_.report("phishdecline", this.url_);
|
||||
|
||||
this.messageShouldShow_ = false;
|
||||
if (this.messageShowing_)
|
||||
this.hideMessage_();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the user accepts our warning
|
||||
*/
|
||||
PROT_PhishMsgDisplayerBase.prototype.acceptAction = function() {
|
||||
G_Assert(this, this.started_, "Accept on an unstarted displayer?");
|
||||
G_Assert(this, this.done_, "Accept on a finished displayer?");
|
||||
G_Debug(this, "User accepted warning.");
|
||||
this.reporter_.report("phishaccept", this.url_);
|
||||
|
||||
var url = this.getMeOutOfHereUrl_();
|
||||
this.browser_.loadURI(url);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the url for "Get me out of here." This is the browser's default home
|
||||
* page, or, about:blank.
|
||||
* @return String url
|
||||
*/
|
||||
PROT_PhishMsgDisplayerBase.prototype.getMeOutOfHereUrl_ = function() {
|
||||
// Try to get their homepage from prefs.
|
||||
var prefs = Cc["@mozilla.org/preferences-service;1"]
|
||||
.getService(Ci.nsIPrefService).getDefaultBranch(null);
|
||||
|
||||
var url = "about:blank";
|
||||
try {
|
||||
url = prefs.getComplexValue("browser.startup.homepage",
|
||||
Ci.nsIPrefLocalizedString).data;
|
||||
// If url is a pipe-delimited set of pages, just take the first one.
|
||||
// This will need to change once bug 221445 is fixed.
|
||||
if (url.indexOf("|") != -1)
|
||||
url = url.split("|")[0];
|
||||
} catch(e) {
|
||||
G_Debug(this, "Couldn't get homepage pref: " + e);
|
||||
}
|
||||
|
||||
return url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked when the browser is resized
|
||||
*/
|
||||
PROT_PhishMsgDisplayerBase.prototype.onBrowserResized_ = function(event) {
|
||||
G_Debug(this, "Got resize for " + event.target);
|
||||
|
||||
if (this.messageShowing_) {
|
||||
this.hideMessage_();
|
||||
this.showMessage_();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked by the browser view when our browser is switched to
|
||||
*/
|
||||
PROT_PhishMsgDisplayerBase.prototype.browserSelected = function() {
|
||||
G_Assert(this, this.started_, "Displayer selected before being started???");
|
||||
|
||||
// If messageshowing hasn't been set, then this is the first time this
|
||||
// problematic browser tab has been on top, so do our setup and show
|
||||
// the warning.
|
||||
if (this.messageShowing_ === undefined) {
|
||||
this.messageShouldShow_ = true;
|
||||
}
|
||||
|
||||
this.addWarningInUrlbar_(); // Goes away when we are unselected or unloaded
|
||||
|
||||
// messageShouldShow might be false if the user dismissed the warning,
|
||||
// switched tabs, and then switched back. We're still active, but don't
|
||||
// want to show the warning again. The user can cause it to show by
|
||||
// clicking our icon in the urlbar.
|
||||
if (this.messageShouldShow_)
|
||||
this.showMessage_();
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked to display the warning message explicitly, for example if the user
|
||||
* clicked the url warning icon.
|
||||
*/
|
||||
PROT_PhishMsgDisplayerBase.prototype.explicitShow = function() {
|
||||
this.messageShouldShow_ = true;
|
||||
if (!this.messageShowing_)
|
||||
this.showMessage_();
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked by the browser view when our browser is switched away from
|
||||
*/
|
||||
PROT_PhishMsgDisplayerBase.prototype.browserUnselected = function() {
|
||||
this.removeWarningInUrlbar_();
|
||||
if (this.messageShowing_)
|
||||
this.hideMessage_();
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked to make this displayer active. The displayer will now start
|
||||
* responding to notifications such as commands and resize events. We
|
||||
* can't do this in the constructor because there might be many
|
||||
* displayers instantiated waiting in the problem queue for a particular
|
||||
* browser (e.g., a page has multiple framed problem pages), and we
|
||||
* don't want them all responding to commands!
|
||||
*
|
||||
* Invoked zero (the page we're a warning for was nav'd away from
|
||||
* before it reaches the head of the problem queue) or one (we're
|
||||
* displaying this warning) times by the browser view.
|
||||
*/
|
||||
PROT_PhishMsgDisplayerBase.prototype.start = function() {
|
||||
G_Assert(this, this.started_ == undefined, "Displayer started twice?");
|
||||
this.started_ = true;
|
||||
|
||||
this.commandController_ = new PROT_CommandController(this.commandHandlers_);
|
||||
this.doc_.defaultView.controllers.appendController(this.commandController_);
|
||||
|
||||
// Add an event listener for when the browser resizes (e.g., user
|
||||
// shows/hides the sidebar).
|
||||
this.resizeHandler_ = BindToObject(this.onBrowserResized_, this);
|
||||
this.browser_.addEventListener("resize",
|
||||
this.resizeHandler_,
|
||||
false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns Boolean indicating whether this displayer is currently
|
||||
* active
|
||||
*/
|
||||
PROT_PhishMsgDisplayerBase.prototype.isActive = function() {
|
||||
return !!this.started_;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked by the browser view to clean up after the user is done
|
||||
* interacting with the message. Should be called once by the browser
|
||||
* view.
|
||||
*/
|
||||
PROT_PhishMsgDisplayerBase.prototype.done = function() {
|
||||
G_Assert(this, !this.done_, "Called done more than once?");
|
||||
this.done_ = true;
|
||||
|
||||
// If the Document we're showing the warning for was nav'd away from
|
||||
// before we had a chance to get started, we have nothing to do.
|
||||
if (this.started_) {
|
||||
|
||||
// If we were started, we must be the current problem, so these things
|
||||
// must be showing
|
||||
this.removeWarningInUrlbar_();
|
||||
|
||||
// Could be though that they've closed the warning dialog
|
||||
if (this.messageShowing_)
|
||||
this.hideMessage_();
|
||||
|
||||
if (this.resizeHandler_) {
|
||||
this.browser_.removeEventListener("resize",
|
||||
this.resizeHandler_,
|
||||
false);
|
||||
this.resizeHandler_ = null;
|
||||
}
|
||||
|
||||
var win = this.doc_.defaultView;
|
||||
win.controllers.removeController(this.commandController_);
|
||||
this.commandController_ = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to remove a substring from inside a string.
|
||||
*
|
||||
* @param orig String to remove substring from
|
||||
*
|
||||
* @param toRemove String to remove (if it is present)
|
||||
*
|
||||
* @returns String with the substring removed
|
||||
*/
|
||||
PROT_PhishMsgDisplayerBase.prototype.removeIfExists_ = function(orig,
|
||||
toRemove) {
|
||||
var pos = orig.indexOf(toRemove);
|
||||
if (pos != -1)
|
||||
orig = orig.substring(0, pos) + orig.substring(pos + toRemove.length);
|
||||
|
||||
return orig;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method makes our warning icon visible in the location bar. It will
|
||||
* be removed only when the problematic document is navigated awy from
|
||||
* (i.e., when done() is called), and not when the warning is dismissed.
|
||||
*/
|
||||
PROT_PhishMsgDisplayerBase.prototype.addWarningInUrlbar_ = function() {
|
||||
var urlbarIcon = this.doc_.getElementById(this.urlbarIconId_);
|
||||
if (!urlbarIcon)
|
||||
return;
|
||||
urlbarIcon.setAttribute('level', 'warn');
|
||||
}
|
||||
|
||||
/**
|
||||
* Hides our urlbar icon
|
||||
*/
|
||||
PROT_PhishMsgDisplayerBase.prototype.removeWarningInUrlbar_ = function() {
|
||||
var urlbarIcon = this.doc_.getElementById(this.urlbarIconId_);
|
||||
if (!urlbarIcon)
|
||||
return;
|
||||
urlbarIcon.setAttribute('level', 'safe');
|
||||
}
|
||||
|
||||
/**
|
||||
* VIRTUAL -- Displays the warning message
|
||||
*/
|
||||
PROT_PhishMsgDisplayerBase.prototype.showMessage_ = function() { };
|
||||
|
||||
/**
|
||||
* VIRTUAL -- Hide the warning message from the user.
|
||||
*/
|
||||
PROT_PhishMsgDisplayerBase.prototype.hideMessage_ = function() { };
|
||||
|
||||
/**
|
||||
* Reposition the message relative to refElement in the parent window
|
||||
*
|
||||
* @param message Reference to the element to position
|
||||
* @param tail Reference to the message tail
|
||||
* @param refElement Reference to element relative to which we position
|
||||
* ourselves
|
||||
*/
|
||||
PROT_PhishMsgDisplayerBase.prototype.adjustLocation_ = function(message,
|
||||
tail,
|
||||
refElement) {
|
||||
var refX = refElement.boxObject.x;
|
||||
var refY = refElement.boxObject.y;
|
||||
var refHeight = refElement.boxObject.height;
|
||||
var refWidth = refElement.boxObject.width;
|
||||
G_Debug(this, "Ref element is at [window-relative] (" + refX + ", " +
|
||||
refY + ")");
|
||||
|
||||
var pixelsIntoRefY = -2;
|
||||
var tailY = refY + refHeight - pixelsIntoRefY;
|
||||
var tailPixelsLeftOfRefX = tail.boxObject.width;
|
||||
var tailPixelsIntoRefX = Math.round(refWidth / 2);
|
||||
var tailX = refX - tailPixelsLeftOfRefX + tailPixelsIntoRefX;
|
||||
|
||||
// Move message up a couple pixels so the tail overlaps it.
|
||||
var messageY = tailY + tail.boxObject.height - 2;
|
||||
var messagePixelsLeftOfRefX = 375;
|
||||
var messageX = refX - messagePixelsLeftOfRefX;
|
||||
G_Debug(this, "Message is at [window-relative] (" + messageX + ", " +
|
||||
messageY + ")");
|
||||
G_Debug(this, "Tail is at [window-relative] (" + tailX + ", " +
|
||||
tailY + ")");
|
||||
|
||||
if (messageX < 0) {
|
||||
// We're hanging off the left edge, switch to floating mode
|
||||
tail.style.display = "none";
|
||||
this.adjustLocationFloating_(message);
|
||||
return;
|
||||
}
|
||||
|
||||
tail.style.top = tailY + "px";
|
||||
tail.style.left = tailX + "px";
|
||||
message.style.top = messageY + "px";
|
||||
message.style.left = messageX + "px";
|
||||
|
||||
this.maybeAddScrollbars_();
|
||||
}
|
||||
|
||||
/**
|
||||
* Position the warning bubble with no reference element. In this case we
|
||||
* just center the warning bubble at the top of the users window.
|
||||
* @param message XULElement message bubble XUL container.
|
||||
*/
|
||||
PROT_PhishMsgDisplayerBase.prototype.adjustLocationFloating_ = function(message) {
|
||||
// Compute X offset
|
||||
var browserX = this.browser_.boxObject.x;
|
||||
var browserXCenter = browserX + this.browser_.boxObject.width / 2;
|
||||
var messageX = browserXCenter - (message.boxObject.width / 2);
|
||||
|
||||
// Compute Y offset (top of the browser window)
|
||||
var messageY = this.browser_.boxObject.y;
|
||||
|
||||
// Position message
|
||||
message.style.top = messageY + "px";
|
||||
message.style.left = messageX + "px";
|
||||
|
||||
this.maybeAddScrollbars_();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a vertical scrollbar if we're falling out of the browser window.
|
||||
*/
|
||||
PROT_PhishMsgDisplayerBase.prototype.maybeAddScrollbars_ = function() {
|
||||
var message = this.doc_.getElementById(this.messageId_);
|
||||
|
||||
var content = this.doc_.getElementById(this.messageContentId_);
|
||||
var bottom = content.boxObject.y + content.boxObject.height;
|
||||
var maxY = this.doc_.defaultView.innerHeight;
|
||||
G_Debug(this, "bottom: " + bottom + ", maxY: " + maxY
|
||||
+ ", new height: " + (maxY - content.boxObject.y));
|
||||
if (bottom > maxY) {
|
||||
var newHeight = maxY - content.boxObject.y;
|
||||
if (newHeight < 1)
|
||||
newHeight = 1;
|
||||
|
||||
content.style.height = newHeight + "px";
|
||||
content.style.overflow = "auto";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the extended warning message
|
||||
*/
|
||||
PROT_PhishMsgDisplayerBase.prototype.showMore_ = function() {
|
||||
this.doc_.getElementById(this.extendedMessageId_).hidden = false;
|
||||
this.doc_.getElementById(this.showmoreLinkId_).style.display = "none";
|
||||
|
||||
// set FAQ URL
|
||||
var formatter = Components.classes["@mozilla.org/toolkit/URLFormatterService;1"]
|
||||
.getService(Components.interfaces.nsIURLFormatter);
|
||||
var faqURL = formatter.formatURLPref("browser.safebrowsing.warning.infoURL");
|
||||
var labelEl = this.doc_.getElementById(this.faqLinkId_);
|
||||
labelEl.setAttribute("href", faqURL);
|
||||
|
||||
this.maybeAddScrollbars_();
|
||||
}
|
||||
|
||||
/**
|
||||
* The user clicked on one of the links in the buble. Display the
|
||||
* corresponding page in a new window with all the chrome enabled.
|
||||
*
|
||||
* @param url The URL to display in a new window
|
||||
*/
|
||||
PROT_PhishMsgDisplayerBase.prototype.showURL_ = function(url) {
|
||||
this.windowWatcher_.openWindow(this.windowWatcher_.activeWindow,
|
||||
url,
|
||||
"_blank",
|
||||
null,
|
||||
null);
|
||||
}
|
||||
|
||||
/**
|
||||
* If the warning bubble came up in error, this url goes to a form
|
||||
* to notify the data provider.
|
||||
* @return url String
|
||||
*/
|
||||
PROT_PhishMsgDisplayerBase.prototype.getReportErrorURL_ = function() {
|
||||
var badUrl = this.url_;
|
||||
|
||||
var url = gDataProvider.getReportErrorURL();
|
||||
url += "&url=" + encodeURIComponent(badUrl);
|
||||
return url;
|
||||
}
|
||||
|
||||
/**
|
||||
* URL for the user to report back to us. This is to provide the user
|
||||
* with an action after being warned.
|
||||
*/
|
||||
PROT_PhishMsgDisplayerBase.prototype.getReportGenericURL_ = function() {
|
||||
var badUrl = this.url_;
|
||||
|
||||
var url = gDataProvider.getReportGenericURL();
|
||||
url += "&url=" + encodeURIComponent(badUrl);
|
||||
return url;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* A specific implementation of the dislpayer using a canvas. This
|
||||
* class is meant for use on platforms that don't support transparent
|
||||
* elements over browser content (currently: all platforms).
|
||||
*
|
||||
* The main ugliness is the fact that we're hiding the content area and
|
||||
* painting the page to canvas. As a result, we must periodically
|
||||
* re-paint the canvas to reflect updates to the page. Otherwise if
|
||||
* the page was half-loaded when we showed our warning, it would
|
||||
* stay that way even though the page actually finished loading.
|
||||
*
|
||||
* See base constructor for full details of constructor args.
|
||||
*
|
||||
* @constructor
|
||||
*/
|
||||
function PROT_PhishMsgDisplayerCanvas(msgDesc, browser, doc, url) {
|
||||
PROT_PhishMsgDisplayerBase.call(this, msgDesc, browser, doc, url);
|
||||
|
||||
this.dimAreaId_ = "safebrowsing-dim-area-canvas";
|
||||
this.pageCanvasId_ = "safebrowsing-page-canvas";
|
||||
this.xhtmlNS_ = "http://www.w3.org/1999/xhtml"; // we create html:canvas
|
||||
}
|
||||
|
||||
PROT_PhishMsgDisplayerCanvas.inherits(PROT_PhishMsgDisplayerBase);
|
||||
|
||||
/**
|
||||
* Displays the warning message. First we make sure the overlay is loaded
|
||||
* then call showMessageAfterOverlay_.
|
||||
*/
|
||||
PROT_PhishMsgDisplayerCanvas.prototype.showMessage_ = function() { }
|
||||
|
||||
/**
|
||||
* This does the actual work of showing the warning message.
|
||||
*/
|
||||
PROT_PhishMsgDisplayerCanvas.prototype.showMessageAfterOverlay_ = function() {
|
||||
this.messageShowing_ = true;
|
||||
|
||||
// Position the canvas overlay. Order here is significant, but don't ask me
|
||||
// why for some of these. You need to:
|
||||
// 1. get browser dimensions
|
||||
// 2. add canvas to the document
|
||||
// 3. unhide the dimmer (gray out overlay)
|
||||
// 4. display to the canvas
|
||||
// 5. unhide the warning message
|
||||
// 6. update link targets in warning message
|
||||
// 7. focus the warning message
|
||||
|
||||
// (1)
|
||||
var w = this.browser_.boxObject.width;
|
||||
G_Debug(this, "browser w=" + w);
|
||||
var h = this.browser_.boxObject.height;
|
||||
G_Debug(this, "browser h=" + h);
|
||||
var x = this.browser_.boxObject.x;
|
||||
G_Debug(this, "browser x=" + w);
|
||||
var y = this.browser_.boxObject.y;
|
||||
G_Debug(this, "browser y=" + h);
|
||||
|
||||
var win = this.browser_.contentWindow;
|
||||
var scrollX = win.scrollX;
|
||||
G_Debug(this, "win scrollx=" + scrollX);
|
||||
var scrollY = win.scrollY;
|
||||
G_Debug(this, "win scrolly=" + scrollY);
|
||||
|
||||
// (2)
|
||||
// We add the canvas dynamically and remove it when we're done because
|
||||
// leaving it hanging around consumes a lot of memory.
|
||||
var pageCanvas = this.doc_.createElementNS(this.xhtmlNS_, "html:canvas");
|
||||
pageCanvas.id = this.pageCanvasId_;
|
||||
pageCanvas.style.left = x + 'px';
|
||||
pageCanvas.style.top = y + 'px';
|
||||
|
||||
var dimarea = this.doc_.getElementById(this.dimAreaId_);
|
||||
this.doc_.getElementById('main-window').insertBefore(pageCanvas,
|
||||
dimarea);
|
||||
|
||||
// (3)
|
||||
dimarea.style.left = x + 'px';
|
||||
dimarea.style.top = y + 'px';
|
||||
dimarea.style.width = w + 'px';
|
||||
dimarea.style.height = h + 'px';
|
||||
dimarea.hidden = false;
|
||||
|
||||
// (4)
|
||||
pageCanvas.setAttribute("width", w);
|
||||
pageCanvas.setAttribute("height", h);
|
||||
|
||||
var bgcolor = this.getBackgroundColor_();
|
||||
|
||||
var cx = pageCanvas.getContext("2d");
|
||||
cx.drawWindow(win, scrollX, scrollY, w, h, bgcolor);
|
||||
|
||||
// Now repaint the window every so often in case the content hasn't fully
|
||||
// loaded at this point.
|
||||
var debZone = this.debugZone;
|
||||
function repaint() {
|
||||
G_Debug(debZone, "Repainting canvas...");
|
||||
cx.drawWindow(win, scrollX, scrollY, w, h, bgcolor);
|
||||
};
|
||||
this.repainter_ = new PROT_PhishMsgCanvasRepainter(repaint);
|
||||
|
||||
// (5)
|
||||
this.showAndPositionWarning_();
|
||||
|
||||
// (6)
|
||||
var link = this.doc_.getElementById('safebrowsing-palm-falsepositive-link');
|
||||
link.href = this.getReportErrorURL_();
|
||||
|
||||
// (7)
|
||||
this.doc_.getElementById(this.messageContentId_).focus();
|
||||
}
|
||||
|
||||
/**
|
||||
* Show and position the warning message. We position the waring message
|
||||
* relative to the icon in the url bar, but if the element doesn't exist,
|
||||
* (e.g., the user remove the url bar from her/his chrome), we anchor at the
|
||||
* top of the window.
|
||||
*/
|
||||
PROT_PhishMsgDisplayerCanvas.prototype.showAndPositionWarning_ = function() {
|
||||
var refElement = this.doc_.getElementById(this.refElementId_);
|
||||
var message = this.doc_.getElementById(this.messageId_);
|
||||
var tail = this.doc_.getElementById(this.messageTailId_);
|
||||
|
||||
message.hidden = false;
|
||||
message.style.display = "block";
|
||||
|
||||
// Determine if the refElement is visible.
|
||||
if (this.isVisibleElement_(refElement)) {
|
||||
// Show tail and position warning relative to refElement.
|
||||
tail.hidden = false;
|
||||
tail.style.display = "block";
|
||||
this.adjustLocation_(message, tail, refElement);
|
||||
} else {
|
||||
// No ref element, position in the top center of window.
|
||||
tail.hidden = true;
|
||||
tail.style.display = "none";
|
||||
this.adjustLocationFloating_(message);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Boolean true if elt is a visible XUL element.
|
||||
*/
|
||||
PROT_PhishMsgDisplayerCanvas.prototype.isVisibleElement_ = function(elt) {
|
||||
if (!elt)
|
||||
return false;
|
||||
|
||||
// If it's on a collapsed/hidden toolbar, the x position is set to 0.
|
||||
if (elt.boxObject.x == 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hide the warning message from the user.
|
||||
*/
|
||||
PROT_PhishMsgDisplayerCanvas.prototype.hideMessage_ = function() { }
|
||||
|
||||
|
||||
/**
|
||||
* Helper class that periodically repaints the canvas. We repaint
|
||||
* frequently at first, and then back off to a less frequent schedule
|
||||
* at "steady state," and finally just stop altogether. We have to do
|
||||
* this because we're not sure if the page has finished loading when
|
||||
* we first paint the canvas, and because we want to reflect any
|
||||
* dynamically written content into the canvas as it appears in the
|
||||
* page after load.
|
||||
*
|
||||
* @param repaintFunc Function to call to repaint browser.
|
||||
*
|
||||
* @constructor
|
||||
*/
|
||||
function PROT_PhishMsgCanvasRepainter(repaintFunc) {
|
||||
this.count_ = 0;
|
||||
this.repaintFunc_ = repaintFunc;
|
||||
this.initPeriodMS_ = 500; // Initially repaint every 500ms
|
||||
this.steadyStateAtMS_ = 10 * 1000; // Go slowly after 10 seconds,
|
||||
this.steadyStatePeriodMS_ = 3 * 1000; // repainting every 3 seconds, and
|
||||
this.quitAtMS_ = 20 * 1000; // stop after 20 seconds
|
||||
this.startMS_ = (new Date).getTime();
|
||||
this.alarm_ = new G_Alarm(BindToObject(this.repaint, this),
|
||||
this.initPeriodMS_);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called periodically to repaint the canvas
|
||||
*/
|
||||
PROT_PhishMsgCanvasRepainter.prototype.repaint = function() {
|
||||
this.repaintFunc_();
|
||||
|
||||
var nextRepaint;
|
||||
// If we're in "steady state", use the slow repaint rate, else fast
|
||||
if ((new Date).getTime() - this.startMS_ > this.steadyStateAtMS_)
|
||||
nextRepaint = this.steadyStatePeriodMS_;
|
||||
else
|
||||
nextRepaint = this.initPeriodMS_;
|
||||
|
||||
if (!((new Date).getTime() - this.startMS_ > this.quitAtMS_))
|
||||
this.alarm_ = new G_Alarm(BindToObject(this.repaint, this), nextRepaint);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to stop repainting the canvas
|
||||
*/
|
||||
PROT_PhishMsgCanvasRepainter.prototype.cancel = function() {
|
||||
if (this.alarm_) {
|
||||
this.alarm_.cancel();
|
||||
this.alarm_ = null;
|
||||
}
|
||||
this.repaintFunc_ = null;
|
||||
}
|
@ -64,14 +64,6 @@
|
||||
|
||||
const kPhishWardenEnabledPref = "browser.safebrowsing.enabled";
|
||||
|
||||
// We have hardcoded URLs that we let people navigate to in order to
|
||||
// check out the warning.
|
||||
const kTestUrls = {
|
||||
"http://www.google.com/tools/firefox/safebrowsing/phish-o-rama.html": true,
|
||||
"http://www.mozilla.org/projects/bonecho/anti-phishing/its-a-trap.html": true,
|
||||
"http://www.mozilla.com/firefox/its-a-trap.html": true,
|
||||
}
|
||||
|
||||
/**
|
||||
* Abtracts the checking of user/browser actions for signs of
|
||||
* phishing.
|
||||
@ -84,8 +76,6 @@ function PROT_PhishingWarden() {
|
||||
PROT_ListWarden.call(this);
|
||||
|
||||
this.debugZone = "phishwarden";
|
||||
this.testing_ = false;
|
||||
this.browserViews_ = [];
|
||||
|
||||
// Use this to query preferences
|
||||
this.prefs_ = new G_Preferences();
|
||||
@ -106,9 +96,6 @@ function PROT_PhishingWarden() {
|
||||
|
||||
PROT_PhishingWarden.inherits(PROT_ListWarden);
|
||||
|
||||
/**
|
||||
* We implement nsIWebProgressListener
|
||||
*/
|
||||
PROT_PhishingWarden.prototype.QueryInterface = function(iid) {
|
||||
if (iid.equals(Ci.nsISupports) ||
|
||||
iid.equals(Ci.nsISupportsWeakReference))
|
||||
@ -136,9 +123,6 @@ PROT_PhishingWarden.prototype.shutdown = function() {
|
||||
* both, so eventually we will start correctly.
|
||||
*/
|
||||
PROT_PhishingWarden.prototype.maybeToggleUpdateChecking = function() {
|
||||
if (this.testing_)
|
||||
return;
|
||||
|
||||
var phishWardenEnabled = this.prefs_.getPref(kPhishWardenEnabledPref, null);
|
||||
|
||||
G_Debug(this, "Maybe toggling update checking. " +
|
||||
|
@ -1,55 +1,50 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- ***** BEGIN LICENSE BLOCK *****
|
||||
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
-
|
||||
- The contents of this file are subject to the Mozilla Public License Version
|
||||
- 1.1 (the "License"); you may not use this file except in compliance with
|
||||
- the License. You may obtain a copy of the License at
|
||||
- http://www.mozilla.org/MPL/
|
||||
-
|
||||
- Software distributed under the License is distributed on an "AS IS" basis,
|
||||
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
- for the specific language governing rights and limitations under the
|
||||
- License.
|
||||
-
|
||||
- The Original Code is Mozilla Reporter (r.m.o).
|
||||
-
|
||||
- The Initial Developer of the Original Code is
|
||||
- Robert Accettura <robert@accettura.com>.
|
||||
-
|
||||
- Portions created by the Initial Developer are Copyright (C) 2004
|
||||
- the Initial Developer. All Rights Reserved.
|
||||
-
|
||||
- Contributor(s):
|
||||
- Jay Patel <jay@mozilla.org>
|
||||
- Gavin Sharp <gavin@gavinsharp.com>
|
||||
-
|
||||
- Alternatively, the contents of this file may be used under the terms of
|
||||
- either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
- in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
- of those above. If you wish to allow use of your version of this file only
|
||||
- under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
- use your version of this file under the terms of the MPL, indicate your
|
||||
- decision by deleting the provisions above and replace them with the notice
|
||||
- and other provisions required by the LGPL or the GPL. If you do not delete
|
||||
- the provisions above, a recipient may use your version of this file under
|
||||
- the terms of any one of the MPL, the GPL or the LGPL.
|
||||
-
|
||||
- ***** END LICENSE BLOCK ***** -->
|
||||
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is Mozilla Reporter (r.m.o).
|
||||
#
|
||||
# The Initial Developer of the Original Code is Robert Accettura <robert@accettura.com>.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2004
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Jay Patel <jay@mozilla.org>
|
||||
# Gavin Sharp <gavin@gavinsharp.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
<!DOCTYPE overlay [
|
||||
<!ENTITY % reportphishDTD SYSTEM "chrome://browser/locale/safebrowsing/report-phishing.dtd">
|
||||
%reportphishDTD;
|
||||
<!ENTITY % safebrowsingDTD SYSTEM "chrome://browser/locale/safebrowsing/phishing-afterload-warning-message.dtd">
|
||||
%safebrowsingDTD;
|
||||
]>
|
||||
|
||||
<overlay id="reportPhishingMenuOverlay"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<broadcasterset id="mainBroadcasterSet">
|
||||
<broadcaster id="reportPhishingBroadcaster" disabled="true"/>
|
||||
<broadcaster id="reportPhishingErrorBroadcaster" disabled="true"/>
|
||||
<!--<broadcaster id="reportPhishingErrorBroadcaster" disabled="true"/>-->
|
||||
</broadcasterset>
|
||||
<menupopup id="menu_HelpPopup">
|
||||
<menuitem id="menu_HelpPopup_reportPhishingtoolmenu"
|
||||
@ -59,12 +54,13 @@
|
||||
observes="reportPhishingBroadcaster"
|
||||
oncommand="openUILink(safebrowsing.getReportURL('Phish'), event);"
|
||||
onclick="checkForMiddleClick(this, event);"/>
|
||||
<!-- XXX Bug 415846
|
||||
<menuitem id="menu_HelpPopup_reportPhishingErrortoolmenu"
|
||||
label="&safeb.palm.notforgery.label;..."
|
||||
accesskey="&reportPhishSiteMenu.accesskey;"
|
||||
insertbefore="updateSeparator"
|
||||
observes="reportPhishingErrorBroadcaster"
|
||||
oncommand="openUILinkIn(safebrowsing.getReportURL('Error'), 'tab');"
|
||||
onclick="checkForMiddleClick(this, event);"/>
|
||||
onclick="checkForMiddleClick(this, event);"/>-->
|
||||
</menupopup>
|
||||
</overlay>
|
||||
|
@ -1,77 +0,0 @@
|
||||
# **** BEGIN LICENSE BLOCK ****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is Google Safe Browsing.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Google Inc.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2006
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Fritz Schneider <fritz@google.com> (original author)
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# **** END LICENSE BLOCK ****
|
||||
|
||||
|
||||
// A tiny class to do reporting for us. We report interesting user actions
|
||||
// such as the user hitting a blacklisted page, and the user accepting
|
||||
// or declining the warning.
|
||||
//
|
||||
// Each report has a subject and data. Current reports are:
|
||||
//
|
||||
// subject data meaning
|
||||
// --------------------------------
|
||||
// phishnavaway url the user navigated away from a phishy page
|
||||
// phishdecline url the user declined our warning
|
||||
// phishaccept url the user accepted our warning
|
||||
// phishblhit url the user loaded a phishing page
|
||||
//
|
||||
// We only send reports in advanced protection mode, and even then we
|
||||
// strip cookies from the request before sending it.
|
||||
|
||||
/**
|
||||
* A very complicated class to send pings to the provider. The class does
|
||||
* nothing if we're not in advanced protection mode.
|
||||
*
|
||||
* @constructor
|
||||
*/
|
||||
function PROT_Reporter() {
|
||||
this.debugZone = "reporter";
|
||||
this.prefs_ = new G_Preferences();
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a report!
|
||||
*
|
||||
* @param subject String indicating what this report is about (will be
|
||||
* urlencoded)
|
||||
* @param data String giving extra information about this report (will be
|
||||
* urlencoded)
|
||||
*/
|
||||
PROT_Reporter.prototype.report = function(subject, data) {
|
||||
// XXX: this is disabled for now, since we don't have advanced mode
|
||||
// anymore.
|
||||
return;
|
||||
}
|
@ -34,108 +34,36 @@
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
|
||||
/**
|
||||
* This file is included into the main browser chrome from
|
||||
* browser/base/content/global-scripts.inc
|
||||
*/
|
||||
|
||||
var safebrowsing = {
|
||||
controller: null,
|
||||
phishWarden: null,
|
||||
appContext: null,
|
||||
|
||||
startup: function() {
|
||||
setTimeout(safebrowsing.deferredStartup, 2000);
|
||||
|
||||
// clean up
|
||||
window.removeEventListener("load", safebrowsing.startup, false);
|
||||
},
|
||||
|
||||
|
||||
deferredStartup: function() {
|
||||
var appContext = Cc["@mozilla.org/safebrowsing/application;1"]
|
||||
.getService().wrappedJSObject;
|
||||
|
||||
var malwareWarden = new appContext.PROT_MalwareWarden();
|
||||
safebrowsing.malwareWarden = malwareWarden;
|
||||
|
||||
// Register tables
|
||||
malwareWarden.registerBlackTable("goog-malware-shavar");
|
||||
|
||||
malwareWarden.maybeToggleUpdateChecking();
|
||||
|
||||
var phishWarden = new appContext.PROT_PhishingWarden();
|
||||
safebrowsing.phishWarden = phishWarden;
|
||||
|
||||
// Register tables
|
||||
// XXX: move table names to a pref that we originally will download
|
||||
// from the provider (need to workout protocol details)
|
||||
phishWarden.registerBlackTable("goog-phish-shavar");
|
||||
|
||||
// Download/update lists if we're in non-enhanced mode
|
||||
phishWarden.maybeToggleUpdateChecking();
|
||||
safebrowsing.controller = new appContext.PROT_Controller(
|
||||
window, getBrowser(), phishWarden);
|
||||
},
|
||||
|
||||
/**
|
||||
* Clean up.
|
||||
*/
|
||||
shutdown: function() {
|
||||
if (safebrowsing.controller) {
|
||||
// If the user shuts down before deferredStartup, there is no controller.
|
||||
safebrowsing.controller.shutdown();
|
||||
}
|
||||
if (safebrowsing.phishWarden) {
|
||||
safebrowsing.phishWarden.shutdown();
|
||||
}
|
||||
if (safebrowsing.malwareWarden) {
|
||||
safebrowsing.malwareWarden.shutdown();
|
||||
}
|
||||
|
||||
window.removeEventListener("unload", safebrowsing.shutdown, false);
|
||||
this.appContext = Cc["@mozilla.org/safebrowsing/application;1"].
|
||||
getService().wrappedJSObject;
|
||||
this.appContext.initialize();
|
||||
},
|
||||
|
||||
setReportPhishingMenu: function() {
|
||||
var uri = getBrowser().currentURI;
|
||||
if (!uri)
|
||||
return;
|
||||
|
||||
var sbIconElt = document.getElementById("safebrowsing-urlbar-icon");
|
||||
var helpMenuElt = document.getElementById("helpMenu");
|
||||
var phishLevel = sbIconElt.getAttribute("level");
|
||||
|
||||
// Show/hide the appropriate menu item.
|
||||
document.getElementById("menu_HelpPopup_reportPhishingtoolmenu")
|
||||
.hidden = ("safe" != phishLevel);
|
||||
document.getElementById("menu_HelpPopup_reportPhishingErrortoolmenu")
|
||||
.hidden = ("safe" == phishLevel);
|
||||
|
||||
var broadcasterId;
|
||||
if ("safe" == phishLevel) {
|
||||
broadcasterId = "reportPhishingBroadcaster";
|
||||
} else {
|
||||
broadcasterId = "reportPhishingErrorBroadcaster";
|
||||
}
|
||||
|
||||
var broadcaster = document.getElementById(broadcasterId);
|
||||
if (!broadcaster)
|
||||
return;
|
||||
|
||||
var progressListener =
|
||||
Cc["@mozilla.org/browser/safebrowsing/navstartlistener;1"]
|
||||
.createInstance(Ci.nsIDocNavStartProgressListener);
|
||||
broadcaster.setAttribute("disabled", progressListener.isSpurious(uri));
|
||||
var broadcaster = document.getElementById("reportPhishingBroadcaster");
|
||||
if (uri && (uri.schemeIs("http") || uri.schemeIs("https")))
|
||||
broadcaster.removeAttribute("disabled");
|
||||
else
|
||||
broadcaster.disabled = true;
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Used to report a phishing page or a false positive
|
||||
* @param name String either "Phish" or "Error"
|
||||
* @return String the report phishing URL.
|
||||
*/
|
||||
getReportURL: function(name) {
|
||||
var appContext = Cc["@mozilla.org/safebrowsing/application;1"]
|
||||
.getService().wrappedJSObject;
|
||||
var reportUrl = appContext.getReportURL(name);
|
||||
var reportUrl = this.appContext.getReportURL(name);
|
||||
|
||||
var pageUrl = getBrowser().currentURI.asciiSpec;
|
||||
reportUrl += "&url=" + encodeURIComponent(pageUrl);
|
||||
@ -145,4 +73,3 @@ var safebrowsing = {
|
||||
}
|
||||
|
||||
window.addEventListener("load", safebrowsing.startup, false);
|
||||
window.addEventListener("unload", safebrowsing.shutdown, false);
|
||||
|
@ -1,116 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<!-- This css and dtd are for the phishing warning message -->
|
||||
|
||||
<?xml-stylesheet
|
||||
href="chrome://browser/skin/safebrowsing/browser-protection.css"
|
||||
type="text/css" ?>
|
||||
<!DOCTYPE window [
|
||||
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd" >
|
||||
%brandDTD;
|
||||
<!ENTITY % safebrowsingDTD SYSTEM "chrome://browser/locale/safebrowsing/phishing-afterload-warning-message.dtd">
|
||||
%safebrowsingDTD;
|
||||
]>
|
||||
|
||||
<overlay id="safebrowsing-overlay"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<window id="main-window">
|
||||
<!-- This is the spike aka tail on top of the warning -->
|
||||
|
||||
<hbox id="safebrowsing-palm-message-tail-container" hidden="true"
|
||||
pack="end">
|
||||
<image id="safebrowsing-palm-message-tail"
|
||||
src="chrome://browser/skin/safebrowsing/tail.png"/>
|
||||
</hbox>
|
||||
|
||||
<!-- This is the phishing afterload warning message -->
|
||||
|
||||
<vbox id="safebrowsing-palm-message" hidden="true" pack="center"
|
||||
class="safebrowsing-palm-fixed-width">
|
||||
|
||||
<!-- This is the main warning area -->
|
||||
|
||||
<vbox id="safebrowsing-palm-message-content"
|
||||
class="safebrowsing-palm-fixed-width"
|
||||
style="-moz-user-focus: normal"
|
||||
role="alert">
|
||||
|
||||
<hbox id="safebrowsing-palm-close-container" align="center"
|
||||
class="safebrowsing-palm-fixed-width">
|
||||
<spacer flex="1"/>
|
||||
<image id="safebrowsing-palm-close"
|
||||
onclick="goDoCommand('safebrowsing-decline-warning')"/>
|
||||
</hbox>
|
||||
|
||||
<!-- Top line -->
|
||||
<description id="safebrowsing-palm-message-titlebox"
|
||||
class="safebrowsing-palm-fixed-width">
|
||||
&safeb.palm.warning.title;
|
||||
</description>
|
||||
|
||||
<!-- Content area: short warning -->
|
||||
|
||||
<description id="safebrowsing-palm-content"
|
||||
class="safebrowsing-paragraph">
|
||||
&safeb.palm.message.p1;
|
||||
<label class="text-link plain"
|
||||
statustext="&safeb.palm.p1.linkStatusText;"
|
||||
id="safebrowsing-palm-showmore-link"
|
||||
onclick="goDoCommand('safebrowsing-palm-showmore'); document.getElementById('safebrowsing-palm-faq-link').focus()"
|
||||
value="&safeb.palm.message.p1.linkText;"/>
|
||||
</description>
|
||||
|
||||
<!-- Content area: rest of the warning, revealed if the user
|
||||
hits the more link -->
|
||||
|
||||
<vbox id="safebrowsing-palm-extended-message" hidden="true"
|
||||
class="safebrowsing-palm-fixed-width">
|
||||
<description class="safebrowsing-palm-paragraph">
|
||||
&safeb.palm.message.p2.start;
|
||||
<label class="text-link plain" id="safebrowsing-palm-faq-link"
|
||||
value="&safeb.palm.message.p2.linkText;"/>
|
||||
&safeb.palm.message.p2.end;
|
||||
</description>
|
||||
</vbox>
|
||||
|
||||
<!-- Main action links -->
|
||||
<description id="safebrowsing-palm-message-actionbox"
|
||||
class="safebrowsing-palm-fixed-width"
|
||||
align="center" crop="none">
|
||||
<label class="safebrowsing-palm-bigtext text-link plain"
|
||||
statustext="&safeb.palm.accept.statustext;"
|
||||
id="safebrowsing-palm-accept-link"
|
||||
onclick="goDoCommand('safebrowsing-accept-warning')"
|
||||
value="&safeb.palm.accept.label;"/>
|
||||
<spacer flex="1"/>
|
||||
<label class="safebrowsing-palm-bigtext text-link plain"
|
||||
statustext="&safeb.palm.decline.statustext;"
|
||||
id="safebrowsing-palm-decline-link"
|
||||
onclick="goDoCommand('safebrowsing-decline-warning')"
|
||||
value="&safeb.palm.decline.label;"/>
|
||||
</description>
|
||||
|
||||
<!-- Footer -->
|
||||
|
||||
<hbox align="center" class="safebrowsing-palm-fixed-width">
|
||||
<spacer flex="1"/>
|
||||
<description>
|
||||
[
|
||||
<label id="safebrowsing-palm-falsepositive-link"
|
||||
class="safebrowsing-palm-smalltext text-link plain"
|
||||
value="&safeb.palm.notforgery.label;"/>
|
||||
]
|
||||
</description>
|
||||
</hbox>
|
||||
</vbox>
|
||||
</vbox>
|
||||
|
||||
<!-- The canvas goes here, but since it takes up so much memory and is
|
||||
rarely used, we add and remove it dynamically -->
|
||||
|
||||
<!-- This dims out the browser content -->
|
||||
<vbox id="safebrowsing-dim-area-canvas" hidden="true">
|
||||
</vbox>
|
||||
</window>
|
||||
</overlay>
|
@ -1,7 +1,5 @@
|
||||
browser.jar:
|
||||
# script file included into main browser.js
|
||||
* content/browser/safebrowsing/sb-loader.js (content/sb-loader.js)
|
||||
+ content/browser/safebrowsing/warning-overlay.xul (content/warning-overlay.xul)
|
||||
+ content/browser/safebrowsing/report-phishing-overlay.xul (content/report-phishing-overlay.xul)
|
||||
+ content/browser/safebrowsing/blockedSite.xhtml (content/blockedSite.xhtml)
|
||||
* content/browser/safebrowsing/report-phishing-overlay.xul (content/report-phishing-overlay.xul)
|
||||
content/browser/safebrowsing/blockedSite.xhtml (content/blockedSite.xhtml)
|
||||
% overlay chrome://browser/content/browser.xul chrome://browser/content/safebrowsing/report-phishing-overlay.xul
|
||||
|
@ -1,50 +0,0 @@
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Google Inc.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2006
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Brett Wilson <brettw@gmail.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
|
||||
DEPTH = ../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = safebrowsing
|
||||
XPIDL_MODULE = safebrowsing
|
||||
|
||||
XPIDLSRCS = nsIDocNavStartProgressListener.idl
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
@ -1,78 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Google Safe Browsing.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Google Inc.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2006
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Brett Wilson <brettw@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIRequest;
|
||||
interface nsIURI;
|
||||
|
||||
|
||||
[scriptable, function, uuid(163f3437-1d69-4db7-9ce1-fd420fba8219)]
|
||||
interface nsIDocNavStartProgressCallback : nsISupports
|
||||
{
|
||||
void onDocNavStart(in nsIRequest aRequest, in AUTF8String aUri);
|
||||
};
|
||||
|
||||
[scriptable, uuid(013bf34b-a7a8-4f89-b0ea-169e7ddbbe15)]
|
||||
interface nsIDocNavStartProgressListener : nsISupports
|
||||
{
|
||||
/**
|
||||
* Set to true to enable this component. Defaults to false (disabled). When
|
||||
* you set this to true, the listener will be attached to the docloader and
|
||||
* the callback can start getting events.
|
||||
*/
|
||||
attribute boolean globalProgressListenerEnabled;
|
||||
|
||||
/**
|
||||
* Number of ms to wait after receiving a doc load event and calling the
|
||||
* callback. Even when set to zero, we set a timer so the call will fire
|
||||
* asynchronously. Defaults to 0.
|
||||
*/
|
||||
attribute PRUint32 delay;
|
||||
|
||||
/**
|
||||
* The callback, if non-null, used when globalProgressListenerEnabled is
|
||||
* true. Setting this to null has the side effect of unqueueing any pending
|
||||
* events for which a callback would be notified; setting it to any other
|
||||
* value, however, will not unqueue any events.
|
||||
*/
|
||||
attribute nsIDocNavStartProgressCallback callback;
|
||||
|
||||
/**
|
||||
* We ignore about:, chrome: and file: URIs.
|
||||
*/
|
||||
boolean isSpurious(in nsIURI aURI);
|
||||
};
|
@ -41,18 +41,4 @@ VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = safebrowsing
|
||||
LIBRARY_NAME = safebrowsing_s
|
||||
FORCE_STATIC_LIB = 1
|
||||
FORCE_USE_PIC = 1
|
||||
USE_STATIC_LIBS = 1
|
||||
|
||||
REQUIRES = \
|
||||
necko \
|
||||
string \
|
||||
uriloader \
|
||||
xpcom
|
||||
|
||||
CPPSRCS = nsDocNavStartProgressListener.cpp
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
@ -1,379 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Google Safe Browsing.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Google Inc.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2006
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Brett Wilson <brettw@gmail.com>
|
||||
* based on JavaScript code by Fritz Schneider <fritz@google.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsCURILoader.h"
|
||||
#include "nsDocNavStartProgressListener.h"
|
||||
#include "nsIChannel.h"
|
||||
#include "nsINestedURI.h"
|
||||
#include "nsIRequest.h"
|
||||
#include "nsITimer.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsIWebProgress.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsStringAPI.h"
|
||||
#include "prlog.h"
|
||||
|
||||
NS_IMPL_ISUPPORTS4(nsDocNavStartProgressListener,
|
||||
nsIDocNavStartProgressListener,
|
||||
nsIWebProgressListener,
|
||||
nsIObserver,
|
||||
nsISupportsWeakReference)
|
||||
|
||||
// NSPR_LOG_MODULES=DocNavStart:5
|
||||
#if defined(PR_LOGGING)
|
||||
static const PRLogModuleInfo *gDocNavStartProgressListenerLog = nsnull;
|
||||
#define LOG(args) PR_LOG(gDocNavStartProgressListenerLog, PR_LOG_DEBUG, args)
|
||||
#else
|
||||
#define LOG(args)
|
||||
#endif
|
||||
|
||||
nsDocNavStartProgressListener::nsDocNavStartProgressListener() :
|
||||
mEnabled(PR_FALSE), mDelay(0), mRequests(nsnull), mTimers(nsnull)
|
||||
{
|
||||
#if defined(PR_LOGGING)
|
||||
if (!gDocNavStartProgressListenerLog)
|
||||
gDocNavStartProgressListenerLog = PR_NewLogModule("DocNavStart");
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
nsDocNavStartProgressListener::~nsDocNavStartProgressListener()
|
||||
{
|
||||
ClearPendingEvents();
|
||||
}
|
||||
|
||||
void
|
||||
nsDocNavStartProgressListener::ClearPendingEvents()
|
||||
{
|
||||
mRequests.Clear();
|
||||
|
||||
PRUint32 length = mTimers.Count();
|
||||
for (PRUint32 i = 0; i < length; ++i) {
|
||||
mTimers[i]->Cancel();
|
||||
}
|
||||
mTimers.Clear();
|
||||
}
|
||||
|
||||
// nsDocNavStartProgressListener::AttachListeners
|
||||
|
||||
nsresult
|
||||
nsDocNavStartProgressListener::AttachListeners()
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIWebProgress> webProgressService = do_GetService(
|
||||
NS_DOCUMENTLOADER_SERVICE_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return webProgressService->AddProgressListener(this,
|
||||
nsIWebProgress::NOTIFY_LOCATION);
|
||||
}
|
||||
|
||||
|
||||
// nsDocNavStartProgressListener::DetachListeners
|
||||
|
||||
nsresult
|
||||
nsDocNavStartProgressListener::DetachListeners()
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIWebProgress> webProgressService = do_GetService(
|
||||
NS_DOCUMENTLOADER_SERVICE_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return webProgressService->RemoveProgressListener(this);
|
||||
}
|
||||
|
||||
// Helper method for checking a request URI.
|
||||
nsresult
|
||||
nsDocNavStartProgressListener::GetRequestUri(nsIRequest* aReq, nsIURI** uri)
|
||||
{
|
||||
nsCOMPtr<nsIChannel> channel;
|
||||
nsresult rv;
|
||||
channel = do_QueryInterface(aReq, &rv);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
rv = channel->GetURI(uri);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
// nsIDocNavStartProgressCallback ***********************************************
|
||||
|
||||
// nsDocNavStartProgressListener::GetGlobalProgressListenerEnabled
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocNavStartProgressListener::GetGlobalProgressListenerEnabled(PRBool* aEnabled)
|
||||
{
|
||||
*aEnabled = mEnabled;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
// nsDocNavStartProgressListener::SetGlobalProgressListenerEnabled
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocNavStartProgressListener::SetGlobalProgressListenerEnabled(PRBool aEnabled)
|
||||
{
|
||||
if (aEnabled && ! mEnabled) {
|
||||
// enable component
|
||||
mEnabled = PR_TRUE;
|
||||
return AttachListeners();
|
||||
} else if (! aEnabled && mEnabled) {
|
||||
// disable component
|
||||
mEnabled = PR_FALSE;
|
||||
return DetachListeners();
|
||||
}
|
||||
return NS_OK; // nothing to do
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocNavStartProgressListener::GetDelay(PRUint32* aDelay)
|
||||
{
|
||||
*aDelay = mDelay;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocNavStartProgressListener::SetDelay(PRUint32 aDelay)
|
||||
{
|
||||
mDelay = aDelay;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// nsDocNavStartProgressListener::GetCallback
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocNavStartProgressListener::GetCallback(
|
||||
nsIDocNavStartProgressCallback** aCallback)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aCallback);
|
||||
*aCallback = mCallback;
|
||||
NS_IF_ADDREF(*aCallback);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
// nsDocNavStartProgressListener::SetCallback
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocNavStartProgressListener::SetCallback(
|
||||
nsIDocNavStartProgressCallback* aCallback)
|
||||
{
|
||||
mCallback = aCallback;
|
||||
|
||||
// Break any cycles we have from mTimers to us by clearing all pending
|
||||
// requests and timers; the timers we use are not exposed externally, but
|
||||
// since we use ourself as an observer with each timer, we have to
|
||||
// manually break this cycle to ensure prompt destruction of this and
|
||||
// the release of everything this entrains, in the case that we can't wait
|
||||
// for all the timers to expire normally for some reason (e.g. application
|
||||
// shutdown).
|
||||
if (!aCallback)
|
||||
ClearPendingEvents();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocNavStartProgressListener::IsSpurious(nsIURI* aURI, PRBool* isSpurious)
|
||||
{
|
||||
NS_PRECONDITION(aURI, "Must have a URI!");
|
||||
|
||||
nsCAutoString scheme;
|
||||
nsresult rv;
|
||||
|
||||
// If there's a nested URI, we want to check the inner URI's scheme.
|
||||
// If we find a spurious scheme then we can break the checking loop at that point.
|
||||
nsCOMPtr<nsIURI> inner = aURI;
|
||||
nsCOMPtr<nsINestedURI> nestedURI = do_QueryInterface(inner);
|
||||
while (true) {
|
||||
rv = inner->GetScheme(scheme);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
*isSpurious = scheme.Equals("about") ||
|
||||
scheme.Equals("chrome") ||
|
||||
scheme.Equals("file") ||
|
||||
scheme.Equals("javascript");
|
||||
if (*isSpurious || !nestedURI)
|
||||
break;
|
||||
|
||||
rv = nestedURI->GetInnerURI(getter_AddRefs(inner));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nestedURI = do_QueryInterface(inner);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// nsIWebProgressListener ******************************************************
|
||||
|
||||
|
||||
// nsDocNavStartProgressListener::OnStateChange
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocNavStartProgressListener::OnStateChange(nsIWebProgress *aWebProgress,
|
||||
nsIRequest *aRequest,
|
||||
PRUint32 aStateFlags,
|
||||
nsresult aStatus)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
// nsDocNavStartProgressListener::OnProgressChange
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocNavStartProgressListener::OnProgressChange(nsIWebProgress *aWebProgress,
|
||||
nsIRequest *aRequest,
|
||||
PRInt32 aCurSelfProgress, PRInt32 aMaxSelfProgress,
|
||||
PRInt32 aCurTotalProgress,
|
||||
PRInt32 aMaxTotalProgress)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
// nsDocNavStartProgressListener::OnLocationChange
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocNavStartProgressListener::OnLocationChange(nsIWebProgress *aWebProgress,
|
||||
nsIRequest *aRequest,
|
||||
nsIURI *aLocation)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCAutoString uriString;
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
|
||||
// ignore requests with no URI
|
||||
rv = GetRequestUri(aRequest, getter_AddRefs(uri));
|
||||
if (NS_FAILED(rv))
|
||||
return NS_OK;
|
||||
rv = uri->GetAsciiSpec(uriString);
|
||||
if (NS_FAILED(rv))
|
||||
return NS_OK;
|
||||
|
||||
LOG(("Firing OnLocationChange for %s", uriString.get()));
|
||||
|
||||
// We store the request and a timer in queue. When the timer fires,
|
||||
// we use the request in the front of the queue.
|
||||
nsCOMPtr<nsITimer> timer = do_CreateInstance("@mozilla.org/timer;1", &rv);
|
||||
NS_ENSURE_TRUE(timer, rv);
|
||||
|
||||
rv = timer->Init(this, mDelay, nsITimer::TYPE_ONE_SHOT);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mRequests.AppendObject(aRequest);
|
||||
mTimers.AppendObject(timer);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
// nsDocNavStartProgressListener::OnStatusChange
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocNavStartProgressListener::OnStatusChange(nsIWebProgress *aWebProgress,
|
||||
nsIRequest *aRequest,
|
||||
nsresult aStatus,
|
||||
const PRUnichar *aMessage)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
// nsDocNavStartProgressListener::OnSecurityChange
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocNavStartProgressListener::OnSecurityChange(nsIWebProgress *aWebProgress,
|
||||
nsIRequest *aRequest,
|
||||
PRUint32 aState)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// nsIObserver ****************************************************************
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocNavStartProgressListener::Observe(nsISupports *subject, const char *topic,
|
||||
const PRUnichar *data)
|
||||
{
|
||||
if (strcmp(topic, NS_TIMER_CALLBACK_TOPIC) == 0) {
|
||||
// Timer callback, pop the front of the request queue and call the callback.
|
||||
#ifdef DEBUG
|
||||
PRUint32 length = mRequests.Count();
|
||||
NS_ASSERTION(length > 0, "timer callback with empty request queue?");
|
||||
length = mTimers.Count();
|
||||
NS_ASSERTION(length > 0, "timer callback with empty timer queue?");
|
||||
#endif
|
||||
|
||||
nsIRequest* request = mRequests[0];
|
||||
|
||||
if (mCallback) {
|
||||
PRBool isSpurious;
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsresult rv = GetRequestUri(request, getter_AddRefs(uri));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = IsSpurious(uri, &isSpurious);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!isSpurious) {
|
||||
nsCString uriString;
|
||||
rv = uri->GetAsciiSpec(uriString);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// We don't care about URL fragments so we take that off.
|
||||
PRInt32 pos = uriString.FindChar('#');
|
||||
if (pos > -1) {
|
||||
uriString.SetLength(pos);
|
||||
}
|
||||
|
||||
LOG(("Firing DocNavStart for %s", uriString.get()));
|
||||
mCallback->OnDocNavStart(request, uriString);
|
||||
}
|
||||
}
|
||||
|
||||
mRequests.RemoveObjectAt(0);
|
||||
mTimers.RemoveObjectAt(0);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
@ -1,81 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Google Safe Browsing.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Google Inc.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2006
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Brett Wilson <brettw@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsIDocNavStartProgressListener.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsIWebProgressListener.h"
|
||||
#include "nsCOMArray.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsWeakReference.h"
|
||||
|
||||
// Forward declare template types.
|
||||
class nsITimer;
|
||||
class nsIRequest;
|
||||
class nsIURI;
|
||||
|
||||
class nsDocNavStartProgressListener : public nsIDocNavStartProgressListener,
|
||||
public nsIWebProgressListener,
|
||||
public nsIObserver,
|
||||
public nsSupportsWeakReference
|
||||
{
|
||||
public:
|
||||
nsDocNavStartProgressListener();
|
||||
virtual ~nsDocNavStartProgressListener();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIDOCNAVSTARTPROGRESSLISTENER
|
||||
NS_DECL_NSIWEBPROGRESSLISTENER
|
||||
NS_DECL_NSIOBSERVER
|
||||
|
||||
protected:
|
||||
|
||||
PRBool mEnabled;
|
||||
PRUint32 mDelay;
|
||||
nsCOMPtr<nsIDocNavStartProgressCallback> mCallback;
|
||||
|
||||
// queue of pending requests; should we use nsDeque instead?
|
||||
nsCOMArray<nsIRequest> mRequests;
|
||||
nsCOMArray<nsITimer> mTimers;
|
||||
|
||||
nsresult AttachListeners();
|
||||
nsresult DetachListeners();
|
||||
|
||||
// clears mRequests, cancels each timer in mTimer and then clears mTimers
|
||||
void ClearPendingEvents();
|
||||
|
||||
// Pull the URI out of the request.
|
||||
nsresult GetRequestUri(nsIRequest* aReq, nsIURI** uri);
|
||||
};
|
@ -11,15 +11,10 @@ Function.prototype.inherits = function(parentCtor) {
|
||||
}
|
||||
|
||||
#include ../content/application.js
|
||||
#include ../content/browser-view.js
|
||||
#include ../content/controller.js
|
||||
#include ../content/firefox-commands.js
|
||||
#include ../content/globalstore.js
|
||||
#include ../content/list-warden.js
|
||||
#include ../content/phishing-afterload-displayer.js
|
||||
#include ../content/phishing-warden.js
|
||||
#include ../content/malware-warden.js
|
||||
#include ../content/reporter.js
|
||||
|
||||
var modScope = this;
|
||||
function Init() {
|
||||
|
@ -1,47 +0,0 @@
|
||||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 1998
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
|
||||
DEPTH = ../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
@ -1,2 +0,0 @@
|
||||
browser.jar:
|
||||
+ content/browser/protection/unittests.xul (unittests.xul)
|
@ -1,70 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<window id="PROT_unittest"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
onload="onProtUnittestLoad();"
|
||||
title="prot unittests">
|
||||
|
||||
<script><![CDATA[
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
|
||||
function G_Debug(zone, s) {
|
||||
var label = document.createElement('label');
|
||||
var txt = "[" + zone + "] " + s;
|
||||
label.appendChild(document.createTextNode(txt));
|
||||
|
||||
document.documentElement.appendChild(label);
|
||||
}
|
||||
|
||||
function G_Assert(zone, cond, msg) {
|
||||
if (!cond) {
|
||||
G_Debug(zone, msg);
|
||||
throw msg;
|
||||
}
|
||||
}
|
||||
|
||||
function ProtectionPhishWardenTests() {
|
||||
var z = "phishwarden UNITTEST";
|
||||
G_Debug(z, "Starting");
|
||||
|
||||
var listManager = Cc["@mozilla.org/protection/protectionlistmanager;1"]
|
||||
.getService(Ci.nsIProtectionListManager);
|
||||
var warden = Cc['@mozilla.org/protection/phishwarden;1']
|
||||
.createInstance(Ci.nsIProtectionListWarden);
|
||||
// Register tables that we are interested in.
|
||||
warden.registerBlackTable("test-black-url");
|
||||
|
||||
var blacklistedCount = 0;
|
||||
|
||||
var blackURLs = [
|
||||
"http://foo.com/1",
|
||||
"http://foo.com/2",
|
||||
"http://foo.com/3",
|
||||
"http://foo.com/4",
|
||||
"http://www.goodsite.com/test",
|
||||
];
|
||||
|
||||
for (var i = 0; i < blackURLs.length; i++)
|
||||
listManager.safeInsert("test-black-url", blackURLs[i], "1");
|
||||
|
||||
G_Assert(z, !warden.checkUrl("http://bar.com/"), 'should not have found');
|
||||
G_Assert(z, warden.checkUrl("http://foo.com/1"), 'should have found (1)');
|
||||
G_Assert(z, warden.checkUrl("http://foo.com/2"), 'should have found (2)');
|
||||
G_Assert(z, warden.checkUrl("http://foo.com/3"), 'should have found (3)');
|
||||
G_Assert(z, warden.checkUrl("http://foo.com/4"), 'should have found (4)');
|
||||
|
||||
warden.registerWhiteTable('test-white-domain');
|
||||
listManager.safeInsert("test-white-domain", "http://www.goodsite.com/", "1");
|
||||
|
||||
G_Assert(z, !warden.checkUrl("http://www.goodsite.com/"),
|
||||
'whitelist failed?')
|
||||
|
||||
|
||||
G_Debug(z, "PASSED");
|
||||
}
|
||||
|
||||
function onProtUnittestLoad() {
|
||||
ProtectionPhishWardenTests();
|
||||
}
|
||||
]]></script>
|
||||
</window>
|
@ -51,14 +51,6 @@ classic.jar:
|
||||
skin/classic/browser/preferences/plugin.png (preferences/plugin.png)
|
||||
* skin/classic/browser/preferences/preferences.css (preferences/preferences.css)
|
||||
skin/classic/browser/preferences/applications.css (preferences/applications.css)
|
||||
#ifdef MOZ_SAFE_BROWSING
|
||||
skin/classic/browser/safebrowsing/browser-protection.css (safebrowsing/browser-protection.css)
|
||||
skin/classic/browser/safebrowsing/close16x16.png (safebrowsing/close16x16.png)
|
||||
skin/classic/browser/safebrowsing/dim.png (safebrowsing/dim.png)
|
||||
skin/classic/browser/safebrowsing/tail.png (safebrowsing/tail.png)
|
||||
skin/classic/browser/safebrowsing/warning16x16.png (safebrowsing/warning16x16.png)
|
||||
skin/classic/browser/safebrowsing/warning24x24.png (safebrowsing/warning24x24.png)
|
||||
#endif
|
||||
skin/classic/browser/tabbrowser/tab-arrow-end.png (tabbrowser/tab-arrow-end.png)
|
||||
skin/classic/browser/tabbrowser/tab-arrow-start.png (tabbrowser/tab-arrow-start.png)
|
||||
skin/classic/browser/tabbrowser/tabDragIndicator.png (tabbrowser/tabDragIndicator.png)
|
||||
|
@ -1,116 +0,0 @@
|
||||
#safebrowsing-palm-message {
|
||||
display: none;
|
||||
position: fixed;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
#safebrowsing-palm-message-content {
|
||||
background-color: white;
|
||||
color: black;
|
||||
-moz-box-sizing: border-box;
|
||||
-moz-border-radius: 10px;
|
||||
padding: 10px;
|
||||
border-top: 1px solid;
|
||||
border-left: 1px solid;
|
||||
border-right: 2px solid;
|
||||
border-bottom: 2px solid;
|
||||
z-index: 1;
|
||||
margin: 0;
|
||||
font-size: 120%;
|
||||
}
|
||||
|
||||
.safebrowsing-palm-fixed-width {
|
||||
width: 400px;
|
||||
max-width: 400px;
|
||||
}
|
||||
|
||||
.safebrowsing-palm-paragraph {
|
||||
padding-bottom: 2em;
|
||||
}
|
||||
|
||||
#safebrowsing-palm-close-container {
|
||||
height: 16px;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#safebrowsing-palm-close {
|
||||
cursor: pointer;
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
list-style-image: url("chrome://browser/skin/safebrowsing/close16x16.png");
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
#safebrowsing-palm-message-tail-container {
|
||||
display: none;
|
||||
position: fixed;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
border-right: 2px solid;
|
||||
z-index: 3;
|
||||
height: 67px;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#safebrowsing-palm-message-tail {
|
||||
height: 67px;
|
||||
width: 24px;
|
||||
max-width: 24px;
|
||||
z-index: 3;
|
||||
}
|
||||
|
||||
#safebrowsing-palm-message-titlebox {
|
||||
background-image: url("chrome://browser/skin/safebrowsing/warning24x24.png");
|
||||
background-repeat: no-repeat;
|
||||
background-position: top left;
|
||||
text-indent: 30px;
|
||||
padding: 0 0 5px;
|
||||
margin-top: -16px;
|
||||
font-size: 120%;
|
||||
font-weight: bold;
|
||||
min-height: 26px;
|
||||
}
|
||||
|
||||
#safebrowsing-palm-message-actionbox {
|
||||
padding: 10px 10px 15px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.safebrowsing-palm-bigtext {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.safebrowsing-palm-smalltext {
|
||||
font-size: 80%;
|
||||
}
|
||||
|
||||
#safebrowsing-palm-google-logo {
|
||||
height: 32px;
|
||||
max-height: 32px;
|
||||
width: 78px;
|
||||
}
|
||||
|
||||
#safebrowsing-page-canvas {
|
||||
position: fixed;
|
||||
}
|
||||
|
||||
#safebrowsing-dim-area-canvas {
|
||||
background-image: url("chrome://browser/skin/safebrowsing/dim.png");
|
||||
position: fixed;
|
||||
}
|
||||
|
||||
#safebrowsing-urlbar-icon {
|
||||
padding: 1px 2px 1px 0;
|
||||
}
|
||||
|
||||
#safebrowsing-urlbar-icon[level="safe"] {
|
||||
list-style-image: none;
|
||||
}
|
||||
|
||||
#safebrowsing-urlbar-icon[level="warn"] {
|
||||
list-style-image: url("chrome://browser/skin/safebrowsing/warning16x16.png");
|
||||
}
|
Before Width: | Height: | Size: 797 B |
Before Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 759 B |
Before Width: | Height: | Size: 735 B |
Before Width: | Height: | Size: 1.3 KiB |
@ -78,14 +78,6 @@ classic.jar:
|
||||
skin/classic/browser/places/expander-closed.png (bookmarks/expander-closed.png)
|
||||
skin/classic/browser/places/expander-open-active.png (bookmarks/expander-open-active.png)
|
||||
skin/classic/browser/places/expander-open.png (bookmarks/expander-open.png)
|
||||
#ifdef MOZ_SAFE_BROWSING
|
||||
skin/classic/browser/safebrowsing/browser-protection.css (safebrowsing/browser-protection.css)
|
||||
skin/classic/browser/safebrowsing/close16x16.png (safebrowsing/close16x16.png)
|
||||
skin/classic/browser/safebrowsing/dim.png (safebrowsing/dim.png)
|
||||
skin/classic/browser/safebrowsing/tail.png (safebrowsing/tail.png)
|
||||
skin/classic/browser/safebrowsing/warning16x16.png (safebrowsing/warning16x16.png)
|
||||
skin/classic/browser/safebrowsing/warning24x24.png (safebrowsing/warning24x24.png)
|
||||
#endif
|
||||
skin/classic/browser/preferences/application.png (preferences/application.png)
|
||||
skin/classic/browser/preferences/Options.png (preferences/Options.png)
|
||||
skin/classic/browser/preferences/plugin.png (preferences/plugin.png)
|
||||
|
@ -1,117 +0,0 @@
|
||||
#safebrowsing-palm-message {
|
||||
display: none;
|
||||
position: fixed;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
#safebrowsing-palm-message-content {
|
||||
background-color: white;
|
||||
color: black;
|
||||
-moz-box-sizing: border-box;
|
||||
-moz-border-radius: 10px;
|
||||
padding: 10px;
|
||||
border-top: 1px solid;
|
||||
border-left: 1px solid;
|
||||
border-right: 2px solid;
|
||||
border-bottom: 2px solid;
|
||||
z-index: 1;
|
||||
margin: 0;
|
||||
font-size: 120%;
|
||||
}
|
||||
|
||||
.safebrowsing-palm-fixed-width {
|
||||
width: 400px;
|
||||
max-width: 400px;
|
||||
}
|
||||
|
||||
.safebrowsing-palm-paragraph {
|
||||
padding-bottom: 2em;
|
||||
}
|
||||
|
||||
#safebrowsing-palm-close-container {
|
||||
height: 16px;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#safebrowsing-palm-close {
|
||||
cursor: pointer;
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
list-style-image: url("chrome://browser/skin/safebrowsing/close16x16.png");
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
#safebrowsing-palm-message-tail-container {
|
||||
display: none;
|
||||
position: fixed;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
border-right: 2px solid;
|
||||
z-index: 3;
|
||||
height: 67px;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#safebrowsing-palm-message-tail {
|
||||
height: 67px;
|
||||
width: 24px;
|
||||
max-width: 24px;
|
||||
z-index: 3;
|
||||
}
|
||||
|
||||
#safebrowsing-palm-message-titlebox {
|
||||
background-image: url("chrome://browser/skin/safebrowsing/warning24x24.png");
|
||||
background-repeat: no-repeat;
|
||||
background-position: top left;
|
||||
text-indent: 30px;
|
||||
padding: 0 0 5px;
|
||||
margin-top: -16px;
|
||||
font-size: 120%;
|
||||
font-weight: bold;
|
||||
min-height: 26px;
|
||||
}
|
||||
|
||||
#safebrowsing-palm-message-actionbox {
|
||||
padding: 10px 10px 15px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.safebrowsing-palm-bigtext {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.safebrowsing-palm-smalltext {
|
||||
font-size: 80%;
|
||||
}
|
||||
|
||||
#safebrowsing-palm-google-logo {
|
||||
height: 32px;
|
||||
max-height: 32px;
|
||||
width: 78px;
|
||||
}
|
||||
|
||||
#safebrowsing-page-canvas {
|
||||
position: fixed;
|
||||
}
|
||||
|
||||
#safebrowsing-dim-area-canvas {
|
||||
background-image: url("chrome://browser/skin/safebrowsing/dim.png");
|
||||
position: fixed;
|
||||
}
|
||||
|
||||
#safebrowsing-urlbar-icon {
|
||||
padding: 1px 2px 1px 0;
|
||||
margin: -1px;
|
||||
}
|
||||
|
||||
#safebrowsing-urlbar-icon[level="safe"] {
|
||||
list-style-image: none;
|
||||
}
|
||||
|
||||
#safebrowsing-urlbar-icon[level="warn"] {
|
||||
list-style-image: url("chrome://browser/skin/safebrowsing/warning16x16.png");
|
||||
}
|
Before Width: | Height: | Size: 710 B |
Before Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 759 B |
Before Width: | Height: | Size: 705 B |
Before Width: | Height: | Size: 1.2 KiB |
@ -51,14 +51,6 @@ classic.jar:
|
||||
skin/classic/browser/places/tag.png (places/tag.png)
|
||||
skin/classic/browser/places/bookmarkProperties.css (places/bookmarkProperties.css)
|
||||
skin/classic/browser/places/organizer-toolbar.png (bookmarks/Bookmarks-toolbar.png)
|
||||
#ifdef MOZ_SAFE_BROWSING
|
||||
skin/classic/browser/safebrowsing/browser-protection.css (safebrowsing/browser-protection.css)
|
||||
skin/classic/browser/safebrowsing/close16x16.png (safebrowsing/close16x16.png)
|
||||
skin/classic/browser/safebrowsing/dim.png (safebrowsing/dim.png)
|
||||
skin/classic/browser/safebrowsing/tail.png (safebrowsing/tail.png)
|
||||
skin/classic/browser/safebrowsing/warning16x16.png (safebrowsing/warning16x16.png)
|
||||
skin/classic/browser/safebrowsing/warning24x24.png (safebrowsing/warning24x24.png)
|
||||
#endif
|
||||
skin/classic/browser/preferences/alwaysAsk.png (preferences/alwaysAsk.png)
|
||||
skin/classic/browser/preferences/application.png (preferences/application.png)
|
||||
skin/classic/browser/preferences/Options.png (preferences/Options.png)
|
||||
|
@ -1,116 +0,0 @@
|
||||
#safebrowsing-palm-message {
|
||||
display: none;
|
||||
position: fixed;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
#safebrowsing-palm-message-content {
|
||||
background-color: white;
|
||||
color: black;
|
||||
-moz-box-sizing: border-box;
|
||||
-moz-border-radius: 10px;
|
||||
padding: 10px;
|
||||
border-top: 1px solid;
|
||||
border-left: 1px solid;
|
||||
border-right: 2px solid;
|
||||
border-bottom: 2px solid;
|
||||
z-index: 1;
|
||||
margin: 0;
|
||||
font-size: 120%;
|
||||
}
|
||||
|
||||
.safebrowsing-palm-fixed-width {
|
||||
width: 400px;
|
||||
max-width: 400px;
|
||||
}
|
||||
|
||||
.safebrowsing-palm-paragraph {
|
||||
padding-bottom: 2em;
|
||||
}
|
||||
|
||||
#safebrowsing-palm-close-container {
|
||||
height: 16px;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#safebrowsing-palm-close {
|
||||
cursor: pointer;
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
list-style-image: url("chrome://browser/skin/safebrowsing/close16x16.png");
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
#safebrowsing-palm-message-tail-container {
|
||||
display: none;
|
||||
position: fixed;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
border-right: 2px solid;
|
||||
z-index: 3;
|
||||
height: 67px;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#safebrowsing-palm-message-tail {
|
||||
height: 67px;
|
||||
width: 24px;
|
||||
max-width: 24px;
|
||||
z-index: 3;
|
||||
}
|
||||
|
||||
#safebrowsing-palm-message-titlebox {
|
||||
background-image: url("chrome://browser/skin/safebrowsing/warning24x24.png");
|
||||
background-repeat: no-repeat;
|
||||
background-position: top left;
|
||||
text-indent: 30px;
|
||||
padding: 0 0 5px;
|
||||
margin-top: -16px;
|
||||
font-size: 120%;
|
||||
font-weight: bold;
|
||||
min-height: 26px;
|
||||
}
|
||||
|
||||
#safebrowsing-palm-message-actionbox {
|
||||
padding: 10px 10px 15px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.safebrowsing-palm-bigtext {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.safebrowsing-palm-smalltext {
|
||||
font-size: 80%;
|
||||
}
|
||||
|
||||
#safebrowsing-palm-google-logo {
|
||||
height: 32px;
|
||||
max-height: 32px;
|
||||
width: 78px;
|
||||
}
|
||||
|
||||
#safebrowsing-page-canvas {
|
||||
position: fixed;
|
||||
}
|
||||
|
||||
#safebrowsing-dim-area-canvas {
|
||||
background-image: url("chrome://browser/skin/safebrowsing/dim.png");
|
||||
position: fixed;
|
||||
}
|
||||
|
||||
#safebrowsing-urlbar-icon {
|
||||
padding: 1px 2px 1px 0;
|
||||
}
|
||||
|
||||
#safebrowsing-urlbar-icon[level="safe"] {
|
||||
list-style-image: none;
|
||||
}
|
||||
|
||||
#safebrowsing-urlbar-icon[level="warn"] {
|
||||
list-style-image: url("chrome://browser/skin/safebrowsing/warning16x16.png");
|
||||
}
|
Before Width: | Height: | Size: 797 B |
Before Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 759 B |
Before Width: | Height: | Size: 735 B |
Before Width: | Height: | Size: 1.3 KiB |