Bug 150101 - Web Inspector: CSS Data URIs count against page weight twice
Summary: Web Inspector: CSS Data URIs count against page weight twice
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: Mac OS X 10.11
: P2 Normal
Assignee: Matt Baker
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2015-10-13 14:26 PDT by Lanny Heidbreder
Modified: 2015-10-22 16:32 PDT (History)
8 users (show)

See Also:


Attachments
Example HTML file that shows the problem (651 bytes, text/html)
2015-10-13 14:26 PDT, Lanny Heidbreder
no flags Details
[Patch] Proposed Fix (1.50 KB, patch)
2015-10-22 13:37 PDT, Matt Baker
no flags Details | Formatted Diff | Diff
[Patch] Proposed Fix (4.65 KB, patch)
2015-10-22 14:22 PDT, Matt Baker
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Lanny Heidbreder 2015-10-13 14:26:42 PDT
Created attachment 263021 [details]
Example HTML file that shows the problem

OVERVIEW:

This is a repeat of bug 75555, which was closed (automatically?) when the new Web Inspector appeared.

Any CSS data URI is counted twice against page weight: once for the CSS code, and once for the separate resource entry for the image or font represented by the data URI.

STEPS TO REPRODUCE:

Open Web Inspector, load a single HTML page that uses a data URI in a <style> element, and look at the Page Weight indicator.

EXPECTED RESULTS:

The Page Weight total shows the exact HTML file size.

ACTUAL RESULTS:

The Page Weight total shows the sum of the HTML file size, PLUS the size of the image or font represented by the data URI, since it gets a separate Resource entry

ADDITIONAL INFO:

You can see this in action at http://75thtrombone.com/links/webkit/page-weight-test.html . That page is also attached.
Comment 1 Radar WebKit Bug Importer 2015-10-13 14:27:40 PDT
<rdar://problem/23096774>
Comment 2 Timothy Hatcher 2015-10-22 08:13:58 PDT
Thanks for the bug report!

Should be a simple fix on DefaultDashboard's _resourceSizeDidChange to ignore data URLs.
Comment 3 Matt Baker 2015-10-22 13:37:21 PDT
Created attachment 263853 [details]
[Patch] Proposed Fix
Comment 4 Matt Baker 2015-10-22 13:40:12 PDT
I considered using Resource.urlComponents.scheme, but the data URI resource's scheme was null (expected "data").
Comment 5 Joseph Pecoraro 2015-10-22 13:49:24 PDT
(In reply to comment #4)
> I considered using Resource.urlComponents.scheme, but the data URI
> resource's scheme was null (expected "data").

Maybe parseURL() doesn't properly handle a data URI. I think I was running into this recently.
Comment 6 Matt Baker 2015-10-22 14:15:22 PDT
(In reply to comment #5)
> (In reply to comment #4)
> > I considered using Resource.urlComponents.scheme, but the data URI
> > resource's scheme was null (expected "data").
> 
> Maybe parseURL() doesn't properly handle a data URI. I think I was running
> into this recently.

I'm certain the scheme property was null at least once while refreshing the attached example page, but I can't reproduce the issue now. Going to switch to checking the scheme field since we do this elsewhere (CSSStyleDeclarationSection.js:516).
Comment 7 Matt Baker 2015-10-22 14:22:26 PDT
Created attachment 263866 [details]
[Patch] Proposed Fix
Comment 8 WebKit Commit Bot 2015-10-22 16:32:37 PDT
Comment on attachment 263866 [details]
[Patch] Proposed Fix

Clearing flags on attachment: 263866

Committed r191486: <http://trac.webkit.org/changeset/191486>
Comment 9 WebKit Commit Bot 2015-10-22 16:32:42 PDT
All reviewed patches have been landed.  Closing bug.