Skip to content

Commit

Permalink
fix: reset render_frame_disposed_ after render frame host change (#32130
Browse files Browse the repository at this point in the history
)

* fix: reset render_frame_disposed_ after hang

* fix: handle exception in webContents.send

Co-authored-by: VerteDinde <keeleymhammond@gmail.com>
Co-authored-by: VerteDinde <khammond@slack-corp.com>
  • Loading branch information
3 people committed Jan 4, 2022
1 parent 316f0bc commit 8283f19
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions lib/browser/api/web-frame-main.ts
Expand Up @@ -7,15 +7,23 @@ WebFrameMain.prototype.send = function (channel, ...args) {
throw new Error('Missing required channel argument');
}

return this._send(false /* internal */, channel, args);
try {
return this._send(false /* internal */, channel, args);
} catch (e) {
console.error('Error sending from webFrameMain: ', e);
}
};

WebFrameMain.prototype._sendInternal = function (channel, ...args) {
if (typeof channel !== 'string') {
throw new Error('Missing required channel argument');
}

return this._send(true /* internal */, channel, args);
try {
return this._send(true /* internal */, channel, args);
} catch (e) {
console.error('Error sending from webFrameMain: ', e);
}
};

WebFrameMain.prototype.postMessage = function (...args) {
Expand Down
2 changes: 1 addition & 1 deletion shell/browser/api/electron_api_web_frame_main.cc
Expand Up @@ -78,7 +78,7 @@ void WebFrameMain::MarkRenderFrameDisposed() {

void WebFrameMain::UpdateRenderFrameHost(content::RenderFrameHost* rfh) {
// Should only be called when swapping frames.
DCHECK(render_frame_);
render_frame_disposed_ = false;
render_frame_ = rfh;
renderer_api_.reset();
}
Expand Down

0 comments on commit 8283f19

Please sign in to comment.