views:

121

answers:

1

I always want to know how the resource inspection work in webkit/safari/chrome's WebInspector work.

The browser must provide a native BPI or something for javascript to display list of queries and their timelines, what is the binary API called? Can I use the same API to write a Chromium extension?

+1  A: 

The resource requests and other DevTools/WebInspector related data is collecting by InspectorController and it's agents. (it just C++ code)

After that all the data is pushing into WebInspector as JS calls of WebInspector object's methods.

As you probably know all the DevTools/WebInspector's GUI is an html page and a lot of JavaScript.

You can try to investigate the internal world of Inspector by Inspector itself.

  1. start Chrome with flag --process-per-tab;
  2. open Inspector window in undocked mode;
  3. press Ctrl-Shift-I in Inspector window.

All the traffic between Inspector and inspected page are passing via two functions: from Inspector to inspected page - sendMessageToBackend from inspected page to Inspector - devtools$$dispatch

You can track the latest changes for WebInspector in WebKit via this link.

loislo
found this: http://developer.apple.com/mac/library/documentation/AppleApplications/Reference/WebKitDOMRef/InspectorBackend_idl/Classes/InspectorBackend/index.html but still trying to figure out how to use it.
est
It is a bit obsolete and was removed from the ToT.We are doing a big refactoring of Inspector protocol at the moment.You can try to look at http://trac.webkit.org/browser/trunk/WebCore/inspector/Inspector.idlThis file is some kind of Inspector API specification.Methods with [notify] flag are transfering the data from the page to Inspector. The others are using by Inspector for requesting the data and manipulating the agents' states. The transition from the old Inspector protocol is not finished yet but it is close to the end.
loislo
thanks for the update, loislo.Since it's a bit related, can you help me with [this question](http://stackoverflow.com/questions/3380914/third-party-ipc-calls-to-chromium-to-capture-filter-traffic)?
est