Commit bc1cb4d8 authored by lazyboy@chromium.org's avatar lazyboy@chromium.org

Remove a hard CHECK when allocating instance ID would fail.

A CHECK here seems too intrusive to me, I've changed it
to send error response instead.
A compromised renderer should not take down the whole browser process.

BUG=364141
Test=None, internal clean up.

Review URL: https://codereview.chromium.org/345983002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@278809 0039d316-1c4b-4281-b951-d872f2087c98
parent e3244ed5
......@@ -9,6 +9,11 @@
#include "chrome/common/extensions/api/guest_view_internal.h"
#include "extensions/common/permissions/permissions_data.h"
namespace {
const char* kWebViewPermissionRequiredError =
"\"webview\" permission is required for allocating instance ID.";
} // namespace
namespace extensions {
GuestViewInternalAllocateInstanceIdFunction::
......@@ -18,9 +23,14 @@ GuestViewInternalAllocateInstanceIdFunction::
bool GuestViewInternalAllocateInstanceIdFunction::RunAsync() {
EXTENSION_FUNCTION_VALIDATE(!args_->GetSize());
// Check if we have "webview" permission.
CHECK(GetExtension()->permissions_data()->HasAPIPermission(
APIPermission::kWebView));
if (!GetExtension()->permissions_data()->HasAPIPermission(
APIPermission::kWebView)) {
LOG(ERROR) << kWebViewPermissionRequiredError;
error_ = kWebViewPermissionRequiredError;
SendResponse(false);
return false;
}
int instanceId = GuestViewManager::FromBrowserContext(browser_context())
->GetNextInstanceID();
......
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