Title: [216051] trunk/Source/WebCore
Revision
216051
Author
[email protected]
Date
2017-05-01 18:16:26 -0700 (Mon, 01 May 2017)

Log Message

Simplify Resource Timing handling of cached resource
https://bugs.webkit.org/show_bug.cgi?id=171526

Patch by Joseph Pecoraro <[email protected]> on 2017-05-01
Reviewed by Youenn Fablet.

* loader/DocumentThreadableLoader.cpp:
(WebCore::DocumentThreadableLoader::loadRequest):
* loader/SubresourceLoader.cpp:
(WebCore::SubresourceLoader::init):
(WebCore::SubresourceLoader::reportResourceTiming):
Use auto in ResourceTiming construction.
Eliminate an outdated comment.

* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::requestResource):
We can avoid the checks around the request.origin. It should already
be the cases we were checking and asserting because of login in
CachedResourceLoader::prepareFetch.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (216050 => 216051)


--- trunk/Source/WebCore/ChangeLog	2017-05-02 01:07:44 UTC (rev 216050)
+++ trunk/Source/WebCore/ChangeLog	2017-05-02 01:16:26 UTC (rev 216051)
@@ -1,3 +1,24 @@
+2017-05-01  Joseph Pecoraro  <[email protected]>
+
+        Simplify Resource Timing handling of cached resource
+        https://bugs.webkit.org/show_bug.cgi?id=171526
+
+        Reviewed by Youenn Fablet.
+
+        * loader/DocumentThreadableLoader.cpp:
+        (WebCore::DocumentThreadableLoader::loadRequest):
+        * loader/SubresourceLoader.cpp:
+        (WebCore::SubresourceLoader::init):
+        (WebCore::SubresourceLoader::reportResourceTiming):
+        Use auto in ResourceTiming construction.
+        Eliminate an outdated comment.
+
+        * loader/cache/CachedResourceLoader.cpp:
+        (WebCore::CachedResourceLoader::requestResource):
+        We can avoid the checks around the request.origin. It should already
+        be the cases we were checking and asserting because of login in
+        CachedResourceLoader::prepareFetch.
+
 2017-05-01  Ryan Haddad  <[email protected]>
 
         Unreviewed, rolling out r216024.

Modified: trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp (216050 => 216051)


--- trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp	2017-05-02 01:07:44 UTC (rev 216050)
+++ trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp	2017-05-02 01:16:26 UTC (rev 216051)
@@ -504,7 +504,7 @@
 
 #if ENABLE(WEB_TIMING)
     if (RuntimeEnabledFeatures::sharedFeatures().resourceTimingEnabled()) {
-        ResourceTiming resourceTiming = ResourceTiming::fromSynchronousLoad(requestURL, m_options.initiator, loadTiming, response.deprecatedNetworkLoadMetrics(), response, securityOrigin());
+        auto resourceTiming = ResourceTiming::fromSynchronousLoad(requestURL, m_options.initiator, loadTiming, response.deprecatedNetworkLoadMetrics(), response, securityOrigin());
         if (options().initiatorContext == InitiatorContext::Worker)
             finishedTimingForWorkerLoad(resourceTiming);
         else {

Modified: trunk/Source/WebCore/loader/SubresourceLoader.cpp (216050 => 216051)


--- trunk/Source/WebCore/loader/SubresourceLoader.cpp	2017-05-02 01:07:44 UTC (rev 216050)
+++ trunk/Source/WebCore/loader/SubresourceLoader.cpp	2017-05-02 01:16:26 UTC (rev 216051)
@@ -153,9 +153,6 @@
     m_state = Initialized;
     m_documentLoader->addSubresourceLoader(this);
 
-    // FIXME: https://bugs.webkit.org/show_bug.cgi?id=155633.
-    // SubresourceLoader could use the document origin as a default and set PotentiallyCrossOriginEnabled requests accordingly.
-    // This would simplify resource loader users as they would only need to set fetch mode to Cors.
     m_origin = m_resource->origin();
 
     return true;
@@ -698,7 +695,7 @@
         return;
 
     SecurityOrigin& origin = m_origin ? *m_origin : document->securityOrigin();
-    ResourceTiming resourceTiming = ResourceTiming::fromLoad(*m_resource, m_resource->initiatorName(), m_loadTiming, networkLoadMetrics, origin);
+    auto resourceTiming = ResourceTiming::fromLoad(*m_resource, m_resource->initiatorName(), m_loadTiming, networkLoadMetrics, origin);
 
     // Worker resources loaded here are all CachedRawResources loaded through WorkerThreadableLoader.
     // Pass the ResourceTiming information on so that WorkerThreadableLoader may add them to the

Modified: trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp (216050 => 216051)


--- trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp	2017-05-02 01:07:44 UTC (rev 216050)
+++ trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp	2017-05-02 01:16:26 UTC (rev 216051)
@@ -777,10 +777,8 @@
             loadTiming.setResponseEnd(MonotonicTime::now());
 
             if (RuntimeEnabledFeatures::sharedFeatures().resourceTimingEnabled() && document() && !resource->isLoading()) {
-                const SecurityOrigin& origin = request.origin() ? *request.origin() : document()->securityOrigin();
-                ResourceTiming resourceTiming = ResourceTiming::fromCache(url, request.initiatorName(), loadTiming, resource->response(), origin);
+                auto resourceTiming = ResourceTiming::fromCache(url, request.initiatorName(), loadTiming, resource->response(), *request.origin());
                 if (initiatorContext == InitiatorContext::Worker) {
-                    ASSERT(request.origin());
                     ASSERT(is<CachedRawResource>(resource.get()));
                     downcast<CachedRawResource>(resource.get())->finishedTimingForWorkerLoad(WTFMove(resourceTiming));
                 } else {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to