Index: remoting/webapp/host_native_messaging.js |
diff --git a/remoting/webapp/host_native_messaging.js b/remoting/webapp/host_native_messaging.js |
index 8c76c424a3f535e45d05498212683b89b56af6f5..5762c05a240ad110a019f5362ff408f45e034588 100644 |
--- a/remoting/webapp/host_native_messaging.js |
+++ b/remoting/webapp/host_native_messaging.js |
@@ -65,29 +65,17 @@ remoting.HostNativeMessaging.PendingReply = function(type, onDone, onError) { |
* @return {void} Nothing. |
*/ |
remoting.HostNativeMessaging.prototype.initialize = function(onDone, onError) { |
- if (!chrome.runtime.connectNative) { |
weitao
2014/01/31 18:37:11
I am about to commit a CL that remove this code an
Sergey Ulanov
2014/01/31 23:34:17
Done.
|
- console.log('Native Messaging API not available'); |
- onError(remoting.Error.UNEXPECTED); |
- return; |
- } |
- |
- // NativeMessaging API exists on Chrome 26.xxx but fails to notify |
- // onDisconnect in the case where the Host components are not installed. Need |
- // to blacklist these versions of Chrome. |
- var majorVersion = navigator.appVersion.match('Chrome/(\\d+)\.')[1]; |
- if (!majorVersion || majorVersion <= 26) { |
- console.log('Native Messaging not supported on this version of Chrome'); |
- onError(remoting.Error.UNEXPECTED); |
- return; |
- } |
- |
+ console.log("NM Init"); |
Jamie
2014/01/31 18:39:15
Are these logs needed? If so, they should be a bit
Sergey Ulanov
2014/01/31 23:34:17
Reverted the changes in this method, but the fix i
|
try { |
+ console.log("NM Init2 " + this.pendingReplies_); |
+ this.pendingReplies_ = {}; |
this.port_ = chrome.runtime.connectNative( |
'com.google.chrome.remote_desktop'); |
this.port_.onMessage.addListener(this.onIncomingMessage_.bind(this)); |
this.port_.onDisconnect.addListener(this.onDisconnect_.bind(this)); |
this.postMessage_({type: 'hello'}, onDone, |
onError.bind(null, remoting.Error.UNEXPECTED)); |
+ console.log("NM Init3"); |
} catch (err) { |
console.log('Native Messaging initialization failed: ', |
/** @type {*} */ (err)); |
@@ -381,11 +369,13 @@ remoting.HostNativeMessaging.prototype.onDisconnect_ = function() { |
console.error('Native Message port disconnected'); |
// Notify the error-handlers of any requests that are still outstanding. |
- for (var id in this.pendingReplies_) { |
- this.pendingReplies_[/** @type {number} */(id)].onError( |
+ var pendingReplies = this.pendingReplies_; |
+ this.pendingReplies_ = {}; |
+ |
+ for (var id in pendingReplies) { |
+ pendingReplies[/** @type {number} */(id)].onError( |
remoting.Error.UNEXPECTED); |
} |
- this.pendingReplies_ = {}; |
} |
/** |