diff --git a/devtools/client/jsonview/converter-child.js b/devtools/client/jsonview/converter-child.js index 40948be5f4e8..184ade02596c 100644 --- a/devtools/client/jsonview/converter-child.js +++ b/devtools/client/jsonview/converter-child.js @@ -363,7 +363,10 @@ function onContentMessage(e) { const value = e.detail.value; switch (e.detail.type) { case "save": - Services.cpmm.sendAsyncMessage("devtools:jsonview:save", value); + win.docShell.messageManager.sendAsyncMessage( + "devtools:jsonview:save", + value + ); } } diff --git a/devtools/startup/DevToolsStartup.jsm b/devtools/startup/DevToolsStartup.jsm index cdffd9b84a3a..e4a0fb6043d3 100644 --- a/devtools/startup/DevToolsStartup.jsm +++ b/devtools/startup/DevToolsStartup.jsm @@ -1156,7 +1156,7 @@ const JsonView = { // Register for messages coming from the child process. // This is never removed as there is no particular need to unregister // it during shutdown. - Services.ppmm.addMessageListener("devtools:jsonview:save", this.onSave); + Services.mm.addMessageListener("devtools:jsonview:save", this.onSave); }, // Message handlers for events from child processes @@ -1166,8 +1166,8 @@ const JsonView = { * in the parent process. */ onSave: function(message) { - const chrome = Services.wm.getMostRecentWindow("navigator:browser"); - const browser = chrome.gBrowser.selectedBrowser; + const browser = message.target; + const chrome = browser.ownerGlobal; if (message.data === null) { // Save original contents chrome.saveBrowser(browser);