[webkit-reviews] review requested: [Bug 32554] Create injected script instance per inspected frame context : [Attachment 45566] initial patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Dec 28 12:04:38 PST 2009


Yury Semikhatsky <yurys at chromium.org> has asked  for review:
Bug 32554: Create injected script instance per inspected frame context
https://bugs.webkit.org/show_bug.cgi?id=32554

Attachment 45566: initial patch
https://bugs.webkit.org/attachment.cgi?id=45566&action=review

------- Additional Comments from Yury Semikhatsky <yurys at chromium.org>
The idea of the change is to compile all JavaScript routines(InjectedScript)
required by the Web Inspector directly in the context of the inspected frame.
The only interface for the InjectedScript to talk to the inspector is
InjectedScriptHost. All the data passed to and received from the InjectedScript
are supposed to be serialized. We cannot rely on window.JSON object from the
inspected context as the object may have been modified by the inspected script.
In the patch I'm using custom JSON serializer but I'm going to employ
SerializedScriptValue for serializing the data. Serializing all messages and
having separate InjectedScript instance per inspected context allows to get rid
of object quarantines.

InjectedScript instance is cached on the inspected context. To avoid cluttering
inspected global object, reference to InjectedScript is stored as a property of
JSDOMGlobalObject in case of JSC and as a hidden property on the context's
global object in case of V8.

There are two major types of operations that require InjectedScript instance:
1) DOM Tree and CSS styles inspection.
2) Inspection of JS objects including evaluation results, objects written to
console and call stack variables.
In the first case we can find frame to which inspected DOM node belongs and use
InjectedScript from that frame. To handle the latter case each InjectedScript
object is assigned unique id. This id is stored as a part of corresponding
object proxies so that when inspector frontend needs to access the
InjectedScript it can find the InjectedScript instance by that id. So each
action that is supposed to be executed by InjectedScript is accompanied with
either DOM Node id or InjectedSript id.

There is one persistent reference to InjectedScript JS object from native part
of the inspector that is mapping from id to InjectedScript. The mapping is
cleared on Page navigation.

This patch should be broken down into several smaller pieces but I think as a
whole it gives a better understanding on the change.


More information about the webkit-reviews mailing list