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,11 @@
package webextension_polyfill.userscripts;
/**
An object that represents a user script registered programmatically
**/
typedef RegisteredUserScript = {
/**
Unregister a user script registered programmatically
**/
function unregister():Void;
};

View File

@@ -0,0 +1,9 @@
package webextension_polyfill.userscripts;
typedef Static = {
/**
Register a user script programmatically given its $(ref:userScripts.UserScriptOptions),
and resolves to a $(ref:userScripts.RegisteredUserScript) instance
**/
function register(userScriptOptions:UserScriptOptions):Void;
};

View File

@@ -0,0 +1,59 @@
package webextension_polyfill.userscripts;
/**
Details of a user script
**/
typedef UserScriptOptions = {
/**
The list of JS files to inject
**/
var js : Array<webextension_polyfill.extensiontypes.ExtensionFileOrCode>;
/**
An opaque user script metadata value
Optional.
**/
@:optional
var scriptMetadata : webextension_polyfill.extensiontypes.PlainJSONValue;
var matches : Array<String>;
/**
Optional.
**/
@:optional
var excludeMatches : Array<String>;
/**
Optional.
**/
@:optional
var includeGlobs : Array<String>;
/**
Optional.
**/
@:optional
var excludeGlobs : Array<String>;
/**
If allFrames is <code>true</code>, implies that the JavaScript 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 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>>;
};