Browse Source

fix: takeHeapSnapshot() using public IPC channel for internal implementation (#16484)

trop[bot] 6 years ago
parent
commit
84f1dc7f8c
2 changed files with 3 additions and 3 deletions
  1. 1 1
      atom/renderer/atom_render_frame_observer.cc
  2. 2 2
      lib/browser/api/web-contents.js

+ 1 - 1
atom/renderer/atom_render_frame_observer.cc

@@ -216,7 +216,7 @@ void AtomRenderFrameObserver::OnTakeHeapSnapshot(
   args.AppendBoolean(success);
 
   render_frame_->Send(new AtomFrameHostMsg_Message(
-      render_frame_->GetRoutingID(), "ipc-message", args));
+      render_frame_->GetRoutingID(), "ipc-internal-message", args));
 }
 
 void AtomRenderFrameObserver::EmitIPCEvent(blink::WebLocalFrame* frame,

+ 2 - 2
lib/browser/api/web-contents.js

@@ -199,7 +199,7 @@ WebContents.prototype.executeJavaScript = function (code, hasUserGesture, callba
 WebContents.prototype.takeHeapSnapshot = function (filePath) {
   return new Promise((resolve, reject) => {
     const channel = `ELECTRON_TAKE_HEAP_SNAPSHOT_RESULT_${getNextId()}`
-    ipcMain.once(channel, (event, success) => {
+    ipcMainInternal.once(channel, (event, success) => {
       if (success) {
         resolve()
       } else {
@@ -207,7 +207,7 @@ WebContents.prototype.takeHeapSnapshot = function (filePath) {
       }
     })
     if (!this._takeHeapSnapshot(filePath, channel)) {
-      ipcMain.emit(channel, false)
+      ipcMainInternal.emit(channel, false)
     }
   })
 }