Bug 185124 - SubresourceLoader::didFail() should only log message if state is Initialized
Summary: SubresourceLoader::didFail() should only log message if state is Initialized
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Woodrow Wang
URL:
Keywords: EasyFix, InRadar
Depends on:
Blocks:
 
Reported: 2018-04-29 11:59 PDT by Daniel Bates
Modified: 2018-06-22 18:23 PDT (History)
8 users (show)

See Also:


Attachments
Patch (2.30 KB, patch)
2018-06-22 14:38 PDT, Woodrow Wang
no flags Details | Formatted Diff | Diff
Patch (2.65 KB, patch)
2018-06-22 17:32 PDT, Woodrow Wang
no flags Details | Formatted Diff | Diff
Patch (2.65 KB, patch)
2018-06-22 17:40 PDT, Woodrow Wang
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Bates 2018-04-29 11:59:04 PDT
SubresourceLoader::didFail() has the followzing code:

[[
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)
...
#endif

    if (m_state != Initialized)
        return;
    ASSERT(!reachedTerminalState());
    LOG(ResourceLoading, "Failed to load '%s'.\n", m_resource->url().string().latin1().data());
...
]]

The logic to log a console message should be moved after LOG() such that we only perform this logic if m_state != Initialized. Moreover, we do not need to null check m_frame once we move the code because it can never be null so long as we have not reached he terminal state.
Comment 1 Woodrow Wang 2018-06-22 14:38:21 PDT
Created attachment 343369 [details]
Patch
Comment 2 Woodrow Wang 2018-06-22 17:32:44 PDT
Created attachment 343402 [details]
Patch
Comment 3 Woodrow Wang 2018-06-22 17:40:40 PDT
Created attachment 343403 [details]
Patch
Comment 4 WebKit Commit Bot 2018-06-22 18:22:10 PDT
Comment on attachment 343403 [details]
Patch

Clearing flags on attachment: 343403

Committed r233117: <https://trac.webkit.org/changeset/233117>
Comment 5 WebKit Commit Bot 2018-06-22 18:22:12 PDT
All reviewed patches have been landed.  Closing bug.
Comment 6 Radar WebKit Bug Importer 2018-06-22 18:23:17 PDT
<rdar://problem/41389563>