Commit f7429dc0 authored by Jarryd's avatar Jarryd Committed by Commit Bot

Quota: Fix null dereference.

Bug: 1117159
Change-Id: I8d8088cb7ca703d579754d880faf2926e483236b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2363258Reviewed-by: default avatarVictor Costan <pwnall@chromium.org>
Commit-Queue: Victor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#800578}
parent 3d34380f
...@@ -190,8 +190,12 @@ void StorageManager::AddedEventListener( ...@@ -190,8 +190,12 @@ void StorageManager::AddedEventListener(
const AtomicString& event_type, const AtomicString& event_type,
RegisteredEventListener& registered_listener) { RegisteredEventListener& registered_listener) {
if (!quota_host_.is_bound()) { if (!quota_host_.is_bound()) {
ExecutionContext* execution_context = GetExecutionContext();
if (!execution_context)
return;
// This method will bind quota_host_. // This method will bind quota_host_.
GetQuotaHost(GetExecutionContext()); GetQuotaHost(execution_context);
} }
EventTargetWithInlineData::AddedEventListener(event_type, EventTargetWithInlineData::AddedEventListener(event_type,
registered_listener); registered_listener);
...@@ -237,10 +241,13 @@ void StorageManager::StartObserving() { ...@@ -237,10 +241,13 @@ void StorageManager::StartObserving() {
if (change_listener_receiver_.is_bound()) if (change_listener_receiver_.is_bound())
return; return;
ExecutionContext* execution_context = GetExecutionContext();
DCHECK(execution_context);
// Using kMiscPlatformAPI because the Storage specification does not // Using kMiscPlatformAPI because the Storage specification does not
// specify a dedicated task queue yet. // specify a dedicated task queue yet.
auto task_runner = auto task_runner =
GetExecutionContext()->GetTaskRunner(TaskType::kMiscPlatformAPI); execution_context->GetTaskRunner(TaskType::kMiscPlatformAPI);
quota_host_->AddChangeListener( quota_host_->AddChangeListener(
change_listener_receiver_.BindNewPipeAndPassRemote(task_runner), {}); change_listener_receiver_.BindNewPipeAndPassRemote(task_runner), {});
} }
......
<!doctype html>
<meta charset="utf-8">
<title>quotachange event on DOMWindow of detached iframe</title>
<link rel="author" href="jarrydg@chromium.org" title="Jarryd">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<iframe id="iframe"></iframe>
<script>
'use strict';
test(t => {
const iframe = document.getElementById('iframe');
const frameWindow = iframe.contentWindow;
const storageManager = frameWindow.navigator.storage;
iframe.parentNode.removeChild(iframe);
const emptyListener = () => {};
storageManager.addEventListener('quotachange', emptyListener);
storageManager.removeEventListener('quotachange', emptyListener);
}, "Add quotachange listener on detached iframe.");
</script>
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