Diff
Modified: trunk/Source/WebCore/ChangeLog (252853 => 252854)
--- trunk/Source/WebCore/ChangeLog 2019-11-25 11:39:48 UTC (rev 252853)
+++ trunk/Source/WebCore/ChangeLog 2019-11-25 13:03:24 UTC (rev 252854)
@@ -1,3 +1,26 @@
+2019-11-25 Youenn Fablet <[email protected]>
+
+ Enable legacy getUserMedia as a quirk
+ https://bugs.webkit.org/show_bug.cgi?id=204403
+ <rdar://problem/56421276>
+
+ Reviewed by Eric Carlson.
+
+ Add a shim for legacy getUserMedia to cover uses of this legacy API for existing web pages.
+ Add a corresponding settings and quirk.
+ Covered by manual test.
+
+ * Modules/mediastream/NavigatorMediaDevices.idl:
+ * bindings/js/JSDOMBindingInternals.js:
+ * bindings/js/JSNavigatorCustom.cpp:
+ (WebCore::JSNavigator::getUserMedia):
+ * dom/Document.cpp:
+ (WebCore::m_undoManager):
+ * page/Quirks.cpp:
+ (WebCore::Quirks::shouldEnableLegacyGetUserMedia const):
+ * page/Quirks.h:
+ * page/Settings.yaml:
+
2019-11-25 Charlie Turner <[email protected]>
[GStreamer] Flatten MediaPlayerPrivateGStreamer into MediaPlayerPrivateGStreamerBase
Modified: trunk/Source/WebCore/Modules/mediastream/NavigatorMediaDevices.idl (252853 => 252854)
--- trunk/Source/WebCore/Modules/mediastream/NavigatorMediaDevices.idl 2019-11-25 11:39:48 UTC (rev 252853)
+++ trunk/Source/WebCore/Modules/mediastream/NavigatorMediaDevices.idl 2019-11-25 13:03:24 UTC (rev 252854)
@@ -33,4 +33,5 @@
EnabledAtRuntime=MediaDevices,
] partial interface Navigator {
[SameObject, SecureContext, ContextAllowsMediaDevices] readonly attribute MediaDevices mediaDevices;
+ [Custom, EnabledBySetting=LegacyGetUserMedia] void getUserMedia(object constraints, object? successCallback, object? errorCallback);
};
Modified: trunk/Source/WebCore/bindings/js/JSDOMBindingInternals.js (252853 => 252854)
--- trunk/Source/WebCore/bindings/js/JSDOMBindingInternals.js 2019-11-25 11:39:48 UTC (rev 252853)
+++ trunk/Source/WebCore/bindings/js/JSDOMBindingInternals.js 2019-11-25 13:03:24 UTC (rev 252854)
@@ -32,3 +32,8 @@
callback(value, key, this);
});
}
+
+function getUserMediaShim(constraints, successCallback, errorCallback)
+{
+ this.mediaDevices.getUserMedia(constraints).then(successCallback, errorCallback);
+}
Modified: trunk/Source/WebCore/bindings/js/JSNavigatorCustom.cpp (252853 => 252854)
--- trunk/Source/WebCore/bindings/js/JSNavigatorCustom.cpp 2019-11-25 11:39:48 UTC (rev 252853)
+++ trunk/Source/WebCore/bindings/js/JSNavigatorCustom.cpp 2019-11-25 13:03:24 UTC (rev 252854)
@@ -26,6 +26,9 @@
#include "config.h"
#include "JSNavigator.h"
+#include "WebCoreJSClientData.h"
+#include <_javascript_Core/CatchScope.h>
+
namespace WebCore {
void JSNavigator::visitAdditionalChildren(JSC::SlotVisitor& visitor)
@@ -33,4 +36,22 @@
visitor.addOpaqueRoot(static_cast<NavigatorBase*>(&wrapped()));
}
+#if ENABLE(MEDIA_STREAM)
+JSValue JSNavigator::getUserMedia(JSGlobalObject& lexicalGlobalObject, CallFrame& callFrame)
+{
+ auto* function = globalObject()->builtinInternalFunctions().jsDOMBindingInternals().m_getUserMediaShimFunction.get();
+ ASSERT(function);
+
+ JSC::CallData callData;
+ JSC::CallType callType = JSC::getCallData(lexicalGlobalObject.vm(), function, callData);
+ ASSERT(callType != JSC::CallType::None);
+ JSC::MarkedArgumentBuffer arguments;
+ for (size_t cptr = 0; cptr < callFrame.argumentCount(); ++cptr)
+ arguments.append(callFrame.uncheckedArgument(cptr));
+ ASSERT(!arguments.hasOverflowed());
+ JSC::call(&lexicalGlobalObject, function, callType, callData, this, arguments);
+ return jsUndefined();
}
+#endif
+
+}
Modified: trunk/Source/WebCore/dom/Document.cpp (252853 => 252854)
--- trunk/Source/WebCore/dom/Document.cpp 2019-11-25 11:39:48 UTC (rev 252853)
+++ trunk/Source/WebCore/dom/Document.cpp 2019-11-25 13:03:24 UTC (rev 252854)
@@ -607,6 +607,9 @@
nodeListAndCollectionCount = 0;
InspectorInstrumentation::addEventListenersToNode(*this);
+#if ENABLE(MEDIA_STREAM)
+ m_settings->setLegacyGetUserMediaEnabled(quirks().shouldEnableLegacyGetUserMedia());
+#endif
}
Ref<Document> Document::create(Document& contextDocument)
Modified: trunk/Source/WebCore/page/Quirks.cpp (252853 => 252854)
--- trunk/Source/WebCore/page/Quirks.cpp 2019-11-25 11:39:48 UTC (rev 252853)
+++ trunk/Source/WebCore/page/Quirks.cpp 2019-11-25 13:03:24 UTC (rev 252854)
@@ -629,4 +629,14 @@
return false;
}
+#if ENABLE(MEDIA_STREAM)
+bool Quirks::shouldEnableLegacyGetUserMedia() const
+{
+ if (!needsQuirks())
+ return false;
+
+ return m_document->url().protocolIs("https") && equalLettersIgnoringASCIICase(m_document-> url().host(), "www.baidu.com");
}
+#endif
+
+}
Modified: trunk/Source/WebCore/page/Quirks.h (252853 => 252854)
--- trunk/Source/WebCore/page/Quirks.h 2019-11-25 11:39:48 UTC (rev 252853)
+++ trunk/Source/WebCore/page/Quirks.h 2019-11-25 13:03:24 UTC (rev 252854)
@@ -84,6 +84,10 @@
bool shouldBypassBackForwardCache() const;
+#if ENABLE(MEDIA_STREAM)
+ bool shouldEnableLegacyGetUserMedia() const;
+#endif
+
private:
bool needsQuirks() const;
Modified: trunk/Source/WebCore/page/Settings.yaml (252853 => 252854)
--- trunk/Source/WebCore/page/Settings.yaml 2019-11-25 11:39:48 UTC (rev 252853)
+++ trunk/Source/WebCore/page/Settings.yaml 2019-11-25 13:03:24 UTC (rev 252854)
@@ -889,6 +889,10 @@
enterKeyHintEnabled:
initial: false
+legacyGetUserMediaEnabled:
+ initial: false
+ conditional: MEDIA_STREAM
+
# Deprecated
iceCandidateFilteringEnabled: