From 7b8d034d48cdd5cac84cffd5b91324d605e9f203 Mon Sep 17 00:00:00 2001 From: Brian Lalor Date: Wed, 21 Nov 2012 09:29:51 -0500 Subject: [PATCH] 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. --- src/test/javascript/lib/env.utils.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/test/javascript/lib/env.utils.js b/src/test/javascript/lib/env.utils.js index 4d3fef1..755d50a 100755 --- a/src/test/javascript/lib/env.utils.js +++ b/src/test/javascript/lib/env.utils.js @@ -140,7 +140,7 @@ * also sets clearTimeout & clearInterval on same level. */ (function() { - var threadTimeoutPool = {}; + var threadTimeoutPool = new java.util.HashMap(); window.setTimeout = function(closure, timeout) { var thread = spawn(function() { @@ -155,7 +155,7 @@ } }); - threadTimeoutPool[thread.getId()] = thread; + threadTimeoutPool.put(thread.getId(), thread); return thread.getId(); }; @@ -174,15 +174,14 @@ } }); - threadTimeoutPool[thread.getId()] = thread; + threadTimeoutPool.put(thread.getId(), thread); return thread.getId(); }; window.clearTimeout = function(threadId) { if (threadId) { - if(threadTimeoutPool[threadId]) { - threadTimeoutPool[threadId].interrupt(); - delete threadTimeoutPool[threadId]; + if(threadTimeoutPool.containsKey(threadId)) { + threadTimeoutPool.remove(threadId).interrupt(); } } };