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

Unified Diff: chrome/browser/extensions/extension_host.cc

Issue 6932038: avoid dereferencing NULL extension in ExtensionHost (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: removed reduntant Created 9 years, 7 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
Index: chrome/browser/extensions/extension_host.cc
diff --git a/chrome/browser/extensions/extension_host.cc b/chrome/browser/extensions/extension_host.cc
index 003f563370f238abb50cd7449cb89f9d2746e4ed..ddd933eff6f1b65afb4a7491a2ca85fb6134b509 100644
--- a/chrome/browser/extensions/extension_host.cc
+++ b/chrome/browser/extensions/extension_host.cc
@@ -26,7 +26,6 @@
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "chrome/browser/ui/webui/chrome_web_ui_factory.h"
#include "chrome/common/chrome_constants.h"
-#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/render_messages.h"
#include "chrome/common/url_constants.h"
@@ -126,6 +125,7 @@ ExtensionHost::ExtensionHost(const Extension* extension,
const GURL& url,
ViewType::Type host_type)
: extension_(extension),
+ id_(extension->id()),
profile_(site_instance->browsing_instance()->profile()),
did_stop_loading_(false),
document_element_available_(false),
@@ -234,8 +234,7 @@ void ExtensionHost::NavigateToURL(const GURL& url) {
// Prevent explicit navigation to another extension id's pages.
// This method is only called by some APIs, so we still need to protect
// DidNavigate below (location = "").
- if (url.SchemeIs(chrome::kExtensionScheme) &&
- url.host() != extension_->id()) {
+ if (url.SchemeIs(chrome::kExtensionScheme) && url.host() != id()) {
// TODO(erikkay) communicate this back to the caller?
return;
}
@@ -259,7 +258,7 @@ void ExtensionHost::Observe(NotificationType type,
switch (type.value) {
case NotificationType::EXTENSION_BACKGROUND_PAGE_READY:
DCHECK(profile_->GetExtensionService()->
- IsBackgroundPageReady(extension_));
+ IsBackgroundPageReady(extension_));
NavigateToURL(url_);
break;
case NotificationType::RENDERER_PROCESS_CREATED:
@@ -342,7 +341,7 @@ void ExtensionHost::DidNavigate(RenderViewHost* render_view_host,
// will leave the host in kind of a bad state with poor UI and errors, but
// it's better than the alternative.
// TODO(erikkay) Perhaps we should display errors in developer mode.
- if (params.url.host() != extension_->id()) {
+ if (params.url.host() != id()) {
extension_function_dispatcher_.reset(NULL);
return;
}

Powered by Google App Engine
This is Rietveld 408576698