testing/mochitest/mochitest-e10s-utils-content.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/testing/mochitest/mochitest-e10s-utils-content.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,16 @@
     1.4 +// This is the content script for mochitest-e10s-utils
     1.5 +
     1.6 +// We hook up some events and forward them back to the parent for the tests
     1.7 +// This is only a partial solution to tests using these events - tests which
     1.8 +// check, eg, event.target is the content window are still likely to be
     1.9 +// confused.
    1.10 +// But it's a good start...
    1.11 +["load", "DOMContentLoaded", "pageshow"].forEach(eventName => {
    1.12 +  addEventListener(eventName, function eventHandler(event) {
    1.13 +    // Some tests also rely on load events from, eg, iframes, so we should see
    1.14 +    // if we can do something sane to support that too.
    1.15 +    if (event.target == content.document) {
    1.16 +      sendAsyncMessage("Test:Event", {name: event.type});
    1.17 +    }
    1.18 +  }, true);
    1.19 +});

mercurial