Bug 1195825 - Fix races with new usages of require(promise) instead of Cu.import(Promise.jsm). r=jryans

This commit is contained in:
Alexandre Poirot 2015-08-26 06:05:14 -07:00
parent c41aba9403
commit c742ab9a34
4 changed files with 45 additions and 12 deletions

View File

@ -37,6 +37,9 @@ add_task(function*() {
info("Follow link with middle-click, wait for new node to be selected.");
yield followLinkWaitForNewNode(linkEl, false, inspector);
// We have to re-select the label as the link switched the currently selected node
yield selectNode("label", inspector);
info("Follow link with ctrl/meta-click, wait for new node to be selected.");
yield followLinkWaitForNewNode(linkEl, true, inspector);

View File

@ -138,7 +138,12 @@ function editCustomForm(callback) {
}, false);
headers.focus();
}, false);
query.focus();
// Bug 1195825: Due to some unexplained dark-matter with promise,
// focus only works if delayed by one tick.
executeSoon(() => {
query.focus();
});
}
/*

View File

@ -31,6 +31,7 @@ function* testButton(toolbox, Telemetry) {
ok(button, "Captain, we have the button");
yield delayedClicks(button, 4);
checkResults("_RESPONSIVE_", Telemetry);
}
@ -41,14 +42,17 @@ function delayedClicks(node, clicks) {
// See TOOL_DELAY for why we need setTimeout here
setTimeout(function delayedClick() {
info("Clicking button " + node.id);
node.click();
clicked++;
if (clicked >= clicks) {
resolve(node);
node.addEventListener("click", function listener() {
node.removeEventListener("click", listener);
resolve();
});
} else {
setTimeout(delayedClick, TOOL_DELAY);
}
node.click();
clicked++;
}, TOOL_DELAY);
});
}

View File

@ -14,12 +14,17 @@ add_task(function*() {
let target = TargetFactory.forTab(gBrowser.selectedTab);
let toolbox = yield gDevTools.showToolbox(target, "inspector");
// Wait for the inspector to be initialized
yield toolbox.getPanel("inspector").once("inspector-updated");
info("inspector opened");
info("testing the tilt button");
yield testButton(toolbox, Telemetry);
stopRecordingTelemetryLogs(Telemetry);
yield gDevTools.closeToolbox(target);
gBrowser.removeCurrentTab();
});
@ -31,6 +36,7 @@ function* testButton(toolbox, Telemetry) {
ok(button, "Captain, we have the button");
yield delayedClicks(button, 4)
checkResults("_TILT_", Telemetry);
}
@ -40,15 +46,30 @@ function delayedClicks(node, clicks) {
// See TOOL_DELAY for why we need setTimeout here
setTimeout(function delayedClick() {
info("Clicking button " + node.id);
node.click();
clicked++;
if (clicked >= clicks) {
resolve(node);
} else {
setTimeout(delayedClick, TOOL_DELAY);
resolve();
return;
}
info("Clicking button " + node.id);
// Depending on odd/even click we are either opening
// or closing tilt
let event;
if (clicked % 2 == 0) {
info("Waiting for opening\n");
event = "tilt-initialized";
} else {
dump("Waiting for closing\n");
event = "tilt-destroyed";
}
let f = function () {
Services.obs.removeObserver(f, event, false);
setTimeout(delayedClick, 200);
};
Services.obs.addObserver(f, event, false);
clicked++;
node.click();
}, TOOL_DELAY);
});
}