add firefox extension template
This commit is contained in:
63
externs/webextension_polyfill/cookies/Cookie.hx
Normal file
63
externs/webextension_polyfill/cookies/Cookie.hx
Normal 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;
|
||||
};
|
20
externs/webextension_polyfill/cookies/CookieStore.hx
Normal file
20
externs/webextension_polyfill/cookies/CookieStore.hx
Normal 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;
|
||||
};
|
66
externs/webextension_polyfill/cookies/GetAllDetailsType.hx
Normal file
66
externs/webextension_polyfill/cookies/GetAllDetailsType.hx
Normal 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;
|
||||
};
|
38
externs/webextension_polyfill/cookies/GetDetailsType.hx
Normal file
38
externs/webextension_polyfill/cookies/GetDetailsType.hx
Normal 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;
|
||||
};
|
11
externs/webextension_polyfill/cookies/OnChangedCause.hx
Normal file
11
externs/webextension_polyfill/cookies/OnChangedCause.hx
Normal 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;
|
@@ -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;
|
||||
};
|
13
externs/webextension_polyfill/cookies/PartitionKey.hx
Normal file
13
externs/webextension_polyfill/cookies/PartitionKey.hx
Normal 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;
|
||||
};
|
@@ -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;
|
||||
};
|
35
externs/webextension_polyfill/cookies/RemoveDetailsType.hx
Normal file
35
externs/webextension_polyfill/cookies/RemoveDetailsType.hx
Normal 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;
|
||||
};
|
8
externs/webextension_polyfill/cookies/SameSiteStatus.hx
Normal file
8
externs/webextension_polyfill/cookies/SameSiteStatus.hx
Normal 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;
|
80
externs/webextension_polyfill/cookies/SetDetailsType.hx
Normal file
80
externs/webextension_polyfill/cookies/SetDetailsType.hx
Normal 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;
|
||||
};
|
35
externs/webextension_polyfill/cookies/Static.hx
Normal file
35
externs/webextension_polyfill/cookies/Static.hx
Normal 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>;
|
||||
};
|
Reference in New Issue
Block a user