#6393 closed defect (fixed)
[patch][cla] Existing setTimeout implementation overwritten by hostenv_rhino.js
Reported by: | guest | Owned by: | dylan |
---|---|---|---|
Priority: | high | Milestone: | 1.3 |
Component: | TestFramework | Version: | 1.1.0 |
Keywords: | Cc: | [email protected]… | |
Blocked By: | Blocking: |
Description
When running within Rhino, the hostenv_rhino.js
file defines implementations of setTimeout
and clearTimeout
. However, the code doesn't check if those functions have already been defined. So those implementations will shadow prior definitions.
Other frameworks used in Rhino may define their own implementation of setTimeout
, clearTimeout
, setInterval
, etc. It would be great if Dojo did not overwrite any existing implementation.
Examples of other implementations of setTimeout
for Rhino are:
The main difference being whether they use Java threads or an event pump to behave more like the browsers which are single threaded.
- Jordi Albornoz Mulligan
Attachments (1)
Change History (12)
Changed 13 years ago by
Attachment: | ticket6393.patch added |
---|
comment:1 Changed 13 years ago by
Patch was attached by Jordi Albornoz Mulligan <[email protected]…>.
comment:2 Changed 13 years ago by
Milestone: | → 1.2 |
---|---|
Owner: | changed from alex to dylan |
Status: | new → assigned |
comment:3 Changed 13 years ago by
Summary: | Existing setTimeout implementation overwritten by hostenv_rhino.js → [patch][cla] Existing setTimeout implementation overwritten by hostenv_rhino.js |
---|
comment:4 Changed 13 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:5 Changed 13 years ago by
Resolution: | fixed |
---|---|
Status: | closed → reopened |
In my current setup, resolving the setTimeout
and clearTimeout
variables does not throw an exception. Running Rhino 1.7.
I can't quite figure out why this is the case, but it wouldn't hurt adding:
if(typeof(setTimeout) == 'undefined' || typeof(clearTimeout) == 'undefined'){ throw new Error; }
at the end of the try{}
block.
comment:6 Changed 13 years ago by
In fact, this could replace the existing check, since the variables are referenced anyway.
comment:7 Changed 13 years ago by
Milestone: | 1.2 → 1.3 |
---|
comment:8 Changed 12 years ago by
Mark,
You mean like so:
Index: hostenv_rhino.js =================================================================== --- hostenv_rhino.js (revision 15698) +++ hostenv_rhino.js (working copy) @@ -223,6 +223,7 @@ } try{ func(); + if(typeof(setTimeout) == 'undefined' || typeof(clearTimeout) == 'undefined'){ throw new Error; } }catch(e){ console.debug("Error running setTimeout thread:" + e); }
comment:9 Changed 12 years ago by
Nope, meant the first block, to check for existing implementations:
try{ setTimeout; clearTimeout; }catch(e){
However, if I run this directly in a Rhino 1.7 shell (release 2, 11/05/2008) referencing setTimeout does throw an error. Don't quite recall what was happening earlier.
comment:10 Changed 12 years ago by
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
Ok, marking as fixed then for now, as I can't reproduce either.
Suggested patch - CLA submitted and acknowledged.