Question

I'm trying to build automated script testing engine using spidermonkey.

Some of the scripts I intend to test are using window and document objects, which are not defined in the js shell.

Is there an easy-track way to define window and document objects to be used in spidermonkey tests?

Was it helpful?

Solution

The SpiderMonkey shell just implements the JavaScript language with a few built-in-functions to do extended things like read files from the local filesystem into strings. When you build Mozilla there is an artifact called the XPCShell that may be used to access a more full browser environment, but I'm not sure if there is good documentation on how to use it properly. Your web search is as good as mine there!

Alternatively, there is the dom.js project which attempts to implement the HTML DOM in pure JavaScript. You may be able to load that project's JS in and program against its implementation of the Window and Document objects in the DOM.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top