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

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

Issue 954543002: <webview>: Fix SrcAttribute and Cleanup (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 | « no previous file | extensions/renderer/resources/guest_view/web_view_attributes.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/resources/guest_view/web_view.js
diff --git a/extensions/renderer/resources/guest_view/web_view.js b/extensions/renderer/resources/guest_view/web_view.js
index e16555d5483a9fe4368747c6c9473805ac7ecf06..4b6774222213046c8128674f41df8732bdcb967e 100644
--- a/extensions/renderer/resources/guest_view/web_view.js
+++ b/extensions/renderer/resources/guest_view/web_view.js
@@ -20,8 +20,6 @@ function WebViewImpl(webviewElement) {
this.setupWebViewAttributes();
this.setupElementProperties();
- // on* Event handlers.
- this.on = {};
new WebViewEvents(this, this.viewInstanceId);
}
@@ -156,37 +154,13 @@ WebViewImpl.prototype.createGuest = function() {
};
WebViewImpl.prototype.onFrameNameChanged = function(name) {
- name = name || '';
- if (name === '') {
- this.element.removeAttribute(WebViewConstants.ATTRIBUTE_NAME);
- } else {
- this.attributes[WebViewConstants.ATTRIBUTE_NAME].setValue(name);
- }
+ this.attributes[WebViewConstants.ATTRIBUTE_NAME].setValueIgnoreMutation(name);
};
WebViewImpl.prototype.dispatchEvent = function(webViewEvent) {
return this.element.dispatchEvent(webViewEvent);
};
-// Adds an 'on<event>' property on the webview, which can be used to set/unset
-// an event handler.
-WebViewImpl.prototype.setupEventProperty = function(eventName) {
- var propertyName = 'on' + eventName.toLowerCase();
- Object.defineProperty(this.element, propertyName, {
- get: function() {
- return this.on[propertyName];
- }.bind(this),
- set: function(value) {
- if (this.on[propertyName])
- this.element.removeEventListener(eventName, this.on[propertyName]);
- this.on[propertyName] = value;
- if (value)
- this.element.addEventListener(eventName, value);
- }.bind(this),
- enumerable: true
- });
-};
-
// Updates state upon loadcommit.
WebViewImpl.prototype.onLoadCommit = function(
baseUrlForDataUrl, currentEntryIndex, entryCount,
@@ -195,19 +169,17 @@ WebViewImpl.prototype.onLoadCommit = function(
this.currentEntryIndex = currentEntryIndex;
this.entryCount = entryCount;
this.processId = processId;
- var oldValue = this.attributes[WebViewConstants.ATTRIBUTE_SRC].getValue();
- var newValue = url;
- if (isTopLevel && (oldValue != newValue)) {
+ if (isTopLevel) {
// Touching the src attribute triggers a navigation. To avoid
// triggering a page reload on every guest-initiated navigation,
// we do not handle this mutation.
- this.attributes[WebViewConstants.ATTRIBUTE_SRC].setValueIgnoreMutation(
- newValue);
+ this.attributes[
+ WebViewConstants.ATTRIBUTE_SRC].setValueIgnoreMutation(url);
}
};
WebViewImpl.prototype.onAttach = function(storagePartitionId) {
- this.attributes[WebViewConstants.ATTRIBUTE_PARTITION].setValue(
+ this.attributes[WebViewConstants.ATTRIBUTE_PARTITION].setValueIgnoreMutation(
storagePartitionId);
};
« no previous file with comments | « no previous file | extensions/renderer/resources/guest_view/web_view_attributes.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698