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,5 @@
package webextension_polyfill.webnavigation;
typedef EventUrlFilters = {
var url : Array<webextension_polyfill.events.UrlFilter>;
};

View File

@@ -0,0 +1,26 @@
package webextension_polyfill.webnavigation;
typedef GetAllFramesCallbackDetailsItemType = {
/**
True if the last navigation in this frame was interrupted by an error, i.e. the onErrorOccurred event fired.
Optional.
**/
@:optional
var errorOccurred : Bool;
/**
The ID of the tab in which the frame is.
**/
var tabId : Float;
/**
The ID of the frame. 0 indicates that this is the main frame; a positive value indicates the ID of a subframe.
**/
var frameId : Float;
/**
ID of frame that wraps the frame. Set to -1 of no parent frame exists.
**/
var parentFrameId : Float;
/**
The URL currently associated with this frame.
**/
var url : String;
};

View File

@@ -0,0 +1,11 @@
package webextension_polyfill.webnavigation;
/**
Information about the tab to retrieve all frames from.
**/
typedef GetAllFramesDetailsType = {
/**
The ID of the tab.
**/
var tabId : Float;
};

View File

@@ -0,0 +1,30 @@
package webextension_polyfill.webnavigation;
/**
Information about the requested frame, null if the specified frame ID and/or tab ID are invalid.
**/
typedef GetFrameCallbackDetailsType = {
/**
True if the last navigation in this frame was interrupted by an error, i.e. the onErrorOccurred event fired.
Optional.
**/
@:optional
var errorOccurred : Bool;
/**
The URL currently associated with this frame, if the frame identified by the frameId existed at one point in the given
tab. The fact that an URL is associated with a given frameId does not imply that the corresponding frame still exists.
**/
var url : String;
/**
The ID of the tab in which the frame is.
**/
var tabId : Float;
/**
The ID of the frame. 0 indicates that this is the main frame; a positive value indicates the ID of a subframe.
**/
var frameId : Float;
/**
ID of frame that wraps the frame. Set to -1 of no parent frame exists.
**/
var parentFrameId : Float;
};

View File

@@ -0,0 +1,21 @@
package webextension_polyfill.webnavigation;
/**
Information about the frame to retrieve information about.
**/
typedef GetFrameDetailsType = {
/**
The ID of the tab in which the frame is.
**/
var tabId : Float;
/**
The ID of the process runs the renderer for this tab.
Optional.
**/
@:optional
var processId : Float;
/**
The ID of the frame in the given tab.
**/
var frameId : Float;
};

View File

@@ -0,0 +1,22 @@
package webextension_polyfill.webnavigation;
typedef OnBeforeNavigateDetailsType = {
/**
The ID of the tab in which the navigation is about to occur.
**/
var tabId : Float;
var url : String;
/**
0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe.
Frame IDs are unique for a given tab and process.
**/
var frameId : Float;
/**
ID of frame that wraps the frame. Set to -1 of no parent frame exists.
**/
var parentFrameId : Float;
/**
The time when the browser was about to start the navigation, in milliseconds since the epoch.
**/
var timeStamp : Float;
};

View File

@@ -0,0 +1,17 @@
package webextension_polyfill.webnavigation;
/**
Fired when a navigation is about to occur.
**/
typedef OnBeforeNavigateEvent = {
/**
Registers an event listener <em>callback</em> to an event.
**/
function addListener(callback:(details:OnBeforeNavigateDetailsType) -> Void, ?filters:EventUrlFilters):Void;
/**
Deregisters an event listener <em>callback</em> from an event.
**/
function removeListener(callback:(details:OnBeforeNavigateDetailsType) -> Void):Void;
function hasListener(callback:(details:OnBeforeNavigateDetailsType) -> Void):Bool;
function hasListeners():Bool;
};

View File

@@ -0,0 +1,26 @@
package webextension_polyfill.webnavigation;
typedef OnCommittedDetailsType = {
/**
The ID of the tab in which the navigation occurs.
**/
var tabId : Float;
var url : String;
/**
0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe.
Frame IDs are unique within a tab.
**/
var frameId : Float;
/**
Cause of the navigation.
**/
var transitionType : TransitionType;
/**
A list of transition qualifiers.
**/
var transitionQualifiers : Array<TransitionQualifier>;
/**
The time when the navigation was committed, in milliseconds since the epoch.
**/
var timeStamp : Float;
};

View File

@@ -0,0 +1,19 @@
package webextension_polyfill.webnavigation;
/**
Fired when a navigation is committed. The document (and the resources it refers to, such as images and subframes)
might still be downloading, but at least part of the document has been received from the server and the browser has
decided to switch to the new document.
**/
typedef OnCommittedEvent = {
/**
Registers an event listener <em>callback</em> to an event.
**/
function addListener(callback:(details:OnCommittedDetailsType) -> Void, ?filters:EventUrlFilters):Void;
/**
Deregisters an event listener <em>callback</em> from an event.
**/
function removeListener(callback:(details:OnCommittedDetailsType) -> Void):Void;
function hasListener(callback:(details:OnCommittedDetailsType) -> Void):Bool;
function hasListeners():Bool;
};

View File

@@ -0,0 +1,18 @@
package webextension_polyfill.webnavigation;
typedef OnCompletedDetailsType = {
/**
The ID of the tab in which the navigation occurs.
**/
var tabId : Float;
var url : String;
/**
0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe.
Frame IDs are unique within a tab.
**/
var frameId : Float;
/**
The time when the document finished loading, in milliseconds since the epoch.
**/
var timeStamp : Float;
};

View File

@@ -0,0 +1,17 @@
package webextension_polyfill.webnavigation;
/**
Fired when a document, including the resources it refers to, is completely loaded and initialized.
**/
typedef OnCompletedEvent = {
/**
Registers an event listener <em>callback</em> to an event.
**/
function addListener(callback:(details:OnCompletedDetailsType) -> Void, ?filters:EventUrlFilters):Void;
/**
Deregisters an event listener <em>callback</em> from an event.
**/
function removeListener(callback:(details:OnCompletedDetailsType) -> Void):Void;
function hasListener(callback:(details:OnCompletedDetailsType) -> Void):Bool;
function hasListeners():Bool;
};

View File

@@ -0,0 +1,28 @@
package webextension_polyfill.webnavigation;
typedef OnCreatedNavigationTargetDetailsType = {
/**
The ID of the tab in which the navigation is triggered.
**/
var sourceTabId : Float;
/**
The ID of the process runs the renderer for the source tab.
**/
var sourceProcessId : Float;
/**
The ID of the frame with sourceTabId in which the navigation is triggered. 0 indicates the main frame.
**/
var sourceFrameId : Float;
/**
The URL to be opened in the new window.
**/
var url : String;
/**
The ID of the tab in which the url is opened
**/
var tabId : Float;
/**
The time when the browser was about to create a new view, in milliseconds since the epoch.
**/
var timeStamp : Float;
};

View File

@@ -0,0 +1,17 @@
package webextension_polyfill.webnavigation;
/**
Fired when a new window, or a new tab in an existing window, is created to host a navigation.
**/
typedef OnCreatedNavigationTargetEvent = {
/**
Registers an event listener <em>callback</em> to an event.
**/
function addListener(callback:(details:OnCreatedNavigationTargetDetailsType) -> Void, ?filters:EventUrlFilters):Void;
/**
Deregisters an event listener <em>callback</em> from an event.
**/
function removeListener(callback:(details:OnCreatedNavigationTargetDetailsType) -> Void):Void;
function hasListener(callback:(details:OnCreatedNavigationTargetDetailsType) -> Void):Bool;
function hasListeners():Bool;
};

View File

@@ -0,0 +1,18 @@
package webextension_polyfill.webnavigation;
typedef OnDOMContentLoadedDetailsType = {
/**
The ID of the tab in which the navigation occurs.
**/
var tabId : Float;
var url : String;
/**
0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe.
Frame IDs are unique within a tab.
**/
var frameId : Float;
/**
The time when the page's DOM was fully constructed, in milliseconds since the epoch.
**/
var timeStamp : Float;
};

View File

@@ -0,0 +1,17 @@
package webextension_polyfill.webnavigation;
/**
Fired when the page's DOM is fully constructed, but the referenced resources may not finish loading.
**/
typedef OnDOMContentLoadedEvent = {
/**
Registers an event listener <em>callback</em> to an event.
**/
function addListener(callback:(details:OnDOMContentLoadedDetailsType) -> Void, ?filters:EventUrlFilters):Void;
/**
Deregisters an event listener <em>callback</em> from an event.
**/
function removeListener(callback:(details:OnDOMContentLoadedDetailsType) -> Void):Void;
function hasListener(callback:(details:OnDOMContentLoadedDetailsType) -> Void):Bool;
function hasListeners():Bool;
};

View File

@@ -0,0 +1,18 @@
package webextension_polyfill.webnavigation;
typedef OnErrorOccurredDetailsType = {
/**
The ID of the tab in which the navigation occurs.
**/
var tabId : Float;
var url : String;
/**
0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe.
Frame IDs are unique within a tab.
**/
var frameId : Float;
/**
The time when the error occurred, in milliseconds since the epoch.
**/
var timeStamp : Float;
};

View File

@@ -0,0 +1,18 @@
package webextension_polyfill.webnavigation;
/**
Fired when an error occurs and the navigation is aborted. This can happen if either a network error occurred,
or the user aborted the navigation.
**/
typedef OnErrorOccurredEvent = {
/**
Registers an event listener <em>callback</em> to an event.
**/
function addListener(callback:(details:OnErrorOccurredDetailsType) -> Void, ?filters:EventUrlFilters):Void;
/**
Deregisters an event listener <em>callback</em> from an event.
**/
function removeListener(callback:(details:OnErrorOccurredDetailsType) -> Void):Void;
function hasListener(callback:(details:OnErrorOccurredDetailsType) -> Void):Bool;
function hasListeners():Bool;
};

View File

@@ -0,0 +1,26 @@
package webextension_polyfill.webnavigation;
typedef OnHistoryStateUpdatedDetailsType = {
/**
The ID of the tab in which the navigation occurs.
**/
var tabId : Float;
var url : String;
/**
0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe.
Frame IDs are unique within a tab.
**/
var frameId : Float;
/**
Cause of the navigation.
**/
var transitionType : TransitionType;
/**
A list of transition qualifiers.
**/
var transitionQualifiers : Array<TransitionQualifier>;
/**
The time when the navigation was committed, in milliseconds since the epoch.
**/
var timeStamp : Float;
};

View File

@@ -0,0 +1,17 @@
package webextension_polyfill.webnavigation;
/**
Fired when the frame's history was updated to a new URL. All future events for that frame will use the updated URL.
**/
typedef OnHistoryStateUpdatedEvent = {
/**
Registers an event listener <em>callback</em> to an event.
**/
function addListener(callback:(details:OnHistoryStateUpdatedDetailsType) -> Void, ?filters:EventUrlFilters):Void;
/**
Deregisters an event listener <em>callback</em> from an event.
**/
function removeListener(callback:(details:OnHistoryStateUpdatedDetailsType) -> Void):Void;
function hasListener(callback:(details:OnHistoryStateUpdatedDetailsType) -> Void):Bool;
function hasListeners():Bool;
};

View File

@@ -0,0 +1,26 @@
package webextension_polyfill.webnavigation;
typedef OnReferenceFragmentUpdatedDetailsType = {
/**
The ID of the tab in which the navigation occurs.
**/
var tabId : Float;
var url : String;
/**
0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe.
Frame IDs are unique within a tab.
**/
var frameId : Float;
/**
Cause of the navigation.
**/
var transitionType : TransitionType;
/**
A list of transition qualifiers.
**/
var transitionQualifiers : Array<TransitionQualifier>;
/**
The time when the navigation was committed, in milliseconds since the epoch.
**/
var timeStamp : Float;
};

View File

@@ -0,0 +1,17 @@
package webextension_polyfill.webnavigation;
/**
Fired when the reference fragment of a frame was updated. All future events for that frame will use the updated URL.
**/
typedef OnReferenceFragmentUpdatedEvent = {
/**
Registers an event listener <em>callback</em> to an event.
**/
function addListener(callback:(details:OnReferenceFragmentUpdatedDetailsType) -> Void, ?filters:EventUrlFilters):Void;
/**
Deregisters an event listener <em>callback</em> from an event.
**/
function removeListener(callback:(details:OnReferenceFragmentUpdatedDetailsType) -> Void):Void;
function hasListener(callback:(details:OnReferenceFragmentUpdatedDetailsType) -> Void):Bool;
function hasListeners():Bool;
};

View File

@@ -0,0 +1,16 @@
package webextension_polyfill.webnavigation;
typedef OnTabReplacedDetailsType = {
/**
The ID of the tab that was replaced.
**/
var replacedTabId : Float;
/**
The ID of the tab that replaced the old tab.
**/
var tabId : Float;
/**
The time when the replacement happened, in milliseconds since the epoch.
**/
var timeStamp : Float;
};

View File

@@ -0,0 +1,52 @@
package webextension_polyfill.webnavigation;
typedef Static = {
/**
Retrieves information about the given frame. A frame refers to an &lt;iframe&gt; or a &lt;frame&gt; of a web page and is
identified by a tab ID and a frame ID.
**/
function getFrame(details:GetFrameDetailsType):js.lib.Promise<Null<GetFrameCallbackDetailsType>>;
/**
Retrieves information about all frames of a given tab.
**/
function getAllFrames(details:GetAllFramesDetailsType):js.lib.Promise<Null<Array<GetAllFramesCallbackDetailsItemType>>>;
/**
Fired when a navigation is about to occur.
**/
var onBeforeNavigate : OnBeforeNavigateEvent;
/**
Fired when a navigation is committed. The document (and the resources it refers to, such as images and subframes)
might still be downloading, but at least part of the document has been received from the server and the browser has
decided to switch to the new document.
**/
var onCommitted : OnCommittedEvent;
/**
Fired when the page's DOM is fully constructed, but the referenced resources may not finish loading.
**/
var onDOMContentLoaded : OnDOMContentLoadedEvent;
/**
Fired when a document, including the resources it refers to, is completely loaded and initialized.
**/
var onCompleted : OnCompletedEvent;
/**
Fired when an error occurs and the navigation is aborted. This can happen if either a network error occurred,
or the user aborted the navigation.
**/
var onErrorOccurred : OnErrorOccurredEvent;
/**
Fired when a new window, or a new tab in an existing window, is created to host a navigation.
**/
var onCreatedNavigationTarget : OnCreatedNavigationTargetEvent;
/**
Fired when the reference fragment of a frame was updated. All future events for that frame will use the updated URL.
**/
var onReferenceFragmentUpdated : OnReferenceFragmentUpdatedEvent;
/**
Fired when the contents of the tab is replaced by a different (usually previously pre-rendered) tab.
**/
var onTabReplaced : webextension_polyfill.events.Event<(details:OnTabReplacedDetailsType) -> Void>;
/**
Fired when the frame's history was updated to a new URL. All future events for that frame will use the updated URL.
**/
var onHistoryStateUpdated : OnHistoryStateUpdatedEvent;
};

View File

@@ -0,0 +1,3 @@
package webextension_polyfill.webnavigation;
typedef TransitionQualifier = String;

View File

@@ -0,0 +1,8 @@
package webextension_polyfill.webnavigation;
/**
Cause of the navigation. The same transition types as defined in the history API are used.
These are the same transition types as defined in the $(topic:transition_types)[history API] except with <code>
"start_page"</code> in place of <code>"auto_toplevel"</code> (for backwards compatibility).
**/
typedef TransitionType = String;