forked from mirrors/gecko-dev
Bug 1331599 - tests fixed by hand after making addEventListener use the once option when possible, r=jaws.
This commit is contained in:
parent
0e0865f4fc
commit
1907780e48
7 changed files with 14 additions and 13 deletions
|
|
@ -657,7 +657,7 @@ exports["test Listeners"] = createProxyTest(html, function (helper) {
|
|||
|
||||
let addEventListenerCalled = false;
|
||||
let expandoCalled = false;
|
||||
input.addEventListener("click", function onclick(event) {
|
||||
input.addEventListener("click", function (event) {
|
||||
assert(!addEventListenerCalled, "closure given to addEventListener is called once");
|
||||
if (addEventListenerCalled)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -121,7 +121,10 @@ function nextTest() {
|
|||
}
|
||||
}
|
||||
|
||||
function checkResult() {
|
||||
function checkResult(event) {
|
||||
if (event.target.URL == "about:blank")
|
||||
return;
|
||||
|
||||
// Sanity check other values, and the value of gIdentityHandler.getEffectiveHost()
|
||||
is(gIdentityHandler._uri.spec, gCurrentTest.location, "location matches for test " + gTestDesc);
|
||||
// getEffectiveHost can't be called for all modes
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ function test() {
|
|||
yield updated;
|
||||
yield ensureThreadClientState(aPanel, "attached");
|
||||
|
||||
let paused = waitForCaretAndScopes(aPanel, 48);
|
||||
let paused = waitForCaretAndScopes(aPanel, 47);
|
||||
generateMouseClickInTab(gTab, "content.document.body");
|
||||
yield paused;
|
||||
yield ensureThreadClientState(aPanel, "paused");
|
||||
|
|
|
|||
|
|
@ -72,15 +72,15 @@ function testBreakOnClick() {
|
|||
|
||||
switch (handlers.length) {
|
||||
case 1:
|
||||
is(aPacket.frame.where.line, 26, "Found the clicker handler.");
|
||||
is(aPacket.frame.where.line, 25, "Found the clicker handler.");
|
||||
handlers.push("handleEventClick");
|
||||
break;
|
||||
case 2:
|
||||
is(aPacket.frame.where.line, 36, "Found the handleEventClick handler.");
|
||||
is(aPacket.frame.where.line, 35, "Found the handleEventClick handler.");
|
||||
handlers.push("boundHandleEventClick");
|
||||
break;
|
||||
case 3:
|
||||
is(aPacket.frame.where.line, 46, "Found the boundHandleEventClick handler.");
|
||||
is(aPacket.frame.where.line, 45, "Found the boundHandleEventClick handler.");
|
||||
gClient.removeListener("paused", tester);
|
||||
deferred.resolve();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ function test() {
|
|||
let argVar = outerScope.get("arg");
|
||||
is(argVar.target.querySelector(".name").getAttribute("value"), "arg",
|
||||
"Should have the right property name for |arg|.");
|
||||
is(argVar.target.querySelector(".value").getAttribute("value"), 42,
|
||||
is(argVar.target.querySelector(".value").getAttribute("value"), 44,
|
||||
"Should have the right property value for |arg|.");
|
||||
|
||||
yield resumeDebuggerThenCloseAndFinish(panel);
|
||||
|
|
|
|||
|
|
@ -31,8 +31,8 @@
|
|||
generate_tests(assert_equals, [
|
||||
[ "Event filename", errorEvent.filename, location.href ],
|
||||
[ "Callback filename", file, location.href ],
|
||||
[ "Event line number", errorEvent.lineno, 28 ],
|
||||
[ "Callback line number", line, 28 ],
|
||||
[ "Event line number", errorEvent.lineno, 27 ],
|
||||
[ "Callback line number", line, 27 ],
|
||||
[ "Event message", errorEvent.message, "Error: hello" ],
|
||||
[ "Callback message", msg, "Error: hello" ],
|
||||
[ "Event error-object", errorEvent.error, thrown],
|
||||
|
|
|
|||
|
|
@ -157,11 +157,9 @@ function synthesizeNativeWheelAndWaitForWheelEvent(aElement, aX, aY, aDeltaX, aD
|
|||
// parameters.
|
||||
function synthesizeNativeWheelAndWaitForScrollEvent(aElement, aX, aY, aDeltaX, aDeltaY, aCallback) {
|
||||
var targetWindow = aElement.ownerDocument.defaultView;
|
||||
var useCapture = true; // scroll events don't always bubble
|
||||
targetWindow.addEventListener("scroll", function scrollWaiter(e) {
|
||||
targetWindow.removeEventListener("scroll", scrollWaiter, useCapture);
|
||||
targetWindow.addEventListener("scroll", function() {
|
||||
setTimeout(aCallback, 0);
|
||||
}, useCapture);
|
||||
}, {capture: true, once: true}); // scroll events don't always bubble
|
||||
return synthesizeNativeWheel(aElement, aX, aY, aDeltaX, aDeltaY);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue