summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfsamuel@chromium.org <fsamuel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-16 19:15:41 +0000
committerfsamuel@chromium.org <fsamuel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-16 19:15:41 +0000
commit1937f681527f276e861a3502aadaa21ffda4d353 (patch)
tree2ede088773fc6a3e83230b510f9b4ed0b388c7df
parent59f6cb72d0bb6e1b9d0f39df53285e7cd5c8c4f2 (diff)
downloadchromium_src-1937f681527f276e861a3502aadaa21ffda4d353.zip
chromium_src-1937f681527f276e861a3502aadaa21ffda4d353.tar.gz
chromium_src-1937f681527f276e861a3502aadaa21ffda4d353.tar.bz2
<webview>: Fixed WebViewTest.ShimSrcAttribute flakiness.
It seems that my previous patch initiated a new navigation on webview.setAttribute('src', '') while webview.removeAttribute('src') didn't. ShimSrcAttribute expects webview.setAttribute('src', '') to do nothing. This patch updates the behavior to BrowserPlugin to match the expectations in ShimSrcAttribute. BUG=176122 Test=WebViewTest.ShimSrcAttribute, WebViewTest.Shim Review URL: https://chromiumcodereview.appspot.com/12212193 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@182997 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/extensions/web_view_browsertest.cc3
-rw-r--r--content/renderer/browser_plugin/browser_plugin_bindings.cc13
2 files changed, 8 insertions, 8 deletions
diff --git a/chrome/browser/extensions/web_view_browsertest.cc b/chrome/browser/extensions/web_view_browsertest.cc
index e634f50..3a13e2f4 100644
--- a/chrome/browser/extensions/web_view_browsertest.cc
+++ b/chrome/browser/extensions/web_view_browsertest.cc
@@ -252,8 +252,7 @@ IN_PROC_BROWSER_TEST_F(WebViewTest, MAYBE_Shim) {
ASSERT_TRUE(RunPlatformAppTest("platform_apps/web_view/shim")) << message_;
}
-// http://crbug.com/176122: This test is flaky.
-IN_PROC_BROWSER_TEST_F(WebViewTest, DISABLED_ShimSrcAttribute) {
+IN_PROC_BROWSER_TEST_F(WebViewTest, ShimSrcAttribute) {
ASSERT_TRUE(RunPlatformAppTest("platform_apps/web_view/src_attribute"))
<< message_;
}
diff --git a/content/renderer/browser_plugin/browser_plugin_bindings.cc b/content/renderer/browser_plugin/browser_plugin_bindings.cc
index dad24f5..adefa0d 100644
--- a/content/renderer/browser_plugin/browser_plugin_bindings.cc
+++ b/content/renderer/browser_plugin/browser_plugin_bindings.cc
@@ -708,15 +708,16 @@ class BrowserPluginPropertyBindingSrc : public BrowserPluginPropertyBinding {
NPObject* np_obj,
const NPVariant* variant) OVERRIDE {
std::string new_value = StringFromNPVariant(*variant);
+ // We should not be issuing navigation IPCs if we attempt to set the
+ // src property to the empty string. Instead, we want to simply restore
+ // the src attribute back to its old value.
+ if (new_value.empty()) {
+ RemoveProperty(bindings, np_obj);
+ return true;
+ }
std::string old_value = bindings->instance()->GetSrcAttribute();
bool guest_crashed = bindings->instance()->guest_crashed();
if ((old_value != new_value) || guest_crashed) {
- if (new_value.empty()) {
- // Remove the DOM attribute to trigger <webview>'s mutation observer
- // when it is restored to its original value again.
- bindings->instance()->RemoveDOMAttribute(name());
- new_value = old_value;
- }
// If the new value was empty then we're effectively resetting the
// attribute to the old value here. This will be picked up by <webview>'s
// mutation observer and will restore the src attribute after it has been