RESOLVED FIXED 59326
Web Inspector: Use CachedResource to retrieve charset-decoded stylesheet text
https://bugs.webkit.org/show_bug.cgi?id=59326
Summary Web Inspector: Use CachedResource to retrieve charset-decoded stylesheet text
Alexander Pavlov (apavlov)
Reported 2011-04-25 09:38:33 PDT
Instead of manual text decoding, use CachedCSSStyleSheet::sheetText() which does what we need.
Attachments
[PATCH] Suggested fix (3.02 KB, patch)
2011-04-25 10:40 PDT, Alexander Pavlov (apavlov)
pfeldman: review-
[PATCH] Improved solution (8.49 KB, patch)
2011-04-26 09:35 PDT, Alexander Pavlov (apavlov)
pfeldman: review-
[PATCH] Comments addressed (8.34 KB, patch)
2011-04-26 10:08 PDT, Alexander Pavlov (apavlov)
pfeldman: review+
Alexander Pavlov (apavlov)
Comment 1 2011-04-25 10:40:21 PDT
Created attachment 90929 [details] [PATCH] Suggested fix
Pavel Feldman
Comment 2 2011-04-25 11:05:34 PDT
Comment on attachment 90929 [details] [PATCH] Suggested fix Btw, how does this new code relate to the decoding logic in the InspectorPageAgent::resourceContent itself? It seems that it should produce valid result without your change.
Alexander Pavlov (apavlov)
Comment 3 2011-04-26 09:35:28 PDT
Created attachment 91118 [details] [PATCH] Improved solution
WebKit Review Bot
Comment 4 2011-04-26 09:37:24 PDT
Attachment 91118 [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/InspectorPageAgent.cpp:180: Local variables should never be PassRefPtr (see http://webkit.org/coding/RefPtr.html). [readability/pass_ptr] [5] Total errors found: 1 in 3 files If any of these errors are false positives, please file a bug against check-webkit-style.
Alexander Pavlov (apavlov)
Comment 5 2011-04-26 09:40:11 PDT
(In reply to comment #2) > (From update of attachment 90929 [details]) > Btw, how does this new code relate to the decoding logic in the InspectorPageAgent::resourceContent itself? It seems that it should produce valid result without your change. The other way round: it does not produce valid results even with my previous change (and \uFEFF did get into the frontend JavaScript but were not displayed). This is now fixed.
WebKit Review Bot
Comment 6 2011-04-26 09:41:14 PDT
Pavel Feldman
Comment 7 2011-04-26 09:43:13 PDT
Comment on attachment 91118 [details] [PATCH] Improved solution View in context: https://bugs.webkit.org/attachment.cgi?id=91118&action=review > Source/WebCore/inspector/InspectorPageAgent.cpp:67 > +bool decodeSharedBuffer(PassRefPtr<SharedBuffer> buffer, const String& textEncodingName, String* result) Please make this static. > Source/WebCore/inspector/InspectorPageAgent.cpp:79 > +bool prepareCachedResourceBuffer(CachedResource* cachedResource, bool* hasZeroSize) Ditto. > Source/WebCore/inspector/InspectorPageAgent.cpp:105 > +bool cachedResourceDecoded(CachedResource* cachedResource, String* result) ditto. decodeCachedResource ? > Source/WebCore/inspector/InspectorPageAgent.cpp:131 > +PassRefPtr<SharedBuffer> mainResourceSharedBuffer(Frame* frame, const KURL& url, String* textEncodingName) ditto > Source/WebCore/inspector/InspectorPageAgent.cpp:135 > + if (equalIgnoringFragmentIdentifier(url, loader->url())) { You should only enter mainResourceSharedBuffer for main resource urls.
Alexander Pavlov (apavlov)
Comment 8 2011-04-26 10:08:35 PDT
Created attachment 91123 [details] [PATCH] Comments addressed
Alexander Pavlov (apavlov)
Comment 9 2011-04-28 02:24:01 PDT
Note You need to log in before you can comment on or make changes to this bug.