Introduce Storage Access API (document parts) as an experimental feature
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2017-09-13  John Wilander  <wilander@apple.com>
2
3         Introduce Storage Access API (document parts) as an experimental feature
4         https://bugs.webkit.org/show_bug.cgi?id=175759
5         <rdar://problem/34414107>
6
7         Reviewed by Alex Christensen.
8
9         Storage Access API is an experimental feature which allows cross-origin,
10         sandboxed iframes to request access to their first-party storage (as
11         opposed to partitioned storage). This might be restricted to cookies or
12         might cover all stateful mechanisms.
13
14         It introduces the following three developer-facing things:
15         - A new readonly attribute, document.hasStorageAccess.
16         - A new function, document.requestStorageAccess().
17         - A new iframe sandbox token, allow-storage-access-by-user-activation.
18
19         * Shared/WebCoreArgumentCoders.cpp:
20         (IPC::ArgumentCoder<ResourceLoadStatistics>::encode):
21         (IPC::ArgumentCoder<ResourceLoadStatistics>::decode):
22             Storage handling of the new type of data.
23         * Shared/WebPreferencesDefinitions.h:
24         * UIProcess/API/C/WKPreferences.cpp:
25         (WKPreferencesSetStorageAccessAPIEnabled):
26         (WKPreferencesGetStorageAccessAPIEnabled):
27         * UIProcess/API/C/WKPreferencesRefPrivate.h:
28         * UIProcess/WebResourceLoadStatisticsStore.cpp:
29             Bumped the model version from 9 to 10.
30         * WebProcess/WebPage/WebPage.cpp:
31         (WebKit::WebPage::updatePreferences):
32
33 2017-09-13  Andy Estes  <aestes@apple.com>
34
35         [Apple Pay] Consider phoneticName when encoding ContactFields
36         https://bugs.webkit.org/show_bug.cgi?id=176885
37         <rdar://problem/34176419>
38
39         Reviewed by Tim Horton.
40
41         * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
42         (IPC::ArgumentCoder<ApplePaySessionPaymentRequest::ContactFields>::encode):
43         (IPC::ArgumentCoder<ApplePaySessionPaymentRequest::ContactFields>::decode):
44
45 2017-09-13  Matt Lewis  <jlewis3@apple.com>
46
47         Unreviewed, rolling out r221976.
48
49         The test introduced was flaky from point of addition.
50
51         Reverted changeset:
52
53         "Introduce Storage Access API (document parts) as an
54         experimental feature"
55         https://bugs.webkit.org/show_bug.cgi?id=175759
56         http://trac.webkit.org/changeset/221976
57
58 2017-09-13  Youenn Fablet  <youenn@apple.com>
59
60         Internals clearCacheStorageMemoryRepresentation should return a Promise
61         https://bugs.webkit.org/show_bug.cgi?id=176818
62
63         Reviewed by Alex Christensen.
64
65         Adding a completion handler to clearMemoryRepresentation.
66
67         * NetworkProcess/cache/CacheStorageEngine.cpp:
68         (WebKit::CacheStorage::Engine::clearMemoryRepresentation):
69         * NetworkProcess/cache/CacheStorageEngine.h:
70         * NetworkProcess/cache/CacheStorageEngineConnection.cpp:
71         (WebKit::CacheStorageEngineConnection::clearMemoryRepresentation):
72         * NetworkProcess/cache/CacheStorageEngineConnection.h:
73         * NetworkProcess/cache/CacheStorageEngineConnection.messages.in:
74         * WebProcess/Cache/WebCacheStorageConnection.cpp:
75         (WebKit::WebCacheStorageConnection::clearMemoryRepresentation):
76         (WebKit::WebCacheStorageConnection::clearMemoryRepresentationCompleted):
77         * WebProcess/Cache/WebCacheStorageConnection.h:
78         * WebProcess/Cache/WebCacheStorageConnection.messages.in:
79
80 2017-09-13  Andy Estes  <aestes@apple.com>
81
82         [CF] Upstream CFNetwork-related WebKitSystemInterface functions
83         https://bugs.webkit.org/show_bug.cgi?id=176729
84
85         Reviewed by Alex Christensen.
86
87         * Shared/mac/WebCoreArgumentCodersMac.mm:
88         (IPC::createSerializableRepresentation):
89         (IPC::dictionaryValueOfType):
90         (IPC::createArchiveList):
91         (IPC::createCFURLRequestFromSerializableRepresentation):
92         (IPC::createNSURLRequestFromSerializableRepresentation):
93         (IPC::ArgumentCoder<ResourceRequest>::encodePlatformData):
94         (IPC::ArgumentCoder<ResourceRequest>::decodePlatformData):
95         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
96         (WebKit::WebProcessPool::legacyPlatformDefaultCacheStorageDirectory):
97         (WebKit::WebProcessPool::legacyPlatformDefaultNetworkCacheDirectory):
98         * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
99         (InitWebCoreSystemInterface):
100
101 2017-09-13  Alex Christensen  <achristensen@webkit.org>
102
103         Add WKUIDelegatePrivate equivalent of WKPageUIClient's setIsResizable, getWindowFrame, and setWindowFrame
104         https://bugs.webkit.org/show_bug.cgi?id=176857
105         <rdar://problem/29270035>
106
107         Reviewed by Tim Horton.
108
109         isResizable is unreachable code because nothing sends Messages::WebPageProxy::GetIsResizable, so I removed it.
110
111         * UIProcess/API/APIUIClient.h:
112         (API::UIClient::setStatusBarIsVisible):
113         (API::UIClient::isResizable): Deleted.
114         * UIProcess/API/C/WKPage.cpp:
115         (WKPageSetPageUIClient):
116         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
117         * UIProcess/API/glib/WebKitUIClient.cpp:
118         * UIProcess/Cocoa/UIDelegate.h:
119         * UIProcess/Cocoa/UIDelegate.mm:
120         (WebKit::UIDelegate::setDelegate):
121         (WebKit::UIDelegate::UIClient::setIsResizable):
122         (WebKit::UIDelegate::UIClient::setWindowFrame):
123         (WebKit::UIDelegate::UIClient::windowFrame):
124         * UIProcess/WebPageProxy.cpp:
125         (WebKit::WebPageProxy::getIsResizable): Deleted.
126         * UIProcess/WebPageProxy.h:
127         * UIProcess/WebPageProxy.messages.in:
128
129 2017-09-13  Youenn Fablet  <youenn@apple.com>
130
131         Add a lambda-based map for Vectors
132         https://bugs.webkit.org/show_bug.cgi?id=176487
133
134         Reviewed by Darin Adler.
135
136         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
137         (WebKit::CacheStorage::Caches::readCachesFromDisk):
138
139 2017-09-13  John Wilander  <wilander@apple.com>
140
141         Introduce Storage Access API (document parts) as an experimental feature
142         https://bugs.webkit.org/show_bug.cgi?id=175759
143         <rdar://problem/33666847>
144
145         Reviewed by Alex Christensen.
146
147         Storage Access API is an experimental feature which allows cross-origin,
148         sandboxed iframes to request access to their first-party storage (as
149         opposed to partitioned storage). This might be restricted to cookies or
150         might cover all stateful mechanisms.
151
152         It introduces the following three developer-facing things:
153         - A new readonly attribute, document.hasStorageAccess.
154         - A new function, document.requestStorageAccess().
155         - A new iframe sandbox token, allow-storage-access-by-user-activation.
156
157         * Shared/WebCoreArgumentCoders.cpp:
158         (IPC::ArgumentCoder<ResourceLoadStatistics>::encode):
159         (IPC::ArgumentCoder<ResourceLoadStatistics>::decode):
160             Storage handling of the new type of data.
161         * Shared/WebPreferencesDefinitions.h:
162         * UIProcess/API/C/WKPreferences.cpp:
163         (WKPreferencesSetStorageAccessAPIEnabled):
164         (WKPreferencesGetStorageAccessAPIEnabled):
165         * UIProcess/API/C/WKPreferencesRefPrivate.h:
166         * UIProcess/WebResourceLoadStatisticsStore.cpp:
167             Bumped the model version from 9 to 10.
168         * WebProcess/WebPage/WebPage.cpp:
169         (WebKit::WebPage::updatePreferences):
170
171 2017-09-13  Sergio Villar Senin  <svillar@igalia.com>
172
173         [WebVR] Add IDLs and stubs
174         https://bugs.webkit.org/show_bug.cgi?id=174202
175
176         Reviewed by Dean Jackson.
177
178         * Shared/WebPreferencesDefinitions.h:
179         * WebProcess/WebPage/WebPage.cpp:
180         (WebKit::WebPage::updatePreferences):
181
182 2017-09-12  Ryosuke Niwa  <rniwa@webkit.org>
183
184         Dragging & dropping a file creates an attachment element even when it's disabled
185         https://bugs.webkit.org/show_bug.cgi?id=176769
186
187         Reviewed by Tim Horton.
188
189         * UIProcess/API/C/WKPreferences.cpp:
190         (WKPreferencesSetAttachmentElementEnabled):
191         (WKPreferencesGetAttachmentElementEnabled):
192         * UIProcess/API/C/WKPreferencesRefPrivate.h:
193         * WebProcess/WebPage/WebPage.cpp:
194         (WebKit::WebPage::updatePreferences):
195
196 2017-09-12  Youenn Fablet  <youenn@apple.com>
197
198         Introduce a RecordData for Cache to efficiently check whether it matches a corresponding request or not
199         https://bugs.webkit.org/show_bug.cgi?id=176579
200
201         Reviewed by Alex Christensen.
202
203         Introducing RecordData that splits its stored data in mandatory data,
204         used to check a record with a request and optional data that is
205         necessary to build a CacheStorageEngine::Record used by WebProcess.
206
207         The mandatory data contains the URL, Vary header information and identifiers.
208         Adding routines to go from a Record to RecordData and vice versa.
209         Storing in CacheStorage::Cache RecordData instead of Record.
210
211         * NetworkProcess/cache/CacheStorageEngineCache.cpp:
212         (WebKit::CacheStorage::queryCache):
213         (WebKit::CacheStorage::updateVaryInformation):
214         (WebKit::CacheStorage::toRecord):
215         (WebKit::CacheStorage::toRecordData):
216         (WebKit::CacheStorage::Cache::retrieveRecords const):
217         (WebKit::CacheStorage::Cache::addRecord):
218         (WebKit::CacheStorage::Cache::recordsFromURL):
219         (WebKit::CacheStorage::Cache::recordsFromURL const):
220         (WebKit::CacheStorage::Cache::put):
221         (WebKit::CacheStorage::Cache::writeRecordToDisk):
222         (WebKit::CacheStorage::Cache::removeRecordFromDisk):
223         * NetworkProcess/cache/CacheStorageEngineCache.h:
224
225 2017-09-12  Dan Bernstein  <mitz@apple.com>
226
227         Tried to fix the iOS 10 build after r221930.
228
229         * UIProcess/API/Cocoa/WKWebView.mm:
230         (-[WKWebView _initializeWithConfiguration:]):
231         (-[WKWebView _setDragInteractionPolicy:]):
232
233 2017-09-12  Dan Bernstein  <mitz@apple.com>
234
235         Update availability annotations to match the macOS 10.13 and iOS 11.0 GM seed SDKs
236         https://bugs.webkit.org/show_bug.cgi?id=176793
237
238         Reviewed by Tim Horton.
239
240         Changed WK_MAC_TBA and WK_IOS_TBA to 10.13 and 11.0, respectively, in all declarations that
241         appear in the GM seed SDKs. Additional changes and exceptions are noted below.
242
243         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: Added missing availability annotation to
244           -_webView:dataOwnerForDropSession: and -_webView:dataOwnerForDragSession:.
245
246         * UIProcess/API/Cocoa/WKWebViewPrivate.h: Removed rednundant
247           __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000 guards.
248
249         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h: Added missing availability annotation to
250           -_setResourceLoadStatisticsTestingCallback:.
251
252         * UIProcess/API/Cocoa/_WKFullscreenDelegate.h: Added missing availability annotation.
253
254         * UIProcess/API/Cocoa/_WKLinkIconParameters.h: Added availability annotation that had been
255           missing since macOS 10.12.3 and iOS 10.3. Corrected annotation for _WKLinkIconParameters.
256
257         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h: Added missing TBA annotation to
258           _resourceLoadStatisticsDirectory.
259
260         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.h: Removed iOS
261           availability from macOS-only declaration and vice versa.
262
263         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.mm:
264         (-[WKWebProcessPlugInRangeHandle detectDataWithTypes:context:]): Removed an availability
265           annotation from this method implementation.
266
267         * Shared/API/Cocoa/WKDragDestinationAction.h:
268         * UIProcess/API/Cocoa/WKContentRuleList.h:
269         * UIProcess/API/Cocoa/WKContentRuleListStore.h:
270         * UIProcess/API/Cocoa/WKError.h:
271         * UIProcess/API/Cocoa/WKFrameInfo.h:
272         * UIProcess/API/Cocoa/WKHTTPCookieStore.h:
273         * UIProcess/API/Cocoa/WKNavigationActionPrivate.h:
274         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
275         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
276         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
277         * UIProcess/API/Cocoa/WKSnapshotConfiguration.h:
278         * UIProcess/API/Cocoa/WKURLSchemeHandler.h:
279         * UIProcess/API/Cocoa/WKURLSchemeTask.h:
280         * UIProcess/API/Cocoa/WKURLSchemeTaskPrivate.h:
281         * UIProcess/API/Cocoa/WKUserContentController.h:
282         * UIProcess/API/Cocoa/WKWebView.h:
283         * UIProcess/API/Cocoa/WKWebViewConfiguration.h:
284         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
285         * UIProcess/API/Cocoa/WKWebsiteDataRecordPrivate.h:
286         * UIProcess/API/Cocoa/WKWebsiteDataStore.h:
287         * UIProcess/API/Cocoa/WKWindowFeaturesPrivate.h:
288         * UIProcess/API/Cocoa/_WKActivatedElementInfo.h:
289         * UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h:
290         * UIProcess/API/Cocoa/_WKDiagnosticLoggingDelegate.h:
291         * UIProcess/API/Cocoa/_WKGeolocationCoreLocationProvider.h:
292         * UIProcess/API/Cocoa/_WKGeolocationPosition.h:
293         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
294         * UIProcess/API/Cocoa/_WKUserContentExtensionStorePrivate.h:
295         * UIProcess/API/Cocoa/_WKUserContentFilterPrivate.h:
296         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
297         * UIProcess/_WKWebViewPrintFormatter.h:
298         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInEditingDelegate.h:
299         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.h:
300         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextControllerPrivate.h:
301
302 2017-09-12  Alex Christensen  <achristensen@webkit.org>
303
304         Add WKUIDelegatePrivate equivalent of WKPageUIClient's runModal
305         https://bugs.webkit.org/show_bug.cgi?id=176728
306         <rdar://problem/29270035>
307         
308         Covered by a new API test.
309
310         Reviewed by Tim Horton.
311
312         * UIProcess/API/APIUIClient.h:
313         (API::UIClient::runModal):
314         * UIProcess/API/C/WKPage.cpp:
315         (WKPageSetPageUIClient):
316         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
317         * UIProcess/Cocoa/UIDelegate.h:
318         * UIProcess/Cocoa/UIDelegate.mm:
319         (WebKit::UIDelegate::setDelegate):
320         (WebKit::UIDelegate::UIClient::canRunModal const):
321         (WebKit::UIDelegate::UIClient::runModal):
322         * UIProcess/WebPageProxy.cpp:
323         (WebKit::WebPageProxy::runModal):
324
325 2017-09-12  Alex Christensen  <achristensen@webkit.org>
326
327         Add WKUIDelegatePrivate equivalent of WKPageUIClient's decidePolicyForNotificationPermissionRequest
328         https://bugs.webkit.org/show_bug.cgi?id=176768
329         <rdar://problem/29270035>
330
331         Reviewed by Tim Horton.
332
333         Covered by a new API test.
334
335         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
336         * UIProcess/Cocoa/UIDelegate.h:
337         * UIProcess/Cocoa/UIDelegate.mm:
338         (WebKit::UIDelegate::setDelegate):
339         (WebKit::UIDelegate::UIClient::runBeforeUnloadConfirmPanel):
340         (WebKit::UIDelegate::UIClient::exceededDatabaseQuota):
341         (WebKit::UIDelegate::UIClient::decidePolicyForNotificationPermissionRequest):
342         (WebKit::UIDelegate::UIClient::reachedApplicationCacheOriginQuota):
343
344 2017-09-11  Wenson Hsieh  <wenson_hsieh@apple.com>
345
346         [iOS DnD] Support DataTransfer.setDragImage when starting a drag on iOS
347         https://bugs.webkit.org/show_bug.cgi?id=176721
348         <rdar://problem/34373660>
349
350         Reviewed by Tim Horton.
351
352         Rename elementBounds => dragPreviewFrameInRootViewCoordinates.
353
354         * UIProcess/ios/DragDropInteractionState.h:
355         * UIProcess/ios/DragDropInteractionState.mm:
356         (WebKit::DragDropInteractionState::previewForDragItem const):
357         (WebKit::DragDropInteractionState::stageDragItem):
358
359 2017-09-11  Tim Horton  <timothy_horton@apple.com>
360
361         REGRESSION (r221272): WKWebView gets stuck zoomed in if the web process crashes
362         https://bugs.webkit.org/show_bug.cgi?id=176767
363         <rdar://problem/34196874>
364
365         Reviewed by Dan Bernstein.
366
367         * UIProcess/API/Cocoa/WKWebView.mm:
368         (-[WKWebView _processDidExit]):
369         Reset the "last sent" layout parameters when the Web Content process exits.
370         They're no longer "last sent", and if we short-circuit from sending them
371         again (from under _didRelaunchProcess), we will never send the correct
372         layout width (until it changes).
373
374 2017-09-11  Wenson Hsieh  <wenson_hsieh@apple.com>
375
376         [iOS WK2] Support tapping to add items to the current drag session in web content
377         https://bugs.webkit.org/show_bug.cgi?id=176421
378         <rdar://problem/31144674>
379
380         Reviewed by Tim Horton.
381
382         To request additional drag items, end the current drag in the web page and try to begin a drag at the new
383         location. This process is transparent to the UI process, which still maintains the same UIDragSession with the
384         old drag source.
385
386         As opposed to firing a new event (for instance: `adddragitem`), this approach is taken to ensure that if the
387         page wants to preventDefault() on `dragstart`, it would also prevent the user from adding it as an additional
388         drag item. Using the new event approach, dealing with this case would either require the page to listen for a
389         new event and call preventDefault(), which would break compatibility with pages that only preventDefault() on
390         `dragstart`, or it would require the default behavior of this new event to be _not_ adding a drag item, in which
391         case this approach would require pages to adopt the new event in some form.
392
393         * WebProcess/WebPage/ios/WebPageIOS.mm:
394         (WebKit::WebPage::requestAdditionalItemsForDragSession):
395
396 2017-09-11  Alex Christensen  <achristensen@webkit.org>
397
398         Clean up API::UIClient
399         https://bugs.webkit.org/show_bug.cgi?id=176568
400
401         Reviewed by Brady Eidson.
402
403         We don't need createNewPage and createNewPageAsync.
404         An async version can support synchronous delegate calls by just calling the completion handler synchronously.
405
406         * UIProcess/API/APIUIClient.h:
407         (API::UIClient::createNewPage):
408         (API::UIClient::createNewPageAsync): Deleted.
409         (API::UIClient::canCreateNewPageAsync): Deleted.
410         * UIProcess/API/C/WKPage.cpp:
411         (WKPageSetPageUIClient):
412         * UIProcess/API/glib/WebKitUIClient.cpp:
413         * UIProcess/API/glib/WebKitUIClient.h:
414         * UIProcess/Cocoa/UIDelegate.h:
415         * UIProcess/Cocoa/UIDelegate.mm:
416         (WebKit::UIDelegate::UIClient::createNewPage):
417         (WebKit::UIDelegate::UIClient::createNewPageCommon): Deleted.
418         (WebKit::UIDelegate::UIClient::canCreateNewPageAsync): Deleted.
419         (WebKit::UIDelegate::UIClient::createNewPageAsync): Deleted.
420         * UIProcess/WebPageProxy.cpp:
421         (WebKit::WebPageProxy::createNewPage):
422         * UIProcess/WebPageProxy.h:
423
424 2017-09-11  Alex Christensen  <achristensen@webkit.org>
425
426         Fix memory leak introduced in r221894.
427         https://bugs.webkit.org/show_bug.cgi?id=176753
428
429         * UIProcess/Notifications/NotificationPermissionRequestManagerProxy.cpp:
430         (WebKit::NotificationPermissionRequestManagerProxy::createRequest):
431         The NotificationPermissionRequestManagerProxy keeps track of pending requests
432         so they can be denied when invalidating the page.  We add them to a HashMap and in
433         r221894 I removed the code that removes them from that map once the request is complete.
434         This code adds the completed task removal back.
435         The NotificationPermissionRequestManagerProxy and WebPageProxy have the same lifetime,
436         so protecting the WebPageProxy (m_page) makes sure there is no use-after-free when the
437         completion handler is called.
438
439 2017-09-11  Alex Christensen  <achristensen@webkit.org>
440
441         Make NotificationPermissionRequest work with completion handlers
442         https://bugs.webkit.org/show_bug.cgi?id=176753
443
444         Reviewed by Andy Estes.
445
446         API::UIClient::decidePolicyForNotificationPermissionRequest should take a completion handler
447         which it will eventually call with a bool representing whether notifications are allowed.
448         To do this, I make NotificationPermissionRequest just a wrapper for a lambda.
449         One subtle change in behavior is when invalidating all outstanding requests, we deny them instead
450         of just dropping them.  This results in a deny message sent where there wasn't one before,
451         resulting in better cleanup in NotificationPermissionRequestManager::didReceiveNotificationPermissionDecision.
452
453         * UIProcess/API/APIUIClient.h:
454         (API::UIClient::decidePolicyForNotificationPermissionRequest):
455         * UIProcess/API/C/WKPage.cpp:
456         (WKPageSetPageUIClient):
457         * UIProcess/Notifications/NotificationPermissionRequest.cpp: Removed.
458         * UIProcess/Notifications/NotificationPermissionRequest.h:
459         (WebKit::NotificationPermissionRequest::create):
460         (WebKit::NotificationPermissionRequest::allow):
461         (WebKit::NotificationPermissionRequest::deny):
462         (WebKit::NotificationPermissionRequest::NotificationPermissionRequest):
463         * UIProcess/Notifications/NotificationPermissionRequestManagerProxy.cpp:
464         (WebKit::NotificationPermissionRequestManagerProxy::invalidateRequests):
465         (WebKit::NotificationPermissionRequestManagerProxy::createRequest):
466         (WebKit::NotificationPermissionRequestManagerProxy::didReceiveNotificationPermissionDecision): Deleted.
467         * UIProcess/Notifications/NotificationPermissionRequestManagerProxy.h:
468         * UIProcess/WebPageProxy.cpp:
469         (WebKit::WebPageProxy::requestNotificationPermission):
470         * WebKit.xcodeproj/project.pbxproj:
471
472 2017-09-11  Alex Christensen  <achristensen@webkit.org>
473
474         Modernize and make API::UIClient more asynchronous
475         https://bugs.webkit.org/show_bug.cgi?id=176583
476
477         Reviewed by Brian Burg.
478
479         API::UIClient calls that return values synchronously require synchronous APIs unnecessarily.
480         Having them call completion handlers with the results instead allows us to make asynchronous
481         APIs, and existing synchronous APIs can just call the completion handlers immediately.
482         
483         Unfortunately an assumption that API::UIClient::windowFrame returns synchronously had worked
484         its way into the WebAutomationSession, which calls WebPageProxy::getWindowFrame.  Making it
485         asynchronous required making some automation protocols asynchronous so they can send their
486         result once they have the resulting frames from the UIClient.
487         
488         No change in behaviour.
489
490         * UIProcess/API/APIUIClient.h:
491         (API::UIClient::setToolbarsAreVisible):
492         (API::UIClient::menuBarIsVisible):
493         (API::UIClient::setMenuBarIsVisible):
494         (API::UIClient::statusBarIsVisible):
495         (API::UIClient::setStatusBarIsVisible):
496         (API::UIClient::isResizable):
497         (API::UIClient::setIsResizable):
498         (API::UIClient::setWindowFrame):
499         (API::UIClient::windowFrame):
500         (API::UIClient::headerHeight):
501         (API::UIClient::footerHeight):
502         (API::UIClient::drawHeader):
503         (API::UIClient::drawFooter):
504         (API::UIClient::printFrame):
505         * UIProcess/API/C/WKPage.cpp:
506         (WKPageSetPageUIClient):
507         * UIProcess/Automation/Automation.json:
508         * UIProcess/Automation/WebAutomationSession.cpp:
509         (WebKit::WebAutomationSession::buildBrowsingContextForPage):
510         (WebKit::WebAutomationSession::getNextContext):
511         (WebKit::WebAutomationSession::getBrowsingContexts):
512         (WebKit::WebAutomationSession::getBrowsingContext):
513         (WebKit::WebAutomationSession::resizeWindowOfBrowsingContext):
514         (WebKit::WebAutomationSession::moveWindowOfBrowsingContext):
515         (WebKit::WebAutomationSession::performMouseInteraction):
516         * UIProcess/Automation/WebAutomationSession.h:
517         * UIProcess/Cocoa/UIDelegate.h:
518         * UIProcess/Cocoa/UIDelegate.mm:
519         (WebKit::UIDelegate::UIClient::printFrame):
520         * UIProcess/Cocoa/WebViewImpl.mm:
521         (WebKit::WebViewImpl::printOperationWithPrintInfo):
522         * UIProcess/WebPageProxy.cpp:
523         (WebKit::WebPageProxy::runJavaScriptPrompt):
524         (WebKit::WebPageProxy::setToolbarsAreVisible):
525         (WebKit::WebPageProxy::setMenuBarIsVisible):
526         (WebKit::WebPageProxy::getMenuBarIsVisible):
527         (WebKit::WebPageProxy::setStatusBarIsVisible):
528         (WebKit::WebPageProxy::getStatusBarIsVisible):
529         (WebKit::WebPageProxy::setIsResizable):
530         (WebKit::WebPageProxy::getIsResizable):
531         (WebKit::WebPageProxy::setWindowFrame):
532         (WebKit::WebPageProxy::getWindowFrame):
533         (WebKit::WebPageProxy::getWindowFrameWithCompletionHandler):
534         (WebKit::WebPageProxy::screenToRootView):
535         (WebKit::WebPageProxy::rootViewToScreen):
536         (WebKit::WebPageProxy::printFrame):
537         (WebKit::WebPageProxy::headerHeight):
538         (WebKit::WebPageProxy::footerHeight):
539         (WebKit::WebPageProxy::drawHeader):
540         (WebKit::WebPageProxy::drawFooter):
541         * UIProcess/WebPageProxy.h:
542         * UIProcess/WebPageProxy.messages.in:
543         * UIProcess/mac/WKPrintingView.h:
544         * UIProcess/mac/WKPrintingView.mm:
545         (-[WKPrintingView initWithFrameProxy:view:]):
546         (-[WKPrintingView _adjustPrintingMarginsForHeaderAndFooter]):
547         (-[WKPrintingView drawPageBorderWithSize:]):
548         * UIProcess/mac/WebPageProxyMac.mm:
549         (WebKit::WebPageProxy::windowAndViewFramesChanged):
550
551 2017-09-11  Stephan Szabo  <stephan.szabo@sony.com>
552
553         [WinCairo] Add entry Web Process files for wincairo webkit
554         https://bugs.webkit.org/show_bug.cgi?id=176570
555
556         Reviewed by Alex Christensen.
557
558         * PlatformWin.cmake:
559         * WebProcess/EntryPoint/win/WebProcessMain.cpp: Added.
560         * WebProcess/win/WebProcessMainWin.cpp: Added.
561         * WebProcess/win/WebProcessMainWin.h: Added.
562
563 2017-09-11  Alex Christensen  <achristensen@webkit.org>
564
565         Add WKUIDelegatePrivate equivalent of WKPageUIClient's decidePolicyForGeolocationPermissionRequest
566         https://bugs.webkit.org/show_bug.cgi?id=176642
567         <rdar://problem/29270035>
568
569         Reviewed by Darin Adler.
570
571         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
572         * UIProcess/Cocoa/UIDelegate.h:
573         * UIProcess/Cocoa/UIDelegate.mm:
574         (WebKit::UIDelegate::setDelegate):
575         (WebKit::UIDelegate::UIClient::runJavaScriptPrompt):
576         (WebKit::Function<void):
577
578 2017-09-11  Wenson Hsieh  <wenson_hsieh@apple.com>
579
580         [iOS DnD] Elements in the DOM with the `draggable` attribute should be draggable
581         https://bugs.webkit.org/show_bug.cgi?id=176664
582         <rdar://problem/32596156>
583
584         Reviewed by Tim Horton.
585
586         Makes a simple adjustment in DragDropInteractionState::previewForDragItem to respect the drag image supplied to
587         the UI process during a "DHTML"-defined drag (i.e. DragSourceActionDHTML).
588
589         Test: DataInteractionTests.CanStartDragOnDivWithDraggableAttribute
590
591         * UIProcess/API/Cocoa/WKWebView.mm:
592         (-[WKWebView _simulateDataInteractionEntered:]): Deleted.
593         (-[WKWebView _simulateDataInteractionUpdated:]): Deleted.
594         (-[WKWebView _simulateDataInteractionPerformOperation:]): Deleted.
595         (-[WKWebView _simulateDataInteractionEnded:]): Deleted.
596         (-[WKWebView _simulateDataInteractionSessionDidEnd:]): Deleted.
597         (-[WKWebView _simulateWillBeginDataInteractionWithSession:]): Deleted.
598         (-[WKWebView _simulatedItemsForSession:]): Deleted.
599         (-[WKWebView _simulateItemsForAddingToSession:atLocation:completion:]): Deleted.
600         (-[WKWebView _simulatePrepareForDataInteractionSession:completion:]): Deleted.
601
602         Remove all -_simulate*: testing helpers on WKWebView.
603
604         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
605         * UIProcess/ios/DragDropInteractionState.mm:
606         (WebKit::shouldUseDragImageToCreatePreviewForDragSource):
607         (WebKit::shouldUseTextIndicatorToCreatePreviewForDragSource):
608
609         Add shouldUseDragImageToCreatePreviewForDragSource, which returns YES when dragging an image or DHTML-defined
610         draggable element and the drag image exists. This is called from previewForDragItem when constructing the drag
611         preview for a given UIDragItem.
612
613         (WebKit::DragDropInteractionState::previewForDragItem const):
614         (WebKit::shouldUseTextIndicatorToCreatePreviewForDragAction): Deleted.
615         * UIProcess/ios/WKContentViewInteraction.h:
616         * UIProcess/ios/WKContentViewInteraction.mm:
617         (-[WKContentView _simulateDataInteractionEntered:]): Deleted.
618         (-[WKContentView _simulateDataInteractionUpdated:]): Deleted.
619         (-[WKContentView _simulateDataInteractionEnded:]): Deleted.
620         (-[WKContentView _simulateDataInteractionPerformOperation:]): Deleted.
621         (-[WKContentView _simulateDataInteractionSessionDidEnd:]): Deleted.
622         (-[WKContentView _simulateWillBeginDataInteractionWithSession:]): Deleted.
623         (-[WKContentView _simulatedItemsForSession:]): Deleted.
624         (-[WKContentView _simulatePrepareForDataInteractionSession:completion:]): Deleted.
625         (-[WKContentView _simulateItemsForAddingToSession:atLocation:completion:]): Deleted.
626
627         Remove all -_simulate*: testing helpers on WKContentView.
628
629 2017-09-11  Alex Christensen  <achristensen@webkit.org>
630
631         Modernize BoxExtent into RectEdges
632         https://bugs.webkit.org/show_bug.cgi?id=176437
633
634         Reviewed by Simon Fraser.
635
636         * Scripts/webkit/messages.py:
637         (class_template_headers):
638         * Shared/WebCoreArgumentCoders.h:
639         * UIProcess/WebPageProxy.h:
640         * UIProcess/WebPageProxy.messages.in:
641         * WebProcess/WebPage/WebPage.messages.in:
642
643 2017-09-11  Andy Estes  <aestes@apple.com>
644
645         [Mac] Upstream QTKit-related WebKitSystemInterface functions
646         https://bugs.webkit.org/show_bug.cgi?id=176472
647
648         Reviewed by Eric Carlson.
649
650         * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
651         (InitWebCoreSystemInterface):
652
653 2017-09-11  JF Bastien  <jfbastien@apple.com>
654
655         cmake build fix
656
657         Unreviewed
658
659         * PlatformMac.cmake: one file was deleted, another renamed.
660
661 2017-09-10  Carlos Garcia Campos  <cgarcia@igalia.com>
662
663         REGRESSION: [GTK] Generated HTML API documentation is missing descriptions
664         https://bugs.webkit.org/show_bug.cgi?id=176667
665
666         Reviewed by Michael Catanzaro.
667
668         Fix several typos in API documentation.
669
670         * UIProcess/API/glib/WebKitSettings.cpp:
671         (webkit_settings_class_init):
672         * UIProcess/API/glib/WebKitWebView.cpp:
673         (webkit_web_view_class_init):
674         * UIProcess/API/glib/WebKitWebsiteDataManager.cpp:
675         * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml:
676
677 2017-09-10  Brady Eidson  <beidson@apple.com>
678
679         Try to avoid creating the default WKWebsiteDataStore until its actually needed.
680         <rdar://problem/33164453> and https://bugs.webkit.org/show_bug.cgi?id=176551
681
682         Reviewed by Tim Horton.
683
684         * UIProcess/API/APIHTTPCookieStore.cpp:
685         (API::HTTPCookieStore::cookies):
686         (API::HTTPCookieStore::setCookie):
687         (API::HTTPCookieStore::deleteCookie):
688
689         * UIProcess/API/APIWebsiteDataStore.cpp:
690         (API::WebsiteDataStore::defaultDataStore):
691         (API::WebsiteDataStore::defaultDataStoreExists):
692         * UIProcess/API/APIWebsiteDataStore.h:
693
694         * UIProcess/API/C/WKContext.cpp:
695         (WKContextGetWebsiteDataStore):
696
697         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
698         (+[WKWebsiteDataStore _defaultDataStoreExists]):
699         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
700
701         * UIProcess/WebProcessPool.cpp:
702         (WebKit::WebProcessPool::WebProcessPool):
703         (WebKit::m_hiddenPageThrottlingTimer):
704         (WebKit::WebProcessPool::ensureNetworkProcess):
705         (WebKit::WebProcessPool::ensureStorageProcessAndWebsiteDataStore):
706         (WebKit::WebProcessPool::warmInitialProcess):
707         (WebKit::WebProcessPool::createNewWebProcessRespectingProcessCountLimit):
708         (WebKit::WebProcessPool::createWebPage):
709         (WebKit::WebProcessPool::pageAddedToProcess):
710         * UIProcess/WebProcessPool.h:
711
712         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
713         (WebKit::WebsiteDataStore::isAssociatedProcessPool const):
714
715 2017-09-09  Mark Lam  <mark.lam@apple.com>
716
717         Avoid duplicate computations of ExecState::vm().
718         https://bugs.webkit.org/show_bug.cgi?id=176647
719
720         Reviewed by Saam Barati.
721
722         * WebProcess/Plugins/Netscape/JSNPMethod.h:
723         (WebKit::JSNPMethod::create):
724         * WebProcess/Plugins/Netscape/NPJSObject.cpp:
725         (WebKit::NPJSObject::setProperty):
726         (WebKit::NPJSObject::removeProperty):
727         (WebKit::NPJSObject::enumerate):
728
729 2017-09-08  Joseph Pecoraro  <pecoraro@apple.com>
730
731         Fetch's Response.statusText is unexpectedly the full http status line for HTTP/2 responses
732         https://bugs.webkit.org/show_bug.cgi?id=176479
733
734         Reviewed by Alex Christensen.
735
736         * NetworkProcess/NetworkProcess.cpp:
737         (WebKit::NetworkProcess::initializeNetworkProcess):
738         Initialize AtomicString statics like emptyAtom().
739
740 2017-09-08  Commit Queue  <commit-queue@webkit.org>
741
742         Unreviewed, rolling out r221773.
743         https://bugs.webkit.org/show_bug.cgi?id=176614
744
745         This caused build failures. (Requested by mlewis13 on
746         #webkit).
747
748         Reverted changeset:
749
750         "[Mac] Upstream QTKit-related WebKitSystemInterface functions"
751         https://bugs.webkit.org/show_bug.cgi?id=176472
752         http://trac.webkit.org/changeset/221773
753
754 2017-09-08  Stephan Szabo  <stephan.szabo@am.sony.com>
755
756         [WinCairo] Add Storage Process files for wincairo webkit
757         https://bugs.webkit.org/show_bug.cgi?id=176567
758
759         Reviewed by Alex Christensen.
760
761         * PlatformWin.cmake:
762         * StorageProcess/EntryPoint/win/StorageProcessMain.cpp: Added.
763         (main):
764         * StorageProcess/win/StorageProcessMainWin.cpp: Added.
765         (WebKit::StorageProcessMainWin):
766         * StorageProcess/win/StorageProcessMainWin.h: Added.
767
768 2017-09-08  Ryan Haddad  <ryanhaddad@apple.com>
769
770         Unreviewed, rolling out r221771.
771
772         This change caused two API tests to crash.
773
774         Reverted changeset:
775
776         "Clean up API::UIClient"
777         https://bugs.webkit.org/show_bug.cgi?id=176568
778         http://trac.webkit.org/changeset/221771
779
780 2017-09-07  Carlos Garcia Campos  <cgarcia@igalia.com>
781
782         [GTK][WPE] UI process crash in WebBackForwardList::restoreFromState
783         https://bugs.webkit.org/show_bug.cgi?id=176303
784
785         Reviewed by Michael Catanzaro.
786
787         Ensure the current index provided by the session state is not out of actual item list bounds. This is a bug in
788         the session state decoder, but WebBackForwardList::backForwardListState() is already doing the check and using
789         the last item index instead, so it's not easy to know where the actual problem is. In any case we should
790         still protect the decoder.
791
792         * UIProcess/API/glib/WebKitWebViewSessionState.cpp:
793         (decodeSessionState):
794
795 2017-09-07  Andy Estes  <aestes@apple.com>
796
797         [Mac] Upstream QTKit-related WebKitSystemInterface functions
798         https://bugs.webkit.org/show_bug.cgi?id=176472
799
800         Reviewed by Eric Carlson.
801
802         * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
803         (InitWebCoreSystemInterface):
804
805 2017-09-07  Alex Christensen  <achristensen@webkit.org>
806
807         Clean up API::UIClient
808         https://bugs.webkit.org/show_bug.cgi?id=176568
809
810         Reviewed by Brady Eidson.
811
812         We don't need createNewPage and createNewPageAsync.
813         An async version can support synchronous delegate calls by just calling the completion handler synchronously.
814
815         * UIProcess/API/APIUIClient.h:
816         (API::UIClient::createNewPage):
817         (API::UIClient::createNewPageAsync): Deleted.
818         (API::UIClient::canCreateNewPageAsync): Deleted.
819         * UIProcess/API/C/WKPage.cpp:
820         (WKPageSetPageUIClient):
821         * UIProcess/API/glib/WebKitUIClient.cpp:
822         * UIProcess/API/glib/WebKitUIClient.h:
823         * UIProcess/Cocoa/UIDelegate.h:
824         * UIProcess/Cocoa/UIDelegate.mm:
825         (WebKit::UIDelegate::UIClient::createNewPage):
826         (WebKit::UIDelegate::UIClient::createNewPageCommon): Deleted.
827         (WebKit::UIDelegate::UIClient::canCreateNewPageAsync): Deleted.
828         (WebKit::UIDelegate::UIClient::createNewPageAsync): Deleted.
829         * UIProcess/WebPageProxy.cpp:
830         (WebKit::WebPageProxy::createNewPage):
831         * UIProcess/WebPageProxy.h:
832
833 2017-09-07  Alex Christensen  <achristensen@webkit.org>
834
835         Make DragControllerAction an enum class
836         https://bugs.webkit.org/show_bug.cgi?id=176565
837
838         Reviewed by Andy Estes.
839
840         * Shared/DragControllerAction.h:
841         (): Deleted.
842         * UIProcess/WebPageProxy.cpp:
843         (WebKit::WebPageProxy::dragEntered):
844         (WebKit::WebPageProxy::dragUpdated):
845         (WebKit::WebPageProxy::dragExited):
846         (WebKit::WebPageProxy::performDragOperation):
847         * WebProcess/WebPage/WebPage.cpp:
848         (WebKit::WebPage::performDragControllerAction):
849         * WebProcess/WebPage/WebPage.h:
850         * WebProcess/WebPage/WebPage.messages.in:
851
852 2017-09-07  Myles C. Maxfield  <mmaxfield@apple.com>
853
854         [PAL] Unify PlatformUserPreferredLanguages.h with Language.h
855         https://bugs.webkit.org/show_bug.cgi?id=176561
856
857         Reviewed by Brent Fulgham.
858
859         * UIProcess/WebProcessPool.cpp:
860         * WebProcess/WebProcess.cpp:
861         (WebKit::WebProcess::userPreferredLanguagesChanged const):
862
863 2017-09-07  Youenn Fablet  <youenn@apple.com>
864
865         Remove entry from CacheStorageEngineConnection lock map when unlocking a Cache
866         https://bugs.webkit.org/show_bug.cgi?id=176548
867
868         Reviewed by Alex Christensen.
869
870         * NetworkProcess/cache/CacheStorageEngineConnection.cpp:
871         (WebKit::CacheStorageEngineConnection::dereference):
872
873 2017-09-07  Chris Dumez  <cdumez@apple.com>
874
875         [WK2] Add C API to retrieve the originating page of a WKDownload
876         https://bugs.webkit.org/show_bug.cgi?id=176557
877         <rdar://problem/34314776>
878
879         Reviewed by Alex Christensen.
880
881         Add C API to retrieve the original page of a WKDownload. This is the C API equivalent to
882         _WKDownload.originatingWebView which already exists in ObjC. The pointer is weak so as
883         to not keep alive the page for the duration of the download.
884
885         * UIProcess/API/C/WKDownload.cpp:
886         (WKDownloadGetOriginatingPage):
887         * UIProcess/API/C/WKDownload.h:
888         * UIProcess/API/Cocoa/_WKDownload.mm:
889         (-[_WKDownload originatingWebView]):
890         * UIProcess/API/Cocoa/_WKDownloadInternal.h:
891         * UIProcess/Downloads/DownloadProxy.cpp:
892         (WebKit::DownloadProxy::originatingPage const):
893         (WebKit::DownloadProxy::setOriginatingPage):
894         * UIProcess/Downloads/DownloadProxy.h:
895         * UIProcess/WebPageProxy.cpp:
896         (WebKit::WebPageProxy::receivedPolicyDecision):
897         * UIProcess/WebProcessPool.cpp:
898         (WebKit::WebProcessPool::download):
899         (WebKit::WebProcessPool::resumeDownload):
900         (WebKit::WebProcessPool::createDownloadProxy):
901         * UIProcess/WebProcessPool.h:
902         * UIProcess/ios/PageClientImplIOS.mm:
903         (WebKit::PageClientImpl::handleDownloadRequest):
904         * UIProcess/mac/PageClientImplMac.mm:
905         (WebKit::PageClientImpl::handleDownloadRequest):
906
907 2017-09-07  Alex Christensen  <achristensen@webkit.org>
908
909         Clean up Geolocation request handling
910         https://bugs.webkit.org/show_bug.cgi?id=176562
911
912         Reviewed by Tim Horton.
913
914         Instead of passing a GeolocationPermissionRequestProxy& to each client and returning a bool if the request will be handled,
915         pass a Function<void(bool)>&& completionHandler and return the function if it won't be handled.
916         This allows to temporarily support our UIClient/PageClient hybrid design while moving towards a sane design.
917
918         * UIProcess/API/APIUIClient.h:
919         (API::UIClient::Function<void):
920         (API::UIClient::decidePolicyForGeolocationPermissionRequest): Deleted.
921         * UIProcess/API/C/WKAPICast.h:
922         * UIProcess/API/C/WKGeolocationPermissionRequest.cpp:
923         (WKGeolocationPermissionRequestGetTypeID):
924         * UIProcess/API/C/WKPage.cpp:
925         (WKPageSetPageUIClient):
926         * UIProcess/GeolocationPermissionRequestProxy.cpp:
927         (WebKit::GeolocationPermissionRequestProxy::allow):
928         (WebKit::GeolocationPermissionRequestProxy::deny):
929         (WebKit::GeolocationPermissionRequestProxy::invalidate):
930         * UIProcess/GeolocationPermissionRequestProxy.h:
931         (WebKit::GeolocationPermissionRequest::create):
932         (WebKit::GeolocationPermissionRequest::allow):
933         (WebKit::GeolocationPermissionRequest::deny):
934         (WebKit::GeolocationPermissionRequest::GeolocationPermissionRequest):
935         * UIProcess/PageClient.h:
936         (WebKit::PageClient::decidePolicyForGeolocationPermissionRequest): Deleted.
937         * UIProcess/WebPageProxy.cpp:
938         (WebKit::WebPageProxy::requestGeolocationPermissionForFrame):
939         * UIProcess/ios/PageClientImplIOS.h:
940         * UIProcess/ios/PageClientImplIOS.mm:
941         (WebKit::Function<void):
942         (WebKit::PageClientImpl::decidePolicyForGeolocationPermissionRequest): Deleted.
943         * UIProcess/ios/WKContentView.h:
944         * UIProcess/ios/WKGeolocationProviderIOS.h:
945         * UIProcess/ios/WKGeolocationProviderIOS.mm:
946         (-[WKGeolocationProviderIOS decidePolicyForGeolocationRequestFromOrigin:frame:completionHandler:view:]):
947         (-[WKGeolocationProviderIOS geolocationAuthorizationGranted]):
948         (-[WKGeolocationProviderIOS geolocationAuthorizationDenied]):
949         (-[WKWebAllowDenyPolicyListener initWithCompletionHandler:]):
950         (-[WKWebAllowDenyPolicyListener allow]):
951         (-[WKWebAllowDenyPolicyListener deny]):
952         (-[WKGeolocationProviderIOS decidePolicyForGeolocationRequestFromOrigin:frame:request:view:]): Deleted.
953         (-[WKWebAllowDenyPolicyListener initWithPermissionRequestProxy:]): Deleted.
954
955 2017-09-07  Alex Christensen  <achristensen@webkit.org>
956
957         Allow modern decoding of enums and OptionSets
958         https://bugs.webkit.org/show_bug.cgi?id=176480
959
960         Reviewed by Andy Estes.
961
962         * Platform/IPC/ArgumentCoders.h:
963         (IPC::ArgumentCoder<OptionSet<T>>::decode):
964         * Platform/IPC/Decoder.h:
965         (IPC::Decoder::operator>>):
966         * Platform/IPC/Encoder.h:
967         * Shared/WebsitePolicies.h:
968         (WebKit::WebsitePolicies::encode const):
969         (WebKit::WebsitePolicies::decode):
970
971 2017-09-07  Frederic Wang  <fwang@igalia.com>
972
973          Move more code from ScrollingTreeScrollingNodeDelegateIOS to ScrollingTreeScrollingNodeDelegate
974          https://bugs.webkit.org/show_bug.cgi?id=174130
975
976          Reviewed by Simon Fraser.
977
978          * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.h: Remove some members,
979          headers and pre-declaration that are moved into the delegate.
980          (WebKit::ScrollingTreeOverflowScrollingNodeIOS::scrollLayer): Deleted.
981          * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.mm: Remove some headers and
982          WKOverflowScrollViewDelegate since they are moved into the delegate file. Also fix the
983          comment to closing the WebKit namespace.
984          (WebKit::ScrollingTreeOverflowScrollingNodeIOS::~ScrollingTreeOverflowScrollingNodeIOS):
985          Remove some code moved into the delegate and call the corresponding helper function to
986          preserve the current behavior.
987          (WebKit::ScrollingTreeOverflowScrollingNodeIOS::commitStateBeforeChildren): Ditto.
988          Note that it is only necessary to cast the parameter to a ScrollingStateTreeNode.
989          (WebKit::ScrollingTreeOverflowScrollingNodeIOS::commitStateAfterChildren): Ditto.
990          (WebKit::ScrollingTreeOverflowScrollingNodeIOS::updateLayersAfterAncestorChange): Ditto.
991          (WebKit::ScrollingTreeOverflowScrollingNodeIOS::scrollPosition): Ditto.
992          (WebKit::ScrollingTreeOverflowScrollingNodeIOS::setScrollLayerPosition): Ditto.
993          (-[WKOverflowScrollViewDelegate initWithScrollingTreeNodeDelegate:]): Deleted.
994          (-[WKOverflowScrollViewDelegate scrollViewDidScroll:]): Deleted.
995          (-[WKOverflowScrollViewDelegate scrollViewWillBeginDragging:]): Deleted.
996          (-[WKOverflowScrollViewDelegate scrollViewWillEndDragging:withVelocity:targetContentOffset:]): Deleted.
997          (-[WKOverflowScrollViewDelegate scrollViewDidEndDragging:willDecelerate:]): Deleted.
998          (-[WKOverflowScrollViewDelegate scrollViewDidEndDecelerating:]): Deleted.
999          * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h: Import headers and members
1000          from ScrollingTreeOverflowScrollingNodeIOS. Define new helper functions for the code imported
1001          from ScrollingTreeOverflowScrollingNodeIOS. Remove the friendship with
1002          ScrollingTreeOverflowScrollingNodeIOS and only makes public the function used by that class.
1003          (WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollLayer): This function is moved from
1004          ScrollingTreeOverflowScrollingNodeIOS.
1005          * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm: Add headers,
1006          WKOverflowScrollViewDelegate (renamed WKScrollingNodeScrollViewDelegate) and some helper code
1007          imported from ScrollingTreeOverflowScrollingNodeIOS.
1008          (-[WKScrollingNodeScrollViewDelegate scrollViewDidScroll:]): Moved from
1009          ScrollingTreeOverflowScrollingNodeIOS.
1010          (-[WKScrollingNodeScrollViewDelegate scrollViewWillBeginDragging:]): Ditto.
1011          (-[WKScrollingNodeScrollViewDelegate scrollViewWillEndDragging:withVelocity:targetContentOffset:]): Ditto.
1012          (-[WKScrollingNodeScrollViewDelegate scrollViewDidEndDragging:willDecelerate:]): Ditto.
1013          (-[WKScrollingNodeScrollViewDelegate scrollViewDidEndDecelerating:]): Ditto.
1014          (WebKit::ScrollingTreeScrollingNodeDelegateIOS::~ScrollingTreeScrollingNodeDelegateIOS):
1015          Import code from ScrollingTreeOverflowScrollingNodeIOS.
1016          (WebKit::ScrollingTreeScrollingNodeDelegateIOS::resetScrollViewDelegate): New helper function
1017          importing code from ScrollingTreeOverflowScrollingNodeIOS.
1018          (WebKit::ScrollingTreeScrollingNodeDelegateIOS::commitStateBeforeChildren): Ditto.
1019          (WebKit::ScrollingTreeScrollingNodeDelegateIOS::commitStateAfterChildren): Ditto.
1020          (WebKit::ScrollingTreeScrollingNodeDelegateIOS::updateLayersAfterAncestorChange): Ditto.
1021          (WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollPosition): Ditto.
1022          (WebKit::ScrollingTreeScrollingNodeDelegateIOS::setScrollLayerPosition): Ditto.
1023
1024 2017-09-07  Chris Dumez  <cdumez@apple.com>
1025
1026         [WK2] Notify client when downloads are redirected
1027         https://bugs.webkit.org/show_bug.cgi?id=176481
1028         <rdar://problem/34309065>
1029
1030         Reviewed by Geoffrey Garen.
1031
1032         Notify client when downloads are redirected via both ObjC and C
1033         API.
1034
1035         * NetworkProcess/Downloads/Download.cpp:
1036         (WebKit::Download::willSendRedirectedRequest):
1037         * NetworkProcess/Downloads/Download.h:
1038         * NetworkProcess/Downloads/mac/DownloadMac.mm:
1039         (-[WKDownloadAsDelegate download:willSendRequest:redirectResponse:]):
1040         * UIProcess/API/APIDownloadClient.h:
1041         (API::DownloadClient::willSendRequest):
1042         * UIProcess/API/C/WKContext.cpp:
1043         (WKContextSetDownloadClient):
1044         * UIProcess/API/C/WKContextDownloadClient.h:
1045         * UIProcess/API/Cocoa/_WKDownloadDelegate.h:
1046         * UIProcess/Cocoa/DownloadClient.h:
1047         * UIProcess/Cocoa/DownloadClient.mm:
1048         (WebKit::DownloadClient::DownloadClient):
1049         (WebKit::DownloadClient::willSendRequest):
1050         * UIProcess/Downloads/DownloadProxy.cpp:
1051         (WebKit::DownloadProxy::willSendRequest):
1052         * UIProcess/Downloads/DownloadProxy.h:
1053         * UIProcess/Downloads/DownloadProxy.messages.in:
1054
1055         * UIProcess/mac/WebContextMenuProxyMac.mm:
1056         (WebKit::WebContextMenuProxyMac::showContextMenuWithItems):
1057         Set menu proxy before calling menuFromProposedMenu() client delegate.
1058         This allows me to perform one of the menu item's action from the
1059         menuFromProposedMenu() client delegate in my API test.
1060
1061 2017-09-07  Alex Christensen  <achristensen@webkit.org>
1062
1063         Modernize Geolocation code
1064         https://bugs.webkit.org/show_bug.cgi?id=176496
1065
1066         Reviewed by Andy Estes.
1067
1068         Making the GeolocationPermissionRequestManager take a reference instead of a pointer
1069         spilled into making the other supplement constructors do the same.
1070
1071         * NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.cpp:
1072         (WebKit::LegacyCustomProtocolManager::LegacyCustomProtocolManager):
1073         (WebKit::LegacyCustomProtocolManager::startLoading):
1074         (WebKit::LegacyCustomProtocolManager::stopLoading):
1075         * NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.h:
1076         * NetworkProcess/NetworkProcess.h:
1077         (WebKit::NetworkProcess::addSupplement):
1078         * Shared/Authentication/AuthenticationManager.cpp:
1079         (WebKit::AuthenticationManager::AuthenticationManager):
1080         (WebKit::AuthenticationManager::didReceiveAuthenticationChallenge):
1081         * Shared/Authentication/AuthenticationManager.h:
1082         * UIProcess/API/APIUIClient.h:
1083         (API::UIClient::decidePolicyForGeolocationPermissionRequest):
1084         * UIProcess/API/C/WKPage.cpp:
1085         (WKPageSetPageUIClient):
1086         * UIProcess/WebPageProxy.cpp:
1087         (WebKit::WebPageProxy::requestGeolocationPermissionForFrame):
1088         * WebProcess/Cookies/WebCookieManager.cpp:
1089         (WebKit::WebCookieManager::WebCookieManager):
1090         (WebKit::WebCookieManager::getHostnamesWithCookies):
1091         (WebKit::WebCookieManager::deleteCookie):
1092         (WebKit::WebCookieManager::deleteAllCookiesModifiedSince):
1093         (WebKit::WebCookieManager::getAllCookies):
1094         (WebKit::WebCookieManager::getCookies):
1095         (WebKit::WebCookieManager::setCookie):
1096         (WebKit::WebCookieManager::setCookies):
1097         (WebKit::WebCookieManager::notifyCookiesDidChange):
1098         (WebKit::WebCookieManager::setHTTPCookieAcceptPolicy):
1099         (WebKit::WebCookieManager::getHTTPCookieAcceptPolicy):
1100         * WebProcess/Cookies/WebCookieManager.h:
1101         * WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp:
1102         (WebKit::GeolocationPermissionRequestManager::GeolocationPermissionRequestManager):
1103         (WebKit::GeolocationPermissionRequestManager::startRequestForGeolocation):
1104         (WebKit::GeolocationPermissionRequestManager::cancelRequestForGeolocation):
1105         * WebProcess/Geolocation/GeolocationPermissionRequestManager.h:
1106         * WebProcess/Geolocation/WebGeolocationManager.cpp:
1107         (WebKit::WebGeolocationManager::WebGeolocationManager):
1108         (WebKit::WebGeolocationManager::registerWebPage):
1109         (WebKit::WebGeolocationManager::unregisterWebPage):
1110         (WebKit::WebGeolocationManager::setEnableHighAccuracyForPage):
1111         (WebKit::WebGeolocationManager::didChangePosition):
1112         (WebKit::WebGeolocationManager::didFailToDeterminePosition):
1113         (WebKit::WebGeolocationManager::resetPermissions):
1114         * WebProcess/Geolocation/WebGeolocationManager.h:
1115         * WebProcess/MediaCache/WebMediaKeyStorageManager.h:
1116         (WebKit::WebMediaKeyStorageManager::WebMediaKeyStorageManager):
1117         * WebProcess/Notifications/WebNotificationManager.cpp:
1118         (WebKit::WebNotificationManager::WebNotificationManager):
1119         (WebKit::WebNotificationManager::show):
1120         (WebKit::WebNotificationManager::cancel):
1121         (WebKit::WebNotificationManager::clearNotifications):
1122         (WebKit::WebNotificationManager::didDestroyNotification):
1123         * WebProcess/Notifications/WebNotificationManager.h:
1124         * WebProcess/WebCoreSupport/WebGeolocationClient.cpp:
1125         (WebKit::WebGeolocationClient::requestPermission):
1126         (WebKit::WebGeolocationClient::cancelPermissionRequest):
1127         * WebProcess/WebCoreSupport/WebGeolocationClient.h:
1128         (WebKit::WebGeolocationClient::WebGeolocationClient):
1129         * WebProcess/WebPage/WebPage.cpp:
1130         (WebKit::m_cpuLimit):
1131         * WebProcess/WebProcess.h:
1132         (WebKit::WebProcess::addSupplement):
1133         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
1134         (WebKit::UserMediaCaptureManager::UserMediaCaptureManager):
1135         * WebProcess/cocoa/UserMediaCaptureManager.h:
1136
1137 2017-09-06  Alex Christensen  <achristensen@webkit.org>
1138
1139         Add WKUIDelegatePrivate equivalent of WKPageUIClient's pageDidScroll
1140         https://bugs.webkit.org/show_bug.cgi?id=176482
1141         <rdar://problem/29270035>
1142
1143         Reviewed by Tim Horton.
1144         
1145         Covered by a new API test!
1146
1147         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
1148         * UIProcess/Cocoa/UIDelegate.h:
1149         * UIProcess/Cocoa/UIDelegate.mm:
1150         (WebKit::UIDelegate::setDelegate):
1151         (WebKit::UIDelegate::UIClient::pageDidScroll):
1152
1153 2017-09-06  Youenn Fablet  <youenn@apple.com>
1154
1155         NetworkProcess Cache and Caches should be cleared when the last related WebProcess Cache or CacheStorage is destroyed
1156         https://bugs.webkit.org/show_bug.cgi?id=176249
1157
1158         Reviewed by Alex Christensen.
1159
1160         CacheStorageEngineConnection will store the number of Caches references for its related WebProcess.
1161         For a new reference, CacheStorageEngineConnection will notify its engine to lock the related Cache.
1162         When the last reference is gone, CacheStorageEngineConnection will ask the engine to release the lock.
1163
1164         CacheStorageEngine will keep locks as a counter for each Cache object.
1165         When the counter goes to zero, the engine asks the Cache to dispose itself.
1166         Disposal is done by its parent Caches as only Caches knows whether the Cache is persistent or has been removed.
1167
1168         The Caches will remove the Cache from memory.
1169         For removed caches, all information will be lost.
1170         For caches that are not removed, they will keep their identifiers but all in-memory record information will be discarded.
1171         If there is a need to reopen the Cache, it will need to read its information from the filesystem.
1172         If the Caches has no longer any active Cache object, it will ask the engine to release itself.
1173
1174         WebProcess crashing is handled correctly as the CacheStorageEngineConnection will release its locks at destruction
1175         time of the connection to the web process.
1176
1177         Adding the possiblity to grab an engine representation for test purposes.
1178
1179         * NetworkProcess/cache/CacheStorageEngine.cpp:
1180         (WebKit::CacheStorage::Engine::readCachesFromDisk):
1181         (WebKit::CacheStorage::Engine::removeCaches):
1182         (WebKit::CacheStorage::Engine::lock):
1183         (WebKit::CacheStorage::Engine::unlock):
1184         * NetworkProcess/cache/CacheStorageEngine.h:
1185         * NetworkProcess/cache/CacheStorageEngineCache.cpp:
1186         (WebKit::CacheStorage::Cache::Cache):
1187         (WebKit::CacheStorage::Cache::dispose):
1188         (WebKit::CacheStorage::Cache::clearMemoryRepresentation):
1189         * NetworkProcess/cache/CacheStorageEngineCache.h:
1190         (WebKit::CacheStorage::Cache::isActive const):
1191         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
1192         (WebKit::CacheStorage::Caches::Caches):
1193         (WebKit::CacheStorage::Caches::open):
1194         (WebKit::CacheStorage::Caches::dispose):
1195         (WebKit::CacheStorage::Caches::readCachesFromDisk):
1196         (WebKit::CacheStorage::Caches::clearMemoryRepresentation):
1197         * NetworkProcess/cache/CacheStorageEngineCaches.h:
1198         (WebKit::CacheStorage::Caches::create):
1199         * NetworkProcess/cache/CacheStorageEngineConnection.cpp:
1200         (WebKit::CacheStorageEngineConnection::~CacheStorageEngineConnection):
1201         (WebKit::CacheStorageEngineConnection::reference):
1202         (WebKit::CacheStorageEngineConnection::dereference):
1203         * NetworkProcess/cache/CacheStorageEngineConnection.h:
1204         * NetworkProcess/cache/CacheStorageEngineConnection.messages.in:
1205         * WebProcess/Cache/WebCacheStorageConnection.cpp:
1206         (WebKit::WebCacheStorageConnection::reference):
1207         (WebKit::WebCacheStorageConnection::dereference):
1208         * WebProcess/Cache/WebCacheStorageConnection.h:
1209
1210 2017-09-06  Alex Christensen  <achristensen@webkit.org>
1211
1212         Add WKUIDelegatePrivate equivalent of WKPageUIClient's pinnedStateDidChange
1213         https://bugs.webkit.org/show_bug.cgi?id=176474
1214         <rdar://problem/29270035>
1215
1216         Reviewed by Tim Horton.
1217
1218         Rather than telling the UIClient that the pinned state changed and having the application check 4 bools
1219         like we do with WKPage, I made a KVO property on the WKWebView.  I introduce _WKRectEdge for this purpose,
1220         which is like UIRectEdge but unfortunately NSRectEdge and CGRectEdge cannot be used as NS_OPTIONS/flags.
1221         This same structure is used for rubber band state.
1222         
1223         Covered by a new API test.
1224
1225         * UIProcess/API/Cocoa/WKWebView.mm:
1226         (-[WKWebView _pinnedState]):
1227         (-[WKWebView _rubberBandState]):
1228         (-[WKWebView _setRubberBandState:]):
1229         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1230         * UIProcess/Cocoa/WebViewImpl.h:
1231         * UIProcess/Cocoa/WebViewImpl.mm:
1232         (WebKit::WebViewImpl::pinnedState):
1233         (WebKit::WebViewImpl::rubberBandState):
1234         (WebKit::WebViewImpl::setRubberBandState):
1235         * UIProcess/PageClient.h:
1236         (WebKit::PageClient::pinnedStateWillChange):
1237         (WebKit::PageClient::pinnedStateDidChange):
1238         * UIProcess/WebPageProxy.cpp:
1239         (WebKit::WebPageProxy::didChangeScrollOffsetPinningForMainFrame):
1240         * UIProcess/mac/PageClientImplMac.h:
1241         * UIProcess/mac/PageClientImplMac.mm:
1242         (WebKit::PageClientImpl::pinnedStateWillChange):
1243         (WebKit::PageClientImpl::pinnedStateDidChange):
1244
1245 2017-09-06  Youenn Fablet  <youenn@apple.com>
1246
1247         Introduce asynchronous opening of CacheStorageEngine cache
1248         https://bugs.webkit.org/show_bug.cgi?id=176425
1249
1250         Reviewed by Alex Christensen.
1251
1252         Introducing Cache::open to allow reading from the filesystem to fill the Cache.
1253         This is called by Caches when engine requests to open an existing Cache.
1254
1255         * NetworkProcess/cache/CacheStorageEngineCache.cpp:
1256         (WebKit::CacheStorage::Cache::Cache):
1257         (WebKit::CacheStorage::Cache::open):
1258         (WebKit::CacheStorage::Cache::finishOpening):
1259         (WebKit::CacheStorage::Cache::readRecordsList):
1260         * NetworkProcess/cache/CacheStorageEngineCache.h:
1261         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
1262         (WebKit::CacheStorage::Caches::find):
1263         (WebKit::CacheStorage::Caches::open):
1264         (WebKit::CacheStorage::Caches::remove):
1265         (WebKit::CacheStorage::Caches::readCachesFromDisk):
1266         (WebKit::CacheStorage::Caches::find const): Deleted.
1267         * NetworkProcess/cache/CacheStorageEngineCaches.h:
1268
1269 2017-09-06  Alex Christensen  <achristensen@webkit.org>
1270
1271         Unreviewed, rolling out r221694.
1272
1273         broke build
1274
1275         Reverted changeset:
1276
1277         "Add WKUIDelegatePrivate equivalent of WKPageUIClient's
1278         pinnedStateDidChange"
1279         https://bugs.webkit.org/show_bug.cgi?id=176474
1280         http://trac.webkit.org/changeset/221694
1281
1282 2017-09-06  Ryan Haddad  <ryanhaddad@apple.com>
1283
1284         Unreviewed, rolling out r221461.
1285
1286         The LayoutTest added with this change crashes under
1287         GuardMalloc.
1288
1289         Reverted changeset:
1290
1291         "Add (entirely incorrect) fetching of ServiceWorker scripts."
1292         https://bugs.webkit.org/show_bug.cgi?id=176179
1293         http://trac.webkit.org/changeset/221461
1294
1295 2017-09-06  Alex Christensen  <achristensen@webkit.org>
1296
1297         Add modern decoders for POD types
1298         https://bugs.webkit.org/show_bug.cgi?id=176456
1299
1300         Reviewed by Geoffrey Garen.
1301
1302         * Platform/IPC/Decoder.cpp:
1303         (IPC::Decoder::getOptional):
1304         (IPC::Decoder::operator>>):
1305         * Platform/IPC/Decoder.h:
1306         * Shared/NavigationActionData.cpp:
1307         (WebKit::NavigationActionData::decode):
1308         * Shared/NavigationActionData.h:
1309
1310 2017-09-06  Alex Christensen  <achristensen@webkit.org>
1311
1312         Add WKUIDelegatePrivate equivalent of WKPageUIClient's pinnedStateDidChange
1313         https://bugs.webkit.org/show_bug.cgi?id=176474
1314         <rdar://problem/29270035>
1315
1316         Reviewed by Tim Horton.
1317
1318         Rather than telling the UIClient that the pinned state changed and having the application check 4 bools
1319         like we do with WKPage, I made a KVO property on the WKWebView.  I introduce _WKRectEdge for this purpose,
1320         which is like UIRectEdge but unfortunately NSRectEdge and CGRectEdge cannot be used as NS_OPTIONS/flags.
1321         This same structure is used for rubber band state.
1322         
1323         Covered by a new API test.
1324
1325         * UIProcess/API/Cocoa/WKWebView.mm:
1326         (-[WKWebView _pinnedState]):
1327         (-[WKWebView _rubberBandState]):
1328         (-[WKWebView _setRubberBandState:]):
1329         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1330         * UIProcess/Cocoa/WebViewImpl.h:
1331         * UIProcess/Cocoa/WebViewImpl.mm:
1332         (WebKit::WebViewImpl::pinnedState):
1333         (WebKit::WebViewImpl::rubberBandState):
1334         (WebKit::WebViewImpl::setRubberBandState):
1335         * UIProcess/PageClient.h:
1336         (WebKit::PageClient::pinnedStateWillChange):
1337         (WebKit::PageClient::pinnedStateDidChange):
1338         * UIProcess/WebPageProxy.cpp:
1339         (WebKit::WebPageProxy::didChangeScrollOffsetPinningForMainFrame):
1340         * UIProcess/mac/PageClientImplMac.h:
1341         * UIProcess/mac/PageClientImplMac.mm:
1342         (WebKit::PageClientImpl::pinnedStateWillChange):
1343         (WebKit::PageClientImpl::pinnedStateDidChange):
1344
1345 2017-09-06  Brent Fulgham  <bfulgham@apple.com>
1346
1347         Deny third-party cookie creation for prevalent resources without interaction
1348         https://bugs.webkit.org/show_bug.cgi?id=175232
1349         <rdar://problem/33709386>
1350
1351         Reviewed by Alex Christensen.
1352
1353         Prior to Intelligent Tracking Prevention, WebKit would deny the ability to create a third party cookie if the user's
1354         settings prohibited it. Due to the internal mechanics of cookie partitioning, we now accept the third party cookie,
1355         but destroy it at some arbitrary moment which is difficult for websites to work with.
1356         
1357         This patch revises WebKit so that attempts to set third party cookies without user interaction fails immediately,
1358         which is what sites are expecting from Safari.
1359
1360         * NetworkProcess/NetworkProcess.cpp:
1361         (WebKit::NetworkProcess::updatePrevalentDomainsWithAndWithoutInteraction):
1362         (WebKit::NetworkProcess::updateCookiePartitioningForTopPrivatelyOwnedDomains): Renamed to updatePrevalentDomainsWithAndWithoutInteraction.
1363         * NetworkProcess/NetworkProcess.h:
1364         * NetworkProcess/NetworkProcess.messages.in: Renamed the UpdateCookiePartitioningForTopPrivatelyOwnedDomains message
1365         to UpdatePrevalentDomainsWithAndWithoutInteraction.
1366         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
1367         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa): Recognize cases where a network session should block cookies, and
1368         use the stateless session so we fail immediately when attempting an invalid cookie set operation.
1369         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
1370         (WebKit::WKWebsiteDataStore::_resourceLoadStatisticsSetShouldPartitionCookies): Use new helper function to clear partitioning state.
1371         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1372         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore): Update for revised naming.
1373         (WebKit::WebResourceLoadStatisticsStore::updateCookiePartitioning): Track domains with and without interaction so that we can recognize
1374         domains that should be immediately blocked from setting cookies.
1375         (WebKit::WebResourceLoadStatisticsStore::updateCookiePartitioningForDomains): Update for revised naming.
1376         (WebKit::WebResourceLoadStatisticsStore::scheduleClearPartitioningStateForDomains): Added helper function for testing.
1377         * UIProcess/WebResourceLoadStatisticsStore.h:
1378         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1379         (WebKit::WebsiteDataStore::updatePrevalentDomainsWithAndWithoutInteraction): Update for revised naming.
1380         (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback): Ditto.
1381         (WebKit::WebsiteDataStore::updateCookiePartitioningForTopPrivatelyOwnedDomains): Renamed to updatePrevalentDomainsWithAndWithoutInteraction.
1382         * UIProcess/WebsiteData/WebsiteDataStore.h:
1383
1384 2017-09-06  Adrian Perez de Castro  <aperez@igalia.com>
1385
1386         [WPE][CMake] Fix path to the WebKitApplicationInfo.h header.
1387
1388         Unreviewed build fix.
1389
1390         This doesn't really make a difference for the build bots, but it makes
1391         it possible to craft working release tarballs of WPE.
1392
1393         * PlatformWPE.cmake: Use the WPE version of WebKitApplicationInfo.h
1394
1395 2017-09-06  Frédéric Wang  <fwang@igalia.com>
1396
1397         Introduce ScrollingTreeScrollingNodeDelegateIOS to share code between overflow and frame scrolling
1398         https://bugs.webkit.org/show_bug.cgi?id=174097
1399
1400         Reviewed by Darin Adler.
1401
1402         This patch introduces a new ScrollingTreeScrollingNodeDelegateIOS that can be used by
1403         WKOverflowScrollViewDelegate to communicate to the scrolling tree and nodes. It can also be
1404         used as a helper class by ScrollingTreeOverflowScrollingNodeIOS. For now, only the non-
1405         overriden member functions of ScrollingTreeOverflowScrollingNodeIOS are moved to that new
1406         class. In follow-up commits, WKOverflowScrollViewDelegate can become a generic
1407         ScrollViewDelegate and more code can be moved into the ScrollingTreeScrollingNodeDelegateIOS
1408         file. Frame scrolling nodes will then be able to share the same UI code as overflow:auto when
1409         iOS frame scrolling is implemented (bug 149264).
1410
1411         * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.h: Move non-overriden member
1412         functions and m_updatingFromStateNode into the delegate class. Also define a member to store
1413         that delegate.
1414         * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.mm: Use the node delegate to
1415         communicate to the scrolling tree and node.
1416         (-[WKOverflowScrollViewDelegate initWithScrollingTreeNodeDelegate:]): Init with a delegate.
1417         (-[WKOverflowScrollViewDelegate scrollViewDidScroll:]): Call the delegate function.
1418         (-[WKOverflowScrollViewDelegate scrollViewWillBeginDragging:]): Ditto.
1419         (-[WKOverflowScrollViewDelegate scrollViewWillEndDragging:withVelocity:targetContentOffset:]):
1420         Use the delegate functions or pass by ScrollingTreeScrollingNodeDelegateIOS::scrollingNode().
1421         (-[WKOverflowScrollViewDelegate scrollViewDidEndDragging:willDecelerate:]): Use the delegate
1422         functions.
1423         (-[WKOverflowScrollViewDelegate scrollViewDidEndDecelerating:]): Ditto.
1424         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::ScrollingTreeOverflowScrollingNodeIOS):
1425         Init the delegate for this class.
1426         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::commitStateAfterChildren): Use the delegate.
1427         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::setScrollLayerPosition): Use the delegate
1428         function.
1429         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::updateLayersAfterDelegatedScroll): Ditto.
1430         (-[WKOverflowScrollViewDelegate initWithScrollingTreeNode:]): Deleted. This is renamed
1431         initWithScrollingTreeNodeDelegate and accepts a delegate.
1432         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::updateChildNodesAfterScroll): Deleted. Moved
1433         to ScrollingTreeScrollingNodeDelegateIOS.
1434         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::overflowScrollWillStart): Ditto.
1435         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::overflowScrollDidEnd): Ditto.
1436         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::overflowScrollViewWillStartPanGesture): Ditto.
1437         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::scrollViewDidScroll): Ditto.
1438         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::currentSnapPointIndicesDidChange): Ditto.
1439         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h: Added. New delegate class
1440         for ScrollingTreeOverflowScrollingNodeIOS. The members used by WKOverflowScrollViewDelegate
1441         are public and the others are private. ScrollingTreeOverflowScrollingNodeIOS is a friend of
1442         ScrollingTreeScrollingNodeDelegateIOS so that it can access private members e.g.
1443         updateChildNodesAfterScroll() or  m_updatingFromStateNode.
1444         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm: Added.
1445         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::ScrollingTreeScrollingNodeDelegateIOS):
1446         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::~ScrollingTreeScrollingNodeDelegateIOS):
1447         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::updateChildNodesAfterScroll): Code extracted
1448         from ScrollingTreeOverflowScrollingNodeIOS.
1449         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollWillStart): Ditto.
1450         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollDidEnd): Ditto.
1451         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollViewWillStartPanGesture): Ditto.
1452         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollViewDidScroll): Ditto.
1453         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::currentSnapPointIndicesDidChange): Ditto.
1454         * WebKit.xcodeproj/project.pbxproj: Add ScrollingTreeScrollingNodeDelegateIOS files to the
1455         build system.
1456
1457 2017-09-05  Wenson Hsieh  <wenson_hsieh@apple.com>
1458
1459         [iOS WK2] Add plumbing for WKContentView to ask the web process for additional drag items
1460         https://bugs.webkit.org/show_bug.cgi?id=176348
1461         Work towards <rdar://problem/31144674>
1462
1463         Reviewed by Tim Horton.
1464
1465         Adds boilerplate plumbing to request additional items to an existing session. This implements some UI-side logic
1466         in WKContentView to send an additional drag items request and handle a response from the web process. 
1467         To start, WebPageProxy::requestAdditionalItemsForDragSession is invoked by -_dragInteraction:
1468         itemsForAddingToSession:withTouchAtPoint:completion: in WKContentView, and the response from the web process is
1469         handled in -[WKContentView _didHandleAdditionalDragItemsRequest:].
1470
1471         * UIProcess/API/Cocoa/WKWebView.mm:
1472         (-[WKWebView _simulateItemsForAddingToSession:atLocation:completion:]):
1473         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1474
1475         Add SPI to simulate a request for additional drag items. See Tools/ChangeLog for more detail.
1476
1477         * UIProcess/PageClient.h:
1478         * UIProcess/WebPageProxy.h:
1479         * UIProcess/WebPageProxy.messages.in:
1480
1481         Add an IPC message handler for the additional drag items response from the web process.
1482
1483         * UIProcess/ios/DragDropInteractionState.h:
1484         (WebKit::DragDropInteractionState::BlockPtr<void):
1485         * UIProcess/ios/DragDropInteractionState.mm:
1486         (WebKit::DragDropInteractionState::shouldRequestAdditionalItemForDragSession const):
1487         (WebKit::DragDropInteractionState::dragSessionWillRequestAdditionalItem):
1488
1489         Invoke the new additional items completion handler when tearing down to avoid getting UIKit into a bad state.
1490
1491         (WebKit::DragDropInteractionState::dragAndDropSessionsDidEnd):
1492         * UIProcess/ios/PageClientImplIOS.h:
1493         * UIProcess/ios/PageClientImplIOS.mm:
1494         (WebKit::PageClientImpl::didHandleAdditionalDragItemsRequest):
1495         * UIProcess/ios/WKContentViewInteraction.h:
1496         * UIProcess/ios/WKContentViewInteraction.mm:
1497         (-[WKContentView _didHandleAdditionalDragItemsRequest:]):
1498         (-[WKContentView _itemsForBeginningOrAddingToSessionWithRegistrationList:stagedDragSource:]):
1499
1500         Factors common logic to convert a staged WebItemProviderRegistrationInfoList and DragSourceState into a list of
1501         drag items, invoking the private UI delegate in the process. This is called both when starting a drag session,
1502         and adding items to an existing drag session.
1503
1504         (-[WKContentView _dragInteraction:itemsForAddingToSession:withTouchAtPoint:completion:]):
1505
1506         Implements a (proposed) additional drag item delegate that serves as an asynchronous alternative to the API
1507         variant, -_dragInteraction:itemsForAddingToSession:withTouchAtPoint:. See <rdar://problem/33146803> for more
1508         information.
1509
1510         (-[WKContentView dragInteraction:itemsForBeginningSession:]):
1511
1512         Refactored to use -_itemsForBeginningOrAddingToSessionWithRegistrationList:stagedDragSource:.
1513
1514         (-[WKContentView _simulateItemsForAddingToSession:atLocation:completion:]):
1515         * UIProcess/ios/WebPageProxyIOS.mm:
1516         (WebKit::WebPageProxy::didHandleAdditionalDragItemsRequest):
1517         (WebKit::WebPageProxy::requestAdditionalItemsForDragSession):
1518         * WebProcess/WebPage/WebPage.h:
1519         * WebProcess/WebPage/WebPage.messages.in:
1520
1521         Add an IPC message handler for the additional drag items request from the UI process.
1522
1523         * WebProcess/WebPage/ios/WebPageIOS.mm:
1524         (WebKit::WebPage::requestAdditionalItemsForDragSession):
1525
1526 2017-09-05  Alex Christensen  <achristensen@webkit.org>
1527
1528         Add WKUIDelegatePrivate equivalent of WKPageUIClient's mouseDidMoveOverElement
1529         https://bugs.webkit.org/show_bug.cgi?id=176428
1530         <rdar://problem/29270035>
1531
1532         Reviewed by Tim Horton.
1533
1534         Covered by a new API test.
1535
1536         * UIProcess/API/APIUIClient.h:
1537         (API::UIClient::mouseDidMoveOverElement):
1538         * UIProcess/API/C/WKPage.cpp:
1539         (WKPageSetPageUIClient):
1540         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
1541         * UIProcess/Cocoa/UIDelegate.h:
1542         * UIProcess/Cocoa/UIDelegate.mm:
1543         (WebKit::UIDelegate::setDelegate):
1544         (WebKit::UIDelegate::ContextMenuClient::menuFromProposedMenu):
1545         (WebKit::UIDelegate::UIClient::createNewPageCommon):
1546         (WebKit::UIDelegate::UIClient::runJavaScriptAlert):
1547         (WebKit::UIDelegate::UIClient::runJavaScriptConfirm):
1548         (WebKit::UIDelegate::UIClient::runJavaScriptPrompt):
1549         (WebKit::UIDelegate::UIClient::runBeforeUnloadConfirmPanel):
1550         (WebKit::UIDelegate::UIClient::takeFocus):
1551         (WebKit::UIDelegate::UIClient::focus):
1552         (WebKit::UIDelegate::UIClient::unfocus):
1553         (WebKit::UIDelegate::UIClient::didExceedBackgroundResourceLimitWhileInForeground):
1554         (WebKit::UIDelegate::UIClient::didNotHandleWheelEvent):
1555         (WebKit::toNSEventModifierFlags):
1556         (WebKit::UIDelegate::UIClient::mouseDidMoveOverElement):
1557         (WebKit::UIDelegate::UIClient::toolbarsAreVisible):
1558         (WebKit::UIDelegate::UIClient::didClickAutoFillButton):
1559         (WebKit::UIDelegate::UIClient::handleAutoplayEvent):
1560         (WebKit::requestUserMediaAuthorizationForDevices):
1561         (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest):
1562         (WebKit::UIDelegate::UIClient::checkUserMediaPermissionForOrigin):
1563         (WebKit::UIDelegate::UIClient::printFrame):
1564         (WebKit::UIDelegate::UIClient::close):
1565         (WebKit::UIDelegate::UIClient::fullscreenMayReturnToInline):
1566         (WebKit::UIDelegate::UIClient::didEnterFullscreen):
1567         (WebKit::UIDelegate::UIClient::didExitFullscreen):
1568         (WebKit::UIDelegate::UIClient::requestPointerLock):
1569         (WebKit::UIDelegate::UIClient::didLosePointerLock):
1570         (WebKit::UIDelegate::UIClient::hasVideoInPictureInPictureDidChange):
1571         * UIProcess/WebPageProxy.cpp:
1572         (WebKit::WebPageProxy::mouseDidMoveOverElement):
1573         * UIProcess/WebPageProxy.h:
1574
1575 2017-09-05  Brent Fulgham  <bfulgham@apple.com>
1576
1577         Relax keychain access to permit users to permanently allow client certificates
1578         https://bugs.webkit.org/show_bug.cgi?id=175857
1579         <rdar://problem/32293867>
1580
1581         Reviewed by Alex Christensen.
1582
1583         Further relax the write permissions on the user's Keychain directory to support local certificates.
1584
1585         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
1586         * WebProcess/com.apple.WebProcess.sb.in:
1587
1588 2017-09-05  Youenn Fablet  <youenn@apple.com>
1589
1590         Cache Storage Engine should not mix different origin caches
1591         https://bugs.webkit.org/show_bug.cgi?id=176394
1592
1593         Reviewed by Alex Christensen.
1594
1595         * NetworkProcess/cache/CacheStorageEngine.cpp:
1596         (WebKit::CacheStorage::Engine::readCachesFromDisk): Initializing the salt before creating the Caches object
1597         so that its persistency path is correctly computed.
1598         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
1599         (WebKit::CacheStorage::cachesRootPath): Setting origin as partition string.
1600
1601 2017-09-05  Brent Fulgham  <bfulgham@apple.com>
1602
1603         Use a single network storage session for stateless connections
1604         https://bugs.webkit.org/show_bug.cgi?id=176386
1605         <rdar://problem/34262148>
1606
1607         Reviewed by Alex Christensen.
1608
1609         Change the name of 'm_dataTaskMapWithoutCredentials' to 'm_dataTaskMapWithoutState'
1610         to reflect that the data tasks do not involve credential or cookie storage. Ditto for
1611         the change from 'm_sessionWIthoutCredentialStorage' to 'm_statelessSession'.
1612
1613         This update should not change behavior, unless some stateless sessions were depending
1614         on cookies to be persistent (which would be a bug!)
1615
1616         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
1617         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa): Update for new variable names.
1618         (WebKit::NetworkDataTaskCocoa::~NetworkDataTaskCocoa): Ditto.
1619         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
1620         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1621         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): Update the configuration to block
1622         cookies as well.
1623         (WebKit::NetworkSessionCocoa::invalidateAndCancel): Update for new names.
1624         (WebKit::NetworkSessionCocoa::clearCredentials): Ditto.
1625         (WebKit::NetworkSessionCocoa::dataTaskForIdentifier): Ditto.
1626
1627 2017-09-05  Yousuke Kimoto  <yousuke.kimoto@sony.com>
1628
1629         [WinCairo] Add Network Process files for wincairo webkit
1630         https://bugs.webkit.org/show_bug.cgi?id=176069
1631
1632         Reviewed by Alex Christensen.
1633
1634         * NetworkProcess/Downloads/curl/DownloadCurl.cpp: Added.
1635         (WebKit::Download::resume):
1636         (WebKit::Download::platformDidFinish):
1637         (WebKit::Download::startNetworkLoadWithHandle):
1638         (WebKit::Download::startNetworkLoad):
1639         (WebKit::Download::platformInvalidate):
1640         * NetworkProcess/EntryPoint/win/NetworkProcessMain.cpp: Added.
1641         (main):
1642         * NetworkProcess/curl/NetworkProcessCurl.cpp: Added.
1643         (WebKit::NetworkProcess::platformInitializeNetworkProcess):
1644         (WebKit::NetworkProcess::platformSetURLCacheSize):
1645         (WebKit::NetworkProcess::allowSpecificHTTPSCertificateForHost):
1646         (WebKit::NetworkProcess::clearCacheForAllOrigins):
1647         (WebKit::NetworkProcess::clearDiskCache):
1648         (WebKit::NetworkProcess::platformTerminate):
1649         * NetworkProcess/curl/RemoteNetworkingContextCurl.cpp: Added.
1650         (WebKit::RemoteNetworkingContext::~RemoteNetworkingContext):
1651         (WebKit::RemoteNetworkingContext::isValid const):
1652         (WebKit::RemoteNetworkingContext::ensurePrivateBrowsingSession):
1653         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
1654         (WebKit::RemoteNetworkingContext::storageSession const):
1655         (WebKit::RemoteNetworkingContext::blockedError const):
1656         * NetworkProcess/win/NetworkProcessMainWin.cpp: Added.
1657         (WebKit::NetworkProcessMainWin):
1658         * NetworkProcess/win/NetworkProcessMainWin.h: Added.
1659         * NetworkProcess/win/SystemProxyWin.cpp: Added.
1660         (WindowsSystemProxy::getSystemHttpProxy):
1661         (WindowsSystemProxy::setCurlHttpProxy):
1662         (WindowsSystemProxy::parseProxyString):
1663         * NetworkProcess/win/SystemProxyWin.h: Added.
1664         * PlatformWin.cmake:
1665
1666 2017-09-05  Youenn Fablet  <youenn@apple.com>
1667
1668         Allow retrieving Cache Storage records for a given URL only
1669         https://bugs.webkit.org/show_bug.cgi?id=176202
1670
1671         Reviewed by Alex Christensen.
1672
1673         Update CacheStorageEngineCache to store records as a map URL -> Vector of Records.
1674         This allows regular record retrieval to be faster.
1675         Retrieval of all records is less efficient but this should happen less often.
1676
1677         * NetworkProcess/cache/CacheStorageEngine.cpp:
1678         (WebKit::CacheStorage::Engine::retrieveRecords):
1679         * NetworkProcess/cache/CacheStorageEngine.h:
1680         * NetworkProcess/cache/CacheStorageEngineCache.cpp:
1681         (WebKit::CacheStorage::queryCache):
1682         (WebKit::CacheStorage::Cache::retrieveRecords const):
1683         (WebKit::CacheStorage::computeKeyURL):
1684         (WebKit::CacheStorage::Cache::addNewURLRecord):
1685         (WebKit::CacheStorage::Cache::recordsFromURL):
1686         (WebKit::CacheStorage::Cache::recordsFromURL const):
1687         (WebKit::CacheStorage::Cache::put):
1688         (WebKit::CacheStorage::Cache::remove):
1689         * NetworkProcess/cache/CacheStorageEngineCache.h:
1690         * NetworkProcess/cache/CacheStorageEngineConnection.cpp:
1691         (WebKit::CacheStorageEngineConnection::retrieveRecords):
1692         * NetworkProcess/cache/CacheStorageEngineConnection.h:
1693         * NetworkProcess/cache/CacheStorageEngineConnection.messages.in:
1694         * WebProcess/Cache/WebCacheStorageConnection.cpp:
1695         (WebKit::WebCacheStorageConnection::doRetrieveRecords):
1696         * WebProcess/Cache/WebCacheStorageConnection.h:
1697
1698 2017-09-05  Youenn Fablet  <youenn@apple.com>
1699
1700         WebKitTestRunner should set the cache storage directory path
1701         https://bugs.webkit.org/show_bug.cgi?id=176373
1702
1703         Reviewed by Chris Dumez.
1704
1705         * UIProcess/API/C/WKContextConfigurationRef.cpp:
1706         (WKContextConfigurationCopyCacheStorageDirectory):
1707         (WKContextConfigurationSetCacheStorageDirectory):
1708         * UIProcess/API/C/WKContextConfigurationRef.h:
1709
1710 2017-09-05  Alex Christensen  <achristensen@webkit.org>
1711
1712         Add WKUIDelegatePrivate equivalent of WKPageUIClient's unavailablePluginButtonClicked
1713         https://bugs.webkit.org/show_bug.cgi?id=176274
1714         <rdar://problem/29270035>
1715
1716         Reviewed by Darin Adler.
1717
1718         * UIProcess/API/APIUIClient.h:
1719         (API::UIClient::unavailablePluginButtonClicked):
1720         * UIProcess/API/C/WKPage.cpp:
1721         (WKPageSetPageUIClient):
1722         * UIProcess/API/Cocoa/WKPreferences.mm:
1723         (-[WKPreferences _setPluginsEnabled:]):
1724         (-[WKPreferences _pluginsEnabled]):
1725         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
1726         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
1727         * UIProcess/Cocoa/UIDelegate.h:
1728         * UIProcess/Cocoa/UIDelegate.mm:
1729         (WebKit::UIDelegate::setDelegate):
1730         (WebKit::toWKPluginUnavailabilityReason):
1731         (WebKit::UIDelegate::UIClient::unavailablePluginButtonClicked):
1732         * UIProcess/WebPageProxy.cpp:
1733         (WebKit::WebPageProxy::unavailablePluginButtonClicked):
1734
1735 2017-09-04  Alex Christensen  <achristensen@webkit.org>
1736
1737         Allow classes to have modern and legacy decoders to aid transition
1738         https://bugs.webkit.org/show_bug.cgi?id=176186
1739
1740         Reviewed by Zan Dobersek.
1741
1742         To illustrate this, I made legacy and modern decoders to WTF::String and transitioned one String decoder.
1743
1744         * Platform/IPC/ArgumentCoder.h:
1745         * Platform/IPC/ArgumentCoders.cpp:
1746         (IPC::ArgumentCoder<String>::decode):
1747         * Platform/IPC/ArgumentCoders.h:
1748         * Platform/IPC/Decoder.h:
1749         * Shared/WebPageCreationParameters.cpp:
1750         (WebKit::WebPageCreationParameters::decode):
1751
1752 2017-09-05  Frederic Wang  <fwang@igalia.com>
1753
1754         Use TilesBacking for iframes when async frame scrolling is enabled
1755         https://bugs.webkit.org/show_bug.cgi?id=173644
1756
1757         Reviewed by Simon Fraser.
1758
1759         This patch adds creation of TilesBacking for non-main frames when async frame scrolling is
1760         enabled. RenderLayerBacking::m_isMainFrameLayerWithTiledBacking is also renamed to reflect
1761         that tiled backing is not exclusive to the main frame. More adjustments might be needed for
1762         non-main frames and will be handled in follow-up commits.
1763
1764         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
1765         (WebKit::RemoteLayerTreeDrawingArea::shouldUseTiledBackingForFrameView): Also use tiled
1766         backing when asyncFrameScrollingEnabled is true.
1767         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
1768         (WebKit::TiledCoreAnimationDrawingArea::shouldUseTiledBackingForFrameView): Ditto.
1769
1770 2017-09-05  Carlos Garcia Campos  <cgarcia@igalia.com>
1771
1772         [GTK] Rename PLUGIN_ARCHITECTURE(X11) as PLUGIN_ARCHITECTURE(UNIX)
1773         https://bugs.webkit.org/show_bug.cgi?id=176330
1774
1775         Reviewed by Michael Catanzaro.
1776
1777         It's no longer X11 specific since it's also used in Wayland when the X11 target is enabled. It should be renamed
1778         as UNIX and make it available when building the wayland target even if the X11 on is disabled.
1779
1780         * PlatformGTK.cmake:
1781         * PlatformWPE.cmake:
1782         * PluginProcess/unix/PluginProcessMainUnix.cpp:
1783         * Shared/Plugins/Netscape/NetscapePluginModule.cpp:
1784         (WebKit::NetscapePluginModule::tryLoad):
1785         * Shared/Plugins/Netscape/NetscapePluginModule.h:
1786         * Shared/Plugins/Netscape/unix/NetscapePluginModuleUnix.cpp: Renamed from Source/WebKit/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp.
1787         * UIProcess/Plugins/PluginProcessProxy.h:
1788         * UIProcess/Plugins/gtk/PluginInfoCache.cpp:
1789         (WebKit::PluginInfoCache::getPluginInfo):
1790         (WebKit::PluginInfoCache::updatePluginInfo):
1791         * UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp:
1792         (WebKit::PluginProcessProxy::scanPlugin):
1793         * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
1794         (WebKit::NPN_InvalidateRect):
1795         * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
1796         (WebKit::NetscapePlugin::initialize):
1797         (WebKit::NetscapePlugin::destroy):
1798         (WebKit::NetscapePlugin::geometryDidChange):
1799         * WebProcess/Plugins/Netscape/NetscapePlugin.h:
1800         * WebProcess/Plugins/Netscape/unix/NetscapePluginUnix.cpp:
1801         * WebProcess/Plugins/Netscape/unix/NetscapePluginUnix.h:
1802         * config.h:
1803
1804 2017-09-05  Carlos Garcia Campos  <cgarcia@igalia.com>
1805
1806         [GTK] Wrong use of PLUGIN_ARCHITECTURE(X11) in several places
1807         https://bugs.webkit.org/show_bug.cgi?id=176329
1808
1809         Reviewed by Michael Catanzaro.
1810
1811         We are using PLUGIN_ARCHITECTURE(X11) in several places where we should actually be using PLATFORM(X11). This is
1812         confusing because PLUGIN_ARCHITECTURE(X11) is no longer specific to X11, it will be renamed as UNIX in a follow
1813         up patch. Because of this we only support plugins in Wayland when building with both X11 and Wayland targets
1814         enabled.
1815
1816         * PluginProcess/PluginControllerProxy.cpp:
1817         * PluginProcess/PluginControllerProxy.h:
1818         * PluginProcess/unix/PluginProcessMainUnix.cpp:
1819         * Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp:
1820         (WebKit::NetscapePluginModule::determineQuirks):
1821         * Shared/Plugins/PluginQuirks.h:
1822         * UIProcess/WebPageProxy.h:
1823         * UIProcess/WebPageProxy.messages.in:
1824         * UIProcess/gtk/WebPageProxyGtk.cpp:
1825         * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
1826         (WebKit::NPN_GetValue):
1827         * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
1828         (WebKit::NetscapePlugin::shouldLoadSrcURL):
1829         (WebKit::NetscapePlugin::initialize):
1830         * WebProcess/Plugins/Netscape/unix/NetscapePluginUnix.cpp:
1831         (WebKit::NetscapePlugin::platformHandleMouseEvent):
1832         * WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp:
1833         * WebProcess/Plugins/Netscape/x11/NetscapePluginX11.h:
1834         * WebProcess/Plugins/PluginController.h:
1835         * WebProcess/Plugins/PluginProxy.cpp:
1836         * WebProcess/Plugins/PluginProxy.h:
1837         * WebProcess/Plugins/PluginProxy.messages.in:
1838         * WebProcess/Plugins/PluginView.cpp:
1839         * WebProcess/Plugins/PluginView.h:
1840
1841 2017-09-04  Wenson Hsieh  <wenson_hsieh@apple.com>
1842
1843         [iOS DnD] Refactor drag and drop logic in WKContentView in preparation for supporting multiple drag items in a drag session
1844         https://bugs.webkit.org/show_bug.cgi?id=176264
1845         <rdar://problem/31144674>
1846
1847         Reviewed by Darin Adler.
1848
1849         Move DataInteractionState from WKContentViewInteraction.h to DragDropInteractionState.h, and also rename it to
1850         DragDropInteractionState. Additionally, refactor drag and drop state in the UI process to capture metadata about
1851         the dragged element in a separate DragSourceState struct. This patch also moves drag and drop state transition
1852         logic that doesn't involve WKContentView internals out of WKContentView, and into the implementation of
1853         DragDropInteractionState.
1854
1855         To support multiple drag items per session, we also introduce a simple mechanism to trace a UIDragItem back to
1856         the DragSourceState used to generate it. When generating a DragSourceState, we assign it a unique identifier,
1857         which we also set as the privateLocalContext of all UIDragItems generated when beginning the drag (this
1858         includes drag items returned by an internal client that uses one of the SPI hooks to augment drag items when
1859         starting a drag). This is subsequently used in the implementation of lift and cancellation preview delegate
1860         methods to supply the appropriate drag preview for each UIDragItem.
1861
1862         Lastly, fix a bug wherein the pageX and pageY of mouse drag events are inconsistent with other synthetic mouse
1863         events, such as synthetic clicks. For synthetic clicks, the PlatformMouseEvent is initialized with the same
1864         position and globalPosition. Whether this is really intended is unclear (see http://webkit.org/b/173855), but
1865         it's a trivial change for now to keep mouse events on iOS consistent by tweaking the behavior during drag and
1866         drop. See Tools/ChangeLog for some more information.
1867
1868         * Platform/spi/ios/UIKitSPI.h:
1869
1870         Add -[UIDragItem privateLocalContext].
1871
1872         * UIProcess/ios/DragDropInteractionState.h: Added.
1873         (WebKit::DragDropInteractionState::stagedDragSource const):
1874         (WebKit::DragDropInteractionState::dropSessionDidExit):
1875         (WebKit::DragDropInteractionState::dropSessionWillPerformDrop):
1876         (WebKit::DragDropInteractionState::adjustedPositionForDragEnd const):
1877         (WebKit::DragDropInteractionState::didBeginDragging const):
1878         (WebKit::DragDropInteractionState::isPerformingDrop const):
1879         (WebKit::DragDropInteractionState::dragSession const):
1880         (WebKit::DragDropInteractionState::dropSession const):
1881
1882         Wrap private drag/drop state member variables behind const getters, and move drag and drop logic that involves
1883         only the DragDropInteractionState into helper methods on DragDropInteractionState.
1884
1885         (WebKit::DragDropInteractionState::BlockPtr<void):
1886         * UIProcess/ios/DragDropInteractionState.mm: Added.
1887         (WebKit::dragItemMatchingIdentifier):
1888         (WebKit::createTargetedDragPreview):
1889         (WebKit::uiImageForImage):
1890
1891         Move drag preview creation logic here, from WKContentViewInteraction.mm.
1892
1893         (WebKit::shouldUseTextIndicatorToCreatePreviewForDragAction):
1894         (WebKit::DragDropInteractionState::activeDragSourceForItem const):
1895         (WebKit::DragDropInteractionState::anyActiveDragSourceIs const):
1896         (WebKit::DragDropInteractionState::prepareForDragSession):
1897         (WebKit::DragDropInteractionState::dragSessionWillBegin):
1898         (WebKit::DragDropInteractionState::previewForDragItem const):
1899         (WebKit::DragDropInteractionState::dragSessionWillDelaySetDownAnimation):
1900         (WebKit::DragDropInteractionState::dropSessionDidEnterOrUpdate):
1901         (WebKit::DragDropInteractionState::stageDragItem):
1902         (WebKit::DragDropInteractionState::hasStagedDragSource const):
1903         (WebKit::DragDropInteractionState::clearStagedDragSource):
1904         (WebKit::DragDropInteractionState::dragAndDropSessionsDidEnd):
1905         (WebKit::DragDropInteractionState::updatePreviewsForActiveDragSources):
1906         * UIProcess/ios/WKContentViewInteraction.h:
1907
1908         Move drag-and-drop-related state tied to the WKContentView here, from DataInteractionState (for instance, the
1909         UIView for the drop caret, the WKContentView snapshot when dropping, and a flag use to keep track of hiding the
1910         callout bar when dragging a text selection).
1911
1912         (): Deleted.
1913         * UIProcess/ios/WKContentViewInteraction.mm:
1914         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:userObject:]):
1915         (-[WKContentView actionSheetAssistant:showCustomSheetForElement:]):
1916         (-[WKContentView _didChangeDragInteractionPolicy]):
1917         (-[WKContentView setupDataInteractionDelegates]):
1918         (-[WKContentView teardownDataInteractionDelegates]):
1919         (-[WKContentView _startDrag:item:]):
1920         (-[WKContentView _didHandleStartDataInteractionRequest:]):
1921         (-[WKContentView computeClientAndGlobalPointsForDropSession:outClientPoint:outGlobalPoint:]):
1922         (-[WKContentView cleanUpDragSourceSessionState]):
1923         (-[WKContentView _didConcludeEditDataInteraction:]):
1924         (-[WKContentView _didPerformDataInteractionControllerOperation:]):
1925         (-[WKContentView _didChangeDataInteractionCaretRect:currentRect:]):
1926         (-[WKContentView currentDragOrDropSession]):
1927         (-[WKContentView _restoreCalloutBarIfNeeded]):
1928         (-[WKContentView _dragInteraction:prepareForSession:completion:]):
1929         (-[WKContentView dragInteraction:itemsForBeginningSession:]):
1930         (-[WKContentView dragInteraction:previewForLiftingItem:session:]):
1931         (-[WKContentView dragInteraction:willAnimateLiftWithAnimator:session:]):
1932         (-[WKContentView dragInteraction:sessionWillBegin:]):
1933         (-[WKContentView dragInteraction:session:didEndWithOperation:]):
1934         (-[WKContentView dragInteraction:previewForCancellingItem:withDefault:]):
1935         (-[WKContentView _dragInteraction:item:shouldDelaySetDownAnimationWithCompletion:]):
1936         (-[WKContentView dragInteraction:item:willAnimateCancelWithAnimator:]):
1937         (-[WKContentView dropInteraction:sessionDidEnter:]):
1938         (-[WKContentView dropInteraction:sessionDidUpdate:]):
1939         (-[WKContentView dropInteraction:sessionDidExit:]):
1940         (-[WKContentView dropInteraction:performDrop:]):
1941         (-[WKContentView dropInteraction:sessionDidEnd:]):
1942
1943         Pull out logic that mutates drag and drop state into DragDropInteractionState. Adjust places that previously
1944         accessed DataInteractionState's members directly with corresponding getters in DragDropInteractionState.
1945
1946         (-[WKContentView _simulateDataInteractionEntered:]):
1947         (-[WKContentView _simulateDataInteractionUpdated:]):
1948         (-[WKContentView _simulateDataInteractionEnded:]):
1949         (-[WKContentView _simulateDataInteractionPerformOperation:]):
1950         (-[WKContentView _simulateDataInteractionSessionDidEnd:]):
1951         (-[WKContentView _simulateWillBeginDataInteractionWithSession:]):
1952         (-[WKContentView _simulatedItemsForSession:]):
1953         (-[WKContentView _simulatePrepareForDataInteractionSession:completion:]):
1954
1955         Rename _dataInteraction => _dragInteraction and _dataOperation => _dropInteraction.
1956
1957         (uiImageForImage): Deleted.
1958         (shouldUseTextIndicatorToCreatePreviewForDragAction): Deleted.
1959         (-[WKContentView dragPreviewForImage:frameInRootViewCoordinates:clippingRectsInFrameCoordinates:backgroundColor:]): Deleted.
1960         (-[WKContentView dragPreviewForCurrentDataInteractionState]): Deleted.
1961         (-[WKContentView _transitionDragPreviewToImageIfNecessary:]): Deleted.
1962         * WebKit.xcodeproj/project.pbxproj:
1963
1964 2017-09-03  Carlos Garcia Campos  <cgarcia@igalia.com>
1965
1966         [Threaded Compositor] Deadlock in ThreadedDisplayRefreshMonitor
1967         https://bugs.webkit.org/show_bug.cgi?id=176296
1968
1969         Reviewed by Žan Doberšek.
1970
1971         The main thread tries to schedule a display refresh monitor from RAF, requestDisplayRefreshMonitorUpdate() tries
1972         to take the attributes lock to update coordinateUpdateCompletionWithClient. The compositing thread has finished
1973         a frame and sceneUpdateFinished() takes the attributes lock to update clientRendersNextFrame and then asks the
1974         display refresh monitor if it requires a new callback. ThreadedDisplayRefreshMonitor::requiresDisplayRefreshCallback()
1975         takes its lock to check the state, and requestDisplayRefreshMonitorUpdate() was called by
1976         ThreadedDisplayRefreshMonitor::requestRefreshCallback() with the display refresh monitor lock taken. So,
1977         the compositing thread has the attributes lock and wants the display refresh monitor one, and main thread has the
1978         display refresh monitor lock and wants the attributes one.
1979
1980         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.cpp:
1981         (WebKit::ThreadedDisplayRefreshMonitor::requestRefreshCallback): Release the mutex before calling
1982         ThreadedCompositor::requestDisplayRefreshMonitorUpdate().
1983
1984 2017-09-03  Zan Dobersek  <zdobersek@igalia.com>
1985
1986         [GTK] Libgcrypt warning: missing initialization - please fix the application
1987         https://bugs.webkit.org/show_bug.cgi?id=171230
1988
1989         Reviewed by Michael Catanzaro.
1990
1991         Replicate the libgcrypt initialization in the NetworkProcess entrypoint.
1992         This is required due to libgcrypt being used through digest operations
1993         originating from the certificate hash computation in SoupNetworkSession.
1994
1995         The initialization is moved to the PAL library, and the initialize()
1996         function is now leveraged in both NetworkProcess and WebProcess entrypoints.
1997
1998         * NetworkProcess/EntryPoint/unix/NetworkProcessMain.cpp:
1999         (main):
2000         * WebProcess/EntryPoint/unix/WebProcessMain.cpp:
2001         (main):
2002
2003 2017-09-03  Zan Dobersek  <zdobersek@igalia.com>
2004
2005         [WPE] Use the device scale factor value in WebPageCreationParameters
2006         https://bugs.webkit.org/show_bug.cgi?id=175377
2007
2008         Reviewed by Michael Catanzaro.
2009
2010         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
2011         (WebKit::AcceleratedDrawingArea::AcceleratedDrawingArea):
2012         WebPageCreationParameters::deviceScaleFactor value should be used
2013         to set the device scale factor on the given WebPage object. This
2014         enables correctly leveraging the scale factor for the WPE port
2015         which enters accelerated mode unconditionally and as such doesn't
2016         wait for the backing store update that would provide that value
2017         otherwise.
2018
2019 2017-09-03  Brent Fulgham  <bfulgham@apple.com>
2020
2021         [WK2][iOS] Remove unnecessary IOHIDEventServiceFastPathUserClient access
2022         https://bugs.webkit.org/show_bug.cgi?id=175947
2023         <rdar://problem/33353627>
2024
2025         Reviewed by Darin Adler.
2026
2027         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2028
2029 2017-09-03  Dan Bernstein  <mitz@apple.com>
2030
2031         WKContentViewInteraction.mm includes redundant declaration of UIPreviewItemController's presentationSecondaryGestureRecognizer
2032         https://bugs.webkit.org/show_bug.cgi?id=176322
2033
2034         Reviewed by Darin Adler.
2035
2036         * UIProcess/ios/WKContentViewInteraction.mm: Removed the declaration, which is already made in the
2037           SDK or in UIKitSPI.h.
2038
2039 2017-09-03  Timothy Horton  <timothy_horton@apple.com>
2040
2041         Try to fix the iOS build
2042
2043         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
2044         (-[WKRemoteView initWithFrame:contextID:]):
2045
2046 2017-09-03  Tim Horton  <timothy_horton@apple.com>
2047
2048         Fix some style issues in the Remote Layer Tree code
2049         https://bugs.webkit.org/show_bug.cgi?id=176298
2050
2051         Reviewed by Dan Bernstein.
2052
2053         In bugs 176273 and 176297, the style bot noticed some existing style
2054         issues in the UI-side compositing code. Fix them, because there aren't
2055         many and they're straightforward.
2056
2057         * Shared/RemoteLayerTree/RemoteLayerBackingStore.h:
2058         * Shared/RemoteLayerTree/RemoteLayerBackingStoreCollection.h:
2059         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
2060         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.h:
2061         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
2062         * UIProcess/RemoteLayerTree/RemoteLayerTreeScrollingPerformanceData.h:
2063         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
2064         * UIProcess/RemoteLayerTree/RemoteScrollingTree.h:
2065         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
2066         * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.h:
2067
2068 2017-09-03  Yusuke Suzuki  <utatane.tea@gmail.com>
2069
2070         String#utf8() allocates new CString
2071         https://bugs.webkit.org/show_bug.cgi?id=176302
2072
2073         Reviewed by Sam Weinig.
2074
2075         * NetworkProcess/webrtc/NetworkRTCSocket.cpp:
2076         (WebKit::NetworkRTCSocket::sendTo):
2077
2078 2017-09-03  Tim Horton  <timothy_horton@apple.com>
2079
2080         Move shared part of the Remote Layer Tree code out of a Mac-specific directory
2081         https://bugs.webkit.org/show_bug.cgi?id=176297
2082
2083         Reviewed by Dan Bernstein.
2084
2085         UI-side compositing works on all Cocoa platforms, so the code should
2086         not live inside Mac/. Also merge the Scrolling directory in here,
2087         since those files are very related.
2088
2089         * PlatformMac.cmake:
2090         * Shared/RemoteLayerTree/RemoteLayerBackingStore.h: Renamed from Shared/mac/RemoteLayerBackingStore.h.
2091         * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm: Renamed from Shared/mac/RemoteLayerBackingStore.mm.
2092         * Shared/RemoteLayerTree/RemoteLayerBackingStoreCollection.h: Renamed from Shared/mac/RemoteLayerBackingStoreCollection.h.
2093         * Shared/RemoteLayerTree/RemoteLayerBackingStoreCollection.mm: Renamed from Shared/mac/RemoteLayerBackingStoreCollection.mm.
2094         * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.h: Renamed from Shared/mac/RemoteLayerTreePropertyApplier.h.
2095         * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm: Renamed from Shared/mac/RemoteLayerTreePropertyApplier.mm.
2096         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h: Renamed from Shared/mac/RemoteLayerTreeTransaction.h.
2097         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm: Renamed from Shared/mac/RemoteLayerTreeTransaction.mm.
2098         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp: Renamed from Shared/Scrolling/RemoteScrollingCoordinatorTransaction.cpp.
2099         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.h: Renamed from Shared/Scrolling/RemoteScrollingCoordinatorTransaction.h.
2100         * WebKit.xcodeproj/project.pbxproj:
2101
2102 2017-09-03  Sam Weinig  <sam@webkit.org>
2103
2104         Remove CanvasProxy
2105         https://bugs.webkit.org/show_bug.cgi?id=176288
2106
2107         Reviewed by Yusuke Suzuki.
2108
2109         CanvasProxy does not appear to be in any current HTML spec
2110         and was disabled and unimplemented in our tree. Time to 
2111         get rid of it.
2112
2113         * Configurations/FeatureDefines.xcconfig:
2114
2115 2017-09-02  Andy Estes  <aestes@apple.com>
2116
2117         [CA] Upstream QuartzCore-related WebKitSystemInterface functions
2118         https://bugs.webkit.org/show_bug.cgi?id=176270
2119
2120         Reviewed by Tim Horton.
2121
2122         * Platform/mac/LayerHostingContext.mm:
2123         (WebKit::LayerHostingContext::createForPort):
2124         (WebKit::LayerHostingContext::createForExternalHostingProcess):
2125         * UIProcess/mac/PageClientImpl.mm:
2126         (WebKit::PageClientImpl::enterAcceleratedCompositingMode):
2127         (WebKit::PageClientImpl::updateAcceleratedCompositingMode):
2128         * UIProcess/mac/RemoteLayerTreeHost.mm:
2129         (WebKit::RemoteLayerTreeHost::createLayer):
2130         * WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm:
2131         (WebKit::makeRenderLayer):
2132         * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
2133         (InitWebCoreSystemInterface):
2134
2135 2017-09-02  Tim Horton  <timothy_horton@apple.com>
2136
2137         Move UI Process part of the Remote Layer Tree code out of a Mac-specific directory
2138         https://bugs.webkit.org/show_bug.cgi?id=176273
2139
2140         Reviewed by Dan Bernstein.
2141
2142         UI-side compositing works on all Cocoa platforms, so the code should
2143         not live inside Mac/. Also merge the Scrolling directory in here,
2144         since those files are very related.
2145
2146         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h: Renamed from SourceebKit/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h.
2147         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.messages.in: Renamed from UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.messages.in.
2148         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm: Renamed from UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm.
2149         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.h: Renamed from UIProcess/mac/RemoteLayerTreeHost.h.
2150         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm: Renamed from UIProcess/mac/RemoteLayerTreeHost.mm.
2151         * UIProcess/RemoteLayerTree/RemoteLayerTreeScrollingPerformanceData.h: Renamed from UIProcess/Cocoa/RemoteLayerTreeScrollingPerformanceData.h.
2152         * UIProcess/RemoteLayerTree/RemoteLayerTreeScrollingPerformanceData.mm: Renamed from UIProcess/Cocoa/RemoteLayerTreeScrollingPerformanceData.mm.
2153         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp: Renamed from UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp.
2154         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h: Renamed from UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h.
2155         * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp: Renamed from UIProcess/Scrolling/RemoteScrollingTree.cpp.
2156         * UIProcess/RemoteLayerTree/RemoteScrollingTree.h: Renamed from UIProcess/Scrolling/RemoteScrollingTree.h.
2157         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm: Renamed from UIProcess/ios/RemoteLayerTreeHostIOS.mm.
2158         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm: Renamed from UIProcess/ios/RemoteScrollingCoordinatorProxyIOS.mm.
2159         * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.h: Renamed from UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.h.
2160         * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.mm: Renamed from UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm.
2161         * WebKit.xcodeproj/project.pbxproj:
2162
2163 2017-09-02  Joseph Pecoraro  <pecoraro@apple.com>
2164
2165         Web Automation: -[_WKAutomationSession init] leaks
2166         https://bugs.webkit.org/show_bug.cgi?id=176268
2167
2168         Reviewed by Darin Adler.
2169
2170         * UIProcess/API/Cocoa/_WKAutomationSession.mm:
2171         (-[_WKAutomationSession init]):
2172
2173 2017-09-02  Tim Horton  <timothy_horton@apple.com>
2174
2175         Fix some style issues in the Web Process part of the Remote Layer Tree code
2176         https://bugs.webkit.org/show_bug.cgi?id=176272
2177
2178         Reviewed by Dan Bernstein.
2179
2180         In bug 176271, the style bot noticed some existing style issues in the UI-side
2181         compositing code. Fix them, because there aren't many and they're straightforward.
2182
2183         * WebProcess/WebPage/Cocoa/RemoteLayerTree/GraphicsLayerCARemote.cpp:
2184         * WebProcess/WebPage/Cocoa/RemoteLayerTree/PlatformCAAnimationRemote.h:
2185         * WebProcess/WebPage/Cocoa/RemoteLayerTree/PlatformCAAnimationRemote.mm:
2186         (WebKit::PlatformCAAnimationRemote::setValues):
2187         * WebProcess/WebPage/Cocoa/RemoteLayerTree/PlatformCALayerRemote.cpp:
2188         (WebKit::PlatformCALayerRemote::appendSublayer):
2189         (WebKit::PlatformCALayerRemote::insertSublayer):
2190         (WebKit::PlatformCALayerRemote::replaceSublayer):
2191         * WebProcess/WebPage/Cocoa/RemoteLayerTree/PlatformCALayerRemote.h:
2192         * WebProcess/WebPage/Cocoa/RemoteLayerTree/PlatformCALayerRemoteCustom.mm:
2193         (WebKit::PlatformCALayerRemoteCustom::clone const):
2194         * WebProcess/WebPage/Cocoa/RemoteLayerTree/PlatformCALayerRemoteTiledBacking.h:
2195         * WebProcess/WebPage/Cocoa/RemoteLayerTree/RemoteLayerTreeContext.h:
2196         * WebProcess/WebPage/Cocoa/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
2197         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
2198         * WebProcess/WebPage/Cocoa/RemoteLayerTree/RemoteScrollingCoordinator.h:
2199         * WebProcess/WebPage/Cocoa/RemoteLayerTree/RemoteScrollingCoordinator.mm:
2200
2201 2017-09-02  Tim Horton  <timothy_horton@apple.com>
2202
2203         Move Web Process part of the Remote Layer Tree code out of a Mac-specific directory
2204         https://bugs.webkit.org/show_bug.cgi?id=176271
2205
2206         Rubber-stamped by Dan Bernstein.
2207
2208         UI-side compositing works on all Cocoa platforms, so the code should
2209         not live inside Mac/. Also merge the Scrolling directory in here,
2210         since those files are very related.
2211
2212         * WebKit.xcodeproj/project.pbxproj:
2213         * DerivedSources.make:
2214         * PlatformMac.cmake:
2215         * WebProcess/WebPage/RemoteLayerTree/GraphicsLayerCARemote.cpp: Renamed from WebProcess/WebPage/mac/GraphicsLayerCARemote.cpp.
2216         * WebProcess/WebPage/RemoteLayerTree/GraphicsLayerCARemote.h: Renamed from WebProcess/WebPage/mac/GraphicsLayerCARemote.h.
2217         * WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.h: Renamed from WebProcess/WebPage/mac/PlatformCAAnimationRemote.h.
2218         * WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.mm: Renamed from WebProcess/WebPage/mac/PlatformCAAnimationRemote.mm.
2219         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp: Renamed from WebProcess/WebPage/mac/PlatformCALayerRemote.cpp.
2220         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h: Renamed from WebProcess/WebPage/mac/PlatformCALayerRemote.h.
2221         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.h: Renamed from WebProcess/WebPage/mac/PlatformCALayerRemoteCustom.h.
2222         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.mm: Renamed from WebProcess/WebPage/mac/PlatformCALayerRemoteCustom.mm.
2223         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteTiledBacking.cpp: Renamed from WebProcess/WebPage/mac/PlatformCALayerRemoteTiledBacking.cpp.
2224         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteTiledBacking.h: Renamed from WebProcess/WebPage/mac/PlatformCALayerRemoteTiledBacking.h.
2225         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.h: Renamed from WebProcess/WebPage/mac/RemoteLayerTreeContext.h.
2226         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm: Renamed from WebProcess/WebPage/mac/RemoteLayerTreeContext.mm.
2227         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDisplayRefreshMonitor.h: Renamed from WebProcess/WebPage/Cocoa/RemoteLayerTreeDisplayRefreshMonitor.h.
2228         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDisplayRefreshMonitor.mm: Renamed from WebProcess/WebPage/Cocoa/RemoteLayerTreeDisplayRefreshMonitor.mm.
2229         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h: Renamed from WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h.
2230         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm: Renamed from WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm.
2231         * WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.h: Renamed from WebProcess/Scrolling/RemoteScrollingCoordinator.h.
2232         * WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.messages.in: Renamed from WebProcess/Scrolling/RemoteScrollingCoordinator.messages.in.
2233         * WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.mm: Renamed from WebProcess/Scrolling/RemoteScrollingCoordinator.mm.
2234
2235 2017-09-02  Carlos Garcia Campos  <cgarcia@igalia.com>
2236
2237         [GTK][Wayland] Use fast malloc to allocate backing store cairo surfaces data
2238         https://bugs.webkit.org/show_bug.cgi?id=176226
2239
2240         Reviewed by Michael Catanzaro.
2241
2242         Do not create the cairo surface for BackingStoreBackendCairoImpl. When not using X11 we are going to use an
2243         image surface anyway, so we don't really need to use the create similar. This way we only need to pass the size
2244         and device scale factor to BackingStoreBackendCairoImpl that will create the image surface using fast malloc to
2245         allocate the data.
2246
2247         * UIProcess/cairo/BackingStoreCairo.cpp:
2248         (WebKit::BackingStore::createBackend):
2249
2250 2017-09-02  Carlos Garcia Campos  <cgarcia@igalia.com>
2251
2252         [GTK][Wayland] Opening FedoraProject's pastebin chews CPU
2253         https://bugs.webkit.org/show_bug.cgi?id=175942
2254
2255         Reviewed by Žan Doberšek.
2256
2257         This regressed when we introduced the display refresh monitor. The monitor schedules updates immediately,
2258         because we removed the option to not do frame sync in X11 to let swapBuffers do the throttling, but that's
2259         not happening in Wayland because the nested compositor is dispatching frame callbacks on surface commit.
2260         We need to ensure that frame callbacks are dispatched on every monitor refresh, because swapBuffers waits for
2261         frame callbacks to be queued on display.
2262
2263         * UIProcess/gtk/WaylandCompositor.cpp:
2264         (WebKit::WaylandCompositor::Surface::~Surface): Destroy pending frame callbacks too.
2265         (WebKit::WaylandCompositor::Surface::setWebPage): Add a tick callback to the web view widget to flush all
2266         committed frame callbacks on every frame update.
2267         (WebKit::WaylandCompositor::Surface::requestFrame): Add the callbacks to m_pendingFrameCallbackList.
2268         (WebKit::WaylandCompositor::Surface::flushFrameCallbacks): Dispatch all committed frame callabcks.
2269         (WebKit::WaylandCompositor::Surface::flushPendingFrameCallbacks): Dispatch all pending frame callbacks.
2270         (WebKit::WaylandCompositor::Surface::commit): Do not dispatch frame callbacks here, move them to the list of
2271         committed frame callbacks that will be dispatched on the next frame clock update.
2272         * UIProcess/gtk/WaylandCompositor.h:
2273         (WebKit::WaylandCompositor::Surface::setWebPage): Moved to the cpp.
2274         * WebProcess/WebPage/gtk/AcceleratedSurfaceWayland.cpp:
2275         (WebKit::AcceleratedSurfaceWayland::AcceleratedSurfaceWayland): Move surface initialization and destruction to
2276         the compositing thread.
2277         (WebKit::AcceleratedSurfaceWayland::initialize):
2278         (WebKit::AcceleratedSurfaceWayland::finalize):
2279         (WebKit::AcceleratedSurfaceWayland::~AcceleratedSurfaceWayland): Deleted.
2280         * WebProcess/WebPage/gtk/AcceleratedSurfaceWayland.h:
2281
2282 2017-09-01  Youenn Fablet  <youenn@apple.com>
2283
2284         Do not Reject CacheStorage promises when updating the persistent filesystem data fails
2285         https://bugs.webkit.org/show_bug.cgi?id=176241
2286
2287         Reviewed by Alex Christensen.
2288
2289         Open/Remove caches may succeed in the memory representation but the write-to-disk operation may fail.
2290         In that case, the callback does not return an error but a value containing the cache identifier.
2291         The value will also contain a boolean flag set to true to notify the client that persistent storage failed this time.
2292
2293         * NetworkProcess/cache/CacheStorageEngine.cpp:
2294         (WebKit::CacheStorage::Engine::open):
2295         (WebKit::CacheStorage::Engine::remove):
2296         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
2297         (WebKit::CacheStorage::Caches::open):
2298         (WebKit::CacheStorage::Caches::remove):
2299         * NetworkProcess/cache/CacheStorageEngineCaches.h:
2300
2301 2017-09-01  Alex Christensen  <achristensen@webkit.org>
2302
2303         Add WKUIDelegatePrivate equivalent of WKPageUIClient's toolbarsAreVisible
2304         https://bugs.webkit.org/show_bug.cgi?id=176246
2305         <rdar://problem/29270035>
2306
2307         Reviewed by Tim Horton.
2308
2309         * UIProcess/API/APIUIClient.h:
2310         (API::UIClient::toolbarsAreVisible):
2311         * UIProcess/API/C/WKPage.cpp:
2312         (WKPageSetPageUIClient):
2313         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
2314         * UIProcess/Cocoa/UIDelegate.h:
2315         * UIProcess/Cocoa/UIDelegate.mm:
2316         (WebKit::UIDelegate::setDelegate):
2317         (WebKit::UIDelegate::UIClient::toolbarsAreVisible):
2318         * UIProcess/WebPageProxy.cpp:
2319         (WebKit::WebPageProxy::getToolbarsAreVisible):
2320         * UIProcess/WebPageProxy.h:
2321         * UIProcess/WebPageProxy.messages.in:
2322
2323 2017-09-01  Alex Christensen  <achristensen@webkit.org>
2324
2325         Make PageClientImplCocoa a proper superclass of PageClientImpls for Mac and iOS
2326         https://bugs.webkit.org/show_bug.cgi?id=176239
2327
2328         Reviewed by Tim Horton.
2329
2330         * UIProcess/Cocoa/PageClientImplCocoa.h: Added.
2331         (WebKit::PageClientImplCocoa::PageClientImplCocoa):
2332         * UIProcess/Cocoa/PageClientImplCocoa.mm:
2333         (WebKit::PageClientImplCocoa::isPlayingAudioWillChange):
2334         (WebKit::PageClientImplCocoa::isPlayingAudioDidChange):
2335         (WebKit::PageClientImpl::isPlayingAudioWillChange): Deleted.
2336         (WebKit::PageClientImpl::isPlayingAudioDidChange): Deleted.
2337         * UIProcess/Cocoa/WebViewImpl.mm:
2338         * UIProcess/ios/PageClientImplIOS.h:
2339         * UIProcess/ios/PageClientImplIOS.mm:
2340         (WebKit::PageClientImpl::PageClientImpl):
2341         * UIProcess/mac/PageClientImpl.h: Removed.
2342         * UIProcess/mac/PageClientImpl.mm: Removed.
2343         * UIProcess/mac/PageClientImplMac.h: Copied from Source/WebKit/UIProcess/mac/PageClientImpl.h.
2344         * UIProcess/mac/PageClientImplMac.mm: Copied from Source/WebKit/UIProcess/mac/PageClientImpl.mm.
2345         (WebKit::PageClientImpl::PageClientImpl):
2346         * UIProcess/mac/WebContextMenuProxyMac.mm:
2347         * UIProcess/mac/WebPageProxyMac.mm:
2348         * UIProcess/mac/WebPopupMenuProxyMac.mm:
2349         * WebKit.xcodeproj/project.pbxproj:
2350
2351 2017-09-01  Alex Christensen  <achristensen@webkit.org>
2352
2353         Replace WKUIDelegatePrivate's isPlayingMediaDidChange with KVO _isPlayingAudio on WKWebView
2354         https://bugs.webkit.org/show_bug.cgi?id=176212
2355
2356         Reviewed by Tim Horton.
2357
2358         Dan suggested this in bug 176203, I think it's a good idea,
2359         and I'll need to add more KVO properties soon anyways so I'd better learn how.
2360         Determining if audio playing changed is important for Safari, so WKPageUIClient's
2361         isPlayingAudioDidChange was correctly named but incorrectly fired if either audio
2362         or video playing changed and had you check if audio was playing, possibly too often.
2363
2364         * UIProcess/API/APIUIClient.h:
2365         (API::UIClient::isPlayingMediaDidChange):
2366         * UIProcess/API/C/WKPage.cpp:
2367         (WKPageSetPageUIClient):
2368         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
2369         * UIProcess/API/Cocoa/WKWebView.mm:
2370         (-[WKWebView _isPlayingAudio]):
2371         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2372         * UIProcess/API/glib/WebKitUIClient.cpp:
2373         * UIProcess/Cocoa/UIDelegate.h:
2374         * UIProcess/Cocoa/UIDelegate.mm:
2375         (WebKit::UIDelegate::setDelegate):
2376         (WebKit::UIDelegate::UIClient::isPlayingMediaDidChange): Deleted.
2377         * UIProcess/Cocoa/WebViewImpl.h:
2378         * UIProcess/Cocoa/WebViewImpl.mm:
2379         (WebKit::WebViewImpl::isPlayingAudioWillChange):
2380         (WebKit::WebViewImpl::isPlayingAudioDidChange):
2381         * UIProcess/PageClient.h:
2382         * UIProcess/WebPageProxy.cpp:
2383         (WebKit::WebPageProxy::isPlayingMediaDidChange):
2384         * UIProcess/mac/PageClientImpl.h:
2385         * UIProcess/mac/PageClientImpl.mm:
2386         (WebKit::PageClientImpl::isPlayingAudioDidChange):
2387         (WebKit::PageClientImpl::isPlayingAudioWillChange):
2388
2389 2017-09-01  Alex Christensen  <achristensen@webkit.org>
2390
2391         Disable ObjC WebGL policy SPI on iOS
2392         https://bugs.webkit.org/show_bug.cgi?id=176233
2393
2394         Reviewed by Tim Horton.
2395         
2396         In r221465 I uploaded new SPI that is only needed on Mac with a beautiful test that only works on Mac.
2397         Since it fails on iOS and is not needed on iOS, let's just disable it on iOS.
2398
2399         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
2400         * UIProcess/Cocoa/NavigationState.h:
2401         * UIProcess/Cocoa/NavigationState.mm:
2402         (WebKit::NavigationState::setNavigationDelegate):
2403
2404 2017-09-01  Andy Estes  <aestes@apple.com>
2405
2406         [CG] Upstream CoreGraphics-related WebKitSystemInterface functions
2407         https://bugs.webkit.org/show_bug.cgi?id=176200
2408
2409         Reviewed by Tim Horton.
2410
2411         * PluginProcess/mac/PluginProcessMac.mm:
2412         (WebKit::PluginProcess::platformInitializeProcess):
2413         * UIProcess/mac/WindowServerConnection.h:
2414         * UIProcess/mac/WindowServerConnection.mm:
2415         (WebKit::registerOcclusionNotificationHandler):
2416         (WebKit::WindowServerConnection::WindowServerConnection):
2417         (WebKit::WindowServerConnection::applicationWindowModificationsStarted): Deleted.
2418         * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
2419         (InitWebCoreSystemInterface):
2420
2421 2017-09-01  Per Arne Vollan  <pvollan@apple.com>
2422
2423         [Win] Compile error, 'Cache' is not declared.
2424         https://bugs.webkit.org/show_bug.cgi?id=176062
2425
2426         Reviewed by Youenn Fablet.
2427
2428         Rename DOMCache to DOMCacheEngine.
2429
2430         * NetworkProcess/cache/CacheStorageEngine.cpp:
2431         (WebKit::CacheStorage::Engine::queryCache):
2432         (WebKit::CacheStorage::Engine::writeFile):
2433         * NetworkProcess/cache/CacheStorageEngine.h:
2434         * NetworkProcess/cache/CacheStorageEngineCache.h:
2435         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
2436         (WebKit::CacheStorage::Caches::initialize):
2437         * NetworkProcess/cache/CacheStorageEngineCaches.h:
2438         * NetworkProcess/cache/CacheStorageEngineConnection.cpp:
2439         * NetworkProcess/cache/CacheStorageEngineConnection.h:
2440         * NetworkProcess/cache/CacheStorageEngineConnection.messages.in:
2441         * Shared/WebCoreArgumentCoders.cpp:
2442         (IPC::ArgumentCoder<DOMCacheEngine::CacheInfo>::encode):
2443         (IPC::ArgumentCoder<DOMCacheEngine::CacheInfo>::decode):
2444         (IPC::ArgumentCoder<DOMCacheEngine::Record>::encode):
2445         (IPC::ArgumentCoder<DOMCacheEngine::Record>::decode):
2446         (IPC::ArgumentCoder<DOMCache::CacheInfo>::encode): Deleted.
2447         (IPC::ArgumentCoder<DOMCache::CacheInfo>::decode): Deleted.
2448         (IPC::ArgumentCoder<DOMCache::Record>::encode): Deleted.
2449         (IPC::ArgumentCoder<DOMCache::Record>::decode): Deleted.
2450         * Shared/WebCoreArgumentCoders.h:
2451         * WebProcess/Cache/WebCacheStorageConnection.cpp:
2452         * WebProcess/Cache/WebCacheStorageConnection.h:
2453         * WebProcess/Cache/WebCacheStorageConnection.messages.in:
2454
2455 2017-08-31  Andy Estes  <aestes@apple.com>
2456
2457         [Mac] Upstream AppKit-related WebKitSystemInterface functions
2458         https://bugs.webkit.org/show_bug.cgi?id=176175
2459
2460         Reviewed by Brady Eidson.
2461
2462         * PluginProcess/mac/PluginProcessMac.mm:
2463         (WebKit::initializeCocoaOverrides):
2464         * Shared/mac/WebEventFactory.mm:
2465         (WebKit::WebEventFactory::createWebWheelEvent):
2466         (WebKit::WebEventFactory::createWebKeyboardEvent):
2467         * UIProcess/mac/WKTextInputWindowController.mm:
2468         (-[WKTextInputPanel init]):
2469         * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
2470         (InitWebCoreSystemInterface):
2471
2472 2017-08-31  Alex Christensen  <achristensen@webkit.org>
2473
2474         Add WKUIDelegatePrivate equivalent of WKPageUIClient's isPlayingAudioDidChange
2475         https://bugs.webkit.org/show_bug.cgi?id=176203
2476         <rdar://problem/29270035>
2477
2478         Reviewed by Tim Horton.
2479
2480         * UIProcess/API/APIUIClient.h:
2481         (API::UIClient::isPlayingMediaDidChange):
2482         (API::UIClient::isPlayingAudioDidChange): Deleted.
2483         * UIProcess/API/C/WKPage.cpp:
2484         (WKPageSetPageUIClient):
2485         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
2486         * UIProcess/Cocoa/UIDelegate.h:
2487         * UIProcess/Cocoa/UIDelegate.mm:
2488         (WebKit::UIDelegate::setDelegate):
2489         (WebKit::UIDelegate::UIClient::isPlayingMediaDidChange):
2490         * UIProcess/WebPageProxy.cpp:
2491         (WebKit::WebPageProxy::isPlayingMediaDidChange):
2492
2493 2017-08-31  Alex Christensen  <achristensen@webkit.org>
2494
2495         Add ObjC SPI corresponding to WKPageLoaderClient's webGLLoadPolicy and resolveWebGLLoadPolicy
2496         https://bugs.webkit.org/show_bug.cgi?id=175779
2497         <rdar://problem/22367975>
2498
2499         Reviewed by Tim Horton.
2500
2501         * UIProcess/API/APINavigationClient.h:
2502         (API::NavigationClient::webGLLoadPolicy const):
2503         (API::NavigationClient::resolveWebGLLoadPolicy const):
2504         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
2505         * UIProcess/Cocoa/NavigationState.h:
2506         * UIProcess/Cocoa/NavigationState.mm:
2507         (WebKit::NavigationState::setNavigationDelegate):
2508         (WebKit::toWebCoreWebGLLoadPolicy):
2509         (WebKit::NavigationState::NavigationClient::webGLLoadPolicy const):
2510         (WebKit::NavigationState::NavigationClient::resolveWebGLLoadPolicy const):
2511         * UIProcess/WebPageProxy.cpp:
2512         (WebKit::WebPageProxy::webGLPolicyForURL):
2513         (WebKit::WebPageProxy::resolveWebGLPolicyForURL):
2514         * UIProcess/WebPageProxy.h:
2515         * UIProcess/WebPageProxy.messages.in:
2516         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2517         (WebKit::WebFrameLoaderClient::webGLPolicyForURL const):
2518         (WebKit::WebFrameLoaderClient::resolveWebGLPolicyForURL const):
2519         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
2520         * WebProcess/WebPage/WebPage.cpp:
2521         (WebKit::WebPage::webGLPolicyForURL):
2522         (WebKit::WebPage::resolveWebGLPolicyForURL):
2523         * WebProcess/WebPage/WebPage.h:
2524         * WebProcess/WebPage/ios/WebPageIOS.mm:
2525         (WebKit::WebPage::webGLPolicyForURL):
2526         (WebKit::WebPage::resolveWebGLPolicyForURL):
2527         * WebProcess/WebPage/mac/WebPageMac.mm:
2528         (WebKit::WebPage::webGLPolicyForURL):
2529         (WebKit::WebPage::resolveWebGLPolicyForURL):
2530
2531 2017-08-31  Brady Eidson  <beidson@apple.com>
2532
2533         Add (entirely incorrect) fetching of ServiceWorker scripts.
2534         https://bugs.webkit.org/show_bug.cgi?id=176179
2535
2536         Reviewed by Andy Estes.
2537
2538         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
2539         (WebKit::WebSWServerConnection::startScriptFetchInClient):
2540         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
2541         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
2542
2543         * WebProcess/Storage/WebSWClientConnection.cpp:
2544         (WebKit::WebSWClientConnection::finishFetchingScriptInServer):
2545         * WebProcess/Storage/WebSWClientConnection.h:
2546         * WebProcess/Storage/WebSWClientConnection.messages.in:
2547
2548 2017-08-31  Megan Gardner  <megan_gardner@apple.com>
2549
2550         Fix error in protocol revving
2551         https://bugs.webkit.org/show_bug.cgi?id=176191
2552
2553         Protocol definition was mastered out of later iOS submissions, causing them to not build.
2554
2555         Reviewed by Tim Horton.
2556
2557         * UIProcess/ios/WKContentViewInteraction.mm:
2558         (-[WKContentView changeSelectionWithGestureAt:withGesture:withState:]):
2559
2560 2017-08-31  Youenn Fablet  <youenn@apple.com>
2561
2562         Update CacheStorage caches only if it is updated
2563         https://bugs.webkit.org/show_bug.cgi?id=176135
2564
2565         Reviewed by Alex Christensen.
2566
2567         For each change to CacheStorageEngineCaches list of cache, CacheStorageEngineCaches increments a counter.
2568         When sending the list of caches, CacheStorageEngineCaches will compare its counter with the one provided.
2569         If they sare the same, CacheStorageEngineCaches will return nothing.
2570         Otherwise it returns the whole list of caches.
2571
2572         * NetworkProcess/cache/CacheStorageEngine.cpp:
2573         (WebKit::CacheStorage::Engine::retrieveCaches):
2574         * NetworkProcess/cache/CacheStorageEngine.h:
2575         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
2576         (WebKit::CacheStorage::Caches::initialize):
2577         (WebKit::CacheStorage::Caches::open):
2578         (WebKit::CacheStorage::Caches::remove):
2579         (WebKit::CacheStorage::Caches::clearMemoryRepresentation):
2580         (WebKit::CacheStorage::Caches::cacheInfos const):
2581         * NetworkProcess/cache/CacheStorageEngineCaches.h:
2582         (WebKit::CacheStorage::Caches::updateCounter const):
2583         * NetworkProcess/cache/CacheStorageEngineConnection.cpp:
2584         (WebKit::CacheStorageEngineConnection::caches):
2585         * NetworkProcess/cache/CacheStorageEngineConnection.h:
2586         * NetworkProcess/cache/CacheStorageEngineConnection.messages.in:
2587         * WebProcess/Cache/WebCacheStorageConnection.cpp:
2588         (WebKit::WebCacheStorageConnection::doRetrieveCaches):
2589         * WebProcess/Cache/WebCacheStorageConnection.h:
2590
2591 2017-08-31  Youenn Fablet  <youenn@apple.com>
2592
2593         Introduce CacheStorageEngineCache to handle cache records
2594         https://bugs.webkit.org/show_bug.cgi?id=176137
2595
2596         Reviewed by Alex Christensen.
2597
2598         CacheStorageEngineCache is the equivalent of WebCore Cache.
2599         It contains a list of records that it needs to manage (add, update, remove).
2600         Moving the logic of this management from CacheStorageEngine to this new class so as to ease future development.
2601
2602         * CMakeLists.txt:
2603         * NetworkProcess/cache/CacheStorageEngine.cpp:
2604         (WebKit::CacheStorage::Engine::open):
2605         (WebKit::CacheStorage::Engine::remove):
2606         (WebKit::CacheStorage::Engine::retrieveRecords):
2607         (WebKit::CacheStorage::Engine::putRecords):
2608         (WebKit::CacheStorage::Engine::deleteMatchingRecords):
2609         (WebKit::CacheStorage::Engine::cache):
2610         (WebKit::CacheStorage::Engine::writeCacheRecords): Deleted.
2611         (WebKit::CacheStorage::Engine::removeCacheRecords): Deleted.
2612         (WebKit::CacheStorage::Engine::queryCache): Deleted.
2613         * NetworkProcess/cache/CacheStorageEngine.h:
2614         * NetworkProcess/cache/CacheStorageEngineCache.cpp: Added.
2615         * NetworkProcess/cache/CacheStorageEngineCache.h:
2616         (WebKit::CacheStorage::Cache::identifier const):
2617         (WebKit::CacheStorage::Cache::name const):
2618         (WebKit::CacheStorage::Cache::info const):
2619         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
2620         (WebKit::CacheStorage::Caches::find):
2621         (WebKit::CacheStorage::Caches::open):
2622         (WebKit::CacheStorage::Caches::remove):
2623         (WebKit::CacheStorage::encodeCacheNames):
2624         (WebKit::CacheStorage::Caches::readCachesFromDisk):
2625         (WebKit::CacheStorage::Caches::cacheInfos const):
2626         * WebKit.xcodeproj/project.pbxproj:
2627
2628 2017-08-31  David Quesada  <david_quesada@apple.com>
2629
2630         WKNavigationDelegatePrivate client redirect SPI needs to be able to detect redirects scheduled before the document finishes loading
2631         https://bugs.webkit.org/show_bug.cgi?id=176128
2632         rdar://problem/34068476
2633
2634         Reviewed by Brady Eidson.
2635
2636         _webView:didPerformClientRedirect: isn't useful for delegates that want to know about client redirects
2637         started before the document is finished loading. This is because the method would be called after the
2638         navigation scheduler's timer fires and the navigation for the redirect has begun. Since this happens in
2639         a later iteration of the run loop, the document has already finished loading. Address this by replacing
2640         the method with two that give the navigation delegate more information about when client redirects are
2641         scheduled and canceled.
2642
2643         * UIProcess/API/APINavigationClient.h:
2644         (API::NavigationClient::willPerformClientRedirect):
2645         (API::NavigationClient::didCancelClientRedirect):
2646         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
2647         * UIProcess/Cocoa/NavigationState.h:
2648         * UIProcess/Cocoa/NavigationState.mm:
2649         (WebKit::NavigationState::setNavigationDelegate):
2650         (WebKit::NavigationState::NavigationClient::willPerformClientRedirect):
2651         (WebKit::NavigationState::NavigationClient::didCancelClientRedirect):
2652         * UIProcess/WebPageProxy.cpp:
2653         (WebKit::WebPageProxy::willPerformClientRedirectForFrame):
2654         (WebKit::WebPageProxy::didCancelClientRedirectForFrame):
2655         * UIProcess/WebPageProxy.h:
2656         * UIProcess/WebPageProxy.messages.in:
2657         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2658         (WebKit::WebFrameLoaderClient::dispatchDidCancelClientRedirect):
2659         (WebKit::WebFrameLoaderClient::dispatchWillPerformClientRedirect):
2660         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
2661
2662 2017-08-30  Megan Gardner  <megan_gardner@apple.com>
2663
2664         Remove IsBlockSelection flag
2665         https://bugs.webkit.org/show_bug.cgi?id=176141
2666
2667         Reviewed by Dean Jackson.
2668
2669         Block selection is disabled. Removed code associated with this flag to allow removal of the
2670         flag in UIKit.
2671         
2672         No tests for a removed feature.
2673
2674         * Platform/spi/ios/UIKitSPI.h:
2675         * Shared/ios/GestureTypes.h:
2676         * UIProcess/ios/WKContentViewInteraction.mm:
2677         (toUIWKSelectionFlags):
2678         * WebProcess/WebPage/ios/WebPageIOS.mm:
2679         (WebKit::WebPage::rangeForWebSelectionAtPosition):
2680         (WebKit::WebPage::selectWithGesture):
2681         (WebKit::WebPage::contractedRangeFromHandle):
2682         (WebKit::WebPage::computeExpandAndShrinkThresholdsForHandle):
2683         (WebKit::WebPage::updateBlockSelectionWithTouch):
2684         (WebKit::WebPage::updateSelectionWithTouches):
2685
2686 2017-08-30  Alex Christensen  <achristensen@webkit.org>
2687
2688         Add WKUIDelegatePrivate equivalent of WKPageUIClient's didClickAutoFillButton
2689         https://bugs.webkit.org/show_bug.cgi?id=176139
2690         <rdar://problem/29270035>
2691
2692         Reviewed by Tim Horton.
2693
2694         Covered by a cool new API test!
2695
2696         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
2697         * UIProcess/Cocoa/UIDelegate.h:
2698         * UIProcess/Cocoa/UIDelegate.mm:
2699         (WebKit::UIDelegate::setDelegate):
2700         (WebKit::UIDelegate::UIClient::didClickAutoFillButton):
2701
2702 2017-08-31  Chris Dumez  <cdumez@apple.com>
2703
2704         Use WTF::crossThreadCopy() in more places
2705         https://bugs.webkit.org/show_bug.cgi?id=176169
2706
2707         Reviewed by Andreas Kling.
2708
2709         Use WTF::crossThreadCopy() in more places to make code more concise.
2710
2711         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2712         (WebKit::WebResourceLoadStatisticsStore::removeDataRecords):
2713         (WebKit::WebResourceLoadStatisticsStore::grandfatherExistingWebsiteData):
2714         (WebKit::WebResourceLoadStatisticsStore::scheduleCookiePartitioningUpdateForDomains):
2715         (WebKit::WebResourceLoadStatisticsStore::updateCookiePartitioning):
2716         (WebKit::WebResourceLoadStatisticsStore::updateCookiePartitioningForDomains):
2717         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2718         (WebKit::WebsiteDataStore::fetchDataForTopPrivatelyControlledDomains):
2719
2720 2017-08-31  Youenn Fablet  <youenn@apple.com>
2721
2722         Take into account removed caches in Caches::remove assertion
2723         https://bugs.webkit.org/show_bug.cgi?id=176164
2724
2725         Reviewed by Alex Christensen.
2726
2727         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
2728         (WebKit::CacheStorage::Caches::remove):
2729
2730 2017-08-31  Youenn Fablet  <youenn@apple.com>
2731
2732         Do not create a salt if the CacheStorage engine should not persist
2733         https://bugs.webkit.org/show_bug.cgi?id=176138
2734
2735         Reviewed by Alex Christensen.
2736
2737         * NetworkProcess/cache/CacheStorageEngine.cpp:
2738         (WebKit::CacheStorage::Engine::~Engine): Ensuring that Caches will not try using the engine if it goes away.
2739         (WebKit::CacheStorage::Engine::initialize): Removing making a salt if engine data is not persistent.
2740         * NetworkProcess/cache/CacheStorageEngine.h: Check persistency according the root path. If it is null, caches should not try to do persistency.
2741         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
2742         (WebKit::CacheStorage::cachesRootPath):
2743         (WebKit::CacheStorage::Caches::initialize):
2744         (WebKit::CacheStorage::Caches::detach):
2745         (WebKit::CacheStorage::Caches::readCachesFromDisk):
2746         (WebKit::CacheStorage::Caches::writeCachesToDisk):
2747         * NetworkProcess/cache/CacheStorageEngineCaches.h:
2748         (WebKit::CacheStorage::Caches::shouldPersist const):
2749         * NetworkProcess/cache/NetworkCacheData.cpp: Making makeSalt private again.
2750         (WebKit::NetworkCache::makeSalt):
2751         * NetworkProcess/cache/NetworkCacheData.h:
2752
2753
2754 2017-08-31  Carlos Garcia Campos  <cgarcia@igalia.com>
2755
2756         [GTK] Several InputMethodFilter tests are failing and crashing
2757         https://bugs.webkit.org/show_bug.cgi?id=176158
2758
2759         Reviewed by Carlos Alberto Lopez Perez.
2760
2761         * UIProcess/gtk/InputMethodFilter.cpp:
2762         (WebKit::InputMethodFilter::confirmCurrentComposition): Return early in testing mode because the page is not available.
2763         (WebKit::InputMethodFilter::logHandleKeyboardEventWithCompositionResultsForTesting): Use hexadecimal numbers for
2764         logging key codes.
2765
2766 2017-08-31  Carlos Garcia Campos  <cgarcia@igalia.com>
2767
2768         [GTK][Wayland] Crash when gdk_keymap_get_entries_for_keyval returns TRUE but n_keys=0
2769         https://bugs.webkit.org/show_bug.cgi?id=176154
2770
2771         Reviewed by Carlos Alberto Lopez Perez.
2772
2773         In Wayland gdk_keymap_get_entries_for_keyval() can return TRUE with n_keys=0. We have several places in WebKit
2774         where we just check the return value of gdk_keymap_get_entries_for_keyval() and then use the returned array to
2775         get the first position assuming it has at least one item. This has always worked in X11 because the GDK X11
2776         backend does the right thing, but it's crashing in Wayland now. It should be fixed in GTK+ but in the meantime
2777         it's easy to workaround by also checking n_keys > 0.
2778
2779         * UIProcess/Automation/gtk/WebAutomationSessionGtk.cpp:
2780         (WebKit::doKeyStrokeEvent):
2781
2782 2017-08-30  Dan Bernstein  <mitz@apple.com>
2783
2784         [iOS] REGRESSION (r218144) -[WKContentView targetForAction:withSender:] returns the content view for actions implemented only by the WKWebView, causing a crash
2785         https://bugs.webkit.org/show_bug.cgi?id=176077
2786         <rdar://problem/34145200>
2787
2788         Reviewed by Sam Weinig.
2789
2790         Test: TestWebKitAPI/Tests/WebKitCocoa/WKContentViewTargetForAction.mm
2791
2792         * UIProcess/API/Cocoa/WKWebView.mm:
2793         (-[WKWebView targetForAction:withSender:]): Override and forward WKContentView actions to
2794           -[WKContentView targetForActionForWebView:withSender:].
2795         * UIProcess/ios/WKContentViewInteraction.h: Declare -targetForActionForWebView:withSender:.
2796         * UIProcess/ios/WKContentViewInteraction.mm:
2797         (-[WKContentView targetForAction:withSender:]): Forward to the WKWebView.
2798         (-[WKContentView targetForActionForWebView:withSender:]): Call super’s
2799           -targetForAction:withSender:.
2800
2801 2017-08-30  Brent Fulgham  <bfulgham@apple.com>
2802
2803         Fix whitespace and formatting
2804         https://bugs.webkit.org/show_bug.cgi?id=176134
2805
2806         Reviewed by Sam Weinig.
2807
2808         Bring the file formatting into compliance with WebKit Coding Style.
2809
2810         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
2811         (-[_WKWebsiteDataStoreConfiguration _webStorageDirectory]):
2812         (-[_WKWebsiteDataStoreConfiguration _setWebStorageDirectory:]):
2813         (-[_WKWebsiteDataStoreConfiguration _indexedDBDatabaseDirectory]):
2814         (-[_WKWebsiteDataStoreConfiguration _setIndexedDBDatabaseDirectory:]):
2815         (-[_WKWebsiteDataStoreConfiguration _webSQLDatabaseDirectory]):
2816         (-[_WKWebsiteDataStoreConfiguration _setWebSQLDatabaseDirectory:]):
2817         (-[_WKWebsiteDataStoreConfiguration _cookieStorageFile]):
2818         (-[_WKWebsiteDataStoreConfiguration _setCookieStorageFile:]):
2819         (-[_WKWebsiteDataStoreConfiguration _resourceLoadStatisticsDirectory]):
2820         (-[_WKWebsiteDataStoreConfiguration _setResourceLoadStatisticsDirectory:]):
2821
2822 2017-08-30  Youenn Fablet  <youenn@apple.com>
2823
2824         Remove the list of removed caches from CacheStorageEngine
2825         https://bugs.webkit.org/show_bug.cgi?id=176136
2826
2827         Reviewed by Alex Christensen.
2828
2829
2830         This list is no longer useful as CacheStorageEngineCaches handles its own removed caches.
2831
2832         * NetworkProcess/cache/CacheStorageEngine.cpp:
2833         (WebKit::CacheStorage::Engine::remove):
2834         (WebKit::CacheStorage::Engine::cache):
2835         * NetworkProcess/cache/CacheStorageEngine.h:
2836
2837 2017-08-30  Tim Horton  <timothy_horton@apple.com>
2838
2839         REGRESSION (r221068): Graphics corruption when dragging images on iOS
2840         https://bugs.webkit.org/show_bug.cgi?id=176132
2841         <rdar://problem/34142983>
2842
2843         Reviewed by Dean Jackson.
2844
2845         * Shared/mac/ColorSpaceData.mm:
2846         (WebKit::ColorSpaceData::encode):
2847         Color space encoding was entirely disabled on iOS, so after r221068,
2848         ShareableBitmap would make different decisions about image format
2849         on both sides of the wire.
2850
2851         Enable color space encoding on iOS (decoding is already implemented)
2852         by moving some ifdefs around.
2853
2854 2017-08-30  Youenn Fablet  <youenn@apple.com>
2855
2856         [Cache API] Support cache names persistency
2857         https://bugs.webkit.org/show_bug.cgi?id=175995
2858
2859         Reviewed by Alex Christensen.
2860
2861         Adding disk read/write capacities to CacheStorage engine.
2862         This is used to store per-origin cache names in a file.
2863         Making Engine a thread safe refcounted object so that it does read/write in a background thread.
2864
2865         Introducing CacheStorage::Caches as the object managing the list of Cache objects for a given origin.
2866         Caches will be responsible to do all the read/write operations for all of its caches.
2867         It will be responsible for quota limitation as well.
2868
2869         Moving part of the logic from CacheStorage::Engine into CacheStorage::Caches.
2870
2871         CacheStorage::Engine is initialized asynchronously as it first creates a salt which is used
2872         to obfuscate the names of the various files stored on disk.
2873
2874         In the same spirit, CacheStorage::Caches is initialized asynchronously as it needs to read from the disk the list of cache names.
2875         Once read, the names will be stored in memory.
2876         Added the possibility to clear this in-memory representation. This will be useful for testing.
2877         This might also be useful to save memory when there is no more use of CacheStorage by web pages.
2878
2879         Introducing a new cacheStorageSubdirectoryName parameter for WebsiteDataStore so as to segment the different per session CacheStorageEngine
2880         in direct sub folders of the main cacheStorageDirectory folder.
2881
2882         * CMakeLists.txt:
2883         * NetworkProcess/cache/CacheStorageEngine.cpp:
2884         (WebKit::CacheStorage::Engine::open):
2885         (WebKit::CacheStorage::Engine::remove):
2886         (WebKit::CacheStorage::Engine::retrieveCaches):
2887         (WebKit::CacheStorage::Engine::retrieveRecords):
2888         (WebKit::CacheStorage::Engine::initialize):
2889         (WebKit::CacheStorage::Engine::readCachesFromDisk):
2890         (WebKit::CacheStorage::Engine::cache):
2891         (WebKit::CacheStorage::Engine::writeFile): Making use of default parameter to directly return to the main loop.
2892         (WebKit::CacheStorage::Engine::readFile): Ditto.
2893         (WebKit::CacheStorage::Engine::clearMemoryRepresentation):
2894         * NetworkProcess/cache/CacheStorageEngine.h:
2895         (WebKit::CacheStorage::Engine::rootPath const):
2896         (WebKit::CacheStorage::Engine::salt const):
2897         (WebKit::CacheStorage::Engine::nextCacheIdentifier):
2898         * NetworkProcess/cache/CacheStorageEngineCaches.cpp: Added.
2899         (WebKit::CacheStorage::cachesRootPath):
2900         (WebKit::CacheStorage::cachesListFilename):
2901         (WebKit::CacheStorage::Caches::Caches):
2902         (WebKit::CacheStorage::Caches::initialize):
2903         (WebKit::CacheStorage::Caches::find):
2904         (WebKit::CacheStorage::Caches::open):
2905         (WebKit::CacheStorage::Caches::remove):
2906         (WebKit::CacheStorage::encodeCacheNames):
2907         (WebKit::CacheStorage::decodeCachesNames):
2908         (WebKit::CacheStorage::Caches::readCachesFromDisk):
2909         (WebKit::CacheStorage::Caches::writeCachesToDisk):
2910         (WebKit::CacheStorage::Caches::clearMemoryRepresentation):
2911         (WebKit::CacheStorage::Caches::cacheInfos const):
2912         * NetworkProcess/cache/CacheStorageEngineCaches.h: Added.
2913         (WebKit::CacheStorage::Caches::create):
2914         (WebKit::CacheStorage::Caches::isInitialized const):
2915         (WebKit::CacheStorage::Caches::detach):
2916         * NetworkProcess/cache/CacheStorageEngineConnection.cpp:
2917         (WebKit::CacheStorageEngineConnection::clearMemoryRepresentation):
2918         * NetworkProcess/cache/CacheStorageEngineConnection.h:
2919         * NetworkProcess/cache/CacheStorageEngineConnection.messages.in:
2920         * NetworkProcess/cache/NetworkCacheData.cpp:
2921         (WebKit::NetworkCache::makeSalt):
2922         * NetworkProcess/cache/NetworkCacheData.h:
2923         * UIProcess/WebsiteData/WebsiteDataStore.h:
2924         * WebKit.xcodeproj/project.pbxproj:
2925         * WebProcess/Cache/WebCacheStorageConnection.cpp:
2926         (WebKit::WebCacheStorageConnection::clearMemoryRepresentation):
2927         * WebProcess/Cache/WebCacheStorageConnection.h:
2928
2929 2017-08-30  Brady Eidson  <beidson@apple.com>
2930
2931         Add "Identified" base class to replace a whole bunch of custom identifier generators.
2932         https://bugs.webkit.org/show_bug.cgi?id=176120
2933
2934         Reviewed by Alex Christensen.
2935
2936         * UIProcess/API/APIUserScript.cpp:
2937         (API::UserScript::UserScript):
2938         (API::generateIdentifier): Deleted.
2939         * UIProcess/API/APIUserScript.h:
2940
2941         * UIProcess/API/APIUserStyleSheet.cpp:
2942         (API::UserStyleSheet::UserStyleSheet):
2943         (API::generateIdentifier): Deleted.
2944         * UIProcess/API/APIUserStyleSheet.h:
2945
2946         * UIProcess/UserContent/WebScriptMessageHandler.cpp:
2947         (WebKit::WebScriptMessageHandler::WebScriptMessageHandler):
2948         (WebKit::generateIdentifier): Deleted.
2949         * UIProcess/UserContent/WebScriptMessageHandler.h:
2950         (WebKit::WebScriptMessageHandler::identifier const): Deleted.
2951
2952         * UIProcess/UserContent/WebUserContentControllerProxy.cpp:
2953         (WebKit::WebUserContentControllerProxy::WebUserContentControllerProxy):
2954         (WebKit::WebUserContentControllerProxy::~WebUserContentControllerProxy):
2955         (WebKit::WebUserContentControllerProxy::addProcess):
2956         (WebKit::WebUserContentControllerProxy::removeProcess):
2957         (WebKit::WebUserContentControllerProxy::addUserContentWorldUse):
2958         (WebKit::WebUserContentControllerProxy::removeUserContentWorldUses):
2959         (WebKit::WebUserContentControllerProxy::addUserScript):
2960         (WebKit::WebUserContentControllerProxy::removeUserScript):
2961         (WebKit::WebUserContentControllerProxy::removeAllUserScripts):
2962         (WebKit::WebUserContentControllerProxy::addUserStyleSheet):
2963         (WebKit::WebUserContentControllerProxy::removeUserStyleSheet):
2964         (WebKit::WebUserContentControllerProxy::removeAllUserStyleSheets):
2965         (WebKit::WebUserContentControllerProxy::addUserScriptMessageHandler):
2966         (WebKit::WebUserContentControllerProxy::removeUserMessageHandlerForName):
2967         (WebKit::WebUserContentControllerProxy::removeAllUserMessageHandlers):
2968         (WebKit::WebUserContentControllerProxy::addContentRuleList):
2969         (WebKit::WebUserContentControllerProxy::removeContentRuleList):
2970         (WebKit::WebUserContentControllerProxy::removeAllContentRuleLists):
2971         (WebKit::generateIdentifier): Deleted.
2972         * UIProcess/UserContent/WebUserContentControllerProxy.h:
2973         (WebKit::WebUserContentControllerProxy::identifier const): Deleted.
2974
2975         * UIProcess/VisitedLinkStore.cpp:
2976         (WebKit::VisitedLinkStore::~VisitedLinkStore):
2977         (WebKit::VisitedLinkStore::VisitedLinkStore):
2978         (WebKit::VisitedLinkStore::addProcess):
2979         (WebKit::VisitedLinkStore::removeProcess):
2980         (WebKit::VisitedLinkStore::removeAll):
2981         (WebKit::VisitedLinkStore::pendingVisitedLinksTimerFired):
2982         (WebKit::VisitedLinkStore::sendTable):
2983         (WebKit::generateIdentifier): Deleted.
2984         * UIProcess/VisitedLinkStore.h:
2985
2986         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2987         (WebKit::WebsiteDataStore::WebsiteDataStore):
2988         (WebKit::generateIdentifier): Deleted.
2989         * UIProcess/WebsiteData/WebsiteDataStore.h:
2990         (WebKit::WebsiteDataStore::identifier const): Deleted.
2991
2992         * WebProcess/Network/WebSocketStream.cpp:
2993         (WebKit::WebSocketStream::WebSocketStream):
2994         (WebKit::WebSocketStream::~WebSocketStream):
2995         (WebKit::WebSocketStream::messageSenderDestinationID):
2996         * WebProcess/Network/WebSocketStream.h:
2997
2998 2017-08-30  Brady Eidson  <beidson@apple.com>
2999
3000         Implement all of "Register" right up until where the script is fetched.
3001         https://bugs.webkit.org/show_bug.cgi?id=176082
3002
3003         Reviewed by Andy Estes.
3004
3005         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
3006         (WebKit::WebSWServerConnection::resolveJobInClient):
3007         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
3008         * WebProcess/Storage/WebSWClientConnection.messages.in:
3009
3010 2017-08-30  Andy Estes  <aestes@apple.com>
3011
3012         [Mac] Upstream Accessibility-related WebKitSystemInterface functions
3013         https://bugs.webkit.org/show_bug.cgi?id=176093
3014
3015         Reviewed by Eric Carlson.
3016
3017         * UIProcess/Cocoa/WebViewImpl.h:
3018         * UIProcess/Cocoa/WebViewImpl.mm:
3019         (WebKit::WebViewImpl::setAccessibilityWebProcessToken):
3020         (WebKit::WebViewImpl::updateRemoteAccessibilityRegistration):
3021         (WebKit::WebViewImpl::accessibilityRegisterUIProcessTokens):
3022         * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
3023         (InitWebCoreSystemInterface):
3024         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:
3025         * WebProcess/WebPage/mac/WebPageMac.mm:
3026         (WebKit::WebPage::platformInitialize):
3027         (WebKit::WebPage::registerUIProcessAccessibilityTokens):
3028
3029 2017-08-30  Carlos Alberto Lopez Perez  <clopez@igalia.com>
3030
3031         [WPE] Enable MEMORY_SAMPLER
3032         https://bugs.webkit.org/show_bug.cgi?id=176099
3033
3034         Reviewed by Michael Catanzaro.
3035
3036         Enable it at runtime if the environment variable WEBKIT_SAMPLE_MEMORY is set.
3037
3038         * UIProcess/API/wpe/WPEView.cpp:
3039         (WKWPE::m_compositingManagerProxy):
3040
3041 2017-08-30  Andy Estes  <aestes@apple.com>
3042
3043         [Mac] Upstream Carbon-related WebKitSystemInterface functions
3044         https://bugs.webkit.org/show_bug.cgi?id=176087
3045
3046         Reviewed by Alex Christensen.
3047
3048         * PluginProcess/mac/PluginProcessMac.mm:
3049         (WebKit::cgWindowID):
3050         * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
3051         (WebKit::scriptCodeFromCurrentKeyboardInputSource):
3052         (WebKit::NetscapePlugin::sendComplexTextInput):
3053
3054 2017-08-30  Carlos Garcia Campos  <cgarcia@igalia.com>
3055
3056         Unreviewed. Try to fix layout test timing out after r221344.
3057
3058         There seems to be an infinite loop in the web process when WebPage::platformEditorState is called with non
3059         content editable result.
3060
3061         * WebProcess/WebPage/gtk/WebPageGtk.cpp:
3062         (WebKit::WebPage::platformEditorState const):
3063
3064 2017-08-29  Carlos Garcia Campos  <cgarcia@igalia.com>
3065
3066         REGRESSION(r221064): [GTK] Editor not correctly working after r221064
3067         https://bugs.webkit.org/show_bug.cgi?id=176052
3068
3069         Reviewed by Michael Catanzaro.
3070
3071         Since r221064 we are not always notified about typing attributes when editor state changes. didChangeSelection
3072         no longer includes the typing attributes in EditorStateChange message, it's scheduled to be sent after the
3073         compositing layer have been flushed, but that part is not implemented for GTK+ port.
3074
3075         Fixes test /webkit2/WebKitWebView/editor-state/typing-attributes.
3076
3077         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
3078         (WebKit::AcceleratedDrawingArea::updateBackingStoreState): Call WebPage::flushPendingEditorStateUpdate() after
3079         the layout.
3080         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
3081         (WebKit::CoordinatedLayerTreeHost::layerFlushTimerFired): Call WebPage::flushPendingEditorStateUpdate() after
3082         the display sync.
3083         * WebProcess/WebPage/DrawingAreaImpl.cpp:
3084         (WebKit::DrawingAreaImpl::display): Call WebPage::flushPendingEditorStateUpdate() after the layout.
3085         * WebProcess/WebPage/gtk/WebPageGtk.cpp:
3086         (WebKit::WebPage::platformEditorState const): Also return early, setting isMissingPostLayoutData to true, when
3087         there's no frame view, the view needs a layout or the result is not for editable content.
3088
3089 2017-08-29  Brent Fulgham  <bfulgham@apple.com>
3090
3091         ResourceLoadStatistics logic does not understand custom WebsiteData stores
3092         https://bugs.webkit.org/show_bug.cgi?id=176037
3093         <rdar://problem/33338238>
3094
3095         Reviewed by Alex Christensen.
3096
3097         The NetworkProcess::updateCookiePartitioningForTopPrivatelyOwnedDomains always notifies the default website
3098         data store about observations it has made. This should be revised so that WebKit clients that register
3099         custom data stores through the WKWebsiteDataStores API can be assured that observations made in one session
3100         do not manipulate data from another session.
3101
3102         * NetworkProcess/NetworkProcess.cpp:
3103         (WebKit::NetworkProcess::updateCookiePartitioningForTopPrivatelyOwnedDomains): Use the passed sessionID to locate
3104         the correct NetworkStorageSession to notify about the new partitioning data.
3105         * NetworkProcess/NetworkProcess.h:
3106         * NetworkProcess/NetworkProcess.messages.in: Accept new argument.
3107         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3108         (WebKit::WebsiteDataStore::updateCookiePartitioningForTopPrivatelyOwnedDomains): Include the WebsiteDataStore's
3109         session ID in the message to update cookie partition data.
3110
3111 2017-08-29  Alex Christensen  <achristensen@webkit.org>
3112
3113         Automatically determine if a class has a modern decoder
3114         https://bugs.webkit.org/show_bug.cgi?id=176084
3115
3116         Reviewed by Sam Weinig.
3117
3118         Instead of determining if ModernDecoder is defined in the class,
3119         just check the signature of the decode member function.
3120
3121         * Platform/IPC/ArgumentCoder.h:
3122         (): Deleted.
3123         * Shared/WebPageCreationParameters.h:
3124         * Shared/WebPageGroupData.h:
3125         * Shared/WebsitePolicies.h:
3126
3127 2017-08-29  Alex Christensen  <achristensen@webkit.org>
3128
3129         Begin transition to modern IPC decoding
3130         https://bugs.webkit.org/show_bug.cgi?id=176043
3131
3132         Reviewed by JF Bastien.
3133
3134         Right now, if a class is decoded from IPC we must have a default constructor.
3135         This prevents us from having Ref or C++ references in such types, which is cluttering up our code.
3136         This is because IPC::decode makes a default-constructed object, fills it, and returns a bool indicating success.
3137         Making IPC::decode instead return a std::optional makes it so we do not need to call an empty constructor.
3138         This could also enable us to add IPC::Decoder::operator>> and other fun things!
3139         I also modernized two arbitrary classes, WebsitePolicies and WebPageGroupData with more to come.
3140         There's no good way to update the actual generated IPC code until each class has been transitioned.
3141
3142         * Platform/IPC/ArgumentCoder.h:
3143         (IPC::ArgumentCoder::decode):
3144         * Platform/IPC/Decoder.h:
3145         (IPC::Decoder::decode):
3146         * Shared/WebPageCreationParameters.cpp:
3147         (WebKit::WebPageCreationParameters::decode):
3148         * Shared/WebPageCreationParameters.h:
3149         * Shared/WebPageGroupData.cpp:
3150         (WebKit::WebPageGroupData::decode):
3151         * Shared/WebPageGroupData.h:
3152         * Shared/WebsitePolicies.h:
3153         (WebKit::WebsitePolicies::decode):
3154
3155 2017-08-29  Youenn Fablet  <youenn@apple.com>
3156
3157         Setting the cache storage engine root path according the session WebsiteDataStore
3158         https://bugs.webkit.org/show_bug.cgi?id=176055
3159
3160         Reviewed by Alex Christensen.
3161
3162         Adding disk read/write capacities to CacheStorage engine.
3163         This is used to store per-origin cache names in a file.
3164         Making Engine a thread safe refcounted object so that it does read/write in a background thread.
3165
3166         Setting the root path of the engine to the directory set for the session in use according the WebsiteDataStore.
3167         For each WebsiteDataStore, a path and a sandbox extension is passed to the network process if persistency of the cache storage is wanted.
3168         Ephemeral sessions will set the path of the engine to null so that no read/write access is performed.
3169
3170         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3171         (WebKit::NetworkConnectionToWebProcess::ensureLegacyPrivateBrowsingSession):
3172         * NetworkProcess/NetworkProcess.cpp:
3173         (WebKit::NetworkProcess::initializeNetworkProcess):
3174         (WebKit::NetworkProcess::cacheStorageDirectory const):
3175         * NetworkProcess/NetworkProcess.h:
3176         * NetworkProcess/cache/CacheStorageEngine.cpp:
3177         (WebKit::CacheStorage::Engine::from):
3178         (WebKit::CacheStorage::Engine::defaultEngine):
3179         (WebKit::CacheStorage::Engine::Engine):
3180         (WebKit::CacheStorage::Engine::writeFile):
3181         * NetworkProcess/cache/CacheStorageEngine.h:
3182         (WebKit::CacheStorage::Engine::create):
3183         (WebKit::CacheStorage::Engine::shouldPersist const):
3184         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
3185         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
3186         * NetworkProcess/mac/RemoteNetworkingContext.mm:
3187         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
3188         * Shared/WebsiteDataStoreParameters.cpp:
3189         (WebKit::WebsiteDataStoreParameters::encode const):
3190         (WebKit::WebsiteDataStoreParameters::decode):
3191         * Shared/WebsiteDataStoreParameters.h:
3192         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
3193         (WebKit::WebsiteDataStore::parameters):
3194
3195 2017-08-29  Chris Dumez  <cdumez@apple.com>
3196
3197         Add initial support for dataTransferItem.webkitGetAsEntry()
3198         https://bugs.webkit.org/show_bug.cgi?id=176038
3199         <rdar://problem/34121095>
3200
3201         Reviewed by Wenson Hsieh.
3202
3203         Make dataTransfer.items an experimental feature so that it can be easily
3204         turned on from the Develop menu, for testing convenience.
3205
3206         * Shared/WebPreferencesDefinitions.h:
3207
3208 2017-08-29  Andy Estes  <aestes@apple.com>
3209
3210         [Mac] Upstream WKSetMetadataURL() from WebKitSystemInterface
3211         https://bugs.webkit.org/show_bug.cgi?id=176046
3212
3213         Reviewed by Alex Christensen.
3214
3215         * UIProcess/mac/WebPageProxyMac.mm:
3216         (WebKit::WebPageProxy::savePDFToTemporaryFolderAndOpenWithNativeApplicationRaw):
3217         * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
3218         (InitWebCoreSystemInterface):
3219
3220 2017-08-28  Andy Estes  <aestes@apple.com>
3221
3222         [Cocoa] Upstream WKGetWebDefaultCFStringEncoding()
3223         https://bugs.webkit.org/show_bug.cgi?id=176039
3224
3225         Reviewed by Alex Christensen.
3226
3227         * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
3228         (InitWebCoreSystemInterface):
3229
3230 2017-08-28  Megan Gardner  <megan_gardner@apple.com>
3231
3232         Fix incorrect enum in atBoundaryOfGranularity call
3233         https://bugs.webkit.org/show_bug.cgi?id=176004
3234
3235         Reviewed by Wenson Hsieh and Enrica Casucci
3236
3237         Enum that was being used was incorrect, as that case in not covered in called function.
3238         Resulted in a no-op. Should now have correct behavior around line boundaries.
3239         
3240         Not possible to add tests for selections with velocity. Will attempt to add this behavior later.
3241
3242         * WebProcess/WebPage/ios/WebPageIOS.mm:
3243         (WebKit::rangeAtWordBoundaryForPosition):
3244
3245 2017-08-28  Stephan Szabo  <stephan.szabo@sony.com>
3246
3247         [WinCairo] Add PlatformWin cmake for Webkit
3248         https://bugs.webkit.org/show_bug.cgi?id=176027
3249
3250         Reviewed by Brent Fulgham.
3251
3252         * PlatformWin.cmake: Added.
3253
3254 2017-08-28  Andy Estes  <aestes@apple.com>
3255
3256         [Cocoa] Upstream CFNetwork-related WebKitSystemInterface functions
3257         https://bugs.webkit.org/show_bug.cgi?id=176032
3258
3259         Reviewed by Alex Christensen.
3260
3261         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3262         (WebKit::privateBrowsingSession):
3263         * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
3264         (InitWebCoreSystemInterface):
3265         * WebProcess/WebPage/mac/WebPageMac.mm:
3266         (WebKit::WebPage::platformHasLocalDataForURL):
3267         (WebKit::cachedResponseForURL):
3268
3269 2017-08-28  Brent Fulgham  <bfulgham@apple.com>
3270
3271         Disable access to secure cookies if an HTTPS site loads mixed content (Part 2: Header Requests)
3272         https://bugs.webkit.org/show_bug.cgi?id=175992
3273         <rdar://problem/34086613>
3274
3275         Reviewed by Daniel Bates.
3276
3277         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3278         (WebKit::NetworkConnectionToWebProcess::cookiesForDOM): Use a better label than 'result'.
3279         (WebKit::NetworkConnectionToWebProcess::cookieRequestHeaderFieldValue): Modify to accept a flag
3280         indicating if secure cookies should be included, and return a pair containing the resulting
3281         cookie string and a boolean indicating if secure cookies were accessed.
3282         * NetworkProcess/NetworkConnectionToWebProcess.h:
3283         * NetworkProcess/NetworkConnectionToWebProcess.messages.in: Ditto.
3284         * Shared/mac/CookieStorageShim.mm:
3285         (WebKit::webKitCookieStorageCopyRequestHeaderFieldsForURL): Ditto.
3286         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
3287         (WebKit::WebPlatformStrategies::cookieRequestHeaderFieldValue): Ditto.
3288         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
3289
3290 2017-08-28  Alex Christensen  <achristensen@webkit.org>
3291
3292         Add WKUIDelegatePrivate equivalent of WKPageUIClient's didExceedBackgroundResourceLimitWhileInForeground
3293         https://bugs.webkit.org/show_bug.cgi?id=176028
3294         <rdar://problem/29270035>
3295
3296         Reviewed by Andy Estes.
3297
3298         An API test for this did not succeed with either the memory or CPU limit calls,
3299         possibly because the app must be in the foreground for this call to be made.
3300
3301         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
3302         * UIProcess/Cocoa/UIDelegate.h:
3303         * UIProcess/Cocoa/UIDelegate.mm:
3304         (WebKit::UIDelegate::setDelegate):
3305         (WebKit::toWKResourceLimit):
3306         (WebKit::UIDelegate::UIClient::didExceedBackgroundResourceLimitWhileInForeground):
3307
3308 2017-08-28  Carlos Garcia Campos  <cgarcia@igalia.com>
3309
3310         WebDriver: implement screen capture commands
3311         https://bugs.webkit.org/show_bug.cgi?id=174615
3312
3313         Reviewed by Brian Burg.
3314
3315         Extend takeScreenshot command to optionally take a screenshot of an element. When no element is provided, the
3316         screenshot is taken from the page visible area.
3317
3318         * PlatformGTK.cmake: Add WebAutomationSessionCairo.cpp to compilation.
3319         * PlatformWPE.cmake: Ditto.
3320         * UIProcess/Automation/Automation.json: Add ScreenshotError and several optional parameters to takeScreenshot.
3321         * UIProcess/Automation/WebAutomationSession.cpp:
3322         (WebKit::WebAutomationSession::takeScreenshot): Receive optional frame, node and scrollIntoView that are
3323         checked and passed to the web process.
3324         * UIProcess/Automation/WebAutomationSession.h:
3325         * UIProcess/Automation/cairo/WebAutomationSessionCairo.cpp: Added.
3326         (WebKit::WebAutomationSession::platformGetBase64EncodedPNGData): Cairo implementation.
3327         * UIProcess/Automation/gtk/WebAutomationSessionGtk.cpp:
3328         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
3329         (WebKit::snapshotRectForScreenshot): Helper to get the rectangle to be used for a screenshot.
3330         (WebKit::WebAutomationSessionProxy::takeScreenshot): If a node handle is provided take the snapshot using the
3331         element rectangle, otherwise use the page visible content rectangle.
3332         * WebProcess/Automation/WebAutomationSessionProxy.h:
3333         * WebProcess/Automation/WebAutomationSessionProxy.messages.in: Update TakeSnapshot message.
3334
3335 2017-08-28  Carlos Garcia Campos  <cgarcia@igalia.com>
3336
3337         Automation: takeScreenshot should use the visible content rect not the document rect
3338         https://bugs.webkit.org/show_bug.cgi?id=175665
3339
3340         Reviewed by Brian Burg.
3341
3342         According to the spec, we should get the toplevel browsing context document rectangle and take a screenshot of
3343         it using the current viewport width and height. We are currently using the document size.
3344
3345         19. Screen Capture.
3346         https://w3c.github.io/webdriver/webdriver-spec.html#dfn-draw-a-bounding-box-from-the-framebuffer
3347
3348         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
3349         (WebKit::WebAutomationSessionProxy::takeScreenshot): Use FrameView::visibleContentRect().
3350
3351 2017-08-28  Carlos Garcia Campos  <cgarcia@igalia.com>
3352
3353         [GTK][WPE] ASSERTION FAILED: !isOpen() in WebKit::IconDatabase::~IconDatabase()
3354         https://bugs.webkit.org/show_bug.cgi?id=175719
3355
3356         Reviewed by Michael Catanzaro.
3357
3358         This is happening always when running /webkit2/WebKitFaviconDatabase/favicon-database-test in debug builds. The
3359         last step we do is removing all icons, then the test finishes, which destroys the WebKitFaviconDatabase object
3360         that closes the icon database on dispose. The problem is that removing all icons schedules a main thread
3361         notification and IconDatabase is not considered closed until all main thread callbacks have been dispatched. This
3362         is never going to happen in the test, because the main loop is no longer running at that point. I don't think
3363         it's worth it to consider the database open while main thread callbacks are pending, they are just notifications
3364         and the client is no longer insterested on them afer closing the database. I think it's bettter and simpler to
3365         simply cancel the pending callbacks on database close. That ensures that isOpen() after close() is always
3366         false. This patch adds a helper private class to schedule notifications to the main thread that can be cancelled
3367         on database close. It also removes the didClose() notification because it was unused and because it's pointless
3368         now that we know the database is closed after close().
3369
3370         * UIProcess/API/glib/IconDatabase.cpp:
3371         (WebKit::IconDatabase::open): Mark the main thread notifier as active.
3372         (WebKit::IconDatabase::close): Mark the main thread notifier as not active.
3373         (WebKit::IconDatabase::IconDatabase): Remove m_mainThreadCallbackCount initialization.
3374         (WebKit::IconDatabase::isOpen const): Do what isOpenBesidesMainThreadCallbacks() used to do.
3375         (WebKit::IconDatabase::removeAllIconsOnThread): Remove the notification because it's currently unused.
3376         (WebKit::IconDatabase::dispatchDidImportIconURLForPageURLOnMainThread): Use MainThreadNotifier.
3377         (WebKit::IconDatabase::dispatchDidImportIconDataForPageURLOnMainThread): Ditto.
3378         (WebKit::IconDatabase::dispatchDidFinishURLImportOnMainThread): Ditto.
3379         (WebKit::IconDatabase::isOpenBesidesMainThreadCallbacks const): Deleted.
3380         (WebKit::IconDatabase::checkClosedAfterMainThreadCallback): Deleted.
3381         (WebKit::IconDatabase::dispatchDidRemoveAllIconsOnMainThread): Deleted.
3382         * UIProcess/API/glib/IconDatabase.h:
3383         (WebKit::IconDatabaseClient::didChangeIconForPageURL):
3384         (WebKit::IconDatabaseClient::didFinishURLImport):
3385         (WebKit::IconDatabase::MainThreadNotifier::MainThreadNotifier):
3386         (WebKit::IconDatabase::MainThreadNotifier::setActive):
3387         (WebKit::IconDatabase::MainThreadNotifier::notify):
3388         (WebKit::IconDatabase::MainThreadNotifier::stop):
3389         (WebKit::IconDatabase::MainThreadNotifier::timerFired):
3390         (WebKit::IconDatabaseClient::didRemoveAllIcons): Deleted.
3391         (WebKit::IconDatabaseClient::didClose): Deleted.
3392
3393 2017-08-27  Wenson Hsieh  <wenson_hsieh@apple.com>
3394
3395         Picking an emoji via the emoji dialog (Ctrl+Cmd+Space) fires inconsistent beforeinput events.
3396         https://bugs.webkit.org/show_bug.cgi?id=170955
3397         <rdar://problem/31697653>
3398
3399         Reviewed by Ryosuke Niwa.
3400
3401         Currently, we insert text with TextEventInputAutocompletion as the text event input type if any text range to
3402         replace was specified by the platform. Instead, limit this only to when the text replacement range is not empty.
3403         This more closely matches the intention of the spec, which states that the "insertReplacementText" inputType
3404         should be used when "[replacing] existing text by means of a spell checker, auto-correct or similar".
3405