summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/navigation_state.h
diff options
context:
space:
mode:
authorthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-12 06:33:49 +0000
committerthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-12 06:33:49 +0000
commit15cf526b5e4fa4e9cfc652a9420fdd09e42eb1c7 (patch)
treed5a01a03686cb88d344f358a6b709bcf6c5462f5 /chrome/renderer/navigation_state.h
parent04b4733ffcf2fdfef413c900cc203e959a7945f9 (diff)
downloadchromium_src-15cf526b5e4fa4e9cfc652a9420fdd09e42eb1c7.zip
chromium_src-15cf526b5e4fa4e9cfc652a9420fdd09e42eb1c7.tar.gz
chromium_src-15cf526b5e4fa4e9cfc652a9420fdd09e42eb1c7.tar.bz2
Send "content blocked" ipc messages more reliably.
I believe that the bug happened in this sequence of events: 1.) JS gets blocked on the web page, icon appears. The renderer (correctly) thinks js is blocked. 2.) User hits "reload" 3.) RenderView::didCommitProvisionalLoad() calls RenderView::UpdateURL() which sends ViewHostMsg_FrameNavigate to the browser which clears the content settings images in the location bar 4.) RenderView::allowScripts() gets called during page loading. The renderer still thinks that js is blocked and hence doesn't notify the browser. 5.) RenderView::didReceiveResponse() clears the content blocked flags (too late) This CL moves the content blocked flags into navigationstate, which should prevent this "race" because there's one new navigationstate per page. BUG=35011 TEST=See bug. Review URL: http://codereview.chromium.org/596039 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38877 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/navigation_state.h')
-rw-r--r--chrome/renderer/navigation_state.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/chrome/renderer/navigation_state.h b/chrome/renderer/navigation_state.h
index d17b542..d3d2418 100644
--- a/chrome/renderer/navigation_state.h
+++ b/chrome/renderer/navigation_state.h
@@ -7,6 +7,7 @@
#include "base/scoped_ptr.h"
#include "base/time.h"
+#include "chrome/common/content_settings.h"
#include "chrome/common/page_transition_types.h"
#include "chrome/renderer/user_script_idle_scheduler.h"
#include "third_party/WebKit/WebKit/chromium/public/WebDataSource.h"
@@ -215,6 +216,13 @@ class NavigationState : public WebKit::WebDataSource::ExtraData {
void set_was_translated(bool value) { was_translated_ = value; }
bool was_translated() const { return was_translated_; }
+ // Whether content has been blocked.
+ bool is_content_blocked(ContentSettingsType settings_type) {
+ return content_blocked_[settings_type];
+ }
+ void set_content_blocked(ContentSettingsType settings_type, bool is_blocked) {
+ content_blocked_[settings_type] = is_blocked;
+ }
private:
NavigationState(PageTransition::Type transition_type,
const base::Time& request_time,
@@ -233,6 +241,8 @@ class NavigationState : public WebKit::WebDataSource::ExtraData {
user_script_idle_scheduler_(NULL),
was_fetched_via_spdy_(false),
was_translated_(false) {
+ for (size_t i = 0; i < arraysize(content_blocked_); ++i)
+ content_blocked_[i] = false;
}
PageTransition::Type transition_type_;
@@ -265,6 +275,9 @@ class NavigationState : public WebKit::WebDataSource::ExtraData {
bool was_translated_;
+ // Stores if images, scripts, and plugins have actually been blocked.
+ bool content_blocked_[CONTENT_SETTINGS_NUM_TYPES];
+
DISALLOW_COPY_AND_ASSIGN(NavigationState);
};