Thu, 15 Jan 2015 15:55:04 +0100
Back out 97036ab72558 which inappropriately compared turds to third parties.
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 }