Skip to content
This repository was archived by the owner on Sep 9, 2022. It is now read-only.
This repository was 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

@clelland

Description

@clelland

[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};
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions