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

Unified Diff: extensions/renderer/resources/guest_view/web_view_attributes.js

Issue 926083002: Decouple web_view.js from attribute internals (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ignore_mutation
Patch Set: Rebased Created 5 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 | « extensions/renderer/resources/guest_view/web_view.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/resources/guest_view/web_view_attributes.js
diff --git a/extensions/renderer/resources/guest_view/web_view_attributes.js b/extensions/renderer/resources/guest_view/web_view_attributes.js
index 41bbe952a648e6f4348221df5d1dfb2e682de45f..b566696c70adcf39b32ea5fa55a02e467bd4832f 100644
--- a/extensions/renderer/resources/guest_view/web_view_attributes.js
+++ b/extensions/renderer/resources/guest_view/web_view_attributes.js
@@ -64,6 +64,9 @@ WebViewAttribute.prototype.maybeHandleMutation = function(oldValue, newValue) {
// Called when a change that isn't ignored occurs to the attribute's value.
WebViewAttribute.prototype.handleMutation = function(oldValue, newValue) {};
+// Called when the <webview> element is detached from the DOM tree.
+WebViewAttribute.prototype.reset = function() {};
+
// An attribute that is treated as a Boolean.
function BooleanAttribute(name, webViewImpl) {
WebViewAttribute.call(this, name, webViewImpl);
@@ -176,7 +179,8 @@ PartitionAttribute.prototype.handleMutation = function(oldValue, newValue) {
newValue = newValue || '';
// The partition cannot change if the webview has already navigated.
- if (!this.webViewImpl.beforeFirstNavigation) {
+ if (!this.webViewImpl.attributes[
+ WebViewConstants.ATTRIBUTE_SRC].beforeFirstNavigation) {
window.console.error(WebViewConstants.ERROR_MSG_ALREADY_NAVIGATED);
this.setValueIgnoreMutation(oldValue);
return;
@@ -188,10 +192,15 @@ PartitionAttribute.prototype.handleMutation = function(oldValue, newValue) {
}
};
+PartitionAttribute.prototype.reset = function() {
+ this.validPartitionId = true;
+};
+
// Attribute that handles the location and navigation of the webview.
function SrcAttribute(webViewImpl) {
WebViewAttribute.call(this, WebViewConstants.ATTRIBUTE_SRC, webViewImpl);
this.setupMutationObserver();
+ this.beforeFirstNavigation = true;
}
SrcAttribute.prototype.__proto__ = WebViewAttribute.prototype;
@@ -221,6 +230,10 @@ SrcAttribute.prototype.handleMutation = function(oldValue, newValue) {
this.parse();
};
+SrcAttribute.prototype.reset = function() {
+ this.beforeFirstNavigation = true;
+};
+
// The purpose of this mutation observer is to catch assignment to the src
// attribute without any changes to its value. This is useful in the case
// where the webview guest has crashed and navigating to the same address
@@ -254,8 +267,8 @@ SrcAttribute.prototype.parse = function() {
}
if (!this.webViewImpl.guest.getId()) {
- if (this.webViewImpl.beforeFirstNavigation) {
- this.webViewImpl.beforeFirstNavigation = false;
+ if (this.beforeFirstNavigation) {
+ this.beforeFirstNavigation = false;
this.webViewImpl.createGuest();
}
return;
« no previous file with comments | « extensions/renderer/resources/guest_view/web_view.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698