[webkit-dev] Script Execution in webkit

Arunprasad Rajkumar ararunprasad at gmail.com
Sat Feb 23 07:16:10 PST 2013


Some basics I understood about JS execution in WebKit.

JavaScript execution inside a browser is event driven. Event may be fired
from multiple source like Mouse,
Keyboard,Timer(window.setInterval,window.setTimeout), XHR, DOM... Also
WebKit executes javascript in a mainthread(in case of worker context it
will be executed from respective worker thread) and script is
not yieldable at any point. Control will reach to mainloop only after
executing the complete flow(Suppose script execution starts from
a()->b()->c()->d(), you can't yield the execution at any intermediate
point).

Please find my reply below,

On 23 February 2013 18:26, Vicky Tux <ssseintr2 at gmail.com> wrote:

>
> 1. Is there any possibility to identify whether any script executing
> currently or not?
>

[ARUN] Not possible. If script is being executing then mainthread will be
blocked. You can add your own traps to
ScriptController::evaluateInWorld(Refer
InspectorInstrumentation::willEvaluateScript
& InspectorInstrumentation::didEvaluateScript). But you should check the
status from another thread to know the browser mainthread is executing
script or not. But what will you do with that status?, beware you can't
yield/disable it from another thread.

2. Is webkit supporting to pause and resume script execution?
>
[ARUN] WebKit supports only disabling the script execution via Settings.
You may wonder like how "WebInspector"'s "pause script execution" works!!!.
It is completely different story :(.

3. Will disabling execution through simply setting
> setJavaScriptEnabled(false) and enabling by reverting it causes any
> misbehavior in script execution?
>
[ARUN] That is depends on the page being executing. Incase page has timing
dependent execution flow(timers) then it may misbehave.

>
> Thanks,
> Ameen.
>
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> https://lists.webkit.org/mailman/listinfo/webkit-dev
>
>
(If it has any faults, please correct me:) )

-- 
*Arunprasad Rajkumar*
http://in.linkedin.com/in/ararunprasad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20130223/c6912b3e/attachment.html>


More information about the webkit-dev mailing list