1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include
"nsISupports.idl"
10 interface nsIPrincipal
;
11 interface nsIObserver
;
14 * Interface for synchronous script loads from local file: or jar: sources.
15 * For asynchronous script loads, ChromeUtils.compileScript() should be used
18 [scriptable
, builtinclass
, uuid(19533e7b
-f321
-4ef1
-bc59
-6e812dc2a733
)]
19 interface mozIJSSubScriptLoader
: nsISupports
22 * This method should only be called from JS!
23 * In JS, the signature looks like:
24 * rv loadSubScript (url [, obj] [, charset]);
25 * @param url the url of the UTF-8-encoded sub-script, it MUST be either a
26 * file:, resource:, blob:, or chrome: url, and MUST be local.
27 * @param obj an optional object to evaluate the script onto, it
28 * defaults to the global object of the caller.
29 * @retval rv the value returned by the sub-script
32 jsval loadSubScript
(in AString url
, [optional] in jsval obj
);
35 * This method should only be called from JS!
36 * In JS, the signature looks like:
37 * rv = loadSubScript (url, optionsObject)
38 * @param url the url of the UTF-8-encoded sub-script, which MUST be either
39 * a file:, resource:, blob:, or chrome: url, and MUST be local.
40 * @param optionsObject an object with parameters. Valid parameters are:
41 * - target: an object to evaluate onto (default: global object of the caller)
42 * - ignoreCache: if set to true, will bypass the cache for reading the file.
43 * - async: if set to true, the script will be loaded
44 * asynchronously, and a Promise is returned which
45 * resolves to its result when execution is complete.
46 * - wantReturnValue: If true, the script will return
47 * the value of the last statement that it evaluated.
48 * This option disables most optimizations in the
49 * top-level scope, and should be avoided if at all
50 * possible. Defaults to false.
51 * @retval rv the value returned by the sub-script
54 jsval loadSubScriptWithOptions
(in AString url
, in jsval options
);