const URL = "data:text/html,"; add_task(function* () { let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, URL); let browser = tab.linkedBrowser; EventUtils.synthesizeKey("d", { code: "KeyD", repeat: 3 }); yield ContentTask.spawn(browser, null, function* () { is(content.document.body.getAttribute("data-down"), "2", "Correct number of events"); is(content.document.body.getAttribute("data-press"), "2", "Correct number of events"); }); EventUtils.synthesizeKey("p", { code: "KeyP", repeat: 3 }); yield ContentTask.spawn(browser, null, function* () { is(content.document.body.getAttribute("data-down"), "4", "Correct number of events"); is(content.document.body.getAttribute("data-press"), "4", "Correct number of events"); }); gBrowser.removeCurrentTab(); });