WebKit crashes when libwebrtc.dylib is missing
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 13 Apr 2018 22:42:24 +0000 (22:42 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 13 Apr 2018 22:42:24 +0000 (22:42 +0000)
https://bugs.webkit.org/show_bug.cgi?id=184607

Rubber-stamped by Jer Noble.

Don't call LibWebRTC related code when libwebrtc is not available.

* dom/Document.cpp:
(WebCore::Document::prepareForDestruction):
(WebCore::Document::suspend):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@230644 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/dom/Document.cpp

index 7984c76..72dfeed 100644 (file)
@@ -1,3 +1,16 @@
+2018-04-13  Ryosuke Niwa  <rniwa@webkit.org>
+
+        WebKit crashes when libwebrtc.dylib is missing
+        https://bugs.webkit.org/show_bug.cgi?id=184607
+
+        Rubber-stamped by Jer Noble.
+
+        Don't call LibWebRTC related code when libwebrtc is not available.
+
+        * dom/Document.cpp:
+        (WebCore::Document::prepareForDestruction):
+        (WebCore::Document::suspend):
+
 2018-04-13  Chris Dumez  <cdumez@apple.com>
 
         Split WindowProxy handling out of ScriptController and into a new class owned by AbstractFrame
index ef2628c..a366676 100644 (file)
@@ -2358,8 +2358,11 @@ void Document::prepareForDestruction()
         m_frame->animation().detachFromDocument(this);
 
 #if USE(LIBWEBRTC)
-    if (auto* page = this->page())
-        page->libWebRTCProvider().unregisterMDNSNames(identifier().toUInt64());
+    // FIXME: This should be moved to Modules/mediastream.
+    if (LibWebRTCProvider::webRTCAvailable()) {
+        if (auto* page = this->page())
+            page->libWebRTCProvider().unregisterMDNSNames(identifier().toUInt64());
+    }
 #endif
 
 #if ENABLE(SERVICE_WORKER)
@@ -4891,8 +4894,11 @@ void Document::suspend(ActiveDOMObject::ReasonForSuspension reason)
     }
 
 #if USE(LIBWEBRTC)
-    if (auto* page = this->page())
-        page->libWebRTCProvider().unregisterMDNSNames(identifier().toUInt64());
+    // FIXME: This should be moved to Modules/mediastream.
+    if (LibWebRTCProvider::webRTCAvailable()) {
+        if (auto* page = this->page())
+            page->libWebRTCProvider().unregisterMDNSNames(identifier().toUInt64());
+    }
 #endif
 
 #if ENABLE(SERVICE_WORKER)