dom/payment/tests/unit/header_helper.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 /* Any copyright is dedicated to the Public Domain.
     2    http://creativecommons.org/publicdomain/zero/1.0/ */
     4 "use strict";
     6 const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
     8 let subscriptLoader = Cc["@mozilla.org/moz/jssubscript-loader;1"]
     9                         .getService(Ci.mozIJSSubScriptLoader);
    11 /**
    12  * Start a new payment module.
    13  *
    14  * @param custom_ns
    15  *        Namespace with symbols to be injected into the new payment module
    16  *        namespace.
    17  *
    18  * @return an object that represents the payment module's namespace.
    19  */
    20 function newPaymentModule(custom_ns) {
    21   let payment_ns = {
    22     importScripts: function fakeImportScripts() {
    23       Array.slice(arguments).forEach(function (script) {
    24         subscriptLoader.loadSubScript("resource://gre/modules/" + script, this);
    25       }, this);
    26     },
    27   };
    29   // Copy the custom definitions over.
    30   for (let key in custom_ns) {
    31     payment_ns[key] = custom_ns[key];
    32   }
    34   // Load the payment module itself.
    35   payment_ns.importScripts("Payment.jsm");
    37   return payment_ns;
    38 }

mercurial