WebKit Bugzilla
Attachment 360764 Details for
Bug 194106
: Add an API test to cover UIClient checkUserMediaPermissionForOrigin being nullptr
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-194106-20190131132858.patch (text/plain), 4.06 KB, created by
youenn fablet
on 2019-01-31 13:29:00 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
youenn fablet
Created:
2019-01-31 13:29:00 PST
Size:
4.06 KB
patch
obsolete
>Subversion Revision: 240795 >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 16c9d467874be85a7ee0c7c3ad6cbc4ba36166d3..8325b1752d71c1412dc93388757c8d5c6d555328 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,16 @@ >+2019-01-31 Youenn Fablet <youenn@apple.com> >+ >+ Add an API test to cover UIClient checkUserMediaPermissionForOrigin being nullptr >+ https://bugs.webkit.org/show_bug.cgi?id=194106 >+ <rdar://problem/47676333> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * TestWebKitAPI/Tests/WebKit/UserMedia.cpp: >+ (TestWebKitAPI::didFinishNavigation): >+ (TestWebKitAPI::TEST): >+ * TestWebKitAPI/Tests/WebKit/getUserMedia.html: >+ > 2019-01-31 Zalan Bujtas <zalan@apple.com> > > [LFC] Margin before/after/start/end initial value is 0 and not auto. >diff --git a/Tools/TestWebKitAPI/Tests/WebKit/UserMedia.cpp b/Tools/TestWebKitAPI/Tests/WebKit/UserMedia.cpp >index 2b06b0b8ad613ac4989b747a9a5fa4586e899001..a0c21d71c85b702815bc559711e387677288a264 100644 >--- a/Tools/TestWebKitAPI/Tests/WebKit/UserMedia.cpp >+++ b/Tools/TestWebKitAPI/Tests/WebKit/UserMedia.cpp >@@ -157,6 +157,44 @@ TEST(WebKit, OnDeviceChangeCrash) > EXPECT_TRUE(!didCrash); > } > >+static bool didReceiveMessage; >+static void didFinishNavigation(WKPageRef, WKNavigationRef, WKTypeRef, const void*) >+{ >+ didReceiveMessage = true; >+} >+ >+TEST(WebKit, EnumerateDevicesCrash) >+{ >+ auto context = adoptWK(WKContextCreateWithConfiguration(nullptr)); >+ >+ WKRetainPtr<WKPageGroupRef> pageGroup(AdoptWK, WKPageGroupCreateWithIdentifier(Util::toWK("GetUserMedia").get())); >+ WKPreferencesRef preferences = WKPageGroupGetPreferences(pageGroup.get()); >+ WKPreferencesSetMediaDevicesEnabled(preferences, true); >+ WKPreferencesSetFileAccessFromFileURLsAllowed(preferences, true); >+ WKPreferencesSetMediaCaptureRequiresSecureConnection(preferences, false); >+ WKPreferencesSetMockCaptureDevicesEnabled(preferences, true); >+ >+ WKPageUIClientV6 uiClient; >+ // We want uiClient.checkUserMediaPermissionForOrigin to be null. >+ memset(&uiClient, 0, sizeof(uiClient)); >+ uiClient.base.version = 6; >+ >+ WKPageNavigationClientV3 loaderClient; >+ memset(&loaderClient, 0, sizeof(loaderClient)); >+ loaderClient.base.version = 3; >+ loaderClient.didFinishNavigation = didFinishNavigation; >+ >+ PlatformWebView webView(context.get(), pageGroup.get()); >+ WKPageSetPageUIClient(webView.page(), &uiClient.base); >+ WKPageSetPageNavigationClient(webView.page(), &loaderClient.base); >+ >+ // Load a page doing enumerateDevices. >+ didReceiveMessage = false; >+ auto url = adoptWK(Util::createURLForResource("getUserMedia", "html")); >+ WKPageLoadURL(webView.page(), url.get()); >+ Util::run(&didReceiveMessage); >+} >+ > } // namespace TestWebKitAPI > > #endif // ENABLE(MEDIA_STREAM) >diff --git a/Tools/TestWebKitAPI/Tests/WebKit/getUserMedia.html b/Tools/TestWebKitAPI/Tests/WebKit/getUserMedia.html >index 73f71b9123b8718d02301c256d32ba66563a8527..d72ce809b1954a13e9066c717d371f156b5c7b1a 100644 >--- a/Tools/TestWebKitAPI/Tests/WebKit/getUserMedia.html >+++ b/Tools/TestWebKitAPI/Tests/WebKit/getUserMedia.html >@@ -5,15 +5,16 @@ > > let stream = null; > >- function promptForCapture() >+ async function promptForCapture() > { >- navigator.mediaDevices.getUserMedia({ audio: false, video: true }) >- .then((s) => { >- stream = s; >- video.srcObject = stream; >- console.log("Got user media"); >- }) >- .catch((error) => console.log(`Failed with error: ${error}`)); >+ try { >+ await navigator.mediaDevices.enumerateDevices(); >+ const stream = await navigator.mediaDevices.getUserMedia({ audio: false, video: true }) >+ video.srcObject = stream; >+ console.log("Got user media"); >+ } catch(error) { >+ console.log(`Failed with error: ${error}`); >+ } > } > > function stop(kind)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 194106
: 360764