add firefox extension template

This commit is contained in:
2025-08-07 16:03:16 -05:00
parent 6cbb29fed1
commit 5df289ffcb
586 changed files with 13636 additions and 0 deletions

View File

@@ -0,0 +1,59 @@
package webextension_polyfill;
typedef Browser = {
var activityLog : webextension_polyfill.activitylog.Static;
var alarms : webextension_polyfill.alarms.Static;
var bookmarks : webextension_polyfill.bookmarks.Static;
var action : webextension_polyfill.action.Static;
var browserAction : webextension_polyfill.browseraction.Static;
var browserSettings : webextension_polyfill.browsersettings.Static;
var browsingData : webextension_polyfill.browsingdata.Static;
var captivePortal : webextension_polyfill.captiveportal.Static;
var clipboard : webextension_polyfill.clipboard.Static;
var commands : webextension_polyfill.commands.Static;
var contentScripts : webextension_polyfill.contentscripts.Static;
var contextualIdentities : webextension_polyfill.contextualidentities.Static;
var cookies : webextension_polyfill.cookies.Static;
var declarativeNetRequest : webextension_polyfill.declarativenetrequest.Static;
var devtools : webextension_polyfill.devtools.Static;
var dns : webextension_polyfill.dns.Static;
var downloads : webextension_polyfill.downloads.Static;
var events : webextension_polyfill.events.Static;
var experiments : webextension_polyfill.experiments.Static;
var extension : webextension_polyfill.extension.Static;
var extensionTypes : webextension_polyfill.extensiontypes.Static;
var find : webextension_polyfill.find.Static;
var geckoProfiler : webextension_polyfill.geckoprofiler.Static;
var history : webextension_polyfill.history.Static;
var i18n : webextension_polyfill.i18n.Static;
var identity : webextension_polyfill.identity.Static;
var idle : webextension_polyfill.idle.Static;
var management : webextension_polyfill.management.Static;
var manifest : webextension_polyfill.manifest.Static;
var contextMenus : webextension_polyfill.contextmenus.Static;
var menus : webextension_polyfill.menus.Static;
var networkStatus : webextension_polyfill.networkstatus.Static;
var normandyAddonStudy : webextension_polyfill.normandyaddonstudy.Static;
var notifications : webextension_polyfill.notifications.Static;
var omnibox : webextension_polyfill.omnibox.Static;
var pageAction : webextension_polyfill.pageaction.Static;
var permissions : webextension_polyfill.permissions.Static;
var pkcs11 : webextension_polyfill.pkcs11.Static;
var privacy : webextension_polyfill.privacy.Static;
var proxy : webextension_polyfill.proxy.Static;
var runtime : webextension_polyfill.runtime.Static;
var scripting : webextension_polyfill.scripting.Static;
var search : webextension_polyfill.search.Static;
var sessions : webextension_polyfill.sessions.Static;
var sidebarAction : webextension_polyfill.sidebaraction.Static;
var storage : webextension_polyfill.storage.Static;
var tabs : webextension_polyfill.tabs.Static;
var theme : webextension_polyfill.theme.Static;
var topSites : webextension_polyfill.topsites.Static;
var types : webextension_polyfill.types.Static;
var urlbar : webextension_polyfill.urlbar.Static;
var userScripts : webextension_polyfill.userscripts.Static;
var webNavigation : webextension_polyfill.webnavigation.Static;
var webRequest : webextension_polyfill.webrequest.Static;
var windows : webextension_polyfill.windows.Static;
};

View File

@@ -0,0 +1,3 @@
package webextension_polyfill.action;
typedef ColorArray = ts.Tuple4<Float, Float, Float, Float>;

View File

@@ -0,0 +1,8 @@
package webextension_polyfill.action;
/**
An array of four integers in the range [0,255] that make up the RGBA color of the badge. For example,
opaque red is <code>[255, 0, 0, 255]</code>. Can also be a string with a CSS value, with opaque red being <code>
#FF0000</code> or <code>#F00</code>.
**/
typedef ColorValue = Null<ts.AnyOf2<String, ColorArray>>;

View File

@@ -0,0 +1,23 @@
package webextension_polyfill.action;
/**
Specifies to which tab or window the value should be set, or from which one it should be retrieved.
If no tab nor window is specified, the global value is set or retrieved.
**/
typedef Details = {
/**
When setting a value, it will be specific to the specified tab, and will automatically reset when the tab navigates.
When getting, specifies the tab to get the value from; if there is no tab-specific value,
the window one will be inherited.
Optional.
**/
@:optional
var tabId : Float;
/**
When setting a value, it will be specific to the specified window. When getting, specifies the window to get the value
from; if there is no window-specific value, the global one will be inherited.
Optional.
**/
@:optional
var windowId : Float;
};

View File

@@ -0,0 +1,14 @@
package webextension_polyfill.action;
/**
The collection of user-specified settings relating to an extension's action.
**/
typedef GetUserSettingsCallbackUserSettingsType = {
/**
Whether the extension's action icon is visible on browser windows' top-level toolbar (i.e.,
whether the extension has been 'pinned' by the user).
Optional.
**/
@:optional
var isOnToolbar : Bool;
};

View File

@@ -0,0 +1,19 @@
package webextension_polyfill.action;
/**
Pixel data for an image. Must be an ImageData object (for example, from a <code>canvas</code> element).
**/
typedef ImageDataType = {
/**
Returns the one-dimensional array containing the data in RGBA order, as integers in the range 0 to 255.
**/
final data : js.lib.Uint8ClampedArray;
/**
Returns the actual dimensions of the data in the ImageData object, in pixels.
**/
final height : Float;
/**
Returns the actual dimensions of the data in the ImageData object, in pixels.
**/
final width : Float;
};

View File

@@ -0,0 +1,17 @@
package webextension_polyfill.action;
/**
Information sent when a browser action is clicked.
**/
typedef OnClickData = {
/**
An array of keyboard modifiers that were held while the menu item was clicked.
**/
var modifiers : Array<OnClickDataModifiersItemEnum>;
/**
An integer value of button by which menu item was clicked.
Optional.
**/
@:optional
var button : Float;
};

View File

@@ -0,0 +1,3 @@
package webextension_polyfill.action;
typedef OnClickDataModifiersItemEnum = String;

View File

@@ -0,0 +1,13 @@
package webextension_polyfill.action;
/**
An object with information about the popup to open.
**/
typedef OpenPopupOptionsType = {
/**
Defaults to the $(topic:current-window)[current window].
Optional.
**/
@:optional
var windowId : Float;
};

View File

@@ -0,0 +1,20 @@
package webextension_polyfill.action;
typedef SetBadgeBackgroundColorDetailsType = {
var color : ColorValue;
/**
When setting a value, it will be specific to the specified tab, and will automatically reset when the tab navigates.
When getting, specifies the tab to get the value from; if there is no tab-specific value,
the window one will be inherited.
Optional.
**/
@:optional
var tabId : Float;
/**
When setting a value, it will be specific to the specified window. When getting, specifies the window to get the value
from; if there is no window-specific value, the global one will be inherited.
Optional.
**/
@:optional
var windowId : Float;
};

View File

@@ -0,0 +1,20 @@
package webextension_polyfill.action;
typedef SetBadgeTextColorDetailsType = {
var color : ColorValue;
/**
When setting a value, it will be specific to the specified tab, and will automatically reset when the tab navigates.
When getting, specifies the tab to get the value from; if there is no tab-specific value,
the window one will be inherited.
Optional.
**/
@:optional
var tabId : Float;
/**
When setting a value, it will be specific to the specified window. When getting, specifies the window to get the value
from; if there is no window-specific value, the global one will be inherited.
Optional.
**/
@:optional
var windowId : Float;
};

View File

@@ -0,0 +1,23 @@
package webextension_polyfill.action;
typedef SetBadgeTextDetailsType = {
/**
Any number of characters can be passed, but only about four can fit in the space.
**/
var text : Null<String>;
/**
When setting a value, it will be specific to the specified tab, and will automatically reset when the tab navigates.
When getting, specifies the tab to get the value from; if there is no tab-specific value,
the window one will be inherited.
Optional.
**/
@:optional
var tabId : Float;
/**
When setting a value, it will be specific to the specified window. When getting, specifies the window to get the value
from; if there is no window-specific value, the global one will be inherited.
Optional.
**/
@:optional
var windowId : Float;
};

View File

@@ -0,0 +1,40 @@
package webextension_polyfill.action;
typedef SetIconDetailsType = {
/**
Either an ImageData object or a dictionary {size -> ImageData} representing icon to be set.
If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density.
If the number of image pixels that fit into one screen space unit equals <code>scale</code>, then image with size <code>
scale</code> * 19 will be selected. Initially only scales 1 and 2 will be supported.
At least one image must be specified. Note that 'details.imageData = foo' is equivalent to 'details.
imageData = {'19': foo}'
Optional.
**/
@:optional
var imageData : ts.AnyOf2<ImageDataType, haxe.DynamicAccess<ImageDataType>>;
/**
Either a relative image path or a dictionary {size -> relative image path} pointing to icon to be set.
If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density.
If the number of image pixels that fit into one screen space unit equals <code>scale</code>, then image with size <code>
scale</code> * 19 will be selected. Initially only scales 1 and 2 will be supported.
At least one image must be specified. Note that 'details.path = foo' is equivalent to 'details.imageData = {'19': foo}'
Optional.
**/
@:optional
var path : ts.AnyOf2<String, haxe.DynamicAccess<String>>;
/**
When setting a value, it will be specific to the specified tab, and will automatically reset when the tab navigates.
When getting, specifies the tab to get the value from; if there is no tab-specific value,
the window one will be inherited.
Optional.
**/
@:optional
var tabId : Float;
/**
When setting a value, it will be specific to the specified window. When getting, specifies the window to get the value
from; if there is no window-specific value, the global one will be inherited.
Optional.
**/
@:optional
var windowId : Float;
};

View File

@@ -0,0 +1,23 @@
package webextension_polyfill.action;
typedef SetPopupDetailsType = {
/**
The html file to show in a popup. If set to the empty string (''), no popup is shown.
**/
var popup : Null<String>;
/**
When setting a value, it will be specific to the specified tab, and will automatically reset when the tab navigates.
When getting, specifies the tab to get the value from; if there is no tab-specific value,
the window one will be inherited.
Optional.
**/
@:optional
var tabId : Float;
/**
When setting a value, it will be specific to the specified window. When getting, specifies the window to get the value
from; if there is no window-specific value, the global one will be inherited.
Optional.
**/
@:optional
var windowId : Float;
};

View File

@@ -0,0 +1,23 @@
package webextension_polyfill.action;
typedef SetTitleDetailsType = {
/**
The string the browser action should display when moused over.
**/
var title : Null<String>;
/**
When setting a value, it will be specific to the specified tab, and will automatically reset when the tab navigates.
When getting, specifies the tab to get the value from; if there is no tab-specific value,
the window one will be inherited.
Optional.
**/
@:optional
var tabId : Float;
/**
When setting a value, it will be specific to the specified window. When getting, specifies the window to get the value
from; if there is no window-specific value, the global one will be inherited.
Optional.
**/
@:optional
var windowId : Float;
};

View File

@@ -0,0 +1,75 @@
package webextension_polyfill.action;
typedef Static = {
/**
Sets the title of the browser action. This shows up in the tooltip.
**/
function setTitle(details:SetTitleDetailsType):js.lib.Promise<ts.Undefined>;
/**
Gets the title of the browser action.
**/
function getTitle(details:Details):js.lib.Promise<String>;
/**
Returns the user-specified settings relating to an extension's action.
**/
function getUserSettings():js.lib.Promise<GetUserSettingsCallbackUserSettingsType>;
/**
Sets the icon for the browser action. The icon can be specified either as the path to an image file or as the pixel data
from a canvas element, or as dictionary of either one of those. Either the <b>path</b> or the <b>imageData</b>
property must be specified.
**/
function setIcon(details:SetIconDetailsType):js.lib.Promise<ts.Undefined>;
/**
Sets the html document to be opened as a popup when the user clicks on the browser action's icon.
**/
function setPopup(details:SetPopupDetailsType):js.lib.Promise<ts.Undefined>;
/**
Gets the html document set as the popup for this browser action.
**/
function getPopup(details:Details):js.lib.Promise<String>;
/**
Sets the badge text for the browser action. The badge is displayed on top of the icon.
**/
function setBadgeText(details:SetBadgeTextDetailsType):js.lib.Promise<ts.Undefined>;
/**
Gets the badge text of the browser action. If no tab nor window is specified is specified,
the global badge text is returned.
**/
function getBadgeText(details:Details):js.lib.Promise<String>;
/**
Sets the background color for the badge.
**/
function setBadgeBackgroundColor(details:SetBadgeBackgroundColorDetailsType):js.lib.Promise<ts.Undefined>;
/**
Gets the background color of the browser action badge.
**/
function getBadgeBackgroundColor(details:Details):js.lib.Promise<ColorArray>;
/**
Sets the text color for the badge.
**/
function setBadgeTextColor(details:SetBadgeTextColorDetailsType):Void;
/**
Gets the text color of the browser action badge.
**/
function getBadgeTextColor(details:Details):Void;
/**
Enables the browser action for a tab. By default, browser actions are enabled.
**/
function enable(?tabId:Float):js.lib.Promise<ts.Undefined>;
/**
Disables the browser action for a tab.
**/
function disable(?tabId:Float):js.lib.Promise<ts.Undefined>;
/**
Checks whether the browser action is enabled.
**/
function isEnabled(details:Details):js.lib.Promise<Bool>;
/**
Opens the extension popup window in the specified window.
**/
function openPopup(?options:OpenPopupOptionsType):js.lib.Promise<ts.Undefined>;
/**
Fired when a browser action icon is clicked. This event will not fire if the browser action has a popup.
**/
var onClicked : webextension_polyfill.events.Event<(tab:webextension_polyfill.tabs.Tab, info:Null<OnClickData>) -> Void>;
};

View File

@@ -0,0 +1,24 @@
package webextension_polyfill.activitylog;
typedef OnExtensionActivityDetailsType = {
/**
The date string when this call is triggered.
**/
var timeStamp : webextension_polyfill.extensiontypes.DateType;
/**
The type of log entry. api_call is a function call made by the extension and api_event is an event callback to the
extension. content_script is logged when a content script is injected.
**/
var type : OnExtensionActivityDetailsTypeTypeEnum;
/**
The type of view where the activity occurred. Content scripts will not have a viewType.
Optional.
**/
@:optional
var viewType : OnExtensionActivityDetailsTypeViewTypeEnum;
/**
The name of the api call or event, or the script url if this is a content or user script event.
**/
var name : String;
var data : OnExtensionActivityDetailsTypeDataType;
};

View File

@@ -0,0 +1,6 @@
package webextension_polyfill.activitylog;
/**
The result of the call.
**/
typedef OnExtensionActivityDetailsTypeDataResultType = { };

View File

@@ -0,0 +1,28 @@
package webextension_polyfill.activitylog;
typedef OnExtensionActivityDetailsTypeDataType = {
/**
A list of arguments passed to the call.
Optional.
**/
@:optional
var args : Array<Dynamic>;
/**
The result of the call.
Optional.
**/
@:optional
var result : OnExtensionActivityDetailsTypeDataResultType;
/**
The tab associated with this event if it is a tab or content script.
Optional.
**/
@:optional
var tabId : Float;
/**
If the type is content_script, this is the url of the script that was injected.
Optional.
**/
@:optional
var url : String;
};

View File

@@ -0,0 +1,7 @@
package webextension_polyfill.activitylog;
/**
The type of log entry. api_call is a function call made by the extension and api_event is an event callback to the
extension. content_script is logged when a content script is injected.
**/
typedef OnExtensionActivityDetailsTypeTypeEnum = String;

View File

@@ -0,0 +1,6 @@
package webextension_polyfill.activitylog;
/**
The type of view where the activity occurred. Content scripts will not have a viewType.
**/
typedef OnExtensionActivityDetailsTypeViewTypeEnum = String;

View File

@@ -0,0 +1,17 @@
package webextension_polyfill.activitylog;
/**
Receives an activityItem for each logging event.
**/
typedef OnExtensionActivityEvent = {
/**
Registers an event listener <em>callback</em> to an event.
**/
function addListener(callback:(details:OnExtensionActivityDetailsType) -> Void, id:String):Void;
/**
Deregisters an event listener <em>callback</em> from an event.
**/
function removeListener(callback:(details:OnExtensionActivityDetailsType) -> Void):Void;
function hasListener(callback:(details:OnExtensionActivityDetailsType) -> Void):Bool;
function hasListeners():Bool;
};

View File

@@ -0,0 +1,8 @@
package webextension_polyfill.activitylog;
typedef Static = {
/**
Receives an activityItem for each logging event.
**/
var onExtensionActivity : OnExtensionActivityEvent;
};

View File

@@ -0,0 +1,18 @@
package webextension_polyfill.alarms;
typedef Alarm = {
/**
Name of this alarm.
**/
var name : String;
/**
Time when the alarm is scheduled to fire, in milliseconds past the epoch.
**/
var scheduledTime : Float;
/**
When present, signals that the alarm triggers periodically after so many minutes.
Optional.
**/
@:optional
var periodInMinutes : Float;
};

View File

@@ -0,0 +1,29 @@
package webextension_polyfill.alarms;
/**
Details about the alarm. The alarm first fires either at 'when' milliseconds past the epoch (if 'when' is provided),
after 'delayInMinutes' minutes from the current time (if 'delayInMinutes' is provided instead),
or after 'periodInMinutes' minutes from the current time (if only 'periodInMinutes' is provided).
Users should never provide both 'when' and 'delayInMinutes'. If 'periodInMinutes' is provided,
then the alarm recurs repeatedly after that many minutes.
**/
typedef CreateAlarmInfoType = {
/**
Time when the alarm is scheduled to first fire, in milliseconds past the epoch.
Optional.
**/
@:optional
var when : Float;
/**
Number of minutes from the current time after which the alarm should first fire.
Optional.
**/
@:optional
var delayInMinutes : Float;
/**
Number of minutes after which the alarm should recur repeatedly.
Optional.
**/
@:optional
var periodInMinutes : Float;
};

View File

@@ -0,0 +1,33 @@
package webextension_polyfill.alarms;
typedef Static = {
/**
Creates an alarm. After the delay is expired, the onAlarm event is fired. If there is another alarm with the same name
(or no name if none is specified), it will be cancelled and replaced by this alarm.
Creates an alarm. After the delay is expired, the onAlarm event is fired. If there is another alarm with the same name
(or no name if none is specified), it will be cancelled and replaced by this alarm.
**/
@:overload(function(alarmInfo:CreateAlarmInfoType):Void { })
function create(name:Null<String>, alarmInfo:CreateAlarmInfoType):Void;
/**
Retrieves details about the specified alarm.
**/
function get(?name:String):js.lib.Promise<Null<Alarm>>;
/**
Gets an array of all the alarms.
**/
function getAll():js.lib.Promise<Array<Alarm>>;
/**
Clears the alarm with the given name.
**/
function clear(?name:String):js.lib.Promise<Bool>;
/**
Clears all alarms.
**/
function clearAll():js.lib.Promise<Bool>;
/**
Fired when an alarm has expired. Useful for transient background pages.
**/
var onAlarm : webextension_polyfill.events.Event<(name:Alarm) -> Void>;
};

View File

@@ -0,0 +1,66 @@
package webextension_polyfill.bookmarks;
/**
A node (either a bookmark or a folder) in the bookmark tree. Child nodes are ordered within their parent folder.
**/
typedef BookmarkTreeNode = {
/**
The unique identifier for the node. IDs are unique within the current profile, and they remain valid even after the
browser is restarted.
**/
var id : String;
/**
The <code>id</code> of the parent folder. Omitted for the root node.
Optional.
**/
@:optional
var parentId : String;
/**
The 0-based position of this node within its parent folder.
Optional.
**/
@:optional
var index : Float;
/**
The URL navigated to when a user clicks the bookmark. Omitted for folders.
Optional.
**/
@:optional
var url : String;
/**
The text displayed for the node.
**/
var title : String;
/**
When this node was created, in milliseconds since the epoch (<code>new Date(dateAdded)</code>).
Optional.
**/
@:optional
var dateAdded : Float;
/**
When the contents of this folder last changed, in milliseconds since the epoch.
Optional.
**/
@:optional
var dateGroupModified : Float;
/**
Indicates the reason why this node is unmodifiable. The <var>managed</var> value indicates that this node was configured
by the system administrator or by the custodian of a supervised user. Omitted if the node can be modified by the user
and the extension (default).
Optional.
**/
@:optional
var unmodifiable : String;
/**
Indicates the type of the BookmarkTreeNode, which can be one of bookmark, folder or separator.
Optional.
**/
@:optional
var type : BookmarkTreeNodeType;
/**
An ordered list of children of this node.
Optional.
**/
@:optional
var children : Array<BookmarkTreeNode>;
};

View File

@@ -0,0 +1,6 @@
package webextension_polyfill.bookmarks;
/**
Indicates the type of a BookmarkTreeNode, which can be one of bookmark, folder or separator.
**/
typedef BookmarkTreeNodeType = String;

View File

@@ -0,0 +1,8 @@
package webextension_polyfill.bookmarks;
/**
Indicates the reason why this node is unmodifiable. The <var>managed</var> value indicates that this node was configured
by the system administrator or by the custodian of a supervised user. Omitted if the node can be modified by the user
and the extension (default).
**/
typedef BookmarkTreeNodeUnmodifiable = String;

View File

@@ -0,0 +1,34 @@
package webextension_polyfill.bookmarks;
/**
Object passed to the create() function.
**/
typedef CreateDetails = {
/**
Defaults to the Other Bookmarks folder.
Optional.
**/
@:optional
var parentId : String;
/**
Optional.
**/
@:optional
var index : Float;
/**
Optional.
**/
@:optional
var title : String;
/**
Optional.
**/
@:optional
var url : String;
/**
Indicates the type of BookmarkTreeNode to create, which can be one of bookmark, folder or separator.
Optional.
**/
@:optional
var type : BookmarkTreeNodeType;
};

View File

@@ -0,0 +1,14 @@
package webextension_polyfill.bookmarks;
typedef MoveDestinationType = {
/**
Optional.
**/
@:optional
var parentId : String;
/**
Optional.
**/
@:optional
var index : Float;
};

View File

@@ -0,0 +1,10 @@
package webextension_polyfill.bookmarks;
typedef OnChangedChangeInfoType = {
var title : String;
/**
Optional.
**/
@:optional
var url : String;
};

View File

@@ -0,0 +1,8 @@
package webextension_polyfill.bookmarks;
typedef OnMovedMoveInfoType = {
var parentId : String;
var index : Float;
var oldParentId : String;
var oldIndex : Float;
};

View File

@@ -0,0 +1,7 @@
package webextension_polyfill.bookmarks;
typedef OnRemovedRemoveInfoType = {
var parentId : String;
var index : Float;
var node : BookmarkTreeNode;
};

View File

@@ -0,0 +1,25 @@
package webextension_polyfill.bookmarks;
/**
An object specifying properties and values to match when searching. Produces bookmarks matching all properties.
**/
typedef SearchQueryC2Type = {
/**
A string of words that are matched against bookmark URLs and titles.
Optional.
**/
@:optional
var query : String;
/**
The URL of the bookmark; matches verbatim. Note that folders have no URL.
Optional.
**/
@:optional
var url : String;
/**
The title of the bookmark; matches verbatim.
Optional.
**/
@:optional
var title : String;
};

View File

@@ -0,0 +1,67 @@
package webextension_polyfill.bookmarks;
typedef Static = {
/**
Retrieves the specified BookmarkTreeNode(s).
**/
function get(idOrIdList:ts.AnyOf2<String, Array<String>>):js.lib.Promise<Array<BookmarkTreeNode>>;
/**
Retrieves the children of the specified BookmarkTreeNode id.
**/
function getChildren(id:String):js.lib.Promise<Array<BookmarkTreeNode>>;
/**
Retrieves the recently added bookmarks.
**/
function getRecent(numberOfItems:Float):js.lib.Promise<Array<BookmarkTreeNode>>;
/**
Retrieves the entire Bookmarks hierarchy.
**/
function getTree():js.lib.Promise<Array<BookmarkTreeNode>>;
/**
Retrieves part of the Bookmarks hierarchy, starting at the specified node.
**/
function getSubTree(id:String):js.lib.Promise<Array<BookmarkTreeNode>>;
/**
Searches for BookmarkTreeNodes matching the given query. Queries specified with an object produce BookmarkTreeNodes
matching all specified properties.
**/
function search(query:ts.AnyOf2<String, SearchQueryC2Type>):js.lib.Promise<Array<BookmarkTreeNode>>;
/**
Creates a bookmark or folder under the specified parentId. If url is NULL or missing, it will be a folder.
**/
function create(bookmark:CreateDetails):js.lib.Promise<BookmarkTreeNode>;
/**
Moves the specified BookmarkTreeNode to the provided location.
**/
function move(id:String, destination:MoveDestinationType):js.lib.Promise<BookmarkTreeNode>;
/**
Updates the properties of a bookmark or folder. Specify only the properties that you want to change; unspecified
properties will be left unchanged. <b>Note:</b> Currently, only 'title' and 'url' are supported.
**/
function update(id:String, changes:UpdateChangesType):js.lib.Promise<BookmarkTreeNode>;
/**
Removes a bookmark or an empty bookmark folder.
**/
function remove(id:String):js.lib.Promise<ts.Undefined>;
/**
Recursively removes a bookmark folder.
**/
function removeTree(id:String):js.lib.Promise<ts.Undefined>;
/**
Fired when a bookmark or folder is created.
**/
var onCreated : webextension_polyfill.events.Event<(id:String, bookmark:BookmarkTreeNode) -> Void>;
/**
Fired when a bookmark or folder is removed. When a folder is removed recursively,
a single notification is fired for the folder, and none for its contents.
**/
var onRemoved : webextension_polyfill.events.Event<(id:String, removeInfo:OnRemovedRemoveInfoType) -> Void>;
/**
Fired when a bookmark or folder changes. <b>Note:</b> Currently, only title and url changes trigger this.
**/
var onChanged : webextension_polyfill.events.Event<(id:String, changeInfo:OnChangedChangeInfoType) -> Void>;
/**
Fired when a bookmark or folder is moved to a different parent folder.
**/
var onMoved : webextension_polyfill.events.Event<(id:String, moveInfo:OnMovedMoveInfoType) -> Void>;
};

View File

@@ -0,0 +1,14 @@
package webextension_polyfill.bookmarks;
typedef UpdateChangesType = {
/**
Optional.
**/
@:optional
var title : String;
/**
Optional.
**/
@:optional
var url : String;
};

View File

@@ -0,0 +1,75 @@
package webextension_polyfill.browseraction;
typedef Static = {
/**
Sets the title of the browser action. This shows up in the tooltip.
**/
function setTitle(details:webextension_polyfill.action.SetTitleDetailsType):js.lib.Promise<ts.Undefined>;
/**
Gets the title of the browser action.
**/
function getTitle(details:webextension_polyfill.action.Details):js.lib.Promise<String>;
/**
Returns the user-specified settings relating to an extension's action.
**/
function getUserSettings():js.lib.Promise<webextension_polyfill.action.GetUserSettingsCallbackUserSettingsType>;
/**
Sets the icon for the browser action. The icon can be specified either as the path to an image file or as the pixel data
from a canvas element, or as dictionary of either one of those. Either the <b>path</b> or the <b>imageData</b>
property must be specified.
**/
function setIcon(details:webextension_polyfill.action.SetIconDetailsType):js.lib.Promise<ts.Undefined>;
/**
Sets the html document to be opened as a popup when the user clicks on the browser action's icon.
**/
function setPopup(details:webextension_polyfill.action.SetPopupDetailsType):js.lib.Promise<ts.Undefined>;
/**
Gets the html document set as the popup for this browser action.
**/
function getPopup(details:webextension_polyfill.action.Details):js.lib.Promise<String>;
/**
Sets the badge text for the browser action. The badge is displayed on top of the icon.
**/
function setBadgeText(details:webextension_polyfill.action.SetBadgeTextDetailsType):js.lib.Promise<ts.Undefined>;
/**
Gets the badge text of the browser action. If no tab nor window is specified is specified,
the global badge text is returned.
**/
function getBadgeText(details:webextension_polyfill.action.Details):js.lib.Promise<String>;
/**
Sets the background color for the badge.
**/
function setBadgeBackgroundColor(details:webextension_polyfill.action.SetBadgeBackgroundColorDetailsType):js.lib.Promise<ts.Undefined>;
/**
Gets the background color of the browser action badge.
**/
function getBadgeBackgroundColor(details:webextension_polyfill.action.Details):js.lib.Promise<webextension_polyfill.action.ColorArray>;
/**
Sets the text color for the badge.
**/
function setBadgeTextColor(details:webextension_polyfill.action.SetBadgeTextColorDetailsType):Void;
/**
Gets the text color of the browser action badge.
**/
function getBadgeTextColor(details:webextension_polyfill.action.Details):Void;
/**
Enables the browser action for a tab. By default, browser actions are enabled.
**/
function enable(?tabId:Float):js.lib.Promise<ts.Undefined>;
/**
Disables the browser action for a tab.
**/
function disable(?tabId:Float):js.lib.Promise<ts.Undefined>;
/**
Checks whether the browser action is enabled.
**/
function isEnabled(details:webextension_polyfill.action.Details):js.lib.Promise<Bool>;
/**
Opens the extension popup window in the specified window.
**/
function openPopup(?options:webextension_polyfill.action.OpenPopupOptionsType):js.lib.Promise<ts.Undefined>;
/**
Fired when a browser action icon is clicked. This event will not fire if the browser action has a popup.
**/
var onClicked : webextension_polyfill.events.Event<(tab:webextension_polyfill.tabs.Tab, info:Null<webextension_polyfill.action.OnClickData>) -> Void>;
};

View File

@@ -0,0 +1,6 @@
package webextension_polyfill.browsersettings;
/**
Color management mode.
**/
typedef ColorManagementMode = String;

View File

@@ -0,0 +1,6 @@
package webextension_polyfill.browsersettings;
/**
After which mouse event context menus should popup.
**/
typedef ContextMenuMouseEvent = String;

View File

@@ -0,0 +1,6 @@
package webextension_polyfill.browsersettings;
/**
How images should be animated in the browser.
**/
typedef ImageAnimationBehavior = String;

View File

@@ -0,0 +1,78 @@
package webextension_polyfill.browsersettings;
typedef Static = {
/**
Allows or disallows pop-up windows from opening in response to user events.
**/
var allowPopupsForUserEvents : webextension_polyfill.types.Setting;
/**
Enables or disables the browser cache.
**/
var cacheEnabled : webextension_polyfill.types.Setting;
/**
This boolean setting controls whether the selected tab can be closed with a double click.
**/
var closeTabsByDoubleClick : webextension_polyfill.types.Setting;
/**
Controls after which mouse event context menus popup. This setting's value is of type ContextMenuMouseEvent,
which has possible values of <code>mouseup</code> and <code>mousedown</code>.
**/
var contextMenuShowEvent : webextension_polyfill.types.Setting;
/**
Returns the value of the overridden home page. Read-only.
**/
var homepageOverride : webextension_polyfill.types.Setting;
/**
Controls the behaviour of image animation in the browser. This setting's value is of type ImageAnimationBehavior,
defaulting to <code>normal</code>.
**/
var imageAnimationBehavior : webextension_polyfill.types.Setting;
/**
Returns the value of the overridden new tab page. Read-only.
**/
var newTabPageOverride : webextension_polyfill.types.Setting;
/**
Controls where new tabs are opened. `afterCurrent` will open all new tabs next to the current tab,
`relatedAfterCurrent` will open only related tabs next to the current tab, and `atEnd` will open all tabs at the end of
the tab strip. The default is `relatedAfterCurrent`.
**/
var newTabPosition : webextension_polyfill.types.Setting;
/**
This boolean setting controls whether bookmarks are opened in the current tab or in a new tab.
**/
var openBookmarksInNewTabs : webextension_polyfill.types.Setting;
/**
This boolean setting controls whether search results are opened in the current tab or in a new tab.
**/
var openSearchResultsInNewTabs : webextension_polyfill.types.Setting;
/**
This boolean setting controls whether urlbar results are opened in the current tab or in a new tab.
**/
var openUrlbarResultsInNewTabs : webextension_polyfill.types.Setting;
/**
Disables webAPI notifications.
**/
var webNotificationsDisabled : webextension_polyfill.types.Setting;
/**
This setting controls whether the user-chosen colors override the page's colors.
**/
var overrideDocumentColors : webextension_polyfill.types.Setting;
/**
This setting controls whether a light or dark color scheme overrides the page's preferred color scheme.
**/
var overrideContentColorScheme : webextension_polyfill.types.Setting;
/**
This setting controls whether the document's fonts are used.
**/
var useDocumentFonts : webextension_polyfill.types.Setting;
/**
This boolean setting controls whether zoom is applied to the full page or to text only.
**/
var zoomFullPage : webextension_polyfill.types.Setting;
/**
This boolean setting controls whether zoom is applied on a per-site basis or to the current tab only. If privacy.
resistFingerprinting is true, this setting has no effect and zoom is applied to the current tab only.
**/
var zoomSiteSpecific : webextension_polyfill.types.Setting;
var colorManagement : webextension_polyfill.namespaces.browsersettings_colormanagement.browsersettingscolormanagement.Static;
};

View File

@@ -0,0 +1,74 @@
package webextension_polyfill.browsingdata;
/**
A set of data types. Missing data types are interpreted as <code>false</code>.
**/
typedef DataTypeSet = {
/**
The browser's cache. Note: when removing data, this clears the <em>entire</em> cache: it is not limited to the range you
specify.
Optional.
**/
@:optional
var cache : Bool;
/**
The browser's cookies.
Optional.
**/
@:optional
var cookies : Bool;
/**
The browser's download list.
Optional.
**/
@:optional
var downloads : Bool;
/**
The browser's stored form data.
Optional.
**/
@:optional
var formData : Bool;
/**
The browser's history.
Optional.
**/
@:optional
var history : Bool;
/**
Websites' IndexedDB data.
Optional.
**/
@:optional
var indexedDB : Bool;
/**
Websites' local storage data.
Optional.
**/
@:optional
var localStorage : Bool;
/**
Server-bound certificates.
Optional.
**/
@:optional
var serverBoundCertificates : Bool;
/**
Stored passwords.
Optional.
**/
@:optional
var passwords : Bool;
/**
Plugins' data.
Optional.
**/
@:optional
var pluginData : Bool;
/**
Service Workers.
Optional.
**/
@:optional
var serviceWorkers : Bool;
};

View File

@@ -0,0 +1,35 @@
package webextension_polyfill.browsingdata;
/**
Options that determine exactly what data will be removed.
**/
typedef RemovalOptions = {
/**
Remove data accumulated on or after this date, represented in milliseconds since the epoch (accessible via the <code>
getTime</code> method of the JavaScript <code>Date</code> object). If absent, defaults to 0 (which would remove all
browsing data).
Optional.
**/
@:optional
var since : webextension_polyfill.extensiontypes.DateType;
/**
Only remove data associated with these hostnames (only applies to cookies and localStorage).
Optional.
**/
@:optional
var hostnames : Array<String>;
/**
Only remove data associated with this specific cookieStoreId.
Optional.
**/
@:optional
var cookieStoreId : String;
/**
An object whose properties specify which origin types ought to be cleared. If this object isn't specified,
it defaults to clearing only "unprotected" origins. Please ensure that you <em>really</em>
want to remove application data before adding 'protectedWeb' or 'extensions'.
Optional.
**/
@:optional
var originTypes : RemovalOptionsOriginTypesType;
};

View File

@@ -0,0 +1,27 @@
package webextension_polyfill.browsingdata;
/**
An object whose properties specify which origin types ought to be cleared. If this object isn't specified,
it defaults to clearing only "unprotected" origins. Please ensure that you <em>really</em>
want to remove application data before adding 'protectedWeb' or 'extensions'.
**/
typedef RemovalOptionsOriginTypesType = {
/**
Normal websites.
Optional.
**/
@:optional
var unprotectedWeb : Bool;
/**
Websites that have been installed as hosted applications (be careful!).
Optional.
**/
@:optional
var protectedWeb : Bool;
/**
Extensions and packaged applications a user has installed (be _really_ careful!).
Optional.
**/
@:optional
var extension : Bool;
};

View File

@@ -0,0 +1,15 @@
package webextension_polyfill.browsingdata;
typedef SettingsCallbackResultType = {
var options : RemovalOptions;
/**
All of the types will be present in the result, with values of <code>true</code> if they are both selected to be removed
and permitted to be removed, otherwise <code>false</code>.
**/
var dataToRemove : DataTypeSet;
/**
All of the types will be present in the result, with values of <code>true</code> if they are permitted to be removed (e.
g., by enterprise policy) and <code>false</code> if not.
**/
var dataRemovalPermitted : DataTypeSet;
};

View File

@@ -0,0 +1,46 @@
package webextension_polyfill.browsingdata;
typedef Static = {
/**
Reports which types of data are currently selected in the 'Clear browsing data' settings UI.
Note: some of the data types included in this API are not available in the settings UI,
and some UI settings control more than one data type listed here.
**/
function settings():js.lib.Promise<SettingsCallbackResultType>;
/**
Clears various types of browsing data stored in a user's profile.
**/
function remove(options:RemovalOptions, dataToRemove:DataTypeSet):js.lib.Promise<ts.Undefined>;
/**
Clears the browser's cache.
**/
function removeCache(options:RemovalOptions):js.lib.Promise<ts.Undefined>;
/**
Clears the browser's cookies and server-bound certificates modified within a particular timeframe.
**/
function removeCookies(options:RemovalOptions):js.lib.Promise<ts.Undefined>;
/**
Clears the browser's list of downloaded files (<em>not</em> the downloaded files themselves).
**/
function removeDownloads(options:RemovalOptions):js.lib.Promise<ts.Undefined>;
/**
Clears the browser's stored form data (autofill).
**/
function removeFormData(options:RemovalOptions):js.lib.Promise<ts.Undefined>;
/**
Clears the browser's history.
**/
function removeHistory(options:RemovalOptions):js.lib.Promise<ts.Undefined>;
/**
Clears websites' local storage data.
**/
function removeLocalStorage(options:RemovalOptions):js.lib.Promise<ts.Undefined>;
/**
Clears plugins' data.
**/
function removePluginData(options:RemovalOptions):js.lib.Promise<ts.Undefined>;
/**
Clears the browser's stored passwords.
**/
function removePasswords(options:RemovalOptions):js.lib.Promise<ts.Undefined>;
};

View File

@@ -0,0 +1,3 @@
package webextension_polyfill.captiveportal;
typedef OnConnectivityAvailableStatusEnum = String;

View File

@@ -0,0 +1,8 @@
package webextension_polyfill.captiveportal;
typedef OnStateChangedDetailsType = {
/**
The current captive portal state.
**/
var state : OnStateChangedDetailsTypeStateEnum;
};

View File

@@ -0,0 +1,6 @@
package webextension_polyfill.captiveportal;
/**
The current captive portal state.
**/
typedef OnStateChangedDetailsTypeStateEnum = String;

View File

@@ -0,0 +1,26 @@
package webextension_polyfill.captiveportal;
typedef Static = {
/**
Returns the current portal state, one of `unknown`, `not_captive`, `unlocked_portal`, `locked_portal`.
**/
function getState():Void;
/**
Returns the time difference between NOW and the last time a request was completed in milliseconds.
**/
function getLastChecked():Void;
/**
Fired when the captive portal state changes.
**/
var onStateChanged : webextension_polyfill.events.Event<(details:OnStateChangedDetailsType) -> Void>;
/**
This notification will be emitted when the captive portal service has determined that we can connect to the internet.
The service will pass either `captive` if there is an unlocked captive portal present,
or `clear` if no captive portal was detected.
**/
var onConnectivityAvailable : webextension_polyfill.events.Event<(status:OnConnectivityAvailableStatusEnum) -> Void>;
/**
Return the canonical captive-portal detection URL. Read-only.
**/
var canonicalURL : webextension_polyfill.types.Setting;
};

View File

@@ -0,0 +1,6 @@
package webextension_polyfill.clipboard;
/**
The type of imageData.
**/
typedef SetImageDataImageTypeEnum = String;

View File

@@ -0,0 +1,9 @@
package webextension_polyfill.clipboard;
typedef Static = {
/**
Copy an image to the clipboard. The image is re-encoded before it is written to the clipboard. If the image is invalid,
the clipboard is not modified.
**/
function setImageData(imageData:js.lib.ArrayBuffer, imageType:SetImageDataImageTypeEnum):js.lib.Promise<ts.Undefined>;
};

View File

@@ -0,0 +1,22 @@
package webextension_polyfill.commands;
typedef Command = {
/**
The name of the Extension Command
Optional.
**/
@:optional
var name : String;
/**
The Extension Command description
Optional.
**/
@:optional
var description : String;
/**
The shortcut active for this command, or blank if not active.
Optional.
**/
@:optional
var shortcut : String;
};

View File

@@ -0,0 +1,16 @@
package webextension_polyfill.commands;
typedef OnChangedChangeInfoType = {
/**
The name of the shortcut.
**/
var name : String;
/**
The new shortcut active for this command, or blank if not active.
**/
var newShortcut : String;
/**
The old shortcut which is no longer active for this command, or blank if the shortcut was previously inactive.
**/
var oldShortcut : String;
};

View File

@@ -0,0 +1,24 @@
package webextension_polyfill.commands;
typedef Static = {
/**
Update the details of an already defined command.
**/
function update(detail:UpdateDetailType):js.lib.Promise<ts.Undefined>;
/**
Reset a command's details to what is specified in the manifest.
**/
function reset(name:String):js.lib.Promise<ts.Undefined>;
/**
Returns all the registered extension commands for this extension and their shortcut (if active).
**/
function getAll():js.lib.Promise<Array<Command>>;
/**
Fired when a registered command is activated using a keyboard shortcut.
**/
var onCommand : webextension_polyfill.events.Event<(command:String, tab:Null<webextension_polyfill.tabs.Tab>) -> Void>;
/**
Fired when a registered command's shortcut is changed.
**/
var onChanged : webextension_polyfill.events.Event<(changeInfo:OnChangedChangeInfoType) -> Void>;
};

View File

@@ -0,0 +1,22 @@
package webextension_polyfill.commands;
/**
The new description for the command.
**/
typedef UpdateDetailType = {
/**
The name of the command.
**/
var name : String;
/**
The new description for the command.
Optional.
**/
@:optional
var description : String;
/**
Optional.
**/
@:optional
var shortcut : String;
};

View File

@@ -0,0 +1,11 @@
package webextension_polyfill.contentscripts;
/**
An object that represents a content script registered programmatically
**/
typedef RegisteredContentScript = {
/**
Unregister a content script registered programmatically
**/
function unregister():js.lib.Promise<ts.Undefined>;
};

View File

@@ -0,0 +1,61 @@
package webextension_polyfill.contentscripts;
/**
Details of a content script registered programmatically
**/
typedef RegisteredContentScriptOptions = {
var matches : Array<String>;
/**
Optional.
**/
@:optional
var excludeMatches : Array<String>;
/**
Optional.
**/
@:optional
var includeGlobs : Array<String>;
/**
Optional.
**/
@:optional
var excludeGlobs : Array<String>;
/**
The list of CSS files to inject
Optional.
**/
@:optional
var css : Array<webextension_polyfill.extensiontypes.ExtensionFileOrCode>;
/**
The list of JS files to inject
Optional.
**/
@:optional
var js : Array<webextension_polyfill.extensiontypes.ExtensionFileOrCode>;
/**
If allFrames is <code>true</code>, implies that the JavaScript or CSS should be injected into all frames of current page.
By default, it's <code>false</code> and is only injected into the top frame.
Optional.
**/
@:optional
var allFrames : Bool;
/**
If matchAboutBlank is true, then the code is also injected in about:blank and about:srcdoc frames if your extension has
access to its parent document. Code cannot be inserted in top-level about:-frames. By default it is <code>false</code>.
Optional.
**/
@:optional
var matchAboutBlank : Bool;
/**
The soonest that the JavaScript or CSS will be injected into the tab. Defaults to "document_idle".
Optional.
**/
@:optional
var runAt : webextension_polyfill.extensiontypes.RunAt;
/**
limit the set of matched tabs to those that belong to the given cookie store id
Optional.
**/
@:optional
var cookieStoreId : ts.AnyOf2<String, Array<String>>;
};

View File

@@ -0,0 +1,8 @@
package webextension_polyfill.contentscripts;
typedef Static = {
/**
Register a content script programmatically
**/
function register(contentScriptOptions:RegisteredContentScriptOptions):js.lib.Promise<RegisteredContentScript>;
};

View File

@@ -0,0 +1,54 @@
package webextension_polyfill.contextmenus;
typedef Static = {
/**
Creates a new context menu item. Note that if an error occurs during creation, you may not find out until the creation
callback fires (the details will be in $(ref:runtime.lastError)).
**/
function create(createProperties:webextension_polyfill.menus.CreateCreatePropertiesType, ?callback:() -> Void):ts.AnyOf2<String, Float>;
/**
Updates a previously created context menu item.
**/
function update(id:ts.AnyOf2<String, Float>, updateProperties:webextension_polyfill.menus.UpdateUpdatePropertiesType):js.lib.Promise<ts.Undefined>;
/**
Removes a context menu item.
**/
function remove(menuItemId:ts.AnyOf2<String, Float>):js.lib.Promise<ts.Undefined>;
/**
Removes all context menu items added by this extension.
**/
function removeAll():js.lib.Promise<ts.Undefined>;
/**
Show the matching menu items from this extension instead of the default menu. This should be called during a
'contextmenu' DOM event handler, and only applies to the menu that opens after this event.
**/
function overrideContext(contextOptions:webextension_polyfill.menus.OverrideContextContextOptionsType):Void;
/**
Updates the extension items in the shown menu, including changes that have been made since the menu was shown.
Has no effect if the menu is hidden. Rebuilding a shown menu is an expensive operation,
only invoke this method when necessary.
**/
function refresh():js.lib.Promise<ts.Undefined>;
/**
Retrieve the element that was associated with a recent contextmenu event.
**/
function getTargetElement(targetElementId:Float):js.html.DOMElement;
/**
Fired when a context menu item is clicked.
**/
var onClicked : webextension_polyfill.events.Event<(info:webextension_polyfill.menus.OnClickData, tab:Null<webextension_polyfill.tabs.Tab>) -> Void>;
/**
Fired when a menu is shown. The extension can add, modify or remove menu items and call menus.refresh()
to update the menu.
**/
var onShown : webextension_polyfill.events.Event<(info:webextension_polyfill.menus.OnShownInfoType, tab:webextension_polyfill.tabs.Tab) -> Void>;
/**
Fired when a menu is hidden. This event is only fired if onShown has fired before.
**/
var onHidden : webextension_polyfill.events.Event<() -> Void>;
/**
The maximum number of top level extension items that can be added to an extension action context menu.
Any items beyond this limit will be ignored.
**/
var ACTION_MENU_TOP_LEVEL_LIMIT : Int;
};

View File

@@ -0,0 +1,31 @@
package webextension_polyfill.contextualidentities;
/**
Represents information about a contextual identity.
**/
typedef ContextualIdentity = {
/**
The name of the contextual identity.
**/
var name : String;
/**
The icon name of the contextual identity.
**/
var icon : String;
/**
The icon url of the contextual identity.
**/
var iconUrl : String;
/**
The color name of the contextual identity.
**/
var color : String;
/**
The color hash of the contextual identity.
**/
var colorCode : String;
/**
The cookie store ID of the contextual identity.
**/
var cookieStoreId : String;
};

View File

@@ -0,0 +1,19 @@
package webextension_polyfill.contextualidentities;
/**
Details about the contextual identity being created.
**/
typedef CreateDetailsType = {
/**
The name of the contextual identity.
**/
var name : String;
/**
The color of the contextual identity.
**/
var color : String;
/**
The icon of the contextual identity.
**/
var icon : String;
};

View File

@@ -0,0 +1,8 @@
package webextension_polyfill.contextualidentities;
typedef OnCreatedChangeInfoType = {
/**
Contextual identity that has been created
**/
var contextualIdentity : ContextualIdentity;
};

View File

@@ -0,0 +1,8 @@
package webextension_polyfill.contextualidentities;
typedef OnRemovedChangeInfoType = {
/**
Contextual identity that has been removed
**/
var contextualIdentity : ContextualIdentity;
};

View File

@@ -0,0 +1,8 @@
package webextension_polyfill.contextualidentities;
typedef OnUpdatedChangeInfoType = {
/**
Contextual identity that has been updated
**/
var contextualIdentity : ContextualIdentity;
};

View File

@@ -0,0 +1,13 @@
package webextension_polyfill.contextualidentities;
/**
Information to filter the contextual identities being retrieved.
**/
typedef QueryDetailsType = {
/**
Filters the contextual identity by name.
Optional.
**/
@:optional
var name : String;
};

View File

@@ -0,0 +1,36 @@
package webextension_polyfill.contextualidentities;
typedef Static = {
/**
Retrieves information about a single contextual identity.
**/
function get(cookieStoreId:String):js.lib.Promise<ContextualIdentity>;
/**
Retrieves all contextual identities
**/
function query(details:QueryDetailsType):js.lib.Promise<Array<ContextualIdentity>>;
/**
Creates a contextual identity with the given data.
**/
function create(details:CreateDetailsType):js.lib.Promise<ContextualIdentity>;
/**
Updates a contextual identity with the given data.
**/
function update(cookieStoreId:String, details:UpdateDetailsType):js.lib.Promise<ContextualIdentity>;
/**
Deletes a contetual identity by its cookie Store ID.
**/
function remove(cookieStoreId:String):js.lib.Promise<ContextualIdentity>;
/**
Fired when a container is updated.
**/
var onUpdated : webextension_polyfill.events.Event<(changeInfo:OnUpdatedChangeInfoType) -> Void>;
/**
Fired when a new container is created.
**/
var onCreated : webextension_polyfill.events.Event<(changeInfo:OnCreatedChangeInfoType) -> Void>;
/**
Fired when a container is removed.
**/
var onRemoved : webextension_polyfill.events.Event<(changeInfo:OnRemovedChangeInfoType) -> Void>;
};

View File

@@ -0,0 +1,25 @@
package webextension_polyfill.contextualidentities;
/**
Details about the contextual identity being created.
**/
typedef UpdateDetailsType = {
/**
The name of the contextual identity.
Optional.
**/
@:optional
var name : String;
/**
The color of the contextual identity.
Optional.
**/
@:optional
var color : String;
/**
The icon of the contextual identity.
Optional.
**/
@:optional
var icon : String;
};

View File

@@ -0,0 +1,63 @@
package webextension_polyfill.cookies;
/**
Represents information about an HTTP cookie.
**/
typedef Cookie = {
/**
The name of the cookie.
**/
var name : String;
/**
The value of the cookie.
**/
var value : String;
/**
The domain of the cookie (e.g. "www.google.com", "example.com").
**/
var domain : String;
/**
True if the cookie is a host-only cookie (i.e. a request's host must exactly match the domain of the cookie).
**/
var hostOnly : Bool;
/**
The path of the cookie.
**/
var path : String;
/**
True if the cookie is marked as Secure (i.e. its scope is limited to secure channels, typically HTTPS).
**/
var secure : Bool;
/**
True if the cookie is marked as HttpOnly (i.e. the cookie is inaccessible to client-side scripts).
**/
var httpOnly : Bool;
/**
The cookie's same-site status (i.e. whether the cookie is sent with cross-site requests).
**/
var sameSite : SameSiteStatus;
/**
True if the cookie is a session cookie, as opposed to a persistent cookie with an expiration date.
**/
var session : Bool;
/**
The expiration date of the cookie as the number of seconds since the UNIX epoch. Not provided for session cookies.
Optional.
**/
@:optional
var expirationDate : Float;
/**
The ID of the cookie store containing this cookie, as provided in getAllCookieStores().
**/
var storeId : String;
/**
The first-party domain of the cookie.
**/
var firstPartyDomain : String;
/**
The cookie's storage partition, if any. null if not partitioned.
Optional.
**/
@:optional
var partitionKey : PartitionKey;
};

View File

@@ -0,0 +1,20 @@
package webextension_polyfill.cookies;
/**
Represents a cookie store in the browser. An incognito mode window, for instance, uses a separate cookie store from a
non-incognito window.
**/
typedef CookieStore = {
/**
The unique identifier for the cookie store.
**/
var id : String;
/**
Identifiers of all the browser tabs that share this cookie store.
**/
var tabIds : Array<Float>;
/**
Indicates if this is an incognito cookie store
**/
var incognito : Bool;
};

View File

@@ -0,0 +1,66 @@
package webextension_polyfill.cookies;
/**
Information to filter the cookies being retrieved.
**/
typedef GetAllDetailsType = {
/**
Restricts the retrieved cookies to those that would match the given URL.
Optional.
**/
@:optional
var url : String;
/**
Filters the cookies by name.
Optional.
**/
@:optional
var name : String;
/**
Restricts the retrieved cookies to those whose domains match or are subdomains of this one.
Optional.
**/
@:optional
var domain : String;
/**
Restricts the retrieved cookies to those whose path exactly matches this string.
Optional.
**/
@:optional
var path : String;
/**
Filters the cookies by their Secure property.
Optional.
**/
@:optional
var secure : Bool;
/**
Filters out session vs. persistent cookies.
Optional.
**/
@:optional
var session : Bool;
/**
The cookie store to retrieve cookies from. If omitted, the current execution context's cookie store will be used.
Optional.
**/
@:optional
var storeId : String;
/**
Restricts the retrieved cookies to those whose first-party domains match this one.
This attribute is required if First-Party Isolation is enabled. To not filter by a specific first-party domain,
use `null` or `undefined`.
Optional.
**/
@:optional
var firstPartyDomain : String;
/**
Selects a specific storage partition to look up cookies. Defaults to null, in which case only non-partitioned cookies
are retrieved. If an object iis passed, partitioned cookies are also included, and filtered based on the keys present in
the given PartitionKey description. An empty object ({}) returns all cookies (partitioned + unpartitioned),
a non-empty object (e.g. {topLevelSite: '...'}) only returns cookies whose partition match all given attributes.
Optional.
**/
@:optional
var partitionKey : PartitionKey;
};

View File

@@ -0,0 +1,38 @@
package webextension_polyfill.cookies;
/**
Details to identify the cookie being retrieved.
**/
typedef GetDetailsType = {
/**
The URL with which the cookie to retrieve is associated. This argument may be a full URL,
in which case any data following the URL path (e.g. the query string) is simply ignored.
If host permissions for this URL are not specified in the manifest file, the API call will fail.
**/
var url : String;
/**
The name of the cookie to retrieve.
**/
var name : String;
/**
The ID of the cookie store in which to look for the cookie. By default, the current execution context's cookie store
will be used.
Optional.
**/
@:optional
var storeId : String;
/**
The first-party domain which the cookie to retrieve is associated. This attribute is required if First-Party Isolation
is enabled.
Optional.
**/
@:optional
var firstPartyDomain : String;
/**
The storage partition, if the cookie is part of partitioned storage. By default, only non-partitioned cookies are
returned.
Optional.
**/
@:optional
var partitionKey : PartitionKey;
};

View File

@@ -0,0 +1,11 @@
package webextension_polyfill.cookies;
/**
The underlying reason behind the cookie's change. If a cookie was inserted, or removed via an explicit call to
$(ref:cookies.remove), "cause" will be "explicit". If a cookie was automatically removed due to expiry,
"cause" will be "expired". If a cookie was removed due to being overwritten with an already-expired expiration date,
"cause" will be set to "expired_overwrite". If a cookie was automatically removed due to garbage collection,
"cause" will be "evicted". If a cookie was automatically removed due to a "set" call that overwrote it,
"cause" will be "overwrite". Plan your response accordingly.
**/
typedef OnChangedCause = String;

View File

@@ -0,0 +1,16 @@
package webextension_polyfill.cookies;
typedef OnChangedChangeInfoType = {
/**
True if a cookie was removed.
**/
var removed : Bool;
/**
Information about the cookie that was set or removed.
**/
var cookie : Cookie;
/**
The underlying reason behind the cookie's change.
**/
var cause : OnChangedCause;
};

View File

@@ -0,0 +1,13 @@
package webextension_polyfill.cookies;
/**
The description of the storage partition of a cookie. This object may be omitted (null) if a cookie is not partitioned.
**/
typedef PartitionKey = {
/**
The first-party URL of the cookie, if the cookie is in storage partitioned by the top-level site.
Optional.
**/
@:optional
var topLevelSite : String;
};

View File

@@ -0,0 +1,30 @@
package webextension_polyfill.cookies;
/**
Contains details about the cookie that's been removed. If removal failed for any reason, this will be "null",
and $(ref:runtime.lastError) will be set.
**/
typedef RemoveCallbackDetailsType = {
/**
The URL associated with the cookie that's been removed.
**/
var url : String;
/**
The name of the cookie that's been removed.
**/
var name : String;
/**
The ID of the cookie store from which the cookie was removed.
**/
var storeId : String;
/**
The first-party domain associated with the cookie that's been removed.
**/
var firstPartyDomain : String;
/**
The storage partition, if the cookie is part of partitioned storage. null if not partitioned.
Optional.
**/
@:optional
var partitionKey : PartitionKey;
};

View File

@@ -0,0 +1,35 @@
package webextension_polyfill.cookies;
/**
Information to identify the cookie to remove.
**/
typedef RemoveDetailsType = {
/**
The URL associated with the cookie. If host permissions for this URL are not specified in the manifest file,
the API call will fail.
**/
var url : String;
/**
The name of the cookie to remove.
**/
var name : String;
/**
The ID of the cookie store to look in for the cookie. If unspecified, the cookie is looked for by default in the current
execution context's cookie store.
Optional.
**/
@:optional
var storeId : String;
/**
The first-party domain associated with the cookie. This attribute is required if First-Party Isolation is enabled.
Optional.
**/
@:optional
var firstPartyDomain : String;
/**
The storage partition, if the cookie is part of partitioned storage. By default, non-partitioned storage is used.
Optional.
**/
@:optional
var partitionKey : PartitionKey;
};

View File

@@ -0,0 +1,8 @@
package webextension_polyfill.cookies;
/**
A cookie's 'SameSite' state (https://tools.ietf.org/html/draft-west-first-party-cookies).
'no_restriction' corresponds to a cookie set without a 'SameSite' attribute, 'lax' to 'SameSite=Lax',
and 'strict' to 'SameSite=Strict'.
**/
typedef SameSiteStatus = String;

View File

@@ -0,0 +1,80 @@
package webextension_polyfill.cookies;
/**
Details about the cookie being set.
**/
typedef SetDetailsType = {
/**
The request-URI to associate with the setting of the cookie. This value can affect the default domain and path values of
the created cookie. If host permissions for this URL are not specified in the manifest file, the API call will fail.
**/
var url : String;
/**
The name of the cookie. Empty by default if omitted.
Optional.
**/
@:optional
var name : String;
/**
The value of the cookie. Empty by default if omitted.
Optional.
**/
@:optional
var value : String;
/**
The domain of the cookie. If omitted, the cookie becomes a host-only cookie.
Optional.
**/
@:optional
var domain : String;
/**
The path of the cookie. Defaults to the path portion of the url parameter.
Optional.
**/
@:optional
var path : String;
/**
Whether the cookie should be marked as Secure. Defaults to false.
Optional.
**/
@:optional
var secure : Bool;
/**
Whether the cookie should be marked as HttpOnly. Defaults to false.
Optional.
**/
@:optional
var httpOnly : Bool;
/**
The cookie's same-site status.
Optional.
**/
@:optional
var sameSite : SameSiteStatus;
/**
The expiration date of the cookie as the number of seconds since the UNIX epoch. If omitted,
the cookie becomes a session cookie.
Optional.
**/
@:optional
var expirationDate : Float;
/**
The ID of the cookie store in which to set the cookie. By default, the cookie is set in the current execution context's
cookie store.
Optional.
**/
@:optional
var storeId : String;
/**
The first-party domain of the cookie. This attribute is required if First-Party Isolation is enabled.
Optional.
**/
@:optional
var firstPartyDomain : String;
/**
The storage partition, if the cookie is part of partitioned storage. By default, non-partitioned storage is used.
Optional.
**/
@:optional
var partitionKey : PartitionKey;
};

View File

@@ -0,0 +1,35 @@
package webextension_polyfill.cookies;
typedef Static = {
/**
Retrieves information about a single cookie. If more than one cookie of the same name exists for the given URL,
the one with the longest path will be returned. For cookies with the same path length,
the cookie with the earliest creation time will be returned.
**/
function get(details:GetDetailsType):js.lib.Promise<Null<Cookie>>;
/**
Retrieves all cookies from a single cookie store that match the given information. The cookies returned will be sorted,
with those with the longest path first. If multiple cookies have the same path length,
those with the earliest creation time will be first.
**/
function getAll(details:GetAllDetailsType):js.lib.Promise<Array<Cookie>>;
/**
Sets a cookie with the given cookie data; may overwrite equivalent cookies if they exist.
**/
function set(details:SetDetailsType):js.lib.Promise<Cookie>;
/**
Deletes a cookie by name.
**/
function remove(details:RemoveDetailsType):js.lib.Promise<Null<RemoveCallbackDetailsType>>;
/**
Lists all existing cookie stores.
**/
function getAllCookieStores():js.lib.Promise<Array<CookieStore>>;
/**
Fired when a cookie is set or removed. As a special case, note that updating a cookie's properties is implemented as a
two step process: the cookie to be updated is first removed entirely, generating a notification with "cause" of
"overwrite" . Afterwards, a new cookie is written with the updated values, generating a second notification with
"cause" "explicit".
**/
var onChanged : webextension_polyfill.events.Event<(changeInfo:OnChangedChangeInfoType) -> Void>;
};

View File

@@ -0,0 +1,14 @@
package webextension_polyfill.declarativenetrequest;
typedef IsRegexSupportedCallbackResultType = {
/**
Whether the given regex is supported
**/
var isSupported : Bool;
/**
Specifies the reason why the regular expression is not supported. Only provided if 'isSupported' is false.
Optional.
**/
@:optional
var reason : UnsupportedRegexReason;
};

View File

@@ -0,0 +1,21 @@
package webextension_polyfill.declarativenetrequest;
typedef IsRegexSupportedRegexOptionsType = {
/**
The regular expresson to check.
**/
var regex : String;
/**
Whether the 'regex' specified is case sensitive.
Optional.
**/
@:optional
var isCaseSensitive : Bool;
/**
Whether the 'regex' specified requires capturing. Capturing is only required for redirect rules which specify a
'regexSubstition' action.
Optional.
**/
@:optional
var requireCapturing : Bool;
};

View File

@@ -0,0 +1,18 @@
package webextension_polyfill.declarativenetrequest;
typedef MatchedRule = {
/**
A matching rule's ID.
**/
var ruleId : Float;
/**
ID of the Ruleset this rule belongs to.
**/
var rulesetId : String;
/**
ID of the extension, if this rule belongs to a different extension.
Optional.
**/
@:optional
var extensionId : String;
};

View File

@@ -0,0 +1,6 @@
package webextension_polyfill.declarativenetrequest;
/**
How the requested resource will be used. Comparable to the webRequest.ResourceType type.
**/
typedef ResourceType = String;

View File

@@ -0,0 +1,22 @@
package webextension_polyfill.declarativenetrequest;
typedef Rule = {
/**
An id which uniquely identifies a rule. Mandatory and should be >= 1.
**/
var id : Float;
/**
Rule priority. Defaults to 1. When specified, should be >= 1
Optional.
**/
@:optional
var priority : Float;
/**
The condition under which this rule is triggered.
**/
var condition : RuleConditionType;
/**
The action to take if this rule is matched.
**/
var action : RuleActionType;
};

View File

@@ -0,0 +1,33 @@
package webextension_polyfill.declarativenetrequest;
/**
Describes how the redirect should be performed. Only valid when type is 'redirect'.
**/
typedef RuleActionRedirectType = {
/**
Path relative to the extension directory. Should start with '/'.
Optional.
**/
@:optional
var extensionPath : String;
/**
Url transformations to perform.
Optional.
**/
@:optional
var transform : URLTransform;
/**
The redirect url. Redirects to JavaScript urls are not allowed.
Optional.
**/
@:optional
var url : String;
/**
Substitution pattern for rules which specify a 'regexFilter'. The first match of regexFilter within the url will be
replaced with this pattern. Within regexSubstitution, backslash-escaped digits (\1 to \9)
can be used to insert the corresponding capture groups. \0 refers to the entire matching text.
Optional.
**/
@:optional
var regexSubstitution : String;
};

View File

@@ -0,0 +1,18 @@
package webextension_polyfill.declarativenetrequest;
typedef RuleActionRequestHeadersItemType = {
/**
The name of the request header to be modified.
**/
var header : String;
/**
The operation to be performed on a header.
**/
var operation : String;
/**
The new value for the header. Must be specified for the 'append' and 'set' operations.
Optional.
**/
@:optional
var value : String;
};

View File

@@ -0,0 +1,18 @@
package webextension_polyfill.declarativenetrequest;
typedef RuleActionResponseHeadersItemType = {
/**
The name of the response header to be modified.
**/
var header : String;
/**
The operation to be performed on a header.
**/
var operation : String;
/**
The new value for the header. Must be specified for the 'append' and 'set' operations.
Optional.
**/
@:optional
var value : String;
};

View File

@@ -0,0 +1,26 @@
package webextension_polyfill.declarativenetrequest;
/**
The action to take if this rule is matched.
**/
typedef RuleActionType = {
var type : RuleActionTypeEnum;
/**
Describes how the redirect should be performed. Only valid when type is 'redirect'.
Optional.
**/
@:optional
var redirect : RuleActionRedirectType;
/**
The request headers to modify for the request. Only valid when type is 'modifyHeaders'.
Optional.
**/
@:optional
var requestHeaders : Array<RuleActionRequestHeadersItemType>;
/**
The response headers to modify for the request. Only valid when type is 'modifyHeaders'.
Optional.
**/
@:optional
var responseHeaders : Array<RuleActionResponseHeadersItemType>;
};

View File

@@ -0,0 +1,3 @@
package webextension_polyfill.declarativenetrequest;
typedef RuleActionTypeEnum = String;

View File

@@ -0,0 +1,7 @@
package webextension_polyfill.declarativenetrequest;
/**
Specifies whether the network request is first-party or third-party to the domain from which it originated. If omitted,
all requests are matched.
**/
typedef RuleConditionDomainTypeEnum = String;

View File

@@ -0,0 +1,104 @@
package webextension_polyfill.declarativenetrequest;
/**
The condition under which this rule is triggered.
**/
typedef RuleConditionType = {
/**
TODO: link to doc explaining supported pattern. The pattern which is matched against the network request url.
Only one of 'urlFilter' or 'regexFilter' can be specified.
Optional.
**/
@:optional
var urlFilter : String;
/**
Regular expression to match against the network request url. Only one of 'urlFilter' or 'regexFilter' can be specified.
Optional.
**/
@:optional
var regexFilter : String;
/**
Whether 'urlFilter' or 'regexFilter' is case-sensitive.
Optional.
**/
@:optional
var isUrlFilterCaseSensitive : Bool;
/**
The rule will only match network requests originating from the list of 'initiatorDomains'. If the list is omitted,
the rule is applied to requests from all domains.
Optional.
**/
@:optional
var initiatorDomains : Array<String>;
/**
The rule will not match network requests originating from the list of 'initiatorDomains'.
If the list is empty or omitted, no domains are excluded. This takes precedence over 'initiatorDomains'.
Optional.
**/
@:optional
var excludedInitiatorDomains : Array<String>;
/**
The rule will only match network requests when the domain matches one from the list of 'requestDomains'.
If the list is omitted, the rule is applied to requests from all domains.
Optional.
**/
@:optional
var requestDomains : Array<String>;
/**
The rule will not match network requests when the domains matches one from the list of 'excludedRequestDomains'.
If the list is empty or omitted, no domains are excluded. This takes precedence over 'requestDomains'.
Optional.
**/
@:optional
var excludedRequestDomains : Array<String>;
/**
List of resource types which the rule can match. When the rule action is 'allowAllRequests',
this must be specified and may only contain 'main_frame' or 'sub_frame'. Cannot be specified if 'excludedResourceTypes'
is specified. If neither of them is specified, all resource types except 'main_frame' are matched.
Optional.
**/
@:optional
var resourceTypes : Array<ResourceType>;
/**
List of resource types which the rule won't match. Cannot be specified if 'resourceTypes' is specified.
If neither of them is specified, all resource types except 'main_frame' are matched.
Optional.
**/
@:optional
var excludedResourceTypes : Array<ResourceType>;
/**
List of HTTP request methods which the rule can match. Should be a lower-case method such as 'connect', 'delete', 'get',
'head', 'options', 'patch', 'post', 'put'.'
Optional.
**/
@:optional
var requestMethods : Array<String>;
/**
List of request methods which the rule won't match. Cannot be specified if 'requestMethods' is specified.
If neither of them is specified, all request methods are matched.
Optional.
**/
@:optional
var excludedRequestMethods : Array<String>;
/**
Specifies whether the network request is first-party or third-party to the domain from which it originated. If omitted,
all requests are matched.
Optional.
**/
@:optional
var domainType : RuleConditionDomainTypeEnum;
/**
List of tabIds which the rule should match. An ID of -1 matches requests which don't originate from a tab.
Only supported for session-scoped rules.
Optional.
**/
@:optional
var tabIds : Array<Float>;
/**
List of tabIds which the rule should not match. An ID of -1 excludes requests which don't originate from a tab.
Only supported for session-scoped rules.
Optional.
**/
@:optional
var excludedTabIds : Array<Float>;
};

View File

@@ -0,0 +1,76 @@
package webextension_polyfill.declarativenetrequest;
typedef Static = {
/**
Modifies the current set of dynamic rules for the extension. The rules with IDs listed in options.
removeRuleIds are first removed, and then the rules given in options.addRules are added.
These rules are persisted across browser sessions and extension updates.
**/
function updateDynamicRules(options:UpdateDynamicRulesOptionsType):js.lib.Promise<ts.Undefined>;
/**
Modifies the current set of session scoped rules for the extension. The rules with IDs listed in options.
removeRuleIds are first removed, and then the rules given in options.addRules are added.
These rules are not persisted across sessions and are backed in memory.
**/
function updateSessionRules(options:UpdateSessionRulesOptionsType):js.lib.Promise<ts.Undefined>;
/**
Returns the ids for the current set of enabled static rulesets.
**/
function getEnabledRulesets():js.lib.Promise<Array<String>>;
/**
Returns the ids for the current set of enabled static rulesets.
**/
function updateEnabledRulesets(updateRulesetOptions:UpdateEnabledRulesetsUpdateRulesetOptionsType):js.lib.Promise<ts.Undefined>;
/**
Returns the remaining number of static rules an extension can enable
**/
function getAvailableStaticRuleCount():js.lib.Promise<Float>;
/**
Returns the current set of dynamic rules for the extension.
**/
function getDynamicRules():js.lib.Promise<Array<Rule>>;
/**
Returns the current set of session scoped rules for the extension.
**/
function getSessionRules():js.lib.Promise<Array<Rule>>;
/**
Checks if the given regular expression will be supported as a 'regexFilter' rule condition.
**/
function isRegexSupported(regexOptions:IsRegexSupportedRegexOptionsType):js.lib.Promise<IsRegexSupportedCallbackResultType>;
/**
Checks if any of the extension's declarativeNetRequest rules would match a hypothetical request.
**/
function testMatchOutcome(request:TestMatchOutcomeRequestType, ?options:TestMatchOutcomeOptionsType):js.lib.Promise<TestMatchOutcomeCallbackResultType>;
/**
Ruleset ID for the dynamic rules added by the extension.
**/
var DYNAMIC_RULESET_ID : String;
/**
The minimum number of static rules guaranteed to an extension across its enabled static rulesets.
Any rules above this limit will count towards the global static rule limit.
**/
var GUARANTEED_MINIMUM_STATIC_RULES : Float;
/**
The maximum number of static Rulesets an extension can specify as part of the rule_resources manifest key.
**/
var MAX_NUMBER_OF_STATIC_RULESETS : Float;
/**
The maximum number of static Rulesets an extension can enable at any one time.
**/
var MAX_NUMBER_OF_ENABLED_STATIC_RULESETS : Float;
/**
The maximum number of dynamic and session rules an extension can add. NOTE: in the Firefox we are enforcing this limit
to the session and dynamic rules count separately, instead of enforcing it to the rules count for both combined as the
Chrome implementation does.
**/
var MAX_NUMBER_OF_DYNAMIC_AND_SESSION_RULES : Float;
/**
The maximum number of regular expression rules that an extension can add. This limit is evaluated separately for the set
of session rules, dynamic rules and those specified in the rule_resources file.
**/
var MAX_NUMBER_OF_REGEX_RULES : Float;
/**
Ruleset ID for the session-scoped rules added by the extension.
**/
var SESSION_RULESET_ID : String;
};

View File

@@ -0,0 +1,8 @@
package webextension_polyfill.declarativenetrequest;
typedef TestMatchOutcomeCallbackResultType = {
/**
The rules (if any) that match the hypothetical request.
**/
var matchedRules : Array<MatchedRule>;
};

View File

@@ -0,0 +1,10 @@
package webextension_polyfill.declarativenetrequest;
typedef TestMatchOutcomeOptionsType = {
/**
Whether to account for rules from other installed extensions during rule evaluation.
Optional.
**/
@:optional
var includeOtherExtensions : Bool;
};

View File

@@ -0,0 +1,34 @@
package webextension_polyfill.declarativenetrequest;
/**
The details of the request to test.
**/
typedef TestMatchOutcomeRequestType = {
/**
The URL of the hypothetical request.
**/
var url : String;
/**
The initiator URL (if any) for the hypothetical request.
Optional.
**/
@:optional
var initiator : String;
/**
Standard HTTP method of the hypothetical request.
Optional.
**/
@:optional
var method : String;
/**
The resource type of the hypothetical request.
**/
var type : ResourceType;
/**
The ID of the tab in which the hypothetical request takes place. Does not need to correspond to a real tab ID.
Default is -1, meaning that the request isn't related to a tab.
Optional.
**/
@:optional
var tabId : Float;
};

View File

@@ -0,0 +1,63 @@
package webextension_polyfill.declarativenetrequest;
/**
Describes the type of the Rule.action.redirect.transform property.
**/
typedef URLTransform = {
/**
The new scheme for the request.
Optional.
**/
@:optional
var scheme : URLTransformSchemeEnum;
/**
The new username for the request.
Optional.
**/
@:optional
var username : String;
/**
The new password for the request.
Optional.
**/
@:optional
var password : String;
/**
The new host name for the request.
Optional.
**/
@:optional
var host : String;
/**
The new port for the request. If empty, the existing port is cleared.
Optional.
**/
@:optional
var port : String;
/**
The new path for the request. If empty, the existing path is cleared.
Optional.
**/
@:optional
var path : String;
/**
The new query for the request. Should be either empty, in which case the existing query is cleared; or should begin with
'?'. Cannot be specified if 'queryTransform' is specified.
Optional.
**/
@:optional
var query : String;
/**
Add, remove or replace query key-value pairs. Cannot be specified if 'query' is specified.
Optional.
**/
@:optional
var queryTransform : URLTransformQueryTransformType;
/**
The new fragment for the request. Should be either empty, in which case the existing fragment is cleared; or should
begin with '#'.
Optional.
**/
@:optional
var fragment : String;
};

View File

@@ -0,0 +1,12 @@
package webextension_polyfill.declarativenetrequest;
typedef URLTransformQueryTransformAddOrReplaceParamsItemType = {
var key : String;
var value : String;
/**
If true, the query key is replaced only if it's already present. Otherwise, the key is also added if it's missing.
Optional.
**/
@:optional
var replaceOnly : Bool;
};

View File

@@ -0,0 +1,19 @@
package webextension_polyfill.declarativenetrequest;
/**
Add, remove or replace query key-value pairs. Cannot be specified if 'query' is specified.
**/
typedef URLTransformQueryTransformType = {
/**
The list of query keys to be removed.
Optional.
**/
@:optional
var removeParams : Array<String>;
/**
The list of query key-value pairs to be added or replaced.
Optional.
**/
@:optional
var addOrReplaceParams : Array<URLTransformQueryTransformAddOrReplaceParamsItemType>;
};

Some files were not shown because too many files have changed in this diff Show More