From 43a97878ce14b72f0981164f87f2e35e14151312 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 11:22:09 +0200 Subject: Adding upstream version 110.0.1. Signed-off-by: Daniel Baumann --- dom/chrome-webidl/BrowserSessionStore.webidl | 59 ++ dom/chrome-webidl/BrowsingContext.webidl | 394 ++++++++ dom/chrome-webidl/ChannelWrapper.webidl | 578 +++++++++++ dom/chrome-webidl/ChromeUtils.webidl | 1009 ++++++++++++++++++++ dom/chrome-webidl/ClonedErrorHolder.webidl | 18 + dom/chrome-webidl/DOMCollectedFrames.webidl | 29 + dom/chrome-webidl/DebuggerNotification.webidl | 58 ++ .../DebuggerNotificationObserver.webidl | 31 + dom/chrome-webidl/DebuggerUtils.webidl | 16 + dom/chrome-webidl/DocumentL10n.webidl | 47 + dom/chrome-webidl/DominatorTree.webidl | 70 ++ dom/chrome-webidl/Flex.webidl | 94 ++ dom/chrome-webidl/Fluent.webidl | 51 + dom/chrome-webidl/FrameLoader.webidl | 233 +++++ dom/chrome-webidl/Glean.webidl | 45 + dom/chrome-webidl/GleanPings.webidl | 15 + dom/chrome-webidl/HeapSnapshot.webidl | 105 ++ dom/chrome-webidl/IOUtils.webidl | 766 +++++++++++++++ dom/chrome-webidl/ImageText.webidl | 29 + dom/chrome-webidl/InspectorUtils.webidl | 188 ++++ dom/chrome-webidl/IteratorResult.webidl | 15 + dom/chrome-webidl/JSActor.webidl | 49 + dom/chrome-webidl/JSProcessActor.webidl | 94 ++ dom/chrome-webidl/JSWindowActor.webidl | 186 ++++ dom/chrome-webidl/L10nOverlays.webidl | 24 + dom/chrome-webidl/L10nRegistry.webidl | 180 ++++ dom/chrome-webidl/MatchGlob.webidl | 26 + dom/chrome-webidl/MatchPattern.webidl | 150 +++ dom/chrome-webidl/MediaController.webidl | 75 ++ dom/chrome-webidl/MessageManager.webidl | 576 +++++++++++ dom/chrome-webidl/MozDocumentObserver.webidl | 20 + dom/chrome-webidl/MozSharedMap.webidl | 54 ++ .../MozStorageAsyncStatementParams.webidl | 22 + dom/chrome-webidl/MozStorageStatementParams.webidl | 22 + dom/chrome-webidl/MozStorageStatementRow.webidl | 11 + dom/chrome-webidl/NetDashboard.webidl | 155 +++ dom/chrome-webidl/PathUtils.webidl | 187 ++++ dom/chrome-webidl/PlacesEvent.webidl | 520 ++++++++++ dom/chrome-webidl/PlacesObservers.webidl | 31 + dom/chrome-webidl/PrecompiledScript.webidl | 43 + dom/chrome-webidl/PrioEncoder.webidl | 20 + dom/chrome-webidl/PromiseDebugging.webidl | 110 +++ dom/chrome-webidl/SessionStoreUtils.webidl | 169 ++++ dom/chrome-webidl/StructuredCloneHolder.webidl | 32 + dom/chrome-webidl/TelemetryStopwatch.webidl | 238 +++++ dom/chrome-webidl/UniFFI.webidl | 107 +++ dom/chrome-webidl/UserInteraction.webidl | 113 +++ dom/chrome-webidl/WebExtensionContentScript.webidl | 174 ++++ dom/chrome-webidl/WebExtensionPolicy.webidl | 320 +++++++ dom/chrome-webidl/WindowGlobalActors.webidl | 189 ++++ dom/chrome-webidl/XULFrameElement.webidl | 31 + dom/chrome-webidl/XULMenuElement.webidl | 19 + dom/chrome-webidl/XULTextElement.webidl | 15 + dom/chrome-webidl/XULTreeElement.webidl | 180 ++++ dom/chrome-webidl/moz.build | 112 +++ 55 files changed, 8104 insertions(+) create mode 100644 dom/chrome-webidl/BrowserSessionStore.webidl create mode 100644 dom/chrome-webidl/BrowsingContext.webidl create mode 100644 dom/chrome-webidl/ChannelWrapper.webidl create mode 100644 dom/chrome-webidl/ChromeUtils.webidl create mode 100644 dom/chrome-webidl/ClonedErrorHolder.webidl create mode 100644 dom/chrome-webidl/DOMCollectedFrames.webidl create mode 100644 dom/chrome-webidl/DebuggerNotification.webidl create mode 100644 dom/chrome-webidl/DebuggerNotificationObserver.webidl create mode 100644 dom/chrome-webidl/DebuggerUtils.webidl create mode 100644 dom/chrome-webidl/DocumentL10n.webidl create mode 100644 dom/chrome-webidl/DominatorTree.webidl create mode 100644 dom/chrome-webidl/Flex.webidl create mode 100644 dom/chrome-webidl/Fluent.webidl create mode 100644 dom/chrome-webidl/FrameLoader.webidl create mode 100644 dom/chrome-webidl/Glean.webidl create mode 100644 dom/chrome-webidl/GleanPings.webidl create mode 100644 dom/chrome-webidl/HeapSnapshot.webidl create mode 100644 dom/chrome-webidl/IOUtils.webidl create mode 100644 dom/chrome-webidl/ImageText.webidl create mode 100644 dom/chrome-webidl/InspectorUtils.webidl create mode 100644 dom/chrome-webidl/IteratorResult.webidl create mode 100644 dom/chrome-webidl/JSActor.webidl create mode 100644 dom/chrome-webidl/JSProcessActor.webidl create mode 100644 dom/chrome-webidl/JSWindowActor.webidl create mode 100644 dom/chrome-webidl/L10nOverlays.webidl create mode 100644 dom/chrome-webidl/L10nRegistry.webidl create mode 100644 dom/chrome-webidl/MatchGlob.webidl create mode 100644 dom/chrome-webidl/MatchPattern.webidl create mode 100644 dom/chrome-webidl/MediaController.webidl create mode 100644 dom/chrome-webidl/MessageManager.webidl create mode 100644 dom/chrome-webidl/MozDocumentObserver.webidl create mode 100644 dom/chrome-webidl/MozSharedMap.webidl create mode 100644 dom/chrome-webidl/MozStorageAsyncStatementParams.webidl create mode 100644 dom/chrome-webidl/MozStorageStatementParams.webidl create mode 100644 dom/chrome-webidl/MozStorageStatementRow.webidl create mode 100644 dom/chrome-webidl/NetDashboard.webidl create mode 100644 dom/chrome-webidl/PathUtils.webidl create mode 100644 dom/chrome-webidl/PlacesEvent.webidl create mode 100644 dom/chrome-webidl/PlacesObservers.webidl create mode 100644 dom/chrome-webidl/PrecompiledScript.webidl create mode 100644 dom/chrome-webidl/PrioEncoder.webidl create mode 100644 dom/chrome-webidl/PromiseDebugging.webidl create mode 100644 dom/chrome-webidl/SessionStoreUtils.webidl create mode 100644 dom/chrome-webidl/StructuredCloneHolder.webidl create mode 100644 dom/chrome-webidl/TelemetryStopwatch.webidl create mode 100644 dom/chrome-webidl/UniFFI.webidl create mode 100644 dom/chrome-webidl/UserInteraction.webidl create mode 100644 dom/chrome-webidl/WebExtensionContentScript.webidl create mode 100644 dom/chrome-webidl/WebExtensionPolicy.webidl create mode 100644 dom/chrome-webidl/WindowGlobalActors.webidl create mode 100644 dom/chrome-webidl/XULFrameElement.webidl create mode 100644 dom/chrome-webidl/XULMenuElement.webidl create mode 100644 dom/chrome-webidl/XULTextElement.webidl create mode 100644 dom/chrome-webidl/XULTreeElement.webidl create mode 100644 dom/chrome-webidl/moz.build (limited to 'dom/chrome-webidl') diff --git a/dom/chrome-webidl/BrowserSessionStore.webidl b/dom/chrome-webidl/BrowserSessionStore.webidl new file mode 100644 index 0000000000..23d3df9457 --- /dev/null +++ b/dom/chrome-webidl/BrowserSessionStore.webidl @@ -0,0 +1,59 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +// object contains either a CollectedFileListValue or a CollectedNonMultipleSelectValue or Sequence +typedef (DOMString or boolean or object) FormDataValue; + +[ChromeOnly, Exposed=Window] +interface SessionStoreFormData { + [Cached, Pure] + readonly attribute ByteString? url; + + [Cached, Pure] + readonly attribute record? id; + + [Cached, Pure] + readonly attribute record? xpath; + + [Cached, Pure] + readonly attribute DOMString? innerHTML; + + [Cached, Frozen, Pure] + readonly attribute sequence? children; + + object toJSON(); +}; + +[GenerateConversionToJS] +dictionary SessionStoreDisplaySize { + unsigned long width; + unsigned long height; +}; + +[GenerateConversionToJS] +dictionary SessionStoreZoomData { + double resolution; + SessionStoreDisplaySize displaySize; +}; + +[ChromeOnly, Exposed=Window] +interface SessionStoreScrollData { + [Cached, Pure] + readonly attribute ByteString? scroll; + + [Cached, Pure] + readonly attribute sequence? children; + + object toJSON(); +}; + +[GenerateConversionToJS] +dictionary UpdateSessionStoreData { + // This is docshell caps, but on-disk format uses the disallow property name. + ByteString? disallow; + boolean isPrivate; + SessionStoreFormData? formdata; + SessionStoreScrollData? scroll; +}; diff --git a/dom/chrome-webidl/BrowsingContext.webidl b/dom/chrome-webidl/BrowsingContext.webidl new file mode 100644 index 0000000000..590ad9e2fd --- /dev/null +++ b/dom/chrome-webidl/BrowsingContext.webidl @@ -0,0 +1,394 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +interface URI; +interface nsIDocShell; +interface nsISecureBrowserUI; +interface nsIPrintSettings; +interface nsIWebProgress; + +interface mixin LoadContextMixin { + readonly attribute WindowProxy? associatedWindow; + + readonly attribute WindowProxy? topWindow; + + readonly attribute Element? topFrameElement; + + readonly attribute boolean isContent; + + [SetterThrows] + attribute boolean usePrivateBrowsing; + + readonly attribute boolean useRemoteTabs; + + readonly attribute boolean useRemoteSubframes; + + [BinaryName="useTrackingProtectionWebIDL", SetterThrows] + attribute boolean useTrackingProtection; + + [NewObject, Throws] + readonly attribute any originAttributes; +}; + +/** + * Allowed CSS display modes. This needs to be kept in + * sync with similar values in ServoStyleConsts.h + */ +enum DisplayMode { + "browser", + "minimal-ui", + "standalone", + "fullscreen", +}; + +/** + * CSS prefers-color-scheme values. + */ +enum PrefersColorSchemeOverride { + "none", + "light", + "dark", +}; + +/** + * Allowed overrides of platform/pref default behaviour for touch events. + */ +enum TouchEventsOverride { + "disabled", // Force-disable touch events. + "enabled", // Force-enable touch events. + "none", // Don't override behaviour for touch events. +}; + +[Exposed=Window, ChromeOnly] +interface BrowsingContext { + static BrowsingContext? get(unsigned long long aId); + + static BrowsingContext? getFromWindow(WindowProxy window); + + static BrowsingContext? getCurrentTopByBrowserId(unsigned long long aId); + + sequence getAllBrowsingContextsInSubtree(); + + BrowsingContext? findChildWithName(DOMString name, BrowsingContext accessor); + BrowsingContext? findWithName(DOMString name); + + readonly attribute DOMString name; + + readonly attribute BrowsingContext? parent; + + readonly attribute BrowsingContext top; + + [Cached, Frozen, Pure] + readonly attribute sequence children; + + readonly attribute nsIDocShell? docShell; + + readonly attribute Element? embedderElement; + + readonly attribute unsigned long long id; + + readonly attribute BrowsingContext? opener; + + readonly attribute BrowsingContextGroup group; + + readonly attribute WindowProxy? window; + + readonly attribute WindowContext? currentWindowContext; + + readonly attribute WindowContext? parentWindowContext; + + readonly attribute WindowContext? topWindowContext; + + readonly attribute boolean ancestorsAreCurrent; + + [SetterThrows] attribute [LegacyNullToEmptyString] DOMString customPlatform; + + [SetterThrows] attribute [LegacyNullToEmptyString] DOMString customUserAgent; + + readonly attribute DOMString embedderElementType; + + readonly attribute boolean createdDynamically; + + readonly attribute boolean isInBFCache; + + readonly attribute boolean isDiscarded; + + /** + * The sandbox flags on the browsing context. These reflect the value of the + * sandbox attribute of the associated IFRAME or CSP-protectable content, if + * existent. See the HTML5 spec for more details. + * These flags on the browsing context reflect the current state of the + * sandbox attribute, which is modifiable. They are only used when loading new + * content, sandbox flags are also immutably set on the document when it is + * loaded. + * The sandbox flags of a document depend on the sandbox flags on its + * browsing context and of its parent document, if any. + * See nsSandboxFlags.h for the possible flags. + */ + [SetterThrows] attribute unsigned long sandboxFlags; + + [SetterThrows] attribute boolean isActive; + + // The inRDMPane flag indicates whether or not Responsive Design Mode is + // active for the browsing context. + [SetterThrows] attribute boolean inRDMPane; + + [SetterThrows] attribute float fullZoom; + + [SetterThrows] attribute float textZoom; + + // Override the dots-per-CSS-pixel scaling factor in this BrowsingContext + // and all of its descendants. May only be set on the top BC, and should + // only be set from the parent process. + // + // A value of 0.0 causes us to use the global default scaling factor. + // + // NOTE that this override only affects a few minor things (the value exposed + // to devicePixelRatio and some media queries in content, and responsive + // image selection). Most notably, it does _not_ affect rendering. + // + // It is intended for RDM, and is probably not what you want in other cases. + // If you want to change the actual device pixel ratio that rendering code + // uses, you probably want to change the fullZoom. + [SetterThrows] attribute float overrideDPPX; + + [SetterThrows] attribute boolean suspendMediaWhenInactive; + + // Default value for nsIContentViewer::authorStyleDisabled in any new + // browsing contexts created as a descendant of this one. + // + // Valid only for top browsing contexts. + [SetterThrows] attribute boolean authorStyleDisabledDefault; + + /** + * Whether this docshell should save entries in global history. + */ + [SetterThrows] attribute boolean useGlobalHistory; + + // Extension to give chrome JS the ability to set the window screen + // orientation while in RDM. + [Throws] undefined setRDMPaneOrientation(OrientationType type, float rotationAngle); + + // Extension to give chrome JS the ability to set a maxTouchPoints override + // while in RDM. + [Throws] undefined setRDMPaneMaxTouchPoints(octet maxTouchPoints); + + // The watchedByDevTools flag indicates whether or not DevTools are currently + // debugging this browsing context. + [SetterThrows] attribute boolean watchedByDevTools; + + // Enable some service workers testing features, for DevTools. + [SetterThrows] attribute boolean serviceWorkersTestingEnabled; + + // Enable media query medium override, for DevTools. + [SetterThrows] attribute DOMString mediumOverride; + + // Color-scheme simulation, for DevTools. + [SetterThrows] attribute PrefersColorSchemeOverride prefersColorSchemeOverride; + + /** + * A unique identifier for the browser element that is hosting this + * BrowsingContext tree. Every BrowsingContext in the element's tree will + * return the same ID in all processes and it will remain stable regardless of + * process changes. When a browser element's frameloader is switched to + * another browser element this ID will remain the same but hosted under the + * under the new browser element. + */ + [SetterThrows] attribute unsigned long long browserId; + + [SetterThrows] attribute DisplayMode displayMode; + + /** + * This allows chrome to override the default choice of whether touch events + * are available in a specific BrowsingContext and its descendents. + */ + readonly attribute TouchEventsOverride touchEventsOverride; + + /** + * Returns true if the top-level BrowsingContext has been configured to + * default-target user-initiated link clicks to _blank. + */ + readonly attribute boolean targetTopLevelLinkClicksToBlank; + + /** + * Partially determines whether script execution is allowed in this + * BrowsingContext. Script execution will be permitted only if this + * attribute is true and script execution is allowed in the parent + * WindowContext. + * + * May only be set in the parent process. + */ + [SetterThrows] attribute boolean allowJavascript; + + /** + * Determines whether we're forcing a desktop-mode viewport. Only settable in + * the top browsing context from the parent process. + */ + [SetterThrows] attribute boolean forceDesktopViewport; + + /* + * Default load flags (as defined in nsIRequest) that will be set on all + * requests made by this BrowsingContext. + */ + [SetterThrows] attribute long defaultLoadFlags; + + /** + * The nsID of the browsing context in the session history. + */ + [NewObject, Throws] + readonly attribute any historyID; + + readonly attribute ChildSHistory? childSessionHistory; + + // Resets the location change rate limit. Used for testing. + undefined resetLocationChangeRateLimit(); + + readonly attribute long childOffset; +}; + +BrowsingContext includes LoadContextMixin; + +[Exposed=Window, ChromeOnly] +interface CanonicalBrowsingContext : BrowsingContext { + sequence getWindowGlobals(); + + readonly attribute WindowGlobalParent? currentWindowGlobal; + + readonly attribute WindowProxy? topChromeWindow; + + // XXX(nika): This feels kinda hacky, but will do for now while we don't + // synchronously create WindowGlobalParent. It can throw if somehow the + // content process has died. + [Throws] + readonly attribute UTF8String? currentRemoteType; + + readonly attribute WindowGlobalParent? embedderWindowGlobal; + + undefined notifyStartDelayedAutoplayMedia(); + [Throws] undefined notifyMediaMutedChanged(boolean muted); + + readonly attribute nsISecureBrowserUI? secureBrowserUI; + + /** + * Returns an nsIWebProgress object for this BrowsingContext, if this + * is a top-level content BC. + * + * Progress listeners attached to this will get notifications filtered by + * nsBrowserStatusFilter, and don't get any notifications from sub frames. + */ + readonly attribute nsIWebProgress? webProgress; + + static unsigned long countSiteOrigins(sequence roots); + + /** + * Loads a given URI. This will give priority to loading the requested URI + * in the object implementing this interface. If it can't be loaded here + * however, the URI dispatcher will go through its normal process of content + * loading. + * + * @param aURI + * The URI string to load. For HTTP and FTP URLs and possibly others, + * characters above U+007F will be converted to UTF-8 and then URL- + * escaped per the rules of RFC 2396. + * @param aLoadURIOptions + * A JSObject defined in LoadURIOptions.webidl holding info like e.g. + * the triggeringPrincipal, the referrer info. + */ + [Throws] + undefined loadURI(DOMString aURI, optional LoadURIOptions aOptions = {}); + + /** + * Print the current document. + * + * @param aOuterWindowID the ID of the outer window to print + * @param aPrintSettings print settings to use; printSilent can be + * set to prevent prompting. + * @return A Promise that resolves once printing is finished. + */ + [NewObject, BinaryName="printJS"] + Promise print(nsIPrintSettings aPrintSettings); + + /** + * These methods implement the nsIWebNavigation methods of the same names + */ + undefined goBack(optional long aCancelContentJSEpoch, optional boolean aRequireUserInteraction = false, optional boolean aUserActivation = false); + undefined goForward(optional long aCancelContentJSEpoch, optional boolean aRequireUserInteraction = false, optional boolean aUserActivation = false); + undefined goToIndex(long aIndex, optional long aCancelContentJSEpoch, optional boolean aUserActivation = false); + undefined reload(unsigned long aReloadFlags); + undefined stop(unsigned long aStopFlags); + + readonly attribute nsISHistory? sessionHistory; + + readonly attribute MediaController? mediaController; + + undefined resetScalingZoom(); + + // The current URI loaded in this BrowsingContext according to nsDocShell. + // This may not match the current window global's document URI in some cases. + readonly attribute URI? currentURI; + + undefined clearRestoreState(); + + // Force this browsing context, which must correspond to an app window, to + // be active regardless of the window being minimized or fully occluded. + [SetterThrows] attribute boolean forceAppWindowActive; + + /** + * This allows chrome to override the default choice of whether touch events + * are available in a specific BrowsingContext and its descendents. + */ + [SetterThrows] inherit attribute TouchEventsOverride touchEventsOverride; + + /** + * Set to true to configure the top-level BrowsingContext to default-target + * user-initiated link clicks to _blank. + */ + [SetterThrows] inherit attribute boolean targetTopLevelLinkClicksToBlank; + + /** + * Set the cross-group opener of this BrowsingContext. This is used to + * retarget the download dialog to an opener window, and close this + * BrowsingContext, if the first load in a newly created BrowsingContext is a + * download. + * + * This value will be automatically set for documents created using + * `window.open`. + */ + [Throws] + undefined setCrossGroupOpener(CanonicalBrowsingContext crossGroupOpener); + + readonly attribute boolean isReplaced; + + + /** + * Notify APZ to start autoscrolling. + * + * (aAnchorX, aAnchorY) are the coordinates of the autoscroll anchor, in + * device coordinates relative to the screen. + * aScrollId and aPresShellId identify the scroll frame that content chose to + * scroll. + * + * Returns whether we were successfully able to notify APZ. + * If this function returns true, APZ (which may live in another process) may + * still reject the autoscroll, but it's then APZ's responsibility to notify + * content via an "autoscroll-rejected-by-apz" message. + */ + boolean startApzAutoscroll(float aAnchorX, float aAnchorY, + unsigned long long aScrollId, + unsigned long aPresShellId); + + /** + * Notify APZ to stop autoscrolling. + */ + undefined stopApzAutoscroll(unsigned long long aScrollId, + unsigned long aPresShellId); +}; + +[Exposed=Window, ChromeOnly] +interface BrowsingContextGroup { + sequence getToplevels(); + + readonly attribute unsigned long long id; +}; diff --git a/dom/chrome-webidl/ChannelWrapper.webidl b/dom/chrome-webidl/ChannelWrapper.webidl new file mode 100644 index 0000000000..b932e79c76 --- /dev/null +++ b/dom/chrome-webidl/ChannelWrapper.webidl @@ -0,0 +1,578 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +interface LoadInfo; +interface MozChannel; +interface RemoteTab; +interface URI; +interface nsISupports; + +/** + * Load types that correspond to the external types in nsIContentPolicy.idl. + * Please also update that IDL when updating this list. + */ +enum MozContentPolicyType { + "main_frame", + "sub_frame", + "stylesheet", + "script", + "image", + "object", + "object_subrequest", + "xmlhttprequest", + "fetch", + "xslt", + "ping", + "beacon", + "xml_dtd", + "font", + "media", + "websocket", + "csp_report", + "imageset", + "web_manifest", + "speculative", + "other" +}; + +/** + * String versions of CLASSIFIED_* tracking flags from nsIClassifiedChannel.idl + */ +enum MozUrlClassificationFlags { + "fingerprinting", + "fingerprinting_content", + "cryptomining", + "cryptomining_content", + "emailtracking", + "emailtracking_content", + "tracking", + "tracking_ad", + "tracking_analytics", + "tracking_social", + "tracking_content", + "socialtracking", + "socialtracking_facebook", + "socialtracking_linkedin", + "socialtracking_twitter", + "any_basic_tracking", + "any_strict_tracking", + "any_social_tracking" +}; + +/** + * A thin wrapper around nsIChannel and nsIHttpChannel that allows JS + * callers to access them without XPConnect overhead. + */ +[ChromeOnly, Exposed=Window] +interface ChannelWrapper : EventTarget { + /** + * Returns the wrapper instance for the given channel. The same wrapper is + * always returned for a given channel. + */ + static ChannelWrapper get(MozChannel channel); + + /** + * Returns the wrapper instance for the given channel. The same wrapper is + * always returned for a given channel. + */ + static ChannelWrapper? getRegisteredChannel(unsigned long long aChannelId, + WebExtensionPolicy extension, + RemoteTab? remoteTab); + + /** + * A unique ID for for the requests which remains constant throughout the + * redirect chain. + */ + [Constant, StoreInSlot] + readonly attribute unsigned long long id; + + // Not technically pure, since it's backed by a weak reference, but if JS + // has a reference to the previous value, we can depend on it not being + // collected. + [Pure] + attribute MozChannel? channel; + + + /** + * Cancels the request with the given nsresult status code. + * + * The optional reason parameter should be one of the BLOCKING_REASON + * constants from nsILoadInfo.idl + */ + [Throws] + undefined cancel(unsigned long result, optional unsigned long reason = 0); + + /** + * Redirects the wrapped HTTP channel to the given URI. For other channel + * types, this method will throw. The redirect is an internal redirect, and + * the behavior is the same as nsIHttpChannel.redirectTo. + */ + [Throws] + undefined redirectTo(URI url); + + /** + * Requests an upgrade of the HTTP channel to a secure request. For other channel + * types, this method will throw. The redirect is an internal redirect, and + * the behavior is the same as nsIHttpChannel.upgradeToSecure. Setting this + * flag is only effective during the WebRequest.onBeforeRequest in + * Web Extensions, calling this at any other point during the request will + * have no effect. Setting this flag in addition to calling redirectTo + * results in the redirect happening rather than the upgrade request. + */ + [Throws] + undefined upgradeToSecure(); + + /** + * Suspends the underlying channel. The profilerText parameter is only used + * to annotate profiles. + */ + [Throws] + undefined suspend(ByteString profileMarkerText); + + /** + * Resumes (un-suspends) the underlying channel. + */ + [Throws] + undefined resume(); + + /** + * The content type of the request, usually as read from the Content-Type + * header. This should be used in preference to the header to determine the + * content type of the channel. + */ + [Pure] + attribute ByteString contentType; + + + /** + * For HTTP requests, the request method (e.g., GET, POST, HEAD). For other + * request types, returns an empty string. + */ + [Cached, Pure] + readonly attribute ByteString method; + + /** + * For requests with LoadInfo, the content policy type that corresponds to + * the request. For requests without LoadInfo, returns "other". + */ + [Cached, Pure] + readonly attribute MozContentPolicyType type; + + + /** + * When true, the request is currently suspended by the wrapper. When false, + * the request is not suspended by the wrapper, but may still be suspended + * by another caller. + */ + [Pure] + readonly attribute boolean suspended; + + + /** + * The final URI of the channel (as returned by NS_GetFinalChannelURI) after + * any redirects have been processed. + */ + [Cached, Pure] + readonly attribute URI finalURI; + + /** + * The string version of finalURI (but cheaper to access than + * finalURI.spec). + */ + [Cached, Pure] + readonly attribute DOMString finalURL; + + + /** + * Returns true if the request matches the given request filter, and the + * given extension has permission to access it. + */ + boolean matches(optional MozRequestFilter filter = {}, + optional WebExtensionPolicy? extension = null, + optional MozRequestMatchOptions options = {}); + + + /** + * Register's this channel as traceable by the given add-on when accessed + * via the process of the given RemoteTab. + */ + undefined registerTraceableChannel(WebExtensionPolicy extension, RemoteTab? remoteTab); + + /** + * The current HTTP status code of the request. This will be 0 if a response + * has not yet been received, or if the request is not an HTTP request. + */ + [Cached, Pure] + readonly attribute unsigned long statusCode; + + /** + * The HTTP status line for the request (e.g., "HTTP/1.0 200 Success"). This + * will be an empty string if a response has not yet been received, or if + * the request is not an HTTP request. + */ + [Cached, Pure] + readonly attribute ByteString statusLine; + + + /** + * If the request has failed or been canceled, an opaque string representing + * the error. For requests that failed at the NSS layer, this is an NSS + * error message. For requests that failed for any other reason, it is the + * name of an nsresult error code. For requests which haven't failed, this + * is null. + * + * This string is used in the error message when notifying extension + * webRequest listeners of failure. The documentation specifically states + * that this value MUST NOT be parsed, and is only meant to be displayed to + * humans, but we all know how that works in real life. + */ + [Cached, Pure] + readonly attribute DOMString? errorString; + + /** + * Dispatched when the channel is closed with an error status. Check + * errorString for the error details. + */ + attribute EventHandler onerror; + + /** + * Checks the request's current status and dispatches an error event if the + * request has failed and one has not already been dispatched. + */ + undefined errorCheck(); + + + /** + * Dispatched when the channel begins receiving data. + */ + attribute EventHandler onstart; + + /** + * Dispatched when the channel has finished receiving data. + */ + attribute EventHandler onstop; + + + /** + * Information about the proxy server which is handling this request, or + * null if the request is not proxied. + */ + [Cached, Frozen, GetterThrows, Pure] + readonly attribute MozProxyInfo? proxyInfo; + + /** + * For HTTP requests, the IP address of the remote server handling the + * request. For other request types, returns null. + */ + [Cached, Pure] + readonly attribute ByteString? remoteAddress; + + + /** + * The LoadInfo object for this channel, if available. Null for channels + * without load info, until support for those is removed. + */ + [Cached, Pure] + readonly attribute LoadInfo? loadInfo; + + /** + * True if this load for a service worker script (either a main script or import scripts). + */ + [Cached, Pure] + readonly attribute boolean isServiceWorkerScript; + + /** + * True if this load was triggered by a system caller. This currently always + * false if the request has no LoadInfo or is a top-level document load. + */ + [Cached, Pure] + readonly attribute boolean isSystemLoad; + + /** + * The URL of the principal that triggered this load. This is equivalent to + * the LoadInfo's triggeringPrincipal, and will only ever be null for + * requests without LoadInfo. + */ + [Cached, Pure] + readonly attribute ByteString? originURL; + + /** + * The URL of the document loading the content for this request. This is + * equivalent to the LoadInfo's loadingPrincipal. This may only ever be null + * for top-level requests and requests without LoadInfo. + */ + [Cached, Pure] + readonly attribute ByteString? documentURL; + + /** + * The URI version of originURL. Will be null only when originURL is null. + */ + [Pure] + readonly attribute URI? originURI; + + /** + * The URI version of documentURL. Will be null only when documentURL is + * null. + */ + [Pure] + readonly attribute URI? documentURI; + + + /** + * True if extensions may modify this request. This is currently false only + * if the request belongs to a document which has access to the + * mozAddonManager API. + */ + [Cached, GetterThrows, Pure] + readonly attribute boolean canModify; + + + /** + * The BrowsingContext ID of the frame that the request belongs to, or 0 if it + * is a top-level load or does not belong to a document. + */ + [Cached, Constant] + readonly attribute long long frameId; + + /** + * The BrowsingContext ID of the parent frame of the window that the request + * belongs to, 0 if that parent frame is the top-level frame, and -1 if the + * request belongs to a top-level frame. + */ + [Cached, Constant] + readonly attribute long long parentFrameId; + + /** + * For cross-process requests, the or