Commit 11420289 authored by kalman@chromium.org's avatar kalman@chromium.org

In ScriptBadgeController, don't CHECK for a valid page ID if there was an error,

nor if there was no page ID on the executing script (possibly handled by the
error case).


BUG=138323


Review URL: https://chromiumcodereview.appspot.com/10855064

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@150706 0039d316-1c4b-4281-b951-d872f2087c98
parent dcb4dc0e
...@@ -111,26 +111,25 @@ void ScriptBadgeController::OnExecuteScriptFinished( ...@@ -111,26 +111,25 @@ void ScriptBadgeController::OnExecuteScriptFinished(
int32 on_page_id, int32 on_page_id,
const GURL& on_url, const GURL& on_url,
const base::ListValue& script_results) { const base::ListValue& script_results) {
if (!error.empty())
return;
int32 current_page_id = GetPageID(); int32 current_page_id = GetPageID();
// Tracking down http://crbug.com/138323. if (on_page_id == current_page_id) {
if (current_page_id < 0) { if (MarkExtensionExecuting(extension_id))
NotifyChange();
} else if (current_page_id < 0) {
// Tracking down http://crbug.com/138323.
std::string message = base::StringPrintf( std::string message = base::StringPrintf(
"Expected a page ID of %d on URL \"%s\", but there was no navigation " "Expected a page ID of %d but there was no navigation entry. "
"entry. Current URL is \"%s\", extension ID is %s.", "Extension ID is %s.",
on_page_id, on_page_id,
on_url.spec().c_str(),
tab_contents_->web_contents()->GetURL().spec().c_str(),
extension_id.c_str()); extension_id.c_str());
char buf[1024]; char buf[1024];
base::snprintf(buf, arraysize(buf), "%s", message.c_str()); base::snprintf(buf, arraysize(buf), "%s", message.c_str());
CHECK(false) << message; CHECK(false) << message;
} }
if (error.empty() && on_page_id == current_page_id) {
if (MarkExtensionExecuting(extension_id))
NotifyChange();
}
} }
ExtensionService* ScriptBadgeController::GetExtensionService() { ExtensionService* ScriptBadgeController::GetExtensionService() {
...@@ -193,24 +192,21 @@ void ScriptBadgeController::OnContentScriptsExecuting( ...@@ -193,24 +192,21 @@ void ScriptBadgeController::OnContentScriptsExecuting(
int32 on_page_id, int32 on_page_id,
const GURL& on_url) { const GURL& on_url) {
int32 current_page_id = GetPageID(); int32 current_page_id = GetPageID();
if (on_page_id != current_page_id)
return;
// Tracking down http://crbug.com/138323.
if (current_page_id < 0) { if (current_page_id < 0) {
// Tracking down http://crbug.com/138323.
std::string message = base::StringPrintf( std::string message = base::StringPrintf(
"Expected a page ID of %d on URL \"%s\", but there was no navigation " "Expected a page ID of %d but there was no navigation entry. "
"entry. Current URL is \"%s\", extension IDs are %s.", "Extension IDs are %s.",
on_page_id, on_page_id,
on_url.spec().c_str(),
tab_contents_->web_contents()->GetURL().spec().c_str(),
JoinExtensionIDs(extension_ids).c_str()); JoinExtensionIDs(extension_ids).c_str());
char buf[1024]; char buf[1024];
base::snprintf(buf, arraysize(buf), "%s", message.c_str()); base::snprintf(buf, arraysize(buf), "%s", message.c_str());
CHECK(false) << message; CHECK(false) << message;
} }
if (on_page_id != current_page_id)
return;
bool changed = false; bool changed = false;
for (std::set<std::string>::const_iterator it = extension_ids.begin(); for (std::set<std::string>::const_iterator it = extension_ids.begin();
it != extension_ids.end(); ++it) { it != extension_ids.end(); ++it) {
......
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