[Webkit-unassigned] [Bug 40300] [JSC] Web Inspector: implement script source editing

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Jun 24 19:28:35 PDT 2012


https://bugs.webkit.org/show_bug.cgi?id=40300





--- Comment #23 from Peter Wang <peter.wang at torchmobile.com.cn>  2012-06-24 19:28:33 PST ---
(In reply to comment #22)
> (From update of attachment 148778 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=148778&action=review
> 
> > Source/WebCore/bindings/js/PageScriptDebugServer.cpp:85
> > +{
> 
> You should change the script with given sourceID live, you are evaluating newContent here, basically creating a new script instead of changing the old one.

I agree that your description is the ideal solution. But it seems impossible for JSC, since neither JSC nor Frame will cache the JS code they executed. JSC just read the string of JS code, "compile" it into Identifiers and executable code blocks, save these things in Global Data structure, and execute. 

My solution is taking an advantage of JSC: when JSC is "compiling" JS code, if there is an Identifier with an existent name in Global Data, JSC will replace the old with the new.

So I did a little modification of "Interpreter::execute": if we just need to recompile, we send a flag to it to let it just replace the old Identifiers and executable code blocks but don't really execute them. By that way we implement the effect of "editing live js code".

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list