1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/xpconnect/idl/mozIJSSubScriptLoader.idl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,64 @@ 1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- 1.5 + * 1.6 + * This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +#include "nsISupports.idl" 1.11 + 1.12 +interface nsIURI; 1.13 +interface nsIPrincipal; 1.14 +interface nsIObserver; 1.15 + 1.16 +[scriptable, uuid(19533e7b-f321-4ef1-bc59-6e812dc2a733)] 1.17 +interface mozIJSSubScriptLoader : nsISupports 1.18 +{ 1.19 + /** 1.20 + * This method should only be called from JS! 1.21 + * In JS, the signature looks like: 1.22 + * rv loadSubScript (url [, obj] [, charset]); 1.23 + * @param url the url of the sub-script, it MUST be either a file:, 1.24 + * resource:, or chrome: url, and MUST be local. 1.25 + * @param obj an optional object to evaluate the script onto, it 1.26 + * defaults to the global object of the caller. 1.27 + * @param charset optionally specifies the character encoding of 1.28 + * the file. If absent, the file is interpreted 1.29 + * as ASCII. 1.30 + * @retval rv the value returned by the sub-script 1.31 + */ 1.32 + [implicit_jscontext] 1.33 + jsval loadSubScript(in AString url, [optional] in jsval obj, [optional] in AString charset); 1.34 + 1.35 + /** 1.36 + * This method should only be called from JS! 1.37 + * In JS, the signature looks like: 1.38 + * rv = loadSubScript (url, optionsObject) 1.39 + * @param url the url of the sub-script, it MUST be either a file:, 1.40 + * resource:, or chrome: url, and MUST be local. 1.41 + * @param optionsObject an object with parameters. Valid parameters are: 1.42 + * - charset: specifying the character encoding of the file (default: ASCII) 1.43 + * - target: an object to evaluate onto (default: global object of the caller) 1.44 + * - ignoreCache: if set to true, will bypass the cache for reading the file. 1.45 + * @retval rv the value returned by the sub-script 1.46 + */ 1.47 + [implicit_jscontext] 1.48 + jsval loadSubScriptWithOptions(in AString url, in jsval options); 1.49 + 1.50 + /* 1.51 + * Compiles a JS script off the main thread and calls back the 1.52 + * observer once it's done. 1.53 + * The script will be cached in temporary or persistent storage depending 1.54 + * on the principal used. 1.55 + * We fire the notification callback in all cases - there is no fatal 1.56 + * error there. 1.57 + * @param uri the uri of the script to load. 1.58 + * @param principal the principal from which we get the app id if any. 1.59 + * @param observer this observer will be called once the script has 1.60 + * been precompiled. The notification topic will be 1.61 + * 'script-precompiled' and the subject the uri of the 1.62 + * script as a nsIURI. 1.63 + */ 1.64 + void precompileScript(in nsIURI uri, 1.65 + in nsIPrincipal principal, 1.66 + in nsIObserver observer); 1.67 +};