Closed
Bug 622224
Opened 14 years ago
Closed 3 years ago
Add global setTimeout/setInterval for frame scripts
Categories
(Core :: DOM: Content Processes, defect, P5)
Tracking
()
RESOLVED
WORKSFORME
Tracking | Status | |
---|---|---|
fennec | - | --- |
People
(Reporter: cjones, Unassigned)
References
Details
For tests that don't need to initially wait, the reftest harness sets up a timeout from its onload handler like so
content.setTimeout(content.setTimeout, 0, AfterOnLoadScripts, 0);
In these tests
content/base/crashtests/483818-1.html
layout/base/crashtests/121533-1.html
the setTimeout function enqueued by reftest-content.js is never called. I tried changing that somewhat complicated incantation above to something simpler like |content.setTimeout(function () { dump('foo\n') }, 1000)|, but nothing worked.
These tests both do document.write from their own onload handlers. Maybe some scope/principal/compartment is getting mixed up and the setTimeout from the harness is being ignored? I dunno. Disabling those tests for now.
This affects both remote=true/false frame scripts.
There was a similar-looking problem in
layout/generic/crashtests/348887-1.html
in which a setTimeout() made by the test in an inline <script> element never ran and the test looped forever. Changing this setTimeout() to be enqueued off an onload handler fixed the problem. These bugs might perhaps be related.
Reporter | ||
Comment 1•14 years ago
|
||
This should block fennec because whatever the bug is can strike the fennec frontend and extensions in the same way reftest-content.js is being affected.
tracking-fennec: --- → ?
Reporter | ||
Comment 2•14 years ago
|
||
Oops, missed two others: similar symptoms also appear in
editor/libeditor/html/crashtests/456727-1.html
editor/libeditor/html/crashtests/456727-2.html
Comment 3•14 years ago
|
||
If document.write is called after the original page is parsed, new inner window
created.
If setTimeout was called using the old window, it is expected that it doesn't
get called.
So I believe this is INVALID.
Reporter | ||
Comment 4•14 years ago
|
||
Well OK, but if so, how are frame scripts supposed to reliably enqueue tasks? Do we need setTimeout/setInterval globals for frame scripts?
Comment 5•14 years ago
|
||
Use nsITimer?
Reporter | ||
Comment 6•14 years ago
|
||
That doesn't sound very friendly to extension authors. Are there other cases in ff 3.6 where extensions would be forced to use nsITimer directly, on the main thread? I can't think of any.
Comment 7•14 years ago
|
||
js components need to use nsITimer.
Reporter | ||
Comment 8•14 years ago
|
||
OK, let me try another tack.
Are there reasons *not* to add global setTimeout/setInterval for frame scripts?
Comment 9•14 years ago
|
||
Other than extracting timeout/interval code, or at least the behavior from
nsGlobalWindow is non-trivial, there shouldn't be any reason
not to add setTimeout/setInterval to frame scripts.
I had to do it for workers an it was a little tricky. We have some unexpected behavior, accepting strings and functions, passing extra arguments, etc.
Reporter | ||
Comment 11•14 years ago
|
||
Mid-aired with bent, but I'll repost unedited ;) ---
The dom/src/threads code doesn't look too bad. But we can discuss the impl more when/if this is blocking-fennec+.
Summary: content.setTimeout doesn't work from frame scripts in some cases (something to do with onload and document.write?) → Add global setTimeout/setInterval for frame scripts
Reporter | ||
Comment 12•14 years ago
|
||
348887-1.html was something different. Filed bug 623091.
Comment 13•14 years ago
|
||
love to see this happen, but we will not block fennec 4
tracking-fennec: ? → 2.0-
Updated•14 years ago
|
Whiteboard: [fennec-4.1?]
Updated•14 years ago
|
Whiteboard: [fennec-4.1?]
Updated•10 years ago
|
Component: IPC → DOM: Content Processes
Comment 14•6 years ago
|
||
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046
Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5.
If you have questions, please contact :mdaly.
Priority: -- → P5
Comment 15•3 years ago
|
||
Still in-tree but apparently without problems:
483818-1.html
121533-1.html
Was bug 623091:
348887-1.html
Gone:
editor/libeditor/html/crashtests/456727-1.html
editor/libeditor/html/crashtests/456727-2.html
Bug 840360 did some related work. I'd assume we are happy with our timers?
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → WORKSFORME
You need to log in
before you can comment on or make changes to this bug.
Description
•