Title: [233117] trunk/Source/WebCore
Revision
233117
Author
[email protected]
Date
2018-06-22 18:22:04 -0700 (Fri, 22 Jun 2018)

Log Message

SubresourceLoader::didFail() should only log message if state is Initialized
https://bugs.webkit.org/show_bug.cgi?id=185124

Patch by Woodrow Wang <[email protected]> on 2018-06-22
Reviewed by Daniel Bates.

Functionality does not change. Moved console logging to be
after checking state of subresource loader. We only need to
log if the state is initialized. This is consistent with other
functions in the file. We can also remove a null check for the
frame pointer (m_frame). The superclass ResourceLoader constructor
takes an lvalue reference and initializes m_frame, ensuring
m_frame cannot be null. It is only set to null by
ResourceLoader::releaseResources(), which is only called after the
resource finishes loading or fails to load. Thus, in didFail(),
m_frame must be non-null when we're logging and up until the end of the function.

* loader/SubresourceLoader.cpp:
(WebCore::SubresourceLoader::didFail):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (233116 => 233117)


--- trunk/Source/WebCore/ChangeLog	2018-06-23 01:21:13 UTC (rev 233116)
+++ trunk/Source/WebCore/ChangeLog	2018-06-23 01:22:04 UTC (rev 233117)
@@ -1,3 +1,24 @@
+2018-06-22  Woodrow Wang  <[email protected]>
+
+        SubresourceLoader::didFail() should only log message if state is Initialized
+        https://bugs.webkit.org/show_bug.cgi?id=185124
+
+        Reviewed by Daniel Bates.
+
+        Functionality does not change. Moved console logging to be 
+        after checking state of subresource loader. We only need to 
+        log if the state is initialized. This is consistent with other
+        functions in the file. We can also remove a null check for the 
+        frame pointer (m_frame). The superclass ResourceLoader constructor
+        takes an lvalue reference and initializes m_frame, ensuring
+        m_frame cannot be null. It is only set to null by 
+        ResourceLoader::releaseResources(), which is only called after the 
+        resource finishes loading or fails to load. Thus, in didFail(), 
+        m_frame must be non-null when we're logging and up until the end of the function.  
+
+        * loader/SubresourceLoader.cpp:
+        (WebCore::SubresourceLoader::didFail):
+
 2018-06-22  Timothy Hatcher  <[email protected]>
 
         Corner of two scroll bars is white with dark mode enabled.

Modified: trunk/Source/WebCore/loader/SubresourceLoader.cpp (233116 => 233117)


--- trunk/Source/WebCore/loader/SubresourceLoader.cpp	2018-06-23 01:21:13 UTC (rev 233116)
+++ trunk/Source/WebCore/loader/SubresourceLoader.cpp	2018-06-23 01:22:04 UTC (rev 233117)
@@ -648,8 +648,6 @@
 
 void SubresourceLoader::didFail(const ResourceError& error)
 {
-    if (m_frame && m_frame->document() && error.isAccessControl())
-        m_frame->document()->addConsoleMessage(MessageSource::Security, MessageLevel::Error, error.localizedDescription());
 
 #if USE(QUICK_LOOK)
     if (auto previewLoader = m_previewLoader.get())
@@ -660,7 +658,10 @@
         return;
     ASSERT(!reachedTerminalState());
     LOG(ResourceLoading, "Failed to load '%s'.\n", m_resource->url().string().latin1().data());
+    if (m_frame->document() && error.isAccessControl())
+        m_frame->document()->addConsoleMessage(MessageSource::Security, MessageLevel::Error, error.localizedDescription());
 
+
     Ref<SubresourceLoader> protectedThis(*this);
     CachedResourceHandle<CachedResource> protectResource(m_resource);
     m_state = Finishing;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to