<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[197744] trunk/Source/WebCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/197744">197744</a></dd>
<dt>Author</dt> <dd>youenn.fablet@crf.canon.fr</dd>
<dt>Date</dt> <dd>2016-03-08 01:10:09 -0800 (Tue, 08 Mar 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>[Fetch API] Make FetchRequest and FetchResponse ActiveDOMObject
https://bugs.webkit.org/show_bug.cgi?id=154729

Reviewed by Darin Adler.

Covered by existing tests.

Making FetchRequest and FetchResponse ActiveDOMObject.
Both objects can always be suspended now.
This might be updated when blob conversion is added or when fetching data to fill in FetchResponse.

* Modules/fetch/FetchRequest.cpp:
(WebCore::FetchRequest::create):
(WebCore::FetchRequest::clone):
(WebCore::FetchRequest::activeDOMObjectName):
(WebCore::FetchRequest::canSuspendForDocumentSuspension):
* Modules/fetch/FetchRequest.h:
(WebCore::FetchRequest::FetchRequest):
* Modules/fetch/FetchRequest.idl:
* Modules/fetch/FetchResponse.cpp:
(WebCore::FetchResponse::error):
(WebCore::FetchResponse::redirect):
(WebCore::FetchResponse::FetchResponse):
(WebCore::FetchResponse::clone):
(WebCore::FetchResponse::activeDOMObjectName):
(WebCore::FetchResponse::canSuspendForDocumentSuspension):
* Modules/fetch/FetchResponse.h:
(WebCore::FetchResponse::create):
* Modules/fetch/FetchResponse.idl:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesfetchFetchRequestcpp">trunk/Source/WebCore/Modules/fetch/FetchRequest.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesfetchFetchRequesth">trunk/Source/WebCore/Modules/fetch/FetchRequest.h</a></li>
<li><a href="#trunkSourceWebCoreModulesfetchFetchRequestidl">trunk/Source/WebCore/Modules/fetch/FetchRequest.idl</a></li>
<li><a href="#trunkSourceWebCoreModulesfetchFetchResponsecpp">trunk/Source/WebCore/Modules/fetch/FetchResponse.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesfetchFetchResponseh">trunk/Source/WebCore/Modules/fetch/FetchResponse.h</a></li>
<li><a href="#trunkSourceWebCoreModulesfetchFetchResponseidl">trunk/Source/WebCore/Modules/fetch/FetchResponse.idl</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (197743 => 197744)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-03-08 09:08:11 UTC (rev 197743)
+++ trunk/Source/WebCore/ChangeLog        2016-03-08 09:10:09 UTC (rev 197744)
</span><span class="lines">@@ -1,3 +1,35 @@
</span><ins>+2016-03-08  Youenn Fablet  &lt;youenn.fablet@crf.canon.fr&gt;
+
+        [Fetch API] Make FetchRequest and FetchResponse ActiveDOMObject
+        https://bugs.webkit.org/show_bug.cgi?id=154729
+
+        Reviewed by Darin Adler.
+
+        Covered by existing tests.
+
+        Making FetchRequest and FetchResponse ActiveDOMObject.
+        Both objects can always be suspended now.
+        This might be updated when blob conversion is added or when fetching data to fill in FetchResponse.
+
+        * Modules/fetch/FetchRequest.cpp:
+        (WebCore::FetchRequest::create):
+        (WebCore::FetchRequest::clone):
+        (WebCore::FetchRequest::activeDOMObjectName):
+        (WebCore::FetchRequest::canSuspendForDocumentSuspension):
+        * Modules/fetch/FetchRequest.h:
+        (WebCore::FetchRequest::FetchRequest):
+        * Modules/fetch/FetchRequest.idl:
+        * Modules/fetch/FetchResponse.cpp:
+        (WebCore::FetchResponse::error):
+        (WebCore::FetchResponse::redirect):
+        (WebCore::FetchResponse::FetchResponse):
+        (WebCore::FetchResponse::clone):
+        (WebCore::FetchResponse::activeDOMObjectName):
+        (WebCore::FetchResponse::canSuspendForDocumentSuspension):
+        * Modules/fetch/FetchResponse.h:
+        (WebCore::FetchResponse::create):
+        * Modules/fetch/FetchResponse.idl:
+
</ins><span class="cx"> 2016-03-08  Nikos Andronikos  &lt;nikos.andronikos-webkit@cisra.canon.com.au&gt;
</span><span class="cx"> 
</span><span class="cx">         [SVG2] Implement marker orient='auto-start-reverse'
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesfetchFetchRequestcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/fetch/FetchRequest.cpp (197743 => 197744)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/fetch/FetchRequest.cpp        2016-03-08 09:08:11 UTC (rev 197743)
+++ trunk/Source/WebCore/Modules/fetch/FetchRequest.cpp        2016-03-08 09:10:09 UTC (rev 197744)
</span><span class="lines">@@ -266,7 +266,7 @@
</span><span class="cx">         return nullptr;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    return adoptRef(*new FetchRequest(WTFMove(body), headers.releaseNonNull(), WTFMove(internalRequest)));
</del><ins>+    return adoptRef(*new FetchRequest(context, WTFMove(body), headers.releaseNonNull(), WTFMove(internalRequest)));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> RefPtr&lt;FetchRequest&gt; FetchRequest::create(ScriptExecutionContext&amp; context, FetchRequest* input, const Dictionary&amp; init, ExceptionCode&amp; ec)
</span><span class="lines">@@ -297,7 +297,7 @@
</span><span class="cx">         return nullptr;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    return adoptRef(*new FetchRequest(WTFMove(body), headers.releaseNonNull(), WTFMove(internalRequest)));
</del><ins>+    return adoptRef(*new FetchRequest(context, WTFMove(body), headers.releaseNonNull(), WTFMove(internalRequest)));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> String FetchRequest::type() const
</span><span class="lines">@@ -435,7 +435,7 @@
</span><span class="cx">     return String();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-RefPtr&lt;FetchRequest&gt; FetchRequest::clone(ExceptionCode&amp; ec)
</del><ins>+RefPtr&lt;FetchRequest&gt; FetchRequest::clone(ScriptExecutionContext* context, ExceptionCode&amp; ec)
</ins><span class="cx"> {
</span><span class="cx">     if (isDisturbed()) {
</span><span class="cx">         ec = TypeError;
</span><span class="lines">@@ -443,9 +443,19 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // FIXME: Validate body teeing.
</span><del>-    return adoptRef(*new FetchRequest(FetchBody(m_body), FetchHeaders::create(m_headers.get()), FetchRequest::InternalRequest(m_internalRequest)));
</del><ins>+    return adoptRef(*new FetchRequest(*context, FetchBody(m_body), FetchHeaders::create(m_headers.get()), FetchRequest::InternalRequest(m_internalRequest)));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+const char* FetchRequest::activeDOMObjectName() const
+{
+    return &quot;Request&quot;;
+}
+
+bool FetchRequest::canSuspendForDocumentSuspension() const
+{
+    return true;
+}
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(FETCH_API)
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesfetchFetchRequesth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/fetch/FetchRequest.h (197743 => 197744)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/fetch/FetchRequest.h        2016-03-08 09:08:11 UTC (rev 197743)
+++ trunk/Source/WebCore/Modules/fetch/FetchRequest.h        2016-03-08 09:10:09 UTC (rev 197744)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(FETCH_API)
</span><span class="cx"> 
</span><ins>+#include &quot;ActiveDOMObject.h&quot;
</ins><span class="cx"> #include &quot;FetchBody.h&quot;
</span><span class="cx"> #include &quot;FetchHeaders.h&quot;
</span><span class="cx"> #include &quot;FetchOptions.h&quot;
</span><span class="lines">@@ -43,7 +44,7 @@
</span><span class="cx"> 
</span><span class="cx"> typedef int ExceptionCode;
</span><span class="cx"> 
</span><del>-class FetchRequest : public RefCounted&lt;FetchRequest&gt; {
</del><ins>+class FetchRequest final : public RefCounted&lt;FetchRequest&gt;, public ActiveDOMObject {
</ins><span class="cx"> public:
</span><span class="cx">     static RefPtr&lt;FetchRequest&gt; create(ScriptExecutionContext&amp;, FetchRequest*, const Dictionary&amp;, ExceptionCode&amp;);
</span><span class="cx">     static RefPtr&lt;FetchRequest&gt; create(ScriptExecutionContext&amp;, const String&amp;, const Dictionary&amp;, ExceptionCode&amp;);
</span><span class="lines">@@ -63,7 +64,7 @@
</span><span class="cx">     String redirect() const;
</span><span class="cx">     const String&amp; integrity() const { return m_internalRequest.integrity; }
</span><span class="cx"> 
</span><del>-    RefPtr&lt;FetchRequest&gt; clone(ExceptionCode&amp;);
</del><ins>+    RefPtr&lt;FetchRequest&gt; clone(ScriptExecutionContext*, ExceptionCode&amp;);
</ins><span class="cx"> 
</span><span class="cx">     // Body API
</span><span class="cx">     bool isDisturbed() const { return m_body.isDisturbed(); }
</span><span class="lines">@@ -83,18 +84,24 @@
</span><span class="cx">     FetchBody&amp; body() { return m_body; }
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    FetchRequest(FetchBody&amp;&amp;, Ref&lt;FetchHeaders&gt;&amp;&amp;, InternalRequest&amp;&amp;);
</del><ins>+    FetchRequest(ScriptExecutionContext&amp;, FetchBody&amp;&amp;, Ref&lt;FetchHeaders&gt;&amp;&amp;, InternalRequest&amp;&amp;);
</ins><span class="cx"> 
</span><ins>+    // ActiveDOMObject API.
+    const char* activeDOMObjectName() const final;
+    bool canSuspendForDocumentSuspension() const final;
+
</ins><span class="cx">     FetchBody m_body;
</span><span class="cx">     Ref&lt;FetchHeaders&gt; m_headers;
</span><span class="cx">     InternalRequest m_internalRequest;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-inline FetchRequest::FetchRequest(FetchBody&amp;&amp; body, Ref&lt;FetchHeaders&gt;&amp;&amp; headers, InternalRequest&amp;&amp; internalRequest)
-    : m_body(WTFMove(body))
</del><ins>+inline FetchRequest::FetchRequest(ScriptExecutionContext&amp; context, FetchBody&amp;&amp; body, Ref&lt;FetchHeaders&gt;&amp;&amp; headers, InternalRequest&amp;&amp; internalRequest)
+    : ActiveDOMObject(&amp;context)
+    , m_body(WTFMove(body))
</ins><span class="cx">     , m_headers(WTFMove(headers))
</span><span class="cx">     , m_internalRequest(WTFMove(internalRequest))
</span><span class="cx"> {
</span><ins>+    suspendIfNeeded();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesfetchFetchRequestidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/fetch/FetchRequest.idl (197743 => 197744)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/fetch/FetchRequest.idl        2016-03-08 09:08:11 UTC (rev 197743)
+++ trunk/Source/WebCore/Modules/fetch/FetchRequest.idl        2016-03-08 09:10:09 UTC (rev 197744)
</span><span class="lines">@@ -35,13 +35,13 @@
</span><span class="cx"> enum ReferrerPolicy { &quot;&quot;, &quot;no-referrer&quot;,  &quot;no-referrer-when-downgrade&quot;, &quot;origin-only&quot;, &quot;origin-when-cross-origin&quot;, &quot;unsafe-url&quot; };
</span><span class="cx"> 
</span><span class="cx"> [
</span><ins>+    ActiveDOMObject,
</ins><span class="cx">     Conditional=FETCH_API,
</span><span class="cx">     ConstructorCallWith=ScriptExecutionContext,
</span><span class="cx">     ConstructorRaisesException,
</span><span class="cx">     Constructor(FetchRequest input, [Default=Undefined] optional Dictionary init),
</span><span class="cx">     Constructor(DOMString input, [Default=Undefined]  optional Dictionary init),
</span><span class="cx">     GlobalContext=DOMWindow&amp;WorkerGlobalScope,
</span><del>-    ImplementationLacksVTable,
</del><span class="cx">     InterfaceName=Request
</span><span class="cx"> ]
</span><span class="cx"> interface FetchRequest {
</span><span class="lines">@@ -59,6 +59,6 @@
</span><span class="cx">     readonly attribute RequestRedirect redirect;
</span><span class="cx">     readonly attribute DOMString integrity;
</span><span class="cx"> 
</span><del>-    [RaisesException, NewObject] FetchRequest clone();
</del><ins>+    [NewObject, CallWith=ScriptExecutionContext, RaisesException] FetchRequest clone();
</ins><span class="cx"> };
</span><span class="cx"> FetchRequest implements FetchBody;
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesfetchFetchResponsecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/fetch/FetchResponse.cpp (197743 => 197744)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/fetch/FetchResponse.cpp        2016-03-08 09:08:11 UTC (rev 197743)
+++ trunk/Source/WebCore/Modules/fetch/FetchResponse.cpp        2016-03-08 09:10:09 UTC (rev 197744)
</span><span class="lines">@@ -48,9 +48,9 @@
</span><span class="cx">     return status == 101 || status == 204 || status == 205 || status == 304;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-Ref&lt;FetchResponse&gt; FetchResponse::error()
</del><ins>+Ref&lt;FetchResponse&gt; FetchResponse::error(ScriptExecutionContext* context)
</ins><span class="cx"> {
</span><del>-    return adoptRef(*new FetchResponse(Type::Error, { }, FetchHeaders::create(FetchHeaders::Guard::Immutable), ResourceResponse()));
</del><ins>+    return adoptRef(*new FetchResponse(*context, Type::Error, { }, FetchHeaders::create(FetchHeaders::Guard::Immutable), ResourceResponse()));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> RefPtr&lt;FetchResponse&gt; FetchResponse::redirect(ScriptExecutionContext* context, const String&amp; url, int status, ExceptionCode&amp; ec)
</span><span class="lines">@@ -65,7 +65,7 @@
</span><span class="cx">         ec = TypeError;
</span><span class="cx">         return nullptr;
</span><span class="cx">     }
</span><del>-    RefPtr&lt;FetchResponse&gt; redirectResponse = adoptRef(*new FetchResponse(Type::Default, { }, FetchHeaders::create(FetchHeaders::Guard::Immutable), ResourceResponse()));
</del><ins>+    RefPtr&lt;FetchResponse&gt; redirectResponse = adoptRef(*new FetchResponse(*context, Type::Default, { }, FetchHeaders::create(FetchHeaders::Guard::Immutable), ResourceResponse()));
</ins><span class="cx">     redirectResponse-&gt;m_response.setHTTPStatusCode(status);
</span><span class="cx">     redirectResponse-&gt;m_headers-&gt;fastSet(HTTPHeaderName::Location, requestURL.string());
</span><span class="cx">     return redirectResponse;
</span><span class="lines">@@ -108,21 +108,23 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-FetchResponse::FetchResponse(Type type, FetchBody&amp;&amp; body, Ref&lt;FetchHeaders&gt;&amp;&amp; headers, ResourceResponse&amp;&amp; response)
-    : m_type(type)
</del><ins>+FetchResponse::FetchResponse(ScriptExecutionContext&amp; context, Type type, FetchBody&amp;&amp; body, Ref&lt;FetchHeaders&gt;&amp;&amp; headers, ResourceResponse&amp;&amp; response)
+    : ActiveDOMObject(&amp;context)
+    , m_type(type)
</ins><span class="cx">     , m_response(WTFMove(response))
</span><span class="cx">     , m_body(WTFMove(body))
</span><span class="cx">     , m_headers(WTFMove(headers))
</span><span class="cx"> {
</span><ins>+    suspendIfNeeded();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-RefPtr&lt;FetchResponse&gt; FetchResponse::clone(ExceptionCode&amp; ec)
</del><ins>+RefPtr&lt;FetchResponse&gt; FetchResponse::clone(ScriptExecutionContext* context, ExceptionCode&amp; ec)
</ins><span class="cx"> {
</span><span class="cx">     if (m_body.isDisturbed() || m_isLocked) {
</span><span class="cx">         ec = TypeError;
</span><span class="cx">         return nullptr;
</span><span class="cx">     }
</span><del>-    RefPtr&lt;FetchResponse&gt; cloned = adoptRef(*new FetchResponse(m_type, FetchBody(m_body), FetchHeaders::create(headers()), ResourceResponse(m_response)));
</del><ins>+    RefPtr&lt;FetchResponse&gt; cloned = adoptRef(*new FetchResponse(*context, m_type, FetchBody(m_body), FetchHeaders::create(headers()), ResourceResponse(m_response)));
</ins><span class="cx">     cloned-&gt;m_isRedirected = m_isRedirected;
</span><span class="cx">     return cloned;
</span><span class="cx"> }
</span><span class="lines">@@ -153,6 +155,16 @@
</span><span class="cx">     return JSC::jsNull();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+const char* FetchResponse::activeDOMObjectName() const
+{
+    return &quot;Response&quot;;
+}
+
+bool FetchResponse::canSuspendForDocumentSuspension() const
+{
+    return true;
+}
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(FETCH_API)
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesfetchFetchResponseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/fetch/FetchResponse.h (197743 => 197744)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/fetch/FetchResponse.h        2016-03-08 09:08:11 UTC (rev 197743)
+++ trunk/Source/WebCore/Modules/fetch/FetchResponse.h        2016-03-08 09:10:09 UTC (rev 197744)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(FETCH_API)
</span><span class="cx"> 
</span><ins>+#include &quot;ActiveDOMObject.h&quot;
</ins><span class="cx"> #include &quot;FetchBody.h&quot;
</span><span class="cx"> #include &quot;FetchHeaders.h&quot;
</span><span class="cx"> #include &quot;ResourceResponse.h&quot;
</span><span class="lines">@@ -45,10 +46,10 @@
</span><span class="cx"> 
</span><span class="cx"> typedef int ExceptionCode;
</span><span class="cx"> 
</span><del>-class FetchResponse : public RefCounted&lt;FetchResponse&gt; {
</del><ins>+class FetchResponse final : public RefCounted&lt;FetchResponse&gt;, public ActiveDOMObject {
</ins><span class="cx"> public:
</span><del>-    static Ref&lt;FetchResponse&gt; create() { return adoptRef(*new FetchResponse(Type::Default, { }, FetchHeaders::create(FetchHeaders::Guard::Response), ResourceResponse())); }
-    static Ref&lt;FetchResponse&gt; error();
</del><ins>+    static Ref&lt;FetchResponse&gt; create(ScriptExecutionContext&amp; context) { return adoptRef(*new FetchResponse(context, Type::Default, { }, FetchHeaders::create(FetchHeaders::Guard::Response), ResourceResponse())); }
+    static Ref&lt;FetchResponse&gt; error(ScriptExecutionContext*);
</ins><span class="cx">     static RefPtr&lt;FetchResponse&gt; redirect(ScriptExecutionContext*, const String&amp;, int, ExceptionCode&amp;);
</span><span class="cx">     // FIXME: Binding generator should not require below method to handle optional status parameter.
</span><span class="cx">     static RefPtr&lt;FetchResponse&gt; redirect(ScriptExecutionContext* context, const String&amp; url, ExceptionCode&amp; ec) { return redirect(context, url, 302, ec); }
</span><span class="lines">@@ -63,7 +64,7 @@
</span><span class="cx">     const String&amp; statusText() const { return m_response.httpStatusText(); }
</span><span class="cx"> 
</span><span class="cx">     FetchHeaders&amp; headers() { return m_headers; }
</span><del>-    RefPtr&lt;FetchResponse&gt; clone(ExceptionCode&amp;);
</del><ins>+    RefPtr&lt;FetchResponse&gt; clone(ScriptExecutionContext*, ExceptionCode&amp;);
</ins><span class="cx"> 
</span><span class="cx">     // Body API
</span><span class="cx">     bool isDisturbed() const { return m_body.isDisturbed(); }
</span><span class="lines">@@ -76,8 +77,12 @@
</span><span class="cx"> private:
</span><span class="cx">     enum class Type { Basic, Cors, Default, Error, Opaque, OpaqueRedirect };
</span><span class="cx"> 
</span><del>-    FetchResponse(Type, FetchBody&amp;&amp;, Ref&lt;FetchHeaders&gt;&amp;&amp;, ResourceResponse&amp;&amp;);
</del><ins>+    FetchResponse(ScriptExecutionContext&amp;, Type, FetchBody&amp;&amp;, Ref&lt;FetchHeaders&gt;&amp;&amp;, ResourceResponse&amp;&amp;);
</ins><span class="cx"> 
</span><ins>+    // ActiveDOMObject API
+    const char* activeDOMObjectName() const final;
+    bool canSuspendForDocumentSuspension() const final;
+
</ins><span class="cx">     Type m_type;
</span><span class="cx">     ResourceResponse m_response;
</span><span class="cx">     FetchBody m_body;
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesfetchFetchResponseidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/fetch/FetchResponse.idl (197743 => 197744)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/fetch/FetchResponse.idl        2016-03-08 09:08:11 UTC (rev 197743)
+++ trunk/Source/WebCore/Modules/fetch/FetchResponse.idl        2016-03-08 09:10:09 UTC (rev 197744)
</span><span class="lines">@@ -28,16 +28,17 @@
</span><span class="cx"> enum ResponseType { &quot;basic&quot;, &quot;cors&quot;, &quot;default&quot;, &quot;error&quot;, &quot;opaque&quot;, &quot;opaqueredirect&quot; };
</span><span class="cx"> 
</span><span class="cx"> [
</span><ins>+    ActiveDOMObject,
</ins><span class="cx">     Conditional=FETCH_API,
</span><ins>+    ConstructorCallWith=ScriptExecutionContext,
</ins><span class="cx">     GlobalContext=DOMWindow&amp;WorkerGlobalScope,
</span><del>-    ImplementationLacksVTable,
</del><span class="cx">     InterfaceName=Response,
</span><span class="cx">     JSBuiltinConstructor
</span><span class="cx"> ]
</span><span class="cx"> interface FetchResponse {
</span><span class="cx">     // FIXME: NewObject does not seem to be supported for static methods.
</span><del>-    static FetchResponse error();
-    [RaisesException, CallWith=ScriptExecutionContext] static FetchResponse redirect(DOMString url, optional unsigned short status = 302);
</del><ins>+    [CallWith=ScriptExecutionContext] static FetchResponse error();
+    [CallWith=ScriptExecutionContext, RaisesException] static FetchResponse redirect(DOMString url, optional unsigned short status = 302);
</ins><span class="cx"> 
</span><span class="cx">     readonly attribute ResponseType type;
</span><span class="cx"> 
</span><span class="lines">@@ -50,7 +51,7 @@
</span><span class="cx">     readonly attribute FetchHeaders headers;
</span><span class="cx">     [Custom, RaisesException] readonly attribute ReadableStream? body;
</span><span class="cx"> 
</span><del>-    [NewObject, RaisesException] FetchResponse clone();
</del><ins>+    [NewObject, CallWith=ScriptExecutionContext, RaisesException] FetchResponse clone();
</ins><span class="cx"> 
</span><span class="cx">     [Private, RaisesException] void initializeWith(Dictionary parameters);
</span><span class="cx"> };
</span></span></pre>
</div>
</div>

</body>
</html>