michael@0: // This is the content script for mochitest-e10s-utils michael@0: michael@0: // We hook up some events and forward them back to the parent for the tests michael@0: // This is only a partial solution to tests using these events - tests which michael@0: // check, eg, event.target is the content window are still likely to be michael@0: // confused. michael@0: // But it's a good start... michael@0: ["load", "DOMContentLoaded", "pageshow"].forEach(eventName => { michael@0: addEventListener(eventName, function eventHandler(event) { michael@0: // Some tests also rely on load events from, eg, iframes, so we should see michael@0: // if we can do something sane to support that too. michael@0: if (event.target == content.document) { michael@0: sendAsyncMessage("Test:Event", {name: event.type}); michael@0: } michael@0: }, true); michael@0: });