Search code examples
javascriptjqueryqunit

QUnit test in Firefox 23: "TypeError: document.setUserData is not a function"


My QUnit test suite (source here) is failing in Firefox 23 and later with the error TypeError: document.setUserData is not a function. See this screenshot for more information.

Mysteriously, a different test seems to fail every time, but only one test fails per page load. I see that Firefox removed setUserData, but I am not using that function in my code, nor do I see that function being used in QUnit code. What could be happening here?


Solution

  • It looks like this is a known issue with FF and Selenium:

    Apparently, Node.setUserData is no longer supported. The alternative is to use a WeakMap
    https://developer.mozilla.org/en-US/docs/Web/API/Node.setUserData more specifically, executeScript() fails, because the firefox driver is injecting a script into the target page and then using document.setUserData to communicate with that script.

    https://code.google.com/p/selenium/issues/detail?id=5710