Backed out changeset 2450366cf7ca (bug 1891629) for causing win msix mochitest failures
[gecko.git] / dom / chrome-webidl / ChromeUtils.webidl
blobe1a4c3bedf795c480d9c43eeec8bbe9c0d2b5766
1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
4  * You can obtain one at http://mozilla.org/MPL/2.0/.
5  */
7 interface nsIDOMProcessChild;
8 interface nsIDOMProcessParent;
9 interface Principal;
11 /**
12  * An optimized QueryInterface method, generated by generateQI.
13  *
14  * For JS callers, this behaves like a normal QueryInterface function. When
15  * called with a supported interface, it returns its `this` object. When
16  * called with an unsupported interface, it throws NS_ERROR_NO_INTERFACE.
17  *
18  * C++ callers use a fast path, and never call the JSAPI or WebIDL methods of
19  * this object.
20  */
21 [ChromeOnly, Exposed=Window]
22 interface MozQueryInterface {
23   [Throws]
24   legacycaller any (any aIID);
27 /**
28  * Options for a marker created with the addProfilerMarker method.
29  * All fields are optional.
30  */
31 dictionary ProfilerMarkerOptions {
32   // A timestamp to use as the start time of the marker.
33   // If no start time is provided, the marker will have no duration.
34   // In window and ChromeWorker contexts, use a timestamp from
35   // `performance.now()`.
36   // In JS modules, use `Cu.now()` to get a timestamp.
37   DOMHighResTimeStamp startTime = 0;
39   // If captureStack is true, a profiler stack will be captured and associated
40   // with the marker.
41   boolean captureStack = false;
43   // Markers are created by default in the JavaScript category, but this can be
44   // overridden.
45   // Examples of correct values: "JavaScript", "Test", "Other", ...
46   // See ProfilingCategoryList.h for the complete list of valid values.
47   // Using an unrecognized value will set the category to "Other".
48   ByteString category = "JavaScript";
50   // Inner window ID to use for the marker. If the global object is a window,
51   // the inner window id of the marker will be set automatically.
52   // If a marker that relates to a specific window is added from a JS module,
53   // setting the inner window id will allow the profiler to show which window
54   // the marker applies to.
55   unsigned long long innerWindowId = 0;
58 dictionary InteractionData {
59   unsigned long interactionCount = 0;
60   unsigned long interactionTimeInMilliseconds = 0;
61   unsigned long scrollingDistanceInPixels = 0;
64 /**
65  * Confidence value of credit card fields. This is used by the native
66  * Fathom Credit Card model to return the score to JS.
67  */
68 dictionary FormAutofillConfidences {
69   double ccNumber = 0;
70   double ccName = 0;
73 /**
74  * A collection of static utility methods that are only exposed to system code.
75  * This is exposed in all the system globals where we can expose stuff by
76  * default, so should only include methods that are **thread-safe**.
77  */
78 [ChromeOnly, Exposed=(Window,Worker)]
79 namespace ChromeUtils {
80   /**
81    * Get the |NodeId| for the given JS Object.
82    * |NodeId| is the identifier of |JS::ubi::Node|.
83    */
84   NodeId getObjectNodeId(object obj);
86   /**
87    * Serialize a snapshot of the heap graph, as seen by |JS::ubi::Node| and
88    * restricted by |boundaries|, and write it to the provided file path.
89    *
90    * @param boundaries        The portion of the heap graph to write.
91    *
92    * @returns                 The path to the file the heap snapshot was written
93    *                          to. This is guaranteed to be within the temp
94    *                          directory and its file name will match the regexp
95    *                          `\d+(\-\d+)?\.fxsnapshot`.
96    */
97   [Throws]
98   DOMString saveHeapSnapshot(optional HeapSnapshotBoundaries boundaries = {});
100   /**
101    * This is the same as saveHeapSnapshot, but with a different return value.
102    *
103    * @returns                 The snapshot ID of the file. This is the file name
104    *                          without the temp directory or the trailing
105    *                          `.fxsnapshot`.
106    */
107   [Throws]
108   DOMString saveHeapSnapshotGetId(optional HeapSnapshotBoundaries boundaries = {});
110   /**
111    * Deserialize a core dump into a HeapSnapshot.
112    *
113    * @param filePath          The file path to read the heap snapshot from.
114    */
115   [Throws, NewObject]
116   HeapSnapshot readHeapSnapshot(DOMString filePath);
118   /**
119    * Efficient way to know if DevTools are active in the current process.
120    *
121    * This doesn't help know what particular context is being debugged,
122    * but can help strip off code entirely when DevTools aren't used at all.
123    *
124    * BrowsingContext.isWatchedByDevTools is a more precise way to know
125    * when one precise tab is being debugged.
126    */
127   boolean isDevToolsOpened();
129   /**
130    * API exposed to DevTools JS code in order to know when devtools are being active in the current process.
131    *
132    * This API counts the number of calls to these methods, allowing to track many DevTools instances.
133    */
134   undefined notifyDevToolsOpened();
135   undefined notifyDevToolsClosed();
138   /**
139    * Return the keys in a weak map.  This operation is
140    * non-deterministic because it is affected by the scheduling of the
141    * garbage collector and the cycle collector.
142    *
143    * @param aMap weak map or other JavaScript value
144    * @returns If aMap is a weak map object, return the keys of the weak
145    *          map as an array.  Otherwise, return undefined.
146    */
147   [Throws, NewObject]
148   any nondeterministicGetWeakMapKeys(any map);
150   /**
151    * Return the keys in a weak set.  This operation is
152    * non-deterministic because it is affected by the scheduling of the
153    * garbage collector and the cycle collector.
154    *
155    * @param aSet weak set or other JavaScript value
156    * @returns If aSet is a weak set object, return the keys of the weak
157    *          set as an array.  Otherwise, return undefined.
158    */
159   [Throws, NewObject]
160   any nondeterministicGetWeakSetKeys(any aSet);
162   /**
163    * Converts a buffer to a Base64 URL-encoded string per RFC 4648.
164    *
165    * @param source The buffer to encode.
166    * @param options Additional encoding options.
167    * @returns The encoded string.
168    */
169   [Throws]
170   ByteString base64URLEncode(BufferSource source,
171                              Base64URLEncodeOptions options);
173   /**
174    * Decodes a Base64 URL-encoded string per RFC 4648.
175    *
176    * @param string The string to decode.
177    * @param options Additional decoding options.
178    * @returns The decoded buffer.
179    */
180   [Throws, NewObject]
181   ArrayBuffer base64URLDecode(ByteString string,
182                               Base64URLDecodeOptions options);
184   /**
185    * Cause the current process to fatally crash unless the given condition is
186    * true. This is similar to MOZ_RELEASE_ASSERT in C++ code.
187    *
188    * WARNING: This message is included publicly in the crash report, and must
189    * not contain private information.
190    *
191    * Crash report will be augmented with the current JS stack information.
192    */
193   undefined releaseAssert(boolean condition,
194                           optional DOMString message = "<no message>");
196 #ifdef NIGHTLY_BUILD
198   /**
199    * If the chrome code has thrown a JavaScript Dev Error
200    * in the current JSRuntime. the first such error, or `undefined`
201    * otherwise.
202    *
203    * A JavaScript Dev Error is an exception thrown by JavaScript
204    * code that matches both conditions:
205    * - it was thrown by chrome code;
206    * - it is either a `ReferenceError`, a `TypeError` or a `SyntaxError`.
207    *
208    * Such errors are stored regardless of whether they have been
209    * caught.
210    *
211    * This mechanism is designed to help ensure that the code of
212    * Firefox is free from Dev Errors, even if they are accidentally
213    * caught by clients.
214    *
215    * The object returned is not an exception. It has fields:
216    * - DOMString stack
217    * - DOMString filename
218    * - DOMString lineNumber
219    * - DOMString message
220    */
221   [Throws]
222   readonly attribute any recentJSDevError;
224   /**
225    * Reset `recentJSDevError` to `undefined` for the current JSRuntime.
226    */
227   undefined clearRecentJSDevError();
228 #endif // NIGHTLY_BUILD
230   /**
231    * Clears the stylesheet cache by baseDomain. This includes associated
232    * state-partitioned cache.
233    */
234   undefined clearStyleSheetCacheByBaseDomain(UTF8String baseDomain);
236   /**
237    * Clears the stylesheet cache by principal.
238    */
239   undefined clearStyleSheetCacheByPrincipal(Principal principal);
241   /**
242    * Clears the entire stylesheet cache.
243    */
244   undefined clearStyleSheetCache();
246   /**
247    * If the profiler is currently running and recording the current thread,
248    * add a marker for the current thread. No-op otherwise.
249    *
250    * @param name              The name of the marker.
251    * @param options           Either a timestamp to use as the start time of the
252    *                          marker, or a ProfilerMarkerOptions object that can
253    *                          contain startTime, captureStack or category fields.
254    *                          If this parameter is omitted, the marker will have
255    *                           no duration.
256    *                          In window and ChromeWorker contexts, use a
257    *                          timestamp from `performance.now()`.
258    *                          In JS modules, use `Cu.now()` to get a timestamp.
259    * @param text              Text to associate with the marker.
260    */
261   undefined addProfilerMarker(UTF8String name,
262                               optional (ProfilerMarkerOptions or DOMHighResTimeStamp) options = {},
263                               optional UTF8String text);
265   /**
266    * Return the symbolic name of any given XPCOM error code (nsresult):
267    * "NS_OK", "NS_ERROR_FAILURE",...
268    */
269   UTF8String getXPCOMErrorName(unsigned long aErrorCode);
271   /**
272    * Return a fractional number representing the current time (in milliseconds from the Epoch).
273    * Should be JS_Now()/1000 so that it can be compared to Date.now in Javascript.
274    */
275   double dateNow();
277   /**
278    * Defines a getter on a specified object that will be created upon first
279    * use.
280    *
281    * @param aTarget
282    *        The object to define the lazy getter on.
283    * @param aName
284    *        The name of the getter to define on aTarget.
285    * @param aLambda
286    *        A function that returns what the getter should return.  This will
287    *        only ever be called once.
288    */
289   [Throws]
290   undefined defineLazyGetter(object aTarget, any aName, object aLambda);
293 #ifdef XP_UNIX
294   /**
295    * Return platform-specific libc constants, such as errno values.
296    */
297   LibcConstants getLibcConstants();
298 #endif
300 #ifdef MOZ_WMF_CDM
301   /**
302    * Returns the information about all Media Foundation based content decryption
303    * modules, which would include key system names and their capabilities.
304    */
305   [NewObject]
306   Promise<sequence<CDMInformation>> getWMFContentDecryptionModuleInformation();
307 #endif
309   /**
310    * Returns the information about the GMP based content decryption
311    * modules, which would include key system names and their capabilities.
312    */
313   [NewObject]
314   Promise<sequence<CDMInformation>> getGMPContentDecryptionModuleInformation();
316   /**
317    * Synchronously loads and evaluates the JS module source located at
318    * 'aResourceURI'.
319    *
320    * @param aResourceURI A resource:// URI string to load the module from.
321    * @param aOption An option to specify where to load the module into.
322    * @returns the module's namespace object.
323    *
324    * The implementation maintains a hash of aResourceURI->global obj.
325    * Subsequent invocations of import with 'aResourceURI' pointing to
326    * the same file will not cause the module to be re-evaluated.
327    *
328    * In worker threads, aOption is required and only { global: "current" } and
329    * { global: "contextual" } are supported.
330    *
331    * In DevTools distinct global, aOptions.global is reuiqred.
332    */
333   [Throws]
334   object importESModule(DOMString aResourceURI,
335                         optional ImportESModuleOptionsDictionary aOptions = {});
337   /**
338    * Defines propertys on the given target which lazily imports a ES module
339    * when accessed.
340    *
341    * @param aTarget The target object on which to define the property.
342    * @param aModules An object with a property for each module property to be
343    *                 imported, where the property name is the name of the
344    *                 imported symbol and the value is the module URI.
345    * @param aOption An option to specify where to load the module into.
346    *
347    * In worker threads, aOption is required and only { global: "current" } and
348    * { global: "contextual" } are supported.
349    *
350    * In DevTools distinct global, aOptions.global is reuiqred.
351    */
352   [Throws]
353   undefined defineESModuleGetters(object aTarget, object aModules,
354                                   optional ImportESModuleOptionsDictionary aOptions = {});
356   /**
357    * IF YOU ADD NEW METHODS HERE, MAKE SURE THEY ARE THREAD-SAFE.
358    */
362  * Additional ChromeUtils methods that are _not_ thread-safe, and hence not
363  * exposed in workers.
364  */
365 [Exposed=Window]
366 partial namespace ChromeUtils {
367   /**
368    * A helper that converts OriginAttributesDictionary to a opaque suffix string.
369    *
370    * @param originAttrs       The originAttributes from the caller.
371    */
372   ByteString
373   originAttributesToSuffix(optional OriginAttributesDictionary originAttrs = {});
375   /**
376    * Returns true if the members of |originAttrs| match the provided members
377    * of |pattern|.
378    *
379    * @param originAttrs       The originAttributes under consideration.
380    * @param pattern           The pattern to use for matching.
381    */
382   boolean
383   originAttributesMatchPattern(optional OriginAttributesDictionary originAttrs = {},
384                                optional OriginAttributesPatternDictionary pattern = {});
386   /**
387    * Returns an OriginAttributesDictionary with values from the |origin| suffix
388    * and unspecified attributes added and assigned default values.
389    *
390    * @param origin            The origin URI to create from.
391    * @returns                 An OriginAttributesDictionary with values from
392    *                          the origin suffix and unspecified attributes
393    *                          added and assigned default values.
394    */
395   [Throws]
396   OriginAttributesDictionary
397   createOriginAttributesFromOrigin(DOMString origin);
399   /**
400    * Returns an OriginAttributesDictionary with values from the origin |suffix|
401    * and unspecified attributes added and assigned default values.
402    *
403    * @param suffix            The origin suffix to create from.
404    * @returns                 An OriginAttributesDictionary with values from
405    *                          the origin suffix and unspecified attributes
406    *                          added and assigned default values.
407    */
408   [Throws]
409   OriginAttributesDictionary
410   CreateOriginAttributesFromOriginSuffix(DOMString suffix);
412   /**
413    * Returns an OriginAttributesDictionary that is a copy of |originAttrs| with
414    * unspecified attributes added and assigned default values.
415    *
416    * @param originAttrs       The origin attributes to copy.
417    * @returns                 An OriginAttributesDictionary copy of |originAttrs|
418    *                          with unspecified attributes added and assigned
419    *                          default values.
420    */
421   OriginAttributesDictionary
422   fillNonDefaultOriginAttributes(optional OriginAttributesDictionary originAttrs = {});
424   /**
425    * Returns true if the 2 OriginAttributes are equal.
426    */
427   boolean
428   isOriginAttributesEqual(optional OriginAttributesDictionary aA = {},
429                           optional OriginAttributesDictionary aB = {});
431   /**
432    * Returns the base domain portion of a given partitionKey.
433    * Returns the empty string for an empty partitionKey.
434    * Throws for invalid partition keys.
435    */
436   [Throws]
437   DOMString
438   getBaseDomainFromPartitionKey(DOMString partitionKey);
440   /**
441    * Returns the partitionKey for a given URL.
442    *
443    * The function will treat the URL as a first party and construct the
444    * partitionKey according to the scheme, site and port in the URL.
445    *
446    * Throws for invalid urls.
447    */
448   [Throws]
449   DOMString
450   getPartitionKeyFromURL(DOMString url);
452   /**
453    * Loads and compiles the script at the given URL and returns an object
454    * which may be used to execute it repeatedly, in different globals, without
455    * re-parsing.
456    */
457   [NewObject]
458   Promise<PrecompiledScript>
459   compileScript(DOMString url, optional CompileScriptOptionsDictionary options = {});
461   /**
462    * Returns an optimized QueryInterface method which, when called from
463    * JavaScript, acts as an ordinary QueryInterface function call, and when
464    * called from XPConnect, circumvents JSAPI entirely.
465    *
466    * The list of interfaces may include a mix of JS ID objects and interface
467    * name strings.
468    *
469    * nsISupports is implicitly supported, and must not be included in the
470    * interface list.
471    */
472   [Affects=Nothing, NewObject]
473   MozQueryInterface generateQI(sequence<any> interfaces);
475   /**
476    * Waive Xray on a given value. Identity op for primitives.
477    */
478   [Throws]
479   any waiveXrays(any val);
481   /**
482    * Strip off Xray waivers on a given value. Identity op for primitives.
483    */
484   [Throws]
485   any unwaiveXrays(any val);
487   /**
488    * Gets the name of the JSClass of the object.
489    *
490    * if |unwrap| is true, all wrappers are unwrapped first. Unless you're
491    * specifically trying to detect whether the object is a proxy, this is
492    * probably what you want.
493    */
494   DOMString getClassName(object obj, optional boolean unwrap = true);
496   /**
497    * Returns whether the object is a DOM object.
498    *
499    * if |unwrap| is true, all wrappers are unwrapped first. Unless you're
500    * specifically trying to detect whether the object is a proxy, this is
501    * probably what you want.
502    */
503   boolean isDOMObject(object obj, optional boolean unwrap = true);
505   /**
506    * Returns whether |str| follows the Date Time String Format.
507    */
508   boolean isISOStyleDate(UTF8String str);
510   /**
511    * Clones the properties of the given object into a new object in the given
512    * target compartment (or the caller compartment if no target is provided).
513    * Property values themeselves are not cloned.
514    *
515    * Ignores non-enumerable properties, properties on prototypes, and properties
516    * with getters or setters.
517    */
518   [Throws]
519   object shallowClone(object obj, optional object? target = null);
521   /**
522    * Dispatches the given callback to the main thread when it would be
523    * otherwise idle. Similar to Window.requestIdleCallback, but not bound to a
524    * particular DOM windw.
525    */
526   [Throws]
527   undefined idleDispatch(IdleRequestCallback callback,
528                          optional IdleRequestOptions options = {});
530   /**
531    * Synchronously loads and evaluates the js file located at
532    * 'aResourceURI' with a new, fully privileged global object.
533    *
534    * If `aTargetObj` is specified all properties exported by the module are
535    * copied to that object. This is deprecated and should not be used in
536    * new code.
537    *
538    * @param aResourceURI A resource:// URI string to load the module from.
539    * @param aTargetObj the object to install the exported properties on or null.
540    * @returns the module code's global object.
541    *
542    * The implementation maintains a hash of aResourceURI->global obj.
543    * Subsequent invocations of import with 'aResourceURI' pointing to
544    * the same file will not cause the module to be re-evaluated, but
545    * the symbols in EXPORTED_SYMBOLS will be exported into the
546    * specified target object and the global object returned as above.
547    *
548    * TODO: Remove this once m-c, c-c, and out-of-tree code migrations finish
549    *       (bug 1881888).
550    */
551   [Throws]
552   object import(UTF8String aResourceURI, optional object aTargetObj);
554   /**
555    * Defines a property on the given target which lazily imports a JavaScript
556    * module when accessed.
557    *
558    * The first time the property is accessed, the module at the given URL is
559    * imported, and the property is replaced with the module's exported symbol
560    * of the same name.
561    *
562    * Some points to note when using this utility:
563    *
564    * - The cached module export is always stored on the `this` object that was
565    *   used to access the getter. This means that if you define the lazy
566    *   getter on a prototype, the module will be re-imported every time the
567    *   property is accessed on a new instance.
568    *
569    * - The getter property may be overwritten by simple assignment, but as
570    *   with imports, the new property value is always defined on the `this`
571    *   object that the setter is called with.
572    *
573    * - If the module import fails, the getter will throw an error, and the
574    *   property will not be replaced. Each subsequent attempt to access the
575    *   getter will attempt to re-import the object, which will likely continue
576    *   to result in errors.
577    *
578    * @param target The target object on which to define the property.
579    * @param id The name of the property to define, and of the symbol to
580    *           import.
581    * @param resourceURI The resource URI of the module, as passed to
582    *                    ChromeUtils.import.
583    */
584   [Throws]
585   undefined defineModuleGetter(object target, DOMString id, DOMString resourceURI);
587   /**
588    * Returns the scripted location of the first ancestor stack frame with a
589    * principal which is subsumed by the given principal. If no such frame
590    * exists on the call stack, returns null.
591    */
592   object? getCallerLocation(Principal principal);
594   /**
595    * Creates a JS Error object with the given message and stack.
596    *
597    * If a stack object is provided, the error object is created in the global
598    * that it belongs to.
599    */
600   [Throws]
601   object createError(DOMString message, optional object? stack = null);
603   /**
604    * Set the collection of specific detailed performance timing information.
605    * Selecting 0 for the mask will end existing collection. All metrics that
606    * are chosen will be cleared after updating the mask.
607    *
608    * @param aCollectionMask A bitmask where each bit corresponds to a metric
609    *        to be collected as listed in PerfStats::Metric.
610    */
611   undefined setPerfStatsCollectionMask(unsigned long long aCollectionMask);
613   /**
614    * Collect results of detailed performance timing information.
615    * The output is a JSON string containing performance timings.
616    */
617   [NewObject]
618   Promise<DOMString> collectPerfStats();
620   /**
621   * Returns a Promise containing a sequence of I/O activities
622   */
623   [NewObject]
624   Promise<sequence<IOActivityDataDictionary>> requestIOActivity();
626   /**
627   * Returns a Promise containing all processes info
628   */
629   [NewObject]
630   Promise<ParentProcInfoDictionary> requestProcInfo();
632   /**
633    * For testing purpose.
634    */
635   [ChromeOnly]
636   boolean vsyncEnabled();
638   [ChromeOnly, Throws]
639   boolean hasReportingHeaderForOrigin(DOMString aOrigin);
641   [ChromeOnly]
642   PopupBlockerState getPopupControlState();
644   /**
645    * Milliseconds from the last iframe loading an external protocol.
646    */
647   [ChromeOnly]
648   double lastExternalProtocolIframeAllowed();
650   /**
651    * For testing purpose we need to reset this value.
652    */
653   [ChromeOnly]
654   undefined resetLastExternalProtocolIframeAllowed();
656   /**
657    * For webdriver consistency purposes, we need to be able to end a wheel
658    * transaction from the browser chrome.
659    */
660   [ChromeOnly]
661   undefined endWheelTransaction();
663   /**
664    * Register a new toplevel window global actor. This method may only be
665    * called in the parent process. |name| must be globally unique.
666    *
667    * See JSWindowActor.webidl for WindowActorOptions fields documentation.
668    */
669   [ChromeOnly, Throws]
670   undefined registerWindowActor(UTF8String aName, optional WindowActorOptions aOptions = {});
672   [ChromeOnly]
673   undefined unregisterWindowActor(UTF8String aName);
675   /**
676    * Register a new toplevel content global actor. This method may only be
677    * called in the parent process. |name| must be globally unique.
678    *
679    * See JSProcessActor.webidl for ProcessActorOptions fields documentation.
680    */
681   [ChromeOnly, Throws]
682   undefined registerProcessActor(UTF8String aName, optional ProcessActorOptions aOptions = {});
684   [ChromeOnly]
685   undefined unregisterProcessActor(UTF8String aName);
687   [ChromeOnly]
688   // aError should a nsresult.
689   boolean isClassifierBlockingErrorCode(unsigned long aError);
691   /**
692    * If leak detection is enabled, print a note to the leak log that this
693    * process will intentionally crash. This should be called only on child
694    * processes for testing purpose.
695    */
696   [ChromeOnly, Throws]
697   undefined privateNoteIntentionalCrash();
699   /**
700    * nsIDOMProcessChild for the current process.
701    */
702   [ChromeOnly]
703   readonly attribute nsIDOMProcessChild? domProcessChild;
705   /**
706    * nsIDOMProcessParent for all processes.
707    *
708    * The first is for the parent process and all the next are for the content
709    * processes.
710    */
711   [Throws, ChromeOnly]
712   sequence<nsIDOMProcessParent> getAllDOMProcesses();
714   /**
715    * Returns a record of user interaction data. Currently only typing,
716    * but will include scrolling and potentially other metrics.
717    *
718    * Valid keys: "Typing"
719    */
720   [Throws, ChromeOnly]
721   record<DOMString, InteractionData> consumeInteractionData();
723   /**
724    * Returns a record of user scrolling interactions collected from content processes.
725    *
726    * Valid keys: "Scrolling"
727    */
728   [NewObject]
729   Promise<InteractionData> collectScrollingData();
731   [Throws]
732   sequence<FormAutofillConfidences> getFormAutofillConfidences(sequence<Element> elements);
734   /**
735    * Returns whether the background of the element is dark.
736    */
737   boolean isDarkBackground(Element element);
739   /**
740    * Starts the JSOracle process for ORB JavaScript validation, if it hasn't started already.
741    */
742   undefined ensureJSOracleStarted();
744   /**
745    * The number of currently alive utility processes.
746    */
747   [ChromeOnly]
748   readonly attribute unsigned long aliveUtilityProcesses;
750   /**
751    * Get a list of all possible Utility process Actor Names ; mostly useful to
752    * perform testing and ensure about:processes display is sound and misses no
753    * actor name.
754    */
755   [ChromeOnly]
756   sequence<UTF8String> getAllPossibleUtilityActorNames();
758   boolean shouldResistFingerprinting(JSRFPTarget target,
759                                      unsigned long long? overriddenFingerprintingSettings);
763  * This type is a WebIDL representation of mozilla::ProcType.
764  * These must match the similar ones in E10SUtils.sys.mjs, RemoteTypes.h,
765  * ProcInfo.h and ChromeUtils.cpp
766  */
767 enum WebIDLProcType {
768  "web",
769  "webIsolated",
770  "file",
771  "extension",
772  "privilegedabout",
773  "privilegedmozilla",
774  "withCoopCoep",
775  "webServiceWorker",
776  "browser",
777  "ipdlUnitTest",
778  "gmpPlugin",
779  "gpu",
780  "vr",
781  "rdd",
782  "socket",
783  "remoteSandboxBroker",
784 #ifdef MOZ_ENABLE_FORKSERVER
785  "forkServer",
786 #endif
787  "utility",
788  "preallocated",
789  "unknown",
793  * These dictionaries hold information about Firefox running processes and
794  * threads.
796  * See widget/ProcInfo.h for fields documentation.
797  */
798 dictionary ThreadInfoDictionary {
799   long long tid = 0;
800   DOMString name = "";
801   unsigned long long cpuCycleCount = 0;
802   unsigned long long cpuTime = 0;
805 dictionary WindowInfoDictionary {
806   // Window ID, as known to the parent process.
807   unsigned long long outerWindowId = 0;
809   // URI of the document loaded in the window.
810   URI? documentURI = null;
812   // Title of the document loaded in the window.
813   // Commonly empty for subframes.
814   DOMString documentTitle = "";
816   // `true` if this window is the root for the process.
817   boolean isProcessRoot = false;
819   // `true` if this is loaded in the same process as the parent, `false` otherwise.
820   boolean isInProcess = false;
824  * Add new entry to WebIDLUtilityActorName here and update accordingly
825  * UtilityActorNameToWebIDL in dom/base/ChromeUtils.cpp as well as
826  * UtilityActorName in toolkit/components/processtools/ProcInfo.h
827  */
828 enum WebIDLUtilityActorName {
829   "unknown",
830   "audioDecoder_Generic",
831   "audioDecoder_AppleMedia",
832   "audioDecoder_WMF",
833   "mfMediaEngineCDM",
834   "jSOracle",
835   "windowsUtils",
836   "windowsFileDialog",
839 dictionary UtilityActorsDictionary {
840   WebIDLUtilityActorName actorName = "unknown";
844  * Information on a child process.
846  * # Limitation
848  * If we lose a race with a process or thread attempting to close the
849  * target process, not all information is available.
851  * Missing information will generally have its default value.
852  */
853 dictionary ChildProcInfoDictionary {
854   // --- System info
856   // The cross-process descriptor for this process.
857   long long pid = 0;
859   // The best end-user measure for "memory used" that we can obtain without
860   // triggering expensive computations. The value is in bytes.
861   // On Mac and Linux this matches the values shown by the system monitors.
862   // On Windows this will return the Commit Size.
863   unsigned long long memory = 0;
865   // Total CPU time spent by the process, in ns.
866   unsigned long long cpuTime = 0;
868   // Total CPU cycles used by this process.
869   // On Windows where the resolution of CPU timings is 16ms, this can
870   // be used to determine if a process is idle or slightly active.
871   unsigned long long cpuCycleCount = 0;
873   // Thread information for this process.
874   sequence<ThreadInfoDictionary> threads = [];
876   // --- Firefox info
878   // Internal-to-Firefox process identifier.
879   unsigned long long childID = 0;
881   // The origin of the process, e.g. the subset of domain names
882   // that this subset serves.
883   UTF8String origin = "";
885   // Type of this child process.
886   WebIDLProcType type = "web";
888   // The windows implemented by this process.
889   sequence<WindowInfoDictionary> windows = [];
891   // The utility process list of actors if any
892   sequence<UtilityActorsDictionary> utilityActors = [];
896  * Information on the parent process.
897  */
898 dictionary ParentProcInfoDictionary {
899   // --- System info
901   // The cross-process descriptor for this process.
902   long long pid = 0;
904   // The best end-user measure for "memory used" that we can obtain without
905   // triggering expensive computations. The value is in bytes.
906   // On Mac and Linux this matches the values shown by the system monitors.
907   // On Windows this will return the Commit Size.
908   unsigned long long memory = 0;
910   // Total CPU time spent by the process, in ns.
911   unsigned long long cpuTime = 0;
913   // Total CPU cycles used by this process.
914   // On Windows where the resolution of CPU timings is 16ms, this can
915   // be used to determine if a process is idle or slightly active.
916   unsigned long long cpuCycleCount = 0;
918   // Thread information for this process.
919   sequence<ThreadInfoDictionary> threads = [];
921   // Information on children processes.
922   sequence<ChildProcInfoDictionary> children = [];
924   // --- Firefox info
925   // Type of this parent process.
926   // As of this writing, this is always `browser`.
927   WebIDLProcType type = "browser";
931  * Used by requestIOActivity() to return the number of bytes
932  * that were read (rx) and/or written (tx) for a given location.
934  * Locations can be sockets or files.
935  */
936 dictionary IOActivityDataDictionary {
937   ByteString location = "";
938   unsigned long long rx = 0;
939   unsigned long long tx = 0;
943  * Used by principals and the script security manager to represent origin
944  * attributes. The first dictionary is designed to contain the full set of
945  * OriginAttributes, the second is used for pattern-matching (i.e. does this
946  * OriginAttributesDictionary match the non-empty attributes in this pattern).
948  * IMPORTANT: If you add any members here, you need to do the following:
949  * (1) Add them to both dictionaries.
950  * (2) Update the methods on mozilla::OriginAttributes, including equality,
951  *     serialization, deserialization, and inheritance.
952  * (3) Update the methods on mozilla::OriginAttributesPattern, including matching.
953  */
954 [GenerateInitFromJSON]
955 dictionary OriginAttributesDictionary {
956   unsigned long userContextId = 0;
957   unsigned long privateBrowsingId = 0;
958   DOMString firstPartyDomain = "";
959   DOMString geckoViewSessionContextId = "";
960   DOMString partitionKey = "";
963 [GenerateInitFromJSON, GenerateToJSON]
964 dictionary OriginAttributesPatternDictionary {
965   unsigned long userContextId;
966   unsigned long privateBrowsingId;
967   DOMString firstPartyDomain;
968   DOMString geckoViewSessionContextId;
969   // partitionKey takes precedence over partitionKeyPattern.
970   DOMString partitionKey;
971   PartitionKeyPatternDictionary partitionKeyPattern;
974 dictionary PartitionKeyPatternDictionary {
975   DOMString scheme;
976   DOMString baseDomain;
977   long port;
978   boolean foreignByAncestorContext;
981 dictionary CompileScriptOptionsDictionary {
982   /**
983    * The character set from which to decode the script.
984    */
985   DOMString charset = "utf-8";
987   /**
988    * If true, certain parts of the script may be parsed lazily, the first time
989    * they are used, rather than eagerly parsed at load time.
990    */
991   boolean lazilyParse = false;
993   /**
994    * If true, the script will be compiled so that its last expression will be
995    * returned as the value of its execution. This makes certain types of
996    * optimization impossible, and disables the JIT in many circumstances, so
997    * should not be used when not absolutely necessary.
998    */
999   boolean hasReturnValue = false;
1003  * Where the modules are loaded into with importESModule and
1004  * defineESModuleGetters.
1005  */
1006 enum ImportESModuleTargetGlobal {
1007   /**
1008    * Load into the shared system global.
1009    * This is the default value.
1010    */
1011   "shared",
1013   /**
1014    * Load into a distinct system global for DevTools, so that the DevTools can
1015    * load a distinct set of modules and do not interfere with its debuggee.
1016    */
1017   "devtools",
1019   /**
1020    * If the current global is DevTools' distinct system global, load into the
1021    * DevTools' distinct system global.
1022    * If the current thread is worker thread, load into the current global.
1023    * Otherwise load into the shared system global.
1024    *
1025    * This is a temporary workaround until DevTools modules are ESMified.
1026    */
1027   "contextual",
1029   /**
1030    * Load into current global.
1031    *
1032    * This can be used for any global.  If this is used for shared global or
1033    * devtools global, this has the same effect as "shared" or "devtools".
1034    */
1035   "current",
1038 dictionary ImportESModuleOptionsDictionary {
1039   // This field is required for importESModule and defineESModuleGetters in
1040   // DevTools distinct global.
1041   ImportESModuleTargetGlobal global;
1045  * A JS object whose properties specify what portion of the heap graph to
1046  * write. The recognized properties are:
1048  * * globals: [ global, ... ]
1049  *   Dump only nodes that either:
1050  *   - belong in the compartment of one of the given globals;
1051  *   - belong to no compartment, but do belong to a Zone that contains one of
1052  *     the given globals;
1053  *   - are referred to directly by one of the last two kinds of nodes; or
1054  *   - is the fictional root node, described below.
1056  * * debugger: Debugger object
1057  *   Like "globals", but use the Debugger's debuggees as the globals.
1059  * * runtime: true
1060  *   Dump the entire heap graph, starting with the JSRuntime's roots.
1062  * One, and only one, of these properties must exist on the boundaries object.
1064  * The root of the dumped graph is a fictional node whose ubi::Node type name is
1065  * "CoreDumpRoot". If we are dumping the entire ubi::Node graph, this root node
1066  * has an edge for each of the JSRuntime's roots. If we are dumping a selected
1067  * set of globals, the root has an edge to each global, and an edge for each
1068  * incoming JS reference to the selected Zones.
1069  */
1070 dictionary HeapSnapshotBoundaries {
1071   sequence<object> globals;
1072   object           debugger;
1073   boolean          runtime;
1076 dictionary Base64URLEncodeOptions {
1077   /** Specifies whether the output should be padded with "=" characters. */
1078   required boolean pad;
1081 enum Base64URLDecodePadding {
1082   /**
1083    * Fails decoding if the input is unpadded. RFC 4648, section 3.2 requires
1084    * padding, unless the referring specification prohibits it.
1085    */
1086   "require",
1088   /** Tolerates padded and unpadded input. */
1089   "ignore",
1091   /**
1092    * Fails decoding if the input is padded. This follows the strict base64url
1093    * variant used in JWS (RFC 7515, Appendix C) and HTTP Encrypted
1094    * Content-Encoding (draft-ietf-httpbis-encryption-encoding-01).
1095    */
1096   "reject"
1099 dictionary Base64URLDecodeOptions {
1100   /** Specifies the padding mode for decoding the input. */
1101   required Base64URLDecodePadding padding;
1104 // Keep this in sync with PopupBlocker::PopupControlState!
1105 enum PopupBlockerState {
1106   "openAllowed",
1107   "openControlled",
1108   "openBlocked",
1109   "openAbused",
1110   "openOverridden",
1113 // Subset of RFPTargets.inc with JS callers.
1114 // New values need to be handled in ChromeUtils::ShouldResistFingerprinting.
1115 enum JSRFPTarget {
1116   "RoundWindowSize",
1117   "SiteSpecificZoom",
1120 #ifdef XP_UNIX
1121 dictionary LibcConstants {
1122   long EINTR;
1123   long EACCES;
1124   long EAGAIN;
1125   long EINVAL;
1126   long ENOSYS;
1128   long F_SETFD;
1129   long F_SETFL;
1131   long FD_CLOEXEC;
1133   long AT_EACCESS;
1135   long O_CREAT;
1136   long O_NONBLOCK;
1137   long O_WRONLY;
1139   long POLLIN;
1140   long POLLOUT;
1141   long POLLERR;
1142   long POLLHUP;
1143   long POLLNVAL;
1145   long WNOHANG;
1147 #ifdef XP_LINUX
1148   long PR_CAPBSET_READ;
1149 #endif
1151 #endif
1153 dictionary CDMInformation {
1154   required DOMString keySystemName;
1155   required DOMString capabilities;
1156   required boolean clearlead;
1157   required boolean isHDCP22Compatible;