mirror of
https://github.com/servo/servo.git
synced 2025-09-27 23:30:08 +01:00
Add signal to request (#39290)
The signal taken from the requestinit is now passed into the request object with the relevant steps. I added all spec comments to this method, as I had trouble figuring out which steps I had to add. This required implementing the algorithm to create dependent signals, which is used in the `any()` method. So that's now implemented as well. All of that required the machinery to have dependent and source signals on an AbortSignal. It uses an IndexSet as the spec requires it to be an ordered set. Part of #34866 Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
This commit is contained in:
parent
1898a740a8
commit
22fbb3458b
11 changed files with 278 additions and 266 deletions
|
@ -20,7 +20,7 @@ DOMInterfaces = {
|
|||
},
|
||||
|
||||
'AbortSignal': {
|
||||
'canGc':['Abort'],
|
||||
'canGc':['Abort', 'Any'],
|
||||
},
|
||||
|
||||
'AbstractRange': {
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
[Exposed=*, Pref="dom_abort_controller_enabled"]
|
||||
interface AbortSignal : EventTarget {
|
||||
[NewObject] static AbortSignal abort(optional any reason);
|
||||
// [Exposed=(Window,Worker), NewObject] static AbortSignal timeout([EnforceRange] unsigned long long milliseconds);
|
||||
[NewObject] static AbortSignal _any(sequence<AbortSignal> signals);
|
||||
readonly attribute boolean aborted;
|
||||
readonly attribute any reason;
|
||||
undefined throwIfAborted();
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
typedef (Request or USVString) RequestInfo;
|
||||
|
||||
// https://fetch.spec.whatwg.org/#request
|
||||
[Exposed=(Window,Worker)]
|
||||
interface Request {
|
||||
[Throws] constructor(RequestInfo input, optional RequestInit init = {});
|
||||
|
@ -21,12 +22,18 @@ interface Request {
|
|||
readonly attribute RequestCache cache;
|
||||
readonly attribute RequestRedirect redirect;
|
||||
readonly attribute DOMString integrity;
|
||||
// readonly attribute boolean keepalive;
|
||||
// readonly attribute boolean isReloadNavigation;
|
||||
// readonly attribute boolean isHistoryNavigation;
|
||||
readonly attribute AbortSignal signal;
|
||||
// readonly attribute RequestDuplex duplex;
|
||||
|
||||
[NewObject, Throws] Request clone();
|
||||
};
|
||||
|
||||
Request includes Body;
|
||||
|
||||
// https://fetch.spec.whatwg.org/#requestinit
|
||||
dictionary RequestInit {
|
||||
ByteString method;
|
||||
HeadersInit headers;
|
||||
|
@ -38,9 +45,14 @@ dictionary RequestInit {
|
|||
RequestCache cache;
|
||||
RequestRedirect redirect;
|
||||
DOMString integrity;
|
||||
// boolean keepalive;
|
||||
AbortSignal? signal;
|
||||
// RequestDuplex duplex;
|
||||
// RequestPriority priority;
|
||||
any window; // can only be set to null
|
||||
};
|
||||
|
||||
// https://fetch.spec.whatwg.org/#requestdestination
|
||||
enum RequestDestination {
|
||||
"",
|
||||
"audio",
|
||||
|
@ -63,6 +75,7 @@ enum RequestDestination {
|
|||
"xslt"
|
||||
};
|
||||
|
||||
// https://fetch.spec.whatwg.org/#requestmode
|
||||
enum RequestMode {
|
||||
"navigate",
|
||||
"same-origin",
|
||||
|
@ -70,12 +83,14 @@ enum RequestMode {
|
|||
"cors"
|
||||
};
|
||||
|
||||
// https://fetch.spec.whatwg.org/#requestcredentials
|
||||
enum RequestCredentials {
|
||||
"omit",
|
||||
"same-origin",
|
||||
"include"
|
||||
};
|
||||
|
||||
// https://fetch.spec.whatwg.org/#requestcache
|
||||
enum RequestCache {
|
||||
"default",
|
||||
"no-store",
|
||||
|
@ -85,12 +100,14 @@ enum RequestCache {
|
|||
"only-if-cached"
|
||||
};
|
||||
|
||||
// https://fetch.spec.whatwg.org/#requestredirect
|
||||
enum RequestRedirect {
|
||||
"follow",
|
||||
"error",
|
||||
"manual"
|
||||
};
|
||||
|
||||
// https://w3c.github.io/webappsec-referrer-policy/#enumdef-referrerpolicy
|
||||
enum ReferrerPolicy {
|
||||
"",
|
||||
"no-referrer",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue