mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-24 10:45:42 +00:00
Bug 1430077 - Correct safety checks on Marionette:Register reply. r=whimboo
sendSyncMessage returns an array of replies from the frame message manager, each item being the return value from each message listener that handles the message. In testing/marionette/driver.js there are two handlers for Marionette:Register, but it is not predictable at the moment when both or either one of them is triggered. We would, however, always expect a response, which means the reply array should never be empty. MozReview-Commit-ID: 5F8YfKO8jBU --HG-- extra : rebase_source : c23900fed32a52d228c91cb6428be569fb967f41
This commit is contained in:
parent
4103c22b8c
commit
b70e3acf47
@ -458,10 +458,12 @@ function registerSelf() {
|
||||
action.inputStateMap = new Map();
|
||||
action.inputsToCancel = [];
|
||||
|
||||
// register will have the ID and a boolean describing if this is the
|
||||
// main process or not
|
||||
let register = sendSyncMessage("Marionette:Register", {outerWindowID});
|
||||
if (register[0].outerWindowID === outerWindowID) {
|
||||
let reply = sendSyncMessage("Marionette:Register", {outerWindowID});
|
||||
if (reply.length == 0) {
|
||||
logger.error("No reply from Marionette:Register");
|
||||
}
|
||||
|
||||
if (reply[0].outerWindowID === outerWindowID) {
|
||||
startListeners();
|
||||
sendAsyncMessage("Marionette:ListenersAttached", {outerWindowID});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user