Bug 130044 - Web Inspector: Frontend loaded resources from cache are not hidden as expected
Summary: Web Inspector: Frontend loaded resources from cache are not hidden as expected
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2014-03-10 15:21 PDT by Joseph Pecoraro
Modified: 2015-11-26 21:33 PST (History)
8 users (show)

See Also:


Attachments
[PATCH] Proposed Fix (5.01 KB, patch)
2014-03-10 15:44 PDT, Joseph Pecoraro
timothy: review+
Details | Formatted Diff | Diff
[PATCH] For Landing (4.82 KB, patch)
2014-03-10 20:37 PDT, Joseph Pecoraro
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph Pecoraro 2014-03-10 15:21:32 PDT
* STEPS TO REPRODUCE
1. Load page with source map resources.
2. Inspect page
3. Reload page from inspector (so that source map resources load from cache)
  => Source map loads show up as page loaded resources instead of getting hidden
Comment 1 Joseph Pecoraro 2014-03-10 15:22:39 PDT
The issue is that when there is a cached resource load of a frontend loaded resource, WebCore send their resource load notifier delegates with a fresh ResourceRequest, losing out on the flags from the original resource request. For example:

lldb> bt
  * frame #0:  WebCore`WebCore::InspectorResourceAgent::willSendRequest
    ...
    frame #5:  WebCore`WebCore::FrameLoader::loadedResourceFromMemoryCache
    frame #6:  WebCore`WebCore::CachedResourceLoader::shouldContinueAfterNotifyingLoadedFromMemoryCache
    frame #7:  WebCore`WebCore::CachedResourceLoader::requestResource
    frame #8:  WebCore`WebCore::CachedResourceLoader::requestRawResource
    frame #9:  WebCore`WebCore::DocumentThreadableLoader::loadRequest
    ...
    frame #15: WebCore`WebCore::XMLHttpRequest::send
    frame #16: WebCore`WebCore::XMLHttpRequest::send
    frame #17: WebCore`WebCore::XMLHttpRequest::sendForInspector

The XHR send for inspector sets "hiddenFromInspector" on the resource request. Later in requestResource we determine we can reuse the cached resource from the cache, and go through the notifer process with a new request that only copies the URL from the original request.
Comment 2 Joseph Pecoraro 2014-03-10 15:44:45 PDT
Created attachment 226345 [details]
[PATCH] Proposed Fix

Proposed fix. Brady, can we pass this option (hiddenFromInspector) into loadedResourceFromMemoryCache in a cleaner way then this? As far as I can tell, these functions are all only used once in this path, there are no other callers.
Comment 3 Timothy Hatcher 2014-03-10 17:25:57 PDT
Comment on attachment 226345 [details]
[PATCH] Proposed Fix

View in context: https://bugs.webkit.org/attachment.cgi?id=226345&action=review

> Source/WebCore/loader/FrameLoader.cpp:3002
>      newRequest = ResourceRequest(resource->url());

It might just be best if the caller did this. That would remove the dance you have to do.
Comment 4 Joseph Pecoraro 2014-03-10 19:22:23 PDT
Comment on attachment 226345 [details]
[PATCH] Proposed Fix

View in context: https://bugs.webkit.org/attachment.cgi?id=226345&action=review

>> Source/WebCore/loader/FrameLoader.cpp:3002
>>      newRequest = ResourceRequest(resource->url());
> 
> It might just be best if the caller did this. That would remove the dance you have to do.

I like that idea, seeing that this is only called in one place.
Comment 5 Joseph Pecoraro 2014-03-10 20:37:42 PDT
Created attachment 226378 [details]
[PATCH] For Landing
Comment 6 WebKit Commit Bot 2014-03-10 21:16:17 PDT
Comment on attachment 226378 [details]
[PATCH] For Landing

Clearing flags on attachment: 226378

Committed r165427: <http://trac.webkit.org/changeset/165427>
Comment 7 Radar WebKit Bug Importer 2015-11-26 21:33:02 PST
<rdar://problem/23673692>