Closed Bug 1421393 Opened 8 years ago Closed 10 months ago

navigator.onLine doesn't return false on Windows when disconnected from network

Categories

(Core :: Networking, defect, P3)

58 Branch
defect

Tracking

()

RESOLVED FIXED
136 Branch
Tracking Status
firefox136 --- fixed

People

(Reporter: sguergachi, Assigned: kernp25)

References

Details

(Whiteboard: [necko-triaged])

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0 Build ID: 20171128100440 Steps to reproduce: 1. In Windows, click the wifi network icon in the tray to pop up the list of wifi networks available 2. Disconnect from the current wifi network and wait a few seconds 3. In firefox console type "navigator.onLine" Actual results: "true" is returned Expected results: "false" should be returned
Component: Untriaged → Networking
Product: Firefox → Core
Assignee: nobody → daniel
Priority: -- → P3
Whiteboard: [necko-triaged]
I can confirm it happens here too. "navigator.onLine" gives false positive. Steps to reproduce: https://kinoseed.com/ click on "source samples" (second icon - the camera roll) What happens: samples are shown no matter if you are online or offline What should happen: indication is shown when you are offline (works with Chrome) Note: While developing it seemed (I think) it worked properly for a while, but failed after a "serviceworker" was introduced.
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Assignee: daniel → nobody
Status: ASSIGNED → NEW

We might just want to skip some interface types that are known to be virtual interfaces (VMWare) here

Severity: normal → S3
Duplicate of this bug: 1935863

Will this bug ever be fixed?

Flags: needinfo?(valentin.gosu)

We could try to use PhysicalAdapter for this - but I'm not sure if switching to WMI is justified by this one issue.

I haven't checked, but it's possible that simply checking the PhysicalAddressLength would also get us the information we want - as long as this is 0 for virtual interfaces created by VMs.

I'm happy to review a patch for this.

Flags: needinfo?(valentin.gosu)

PhysicalAdapter was useless to detect VMware Adapters:

PS C:\Users\****> Get-WmiObject Win32_NetworkAdapter | Select-Object Name,PhysicalAdapter

Name                                              PhysicalAdapter
----                                              ---------------
ASIX USB to Gigabit Ethernet Family Adapter                  True
Realtek Gaming 2.5GbE Family Controller                      True
MediaTek Wi-Fi 6E MT7922 160MHz Wireless LAN Card            True
Microsoft Kernel Debug Network Adapter                      False
VMware Virtual Ethernet Adapter for VMnet1                   True
Bluetooth Device (Personal Area Network)                     True
VMware Virtual Ethernet Adapter for VMnet8                   True
Microsoft Wi-Fi Direct Virtual Adapter                      False
Microsoft Wi-Fi Direct Virtual Adapter #2                   False
WAN Miniport (SSTP)                                         False
WAN Miniport (IKEv2)                                        False
WAN Miniport (L2TP)                                         False
WAN Miniport (PPTP)                                         False
WAN Miniport (PPPOE)                                        False
WAN Miniport (IP)                                           False
WAN Miniport (IPv6)                                         False
WAN Miniport (Network Monitor)                              False


PS C:\Users\****>

PhysicalAddressLength did not help, either.

Thank you for checking, Masatoshi.
In that case, I suspect the best option here would be to skip adapters that contain "VMware" or "Virtual" in the name.
Definitely doesn't cover all of the possible virtual adapters, but it's better than nothing I suppose.

(In reply to Valentin Gosu [:valentin] (he/him) from comment #10)

In that case, I suspect the best option here would be to skip adapters that contain "VMware" or "Virtual" in the name.
Definitely doesn't cover all of the possible virtual adapters, but it's better than nothing I suppose.

Is this the same?

If so, should the patch only check for VMnet or should it check for VMware and Virtual?

Flags: needinfo?(valentin.gosu)

VMware should not be checked according to this comment:

// but don't ignore any GUEST side adapters with a description like:
// VMware Accelerated AMD PCNet Adapter #2

Assignee: nobody → kernp25
Status: NEW → ASSIGNED

My adapters:

PS C:\Users\kernp> Get-WmiObject Win32_NetworkAdapter | Select-Object Name,PhysicalAdapter

Name                                       PhysicalAdapter
----                                       ---------------
Microsoft Kernel Debug Network Adapter               False
Realtek Gaming GbE Family Controller                  True
Realtek RTL8822CE 802.11ac PCIe Adapter               True
Microsoft Wi-Fi Direct Virtual Adapter #3            False
WAN Miniport (SSTP)                                  False
WAN Miniport (IKEv2)                                 False
WAN Miniport (L2TP)                                  False
WAN Miniport (PPTP)                                  False
WAN Miniport (PPPOE)                                 False
WAN Miniport (IP)                                    False
WAN Miniport (IPv6)                                  False
WAN Miniport (Network Monitor)                       False
Microsoft Wi-Fi Direct Virtual Adapter #4            False
Realtek USB GbE Family Controller                     True
VMware Virtual Ethernet Adapter for VMnet1            True
VMware Virtual Ethernet Adapter for VMnet8            True

I tested it with the patch applied and it worked perfectly. navigator.onLine was false when there was no internet connection.

(In reply to kernp25 from comment #11)

If so, should the patch only check for VMnet or should it check for VMware and Virtual?

I think only checking for VMnet should be OK if that's all Chrome is doing and it's enough.

Flags: needinfo?(valentin.gosu)
Pushed by valentin.gosu@gmail.com: https://hg.mozilla.org/integration/autoland/rev/761fc968e3e8 Skip some virtual interfaces (VMWare). r=valentin,necko-reviewers
Status: ASSIGNED → RESOLVED
Closed: 10 months ago
Resolution: --- → FIXED
Target Milestone: --- → 136 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: