Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6589)

Unified Diff: chrome/renderer/searchbox_extension.cc

Issue 6677030: Fixes crash if instant is enabled and you block JS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adds test Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/instant/instant_loader.cc ('k') | content/common/notification_type.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/searchbox_extension.cc
diff --git a/chrome/renderer/searchbox_extension.cc b/chrome/renderer/searchbox_extension.cc
index c1b9bfe423a6147a43af80100c18a3e9ef034f49..d866c49f85f2c7d9be7a450796128eb8980d2d0e 100644
--- a/chrome/renderer/searchbox_extension.cc
+++ b/chrome/renderer/searchbox_extension.cc
@@ -354,6 +354,8 @@ bool Dispatch(WebFrame* frame, const std::string& event_name) {
v8::HandleScope handle_scope;
v8::Local<v8::Context> context = frame->mainWorldScriptContext();
+ if (context.IsEmpty())
+ return false;
v8::Context::Scope context_scope(context);
v8::Local<v8::Value> value =
@@ -408,8 +410,9 @@ bool SearchBoxExtension::PageSupportsInstant(WebFrame* frame) {
DCHECK(frame) << "PageSupportsInstant requires frame";
if (!frame) return false;
- bool supports_deprecated_api = frame->executeScriptAndReturnValue(
- WebScriptSource(kSupportsInstantScript))->BooleanValue();
+ v8::Handle<v8::Value> v = frame->executeScriptAndReturnValue(
+ WebScriptSource(kSupportsInstantScript));
+ bool supports_deprecated_api = !v.IsEmpty() && v->BooleanValue();
// TODO(tonyg): Add way of detecting instant support to SearchBox API.
bool supports_searchbox_api = supports_deprecated_api;
« no previous file with comments | « chrome/browser/instant/instant_loader.cc ('k') | content/common/notification_type.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698