nsPrivateBrowsingService - /@line 38

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
//@line 38 "e:\builds\moz2_slave\win32_build\build\browser\components\privatebrowsing\src\nsPr ivateBrowsingService.js" Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); //////////////////////////////////////////////////////////////////////////////// //// Utilities /** * Returns true if the string passed in is part of the root domain of the * current string. For example, if this is "www.mozilla.org", and we pass in * "mozilla.org", this will return true. It would return false the other way * around. */ String.prototype.hasRootDomain = function hasRootDomain(aDomain) { let index = this.indexOf(aDomain); // If aDomain is not found, we know we do not have it as a root domain. if (index == -1) return false; // If the strings are the same, we obviously have a match. if (this == aDomain) return true; // Otherwise, we have aDomain as our root domain iff the index of aDomain is // aDomain.length subtracted from our length and (since we do not have an // exact match) the character before the index is a dot or slash. let prevChar = this[index - 1]; (prevChar == "." || prevChar == "/"); } //////////////////////////////////////////////////////////////////////////////// //// Constants const Cc = Components.classes; const Ci = Components.interfaces; const Cu = Components.utils; const Cr = Components.results; const STATE_IDLE = 0; const STATE_TRANSITION_STARTED = 1; const STATE_WAITING_FOR_RESTORE = 2; const STATE_RESTORE_FINISHED = 3; //////////////////////////////////////////////////////////////////////////////// //// PrivateBrowsingService function PrivateBrowsingService() { this._obs.addObserver(this, "profile-after-change", true); this._obs.addObserver(this, "quit-application-granted", true); this._obs.addObserver(this, "private-browsing", true); this._obs.addObserver(this, "command-line-startup", true); this._obs.addObserver(this, "sessionstore-browser-state-restored", true); } PrivateBrowsingService.prototype = {
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
// Observer Service __obs: null, get _obs() { if (!this.__obs) this.__obs = Cc["@mozilla.org/observer-service;1"]. getService(Ci.nsIObserverService); return this.__obs; }, // Preferences Service __prefs: null, get _prefs() { if (!this.__prefs) this.__prefs = Cc["@mozilla.org/preferences-service;1"]. getService(Ci.nsIPrefBranch); return this.__prefs; }, // Whether the private browsing mode is currently active or not. _inPrivateBrowsing: false, // Saved browser state before entering the private mode. _savedBrowserState: null, // Whether we're in the process of shutting down _quitting: false, // How to treat the non-private session _saveSession: true, // The current status of the private browsing service _currentStatus: STATE_IDLE, // Whether the private browsing mode has been started automatically (ie. always- on) _autoStarted: false, // List of view source window URIs for restoring later _viewSrcURLs: [], // List of nsIXULWindows we are going to be closing during the transition _windowsToClose: [],
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 12

nsPrivateBrowsingService - /@line 38

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online