summaryrefslogtreecommitdiff
path: root/ext/fetch/23_request.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/fetch/23_request.js')
-rw-r--r--ext/fetch/23_request.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/ext/fetch/23_request.js b/ext/fetch/23_request.js
index 5232cc13c..c09bd4880 100644
--- a/ext/fetch/23_request.js
+++ b/ext/fetch/23_request.js
@@ -52,6 +52,7 @@ const _mimeType = Symbol("mime type");
const _body = Symbol("body");
const _url = Symbol("url");
const _method = Symbol("method");
+const _brand = webidl.brand;
/**
* @param {(() => string)[]} urlList
@@ -275,6 +276,11 @@ class Request {
* @param {RequestInit} init
*/
constructor(input, init = {}) {
+ if (input === _brand) {
+ this[_brand] = _brand;
+ return;
+ }
+
const prefix = "Failed to construct 'Request'";
webidl.requiredArguments(arguments.length, 1, prefix);
input = webidl.converters["RequestInfo_DOMString"](
@@ -284,7 +290,7 @@ class Request {
);
init = webidl.converters["RequestInit"](init, prefix, "Argument 2");
- this[webidl.brand] = webidl.brand;
+ this[_brand] = _brand;
/** @type {InnerRequest} */
let request;
@@ -554,7 +560,7 @@ function toInnerRequest(request) {
* @returns {Request}
*/
function fromInnerRequest(inner, signal, guard) {
- const request = webidl.createBranded(Request);
+ const request = new Request(_brand);
request[_request] = inner;
request[_signal] = signal;
request[_getHeaders] = () => headersFromHeaderList(inner.headerList, guard);