Menu

#414 Thread local variables not applied to async XMLHttpRequests

Latest SVN
closed
None
5
2012-10-21
2006-12-20
No

When an asynchronous XMLHttpRequest is made, a new thread is kicked off to do the work. However, at least one thread local variable (JavaScriptEngine.KEY_STARTING_SCOPE) is missing when this new thread is created. I can see the problem when I try to set window.location.href value. A NullPointerException is thrown when the Window.jsxSet_location method is called because it attempts to retrieve the starting scope as a thread local and cannot.

Attaching a test case and a potential fix as a patch file. The fix may not be broad enough (not sure how many thread locals need to be applied). Perhaps consider using an InheritableThreadLocal instead.

Discussion

  • Deryk Sinotte

    Deryk Sinotte - 2006-12-20

    Test case and one way to potentially fix.

     
  • Marc Guillemot

    Marc Guillemot - 2006-12-28

    Logged In: YES
    user_id=402164
    Originator: NO

    Patch applied (after simplification and cleanup to conform to htmlunit coding guidelines). Thanks.

     

Log in to post a comment.