toolkit/modules/LoadContextInfo.jsm

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* This Source Code Form is subject to the terms of the Mozilla Public
     2  * License, v. 2.0. If a copy of the MPL was not distributed with this
     3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     5 this.EXPORTED_SYMBOLS = ["LoadContextInfo"];
     7 const Ci = Components.interfaces;
     8 const Cc = Components.classes;
     9 const Cr = Components.results;
    11 Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
    13 this.LoadContextInfo = {};
    15 _LoadContextInfo.prototype = {
    16   QueryInterface: XPCOMUtils.generateQI([Ci.nsILoadContextInfo, Ci.nsISupports]),
    17   get isPrivate() { return this._isPrivate },
    18   get isAnonymous() { return this._isAnonymous },
    19   get isInBrowserElement() { return this._isInBrowserElement },
    20   get appId() { return this._appId }
    21 }
    23 function _LoadContextInfo(_private, _anonymous, _appId, _inBrowser) {
    24   this._isPrivate = _private || false;
    25   this._isAnonymous = _anonymous || false;
    26   this._appId = _appId || 0;
    27   this._isInBrowserElement = _inBrowser || false;
    28 }
    30 // LoadContextInfo.default
    32 // Non-private, non-anonymous, no app ID, not in browser
    33 XPCOMUtils.defineLazyGetter(LoadContextInfo, "default", function () {
    34   return new _LoadContextInfo(false, false, 0, false);
    35 });
    37 // LoadContextInfo.private
    39 // Private, non-anonymous, no app ID, not in browser
    40 XPCOMUtils.defineLazyGetter(LoadContextInfo, "private", function () {
    41   return new _LoadContextInfo(true, false, 0, false);
    42 });
    44 // LoadContextInfo.anonymous
    46 // Non-private, anonymous, no app ID, not in browser
    47 XPCOMUtils.defineLazyGetter(LoadContextInfo, "anonymous", function () {
    48   return new _LoadContextInfo(false, true, 0, false);
    49 });
    51 // Fully customizable
    52 LoadContextInfo.custom = function(_private, _anonymous, _appId, _inBrowser) {
    53   return new _LoadContextInfo(_private, _anonymous, _appId, _inBrowser);
    54 }
    56 // Copies info from provided nsILoadContext
    57 LoadContextInfo.fromLoadContext = function(_loadContext, _anonymous) {
    58   return new _LoadContextInfo(_loadContext.isPrivate,
    59                               _anonymous,
    60                               _loadContext.appId,
    61                               _loadContext.isInBrowserElement);
    62 }

mercurial