<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Pascal,</div>I was wrong. &nbsp;Please see&nbsp;<a href="https://bugs.webkit.org/show_bug.cgi?id=131082#c1" class="">https://bugs.webkit.org/show_bug.cgi?id=131082#c1</a> for details.<div class=""><br class=""></div><div class="">The gist of it is that the existing watchdog mechanism requires that the user of the VM explicitly reset it before any scripts are allowed to run again. &nbsp;For example, you can do that by calling&nbsp;JSContextGroupSetExecutionTimeLimit() again.<br class=""><div class=""><br class=""></div><div class="">Hence, you’re probably not resetting the watchdog after a time out.</div><div class=""><br class=""></div><div class="">Regards,</div><div class="">Mark</div><div class=""><br class=""></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jul 29, 2015, at 9:54 AM, Mark Lam &lt;<a href="mailto:mark.lam@apple.com" class="">mark.lam@apple.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Pascal,</div><div class=""><br class=""></div><div class="">You can take a look at ExecutionTimeLimitTest.cpp for examples of the watchdog in action. &nbsp;The way the watchdog works is by throwing a non-catchable TerminatedExecutionException. &nbsp;Normally, the JSC APIs will clear the vm-&gt;exception() before returning to client code; the exception is returned to the caller via an argument. &nbsp;Thereafter, you should be able to re-enter the VM and execute JS code like normal without needing to do any explicit resets.</div><div class=""><br class=""></div><div class="">If you’re not able to do this, then I suspect you have a code path where the termination exception is not cleared before re-entering the VM. &nbsp;All the entry points in Interpreter.cpp already check for this with an "ASSERT(!vm.exception())”. &nbsp;If you see that assertion fail on a debug build when re-entering the VM, then the bug is that the exception is not being cleared. &nbsp;If you don’t see that assertion, then you’ll need to do some debugging to see what went wrong.</div><div class=""><br class=""></div><div class="">Another detail is that the Watchdog::Scope is responsible for disarming the watchdog when you exit the VM. &nbsp;Watchdog::Scope is already being used in all the proper places. &nbsp;Disarming in this case also means that the watchdog will be ready to start fresh when you enter the VM again. &nbsp;If you have a bug in your disarming code where it’s not reseting the watchdog, then it is possible that your watchdog is firing immediately when you re-enter the VM. &nbsp;Some tracing / debugging in your watchdog implementation should quickly show if that’s the case.</div><div class=""><br class=""></div><div class="">Regards,</div><div class="">Mark</div><div class=""><br class=""></div><div class=""><br class=""></div><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Jul 28, 2015, at 11:14 AM, Geoffrey Garen &lt;<a href="mailto:ggaren@apple.com" class="">ggaren@apple.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Mark, do you know how to restart JavaScript after it has reached a watchdog time limit?<div class=""><br class=""></div><div class="">Geoff</div><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Jul 28, 2015, at 9:09 AM, Pascal Jacquemart &lt;<a href="mailto:p.jacquemart@samsung.com" class="">p.jacquemart@samsung.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div style="font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; direction: ltr; font-family: Tahoma; font-size: 10pt;" class=""><div style="direction: ltr; font-family: Tahoma; font-size: 10pt;" class="">Hello,<br class=""><br class="">I am trying to protect the MiniBrowser from executing faulty JavaScript code taking too much time / CPU. All browsers normally raise a pop-up allowing the user to stop the script and run away.<span class="Apple-converted-space">&nbsp;</span><br class="">But MiniBrowser does not seem to have such feature. It is just stuck forever ;-(<br class=""><br class="">After a little digging I found this JSC API: JSContextGroupSetExecutionTimeLimit()<br class="">I had to implement a JSC Watchdog back-end because it is not implemented for EFL, fair enough -&gt;<span class="Apple-converted-space">&nbsp;</span><a href="https://bugs.webkit.org/show_bug.cgi?id=147107" target="_blank" class="">https://bugs.webkit.org/show_bug.cgi?id=147107</a><span class="Apple-converted-space">&nbsp;</span>(ongoing)<br class=""><br class="">Now the JSContextGroupSetExecutionTimeLimit() have the expected behaviour.<br class="">I can stop the JavaScript execution and run away... Great but the big problem now is that the JavaScript won't restart. Even while loading other pages, the JavaScript remains disabled.<br class=""><br class="">If you have any hints about this, I would be grateful.<br class="">How to restart JavaScript execution? Where to look? Is it an EFL bug?<br class=""><br class="">Thanks,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Pascal Jacquemart<br class=""><br class=""></div></div><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">_______________________________________________</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">webkit-dev mailing list</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="mailto:webkit-dev@lists.webkit.org" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">webkit-dev@lists.webkit.org</a><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="https://lists.webkit.org/mailman/listinfo/webkit-dev" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">https://lists.webkit.org/mailman/listinfo/webkit-dev</a></div></blockquote></div><br class=""></div></div>_______________________________________________<br class="">webkit-dev mailing list<br class=""><a href="mailto:webkit-dev@lists.webkit.org" class="">webkit-dev@lists.webkit.org</a><br class=""><a href="https://lists.webkit.org/mailman/listinfo/webkit-dev" class="">https://lists.webkit.org/mailman/listinfo/webkit-dev</a><br class=""></div></blockquote></div><br class=""></div>_______________________________________________<br class="">webkit-dev mailing list<br class=""><a href="mailto:webkit-dev@lists.webkit.org" class="">webkit-dev@lists.webkit.org</a><br class="">https://lists.webkit.org/mailman/listinfo/webkit-dev<br class=""></div></blockquote></div><br class=""></div></div></body></html>