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 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #include "nsISupports.idl" |
michael@0 | 7 | |
michael@0 | 8 | [ptr] native nsAXPCNativeCallContextPtr(nsAXPCNativeCallContext); |
michael@0 | 9 | |
michael@0 | 10 | %{C++ |
michael@0 | 11 | #include "js/TypeDecls.h" |
michael@0 | 12 | |
michael@0 | 13 | class nsAXPCNativeCallContext; |
michael@0 | 14 | %} |
michael@0 | 15 | |
michael@0 | 16 | [ptr] native JSObjectPtr(JSObject); |
michael@0 | 17 | |
michael@0 | 18 | [scriptable, uuid(243d1a31-db9f-47a1-9922-55a1ad5515fb)] |
michael@0 | 19 | interface xpcIJSModuleLoader : nsISupports |
michael@0 | 20 | { |
michael@0 | 21 | /** |
michael@0 | 22 | * To be called from JavaScript only. |
michael@0 | 23 | * |
michael@0 | 24 | * Synchronously loads and evaluates the js file located at |
michael@0 | 25 | * aResourceURI with a new, fully privileged global object. |
michael@0 | 26 | * |
michael@0 | 27 | * If 'targetObj' is specified and equal to null, returns the |
michael@0 | 28 | * module's global object. Otherwise (if 'targetObj' is not |
michael@0 | 29 | * specified, or 'targetObj' is != null) looks for a property |
michael@0 | 30 | * 'EXPORTED_SYMBOLS' on the new global object. 'EXPORTED_SYMBOLS' |
michael@0 | 31 | * is expected to be an array of strings identifying properties on |
michael@0 | 32 | * the global object. These properties will be installed as |
michael@0 | 33 | * properties on 'targetObj', or, if 'targetObj' is not specified, |
michael@0 | 34 | * on the caller's global object. If 'EXPORTED_SYMBOLS' is not |
michael@0 | 35 | * found, an error is thrown. |
michael@0 | 36 | * |
michael@0 | 37 | * @param resourceURI A resource:// URI string to load the module from. |
michael@0 | 38 | * @param targetObj the object to install the exported properties on. |
michael@0 | 39 | * If this parameter is a primitive value, this method throws |
michael@0 | 40 | * an exception. |
michael@0 | 41 | * @returns the module code's global object. |
michael@0 | 42 | * |
michael@0 | 43 | * The implementation maintains a hash of registryLocation->global obj. |
michael@0 | 44 | * Subsequent invocations of importModule with 'registryLocation' |
michael@0 | 45 | * pointing to the same file will not cause the module to be re-evaluated, |
michael@0 | 46 | * but the symbols in EXPORTED_SYMBOLS will be exported into the |
michael@0 | 47 | * specified target object and the global object returned as above. |
michael@0 | 48 | * |
michael@0 | 49 | * (This comment is duplicated to nsIXPCComponents_Utils.) |
michael@0 | 50 | */ |
michael@0 | 51 | [implicit_jscontext,optional_argc] |
michael@0 | 52 | jsval import(in AUTF8String aResourceURI, [optional] in jsval targetObj); |
michael@0 | 53 | |
michael@0 | 54 | /** |
michael@0 | 55 | * Imports the JS module at aResourceURI to the JS object |
michael@0 | 56 | * 'targetObj' (if != null) as described for importModule() and |
michael@0 | 57 | * returns the module's global object. |
michael@0 | 58 | */ |
michael@0 | 59 | [noscript] JSObjectPtr importInto(in AUTF8String aResourceURI, |
michael@0 | 60 | in JSObjectPtr targetObj, |
michael@0 | 61 | in nsAXPCNativeCallContextPtr cc); |
michael@0 | 62 | |
michael@0 | 63 | /** |
michael@0 | 64 | * Unloads the JS module at aResourceURI. Existing references to the module |
michael@0 | 65 | * will continue to work but any subsequent import of the module will |
michael@0 | 66 | * reload it and give new reference. If the JS module hasn't yet been imported |
michael@0 | 67 | * then this method will do nothing. |
michael@0 | 68 | */ |
michael@0 | 69 | void unload(in AUTF8String aResourceURI); |
michael@0 | 70 | }; |