Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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 | } |