<!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>[209231] 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/209231">209231</a></dd>
<dt>Author</dt> <dd>darin@apple.com</dd>
<dt>Date</dt> <dd>2016-12-01 21:31:07 -0800 (Thu, 01 Dec 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Stop using WebCore::Dictionary in bindings for Fetch
https://bugs.webkit.org/show_bug.cgi?id=165241

Reviewed by Chris Dumez.

* Modules/fetch/DOMWindowFetch.idl: Use RequestInit instead of Dictionary.
No effect on code generated since this is a JSBuiltin.

* Modules/fetch/FetchRequest.cpp:
(WebCore::setReferrerPolicy): Deleted. Bindings handle this now.
(WebCore::setMode): Ditto.
(WebCore::setCredentials): Ditto.
(WebCore::setCache): Ditto.
(WebCore::setRedirect): Ditto.
(WebCore::setReferrer): Changed argument from Dictionary to String.
(WebCore::buildOptions): Changed argument from Dictionary to FetchRequest::Init,
and simplified the code accordingly.
(WebCore::FetchRequest::initializeOptions): Ditto.
(WebCore::FetchRequest::initializeWith): Ditto.
* Modules/fetch/FetchRequest.h: Updated for above changes. Also added the Init struct.

* Modules/fetch/FetchRequest.idl: Added missing &quot;only-if-cached&quot; value to RequestCache.
Added RequestInit dictionary and used it instead of Dictionary. Used more-specific string
types for the method and referrer attributes; no effect at runtime, since the code for
getters is the same for ByteString, USVString, and DOMString and these are read-only.

* Modules/fetch/WorkerGlobalScopeFetch.idl: Use RequestInit instead of Dictionary.
No effect on code generated since this is a JSBuiltin.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesfetchDOMWindowFetchidl">trunk/Source/WebCore/Modules/fetch/DOMWindowFetch.idl</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="#trunkSourceWebCoreModulesfetchWorkerGlobalScopeFetchidl">trunk/Source/WebCore/Modules/fetch/WorkerGlobalScopeFetch.idl</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (209230 => 209231)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-12-02 03:30:37 UTC (rev 209230)
+++ trunk/Source/WebCore/ChangeLog        2016-12-02 05:31:07 UTC (rev 209231)
</span><span class="lines">@@ -1,3 +1,34 @@
</span><ins>+2016-11-30  Darin Adler  &lt;darin@apple.com&gt;
+
+        Stop using WebCore::Dictionary in bindings for Fetch
+        https://bugs.webkit.org/show_bug.cgi?id=165241
+
+        Reviewed by Chris Dumez.
+
+        * Modules/fetch/DOMWindowFetch.idl: Use RequestInit instead of Dictionary.
+        No effect on code generated since this is a JSBuiltin.
+
+        * Modules/fetch/FetchRequest.cpp:
+        (WebCore::setReferrerPolicy): Deleted. Bindings handle this now.
+        (WebCore::setMode): Ditto.
+        (WebCore::setCredentials): Ditto.
+        (WebCore::setCache): Ditto.
+        (WebCore::setRedirect): Ditto.
+        (WebCore::setReferrer): Changed argument from Dictionary to String.
+        (WebCore::buildOptions): Changed argument from Dictionary to FetchRequest::Init,
+        and simplified the code accordingly.
+        (WebCore::FetchRequest::initializeOptions): Ditto.
+        (WebCore::FetchRequest::initializeWith): Ditto.
+        * Modules/fetch/FetchRequest.h: Updated for above changes. Also added the Init struct.
+
+        * Modules/fetch/FetchRequest.idl: Added missing &quot;only-if-cached&quot; value to RequestCache.
+        Added RequestInit dictionary and used it instead of Dictionary. Used more-specific string
+        types for the method and referrer attributes; no effect at runtime, since the code for
+        getters is the same for ByteString, USVString, and DOMString and these are read-only.
+
+        * Modules/fetch/WorkerGlobalScopeFetch.idl: Use RequestInit instead of Dictionary.
+        No effect on code generated since this is a JSBuiltin.
+
</ins><span class="cx"> 2016-12-01  Jiewen Tan  &lt;jiewen_tan@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Add a runtime flag for SubtleCrypto
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesfetchDOMWindowFetchidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/fetch/DOMWindowFetch.idl (209230 => 209231)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/fetch/DOMWindowFetch.idl        2016-12-02 03:30:37 UTC (rev 209230)
+++ trunk/Source/WebCore/Modules/fetch/DOMWindowFetch.idl        2016-12-02 05:31:07 UTC (rev 209231)
</span><span class="lines">@@ -30,7 +30,6 @@
</span><span class="cx">     Conditional=FETCH_API,
</span><span class="cx">     EnabledAtRuntime=FetchAPI,
</span><span class="cx"> ] partial interface DOMWindow {
</span><del>-    [JSBuiltin] Promise&lt;Response&gt; fetch(any input, optional Dictionary init);
-
</del><ins>+    [JSBuiltin] Promise&lt;Response&gt; fetch(any input, optional RequestInit init);
</ins><span class="cx">     [PrivateIdentifier, ImplementedAs=fetch] Promise&lt;Response&gt; fetchRequest(FetchRequest request);
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesfetchFetchRequestcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/fetch/FetchRequest.cpp (209230 => 209231)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/fetch/FetchRequest.cpp        2016-12-02 03:30:37 UTC (rev 209230)
+++ trunk/Source/WebCore/Modules/fetch/FetchRequest.cpp        2016-12-02 05:31:07 UTC (rev 209231)
</span><span class="lines">@@ -31,7 +31,6 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(FETCH_API)
</span><span class="cx"> 
</span><del>-#include &quot;Dictionary.h&quot;
</del><span class="cx"> #include &quot;ExceptionCode.h&quot;
</span><span class="cx"> #include &quot;HTTPParsers.h&quot;
</span><span class="cx"> #include &quot;ScriptExecutionContext.h&quot;
</span><span class="lines">@@ -39,85 +38,6 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-static std::optional&lt;Exception&gt; setReferrerPolicy(FetchOptions&amp; options, const String&amp; referrerPolicy)
-{
-    if (referrerPolicy.isEmpty())
-        options.referrerPolicy = FetchOptions::ReferrerPolicy::EmptyString;
-    else if (referrerPolicy == &quot;no-referrer&quot;)
-        options.referrerPolicy = FetchOptions::ReferrerPolicy::NoReferrer;
-    else if (referrerPolicy == &quot;no-referrer-when-downgrade&quot;)
-        options.referrerPolicy = FetchOptions::ReferrerPolicy::NoReferrerWhenDowngrade;
-    else if (referrerPolicy == &quot;origin&quot;)
-        options.referrerPolicy = FetchOptions::ReferrerPolicy::Origin;
-    else if (referrerPolicy == &quot;origin-when-cross-origin&quot;)
-        options.referrerPolicy = FetchOptions::ReferrerPolicy::OriginWhenCrossOrigin;
-    else if (referrerPolicy == &quot;unsafe-url&quot;)
-        options.referrerPolicy = FetchOptions::ReferrerPolicy::UnsafeUrl;
-    else
-        return Exception { TypeError, ASCIILiteral(&quot;Bad referrer policy value.&quot;) };
-    return std::nullopt;
-}
-
-static std::optional&lt;Exception&gt; setMode(FetchOptions&amp; options, const String&amp; mode)
-{
-    if (mode == &quot;navigate&quot;)
-        options.mode = FetchOptions::Mode::Navigate;
-    else if (mode == &quot;same-origin&quot;)
-        options.mode = FetchOptions::Mode::SameOrigin;
-    else if (mode == &quot;no-cors&quot;)
-        options.mode = FetchOptions::Mode::NoCors;
-    else if (mode == &quot;cors&quot;)
-        options.mode = FetchOptions::Mode::Cors;
-    else
-        return Exception { TypeError, ASCIILiteral(&quot;Bad fetch mode value.&quot;) };
-    return std::nullopt;
-}
-
-static std::optional&lt;Exception&gt; setCredentials(FetchOptions&amp; options, const String&amp; credentials)
-{
-    if (credentials == &quot;omit&quot;)
-        options.credentials = FetchOptions::Credentials::Omit;
-    else if (credentials == &quot;same-origin&quot;)
-        options.credentials = FetchOptions::Credentials::SameOrigin;
-    else if (credentials == &quot;include&quot;)
-        options.credentials = FetchOptions::Credentials::Include;
-    else
-        return Exception { TypeError, ASCIILiteral(&quot;Bad credentials mode value.&quot;) };
-    return std::nullopt;
-}
-
-static std::optional&lt;Exception&gt; setCache(FetchOptions&amp; options, const String&amp; cache)
-{
-    if (cache == &quot;default&quot;)
-        options.cache = FetchOptions::Cache::Default;
-    else if (cache == &quot;no-store&quot;)
-        options.cache = FetchOptions::Cache::NoStore;
-    else if (cache == &quot;reload&quot;)
-        options.cache = FetchOptions::Cache::Reload;
-    else if (cache == &quot;no-cache&quot;)
-        options.cache = FetchOptions::Cache::NoCache;
-    else if (cache == &quot;force-cache&quot;)
-        options.cache = FetchOptions::Cache::ForceCache;
-    else if (cache == &quot;only-if-cached&quot;)
-        options.cache = FetchOptions::Cache::OnlyIfCached;
-    else
-        return Exception { TypeError, ASCIILiteral(&quot;Bad cache mode value.&quot;) };
-    return std::nullopt;
-}
-
-static std::optional&lt;Exception&gt; setRedirect(FetchOptions&amp; options, const String&amp; redirect)
-{
-    if (redirect == &quot;follow&quot;)
-        options.redirect = FetchOptions::Redirect::Follow;
-    else if (redirect == &quot;error&quot;)
-        options.redirect = FetchOptions::Redirect::Error;
-    else if (redirect == &quot;manual&quot;)
-        options.redirect = FetchOptions::Redirect::Manual;
-    else
-        return Exception { TypeError, ASCIILiteral(&quot;Bad redirect mode value.&quot;) };
-    return std::nullopt;
-}
-
</del><span class="cx"> static std::optional&lt;Exception&gt; setMethod(ResourceRequest&amp; request, const String&amp; initMethod)
</span><span class="cx"> {
</span><span class="cx">     if (!isValidHTTPToken(initMethod))
</span><span class="lines">@@ -132,11 +52,8 @@
</span><span class="cx">     return std::nullopt;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static std::optional&lt;Exception&gt; setReferrer(FetchRequest::InternalRequest&amp; request, ScriptExecutionContext&amp; context, const Dictionary&amp; init)
</del><ins>+static std::optional&lt;Exception&gt; setReferrer(FetchRequest::InternalRequest&amp; request, ScriptExecutionContext&amp; context, const String&amp; referrer)
</ins><span class="cx"> {
</span><del>-    String referrer;
-    if (!init.get(&quot;referrer&quot;, referrer))
-        return std::nullopt;
</del><span class="cx">     if (referrer.isEmpty()) {
</span><span class="cx">         request.referrer = ASCIILiteral(&quot;no-referrer&quot;);
</span><span class="cx">         return std::nullopt;
</span><span class="lines">@@ -158,61 +75,43 @@
</span><span class="cx">     return std::nullopt;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static std::optional&lt;Exception&gt; buildOptions(FetchRequest::InternalRequest&amp; request, ScriptExecutionContext&amp; context, const Dictionary&amp; init)
</del><ins>+static std::optional&lt;Exception&gt; buildOptions(FetchRequest::InternalRequest&amp; request, ScriptExecutionContext&amp; context, const FetchRequest::Init&amp; init)
</ins><span class="cx"> {
</span><del>-    JSC::JSValue window;
-    if (init.get(&quot;window&quot;, window)) {
-        if (!window.isNull())
-            return Exception { TypeError, ASCIILiteral(&quot;Window can only be null.&quot;) };
-    }
</del><ins>+    if (!init.window.isUndefinedOrNull())
+        return Exception { TypeError, ASCIILiteral(&quot;Window can only be null.&quot;) };
</ins><span class="cx"> 
</span><del>-    auto exception = setReferrer(request, context, init);
-    if (exception)
-        return exception;
-
-    String value;
-    if (init.get(&quot;referrerPolicy&quot;, value)) {
-        exception = setReferrerPolicy(request.options, value);
-        if (exception)
</del><ins>+    if (!init.referrer.isNull()) {
+        if (auto exception = setReferrer(request, context, init.referrer))
</ins><span class="cx">             return exception;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (init.get(&quot;mode&quot;, value)) {
-        exception = setMode(request.options, value);
-        if (exception)
-            return exception;
-    }
</del><ins>+    if (init.referrerPolicy)
+        request.options.referrerPolicy = init.referrerPolicy.value();
+
+    if (init.mode)
+        request.options.mode = init.mode.value();
</ins><span class="cx">     if (request.options.mode == FetchOptions::Mode::Navigate)
</span><span class="cx">         return Exception { TypeError, ASCIILiteral(&quot;Request constructor does not accept navigate fetch mode.&quot;) };
</span><span class="cx"> 
</span><del>-    if (init.get(&quot;credentials&quot;, value)) {
-        exception = setCredentials(request.options, value);
-        if (exception)
-            return exception;
-    }
</del><ins>+    if (init.credentials)
+        request.options.credentials = init.credentials.value();
</ins><span class="cx"> 
</span><del>-    if (init.get(&quot;cache&quot;, value)) {
-        exception = setCache(request.options, value);
-        if (exception)
-            return exception;
-    }
-
</del><ins>+    if (init.cache)
+        request.options.cache = init.cache.value();
</ins><span class="cx">     if (request.options.cache == FetchOptions::Cache::OnlyIfCached &amp;&amp; request.options.mode != FetchOptions::Mode::SameOrigin)
</span><span class="cx">         return Exception { TypeError, ASCIILiteral(&quot;only-if-cached cache option requires fetch mode to be same-origin.&quot;)  };
</span><span class="cx"> 
</span><del>-    if (init.get(&quot;redirect&quot;, value)) {
-        exception = setRedirect(request.options, value);
-        if (exception)
-            return exception;
-    }
</del><ins>+    if (init.redirect)
+        request.options.redirect = init.redirect.value();
</ins><span class="cx"> 
</span><del>-    init.get(&quot;integrity&quot;, request.integrity);
</del><ins>+    if (!init.integrity.isNull())
+        request.integrity = init.integrity;
</ins><span class="cx"> 
</span><del>-    if (init.get(&quot;method&quot;, value)) {
-        exception = setMethod(request.request, value);
-        if (exception)
</del><ins>+    if (!init.method.isNull()) {
+        if (auto exception = setMethod(request.request, init.method))
</ins><span class="cx">             return exception;
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     return std::nullopt;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -221,7 +120,7 @@
</span><span class="cx">     return internalRequest.request.httpMethod() != &quot;GET&quot; &amp;&amp; internalRequest.request.httpMethod() != &quot;HEAD&quot;;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-ExceptionOr&lt;FetchHeaders&amp;&gt; FetchRequest::initializeOptions(const Dictionary&amp; init)
</del><ins>+ExceptionOr&lt;FetchHeaders&amp;&gt; FetchRequest::initializeOptions(const Init&amp; init)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(scriptExecutionContext());
</span><span class="cx"> 
</span><span class="lines">@@ -240,7 +139,7 @@
</span><span class="cx">     return m_headers.get();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-ExceptionOr&lt;FetchHeaders&amp;&gt; FetchRequest::initializeWith(const String&amp; url, const Dictionary&amp; init)
</del><ins>+ExceptionOr&lt;FetchHeaders&amp;&gt; FetchRequest::initializeWith(const String&amp; url, const Init&amp; init)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(scriptExecutionContext());
</span><span class="cx">     // FIXME: Tighten the URL parsing algorithm according https://url.spec.whatwg.org/#concept-url-parser.
</span><span class="lines">@@ -257,7 +156,7 @@
</span><span class="cx">     return initializeOptions(init);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-ExceptionOr&lt;FetchHeaders&amp;&gt; FetchRequest::initializeWith(FetchRequest&amp; input, const Dictionary&amp; init)
</del><ins>+ExceptionOr&lt;FetchHeaders&amp;&gt; FetchRequest::initializeWith(FetchRequest&amp; input, const Init&amp; init)
</ins><span class="cx"> {
</span><span class="cx">     if (input.isDisturbedOrLocked())
</span><span class="cx">         return Exception {TypeError, ASCIILiteral(&quot;Request input is disturbed or locked.&quot;) };
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesfetchFetchRequesth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/fetch/FetchRequest.h (209230 => 209231)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/fetch/FetchRequest.h        2016-12-02 03:30:37 UTC (rev 209230)
+++ trunk/Source/WebCore/Modules/fetch/FetchRequest.h        2016-12-02 05:31:07 UTC (rev 209231)
</span><span class="lines">@@ -38,15 +38,36 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-class Dictionary;
</del><ins>+class Blob;
</ins><span class="cx"> class ScriptExecutionContext;
</span><ins>+class URLSearchParams;
</ins><span class="cx"> 
</span><span class="cx"> class FetchRequest final : public FetchBodyOwner {
</span><span class="cx"> public:
</span><span class="cx">     static Ref&lt;FetchRequest&gt; create(ScriptExecutionContext&amp; context) { return adoptRef(*new FetchRequest(context, std::nullopt, FetchHeaders::create(FetchHeaders::Guard::Request), { })); }
</span><span class="cx"> 
</span><del>-    ExceptionOr&lt;FetchHeaders&amp;&gt; initializeWith(FetchRequest&amp;, const Dictionary&amp;);
-    ExceptionOr&lt;FetchHeaders&amp;&gt; initializeWith(const String&amp;, const Dictionary&amp;);
</del><ins>+    using Cache = FetchOptions::Cache;
+    using Credentials = FetchOptions::Credentials;
+    using Destination = FetchOptions::Destination;
+    using Mode = FetchOptions::Mode;
+    using Redirect = FetchOptions::Redirect;
+    using ReferrerPolicy = FetchOptions::ReferrerPolicy;
+    using Type = FetchOptions::Type;
+
+    struct Init {
+        String method;
+        String referrer;
+        std::optional&lt;ReferrerPolicy&gt; referrerPolicy;
+        std::optional&lt;Mode&gt; mode;
+        std::optional&lt;Credentials&gt; credentials;
+        std::optional&lt;Cache&gt; cache;
+        std::optional&lt;Redirect&gt; redirect;
+        String integrity;
+        JSC::JSValue window;
+    };
+
+    ExceptionOr&lt;FetchHeaders&amp;&gt; initializeWith(FetchRequest&amp;, const Init&amp;);
+    ExceptionOr&lt;FetchHeaders&amp;&gt; initializeWith(const String&amp;, const Init&amp;);
</ins><span class="cx">     ExceptionOr&lt;void&gt; setBody(JSC::ExecState&amp;, JSC::JSValue, FetchRequest*);
</span><span class="cx"> 
</span><span class="cx">     const String&amp; method() const { return m_internalRequest.request.httpMethod(); }
</span><span class="lines">@@ -53,27 +74,13 @@
</span><span class="cx">     const String&amp; url() const;
</span><span class="cx">     FetchHeaders&amp; headers() { return m_headers.get(); }
</span><span class="cx"> 
</span><del>-    using Type = FetchOptions::Type;
</del><span class="cx">     Type type() const;
</span><del>-
-    using Destination = FetchOptions::Destination;
</del><span class="cx">     Destination destination() const;
</span><del>-
</del><span class="cx">     String referrer() const;
</span><del>-
-    using ReferrerPolicy = FetchOptions::ReferrerPolicy;
</del><span class="cx">     ReferrerPolicy referrerPolicy() const;
</span><del>-
-    using Mode = FetchOptions::Mode;
</del><span class="cx">     Mode mode() const;
</span><del>-
-    using Credentials = FetchOptions::Credentials;
</del><span class="cx">     Credentials credentials() const;
</span><del>-
-    using Cache = FetchOptions::Cache;
</del><span class="cx">     Cache cache() const;
</span><del>-
-    using Redirect = FetchOptions::Redirect;
</del><span class="cx">     Redirect redirect() const;
</span><span class="cx"> 
</span><span class="cx">     const String&amp; integrity() const { return m_internalRequest.integrity; }
</span><span class="lines">@@ -95,7 +102,7 @@
</span><span class="cx"> private:
</span><span class="cx">     FetchRequest(ScriptExecutionContext&amp;, std::optional&lt;FetchBody&gt;&amp;&amp;, Ref&lt;FetchHeaders&gt;&amp;&amp;, InternalRequest&amp;&amp;);
</span><span class="cx"> 
</span><del>-    ExceptionOr&lt;FetchHeaders&amp;&gt; initializeOptions(const Dictionary&amp;);
</del><ins>+    ExceptionOr&lt;FetchHeaders&amp;&gt; initializeOptions(const Init&amp;);
</ins><span class="cx"> 
</span><span class="cx">     const char* activeDOMObjectName() const final;
</span><span class="cx">     bool canSuspendForDocumentSuspension() const final;
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesfetchFetchRequestidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/fetch/FetchRequest.idl (209230 => 209231)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/fetch/FetchRequest.idl        2016-12-02 03:30:37 UTC (rev 209230)
+++ trunk/Source/WebCore/Modules/fetch/FetchRequest.idl        2016-12-02 05:31:07 UTC (rev 209231)
</span><span class="lines">@@ -30,14 +30,29 @@
</span><span class="cx"> enum RequestDestination { &quot;&quot;, &quot;document&quot;, &quot;sharedworker&quot;, &quot;subresource&quot;, &quot;unknown&quot;, &quot;worker&quot; };
</span><span class="cx"> enum RequestMode { &quot;navigate&quot;, &quot;same-origin&quot;, &quot;no-cors&quot;, &quot;cors&quot; };
</span><span class="cx"> enum RequestCredentials { &quot;omit&quot;, &quot;same-origin&quot;, &quot;include&quot; };
</span><del>-enum RequestCache { &quot;default&quot;, &quot;no-store&quot;, &quot;reload&quot;, &quot;no-cache&quot;, &quot;force-cache&quot; };
</del><ins>+enum RequestCache { &quot;default&quot;, &quot;no-store&quot;, &quot;reload&quot;, &quot;no-cache&quot;, &quot;force-cache&quot;, &quot;only-if-cached&quot; };
</ins><span class="cx"> enum RequestRedirect { &quot;follow&quot;, &quot;error&quot;, &quot;manual&quot; };
</span><span class="cx"> enum ReferrerPolicy { &quot;&quot;, &quot;no-referrer&quot;,  &quot;no-referrer-when-downgrade&quot;, &quot;origin&quot;, &quot;origin-when-cross-origin&quot;, &quot;unsafe-url&quot; };
</span><span class="cx"> 
</span><ins>+dictionary RequestInit {
+    ByteString method;
+    // FIXME: Should add: HeadersInit headers;
+    // FIXME: Should add: BodyInit? body;
+    USVString referrer;
+    ReferrerPolicy referrerPolicy;
+    RequestMode mode;
+    RequestCredentials credentials;
+    RequestCache cache;
+    RequestRedirect redirect;
+    DOMString integrity;
+    // FIXME: Should add: boolean keepalive;
+    any window; // can only be set to null
+};
+
</ins><span class="cx"> [
</span><span class="cx">     ActiveDOMObject,
</span><span class="cx">     Conditional=FETCH_API,
</span><del>-    Constructor(any input, optional Dictionary init),
</del><ins>+    Constructor(any input, optional RequestInit init),
</ins><span class="cx">     EnabledAtRuntime=FetchAPI,
</span><span class="cx">     Exposed=(Window,Worker),
</span><span class="cx">     InterfaceName=Request,
</span><span class="lines">@@ -45,13 +60,13 @@
</span><span class="cx">     PrivateIdentifier,
</span><span class="cx">     PublicIdentifier,
</span><span class="cx"> ] interface FetchRequest {
</span><del>-    readonly attribute DOMString method;
</del><ins>+    readonly attribute ByteString method;
</ins><span class="cx">     readonly attribute DOMString url;
</span><span class="cx">     readonly attribute FetchHeaders headers;
</span><span class="cx"> 
</span><span class="cx">     readonly attribute RequestType type;
</span><span class="cx">     readonly attribute RequestDestination destination;
</span><del>-    readonly attribute DOMString referrer;
</del><ins>+    readonly attribute USVString referrer;
</ins><span class="cx">     readonly attribute ReferrerPolicy referrerPolicy;
</span><span class="cx">     readonly attribute RequestMode mode;
</span><span class="cx">     readonly attribute RequestCredentials credentials;
</span><span class="lines">@@ -61,8 +76,8 @@
</span><span class="cx"> 
</span><span class="cx">     [CallWith=ScriptExecutionContext, MayThrowException, NewObject] FetchRequest clone();
</span><span class="cx"> 
</span><del>-    [MayThrowException, NewObject, PrivateIdentifier] FetchHeaders initializeWith(FetchRequest input, Dictionary init);
-    [MayThrowException, NewObject, PrivateIdentifier] FetchHeaders initializeWith(DOMString input, Dictionary init);
</del><ins>+    [MayThrowException, NewObject, PrivateIdentifier] FetchHeaders initializeWith(FetchRequest input, RequestInit init);
+    [MayThrowException, NewObject, PrivateIdentifier] FetchHeaders initializeWith(DOMString input, RequestInit init);
</ins><span class="cx">     [CallWith=ScriptState, MayThrowException, PrivateIdentifier] void setBody(any body, FetchRequest? request);
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesfetchWorkerGlobalScopeFetchidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/fetch/WorkerGlobalScopeFetch.idl (209230 => 209231)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/fetch/WorkerGlobalScopeFetch.idl        2016-12-02 03:30:37 UTC (rev 209230)
+++ trunk/Source/WebCore/Modules/fetch/WorkerGlobalScopeFetch.idl        2016-12-02 05:31:07 UTC (rev 209231)
</span><span class="lines">@@ -30,7 +30,6 @@
</span><span class="cx">     Conditional=FETCH_API,
</span><span class="cx">     EnabledAtRuntime=FetchAPI,
</span><span class="cx"> ] partial interface WorkerGlobalScope {
</span><del>-    [JSBuiltin] Promise&lt;Response&gt; fetch(any input, optional Dictionary init);
-
</del><ins>+    [JSBuiltin] Promise&lt;Response&gt; fetch(any input, optional RequestInit init);
</ins><span class="cx">     [PrivateIdentifier, ImplementedAs=fetch] Promise&lt;Response&gt; fetchRequest(FetchRequest request);
</span><span class="cx"> };
</span></span></pre>
</div>
</div>

</body>
</html>