dom/payment/tests/unit/header_helper.js

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 /* 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