Fire operation callback before time is up so we can test the non-aborting case

RESOLVED FIXED in mozilla22

Status

()

Core
JavaScript Engine
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: luke, Unassigned)

Tracking

unspecified
mozilla22
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

Created attachment 715278 [details] [diff] [review]
patch

Right now, AFAICS, there is no way to test the operation-callback-lets-execution-continue case.  This happens a lot in the browser (not just when the user clicks "Continue" on the slow-script dialog, but at regular intervals before we decide to throw up the slow-script dialog.  This patch changes WatchdogMain so it fires the callback 10 times a second until the timeout value is exceeded.

Terrence, you reviewed Niko's patch to this code, so I think you're the reviewer for this patch, but Niko feel free to let me know if this looks right to you.
Attachment #715278 - Flags: review?(terrence)
As part of bug 829602, I have a variation that I am hoping to land soon in which the user can supply a JS function to be called upon timeout:

https://bug829602.bugzilla.mozilla.org/attachment.cgi?id=701098

I think this might address your use case?
That would also be good (and would allow us to test non-threadsafe builds).  For threadsafe builds though, I like this change since it would mean we are *always* testing the non-abortive operation callback (well, any time we use timeout(), not just when we go through the effort of specifying a callback function that sometimes aborts).
Comment on attachment 715278 [details] [diff] [review]
patch

Review of attachment 715278 [details] [diff] [review]:
-----------------------------------------------------------------

Excellent idea!
Attachment #715278 - Flags: review?(terrence) → review+
https://hg.mozilla.org/mozilla-central/rev/408ad90d68dc
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla22
You need to log in before you can comment on or make changes to this bug.