<!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>[213621] trunk</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/213621">213621</a></dd>
<dt>Author</dt> <dd>joepeck@webkit.org</dd>
<dt>Date</dt> <dd>2017-03-08 19:35:13 -0800 (Wed, 08 Mar 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>Web Inspector: Should be able to see where Resources came from (Memory Cache, Disk Cache)
https://bugs.webkit.org/show_bug.cgi?id=164892
&lt;rdar://problem/29320562&gt;

Reviewed by Brian Burg.

Source/JavaScriptCore:

* inspector/protocol/Network.json:
Replace &quot;fromDiskCache&quot; property with &quot;source&quot; property which includes
more complete information about the source of this response (network,
memory cache, disk cache, or unknown).

* inspector/scripts/codegen/generate_cpp_protocol_types_header.py:
(_generate_class_for_object_declaration):
* inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py:
(CppProtocolTypesImplementationGenerator._generate_open_field_names):
* inspector/scripts/codegen/generator.py:
(Generator):
(Generator.open_fields):
To avoid conflicts between the Inspector::Protocol::Network::Response::Source
enum and open accessor string symbol that would have the same name, only generate
a specific list of open accessor strings. This reduces the list of exported
symbols from all properties to just the ones that are needed. This can be
cleaned up later if needed.

* inspector/scripts/tests/generic/expected/type-with-open-parameters.json-result: Added.
* inspector/scripts/tests/generic/type-with-open-parameters.json: Added.
Test for open accessors generation.

Source/WebCore:

Test: http/tests/inspector/network/resource-response-source-disk-cache.html
      http/tests/inspector/network/resource-response-source-memory-cache.html
      http/tests/inspector/network/resource-response-source-network.html

* platform/network/ResourceResponseBase.cpp:
(WebCore::ResourceResponseBase::setSource): Deleted.
* platform/network/ResourceResponseBase.h:
(WebCore::ResourceResponseBase::setSource):
Make Source mutable to allow it to be set in const methods.

* loader/SubresourceLoader.cpp:
(WebCore::SubresourceLoader::didReceiveResponse):
Set the Response source after a successful memory cache validation
as early as possible so that future copies have up to date info.

* inspector/InspectorNetworkAgent.cpp:
(WebCore::responseSource):
(WebCore::InspectorNetworkAgent::buildObjectForResourceResponse):
(WebCore::InspectorNetworkAgent::didLoadResourceFromMemoryCache):
(WebCore::InspectorNetworkAgent::markResourceAsCached): Deleted.
Eliminate this &quot;markResourceAsCached&quot; path.
Update Response to include required source parameter instead of
optional fromDiskCache parameter.

* inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::markResourceAsCachedImpl): Deleted.
* inspector/InspectorInstrumentation.h:
(WebCore::InspectorInstrumentation::markResourceAsCached): Deleted.
* inspector/InspectorNetworkAgent.h:
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::loadedResourceFromMemoryCache):
Eliminate this &quot;markResourceAsCached&quot; call because the later delegate
messages will include this information.

Source/WebInspectorUI:

* Localizations/en.lproj/localizedStrings.js:
New localized strings for memory/disk cache information.

* UserInterface/Controllers/FrameResourceManager.js:
(WebInspector.FrameResourceManager.prototype.markResourceRequestAsServedFromMemoryCache):
Make this legacy path more explicit.

(WebInspector.FrameResourceManager.prototype.resourceRequestWasServedFromMemoryCache):
Make this memory cache path more explicit.

(WebInspector.FrameResourceManager.prototype.resourceRequestDidReceiveResponse):
Pass the resource's response source onward.

* UserInterface/Models/Resource.js:
(WebInspector.Resource):
(WebInspector.Resource.responseSourceFromPayload):
(WebInspector.Resource.prototype.get responseSource):
(WebInspector.Resource.prototype.hasResponse):
(WebInspector.Resource.prototype.updateForResponse):
(WebInspector.Resource.prototype.markAsCached):
(WebInspector.Resource.prototype.legacyMarkServedFromMemoryCache):
(WebInspector.Resource.prototype.legacyMarkServedFromDiskCache):
Include a WebInspector.ResponseSource enum.
Update a Resource's responseSource state where appropriate.

* UserInterface/Protocol/NetworkObserver.js:
(WebInspector.NetworkObserver.prototype.requestServedFromCache):
Mark legacy path.

* UserInterface/Views/NetworkGridContentView.js:
(WebInspector.NetworkGridContentView):
* UserInterface/Views/NetworkTimelineView.js:
(WebInspector.NetworkTimelineView):
Tweak default column sizes to make Cached and graph columns a little larger.

* UserInterface/Views/ResourceTimelineDataGridNode.js:
(WebInspector.ResourceTimelineDataGridNode.prototype.createCellContent):
(WebInspector.ResourceTimelineDataGridNode.prototype._cachedCellContent):
Update &quot;Cached&quot; column data with more information if available.

* UserInterface/Views/NetworkGridContentView.css:
(.content-view.network-grid &gt; .data-grid .cache-type):
(.content-view.network-grid &gt; .data-grid:matches(:focus, .force-focus) tr.selected .cache-type):
Style the cache type a secondary color.

LayoutTests:

* http/tests/inspector/network/resource-response-source-disk-cache-expected.txt: Added.
* http/tests/inspector/network/resource-response-source-disk-cache.html: Added.
* http/tests/inspector/network/resource-response-source-memory-cache-expected.txt: Added.
* http/tests/inspector/network/resource-response-source-memory-cache.html: Added.
* http/tests/inspector/network/resource-response-source-network-expected.txt: Added.
* http/tests/inspector/network/resource-response-source-network.html: Added.
* http/tests/inspector/network/resources/cached-script.js: Added.
Test for Network, MemoryCache, and DiskCache loads.

* http/tests/inspector/network/resource-timing-expected.txt:
* http/tests/inspector/network/resource-timing.html:
Fix a typo.

* http/tests/cache/disk-cache/resources/cache-test.js:
(loadResourcesWithOptions):
(loadResources):
Fix typos and style.

* platform/mac-wk1/TestExpectations:
* platform/win/TestExpectations:
Skip disk cache tests where the disk cache is not enabled.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestshttptestscachediskcacheresourcescachetestjs">trunk/LayoutTests/http/tests/cache/disk-cache/resources/cache-test.js</a></li>
<li><a href="#trunkLayoutTestshttptestsinspectornetworkresourcetimingexpectedtxt">trunk/LayoutTests/http/tests/inspector/network/resource-timing-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestsinspectornetworkresourcetiminghtml">trunk/LayoutTests/http/tests/inspector/network/resource-timing.html</a></li>
<li><a href="#trunkLayoutTestsplatformmacwk1TestExpectations">trunk/LayoutTests/platform/mac-wk1/TestExpectations</a></li>
<li><a href="#trunkLayoutTestsplatformwinTestExpectations">trunk/LayoutTests/platform/win/TestExpectations</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorprotocolNetworkjson">trunk/Source/JavaScriptCore/inspector/protocol/Network.json</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorscriptscodegengenerate_cpp_protocol_types_headerpy">trunk/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_protocol_types_header.py</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorscriptscodegengenerate_cpp_protocol_types_implementationpy">trunk/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorscriptscodegengeneratorpy">trunk/Source/JavaScriptCore/inspector/scripts/codegen/generator.py</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorInstrumentationcpp">trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorInstrumentationh">trunk/Source/WebCore/inspector/InspectorInstrumentation.h</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorNetworkAgentcpp">trunk/Source/WebCore/inspector/InspectorNetworkAgent.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorNetworkAgenth">trunk/Source/WebCore/inspector/InspectorNetworkAgent.h</a></li>
<li><a href="#trunkSourceWebCoreloaderFrameLoadercpp">trunk/Source/WebCore/loader/FrameLoader.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderSubresourceLoadercpp">trunk/Source/WebCore/loader/SubresourceLoader.cpp</a></li>
<li><a href="#trunkSourceWebCoreloadercacheMemoryCachecpp">trunk/Source/WebCore/loader/cache/MemoryCache.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkResourceResponseBasecpp">trunk/Source/WebCore/platform/network/ResourceResponseBase.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkResourceResponseBaseh">trunk/Source/WebCore/platform/network/ResourceResponseBase.h</a></li>
<li><a href="#trunkSourceWebInspectorUIChangeLog">trunk/Source/WebInspectorUI/ChangeLog</a></li>
<li><a href="#trunkSourceWebInspectorUILocalizationsenlprojlocalizedStringsjs">trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceControllersFrameResourceManagerjs">trunk/Source/WebInspectorUI/UserInterface/Controllers/FrameResourceManager.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceModelsResourcejs">trunk/Source/WebInspectorUI/UserInterface/Models/Resource.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceProtocolNetworkObserverjs">trunk/Source/WebInspectorUI/UserInterface/Protocol/NetworkObserver.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsNetworkGridContentViewcss">trunk/Source/WebInspectorUI/UserInterface/Views/NetworkGridContentView.css</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsNetworkGridContentViewjs">trunk/Source/WebInspectorUI/UserInterface/Views/NetworkGridContentView.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsNetworkTimelineViewjs">trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTimelineView.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsResourceTimelineDataGridNodejs">trunk/Source/WebInspectorUI/UserInterface/Views/ResourceTimelineDataGridNode.js</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestshttptestsinspectornetworkresourceresponsesourcediskcacheexpectedtxt">trunk/LayoutTests/http/tests/inspector/network/resource-response-source-disk-cache-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestsinspectornetworkresourceresponsesourcediskcachehtml">trunk/LayoutTests/http/tests/inspector/network/resource-response-source-disk-cache.html</a></li>
<li><a href="#trunkLayoutTestshttptestsinspectornetworkresourceresponsesourcememorycacheexpectedtxt">trunk/LayoutTests/http/tests/inspector/network/resource-response-source-memory-cache-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestsinspectornetworkresourceresponsesourcememorycachehtml">trunk/LayoutTests/http/tests/inspector/network/resource-response-source-memory-cache.html</a></li>
<li><a href="#trunkLayoutTestshttptestsinspectornetworkresourceresponsesourcenetworkexpectedtxt">trunk/LayoutTests/http/tests/inspector/network/resource-response-source-network-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestsinspectornetworkresourceresponsesourcenetworkhtml">trunk/LayoutTests/http/tests/inspector/network/resource-response-source-network.html</a></li>
<li><a href="#trunkLayoutTestshttptestsinspectornetworkresourcescachedscriptjs">trunk/LayoutTests/http/tests/inspector/network/resources/cached-script.js</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorscriptstestsgenericexpectedtypewithopenparametersjsonresult">trunk/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/type-with-open-parameters.json-result</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorscriptstestsgenerictypewithopenparametersjson">trunk/Source/JavaScriptCore/inspector/scripts/tests/generic/type-with-open-parameters.json</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (213620 => 213621)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2017-03-09 02:40:54 UTC (rev 213620)
+++ trunk/LayoutTests/ChangeLog        2017-03-09 03:35:13 UTC (rev 213621)
</span><span class="lines">@@ -1,3 +1,33 @@
</span><ins>+2017-03-08  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
+
+        Web Inspector: Should be able to see where Resources came from (Memory Cache, Disk Cache)
+        https://bugs.webkit.org/show_bug.cgi?id=164892
+        &lt;rdar://problem/29320562&gt;
+
+        Reviewed by Brian Burg.
+
+        * http/tests/inspector/network/resource-response-source-disk-cache-expected.txt: Added.
+        * http/tests/inspector/network/resource-response-source-disk-cache.html: Added.
+        * http/tests/inspector/network/resource-response-source-memory-cache-expected.txt: Added.
+        * http/tests/inspector/network/resource-response-source-memory-cache.html: Added.
+        * http/tests/inspector/network/resource-response-source-network-expected.txt: Added.
+        * http/tests/inspector/network/resource-response-source-network.html: Added.
+        * http/tests/inspector/network/resources/cached-script.js: Added.
+        Test for Network, MemoryCache, and DiskCache loads.
+
+        * http/tests/inspector/network/resource-timing-expected.txt:
+        * http/tests/inspector/network/resource-timing.html:
+        Fix a typo.
+
+        * http/tests/cache/disk-cache/resources/cache-test.js:
+        (loadResourcesWithOptions):
+        (loadResources):
+        Fix typos and style.
+
+        * platform/mac-wk1/TestExpectations:
+        * platform/win/TestExpectations:
+        Skip disk cache tests where the disk cache is not enabled.
+
</ins><span class="cx"> 2017-03-08  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Drop support for non-standard document.all.tags()
</span></span></pre></div>
<a id="trunkLayoutTestshttptestscachediskcacheresourcescachetestjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/cache/disk-cache/resources/cache-test.js (213620 => 213621)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/cache/disk-cache/resources/cache-test.js        2017-03-09 02:40:54 UTC (rev 213620)
+++ trunk/LayoutTests/http/tests/cache/disk-cache/resources/cache-test.js        2017-03-09 03:35:13 UTC (rev 213621)
</span><span class="lines">@@ -75,7 +75,7 @@
</span><span class="cx">     test.xhr.send();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-function loadResourcesWithOptions(tests, options, completetion)
</del><ins>+function loadResourcesWithOptions(tests, options, completion)
</ins><span class="cx"> {
</span><span class="cx">     if (options[&quot;ClearMemoryCache&quot;])
</span><span class="cx">         internals.clearMemoryCache();
</span><span class="lines">@@ -86,14 +86,14 @@
</span><span class="cx">         loadResource(tests[i], function (ev) {
</span><span class="cx">             --pendingCount;
</span><span class="cx">             if (!pendingCount)
</span><del>-                completetion(ev);
-         });
</del><ins>+                completion(ev);
+        });
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-function loadResources(tests, completetion)
</del><ins>+function loadResources(tests, completion)
</ins><span class="cx"> {
</span><del>-    loadResourcesWithOptions(tests, { &quot;ClearMemoryCache&quot; : true }, completetion);
</del><ins>+    loadResourcesWithOptions(tests, { &quot;ClearMemoryCache&quot; : true }, completion);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function printResults(tests)
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsinspectornetworkresourceresponsesourcediskcacheexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/inspector/network/resource-response-source-disk-cache-expected.txt (0 => 213621)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/inspector/network/resource-response-source-disk-cache-expected.txt                                (rev 0)
+++ trunk/LayoutTests/http/tests/inspector/network/resource-response-source-disk-cache-expected.txt        2017-03-09 03:35:13 UTC (rev 213621)
</span><span class="lines">@@ -0,0 +1,15 @@
</span><ins>+Test for `Resource.ResponseSource.DiskCache`.
+
+
+== Running test suite: Resource.ResponseSource.DiskCache
+-- Running test setup.
+-- Running test case: PossibleNetworkLoad
+PASS: Resource should be created.
+PASS: Resource should receive a Response.
+
+-- Running test case: Resource.ResponseSource.DiskCache
+PASS: Resource should be created.
+PASS: Resource should receive a Response.
+PASS: statusCode should be 200
+PASS: responseSource should be Symbol(disk-cache)
+
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsinspectornetworkresourceresponsesourcediskcachehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/inspector/network/resource-response-source-disk-cache.html (0 => 213621)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/inspector/network/resource-response-source-disk-cache.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/inspector/network/resource-response-source-disk-cache.html        2017-03-09 03:35:13 UTC (rev 213621)
</span><span class="lines">@@ -0,0 +1,70 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;meta charset=&quot;utf-8&quot;&gt;
+&lt;script src=&quot;../resources/inspector-test.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../../cache/disk-cache/resources/cache-test.js&quot;&gt;&lt;/script&gt;
+&lt;script&gt;
+function loadAndTriggerInspector(url) {
+    fetch(url).then(() =&gt; {
+        TestPage.dispatchEventToFrontend(&quot;LoadComplete&quot;);
+    });
+}
+
+function triggerNetworkLoad() {
+    loadAndTriggerInspector(&quot;/resources/square100.png&quot;);
+}
+
+function triggerDiskCacheLoad() {
+    loadAndTriggerInspector(&quot;/resources/square100.png&quot;);
+}
+
+function test()
+{
+    let suite = InspectorTest.createAsyncSuite(&quot;Resource.ResponseSource.DiskCache&quot;);
+
+    function addTestCase({name, description, setup, expression, statusCode, responseSource}) {
+        suite.addTestCase({
+            name, description, setup,
+            test(resolve, reject) {
+                InspectorTest.evaluateInPage(expression);
+                Promise.all([
+                    WebInspector.Frame.awaitEvent(WebInspector.Frame.Event.ResourceWasAdded),
+                    WebInspector.Resource.awaitEvent(WebInspector.Resource.Event.ResponseReceived),
+                    InspectorTest.awaitEvent(&quot;LoadComplete&quot;),
+                ]).then(([resourceWasAddedEvent, responseReceivedEvent, loadCompleteEvent]) =&gt; {
+                    let resource = resourceWasAddedEvent.data.resource;
+                    InspectorTest.expectThat(resource instanceof WebInspector.Resource, &quot;Resource should be created.&quot;);
+                    InspectorTest.expectEqual(resource, responseReceivedEvent.target, &quot;Resource should receive a Response.&quot;);
+                    if (statusCode)
+                        InspectorTest.expectEqual(resource.statusCode, statusCode, `statusCode should be ${statusCode}`);
+                    if (responseSource)
+                        InspectorTest.expectEqual(resource.responseSource, responseSource, `responseSource should be ${String(responseSource)}`);
+                }).then(resolve, reject);
+            }
+        });
+    }
+
+    addTestCase({
+        name: &quot;PossibleNetworkLoad&quot;,
+        description: &quot;Load a resource from the network, it might be in an earlier disk cache&quot;,
+        setup(resolve) { InspectorTest.evaluateInPage(`internals.clearMemoryCache()`, resolve); },
+        expression: `triggerNetworkLoad()`,
+    });
+
+    addTestCase({
+        name: &quot;Resource.ResponseSource.DiskCache&quot;,
+        description: &quot;Load a resource from the disk cache&quot;,
+        expression: `triggerDiskCacheLoad()`,
+        responseSource: WebInspector.Resource.ResponseSource.DiskCache,
+        statusCode: 200,
+    });
+
+    suite.runTestCasesAndFinish();
+}
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;runTest()&quot;&gt;
+&lt;p&gt;Test for `Resource.ResponseSource.DiskCache`.&lt;/p&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsinspectornetworkresourceresponsesourcememorycacheexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/inspector/network/resource-response-source-memory-cache-expected.txt (0 => 213621)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/inspector/network/resource-response-source-memory-cache-expected.txt                                (rev 0)
+++ trunk/LayoutTests/http/tests/inspector/network/resource-response-source-memory-cache-expected.txt        2017-03-09 03:35:13 UTC (rev 213621)
</span><span class="lines">@@ -0,0 +1,9 @@
</span><ins>+Test for `Resource.ResponseSource.MemoryCache`.
+
+
+== Running test suite: Resource.ResponseSource.MemoryCache
+-- Running test case: Resource.ResponseSource.MemoryCache
+PASS: Resource should be exist.
+PASS: statusCode should be 304
+PASS: responseSource should be Symbol(memory-cache)
+
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsinspectornetworkresourceresponsesourcememorycachehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/inspector/network/resource-response-source-memory-cache.html (0 => 213621)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/inspector/network/resource-response-source-memory-cache.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/inspector/network/resource-response-source-memory-cache.html        2017-03-09 03:35:13 UTC (rev 213621)
</span><span class="lines">@@ -0,0 +1,56 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;meta charset=&quot;utf-8&quot;&gt;
+&lt;script src=&quot;resources/cached-script.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../resources/inspector-test.js&quot;&gt;&lt;/script&gt;
+&lt;script&gt;
+TestPage.dispatchEventToFrontend(&quot;LoadComplete&quot;);
+
+function test()
+{
+    let suite = InspectorTest.createAsyncSuite(&quot;Resource.ResponseSource.MemoryCache&quot;);
+
+    function addReloadTestCase({name, description, expression, pattern, ignoreCache, statusCode, responseSource}) {
+        suite.addTestCase({
+            name, description,
+            test(resolve, reject) {
+                InspectorTest.reloadPage(ignoreCache);
+                InspectorTest.awaitEvent(&quot;LoadComplete&quot;).then((event) =&gt; {
+                    let resource = null;
+                    for (let item of WebInspector.frameResourceManager.mainFrame.resourceCollection.items) {
+                        if (pattern.test(item.url)) {
+                            resource = item;
+                            break;
+                        }
+                    }
+                    if (!resource) {
+                        InspectorTest.fail(&quot;Failed to find specific resource.&quot;);
+                        reject();
+                        return;
+                    }
+                    InspectorTest.expectThat(resource instanceof WebInspector.Resource, &quot;Resource should be exist.&quot;);
+                    InspectorTest.expectEqual(resource.statusCode, statusCode, `statusCode should be ${statusCode}`);
+                    InspectorTest.expectEqual(resource.responseSource, responseSource, `responseSource should be ${String(responseSource)}`);                    
+                }).then(resolve, reject);
+            }
+        });
+    }
+
+    addReloadTestCase({
+        name: &quot;Resource.ResponseSource.MemoryCache&quot;,
+        description: &quot;Load a resource from the memory cache by reloading this page.&quot;,
+        pattern: /cached-script\.js$/,
+        ignoreCache: false,
+        responseSource: WebInspector.Resource.ResponseSource.MemoryCache,
+        statusCode: 304,
+    });
+
+    suite.runTestCasesAndFinish();
+}
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;runTest()&quot;&gt;
+&lt;p&gt;Test for `Resource.ResponseSource.MemoryCache`.&lt;/p&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsinspectornetworkresourceresponsesourcenetworkexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/inspector/network/resource-response-source-network-expected.txt (0 => 213621)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/inspector/network/resource-response-source-network-expected.txt                                (rev 0)
+++ trunk/LayoutTests/http/tests/inspector/network/resource-response-source-network-expected.txt        2017-03-09 03:35:13 UTC (rev 213621)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+Test for `Resource.ResponseSource.Network`.
+
+
+== Running test suite: Resource.ResponseSource.Network
+-- Running test case: Resource.ResponseSource.Network
+PASS: Resource should be created.
+PASS: Resource should receive a Response.
+PASS: statusCode should be 200
+PASS: responseSource should be Symbol(network)
+
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsinspectornetworkresourceresponsesourcenetworkhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/inspector/network/resource-response-source-network.html (0 => 213621)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/inspector/network/resource-response-source-network.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/inspector/network/resource-response-source-network.html        2017-03-09 03:35:13 UTC (rev 213621)
</span><span class="lines">@@ -0,0 +1,53 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;meta charset=&quot;utf-8&quot;&gt;
+&lt;script src=&quot;../resources/inspector-test.js&quot;&gt;&lt;/script&gt;
+&lt;script&gt;
+function triggerNetworkLoad() {
+    let url = &quot;resources/data.json?&quot; + Math.random();
+    fetch(url).then(() =&gt; {
+        TestPage.dispatchEventToFrontend(&quot;LoadComplete&quot;);
+    });
+}
+
+function test()
+{
+    let suite = InspectorTest.createAsyncSuite(&quot;Resource.ResponseSource.Network&quot;);
+
+    function addTestCase({name, description, expression, statusCode, responseSource}) {
+        suite.addTestCase({
+            name, description,
+            test(resolve, reject) {
+                InspectorTest.evaluateInPage(expression);
+                Promise.all([
+                    WebInspector.Frame.awaitEvent(WebInspector.Frame.Event.ResourceWasAdded),
+                    WebInspector.Resource.awaitEvent(WebInspector.Resource.Event.ResponseReceived),
+                    InspectorTest.awaitEvent(&quot;LoadComplete&quot;),
+                ]).then(([resourceWasAddedEvent, responseReceivedEvent, loadCompleteEvent]) =&gt; {
+                    let resource = resourceWasAddedEvent.data.resource;
+                    InspectorTest.expectThat(resource instanceof WebInspector.Resource, &quot;Resource should be created.&quot;);
+                    InspectorTest.expectEqual(resource, responseReceivedEvent.target, &quot;Resource should receive a Response.&quot;);
+                    InspectorTest.expectEqual(resource.statusCode, statusCode, `statusCode should be ${statusCode}`);
+                    InspectorTest.expectEqual(resource.responseSource, responseSource, `responseSource should be ${String(responseSource)}`);
+                }).then(resolve, reject);
+            }
+        });
+    }
+
+    addTestCase({
+        name: &quot;Resource.ResponseSource.Network&quot;,
+        description: &quot;Load a resource from the network by giving a random URL.&quot;,
+        expression: `triggerNetworkLoad()`,
+        responseSource: WebInspector.Resource.ResponseSource.Network,
+        statusCode: 200,
+    });
+
+    suite.runTestCasesAndFinish();
+}
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;runTest()&quot;&gt;
+&lt;p&gt;Test for `Resource.ResponseSource.Network`.&lt;/p&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsinspectornetworkresourcetimingexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/inspector/network/resource-timing-expected.txt (213620 => 213621)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/inspector/network/resource-timing-expected.txt        2017-03-09 02:40:54 UTC (rev 213620)
+++ trunk/LayoutTests/http/tests/inspector/network/resource-timing-expected.txt        2017-03-09 03:35:13 UTC (rev 213621)
</span><span class="lines">@@ -3,7 +3,7 @@
</span><span class="cx"> 
</span><span class="cx"> == Running test suite: ResourceTimingData
</span><span class="cx"> -- Running test case: CheckResourceTimingInformationForResource
</span><del>-PASS: Resource should be createad.
</del><ins>+PASS: Resource should be created.
</ins><span class="cx"> PASS: Added Resource received a response.
</span><span class="cx"> PASS: Added Resource did finish loading.
</span><span class="cx"> PASS: Newly added resource should have a resource timing model.
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsinspectornetworkresourcetiminghtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/inspector/network/resource-timing.html (213620 => 213621)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/inspector/network/resource-timing.html        2017-03-09 02:40:54 UTC (rev 213620)
+++ trunk/LayoutTests/http/tests/inspector/network/resource-timing.html        2017-03-09 03:35:13 UTC (rev 213621)
</span><span class="lines">@@ -26,7 +26,7 @@
</span><span class="cx">             .then(([resourceWasAddedEvent, responseReceivedEvent, loadingDidFinishEvent]) =&gt; {
</span><span class="cx">                 let resource = resourceWasAddedEvent.data.resource;
</span><span class="cx"> 
</span><del>-                InspectorTest.expectThat(resource instanceof WebInspector.Resource, &quot;Resource should be createad.&quot;);
</del><ins>+                InspectorTest.expectThat(resource instanceof WebInspector.Resource, &quot;Resource should be created.&quot;);
</ins><span class="cx">                 InspectorTest.expectThat(resource === responseReceivedEvent.target, &quot;Added Resource received a response.&quot;);
</span><span class="cx">                 InspectorTest.expectThat(resource === loadingDidFinishEvent.target, &quot;Added Resource did finish loading.&quot;);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsinspectornetworkresourcescachedscriptjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/inspector/network/resources/cached-script.js (0 => 213621)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/inspector/network/resources/cached-script.js                                (rev 0)
+++ trunk/LayoutTests/http/tests/inspector/network/resources/cached-script.js        2017-03-09 03:35:13 UTC (rev 213621)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+function cachedScript() {}
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacwk1TestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac-wk1/TestExpectations (213620 => 213621)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-wk1/TestExpectations        2017-03-09 02:40:54 UTC (rev 213620)
+++ trunk/LayoutTests/platform/mac-wk1/TestExpectations        2017-03-09 03:35:13 UTC (rev 213621)
</span><span class="lines">@@ -146,6 +146,7 @@
</span><span class="cx"> 
</span><span class="cx"> # Disk cache is WK2 only
</span><span class="cx"> http/tests/cache/disk-cache
</span><ins>+http/tests/inspector/network/resource-response-source-disk-cache.html
</ins><span class="cx"> 
</span><span class="cx"> [ Yosemite+ ] fast/ruby/ruby-expansion-cjk-2.html [ ImageOnlyFailure ]
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsplatformwinTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/win/TestExpectations (213620 => 213621)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/win/TestExpectations        2017-03-09 02:40:54 UTC (rev 213620)
+++ trunk/LayoutTests/platform/win/TestExpectations        2017-03-09 03:35:13 UTC (rev 213621)
</span><span class="lines">@@ -2281,6 +2281,7 @@
</span><span class="cx"> 
</span><span class="cx"> # Disk cache is WK2 only
</span><span class="cx"> http/tests/cache/disk-cache
</span><ins>+http/tests/inspector/network/resource-response-source-disk-cache.html
</ins><span class="cx"> 
</span><span class="cx"> # The following are unreviewed:
</span><span class="cx"> http/tests/cache/content-type-ignored-during-revalidation.html [ Failure ]
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (213620 => 213621)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2017-03-09 02:40:54 UTC (rev 213620)
+++ trunk/Source/JavaScriptCore/ChangeLog        2017-03-09 03:35:13 UTC (rev 213621)
</span><span class="lines">@@ -1,3 +1,33 @@
</span><ins>+2017-03-08  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
+
+        Web Inspector: Should be able to see where Resources came from (Memory Cache, Disk Cache)
+        https://bugs.webkit.org/show_bug.cgi?id=164892
+        &lt;rdar://problem/29320562&gt;
+
+        Reviewed by Brian Burg.
+
+        * inspector/protocol/Network.json:
+        Replace &quot;fromDiskCache&quot; property with &quot;source&quot; property which includes
+        more complete information about the source of this response (network,
+        memory cache, disk cache, or unknown).
+
+        * inspector/scripts/codegen/generate_cpp_protocol_types_header.py:
+        (_generate_class_for_object_declaration):
+        * inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py:
+        (CppProtocolTypesImplementationGenerator._generate_open_field_names):
+        * inspector/scripts/codegen/generator.py:
+        (Generator):
+        (Generator.open_fields):
+        To avoid conflicts between the Inspector::Protocol::Network::Response::Source
+        enum and open accessor string symbol that would have the same name, only generate
+        a specific list of open accessor strings. This reduces the list of exported
+        symbols from all properties to just the ones that are needed. This can be
+        cleaned up later if needed.
+
+        * inspector/scripts/tests/generic/expected/type-with-open-parameters.json-result: Added.
+        * inspector/scripts/tests/generic/type-with-open-parameters.json: Added.
+        Test for open accessors generation.
+
</ins><span class="cx"> 2017-03-08  Keith Miller  &lt;keith_miller@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         WebAssembly: Make OOB for fast memory do an extra safety check by ensuring the faulting address is in the range we allocated for fast memory
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorprotocolNetworkjson"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/protocol/Network.json (213620 => 213621)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/protocol/Network.json        2017-03-09 02:40:54 UTC (rev 213620)
+++ trunk/Source/JavaScriptCore/inspector/protocol/Network.json        2017-03-09 03:35:13 UTC (rev 213621)
</span><span class="lines">@@ -65,9 +65,9 @@
</span><span class="cx">                 { &quot;name&quot;: &quot;headers&quot;, &quot;$ref&quot;: &quot;Headers&quot;, &quot;description&quot;: &quot;HTTP response headers.&quot; },
</span><span class="cx">                 { &quot;name&quot;: &quot;headersText&quot;, &quot;type&quot;: &quot;string&quot;, &quot;optional&quot;: true, &quot;description&quot;: &quot;HTTP response headers text.&quot; },
</span><span class="cx">                 { &quot;name&quot;: &quot;mimeType&quot;, &quot;type&quot;: &quot;string&quot;, &quot;description&quot;: &quot;Resource mimeType as determined by the browser.&quot; },
</span><ins>+                { &quot;name&quot;: &quot;source&quot;, &quot;type&quot;: &quot;string&quot;, &quot;enum&quot;: [&quot;unknown&quot;, &quot;network&quot;, &quot;memory-cache&quot;, &quot;disk-cache&quot;], &quot;description&quot;: &quot;Specifies where the response came from.&quot; },
</ins><span class="cx">                 { &quot;name&quot;: &quot;requestHeaders&quot;, &quot;$ref&quot;: &quot;Headers&quot;, &quot;optional&quot;: true, &quot;description&quot;: &quot;Refined HTTP request headers that were actually transmitted over the network.&quot; },
</span><span class="cx">                 { &quot;name&quot;: &quot;requestHeadersText&quot;, &quot;type&quot;: &quot;string&quot;, &quot;optional&quot;: true, &quot;description&quot;: &quot;HTTP request headers text.&quot; },
</span><del>-                { &quot;name&quot;: &quot;fromDiskCache&quot;, &quot;type&quot;: &quot;boolean&quot;, &quot;optional&quot;: true, &quot;description&quot;: &quot;Specifies that the request was served from the disk cache.&quot; },
</del><span class="cx">                 { &quot;name&quot;: &quot;timing&quot;, &quot;$ref&quot;: &quot;ResourceTiming&quot;, &quot;optional&quot;: true, &quot;description&quot;: &quot;Timing information for the given request.&quot; }
</span><span class="cx">             ]
</span><span class="cx">         },
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorscriptscodegengenerate_cpp_protocol_types_headerpy"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_protocol_types_header.py (213620 => 213621)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_protocol_types_header.py        2017-03-09 02:40:54 UTC (rev 213620)
+++ trunk/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_protocol_types_header.py        2017-03-09 03:35:13 UTC (rev 213621)
</span><span class="lines">@@ -236,7 +236,8 @@
</span><span class="cx">         if Generator.type_has_open_fields(type_declaration.type):
</span><span class="cx">             lines.append('')
</span><span class="cx">             lines.append('    // Property names for type generated as open.')
</span><del>-            for type_member in type_declaration.type_members:
</del><ins>+            open_members = Generator.open_fields(type_declaration)
+            for type_member in open_members:
</ins><span class="cx">                 export_macro = self.model().framework.setting('export_macro', None)
</span><span class="cx">                 lines.append('    %s static const char* %s;' % (export_macro, ucfirst(type_member.member_name)))
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorscriptscodegengenerate_cpp_protocol_types_implementationpy"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py (213620 => 213621)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py        2017-03-09 02:40:54 UTC (rev 213620)
+++ trunk/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py        2017-03-09 03:35:13 UTC (rev 213621)
</span><span class="lines">@@ -161,7 +161,8 @@
</span><span class="cx">         for domain in self.domains_to_generate():
</span><span class="cx">             type_declarations = self.type_declarations_for_domain(domain)
</span><span class="cx">             for type_declaration in filter(lambda decl: Generator.type_has_open_fields(decl.type), type_declarations):
</span><del>-                for type_member in sorted(type_declaration.type_members, key=lambda member: member.member_name):
</del><ins>+                open_members = Generator.open_fields(type_declaration)
+                for type_member in sorted(open_members, key=lambda member: member.member_name):
</ins><span class="cx">                     field_name = '::'.join(['Inspector', 'Protocol', domain.domain_name, ucfirst(type_declaration.type_name), ucfirst(type_member.member_name)])
</span><span class="cx">                     lines.append('const char* %s = &quot;%s&quot;;' % (field_name, type_member.member_name))
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorscriptscodegengeneratorpy"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/scripts/codegen/generator.py (213620 => 213621)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/scripts/codegen/generator.py        2017-03-09 02:40:54 UTC (rev 213620)
+++ trunk/Source/JavaScriptCore/inspector/scripts/codegen/generator.py        2017-03-09 03:35:13 UTC (rev 213621)
</span><span class="lines">@@ -65,17 +65,16 @@
</span><span class="cx"> ])
</span><span class="cx"> 
</span><span class="cx"> # FIXME: This should be converted into a property in JSON.
</span><del>-_TYPES_WITH_OPEN_FIELDS = set([
-    &quot;Timeline.TimelineEvent&quot;,
</del><ins>+_TYPES_WITH_OPEN_FIELDS = {
+    &quot;Timeline.TimelineEvent&quot;: [],
</ins><span class="cx">     # InspectorStyleSheet not only creates this property but wants to read it and modify it.
</span><del>-    &quot;CSS.CSSProperty&quot;,
</del><ins>+    &quot;CSS.CSSProperty&quot;: [],
</ins><span class="cx">     # InspectorNetworkAgent needs to update mime-type.
</span><del>-    &quot;Network.Response&quot;,
</del><ins>+    &quot;Network.Response&quot;: [&quot;mimeType&quot;],
</ins><span class="cx">     # For testing purposes only.
</span><del>-    &quot;Test.OpenParameterBundle&quot;
-])
</del><ins>+    &quot;Test.OpenParameters&quot;: [&quot;alpha&quot;],
+}
</ins><span class="cx"> 
</span><del>-
</del><span class="cx"> class Generator:
</span><span class="cx">     def __init__(self, model, platform, input_filepath):
</span><span class="cx">         self._model = model
</span><span class="lines">@@ -144,6 +143,13 @@
</span><span class="cx">     def type_has_open_fields(_type):
</span><span class="cx">         return _type.qualified_name() in _TYPES_WITH_OPEN_FIELDS
</span><span class="cx"> 
</span><ins>+    @staticmethod
+    def open_fields(type_declaration):
+        fields = set(_TYPES_WITH_OPEN_FIELDS.get(type_declaration.type.qualified_name(), []))
+        if not fields:
+            return type_declaration.type_members
+        return filter(lambda member: member.member_name in fields, type_declaration.type_members)
+
</ins><span class="cx">     def type_needs_shape_assertions(self, _type):
</span><span class="cx">         if not hasattr(self, &quot;_types_needing_shape_assertions&quot;):
</span><span class="cx">             self.calculate_types_requiring_shape_assertions(self.model().domains)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorscriptstestsgenericexpectedtypewithopenparametersjsonresult"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/type-with-open-parameters.json-result (0 => 213621)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/type-with-open-parameters.json-result                                (rev 0)
+++ trunk/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/type-with-open-parameters.json-result        2017-03-09 03:35:13 UTC (rev 213621)
</span><span class="lines">@@ -0,0 +1,1158 @@
</span><ins>+### Begin File: InspectorBackendCommands.js
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013-2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * 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. AND ITS CONTRIBUTORS ``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 ITS 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.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-with-open-parameters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+### End File: InspectorBackendCommands.js
+
+### Begin File: TestAlternateBackendDispatchers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013-2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * 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. AND ITS CONTRIBUTORS ``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 ITS 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.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-with-open-parameters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#pragma once
+
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+
+#include &quot;TestProtocolTypes.h&quot;
+#include &lt;inspector/InspectorFrontendRouter.h&gt;
+#include &lt;JavaScriptCore/InspectorBackendDispatcher.h&gt;
+
+namespace Inspector {
+
+class AlternateBackendDispatcher {
+public:
+    void setBackendDispatcher(RefPtr&lt;BackendDispatcher&gt;&amp;&amp; dispatcher) { m_backendDispatcher = WTFMove(dispatcher); }
+    BackendDispatcher* backendDispatcher() const { return m_backendDispatcher.get(); }
+private:
+    RefPtr&lt;BackendDispatcher&gt; m_backendDispatcher;
+};
+
+
+
+
+} // namespace Inspector
+
+#endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+### End File: TestAlternateBackendDispatchers.h
+
+### Begin File: TestBackendDispatchers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013-2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * 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. AND ITS CONTRIBUTORS ``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 ITS 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.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-with-open-parameters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#pragma once
+
+#include &quot;TestProtocolObjects.h&quot;
+#include &lt;inspector/InspectorBackendDispatcher.h&gt;
+#include &lt;wtf/text/WTFString.h&gt;
+
+namespace Inspector {
+
+typedef String ErrorString;
+
+
+
+} // namespace Inspector
+### End File: TestBackendDispatchers.h
+
+### Begin File: TestBackendDispatchers.cpp
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013-2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * 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. AND ITS CONTRIBUTORS ``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 ITS 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.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-with-open-parameters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#include &quot;config.h&quot;
+#include &quot;TestBackendDispatchers.h&quot;
+
+#include &lt;inspector/InspectorFrontendRouter.h&gt;
+#include &lt;inspector/InspectorValues.h&gt;
+#include &lt;wtf/NeverDestroyed.h&gt;
+#include &lt;wtf/text/CString.h&gt;
+
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+#include &quot;TestAlternateBackendDispatchers.h&quot;
+#endif
+
+namespace Inspector {
+
+
+
+} // namespace Inspector
+
+### End File: TestBackendDispatchers.cpp
+
+### Begin File: TestFrontendDispatchers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013-2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * 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. AND ITS CONTRIBUTORS ``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 ITS 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.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-with-open-parameters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#pragma once
+
+#include &quot;TestProtocolObjects.h&quot;
+#include &lt;inspector/InspectorValues.h&gt;
+#include &lt;wtf/text/WTFString.h&gt;
+
+namespace Inspector {
+
+class FrontendRouter;
+
+} // namespace Inspector
+### End File: TestFrontendDispatchers.h
+
+### Begin File: TestFrontendDispatchers.cpp
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013-2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * 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. AND ITS CONTRIBUTORS ``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 ITS 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.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-with-open-parameters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#include &quot;config.h&quot;
+#include &quot;TestFrontendDispatchers.h&quot;
+
+#include &quot;InspectorFrontendRouter.h&quot;
+#include &lt;wtf/text/CString.h&gt;
+
+namespace Inspector {
+
+} // namespace Inspector
+
+### End File: TestFrontendDispatchers.cpp
+
+### Begin File: TestProtocolObjects.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013-2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * 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. AND ITS CONTRIBUTORS ``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 ITS 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.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-with-open-parameters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#pragma once
+
+#include &lt;inspector/InspectorProtocolTypes.h&gt;
+#include &lt;wtf/Assertions.h&gt;
+
+namespace Inspector {
+
+
+
+namespace Protocol {
+
+// Forward declarations.
+namespace Test {
+class NoOpenParameters;
+class OpenParameters;
+} // Test
+// End of forward declarations.
+
+
+
+
+namespace Test {
+class NoOpenParameters : public Inspector::InspectorObjectBase {
+public:
+    enum {
+        NoFieldsSet = 0,
+        OneSet = 1 &lt;&lt; 0,
+        TwoSet = 1 &lt;&lt; 1,
+        AllFieldsSet = (OneSet | TwoSet)
+    };
+
+    template&lt;int STATE&gt;
+    class Builder {
+    private:
+        RefPtr&lt;InspectorObject&gt; m_result;
+
+        template&lt;int STEP&gt; Builder&lt;STATE | STEP&gt;&amp; castState()
+        {
+            return *reinterpret_cast&lt;Builder&lt;STATE | STEP&gt;*&gt;(this);
+        }
+
+        Builder(Ref&lt;/*NoOpenParameters*/InspectorObject&gt;&amp;&amp; object)
+            : m_result(WTFMove(object))
+        {
+            COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
+        }
+        friend class NoOpenParameters;
+    public:
+
+        Builder&lt;STATE | OneSet&gt;&amp; setOne(double value)
+        {
+            COMPILE_ASSERT(!(STATE &amp; OneSet), property_one_already_set);
+            m_result-&gt;setDouble(ASCIILiteral(&quot;one&quot;), value);
+            return castState&lt;OneSet&gt;();
+        }
+
+        Builder&lt;STATE | TwoSet&gt;&amp; setTwo(double value)
+        {
+            COMPILE_ASSERT(!(STATE &amp; TwoSet), property_two_already_set);
+            m_result-&gt;setDouble(ASCIILiteral(&quot;two&quot;), value);
+            return castState&lt;TwoSet&gt;();
+        }
+
+        Ref&lt;NoOpenParameters&gt; release()
+        {
+            COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
+            COMPILE_ASSERT(sizeof(NoOpenParameters) == sizeof(InspectorObject), cannot_cast);
+
+            Ref&lt;InspectorObject&gt; result = m_result.releaseNonNull();
+            return WTFMove(*reinterpret_cast&lt;Ref&lt;NoOpenParameters&gt;*&gt;(&amp;result));
+        }
+    };
+
+    /*
+     * Synthetic constructor:
+     * Ref&lt;NoOpenParameters&gt; result = NoOpenParameters::create()
+     *     .setOne(...)
+     *     .setTwo(...)
+     *     .release();
+     */
+    static Builder&lt;NoFieldsSet&gt; create()
+    {
+        return Builder&lt;NoFieldsSet&gt;(InspectorObject::create());
+    }
+};
+
+class OpenParameters : public Inspector::InspectorObject {
+public:
+    enum {
+        NoFieldsSet = 0,
+        AlphaSet = 1 &lt;&lt; 0,
+        BetaSet = 1 &lt;&lt; 1,
+        AllFieldsSet = (AlphaSet | BetaSet)
+    };
+
+    template&lt;int STATE&gt;
+    class Builder {
+    private:
+        RefPtr&lt;InspectorObject&gt; m_result;
+
+        template&lt;int STEP&gt; Builder&lt;STATE | STEP&gt;&amp; castState()
+        {
+            return *reinterpret_cast&lt;Builder&lt;STATE | STEP&gt;*&gt;(this);
+        }
+
+        Builder(Ref&lt;/*OpenParameters*/InspectorObject&gt;&amp;&amp; object)
+            : m_result(WTFMove(object))
+        {
+            COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
+        }
+        friend class OpenParameters;
+    public:
+
+        Builder&lt;STATE | AlphaSet&gt;&amp; setAlpha(double value)
+        {
+            COMPILE_ASSERT(!(STATE &amp; AlphaSet), property_alpha_already_set);
+            m_result-&gt;setDouble(ASCIILiteral(&quot;alpha&quot;), value);
+            return castState&lt;AlphaSet&gt;();
+        }
+
+        Builder&lt;STATE | BetaSet&gt;&amp; setBeta(double value)
+        {
+            COMPILE_ASSERT(!(STATE &amp; BetaSet), property_beta_already_set);
+            m_result-&gt;setDouble(ASCIILiteral(&quot;beta&quot;), value);
+            return castState&lt;BetaSet&gt;();
+        }
+
+        Ref&lt;OpenParameters&gt; release()
+        {
+            COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
+            COMPILE_ASSERT(sizeof(OpenParameters) == sizeof(InspectorObject), cannot_cast);
+
+            Ref&lt;InspectorObject&gt; result = m_result.releaseNonNull();
+            return WTFMove(*reinterpret_cast&lt;Ref&lt;OpenParameters&gt;*&gt;(&amp;result));
+        }
+    };
+
+    /*
+     * Synthetic constructor:
+     * Ref&lt;OpenParameters&gt; result = OpenParameters::create()
+     *     .setAlpha(...)
+     *     .setBeta(...)
+     *     .release();
+     */
+    static Builder&lt;NoFieldsSet&gt; create()
+    {
+        return Builder&lt;NoFieldsSet&gt;(InspectorObject::create());
+    }
+
+    // Property names for type generated as open.
+    None static const char* Alpha;
+};
+
+} // Test
+
+
+
+} // namespace Protocol
+
+} // namespace Inspector
+### End File: TestProtocolObjects.h
+
+### Begin File: TestProtocolObjects.cpp
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013-2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * 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. AND ITS CONTRIBUTORS ``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 ITS 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.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-with-open-parameters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#include &quot;config.h&quot;
+#include &quot;TestProtocolObjects.h&quot;
+
+#include &lt;wtf/Optional.h&gt;
+#include &lt;wtf/text/CString.h&gt;
+
+namespace Inspector {
+
+namespace Protocol {
+
+const char* Inspector::Protocol::Test::OpenParameters::Alpha = &quot;alpha&quot;;
+
+} // namespace Protocol
+
+} // namespace Inspector
+
+### End File: TestProtocolObjects.cpp
+
+### Begin File: TestProtocolBackendDispatchers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013-2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * 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. AND ITS CONTRIBUTORS ``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 ITS 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.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-with-open-parameters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#include &lt;JavaScriptCore/InspectorAlternateBackendDispatchers.h&gt;
+#include &lt;wtf/RetainPtr.h&gt;
+
+
+
+namespace Inspector {
+
+
+} // namespace Inspector
+
+### End File: TestProtocolBackendDispatchers.h
+
+### Begin File: TestProtocolBackendDispatchers.mm
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013-2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * 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. AND ITS CONTRIBUTORS ``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 ITS 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.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-with-open-parameters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import &quot;config.h&quot;
+#import &quot;TestProtocolBackendDispatchers.h&quot;
+
+#include &quot;TestProtocolInternal.h&quot;
+#include &quot;TestProtocolTypeConversions.h&quot;
+#include &lt;JavaScriptCore/InspectorValues.h&gt;
+
+namespace Inspector {
+
+} // namespace Inspector
+
+### End File: TestProtocolBackendDispatchers.mm
+
+### Begin File: TestProtocolConfiguration.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013-2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * 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. AND ITS CONTRIBUTORS ``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 ITS 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.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-with-open-parameters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import &lt;WebInspector/TestProtocol.h&gt;
+
+__attribute__((visibility (&quot;default&quot;)))
+@interface TestProtocolConfiguration : NSObject
+@end
+
+
+### End File: TestProtocolConfiguration.h
+
+### Begin File: TestProtocolConfiguration.mm
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013-2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * 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. AND ITS CONTRIBUTORS ``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 ITS 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.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-with-open-parameters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import &quot;TestProtocolConfiguration.h&quot;
+
+#import &quot;TestProtocolInternal.h&quot;
+#import &quot;TestProtocolBackendDispatchers.h&quot;
+#import &lt;JavaScriptCore/AlternateDispatchableAgent.h&gt;
+#import &lt;JavaScriptCore/AugmentableInspectorController.h&gt;
+#import &lt;JavaScriptCore/InspectorAlternateBackendDispatchers.h&gt;
+#import &lt;JavaScriptCore/InspectorBackendDispatchers.h&gt;
+
+using namespace Inspector;
+
+@implementation TestProtocolConfiguration
+{
+    AugmentableInspectorController* _controller;
+}
+
+- (instancetype)initWithController:(AugmentableInspectorController*)controller
+{
+    self = [super init];
+    if (!self)
+        return nil;
+    ASSERT(controller);
+    _controller = controller;
+    return self;
+}
+
+- (void)dealloc
+{
+    [super dealloc];
+}
+
+@end
+
+
+### End File: TestProtocolConfiguration.mm
+
+### Begin File: TestProtocolEventDispatchers.mm
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013-2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * 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. AND ITS CONTRIBUTORS ``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 ITS 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.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-with-open-parameters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import &quot;TestProtocolInternal.h&quot;
+
+#import &quot;TestProtocolTypeConversions.h&quot;
+#import &lt;JavaScriptCore/InspectorValues.h&gt;
+
+using namespace Inspector;
+
+
+### End File: TestProtocolEventDispatchers.mm
+
+### Begin File: TestProtocol.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013-2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * 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. AND ITS CONTRIBUTORS ``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 ITS 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.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-with-open-parameters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import &lt;Foundation/Foundation.h&gt;
+
+#import &lt;WebInspector/RWIProtocolJSONObject.h&gt;
+
+
+@class TestProtocolTestNoOpenParameters;
+@class TestProtocolTestOpenParameters;
+
+typedef NS_ENUM(NSInteger, TestProtocolPlatform) {
+    TestProtocolPlatformAll,
+    TestProtocolPlatformGeneric,
+    TestProtocolPlatformIOS,
+    TestProtocolPlatformMacOS,
+};
+
+
+
+
+__attribute__((visibility (&quot;default&quot;)))
+@interface TestProtocolTestNoOpenParameters : RWIProtocolJSONObject
+- (instancetype)initWithPayload:(NSDictionary&lt;NSString *, id&gt; *)payload;
+- (instancetype)initWithJSONObject:(RWIProtocolJSONObject *)jsonObject;
+- (instancetype)initWithOne:(double)one two:(double)two;
+/* required */ @property (nonatomic, assign) double one;
+/* required */ @property (nonatomic, assign) double two;
+@end
+
+__attribute__((visibility (&quot;default&quot;)))
+@interface TestProtocolTestOpenParameters : RWIProtocolJSONObject
+- (instancetype)initWithPayload:(NSDictionary&lt;NSString *, id&gt; *)payload;
+- (instancetype)initWithJSONObject:(RWIProtocolJSONObject *)jsonObject;
+- (instancetype)initWithAlpha:(double)alpha beta:(double)beta;
+/* required */ @property (nonatomic, assign) double alpha;
+/* required */ @property (nonatomic, assign) double beta;
+@end
+
+
+
+
+
+
+### End File: TestProtocol.h
+
+### Begin File: TestProtocolInternal.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013-2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * 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. AND ITS CONTRIBUTORS ``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 ITS 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.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-with-open-parameters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import &quot;TestProtocol.h&quot;
+#import &quot;TestProtocolJSONObjectPrivate.h&quot;
+#import &lt;JavaScriptCore/AugmentableInspectorController.h&gt;
+#import &lt;JavaScriptCore/InspectorValues.h&gt;
+
+
+
+
+### End File: TestProtocolInternal.h
+
+### Begin File: TestProtocolTypeConversions.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013-2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * 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. AND ITS CONTRIBUTORS ``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 ITS 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.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-with-open-parameters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import &quot;TestProtocol.h&quot;
+#import &lt;WebInspector/RWIProtocolArrayConversions.h&gt;
+
+namespace Inspector {
+
+template&lt;typename ObjCEnumType&gt;
+std::optional&lt;ObjCEnumType&gt; fromProtocolString(const String&amp; value);
+
+inline String toProtocolString(TestProtocolPlatform value)
+{
+    switch(value) {
+    case TestProtocolPlatformAll:
+        return ASCIILiteral(&quot;all&quot;);
+    case TestProtocolPlatformGeneric:
+        return ASCIILiteral(&quot;generic&quot;);
+    case TestProtocolPlatformIOS:
+        return ASCIILiteral(&quot;ios&quot;);
+    case TestProtocolPlatformMacOS:
+        return ASCIILiteral(&quot;macos&quot;);
+    }
+}
+
+template&lt;&gt;
+inline std::optional&lt;TestProtocolPlatform&gt; fromProtocolString(const String&amp; value)
+{
+    if (value == &quot;all&quot;)
+        return TestProtocolPlatformAll;
+    if (value == &quot;generic&quot;)
+        return TestProtocolPlatformGeneric;
+    if (value == &quot;ios&quot;)
+        return TestProtocolPlatformIOS;
+    if (value == &quot;macos&quot;)
+        return TestProtocolPlatformMacOS;
+    return std::nullopt;
+}
+
+
+
+} // namespace Inspector
+
+### End File: TestProtocolTypeConversions.h
+
+### Begin File: TestProtocolTypeConversions.mm
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013-2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * 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. AND ITS CONTRIBUTORS ``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 ITS 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.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-with-open-parameters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import &quot;TestProtocolTypeConversions.h&quot;
+
+#import &quot;TestProtocol.h&quot;
+#import &quot;TestProtocolTypeParser.h&quot;
+#import &lt;WebInspector/RWIProtocolJSONObjectPrivate.h&gt;
+
+using namespace Inspector;
+
+@interface TestProtocolTypeConversions (TestDomain)
+
++ (void)_parseNoOpenParameters:(TestProtocolTestNoOpenParameters **)outValue fromPayload:(id)payload;
++ (void)_parseOpenParameters:(TestProtocolTestOpenParameters **)outValue fromPayload:(id)payload;
+
+@end
+
+@implementation TestProtocolTypeConversions (TestDomain)
+
++ (void)_parseNoOpenParameters:(TestProtocolTestNoOpenParameters **)outValue fromPayload:(id)payload
+{
+    THROW_EXCEPTION_FOR_BAD_TYPE(payload, [NSDictionary class]);
+    *outValue = [[TestProtocolTestNoOpenParameters alloc] initWithPayload:payload];
+}
+
++ (void)_parseOpenParameters:(TestProtocolTestOpenParameters **)outValue fromPayload:(id)payload
+{
+    THROW_EXCEPTION_FOR_BAD_TYPE(payload, [NSDictionary class]);
+    *outValue = [[TestProtocolTestOpenParameters alloc] initWithPayload:payload];
+}
+
+@end
+
+
+### End File: TestProtocolTypeConversions.mm
+
+### Begin File: TestProtocolTypes.mm
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013-2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * 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. AND ITS CONTRIBUTORS ``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 ITS 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.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-with-open-parameters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import &quot;TestProtocolInternal.h&quot;
+
+#import &quot;TestProtocolTypeConversions.h&quot;
+#import &lt;WebInspector/RWIProtocolJSONObjectPrivate.h&gt;
+#import &lt;JavaScriptCore/InspectorValues.h&gt;
+#import &lt;wtf/Assertions.h&gt;
+
+using namespace Inspector;
+
+
+@implementation TestProtocolTestNoOpenParameters
+
+- (instancetype)initWithPayload:(nonnull NSDictionary&lt;NSString *, id&gt; *)payload
+{
+    if (!(self = [super init]))
+        return nil;
+
+    THROW_EXCEPTION_FOR_REQUIRED_PROPERTY(payload[@&quot;one&quot;], @&quot;one&quot;);
+    self.one = [payload[@&quot;one&quot;] doubleValue];
+
+    THROW_EXCEPTION_FOR_REQUIRED_PROPERTY(payload[@&quot;two&quot;], @&quot;two&quot;);
+    self.two = [payload[@&quot;two&quot;] doubleValue];
+
+    return self;
+}
+- (instancetype)initWithJSONObject:(RWIProtocolJSONObject *)jsonObject
+{
+    if (!(self = [super initWithInspectorObject:[jsonObject toInspectorObject].get()]))
+        return nil;
+
+    return self;
+}
+
+- (instancetype)initWithOne:(double)one two:(double)two
+{
+    if (!(self = [super init]))
+        return nil;
+
+    self.one = one;
+    self.two = two;
+
+    return self;
+}
+
+- (void)setOne:(double)one
+{
+    [super setDouble:one forKey:@&quot;one&quot;];
+}
+
+- (double)one
+{
+    return [super doubleForKey:@&quot;one&quot;];
+}
+
+- (void)setTwo:(double)two
+{
+    [super setDouble:two forKey:@&quot;two&quot;];
+}
+
+- (double)two
+{
+    return [super doubleForKey:@&quot;two&quot;];
+}
+
+@end
+
+@implementation TestProtocolTestOpenParameters
+
+- (instancetype)initWithPayload:(nonnull NSDictionary&lt;NSString *, id&gt; *)payload
+{
+    if (!(self = [super init]))
+        return nil;
+
+    THROW_EXCEPTION_FOR_REQUIRED_PROPERTY(payload[@&quot;alpha&quot;], @&quot;alpha&quot;);
+    self.alpha = [payload[@&quot;alpha&quot;] doubleValue];
+
+    THROW_EXCEPTION_FOR_REQUIRED_PROPERTY(payload[@&quot;beta&quot;], @&quot;beta&quot;);
+    self.beta = [payload[@&quot;beta&quot;] doubleValue];
+
+    return self;
+}
+- (instancetype)initWithJSONObject:(RWIProtocolJSONObject *)jsonObject
+{
+    if (!(self = [super initWithInspectorObject:[jsonObject toInspectorObject].get()]))
+        return nil;
+
+    return self;
+}
+
+- (instancetype)initWithAlpha:(double)alpha beta:(double)beta
+{
+    if (!(self = [super init]))
+        return nil;
+
+    self.alpha = alpha;
+    self.beta = beta;
+
+    return self;
+}
+
+- (void)setAlpha:(double)alpha
+{
+    [super setDouble:alpha forKey:@&quot;alpha&quot;];
+}
+
+- (double)alpha
+{
+    return [super doubleForKey:@&quot;alpha&quot;];
+}
+
+- (void)setBeta:(double)beta
+{
+    [super setDouble:beta forKey:@&quot;beta&quot;];
+}
+
+- (double)beta
+{
+    return [super doubleForKey:@&quot;beta&quot;];
+}
+
+@end
+
+
+### End File: TestProtocolTypes.mm
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorscriptstestsgenerictypewithopenparametersjson"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/inspector/scripts/tests/generic/type-with-open-parameters.json (0 => 213621)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/scripts/tests/generic/type-with-open-parameters.json                                (rev 0)
+++ trunk/Source/JavaScriptCore/inspector/scripts/tests/generic/type-with-open-parameters.json        2017-03-09 03:35:13 UTC (rev 213621)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+{
+    &quot;domain&quot;: &quot;Test&quot;,
+    &quot;types&quot;: [
+        {
+            &quot;id&quot;: &quot;NoOpenParameters&quot;,
+            &quot;type&quot;: &quot;object&quot;,
+            &quot;properties&quot;: [
+                { &quot;name&quot;: &quot;one&quot;, &quot;type&quot;: &quot;number&quot; },
+                { &quot;name&quot;: &quot;two&quot;, &quot;type&quot;: &quot;number&quot; }
+            ]
+        },
+        {
+            &quot;id&quot;: &quot;OpenParameters&quot;,
+            &quot;type&quot;: &quot;object&quot;,
+            &quot;properties&quot;: [
+                { &quot;name&quot;: &quot;alpha&quot;, &quot;type&quot;: &quot;number&quot; },
+                { &quot;name&quot;: &quot;beta&quot;, &quot;type&quot;: &quot;number&quot; }
+            ]
+        }
+    ]
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (213620 => 213621)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2017-03-09 02:40:54 UTC (rev 213620)
+++ trunk/Source/WebCore/ChangeLog        2017-03-09 03:35:13 UTC (rev 213621)
</span><span class="lines">@@ -1,3 +1,45 @@
</span><ins>+2017-03-08  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
+
+        Web Inspector: Should be able to see where Resources came from (Memory Cache, Disk Cache)
+        https://bugs.webkit.org/show_bug.cgi?id=164892
+        &lt;rdar://problem/29320562&gt;
+
+        Reviewed by Brian Burg.
+
+        Test: http/tests/inspector/network/resource-response-source-disk-cache.html
+              http/tests/inspector/network/resource-response-source-memory-cache.html
+              http/tests/inspector/network/resource-response-source-network.html
+
+        * platform/network/ResourceResponseBase.cpp:
+        (WebCore::ResourceResponseBase::setSource): Deleted.
+        * platform/network/ResourceResponseBase.h:
+        (WebCore::ResourceResponseBase::setSource):
+        Make Source mutable to allow it to be set in const methods.
+
+        * loader/SubresourceLoader.cpp:
+        (WebCore::SubresourceLoader::didReceiveResponse):
+        Set the Response source after a successful memory cache validation
+        as early as possible so that future copies have up to date info.
+
+        * inspector/InspectorNetworkAgent.cpp:
+        (WebCore::responseSource):
+        (WebCore::InspectorNetworkAgent::buildObjectForResourceResponse):
+        (WebCore::InspectorNetworkAgent::didLoadResourceFromMemoryCache):
+        (WebCore::InspectorNetworkAgent::markResourceAsCached): Deleted.
+        Eliminate this &quot;markResourceAsCached&quot; path.
+        Update Response to include required source parameter instead of
+        optional fromDiskCache parameter.
+
+        * inspector/InspectorInstrumentation.cpp:
+        (WebCore::InspectorInstrumentation::markResourceAsCachedImpl): Deleted.
+        * inspector/InspectorInstrumentation.h:
+        (WebCore::InspectorInstrumentation::markResourceAsCached): Deleted.
+        * inspector/InspectorNetworkAgent.h:
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::loadedResourceFromMemoryCache):
+        Eliminate this &quot;markResourceAsCached&quot; call because the later delegate
+        messages will include this information.
+
</ins><span class="cx"> 2017-03-08  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Drop support for non-standard document.all.tags()
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorInstrumentationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp (213620 => 213621)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp        2017-03-09 02:40:54 UTC (rev 213620)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp        2017-03-09 03:35:13 UTC (rev 213621)
</span><span class="lines">@@ -564,12 +564,6 @@
</span><span class="cx">     willSendRequestImpl(instrumentingAgents, identifier, loader, request, response);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void InspectorInstrumentation::markResourceAsCachedImpl(InstrumentingAgents&amp; instrumentingAgents, unsigned long identifier)
-{
-    if (InspectorNetworkAgent* networkAgent = instrumentingAgents.inspectorNetworkAgent())
-        networkAgent-&gt;markResourceAsCached(identifier);
-}
-
</del><span class="cx"> void InspectorInstrumentation::didLoadResourceFromMemoryCacheImpl(InstrumentingAgents&amp; instrumentingAgents, DocumentLoader* loader, CachedResource* cachedResource)
</span><span class="cx"> {
</span><span class="cx">     if (!instrumentingAgents.inspectorEnvironment().developerExtrasEnabled())
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorInstrumentationh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorInstrumentation.h (213620 => 213621)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorInstrumentation.h        2017-03-09 02:40:54 UTC (rev 213620)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentation.h        2017-03-09 03:35:13 UTC (rev 213621)
</span><span class="lines">@@ -152,7 +152,6 @@
</span><span class="cx">     static void applyEmulatedMedia(Frame&amp;, String&amp;);
</span><span class="cx">     static void willSendRequest(Frame*, unsigned long identifier, DocumentLoader*, ResourceRequest&amp;, const ResourceResponse&amp; redirectResponse);
</span><span class="cx">     static void continueAfterPingLoader(Frame&amp;, unsigned long identifier, DocumentLoader*, ResourceRequest&amp;, const ResourceResponse&amp;);
</span><del>-    static void markResourceAsCached(Page&amp;, unsigned long identifier);
</del><span class="cx">     static void didLoadResourceFromMemoryCache(Page&amp;, DocumentLoader*, CachedResource*);
</span><span class="cx">     static void didReceiveResourceResponse(Frame&amp;, unsigned long identifier, DocumentLoader*, const ResourceResponse&amp;, ResourceLoader*);
</span><span class="cx">     static void didReceiveThreadableLoaderResponse(DocumentThreadableLoader&amp;, unsigned long identifier);
</span><span class="lines">@@ -835,11 +834,6 @@
</span><span class="cx">         InspectorInstrumentation::continueAfterPingLoaderImpl(*instrumentingAgents, identifier, loader, request, response);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-inline void InspectorInstrumentation::markResourceAsCached(Page&amp; page, unsigned long identifier)
-{
-    markResourceAsCachedImpl(instrumentingAgentsForPage(page), identifier);
-}
-
</del><span class="cx"> inline void InspectorInstrumentation::didLoadResourceFromMemoryCache(Page&amp; page, DocumentLoader* loader, CachedResource* resource)
</span><span class="cx"> {
</span><span class="cx">     didLoadResourceFromMemoryCacheImpl(instrumentingAgentsForPage(page), loader, resource);
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorNetworkAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorNetworkAgent.cpp (213620 => 213621)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorNetworkAgent.cpp        2017-03-09 02:40:54 UTC (rev 213620)
+++ trunk/Source/WebCore/inspector/InspectorNetworkAgent.cpp        2017-03-09 03:35:13 UTC (rev 213621)
</span><span class="lines">@@ -211,6 +211,25 @@
</span><span class="cx">     return requestObject;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static Inspector::Protocol::Network::Response::Source responseSource(ResourceResponse::Source source)
+{
+    switch (source) {
+    case ResourceResponse::Source::Unknown:
+        return Inspector::Protocol::Network::Response::Source::Unknown;
+    case ResourceResponse::Source::Network:
+        return Inspector::Protocol::Network::Response::Source::Network;
+    case ResourceResponse::Source::MemoryCache:
+    case ResourceResponse::Source::MemoryCacheAfterValidation:
+        return Inspector::Protocol::Network::Response::Source::MemoryCache;
+    case ResourceResponse::Source::DiskCache:
+    case ResourceResponse::Source::DiskCacheAfterValidation:
+        return Inspector::Protocol::Network::Response::Source::DiskCache;
+    }
+
+    ASSERT_NOT_REACHED();
+    return Inspector::Protocol::Network::Response::Source::Unknown;
+}
+
</ins><span class="cx"> RefPtr&lt;Inspector::Protocol::Network::Response&gt; InspectorNetworkAgent::buildObjectForResourceResponse(const ResourceResponse&amp; response, ResourceLoader* resourceLoader)
</span><span class="cx"> {
</span><span class="cx">     if (response.isNull())
</span><span class="lines">@@ -225,9 +244,9 @@
</span><span class="cx">         .setStatusText(response.httpStatusText())
</span><span class="cx">         .setHeaders(WTFMove(headers))
</span><span class="cx">         .setMimeType(response.mimeType())
</span><ins>+        .setSource(responseSource(response.source()))
</ins><span class="cx">         .release();
</span><span class="cx"> 
</span><del>-    responseObject-&gt;setFromDiskCache(response.source() == ResourceResponse::Source::DiskCache || response.source() == ResourceResponse::Source::DiskCacheAfterValidation);
</del><span class="cx">     if (resourceLoader)
</span><span class="cx">         responseObject-&gt;setTiming(buildObjectForTiming(response.deprecatedNetworkLoadMetrics(), *resourceLoader));
</span><span class="cx"> 
</span><span class="lines">@@ -309,14 +328,6 @@
</span><span class="cx">     m_frontendDispatcher-&gt;requestWillBeSent(requestId, m_pageAgent-&gt;frameId(loader.frame()), m_pageAgent-&gt;loaderId(&amp;loader), loader.url().string(), buildObjectForResourceRequest(request), timestamp(), initiatorObject, buildObjectForResourceResponse(redirectResponse, nullptr), type != InspectorPageAgent::OtherResource ? &amp;resourceType : nullptr, targetId.isEmpty() ? nullptr : &amp;targetId);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void InspectorNetworkAgent::markResourceAsCached(unsigned long identifier)
-{
-    if (m_hiddenRequestIdentifiers.contains(identifier))
-        return;
-
-    m_frontendDispatcher-&gt;requestServedFromCache(IdentifiersFactory::requestId(identifier));
-}
-
</del><span class="cx"> void InspectorNetworkAgent::didReceiveResponse(unsigned long identifier, DocumentLoader&amp; loader, const ResourceResponse&amp; response, ResourceLoader* resourceLoader)
</span><span class="cx"> {
</span><span class="cx">     if (m_hiddenRequestIdentifiers.contains(identifier))
</span><span class="lines">@@ -428,11 +439,16 @@
</span><span class="cx">     String frameId = m_pageAgent-&gt;frameId(loader.frame());
</span><span class="cx">     unsigned long identifier = loader.frame()-&gt;page()-&gt;progress().createUniqueIdentifier();
</span><span class="cx">     String requestId = IdentifiersFactory::requestId(identifier);
</span><ins>+
</ins><span class="cx">     m_resourcesData-&gt;resourceCreated(requestId, loaderId);
</span><span class="cx">     m_resourcesData-&gt;addCachedResource(requestId, &amp;resource);
</span><span class="cx"> 
</span><span class="cx">     RefPtr&lt;Inspector::Protocol::Network::Initiator&gt; initiatorObject = buildInitiatorObject(loader.frame() ? loader.frame()-&gt;document() : nullptr);
</span><span class="cx"> 
</span><ins>+    // FIXME: It would be ideal to generate the Network.Response with the MemoryCache source
+    // instead of whatever ResourceResponse::Source the CachedResources's response has.
+    // The frontend already knows for certain that this was served from the memory cache.
+
</ins><span class="cx">     m_frontendDispatcher-&gt;requestServedFromMemoryCache(requestId, frameId, loaderId, loader.url().string(), timestamp(), initiatorObject, buildObjectForCachedResource(&amp;resource));
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorNetworkAgenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorNetworkAgent.h (213620 => 213621)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorNetworkAgent.h        2017-03-09 02:40:54 UTC (rev 213620)
+++ trunk/Source/WebCore/inspector/InspectorNetworkAgent.h        2017-03-09 03:35:13 UTC (rev 213621)
</span><span class="lines">@@ -76,7 +76,6 @@
</span><span class="cx">     void willRecalculateStyle();
</span><span class="cx">     void didRecalculateStyle();
</span><span class="cx">     void willSendRequest(unsigned long identifier, DocumentLoader&amp;, ResourceRequest&amp;, const ResourceResponse&amp; redirectResponse);
</span><del>-    void markResourceAsCached(unsigned long identifier);
</del><span class="cx">     void didReceiveResponse(unsigned long identifier, DocumentLoader&amp;, const ResourceResponse&amp;, ResourceLoader*);
</span><span class="cx">     void didReceiveData(unsigned long identifier, const char* data, int dataLength, int encodedDataLength);
</span><span class="cx">     void didFinishLoading(unsigned long identifier, DocumentLoader&amp;);
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderFrameLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (213620 => 213621)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/FrameLoader.cpp        2017-03-09 02:40:54 UTC (rev 213620)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp        2017-03-09 03:35:13 UTC (rev 213621)
</span><span class="lines">@@ -3218,8 +3218,10 @@
</span><span class="cx">     unsigned long identifier;
</span><span class="cx">     ResourceError error;
</span><span class="cx">     requestFromDelegate(newRequest, identifier, error);
</span><del>-    InspectorInstrumentation::markResourceAsCached(*page, identifier);
-    notifier().sendRemainingDelegateMessages(m_documentLoader.get(), identifier, newRequest, resource-&gt;response(), 0, resource-&gt;encodedSize(), 0, error);
</del><ins>+
+    ResourceResponse response = resource-&gt;response();
+    response.setSource(ResourceResponse::Source::MemoryCache);
+    notifier().sendRemainingDelegateMessages(m_documentLoader.get(), identifier, newRequest, response, 0, resource-&gt;encodedSize(), 0, error);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void FrameLoader::applyUserAgent(ResourceRequest&amp; request)
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderSubresourceLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/SubresourceLoader.cpp (213620 => 213621)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/SubresourceLoader.cpp        2017-03-09 02:40:54 UTC (rev 213620)
+++ trunk/Source/WebCore/loader/SubresourceLoader.cpp        2017-03-09 03:35:13 UTC (rev 213621)
</span><span class="lines">@@ -301,12 +301,14 @@
</span><span class="cx">         if (response.httpStatusCode() == 304) {
</span><span class="cx">             // 304 Not modified / Use local copy
</span><span class="cx">             // Existing resource is ok, just use it updating the expiration time.
</span><del>-            m_resource-&gt;setResponse(response);
-            MemoryCache::singleton().revalidationSucceeded(*m_resource, response);
</del><ins>+            ResourceResponse revalidationResponse = response;
+            revalidationResponse.setSource(ResourceResponse::Source::MemoryCacheAfterValidation);
+            m_resource-&gt;setResponse(revalidationResponse);
+            MemoryCache::singleton().revalidationSucceeded(*m_resource, revalidationResponse);
</ins><span class="cx">             if (m_frame &amp;&amp; m_frame-&gt;page())
</span><span class="cx">                 m_frame-&gt;page()-&gt;diagnosticLoggingClient().logDiagnosticMessageWithResult(DiagnosticLoggingKeys::cachedResourceRevalidationKey(), emptyString(), DiagnosticLoggingResultPass, ShouldSample::Yes);
</span><span class="cx">             if (!reachedTerminalState())
</span><del>-                ResourceLoader::didReceiveResponse(response);
</del><ins>+                ResourceLoader::didReceiveResponse(revalidationResponse);
</ins><span class="cx">             return;
</span><span class="cx">         }
</span><span class="cx">         // Did not get 304 response, continue as a regular resource load.
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheMemoryCachecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/MemoryCache.cpp (213620 => 213621)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/MemoryCache.cpp        2017-03-09 02:40:54 UTC (rev 213620)
+++ trunk/Source/WebCore/loader/cache/MemoryCache.cpp        2017-03-09 03:35:13 UTC (rev 213621)
</span><span class="lines">@@ -128,6 +128,7 @@
</span><span class="cx"> 
</span><span class="cx"> void MemoryCache::revalidationSucceeded(CachedResource&amp; revalidatingResource, const ResourceResponse&amp; response)
</span><span class="cx"> {
</span><ins>+    ASSERT(response.source() == ResourceResponse::Source::MemoryCacheAfterValidation);
</ins><span class="cx">     ASSERT(revalidatingResource.resourceToRevalidate());
</span><span class="cx">     CachedResource&amp; resource = *revalidatingResource.resourceToRevalidate();
</span><span class="cx">     ASSERT(!resource.inCache());
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkResourceResponseBasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/ResourceResponseBase.cpp (213620 => 213621)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/ResourceResponseBase.cpp        2017-03-09 02:40:54 UTC (rev 213620)
+++ trunk/Source/WebCore/platform/network/ResourceResponseBase.cpp        2017-03-09 03:35:13 UTC (rev 213621)
</span><span class="lines">@@ -565,11 +565,6 @@
</span><span class="cx">     return m_source;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void ResourceResponseBase::setSource(Source source)
-{
-    m_source = source;
-}
-
</del><span class="cx"> void ResourceResponseBase::lazyInit(InitLevel initLevel) const
</span><span class="cx"> {
</span><span class="cx">     const_cast&lt;ResourceResponse*&gt;(static_cast&lt;const ResourceResponse*&gt;(this))-&gt;platformLazyInit(initLevel);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkResourceResponseBaseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/ResourceResponseBase.h (213620 => 213621)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/ResourceResponseBase.h        2017-03-09 02:40:54 UTC (rev 213620)
+++ trunk/Source/WebCore/platform/network/ResourceResponseBase.h        2017-03-09 03:35:13 UTC (rev 213621)
</span><span class="lines">@@ -132,10 +132,9 @@
</span><span class="cx">     WEBCORE_EXPORT std::optional&lt;std::chrono::system_clock::time_point&gt; lastModified() const;
</span><span class="cx">     ParsedContentRange&amp; contentRange() const;
</span><span class="cx"> 
</span><del>-    // This is primarily for testing support. It is not necessarily accurate in all scenarios.
</del><span class="cx">     enum class Source { Unknown, Network, DiskCache, DiskCacheAfterValidation, MemoryCache, MemoryCacheAfterValidation };
</span><span class="cx">     WEBCORE_EXPORT Source source() const;
</span><del>-    WEBCORE_EXPORT void setSource(Source);
</del><ins>+    void setSource(Source source) { m_source = source; }
</ins><span class="cx"> 
</span><span class="cx">     const std::optional&lt;SHA1::Digest&gt;&amp; cacheBodyKey() const { return m_cacheBodyKey; }
</span><span class="cx">     void setCacheBodyKey(const SHA1::Digest&amp; key) { m_cacheBodyKey = key; }
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/ChangeLog (213620 => 213621)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/ChangeLog        2017-03-09 02:40:54 UTC (rev 213620)
+++ trunk/Source/WebInspectorUI/ChangeLog        2017-03-09 03:35:13 UTC (rev 213621)
</span><span class="lines">@@ -1,3 +1,56 @@
</span><ins>+2017-03-08  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
+
+        Web Inspector: Should be able to see where Resources came from (Memory Cache, Disk Cache)
+        https://bugs.webkit.org/show_bug.cgi?id=164892
+        &lt;rdar://problem/29320562&gt;
+
+        Reviewed by Brian Burg.
+
+        * Localizations/en.lproj/localizedStrings.js:
+        New localized strings for memory/disk cache information.
+
+        * UserInterface/Controllers/FrameResourceManager.js:
+        (WebInspector.FrameResourceManager.prototype.markResourceRequestAsServedFromMemoryCache):
+        Make this legacy path more explicit.
+
+        (WebInspector.FrameResourceManager.prototype.resourceRequestWasServedFromMemoryCache):
+        Make this memory cache path more explicit.
+
+        (WebInspector.FrameResourceManager.prototype.resourceRequestDidReceiveResponse):
+        Pass the resource's response source onward.
+
+        * UserInterface/Models/Resource.js:
+        (WebInspector.Resource):
+        (WebInspector.Resource.responseSourceFromPayload):
+        (WebInspector.Resource.prototype.get responseSource):
+        (WebInspector.Resource.prototype.hasResponse):
+        (WebInspector.Resource.prototype.updateForResponse):
+        (WebInspector.Resource.prototype.markAsCached):
+        (WebInspector.Resource.prototype.legacyMarkServedFromMemoryCache):
+        (WebInspector.Resource.prototype.legacyMarkServedFromDiskCache):
+        Include a WebInspector.ResponseSource enum.
+        Update a Resource's responseSource state where appropriate.
+
+        * UserInterface/Protocol/NetworkObserver.js:
+        (WebInspector.NetworkObserver.prototype.requestServedFromCache):
+        Mark legacy path.
+
+        * UserInterface/Views/NetworkGridContentView.js:
+        (WebInspector.NetworkGridContentView):
+        * UserInterface/Views/NetworkTimelineView.js:
+        (WebInspector.NetworkTimelineView):
+        Tweak default column sizes to make Cached and graph columns a little larger.
+
+        * UserInterface/Views/ResourceTimelineDataGridNode.js:
+        (WebInspector.ResourceTimelineDataGridNode.prototype.createCellContent):
+        (WebInspector.ResourceTimelineDataGridNode.prototype._cachedCellContent):
+        Update &quot;Cached&quot; column data with more information if available.
+
+        * UserInterface/Views/NetworkGridContentView.css:
+        (.content-view.network-grid &gt; .data-grid .cache-type):
+        (.content-view.network-grid &gt; .data-grid:matches(:focus, .force-focus) tr.selected .cache-type):
+        Style the cache type a secondary color.
+
</ins><span class="cx"> 2017-03-08  Devin Rousso  &lt;dcrousso+webkit@gmail.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Web Inspector: add a &quot;create breakpoint&quot; context menu item for linkified source locations
</span></span></pre></div>
<a id="trunkSourceWebInspectorUILocalizationsenlprojlocalizedStringsjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js (213620 => 213621)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js        2017-03-09 02:40:54 UTC (rev 213620)
+++ trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js        2017-03-09 03:35:13 UTC (rev 213621)
</span><span class="lines">@@ -41,7 +41,9 @@
</span><span class="cx"> localizedStrings[&quot;%s cannot be modified&quot;] = &quot;%s cannot be modified&quot;;
</span><span class="cx"> localizedStrings[&quot;%s delay&quot;] = &quot;%s delay&quot;;
</span><span class="cx"> localizedStrings[&quot;%s interval&quot;] = &quot;%s interval&quot;;
</span><ins>+localizedStrings[&quot;(Disk)&quot;] = &quot;(Disk)&quot;;
</ins><span class="cx"> localizedStrings[&quot;(Index)&quot;] = &quot;(Index)&quot;;
</span><ins>+localizedStrings[&quot;(Memory)&quot;] = &quot;(Memory)&quot;;
</ins><span class="cx"> localizedStrings[&quot;(Tail Call)&quot;] = &quot;(Tail Call)&quot;;
</span><span class="cx"> localizedStrings[&quot;(anonymous function)&quot;] = &quot;(anonymous function)&quot;;
</span><span class="cx"> localizedStrings[&quot;(async)&quot;] = &quot;(async)&quot;;
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceControllersFrameResourceManagerjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/FrameResourceManager.js (213620 => 213621)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Controllers/FrameResourceManager.js        2017-03-09 02:40:54 UTC (rev 213620)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/FrameResourceManager.js        2017-03-09 03:35:13 UTC (rev 213621)
</span><span class="lines">@@ -305,7 +305,7 @@
</span><span class="cx">         if (!resource)
</span><span class="cx">             return;
</span><span class="cx"> 
</span><del>-        resource.markAsCached();
</del><ins>+        resource.legacyMarkServedFromMemoryCache();
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     resourceRequestWasServedFromMemoryCache(requestIdentifier, frameIdentifier, loaderIdentifier, cachedResourcePayload, timestamp, initiator)
</span><span class="lines">@@ -318,16 +318,19 @@
</span><span class="cx"> 
</span><span class="cx">         console.assert(!this._resourceRequestIdentifierMap.has(requestIdentifier));
</span><span class="cx"> 
</span><del>-        var elapsedTime = WebInspector.timelineManager.computeElapsedTime(timestamp);
-        var initiatorSourceCodeLocation = this._initiatorSourceCodeLocationFromPayload(initiator);
-        var response = cachedResourcePayload.response;
-        var resource = this._addNewResourceToFrameOrTarget(requestIdentifier, frameIdentifier, loaderIdentifier, cachedResourcePayload.url, cachedResourcePayload.type, &quot;GET&quot;, null, null, elapsedTime, null, null, initiatorSourceCodeLocation);
-        resource.markAsCached();
-        resource.updateForResponse(cachedResourcePayload.url, response.mimeType, cachedResourcePayload.type, response.headers, response.status, response.statusText, elapsedTime, response.timing);
</del><ins>+        let elapsedTime = WebInspector.timelineManager.computeElapsedTime(timestamp);
+        let initiatorSourceCodeLocation = this._initiatorSourceCodeLocationFromPayload(initiator);
+        let response = cachedResourcePayload.response;
+        const responseSource = NetworkAgent.ResponseSource.MemoryCache;
+
+        let resource = this._addNewResourceToFrameOrTarget(requestIdentifier, frameIdentifier, loaderIdentifier, cachedResourcePayload.url, cachedResourcePayload.type, &quot;GET&quot;, null, null, elapsedTime, null, null, initiatorSourceCodeLocation);
+        resource.updateForResponse(cachedResourcePayload.url, response.mimeType, cachedResourcePayload.type, response.headers, response.status, response.statusText, elapsedTime, response.timing, responseSource);
</ins><span class="cx">         resource.increaseSize(cachedResourcePayload.bodySize, elapsedTime);
</span><span class="cx">         resource.increaseTransferSize(cachedResourcePayload.bodySize);
</span><span class="cx">         resource.markAsFinished(elapsedTime);
</span><span class="cx"> 
</span><ins>+        console.assert(resource.cached, &quot;This resource should be classified as cached since it was served from the MemoryCache&quot;, resource);
+
</ins><span class="cx">         if (cachedResourcePayload.sourceMapURL)
</span><span class="cx">             WebInspector.sourceMapManager.downloadSourceMap(cachedResourcePayload.sourceMapURL, resource.url, resource);
</span><span class="cx"> 
</span><span class="lines">@@ -372,10 +375,11 @@
</span><span class="cx">             this._resourceRequestIdentifierMap.set(requestIdentifier, resource);
</span><span class="cx">         }
</span><span class="cx"> 
</span><ins>+        // COMPATIBILITY (iOS 10.3): `fromDiskCache` is legacy, replaced by `source`.
</ins><span class="cx">         if (response.fromDiskCache)
</span><del>-            resource.markAsCached();
</del><ins>+            resource.legacyMarkServedFromDiskCache();
</ins><span class="cx"> 
</span><del>-        resource.updateForResponse(response.url, response.mimeType, type, response.headers, response.status, response.statusText, elapsedTime, response.timing);
</del><ins>+        resource.updateForResponse(response.url, response.mimeType, type, response.headers, response.status, response.statusText, elapsedTime, response.timing, response.source);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     resourceRequestDidReceiveData(requestIdentifier, dataLength, encodedDataLength, timestamp)
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceModelsResourcejs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Models/Resource.js (213620 => 213621)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Models/Resource.js        2017-03-09 02:40:54 UTC (rev 213620)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/Resource.js        2017-03-09 03:35:13 UTC (rev 213621)
</span><span class="lines">@@ -56,9 +56,12 @@
</span><span class="cx">         this._lastDataReceivedTimestamp = NaN;
</span><span class="cx">         this._finishedOrFailedTimestamp = NaN;
</span><span class="cx">         this._finishThenRequestContentPromise = null;
</span><ins>+        this._statusCode = NaN;
+        this._statusText = null;
</ins><span class="cx">         this._size = NaN;
</span><span class="cx">         this._transferSize = NaN;
</span><span class="cx">         this._cached = false;
</span><ins>+        this._responseSource = WebInspector.Resource.ResponseSource.Unknown;
</ins><span class="cx">         this._timingData = new WebInspector.ResourceTimingData(this);
</span><span class="cx">         this._target = targetId ? WebInspector.targetManager.targetForIdentifier(targetId) : WebInspector.mainTarget;
</span><span class="cx"> 
</span><span class="lines">@@ -130,10 +133,37 @@
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    static responseSourceFromPayload(source)
+    {
+        if (!source)
+            return WebInspector.Resource.ResponseSource.Unknown;
+
+        switch (source) {
+        case NetworkAgent.ResponseSource.Unknown:
+            return WebInspector.Resource.ResponseSource.Unknown;
+        case NetworkAgent.ResponseSource.Network:
+            return WebInspector.Resource.ResponseSource.Network;
+        case NetworkAgent.ResponseSource.MemoryCache:
+            return WebInspector.Resource.ResponseSource.MemoryCache;
+        case NetworkAgent.ResponseSource.DiskCache:
+            return WebInspector.Resource.ResponseSource.DiskCache;
+        default:
+            console.error(&quot;Unknown response source type: &quot;, source);
+            return WebInspector.Resource.ResponseSource.Unknown;
+        }
+    }
+
</ins><span class="cx">     // Public
</span><span class="cx"> 
</span><span class="cx">     get target() { return this._target; }
</span><span class="cx">     get type() { return this._type; }
</span><ins>+    get loaderIdentifier() { return this._loaderIdentifier; }
+    get requestIdentifier() { return this._requestIdentifier; }
+    get requestMethod() { return this._requestMethod; }
+    get requestData() { return this._requestData; }
+    get statusCode() { return this._statusCode; }
+    get statusText() { return this._statusText; }
+    get responseSource() { return this._responseSource; }
</ins><span class="cx">     get timingData() { return this._timingData; }
</span><span class="cx"> 
</span><span class="cx">     get url()
</span><span class="lines">@@ -245,16 +275,6 @@
</span><span class="cx">         return this._parentFrame;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    get loaderIdentifier()
-    {
-        return this._loaderIdentifier;
-    }
-
-    get requestIdentifier()
-    {
-        return this._requestIdentifier;
-    }
-
</del><span class="cx">     get finished()
</span><span class="cx">     {
</span><span class="cx">         return this._finished;
</span><span class="lines">@@ -270,16 +290,6 @@
</span><span class="cx">         return this._canceled;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    get requestMethod()
-    {
-        return this._requestMethod;
-    }
-
-    get requestData()
-    {
-        return this._requestData;
-    }
-
</del><span class="cx">     get requestDataContentType()
</span><span class="cx">     {
</span><span class="cx">         return this._requestHeaders.valueForCaseInsensitiveKey(&quot;Content-Type&quot;) || null;
</span><span class="lines">@@ -350,16 +360,6 @@
</span><span class="cx">         return this._cached;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    get statusCode()
-    {
-        return this._statusCode;
-    }
-
-    get statusText()
-    {
-        return this._statusText;
-    }
-
</del><span class="cx">     get size()
</span><span class="cx">     {
</span><span class="cx">         return this._size;
</span><span class="lines">@@ -452,15 +452,20 @@
</span><span class="cx">         this.dispatchEventToListeners(WebInspector.Resource.Event.TimestampsDidChange);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    updateForResponse(url, mimeType, type, responseHeaders, statusCode, statusText, elapsedTime, timingData)
</del><ins>+    hasResponse()
</ins><span class="cx">     {
</span><ins>+        return !isNaN(this._statusCode);
+    }
+
+    updateForResponse(url, mimeType, type, responseHeaders, statusCode, statusText, elapsedTime, timingData, source)
+    {
</ins><span class="cx">         console.assert(!this._finished);
</span><span class="cx">         console.assert(!this._failed);
</span><span class="cx">         console.assert(!this._canceled);
</span><span class="cx"> 
</span><del>-        var oldURL = this._url;
-        var oldMIMEType = this._mimeType;
-        var oldType = this._type;
</del><ins>+        let oldURL = this._url;
+        let oldMIMEType = this._mimeType;
+        let oldType = this._type;
</ins><span class="cx"> 
</span><span class="cx">         if (type in WebInspector.Resource.Type)
</span><span class="cx">             type = WebInspector.Resource.Type[type];
</span><span class="lines">@@ -474,12 +479,17 @@
</span><span class="cx">         this._responseReceivedTimestamp = elapsedTime || NaN;
</span><span class="cx">         this._timingData = WebInspector.ResourceTimingData.fromPayload(timingData, this);
</span><span class="cx"> 
</span><ins>+        if (source)
+            this._responseSource = WebInspector.Resource.responseSourceFromPayload(source);
+
</ins><span class="cx">         this._responseHeadersSize = String(this._statusCode).length + this._statusText.length + 12; // Extra length is for &quot;HTTP/1.1 &quot;, &quot; &quot;, and &quot;\r\n&quot;.
</span><del>-        for (var name in this._responseHeaders)
</del><ins>+        for (let name in this._responseHeaders)
</ins><span class="cx">             this._responseHeadersSize += name.length + this._responseHeaders[name].length + 4; // Extra length is for &quot;: &quot;, and &quot;\r\n&quot;.
</span><span class="cx"> 
</span><del>-        if (statusCode === 304 &amp;&amp; !this._cached)
-            this.markAsCached();
</del><ins>+        if (!this._cached) {
+            if (statusCode === 304 || (this._responseSource === WebInspector.Resource.ResponseSource.MemoryCache || this._responseSource === WebInspector.Resource.ResponseSource.DiskCache))
+                this.markAsCached();
+        }
</ins><span class="cx"> 
</span><span class="cx">         if (oldURL !== url) {
</span><span class="cx">             // Delete the URL components so the URL is re-parsed the next time it is requested.
</span><span class="lines">@@ -566,7 +576,7 @@
</span><span class="cx"> 
</span><span class="cx">         this.dispatchEventToListeners(WebInspector.Resource.Event.CacheStatusDidChange);
</span><span class="cx"> 
</span><del>-        // The transferSize is starts returning 0 when cached is true, unless status is 304.
</del><ins>+        // The transferSize starts returning 0 when cached is true, unless status is 304.
</ins><span class="cx">         if (this._statusCode !== 304)
</span><span class="cx">             this.dispatchEventToListeners(WebInspector.Resource.Event.TransferSizeDidChange);
</span><span class="cx">     }
</span><span class="lines">@@ -609,6 +619,26 @@
</span><span class="cx">         this._finishedOrFailedTimestamp = NaN;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    legacyMarkServedFromMemoryCache()
+    {
+        // COMPATIBILITY (iOS 10.3): This is a legacy code path where we know the resource came from the MemoryCache.
+        console.assert(this._responseSource === WebInspector.Resource.ResponseSource.Unknown);
+
+        this._responseSource = WebInspector.Resource.ResponseSource.MemoryCache;
+
+        this.markAsCached();
+    }
+
+    legacyMarkServedFromDiskCache()
+    {
+        // COMPATIBILITY (iOS 10.3): This is a legacy code path where we know the resource came from the DiskCache.
+        console.assert(this._responseSource === WebInspector.Resource.ResponseSource.Unknown);
+
+        this._responseSource = WebInspector.Resource.ResponseSource.DiskCache;
+
+        this.markAsCached();
+    }
+
</ins><span class="cx">     getImageSize(callback)
</span><span class="cx">     {
</span><span class="cx">         // Throw an error in the case this resource is not an image.
</span><span class="lines">@@ -762,6 +792,13 @@
</span><span class="cx">     Other: &quot;resource-type-other&quot;
</span><span class="cx"> };
</span><span class="cx"> 
</span><ins>+WebInspector.Resource.ResponseSource = {
+    Unknown: Symbol(&quot;unknown&quot;),
+    Network: Symbol(&quot;network&quot;),
+    MemoryCache: Symbol(&quot;memory-cache&quot;),
+    DiskCache: Symbol(&quot;disk-cache&quot;),
+};
+
</ins><span class="cx"> // This MIME Type map is private, use WebInspector.Resource.typeFromMIMEType().
</span><span class="cx"> WebInspector.Resource._mimeTypeMap = {
</span><span class="cx">     &quot;text/html&quot;: WebInspector.Resource.Type.Document,
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceProtocolNetworkObserverjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Protocol/NetworkObserver.js (213620 => 213621)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Protocol/NetworkObserver.js        2017-03-09 02:40:54 UTC (rev 213620)
+++ trunk/Source/WebInspectorUI/UserInterface/Protocol/NetworkObserver.js        2017-03-09 03:35:13 UTC (rev 213621)
</span><span class="lines">@@ -34,6 +34,7 @@
</span><span class="cx"> 
</span><span class="cx">     requestServedFromCache(requestId)
</span><span class="cx">     {
</span><ins>+        // COMPATIBILITY (iOS 10.3): The backend no longer sends this.
</ins><span class="cx">         WebInspector.frameResourceManager.markResourceRequestAsServedFromMemoryCache(requestId);
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsNetworkGridContentViewcss"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/NetworkGridContentView.css (213620 => 213621)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/NetworkGridContentView.css        2017-03-09 02:40:54 UTC (rev 213620)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/NetworkGridContentView.css        2017-03-09 03:35:13 UTC (rev 213621)
</span><span class="lines">@@ -42,3 +42,11 @@
</span><span class="cx"> .content-view.network-grid &gt; .data-grid .preserved:not(.selected) .cell-content .timeline-record-bar &gt; .segment {
</span><span class="cx">     filter: grayscale();
</span><span class="cx"> }
</span><ins>+
+.content-view.network-grid &gt; .data-grid .cache-type {
+    color: gray;
+}
+
+.content-view.network-grid &gt; .data-grid:matches(:focus, .force-focus) tr.selected .cache-type {
+    color: var(--selected-foreground-color) !important;
+}
</ins></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsNetworkGridContentViewjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/NetworkGridContentView.js (213620 => 213621)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/NetworkGridContentView.js        2017-03-09 02:40:54 UTC (rev 213620)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/NetworkGridContentView.js        2017-03-09 03:35:13 UTC (rev 213621)
</span><span class="lines">@@ -45,22 +45,22 @@
</span><span class="cx">         columns.domain.width = &quot;10%&quot;;
</span><span class="cx"> 
</span><span class="cx">         columns.type.title = WebInspector.UIString(&quot;Type&quot;);
</span><del>-        columns.type.width = &quot;8%&quot;;
</del><ins>+        columns.type.width = &quot;6%&quot;;
</ins><span class="cx"> 
</span><span class="cx">         columns.method.title = WebInspector.UIString(&quot;Method&quot;);
</span><del>-        columns.method.width = &quot;6%&quot;;
</del><ins>+        columns.method.width = &quot;5%&quot;;
</ins><span class="cx"> 
</span><span class="cx">         columns.scheme.title = WebInspector.UIString(&quot;Scheme&quot;);
</span><del>-        columns.scheme.width = &quot;6%&quot;;
</del><ins>+        columns.scheme.width = &quot;5%&quot;;
</ins><span class="cx"> 
</span><span class="cx">         columns.statusCode.title = WebInspector.UIString(&quot;Status&quot;);
</span><del>-        columns.statusCode.width = &quot;6%&quot;;
</del><ins>+        columns.statusCode.width = &quot;5%&quot;;
</ins><span class="cx"> 
</span><span class="cx">         columns.cached.title = WebInspector.UIString(&quot;Cached&quot;);
</span><del>-        columns.cached.width = &quot;6%&quot;;
</del><ins>+        columns.cached.width = &quot;8%&quot;;
</ins><span class="cx"> 
</span><span class="cx">         columns.size.title = WebInspector.UIString(&quot;Size&quot;);
</span><del>-        columns.size.width = &quot;8%&quot;;
</del><ins>+        columns.size.width = &quot;6%&quot;;
</ins><span class="cx">         columns.size.aligned = &quot;right&quot;;
</span><span class="cx"> 
</span><span class="cx">         columns.transferSize.title = WebInspector.UIString(&quot;Transferred&quot;);
</span><span class="lines">@@ -86,7 +86,7 @@
</span><span class="cx">         this._timelineRuler.allowsClippedLabels = true;
</span><span class="cx"> 
</span><span class="cx">         columns.graph.title = WebInspector.UIString(&quot;Timeline&quot;);
</span><del>-        columns.graph.width = &quot;15%&quot;;
</del><ins>+        columns.graph.width = &quot;20%&quot;;
</ins><span class="cx">         columns.graph.headerView = this._timelineRuler;
</span><span class="cx">         columns.graph.sortable = false;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsNetworkTimelineViewjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTimelineView.js (213620 => 213621)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTimelineView.js        2017-03-09 02:40:54 UTC (rev 213620)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTimelineView.js        2017-03-09 03:35:13 UTC (rev 213621)
</span><span class="lines">@@ -63,10 +63,10 @@
</span><span class="cx">         columns.statusCode.width = &quot;4%&quot;;
</span><span class="cx"> 
</span><span class="cx">         columns.cached.title = WebInspector.UIString(&quot;Cached&quot;);
</span><del>-        columns.cached.width = &quot;4%&quot;;
</del><ins>+        columns.cached.width = &quot;6%&quot;;
</ins><span class="cx"> 
</span><span class="cx">         columns.size.title = WebInspector.UIString(&quot;Size&quot;);
</span><del>-        columns.size.width = &quot;8%&quot;;
</del><ins>+        columns.size.width = &quot;6%&quot;;
</ins><span class="cx">         columns.size.aligned = &quot;right&quot;;
</span><span class="cx"> 
</span><span class="cx">         columns.transferSize.title = WebInspector.UIString(&quot;Transferred&quot;);
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsResourceTimelineDataGridNodejs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ResourceTimelineDataGridNode.js (213620 => 213621)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/ResourceTimelineDataGridNode.js        2017-03-09 02:40:54 UTC (rev 213620)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ResourceTimelineDataGridNode.js        2017-03-09 03:35:13 UTC (rev 213621)
</span><span class="lines">@@ -90,12 +90,12 @@
</span><span class="cx"> 
</span><span class="cx">     createCellContent(columnIdentifier, cell)
</span><span class="cx">     {
</span><del>-        var resource = this._resource;
</del><ins>+        let resource = this._resource;
</ins><span class="cx"> 
</span><span class="cx">         if (resource.failed || resource.canceled || resource.statusCode &gt;= 400)
</span><span class="cx">             cell.classList.add(&quot;error&quot;);
</span><span class="cx"> 
</span><del>-        var value = this.data[columnIdentifier];
</del><ins>+        let value = this.data[columnIdentifier];
</ins><span class="cx"> 
</span><span class="cx">         switch (columnIdentifier) {
</span><span class="cx">         case &quot;name&quot;:
</span><span class="lines">@@ -112,7 +112,7 @@
</span><span class="cx">             return value || emDash;
</span><span class="cx"> 
</span><span class="cx">         case &quot;cached&quot;:
</span><del>-            return value ? WebInspector.UIString(&quot;Yes&quot;) : WebInspector.UIString(&quot;No&quot;);
</del><ins>+            return this._cachedCellContent();
</ins><span class="cx"> 
</span><span class="cx">         case &quot;domain&quot;:
</span><span class="cx">             return value || emDash;
</span><span class="lines">@@ -219,6 +219,25 @@
</span><span class="cx">         return fragment;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    _cachedCellContent()
+    {
+        if (!this._resource.hasResponse())
+            return emDash;
+
+        let responseSource = this._resource.responseSource;
+        if (responseSource === WebInspector.Resource.ResponseSource.MemoryCache || responseSource === WebInspector.Resource.ResponseSource.DiskCache) {
+            console.assert(this._resource.cached, &quot;This resource has a cache responseSource it should also be marked as cached&quot;, resource);
+            let span = document.createElement(&quot;span&quot;);
+            let cacheType = document.createElement(&quot;span&quot;);
+            cacheType.classList = &quot;cache-type&quot;;
+            cacheType.textContent = responseSource === WebInspector.Resource.ResponseSource.MemoryCache ? WebInspector.UIString(&quot;(Memory)&quot;) : WebInspector.UIString(&quot;(Disk)&quot;);
+            span.append(WebInspector.UIString(&quot;Yes&quot;), &quot; &quot;, cacheType);
+            return span;
+        }
+
+        return this._resource.cached ? WebInspector.UIString(&quot;Yes&quot;) : WebInspector.UIString(&quot;No&quot;);
+    }
+
</ins><span class="cx">     _needsRefresh()
</span><span class="cx">     {
</span><span class="cx">         if (this.dataGrid instanceof WebInspector.TimelineDataGrid) {
</span></span></pre>
</div>
</div>

</body>
</html>