Commit 4b545779 authored by Olivier Yiptong's avatar Olivier Yiptong Committed by Commit Bot

FontAccess: Guard against null RenderFrameHostImpl

There is a chance that RFHI may be gone when the static method FromID is
called. This guards against that eventuality.

Bug: 1043306
Change-Id: Ief88320e139a7ae69a4f4ec9a60e914809875c15
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2425171
Commit-Queue: Nasko Oskov <nasko@chromium.org>
Auto-Submit: Olivier Yiptong <oyiptong@chromium.org>
Reviewed-by: default avatarNasko Oskov <nasko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#809809}
parent 3a9b5a1a
......@@ -5,6 +5,7 @@
#include "content/browser/font_access/font_access_manager_impl.h"
#include "base/bind.h"
#include "base/memory/read_only_shared_memory_region.h"
#include "base/task/post_task.h"
#include "content/browser/font_access/font_enumeration_cache.h"
#include "content/browser/permissions/permission_controller_impl.h"
......@@ -43,7 +44,13 @@ void FontAccessManagerImpl::EnumerateLocalFonts(
#if defined(PLATFORM_HAS_LOCAL_FONT_ENUMERATION_IMPL)
const BindingContext& context = receivers_.current_context();
RenderFrameHostImpl* rfh = RenderFrameHostImpl::FromID(context.frame_id);
if (rfh == nullptr) {
std::move(callback).Run(
blink::mojom::FontEnumerationStatus::kUnexpectedError,
base::ReadOnlySharedMemoryRegion());
}
// Sticky User Activation is required for the API to function at all.
if (!rfh->frame_tree_node()->HasStickyUserActivation()) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment