Changeset 237031 in webkit
- Timestamp:
- Oct 11, 2018 3:26:52 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 6 added
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r237028 r237031 1 2018-10-11 Alejandro G. Castro <alex@igalia.com> 2 3 [GTK][WPE] Add mediaDevices.enumerateDevices support 4 https://bugs.webkit.org/show_bug.cgi?id=185761 5 6 Reviewed by Youenn Fablet. 7 8 Remove the failure expectation for the test 9 media-devices-enumerate-devices.html. Just for the record we have 10 also checked the following tests. 11 12 fast/mediastream/media-devices-enumerate-devices.html 13 fast/mediastream/resources/enumerate-devices-frame.html 14 http/tests/media/media-stream/enumerate-devices-source-id.html 15 http/tests/media/media-stream/enumerate-devices-source-id-persistent.html 16 http/tests/media/media-stream/resources/enumerate-devices-source-id-frame.html 17 18 * platform/gtk/TestExpectations: 19 1 20 2018-10-10 Devin Rousso <drousso@apple.com> 2 21 -
trunk/LayoutTests/platform/gtk/TestExpectations
r236961 r237031 641 641 # Crash is bug #176801 642 642 webkit.org/b/160996 fast/mediastream/MediaStream-video-element-video-tracks-disabled.html [ ImageOnlyFailure Crash ] 643 webkit.org/b/172269 fast/mediastream/media-devices-enumerate-devices.html [ Failure ]644 643 webkit.org/b/173257 fast/mediastream/getUserMedia-grant-persistency3.html [ Pass Failure ] 645 644 -
trunk/Source/WebCore/ChangeLog
r237029 r237031 1 2018-10-11 Alejandro G. Castro <alex@igalia.com> 2 3 [GTK][WPE] Add mediaDevices.enumerateDevices support 4 https://bugs.webkit.org/show_bug.cgi?id=185761 5 6 Reviewed by Youenn Fablet. 7 8 We are adopting the same policy COCOA is using when returning the 9 list of media devices if the user does not have persistent 10 access. Namely, we just return the first media device for audio 11 and video capture. 12 13 * Modules/mediastream/MediaDevicesRequest.cpp: 14 (WebCore::MediaDevicesRequest::filterDeviceList): Add support for 15 other platforms when filtering devices if there is no persistent 16 access to the origin. 17 1 18 2018-10-10 Chris Dumez <cdumez@apple.com> 2 19 -
trunk/Source/WebCore/Modules/mediastream/MediaDevicesRequest.cpp
r236877 r237031 82 82 void MediaDevicesRequest::filterDeviceList(Vector<Ref<MediaDeviceInfo>>& devices) 83 83 { 84 #if !PLATFORM(COCOA)85 UNUSED_PARAM(devices);86 #else87 88 84 #if PLATFORM(IOS) 89 85 static const int defaultCameraCount = 2; 90 #endif 91 #if PLATFORM(MAC) 86 #else 92 87 static const int defaultCameraCount = 1; 93 88 #endif 89 94 90 static const int defaultMicrophoneCount = 1; 95 91 … … 104 100 return false; 105 101 }); 106 107 #endif108 102 } 109 103 -
trunk/Source/WebKit/ChangeLog
r237026 r237031 1 2018-10-11 Alejandro G. Castro <alex@igalia.com> 2 3 [GTK][WPE] Add mediaDevices.enumerateDevices support 4 https://bugs.webkit.org/show_bug.cgi?id=185761 5 6 Reviewed by Youenn Fablet. 7 8 Implemented the enumerateDevices API using a new WebKit class 9 (DeviceIdHashSaltStorage) that generates and stores the device ids 10 hash salts per origin, used to avoid fingerprinting in the 11 webpages. 12 13 The patch also adds a new type of data for the WebsiteDataStore. 14 That way the users can call the WebsiteDataStore to show what 15 origins have hash salt generated and remove them at some point. 16 17 For the moment just GTK+ and WPE ports are using this class to 18 generate the hash salts. The patch adds code to the 19 checkUserMediaPermissionForOrigin API implementation, it was empty 20 until now for these ports. In this function we create an instance 21 of a new class WebKitDeviceInfoPermissionRequest that implements 22 the WebKitPermissionRequestIface interface, that allows the ports 23 to use the current permission managers implemented in the 24 embedders to handle this new kind of request the way they like 25 it. The default implementation is deny. 26 27 The class WebKitDeviceInfoPermissionRequest takes care of 28 contacting the DeviceIdHashSaltStorage and request/regenerate the 29 hash salts accordingly. 30 31 Persistency is still not implemented, we will add it in a 32 future patch. 33 34 * Shared/WebsiteData/WebsiteDataType.h: Added the new type of 35 webside data: DeviceIdHashSalt. 36 * Sources.txt: Added new files to compilation. 37 * SourcesGTK.txt: Ditto. 38 * SourcesWPE.txt: Ditto. 39 * UIProcess/API/glib/WebKitDeviceInfoPermissionRequest.cpp: Added 40 this class to represent a request of permission to access the 41 devices information. This is specific for glib ports and implements 42 the policies regarding the hash salts when the embedder allows or 43 denies the access using the DeviceIdHashSaltStorage class. 44 (webkitDeviceInfoPermissionRequestAllow): Get the device hash salt 45 when the origin is allowed and set it in the original request. 46 (webkitDeviceInfoPermissionRequestDeny): Regenerate the device id 47 hash salt when the user does not allow to access the device information. 48 (webkit_permission_request_interface_init): 49 (webkitDeviceInfoPermissionRequestDispose): 50 (webkit_device_info_permission_request_class_init): 51 (webkitDeviceInfoPermissionRequestCreate): Create the class using 52 the proxy request from the webprocess and a reference to the 53 DeviceIdHashSaltStorage. 54 * UIProcess/API/glib/WebKitDeviceInfoPermissionRequestPrivate.h: 55 Ditto. 56 * UIProcess/API/glib/WebKitUIClient.cpp: Added the implementation 57 for the checkUserMediaPermissionForOrigin API for the glib ports, 58 it creates the device info request and calls the permission 59 request API. 60 * UIProcess/API/glib/WebKitWebsiteData.cpp: 61 (recordContainsSupportedDataTypes): Added the DeviceIdHashSalt 62 type. 63 (toWebKitWebsiteDataTypes): Added the conversion from the WebKit 64 types to the glib types for the WebsiteDataType::DeviceIdHashSalt. 65 * UIProcess/API/glib/WebKitWebsiteDataManager.cpp: 66 (toWebsiteDataTypes): Added the conversion from the glib type 67 WEBKIT_WEBSITE_DATA_DEVICE_ID_HASH_SALT to the WebKit type. 68 (webkit_website_data_manager_remove): Make sure we remote the 69 DeviceIdHashSalt if the Cookies are selected. 70 * UIProcess/API/gtk/WebKitDeviceInfoPermissionRequest.h: Added 71 this new class that represents a permission request for the device 72 information in the GTK+ port. 73 * UIProcess/API/gtk/WebKitWebsiteData.h: Added the new type of 74 website that in the GTK+ port: 75 WEBKIT_WEBSITE_DATA_DEVICE_ID_HASH_SALT. 76 * UIProcess/API/wpe/WebKitDeviceInfoPermissionRequest.h: Added 77 this new class that represents a permission request for the device 78 information in the WPE port. 79 * UIProcess/API/wpe/WebKitWebsiteData.h: Added the new type of 80 website that in the WPE port: 81 WEBKIT_WEBSITE_DATA_DEVICE_ID_HASH_SALT. 82 * UIProcess/DeviceIdHashSaltStorage.cpp: Added this new class that 83 handles how to generate and store the hash salts inside 84 WebKit. Persistency is still not implemented, we will add it in a 85 future patch. 86 (WebKit::DeviceIdHashSaltStorage::create): 87 (WebKit::DeviceIdHashSaltStorage::deviceIdentifierHashSaltForOrigin): 88 Check the map to get the hash salt for an origin, if there is none 89 create a new random one. 90 (WebKit::DeviceIdHashSaltStorage::regenerateDeviceIdentifierHashSaltForOrigin): 91 Delete the hash salt of an origin if it already exists and create a new one. 92 (WebKit::DeviceIdHashSaltStorage::getDeviceIdHashSaltOrigins): 93 Returns the list of origins that have a hash salt generated for 94 them. It is used in the WebsiteDataStore. 95 (WebKit::DeviceIdHashSaltStorage::deleteDeviceIdHashSaltForOrigins): 96 Deletes the hash salts in the map for an origin. 97 (WebKit::DeviceIdHashSaltStorage::deleteDeviceIdHashSaltOriginsModifiedSince): 98 Delete the origins that have not been modified since a time. 99 * UIProcess/DeviceIdHashSaltStorage.h: Ditto. 100 * UIProcess/UserMediaPermissionCheckProxy.h: Remove uneeded class 101 definition. 102 * UIProcess/WebsiteData/WebsiteDataStore.cpp: Added support to 103 return and remove the origins with a generate hash salt used to 104 generate the device ids. 105 (WebKit::WebsiteDataStore::WebsiteDataStore): Added the new 106 reference to the DeviceIdHashSaltStorage class, used to handle the 107 hash salts. 108 (WebKit::WebsiteDataStore::fetchDataAndApply): Get the list of 109 origins with a hash salts in the DeviceIdHashSaltStorage. 110 (WebKit::WebsiteDataStore::removeData): Remove the hash salts in 111 DeviceIdHashSaltStorage for an origin. 112 * UIProcess/WebsiteData/WebsiteDataStore.h: Ditto. 113 (WebKit::WebsiteDataStore::deviceIdHashSaltStorage): 114 * WebKit.xcodeproj/project.pbxproj: Added the 115 DeviceIdHashSaltStorage to the compilation. 116 1 117 2018-10-10 Tim Horton <timothy_horton@apple.com> 2 118 -
trunk/Source/WebKit/Shared/WebsiteData/WebsiteDataType.h
r223263 r237031 50 50 #endif 51 51 DOMCache = 1 << 15, 52 DeviceIdHashSalt = 1 << 16, 52 53 }; 53 54 -
trunk/Source/WebKit/Sources.txt
r236930 r237031 229 229 UIProcess/GeolocationPermissionRequestProxy.cpp 230 230 UIProcess/PageLoadState.cpp 231 UIProcess/DeviceIdHashSaltStorage.cpp 231 232 UIProcess/ProcessAssertion.cpp 232 233 UIProcess/ProcessThrottler.cpp -
trunk/Source/WebKit/SourcesGTK.txt
r236690 r237031 134 134 UIProcess/API/glib/WebKitCredential.cpp @no-unify 135 135 UIProcess/API/glib/WebKitCustomProtocolManagerClient.cpp @no-unify 136 UIProcess/API/glib/WebKitDeviceInfoPermissionRequest.cpp @no-unify 136 137 UIProcess/API/glib/WebKitDownload.cpp @no-unify 137 138 UIProcess/API/glib/WebKitDownloadClient.cpp @no-unify -
trunk/Source/WebKit/SourcesWPE.txt
r236690 r237031 121 121 UIProcess/API/glib/WebKitCredential.cpp @no-unify 122 122 UIProcess/API/glib/WebKitCustomProtocolManagerClient.cpp @no-unify 123 UIProcess/API/glib/WebKitDeviceInfoPermissionRequest.cpp @no-unify 123 124 UIProcess/API/glib/WebKitDownload.cpp @no-unify 124 125 UIProcess/API/glib/WebKitDownloadClient.cpp @no-unify -
trunk/Source/WebKit/UIProcess/API/glib/WebKitUIClient.cpp
r235969 r237031 23 23 #include "APIUIClient.h" 24 24 #include "DrawingAreaProxy.h" 25 #include "WebKitDeviceInfoPermissionRequestPrivate.h" 25 26 #include "WebKitFileChooserRequestPrivate.h" 26 27 #include "WebKitGeolocationPermissionRequestPrivate.h" … … 33 34 #include "WebPageProxy.h" 34 35 #include "WebProcessProxy.h" 36 #include "WebsiteDataStore.h" 35 37 #include <wtf/glib/GRefPtr.h> 36 38 … … 190 192 } 191 193 194 bool checkUserMediaPermissionForOrigin(WebPageProxy& page, WebFrameProxy&, API::SecurityOrigin& userMediaDocumentOrigin, API::SecurityOrigin& topLevelDocumentOrigin, UserMediaPermissionCheckProxy& permissionRequest) override 195 { 196 auto deviceInfoPermissionRequest = adoptGRef(webkitDeviceInfoPermissionRequestCreate(permissionRequest, page.websiteDataStore().deviceIdHashSaltStorage())); 197 webkitWebViewMakePermissionRequest(m_webView, WEBKIT_PERMISSION_REQUEST(deviceInfoPermissionRequest.get())); 198 return true; 199 } 200 192 201 void decidePolicyForNotificationPermissionRequest(WebPageProxy&, API::SecurityOrigin&, Function<void(bool)>&& completionHandler) final 193 202 { -
trunk/Source/WebKit/UIProcess/API/glib/WebKitWebsiteData.cpp
r234813 r237031 77 77 WebsiteDataType::PlugInData, 78 78 #endif 79 WebsiteDataType::Cookies 79 WebsiteDataType::Cookies, 80 WebsiteDataType::DeviceIdHashSalt 80 81 }); 81 82 } … … 104 105 if (types.contains(WebsiteDataType::Cookies)) 105 106 returnValue |= WEBKIT_WEBSITE_DATA_COOKIES; 107 if (types.contains(WebsiteDataType::DeviceIdHashSalt)) 108 returnValue |= WEBKIT_WEBSITE_DATA_DEVICE_ID_HASH_SALT; 106 109 return static_cast<WebKitWebsiteDataTypes>(returnValue); 107 110 } -
trunk/Source/WebKit/UIProcess/API/glib/WebKitWebsiteDataManager.cpp
r235560 r237031 650 650 if (types & WEBKIT_WEBSITE_DATA_COOKIES) 651 651 returnValue.add(WebsiteDataType::Cookies); 652 if (types & WEBKIT_WEBSITE_DATA_DEVICE_ID_HASH_SALT) 653 returnValue.add(WebsiteDataType::DeviceIdHashSalt); 652 654 return returnValue; 653 655 } … … 733 735 WebKitWebsiteData* data = static_cast<WebKitWebsiteData*>(item->data); 734 736 735 if (webkit_website_data_get_types(data) & types) 737 // We have to remove the hash salts when cookies are removed. 738 auto dataTypes = webkit_website_data_get_types(data); 739 if (dataTypes & WEBKIT_WEBSITE_DATA_DEVICE_ID_HASH_SALT) 740 dataTypes = static_cast<WebKitWebsiteDataTypes>(dataTypes | WEBKIT_WEBSITE_DATA_COOKIES); 741 742 if (dataTypes & types) 736 743 records.append(webkitWebsiteDataGetRecord(data)); 737 744 } -
trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebsiteData.h
r232010 r237031 45 45 * @WEBKIT_WEBSITE_DATA_PLUGIN_DATA: Plugins data. 46 46 * @WEBKIT_WEBSITE_DATA_COOKIES: Cookies. 47 * @WEBKIT_WEBSITE_DATA_DEVICE_ID_HASH_SALT: Hash salt used to generate the device ids used by webpages. 47 48 * @WEBKIT_WEBSITE_DATA_ALL: All types. 48 49 * … … 61 62 WEBKIT_WEBSITE_DATA_PLUGIN_DATA = 1 << 7, 62 63 WEBKIT_WEBSITE_DATA_COOKIES = 1 << 8, 63 WEBKIT_WEBSITE_DATA_ALL = (1 << 9) - 1 64 WEBKIT_WEBSITE_DATA_DEVICE_ID_HASH_SALT = 1 << 9, 65 WEBKIT_WEBSITE_DATA_ALL = (1 << 10) - 1 64 66 } WebKitWebsiteDataTypes; 65 67 -
trunk/Source/WebKit/UIProcess/API/wpe/WebKitWebsiteData.h
r232010 r237031 45 45 * @WEBKIT_WEBSITE_DATA_PLUGIN_DATA: Plugins data. 46 46 * @WEBKIT_WEBSITE_DATA_COOKIES: Cookies. 47 * @WEBKIT_WEBSITE_DATA_DEVICE_ID_HASH_SALT: Hash salt used to generate the device ids used by webpages. 47 48 * @WEBKIT_WEBSITE_DATA_ALL: All types. 48 49 * … … 61 62 WEBKIT_WEBSITE_DATA_PLUGIN_DATA = 1 << 7, 62 63 WEBKIT_WEBSITE_DATA_COOKIES = 1 << 8, 63 WEBKIT_WEBSITE_DATA_ALL = (1 << 9) - 1 64 WEBKIT_WEBSITE_DATA_DEVICE_ID_HASH_SALT = 1 << 9, 65 WEBKIT_WEBSITE_DATA_ALL = (1 << 10) - 1 64 66 } WebKitWebsiteDataTypes; 65 67 -
trunk/Source/WebKit/UIProcess/UserMediaPermissionCheckProxy.h
r216952 r237031 37 37 namespace WebKit { 38 38 39 class UserMediaPermissionRequestManagerProxy;40 41 39 class UserMediaPermissionCheckProxy : public API::ObjectImpl<API::Object::Type::UserMediaPermissionCheck> { 42 40 public: -
trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp
r236690 r237031 31 31 #include "APIWebsiteDataStore.h" 32 32 #include "AuthenticatorManager.h" 33 #include "DeviceIdHashSaltStorage.h" 33 34 #include "MockAuthenticatorManager.h" 34 35 #include "NetworkProcessMessages.h" … … 96 97 , m_configuration(WTFMove(configuration)) 97 98 , m_storageManager(StorageManager::create(m_configuration.localStorageDirectory)) 99 , m_deviceIdHashSaltStorage(DeviceIdHashSaltStorage::create()) 98 100 , m_queue(WorkQueue::create("com.apple.WebKit.WebsiteDataStore")) 99 101 #if ENABLE(WEB_AUTHN) … … 486 488 } 487 489 490 if (m_deviceIdHashSaltStorage && dataTypes.contains(WebsiteDataType::DeviceIdHashSalt)) { 491 callbackAggregator->addPendingCallback(); 492 493 m_deviceIdHashSaltStorage->getDeviceIdHashSaltOrigins([callbackAggregator](auto&& origins) { 494 WebsiteData websiteData; 495 496 while (!origins.isEmpty()) 497 websiteData.entries.append(WebsiteData::Entry { origins.takeAny(), WebsiteDataType::DeviceIdHashSalt, 0 }); 498 499 callbackAggregator->removePendingCallback(WTFMove(websiteData)); 500 }); 501 } 502 488 503 if (dataTypes.contains(WebsiteDataType::OfflineWebApplicationCache) && isPersistent()) { 489 504 callbackAggregator->addPendingCallback(); … … 801 816 } 802 817 818 if (m_deviceIdHashSaltStorage && (dataTypes.contains(WebsiteDataType::DeviceIdHashSalt) || (dataTypes.contains(WebsiteDataType::Cookies)))) { 819 callbackAggregator->addPendingCallback(); 820 821 m_deviceIdHashSaltStorage->deleteDeviceIdHashSaltOriginsModifiedSince(modifiedSince, [callbackAggregator] { 822 callbackAggregator->removePendingCallback(); 823 }); 824 } 825 803 826 if (dataTypes.contains(WebsiteDataType::OfflineWebApplicationCache) && isPersistent()) { 804 827 callbackAggregator->addPendingCallback(); … … 1075 1098 } 1076 1099 1100 if (m_deviceIdHashSaltStorage && (dataTypes.contains(WebsiteDataType::DeviceIdHashSalt) || (dataTypes.contains(WebsiteDataType::Cookies)))) { 1101 callbackAggregator->addPendingCallback(); 1102 1103 m_deviceIdHashSaltStorage->deleteDeviceIdHashSaltForOrigins(origins, [callbackAggregator] { 1104 callbackAggregator->removePendingCallback(); 1105 }); 1106 } 1107 1077 1108 if (dataTypes.contains(WebsiteDataType::OfflineWebApplicationCache) && isPersistent()) { 1078 1109 HashSet<WebCore::SecurityOriginData> origins; -
trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h
r236690 r237031 56 56 class SecKeyProxyStore; 57 57 class StorageManager; 58 class DeviceIdHashSaltStorage; 58 59 class WebPageProxy; 59 60 class WebProcessPool; … … 93 94 String localStorageDirectory; 94 95 String mediaKeysStorageDirectory; 96 String deviceIdHashSaltsStorageDirectory; 95 97 String resourceLoadStatisticsDirectory; 96 98 String javaScriptConfigurationDirectory; … … 162 164 StorageManager* storageManager() { return m_storageManager.get(); } 163 165 166 DeviceIdHashSaltStorage* deviceIdHashSaltStorage() { return m_deviceIdHashSaltStorage.get(); } 167 164 168 WebProcessPool* processPoolForCookieStorageOperations(); 165 169 bool isAssociatedProcessPool(WebProcessPool&) const; … … 236 240 237 241 const RefPtr<StorageManager> m_storageManager; 242 const RefPtr<DeviceIdHashSaltStorage> m_deviceIdHashSaltStorage; 238 243 RefPtr<WebResourceLoadStatisticsStore> m_resourceLoadStatistics; 239 244 bool m_resourceLoadStatisticsDebugMode { false }; -
trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj
r236930 r237031 77 77 00B9661A18E25AE100CE1F88 /* FindClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 00B9661818E25AE100CE1F88 /* FindClient.h */; }; 78 78 07297F9F1C17BBEA003F0735 /* UserMediaPermissionCheckProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 07297F9D1C17BBEA003F0735 /* UserMediaPermissionCheckProxy.h */; }; 79 07297F9F1C17BBEA015F0735 /* DeviceIdHashSaltStorage.h in Headers */ = {isa = PBXBuildFile; fileRef = 07297F9D1C17BBEA223F0735 /* DeviceIdHashSaltStorage.h */; }; 79 80 07297FA31C186ADB003F0735 /* WKUserMediaPermissionCheck.h in Headers */ = {isa = PBXBuildFile; fileRef = 07297FA11C186ADB003F0735 /* WKUserMediaPermissionCheck.h */; settings = {ATTRIBUTES = (Private, ); }; }; 80 81 074E75FE1DF2211900D318EC /* UserMediaProcessManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 074E75FB1DF1FD1300D318EC /* UserMediaProcessManager.h */; }; … … 1835 1836 07297F9C1C17BBEA003F0735 /* UserMediaPermissionCheckProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UserMediaPermissionCheckProxy.cpp; sourceTree = "<group>"; }; 1836 1837 07297F9D1C17BBEA003F0735 /* UserMediaPermissionCheckProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserMediaPermissionCheckProxy.h; sourceTree = "<group>"; }; 1838 07297F9C1C1711EA003F0735 /* DeviceIdHashSaltStorage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DeviceIdHashSaltStorage.cpp; sourceTree = "<group>"; }; 1839 07297F9D1C17BBEA223F0735 /* DeviceIdHashSaltStorage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeviceIdHashSaltStorage.h; sourceTree = "<group>"; }; 1837 1840 07297FA01C186ADB003F0735 /* WKUserMediaPermissionCheck.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKUserMediaPermissionCheck.cpp; sourceTree = "<group>"; }; 1838 1841 07297FA11C186ADB003F0735 /* WKUserMediaPermissionCheck.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKUserMediaPermissionCheck.h; sourceTree = "<group>"; }; … … 7186 7189 E1513C64166EABB200149FCB /* ChildProcessProxy.cpp */, 7187 7190 E1513C65166EABB200149FCB /* ChildProcessProxy.h */, 7191 07297F9C1C1711EA003F0735 /* DeviceIdHashSaltStorage.cpp */, 7192 07297F9D1C17BBEA223F0735 /* DeviceIdHashSaltStorage.h */, 7188 7193 BC2652121182608100243E12 /* DrawingAreaProxy.cpp */, 7189 7194 BC2652131182608100243E12 /* DrawingAreaProxy.h */, … … 8858 8863 BC032DA610F437D10058C15A /* Decoder.h in Headers */, 8859 8864 57DCEDAB214C60090016B847 /* DeviceIdentitySPI.h in Headers */, 8865 07297F9F1C17BBEA015F0735 /* DeviceIdHashSaltStorage.h in Headers */, 8860 8866 83891B6C1A68C30B0030F386 /* DiagnosticLoggingClient.h in Headers */, 8861 8867 C18173612058424700DFDA65 /* DisplayLink.h in Headers */, … … 10595 10601 2D92A77E212B6A7100F493FD /* DataReference.cpp in Sources */, 10596 10602 2D92A77F212B6A7100F493FD /* Decoder.cpp in Sources */, 10603 07297F9E1C17BBEA014F0735 /* DeviceIdHashSaltStorage.cpp in Sources */, 10597 10604 1AB7D6191288B9D900CFD08C /* DownloadProxyMessageReceiver.cpp in Sources */, 10598 10605 1A64229912DD029200CAAE2C /* DrawingAreaMessageReceiver.cpp in Sources */, -
trunk/Tools/ChangeLog
r237023 r237031 1 2018-10-11 Alejandro G. Castro <alex@igalia.com> 2 3 [GTK][WPE] Add mediaDevices.enumerateDevices support 4 https://bugs.webkit.org/show_bug.cgi?id=185761 5 6 Reviewed by Youenn Fablet. 7 8 Added new API test for the mediaDevices.enumerateDevices: 9 usermedia-enumeratedevices-permission-check. And a new API test 10 for the WebsiteDataStore: testWebsiteDataDeviceIdHashSalt. 11 12 * MiniBrowser/gtk/main.c: 13 (gotWebsiteDataCallback): Added a new section to the about:data 14 webpage to include the information about the hash salt. 15 * TestWebKitAPI/Tests/WebKitGLib/TestUIClient.cpp: 16 (testWebViewUserMediaEnumerateDevicesPermissionCheck): Added the 17 new test checking the enumerateDevices API when permission is 18 denied and when permission is allowed for the origin. 19 (beforeAll): Defined the new test. 20 * TestWebKitAPI/Tests/WebKitGLib/TestWebsiteData.cpp: 21 (serverCallback): Register a new URI for the enumerateDevices. 22 (testWebsiteDataConfiguration): Remove the hash salts from the 23 directories. 24 (testWebsiteDataDeviceIdHashSalt): New test cheking the 25 enumerateDevices API. 26 (beforeAll): Added the new test testWebsiteDataDeviceIdHashSalt to 27 the init structure. 28 * TestWebKitAPI/glib/WebKitGLib/WebViewTest.cpp: 29 (WebViewTest::initializeWebView): Make sure the media-stream is 30 activated in the webView. 31 1 32 2018-10-10 Fujii Hironori <Hironori.Fujii@sony.com> 2 33 -
trunk/Tools/MiniBrowser/gtk/main.c
r232834 r237031 403 403 guint64 pageID = webkit_web_view_get_page_id(webkit_uri_scheme_request_get_web_view(dataRequest->request)); 404 404 aboutDataFillTable(result, dataRequest, dataList, "Cookies", WEBKIT_WEBSITE_DATA_COOKIES, NULL, pageID); 405 aboutDataFillTable(result, dataRequest, dataList, "Device Id Hash Salt", WEBKIT_WEBSITE_DATA_DEVICE_ID_HASH_SALT, NULL, pageID); 405 406 aboutDataFillTable(result, dataRequest, dataList, "Memory Cache", WEBKIT_WEBSITE_DATA_MEMORY_CACHE, NULL, pageID); 406 407 aboutDataFillTable(result, dataRequest, dataList, "Disk Cache", WEBKIT_WEBSITE_DATA_DISK_CACHE, webkit_website_data_manager_get_disk_cache_directory(manager), pageID); -
trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestUIClient.cpp
r235969 r237031 835 835 836 836 #if ENABLE(MEDIA_STREAM) 837 static void testWebViewUserMediaEnumerateDevicesPermissionCheck(UIClientTest* test, gconstpointer) 838 { 839 WebKitSettings* settings = webkit_web_view_get_settings(test->m_webView); 840 gboolean enabled = webkit_settings_get_enable_media_stream(settings); 841 webkit_settings_set_enable_media_stream(settings, TRUE); 842 843 #if PLATFORM(GTK) 844 test->showInWindowAndWaitUntilMapped(); 845 #endif 846 static const char* userMediaRequestHTML = 847 "<html>" 848 " <script>" 849 " function runTest()" 850 " {" 851 " navigator.mediaDevices.enumerateDevices().then(" 852 " function(devices) { " 853 " devices.forEach(function(device) {" 854 " if (device.label) document.title = \"OK\";" 855 " else document.title = \"Permission denied\";" 856 " })" 857 " })" 858 " }" 859 " </script>" 860 " <body onload='runTest();'></body>" 861 "</html>"; 862 863 test->m_verifyMediaTypes = TRUE; 864 865 // Test denying a permission request. 866 test->m_allowPermissionRequests = false; 867 test->loadHtml(userMediaRequestHTML, nullptr); 868 test->waitUntilTitleChangedTo("Permission denied"); 869 870 // Test allowing a permission request. 871 test->m_allowPermissionRequests = true; 872 test->loadHtml(userMediaRequestHTML, nullptr); 873 test->waitUntilTitleChangedTo("OK"); 874 875 webkit_settings_set_enable_media_stream(settings, enabled); 876 } 877 837 878 static void testWebViewUserMediaPermissionRequests(UIClientTest* test, gconstpointer) 838 879 { … … 1157 1198 #endif 1158 1199 #if ENABLE(MEDIA_STREAM) 1200 UIClientTest::add("WebKitWebView", "usermedia-enumeratedevices-permission-check", testWebViewUserMediaEnumerateDevicesPermissionCheck); 1159 1201 UIClientTest::add("WebKitWebView", "usermedia-permission-requests", testWebViewUserMediaPermissionRequests); 1160 1202 UIClientTest::add("WebKitWebView", "audio-usermedia-permission-request", testWebViewAudioOnlyUserMediaPermissionRequests); -
trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebsiteData.cpp
r232010 r237031 22 22 #include "WebKitTestServer.h" 23 23 #include "WebViewTest.h" 24 #include <glib/gstdio.h> 24 25 25 26 static WebKitTestServer* kServer; … … 60 61 const char* localStorageHTML = "<html><body onload=\"localStorage.foo = 'bar';\"></body></html>"; 61 62 soup_message_body_append(message->response_body, SOUP_MEMORY_STATIC, localStorageHTML, strlen(localStorageHTML)); 63 soup_message_body_complete(message->response_body); 64 soup_message_set_status(message, SOUP_STATUS_OK); 65 } else if (g_str_equal(path, "/enumeratedevices")) { 66 const char* enumerateDevicesHTML = "<html><body onload=\"navigator.mediaDevices.enumerateDevices().then(function(devices) { document.title = 'Finished'; })\"></body></html>"; 67 soup_message_body_append(message->response_body, SOUP_MEMORY_STATIC, enumerateDevicesHTML, strlen(enumerateDevicesHTML)); 62 68 soup_message_body_complete(message->response_body); 63 69 soup_message_set_status(message, SOUP_STATUS_OK); … … 164 170 // Clear all persistent caches, since the data dir is common to all test cases. 165 171 static const WebKitWebsiteDataTypes persistentCaches = static_cast<WebKitWebsiteDataTypes>(WEBKIT_WEBSITE_DATA_DISK_CACHE | WEBKIT_WEBSITE_DATA_LOCAL_STORAGE 166 | WEBKIT_WEBSITE_DATA_WEBSQL_DATABASES | WEBKIT_WEBSITE_DATA_INDEXEDDB_DATABASES | WEBKIT_WEBSITE_DATA_OFFLINE_APPLICATION_CACHE );172 | WEBKIT_WEBSITE_DATA_WEBSQL_DATABASES | WEBKIT_WEBSITE_DATA_INDEXEDDB_DATABASES | WEBKIT_WEBSITE_DATA_OFFLINE_APPLICATION_CACHE | WEBKIT_WEBSITE_DATA_DEVICE_ID_HASH_SALT); 167 173 test->clear(persistentCaches, 0); 168 174 g_assert(!test->fetch(persistentCaches)); … … 518 524 } 519 525 526 static void testWebsiteDataDeviceIdHashSalt(WebsiteDataTest* test, gconstpointer) 527 { 528 test->clear(WEBKIT_WEBSITE_DATA_DEVICE_ID_HASH_SALT, 0); 529 530 GList* dataList = test->fetch(WEBKIT_WEBSITE_DATA_DEVICE_ID_HASH_SALT); 531 g_assert(!dataList); 532 533 test->loadURI(kServer->getURIForPath("/enumeratedevices").data()); 534 test->waitUntilTitleChangedTo("Finished"); 535 536 dataList = test->fetch(WEBKIT_WEBSITE_DATA_DEVICE_ID_HASH_SALT); 537 g_assert(dataList); 538 539 g_assert_cmpuint(g_list_length(dataList), ==, 1); 540 WebKitWebsiteData* data = static_cast<WebKitWebsiteData*>(dataList->data); 541 g_assert(data); 542 WebKitSecurityOrigin* origin = webkit_security_origin_new_for_uri(kServer->getURIForPath("/").data()); 543 g_assert_cmpstr(webkit_website_data_get_name(data), ==, webkit_security_origin_get_host(origin)); 544 webkit_security_origin_unref(origin); 545 g_assert_cmpuint(webkit_website_data_get_types(data), ==, WEBKIT_WEBSITE_DATA_DEVICE_ID_HASH_SALT); 546 547 GList removeList = { data, nullptr, nullptr }; 548 test->remove(WEBKIT_WEBSITE_DATA_DEVICE_ID_HASH_SALT, &removeList); 549 dataList = test->fetch(WEBKIT_WEBSITE_DATA_DEVICE_ID_HASH_SALT); 550 g_assert(!dataList); 551 552 // Test removing the cookies. 553 test->loadURI(kServer->getURIForPath("/enumeratedevices").data()); 554 test->waitUntilTitleChangedTo("Finished"); 555 556 dataList = test->fetch(WEBKIT_WEBSITE_DATA_DEVICE_ID_HASH_SALT); 557 g_assert(dataList); 558 data = static_cast<WebKitWebsiteData*>(dataList->data); 559 g_assert(data); 560 561 GList removeCookieList = { data, nullptr, nullptr }; 562 test->remove(WEBKIT_WEBSITE_DATA_COOKIES, &removeCookieList); 563 dataList = test->fetch(WEBKIT_WEBSITE_DATA_DEVICE_ID_HASH_SALT); 564 g_assert(!dataList); 565 566 // Clear all. 567 static const WebKitWebsiteDataTypes cacheAndAppcacheTypes = static_cast<WebKitWebsiteDataTypes>(WEBKIT_WEBSITE_DATA_DEVICE_ID_HASH_SALT); 568 test->clear(cacheAndAppcacheTypes, 0); 569 dataList = test->fetch(cacheAndAppcacheTypes); 570 g_assert(!dataList); 571 } 572 520 573 void beforeAll() 521 574 { … … 530 583 WebsiteDataTest::add("WebKitWebsiteData", "appcache", testWebsiteDataAppcache); 531 584 WebsiteDataTest::add("WebKitWebsiteData", "cookies", testWebsiteDataCookies); 585 WebsiteDataTest::add("WebKitWebsiteData", "deviceidhashsalt", testWebsiteDataDeviceIdHashSalt); 532 586 } 533 587 -
trunk/Tools/TestWebKitAPI/glib/WebKitGLib/WebViewTest.cpp
r232671 r237031 49 49 { 50 50 g_assert(!m_webView); 51 52 WebKitSettings* webkitSettings = webkit_settings_new(); 53 webkit_settings_set_enable_media_stream(webkitSettings, TRUE); 54 51 55 m_webView = WEBKIT_WEB_VIEW(g_object_new(WEBKIT_TYPE_WEB_VIEW, 52 56 #if PLATFORM(WPE) 53 57 "backend", Test::createWebViewBackend(), 54 58 #endif 59 "settings", webkitSettings, 55 60 "web-context", m_webContext.get(), 56 61 "user-content-manager", m_userContentManager.get(),
Note: See TracChangeset
for help on using the changeset viewer.