fix: RenderFrameHost nullptr dereference (#45487)
* fix: add nullptr tests before using render_frame_ * refactor: extract-method HasRenderFrame()
This commit is contained in:
parent
517935cd55
commit
67f5ac5bbc
2 changed files with 11 additions and 5 deletions
|
@ -101,8 +101,14 @@ class WebFrameMain final : public gin::Wrappable<WebFrameMain>,
|
|||
void TeardownMojoConnection();
|
||||
void OnRendererConnectionError();
|
||||
|
||||
// WebFrameMain can outlive its RenderFrameHost pointer so we need to check
|
||||
// whether its been disposed of prior to accessing it.
|
||||
[[nodiscard]] constexpr bool HasRenderFrame() const {
|
||||
return !render_frame_disposed_ && render_frame_ != nullptr;
|
||||
}
|
||||
|
||||
// Throws a JS error if HasRenderFrame() is false.
|
||||
// WebFrameMain can outlive its RenderFrameHost pointer,
|
||||
// so we need to check whether its been disposed of
|
||||
// prior to accessing it.
|
||||
bool CheckRenderFrame() const;
|
||||
|
||||
v8::Local<v8::Promise> ExecuteJavaScript(gin::Arguments* args,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue