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 */
6
7interface nsIDOMProcessChild;
8interface nsIDOMProcessParent;
9interface Principal;
10
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]
22interface MozQueryInterface {
23  [Throws]
24  legacycaller any (any aIID);
25};
26
27/**
28 * Options for a marker created with the addProfilerMarker method.
29 * All fields are optional.
30 */
31dictionary 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;
38
39  // If captureStack is true, a profiler stack will be captured and associated
40  // with the marker.
41  boolean captureStack = false;
42
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";
49
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;
56};
57
58dictionary InteractionData {
59  unsigned long interactionCount = 0;
60  unsigned long interactionTimeInMilliseconds = 0;
61};
62
63/**
64 * A collection of static utility methods that are only exposed to system code.
65 * This is exposed in all the system globals where we can expose stuff by
66 * default, so should only include methods that are **thread-safe**.
67 */
68[ChromeOnly, Exposed=(Window,Worker)]
69namespace ChromeUtils {
70  /**
71   * Get the |NodeId| for the given JS Object.
72   * |NodeId| is the identifier of |JS::ubi::Node|.
73   */
74  NodeId getObjectNodeId(object obj);
75
76  /**
77   * Serialize a snapshot of the heap graph, as seen by |JS::ubi::Node| and
78   * restricted by |boundaries|, and write it to the provided file path.
79   *
80   * @param boundaries        The portion of the heap graph to write.
81   *
82   * @returns                 The path to the file the heap snapshot was written
83   *                          to. This is guaranteed to be within the temp
84   *                          directory and its file name will match the regexp
85   *                          `\d+(\-\d+)?\.fxsnapshot`.
86   */
87  [Throws]
88  DOMString saveHeapSnapshot(optional HeapSnapshotBoundaries boundaries = {});
89
90  /**
91   * This is the same as saveHeapSnapshot, but with a different return value.
92   *
93   * @returns                 The snapshot ID of the file. This is the file name
94   *                          without the temp directory or the trailing
95   *                          `.fxsnapshot`.
96   */
97  [Throws]
98  DOMString saveHeapSnapshotGetId(optional HeapSnapshotBoundaries boundaries = {});
99
100  /**
101   * Deserialize a core dump into a HeapSnapshot.
102   *
103   * @param filePath          The file path to read the heap snapshot from.
104   */
105  [Throws, NewObject]
106  HeapSnapshot readHeapSnapshot(DOMString filePath);
107
108  /**
109   * Return the keys in a weak map.  This operation is
110   * non-deterministic because it is affected by the scheduling of the
111   * garbage collector and the cycle collector.
112   *
113   * @param aMap weak map or other JavaScript value
114   * @returns If aMap is a weak map object, return the keys of the weak
115   *          map as an array.  Otherwise, return undefined.
116   */
117  [Throws, NewObject]
118  any nondeterministicGetWeakMapKeys(any map);
119
120  /**
121   * Return the keys in a weak set.  This operation is
122   * non-deterministic because it is affected by the scheduling of the
123   * garbage collector and the cycle collector.
124   *
125   * @param aSet weak set or other JavaScript value
126   * @returns If aSet is a weak set object, return the keys of the weak
127   *          set as an array.  Otherwise, return undefined.
128   */
129  [Throws, NewObject]
130  any nondeterministicGetWeakSetKeys(any aSet);
131
132  /**
133   * Converts a buffer to a Base64 URL-encoded string per RFC 4648.
134   *
135   * @param source The buffer to encode.
136   * @param options Additional encoding options.
137   * @returns The encoded string.
138   */
139  [Throws]
140  ByteString base64URLEncode(BufferSource source,
141                             Base64URLEncodeOptions options);
142
143  /**
144   * Decodes a Base64 URL-encoded string per RFC 4648.
145   *
146   * @param string The string to decode.
147   * @param options Additional decoding options.
148   * @returns The decoded buffer.
149   */
150  [Throws, NewObject]
151  ArrayBuffer base64URLDecode(ByteString string,
152                              Base64URLDecodeOptions options);
153
154  /**
155   * Cause the current process to fatally crash unless the given condition is
156   * true. This is similar to MOZ_RELEASE_ASSERT in C++ code.
157   *
158   * WARNING: This message is included publicly in the crash report, and must
159   * not contain private information.
160   *
161   * Crash report will be augmented with the current JS stack information.
162   */
163  void releaseAssert(boolean condition,
164                     optional DOMString message = "<no message>");
165
166#ifdef NIGHTLY_BUILD
167
168  /**
169   * If the chrome code has thrown a JavaScript Dev Error
170   * in the current JSRuntime. the first such error, or `undefined`
171   * otherwise.
172   *
173   * A JavaScript Dev Error is an exception thrown by JavaScript
174   * code that matches both conditions:
175   * - it was thrown by chrome code;
176   * - it is either a `ReferenceError`, a `TypeError` or a `SyntaxError`.
177   *
178   * Such errors are stored regardless of whether they have been
179   * caught.
180   *
181   * This mechanism is designed to help ensure that the code of
182   * Firefox is free from Dev Errors, even if they are accidentally
183   * caught by clients.
184   *
185   * The object returned is not an exception. It has fields:
186   * - DOMString stack
187   * - DOMString filename
188   * - DOMString lineNumber
189   * - DOMString message
190   */
191  [Throws]
192  readonly attribute any recentJSDevError;
193
194  /**
195   * Reset `recentJSDevError` to `undefined` for the current JSRuntime.
196   */
197  void clearRecentJSDevError();
198#endif // NIGHTLY_BUILD
199
200  /**
201   * Clears the stylesheet cache by baseDomain. This includes associated
202   * state-partitioned cache.
203   */
204  void clearStyleSheetCacheByBaseDomain(UTF8String baseDomain);
205
206  /**
207   * Clears the stylesheet cache by principal.
208   */
209  void clearStyleSheetCacheByPrincipal(Principal principal);
210
211  /**
212   * Clears the entire stylesheet cache.
213   */
214  void clearStyleSheetCache();
215
216  /**
217   * If the profiler is currently running and recording the current thread,
218   * add a marker for the current thread. No-op otherwise.
219   *
220   * @param name              The name of the marker.
221   * @param options           Either a timestamp to use as the start time of the
222   *                          marker, or a ProfilerMarkerOptions object that can
223   *                          contain startTime, captureStack or category fields.
224   *                          If this parameter is omitted, the marker will have
225   *                           no duration.
226   *                          In window and ChromeWorker contexts, use a
227   *                          timestamp from `performance.now()`.
228   *                          In JS modules, use `Cu.now()` to get a timestamp.
229   * @param text              Text to associate with the marker.
230   */
231  void addProfilerMarker(UTF8String name,
232                         optional (ProfilerMarkerOptions or DOMHighResTimeStamp) options = {},
233                         optional UTF8String text);
234
235  /**
236   * IF YOU ADD NEW METHODS HERE, MAKE SURE THEY ARE THREAD-SAFE.
237   */
238};
239
240/**
241 * Additional ChromeUtils methods that are _not_ thread-safe, and hence not
242 * exposed in workers.
243 */
244[Exposed=Window]
245partial namespace ChromeUtils {
246  /**
247   * A helper that converts OriginAttributesDictionary to a opaque suffix string.
248   *
249   * @param originAttrs       The originAttributes from the caller.
250   */
251  ByteString
252  originAttributesToSuffix(optional OriginAttributesDictionary originAttrs = {});
253
254  /**
255   * Returns true if the members of |originAttrs| match the provided members
256   * of |pattern|.
257   *
258   * @param originAttrs       The originAttributes under consideration.
259   * @param pattern           The pattern to use for matching.
260   */
261  boolean
262  originAttributesMatchPattern(optional OriginAttributesDictionary originAttrs = {},
263                               optional OriginAttributesPatternDictionary pattern = {});
264
265  /**
266   * Returns an OriginAttributesDictionary with values from the |origin| suffix
267   * and unspecified attributes added and assigned default values.
268   *
269   * @param origin            The origin URI to create from.
270   * @returns                 An OriginAttributesDictionary with values from
271   *                          the origin suffix and unspecified attributes
272   *                          added and assigned default values.
273   */
274  [Throws]
275  OriginAttributesDictionary
276  createOriginAttributesFromOrigin(DOMString origin);
277
278  /**
279   * Returns an OriginAttributesDictionary with values from the origin |suffix|
280   * and unspecified attributes added and assigned default values.
281   *
282   * @param suffix            The origin suffix to create from.
283   * @returns                 An OriginAttributesDictionary with values from
284   *                          the origin suffix and unspecified attributes
285   *                          added and assigned default values.
286   */
287  [Throws]
288  OriginAttributesDictionary
289  CreateOriginAttributesFromOriginSuffix(DOMString suffix);
290
291  /**
292   * Returns an OriginAttributesDictionary that is a copy of |originAttrs| with
293   * unspecified attributes added and assigned default values.
294   *
295   * @param originAttrs       The origin attributes to copy.
296   * @returns                 An OriginAttributesDictionary copy of |originAttrs|
297   *                          with unspecified attributes added and assigned
298   *                          default values.
299   */
300  OriginAttributesDictionary
301  fillNonDefaultOriginAttributes(optional OriginAttributesDictionary originAttrs = {});
302
303  /**
304   * Returns true if the 2 OriginAttributes are equal.
305   */
306  boolean
307  isOriginAttributesEqual(optional OriginAttributesDictionary aA = {},
308                          optional OriginAttributesDictionary aB = {});
309
310  /**
311   * Returns the base domain portion of a given partitionKey.
312   * Returns the empty string for an empty partitionKey.
313   * Throws for invalid partition keys.
314   */
315  [Throws]
316  DOMString
317  getBaseDomainFromPartitionKey(DOMString partitionKey);
318
319  /**
320   * Loads and compiles the script at the given URL and returns an object
321   * which may be used to execute it repeatedly, in different globals, without
322   * re-parsing.
323   */
324  [NewObject]
325  Promise<PrecompiledScript>
326  compileScript(DOMString url, optional CompileScriptOptionsDictionary options = {});
327
328  /**
329   * Returns an optimized QueryInterface method which, when called from
330   * JavaScript, acts as an ordinary QueryInterface function call, and when
331   * called from XPConnect, circumvents JSAPI entirely.
332   *
333   * The list of interfaces may include a mix of JS ID objects and interface
334   * name strings.
335   *
336   * nsISupports is implicitly supported, and must not be included in the
337   * interface list.
338   */
339  [Affects=Nothing, NewObject, Throws]
340  MozQueryInterface generateQI(sequence<any> interfaces);
341
342  /**
343   * Waive Xray on a given value. Identity op for primitives.
344   */
345  [Throws]
346  any waiveXrays(any val);
347
348  /**
349   * Strip off Xray waivers on a given value. Identity op for primitives.
350   */
351  [Throws]
352  any unwaiveXrays(any val);
353
354  /**
355   * Gets the name of the JSClass of the object.
356   *
357   * if |unwrap| is true, all wrappers are unwrapped first. Unless you're
358   * specifically trying to detect whether the object is a proxy, this is
359   * probably what you want.
360   */
361  DOMString getClassName(object obj, optional boolean unwrap = true);
362
363  /**
364   * Clones the properties of the given object into a new object in the given
365   * target compartment (or the caller compartment if no target is provided).
366   * Property values themeselves are not cloned.
367   *
368   * Ignores non-enumerable properties, properties on prototypes, and properties
369   * with getters or setters.
370   */
371  [Throws]
372  object shallowClone(object obj, optional object? target = null);
373
374  /**
375   * Dispatches the given callback to the main thread when it would be
376   * otherwise idle. Similar to Window.requestIdleCallback, but not bound to a
377   * particular DOM windw.
378   */
379  [Throws]
380  void idleDispatch(IdleRequestCallback callback,
381                    optional IdleRequestOptions options = {});
382
383  /**
384   * Synchronously loads and evaluates the js file located at
385   * 'aResourceURI' with a new, fully privileged global object.
386   *
387   * If `aTargetObj` is specified, and non-null, all properties exported by
388   * the module are copied to that object.
389   *
390   * If `aTargetObj` is not specified, or is non-null, an object is returned
391   * containing all of the module's exported properties. The same object is
392   * returned for every call.
393   *
394   * If `aTargetObj` is specified and null, the module's global object is
395   * returned, rather than its explicit exports. This behavior is deprecated,
396   * and will removed in the near future, since it is incompatible with the
397   * ES6 module semanitcs we intend to migrate to. It should not be used in
398   * new code.
399   *
400   * @param aResourceURI A resource:// URI string to load the module from.
401   * @param aTargetObj the object to install the exported properties on or null.
402   * @returns the module code's global object.
403   *
404   * The implementation maintains a hash of aResourceURI->global obj.
405   * Subsequent invocations of import with 'aResourceURI' pointing to
406   * the same file will not cause the module to be re-evaluated, but
407   * the symbols in EXPORTED_SYMBOLS will be exported into the
408   * specified target object and the global object returned as above.
409   */
410  [Throws]
411  object import(DOMString aResourceURI, optional object? aTargetObj);
412
413  /**
414   * Defines a property on the given target which lazily imports a JavaScript
415   * module when accessed.
416   *
417   * The first time the property is accessed, the module at the given URL is
418   * imported, and the property is replaced with the module's exported symbol
419   * of the same name.
420   *
421   * Some points to note when using this utility:
422   *
423   * - The cached module export is always stored on the `this` object that was
424   *   used to access the getter. This means that if you define the lazy
425   *   getter on a prototype, the module will be re-imported every time the
426   *   property is accessed on a new instance.
427   *
428   * - The getter property may be overwritten by simple assignment, but as
429   *   with imports, the new property value is always defined on the `this`
430   *   object that the setter is called with.
431   *
432   * - If the module import fails, the getter will throw an error, and the
433   *   property will not be replaced. Each subsequent attempt to access the
434   *   getter will attempt to re-import the object, which will likely continue
435   *   to result in errors.
436   *
437   * @param target The target object on which to define the property.
438   * @param id The name of the property to define, and of the symbol to
439   *           import.
440   * @param resourceURI The resource URI of the module, as passed to
441   *                    ChromeUtils.import.
442   */
443  [Throws]
444  void defineModuleGetter(object target, DOMString id, DOMString resourceURI);
445
446  /**
447   * Returns the scripted location of the first ancestor stack frame with a
448   * principal which is subsumed by the given principal. If no such frame
449   * exists on the call stack, returns null.
450   */
451  object? getCallerLocation(Principal principal);
452
453  /**
454   * Creates a JS Error object with the given message and stack.
455   *
456   * If a stack object is provided, the error object is created in the global
457   * that it belongs to.
458   */
459  [Throws]
460  object createError(DOMString message, optional object? stack = null);
461
462  /**
463   * Request performance metrics to the current process & all content processes.
464   */
465  [Throws]
466  Promise<sequence<PerformanceInfoDictionary>> requestPerformanceMetrics();
467
468  /**
469   * Set the collection of specific detailed performance timing information.
470   * Selecting 0 for the mask will end existing collection. All metrics that
471   * are chosen will be cleared after updating the mask.
472   *
473   * @param aCollectionMask A bitmask where each bit corresponds to a metric
474   *        to be collected as listed in PerfStats::Metric.
475   */
476  void setPerfStatsCollectionMask(unsigned long long aCollectionMask);
477
478  /**
479   * Collect results of detailed performance timing information.
480   * The output is a JSON string containing performance timings.
481   */
482  [Throws]
483  Promise<DOMString> collectPerfStats();
484
485  /**
486  * Returns a Promise containing a sequence of I/O activities
487  */
488  [Throws]
489  Promise<sequence<IOActivityDataDictionary>> requestIOActivity();
490
491  /**
492  * Returns a Promise containing all processes info
493  */
494  [Throws]
495  Promise<ParentProcInfoDictionary> requestProcInfo();
496
497  [ChromeOnly, Throws]
498  boolean hasReportingHeaderForOrigin(DOMString aOrigin);
499
500  [ChromeOnly]
501  PopupBlockerState getPopupControlState();
502
503  /**
504   * Milliseconds from the last iframe loading an external protocol.
505   */
506  [ChromeOnly]
507  double lastExternalProtocolIframeAllowed();
508
509  /**
510   * For testing purpose we need to reset this value.
511   */
512  [ChromeOnly]
513  void resetLastExternalProtocolIframeAllowed();
514
515  /**
516   * Register a new toplevel window global actor. This method may only be
517   * called in the parent process. |name| must be globally unique.
518   *
519   * See JSWindowActor.webidl for WindowActorOptions fields documentation.
520   */
521  [ChromeOnly, Throws]
522  void registerWindowActor(UTF8String aName, optional WindowActorOptions aOptions = {});
523
524  [ChromeOnly]
525  void unregisterWindowActor(UTF8String aName);
526
527  /**
528   * Register a new toplevel content global actor. This method may only be
529   * called in the parent process. |name| must be globally unique.
530   *
531   * See JSProcessActor.webidl for ProcessActorOptions fields documentation.
532   */
533  [ChromeOnly, Throws]
534  void registerProcessActor(UTF8String aName, optional ProcessActorOptions aOptions = {});
535
536  [ChromeOnly]
537  void unregisterProcessActor(UTF8String aName);
538
539  [ChromeOnly]
540  // aError should a nsresult.
541  boolean isClassifierBlockingErrorCode(unsigned long aError);
542
543  /**
544   * If leak detection is enabled, print a note to the leak log that this
545   * process will intentionally crash. This should be called only on child
546   * processes for testing purpose.
547   */
548  [ChromeOnly, Throws]
549  void privateNoteIntentionalCrash();
550
551  /**
552   * nsIDOMProcessChild for the current process.
553   */
554  [ChromeOnly]
555  readonly attribute nsIDOMProcessChild? domProcessChild;
556
557  /**
558   * nsIDOMProcessParent for all processes.
559   *
560   * The first is for the parent process and all the next are for the content
561   * processes.
562   */
563  [Throws, ChromeOnly]
564  sequence<nsIDOMProcessParent> getAllDOMProcesses();
565
566  /**
567   * Returns a record of user interaction data. Currently only typing,
568   * but will include scrolling and potentially other metrics.
569   *
570   * Valid keys: "Typing"
571   */
572  [Throws, ChromeOnly]
573  record<DOMString, InteractionData> consumeInteractionData();
574
575};
576
577/*
578 * This type is a WebIDL representation of mozilla::ProcType.
579 */
580enum WebIDLProcType {
581 "web",
582 "webIsolated",
583 "file",
584 "extension",
585 "privilegedabout",
586 "privilegedmozilla",
587 "webLargeAllocation",
588 "withCoopCoep",
589 "browser",
590 "ipdlUnitTest",
591 "gmpPlugin",
592 "gpu",
593 "vr",
594 "rdd",
595 "socket",
596 "remoteSandboxBroker",
597#ifdef MOZ_ENABLE_FORKSERVER
598 "forkServer",
599#endif
600 "preallocated",
601 "unknown",
602};
603
604/**
605 * These dictionaries hold information about Firefox running processes and
606 * threads.
607 *
608 * See widget/ProcInfo.h for fields documentation.
609 */
610dictionary ThreadInfoDictionary {
611  long long tid = 0;
612  DOMString name = "";
613  unsigned long long cpuUser = 0;
614  unsigned long long cpuKernel = 0;
615};
616
617dictionary WindowInfoDictionary {
618  // Window ID, as known to the parent process.
619  unsigned long long outerWindowId = 0;
620
621  // URI of the document loaded in the window.
622  URI? documentURI = null;
623
624  // Title of the document loaded in the window.
625  // Commonly empty for subframes.
626  DOMString documentTitle = "";
627
628  // `true` if this window is the root for the process.
629  boolean isProcessRoot = false;
630
631  // `true` if this is loaded in the same process as the parent, `false` otherwise.
632  boolean isInProcess = false;
633};
634
635/**
636 * Information on a child process.
637 *
638 * # Limitation
639 *
640 * If we lose a race with a process or thread attempting to close the
641 * target process, not all information is available.
642 *
643 * Missing information will generally have its default value.
644 */
645dictionary ChildProcInfoDictionary {
646  // --- System info
647
648  // The cross-process descriptor for this process.
649  long long pid = 0;
650
651  // Process filename (without the path name).
652  DOMString filename = "";
653
654  // RSS, in bytes, i.e. the total amount of memory allocated
655  // by this process.
656  long long residentSetSize = 0;
657
658  // Resident unique size, i.e. the total amount of memory
659  // allocated by this process *and not shared with other processes*.
660  // Given that we share lots of memory between processes,
661  // this is probably the best end-user measure for "memory used".
662  long long residentUniqueSize = 0;
663
664  // Time spent by the process in user mode, in ns.
665  unsigned long long cpuUser = 0;
666
667  // Time spent by the process in kernel mode, in ns.
668  unsigned long long cpuKernel = 0;
669
670  // Thread information for this process.
671  sequence<ThreadInfoDictionary> threads = [];
672
673  // --- Firefox info
674
675  // Internal-to-Firefox process identifier.
676  unsigned long long childID = 0;
677
678  // The origin of the process, e.g. the subset of domain names
679  // that this subset serves.
680  UTF8String origin = "";
681
682  // Type of this child process.
683  WebIDLProcType type = "web";
684
685  // The windows implemented by this process.
686  sequence<WindowInfoDictionary> windows = [];
687};
688
689/**
690 * Information on the parent process.
691 */
692dictionary ParentProcInfoDictionary {
693  // --- System info
694
695  // The cross-process descriptor for this process.
696  long long pid = 0;
697
698  // Process filename (without the path name).
699  DOMString filename = "";
700
701  // RSS, in bytes, i.e. the total amount of memory allocated
702  // by this process.
703  long long residentSetSize = 0;
704
705  // Resident unique size, i.e. the total amount of memory
706  // allocated by this process *and not shared with other processes*.
707  // Given that we share lots of memory between processes,
708  // this is probably the best end-user measure for "memory used".
709  long long residentUniqueSize = 0;
710
711  // Time spent by the process in user mode, in ns.
712  unsigned long long cpuUser = 0;
713
714  // Time spent by the process in kernel mode, in ns.
715  unsigned long long cpuKernel = 0;
716
717  // Thread information for this process.
718  sequence<ThreadInfoDictionary> threads = [];
719
720  // Information on children processes.
721  sequence<ChildProcInfoDictionary> children = [];
722
723  // --- Firefox info
724  // Type of this parent process.
725  // As of this writing, this is always `browser`.
726  WebIDLProcType type = "browser";
727};
728
729/**
730 * Dictionaries duplicating IPDL types in dom/ipc/DOMTypes.ipdlh
731 * Used by requestPerformanceMetrics
732 */
733dictionary MediaMemoryInfoDictionary {
734  unsigned long long audioSize = 0;
735  unsigned long long videoSize = 0;
736  unsigned long long resourcesSize = 0;
737};
738
739dictionary MemoryInfoDictionary {
740  unsigned long long domDom = 0;
741  unsigned long long domStyle = 0;
742  unsigned long long domOther = 0;
743  unsigned long long GCHeapUsage = 0;
744  required MediaMemoryInfoDictionary media;
745};
746
747dictionary CategoryDispatchDictionary
748{
749  unsigned short category = 0;
750  unsigned short count = 0;
751};
752
753dictionary PerformanceInfoDictionary {
754  ByteString host = "";
755  unsigned long pid = 0;
756  unsigned long long windowId = 0;
757  unsigned long long duration = 0;
758  unsigned long long counterId = 0;
759  boolean isWorker = false;
760  boolean isTopLevel = false;
761  required MemoryInfoDictionary memoryInfo;
762  sequence<CategoryDispatchDictionary> items = [];
763};
764
765/**
766 * Used by requestIOActivity() to return the number of bytes
767 * that were read (rx) and/or written (tx) for a given location.
768 *
769 * Locations can be sockets or files.
770 */
771dictionary IOActivityDataDictionary {
772  ByteString location = "";
773  unsigned long long rx = 0;
774  unsigned long long tx = 0;
775};
776
777/**
778 * Used by principals and the script security manager to represent origin
779 * attributes. The first dictionary is designed to contain the full set of
780 * OriginAttributes, the second is used for pattern-matching (i.e. does this
781 * OriginAttributesDictionary match the non-empty attributes in this pattern).
782 *
783 * IMPORTANT: If you add any members here, you need to do the following:
784 * (1) Add them to both dictionaries.
785 * (2) Update the methods on mozilla::OriginAttributes, including equality,
786 *     serialization, deserialization, and inheritance.
787 * (3) Update the methods on mozilla::OriginAttributesPattern, including matching.
788 */
789[GenerateInitFromJSON]
790dictionary OriginAttributesDictionary {
791  unsigned long userContextId = 0;
792  boolean inIsolatedMozBrowser = false;
793  unsigned long privateBrowsingId = 0;
794  DOMString firstPartyDomain = "";
795  DOMString geckoViewSessionContextId = "";
796  DOMString partitionKey = "";
797};
798
799[GenerateInitFromJSON, GenerateToJSON]
800dictionary OriginAttributesPatternDictionary {
801  unsigned long userContextId;
802  boolean inIsolatedMozBrowser;
803  unsigned long privateBrowsingId;
804  DOMString firstPartyDomain;
805  DOMString geckoViewSessionContextId;
806  // partitionKey takes precedence over partitionKeyPattern.
807  DOMString partitionKey;
808  PartitionKeyPatternDictionary partitionKeyPattern;
809};
810
811dictionary PartitionKeyPatternDictionary {
812  DOMString scheme;
813  DOMString baseDomain;
814  long port;
815};
816
817dictionary CompileScriptOptionsDictionary {
818  /**
819   * The character set from which to decode the script.
820   */
821  DOMString charset = "utf-8";
822
823  /**
824   * If true, certain parts of the script may be parsed lazily, the first time
825   * they are used, rather than eagerly parsed at load time.
826   */
827  boolean lazilyParse = false;
828
829  /**
830   * If true, the script will be compiled so that its last expression will be
831   * returned as the value of its execution. This makes certain types of
832   * optimization impossible, and disables the JIT in many circumstances, so
833   * should not be used when not absolutely necessary.
834   */
835  boolean hasReturnValue = false;
836};
837
838/**
839 * A JS object whose properties specify what portion of the heap graph to
840 * write. The recognized properties are:
841 *
842 * * globals: [ global, ... ]
843 *   Dump only nodes that either:
844 *   - belong in the compartment of one of the given globals;
845 *   - belong to no compartment, but do belong to a Zone that contains one of
846 *     the given globals;
847 *   - are referred to directly by one of the last two kinds of nodes; or
848 *   - is the fictional root node, described below.
849 *
850 * * debugger: Debugger object
851 *   Like "globals", but use the Debugger's debuggees as the globals.
852 *
853 * * runtime: true
854 *   Dump the entire heap graph, starting with the JSRuntime's roots.
855 *
856 * One, and only one, of these properties must exist on the boundaries object.
857 *
858 * The root of the dumped graph is a fictional node whose ubi::Node type name is
859 * "CoreDumpRoot". If we are dumping the entire ubi::Node graph, this root node
860 * has an edge for each of the JSRuntime's roots. If we are dumping a selected
861 * set of globals, the root has an edge to each global, and an edge for each
862 * incoming JS reference to the selected Zones.
863 */
864dictionary HeapSnapshotBoundaries {
865  sequence<object> globals;
866  object           debugger;
867  boolean          runtime;
868};
869
870dictionary Base64URLEncodeOptions {
871  /** Specifies whether the output should be padded with "=" characters. */
872  required boolean pad;
873};
874
875enum Base64URLDecodePadding {
876  /**
877   * Fails decoding if the input is unpadded. RFC 4648, section 3.2 requires
878   * padding, unless the referring specification prohibits it.
879   */
880  "require",
881
882  /** Tolerates padded and unpadded input. */
883  "ignore",
884
885  /**
886   * Fails decoding if the input is padded. This follows the strict base64url
887   * variant used in JWS (RFC 7515, Appendix C) and HTTP Encrypted
888   * Content-Encoding (draft-ietf-httpbis-encryption-encoding-01).
889   */
890  "reject"
891};
892
893dictionary Base64URLDecodeOptions {
894  /** Specifies the padding mode for decoding the input. */
895  required Base64URLDecodePadding padding;
896};
897
898// Keep this in sync with PopupBlocker::PopupControlState!
899enum PopupBlockerState {
900  "openAllowed",
901  "openControlled",
902  "openBlocked",
903  "openAbused",
904  "openOverridden",
905};
906