Closed
Bug 1101124
Opened 10 years ago
Closed 9 years ago
Throw an exception for slow scripts
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
mozilla36
People
(Reporter: tschneider, Assigned: tschneider)
Details
Attachments
(1 file)
1.05 KB,
patch
|
bzbarsky
:
review+
|
Details | Diff | Splinter Review |
When doing automated testing (in our case testing the Shumway extension on crawled SWFs using Selenium/WebDrivers), infinite loops or slow scripts are leading to unresponsive browser instances. Showing a prompt to decide whether to stop or continuing such a script blocks all subsequent tests (using the same instance), waiting for manual interaction. To avoid that, and being able to react to test cases where scripts are running too slowly, I want to propose adding a preference that, when set, makes the browser throwing an exception instead of showing the slow script dialog.
Comment 1•10 years ago
|
||
Where would the exception be thrown? Say you have while(true); What should actually throw? We could make http://mxr.mozilla.org/mozilla-aurora/source/dom/base/nsGlobalWindow.cpp#10960 to dispatch a chrome only event if needed. Would that help?
Comment 2•10 years ago
|
||
Do we want an exception, or do we want to act the same way we do if the user clicks "stop script" in the dialog (i.e. an uncatchable script termination)? The problem with an exception is that something like this: while (true) { try { while (true); } catch (e) {} } will simply suppress it and keep ilooping...
Assignee | ||
Comment 3•10 years ago
|
||
That's a good point. An "always stop" pref at least helps us getting back control of the blocked browser instance. We might also want to consider setting that flag after a user chose "Stop script" + "Don't ask me again" in the slow script dialog.
Comment 4•10 years ago
|
||
OK. An "always stop" pref is trivial to implement. If you want it to only affect Window instances and sandboxes that have a window prototype, just have nsGlobalWindow::ShowSlowScriptDialog check the pref and return KillSlowScript if set. If you want it to also affect JSMs, it needs to go in XPCJSRuntime::InterruptCallback. I'm happy to review. ;)
Assignee | ||
Comment 5•10 years ago
|
||
This adds a check in nsGlobalWindow::ShowSlowScriptDialog for a pref named dom.always_stop_slow_scripts and returns KillSlowScript if set.
Attachment #8526537 -
Flags: review?(bzbarsky)
Comment 6•10 years ago
|
||
Comment on attachment 8526537 [details] [diff] [review] Checks for a pref to always stop slow scripts r=me
Attachment #8526537 -
Flags: review?(bzbarsky) → review+
Assignee | ||
Updated•10 years ago
|
Keywords: checkin-needed
Comment 7•10 years ago
|
||
Hi Tobias would it be possible to provide a try run, thanks!
Assignee | ||
Comment 8•10 years ago
|
||
https://treeherder.mozilla.org/ui/#/jobs?repo=try&revision=e14990fbff2a
Assignee | ||
Updated•10 years ago
|
Flags: needinfo?(schneider)
Assignee | ||
Updated•9 years ago
|
Keywords: checkin-needed
Comment 10•9 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/b98e55fb98b7
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla36
Updated•5 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•