summaryrefslogtreecommitdiffstats
path: root/remoting
diff options
context:
space:
mode:
authorsergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-09 19:08:05 +0000
committersergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-09 19:08:05 +0000
commit473ab3aafd2add9f29df652ec03067c9ad5b0a2a (patch)
tree8012a7331f17148babd54c53160eb44bd99e56eb /remoting
parent636b47441b3d992678b53a5a8f4fd8ea1c79a6ca (diff)
downloadchromium_src-473ab3aafd2add9f29df652ec03067c9ad5b0a2a.zip
chromium_src-473ab3aafd2add9f29df652ec03067c9ad5b0a2a.tar.gz
chromium_src-473ab3aafd2add9f29df652ec03067c9ad5b0a2a.tar.bz2
Workaround for the races when opening new tab with the chromoting extension.
The problem is that the extension popup is often closed before it receives the message that the tab has been opened, and thus never sends the message to the new tab. BUG=51194 TEST=tabs opened with the chromoting extension always connect Review URL: http://codereview.chromium.org/3047058 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55436 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r--remoting/client/extension/client.js16
1 files changed, 11 insertions, 5 deletions
diff --git a/remoting/client/extension/client.js b/remoting/client/extension/client.js
index e01de07..e067bd7 100644
--- a/remoting/client/extension/client.js
+++ b/remoting/client/extension/client.js
@@ -209,6 +209,7 @@ function open_chromoting_tab(host_jid) {
};
var tab_args = {
url: new_tab_url,
+ selected: false,
};
console.log("Attempt to connect with " +
@@ -216,13 +217,18 @@ function open_chromoting_tab(host_jid) {
" host_jid='" + request.host_jid + "'" +
" auth_token='" + request.xmpp_auth + "'");
+ // TODO(sergeyu): Currently we open a new tab, send a message and only after
+ // that select the new tab. This is neccessary because chrome closes the
+ // popup the moment the new tab is selected, and so we fail to send the
+ // message if the tab is selected when it is created. There is visible delay
+ // when opening a new tab, so it is necessary to pass the message somehow
+ // differently. Figure out how.
chrome.tabs.create(tab_args, function(tab) {
console.log("We're trying now to send to " + tab.id);
- // TODO(ajwong): This request does not always seem to make it through.
- // I think there's a race condition sending to the view. Figure out how
- // to correctly synchronize this call.
chrome.tabs.sendRequest(
- tab.id, request,
- function() {console.log('Tab finished conenct.')});
+ tab.id, request, function() {
+ console.log('Tab finished connect.');
+ chrome.tabs.update(tab.id, {selected: true});
+ });
});
}