Instead of manual text decoding, use CachedCSSStyleSheet::sheetText() which does what we need.
Created attachment 90929 [details] [PATCH] Suggested fix
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.
Created attachment 91118 [details] [PATCH] Improved solution
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.
(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.
Attachment 91118 [details] did not build on mac: Build output: http://queues.webkit.org/results/8507670
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.
Created attachment 91123 [details] [PATCH] Comments addressed
Committed r85172: <http://trac.webkit.org/changeset/85172>