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

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

Issue 530043002: <webview> cleanup: Change self = this to bind(this) in web_view.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed rebase Created 6 years, 3 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 | chrome/renderer/resources/extensions/web_view_events.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/resources/extensions/web_view.js
diff --git a/chrome/renderer/resources/extensions/web_view.js b/chrome/renderer/resources/extensions/web_view.js
index 30278f0f4fd5105bbba48bd9b3ff6f264b78d725..5d4c0fda9630c5cac632b354f51d53d691597c0e 100644
--- a/chrome/renderer/resources/extensions/web_view.js
+++ b/chrome/renderer/resources/extensions/web_view.js
@@ -444,18 +444,17 @@ WebViewInternal.prototype.setupWebViewSrcAttributeMutationObserver =
// 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
// spawns off a new process.
- var self = this;
this.srcAndPartitionObserver = new MutationObserver(function(mutations) {
$Array.forEach(mutations, function(mutation) {
var oldValue = mutation.oldValue;
- var newValue = self.webviewNode.getAttribute(mutation.attributeName);
+ var newValue = this.webviewNode.getAttribute(mutation.attributeName);
if (oldValue != newValue) {
return;
}
- self.handleWebviewAttributeMutation(
+ this.handleWebviewAttributeMutation(
mutation.attributeName, oldValue, newValue);
- });
- });
+ }.bind(this));
+ }.bind(this));
var params = {
attributes: true,
attributeOldValue: true,
@@ -756,19 +755,17 @@ WebViewInternal.prototype.dispatchEvent = function(webViewEvent) {
*/
WebViewInternal.prototype.setupEventProperty = function(eventName) {
var propertyName = 'on' + eventName.toLowerCase();
- var self = this;
- var webviewNode = this.webviewNode;
- Object.defineProperty(webviewNode, propertyName, {
+ Object.defineProperty(this.webviewNode, propertyName, {
get: function() {
- return self.on[propertyName];
- },
+ return this.on[propertyName];
+ }.bind(this),
set: function(value) {
- if (self.on[propertyName])
- webviewNode.removeEventListener(eventName, self.on[propertyName]);
- self.on[propertyName] = value;
+ if (this.on[propertyName])
+ this.webviewNode.removeEventListener(eventName, self.on[propertyName]);
+ this.on[propertyName] = value;
if (value)
- webviewNode.addEventListener(eventName, value);
- },
+ this.webviewNode.addEventListener(eventName, value);
+ }.bind(this),
enumerable: true
});
};
« no previous file with comments | « no previous file | chrome/renderer/resources/extensions/web_view_events.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698