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

Side by Side 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: 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/browser_plugin/browser_plugin_bindings.h" 5 #include "content/renderer/browser_plugin/browser_plugin_bindings.h"
6 6
7 #include <cstdlib> 7 #include <cstdlib>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after
702 virtual bool GetProperty(BrowserPluginBindings* bindings, 702 virtual bool GetProperty(BrowserPluginBindings* bindings,
703 NPVariant* result) OVERRIDE { 703 NPVariant* result) OVERRIDE {
704 std::string src = bindings->instance()->GetSrcAttribute(); 704 std::string src = bindings->instance()->GetSrcAttribute();
705 return StringToNPVariant(src, result); 705 return StringToNPVariant(src, result);
706 } 706 }
707 virtual bool SetProperty(BrowserPluginBindings* bindings, 707 virtual bool SetProperty(BrowserPluginBindings* bindings,
708 NPObject* np_obj, 708 NPObject* np_obj,
709 const NPVariant* variant) OVERRIDE { 709 const NPVariant* variant) OVERRIDE {
710 std::string new_value = StringFromNPVariant(*variant); 710 std::string new_value = StringFromNPVariant(*variant);
711 std::string old_value = bindings->instance()->GetSrcAttribute(); 711 std::string old_value = bindings->instance()->GetSrcAttribute();
712 if (old_value != new_value && !new_value.empty()) { 712 bool guest_crashed = bindings->instance()->guest_crashed();
713 if ((old_value != new_value) || guest_crashed) {
714 if (new_value.empty()) {
lazyboy 2013/02/11 18:23:18 Just noting: We used to have this check (setting e
Fady Samuel 2013/02/12 20:44:41 I don't recall. Right now 'src' is treated like an
715 // Remove the DOM attribute to trigger <webview>'s mutation observer
716 // when it is restored to its original value again.
717 bindings->instance()->RemoveDOMAttribute(name());
718 new_value = old_value;
719 }
720 // If the new value was empty then we're effectively resetting the
721 // attribute to the old value here. This will be picked up by <webview>'s
722 // mutation observer and will restore the src attribute after it has been
723 // removed.
713 UpdateDOMAttribute(bindings, new_value); 724 UpdateDOMAttribute(bindings, new_value);
714 std::string error_message; 725 std::string error_message;
715 if (!bindings->instance()->ParseSrcAttribute(&error_message)) { 726 if (!bindings->instance()->ParseSrcAttribute(&error_message)) {
716 WebBindings::setException( 727 WebBindings::setException(
717 np_obj, static_cast<const NPUTF8 *>(error_message.c_str())); 728 np_obj, static_cast<const NPUTF8 *>(error_message.c_str()));
718 // Reset to old value on error. 729 // Reset to old value on error.
719 UpdateDOMAttribute(bindings, old_value); 730 UpdateDOMAttribute(bindings, old_value);
720 return false; 731 return false;
721 } 732 }
722 } 733 }
723 return true; 734 return true;
724 } 735 }
725 virtual void RemoveProperty(BrowserPluginBindings* bindings, 736 virtual void RemoveProperty(BrowserPluginBindings* bindings,
726 NPObject* np_obj) OVERRIDE { 737 NPObject* np_obj) OVERRIDE {
738 std::string old_value = bindings->instance()->GetSrcAttribute();
739 // Remove the DOM attribute to trigger the mutation observer when it is
740 // restored to its original value again.
727 bindings->instance()->RemoveDOMAttribute(name()); 741 bindings->instance()->RemoveDOMAttribute(name());
742 UpdateDOMAttribute(bindings, old_value);
728 } 743 }
729 private: 744 private:
730 DISALLOW_COPY_AND_ASSIGN(BrowserPluginPropertyBindingSrc); 745 DISALLOW_COPY_AND_ASSIGN(BrowserPluginPropertyBindingSrc);
731 }; 746 };
732 747
733 748
734 // BrowserPluginBindings ------------------------------------------------------ 749 // BrowserPluginBindings ------------------------------------------------------
735 750
736 BrowserPluginBindings::BrowserPluginNPObject::BrowserPluginNPObject() { 751 BrowserPluginBindings::BrowserPluginNPObject::BrowserPluginNPObject() {
737 } 752 }
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
840 for (PropertyBindingList::iterator iter = property_bindings_.begin(); 855 for (PropertyBindingList::iterator iter = property_bindings_.begin();
841 iter != property_bindings_.end(); 856 iter != property_bindings_.end();
842 ++iter) { 857 ++iter) {
843 if ((*iter)->MatchesName(name)) 858 if ((*iter)->MatchesName(name))
844 return (*iter)->GetProperty(this, result); 859 return (*iter)->GetProperty(this, result);
845 } 860 }
846 return false; 861 return false;
847 } 862 }
848 863
849 } // namespace content 864 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698