fix: reset render_frame_disposed_ after render frame host change (#31401)

* fix: reset render_frame_disposed_ after hang

* fix: handle exception in webContents.send
This commit is contained in:
Keeley Hammond 2021-10-14 09:44:44 -07:00 committed by GitHub
parent 11db6a7d9a
commit bff20bd769
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 3 deletions

View file

@ -7,7 +7,11 @@ WebFrameMain.prototype.send = function (channel, ...args) {
throw new Error('Missing required channel argument'); 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) { WebFrameMain.prototype._sendInternal = function (channel, ...args) {
@ -15,7 +19,11 @@ WebFrameMain.prototype._sendInternal = function (channel, ...args) {
throw new Error('Missing required channel argument'); 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) { WebFrameMain.prototype.postMessage = function (...args) {

View file

@ -100,7 +100,7 @@ void WebFrameMain::MarkRenderFrameDisposed() {
void WebFrameMain::UpdateRenderFrameHost(content::RenderFrameHost* rfh) { void WebFrameMain::UpdateRenderFrameHost(content::RenderFrameHost* rfh) {
// Should only be called when swapping frames. // Should only be called when swapping frames.
DCHECK(render_frame_); render_frame_disposed_ = false;
render_frame_ = rfh; render_frame_ = rfh;
renderer_api_.reset(); renderer_api_.reset();
} }