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

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

Issue 564973004: Move ContentWindow from BrowserPlugin To GuestView (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments + fixed teardown bug 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
Index: extensions/renderer/resources/web_view.js
diff --git a/extensions/renderer/resources/web_view.js b/extensions/renderer/resources/web_view.js
index 85c588c4071d278d553b7b4a359b24339ad41652..03f65c6f686193670e4ab84efa91bbcbac18c457 100644
--- a/extensions/renderer/resources/web_view.js
+++ b/extensions/renderer/resources/web_view.js
@@ -94,6 +94,7 @@ function WebViewInternal(webviewNode) {
this.elementAttached = false;
this.beforeFirstNavigation = true;
+ this.contentWindow = null;
this.validPartitionId = true;
// Used to save some state upon deferred attachment.
// If <object> bindings is not available, we defer attachment.
@@ -166,6 +167,7 @@ WebViewInternal.prototype.reset = function() {
this.beforeFirstNavigation = true;
this.validPartitionId = true;
this.partition.validPartitionId = true;
+ this.contentWindow = null;
}
this.internalInstanceId = 0;
};
@@ -419,10 +421,11 @@ WebViewInternal.prototype.setupWebviewNodeProperties = function() {
// dynamic getter value.
Object.defineProperty(this.webviewNode, 'contentWindow', {
get: function() {
- if (browserPluginNode.contentWindow)
- return browserPluginNode.contentWindow;
+ if (this.contentWindow) {
+ return this.contentWindow;
+ }
window.console.error(ERROR_MSG_CONTENTWINDOW_NOT_AVAILABLE);
- },
+ }.bind(this),
// No setter.
enumerable: true
});
@@ -575,7 +578,10 @@ WebViewInternal.prototype.handleBrowserPluginAttributeMutation =
guestViewInternalNatives.AttachGuest(
this.internalInstanceId,
this.guestInstanceId,
- params);
+ params,
+ function(w) {
+ this.contentWindow = w;
Ken Rockot(use gerrit already) 2014/09/17 21:30:37 nit: This indentation seems a little funky to me;
Fady Samuel 2014/09/17 22:05:46 Done.
+ }.bind(this));
}.bind(this), 0);
}
@@ -879,7 +885,9 @@ WebViewInternal.prototype.attachWindow = function(guestInstanceId,
return guestViewInternalNatives.AttachGuest(
this.internalInstanceId,
this.guestInstanceId,
- params);
+ params, function(w) {
+ this.contentWindow = w;
+ }.bind(this));
};
// Registers browser plugin <object> custom element.

Powered by Google App Engine
This is Rietveld 408576698