0

[pip] Add CHECK when looking up WebFrame from v8 context

Wen trying to find the decoder factory for a frame, handle the case
where there is no frame associated with the v8 context.  This can
happen when the frame is closed / reloaded, but the video element
is in a same-origin frame that still exists.

It's unclear that the v8 frame is the correct one to use in these
cases, but it's quite clear that dereferencing a nullptr is bad.

Explicitly CHECK() for this case.

Bug: 355139787
Change-Id: Ie976e12957f0f08dbfacdae5ce426a6bd40c2f54
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5763089
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Frank Liberato <liberato@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1337962}
This commit is contained in:
Frank Liberato
2024-08-06 17:21:36 +00:00
committed by Chromium LUCI CQ
parent 79628d5451
commit a668522089

@ -1015,6 +1015,7 @@ base::WeakPtr<media::DecoderFactory>
RendererBlinkPlatformImpl::GetMediaDecoderFactory() {
blink::WebLocalFrame* const web_frame =
blink::WebLocalFrame::FrameForCurrentContext();
CHECK(web_frame);
RenderFrameImpl* render_frame = RenderFrameImpl::FromWebFrame(web_frame);
return render_frame->GetMediaDecoderFactory();
}