Skip to content

Using WebWorker Prototype

fzzzy edited this page Feb 21, 2012 · 1 revision

dom.js includes a prototype environment for servo which runs inside of a normal Firefox environment. dom.js is loaded in a WebWorker and does not have access to the normal browser DOM. It then loads a URL via XMLHttpRequest and parses the HTML into a dom.js javascript DOM. As it does so, and as the DOM is mutated by scripts in the HTML page, dom.js sends mutation events (in a simple, custom, string-based format) to the parent page using postMessage.

The parent page then parses these messages and can then do whatever it likes, including potentially rendering the entire page using canvas, if prototyping a layout engine in javascript is desired. Currently, it builds a custom DOM inspector view out of normal DOM nodes as well as a clone of the dom.js DOM using normal DOM nodes.

Check out and build dom.js and load servo/index.html into a recent firefox if you wish to try this prototype.

https://github.com/andreasgal/dom.js

Clone this wiki locally