js/xpconnect/idl/xpccomponents.idl

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

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: IDL; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 %{C++
michael@0 9 #include "jspubtd.h"
michael@0 10 %}
michael@0 11
michael@0 12 interface xpcIJSWeakReference;
michael@0 13 interface nsIClassInfo;
michael@0 14 interface nsIComponentManager;
michael@0 15 interface nsIJSCID;
michael@0 16 interface nsIJSIID;
michael@0 17 interface nsIPrincipal;
michael@0 18 interface nsIStackFrame;
michael@0 19
michael@0 20 /**
michael@0 21 * interface of Components.interfacesByID
michael@0 22 * (interesting stuff only reflected into JavaScript)
michael@0 23 */
michael@0 24 [scriptable, uuid(c99cffac-5aed-4267-ad2f-f4a4c9d4a081)]
michael@0 25 interface nsIXPCComponents_InterfacesByID : nsISupports
michael@0 26 {
michael@0 27 };
michael@0 28
michael@0 29 /**
michael@0 30 * interface of Components.interfaces
michael@0 31 * (interesting stuff only reflected into JavaScript)
michael@0 32 */
michael@0 33 [scriptable, uuid(b8c31bba-79db-4a1d-930d-4cdd68713f9e)]
michael@0 34 interface nsIXPCComponents_Interfaces : nsISupports
michael@0 35 {
michael@0 36 };
michael@0 37
michael@0 38 /**
michael@0 39 * interface of Components.classes
michael@0 40 * (interesting stuff only reflected into JavaScript)
michael@0 41 */
michael@0 42 [scriptable, uuid(978ff520-d26c-11d2-9842-006008962422)]
michael@0 43 interface nsIXPCComponents_Classes : nsISupports
michael@0 44 {
michael@0 45 };
michael@0 46
michael@0 47 /**
michael@0 48 * interface of Components.classesByID
michael@0 49 * (interesting stuff only reflected into JavaScript)
michael@0 50 */
michael@0 51 [scriptable, uuid(336a9590-4d19-11d3-9893-006008962422)]
michael@0 52 interface nsIXPCComponents_ClassesByID : nsISupports
michael@0 53 {
michael@0 54 };
michael@0 55
michael@0 56 /**
michael@0 57 * interface of Components.results
michael@0 58 * (interesting stuff only reflected into JavaScript)
michael@0 59 */
michael@0 60 [scriptable, uuid(2fc229a0-5860-11d3-9899-006008962422)]
michael@0 61 interface nsIXPCComponents_Results : nsISupports
michael@0 62 {
michael@0 63 };
michael@0 64
michael@0 65 /**
michael@0 66 * interface of Components.ID
michael@0 67 * (interesting stuff only reflected into JavaScript)
michael@0 68 */
michael@0 69 [scriptable, uuid(7994a6e0-e028-11d3-8f5d-0010a4e73d9a)]
michael@0 70 interface nsIXPCComponents_ID : nsISupports
michael@0 71 {
michael@0 72 };
michael@0 73
michael@0 74 /**
michael@0 75 * interface of Components.Exception
michael@0 76 * (interesting stuff only reflected into JavaScript)
michael@0 77 */
michael@0 78 [scriptable, uuid(5bf039c0-e028-11d3-8f5d-0010a4e73d9a)]
michael@0 79 interface nsIXPCComponents_Exception : nsISupports
michael@0 80 {
michael@0 81 };
michael@0 82
michael@0 83 /**
michael@0 84 * interface of Components.Constructor
michael@0 85 * (interesting stuff only reflected into JavaScript)
michael@0 86 */
michael@0 87 [scriptable, uuid(88655640-e028-11d3-8f5d-0010a4e73d9a)]
michael@0 88 interface nsIXPCComponents_Constructor : nsISupports
michael@0 89 {
michael@0 90 };
michael@0 91
michael@0 92 /**
michael@0 93 * interface of object returned by Components.Constructor
michael@0 94 * (additional interesting stuff only reflected into JavaScript)
michael@0 95 */
michael@0 96 [scriptable, uuid(c814ca20-e0dc-11d3-8f5f-0010a4e73d9a)]
michael@0 97 interface nsIXPCConstructor : nsISupports
michael@0 98 {
michael@0 99 readonly attribute nsIJSCID classID;
michael@0 100 readonly attribute nsIJSIID interfaceID;
michael@0 101 readonly attribute string initializer;
michael@0 102 };
michael@0 103
michael@0 104 /**
michael@0 105 * interface of object returned by Components.utils.Sandbox.
michael@0 106 */
michael@0 107 [scriptable, uuid(4f8ae0dc-d266-4a32-875b-6a9de71a8ce9)]
michael@0 108 interface nsIXPCComponents_utils_Sandbox : nsISupports
michael@0 109 {
michael@0 110 };
michael@0 111
michael@0 112 /**
michael@0 113 * interface for callback to be passed to Cu.schedulePreciseGC
michael@0 114 */
michael@0 115 [scriptable, function, uuid(71000535-b0fd-44d1-8ce0-909760e3953c)]
michael@0 116 interface ScheduledGCCallback : nsISupports
michael@0 117 {
michael@0 118 void callback();
michael@0 119 };
michael@0 120
michael@0 121 /**
michael@0 122 * interface of Components.utils
michael@0 123 */
michael@0 124 [scriptable, uuid(45b80e00-fb0d-439e-b7bf-54f24af0c4a6)]
michael@0 125 interface nsIXPCComponents_Utils : nsISupports
michael@0 126 {
michael@0 127
michael@0 128 /* reportError is designed to be called from JavaScript only.
michael@0 129 *
michael@0 130 * It will report a JS Error object to the JS console, and return. It
michael@0 131 * is meant for use in exception handler blocks which want to "eat"
michael@0 132 * an exception, but still want to report it to the console.
michael@0 133 *
michael@0 134 * It must be called with one param, usually an object which was caught by
michael@0 135 * an exception handler. If it is not a JS error object, the parameter
michael@0 136 * is converted to a string and reported as a new error.
michael@0 137 */
michael@0 138 [implicit_jscontext] void reportError(in jsval error);
michael@0 139
michael@0 140 readonly attribute nsIXPCComponents_utils_Sandbox Sandbox;
michael@0 141
michael@0 142 /*
michael@0 143 * evalInSandbox is designed to be called from JavaScript only.
michael@0 144 *
michael@0 145 * evalInSandbox evaluates the provided source string in the given sandbox.
michael@0 146 * It returns the result of the evaluation to the caller.
michael@0 147 *
michael@0 148 * var s = new C.u.Sandbox("http://www.mozilla.org");
michael@0 149 * var res = C.u.evalInSandbox("var five = 5; 2 + five", s);
michael@0 150 * var outerFive = s.five;
michael@0 151 * s.seven = res;
michael@0 152 * var thirtyFive = C.u.evalInSandbox("five * seven", s);
michael@0 153 */
michael@0 154 [implicit_jscontext,optional_argc]
michael@0 155 jsval evalInSandbox(in AString source, in jsval sandbox,
michael@0 156 [optional] in jsval version,
michael@0 157 [optional] in AUTF8String filename,
michael@0 158 [optional] in long lineNo);
michael@0 159
michael@0 160 /*
michael@0 161 * getSandboxMetadata is designed to be called from JavaScript only.
michael@0 162 *
michael@0 163 * getSandboxMetadata retrieves the metadata associated with
michael@0 164 * a sandbox object. It will return undefined if there
michael@0 165 * is no metadata attached to the sandbox.
michael@0 166 *
michael@0 167 * var s = C.u.Sandbox(..., { metadata: "metadata" });
michael@0 168 * var metadata = C.u.getSandboxMetadata(s);
michael@0 169 */
michael@0 170 [implicit_jscontext]
michael@0 171 jsval getSandboxMetadata(in jsval sandbox);
michael@0 172
michael@0 173 /*
michael@0 174 * setSandboxMetadata is designed to be called from JavaScript only.
michael@0 175 *
michael@0 176 * setSandboxMetadata sets the metadata associated with
michael@0 177 * a sandbox object.
michael@0 178 *
michael@0 179 * Note that the metadata object will be copied before being used.
michael@0 180 * The copy will be performed using the structured clone algorithm.
michael@0 181 * Note that this algorithm does not support reflectors and
michael@0 182 * it will throw if it encounters them.
michael@0 183 */
michael@0 184 [implicit_jscontext]
michael@0 185 void setSandboxMetadata(in jsval sandbox, in jsval metadata);
michael@0 186
michael@0 187 /*
michael@0 188 * import is designed to be called from JavaScript only.
michael@0 189 *
michael@0 190 * Synchronously loads and evaluates the js file located at
michael@0 191 * 'registryLocation' with a new, fully privileged global object.
michael@0 192 *
michael@0 193 * If 'targetObj' is specified and equal to null, returns the
michael@0 194 * module's global object. Otherwise (if 'targetObj' is not
michael@0 195 * specified, or 'targetObj' is != null) looks for a property
michael@0 196 * 'EXPORTED_SYMBOLS' on the new global object. 'EXPORTED_SYMBOLS'
michael@0 197 * is expected to be an array of strings identifying properties on
michael@0 198 * the global object. These properties will be installed as
michael@0 199 * properties on 'targetObj', or, if 'targetObj' is not specified,
michael@0 200 * on the caller's global object. If 'EXPORTED_SYMBOLS' is not
michael@0 201 * found, an error is thrown.
michael@0 202 *
michael@0 203 * @param resourceURI A resource:// URI string to load the module from.
michael@0 204 * @param targetObj the object to install the exported properties on.
michael@0 205 * If this parameter is a primitive value, this method throws
michael@0 206 * an exception.
michael@0 207 * @returns the module code's global object.
michael@0 208 *
michael@0 209 * The implementation maintains a hash of registryLocation->global obj.
michael@0 210 * Subsequent invocations of importModule with 'registryLocation'
michael@0 211 * pointing to the same file will not cause the module to be re-evaluated,
michael@0 212 * but the symbols in EXPORTED_SYMBOLS will be exported into the
michael@0 213 * specified target object and the global object returned as above.
michael@0 214 *
michael@0 215 * (This comment is duplicated from xpcIJSModuleLoader.)
michael@0 216 */
michael@0 217 [implicit_jscontext,optional_argc]
michael@0 218 jsval import(in AUTF8String aResourceURI, [optional] in jsval targetObj);
michael@0 219
michael@0 220 /*
michael@0 221 * Unloads the JS module at 'registryLocation'. Existing references to the
michael@0 222 * module will continue to work but any subsequent import of the module will
michael@0 223 * reload it and give new reference. If the JS module hasn't yet been
michael@0 224 * imported then this method will do nothing.
michael@0 225 *
michael@0 226 * @param resourceURI A resource:// URI string to unload the module from.
michael@0 227 */
michael@0 228 void unload(in AUTF8String registryLocation);
michael@0 229
michael@0 230 /*
michael@0 231 * Imports global properties (like DOM constructors) into the scope, defining
michael@0 232 * them on the caller's global. aPropertyList should be an array of property
michael@0 233 * names.
michael@0 234 *
michael@0 235 * See xpc::GlobalProperties::Parse for the current list of supported
michael@0 236 * properties.
michael@0 237 */
michael@0 238 [implicit_jscontext]
michael@0 239 void importGlobalProperties(in jsval aPropertyList);
michael@0 240
michael@0 241 /*
michael@0 242 * To be called from JS only.
michael@0 243 *
michael@0 244 * Return a weak reference for the given JS object.
michael@0 245 */
michael@0 246 [implicit_jscontext]
michael@0 247 xpcIJSWeakReference getWeakReference(in jsval obj);
michael@0 248
michael@0 249 /*
michael@0 250 * To be called from JS only.
michael@0 251 *
michael@0 252 * Force an immediate garbage collection cycle.
michael@0 253 */
michael@0 254 void forceGC();
michael@0 255
michael@0 256 /*
michael@0 257 * To be called from JS only.
michael@0 258 *
michael@0 259 * Force an immediate cycle collection cycle.
michael@0 260 */
michael@0 261 void forceCC();
michael@0 262
michael@0 263 /*
michael@0 264 * To be called from JS only.
michael@0 265 *
michael@0 266 * Force an immediate shrinking garbage collection cycle.
michael@0 267 */
michael@0 268 void forceShrinkingGC();
michael@0 269
michael@0 270 /*
michael@0 271 * Schedule a garbage collection cycle for a point in the future when no JS
michael@0 272 * is running. Call the provided function once this has occurred.
michael@0 273 */
michael@0 274 void schedulePreciseGC(in ScheduledGCCallback callback);
michael@0 275
michael@0 276 /*
michael@0 277 * Schedule a shrinking garbage collection cycle for a point in the future
michael@0 278 * when no JS is running. Call the provided function once this has occured.
michael@0 279 */
michael@0 280 void schedulePreciseShrinkingGC(in ScheduledGCCallback callback);
michael@0 281
michael@0 282 /*
michael@0 283 * In a debug build, unlink any ghost windows. This is only for debugging
michael@0 284 * leaks, and can cause bad things to happen if called.
michael@0 285 */
michael@0 286 void unlinkGhostWindows();
michael@0 287
michael@0 288 /**
michael@0 289 * Return the keys in a weak map. This operation is
michael@0 290 * non-deterministic because it is affected by the scheduling of the
michael@0 291 * garbage collector and the cycle collector.
michael@0 292 *
michael@0 293 * This should only be used to write tests of the interaction of
michael@0 294 * the GC and CC with weak maps.
michael@0 295 *
michael@0 296 * @param aMap weak map or other JavaScript value
michael@0 297 * @returns If aMap is a weak map object, return the keys of the weak
michael@0 298 map as an array. Otherwise, return undefined.
michael@0 299 */
michael@0 300 [implicit_jscontext]
michael@0 301 jsval nondeterministicGetWeakMapKeys(in jsval aMap);
michael@0 302
michael@0 303 [implicit_jscontext]
michael@0 304 jsval getJSTestingFunctions();
michael@0 305
michael@0 306 /*
michael@0 307 * To be called from JS only.
michael@0 308 *
michael@0 309 * Returns the global object with which the given object is associated.
michael@0 310 *
michael@0 311 * @param obj The JavaScript object whose global is to be gotten.
michael@0 312 * @return the corresponding global.
michael@0 313 */
michael@0 314 [implicit_jscontext]
michael@0 315 jsval getGlobalForObject(in jsval obj);
michael@0 316
michael@0 317 /*
michael@0 318 * To be called from JS only.
michael@0 319 *
michael@0 320 * Returns the true if the object is a (scripted) proxy.
michael@0 321 * NOTE: Security wrappers are unwrapped first before the check.
michael@0 322 */
michael@0 323 [implicit_jscontext]
michael@0 324 boolean isProxy(in jsval vobject);
michael@0 325
michael@0 326 /*
michael@0 327 * Similar to evalInSandbox except this one is used to eval a script in the
michael@0 328 * scope of a window. Also note, that the return value and the possible exceptions
michael@0 329 * in the script are structured cloned, unless they are natives (then they are just
michael@0 330 * wrapped).
michael@0 331 * Principal of the caller must subsume the target's.
michael@0 332 */
michael@0 333 [implicit_jscontext]
michael@0 334 jsval evalInWindow(in AString source, in jsval window);
michael@0 335
michael@0 336 /*
michael@0 337 * To be called from JS only.
michael@0 338 *
michael@0 339 * Instead of simply wrapping a function into another compartment,
michael@0 340 * this helper function creates a native function in the target
michael@0 341 * compartment and forwards the call to the original function.
michael@0 342 * That call will be different than a regular JS function call in
michael@0 343 * that, the |this| is left unbound, and all the non-native JS
michael@0 344 * object arguments will be cloned using the structured clone
michael@0 345 * algorithm.
michael@0 346 * The return value is the new forwarder function, wrapped into
michael@0 347 * the caller's compartment.
michael@0 348 * The 3rd argument is an optional options object:
michael@0 349 * - defineAs: the name of the property that will
michael@0 350 * be set on the target scope, with
michael@0 351 * the forwarder function as the value.
michael@0 352 */
michael@0 353 [implicit_jscontext]
michael@0 354 jsval exportFunction(in jsval vfunction, in jsval vscope, [optional] in jsval voptions);
michael@0 355
michael@0 356 /*
michael@0 357 * To be called from JS only.
michael@0 358 *
michael@0 359 * Returns an object created in |vobj|'s compartment.
michael@0 360 * If defineAs property on the options object is a non-null ID,
michael@0 361 * the new object will be added to vobj as a property. Also, the
michael@0 362 * returned new object is always automatically waived (see waiveXrays).
michael@0 363 */
michael@0 364 [implicit_jscontext]
michael@0 365 jsval createObjectIn(in jsval vobj, [optional] in jsval voptions);
michael@0 366
michael@0 367 /*
michael@0 368 * To be called from JS only.
michael@0 369 *
michael@0 370 * Ensures that all functions come from vobj's scope (and aren't cross
michael@0 371 * compartment wrappers).
michael@0 372 */
michael@0 373 [implicit_jscontext]
michael@0 374 void makeObjectPropsNormal(in jsval vobj);
michael@0 375
michael@0 376 /**
michael@0 377 * Determines whether this object is backed by a DeadObjectProxy.
michael@0 378 *
michael@0 379 * Dead-wrapper objects hold no other objects alive (they have no outgoing
michael@0 380 * reference edges) and will throw if you touch them (e.g. by
michael@0 381 * reading/writing a property).
michael@0 382 */
michael@0 383 bool isDeadWrapper(in jsval obj);
michael@0 384
michael@0 385 /*
michael@0 386 * To be called from JS only. This is for Gecko internal use only, and may
michael@0 387 * disappear at any moment.
michael@0 388 *
michael@0 389 * Forces a recomputation of all wrappers in and out of the compartment
michael@0 390 * containing |vobj|. If |vobj| is not an object, all wrappers system-wide
michael@0 391 * are recomputed.
michael@0 392 */
michael@0 393 [implicit_jscontext]
michael@0 394 void recomputeWrappers([optional] in jsval vobj);
michael@0 395
michael@0 396 /*
michael@0 397 * To be called from JS only. This is for Gecko internal use only, and may
michael@0 398 * disappear at any moment.
michael@0 399 *
michael@0 400 * Enables Xray vision for same-compartment access for the compartment
michael@0 401 * indicated by |vscope|. All outgoing wrappers are recomputed.
michael@0 402 */
michael@0 403 [implicit_jscontext]
michael@0 404 void setWantXrays(in jsval vscope);
michael@0 405
michael@0 406 /*
michael@0 407 * Forces the usage of a privileged |Components| object for a potentially-
michael@0 408 * unprivileged scope. This will crash if used outside of automation.
michael@0 409 */
michael@0 410 [implicit_jscontext]
michael@0 411 void forcePrivilegedComponentsForScope(in jsval vscope);
michael@0 412
michael@0 413 /*
michael@0 414 * This seemingly-paradoxical API allows privileged code to explicitly give
michael@0 415 * unprivileged code a reference to its own Components object (whereas it's
michael@0 416 * normally hidden away on a scope chain visible only to XBL methods). See
michael@0 417 * also SpecialPowers.getComponents.
michael@0 418 */
michael@0 419 [implicit_jscontext]
michael@0 420 jsval getComponentsForScope(in jsval vscope);
michael@0 421
michael@0 422 /*
michael@0 423 * Dispatches a runnable to the current/main thread. If |scope| is passed,
michael@0 424 * the runnable will be dispatch in the compartment of |scope|, which
michael@0 425 * affects which error reporter gets called.
michael@0 426 */
michael@0 427 [implicit_jscontext]
michael@0 428 void dispatch(in jsval runnable, [optional] in jsval scope);
michael@0 429
michael@0 430 /*
michael@0 431 * To be called from JS only.
michael@0 432 *
michael@0 433 * These are the set of JSContext options that privileged script
michael@0 434 * is allowed to control for the purposes of testing. These
michael@0 435 * options should be kept in sync with what's controllable in the
michael@0 436 * jsshell and by setting prefs in nsJSEnvironment.
michael@0 437 *
michael@0 438 * NB: Assume that getting any of these attributes is relatively
michael@0 439 * cheap, but setting any of them is relatively expensive.
michael@0 440 */
michael@0 441 [implicit_jscontext]
michael@0 442 attribute boolean strict;
michael@0 443
michael@0 444 [implicit_jscontext]
michael@0 445 attribute boolean werror;
michael@0 446
michael@0 447 [implicit_jscontext]
michael@0 448 attribute boolean strict_mode;
michael@0 449
michael@0 450 [implicit_jscontext]
michael@0 451 attribute boolean ion;
michael@0 452
michael@0 453 [implicit_jscontext]
michael@0 454 void setGCZeal(in long zeal);
michael@0 455
michael@0 456 [implicit_jscontext]
michael@0 457 void nukeSandbox(in jsval obj);
michael@0 458
michael@0 459 /*
michael@0 460 * API to dynamically block script for a given global. This takes effect
michael@0 461 * immediately, unlike other APIs that only affect newly-created globals.
michael@0 462 *
michael@0 463 * The machinery here maintains a counter, and allows script only if each
michael@0 464 * call to blockScriptForGlobal() has been matched with a call to
michael@0 465 * unblockScriptForGlobal(). The caller _must_ make sure never to call
michael@0 466 * unblock() more times than it calls block(), since that could potentially
michael@0 467 * interfere with another consumer's script blocking.
michael@0 468 */
michael@0 469
michael@0 470 [implicit_jscontext]
michael@0 471 void blockScriptForGlobal(in jsval global);
michael@0 472
michael@0 473 [implicit_jscontext]
michael@0 474 void unblockScriptForGlobal(in jsval global);
michael@0 475
michael@0 476 /**
michael@0 477 * Check whether the given object is an XrayWrapper.
michael@0 478 */
michael@0 479 bool isXrayWrapper(in jsval obj);
michael@0 480
michael@0 481 /**
michael@0 482 * Waive Xray on a given value. Identity op for primitives.
michael@0 483 */
michael@0 484 [implicit_jscontext]
michael@0 485 jsval waiveXrays(in jsval aVal);
michael@0 486
michael@0 487 /**
michael@0 488 * Strip off Xray waivers on a given value. Identity op for primitives.
michael@0 489 */
michael@0 490 [implicit_jscontext]
michael@0 491 jsval unwaiveXrays(in jsval aVal);
michael@0 492
michael@0 493 /**
michael@0 494 * Gets the name of the JSClass of the object.
michael@0 495 *
michael@0 496 * if |aUnwrap| is true, all wrappers are unwrapped first. Unless you're
michael@0 497 * specifically trying to detect whether the object is a proxy, this is
michael@0 498 * probably what you want.
michael@0 499 */
michael@0 500 [implicit_jscontext]
michael@0 501 string getClassName(in jsval aObj, in bool aUnwrap);
michael@0 502
michael@0 503 /**
michael@0 504 * Get a DOM classinfo for the given classname. Only some class
michael@0 505 * names are supported.
michael@0 506 */
michael@0 507 nsIClassInfo getDOMClassInfo(in AString aClassName);
michael@0 508
michael@0 509 /**
michael@0 510 * Gets the incument global for the execution of this function. For internal
michael@0 511 * and testing use only.
michael@0 512 *
michael@0 513 * If |callback| is passed, it is invoked with the incumbent global as its
michael@0 514 * sole argument. This allows the incumbent global to be measured in callback
michael@0 515 * environments with no scripted frames on the stack.
michael@0 516 */
michael@0 517 [implicit_jscontext]
michael@0 518 jsval getIncumbentGlobal([optional] in jsval callback);
michael@0 519
michael@0 520 /**
michael@0 521 * Forces the generation of an XPCWrappedJS for a given object. For internal
michael@0 522 * and testing use only. This is only useful to set up wrapper map conditions
michael@0 523 * for a testcase. The return value is not an XPCWrappedJS itself, but an
michael@0 524 * opaque nsISupports holder that keeps the underlying XPCWrappedJS alive.
michael@0 525 *
michael@0 526 * if |scope| is passed, the XPCWrappedJS is generated in the scope of that object.
michael@0 527 */
michael@0 528 [implicit_jscontext]
michael@0 529 nsISupports generateXPCWrappedJS(in jsval obj, [optional] in jsval scope);
michael@0 530
michael@0 531 /**
michael@0 532 * Retrieve the last time, in microseconds since epoch, that a given
michael@0 533 * watchdog-related event occured.
michael@0 534 *
michael@0 535 * Valid categories:
michael@0 536 * "RuntimeStateChange" - Runtime switching between active and inactive states
michael@0 537 * "WatchdogWakeup" - Watchdog waking up from sleeping
michael@0 538 * "WatchdogHibernateStart" - Watchdog begins hibernating
michael@0 539 * "WatchdogHibernateStop" - Watchdog stops hibernating
michael@0 540 */
michael@0 541 PRTime getWatchdogTimestamp(in AString aCategory);
michael@0 542
michael@0 543 [implicit_jscontext]
michael@0 544 jsval getJSEngineTelemetryValue();
michael@0 545
michael@0 546 /*
michael@0 547 * Clone an object into a scope.
michael@0 548 * The 3rd argument is an optional options object:
michael@0 549 * - cloneFunction: boolean. If true, any function in the value is are
michael@0 550 * wrapped in a function forwarder that appears to be a native function in
michael@0 551 * the content scope.
michael@0 552 */
michael@0 553 [implicit_jscontext]
michael@0 554 jsval cloneInto(in jsval value, in jsval scope, [optional] in jsval options);
michael@0 555
michael@0 556 /*
michael@0 557 * When C++-Implemented code does security checks, it can generally query
michael@0 558 * the subject principal (i.e. the principal of the most-recently-executed
michael@0 559 * script) in order to determine the responsible party. However, when an API
michael@0 560 * is implemented in JS, this doesn't work - the most-recently-executed
michael@0 561 * script is always the System-Principaled API implementation. So we need
michael@0 562 * another mechanism.
michael@0 563 *
michael@0 564 * Hence the notion of the "WebIDL Caller". If the current Entry Script on
michael@0 565 * the Script Settings Stack represents the invocation of JS-implemented
michael@0 566 * WebIDL, this API returns the principal of the caller at the time
michael@0 567 * of invocation. Otherwise (i.e. outside of JS-implemented WebIDL), this
michael@0 568 * function throws. If it throws, you probably shouldn't be using it.
michael@0 569 */
michael@0 570 nsIPrincipal getWebIDLCallerPrincipal();
michael@0 571
michael@0 572 /*
michael@0 573 * Gets the principal of a script object, after unwrapping any cross-
michael@0 574 * compartment wrappers.
michael@0 575 */
michael@0 576 [implicit_jscontext]
michael@0 577 nsIPrincipal getObjectPrincipal(in jsval obj);
michael@0 578 };
michael@0 579
michael@0 580 /**
michael@0 581 * Interface for the 'Components' object.
michael@0 582 *
michael@0 583 * The first interface contains things that are available to non-chrome XBL code
michael@0 584 * that runs in a scope with an nsExpandedPrincipal. The second interface
michael@0 585 * includes members that are only exposed to chrome.
michael@0 586 */
michael@0 587
michael@0 588 [scriptable, uuid(eeeada2f-86c0-4609-b2bf-4bf2351b1ce6)]
michael@0 589 interface nsIXPCComponentsBase : nsISupports
michael@0 590 {
michael@0 591 readonly attribute nsIXPCComponents_Interfaces interfaces;
michael@0 592 readonly attribute nsIXPCComponents_InterfacesByID interfacesByID;
michael@0 593 readonly attribute nsIXPCComponents_Results results;
michael@0 594
michael@0 595 boolean isSuccessCode(in nsresult result);
michael@0 596
michael@0 597 };
michael@0 598
michael@0 599 [scriptable, uuid(aa28aaf6-70ce-4b03-9514-afe43c7dfda8)]
michael@0 600 interface nsIXPCComponents : nsIXPCComponentsBase
michael@0 601 {
michael@0 602 readonly attribute nsIXPCComponents_Classes classes;
michael@0 603 readonly attribute nsIXPCComponents_ClassesByID classesByID;
michael@0 604 readonly attribute nsIStackFrame stack;
michael@0 605 readonly attribute nsIComponentManager manager;
michael@0 606 readonly attribute nsIXPCComponents_Utils utils;
michael@0 607
michael@0 608 readonly attribute nsIXPCComponents_ID ID;
michael@0 609 readonly attribute nsIXPCComponents_Exception Exception;
michael@0 610 readonly attribute nsIXPCComponents_Constructor Constructor;
michael@0 611
michael@0 612 [implicit_jscontext]
michael@0 613 readonly attribute jsval lastResult;
michael@0 614 [implicit_jscontext]
michael@0 615 attribute jsval returnCode;
michael@0 616
michael@0 617 /* @deprecated Use Components.utils.reportError instead. */
michael@0 618 [deprecated, implicit_jscontext] void reportError(in jsval error);
michael@0 619 };

mercurial