addon-sdk/source/test/traits/utils.js

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
     3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     5 "use strict";
     7 var ERR_CONFLICT = "Remaining conflicting property: ";
     8 var ERR_REQUIRED = "Missing required property: ";
    10 exports.Data = function Data(value, enumerable, configurable, writable) {
    11   return ({
    12     value: value,
    13     enumerable: enumerable !== false,
    14     configurable: configurable !== false,
    15     writable: writable !== false
    16   });
    17 };
    19 exports.Method = function Method(method, enumerable, configurable, writable) {
    20   return ({
    21     value: method,
    22     enumerable: enumerable !== false,
    23     configurable: configurable !== false,
    24     writable: writable !== false
    25   });
    26 };
    28 exports.Accessor = function Accessor(get, set, enumerable, configurable) {
    29   return ({
    30     get: get,
    31     set: set,
    32     enumerable: enumerable !== false,
    33     configurable: configurable !== false
    34   });
    35 };
    37 exports.Required = function Required(name) {
    38   function required() { throw new Error(ERR_REQUIRED + name) }
    40   return ({
    41     get: required,
    42     set: required,
    43     required: true
    44   });
    45 };
    47 exports.Conflict = function Conflict(name) {
    48   function conflict() { throw new Error(ERR_CONFLICT + name) }
    50   return ({
    51     get: conflict,
    52     set: conflict,
    53     conflict: true
    54   });
    55 };

mercurial