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

Unified Diff: content/renderer/browser_plugin/browser_plugin_bindings.cc

Issue 12224094: Browser Plugin: Navigating to the same URL after crash should load a new guest (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed nits + Merged with ToT Created 7 years, 10 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
« no previous file with comments | « content/renderer/browser_plugin/browser_plugin.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/browser_plugin/browser_plugin_bindings.cc
diff --git a/content/renderer/browser_plugin/browser_plugin_bindings.cc b/content/renderer/browser_plugin/browser_plugin_bindings.cc
index 142adc96e2f5e5b69a36b0df0c01fcb7295cd43b..bfeaa8b6b281023d0745ed2a1bfbb93b3d0fba96 100644
--- a/content/renderer/browser_plugin/browser_plugin_bindings.cc
+++ b/content/renderer/browser_plugin/browser_plugin_bindings.cc
@@ -709,7 +709,18 @@ class BrowserPluginPropertyBindingSrc : public BrowserPluginPropertyBinding {
const NPVariant* variant) OVERRIDE {
std::string new_value = StringFromNPVariant(*variant);
std::string old_value = bindings->instance()->GetSrcAttribute();
- if (old_value != new_value && !new_value.empty()) {
+ 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
+ // removed.
UpdateDOMAttribute(bindings, new_value);
std::string error_message;
if (!bindings->instance()->ParseSrcAttribute(&error_message)) {
@@ -724,7 +735,11 @@ class BrowserPluginPropertyBindingSrc : public BrowserPluginPropertyBinding {
}
virtual void RemoveProperty(BrowserPluginBindings* bindings,
NPObject* np_obj) OVERRIDE {
+ std::string old_value = bindings->instance()->GetSrcAttribute();
+ // Remove the DOM attribute to trigger the mutation observer when it is
+ // restored to its original value again.
bindings->instance()->RemoveDOMAttribute(name());
+ UpdateDOMAttribute(bindings, old_value);
}
private:
DISALLOW_COPY_AND_ASSIGN(BrowserPluginPropertyBindingSrc);
« no previous file with comments | « content/renderer/browser_plugin/browser_plugin.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698