Extensions API currently offers resource meta-information in HAR format, but skips the bodies for efficiency reasons. It is suggested to expose a separate webInspectror.resources.getBodies(resourceIdList) method for extensions to access the resource bodies. Ideally, we would use blobs to return the bodies. However, it appears that blobs are not fully functional yet, so it is suggested to return strings, using base64 for binary resource types.
Created attachment 69793 [details] patch
Comment on attachment 69793 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=69793&action=review > LayoutTests/inspector/extensions-api-expected.txt:63 > + getBodies : <function> We should be consistent in naming either body or content everywhere. > LayoutTests/inspector/extensions-resources.html:98 > + return (a.response && a.response.content || "").localeCompare(b.response && b.response.content || ""); please embrace the && expressions in bracketsю > WebCore/inspector/InspectorController.cpp:2095 > +void InspectorController::getResourceContent(unsigned long identifier, const String& encoding, String* content) I'd rather pass it as a boolean flag. We're not going to support other encodings any time soon. > WebCore/inspector/front-end/ExtensionServer.js:297 > + if (typeof message.ids === "number") { I don't think we should support non-array values for the field called ids.
Created attachment 69912 [details] patch to land
(In reply to comment #2) > (From update of attachment 69793 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=69793&action=review > > > LayoutTests/inspector/extensions-api-expected.txt:63 > > + getBodies : <function> > > We should be consistent in naming either body or content everywhere. Done. > > > LayoutTests/inspector/extensions-resources.html:98 > > + return (a.response && a.response.content || "").localeCompare(b.response && b.response.content || ""); > > please embrace the && expressions in bracketsю Done. > > > WebCore/inspector/InspectorController.cpp:2095 > > +void InspectorController::getResourceContent(unsigned long identifier, const String& encoding, String* content) > > I'd rather pass it as a boolean flag. We're not going to support other encodings any time soon. > Done. > > WebCore/inspector/front-end/ExtensionServer.js:297 > > + if (typeof message.ids === "number") { > > I don't think we should support non-array values for the field called ids. Agreed offline to leave it as is. The idea is that we want to support array of ids to reduce latencies on roundtrips when processing large number of resources, yet uses cases when once requests a single resource id are probably equally frequent, and while it wouldn't be hard for a user to write '[ id ]', it may be a bit counterintuitive.
Manually committed r69185: http://trac.webkit.org/changeset/69185
Comment on attachment 69793 [details] patch Cleared Yury Semikhatsky's review+ from obsolete attachment 69793 [details] so that this bug does not appear in http://webkit.org/pending-commit.