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 <[email protected]> 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
> [email protected]
> https://lists.webkit.org/mailman/listinfo/webkit-dev
>
>
(If it has any faults, please correct me:) )

-- 
*Arunprasad Rajkumar*
http://in.linkedin.com/in/ararunprasad
_______________________________________________
webkit-dev mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-dev

Reply via email to