Bug 1387678 - Allow Marionette sendAsync command to handle null or undefinedr?ato
When evaluating if an object can be null, which would mean that we would
not be able to pass through IPC as, the commandId could not be added to null.
This patch makes sure that we can still send commands via IPC if the object is
evaluated to null.
MozReview-Commit-ID: Fl3Ionj08Sk
--- a/testing/marionette/driver.js
+++ b/testing/marionette/driver.js
@@ -317,16 +317,20 @@ GeckoDriver.prototype.globalModalDialogH
* @throws {JavaScriptError}
* If <var>data</var> could not be marshaled.
* @throws {NoSuchWindowError}
* If there is no current target frame.
*/
GeckoDriver.prototype.sendAsync = function(name, data, commandID) {
let payload = evaluate.toJSON(data, this.seenEls);
+ if (payload === null) {
+ payload = {};
+ }
+
// TODO(ato): When proxy.AsyncMessageChannel
// is used for all chrome <-> content communication
// this can be removed.
if (commandID) {
payload.commandID = commandID;
}
this.curBrowser.executeWhenReady(() => {