summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/render_view.cc
diff options
context:
space:
mode:
authorthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-15 05:43:07 +0000
committerthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-15 05:43:07 +0000
commit71b0d5d1eb376f86ff37daf48ec2fdd89ce5aa6e (patch)
tree12f659212ac21f430b4baa05b4dea2a7d147d931 /chrome/renderer/render_view.cc
parent0d809dc5c0407a9592427533a735396771ca65ca (diff)
downloadchromium_src-71b0d5d1eb376f86ff37daf48ec2fdd89ce5aa6e.zip
chromium_src-71b0d5d1eb376f86ff37daf48ec2fdd89ce5aa6e.tar.gz
chromium_src-71b0d5d1eb376f86ff37daf48ec2fdd89ce5aa6e.tar.bz2
Send "content blocked" ipc messages even more reliably.
This effectively reverts patch set 6 from http://codereview.chromium.org/596039 and adds patch set 1 instead. Also add a regression test to make sure the bug is actually fixed. The problem with using navigation state was that allowScripts() was still called before the FrameNavigate message was sent. BUG=35011 TEST=See bug. Review URL: http://codereview.chromium.org/608001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39040 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/render_view.cc')
-rw-r--r--chrome/renderer/render_view.cc18
1 files changed, 14 insertions, 4 deletions
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index f4f3a2d..c086f25 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -314,6 +314,7 @@ RenderView::RenderView(RenderThreadBase* render_thread,
webkit_preferences_(webkit_preferences),
session_storage_namespace_id_(session_storage_namespace_id),
ALLOW_THIS_IN_INITIALIZER_LIST(text_translator_(this)) {
+ ClearBlockedContentSettings();
page_translator_.reset(new PageTranslator(&text_translator_, this));
}
@@ -1160,6 +1161,12 @@ void RenderView::UpdateURL(WebFrame* frame) {
if (!frame->parent()) {
// Top-level navigation.
+ // Clear "block" flags for the new page. This needs to happen before any of
+ // allowScripts(), allowImages(), allowPlugins() is called for the new page
+ // so that these functions can correctly detect that a piece of content
+ // flipped from "not blocked" to "blocked".
+ ClearBlockedContentSettings();
+
// Set content settings.
HostContentSettings::iterator host_content_settings =
host_content_settings_.find(GURL(request.url()).host());
@@ -3211,10 +3218,8 @@ bool RenderView::AllowContentType(ContentSettingsType settings_type,
// CONTENT_SETTING_ASK is only valid for cookies.
if (current_content_settings_.settings[settings_type] ==
CONTENT_SETTING_BLOCK) {
- NavigationState* navigation_state =
- NavigationState::FromDataSource(webview()->mainFrame()->dataSource());
- if (!navigation_state->is_content_blocked(settings_type)) {
- navigation_state->set_content_blocked(settings_type, true);
+ if (!content_blocked_[settings_type]) {
+ content_blocked_[settings_type] = true;
Send(new ViewHostMsg_ContentBlocked(routing_id_, settings_type));
}
return false;
@@ -3222,6 +3227,11 @@ bool RenderView::AllowContentType(ContentSettingsType settings_type,
return true;
}
+void RenderView::ClearBlockedContentSettings() {
+ for (size_t i = 0; i < arraysize(content_blocked_); ++i)
+ content_blocked_[i] = false;
+}
+
void RenderView::DnsPrefetch(const std::vector<std::string>& host_names) {
Send(new ViewHostMsg_DnsPrefetch(host_names));
}