dom/payment/tests/unit/header_helper.js

Thu, 15 Jan 2015 15:55:04 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:55:04 +0100
branch
TOR_BUG_9701
changeset 9
a63d609f5ebe
permissions
-rw-r--r--

Back out 97036ab72558 which inappropriately compared turds to third parties.

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

mercurial