Getting initiator info while in devtools

2,294 views
Skip to first unread message

pde...@cardinalpath.com

unread,
Jun 13, 2014, 10:32:42 AM6/13/14
to google-chrome-...@googlegroups.com
There is no way to get initiator information about dynamic script/image/xhr calls while in devtools (despite the information being shown in the network panel). 

Currrently, to get around the lack of initiator info, I am forced to inject inline code into pages I monitor and copy out & replace built in methods (like appendChild, appendBefore etc). My replacements capture the call, throw an error, dicect the error stack trace, message the result over to my content script (then up to background page and back down to devtools extension) and finally fire the original native method. This is less than ideal, and I have had to revisit the code a few times, as it has broken some pages. I would much rather use built in method that doesn't interfere with page side scripts.

Reposting a summary of my bug report about this ( https://code.google.com/p/chromium/issues/detail?id=230828 ) here on advice of a google associate I met recently in hopes that someone can help me:

currently it is only possible to obtain initiator information via the Debbuger.onEvent listener, by filtering for requestWillBeSent. However, this causes a warning infobar to appear on the tab while using the debugger API. Also, the debugger API cannot be accessed if the Devtools Pane/Window is open, making the information unavailable to Devtools extensions (even if messaging with a background page).

I propose that this information be available without requiring the debugger. I think it can be easily added in three places:

1) chrome.webRequest.onBeforeRequest event.
When calling the addListener method, allow an optional [“initiator”] flag to be added to the extraInfoSpec array argument. This would add an “initiator” property/object to the “details” object that is passed to the callback function

2) chrome.devtools.network.onRequestFinished event.
When calling the addListener method, allow an optional [“initiator”] flag to be added to the extraInfoSpec array argument. This would add an “_initiator” property/object  (with a leading underscore, as allowed by the spec) to the HAR Request object that is passed to the callback function

3) chrome.detvools.network.getHAR method
Add an optional second extraInfoSpec array argument with at least one available optional flag: “initator”. This would add an “_initiator” property/object (with a leading underscore, as allowed by the spec) to each  “Request” entry in the HAR log that is returned.


Connect with us on twitter, google+, facebook, or linkedin.

Catch our next training: Washington Jun 9 - 13, San Jose Jun 16 - 20, Detroit Jun 23 - 27 or See All.

This email, including any attachments, is for the sole use of the intended recipient and may contain confidential information. If you are not the intended recipient, please immediately notify us by reply email or by telephone, delete this email and destroy any copies. Thank you

Reply all
Reply to author
Forward
0 new messages