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

Unified Diff: remoting/webapp/base/js/connected_view.js

Issue 1584573006: Fix script error on disconnect. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/base/js/connected_view.js
diff --git a/remoting/webapp/base/js/connected_view.js b/remoting/webapp/base/js/connected_view.js
index da75a66261ad4ec73442ac3592cf6ad54c37f133..b90a112844059f1f8959f2da70a02779e253424a 100644
--- a/remoting/webapp/base/js/connected_view.js
+++ b/remoting/webapp/base/js/connected_view.js
@@ -52,6 +52,9 @@ remoting.ConnectedView = function(plugin, viewportElement, cursorElement) {
new remoting.Clipboard(plugin)
);
+ /** @private {base.OneShotTimer} */
+ this.restoreFocusTimer_ = null;
+
// TODO(wez): Only allow mouse lock if the app has the pointerLock permission.
this.plugin_.allowMouseLock();
@@ -66,6 +69,8 @@ remoting.ConnectedView.prototype.dispose = function() {
this.disposables_ = null;
this.cursorRender_ = null;
this.plugin_ = null;
+ base.dispose(this.restoreFocusTimer_);
+ this.restoreFocusTimer_ = null;
};
/**
@@ -101,7 +106,8 @@ remoting.ConnectedView.prototype.onPluginLostFocus_ = function(event) {
// Due to crbug.com/246335, we can't restore the focus immediately,
// otherwise the plugin gets confused about whether or not it has focus.
var that = this;
- var delayedCallback = function() {
+ base.dispose(this.restoreFocusTimer_);
+ this.restoreFocusTimer_ = new base.OneShotTimer(function() {
// When the 'blur' event handler is called document.activeElement has not
// been set to the correct target. We need to retrieve the target in this
// delayedCallback.
@@ -109,8 +115,7 @@ remoting.ConnectedView.prototype.onPluginLostFocus_ = function(event) {
if (!that.isElementFocusable_(target)) {
that.plugin_.element().focus();
}
- };
- window.setTimeout(delayedCallback, 0);
+ }, 0);
};
/**
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698