+2017-12-21 Chris Dumez <cdumez@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 <zalan@apple.com>
[RenderTreeBuilder] Move repeating code to RenderTreeBuilder::insertInternal
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;