js/xpconnect/idl/xpccomponents.idl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/xpconnect/idl/xpccomponents.idl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,619 @@
     1.4 +/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#include "nsISupports.idl"
    1.10 +
    1.11 +%{C++
    1.12 +#include "jspubtd.h"
    1.13 +%}
    1.14 +
    1.15 +interface xpcIJSWeakReference;
    1.16 +interface nsIClassInfo;
    1.17 +interface nsIComponentManager;
    1.18 +interface nsIJSCID;
    1.19 +interface nsIJSIID;
    1.20 +interface nsIPrincipal;
    1.21 +interface nsIStackFrame;
    1.22 +
    1.23 +/**
    1.24 +* interface of Components.interfacesByID
    1.25 +* (interesting stuff only reflected into JavaScript)
    1.26 +*/
    1.27 +[scriptable, uuid(c99cffac-5aed-4267-ad2f-f4a4c9d4a081)]
    1.28 +interface nsIXPCComponents_InterfacesByID : nsISupports
    1.29 +{
    1.30 +};
    1.31 +
    1.32 +/**
    1.33 +* interface of Components.interfaces
    1.34 +* (interesting stuff only reflected into JavaScript)
    1.35 +*/
    1.36 +[scriptable, uuid(b8c31bba-79db-4a1d-930d-4cdd68713f9e)]
    1.37 +interface nsIXPCComponents_Interfaces : nsISupports
    1.38 +{
    1.39 +};
    1.40 +
    1.41 +/**
    1.42 +* interface of Components.classes
    1.43 +* (interesting stuff only reflected into JavaScript)
    1.44 +*/
    1.45 +[scriptable, uuid(978ff520-d26c-11d2-9842-006008962422)]
    1.46 +interface nsIXPCComponents_Classes : nsISupports
    1.47 +{
    1.48 +};
    1.49 +
    1.50 +/**
    1.51 +* interface of Components.classesByID
    1.52 +* (interesting stuff only reflected into JavaScript)
    1.53 +*/
    1.54 +[scriptable, uuid(336a9590-4d19-11d3-9893-006008962422)]
    1.55 +interface nsIXPCComponents_ClassesByID : nsISupports
    1.56 +{
    1.57 +};
    1.58 +
    1.59 +/**
    1.60 +* interface of Components.results
    1.61 +* (interesting stuff only reflected into JavaScript)
    1.62 +*/
    1.63 +[scriptable, uuid(2fc229a0-5860-11d3-9899-006008962422)]
    1.64 +interface nsIXPCComponents_Results : nsISupports
    1.65 +{
    1.66 +};
    1.67 +
    1.68 +/**
    1.69 +* interface of Components.ID
    1.70 +* (interesting stuff only reflected into JavaScript)
    1.71 +*/
    1.72 +[scriptable, uuid(7994a6e0-e028-11d3-8f5d-0010a4e73d9a)]
    1.73 +interface nsIXPCComponents_ID : nsISupports
    1.74 +{
    1.75 +};
    1.76 +
    1.77 +/**
    1.78 +* interface of Components.Exception
    1.79 +* (interesting stuff only reflected into JavaScript)
    1.80 +*/
    1.81 +[scriptable, uuid(5bf039c0-e028-11d3-8f5d-0010a4e73d9a)]
    1.82 +interface nsIXPCComponents_Exception : nsISupports
    1.83 +{
    1.84 +};
    1.85 +
    1.86 +/**
    1.87 +* interface of Components.Constructor
    1.88 +* (interesting stuff only reflected into JavaScript)
    1.89 +*/
    1.90 +[scriptable, uuid(88655640-e028-11d3-8f5d-0010a4e73d9a)]
    1.91 +interface nsIXPCComponents_Constructor : nsISupports
    1.92 +{
    1.93 +};
    1.94 +
    1.95 +/**
    1.96 +* interface of object returned by Components.Constructor
    1.97 +* (additional interesting stuff only reflected into JavaScript)
    1.98 +*/
    1.99 +[scriptable, uuid(c814ca20-e0dc-11d3-8f5f-0010a4e73d9a)]
   1.100 +interface nsIXPCConstructor : nsISupports
   1.101 +{
   1.102 +    readonly attribute nsIJSCID classID;
   1.103 +    readonly attribute nsIJSIID interfaceID;
   1.104 +    readonly attribute string   initializer;
   1.105 +};
   1.106 +
   1.107 +/**
   1.108 +* interface of object returned by Components.utils.Sandbox.
   1.109 +*/
   1.110 +[scriptable, uuid(4f8ae0dc-d266-4a32-875b-6a9de71a8ce9)]
   1.111 +interface nsIXPCComponents_utils_Sandbox : nsISupports
   1.112 +{
   1.113 +};
   1.114 +
   1.115 +/**
   1.116 + * interface for callback to be passed to Cu.schedulePreciseGC
   1.117 + */
   1.118 +[scriptable, function, uuid(71000535-b0fd-44d1-8ce0-909760e3953c)]
   1.119 +interface ScheduledGCCallback : nsISupports
   1.120 +{
   1.121 +    void callback();
   1.122 +};
   1.123 +
   1.124 +/**
   1.125 +* interface of Components.utils
   1.126 +*/
   1.127 +[scriptable, uuid(45b80e00-fb0d-439e-b7bf-54f24af0c4a6)]
   1.128 +interface nsIXPCComponents_Utils : nsISupports
   1.129 +{
   1.130 +
   1.131 +    /* reportError is designed to be called from JavaScript only.
   1.132 +     *
   1.133 +     * It will report a JS Error object to the JS console, and return. It
   1.134 +     * is meant for use in exception handler blocks which want to "eat"
   1.135 +     * an exception, but still want to report it to the console.
   1.136 +     *
   1.137 +     * It must be called with one param, usually an object which was caught by
   1.138 +     * an exception handler.  If it is not a JS error object, the parameter
   1.139 +     * is converted to a string and reported as a new error.
   1.140 +     */
   1.141 +    [implicit_jscontext] void reportError(in jsval error);
   1.142 +
   1.143 +    readonly attribute nsIXPCComponents_utils_Sandbox Sandbox;
   1.144 +
   1.145 +    /*
   1.146 +     * evalInSandbox is designed to be called from JavaScript only.
   1.147 +     *
   1.148 +     * evalInSandbox evaluates the provided source string in the given sandbox.
   1.149 +     * It returns the result of the evaluation to the caller.
   1.150 +     *
   1.151 +     * var s = new C.u.Sandbox("http://www.mozilla.org");
   1.152 +     * var res = C.u.evalInSandbox("var five = 5; 2 + five", s);
   1.153 +     * var outerFive = s.five;
   1.154 +     * s.seven = res;
   1.155 +     * var thirtyFive = C.u.evalInSandbox("five * seven", s);
   1.156 +     */
   1.157 +    [implicit_jscontext,optional_argc]
   1.158 +    jsval evalInSandbox(in AString source, in jsval sandbox,
   1.159 +                        [optional] in jsval version,
   1.160 +                        [optional] in AUTF8String filename,
   1.161 +                        [optional] in long lineNo);
   1.162 +
   1.163 +    /*
   1.164 +     * getSandboxMetadata is designed to be called from JavaScript only.
   1.165 +     *
   1.166 +     * getSandboxMetadata retrieves the metadata associated with
   1.167 +     * a sandbox object. It will return undefined if there
   1.168 +     * is no metadata attached to the sandbox.
   1.169 +     *
   1.170 +     * var s = C.u.Sandbox(..., { metadata: "metadata" });
   1.171 +     * var metadata = C.u.getSandboxMetadata(s);
   1.172 +     */
   1.173 +    [implicit_jscontext]
   1.174 +    jsval getSandboxMetadata(in jsval sandbox);
   1.175 +
   1.176 +    /*
   1.177 +     * setSandboxMetadata is designed to be called from JavaScript only.
   1.178 +     *
   1.179 +     * setSandboxMetadata sets the metadata associated with
   1.180 +     * a sandbox object.
   1.181 +     *
   1.182 +     * Note that the metadata object will be copied before being used.
   1.183 +     * The copy will be performed using the structured clone algorithm.
   1.184 +     * Note that this algorithm does not support reflectors and
   1.185 +     * it will throw if it encounters them.
   1.186 +     */
   1.187 +    [implicit_jscontext]
   1.188 +    void setSandboxMetadata(in jsval sandbox, in jsval metadata);
   1.189 +
   1.190 +    /*
   1.191 +     * import is designed to be called from JavaScript only.
   1.192 +     *
   1.193 +     * Synchronously loads and evaluates the js file located at
   1.194 +     * 'registryLocation' with a new, fully privileged global object.
   1.195 +     *
   1.196 +     * If 'targetObj' is specified and equal to null, returns the
   1.197 +     * module's global object. Otherwise (if 'targetObj' is not
   1.198 +     * specified, or 'targetObj' is != null) looks for a property
   1.199 +     * 'EXPORTED_SYMBOLS' on the new global object. 'EXPORTED_SYMBOLS'
   1.200 +     * is expected to be an array of strings identifying properties on
   1.201 +     * the global object.  These properties will be installed as
   1.202 +     * properties on 'targetObj', or, if 'targetObj' is not specified,
   1.203 +     * on the caller's global object. If 'EXPORTED_SYMBOLS' is not
   1.204 +     * found, an error is thrown.
   1.205 +     *
   1.206 +     * @param resourceURI A resource:// URI string to load the module from.
   1.207 +     * @param targetObj  the object to install the exported properties on.
   1.208 +     *        If this parameter is a primitive value, this method throws
   1.209 +     *        an exception.
   1.210 +     * @returns the module code's global object.
   1.211 +     *
   1.212 +     * The implementation maintains a hash of registryLocation->global obj.
   1.213 +     * Subsequent invocations of importModule with 'registryLocation'
   1.214 +     * pointing to the same file will not cause the module to be re-evaluated,
   1.215 +     * but the symbols in EXPORTED_SYMBOLS will be exported into the
   1.216 +     * specified target object and the global object returned as above.
   1.217 +     *
   1.218 +     * (This comment is duplicated from xpcIJSModuleLoader.)
   1.219 +     */
   1.220 +    [implicit_jscontext,optional_argc]
   1.221 +    jsval import(in AUTF8String aResourceURI, [optional] in jsval targetObj);
   1.222 +
   1.223 +    /*
   1.224 +     * Unloads the JS module at 'registryLocation'. Existing references to the
   1.225 +     * module will continue to work but any subsequent import of the module will
   1.226 +     * reload it and give new reference. If the JS module hasn't yet been
   1.227 +     * imported then this method will do nothing.
   1.228 +     *
   1.229 +     * @param resourceURI A resource:// URI string to unload the module from.
   1.230 +     */
   1.231 +    void unload(in AUTF8String registryLocation);
   1.232 +
   1.233 +    /*
   1.234 +     * Imports global properties (like DOM constructors) into the scope, defining
   1.235 +     * them on the caller's global. aPropertyList should be an array of property
   1.236 +     * names.
   1.237 +     *
   1.238 +     * See xpc::GlobalProperties::Parse for the current list of supported
   1.239 +     * properties.
   1.240 +     */
   1.241 +    [implicit_jscontext]
   1.242 +    void importGlobalProperties(in jsval aPropertyList);
   1.243 +
   1.244 +    /*
   1.245 +     * To be called from JS only.
   1.246 +     *
   1.247 +     * Return a weak reference for the given JS object.
   1.248 +     */
   1.249 +    [implicit_jscontext]
   1.250 +    xpcIJSWeakReference getWeakReference(in jsval obj);
   1.251 +
   1.252 +    /*
   1.253 +     * To be called from JS only.
   1.254 +     *
   1.255 +     * Force an immediate garbage collection cycle.
   1.256 +     */
   1.257 +    void forceGC();
   1.258 +
   1.259 +    /*
   1.260 +     * To be called from JS only.
   1.261 +     *
   1.262 +     * Force an immediate cycle collection cycle.
   1.263 +     */
   1.264 +    void forceCC();
   1.265 +
   1.266 +    /*
   1.267 +     * To be called from JS only.
   1.268 +     *
   1.269 +     * Force an immediate shrinking garbage collection cycle.
   1.270 +     */
   1.271 +    void forceShrinkingGC();
   1.272 +
   1.273 +    /*
   1.274 +     * Schedule a garbage collection cycle for a point in the future when no JS
   1.275 +     * is running. Call the provided function once this has occurred.
   1.276 +     */
   1.277 +    void schedulePreciseGC(in ScheduledGCCallback callback);
   1.278 +
   1.279 +    /*
   1.280 +     * Schedule a shrinking garbage collection cycle for a point in the future
   1.281 +     * when no JS is running. Call the provided function once this has occured.
   1.282 +     */
   1.283 +    void schedulePreciseShrinkingGC(in ScheduledGCCallback callback);
   1.284 +
   1.285 +    /*
   1.286 +     * In a debug build, unlink any ghost windows. This is only for debugging
   1.287 +     * leaks, and can cause bad things to happen if called.
   1.288 +     */
   1.289 +    void unlinkGhostWindows();
   1.290 +
   1.291 +    /**
   1.292 +     * Return the keys in a weak map.  This operation is
   1.293 +     * non-deterministic because it is affected by the scheduling of the
   1.294 +     * garbage collector and the cycle collector.
   1.295 +     *
   1.296 +     * This should only be used to write tests of the interaction of
   1.297 +     * the GC and CC with weak maps.
   1.298 +     *
   1.299 +     * @param aMap weak map or other JavaScript value
   1.300 +     * @returns If aMap is a weak map object, return the keys of the weak
   1.301 +                map as an array.  Otherwise, return undefined.
   1.302 +     */
   1.303 +    [implicit_jscontext]
   1.304 +    jsval nondeterministicGetWeakMapKeys(in jsval aMap);
   1.305 +
   1.306 +    [implicit_jscontext]
   1.307 +    jsval getJSTestingFunctions();
   1.308 +
   1.309 +    /*
   1.310 +     * To be called from JS only.
   1.311 +     *
   1.312 +     * Returns the global object with which the given object is associated.
   1.313 +     *
   1.314 +     * @param obj The JavaScript object whose global is to be gotten.
   1.315 +     * @return the corresponding global.
   1.316 +     */
   1.317 +    [implicit_jscontext]
   1.318 +    jsval getGlobalForObject(in jsval obj);
   1.319 +
   1.320 +    /*
   1.321 +     * To be called from JS only.
   1.322 +     *
   1.323 +     * Returns the true if the object is a (scripted) proxy.
   1.324 +     * NOTE: Security wrappers are unwrapped first before the check.
   1.325 +     */
   1.326 +    [implicit_jscontext]
   1.327 +    boolean isProxy(in jsval vobject);
   1.328 +
   1.329 +    /*
   1.330 +     * Similar to evalInSandbox except this one is used to eval a script in the
   1.331 +     * scope of a window. Also note, that the return value and the possible exceptions
   1.332 +     * in the script are structured cloned, unless they are natives (then they are just
   1.333 +     * wrapped).
   1.334 +     * Principal of the caller must subsume the target's.
   1.335 +     */
   1.336 +    [implicit_jscontext]
   1.337 +    jsval evalInWindow(in AString source, in jsval window);
   1.338 +
   1.339 +    /*
   1.340 +     * To be called from JS only.
   1.341 +     *
   1.342 +     * Instead of simply wrapping a function into another compartment,
   1.343 +     * this helper function creates a native function in the target
   1.344 +     * compartment and forwards the call to the original function.
   1.345 +     * That call will be different than a regular JS function call in
   1.346 +     * that, the |this| is left unbound, and all the non-native JS
   1.347 +     * object arguments will be cloned using the structured clone
   1.348 +     * algorithm.
   1.349 +     * The return value is the new forwarder function, wrapped into
   1.350 +     * the caller's compartment.
   1.351 +     * The 3rd argument is an optional options object:
   1.352 +     * - defineAs: the name of the property that will
   1.353 +     *             be set on the target scope, with
   1.354 +     *             the forwarder function as the value.
   1.355 +     */
   1.356 +    [implicit_jscontext]
   1.357 +    jsval exportFunction(in jsval vfunction, in jsval vscope, [optional] in jsval voptions);
   1.358 +
   1.359 +    /*
   1.360 +     * To be called from JS only.
   1.361 +     *
   1.362 +     * Returns an object created in |vobj|'s compartment.
   1.363 +     * If defineAs property on the options object is a non-null ID,
   1.364 +     * the new object will be added to vobj as a property. Also, the
   1.365 +     * returned new object is always automatically waived (see waiveXrays).
   1.366 +     */
   1.367 +    [implicit_jscontext]
   1.368 +    jsval createObjectIn(in jsval vobj, [optional] in jsval voptions);
   1.369 +
   1.370 +    /*
   1.371 +     * To be called from JS only.
   1.372 +     *
   1.373 +     * Ensures that all functions come from vobj's scope (and aren't cross
   1.374 +     * compartment wrappers).
   1.375 +     */
   1.376 +    [implicit_jscontext]
   1.377 +    void makeObjectPropsNormal(in jsval vobj);
   1.378 +
   1.379 +    /**
   1.380 +     * Determines whether this object is backed by a DeadObjectProxy.
   1.381 +     *
   1.382 +     * Dead-wrapper objects hold no other objects alive (they have no outgoing
   1.383 +     * reference edges) and will throw if you touch them (e.g. by
   1.384 +     * reading/writing a property).
   1.385 +     */
   1.386 +    bool isDeadWrapper(in jsval obj);
   1.387 +
   1.388 +    /*
   1.389 +     * To be called from JS only. This is for Gecko internal use only, and may
   1.390 +     * disappear at any moment.
   1.391 +     *
   1.392 +     * Forces a recomputation of all wrappers in and out of the compartment
   1.393 +     * containing |vobj|. If |vobj| is not an object, all wrappers system-wide
   1.394 +     * are recomputed.
   1.395 +     */
   1.396 +    [implicit_jscontext]
   1.397 +    void recomputeWrappers([optional] in jsval vobj);
   1.398 +
   1.399 +    /*
   1.400 +     * To be called from JS only. This is for Gecko internal use only, and may
   1.401 +     * disappear at any moment.
   1.402 +     *
   1.403 +     * Enables Xray vision for same-compartment access for the compartment
   1.404 +     * indicated by |vscope|. All outgoing wrappers are recomputed.
   1.405 +     */
   1.406 +    [implicit_jscontext]
   1.407 +    void setWantXrays(in jsval vscope);
   1.408 +
   1.409 +    /*
   1.410 +     * Forces the usage of a privileged |Components| object for a potentially-
   1.411 +     * unprivileged scope. This will crash if used outside of automation.
   1.412 +     */
   1.413 +    [implicit_jscontext]
   1.414 +    void forcePrivilegedComponentsForScope(in jsval vscope);
   1.415 +
   1.416 +    /*
   1.417 +     * This seemingly-paradoxical API allows privileged code to explicitly give
   1.418 +     * unprivileged code a reference to its own Components object (whereas it's
   1.419 +     * normally hidden away on a scope chain visible only to XBL methods). See
   1.420 +     * also SpecialPowers.getComponents.
   1.421 +     */
   1.422 +    [implicit_jscontext]
   1.423 +    jsval getComponentsForScope(in jsval vscope);
   1.424 +
   1.425 +    /*
   1.426 +     * Dispatches a runnable to the current/main thread. If |scope| is passed,
   1.427 +     * the runnable will be dispatch in the compartment of |scope|, which
   1.428 +     * affects which error reporter gets called.
   1.429 +     */
   1.430 +    [implicit_jscontext]
   1.431 +    void dispatch(in jsval runnable, [optional] in jsval scope);
   1.432 +
   1.433 +    /*
   1.434 +     * To be called from JS only.
   1.435 +     *
   1.436 +     * These are the set of JSContext options that privileged script
   1.437 +     * is allowed to control for the purposes of testing.  These
   1.438 +     * options should be kept in sync with what's controllable in the
   1.439 +     * jsshell and by setting prefs in nsJSEnvironment.
   1.440 +     *
   1.441 +     * NB: Assume that getting any of these attributes is relatively
   1.442 +     * cheap, but setting any of them is relatively expensive.
   1.443 +     */
   1.444 +    [implicit_jscontext]
   1.445 +    attribute boolean strict;
   1.446 +
   1.447 +    [implicit_jscontext]
   1.448 +    attribute boolean werror;
   1.449 +
   1.450 +    [implicit_jscontext]
   1.451 +    attribute boolean strict_mode;
   1.452 +
   1.453 +    [implicit_jscontext]
   1.454 +    attribute boolean ion;
   1.455 +
   1.456 +    [implicit_jscontext]
   1.457 +    void setGCZeal(in long zeal);
   1.458 +
   1.459 +    [implicit_jscontext]
   1.460 +    void nukeSandbox(in jsval obj);
   1.461 +
   1.462 +    /*
   1.463 +     * API to dynamically block script for a given global. This takes effect
   1.464 +     * immediately, unlike other APIs that only affect newly-created globals.
   1.465 +     *
   1.466 +     * The machinery here maintains a counter, and allows script only if each
   1.467 +     * call to blockScriptForGlobal() has been matched with a call to
   1.468 +     * unblockScriptForGlobal(). The caller _must_ make sure never to call
   1.469 +     * unblock() more times than it calls block(), since that could potentially
   1.470 +     * interfere with another consumer's script blocking.
   1.471 +     */
   1.472 +
   1.473 +    [implicit_jscontext]
   1.474 +    void blockScriptForGlobal(in jsval global);
   1.475 +
   1.476 +    [implicit_jscontext]
   1.477 +    void unblockScriptForGlobal(in jsval global);
   1.478 +
   1.479 +    /**
   1.480 +     * Check whether the given object is an XrayWrapper.
   1.481 +     */
   1.482 +    bool isXrayWrapper(in jsval obj);
   1.483 +
   1.484 +    /**
   1.485 +     * Waive Xray on a given value. Identity op for primitives.
   1.486 +     */
   1.487 +    [implicit_jscontext]
   1.488 +    jsval waiveXrays(in jsval aVal);
   1.489 +
   1.490 +    /**
   1.491 +     * Strip off Xray waivers on a given value. Identity op for primitives.
   1.492 +     */
   1.493 +    [implicit_jscontext]
   1.494 +    jsval unwaiveXrays(in jsval aVal);
   1.495 +
   1.496 +    /**
   1.497 +     * Gets the name of the JSClass of the object.
   1.498 +     *
   1.499 +     * if |aUnwrap| is true, all wrappers are unwrapped first. Unless you're
   1.500 +     * specifically trying to detect whether the object is a proxy, this is
   1.501 +     * probably what you want.
   1.502 +     */
   1.503 +    [implicit_jscontext]
   1.504 +    string getClassName(in jsval aObj, in bool aUnwrap);
   1.505 +
   1.506 +    /**
   1.507 +     * Get a DOM classinfo for the given classname.  Only some class
   1.508 +     * names are supported.
   1.509 +     */
   1.510 +    nsIClassInfo getDOMClassInfo(in AString aClassName);
   1.511 +
   1.512 +    /**
   1.513 +     * Gets the incument global for the execution of this function. For internal
   1.514 +     * and testing use only.
   1.515 +     *
   1.516 +     * If |callback| is passed, it is invoked with the incumbent global as its
   1.517 +     * sole argument. This allows the incumbent global to be measured in callback
   1.518 +     * environments with no scripted frames on the stack.
   1.519 +     */
   1.520 +    [implicit_jscontext]
   1.521 +    jsval getIncumbentGlobal([optional] in jsval callback);
   1.522 +
   1.523 +    /**
   1.524 +     * Forces the generation of an XPCWrappedJS for a given object. For internal
   1.525 +     * and testing use only. This is only useful to set up wrapper map conditions
   1.526 +     * for a testcase. The return value is not an XPCWrappedJS itself, but an
   1.527 +     * opaque nsISupports holder that keeps the underlying XPCWrappedJS alive.
   1.528 +     *
   1.529 +     * if |scope| is passed, the XPCWrappedJS is generated in the scope of that object.
   1.530 +     */
   1.531 +    [implicit_jscontext]
   1.532 +    nsISupports generateXPCWrappedJS(in jsval obj, [optional] in jsval scope);
   1.533 +
   1.534 +    /**
   1.535 +      * Retrieve the last time, in microseconds since epoch, that a given
   1.536 +      * watchdog-related event occured.
   1.537 +      *
   1.538 +      * Valid categories:
   1.539 +      *   "RuntimeStateChange"      - Runtime switching between active and inactive states
   1.540 +      *   "WatchdogWakeup"          - Watchdog waking up from sleeping
   1.541 +      *   "WatchdogHibernateStart"  - Watchdog begins hibernating
   1.542 +      *   "WatchdogHibernateStop"   - Watchdog stops hibernating
   1.543 +      */
   1.544 +    PRTime getWatchdogTimestamp(in AString aCategory);
   1.545 +
   1.546 +    [implicit_jscontext]
   1.547 +    jsval getJSEngineTelemetryValue();
   1.548 +
   1.549 +    /*
   1.550 +     * Clone an object into a scope.
   1.551 +     * The 3rd argument is an optional options object:
   1.552 +     * - cloneFunction: boolean. If true, any function in the value is are
   1.553 +     *   wrapped in a function forwarder that appears to be a native function in
   1.554 +     *   the content scope.
   1.555 +     */
   1.556 +    [implicit_jscontext]
   1.557 +    jsval cloneInto(in jsval value, in jsval scope, [optional] in jsval options);
   1.558 +
   1.559 +    /*
   1.560 +     * When C++-Implemented code does security checks, it can generally query
   1.561 +     * the subject principal (i.e. the principal of the most-recently-executed
   1.562 +     * script) in order to determine the responsible party. However, when an API
   1.563 +     * is implemented in JS, this doesn't work - the most-recently-executed
   1.564 +     * script is always the System-Principaled API implementation. So we need
   1.565 +     * another mechanism.
   1.566 +     *
   1.567 +     * Hence the notion of the "WebIDL Caller". If the current Entry Script on
   1.568 +     * the Script Settings Stack represents the invocation of JS-implemented
   1.569 +     * WebIDL, this API returns the principal of the caller at the time
   1.570 +     * of invocation. Otherwise (i.e. outside of JS-implemented WebIDL), this
   1.571 +     * function throws. If it throws, you probably shouldn't be using it.
   1.572 +     */
   1.573 +    nsIPrincipal getWebIDLCallerPrincipal();
   1.574 +
   1.575 +    /*
   1.576 +     * Gets the principal of a script object, after unwrapping any cross-
   1.577 +     * compartment wrappers.
   1.578 +     */
   1.579 +    [implicit_jscontext]
   1.580 +    nsIPrincipal getObjectPrincipal(in jsval obj);
   1.581 +};
   1.582 +
   1.583 +/**
   1.584 +* Interface for the 'Components' object.
   1.585 +*
   1.586 +* The first interface contains things that are available to non-chrome XBL code
   1.587 +* that runs in a scope with an nsExpandedPrincipal. The second interface
   1.588 +* includes members that are only exposed to chrome.
   1.589 +*/
   1.590 +
   1.591 +[scriptable, uuid(eeeada2f-86c0-4609-b2bf-4bf2351b1ce6)]
   1.592 +interface nsIXPCComponentsBase : nsISupports
   1.593 +{
   1.594 +    readonly attribute nsIXPCComponents_Interfaces      interfaces;
   1.595 +    readonly attribute nsIXPCComponents_InterfacesByID  interfacesByID;
   1.596 +    readonly attribute nsIXPCComponents_Results         results;
   1.597 +
   1.598 +    boolean isSuccessCode(in nsresult result);
   1.599 +
   1.600 +};
   1.601 +
   1.602 +[scriptable, uuid(aa28aaf6-70ce-4b03-9514-afe43c7dfda8)]
   1.603 +interface nsIXPCComponents : nsIXPCComponentsBase
   1.604 +{
   1.605 +    readonly attribute nsIXPCComponents_Classes         classes;
   1.606 +    readonly attribute nsIXPCComponents_ClassesByID     classesByID;
   1.607 +    readonly attribute nsIStackFrame                    stack;
   1.608 +    readonly attribute nsIComponentManager              manager;
   1.609 +    readonly attribute nsIXPCComponents_Utils           utils;
   1.610 +
   1.611 +    readonly attribute nsIXPCComponents_ID              ID;
   1.612 +    readonly attribute nsIXPCComponents_Exception       Exception;
   1.613 +    readonly attribute nsIXPCComponents_Constructor     Constructor;
   1.614 +
   1.615 +    [implicit_jscontext]
   1.616 +    readonly attribute jsval                            lastResult;
   1.617 +    [implicit_jscontext]
   1.618 +    attribute jsval                                     returnCode;
   1.619 +
   1.620 +    /* @deprecated Use Components.utils.reportError instead. */
   1.621 +    [deprecated, implicit_jscontext] void reportError(in jsval error);
   1.622 +};

mercurial