tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

mozIJSSubScriptLoader.idl (2792B)


      1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
      2 *
      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/. */
      6 
      7 #include "nsISupports.idl"
      8 
      9 interface nsIURI;
     10 interface nsIPrincipal;
     11 interface nsIObserver;
     12 
     13 /**
     14 * Interface for synchronous script loads from local file: or jar: sources.
     15 * For asynchronous script loads, ChromeUtils.compileScript() should be used
     16 * instead.
     17 */
     18 [scriptable, builtinclass, uuid(19533e7b-f321-4ef1-bc59-6e812dc2a733)]
     19 interface mozIJSSubScriptLoader : nsISupports
     20 {
     21    /**
     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, which MUST be either
     26     *            a chrome:, resource:, moz-src:, file:, jar:, or (privileged) moz-extension: url.
     27     *            TODO(Bug 1974213):  Disallow file: or jar.
     28     * @param obj an optional object to evaluate the script onto, it
     29     *            defaults to the global object of the caller.
     30     * @retval rv the value returned by the sub-script
     31     */
     32    [implicit_jscontext]
     33    jsval loadSubScript(in AString url, [optional] in jsval obj);
     34 
     35    /**
     36     * This method should only be called from JS!
     37     * In JS, the signature looks like:
     38     * rv = loadSubScript (url, optionsObject)
     39     * @param url the url of the UTF-8-encoded sub-script, which MUST be either
     40     *            a chrome:, resource:, moz-src:, file:, jar:, or (privileged) moz-extension: url.
     41     *            TODO(Bug 1974213):  Disallow file: or jar.
     42     * @param optionsObject an object with parameters. Valid parameters are:
     43     *                      - target:  an object to evaluate onto (default: global object of the caller)
     44     *                      - ignoreCache: if set to true, will bypass the cache for reading the file.
     45     *                      - async: if set to true, the script will be loaded
     46     *                        asynchronously, and a Promise is returned which
     47     *                        resolves to its result when execution is complete.
     48     *                      - wantReturnValue: If true, the script will return
     49     *                        the value of the last statement that it evaluated.
     50     *                        This option disables most optimizations in the
     51     *                        top-level scope, and should be avoided if at all
     52     *                        possible. Defaults to false.
     53     * @retval rv the value returned by the sub-script
     54     */
     55    [implicit_jscontext]
     56    jsval loadSubScriptWithOptions(in AString url, in jsval options);
     57 };