diff options
author | rafaelw@chromium.org <rafaelw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-23 03:28:51 +0000 |
---|---|---|
committer | rafaelw@chromium.org <rafaelw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-23 03:28:51 +0000 |
commit | c931db6d8adbf334c86e31714e2897bc2e9db08a (patch) | |
tree | cf83d11e8e00e45a4733ad62c1a38f0925d8dd8c /chrome/browser/renderer_host | |
parent | d146b8311c38186872d2be3764e2c2d66827107f (diff) | |
download | chromium_src-c931db6d8adbf334c86e31714e2897bc2e9db08a.zip chromium_src-c931db6d8adbf334c86e31714e2897bc2e9db08a.tar.gz chromium_src-c931db6d8adbf334c86e31714e2897bc2e9db08a.tar.bz2 |
Don't inject content scripts into incognito browsers.
This patch prevents content scripts from being injected into incognito profile tabs by only injecting into the same profile in which the extension is running.
BUG=21392
TEST=Load chrome/test/data/extensions/api/incognito_no_script and open any url in incognito browser. No page titles should be modified to "modified".
Review URL: http://codereview.chromium.org/502079
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35203 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/renderer_host')
-rw-r--r-- | chrome/browser/renderer_host/browser_render_process_host.cc | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/chrome/browser/renderer_host/browser_render_process_host.cc b/chrome/browser/renderer_host/browser_render_process_host.cc index 2d7d2f8..5a69ccd 100644 --- a/chrome/browser/renderer_host/browser_render_process_host.cc +++ b/chrome/browser/renderer_host/browser_render_process_host.cc @@ -196,7 +196,7 @@ BrowserRenderProcessHost::BrowserRenderProcessHost(Profile* profile) widget_helper_ = new RenderWidgetHelper(); registrar_.Add(this, NotificationType::USER_SCRIPTS_UPDATED, - NotificationService::AllSources()); + Source<Profile>(profile)); registrar_.Add(this, NotificationType::SPELLCHECK_HOST_REINITIALIZED, NotificationService::AllSources()); registrar_.Add(this, NotificationType::SPELLCHECK_WORD_ADDED, @@ -575,7 +575,10 @@ void BrowserRenderProcessHost::InitVisitedLinks() { void BrowserRenderProcessHost::InitUserScripts() { UserScriptMaster* user_script_master = profile()->GetUserScriptMaster(); - DCHECK(user_script_master); + + // Incognito profiles won't have user scripts. + if (!user_script_master) + return; if (!user_script_master->ScriptsReady()) { // No scripts ready. :( |