Bug 54085 - Web Inspector: Network & Resource panels make multiple requests for images with co content
Summary: Web Inspector: Network & Resource panels make multiple requests for images wi...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Andrey Kosyakov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-09 02:58 PST by Andrey Kosyakov
Modified: 2011-02-10 05:00 PST (History)
11 users (show)

See Also:


Attachments
patch (2.38 KB, patch)
2011-02-09 07:06 PST, Andrey Kosyakov
pfeldman: review-
pfeldman: commit-queue-
Details | Formatted Diff | Diff
patch (6.38 KB, patch)
2011-02-09 09:05 PST, Andrey Kosyakov
pfeldman: review+
pfeldman: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrey Kosyakov 2011-02-09 02:58:44 PST
Run following snippet with DevTools opened.

<script>
function doStuff() {
  var r = Math.floor(Math.random()*100000);
  var i = new Image();
  i.src = 'http://www.facebook.com/ajax/hovercard/shown.php?'+r;
}
</script>
<button onclick="doStuff()">do stuff</button>

Observe preview image source in the Network/Resources panels.

Expected: data URL, no network requests
Actual: original URL, additional network request is being made

Original bug report: http://code.google.com/p/chromium/issues/detail?id=72402
Comment 1 Andrey Kosyakov 2011-02-09 07:06:30 PST
Created attachment 81806 [details]
patch
Comment 2 Pavel Feldman 2011-02-09 07:17:28 PST
Comment on attachment 81806 [details]
patch

I don't think this is a reliable solution. We might be not accurate wrt resource size, why should we make content request depend on potential resource size inconsistencies.
Comment 3 Andrey Kosyakov 2011-02-09 09:05:42 PST
Created attachment 81818 [details]
patch

- check resource size on back-end, return "" for 0-sized resources, NULL for errors
Comment 4 WebKit Review Bot 2011-02-09 09:08:52 PST
Attachment 81818 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCor..." exit_code: 1

Source/WebCore/inspector/InspectorResourceAgent.cpp:127:  Use 0 instead of NULL.  [readability/null] [4]
Total errors found: 1 in 6 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 5 Pavel Feldman 2011-02-09 09:37:48 PST
Comment on attachment 81818 [details]
patch

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

> Source/WebCore/inspector/Inspector.idl:103
> +        [domain=Network] void resourceContent(in unsigned long frameId, in String url, in boolean base64Encode, out boolean foundResource, out String content);

foundResource -> success

> Source/WebCore/inspector/InspectorResourceAgent.cpp:506
> +void InspectorResourceAgent::resourceContent(unsigned long id, const String& url, bool base64Encode, bool* resourceFound, String* content)

frameId?
Comment 6 Andrey Kosyakov 2011-02-10 05:00:07 PST
Manually committed r78196: http://trac.webkit.org/changeset/78196