[webkit-dev] window.internals is teh hot. Help make it work on all platforms

Dimitri Glazkov dglazkov at chromium.org
Thu Jun 2 16:27:20 PDT 2011

As of http://trac.webkit.org/changeset/87948, we have a new, less
painful way to write WebCore tests: the window.internals object.

Similar to window.layoutTestController, this object is only exposed
when DRT runs. Unlike window.layoutTestController, you don't have to
wade in every port's implementation of DumpRenderTree and plumb the
calls through each port's layer to implement your WebCore-related
layout test methods.

As an example, see how simple it is to expose all shadow DOM-related
methods with window.internals:

This is possible, because the implementation of the window.internal
object actually lives in WebCore
(http://trac.webkit.org/browser/trunk/Source/WebCore/testing/), but is
built as a separate library, which is linked into DumpRenderTree.
There is a tiny bit of port-specific code that then facilitates
construction and injection of the object instance, allowing the actual
testing code to stay port-independent.

Obviously, this is not a replacement for window.layoutTestController.
Here's a set of simple rules you should follow when deciding where to
add your testing hooks:

1) Does the code you are testing reside entirely in WebCore? If yes,
use window.internals.
2) Otherwise, use window.layoutTestController. End-to-end tests are
still a huge part of our testing infrastructure.

Finally, A CALL TO ACTION. Currently, the window.internals object only
work on platform/mac and platform/chromium.

We need heroes to help implement it for other ports. If you are a
hero, please fix one of these bugs:


Thank you, heroes! And thank you Hajime Morrita, Darin Adler, Alexey
Proskuryakov, and Mark Rowe for ideas and direction.


More information about the webkit-dev mailing list