Fix for Rhino usage warning

Warning was
    RHINO USAGE WARNING: Missed Context.javaToJS() conversion
from
    threadTimeoutPool[threadId].interrupt()

I'm assuming this came about from the switch to Rhino 1.7something,
but I'm not positive.
This commit is contained in:
Brian Lalor 2012-11-21 09:29:51 -05:00
parent 2be0c284e0
commit 7b8d034d48
1 changed files with 5 additions and 6 deletions

View File

@ -140,7 +140,7 @@
* also sets clearTimeout & clearInterval on same level. * also sets clearTimeout & clearInterval on same level.
*/ */
(function() { (function() {
var threadTimeoutPool = {}; var threadTimeoutPool = new java.util.HashMap();
window.setTimeout = function(closure, timeout) { window.setTimeout = function(closure, timeout) {
var thread = spawn(function() { var thread = spawn(function() {
@ -155,7 +155,7 @@
} }
}); });
threadTimeoutPool[thread.getId()] = thread; threadTimeoutPool.put(thread.getId(), thread);
return thread.getId(); return thread.getId();
}; };
@ -174,15 +174,14 @@
} }
}); });
threadTimeoutPool[thread.getId()] = thread; threadTimeoutPool.put(thread.getId(), thread);
return thread.getId(); return thread.getId();
}; };
window.clearTimeout = function(threadId) { window.clearTimeout = function(threadId) {
if (threadId) { if (threadId) {
if(threadTimeoutPool[threadId]) { if(threadTimeoutPool.containsKey(threadId)) {
threadTimeoutPool[threadId].interrupt(); threadTimeoutPool.remove(threadId).interrupt();
delete threadTimeoutPool[threadId];
} }
} }
}; };