Title: [226238] trunk/Source/WebCore
- Revision
- 226238
- Author
- cdu...@apple.com
- Date
- 2017-12-21 13:00:50 -0800 (Thu, 21 Dec 2017)
Log Message
ononline, onoffline and navigator.onLine don't work if Parallels or VMWare is installed
https://bugs.webkit.org/show_bug.cgi?id=32327
Reviewed by Alexey Proskuryakov.
When determining if we are online, ignore virtual interfaces added on the host machine
by Parallels and VMWare. This is needed because those interfaces are always up, whether
or not the virtual machine is running. This was causing navigator.onLine to always return
true on the host machine when Parallels or VMWare was installed.
Note that it is safe to ignore these interfaces and that it does not cause issues when
running Safari inside the virtual machine because those virtual interfaces are only
exposed on the host machine. Inside, the virtual machine, we see the usual en0 interface.
* platform/network/mac/NetworkStateNotifierMac.cpp:
(WebCore::NetworkStateNotifier::updateStateWithoutNotifying):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (226237 => 226238)
--- trunk/Source/WebCore/ChangeLog 2017-12-21 20:59:12 UTC (rev 226237)
+++ trunk/Source/WebCore/ChangeLog 2017-12-21 21:00:50 UTC (rev 226238)
@@ -1,3 +1,22 @@
+2017-12-21 Chris Dumez <cdu...@apple.com>
+
+ ononline, onoffline and navigator.onLine don't work if Parallels or VMWare is installed
+ https://bugs.webkit.org/show_bug.cgi?id=32327
+
+ Reviewed by Alexey Proskuryakov.
+
+ When determining if we are online, ignore virtual interfaces added on the host machine
+ by Parallels and VMWare. This is needed because those interfaces are always up, whether
+ or not the virtual machine is running. This was causing navigator.onLine to always return
+ true on the host machine when Parallels or VMWare was installed.
+
+ Note that it is safe to ignore these interfaces and that it does not cause issues when
+ running Safari inside the virtual machine because those virtual interfaces are only
+ exposed on the host machine. Inside, the virtual machine, we see the usual en0 interface.
+
+ * platform/network/mac/NetworkStateNotifierMac.cpp:
+ (WebCore::NetworkStateNotifier::updateStateWithoutNotifying):
+
2017-12-21 Zalan Bujtas <za...@apple.com>
[RenderTreeBuilder] Move repeating code to RenderTreeBuilder::insertInternal
Modified: trunk/Source/WebCore/platform/network/mac/NetworkStateNotifierMac.cpp (226237 => 226238)
--- trunk/Source/WebCore/platform/network/mac/NetworkStateNotifierMac.cpp 2017-12-21 20:59:12 UTC (rev 226237)
+++ trunk/Source/WebCore/platform/network/mac/NetworkStateNotifierMac.cpp 2017-12-21 21:00:50 UTC (rev 226238)
@@ -42,15 +42,23 @@
return;
for (CFIndex i = 0; i < CFArrayGetCount((CFArrayRef)netInterfaces); i++) {
- auto interface = CFArrayGetValueAtIndex((CFArrayRef)netInterfaces, i);
- if (CFGetTypeID(interface) != CFStringGetTypeID())
+ auto interfaceName = (CFStringRef)CFArrayGetValueAtIndex((CFArrayRef)netInterfaces, i);
+ if (CFGetTypeID(interfaceName) != CFStringGetTypeID())
continue;
// Ignore the loopback interface.
- if (CFStringFind((CFStringRef)interface, CFSTR("lo"), kCFCompareAnchored).location != kCFNotFound)
+ if (CFStringHasPrefix(interfaceName, CFSTR("lo")))
continue;
- auto key = adoptCF(SCDynamicStoreKeyCreateNetworkInterfaceEntity(0, kSCDynamicStoreDomainState, (CFStringRef)interface, kSCEntNetIPv4));
+ // Ignore Parallels virtual interfaces on host machine as these are always up.
+ if (CFStringHasPrefix(interfaceName, CFSTR("vnic")))
+ continue;
+
+ // Ignore VMWare virtual interfaces on host machine as these are always up.
+ if (CFStringHasPrefix(interfaceName, CFSTR("vmnet")))
+ continue;
+
+ auto key = adoptCF(SCDynamicStoreKeyCreateNetworkInterfaceEntity(0, kSCDynamicStoreDomainState, interfaceName, kSCEntNetIPv4));
auto keyList = adoptCF(SCDynamicStoreCopyKeyList(m_store.get(), key.get()));
if (keyList && CFArrayGetCount(keyList.get())) {
m_isOnLine = true;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes