diff options
author | sreeram@chromium.org <sreeram@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-11 19:42:34 +0000 |
---|---|---|
committer | sreeram@chromium.org <sreeram@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-11 19:42:34 +0000 |
commit | 4330f4c64f4249d41452511b227592e94478a563 (patch) | |
tree | 4a3f59c71eeb96357038ee412d2d5141a19baa7a | |
parent | bdc693616f079d4d1eea79e2b9e914432e58250c (diff) | |
download | chromium_src-4330f4c64f4249d41452511b227592e94478a563.zip chromium_src-4330f4c64f4249d41452511b227592e94478a563.tar.gz chromium_src-4330f4c64f4249d41452511b227592e94478a563.tar.bz2 |
Be more robust in checking v8 values.
Something has changed in v8 that result.IsEmpty() is no longer true even when
the v2 API methods don't exist. Thus, the v1 API doesn't get called when it
should. It turns out that result->IsUndefined() is true, so just adding that
check should suffice, but I've also added IsNull() and IsFalse(), just in case.
Even more curiously, all of these return false (and thus the v1 API is still
not called) for the onresize() script alone. This boggles my mind. But since
onresize() isn't relevant for the SILENT mode where this bug occurs, I'll debug
it and fix it later.
BUG=127625
TEST=Follow these steps:
1. Start Chrome with --instant-field-trial=silent
2. Navigate to www.google.com.
3. Open the JS console and execute this line:
localStorage['web-psy-sc'] = Date.now();
4. Open a new tab.
5. Type a search query in the omnibox (and press Enter).
In the bug, you'll end up on the Google homepage, with no search results.
In the fix, the search will successfully execute, and you'll see
"sourceid=chrome-psyapi1" in the URL somewhere.
Review URL: https://chromiumcodereview.appspot.com/10377113
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@136637 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/renderer/searchbox_extension.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/chrome/renderer/searchbox_extension.cc b/chrome/renderer/searchbox_extension.cc index d21906e..1135265 100644 --- a/chrome/renderer/searchbox_extension.cc +++ b/chrome/renderer/searchbox_extension.cc @@ -386,8 +386,10 @@ void Dispatch(WebFrame* frame, v8::Handle<v8::Value> result = frame->executeScriptAndReturnValue( WebScriptSource(event_dispatch_script)); - if (result.IsEmpty()) + if (result.IsEmpty() || result->IsUndefined() || result->IsNull() || + result->IsFalse()) { frame->executeScript(WebScriptSource(no_event_handler_script)); + } } // static |