Replace JS builtin implementation of the FetchResponse constructor with a C++ one
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 9 Sep 2017 03:32:59 +0000 (03:32 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 9 Sep 2017 03:32:59 +0000 (03:32 +0000)
https://bugs.webkit.org/show_bug.cgi?id=176627

Patch by Sam Weinig <sam@webkit.org> on 2017-09-08
Reviewed by Alex Christensen.

Removes the last of the Fetch related JS builtin code.

* CMakeLists.txt:
* DerivedSources.make:
* WebCore.xcodeproj/project.pbxproj:
* Modules/fetch/FetchInternals.js: Removed.
* Modules/fetch/FetchResponse.js: Removed.

    Remove FetchInternals.js and FetchResponse.js.

* Modules/fetch/FetchBody.idl:
* Modules/fetch/FetchBodyConsumer.h:

    Remove no longer correct FIXMEs.

* Modules/fetch/FetchBodySource.cpp:

    Add missing newline between functions.

* Modules/fetch/FetchHeaders.idl:
* Modules/fetch/FetchResponse.idl:

    Remove builtin related operations and extended attributes.

* Modules/fetch/FetchHeaders.h:
(WebCore::FetchHeaders::fastHas const):
* Modules/fetch/FetchHeaders.cpp:

    Added fastHas to allow checking for a header using a HTTPHeaderName. Remove
    now unused filter function.

* Modules/fetch/FetchResponse.cpp:
(WebCore::isNullBodyStatus):

    Added helper predicate for 'null body status' concept.

(WebCore::FetchResponse::create):

    Add spec defined constructor implementation.

(WebCore::FetchResponse::setBodyData):

    Reformatted to match more common WTF::switchOn style.

(WebCore::FetchResponse::setStatus): Deleted.
(WebCore::FetchResponse::initializeWith): Deleted.

    Removed now unused functions.

* Modules/fetch/FetchResponse.h:
(WebCore::FetchResponse::create):

    Move inline create out of the class definition to make things a bit less crowded.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@221806 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 files changed:
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/DerivedSources.make
Source/WebCore/Modules/fetch/FetchBody.idl
Source/WebCore/Modules/fetch/FetchBodyConsumer.h
Source/WebCore/Modules/fetch/FetchBodySource.cpp
Source/WebCore/Modules/fetch/FetchHeaders.cpp
Source/WebCore/Modules/fetch/FetchHeaders.h
Source/WebCore/Modules/fetch/FetchHeaders.idl
Source/WebCore/Modules/fetch/FetchInternals.js [deleted file]
Source/WebCore/Modules/fetch/FetchResponse.cpp
Source/WebCore/Modules/fetch/FetchResponse.h
Source/WebCore/Modules/fetch/FetchResponse.idl
Source/WebCore/Modules/fetch/FetchResponse.js [deleted file]
Source/WebCore/WebCore.xcodeproj/project.pbxproj

index 9ad1cc2..70e1a7f 100644 (file)
@@ -3897,8 +3897,6 @@ add_dependencies(WebCoreTestSupportBindings WebCoreDerivedSources)
 # WebCore JS Builtins
 
 set(WebCore_BUILTINS_SOURCES
-    ${WEBCORE_DIR}/Modules/fetch/FetchInternals.js
-    ${WEBCORE_DIR}/Modules/fetch/FetchResponse.js
     ${WEBCORE_DIR}/Modules/mediastream/NavigatorUserMedia.js
     ${WEBCORE_DIR}/Modules/mediastream/RTCPeerConnection.js
     ${WEBCORE_DIR}/Modules/mediastream/RTCPeerConnectionInternals.js
index 6e7f266..9b1c913 100644 (file)
@@ -1,3 +1,65 @@
+2017-09-08  Sam Weinig  <sam@webkit.org>
+
+        Replace JS builtin implementation of the FetchResponse constructor with a C++ one
+        https://bugs.webkit.org/show_bug.cgi?id=176627
+
+        Reviewed by Alex Christensen.
+
+        Removes the last of the Fetch related JS builtin code.
+
+        * CMakeLists.txt:
+        * DerivedSources.make:
+        * WebCore.xcodeproj/project.pbxproj:
+        * Modules/fetch/FetchInternals.js: Removed.
+        * Modules/fetch/FetchResponse.js: Removed.
+        
+            Remove FetchInternals.js and FetchResponse.js.
+
+
+        * Modules/fetch/FetchBody.idl:
+        * Modules/fetch/FetchBodyConsumer.h:
+
+            Remove no longer correct FIXMEs.
+
+        * Modules/fetch/FetchBodySource.cpp:
+
+            Add missing newline between functions.
+
+        * Modules/fetch/FetchHeaders.idl:
+        * Modules/fetch/FetchResponse.idl:
+
+            Remove builtin related operations and extended attributes.
+
+        * Modules/fetch/FetchHeaders.h:
+        (WebCore::FetchHeaders::fastHas const):
+        * Modules/fetch/FetchHeaders.cpp:
+
+            Added fastHas to allow checking for a header using a HTTPHeaderName. Remove
+            now unused filter function.
+
+        * Modules/fetch/FetchResponse.cpp:
+        (WebCore::isNullBodyStatus):
+
+            Added helper predicate for 'null body status' concept.
+
+        (WebCore::FetchResponse::create):
+
+            Add spec defined constructor implementation.
+
+        (WebCore::FetchResponse::setBodyData):
+
+            Reformatted to match more common WTF::switchOn style.
+
+        (WebCore::FetchResponse::setStatus): Deleted.
+        (WebCore::FetchResponse::initializeWith): Deleted.
+
+            Removed now unused functions.
+
+        * Modules/fetch/FetchResponse.h:
+        (WebCore::FetchResponse::create):
+
+            Move inline create out of the class definition to make things a bit less crowded.
+
 2017-09-08  Said Abou-Hallawa  <sabouhallawa@apple.com>
 
         Implement HTMLImageElement.decoode() method
index bb16b51..db00c34 100644 (file)
@@ -1454,8 +1454,6 @@ CommandLineAPIModuleSource.h : CommandLineAPIModuleSource.js
 # WebCore JS Builtins
 
 WebCore_BUILTINS_SOURCES = \
-    $(WebCore)/Modules/fetch/FetchInternals.js \
-    $(WebCore)/Modules/fetch/FetchResponse.js \
     $(WebCore)/Modules/mediastream/NavigatorUserMedia.js \
     $(WebCore)/Modules/mediastream/RTCPeerConnection.js \
     $(WebCore)/Modules/mediastream/RTCPeerConnectionInternals.js \
index 50d89c0..a558d08 100644 (file)
@@ -32,7 +32,6 @@
     InterfaceName=Body,
     NoInterfaceObject
 ] interface FetchBody {
-    // FIMXE: Add missing body attribute.
     [ImplementedAs=readableStream, CallWith=ScriptState] readonly attribute ReadableStream? body;
     readonly attribute boolean bodyUsed;
     [NewObject] Promise<ArrayBuffer> arrayBuffer();
index 2ceff37..7a34054 100644 (file)
@@ -41,7 +41,6 @@ class ReadableStream;
 
 class FetchBodyConsumer {
 public:
-    // Type is used in FetchResponse.js and should be kept synchronized with it.
     enum class Type { None, ArrayBuffer, Blob, JSON, Text };
 
     FetchBodyConsumer(Type type) : m_type(type) { }
index 79459f3..237a460 100644 (file)
@@ -69,6 +69,7 @@ void FetchBodySource::close()
     controller().close();
     clean();
 }
+
 void FetchBodySource::error(const String& value)
 {
     controller().error(value);
index 172971b..c40cdd0 100644 (file)
@@ -169,14 +169,6 @@ ExceptionOr<void> FetchHeaders::set(const String& name, const String& value)
     return { };
 }
 
-void FetchHeaders::fill(const FetchHeaders* headers)
-{
-    ASSERT(m_guard != Guard::Immutable);
-    if (!headers)
-        return;
-    filterAndFill(headers->m_headers, m_guard);
-}
-
 void FetchHeaders::filterAndFill(const HTTPHeaderMap& headers, Guard guard)
 {
     for (auto& header : headers) {
index fee1f8f..cfb1d7e 100644 (file)
@@ -61,11 +61,10 @@ public:
 
     ExceptionOr<void> fill(const Init&);
     ExceptionOr<void> fill(const FetchHeaders&);
-
-    void fill(const FetchHeaders*);
     void filterAndFill(const HTTPHeaderMap&, Guard);
 
     String fastGet(HTTPHeaderName name) const { return m_headers.get(name); }
+    bool fastHas(HTTPHeaderName name) const { return m_headers.contains(name); }
     void fastSet(HTTPHeaderName name, const String& value) { m_headers.set(name, value); }
 
     class Iterator {
index 56238fa..fe1f1e8 100644 (file)
@@ -35,8 +35,6 @@ typedef (sequence<sequence<ByteString>> or record<ByteString, ByteString>) Heade
     InterfaceName=Headers,
     Constructor(optional HeadersInit init),
     ConstructorMayThrowException,
-    PrivateIdentifier,
-    PublicIdentifier,
 ] interface FetchHeaders {
     [MayThrowException] void append(ByteString name, ByteString value);
     [MayThrowException, ImplementedAs=remove] void delete(ByteString name);
@@ -45,7 +43,4 @@ typedef (sequence<sequence<ByteString>> or record<ByteString, ByteString>) Heade
     [MayThrowException] void set(ByteString name, ByteString value);
 
     iterable<ByteString, ByteString>;
-
-    [ImplementedAs=append, MayThrowException, PrivateIdentifier] void appendFromJS(ByteString name, ByteString value);
-    [ImplementedAs=fill, PrivateIdentifier] void fillFromJS(FetchHeaders? headers);
 };
diff --git a/Source/WebCore/Modules/fetch/FetchInternals.js b/Source/WebCore/Modules/fetch/FetchInternals.js
deleted file mode 100644 (file)
index a3878f1..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2016 Apple Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-// @internal
-
-function fillFetchHeaders(headers, headersInit)
-{
-    "use strict";
-
-    if (headersInit === @undefined)
-        return;
-
-    if (headersInit instanceof @Headers) {
-        @Headers.prototype.@fillFromJS.@call(headers, headersInit);
-        return;
-    }
-
-    if (@isArray(headersInit)) {
-        for (let i = 0; i < headersInit.length; i++) {
-            let header = headersInit[i];
-            if (header.length !== 2)
-                @throwTypeError("headersInit sequence items should contain two values");
-            @Headers.prototype.@appendFromJS.@call(headers, header[0], header[1]);
-        }
-        return this;
-    }
-
-    let propertyNames = @Object.@getOwnPropertyNames(headersInit);
-    for (let i = 0; i < propertyNames.length; ++i) {
-        let name = propertyNames[i];
-        @Headers.prototype.@appendFromJS.@call(headers, name, headersInit[name]);
-    }
-}
index 0897f48..f65cd2f 100644 (file)
@@ -42,6 +42,81 @@ static inline bool isRedirectStatus(int status)
     return status == 301 || status == 302 || status == 303 || status == 307 || status == 308;
 }
 
+// https://fetch.spec.whatwg.org/#null-body-status
+static inline bool isNullBodyStatus(int status)
+{
+    return status == 101 || status == 204 || status == 205 || status == 304;
+}
+
+ExceptionOr<Ref<FetchResponse>> FetchResponse::create(ScriptExecutionContext& context, std::optional<FetchBody::Init>&& body, Init&& init)
+{
+    // 1. If init’s status member is not in the range 200 to 599, inclusive, then throw a RangeError.
+    if (init.status < 200  || init.status > 599)
+        return Exception { RangeError, ASCIILiteral("Status must be between 200 and 599") };
+
+    // 2. If init’s statusText member does not match the reason-phrase token production, then throw a TypeError.
+    if (!isValidReasonPhrase(init.statusText))
+        return Exception { TypeError, ASCIILiteral("Status text must be a valid reason-phrase.") };
+
+    // 3. Let r be a new Response object associated with a new response.
+    // NOTE: Creation of the Response object is delayed until all potential exceptional cases are handled.
+    
+    // 4. Set r’s headers to a new Headers object, whose header list is r’s response’s header list, and guard is "response".
+    auto headers = FetchHeaders::create(FetchHeaders::Guard::Response);
+
+    // 5. Set r’s response’s status to init’s status member.
+    auto status = init.status;
+    
+    // 6. Set r’s response’s status message to init’s statusText member.
+    auto statusText = init.statusText;
+    
+    // 7. If init’s headers member is present, then fill r’s headers with init’s headers member.
+    if (init.headers) {
+        auto result = headers->fill(*init.headers);
+        if (result.hasException())
+            return result.releaseException();
+    }
+
+    std::optional<FetchBody> extractedBody;
+
+    // 8. If body is non-null, run these substeps:
+    if (body) {
+        // 8.1 If init’s status member is a null body status, then throw a TypeError.
+        //     (NOTE: 101 is included in null body status due to its use elsewhere. It does not affect this step.)
+        if (isNullBodyStatus(init.status))
+            return Exception { TypeError, ASCIILiteral("Response cannot have a body with the given status.") };
+
+        // 8.2 Let Content-Type be null.
+        String contentType;
+
+        // 8.3 Set r’s response’s body and Content-Type to the result of extracting body.
+        extractedBody = FetchBody::extract(context, WTFMove(*body), contentType);
+
+        // 8.4 If Content-Type is non-null and r’s response’s header list does not contain `Content-Type`, then append
+        //     `Content-Type`/Content-Type to r’s response’s header list.
+        if (!contentType.isNull() && !headers->fastHas(HTTPHeaderName::ContentType))
+            headers->fastSet(HTTPHeaderName::ContentType, contentType);
+    }
+
+    // 9. Set r’s MIME type to the result of extracting a MIME type from r’s response’s header list.
+    auto contentType = headers->fastGet(HTTPHeaderName::ContentType);
+
+    // 10. Set r’s response’s HTTPS state to current settings object’s HTTPS state.
+    // FIXME: Implement.
+
+    // 11. Resolve r’s trailer promise with a new Headers object whose guard is "immutable".
+    // FIXME: Implement.
+    
+    // 12. Return r.
+    auto r = adoptRef(*new FetchResponse(context, WTFMove(extractedBody), WTFMove(headers), { }));
+
+    r->m_contentType = contentType;
+    r->m_response.setHTTPStatusCode(status);
+    r->m_response.setHTTPStatusText(statusText);
+
+    return WTFMove(r);
+}
+
 Ref<FetchResponse> FetchResponse::error(ScriptExecutionContext& context)
 {
     auto response = adoptRef(*new FetchResponse(context, { }, FetchHeaders::create(FetchHeaders::Guard::Immutable), { }));
@@ -63,22 +138,6 @@ ExceptionOr<Ref<FetchResponse>> FetchResponse::redirect(ScriptExecutionContext&
     return WTFMove(redirectResponse);
 }
 
-ExceptionOr<void> FetchResponse::setStatus(int status, const String& statusText)
-{
-    if (!isValidReasonPhrase(statusText))
-        return Exception { TypeError };
-    m_response.setHTTPStatusCode(status);
-    m_response.setHTTPStatusText(statusText);
-    return { };
-}
-
-void FetchResponse::initializeWith(FetchBody::Init&& body)
-{
-    ASSERT(scriptExecutionContext());
-    extractBody(*scriptExecutionContext(), WTFMove(body));
-    updateContentType();
-}
-
 FetchResponse::FetchResponse(ScriptExecutionContext& context, std::optional<FetchBody>&& body, Ref<FetchHeaders>&& headers, ResourceResponse&& response)
     : FetchBodyOwner(context, WTFMove(body), WTFMove(headers))
     , m_response(WTFMove(response))
@@ -267,15 +326,20 @@ void FetchResponse::consumeBodyWhenLoaded(ConsumeDataCallback&& callback)
 
 void FetchResponse::setBodyData(ResponseData&& data)
 {
-    WTF::switchOn(data, [this](Ref<FormData>& formData) {
-        if (isBodyNull())
-            setBody({ });
-        body().setAsFormData(WTFMove(formData));
-    }, [this](Ref<SharedBuffer>& buffer) {
-        if (isBodyNull())
-            setBody({ });
-        body().consumer().setData(WTFMove(buffer));
-    }, [](std::nullptr_t&) { });
+    WTF::switchOn(data,
+        [this](Ref<FormData>& formData) {
+            if (isBodyNull())
+                setBody({ });
+            body().setAsFormData(WTFMove(formData));
+        },
+        [this](Ref<SharedBuffer>& buffer) {
+            if (isBodyNull())
+                setBody({ });
+            body().consumer().setData(WTFMove(buffer));
+        },
+        [](std::nullptr_t&) {
+        }
+    );
 }
 
 #if ENABLE(STREAMS_API)
index ca0a737..9f106c6 100644 (file)
@@ -53,12 +53,12 @@ public:
         std::optional<FetchHeaders::Init> headers;
     };
 
-    static Ref<FetchResponse> create(ScriptExecutionContext& context) { return adoptRef(*new FetchResponse(context, std::nullopt, FetchHeaders::create(FetchHeaders::Guard::Response), ResourceResponse())); }
+    static Ref<FetchResponse> create(ScriptExecutionContext&, std::optional<FetchBody>&&, Ref<FetchHeaders>&&, ResourceResponse&&);
+
+    static ExceptionOr<Ref<FetchResponse>> create(ScriptExecutionContext&, std::optional<FetchBody::Init>&&, Init&&);
     static Ref<FetchResponse> error(ScriptExecutionContext&);
     static ExceptionOr<Ref<FetchResponse>> redirect(ScriptExecutionContext&, const String& url, int status);
 
-    static Ref<FetchResponse> create(ScriptExecutionContext& context, std::optional<FetchBody>&& body, Ref<FetchHeaders>&& headers, ResourceResponse&& response) { return adoptRef(*new FetchResponse(context, WTFMove(body), WTFMove(headers), WTFMove(response))); }
-
     using NotificationCallback = WTF::Function<void(ExceptionOr<FetchResponse&>&&)>;
     static void fetch(ScriptExecutionContext&, FetchRequest&, NotificationCallback&&);
 
@@ -68,9 +68,6 @@ public:
     void finishConsumingStream(Ref<DeferredPromise>&&);
 #endif
 
-    ExceptionOr<void> setStatus(int status, const String& statusText);
-    void initializeWith(FetchBody::Init&&);
-
     Type type() const { return m_response.type(); }
     const String& url() const;
     bool redirected() const { return m_response.isRedirected(); }
@@ -143,4 +140,9 @@ private:
     mutable String m_responseURL;
 };
 
+inline Ref<FetchResponse> FetchResponse::create(ScriptExecutionContext& context, std::optional<FetchBody>&& body, Ref<FetchHeaders>&& headers, ResourceResponse&& response)
+{
+    return adoptRef(*new FetchResponse(context, WTFMove(body), WTFMove(headers), WTFMove(response)));
+}
+
 } // namespace WebCore
index b551586..e463fbb 100644 (file)
@@ -39,12 +39,12 @@ dictionary FetchResponseInit {
 
 [
     ActiveDOMObject,
+    Constructor(optional BodyInit? body = null, optional FetchResponseInit init),
     ConstructorCallWith=ScriptExecutionContext,
+    ConstructorMayThrowException,
     EnabledAtRuntime=FetchAPI,
     Exposed=(Window,Worker),
     InterfaceName=Response,
-    JSBuiltinConstructor,
-    // Constructor(optional BodyInit? body = null, optional FetchResponseInit init)
 ] interface FetchResponse {
     [CallWith=ScriptExecutionContext, NewObject] static FetchResponse error();
     [CallWith=ScriptExecutionContext, MayThrowException, NewObject] static FetchResponse redirect(USVString url, optional unsigned short status = 302);
@@ -61,9 +61,6 @@ dictionary FetchResponseInit {
     // readonly attribute Promise<Headers> trailer;
 
     [CallWith=ScriptExecutionContext, MayThrowException, NewObject] FetchResponse clone();
-
-    [MayThrowException, PrivateIdentifier] void setStatus(unsigned short status, DOMString statusText);
-    [PrivateIdentifier] void initializeWith(BodyInit body);
 };
 
 FetchResponse implements FetchBody;
diff --git a/Source/WebCore/Modules/fetch/FetchResponse.js b/Source/WebCore/Modules/fetch/FetchResponse.js
deleted file mode 100644 (file)
index 11b3097..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2016 Canon Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY CANON INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL CANON INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-function initializeFetchResponse(body, init)
-{
-    "use strict";
-
-    if (init === @undefined)
-        init = { };
-    else if (!@isObject(init))
-        @throwTypeError("Response init must be an object");
-
-    let status = (init.status !== @undefined) ? @toNumber(init.status) : 200;
-    if (status < 200  || status > 599)
-        @throwRangeError("Status must be between 200 and 599");
-
-    let statusText = (init.statusText !== @undefined) ? init.statusText : "OK";
-
-    this.@setStatus(status, statusText);
-
-    if (init.headers !== @undefined)
-        @fillFetchHeaders(this.headers, init.headers);
-
-    if (body !== @undefined && body !== null) {
-        if (status === 101 || status === 204 || status === 205 || status === 304)
-            @throwTypeError("Response cannot have a body with the given status");
-
-        this.@initializeWith(body);
-    }
-
-    return this;
-}
index 32207b0..5ed971f 100644 (file)
                416E29A6102FA962007FC14E /* WorkerReportingProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 416E29A5102FA962007FC14E /* WorkerReportingProxy.h */; };
                416E6FE81BBD12DF000A3F64 /* ReadableStreamInternalsBuiltins.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B03D8061BB3110D00B764D9 /* ReadableStreamInternalsBuiltins.h */; settings = {ATTRIBUTES = (Private, ); }; };
                416E6FE81BBD12DF000A3F65 /* JSDOMBindingInternalsBuiltins.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B03D8061BB3110D00B764DA /* JSDOMBindingInternalsBuiltins.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               416E6FE81BBD12DF000A6023 /* FetchInternalsBuiltins.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B03D8061BB3110D00B764B9 /* FetchInternalsBuiltins.h */; settings = {ATTRIBUTES = (Private, ); }; };
                416E6FE81BBD12DF000A6033 /* StreamInternalsBuiltins.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B03D8061BB3110D00B764C9 /* StreamInternalsBuiltins.h */; settings = {ATTRIBUTES = (Private, ); }; };
                416E6FE81BBD12DF000A6043 /* ReadableByteStreamInternalsBuiltins.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B03D8061BB3110D00B73F64 /* ReadableByteStreamInternalsBuiltins.h */; settings = {ATTRIBUTES = (Private, ); }; };
                416E6FE81BBD12DF000A6053 /* WritableStreamInternalsBuiltins.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B03D8061BB3110D00B764E9 /* WritableStreamInternalsBuiltins.h */; settings = {ATTRIBUTES = (Private, ); }; };
                413015D61C7B570400091C6E /* FetchResponse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FetchResponse.h; sourceTree = "<group>"; };
                413015D61C7B570400091C6F /* FetchBodySource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FetchBodySource.h; sourceTree = "<group>"; };
                413015D71C7B570400091C6E /* FetchResponse.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = FetchResponse.idl; sourceTree = "<group>"; };
-               413015D81C7B570400091C6E /* FetchResponse.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = FetchResponse.js; sourceTree = "<group>"; };
                41380C201F34368A00155FDA /* DOMCache.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = DOMCache.cpp; path = Modules/cache/DOMCache.cpp; sourceTree = SOURCE_ROOT; };
                41380C211F34368D00155FDA /* CacheStorage.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = CacheStorage.cpp; path = Modules/cache/CacheStorage.cpp; sourceTree = SOURCE_ROOT; };
                41380C221F34369000155FDA /* CacheStorage.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = CacheStorage.h; path = Modules/cache/CacheStorage.h; sourceTree = SOURCE_ROOT; };
                41CAD71D1EA0905700178164 /* VideoToolBoxEncoderFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VideoToolBoxEncoderFactory.h; path = libwebrtc/VideoToolBoxEncoderFactory.h; sourceTree = "<group>"; };
                41CF8BE41D46222000707DC9 /* FetchBodyConsumer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FetchBodyConsumer.cpp; sourceTree = "<group>"; };
                41CF8BE51D46222000707DC9 /* FetchBodyConsumer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FetchBodyConsumer.h; sourceTree = "<group>"; };
-               41CF8BE61D46222C00707DC9 /* FetchInternals.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = FetchInternals.js; sourceTree = "<group>"; };
                41D015C80F4B5C71004A662F /* ContentType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContentType.h; sourceTree = "<group>"; };
                41D015C90F4B5C71004A662F /* ContentType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ContentType.cpp; sourceTree = "<group>"; };
                41D129C91F3D0EE300D15E47 /* CacheStorageConnection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CacheStorageConnection.cpp; sourceTree = "<group>"; };
                9908B0F91BCAD07D00ED0F75 /* WritableStreamBuiltins.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WritableStreamBuiltins.cpp; sourceTree = "<group>"; };
                9908B0FA1BCAD07D00ED0F65 /* ReadableStreamDefaultControllerBuiltins.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ReadableStreamDefaultControllerBuiltins.cpp; sourceTree = "<group>"; };
                9908B0FB1BCAD07D00ED0F65 /* ReadableStreamDefaultControllerBuiltins.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReadableStreamDefaultControllerBuiltins.h; sourceTree = "<group>"; };
-               9908B0FD1BCAD07D00ED0F45 /* FetchInternalsBuiltins.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FetchInternalsBuiltins.cpp; sourceTree = "<group>"; };
                9908B0FD1BCAD07D00ED0F55 /* StreamInternalsBuiltins.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StreamInternalsBuiltins.cpp; sourceTree = "<group>"; };
                9908B0FD1BCAD07D00ED0F65 /* ReadableStreamInternalsBuiltins.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ReadableStreamInternalsBuiltins.cpp; sourceTree = "<group>"; };
                9908B0FD1BCAD07D00ED0F66 /* JSDOMBindingInternalsBuiltins.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMBindingInternalsBuiltins.cpp; sourceTree = "<group>"; };
                9AB1F37E18E2489A00534743 /* CSSToLengthConversionData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSToLengthConversionData.h; sourceTree = "<group>"; };
                9AB1F37F18E2489A00534743 /* CSSToLengthConversionData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSToLengthConversionData.cpp; sourceTree = "<group>"; };
                9B03D8061BB3110D00B73F64 /* ReadableByteStreamInternalsBuiltins.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReadableByteStreamInternalsBuiltins.h; sourceTree = "<group>"; };
-               9B03D8061BB3110D00B764B9 /* FetchInternalsBuiltins.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FetchInternalsBuiltins.h; sourceTree = "<group>"; };
                9B03D8061BB3110D00B764C9 /* StreamInternalsBuiltins.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StreamInternalsBuiltins.h; sourceTree = "<group>"; };
                9B03D8061BB3110D00B764D8 /* ReadableStreamBuiltins.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReadableStreamBuiltins.h; sourceTree = "<group>"; };
                9B03D8061BB3110D00B764D9 /* ReadableStreamInternalsBuiltins.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReadableStreamInternalsBuiltins.h; sourceTree = "<group>"; };
                                41F54F821C50C4F600338488 /* FetchHeaders.cpp */,
                                41F54F831C50C4F600338488 /* FetchHeaders.h */,
                                41F54F841C50C4F600338488 /* FetchHeaders.idl */,
-                               41CF8BE61D46222C00707DC9 /* FetchInternals.js */,
                                4147E2B41C89912600A7E715 /* FetchLoader.cpp */,
                                4147E2B51C89912600A7E715 /* FetchLoader.h */,
                                4147E2B61C89912600A7E715 /* FetchLoaderClient.h */,
                                413015D51C7B570400091C6E /* FetchResponse.cpp */,
                                413015D61C7B570400091C6E /* FetchResponse.h */,
                                413015D71C7B570400091C6E /* FetchResponse.idl */,
-                               413015D81C7B570400091C6E /* FetchResponse.js */,
                                418C39571C8DD6960051C8A3 /* WorkerGlobalScopeFetch.cpp */,
                                418C39581C8DD6960051C8A3 /* WorkerGlobalScopeFetch.h */,
                                418C39591C8DD6960051C8A3 /* WorkerGlobalScopeFetch.idl */,
                                970B7289144FFAC600F00A37 /* EventInterfaces.h */,
                                97AA3CA3145237CC003E1DA6 /* EventTargetHeaders.h */,
                                97AA3CA4145237CC003E1DA6 /* EventTargetInterfaces.h */,
-                               9908B0FD1BCAD07D00ED0F45 /* FetchInternalsBuiltins.cpp */,
-                               9B03D8061BB3110D00B764B9 /* FetchInternalsBuiltins.h */,
                                A17C81200F2A5CF7005DAAEB /* HTMLElementFactory.cpp */,
                                A17C81210F2A5CF7005DAAEB /* HTMLElementFactory.h */,
                                B562DB5E17D3CD560010AF96 /* HTMLElementTypeHelpers.h */,
                                84730D891248F0B300D3A9C9 /* FESpecularLighting.h in Headers */,
                                4129C9971F59B963009D7403 /* FetchBodySource.h in Headers */,
                                41D129DB1F3D143800D15E47 /* FetchHeaders.h in Headers */,
-                               416E6FE81BBD12DF000A6023 /* FetchInternalsBuiltins.h in Headers */,
                                41AD753A1CEF6BD100A31486 /* FetchOptions.h in Headers */,
                                7CE1914D1F2A9AFB00272F78 /* FetchReferrerPolicy.h in Headers */,
                                7CE1915A1F2A9B3400272F78 /* FetchRequestCache.h in Headers */,