Skip to content
This repository has been archived by the owner on Sep 9, 2022. It is now read-only.

chrome.sockets.tcp throws null error when there is no internet connection on device #31

Open
clelland opened this issue Jul 21, 2017 · 0 comments

Comments

@clelland
Copy link
Contributor

[Migrated from https://bugs.chromium.org/p/chromium/issues/detail?id=449527]

Steps to reproduce the problem:

  1. Start a cordova app on android with the chrome.sockets.tcp plugin
  2. Create a tcp socket
  3. Make sure the device have no Internet connection, and attempt a tcp connection to google.com (or any other website) with chrome.sockets.tcp.connect
  4. The error should show up in error log.

What is the expected behavior?
The fail callback is expected to be called with some error information.

What went wrong?
On sockets.tcp.js line 68, the error argument is passed in as 'null'. Cordova then throws the error

'processmessage Failed: Error: TypeError: Cannot read property 'message' of null'.

Did this work before? N/A

Chrome version: None (Android webview) Channel: stable
OS Version: 4.4.4
Flash Version: Shockwave Flash 11.2 r202

This behavior is not ideal because I would like to retry connections if the connect attempt fails.
I currently have a fix by adding this line in the sockets.tcp.js file:

if (!error){
  error = {message: 'unknown error', resultCode: -100};
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant