dom/base/ObjectWrapper.jsm

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     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 file,
     3  * You can obtain one at http://mozilla.org/MPL/2.0/. */
     5 "use strict"
     7 const Cu = Components.utils;
     8 const Cc = Components.classes;
     9 const Ci = Components.interfaces;
    11 this.EXPORTED_SYMBOLS = ["ObjectWrapper"];
    13 // Makes sure that we expose correctly chrome JS objects to content.
    15 const TypedArrayThings = [
    16   "Int8Array",
    17   "Uint8Array",
    18   "Uint8ClampedArray",
    19   "Int16Array",
    20   "Uint16Array",
    21   "Int32Array",
    22   "Uint32Array",
    23   "Float32Array",
    24   "Float64Array",
    25 ];
    27 this.ObjectWrapper = {
    28   getObjectKind: function objWrapper_getObjectKind(aObject) {
    29     if (aObject === null || aObject === undefined) {
    30       return "primitive";
    31     } else if (Array.isArray(aObject)) {
    32       return "array";
    33     } else if (aObject instanceof Ci.nsIDOMFile) {
    34       return "file";
    35     } else if (aObject instanceof Ci.nsIDOMBlob) {
    36       return "blob";
    37     } else if (aObject instanceof Date) {
    38       return "date";
    39     } else if (TypedArrayThings.indexOf(aObject.constructor.name) !== -1) {
    40       return aObject.constructor.name;
    41     } else if (typeof aObject == "object") {
    42       return "object";
    43     } else {
    44       return "primitive";
    45     }
    46   },
    48   wrap: function objWrapper_wrap(aObject, aCtxt) {
    49     dump("-*- ObjectWrapper is deprecated. Use Components.utils.cloneInto() instead.\n");
    50     return Cu.cloneInto(aObject, aCtxt, { cloneFunctions: true });
    51   }
    52 }

mercurial