[WPE] Implement WebsiteDataStore::defaultApplicationCacheDirectory() and friends
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2017-08-08  Adrian Perez de Castro  <aperez@igalia.com>
2
3         [WPE] Implement WebsiteDataStore::defaultApplicationCacheDirectory() and friends
4         https://bugs.webkit.org/show_bug.cgi?id=175322
5
6         Reviewed by Carlos Garcia Campos.
7
8         This makes WPE use the same implementation as the GTK+ port, with a preprocessor switch to choose the name of
9         the base directory inside the user XDG cache directory.
10
11         * PlatformGTK.cmake: Add APIWebsiteDataStoreGLib.cpp to the build sources and remove APIWebsiteDataStoreGtk.cpp.
12         * PlatformWPE.cmake: Add APIWebsiteDataStoreGLib.cpp to the built sources.
13         * UIProcess/API/APIWebsiteDataStore.cpp: Remove now dead code.
14         * UIProcess/API/glib/APIWebsiteDataStoreGLib.cpp: Renamed from Source/WebKit/UIProcess/API/gtk/APIWebsiteDataStoreGtk.cpp.
15         (API::WebsiteDataStore::defaultApplicationCacheDirectory):
16         (API::WebsiteDataStore::defaultIndexedDBDatabaseDirectory):
17         (API::WebsiteDataStore::defaultLocalStorageDirectory):
18         (API::WebsiteDataStore::defaultMediaKeysStorageDirectory):
19         (API::WebsiteDataStore::defaultWebSQLDatabaseDirectory):
20         (API::WebsiteDataStore::defaultResourceLoadStatisticsDirectory):
21
22 2017-08-08  Ryan Haddad  <ryanhaddad@apple.com>
23
24         Unreviewed, rolling out r220368.
25
26         This change caused WK1 tests to exit early with crashes.
27
28         Reverted changeset:
29
30         "Baseline JIT should do caging"
31         https://bugs.webkit.org/show_bug.cgi?id=175037
32         http://trac.webkit.org/changeset/220368
33
34 2017-08-08  Michael Catanzaro  <mcatanzaro@igalia.com>
35
36         [CMake] Properly test if compiler supports compiler flags
37         https://bugs.webkit.org/show_bug.cgi?id=174490
38
39         Reviewed by Konstantin Tokarev.
40
41         * CMakeLists.txt:
42         * PlatformGTK.cmake:
43
44 2017-08-07  Carlos Garcia Campos  <cgarcia@igalia.com>
45
46         Web Automation: setUserInputForCurrentJavaScriptPrompt should fail if current dialog is not a prompt
47         https://bugs.webkit.org/show_bug.cgi?id=175261
48
49         Reviewed by Brian Burg.
50
51         According to the spec, send alert text command should fail if the current dialog is not a prompt. This patch
52         adds JavaScriptDialogType enum to API::AutomationSessionClient and a new virtual method to ask the client about
53         the type of the current dialog. WebAutomationSession::setUserInputForCurrentJavaScriptPrompt() uses the new
54         client method to check the type of the current dialog and fail in case it's not a prompt. Cocoa needs an
55         implementation, for now it always returns Prompt as the type to keep compatibility.
56
57         18.4 Send Alert Text.
58         https://w3c.github.io/webdriver/webdriver-spec.html#send-alert-text
59
60         This fixes selenium test testSettingTheValueOfAnAlertThrows.
61
62         * UIProcess/API/APIAutomationSessionClient.h:
63         (API::AutomationSessionClient::typeOfCurrentJavaScriptDialogOnPage):
64         * UIProcess/API/glib/WebKitAutomationSession.cpp:
65         * UIProcess/API/glib/WebKitWebView.cpp:
66         (webkitWebViewGetCurrentScriptDialogType):
67         * UIProcess/API/glib/WebKitWebViewPrivate.h:
68         * UIProcess/Automation/Automation.json:
69         * UIProcess/Automation/WebAutomationSession.cpp:
70         (WebKit::WebAutomationSession::setUserInputForCurrentJavaScriptPrompt):
71         * UIProcess/Cocoa/AutomationSessionClient.h:
72         * UIProcess/Cocoa/AutomationSessionClient.mm:
73         (WebKit::AutomationSessionClient::typeOfCurrentJavaScriptDialogOnPage):
74
75 2017-08-08  Wenson Hsieh  <wenson_hsieh@apple.com>
76
77         [iOS WK2] WKWebView schedules nonstop layout after pressing cmb+b,i,u inside a contenteditable div
78         https://bugs.webkit.org/show_bug.cgi?id=175116
79         <rdar://problem/28279301>
80
81         Reviewed by Darin Adler and Ryosuke Niwa.
82
83         Refactors WebPage::editorState to only use the StyleProperties derived from EditingStyle, instead of inserting
84         and removing a temporary node to figure out the style. Also adds hooks to notify the UI delegate of EditorState
85         changes.
86
87         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
88         * UIProcess/API/Cocoa/WKWebView.mm:
89         (nsTextAlignment):
90         (dictionaryRepresentationForEditorState):
91         (-[WKWebView _didChangeEditorState]):
92
93         Alerts the private UI delegate of UI-side EditorState updates.
94
95         (-[WKWebView _web_editorStateDidChange]):
96         (-[WKWebView _executeEditCommand:argument:completion:]):
97         * UIProcess/API/Cocoa/WKWebViewInternal.h:
98         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
99         * UIProcess/API/mac/WKView.mm:
100         (-[WKView _web_editorStateDidChange]):
101         * UIProcess/Cocoa/WebViewImpl.h:
102         * UIProcess/Cocoa/WebViewImpl.mm:
103         (WebKit::WebViewImpl::selectionDidChange):
104         * UIProcess/WebPageProxy.cpp:
105         (WebKit::WebPageProxy::executeEditCommand):
106
107         Change executeEditCommand(name, callback) to executeEditCommand(name, argument, callback) and lift out of iOS
108         platform code and into WebPage.cpp.
109
110         * UIProcess/WebPageProxy.h:
111         * UIProcess/ios/WKContentViewInteraction.mm:
112         (-[WKContentView executeEditCommandWithCallback:]):
113         (-[WKContentView _selectionChanged]):
114         * UIProcess/ios/WebPageProxyIOS.mm:
115         (WebKit::WebPageProxy::executeEditCommand): Deleted.
116
117         Move the iOS-specific implementation of executeEditCommand that invokes a callback when the web process responds
118         out of WebPageProxyIOS, and into cross-platform WebPageProxy code. Additionally, add a parameter for the edit
119         command's argument.
120
121         * WebProcess/WebPage/WebPage.cpp:
122         (WebKit::WebPage::editorState const):
123
124         Use EditingStyle::styleAtSelectionStart instead of Editor::styleForSelectionStart when computing an EditorState.
125         Tweak bold, italic and underline to use EditingStyle TriStates.
126
127         (WebKit::shouldEnsureEditorStateUpdateAfterExecutingCommand):
128         (WebKit::WebPage::executeEditCommandWithCallback):
129         * WebProcess/WebPage/WebPage.h:
130         * WebProcess/WebPage/WebPage.messages.in:
131         * WebProcess/WebPage/ios/WebPageIOS.mm:
132         (WebKit::WebPage::executeEditCommandWithCallback): Deleted.
133
134 2017-08-08  Zan Dobersek  <zdobersek@igalia.com>
135
136         [TexMap] Don't expose GraphicsContext3D object
137         https://bugs.webkit.org/show_bug.cgi?id=175310
138
139         Reviewed by Carlos Garcia Campos.
140
141         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
142         (WebKit::CoordinatedGraphicsScene::paintToCurrentGLContext):
143         Stop using GraphicsContext3D directly and instead use the
144         TextureMapper::clearColor() method to achieve the same result.
145
146 2017-08-07  Carlos Garcia Campos  <cgarcia@igalia.com>
147
148         [GTK] Implement JavaScript dialog methods of API::AutomationSessionClient
149         https://bugs.webkit.org/show_bug.cgi?id=175259
150
151         Reviewed by Michael Catanzaro.
152
153         Move the default implementation of WebKitScriptDialog from WebKitWebView platform specific files to their own
154         files. Implement all JavaScript dialog methods of API::AutomationSessionClient in WebKitAutomationSession. For
155         now it only works when the user doesn't override WebKitWebView::script-dialog signal and default implementation
156         is used.
157
158         * PlatformGTK.cmake: Add new files to compilation.
159         * PlatformWPE.cmake: Ditto.
160         * UIProcess/API/glib/WebKitAutomationSession.cpp:
161         (webkitAutomationSessionCreate): Pass the WebKitWebContext to the constructor and keep a pointer to it in session.
162         * UIProcess/API/glib/WebKitAutomationSessionPrivate.h:
163         * UIProcess/API/glib/WebKitScriptDialogPrivate.h:
164         * UIProcess/API/glib/WebKitWebContext.cpp:
165         * UIProcess/API/glib/WebKitWebView.cpp:
166         (webkitWebViewRunJavaScriptAlert): Set the currently script dialog for the scope of the function.
167         (webkitWebViewRunJavaScriptConfirm): Ditto.
168         (webkitWebViewRunJavaScriptPrompt): Ditto.
169         (webkitWebViewRunJavaScriptBeforeUnloadConfirm): Ditto.
170         (webkitWebViewIsShowingScriptDialog): Ask current dialog if there's one.
171         (webkitWebViewGetCurrentScriptDialogMessage): Ditto.
172         (webkitWebViewSetCurrentScriptDialogUserInput): Ditto.
173         (webkitWebViewAcceptCurrentScriptDialog): Ditto.
174         (webkitWebViewDismissCurrentScriptDialog): Ditto.
175         * UIProcess/API/glib/WebKitWebViewPrivate.h:
176         * UIProcess/API/gtk/WebKitScriptDialogGtk.cpp: Added.
177         (webkitWebViewCreateJavaScriptDialog): Moved from WebKitWebViewGtk.cpp.
178         (webkitScriptDialogRun): Run the dialog, this code is moved from WebKitWebViewGtk.cpp.
179         (webkitScriptDialogIsRunning): Return true if the script dialog has a native dialog running.
180         (webkitScriptDialogAccept): Send Ok or Close response to the native dialog depending on the dialog type.
181         (webkitScriptDialogDismiss): Send Close response to the native dialog.
182         (webkitScriptDialogSetUserInput): Set the given text on the prompt dialog entry.
183         * UIProcess/API/gtk/WebKitWebViewGtk.cpp:
184         (webkitWebViewScriptDialog): Simply call webkitScriptDialogRun() now.
185         * UIProcess/API/wpe/WebKitScriptDialogWPE.cpp: Copied from Source/WebKit/UIProcess/API/glib/WebKitAutomationSessionPrivate.h.
186         (webkitScriptDialogRun):
187         (webkitScriptDialogIsRunning):
188         (webkitScriptDialogAccept):
189         (webkitScriptDialogDismiss):
190         (webkitScriptDialogSetUserInput):
191
192 2017-08-07  Devin Rousso  <drousso@apple.com>
193
194         Web Inspector: Preview Canvas path when viewing a recording
195         https://bugs.webkit.org/show_bug.cgi?id=174967
196
197         Reviewed by Brian Burg.
198
199         * Shared/WebPreferencesDefinitions.h:
200         * UIProcess/API/C/WKPreferencesRefPrivate.h:
201         * UIProcess/API/C/WKPreferences.cpp:
202         (WKPreferencesSetInspectorAdditionsEnabled):
203         (WKPreferencesGetInspectorAdditionsEnabled):
204         * WebProcess/WebPage/WebPage.cpp:
205         (WebKit::WebPage::updatePreferences):
206         Add plumbing for new InspectorAdditions runtime flag.
207
208         * WebProcess/WebPage/WebInspectorUI.cpp:
209         (WebKit::WebInspectorUI::WebInspectorUI):
210         Enable InspectorAdditions by default in the WebInspector page.
211
212 2017-08-07  Filip Pizlo  <fpizlo@apple.com>
213
214         Baseline JIT should do caging
215         https://bugs.webkit.org/show_bug.cgi?id=175037
216
217         Reviewed by Mark Lam.
218         
219         Use a better API to disable disabling the primitive gigacage.
220
221         * WebProcess/WebProcess.cpp:
222         (WebKit::m_webSQLiteDatabaseTracker):
223         (WebKit::primitiveGigacageDisabled): Deleted.
224
225 2017-08-06  Filip Pizlo  <fpizlo@apple.com>
226
227         Primitive auxiliaries and JSValue auxiliaries should have separate gigacages
228         https://bugs.webkit.org/show_bug.cgi?id=174919
229
230         Reviewed by Keith Miller.
231         
232         The disable callback is all about the primitive gigacage.
233
234         * WebProcess/WebProcess.cpp:
235         (WebKit::primitiveGigacageDisabled):
236         (WebKit::m_webSQLiteDatabaseTracker):
237         (WebKit::gigacageDisabled): Deleted.
238
239 2017-08-07  Brian Burg  <bburg@apple.com>
240
241         Remove CANVAS_PATH compilation guard
242         https://bugs.webkit.org/show_bug.cgi?id=175207
243
244         Reviewed by Sam Weinig.
245
246         * Configurations/FeatureDefines.xcconfig:
247
248 2017-08-07  Carlos Alberto Lopez Perez  <clopez@igalia.com>
249
250         [WPE][CMake] Only pass pkg-config CFLAGS from (E)GL when not using libepoxy.
251         https://bugs.webkit.org/show_bug.cgi?id=175125
252
253         Reviewed by Michael Catanzaro.
254
255         * CMakeLists.txt: When using libepoxy avoid passing the CFLAGS from (E)GL,
256         and instead pass the libepoxy ones.
257
258 2017-08-07  Carlos Alberto Lopez Perez  <clopez@igalia.com>
259
260         [GTK][WPE] CFLAGS from pkg-config for (E)GL are not passed to WebKit
261         https://bugs.webkit.org/show_bug.cgi?id=175125
262
263         Unreviewed follow-up fix after r220326.
264
265         * CMakeLists.txt: Move the block appending to WebKit2_LIBRARIES
266         below where the list itself is created.
267
268 2017-08-05  Carlos Garcia Campos  <cgarcia@igalia.com>
269
270         [GTK][WPE] Add API to provide browser information required by automation
271         https://bugs.webkit.org/show_bug.cgi?id=175130
272
273         Reviewed by Michael Catanzaro.
274
275         When a new automation session is started, the web driver receives some required capabilities from the client,
276         like browser name and version. The session should be rejected if those required capabilities don't match with
277         the actual browser that is launched. We don't know that information in WebKit, so we need to add API so that
278         users can provide it when a new session request is made. This patch adds boxed object WebKitApplicationInfo that
279         can be used to set the application name and version. This object can be set to a WebKitAutomationSession when
280         WebKitWebContext::automation-started signal is emitted.
281
282         * PlatformGTK.cmake:
283         * PlatformWPE.cmake:
284         * UIProcess/API/glib/WebKitApplicationInfo.cpp: Added.
285         (webkit_application_info_new):
286         (webkit_application_info_ref):
287         (webkit_application_info_unref):
288         (webkit_application_info_set_name):
289         (webkit_application_info_get_name):
290         (webkit_application_info_set_version):
291         (webkit_application_info_get_version):
292         * UIProcess/API/glib/WebKitAutomationSession.cpp:
293         (webkitAutomationSessionDispose):
294         (webkit_automation_session_class_init):
295         (webkitAutomationSessionGetBrowserName):
296         (webkitAutomationSessionGetBrowserVersion):
297         (webkit_automation_session_set_application_info):
298         (webkit_automation_session_get_application_info):
299         * UIProcess/API/glib/WebKitAutomationSessionPrivate.h:
300         * UIProcess/API/glib/WebKitWebContext.cpp:
301         * UIProcess/API/gtk/WebKitApplicationInfo.h: Added.
302         * UIProcess/API/gtk/WebKitAutomationSession.h:
303         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
304         * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml:
305         * UIProcess/API/gtk/webkit2.h:
306         * UIProcess/API/wpe/WebKitApplicationInfo.h: Added.
307         * UIProcess/API/wpe/WebKitAutomationSession.h:
308         * UIProcess/API/wpe/webkit.h:
309
310 2017-08-06  Carlos Alberto Lopez Perez  <clopez@igalia.com>
311
312         [GTK][WPE] CFLAGS from pkg-config for (E)GL are not passed to WebKit
313         https://bugs.webkit.org/show_bug.cgi?id=175125
314
315         Reviewed by Michael Catanzaro.
316
317         Some platforms define cflags on the (E)GL pkg-config files that we
318         need to pass to the build system when including the (E)GL headers.
319         And we are already doing this when building WebCore (after r184954).
320
321         But now we need to do this also on WebKit (former WebKit2) because
322         we include (E)GL headers (and make use of them) on the UIProcess.
323
324         * CMakeLists.txt:
325
326 2017-08-05  Carlos Garcia Campos  <cgarcia@igalia.com>
327
328         WebDriver: Implement page load strategy
329         https://bugs.webkit.org/show_bug.cgi?id=175183
330
331         Reviewed by Brian Burg.
332
333         Split pending navigation maps into normal and eager, and use one or the other depending on the received page
334         load strategy. We need to keep different maps for every page load strategy because every command could use a
335         different strategy.
336
337         * UIProcess/Automation/WebAutomationSession.cpp:
338         (WebKit::WebAutomationSession::waitForNavigationToComplete): Extract page load strategy from parameter and pass
339         it to waitForNavigationToCompleteOnPage() and waitForNavigationToCompleteOnFrame().
340         (WebKit::WebAutomationSession::waitForNavigationToCompleteOnPage): Return early if page load strategy is
341         none. Otherwise at the pening callback to the normal or eager map depeding on the page load straegy.
342         (WebKit::WebAutomationSession::waitForNavigationToCompleteOnFrame): Ditto.
343         (WebKit::respondToPendingNavigationCallbacksWithTimeout): Helper to send pening navigation callback in case of
344         timeout failure.
345         (WebKit::WebAutomationSession::loadTimerFired): Call finishPendingNavigationsWithTimeoutFailure() with all the maps.
346         (WebKit::WebAutomationSession::navigateBrowsingContext): Extract page load strategy from parameter and pass it
347         to waitForNavigationToCompleteOnPage().
348         (WebKit::WebAutomationSession::goBackInBrowsingContext): Ditto.
349         (WebKit::WebAutomationSession::goForwardInBrowsingContext): Ditto.
350         (WebKit::WebAutomationSession::reloadBrowsingContext): Ditto.
351         (WebKit::WebAutomationSession::navigationOccurredForFrame): Use the normal maps.
352         (WebKit::WebAutomationSession::documentLoadedForFrame): Stop timeout timer and dispatch eager pending navigations.
353         * UIProcess/Automation/WebAutomationSession.h:
354         * UIProcess/WebPageProxy.cpp:
355         (WebKit::WebPageProxy::didFinishDocumentLoadForFrame): Notify the automation session.
356
357 2017-08-05  Carlos Garcia Campos  <cgarcia@igalia.com>
358
359         WebDriver: use in-view center point for clicks instead of bounding box center point
360         https://bugs.webkit.org/show_bug.cgi?id=174863
361
362         Reviewed by Simon Fraser.
363
364         Change computeElementLayout to also return the in-view center point and whether it's obscured by another
365         element.
366
367         * UIProcess/Automation/Automation.json: Add optional inViewCenterPoint to the result and isObscured.
368         * UIProcess/Automation/WebAutomationSession.cpp:
369         (WebKit::WebAutomationSession::didComputeElementLayout): Handle inViewCenterPoint and isObscured.
370         * UIProcess/Automation/WebAutomationSession.h:
371         * UIProcess/Automation/WebAutomationSession.messages.in:
372         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
373         (WebKit::elementInViewClientCenterPoint): Get the client in-view center point and whether it's obscured
374         according to the spec.
375         (WebKit::WebAutomationSessionProxy::computeElementLayout): Pass inViewCenterPoint and isObscured to
376         DidComputeElementLayout message.
377
378 2017-08-05  Brian Burg  <bburg@apple.com>
379
380         Web Automation: files selected for upload should be matched against 'accept' attribute values case-insensitively
381         https://bugs.webkit.org/show_bug.cgi?id=175191
382         <rdar://problem/33725790>
383
384         Reviewed by Carlos Garcia Campos.
385
386         Values of the "accept" attribute are to be compared in a case-insensitive manner, per
387         https://html.spec.whatwg.org/multipage/input.html#file-upload-state-(type=file)
388
389         Except for converting MIME types and extensions to lowercase, most of these changes
390         were lost in a rebase prior to landing the patch.
391
392         * UIProcess/Automation/WebAutomationSession.cpp:
393         (WebKit::fileCanBeAcceptedForUpload): Fix some issues:
394         - Handle a file ending in a period.
395         - Handle MIME type inference failing.
396         - Convert extensions and MIMEs to lower case, per specification.
397
398         (WebKit::WebAutomationSession::handleRunOpenPanel):
399         - Strip the leading period from file extensions.
400         - These range converters crash unless the API::Array is retained by a local variable.
401
402 2017-08-04  Youenn Fablet  <youenn@apple.com>
403
404         [Cache API] Add Cache and CacheStorage IDL definitions
405         https://bugs.webkit.org/show_bug.cgi?id=175201
406
407         Reviewed by Brady Eidson.
408
409         * Shared/WebPreferencesDefinitions.h:
410         * WebProcess/InjectedBundle/InjectedBundle.cpp:
411         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
412         * WebProcess/WebPage/WebPage.cpp:
413         (WebKit::WebPage::updatePreferences):
414
415 2017-08-04  Brian Burg  <bburg@apple.com>
416
417         Expose WKPreferences SPI for toggling mock capture devices prompt
418         https://bugs.webkit.org/show_bug.cgi?id=175227
419         <rdar://problem/33734528>
420
421         Reviewed by Youenn Fablet.
422
423         * UIProcess/API/Cocoa/WKPreferences.mm:
424         (-[WKPreferences _mockCaptureDevicesPromptEnabled]):
425         (-[WKPreferences _setMockCaptureDevicesPromptEnabled:]):
426         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
427
428 2017-08-04  Brian Burg  <bburg@apple.com>
429
430         Fix typo in WKPreferences _iceCandidateFiltertingEnabled property
431         https://bugs.webkit.org/show_bug.cgi?id=175224
432
433         Reviewed by Tim Horton.
434
435         * UIProcess/API/Cocoa/WKPreferences.mm:
436         (-[WKPreferences _iceCandidateFilteringEnabled]):
437         (-[WKPreferences _iceCandidateFiltertingEnabled]): Deleted.
438         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
439
440 2017-08-04  Chris Dumez  <cdumez@apple.com>
441
442         [Beacon] Update sendBeacon to use the CachedResourceLoader
443         https://bugs.webkit.org/show_bug.cgi?id=175192
444         <rdar://problem/33725923>
445
446         Reviewed by Youenn Fablet.
447
448         Deal with new Beacon CachedResource type.
449
450         * WebProcess/Network/WebLoaderStrategy.cpp:
451         (WebKit::maximumBufferingTime):
452
453 2017-08-04  John Wilander  <wilander@apple.com>
454
455         Resource Load Statistics: Report user interaction immediately, but only when needed
456         https://bugs.webkit.org/show_bug.cgi?id=175090
457         <rdar://problem/33685546>
458
459         Reviewed by Chris Dumez.
460
461         * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
462         (WKBundleClearResourceLoadStatistics):
463             Test infrastructure. Ends up calling
464             WebCore::ResourceLoadObserver::clearState().
465         * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h:
466
467 2017-08-04  Matt Lewis  <jlewis3@apple.com>
468
469         Unreviewed, rolling out r220288.
470
471         This broke multiple builds.
472
473         Reverted changeset:
474
475         "Use MPAVRoutingController instead of deprecated versions."
476         https://bugs.webkit.org/show_bug.cgi?id=175063
477         http://trac.webkit.org/changeset/220288
478
479 2017-08-04  Jeremy Jones  <jeremyj@apple.com>
480
481         Use MPAVRoutingController instead of deprecated versions.
482         https://bugs.webkit.org/show_bug.cgi?id=175063
483         rdar://problem/33301230
484
485         Reviewed by Tim Horton.
486
487         Remove dependence on deprecated classes MPAVRoutingSheet and MPAudioVideoRoutingPopoverController.
488
489         * UIProcess/ios/forms/WKAirPlayRoutePicker.h:
490         * UIProcess/ios/forms/WKAirPlayRoutePicker.mm:
491         (-[WKAirPlayRoutePicker dealloc]):
492         (-[WKAirPlayRoutePicker show:fromRect:]):
493         (-[WKAirPlayRoutePicker popoverControllerDidDismissPopover:]): Deleted.
494         (-[WKAirPlayRoutePicker _presentAirPlayPopoverAnimated:fromRect:]): Deleted.
495         (-[WKAirPlayRoutePicker _windowWillRotate:]): Deleted.
496         (-[WKAirPlayRoutePicker _windowDidRotate:]): Deleted.
497         (-[WKAirPlayRoutePicker _dismissAirPlayRoutePickerIPad]): Deleted.
498         (-[WKAirPlayRoutePicker showAirPlayPickerIPad:fromRect:]): Deleted.
499         (-[WKAirPlayRoutePicker showAirPlayPickerIPhone:]): Deleted.
500
501 2017-08-04  Tim Horton  <timothy_horton@apple.com>
502
503         viewport-fit changes during animated resize can cause layout size to get stuck
504         https://bugs.webkit.org/show_bug.cgi?id=175169
505         <rdar://problem/33684697>
506
507         Reviewed by Simon Fraser.
508
509         If we get a commit that changes viewport-fit state while an animated
510         resize is underway, and that change causes the client to push a new
511         minimumLayoutSizeOverride, the new size will be lost forever, and we
512         will get stuck laying out at the wrong size.
513
514         This is because we unconditionally apply avoidsUnsafeArea for every commit,
515         while most other changes that come in from a commit are ignored if we're
516         inside animated resize. To fix, also ignore avoidsUnsafeArea changes during
517         animated resize, by moving the code that keeps track of it into WKWebView
518         like all of the rest, and read it out of the commit in didCommitLayerTree
519         *after* the animated-resize early-return.
520
521         Also, fix the associated layout tests by adding a missing assignment
522         in _computedContentInset, which was broken in r220138.
523
524         * UIProcess/API/Cocoa/WKWebView.mm:
525         (-[WKWebView _initializeWithConfiguration:]):
526         (-[WKWebView _setHasCustomContentView:loadedMIMEType:]):
527         (-[WKWebView _processDidExit]):
528         (-[WKWebView _didCommitLayerTree:]):
529         (-[WKWebView _setAvoidsUnsafeArea:]):
530         (-[WKWebView _safeAreaShouldAffectObscuredInsets]):
531         (-[WKWebView _didChangeAvoidsUnsafeArea:]): Deleted.
532         * UIProcess/API/Cocoa/WKWebViewInternal.h:
533         * UIProcess/PageClient.h:
534         * UIProcess/WebPageProxy.cpp:
535         (WebKit::WebPageProxy::resetState):
536         (WebKit::WebPageProxy::setAvoidsUnsafeArea): Deleted.
537         * UIProcess/WebPageProxy.h:
538         (WebKit::WebPageProxy::avoidsUnsafeArea const): Deleted.
539         * UIProcess/ios/PageClientImplIOS.h:
540         * UIProcess/ios/PageClientImplIOS.mm:
541         (WebKit::PageClientImpl::didChangeAvoidsUnsafeArea): Deleted.
542         * UIProcess/ios/WebPageProxyIOS.mm:
543         (WebKit::WebPageProxy::didCommitLayerTree):
544
545 2017-08-04  Matt Lewis  <jlewis3@apple.com>
546
547         Unreviewed, rolling out r220271.
548
549         Rolling out due to Layout Test failing on iOS Simulator.
550
551         Reverted changeset:
552
553         "Remove STREAMS_API compilation guard"
554         https://bugs.webkit.org/show_bug.cgi?id=175165
555         http://trac.webkit.org/changeset/220271
556
557 2017-08-03  Sam Weinig  <sam@webkit.org>
558
559         [Cleanup] Remove ScriptGlobalObject
560         https://bugs.webkit.org/show_bug.cgi?id=175173
561
562         Reviewed by Darin Adler.
563
564         * WebProcess/WebPage/RemoteWebInspectorUI.cpp:
565         (WebKit::RemoteWebInspectorUI::windowObjectCleared):
566         * WebProcess/WebPage/WebInspectorUI.cpp:
567         (WebKit::WebInspectorUI::windowObjectCleared):
568         Remove call to ScriptGlobalObject::set and use addSelfToGlobalObjectInWorld instead.
569
570 2017-08-03  Brian Burg  <bburg@apple.com>
571
572         [Cocoa] Web Automation: copy JavaScript atoms to WebKit.framework private headers
573         https://bugs.webkit.org/show_bug.cgi?id=175088
574         <rdar://problem/33685818>
575
576         Reviewed by Joseph Pecoraro.
577
578         * WebKit.xcodeproj/project.pbxproj:
579         - Add a Copy Files phase to WebKit.framework.
580         - Copy atoms to the atoms/ directory in WebKit.framework/PrivateHeaders/.
581
582 2017-08-04  Ryan Haddad  <ryanhaddad@apple.com>
583
584         Unreviewed, rolling out r220268.
585
586         This change caused assertion failures on macOS and iOS Debug
587         WK2.
588
589         Reverted changeset:
590
591         "Resource Load Statistics: Report user interaction
592         immediately, but only when needed"
593         https://bugs.webkit.org/show_bug.cgi?id=175090
594         http://trac.webkit.org/changeset/220268
595
596 2017-08-04  Andreas Kling  <akling@apple.com>
597
598         NetworkLoad should always invoke its redirect completion handler
599         https://bugs.webkit.org/show_bug.cgi?id=175179
600         <rdar://problem/33464999>
601
602         Reviewed by Chris Dumez.
603
604         Make sure the redirect completion handler is always invoked,
605         just like we already did for the response completion handler.
606
607         * NetworkProcess/NetworkLoad.cpp:
608         (WebKit::NetworkLoad::~NetworkLoad):
609
610 2017-08-04  Youenn Fablet  <youenn@apple.com>
611
612         Remove STREAMS_API compilation guard
613         https://bugs.webkit.org/show_bug.cgi?id=175165
614
615         Reviewed by Darin Adler.
616
617         * Configurations/FeatureDefines.xcconfig:
618         * WebProcess/InjectedBundle/InjectedBundle.cpp:
619         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
620
621 2017-08-04  Brady Eidson  <beidson@apple.com>
622
623         Enable ServiceWorkers at runtime for WebKitTestRunner.
624         https://bugs.webkit.org/show_bug.cgi?id=175174
625
626         Reviewed by Youenn Fablet.
627
628         * UIProcess/WebPreferences.cpp:
629         (WebKit::WebPreferences::enableAllExperimentalFeatures):
630
631 2017-08-04  John Wilander  <wilander@apple.com>
632
633         Resource Load Statistics: Report user interaction immediately, but only when needed
634         https://bugs.webkit.org/show_bug.cgi?id=175090
635         <rdar://problem/33685546>
636
637         Reviewed by Chris Dumez.
638
639         * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
640         (WKBundleClearResourceLoadStatistics):
641             Test infrastructure. Ends up calling
642             WebCore::ResourceLoadObserver::clearState().
643         * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h:
644
645 2017-08-04  Antti Koivisto  <antti@apple.com>
646
647         Network cache should be usable as non-singleton
648         https://bugs.webkit.org/show_bug.cgi?id=175139
649
650         Reviewed by Sam Weinig.
651
652         We might want to use it as a non-singleton in the future (for example as a backend for the cache API).
653
654         This patch makes NetworkCache::Cache and NetworkCache::Storage refcounted objects and takes
655         care to ref them properly during asynchronous operations.
656
657         The patch doesn't actually create any non-shared instances, it just adds the capability.
658
659         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
660         (WebKit::NetworkConnectionToWebProcess::storeDerivedDataToCache):
661         * NetworkProcess/NetworkProcess.cpp:
662         (WebKit::fetchDiskCacheEntries):
663         (WebKit::clearDiskCacheEntries):
664         (WebKit::NetworkProcess::setCacheModel):
665         * NetworkProcess/NetworkProcess.h:
666         (WebKit::NetworkProcess::cache):
667
668             Move the shared cache instance to the network process singleton.
669
670         * NetworkProcess/NetworkResourceLoader.cpp:
671         (WebKit::NetworkResourceLoader::NetworkResourceLoader):
672
673             Include shared cache as a reffed member for non-ephemeral instances.
674
675         (WebKit::NetworkResourceLoader::canUseCache const):
676         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
677         (WebKit::NetworkResourceLoader::abort):
678         (WebKit::NetworkResourceLoader::didReceiveResponse):
679         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
680         (WebKit::NetworkResourceLoader::tryStoreAsCacheEntry):
681         (WebKit::NetworkResourceLoader::didRetrieveCacheEntry):
682         * NetworkProcess/NetworkResourceLoader.h:
683         * NetworkProcess/cache/NetworkCache.cpp:
684         (WebKit::NetworkCache::Cache::open):
685
686             Open now returns null if it fails.
687             Add RegisterNotify option to set up notify trigger for the shared instance.
688
689         (WebKit::NetworkCache::Cache::Cache):
690         (WebKit::NetworkCache::Cache::~Cache):
691
692             Add destructor.
693
694         (WebKit::NetworkCache::dumpFileChanged):
695         (WebKit::NetworkCache::Cache::setCapacity):
696         (WebKit::NetworkCache::Cache::retrieve):
697
698             Protect the cache instance during asynchronous operations.
699
700         (WebKit::NetworkCache::Cache::store):
701         (WebKit::NetworkCache::Cache::storeRedirect):
702         (WebKit::NetworkCache::Cache::remove):
703         (WebKit::NetworkCache::Cache::traverse):
704         (WebKit::NetworkCache::Cache::dumpContentsToFile):
705         (WebKit::NetworkCache::Cache::clear):
706         (WebKit::NetworkCache::Cache::recordsPath const):
707         (WebKit::NetworkCache::Cache::retrieveData):
708         (WebKit::NetworkCache::Cache::storeData):
709         (WebKit::NetworkCache::singleton): Deleted.
710         (WebKit::NetworkCache::Cache::initialize): Deleted.
711         * NetworkProcess/cache/NetworkCache.h:
712         (WebKit::NetworkCache::Cache::canUseSharedMemoryForBodyData const):
713         (WebKit::NetworkCache::Cache::isEnabled const): Deleted.
714
715             Remove isEnabled() state as a cache object now always represents an enabled cache.
716
717         * NetworkProcess/cache/NetworkCacheEntry.cpp:
718         (WebKit::NetworkCache::Entry::initializeShareableResourceHandleFromStorageRecord const):
719         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
720         (WebKit::NetworkCache::SpeculativeLoad::willSendRedirectedRequest):
721         (WebKit::NetworkCache::SpeculativeLoad::didReceiveResponse):
722         (WebKit::NetworkCache::SpeculativeLoad::didFinishLoading):
723         * NetworkProcess/cache/NetworkCacheStatistics.cpp:
724         (WebKit::NetworkCache::Statistics::initialize):
725         (WebKit::NetworkCache::Statistics::shrinkIfNeeded):
726         * NetworkProcess/cache/NetworkCacheStorage.cpp:
727         (WebKit::NetworkCache::Storage::ReadOperation::ReadOperation):
728         (WebKit::NetworkCache::Storage::WriteOperation::WriteOperation):
729         (WebKit::NetworkCache::Storage::TraverseOperation::TraverseOperation):
730
731             Operations now ref the storage. They are already deleted in the main thread so
732             proper destruction is taken care of.
733
734         (WebKit::NetworkCache::Storage::open):
735         (WebKit::NetworkCache::Storage::~Storage):
736         (WebKit::NetworkCache::Storage::synchronize):
737
738             This and other asynchronous methods now protect the Storage instance.
739
740         (WebKit::NetworkCache::Storage::remove):
741         (WebKit::NetworkCache::Storage::retrieve):
742         (WebKit::NetworkCache::Storage::store):
743         (WebKit::NetworkCache::Storage::traverse):
744         (WebKit::NetworkCache::Storage::clear):
745         (WebKit::NetworkCache::Storage::shrink):
746         (WebKit::NetworkCache::Storage::deleteOldVersions):
747         * NetworkProcess/cache/NetworkCacheStorage.h:
748         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
749         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
750         (WebKit::NetworkProcess::clearDiskCache):
751         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
752         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
753         * NetworkProcess/soup/NetworkProcessSoup.cpp:
754         (WebKit::NetworkProcess::platformInitializeNetworkProcess):
755         (WebKit::NetworkProcess::clearDiskCache):
756
757 2017-08-04  Frederic Wang  <fwang@igalia.com>
758
759         ScrollingTreeOverflowScrollingNodeIOS uses the wrong fixed position rectangle
760         https://bugs.webkit.org/show_bug.cgi?id=175135
761
762         Reviewed by Simon Fraser.
763
764         This patch modifies ScrollingTreeOverflowScrollingNodeIOS::updateChildNodesAfterScroll so
765         that it uses the fixed position rectangle relative of the first frame ancestor instead of
766         the one of the main frame. This makes it consistent with ScrollingTreeFrameScrollingNodeIOS
767         and RenderLayerCompositor. This fixes some flickering issues on iOS.
768
769         * UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
770         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::updateChildNodesAfterScroll): Use the fixed
771         position rect of a non-main frame if there is one.
772
773 2017-08-03  Brian Burg  <bburg@apple.com>
774
775         Remove ENABLE(WEB_SOCKET) guards
776         https://bugs.webkit.org/show_bug.cgi?id=167044
777
778         Reviewed by Joseph Pecoraro.
779
780         * Configurations/FeatureDefines.xcconfig:
781         * WebProcess/Network/WebSocketProvider.cpp:
782         * WebProcess/Network/WebSocketProvider.h:
783
784 2017-08-03  Chris Dumez  <cdumez@apple.com>
785
786         Multiple Layout tests from web-platform-tests/beacon/ are timing out.
787         https://bugs.webkit.org/show_bug.cgi?id=175076
788         <rdar://problem/33704752>
789
790         Reviewed by Alexey Proskuryakov.
791
792         * NetworkProcess/NetworkLoad.cpp:
793         (WebKit::NetworkLoad::completeAuthenticationChallenge):
794         In the NETWORK_SESSION code path, we did not ask the client about server trust evaluation
795         when the clientCredentialPolicy was CannotAskClientForCredentials. This is because the
796         same delegate is used for HTTP authentication and server trust evaluation in the
797         NETWORK_SESSION code path. To align both code paths, we now ask the client about server
798         trust evaluation even if the policy CannotAskClientForCredentials. This allows WKTR
799         to trust certificates for localhost / 127.0.0.1 unconditionally and consistently.
800
801 2017-08-03  Yoshiaki Jitsukawa  <jitsu@rd.scei.sony.co.jp>
802
803         [PAL] Move spi/cf directory into PAL
804         https://bugs.webkit.org/show_bug.cgi?id=175057
805
806         Reviewed by Antti Koivisto.
807
808         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
809         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
810         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
811         * NetworkProcess/ios/NetworkProcessIOS.mm:
812         * NetworkProcess/mac/NetworkLoadMac.mm:
813         * NetworkProcess/mac/NetworkProcessMac.mm:
814         * Shared/cf/CookieStorageUtilsCF.h:
815         * Shared/mac/ChildProcessMac.mm:
816         * Shared/mac/CookieStorageShim.mm:
817         * UIProcess/API/Cocoa/WKHTTPCookieStore.mm:
818         * UIProcess/API/Cocoa/WKProcessPool.mm:
819         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
820         * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
821         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
822         * UIProcess/WebsiteData/WebsiteDataRecord.cpp:
823         * UIProcess/WebsiteData/WebsiteDataStore.h:
824         * UIProcess/mac/WebCookieManagerProxyMac.mm:
825         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
826         * WebProcess/cocoa/WebProcessCocoa.mm:
827
828 2017-08-03  Youenn Fablet  <youenn@apple.com>
829
830         Remove FETCH_API compilation guard
831         https://bugs.webkit.org/show_bug.cgi?id=175154
832
833         Reviewed by Chris Dumez.
834
835         * Configurations/FeatureDefines.xcconfig:
836         * WebProcess/WebPage/WebPage.cpp:
837         (WebKit::WebPage::updatePreferences):
838
839 2017-08-03  Matt Lewis  <jlewis3@apple.com>
840
841         Unreviewed, rolling out r220209.
842
843         This caused internal build failures.
844
845         Reverted changeset:
846
847         "Use MPAVRoutingController instead of deprecated versions."
848         https://bugs.webkit.org/show_bug.cgi?id=175063
849         http://trac.webkit.org/changeset/220209
850
851 2017-08-02  Brian Burg  <bburg@apple.com>
852
853         Web Automation: consider file extensions in the "accept" attribute when deciding if a file can be uploaded
854         https://bugs.webkit.org/show_bug.cgi?id=175081
855
856         Reviewed by Joseph Pecoraro.
857
858         * UIProcess/Automation/WebAutomationSession.cpp:
859         (WebKit::fileCanBeAcceptedForUpload):
860         (WebKit::WebAutomationSession::handleRunOpenPanel):
861         In cases where a file has an extension, try to match it against the
862         accepted extensions list. Give up if there's no extension. Otherwise,
863         proceed as normal to infer a MIME type based on the extension.
864         In cases where extension-less files are inside hidden folders, the MIME
865         inference will fail as well.
866
867 2017-08-03  Brady Eidson  <beidson@apple.com>
868
869         Add SW IDLs and stub out basic functionality.
870         https://bugs.webkit.org/show_bug.cgi?id=175115
871
872         Reviewed by Chris Dumez.
873
874         * Configurations/FeatureDefines.xcconfig:
875         
876         * Shared/WebPreferencesDefinitions.h:
877         
878         * UIProcess/WebPreferences.cpp:
879         (WebKit::WebPreferences::enableAllExperimentalFeatures): Explicitly skip SW for now.
880           The ramifications to layouttests are complicated, and we'd like to follow up in a
881           separate patch.
882         
883         * WebProcess/WebPage/WebPage.cpp:
884         (WebKit::WebPage::updatePreferences):
885
886 2017-08-03  Yoshiaki Jitsukawa  <jitsu@rd.scei.sony.co.jp>
887
888         [WebKit] Sort Xcode project file
889         https://bugs.webkit.org/show_bug.cgi?id=175122
890
891         Reviewed by Antti Koivisto.
892
893         * WebKit.xcodeproj/project.pbxproj:
894
895 2017-08-02  Sam Weinig  <sam@webkit.org>
896
897         [WebIDL] Convert MutationCallback to be a normal generated callback
898         https://bugs.webkit.org/show_bug.cgi?id=174140
899
900         Reviewed by Darin Adler.
901
902         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocument.cpp:
903         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMNodeFilter.cpp:
904         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMNodeFilterPrivate.h:
905         Pass, now necessary, Document to NativeNodeFilter constructor.
906
907 2017-08-03  Jeremy Jones  <jeremyj@apple.com>
908
909         Use MPAVRoutingController instead of deprecated versions.
910         https://bugs.webkit.org/show_bug.cgi?id=175063
911         rdar://problem/33301230
912
913         Reviewed by Tim Horton.
914
915         Remove dependence on deprecated classes MPAVRoutingSheet and MPAudioVideoRoutingPopoverController.
916
917         * UIProcess/ios/forms/WKAirPlayRoutePicker.h:
918         * UIProcess/ios/forms/WKAirPlayRoutePicker.mm:
919         (-[WKAirPlayRoutePicker dealloc]):
920         (-[WKAirPlayRoutePicker show:fromRect:]):
921         (-[WKAirPlayRoutePicker popoverControllerDidDismissPopover:]): Deleted.
922         (-[WKAirPlayRoutePicker _presentAirPlayPopoverAnimated:fromRect:]): Deleted.
923         (-[WKAirPlayRoutePicker _windowWillRotate:]): Deleted.
924         (-[WKAirPlayRoutePicker _windowDidRotate:]): Deleted.
925         (-[WKAirPlayRoutePicker _dismissAirPlayRoutePickerIPad]): Deleted.
926         (-[WKAirPlayRoutePicker showAirPlayPickerIPad:fromRect:]): Deleted.
927         (-[WKAirPlayRoutePicker showAirPlayPickerIPhone:]): Deleted.
928
929 2017-08-03  Chris Dumez  <cdumez@apple.com>
930
931         Improve our support for referrer policies
932         https://bugs.webkit.org/show_bug.cgi?id=175069
933         <rdar://problem/33677313>
934
935         Reviewed by Darin Adler.
936
937         * WebProcess/Network/WebLoaderStrategy.cpp:
938         (WebKit::WebLoaderStrategy::loadResource):
939         (WebKit::WebLoaderStrategy::schedulePluginStreamLoad):
940
941 2017-08-02  Chris Dumez  <cdumez@apple.com>
942
943         NetworkResourceLoader::setDefersLoading() may cause start() to be called multiple times
944         https://bugs.webkit.org/show_bug.cgi?id=175109
945         <rdar://problem/33363169>
946
947         Reviewed by Brady Eidson.
948
949         If NetworkResourceLoader::setDefersLoading(false) is called by the client while m_networkLoad is null
950         then we call NetworkResourceLoader::start() to start the load. This is needed in the case where
951         a NetworkResourceLoader is constructed in deferred mode so that the load can later be started via
952         setDefersLoading(). However, it is possible for setDefersLoading(false) to be called when start()
953         has already been called, which causes start() to be called multiple times and leads to an assertion
954         hit in debug.
955
956         Normally, setDefersLoading(false) returns without calling start() if m_networkLoad is not null. It
957         relies on m_networkLoad being non-null to determine if start() should be called. This is bad because
958         start() checks the disk cache asynchronously *before* calling startNetworkLoad() and initializing
959         m_networkLoad. Therefore, if setDefersLoading(false) is called *while* we are checking the cache,
960         then we will call incorrectly call start() again.
961
962         In the case of the radar, this happens when we:
963         1. Call start() and check the disk cache
964         2. Retrieve a cached redirect from the cache, which causes a WillSendRequest IPC to be sent to the
965            WebProcess
966         3. The WebProcess calls setDefersLoading(true), sends the ContinueWillSendRequest IPC back and
967            then calls setDefersLoading(false)
968
969         The call to continueWillSendRequest() causes us to retrieve the redirected entry from the cache,
970         asynchronously, which will return no entry and start a load.
971         The later call to setDefersLoading(false) causes us to call start() again and we end up back to step 1.
972
973         * NetworkProcess/NetworkResourceLoader.cpp:
974         (WebKit::NetworkResourceLoader::start):
975         (WebKit::NetworkResourceLoader::setDefersLoading):
976         * NetworkProcess/NetworkResourceLoader.h:
977
978 2017-08-02  Andreas Kling  <akling@apple.com>
979
980         NetworkRTCProvider::createResolver() leaks CFHost objects
981         https://bugs.webkit.org/show_bug.cgi?id=175103
982         <rdar://problem/33690347>
983
984         Reviewed by Youenn Fablet.
985
986         Add a missing adoptCF() so we don't leak the CFHost.
987
988         * NetworkProcess/webrtc/NetworkRTCProvider.cpp:
989         (WebKit::NetworkRTCProvider::createResolver):
990
991 2017-08-02  Jeremy Jones  <jeremyj@apple.com>
992
993         Remove unused and obsolete setting mediaDocumentEntersFullscreenAutomatically
994         https://bugs.webkit.org/show_bug.cgi?id=175080
995
996         Reviewed by Jon Lee.
997
998         This is obsolete because of the alternate solution in
999         https://bugs.webkit.org/show_bug.cgi?id=174850
1000
1001         * Shared/WebPreferencesDefinitions.h:
1002         * UIProcess/API/Cocoa/WKPreferences.mm:
1003         (-[WKPreferences _setMediaDocumentEntersFullscreenAutomatically:]): Deleted.
1004         (-[WKPreferences _mediaDocumentEntersFullscreenAutomatically]): Deleted.
1005         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
1006         * WebProcess/WebPage/WebPage.cpp:
1007         (WebKit::WebPage::updatePreferences):
1008
1009 2017-08-02  Filip Pizlo  <fpizlo@apple.com>
1010
1011         We should be OK with the gigacage being disabled on gmalloc
1012         https://bugs.webkit.org/show_bug.cgi?id=175082
1013
1014         Reviewed by Michael Saboff.
1015
1016         * WebProcess/WebProcess.cpp:
1017         (WebKit::m_webSQLiteDatabaseTracker):
1018
1019 2017-08-02  Brian Burg  <bburg@apple.com>
1020
1021         Web Automation: files selected for upload should be checked against values of the 'accept' attribute
1022         https://bugs.webkit.org/show_bug.cgi?id=174803
1023         <rdar://problem/33514190>
1024
1025         Reviewed by Carlos Garcia Campos.
1026
1027         Use the parsed values of the file input element's "accept" attribute to reject
1028         files that don't match the specified values. This is normally done by Safari
1029         using NSOpenPanel, but since a real open panel isn't shown during automation,
1030         it needs to be done here.
1031
1032         Support for limiting accepted files by file extensions will be added when the
1033         same is implemented in the normal code path for the C and Objective-C APIs.
1034
1035         This change is covered by internal WebDriver tests that will be rewritten for the
1036         public Webdriver W3C test suite someday, when safaridriver runs those tests itself.
1037
1038         * UIProcess/Automation/WebAutomationSession.cpp:
1039         (WebKit::WebAutomationSession::handleRunOpenPanel):
1040         Since we already have the proposed files, there's no need to compute a list of
1041         supported extensions based on wildcard MIME types. First check the extension,
1042         then the inferred MIME type for the extension, and then the wildcard MIME type
1043         if the inferred type is not an exact match.
1044
1045 2017-08-02  Tim Horton  <timothy_horton@apple.com>
1046
1047         WKPDFView doesn't respect safe area insets
1048         https://bugs.webkit.org/show_bug.cgi?id=175046
1049         <rdar://problem/33558386>
1050
1051         Reviewed by Wenson Hsieh.
1052
1053         * Platform/spi/ios/UIKitSPI.h:
1054         Add some SPI.
1055
1056         * UIProcess/API/Cocoa/WKWebView.mm:
1057         (-[WKWebView _setHasCustomContentView:loadedMIMEType:]):
1058         Drive-by fix two small custom content view issues:
1059
1060         - Reset _scrollViewBackgroundColor; it is used to early-return from
1061         updating the background color if it hasn't changed, but if you go from a
1062         site with (for example) a white background, to a PDF, to another site
1063         with a white background, we will early-return and not reset the background
1064         color from the grey WKPDFView background.
1065
1066         - When installing a custom content view, scroll to the origin. We miss
1067         the usual mechanism for scrolling to the origin when custom content views
1068         are installed, so do it here.
1069
1070         (-[WKWebView _effectiveObscuredInsetEdgesAffectedBySafeArea]):
1071         Ignore _obscuredInsetEdgesAffectedBySafeArea for custom content views.
1072         This is fairly arbitrary, and we should find a different way to
1073         express different edge sets for different kinds of content (perhaps
1074         bake this into default viewports?), but for now this works.
1075
1076         (-[WKWebView _computedContentInset]):
1077         Use _effectiveObscuredInsetEdgesAffectedBySafeArea instead of the ivar directly.
1078
1079         (-[WKWebView _safeAreaShouldAffectObscuredInsets]):
1080         Force safe areas to not affect obscured insets for custom content views,
1081         so that it's up to every custom content view to take safe areas into
1082         account themselves.
1083
1084         * UIProcess/API/Cocoa/WKWebViewInternal.h:
1085         Expose _computedUnobscuredSafeAreaInset for WKPDFView's use.
1086
1087         * UIProcess/ios/WKPDFView.mm:
1088         (-[WKPDFView web_setMinimumSize:]):
1089         Avoid rebuilding the WKPDFView if the minimum size didn't change.
1090
1091         (-[WKPDFView _offsetForPageNumberIndicator]):
1092         Take unobscured safe area insets into account when insetting
1093         the page number indicator.
1094
1095         (-[WKPDFView web_computedContentInsetDidChange]):
1096         Watch for unobscured safe area inset changes, and apply them to the
1097         layout of the WKPDFView.
1098
1099         (-[WKPDFView _computePageAndDocumentFrames]):
1100         Make it possible to only update the WKPDFView's size and position, without
1101         rebuilding its subviews, if the width did not change. This prevents lots
1102         of flashing of the child UIPDFPageViews when the unobscured safe area
1103         insets change dynamically.
1104
1105         Take the safe area insets into account when determining what width
1106         to lay out to.
1107
1108         (-[WKPDFView _updateDocumentFrame]):
1109         Take the safe area insets into account when positioning the WKPDFView
1110         inside the WKScrollView.
1111
1112 2017-08-02  John Wilander  <wilander@apple.com>
1113
1114         ResourceLoadStatisticsClassifierCocoa::singletonPredictionModel() should check the return value of storagePath()
1115         https://bugs.webkit.org/show_bug.cgi?id=175055
1116         <rdar://problem/32671352>
1117
1118         Reviewed by David Kilzer.
1119
1120         * Platform/classifier/cocoa/ResourceLoadStatisticsClassifierCocoa.cpp:
1121         (WebKit::ResourceLoadStatisticsClassifierCocoa::singletonPredictionModel):
1122             Now uses dispatch_once() instead of NeverDestroyed and checks the
1123             return value of storagePath() before using it to load the model.
1124
1125 2017-08-01  Brian Burg  <bburg@apple.com>
1126
1127         HTML file input elements do not support file extensions in the "accept" attribute
1128         https://bugs.webkit.org/show_bug.cgi?id=95698
1129         <rdar://problem/12231850>
1130
1131         Reviewed by Darin Adler.
1132
1133         Plumb accepted file extensions out to the C API.
1134         The Cocoa API will be improved in a later patch.
1135
1136         * Shared/WebCoreArgumentCoders.cpp:
1137         (IPC::ArgumentCoder<FileChooserSettings>::encode):
1138         (IPC::ArgumentCoder<FileChooserSettings>::decode):
1139         * UIProcess/API/APIOpenPanelParameters.cpp:
1140         (API::OpenPanelParameters::acceptFileExtensions const):
1141         * UIProcess/API/APIOpenPanelParameters.h:
1142         * UIProcess/API/C/WKOpenPanelParametersRef.cpp:
1143         (WKOpenPanelParametersCopyAcceptedFileExtensions):
1144         * UIProcess/API/C/WKOpenPanelParametersRef.h:
1145
1146 2017-08-02  Fujii Hironori  <Hironori.Fujii@sony.com>
1147
1148         Use LazyNeverDestroyed instead of DEFINE_GLOBAL for QualifiedName
1149         https://bugs.webkit.org/show_bug.cgi?id=175010
1150         <rdar://problem/33647818>
1151
1152         Reviewed by Alex Christensen.
1153
1154         * UIProcess/API/APIContentRuleListStore.cpp:
1155         (API::ContentRuleListStore::compileContentRuleList):
1156         Call QualifiedName::init().
1157
1158 2017-08-01  Chris Dumez  <cdumez@apple.com>
1159
1160         Add initial support for navigator.sendBeacon
1161         https://bugs.webkit.org/show_bug.cgi?id=175007
1162         <rdar://problem/33547728>
1163
1164         Reviewed by Sam Weinig.
1165
1166         Add experimental feature flag for the Beacon API, disabled by default.
1167
1168         * Shared/WebPreferencesDefinitions.h:
1169         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1170         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
1171         * WebProcess/WebPage/WebPage.cpp:
1172         (WebKit::WebPage::updatePreferences):
1173
1174 2017-08-01  Filip Pizlo  <fpizlo@apple.com>
1175
1176         Bmalloc and GC should put auxiliaries (butterflies, typed array backing stores) in a gigacage (separate multi-GB VM region)
1177         https://bugs.webkit.org/show_bug.cgi?id=174727
1178
1179         Reviewed by Mark Lam.
1180         
1181         The WebProcess should never disable the Gigacage by allocating typed arrays outside the Gigacage. So,
1182         we add a callback that crashes the process.
1183
1184         * WebProcess/WebProcess.cpp:
1185         (WebKit::gigacageDisabled):
1186         (WebKit::m_webSQLiteDatabaseTracker):
1187
1188 2017-08-01  Brian Burg  <bburg@apple.com>
1189
1190         Web Automation: add event to notify service when a page's main frame window object has cleared
1191         https://bugs.webkit.org/show_bug.cgi?id=174987
1192         <rdar://problem/36602634>
1193
1194         Reviewed by Carlos Garcia Campos.
1195
1196         * UIProcess/Automation/Automation.json: Add new event.
1197
1198         * UIProcess/Automation/WebAutomationSession.h:
1199         * UIProcess/Automation/WebAutomationSession.cpp:
1200         (WebKit::WebAutomationSession::navigationOccurredForFrame):
1201         (WebKit::WebAutomationSession::willClosePage):
1202         When a WebPage navigates or closes, send the browsingContextCleared event.
1203         Any element handles for elements in the browsing context are no longer valid.
1204
1205         * UIProcess/WebPageProxy.cpp:
1206         (WebKit::WebPageProxy::close):
1207         Add a new hook into the active automation session so it is notified when a page closes.
1208
1209 2017-08-01  Brady Eidson  <beidson@apple.com>
1210
1211         API test URLSchemeHandler.Exceptions is Exiting out early on macOS Debug..
1212         https://bugs.webkit.org/show_bug.cgi?id=175030
1213
1214         Reviewed by Andy Estes.
1215
1216         * UIProcess/Cocoa/WebURLSchemeHandlerCocoa.mm:
1217         (WebKit::WebURLSchemeHandlerCocoa::platformTaskCompleted): Release the API wrapped on the next
1218           spin of the runloop.
1219
1220 2017-08-01  Brady Eidson  <beidson@apple.com>
1221
1222         Part 2 of: Rename DatabaseProcess to StorageProcess.
1223         https://bugs.webkit.org/show_bug.cgi?id=174880
1224
1225         Reviewed by Andy Estes.
1226
1227         Rename some more variables, classes, etc. to reflect the change.
1228
1229         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1230         (WebKit::NetworkConnectionToWebProcess::writeBlobsToTemporaryFiles):
1231
1232         * NetworkProcess/NetworkProcess.cpp:
1233         (WebKit::NetworkProcess::grantSandboxExtensionsToStorageProcessForBlobs):
1234         (WebKit::NetworkProcess::didGrantSandboxExtensionsToStorageProcessForBlobs):
1235         (WebKit::NetworkProcess::grantSandboxExtensionsToDatabaseProcessForBlobs): Deleted.
1236         (WebKit::NetworkProcess::didGrantSandboxExtensionsToDatabaseProcessForBlobs): Deleted.
1237         * NetworkProcess/NetworkProcess.h:
1238         * NetworkProcess/NetworkProcess.messages.in:
1239
1240         * Shared/ProcessExecutablePath.h:
1241         * Shared/gtk/ProcessExecutablePathGtk.cpp:
1242         (WebKit::executablePathOfStorageProcess):
1243         (WebKit::executablePathOfDatabaseProcess): Deleted.
1244         * Shared/wpe/ProcessExecutablePathWPE.cpp:
1245         (WebKit::executablePathOfStorageProcess):
1246         (WebKit::executablePathOfDatabaseProcess): Deleted.
1247
1248         * StorageProcess/IndexedDB/WebIDBConnectionToClient.cpp:
1249         (WebKit::WebIDBConnectionToClient::putOrAdd):
1250
1251         * StorageProcess/StorageProcess.cpp:
1252         (WebKit::StorageProcess::initializeWebsiteDataStore):
1253         (WebKit::StorageProcess::postStorageTask):
1254         (WebKit::StorageProcess::performNextStorageTask):
1255         (WebKit::StorageProcess::createStorageToWebProcessConnection):
1256         (WebKit::StorageProcess::fetchWebsiteData):
1257         (WebKit::StorageProcess::postDatabaseTask): Deleted.
1258         (WebKit::StorageProcess::performNextDatabaseTask): Deleted.
1259         (WebKit::StorageProcess::createDatabaseToWebProcessConnection): Deleted.
1260         * StorageProcess/StorageProcess.h:
1261         * StorageProcess/StorageProcess.messages.in:
1262         * StorageProcess/mac/StorageProcessMac.mm:
1263         (WebKit::StorageProcess::initializeProcessName):
1264
1265         * UIProcess/API/C/WKContext.cpp:
1266         (WKContextGetDatabaseProcessIdentifier):
1267
1268         * UIProcess/API/Cocoa/WKProcessPool.mm:
1269         (-[WKProcessPool _terminateStorageProcess]):
1270         (-[WKProcessPool _storageProcessIdentifier]):
1271         (-[WKProcessPool _terminateDatabaseProcess]): Deleted.
1272         (-[WKProcessPool _databaseProcessIdentifier]): Deleted.
1273         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
1274
1275         * UIProcess/ChildProcessProxy.cpp:
1276         (WebKit::ChildProcessProxy::getLaunchOptions):
1277
1278         * UIProcess/Launcher/ProcessLauncher.h:
1279         * UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp:
1280         (WebKit::ProcessLauncher::launchProcess):
1281         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
1282         (WebKit::serviceName):
1283         * UIProcess/Launcher/wpe/ProcessLauncherWPE.cpp:
1284         (WebKit::ProcessLauncher::launchProcess):
1285
1286         * UIProcess/Network/NetworkProcessProxy.cpp:
1287         (WebKit::NetworkProcessProxy::grantSandboxExtensionsToStorageProcessForBlobs):
1288         (WebKit::NetworkProcessProxy::grantSandboxExtensionsToDatabaseProcessForBlobs): Deleted.
1289         * UIProcess/Network/NetworkProcessProxy.h:
1290         * UIProcess/Network/NetworkProcessProxy.messages.in:
1291
1292         * UIProcess/Storage/StorageProcessProxy.cpp:
1293         (WebKit::StorageProcessProxy::getLaunchOptions):
1294         (WebKit::StorageProcessProxy::getStorageProcessConnection):
1295         (WebKit::StorageProcessProxy::didClose):
1296         (WebKit::StorageProcessProxy::didCreateStorageToWebProcessConnection):
1297         (WebKit::StorageProcessProxy::didFinishLaunching):
1298         (WebKit::StorageProcessProxy::getDatabaseProcessConnection): Deleted.
1299         (WebKit::StorageProcessProxy::didCreateDatabaseToWebProcessConnection): Deleted.
1300         * UIProcess/Storage/StorageProcessProxy.h:
1301         * UIProcess/Storage/StorageProcessProxy.messages.in:
1302
1303         * UIProcess/WebContextClient.cpp:
1304         (WebKit::WebContextClient::storageProcessDidCrash):
1305         (WebKit::WebContextClient::databaseProcessDidCrash): Deleted.
1306         * UIProcess/WebContextClient.h:
1307
1308         * UIProcess/WebProcessPool.cpp:
1309         (WebKit::WebProcessPool::ensureStorageProcessAndWebsiteDataStore):
1310         (WebKit::WebProcessPool::getStorageProcessConnection):
1311         (WebKit::WebProcessPool::storageProcessCrashed):
1312         (WebKit::WebProcessPool::pageAddedToProcess):
1313         (WebKit::WebProcessPool::storageProcessIdentifier):
1314         (WebKit::WebProcessPool::terminateStorageProcess):
1315         (WebKit::WebProcessPool::ensureDatabaseProcessAndWebsiteDataStore): Deleted.
1316         (WebKit::WebProcessPool::getDatabaseProcessConnection): Deleted.
1317         (WebKit::WebProcessPool::databaseProcessCrashed): Deleted.
1318         (WebKit::WebProcessPool::databaseProcessIdentifier): Deleted.
1319         (WebKit::WebProcessPool::terminateDatabaseProcess): Deleted.
1320         * UIProcess/WebProcessPool.h:
1321         (WebKit::WebProcessPool::sendToStorageProcessRelaunchingIfNecessary):
1322         (WebKit::WebProcessPool::sendToDatabaseProcessRelaunchingIfNecessary): Deleted.
1323
1324         * UIProcess/WebProcessProxy.cpp:
1325         (WebKit::WebProcessProxy::getStorageProcessConnection):
1326         (WebKit::WebProcessProxy::getDatabaseProcessConnection): Deleted.
1327         * UIProcess/WebProcessProxy.h:
1328         * UIProcess/WebProcessProxy.messages.in:
1329
1330         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1331         (WebKit::WebsiteDataStore::fetchDataAndApply):
1332         (WebKit::WebsiteDataStore::removeData):
1333         (WebKit::WebsiteDataStore::storageProcessParameters):
1334         (WebKit::WebsiteDataStore::databaseProcessParameters): Deleted.
1335         * UIProcess/WebsiteData/WebsiteDataStore.h:
1336
1337         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
1338         (WebKit::WebIDBConnectionToServer::messageSenderConnection):
1339         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h:
1340
1341         * WebProcess/Databases/WebDatabaseProvider.cpp:
1342         (WebKit::WebDatabaseProvider::idbConnectionToServerForSession):
1343
1344         * WebProcess/Storage/WebToStorageProcessConnection.cpp:
1345         (WebKit::WebToStorageProcessConnection::WebToStorageProcessConnection):
1346         (WebKit::WebToStorageProcessConnection::~WebToStorageProcessConnection):
1347         (WebKit::WebToStorageProcessConnection::didReceiveMessage):
1348         (WebKit::WebToStorageProcessConnection::didClose):
1349         (WebKit::WebToStorageProcessConnection::didReceiveInvalidMessage):
1350         (WebKit::WebToStorageProcessConnection::idbConnectionToServerForSession):
1351         (WebKit::WebToDatabaseProcessConnection::WebToDatabaseProcessConnection): Deleted.
1352         (WebKit::WebToDatabaseProcessConnection::~WebToDatabaseProcessConnection): Deleted.
1353         (WebKit::WebToDatabaseProcessConnection::didReceiveMessage): Deleted.
1354         (WebKit::WebToDatabaseProcessConnection::didClose): Deleted.
1355         (WebKit::WebToDatabaseProcessConnection::didReceiveInvalidMessage): Deleted.
1356         (WebKit::WebToDatabaseProcessConnection::idbConnectionToServerForSession): Deleted.
1357         * WebProcess/Storage/WebToStorageProcessConnection.h:
1358         (WebKit::WebToStorageProcessConnection::create):
1359         (WebKit::WebToDatabaseProcessConnection::create): Deleted.
1360         (WebKit::WebToDatabaseProcessConnection::connection): Deleted.
1361
1362         * WebProcess/WebProcess.cpp:
1363         (WebKit::WebProcess::webToStorageProcessConnectionClosed):
1364         (WebKit::WebProcess::webToStorageProcessConnection):
1365         (WebKit::WebProcess::ensureWebToStorageProcessConnection):
1366         (WebKit::WebProcess::webToDatabaseProcessConnectionClosed): Deleted.
1367         (WebKit::WebProcess::webToDatabaseProcessConnection): Deleted.
1368         (WebKit::WebProcess::ensureWebToDatabaseProcessConnection): Deleted.
1369         * WebProcess/WebProcess.h:
1370
1371 2017-08-01  Brady Eidson  <beidson@apple.com>
1372
1373         Part 1 of: Rename DatabaseProcess to StorageProcess.
1374         https://bugs.webkit.org/show_bug.cgi?id=174879
1375
1376         Reviewed by Andy Estes.
1377
1378         This patch is all about renaming source files and renaming the process itself (touching build system files, etc etc).
1379
1380         Some renaming in actual code did result (Some class/struct names, method names, etc)
1381
1382         Part 2 (174880) will go through and update all references in code itself from "Database" to "Storage"
1383
1384         * CMakeLists.txt:
1385         * DerivedSources.make:
1386         * PlatformGTK.cmake:
1387         * PlatformMac.cmake:
1388         * PlatformWPE.cmake:
1389         * WebKit.xcodeproj/project.pbxproj:
1390
1391         * Configurations/StorageService.xcconfig: Renamed from Source/WebKit/Configurations/DatabaseService.xcconfig.
1392         * StorageProcess/EntryPoint/mac/XPCService/StorageService/Info.plist: Renamed from Source/WebKit/DatabaseProcess/EntryPoint/mac/XPCService/DatabaseService/Info.plist.
1393         * StorageProcess/mac/com.apple.WebKit.Databases.sb.in: Renamed from Source/WebKit/DatabaseProcess/mac/com.apple.WebKit.Databases.sb.in.
1394
1395         * Shared/Storage/StorageProcessCreationParameters.cpp: Renamed from Source/WebKit/Shared/Databases/DatabaseProcessCreationParameters.cpp.
1396         * Shared/Storage/StorageProcessCreationParameters.h: Renamed from Source/WebKit/Shared/Databases/DatabaseProcessCreationParameters.h.
1397
1398         * StorageProcess/EntryPoint/mac/XPCService/StorageServiceEntryPoint.mm: Renamed from Source/WebKit/DatabaseProcess/EntryPoint/mac/XPCService/DatabaseServiceEntryPoint.mm.
1399         * StorageProcess/EntryPoint/unix/StorageProcessMain.cpp: Renamed from Source/WebKit/DatabaseProcess/EntryPoint/unix/DatabaseProcessMain.cpp.
1400
1401         * StorageProcess/IndexedDB/WebIDBConnectionToClient.cpp: Renamed from Source/WebKit/DatabaseProcess/IndexedDB/WebIDBConnectionToClient.cpp.
1402         * StorageProcess/IndexedDB/WebIDBConnectionToClient.h: Renamed from Source/WebKit/DatabaseProcess/IndexedDB/WebIDBConnectionToClient.h.
1403         * StorageProcess/IndexedDB/WebIDBConnectionToClient.messages.in: Renamed from Source/WebKit/DatabaseProcess/IndexedDB/WebIDBConnectionToClient.messages.in.
1404
1405         * StorageProcess/StorageProcess.cpp: Renamed from Source/WebKit/DatabaseProcess/DatabaseProcess.cpp.
1406         * StorageProcess/StorageProcess.h: Renamed from Source/WebKit/DatabaseProcess/DatabaseProcess.h.
1407         * StorageProcess/StorageProcess.messages.in: Renamed from Source/WebKit/DatabaseProcess/DatabaseProcess.messages.in.
1408
1409         * StorageProcess/StorageToWebProcessConnection.cpp: Renamed from Source/WebKit/DatabaseProcess/DatabaseToWebProcessConnection.cpp.
1410         * StorageProcess/StorageToWebProcessConnection.h: Renamed from Source/WebKit/DatabaseProcess/DatabaseToWebProcessConnection.h.
1411         * StorageProcess/StorageToWebProcessConnection.messages.in: Renamed from Source/WebKit/DatabaseProcess/DatabaseToWebProcessConnection.messages.in.
1412
1413         * StorageProcess/gtk/StorageProcessMainGtk.cpp: Renamed from Source/WebKit/DatabaseProcess/gtk/DatabaseProcessMainGtk.cpp.
1414         * StorageProcess/ios/StorageProcessIOS.mm: Renamed from Source/WebKit/DatabaseProcess/ios/DatabaseProcessIOS.mm.
1415         * StorageProcess/mac/StorageProcessMac.mm: Renamed from Source/WebKit/DatabaseProcess/mac/DatabaseProcessMac.mm.
1416         * StorageProcess/unix/StorageProcessMainUnix.h: Renamed from Source/WebKit/DatabaseProcess/unix/DatabaseProcessMainUnix.h.
1417         * UIProcess/Network/NetworkProcessProxy.cpp:
1418
1419         * UIProcess/Storage/StorageProcessProxy.cpp: Renamed from Source/WebKit/UIProcess/Databases/DatabaseProcessProxy.cpp.
1420         * UIProcess/Storage/StorageProcessProxy.h: Renamed from Source/WebKit/UIProcess/Databases/DatabaseProcessProxy.h.
1421         * UIProcess/Storage/StorageProcessProxy.messages.in: Renamed from Source/WebKit/UIProcess/Databases/DatabaseProcessProxy.messages.in.
1422
1423         * UIProcess/WebContextSupplement.h:
1424         * UIProcess/WebProcessPool.cpp:
1425         * UIProcess/WebProcessPool.h:
1426         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1427         * UIProcess/WebsiteData/WebsiteDataStore.h:
1428         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
1429         * WebProcess/Databases/WebDatabaseProvider.cpp:
1430
1431         * WebProcess/Storage/WebToStorageProcessConnection.cpp: Renamed from Source/WebKit/WebProcess/Databases/WebToDatabaseProcessConnection.cpp.
1432         * WebProcess/Storage/WebToStorageProcessConnection.h: Renamed from Source/WebKit/WebProcess/Databases/WebToDatabaseProcessConnection.h.
1433
1434         * WebProcess/WebProcess.cpp:
1435
1436 2017-08-01  Michael Catanzaro  <mcatanzaro@igalia.com>
1437
1438         [CMake] WebKitFS.cmake depends on options set in Option cmake files that are included later
1439         https://bugs.webkit.org/show_bug.cgi?id=174855
1440
1441         Reviewed by Carlos Garcia Campos.
1442
1443         Don't create derived sources directory here anymore.
1444
1445         * PlatformGTK.cmake:
1446         * PlatformMac.cmake:
1447         * PlatformWPE.cmake:
1448
1449 2017-07-31  Daniel Bates  <dabates@apple.com>
1450
1451         WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction() may not be able to
1452         determine page that initiated navigation
1453         https://bugs.webkit.org/show_bug.cgi?id=174531
1454
1455         Remove a comment from WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction()
1456         about determining the originating page independently from the originating frame. There
1457         does not seem to be much value to fixing this. We can always revisit this issue if we
1458         discover a strong motivating example. See <https://bugs.webkit.org/show_bug.cgi?id=174531#c1>
1459         for more details.
1460
1461         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1462         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
1463
1464 2017-07-31  Sam Weinig  <sam@webkit.org>
1465
1466         Remove unnecessary exceptions from storage code
1467         https://bugs.webkit.org/show_bug.cgi?id=174572
1468
1469         Reviewed by Chris Dumez.
1470
1471         * WebProcess/Storage/StorageAreaImpl.cpp:
1472         (WebKit::StorageAreaImpl::canAccessStorage): Deleted.
1473         * WebProcess/Storage/StorageAreaImpl.h:
1474         * WebProcess/Storage/StorageNamespaceImpl.cpp:
1475         Remove canAccessStorage. It is no longer called.
1476
1477 2017-07-30  Brady Eidson  <beidson@apple.com>
1478
1479         Add URLSchemeHandler API tests that verify the lack of URLSchemeTask object leaks.
1480         https://bugs.webkit.org/show_bug.cgi?id=174958
1481
1482         Reviewed by Darin Adler.
1483
1484         * UIProcess/API/APIURLSchemeTask.h:
1485
1486         * UIProcess/API/C/WKTestingSupport.cpp:
1487         (WKGetAPIURLSchemeTaskInstanceCount):
1488         (WKGetWebURLSchemeTaskInstanceCount):
1489         * UIProcess/API/C/WKTestingSupport.h:
1490
1491         * UIProcess/WebURLSchemeTask.h:
1492
1493         * WebKit.xcodeproj/project.pbxproj:
1494
1495 2017-07-29  Yusuke Suzuki  <utatane.tea@gmail.com>
1496
1497         Unreviewed, build fix for GTK and WPE about StorageProcess renaming
1498
1499         * CMakeLists.txt:
1500         * PlatformGTK.cmake:
1501         * PlatformMac.cmake:
1502         * PlatformWPE.cmake:
1503
1504 2017-07-28  Brent Fulgham  <bfulgham@apple.com>
1505
1506         [Mac][WebKit2] WebKit sandbox errors while streaming Netflix
1507         https://bugs.webkit.org/show_bug.cgi?id=174955
1508         <rdar://problem/33583994>
1509
1510         Reviewed by Alex Christensen.
1511
1512         Wider testing with the stricter sandboxing rules identified three more IOKit properties we need to expose:
1513         - CEAModeID
1514         - CEAPixelRepetition
1515         - IOFBHDMIDongleROM
1516
1517         * WebProcess/com.apple.WebProcess.sb.in:
1518
1519 2017-07-28  Commit Queue  <commit-queue@webkit.org>
1520
1521         Unreviewed, rolling out r219986.
1522         https://bugs.webkit.org/show_bug.cgi?id=174962
1523
1524         "broke PLT on iOS (rdar://problem/33602751)" (Requested by
1525         estes on #webkit).
1526
1527         Reverted changeset:
1528
1529         "Part 1 of: Rename DatabaseProcess to StorageProcess."
1530         https://bugs.webkit.org/show_bug.cgi?id=174879
1531         http://trac.webkit.org/changeset/219986
1532
1533 2017-07-28  Commit Queue  <commit-queue@webkit.org>
1534
1535         Unreviewed, rolling out r219990.
1536         https://bugs.webkit.org/show_bug.cgi?id=174961
1537
1538         "broke PLT on iOS (rdar://problem/33602751)" (Requested by
1539         estes on #webkit).
1540
1541         Reverted changeset:
1542
1543         "Part 2 of: Rename DatabaseProcess to StorageProcess."
1544         https://bugs.webkit.org/show_bug.cgi?id=174880
1545         http://trac.webkit.org/changeset/219990
1546
1547 2017-07-28  Brady Eidson  <beidson@apple.com>
1548
1549         API tests that use URLSchemeHandler are failing.
1550         https://bugs.webkit.org/show_bug.cgi?id=174950
1551
1552         Reviewed by Alex Christensen.
1553
1554         Make sure that in all cases where we remove the last task from the page->task map...
1555         ...We also remove the map itself.
1556
1557         * UIProcess/WebURLSchemeHandler.cpp:
1558         (WebKit::WebURLSchemeHandler::stopTask):
1559         (WebKit::WebURLSchemeHandler::taskCompleted):
1560         (WebKit::WebURLSchemeHandler::removeTaskFromPageMap):
1561         * UIProcess/WebURLSchemeHandler.h:
1562
1563 2017-07-28  Brady Eidson  <beidson@apple.com>
1564
1565         WKURLSchemeTaskImpl instances are being abandoned (except if the task is stopped).
1566         <rdar://problem/33568276> and https://bugs.webkit.org/show_bug.cgi?id=174895
1567
1568         Reviewed by Alex Christensen.
1569
1570         There was a lot going on here:
1571         - There was an unbroken cycle between URLSchemeHandlers and URLSchemeTasks 
1572         - WKURLSchemeTasks were not destroying their API::URLSchemeTask implementation object
1573         - When a WKWebView was dealloc'ed, it was not cleaning up the related UIProcess tasks
1574         - If the NetworkingProcess crashed, WebProcesses were not cleaning up their tasks
1575           (and therefore the UIProcess tasks were also not getting cleaned up)
1576         - If a WebProcess crashed, the UIProcess was not cleaning up the related tasks
1577         
1578         * UIProcess/API/Cocoa/WKURLSchemeTask.mm:
1579         (-[WKURLSchemeTaskImpl dealloc]): Call API::~URLSchemeTask
1580         
1581         * UIProcess/Cocoa/WebURLSchemeHandlerCocoa.h:
1582         * UIProcess/Cocoa/WebURLSchemeHandlerCocoa.mm:
1583         (WebKit::WebURLSchemeHandlerCocoa::platformTaskCompleted): Clear out the API wrapper map
1584           so the wrapper and implementation object can both be destroyed.
1585         
1586         * UIProcess/WebPageProxy.cpp:
1587         (WebKit::WebPageProxy::close): Call stopAllURLSchemeTasks.
1588         (WebKit::WebPageProxy::processDidTerminate): Call stopAllURLSchemeTasks.
1589         (WebKit::WebPageProxy::stopAllURLSchemeTasks):
1590         * UIProcess/WebPageProxy.h:
1591         
1592         * UIProcess/WebURLSchemeHandler.cpp:
1593         (WebKit::WebURLSchemeHandler::startTask):
1594         (WebKit::WebURLSchemeHandler::stopAllTasksForPage):
1595         (WebKit::WebURLSchemeHandler::stopTask):
1596         (WebKit::WebURLSchemeHandler::taskCompleted):
1597         * UIProcess/WebURLSchemeHandler.h:
1598         
1599         * UIProcess/WebURLSchemeTask.cpp:
1600         (WebKit::WebURLSchemeTask::WebURLSchemeTask):
1601         * UIProcess/WebURLSchemeTask.h:
1602         (WebKit::WebURLSchemeTask::pageID): Store separate from the WebPage so messaging
1603           is possible even after the WebPage* has been cleared.
1604         
1605         * WebProcess/WebPage/WebPage.cpp:
1606         (WebKit::WebPage::stopAllURLSchemeTasks):
1607         * WebProcess/WebPage/WebPage.h:
1608         
1609         * WebProcess/WebPage/WebURLSchemeHandlerProxy.cpp:
1610         (WebKit::WebURLSchemeHandlerProxy::stopAllTasks):
1611         (WebKit::WebURLSchemeHandlerProxy::taskDidComplete):
1612         (WebKit::WebURLSchemeHandlerProxy::taskDidStopLoading):
1613         (WebKit::WebURLSchemeHandlerProxy::removeTask):
1614         * WebProcess/WebPage/WebURLSchemeHandlerProxy.h:
1615         
1616         * WebProcess/WebProcess.cpp:
1617         (WebKit::WebProcess::networkProcessConnectionClosed): Call stopAllURLSchemeTasks 
1618           for each WebPage.
1619
1620 2017-07-28  Frederic Wang  <fwang@igalia.cpm>
1621
1622         Fix typo in scrollPositionChangedViaDelegatedScrolling
1623         https://bugs.webkit.org/show_bug.cgi?id=174937
1624
1625         Reviewed by Wenson Hsieh.
1626
1627         * UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.h:
1628         * UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
1629         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::scrollViewDidScroll):
1630
1631 2017-07-28  Jeremy Jones  <jeremyj@apple.com>
1632
1633         Remove Web prefix from WebVideoFullscreen and WebPlaybackSession classes.
1634         https://bugs.webkit.org/show_bug.cgi?id=174437
1635
1636         Reviewed by Darin Adler.
1637
1638         Remove redundant Web- prefix from classes in WebKit namespace.
1639
1640         * DerivedSources.make:
1641         * UIProcess/API/Cocoa/WKWebView.mm:
1642         * UIProcess/Cocoa/PlaybackSessionManagerProxy.h: Renamed from Source/WebKit/UIProcess/Cocoa/WebPlaybackSessionManagerProxy.h.
1643         * UIProcess/Cocoa/PlaybackSessionManagerProxy.messages.in: Renamed from Source/WebKit/UIProcess/Cocoa/WebPlaybackSessionManagerProxy.messages.in.
1644         * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm: Added.
1645         * UIProcess/Cocoa/VideoFullscreenManagerProxy.h: Renamed from Source/WebKit/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h.
1646         * UIProcess/Cocoa/VideoFullscreenManagerProxy.messages.in: Renamed from Source/WebKit/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.messages.in.
1647         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm: Renamed from Source/WebKit/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm.
1648         * UIProcess/Cocoa/WebPlaybackSessionManagerProxy.mm: Removed.
1649         * UIProcess/Cocoa/WebViewImpl.mm:
1650         (WebKit::WebViewImpl::updateMediaTouchBar):
1651         * UIProcess/WebPageProxy.cpp:
1652         (WebKit::m_weakPtrFactory):
1653         (WebKit::WebPageProxy::reattachToWebProcess):
1654         (WebKit::WebPageProxy::playbackSessionManager):
1655         (WebKit::WebPageProxy::videoFullscreenManager):
1656         * UIProcess/WebPageProxy.h:
1657         * UIProcess/ios/WebPageProxyIOS.mm:
1658         * WebKit.xcodeproj/project.pbxproj:
1659         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1660         * WebProcess/WebPage/WebPage.cpp:
1661         (WebKit::WebPage::playbackSessionManager):
1662         (WebKit::WebPage::videoFullscreenManager):
1663         * WebProcess/WebPage/WebPage.h:
1664         * WebProcess/cocoa/PlaybackSessionManager.h: Renamed from Source/WebKit/WebProcess/cocoa/WebPlaybackSessionManager.h.
1665         * WebProcess/cocoa/PlaybackSessionManager.messages.in: Renamed from Source/WebKit/WebProcess/cocoa/WebPlaybackSessionManager.messages.in.
1666         * WebProcess/cocoa/PlaybackSessionManager.mm: Added.
1667         * WebProcess/cocoa/VideoFullscreenManager.h: Renamed from Source/WebKit/WebProcess/cocoa/WebVideoFullscreenManager.h.
1668         (WebKit::VideoFullscreenInterfaceContext::create):
1669         * WebProcess/cocoa/VideoFullscreenManager.messages.in: Renamed from Source/WebKit/WebProcess/cocoa/WebVideoFullscreenManager.messages.in.
1670         * WebProcess/cocoa/VideoFullscreenManager.mm: Renamed from Source/WebKit/WebProcess/cocoa/WebVideoFullscreenManager.mm.
1671         * WebProcess/cocoa/WebPlaybackSessionManager.mm: Removed.
1672
1673 2017-07-27  Zan Dobersek  <zdobersek@igalia.com>
1674
1675         [CMake] Re-add the StorageProcess executable target
1676         https://bugs.webkit.org/show_bug.cgi?id=174929
1677
1678         Reviewed by Carlos Garcia Campos.
1679
1680         Re-add the StorageProcess executable target that was removed in r219960.
1681         Back then it was still named DatabaseProcess, but the name changed in
1682         the following patches.
1683
1684         * CMakeLists.txt:
1685
1686 2017-07-27  Brady Eidson  <beidson@apple.com>
1687
1688         Part 2 of: Rename DatabaseProcess to StorageProcess.
1689         https://bugs.webkit.org/show_bug.cgi?id=174880
1690
1691         Reviewed by Andy Estes.
1692
1693         Rename some more variables, classes, etc. to reflect the change.
1694
1695         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1696         (WebKit::NetworkConnectionToWebProcess::writeBlobsToTemporaryFiles):
1697
1698         * NetworkProcess/NetworkProcess.cpp:
1699         (WebKit::NetworkProcess::grantSandboxExtensionsToStorageProcessForBlobs):
1700         (WebKit::NetworkProcess::didgrantSandboxExtensionsToStorageProcessForBlobs):
1701         (WebKit::NetworkProcess::grantSandboxExtensionsToDatabaseProcessForBlobs): Deleted.
1702         (WebKit::NetworkProcess::didGrantSandboxExtensionsToDatabaseProcessForBlobs): Deleted.
1703         * NetworkProcess/NetworkProcess.h:
1704         * NetworkProcess/NetworkProcess.messages.in:
1705
1706         * Shared/ProcessExecutablePath.h:
1707         * Shared/gtk/ProcessExecutablePathGtk.cpp:
1708         (WebKit::executablePathOfStorageProcess):
1709         (WebKit::executablePathOfDatabaseProcess): Deleted.
1710         * Shared/wpe/ProcessExecutablePathWPE.cpp:
1711         (WebKit::executablePathOfStorageProcess):
1712         (WebKit::executablePathOfDatabaseProcess): Deleted.
1713
1714         * StorageProcess/IndexedDB/WebIDBConnectionToClient.cpp:
1715         (WebKit::WebIDBConnectionToClient::putOrAdd):
1716
1717         * StorageProcess/StorageProcess.cpp:
1718         (WebKit::StorageProcess::initializeWebsiteDataStore):
1719         (WebKit::StorageProcess::postStorageTask):
1720         (WebKit::StorageProcess::performNextStorageTask):
1721         (WebKit::StorageProcess::createStorageToWebProcessConnection):
1722         (WebKit::StorageProcess::fetchWebsiteData):
1723         (WebKit::StorageProcess::postDatabaseTask): Deleted.
1724         (WebKit::StorageProcess::performNextDatabaseTask): Deleted.
1725         (WebKit::StorageProcess::createDatabaseToWebProcessConnection): Deleted.
1726         * StorageProcess/StorageProcess.h:
1727         * StorageProcess/StorageProcess.messages.in:
1728         * StorageProcess/mac/StorageProcessMac.mm:
1729         (WebKit::StorageProcess::initializeProcessName):
1730
1731         * UIProcess/API/C/WKContext.cpp:
1732         (WKContextGetDatabaseProcessIdentifier):
1733
1734         * UIProcess/API/Cocoa/WKProcessPool.mm:
1735         (-[WKProcessPool _terminateStorageProcess]):
1736         (-[WKProcessPool _storageProcessIdentifier]):
1737         (-[WKProcessPool _terminateDatabaseProcess]): Deleted.
1738         (-[WKProcessPool _databaseProcessIdentifier]): Deleted.
1739         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
1740
1741         * UIProcess/Launcher/ProcessLauncher.h:
1742         * UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp:
1743         (WebKit::ProcessLauncher::launchProcess):
1744         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
1745         (WebKit::serviceName):
1746         * UIProcess/Launcher/wpe/ProcessLauncherWPE.cpp:
1747         (WebKit::ProcessLauncher::launchProcess):
1748
1749         * UIProcess/Network/NetworkProcessProxy.cpp:
1750         (WebKit::NetworkProcessProxy::grantSandboxExtensionsToStorageProcessForBlobs):
1751         (WebKit::NetworkProcessProxy::grantSandboxExtensionsToDatabaseProcessForBlobs): Deleted.
1752         * UIProcess/Network/NetworkProcessProxy.h:
1753         * UIProcess/Network/NetworkProcessProxy.messages.in:
1754
1755         * UIProcess/Storage/StorageProcessProxy.cpp:
1756         (WebKit::StorageProcessProxy::getLaunchOptions):
1757         (WebKit::StorageProcessProxy::getStorageProcessConnection):
1758         (WebKit::StorageProcessProxy::didClose):
1759         (WebKit::StorageProcessProxy::didCreateStorageToWebProcessConnection):
1760         (WebKit::StorageProcessProxy::didFinishLaunching):
1761         (WebKit::StorageProcessProxy::getDatabaseProcessConnection): Deleted.
1762         (WebKit::StorageProcessProxy::didCreateDatabaseToWebProcessConnection): Deleted.
1763         * UIProcess/Storage/StorageProcessProxy.h:
1764         * UIProcess/Storage/StorageProcessProxy.messages.in:
1765
1766         * UIProcess/WebContextClient.cpp:
1767         (WebKit::WebContextClient::storageProcessDidCrash):
1768         (WebKit::WebContextClient::databaseProcessDidCrash): Deleted.
1769         * UIProcess/WebContextClient.h:
1770
1771         * UIProcess/WebProcessPool.cpp:
1772         (WebKit::WebProcessPool::ensureStorageProcessAndWebsiteDataStore):
1773         (WebKit::WebProcessPool::getStorageProcessConnection):
1774         (WebKit::WebProcessPool::storageProcessCrashed):
1775         (WebKit::WebProcessPool::pageAddedToProcess):
1776         (WebKit::WebProcessPool::storageProcessIdentifier):
1777         (WebKit::WebProcessPool::terminateStorageProcess):
1778         (WebKit::WebProcessPool::ensureDatabaseProcessAndWebsiteDataStore): Deleted.
1779         (WebKit::WebProcessPool::getDatabaseProcessConnection): Deleted.
1780         (WebKit::WebProcessPool::databaseProcessCrashed): Deleted.
1781         (WebKit::WebProcessPool::databaseProcessIdentifier): Deleted.
1782         (WebKit::WebProcessPool::terminateDatabaseProcess): Deleted.
1783         * UIProcess/WebProcessPool.h:
1784         (WebKit::WebProcessPool::sendToStorageProcessRelaunchingIfNecessary):
1785         (WebKit::WebProcessPool::sendToDatabaseProcessRelaunchingIfNecessary): Deleted.
1786
1787         * UIProcess/WebProcessProxy.cpp:
1788         (WebKit::WebProcessProxy::getStorageProcessConnection):
1789         (WebKit::WebProcessProxy::getDatabaseProcessConnection): Deleted.
1790         * UIProcess/WebProcessProxy.h:
1791         * UIProcess/WebProcessProxy.messages.in:
1792
1793         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1794         (WebKit::WebsiteDataStore::fetchDataAndApply):
1795         (WebKit::WebsiteDataStore::removeData):
1796         (WebKit::WebsiteDataStore::storageProcessParameters):
1797         (WebKit::WebsiteDataStore::databaseProcessParameters): Deleted.
1798         * UIProcess/WebsiteData/WebsiteDataStore.h:
1799
1800         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
1801         (WebKit::WebIDBConnectionToServer::messageSenderConnection):
1802         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h:
1803
1804         * WebProcess/Databases/WebDatabaseProvider.cpp:
1805         (WebKit::WebDatabaseProvider::idbConnectionToServerForSession):
1806
1807         * WebProcess/Storage/WebToStorageProcessConnection.cpp:
1808         (WebKit::WebToStorageProcessConnection::WebToStorageProcessConnection):
1809         (WebKit::WebToStorageProcessConnection::~WebToStorageProcessConnection):
1810         (WebKit::WebToStorageProcessConnection::didReceiveMessage):
1811         (WebKit::WebToStorageProcessConnection::didClose):
1812         (WebKit::WebToStorageProcessConnection::didReceiveInvalidMessage):
1813         (WebKit::WebToStorageProcessConnection::idbConnectionToServerForSession):
1814         (WebKit::WebToDatabaseProcessConnection::WebToDatabaseProcessConnection): Deleted.
1815         (WebKit::WebToDatabaseProcessConnection::~WebToDatabaseProcessConnection): Deleted.
1816         (WebKit::WebToDatabaseProcessConnection::didReceiveMessage): Deleted.
1817         (WebKit::WebToDatabaseProcessConnection::didClose): Deleted.
1818         (WebKit::WebToDatabaseProcessConnection::didReceiveInvalidMessage): Deleted.
1819         (WebKit::WebToDatabaseProcessConnection::idbConnectionToServerForSession): Deleted.
1820         * WebProcess/Storage/WebToStorageProcessConnection.h:
1821         (WebKit::WebToStorageProcessConnection::create):
1822         (WebKit::WebToDatabaseProcessConnection::create): Deleted.
1823         (WebKit::WebToDatabaseProcessConnection::connection): Deleted.
1824
1825         * WebProcess/WebProcess.cpp:
1826         (WebKit::WebProcess::webToStorageProcessConnectionClosed):
1827         (WebKit::WebProcess::webToStorageProcessConnection):
1828         (WebKit::WebProcess::ensureWebToStorageProcessConnection):
1829         (WebKit::WebProcess::webToDatabaseProcessConnectionClosed): Deleted.
1830         (WebKit::WebProcess::webToDatabaseProcessConnection): Deleted.
1831         (WebKit::WebProcess::ensureWebToDatabaseProcessConnection): Deleted.
1832         * WebProcess/WebProcess.h:
1833
1834 2017-07-27  Nan Wang  <n_wang@apple.com>
1835
1836         AX: A11Y: Zoom no longer follows keyboard insertion point in safari
1837         https://bugs.webkit.org/show_bug.cgi?id=174869
1838
1839         Reviewed by David Kilzer.
1840
1841         There was a recent change by denying XPC services access by default. 
1842         In UAZoomChangeFocus we need to send message to HIServices, so let's
1843         allow the connection to XPC services for that. 
1844
1845         * WebProcess/com.apple.WebProcess.sb.in:
1846
1847 2017-07-27  Brady Eidson  <beidson@apple.com>
1848
1849         Part 1 of: Rename DatabaseProcess to StorageProcess.
1850         https://bugs.webkit.org/show_bug.cgi?id=174879
1851
1852         Reviewed by Andy Estes.
1853
1854         This patch is all about renaming source files and renaming the process itself (touching build system files, etc etc).
1855
1856         Some renaming in actual code did result (Some class/struct names, method names, etc)
1857
1858         Part 2 (174880) will go through and update all references in code itself from "Database" to "Storage"
1859
1860         * CMakeLists.txt:
1861         * Configurations/Storage-iOS.entitlements: Renamed from Source/WebKit/Configurations/Databases-iOS.entitlements.
1862         * Configurations/StorageService.xcconfig: Renamed from Source/WebKit/Configurations/DatabaseService.xcconfig.
1863         * Configurations/WebKit.xcconfig:
1864         * DerivedSources.make:
1865         * Platform/ExtraPrivateSymbolsForTAPI.h:
1866         * PlatformGTK.cmake:
1867         * PlatformMac.cmake:
1868         * PlatformWPE.cmake:
1869
1870         * Resources/SandboxProfiles/ios/com.apple.WebKit.Storage.sb: Renamed from Source/WebKit/Resources/SandboxProfiles/ios/com.apple.WebKit.Databases.sb.
1871
1872         * Shared/Storage/StorageProcessCreationParameters.cpp: Renamed from Source/WebKit/Shared/Databases/DatabaseProcessCreationParameters.cpp.
1873         (WebKit::StorageProcessCreationParameters::StorageProcessCreationParameters):
1874         (WebKit::StorageProcessCreationParameters::encode):
1875         (WebKit::StorageProcessCreationParameters::decode):
1876         * Shared/Storage/StorageProcessCreationParameters.h: Renamed from Source/WebKit/Shared/Databases/DatabaseProcessCreationParameters.h.
1877
1878         * StorageProcess/EntryPoint/mac/XPCService/StorageService/Info.plist: Renamed from Source/WebKit/DatabaseProcess/EntryPoint/mac/XPCService/DatabaseService/Info.plist.
1879         * StorageProcess/EntryPoint/mac/XPCService/StorageServiceEntryPoint.mm: Renamed from Source/WebKit/DatabaseProcess/EntryPoint/mac/XPCService/DatabaseServiceEntryPoint.mm.
1880         (StorageServiceInitializer):
1881         * StorageProcess/EntryPoint/unix/StorageProcessMain.cpp: Renamed from Source/WebKit/DatabaseProcess/EntryPoint/unix/DatabaseProcessMain.cpp.
1882         (main):
1883
1884         * StorageProcess/IndexedDB/WebIDBConnectionToClient.cpp: Renamed from Source/WebKit/DatabaseProcess/IndexedDB/WebIDBConnectionToClient.cpp.
1885         * StorageProcess/IndexedDB/WebIDBConnectionToClient.h: Renamed from Source/WebKit/DatabaseProcess/IndexedDB/WebIDBConnectionToClient.h.
1886         * StorageProcess/IndexedDB/WebIDBConnectionToClient.messages.in: Renamed from Source/WebKit/DatabaseProcess/IndexedDB/WebIDBConnectionToClient.messages.in.
1887         
1888         * StorageProcess/StorageProcess.cpp: Renamed from Source/WebKit/DatabaseProcess/DatabaseProcess.cpp.
1889         * StorageProcess/StorageProcess.h: Renamed from Source/WebKit/DatabaseProcess/DatabaseProcess.h.
1890         * StorageProcess/StorageProcess.messages.in: Renamed from Source/WebKit/DatabaseProcess/DatabaseProcess.messages.in.
1891
1892         * StorageProcess/StorageToWebProcessConnection.cpp: Renamed from Source/WebKit/DatabaseProcess/DatabaseToWebProcessConnection.cpp.
1893         * StorageProcess/StorageToWebProcessConnection.h: Renamed from Source/WebKit/DatabaseProcess/DatabaseToWebProcessConnection.h.
1894         * StorageProcess/StorageToWebProcessConnection.messages.in: Renamed from Source/WebKit/DatabaseProcess/DatabaseToWebProcessConnection.messages.in.
1895
1896         * StorageProcess/gtk/StorageProcessMainGtk.cpp: Renamed from Source/WebKit/DatabaseProcess/gtk/DatabaseProcessMainGtk.cpp.
1897         (WebKit::StorageProcessMainUnix):
1898         * StorageProcess/ios/StorageProcessIOS.mm: Renamed from Source/WebKit/DatabaseProcess/ios/DatabaseProcessIOS.mm.
1899         (WebKit::StorageProcess::initializeProcess):
1900         (WebKit::StorageProcess::initializeProcessName):
1901         (WebKit::StorageProcess::initializeSandbox):
1902         * StorageProcess/mac/StorageProcessMac.mm: Renamed from Source/WebKit/DatabaseProcess/mac/DatabaseProcessMac.mm.
1903         (WebKit::StorageProcess::initializeProcess):
1904         (WebKit::StorageProcess::initializeProcessName):
1905         (WebKit::StorageProcess::initializeSandbox):
1906
1907         * StorageProcess/mac/com.apple.WebKit.Databases.sb.in: Copied from Source/WebKit/DatabaseProcess/mac/com.apple.WebKit.Databases.sb.in.
1908         * StorageProcess/mac/com.apple.WebKit.Storage.sb.in: Renamed from Source/WebKit/DatabaseProcess/mac/com.apple.WebKit.Databases.sb.in.
1909
1910         * StorageProcess/unix/StorageProcessMainUnix.h: Renamed from Source/WebKit/DatabaseProcess/unix/DatabaseProcessMainUnix.h.
1911
1912         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
1913         (WebKit::serviceName):
1914
1915         * UIProcess/Network/NetworkProcessProxy.cpp:
1916         (WebKit::NetworkProcessProxy::grantSandboxExtensionsToDatabaseProcessForBlobs):
1917
1918         * UIProcess/Storage/StorageProcessProxy.cpp: Renamed from Source/WebKit/UIProcess/Databases/DatabaseProcessProxy.cpp.
1919         * UIProcess/Storage/StorageProcessProxy.h: Renamed from Source/WebKit/UIProcess/Databases/DatabaseProcessProxy.h.
1920         * UIProcess/Storage/StorageProcessProxy.messages.in: Renamed from Source/WebKit/UIProcess/Databases/DatabaseProcessProxy.messages.in.
1921
1922         * UIProcess/WebContextSupplement.h:
1923         (WebKit::WebContextSupplement::processDidClose):
1924
1925         * UIProcess/WebProcessPool.cpp:
1926         (WebKit::WebProcessPool::ensureDatabaseProcessAndWebsiteDataStore):
1927         (WebKit::WebProcessPool::databaseProcessCrashed):
1928         (WebKit::WebProcessPool::pageAddedToProcess):
1929         * UIProcess/WebProcessPool.h:
1930
1931         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1932         (WebKit::WebsiteDataStore::databaseProcessParameters):
1933         * UIProcess/WebsiteData/WebsiteDataStore.h:
1934
1935         * WebKit.xcodeproj/project.pbxproj:
1936
1937         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
1938         (WebKit::WebIDBConnectionToServer::WebIDBConnectionToServer):
1939         (WebKit::WebIDBConnectionToServer::~WebIDBConnectionToServer):
1940         * WebProcess/Databases/WebDatabaseProvider.cpp:
1941
1942         * WebProcess/Storage/WebToStorageProcessConnection.cpp: Renamed from Source/WebKit/WebProcess/Databases/WebToDatabaseProcessConnection.cpp.
1943         * WebProcess/Storage/WebToStorageProcessConnection.h: Renamed from Source/WebKit/WebProcess/Databases/WebToDatabaseProcessConnection.h.
1944
1945         * WebProcess/WebProcess.cpp:
1946
1947 2017-07-27  Tim Horton  <timothy_horton@apple.com>
1948
1949         PDF page number indicator is very flashy when scrolling
1950         https://bugs.webkit.org/show_bug.cgi?id=174882
1951         <rdar://problem/23760981>
1952
1953         Reviewed by Andy Estes.
1954
1955         * Platform/spi/ios/UIKitSPI.h:
1956         * UIProcess/ios/WKPDFPageNumberIndicator.mm:
1957         (-[WKPDFPageNumberIndicator initWithFrame:]):
1958         Increase the backdrop rendering resolution to reduce flashiness.
1959         It's still not perfect, but it's quite visibly better.
1960
1961 2017-07-26  Brady Eidson  <beidson@apple.com>
1962
1963         ResourceLoadStatistics API tests fail on El Capitan.
1964         https://bugs.webkit.org/show_bug.cgi?id=174877
1965
1966         Reviewed by Chris Dumez.
1967
1968         Always install the testing callback.
1969
1970         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1971         (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback):
1972
1973 2017-07-26  Tim Horton  <timothy_horton@apple.com>
1974
1975         REGRESSION (r211160): Can't pinch to zoom unlocked encrypted PDFs in WKWebView
1976         https://bugs.webkit.org/show_bug.cgi?id=174881
1977         <rdar://problem/33556312>
1978
1979         Reviewed by Andy Estes.
1980
1981         * UIProcess/API/Cocoa/WKWebView.mm:
1982         (-[WKWebView _hidePasswordView]):
1983         WKPasswordView saves and restores a bunch of scroll view properties, including
1984         those relating to zoom limits. The restoration happens in -[WKPasswordView hide],
1985         which is never called. Instead, the code added in r211160 just calls
1986         removeFromSuperview after unlocking, never restoring the old zoom limits,
1987         causing the then fully unlocked PDF to not be zoomable. Fix this by calling
1988         -hide instead of -removeFromSuperview (which -hide also calls).
1989
1990 2017-07-26  Brady Eidson  <beidson@apple.com>
1991
1992         Rename {Web/UI}Process/Storage to {Web/UI}Process/WebStorage.
1993         https://bugs.webkit.org/show_bug.cgi?id=174871
1994
1995         Reviewed by Chris Dumez.
1996
1997         The standard these directories help implement is the "Web Storage" standard.
1998         "Storage" is too general of a word that we have plans to start using in other contexts soon.
1999
2000         * CMakeLists.txt:
2001         * DerivedSources.make:
2002         * PlatformGTK.cmake:
2003         * PlatformMac.cmake:
2004         * PlatformWPE.cmake:
2005         * WebKit.xcodeproj/project.pbxproj:
2006
2007         * UIProcess/ResourceLoadStatisticsPersistentStorage.cpp: Renamed from Source/WebKit/UIProcess/Storage/ResourceLoadStatisticsPersistentStorage.cpp.
2008         * UIProcess/ResourceLoadStatisticsPersistentStorage.h: Renamed from Source/WebKit/UIProcess/Storage/ResourceLoadStatisticsPersistentStorage.h.
2009         * UIProcess/WebStorage/LocalStorageDatabase.cpp: Renamed from Source/WebKit/UIProcess/Storage/LocalStorageDatabase.cpp.
2010         * UIProcess/WebStorage/LocalStorageDatabase.h: Renamed from Source/WebKit/UIProcess/Storage/LocalStorageDatabase.h.
2011         * UIProcess/WebStorage/LocalStorageDatabaseTracker.cpp: Renamed from Source/WebKit/UIProcess/Storage/LocalStorageDatabaseTracker.cpp.
2012         * UIProcess/WebStorage/LocalStorageDatabaseTracker.h: Renamed from Source/WebKit/UIProcess/Storage/LocalStorageDatabaseTracker.h.
2013         * UIProcess/WebStorage/StorageManager.cpp: Renamed from Source/WebKit/UIProcess/Storage/StorageManager.cpp.
2014         * UIProcess/WebStorage/StorageManager.h: Renamed from Source/WebKit/UIProcess/Storage/StorageManager.h.
2015         * UIProcess/WebStorage/StorageManager.messages.in: Renamed from Source/WebKit/UIProcess/Storage/StorageManager.messages.in.
2016         * UIProcess/WebStorage/ios/LocalStorageDatabaseTrackerIOS.mm: Renamed from Source/WebKit/UIProcess/Storage/ios/LocalStorageDatabaseTrackerIOS.mm.
2017         * UIProcess/ios/ResourceLoadStatisticsPersistentStorageIOS.mm: Renamed from Source/WebKit/UIProcess/Storage/ios/ResourceLoadStatisticsPersistentStorageIOS.mm.
2018
2019         * WebProcess/WebStorage/StorageAreaImpl.cpp: Renamed from Source/WebKit/WebProcess/Storage/StorageAreaImpl.cpp.
2020         * WebProcess/WebStorage/StorageAreaImpl.h: Renamed from Source/WebKit/WebProcess/Storage/StorageAreaImpl.h.
2021         * WebProcess/WebStorage/StorageAreaMap.cpp: Renamed from Source/WebKit/WebProcess/Storage/StorageAreaMap.cpp.
2022         * WebProcess/WebStorage/StorageAreaMap.h: Renamed from Source/WebKit/WebProcess/Storage/StorageAreaMap.h.
2023         * WebProcess/WebStorage/StorageAreaMap.messages.in: Renamed from Source/WebKit/WebProcess/Storage/StorageAreaMap.messages.in.
2024         * WebProcess/WebStorage/StorageNamespaceImpl.cpp: Renamed from Source/WebKit/WebProcess/Storage/StorageNamespaceImpl.cpp.
2025         * WebProcess/WebStorage/StorageNamespaceImpl.h: Renamed from Source/WebKit/WebProcess/Storage/StorageNamespaceImpl.h.
2026         * WebProcess/WebStorage/WebStorageNamespaceProvider.cpp: Renamed from Source/WebKit/WebProcess/Storage/WebStorageNamespaceProvider.cpp.
2027         * WebProcess/WebStorage/WebStorageNamespaceProvider.h: Renamed from Source/WebKit/WebProcess/Storage/WebStorageNamespaceProvider.h.
2028
2029 2017-07-26  Brady Eidson  <beidson@apple.com>
2030
2031         Remove DATABASE_PROCESS build flag.
2032         https://bugs.webkit.org/show_bug.cgi?id=174868
2033
2034         Reviewed by Andy Estes.
2035
2036         * CMakeLists.txt:
2037         * DatabaseProcess/DatabaseProcess.cpp:
2038         * DatabaseProcess/DatabaseProcess.h:
2039         * DatabaseProcess/DatabaseProcess.messages.in:
2040         * DatabaseProcess/DatabaseToWebProcessConnection.cpp:
2041         * DatabaseProcess/DatabaseToWebProcessConnection.h:
2042         * DatabaseProcess/DatabaseToWebProcessConnection.messages.in:
2043         * DatabaseProcess/IndexedDB/WebIDBConnectionToClient.messages.in:
2044         * DatabaseProcess/gtk/DatabaseProcessMainGtk.cpp:
2045         * DatabaseProcess/ios/DatabaseProcessIOS.mm:
2046         * DatabaseProcess/mac/DatabaseProcessMac.mm:
2047         * DatabaseProcess/unix/DatabaseProcessMainUnix.h:
2048         * Shared/Databases/DatabaseProcessCreationParameters.cpp:
2049         * Shared/Databases/DatabaseProcessCreationParameters.h:
2050         * Shared/ProcessExecutablePath.h:
2051         * Shared/gtk/ProcessExecutablePathGtk.cpp:
2052         (WebKit::executablePathOfDatabaseProcess):
2053         * Shared/wpe/ProcessExecutablePathWPE.cpp:
2054         (WebKit::executablePathOfDatabaseProcess):
2055         * UIProcess/ChildProcessProxy.cpp:
2056         (WebKit::ChildProcessProxy::getLaunchOptions):
2057         * UIProcess/Databases/DatabaseProcessProxy.cpp:
2058         * UIProcess/Databases/DatabaseProcessProxy.h:
2059         * UIProcess/Databases/DatabaseProcessProxy.messages.in:
2060         * UIProcess/Launcher/ProcessLauncher.h:
2061         * UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp:
2062         (WebKit::ProcessLauncher::launchProcess):
2063         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
2064         (WebKit::serviceName):
2065         * UIProcess/Launcher/wpe/ProcessLauncherWPE.cpp:
2066         (WebKit::ProcessLauncher::launchProcess):
2067         * UIProcess/Network/NetworkProcessProxy.cpp:
2068         (WebKit::NetworkProcessProxy::grantSandboxExtensionsToDatabaseProcessForBlobs):
2069         * UIProcess/WebProcessPool.cpp:
2070         (WebKit::WebProcessPool::databaseProcessCrashed):
2071         (WebKit::WebProcessPool::databaseProcessIdentifier):
2072         (WebKit::WebProcessPool::terminateDatabaseProcess):
2073         * UIProcess/WebProcessPool.h:
2074         (WebKit::WebProcessPool::sendToDatabaseProcessRelaunchingIfNecessary):
2075         * UIProcess/WebProcessProxy.cpp:
2076         (WebKit::WebProcessProxy::getDatabaseProcessConnection):
2077         * UIProcess/WebProcessProxy.h:
2078         * UIProcess/WebProcessProxy.messages.in:
2079         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2080         (WebKit::WebsiteDataStore::fetchDataAndApply):
2081         (WebKit::WebsiteDataStore::removeData):
2082         * WebKit2Prefix.h:
2083         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.messages.in:
2084         * WebProcess/Databases/WebToDatabaseProcessConnection.cpp:
2085         * WebProcess/Databases/WebToDatabaseProcessConnection.h:
2086         * WebProcess/WebProcess.cpp:
2087         * WebProcess/WebProcess.h:
2088
2089 2017-07-26  Brady Eidson  <beidson@apple.com>
2090
2091         Add test to verify certain child processes are not launched as a side effect of enabling ResourceLoadStatistics.
2092         https://bugs.webkit.org/show_bug.cgi?id=174851
2093
2094         Reviewed by Chris Dumez.
2095
2096         * UIProcess/API/Cocoa/WKProcessPool.mm:
2097         (-[WKProcessPool _databaseProcessIdentifier]):
2098         (-[WKProcessPool _pluginProcessCount]):
2099         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
2100
2101         * UIProcess/Plugins/PluginProcessManager.h:
2102         (WebKit::PluginProcessManager::pluginProcesses):
2103
2104 2017-07-26  Brian Burg  <bburg@apple.com>
2105
2106         Remove WEB_TIMING feature flag
2107         https://bugs.webkit.org/show_bug.cgi?id=174795
2108
2109         Reviewed by Alex Christensen.
2110
2111         * Configurations/FeatureDefines.xcconfig:
2112         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
2113         (WebKit::NetworkDataTaskSoup::NetworkDataTaskSoup):
2114         (WebKit::NetworkDataTaskSoup::createRequest):
2115         (WebKit::NetworkDataTaskSoup::didSendRequest):
2116         (WebKit::NetworkDataTaskSoup::dispatchDidReceiveResponse):
2117         (WebKit::NetworkDataTaskSoup::dispatchDidCompleteWithError):
2118         (WebKit::NetworkDataTaskSoup::continueHTTPRedirection):
2119         (WebKit::NetworkDataTaskSoup::didGetHeaders):
2120         (WebKit::NetworkDataTaskSoup::didRestart):
2121         * NetworkProcess/soup/NetworkDataTaskSoup.h:
2122
2123 2017-07-26  Brian Burg  <bburg@apple.com>
2124
2125         Use SandboxExtension::HandleArray when sending extensions for file uploads to the web process
2126         https://bugs.webkit.org/show_bug.cgi?id=174828
2127
2128         Reviewed by Tim Horton.
2129
2130         In the previous change I forgot to hoist the HandleArray and message-send out of the
2131         loop, so the code wasn't actually sending fewer messages. That's fixed now.
2132
2133         * UIProcess/WebPageProxy.cpp:
2134         (WebKit::WebPageProxy::didChooseFilesForOpenPanelWithDisplayStringAndIcon):
2135         (WebKit::WebPageProxy::didChooseFilesForOpenPanel):
2136
2137 2017-07-26  Zan Dobersek  <zdobersek@igalia.com>
2138
2139         Unreviewed. Fix a compiler warning that springs up when
2140         building the WPE port with Clang.
2141
2142         * UIProcess/API/wpe/ScrollGestureController.h:
2143         Let ScrollGestureController be a class, and not a struct.
2144         This fits the usual pattern, and also matches the forward
2145         declaration used in WPE's PageClientImpl.h.
2146
2147 2017-07-26  Carlos Garcia Campos  <cgarcia@igalia.com>
2148
2149         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.17.5 release.
2150
2151         * gtk/NEWS: Add release notes for 2.17.5.
2152
2153 2017-07-25  Carlos Garcia Campos  <cgarcia@igalia.com>
2154
2155         Icon loader error on startup
2156         https://bugs.webkit.org/show_bug.cgi?id=174787
2157
2158         Reviewed by Brady Eidson.
2159
2160         Ignore non HTTP favicons in glib API.
2161
2162         * UIProcess/API/glib/WebKitIconLoadingClient.cpp:
2163
2164 2017-07-25  Brady Eidson  <beidson@apple.com>
2165
2166         ResourceLoadStatistics grandfathering happens much too often.
2167         <rdar://problem/32655834> and https://bugs.webkit.org/show_bug.cgi?id=174825
2168
2169         Reviewed by Chris Dumez.
2170
2171         The ResourceLoadStatistics grandfathering procedure happens too often.
2172         - With an empty memory store, even though an empty memory store is a perfectly valid state.
2173         - On each launch, even if grandfathering happened on the last launch - because grandfathering
2174           data would not automatically be saved to disk.
2175         - After clearing all website data, at which point no grandfathering can possibly be relevant
2176           because there is no data to grandfather.
2177
2178         This patch fixes those cases and adds API tests to verify they remain fixed.
2179
2180         * Shared/WebsiteData/WebsiteDataType.h:
2181
2182         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
2183         (+[WKWebsiteDataStore _allWebsiteDataTypesIncludingPrivate]): allWebsiteDataTypes, but even with the private ones.
2184         (-[WKWebsiteDataStore _resourceLoadStatisticsClearInMemoryAndPersistentStore]): If the types being cleared cover all of 
2185           the types that ResourceLoadStatistics care about, don't grandfather afterwards.
2186         (-[WKWebsiteDataStore _resourceLoadStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours:]): Ditto.
2187         (-[WKWebsiteDataStore _setResourceLoadStatisticsTestingCallback:]):
2188         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
2189
2190         * UIProcess/Storage/ResourceLoadStatisticsPersistentStorage.cpp:
2191         (WebKit::ResourceLoadStatisticsPersistentStorage::populateMemoryStoreFromDisk): Don't grandfather if the store read from 
2192           disk is empty (as being empty is perfectly fine), and also log the event of "populated without grandfathering".
2193         * UIProcess/Storage/ResourceLoadStatisticsPersistentStorage.h:
2194
2195         * UIProcess/WebProcessProxy.cpp:
2196         (WebKit::WebProcessProxy::topPrivatelyControlledDomainsWithWebsiteData):
2197
2198         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2199         (WebKit::WebResourceLoadStatisticsStore::monitoredDataTypes):
2200         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
2201         (WebKit::WebResourceLoadStatisticsStore::~WebResourceLoadStatisticsStore):
2202         (WebKit::WebResourceLoadStatisticsStore::removeDataRecords): 
2203         (WebKit::WebResourceLoadStatisticsStore::grandfatherExistingWebsiteData): Schedule a write right away so we don't re-grandfather
2204           on next launch, and also log the grandfathering event.
2205         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent): Takes a ShouldGrandfather flag
2206           to tell whether or not data should be re-grandfathered after the store is cleared.
2207         (WebKit::WebResourceLoadStatisticsStore::logTestingEvent): Log the event to the testing client.
2208         (WebKit::dataTypesToRemove): Deleted.
2209         * UIProcess/WebResourceLoadStatisticsStore.h:
2210
2211         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2212         (WebKit::WebsiteDataStore::removeData):
2213         (WebKit::WebsiteDataStore::setResourceLoadStatisticsEnabled):
2214         (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback): Handles enabling ResourceLoadStatistics both
2215           with and without a testing callback.
2216         * UIProcess/WebsiteData/WebsiteDataStore.h:
2217
2218 2017-07-25  Andy Estes  <aestes@apple.com>
2219
2220         [Apple Pay] Add "carteBancaire" as a supported payment network
2221         https://bugs.webkit.org/show_bug.cgi?id=174841
2222         <rdar://problem/31935596>
2223
2224         Reviewed by Alex Christensen.
2225
2226         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
2227         (WebKit::toSupportedNetwork):
2228
2229 2017-07-25  Brian Burg  <bburg@apple.com>
2230
2231         Use SandboxExtension::HandleArray when sending extensions for file uploads to the web process
2232         https://bugs.webkit.org/show_bug.cgi?id=174828
2233
2234         Reviewed by Tim Horton.
2235
2236         Send all of the sandbox extension handles in a single message, rather than
2237         one message per extension. Update message name and parameter types to match.
2238
2239         * UIProcess/WebPageProxy.cpp:
2240         (WebKit::WebPageProxy::didChooseFilesForOpenPanelWithDisplayStringAndIcon):
2241         (WebKit::WebPageProxy::didChooseFilesForOpenPanel):
2242         * WebProcess/WebPage/WebPage.cpp:
2243         (WebKit::WebPage::extendSandboxForFilesFromOpenPanel):
2244         (WebKit::WebPage::extendSandboxForFileFromOpenPanel): Deleted.
2245         * WebProcess/WebPage/WebPage.h:
2246         * WebProcess/WebPage/WebPage.messages.in:
2247
2248 2017-07-25  Alex Christensen  <achristensen@webkit.org>
2249
2250         Fix API tests after r219871.
2251         https://bugs.webkit.org/show_bug.cgi?id=174807
2252
2253         WebKit2.OpenAndCloseWindowAsync and WebKit2.OpenAsyncWithNil API tests are fixed.
2254
2255         * UIProcess/WebPageProxy.cpp:
2256         (WebKit::WebPageProxy::createNewPage):
2257         createNewPageAsync or createNewPage should be called, not both.
2258
2259 2017-07-25  Said Abou-Hallawa  <sabouhallawa@apple.com>
2260
2261         Async image decoding for large images should be disabled after the first time a tile is painted
2262         https://bugs.webkit.org/show_bug.cgi?id=174451
2263         <rdar://problem/31246421>
2264
2265         Reviewed by Simon Fraser.
2266
2267         * Shared/mac/RemoteLayerBackingStore.mm:
2268         (WebKit::RemoteLayerBackingStore::drawInContext):
2269         * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:
2270         (WebKit::imageForRect):
2271         * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
2272         (WebKit::InjectedBundleRangeHandle::renderedImage):
2273         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
2274         (WebKit::CompositingCoordinator::paintContents):
2275         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
2276
2277 2017-07-25  Brian Burg  <bburg@apple.com>
2278
2279         Web Automation: add support for uploading files
2280         https://bugs.webkit.org/show_bug.cgi?id=174797
2281         <rdar://problem/28485063>
2282
2283         Reviewed by Joseph Pecoraro.
2284
2285         The general strategy is to have automation clients set the list of files they want
2286         to select ahead of time. Then, the client simulates a click on the <input type="file"> element.
2287         When that causes WebPageProxy to ask the UI delegate to runOpenPanel, it instead
2288         gives WebAutomationSession a chance to select files if the page is under control of
2289         automation. WebAutomationSession validates its file list and selects the files if valid.
2290
2291         * CMakeLists.txt: Add frontend dispatcher files.
2292         * DerivedSources.make:
2293         Add frontend dispatcher code generator scripts as dependencies of the generated code.
2294         Add generated frontend dispatcher files to the list of output files.
2295
2296         * UIProcess/Automation/Automation.json:
2297         Add a command to set the canned list of files that should be selected when prompted.
2298         If no files are selected, then the effect is as if the user had clicked "cancel" in
2299         the file chooser dialog.
2300
2301         Add an event to signal to the WebDriver service that the file selection request has
2302         been either fulfilled or cancelled. This event is necessary because otherwise remotes
2303         cannot distinguish whether selecting the files failed for some reason, or if the
2304         UIProcess has not yet selected the files and sent them to the web content process.
2305         In either case, the input element's "files" attribute would return an empty FileList.
2306
2307         * UIProcess/Automation/WebAutomationSession.h:
2308         * UIProcess/Automation/WebAutomationSession.cpp:
2309         (WebKit::WebAutomationSession::WebAutomationSession):
2310         Add the frontend dispatcher for Automation domain. This is named m_domainNotifier since
2311         m_domainDispatcher is already being used for the backend command dispatcher.
2312
2313         (WebKit::WebAutomationSession::handleRunOpenPanel):
2314         Validate that the files-to-select list has valid entries and select the files if so.
2315         If anything goes wrong, pretend to cancel out of the file chooser. Either way, notify the
2316         frontend with an event that the file chooser was dismissed due to selecting files or cancelling.
2317         Automation protocol clients may implement additional strategies to further restrict
2318         the conditions upon which local files can be uploaded.
2319
2320         (WebKit::WebAutomationSession::setFilesToSelectForFileUpload): Added.
2321         Store the list of files as a vector of strings. The file list is always replaced.
2322
2323         * UIProcess/WebPageProxy.cpp:
2324         (WebKit::WebPageProxy::runOpenPanel):
2325         If the page is under automation, delegating the runOpenPanel is likely to hang
2326         because WebDriver cannot interact directly with the file chooser dialog. Instead,
2327         give WebAutomationSession a chance to select files and don't tell the delegate.
2328
2329         * WebKit.xcodeproj/project.pbxproj:
2330         Add frontend dispatcher files to "Derived Sources" group.
2331
2332 2017-07-25  Alex Christensen  <achristensen@webkit.org>
2333
2334         Modernize NavigationAction code
2335         https://bugs.webkit.org/show_bug.cgi?id=174807
2336
2337         Reviewed by Darin Adler.
2338
2339         Mostly just use more move semantics.
2340
2341         * Platform/IPC/HandleMessage.h:
2342         (IPC::callMemberFunctionImpl):
2343         * Shared/API/APIURLRequest.h:
2344         * Shared/NavigationActionData.h:
2345         * UIProcess/API/APINavigation.cpp:
2346         (API::Navigation::Navigation):
2347         * UIProcess/API/APINavigation.h:
2348         (API::Navigation::create):
2349         * UIProcess/API/APINavigationAction.h:
2350         * UIProcess/API/APINavigationClient.h:
2351         (API::NavigationClient::decidePolicyForNavigationAction):
2352         * UIProcess/API/APIPolicyClient.h:
2353         * UIProcess/API/APIUIClient.h:
2354         (API::UIClient::createNewPage):
2355         (API::UIClient::createNewPageAsync):
2356         (API::UIClient::canCreateNewPageAsync):
2357         * UIProcess/API/C/WKPage.cpp:
2358         (WKPageLoadURLRequest):
2359         (WKPageLoadURLRequestWithUserData):
2360         (WKPageSetPageUIClient):
2361         (WKPageSetPageNavigationClient):
2362         * UIProcess/Cocoa/NavigationState.h:
2363         * UIProcess/Cocoa/NavigationState.mm:
2364         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
2365         * UIProcess/Cocoa/UIDelegate.h:
2366         * UIProcess/Cocoa/UIDelegate.mm:
2367         (WebKit::UIDelegate::UIClient::createNewPageCommon):
2368         (WebKit::UIDelegate::UIClient::createNewPage):
2369         (WebKit::UIDelegate::UIClient::canCreateNewPageAsync):
2370         (WebKit::UIDelegate::UIClient::createNewPageAsync):
2371         * UIProcess/WebInspectorProxy.cpp:
2372         (WebKit::decidePolicyForNavigationAction):
2373         * UIProcess/WebNavigationState.cpp:
2374         (WebKit::WebNavigationState::createLoadRequestNavigation):
2375         * UIProcess/WebNavigationState.h:
2376         * UIProcess/WebPageProxy.cpp:
2377         (WebKit::WebPageProxy::loadRequest):
2378         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2379         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
2380         (WebKit::WebPageProxy::createNewPage):
2381         * UIProcess/WebPageProxy.h:
2382
2383 2017-07-25  Carlos Garcia Campos  <cgarcia@igalia.com>
2384
2385         REGRESSION(r218629): [GTK] ASSERTION FAILED: m_eglDisplay == EGL_NO_DISPLAY in WebCore::PlatformDisplay::~PlatformDisplay
2386         https://bugs.webkit.org/show_bug.cgi?id=174789
2387
2388         Reviewed by Žan Doberšek.
2389
2390         Before r218629, the wayland nested compositor display was a singleton created on demand by
2391         AcceleratedSurfaceWayland, but now it's created unconditionally on web process creation when a valid display
2392         name is received from the UI process. The side effect of this is that now the shared display is created after
2393         the nested compositor display that is not a singleton anymore. The atexit used by PlatformDisplay to shutdown
2394         egl display assumes that it will be registered by the shared display. Since we switched to on demand AC mode,
2395         the shared display is only used in the web process when entering AC mode, that's why it only crashes when we
2396         have entered AC at least once. We just need to ensure that the shared display is created before the nested
2397         compositor display.
2398
2399         * WebProcess/gtk/WaylandCompositorDisplay.cpp:
2400         (WebKit::WaylandCompositorDisplay::create): Check we are under wayland before creating the WaylandCompositorDisplay.
2401
2402 2017-07-24  Michael Catanzaro  <mcatanzaro@igalia.com>
2403
2404         [GTK] ASSERTION FAILED: client in WebKit::IconDatabase::setClient
2405         https://bugs.webkit.org/show_bug.cgi?id=174788
2406
2407         Reviewed by Carlos Garcia Campos.
2408
2409         IconDatabase ensures that setClient is never called with nullptr, but WebKitFaviconDatabase
2410         does exactly that. First, ensure it's safe to unset the client. Next, we can either remove
2411         the assertions from setClient or else automatically unset the client in IconDatabase::close.
2412         I opted to do both.
2413
2414         * UIProcess/API/glib/IconDatabase.cpp:
2415         (WebKit::IconDatabase::close):
2416         (WebKit::IconDatabase::setIconDataForIconURL):
2417         (WebKit::IconDatabase::setIconURLForPageURL):
2418         * UIProcess/API/glib/WebKitFaviconDatabase.cpp:
2419         (_WebKitFaviconDatabasePrivate::~_WebKitFaviconDatabasePrivate): Deleted.
2420         (webkitFaviconDatabaseDispose): Deleted.
2421
2422 2017-07-24  Michael Catanzaro  <mcatanzaro@igalia.com>
2423
2424         [GTK][WPE] Remove useless conditional in IconDatabase::setIconDataForIconURL
2425         https://bugs.webkit.org/show_bug.cgi?id=174792
2426
2427         Reviewed by Carlos Garcia Campos.
2428
2429         We have in IconDatabase::setIconDataForIconURL some code in a conditional to check if it's
2430         not being executed on the icon sync thread. But at the top of the function is an assertion
2431         to ensure the code is never executed on the icon sync thread. The condition is therefore
2432         useless and the code should be executed unconditionally.
2433
2434         * UIProcess/API/glib/IconDatabase.cpp:
2435         (WebKit::IconDatabase::setIconDataForIconURL):
2436
2437 2017-07-24  Carlos Garcia Campos  <cgarcia@igalia.com>
2438
2439         [GTK] Icon database error and crash
2440         https://bugs.webkit.org/show_bug.cgi?id=174760
2441
2442         Reviewed by Michael Catanzaro.
2443
2444         The crash is a debug ASSERT that happens when the IconRecord image is created in one thread and destroyed in
2445         another one. IconDatabase creates and destroys IconRecord objects in both database and main thread. The
2446         IconRecord is destroyed when the icon is no longer retained, and we only release icons when we fail to get the
2447         image data (including pages that don't have a favicon). We can prevent this crash from happening if we ensure we
2448         never create an Image for an IconRecord when the given image data is nullptr.
2449
2450         * UIProcess/API/glib/IconDatabase.cpp:
2451         (WebKit::IconDatabase::IconRecord::setImageData):
2452
2453 2017-07-24  Chris Dumez  <cdumez@apple.com>
2454
2455         [WK2][Cocoa] Allow overriding the ITP data removal internal using a default
2456         https://bugs.webkit.org/show_bug.cgi?id=174802
2457         <rdar://problem/33497898>
2458
2459         Reviewed by Sam Weinig.
2460
2461         Allow overriding the ITP data removal internal using a default to facilitate testing.
2462         Can be used like so:
2463         defaults write -g ResourceLoadStatisticsMinimumTimeBetweenDataRecordsRemoval 60
2464
2465         Will cause us to write every 60 seconds instead of 3600.
2466
2467         * Shared/WebPreferencesDefinitions.h:
2468         * UIProcess/Cocoa/WebResourceLoadStatisticsStoreCocoa.mm:
2469         (WebKit::WebResourceLoadStatisticsStore::registerUserDefaultsIfNeeded):
2470
2471 2017-07-24  Simon Fraser  <simon.fraser@apple.com>
2472
2473         [iOS WK2] Crash under PageOverlayController::uninstallPageOverlay when doing multiple finds
2474         https://bugs.webkit.org/show_bug.cgi?id=174806
2475         rdar://problem/33501664
2476
2477         Reviewed by Tim Horton.
2478         
2479         Calling TextIndicator::createWithSelectionInFrame can trigger layout via VisibleSelection code,
2480         which can re-enter FindController::updateFindIndicator which has by now removed m_findIndicatorOverlay
2481         from pageOverlayController's map, but not deleted it. The second call to uninstallPageOverlay()
2482         thus crashes at m_overlayGraphicsLayers.take(&overlay)->removeFromParent().
2483         
2484         Fix by nulling out m_findIndicatorOverlay as soon as we uninstall it.
2485
2486         * WebProcess/WebPage/ios/FindControllerIOS.mm:
2487         (WebKit::FindController::updateFindIndicator):
2488
2489 2017-07-24  Chris Dumez  <cdumez@apple.com>
2490
2491         Fix lifetime management issue in ResourceLoadStatisticsPersistentStorage::scheduleOrWriteMemoryStore()
2492         https://bugs.webkit.org/show_bug.cgi?id=174790
2493
2494         Reviewed by Brady Eidson.
2495
2496         Fix lifetime management issue in ResourceLoadStatisticsPersistentStorage::scheduleOrWriteMemoryStore().
2497         WorkQueue::dispatchAfter() keeps the WorkQueue alive because its implementation keeps a strong ref to
2498         |this|. As a result, the lambda passed to dispatchAfter(), which calls writeMemoryStoreToDisk(), can
2499         get executed after the store is gone.
2500
2501         To address the issue, we now use a RunLoop::Timer to schedule the write, instead of a
2502         WorkQueue::dispatchAfter() call. This way, we are guaranteed that the callback will not get called
2503         after the store has been destroyed.
2504
2505         * UIProcess/Storage/ResourceLoadStatisticsPersistentStorage.cpp:
2506         (WebKit::ResourceLoadStatisticsPersistentStorage::ResourceLoadStatisticsPersistentStorage):
2507         (WebKit::ResourceLoadStatisticsPersistentStorage::asyncWriteTimerFired):
2508         (WebKit::ResourceLoadStatisticsPersistentStorage::scheduleOrWriteMemoryStore):
2509         (WebKit::ResourceLoadStatisticsPersistentStorage::finishAllPendingWorkSynchronously):
2510         (WebKit::ResourceLoadStatisticsPersistentStorage::ref):
2511         (WebKit::ResourceLoadStatisticsPersistentStorage::deref):
2512         * UIProcess/Storage/ResourceLoadStatisticsPersistentStorage.h:
2513
2514 2017-07-24  Chris Dumez  <cdumez@apple.com>
2515
2516         Unreviewed, rolling out r219828.
2517
2518         Causes debug assertions to be hit on iOS
2519
2520         Reverted changeset:
2521
2522         "Fix lifetime management issue in
2523         ResourceLoadStatisticsPersistentStorage::scheduleOrWriteMemoryStore()"
2524         https://bugs.webkit.org/show_bug.cgi?id=174790
2525         http://trac.webkit.org/changeset/219828
2526
2527 2017-07-24  Michael Catanzaro  <mcatanzaro@igalia.com>
2528
2529         [GTK][WPE] Stop using AutodrainedPool in IconDatabase
2530         https://bugs.webkit.org/show_bug.cgi?id=174791
2531
2532         Reviewed by Alex Christensen.
2533
2534         AutodrainedPool seems to be some NS garbage collection thing that has no implementation on
2535         other platforms. Now that IconDatabase is used only by GTK and WPE, we can stop using it.
2536
2537         * UIProcess/API/glib/IconDatabase.cpp:
2538         (WebKit::IconDatabase::setIconDataForIconURL):
2539         (WebKit::IconDatabase::setIconURLForPageURL):
2540         (WebKit::IconDatabase::iconDatabaseSyncThread):
2541         (WebKit::IconDatabase::performURLImport):
2542         (WebKit::IconDatabase::readFromDatabase):
2543
2544 2017-07-24  Chris Dumez  <cdumez@apple.com>
2545
2546         Fix lifetime management issue in ResourceLoadStatisticsPersistentStorage::scheduleOrWriteMemoryStore()
2547         https://bugs.webkit.org/show_bug.cgi?id=174790
2548
2549         Reviewed by Brady Eidson.
2550
2551         Fix lifetime management issue in ResourceLoadStatisticsPersistentStorage::scheduleOrWriteMemoryStore().
2552         WorkQueue::dispatchAfter() keeps the WorkQueue alive because its implementation keeps a strong ref to
2553         |this|. As a result, the lambda passed to dispatchAfter(), which calls writeMemoryStoreToDisk(), can
2554         get executed after the store is gone.
2555
2556         * UIProcess/Storage/ResourceLoadStatisticsPersistentStorage.cpp:
2557         (WebKit::ResourceLoadStatisticsPersistentStorage::ResourceLoadStatisticsPersistentStorage):
2558         (WebKit::ResourceLoadStatisticsPersistentStorage::scheduleOrWriteMemoryStore):
2559         * UIProcess/Storage/ResourceLoadStatisticsPersistentStorage.h:
2560         (WebKit::ResourceLoadStatisticsPersistentStorage::createWeakPtr):
2561
2562 2017-07-23  Carlos Garcia Campos  <cgarcia@igalia.com>
2563
2564         Unreviewed. REGRESSION(r219713): [GTK][WPE] Fix default favicon database patch.
2565
2566         When nullptr is passed to webkit_web_context_set_favicon_database_directory() the default database directory was
2567         taken from WebProcessPool::platformDefaultIconDatabasePath(), that has been removed in r219713 without properly
2568         replacing it, now it uses an empty string. This causes that the current directory is used to create the favicon
2569         database.
2570
2571         * UIProcess/API/glib/WebKitWebContext.cpp:
2572         (webkit_web_context_set_favicon_database_directory): Use the default icon database directory instead of an empty
2573         string when nullptr is passed.
2574
2575 2017-07-23  Wenson Hsieh  <wenson_hsieh@apple.com>
2576
2577         [iOS WK2] 5 DataInteractionTests are failing: observed selection rects after dropping don't match expected values
2578         https://bugs.webkit.org/show_bug.cgi?id=174769
2579         <rdar://problem/33478864>
2580
2581         Reviewed by Tim Horton.
2582
2583         Fixes several API tests in the DataInteractionTests suite. See Source/WebCore/ChangeLog for more details.
2584
2585         * WebProcess/WebPage/WebPage.cpp:
2586         (WebKit::WebPage::performDragControllerAction):
2587
2588 2017-07-20  Carlos Garcia Campos  <cgarcia@igalia.com>
2589
2590         WebDriver: implement page load timeout
2591         https://bugs.webkit.org/show_bug.cgi?id=174672
2592
2593         Reviewed by Brian Burg.
2594
2595         Always start a timer when waiting for a navigation to complete. When the timer fires, pending callbacks for
2596         navigations are removed and invoked with a timeout error. If navigation completes before the timer is fired,
2597         then the timer is stopped. All navigation commands now receive the page load strategy and timeout as optional
2598         parameters, when not provided the default timeout (300 seconds) is used.
2599
2600         * UIProcess/Automation/Automation.json:
2601         * UIProcess/Automation/WebAutomationSession.cpp:
2602         (WebKit::WebAutomationSession::WebAutomationSession):
2603         (WebKit::WebAutomationSession::waitForNavigationToComplete):
2604         (WebKit::WebAutomationSession::waitForNavigationToCompleteOnPage):
2605         (WebKit::WebAutomationSession::waitForNavigationToCompleteOnFrame):
2606         (WebKit::WebAutomationSession::loadTimerFired):
2607         (WebKit::WebAutomationSession::navigateBrowsingContext):
2608         (WebKit::WebAutomationSession::goBackInBrowsingContext):
2609         (WebKit::WebAutomationSession::goForwardInBrowsingContext):
2610         (WebKit::WebAutomationSession::reloadBrowsingContext):
2611         (WebKit::WebAutomationSession::navigationOccurredForFrame):
2612         * UIProcess/Automation/WebAutomationSession.h:
2613
2614 2017-07-23  Takuro Ashie  <ashie@clear-code.com>
2615
2616         [GTK] Correct a typo in the reference manual of WebKitWebInspector
2617         https://bugs.webkit.org/show_bug.cgi?id=174767
2618
2619         Reviewed by Michael Catanzaro.
2620
2621         * UIProcess/API/gtk/WebKitWebInspector.cpp:
2622
2623 2017-07-23  Chris Dumez  <cdumez@apple.com>
2624
2625         Drop ExceptionCodeDescription class
2626         https://bugs.webkit.org/show_bug.cgi?id=174757
2627
2628         Reviewed by Darin Adler.
2629
2630         Update GTK bindings to use new API on DOMException instead of
2631         ExceptionCodeDescription.
2632
2633         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMAttr.cpp:
2634         (webkit_dom_attr_dispatch_event):
2635         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMBlob.cpp:
2636         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCDATASection.cpp:
2637         (webkit_dom_cdata_section_dispatch_event):
2638         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSRule.cpp:
2639         (webkit_dom_css_rule_set_css_text):
2640         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSRuleList.cpp:
2641         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSStyleDeclaration.cpp:
2642         (webkit_dom_css_style_declaration_set_property):
2643         (webkit_dom_css_style_declaration_set_css_text):
2644         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSStyleSheet.cpp:
2645         (webkit_dom_css_style_sheet_insert_rule):
2646         (webkit_dom_css_style_sheet_delete_rule):
2647         (webkit_dom_css_style_sheet_add_rule):
2648         (webkit_dom_css_style_sheet_remove_rule):
2649         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSValue.cpp:
2650         (webkit_dom_css_value_set_css_text):
2651         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCharacterData.cpp:
2652         (webkit_dom_character_data_dispatch_event):
2653         (webkit_dom_character_data_insert_data):
2654         (webkit_dom_character_data_delete_data):
2655         (webkit_dom_character_data_replace_data):
2656         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRect.cpp:
2657         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRectList.cpp:
2658         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMComment.cpp:
2659         (webkit_dom_comment_dispatch_event):
2660         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMImplementation.cpp:
2661         (webkit_dom_dom_implementation_create_document_type):
2662         (webkit_dom_dom_implementation_create_document):
2663         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMSelection.cpp:
2664         (webkit_dom_dom_selection_collapse_to_end):
2665         (webkit_dom_dom_selection_collapse_to_start):
2666         (webkit_dom_dom_selection_extend):
2667         (webkit_dom_dom_selection_get_range_at):
2668         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMTokenList.cpp:
2669         (webkit_dom_dom_token_list_add):
2670         (webkit_dom_dom_token_list_remove):
2671         (webkit_dom_dom_token_list_toggle):
2672         (webkit_dom_dom_token_list_replace):
2673         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMWindow.cpp:
2674         (webkit_dom_dom_window_dispatch_event):
2675         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDeprecated.cpp:
2676         (webkit_dom_node_set_prefix):
2677         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocument.cpp:
2678         (webkit_dom_document_dispatch_event):
2679         (webkit_dom_document_create_element):
2680         (webkit_dom_document_create_cdata_section):
2681         (webkit_dom_document_create_processing_instruction):
2682         (webkit_dom_document_create_attribute):
2683         (webkit_dom_document_import_node):
2684         (webkit_dom_document_create_element_ns):
2685         (webkit_dom_document_create_attribute_ns):
2686         (webkit_dom_document_adopt_node):
2687         (webkit_dom_document_create_event):
2688         (webkit_dom_document_create_expression):
2689         (webkit_dom_document_evaluate):
2690         (webkit_dom_document_query_selector):
2691         (webkit_dom_document_query_selector_all):
2692         (webkit_dom_document_set_xml_version):
2693         (webkit_dom_document_set_cookie):
2694         (webkit_dom_document_set_body):
2695         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentFragment.cpp:
2696         (webkit_dom_document_fragment_dispatch_event):
2697         (webkit_dom_document_fragment_query_selector):
2698         (webkit_dom_document_fragment_query_selector_all):
2699         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentType.cpp:
2700         (webkit_dom_document_type_dispatch_event):
2701         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMElement.cpp:
2702         (webkit_dom_element_dispatch_event):
2703         (webkit_dom_element_set_attribute):
2704         (webkit_dom_element_set_attribute_node):
2705         (webkit_dom_element_remove_attribute_node):
2706         (webkit_dom_element_set_attribute_ns):
2707         (webkit_dom_element_set_attribute_node_ns):
2708         (webkit_dom_element_matches):
2709         (webkit_dom_element_closest):
2710         (webkit_dom_element_insert_adjacent_element):
2711         (webkit_dom_element_insert_adjacent_html):
2712         (webkit_dom_element_insert_adjacent_text):
2713         (webkit_dom_element_remove):
2714         (webkit_dom_element_query_selector):
2715         (webkit_dom_element_query_selector_all):
2716         (webkit_dom_element_set_inner_html):
2717         (webkit_dom_element_set_outer_html):
2718         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMEvent.cpp:
2719         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMFile.cpp:
2720         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMFileList.cpp:
2721         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLAnchorElement.cpp:
2722         (webkit_dom_html_anchor_element_dispatch_event):
2723         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLAppletElement.cpp:
2724         (webkit_dom_html_applet_element_dispatch_event):
2725         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLAreaElement.cpp:
2726         (webkit_dom_html_area_element_dispatch_event):
2727         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLBRElement.cpp:
2728         (webkit_dom_html_br_element_dispatch_event):
2729         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLBaseElement.cpp:
2730         (webkit_dom_html_base_element_dispatch_event):
2731         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLBodyElement.cpp:
2732         (webkit_dom_html_body_element_dispatch_event):
2733         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLButtonElement.cpp:
2734         (webkit_dom_html_button_element_dispatch_event):
2735         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLCanvasElement.cpp:
2736         (webkit_dom_html_canvas_element_dispatch_event):
2737         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLCollection.cpp:
2738         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLDListElement.cpp:
2739         (webkit_dom_html_d_list_element_dispatch_event):
2740         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLDirectoryElement.cpp:
2741         (webkit_dom_html_directory_element_dispatch_event):
2742         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLDivElement.cpp:
2743         (webkit_dom_html_div_element_dispatch_event):
2744         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLDocument.cpp:
2745         (webkit_dom_html_document_dispatch_event):
2746         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLElement.cpp:
2747         (webkit_dom_html_element_dispatch_event):
2748         (webkit_dom_html_element_set_inner_text):
2749         (webkit_dom_html_element_set_outer_text):
2750         (webkit_dom_html_element_set_content_editable):
2751         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLEmbedElement.cpp:
2752         (webkit_dom_html_embed_element_dispatch_event):
2753         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLFieldSetElement.cpp:
2754         (webkit_dom_html_field_set_element_dispatch_event):
2755         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLFontElement.cpp:
2756         (webkit_dom_html_font_element_dispatch_event):
2757         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLFormElement.cpp:
2758         (webkit_dom_html_form_element_dispatch_event):
2759         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLFrameElement.cpp:
2760         (webkit_dom_html_frame_element_dispatch_event):
2761         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLFrameSetElement.cpp:
2762         (webkit_dom_html_frame_set_element_dispatch_event):
2763         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLHRElement.cpp:
2764         (webkit_dom_html_hr_element_dispatch_event):
2765         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLHeadElement.cpp:
2766         (webkit_dom_html_head_element_dispatch_event):
2767         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLHeadingElement.cpp:
2768         (webkit_dom_html_heading_element_dispatch_event):
2769         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLHtmlElement.cpp:
2770         (webkit_dom_html_html_element_dispatch_event):
2771         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLIFrameElement.cpp:
2772         (webkit_dom_html_iframe_element_dispatch_event):
2773         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLImageElement.cpp:
2774         (webkit_dom_html_image_element_dispatch_event):
2775         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLInputElement.cpp:
2776         (webkit_dom_html_input_element_dispatch_event):
2777         (webkit_dom_html_input_element_set_max_length):
2778         (webkit_dom_html_input_element_set_size):
2779         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLLIElement.cpp:
2780         (webkit_dom_html_li_element_dispatch_event):
2781         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLLabelElement.cpp:
2782         (webkit_dom_html_label_element_dispatch_event):
2783         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLLegendElement.cpp:
2784         (webkit_dom_html_legend_element_dispatch_event):
2785         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLLinkElement.cpp:
2786         (webkit_dom_html_link_element_dispatch_event):
2787         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLMapElement.cpp:
2788         (webkit_dom_html_map_element_dispatch_event):
2789         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLMarqueeElement.cpp:
2790         (webkit_dom_html_marquee_element_dispatch_event):
2791         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLMenuElement.cpp:
2792         (webkit_dom_html_menu_element_dispatch_event):
2793         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLMetaElement.cpp:
2794         (webkit_dom_html_meta_element_dispatch_event):
2795         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLModElement.cpp:
2796         (webkit_dom_html_mod_element_dispatch_event):
2797         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLOListElement.cpp:
2798         (webkit_dom_html_o_list_element_dispatch_event):
2799         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLObjectElement.cpp:
2800         (webkit_dom_html_object_element_dispatch_event):
2801         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLOptGroupElement.cpp:
2802         (webkit_dom_html_opt_group_element_dispatch_event):
2803         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLOptionElement.cpp:
2804         (webkit_dom_html_option_element_dispatch_event):
2805         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLOptionsCollection.cpp:
2806         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLParagraphElement.cpp:
2807         (webkit_dom_html_paragraph_element_dispatch_event):
2808         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLParamElement.cpp:
2809         (webkit_dom_html_param_element_dispatch_event):
2810         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLPreElement.cpp:
2811         (webkit_dom_html_pre_element_dispatch_event):
2812         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLQuoteElement.cpp:
2813         (webkit_dom_html_quote_element_dispatch_event):
2814         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLScriptElement.cpp:
2815         (webkit_dom_html_script_element_dispatch_event):
2816         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLSelectElement.cpp:
2817         (webkit_dom_html_select_element_dispatch_event):
2818         (webkit_dom_html_select_element_add):
2819         (webkit_dom_html_select_element_set_length):
2820         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLStyleElement.cpp:
2821         (webkit_dom_html_style_element_dispatch_event):
2822         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableCaptionElement.cpp:
2823         (webkit_dom_html_table_caption_element_dispatch_event):
2824         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableCellElement.cpp:
2825         (webkit_dom_html_table_cell_element_dispatch_event):
2826         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableColElement.cpp:
2827         (webkit_dom_html_table_col_element_dispatch_event):
2828         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableElement.cpp:
2829         (webkit_dom_html_table_element_dispatch_event):
2830         (webkit_dom_html_table_element_insert_row):
2831         (webkit_dom_html_table_element_delete_row):
2832         (webkit_dom_html_table_element_set_caption):
2833         (webkit_dom_html_table_element_set_t_head):
2834         (webkit_dom_html_table_element_set_t_foot):
2835         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableRowElement.cpp:
2836         (webkit_dom_html_table_row_element_dispatch_event):
2837         (webkit_dom_html_table_row_element_insert_cell):
2838         (webkit_dom_html_table_row_element_delete_cell):
2839         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableSectionElement.cpp:
2840         (webkit_dom_html_table_section_element_dispatch_event):
2841         (webkit_dom_html_table_section_element_insert_row):
2842         (webkit_dom_html_table_section_element_delete_row):
2843         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTextAreaElement.cpp:
2844         (webkit_dom_html_text_area_element_dispatch_event):
2845         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTitleElement.cpp:
2846         (webkit_dom_html_title_element_dispatch_event):
2847         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLUListElement.cpp:
2848         (webkit_dom_html_u_list_element_dispatch_event):
2849         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMKeyboardEvent.cpp:
2850         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMMediaList.cpp:
2851         (webkit_dom_media_list_delete_medium):
2852         (webkit_dom_media_list_append_medium):
2853         (webkit_dom_media_list_set_media_text):
2854         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMMouseEvent.cpp:
2855         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMNamedNodeMap.cpp:
2856         (webkit_dom_named_node_map_set_named_item):
2857         (webkit_dom_named_node_map_remove_named_item):
2858         (webkit_dom_named_node_map_remove_named_item_ns):
2859         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMNode.cpp:
2860         (webkit_dom_node_dispatch_event):
2861         (webkit_dom_node_insert_before):
2862         (webkit_dom_node_replace_child):
2863         (webkit_dom_node_remove_child):
2864         (webkit_dom_node_append_child):
2865         (webkit_dom_node_clone_node_with_error):
2866         (webkit_dom_node_set_node_value):
2867         (webkit_dom_node_set_text_content):
2868         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMNodeIterator.cpp:
2869         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMNodeList.cpp:
2870         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMProcessingInstruction.cpp:
2871         (webkit_dom_processing_instruction_dispatch_event):
2872         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMRange.cpp:
2873         (webkit_dom_range_set_start):
2874         (webkit_dom_range_set_end):
2875         (webkit_dom_range_set_start_before):
2876         (webkit_dom_range_set_start_after):
2877         (webkit_dom_range_set_end_before):
2878         (webkit_dom_range_set_end_after):
2879         (webkit_dom_range_select_node):
2880         (webkit_dom_range_select_node_contents):
2881         (webkit_dom_range_compare_boundary_points):
2882         (webkit_dom_range_delete_contents):
2883         (webkit_dom_range_extract_contents):
2884         (webkit_dom_range_clone_contents):
2885         (webkit_dom_range_insert_node):
2886         (webkit_dom_range_surround_contents):
2887         (webkit_dom_range_create_contextual_fragment):
2888         (webkit_dom_range_compare_node):
2889         (webkit_dom_range_intersects_node):
2890         (webkit_dom_range_compare_point):
2891         (webkit_dom_range_is_point_in_range):
2892         (webkit_dom_range_expand):
2893         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMStyleSheet.cpp:
2894         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMStyleSheetList.cpp:
2895         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMText.cpp:
2896         (webkit_dom_text_dispatch_event):
2897         (webkit_dom_text_split_text):
2898         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMTreeWalker.cpp:
2899         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMUIEvent.cpp:
2900         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMWheelEvent.cpp:
2901         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMXPathExpression.cpp:
2902         (webkit_dom_xpath_expression_evaluate):
2903         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMXPathResult.cpp:
2904         (webkit_dom_xpath_result_iterate_next):
2905         (webkit_dom_xpath_result_snapshot_item):
2906         (webkit_dom_xpath_result_get_number_value):
2907         (webkit_dom_xpath_result_get_boolean_value):
2908         (webkit_dom_xpath_result_get_single_node_value):
2909         (webkit_dom_xpath_result_get_snapshot_length):
2910
2911 2017-07-22  Wenson Hsieh  <wenson_hsieh@apple.com>
2912
2913         [iOS WK2] Remove _WKDraggableElementInfo and fold PositionInformationTests into WKRequestActivatedElementInfo
2914         https://bugs.webkit.org/show_bug.cgi?id=174758
2915
2916         Reviewed by Dan Bernstein.
2917
2918         _WKDraggableElementInfo is no longer used in WebKit, so it should be removed. However, some of the scenarios
2919         in PositionInformationTests that depend on _WKDraggableElementInfo are still useful to exercise: namely,
2920         performing both synchronous and asynchronous position information updates while an async position information
2921         update is in flight. This patch refactors these unit tests into 2 new unit tests in the existing
2922         WKRequestActivatedElementInfo test suite.
2923
2924         * UIProcess/API/Cocoa/WKWebView.mm:
2925         (-[WKWebView _draggableElementAtPosition:]): Deleted.
2926         (-[WKWebView _requestDraggableElementAtPosition:completionBlock:]): Deleted.
2927         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2928         * UIProcess/API/Cocoa/_WKDraggableElementInfo.h: Removed.
2929         * UIProcess/API/Cocoa/_WKDraggableElementInfo.mm: Removed.
2930         * UIProcess/API/Cocoa/_WKDraggableElementInfoInternal.h: Removed.
2931         * UIProcess/ios/WKContentViewInteraction.mm:
2932         * WebKit.xcodeproj/project.pbxproj:
2933
2934 2017-07-22  Wenson Hsieh  <wenson_hsieh@apple.com>
2935
2936         [Mac WK2] Fix null dereference in asynchronous NSTextInputClient methods when deallocating a WKWebView
2937         https://bugs.webkit.org/show_bug.cgi?id=174751
2938         <rdar://problem/33132405>
2939
2940         Reviewed by Darin Adler.
2941
2942         Tweaks -[WKWebView dealloc] to close the WebPageProxy at an earlier time, prior to destroying the WebViewImpl.
2943         This fixes a NSTextInputClient crash in WKWebView when exercising the following scenario:
2944
2945         (1) Suppose that NSTextInputContext invokes an asynchronous text input query on WKWebView immediately before
2946         WKWebView is deallocated, such that WebPageProxy's CallbackMap contains an NSTextInputContext callback at the
2947         time that -[WKWebView dealloc] is called. Additionally, suppose that this callback from NSTextInputContext
2948         invokes additional NSTextInputClient methods on the WKWebView that involve plumbing through to the WebViewImpl
2949         (which is stored as _impl on the WKWebView).
2950
2951         (2) Observe that when calling [super dealloc] in [WKWebView dealloc], we will destroy the WebViewImpl as a
2952         result of setting our unique pointer to _impl to be null. In ~WebViewImpl, we invoke WebPageProxy::close, which
2953         in turn invokes WebPageProxy::resetState.
2954
2955         (3) WebPageProxy::resetState then calls m_callbacks.invalidate(error), which triggers all pending callbacks.
2956         This invokes the block described in (1), which causes us to try and call back into WKWebView, invoking
2957         NSTextInputClient methods. Without the fix in this patch, these methods currently assume that _impl is nonnull,
2958         even though we've already cleared out the pointer in (2), so we segfault with a null dereference.
2959
2960         After this patch, we close the _page at an earlier time, such that the state is reset before the WebViewImpl
2961         (and corresponding _impl unique_ptr in WKWebView) is torn down. This ensures that _impl will not be null for
2962         callbacks invoked after beginning to deallocate the WKWebView.
2963
2964         Forcing this scenario in a custom AppKit root that triggers async NSTextInputClient methods immediately when a
2965         WKWebView is being deallocated produces a crash with the same stack trace as what we observe in the radar, but
2966         there are no known steps to actually reproduce this crash in shipping software.
2967
2968         * UIProcess/API/Cocoa/WKWebView.mm:
2969         (-[WKWebView dealloc]):
2970
2971 2017-07-22  Chris Dumez  <cdumez@apple.com>
2972
2973         REGRESSION(r204565): WKObject is broken
2974         https://bugs.webkit.org/show_bug.cgi?id=174736
2975         <rdar://problem/33246169>
2976
2977         Reviewed by Dan Bernstein.
2978
2979         Revert r204565 as making WKObject a root class caused unexpected crashes.
2980         Instead, we now have WKObject inherit from NSProxy (instead of previously
2981         NSObject) and we forward calls to the target.
2982
2983         We also need to provide an implementation for private methods such as
2984         isNSString__ to address the issue with NSStrings that r204565 was trying
2985         to fix.
2986
2987         * Shared/Cocoa/APIObject.mm:
2988         (API::Object::unwrap):
2989         * Shared/Cocoa/WKObject.h:
2990         * Shared/Cocoa/WKObject.mm:
2991         (-[WKObject dealloc]):
2992         (-[WKObject hash]):
2993         (-[WKObject isKindOfClass:]):
2994         (-[WKObject isMemberOfClass:]):
2995         (-[WKObject respondsToSelector:]):
2996         (-[WKObject conformsToProtocol:]):
2997         (-[WKObject forwardingTargetForSelector:]):
2998         (-[WKObject description]):
2999         (-[WKObject debugDescription]):
3000         (-[WKObject classForCoder]):
3001         (-[WKObject classForKeyedArchiver]):
3002         (-[WKObject _web_createTarget]):
3003         (-[WKObject forwardInvocation:]):
3004         (-[WKObject methodSignatureForSelector:]):
3005         (-[WKObject isNSObject__]):
3006         (-[WKObject isNSArray__]):
3007         (-[WKObject isNSCFConstantString__]):
3008         (-[WKObject isNSData__]):
3009         (-[WKObject isNSDate__]):
3010         (-[WKObject isNSDictionary__]):
3011         (-[WKObject isNSNumber__]):
3012         (-[WKObject isNSOrderedSet__]):
3013         (-[WKObject isNSSet__]):
3014         (-[WKObject isNSString__]):
3015         (-[WKObject isNSTimeZone__]):
3016         (-[WKObject isNSValue__]):
3017
3018 2017-07-21  Chris Dumez  <cdumez@apple.com>
3019
3020         Drop IDBDatabaseException class
3021         https://bugs.webkit.org/show_bug.cgi?id=174743
3022
3023         Reviewed by Darin Adler.
3024
3025         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
3026         (WebKit::WebIDBConnectionToServer::connectionToServerLost):
3027
3028 2017-07-21  Brady Eidson  <beidson@apple.com>
3029
3030         Crash in many WebKit apps marking a connection invalid under Messages::NetworkProcessProxy::canAuthenticateAgainstProtectionSpace.
3031         <rdar://problem/28822272> and https://bugs.webkit.org/show_bug.cgi?id=174729
3032
3033         Reviewed by Tim Horton.
3034
3035         Previously, when a NetworkLoad generated a "CanAuthenticateAgainstProtectionSpace" event, the message went from
3036         Network process -> Web process -> UI process.
3037
3038         In that case, MESSAGE_CHECKing the validity of the frame in WebPageProxy made sense.
3039
3040         In r202511 we cut the WebProcess out of this and had Networking go straight to UI process.
3041
3042         As a result, the message check became invalid. The Networking process cannot possible know the validity of 
3043         particular WebPage or WebFrame identifiers.
3044
3045         We simply need to validate the input in NetworkProcessProxy.
3046
3047         * UIProcess/Network/NetworkProcessProxy.cpp:
3048         (WebKit::NetworkProcessProxy::canAuthenticateAgainstProtectionSpace): Validate both the page and frame ids before
3049           passing the call along to the WebPageProxy. Also, if either of those validations fail, respond to the network process.
3050
3051 2017-07-21  Andy Estes  <aestes@apple.com>
3052
3053         [iOS] Adopt UIImagePickerControllerImageURL for photo uploads
3054         https://bugs.webkit.org/show_bug.cgi?id=174723
3055         <rdar://problem/33223962>
3056
3057         Reviewed by Joseph Pecoraro.
3058
3059         In iOS 11, use the URL provided by UIImagePickerControllerImageURL, if available, as the
3060         file URL for photo uploads. Since we use the UIImagePickerController imageExportPreset of
3061         UIImagePickerControllerImageURLExportPresetCompatible, UIKit will take care of converting
3062         HEIF images to JPEG for us. For other types (GIF, JPEG, and PNG), it will preserve the
3063         original format.
3064
3065         Since UIImagePickerController now provides GIF and PNG representations, we no longer need to
3066         use PHImageManager to access the original assets. This patch removes the
3067         PHAsset/PHImageManager code added in r185241.
3068
3069         * Platform/spi/ios/PhotosSPI.h: Removed.
3070         * UIProcess/ios/forms/WKFileUploadPanel.mm:
3071         (-[WKFileUploadPanel _uploadItemFromMediaInfo:successBlock:failureBlock:]):
3072         (-[WKFileUploadPanel _uploadItemForImage:withAssetURL:successBlock:failureBlock:]): Deleted.
3073         * WebKit.xcodeproj/project.pbxproj:
3074
3075 2017-07-21  Konstantin Tokarev  <annulen@yandex.ru>
3076
3077         [cmake][Mac] Unreviewed, fix linking WebKitSystemInterface
3078
3079         After r219560 link_directories() in PlatformXXX.cmake files does not
3080         affect corresponding targets.
3081
3082         * PlatformMac.cmake:
3083
3084 2017-07-21  Andreas Kling  <akling@apple.com>
3085
3086         Use more references in event dispatch code
3087         https://bugs.webkit.org/show_bug.cgi?id=174681
3088
3089         Reviewed by Geoffrey Garen.
3090
3091         * WebProcess/Plugins/PDF/PDFPluginAnnotation.h:
3092         * WebProcess/Plugins/PDF/PDFPluginAnnotation.mm:
3093         (WebKit::PDFPluginAnnotation::handleEvent):
3094         (WebKit::PDFPluginAnnotation::PDFPluginAnnotationEventListener::handleEvent):
3095         * WebProcess/Plugins/PDF/PDFPluginPasswordField.h:
3096         * WebProcess/Plugins/PDF/PDFPluginPasswordField.mm:
3097         (WebKit::PDFPluginPasswordField::handleEvent):
3098         * WebProcess/Plugins/PDF/PDFPluginTextAnnotation.h:
3099         * WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm:
3100         (WebKit::PDFPluginTextAnnotation::handleEvent):
3101         * WebProcess/Plugins/PluginView.cpp:
3102         (WebKit::PluginView::createWebEvent):
3103         (WebKit::PluginView::handleEvent):
3104         * WebProcess/Plugins/PluginView.h:
3105
3106 2017-07-21  Chris Dumez  <cdumez@apple.com>
3107
3108         WebResourceLoadStatisticsStore::m_operatingDates is unsafely modified from several threads
3109         https://bugs.webkit.org/show_bug.cgi?id=174721
3110         <rdar://problem/33400343>
3111
3112         Reviewed by Brent Fulgham.
3113
3114         WebResourceLoadStatisticsStore::m_operatingDates is supposed to only be modified on
3115         the background thread. However, WebResourceLoadStatisticsStore::performDailyTasks()
3116         was mistakenly calling includeTodayAsOperatingDateIfNecessary() on the main thread,
3117         which would modify m_operatingDates. This could lead to crashes such as the
3118         one in <rdar://problem/33400343>, as the main thread may modify m_operatingDates
3119         while we are interating over it on the background thread to save it to disk.
3120
3121         * UIProcess/WebResourceLoadStatisticsStore.cpp:
3122         (WebKit::WebResourceLoadStatisticsStore::performDailyTasks):
3123         (WebKit::WebResourceLoadStatisticsStore::includeTodayAsOperatingDateIfNecessary):
3124
3125 2017-07-21  Brady Eidson  <beidson@apple.com>
3126
3127         Get rid of WebCore IconDatabase code.
3128         https://bugs.webkit.org/show_bug.cgi?id=174700
3129
3130         Reviewed by Tim Horton.
3131
3132         * UIProcess/API/glib/WebKitWebContext.cpp:
3133         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3134         (WebKit::WebFrameLoaderClient::useIconLoadingClient): Deleted.
3135         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
3136
3137 2017-07-21  Carlos Garcia Campos  <cgarcia@igalia.com>
3138
3139         Web Automation: implicit navigations don't cause browsing context switch
3140         https://bugs.webkit.org/show_bug.cgi?id=174633
3141         <rdar://problem/33387797>
3142
3143         Reviewed by Brian Burg.
3144
3145         When a new page load replaces the current frameset, for example when a link in the current browser context has a
3146         _top target, there's no explicit context switch, so the web driver doesn't know that the current browsing
3147         context is no longer valid. Following commands will still be using the previous frame as the current browsing
3148         context, but they don't fail with no such frame because the frame is still alive in the page cache and
3149         referenced in the internal maps used in both UI and web processes. This causes test
3150         testShouldFocusOnTheReplacementWhenAFrameFollowsALinkToA_TopTargetedPage to fail, since it expects a no such
3151         frame exception. When a new page navigation happens we can simply remove references to frames from
3152         m_handleWebFrameMap in WebAutomationSession, because any existing frame reference in the map should be for a
3153         previous page. With this, before the next command is executed, waitForNavigationToComplete will be called and it
3154         will fail with no such frame, condition that is handled to switch to the top level browser context. The test
3155         still fails, because the find element command is called with the top level browsing context, returning no such
3156         element, instead of no such frame. This is consistent with Chrome.
3157
3158         * UIProcess/Automation/WebAutomationSession.cpp:
3159         (WebKit::WebAutomationSession::navigationOccurredForFrame): Clear the m_handleWebFrameMap when a new page load
3160         finished.
3161
3162 2017-07-21  Carlos Garcia Campos  <cgarcia@igalia.com>
3163
3164         WebDriver: wait until navigation is complete before running new commands and after a click
3165         https://bugs.webkit.org/show_bug.cgi?id=174670
3166
3167         Reviewed by Brian Burg.
3168
3169         Add waitForNavigationToComplete method to Automation to allow WebDriver to wait for pending navigations to
3170         complete. The new method already receives page load strategy and timeout, but they are not implemented yet.
3171
3172         * UIProcess/Automation/Automation.json: Add waitForNavigationToComplete method and PageLoadStrategy new type.
3173         * UIProcess/Automation/WebAutomationSession.cpp:
3174         (WebKit::WebAutomationSession::waitForNavigationToComplete): Call waitForNavigationToCompleteOnPage or
3175         waitForNavigationToCompleteOnFrame depending on whether the current borwsing context is the main frame or not.
3176         (WebKit::WebAutomationSession::waitForNavigationToCompleteOnPage): Check if there's an ongoing load for the page,
3177         and wait for it to complete if needed.
3178         (WebKit::WebAutomationSession::waitForNavigationToCompleteOnFrame): Check if there's an ongoing load for the frame,
3179         and wait for it to complete if needed.
3180         (WebKit::WebAutomationSession::navigateBrowsingContext): Use waitForNavigationToCompleteOnPage() now.
3181         (WebKit::WebAutomationSession::goBackInBrowsingContext): Ditto.
3182         (WebKit::WebAutomationSession::goForwardInBrowsingContext): Ditto.
3183         (WebKit::WebAutomationSession::reloadBrowsingContext): Ditto.
3184         (WebKit::WebAutomationSession::navigationOccurredForFrame): Renamed since it now receives the notification for
3185         all the frames. Complete page operations if it's a main frame, or frame operations otherwise.
3186         * UIProcess/Automation/WebAutomationSession.h:
3187         * UIProcess/WebPageProxy.cpp:
3188         (WebKit::WebPageProxy::didFinishLoadForFrame): Notify about all frames, not only the main one.
3189         (WebKit::WebPageProxy::didFailLoadForFrame): Ditto.
3190         (WebKit::WebPageProxy::didSameDocumentNavigationForFrame): Ditto.
3191
3192 2017-07-20  Carlos Garcia Campos  <cgarcia@igalia.com>
3193
3194         Unreviewed. Remove WKIconDatabaseCairo.
3195
3196         * PlatformGTK.cmake:
3197         * PlatformWPE.cmake:
3198         * UIProcess/API/C/cairo/WKIconDatabaseCairo.cpp: Removed.
3199         * UIProcess/API/C/cairo/WKIconDatabaseCairo.h: Removed.
3200
3201 2017-07-20  Brady Eidson  <beidson@apple.com>
3202
3203         Get rid of IconDatabase related code in WebKit.
3204         https://bugs.webkit.org/show_bug.cgi?id=174693
3205
3206         Reviewed by Tim Horton.
3207
3208         This leaves the C-API class but guts it.
3209
3210         No explanations of the other changes are needed.
3211
3212         * CMakeLists.txt:
3213         * DerivedSources.make:
3214         * Shared/WebProcessCreationParameters.cpp:
3215         (WebKit::WebProcessCreationParameters::encode):
3216         (WebKit::WebProcessCreationParameters::decode):
3217         * Shared/WebProcessCreationParameters.h:
3218         * UIProcess/API/C/WKContext.cpp:
3219         (WKContextGetIconDatabase):
3220         (WKContextSetIconDatabasePath):
3221         * UIProcess/API/C/WKIconDatabase.cpp:
3222         (WKIconDatabaseSetIconDatabaseClient):
3223         (WKIconDatabaseRetainIconForURL):
3224         (WKIconDatabaseReleaseIconForURL):
3225         (WKIconDatabaseSetIconDataForIconURL):
3226         (WKIconDatabaseSetIconURLForPageURL):
3227         (WKIconDatabaseCopyIconURLForPageURL):
3228         (WKIconDatabaseCopyIconDataForPageURL):
3229         (WKIconDatabaseEnableDatabaseCleanup):
3230         (WKIconDatabaseRemoveAllIcons):
3231         (WKIconDatabaseCheckIntegrityBeforeOpening):
3232         (WKIconDatabaseClose):
3233         * UIProcess/API/C/cg/WKIconDatabaseCG.cpp:
3234         (WKIconDatabaseTryGetCGImageForURL):
3235         (WKIconDatabaseTryCopyCGImageArrayForURL):
3236         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3237         (WebKit::WebProcessPool::platformDefaultIconDatabasePath): Deleted.
3238         * UIProcess/WebIconDatabase.cpp: Removed.
3239         * UIProcess/WebIconDatabase.h:
3240         (WebKit::WebIconDatabase::clearProcessPool): Deleted.
3241         * UIProcess/WebIconDatabase.messages.in: Removed.
3242         * UIProcess/WebIconDatabaseClient.cpp: Removed.
3243         * UIProcess/WebIconDatabaseClient.h: Removed.
3244         * UIProcess/WebProcessPool.cpp:
3245         (WebKit::m_hiddenPageThrottlingTimer):
3246         (WebKit::WebProcessPool::~WebProcessPool):
3247         (WebKit::WebProcessPool::setAnyPageGroupMightHavePrivateBrowsingEnabled):
3248         (WebKit::WebProcessPool::createNewWebProcess):
3249         (WebKit::WebProcessPool::setIconDatabasePath): Deleted.
3250         (WebKit::WebProcessPool::iconDatabasePath): Deleted.
3251         * UIProcess/WebProcessPool.h:
3252         * UIProcess/WebProcessProxy.cpp:
3253         (WebKit::WebProcessProxy::processWillShutDown):
3254         (WebKit::WebProcessProxy::retainIconForPageURL): Deleted.
3255         (WebKit::WebProcessProxy::releaseIconForPageURL): Deleted.
3256         (WebKit::WebProcessProxy::releaseRemainingIconsForPageURLs): Deleted.
3257         * UIProcess/WebProcessProxy.h:
3258         * UIProcess/WebProcessProxy.messages.in:
3259         * UIProcess/gtk/WebProcessPoolGtk.cpp:
3260         (WebKit::WebProcessPool::platformDefaultIconDatabasePath): Deleted.
3261         * UIProcess/wpe/WebProcessPoolWPE.cpp:
3262         (WebKit::WebProcessPool::platformDefaultIconDatabasePath): Deleted.
3263         * WebKit.xcodeproj/project.pbxproj:
3264         * WebProcess/IconDatabase/WebIconDatabaseProxy.cpp: Removed.
3265         * WebProcess/IconDatabase/WebIconDatabaseProxy.h: Removed.
3266         * WebProcess/IconDatabase/WebIconDatabaseProxy.messages.in: Removed.
3267         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3268         * WebProcess/WebProcess.cpp:
3269         (WebKit::WebProcess::WebProcess):
3270         (WebKit::WebProcess::initializeWebProcess):
3271         (WebKit::WebProcess::getWebCoreStatistics):
3272         * WebProcess/WebProcess.h:
3273
3274 2017-07-20  David Quesada  <david_quesada@apple.com>
3275
3276         Add SPI to notify WKNavigationDelegate about client redirects
3277         https://bugs.webkit.org/show_bug.cgi?id=174680
3278         rdar://problem/33184886
3279
3280         Reviewed by Brady Eidson.
3281
3282         * UIProcess/API/APINavigationClient.h:
3283         (API::NavigationClient::didPerformClientRedirectForNavigation):
3284         Add a new virtual method for navigation clients to implement if they want to be informed
3285         when the page is initiating a navigation that is a client redirect.
3286
3287         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
3288         Declare the new WKNavigationDelegate method -_webView:didPerformClientRedirectForNavigation:
3289
3290         * UIProcess/Cocoa/NavigationState.h:
3291         * UIProcess/Cocoa/NavigationState.mm:
3292         (WebKit::NavigationState::setNavigationDelegate):
3293         (WebKit::NavigationState::NavigationClient::didPerformClientRedirectForNavigation):
3294         Add a new method to NavigationState method to tell the WKNavigationDelegate when a
3295         client redirect happens.
3296
3297         * UIProcess/WebPageProxy.cpp:
3298         (WebKit::WebPageProxy::didPerformClientRedirectForLoadForFrame):
3299         * UIProcess/WebPageProxy.h:
3300         * UIProcess/WebPageProxy.messages.in:
3301         Allow the WebPageProxy to receive a message from the web process when a client redirect happens.
3302
3303         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3304         (WebKit::WebFrameLoaderClient::dispatchDidPerformClientRedirect):
3305         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
3306         Send this new message to the UI process on client redirects.
3307
3308 2017-07-20  Chris Dumez  <cdumez@apple.com>
3309
3310         Drop legacy XPathException type
3311         https://bugs.webkit.org/show_bug.cgi?id=174679
3312
3313         Reviewed by Sam Weinig.
3314
3315         Drop legacy XPathException type and use DOMException instead. Both Firefox and Chrome
3316         no longer expose XPathException.
3317
3318         * UIProcess/Automation/atoms/FindNodes.js:
3319         (tryToFindNode):
3320
3321 2017-07-20  Chris Dumez  <cdumez@apple.com>
3322
3323         Unreviewed, rolling out r219706.
3324
3325         Broke iOS build
3326
3327         Reverted changeset:
3328
3329         "Drop legacy XPathException type"
3330         https://bugs.webkit.org/show_bug.cgi?id=174679
3331         http://trac.webkit.org/changeset/219706
3332
3333 2017-07-20  Chris Dumez  <cdumez@apple.com>
3334
3335         Drop legacy XPathException type
3336         https://bugs.webkit.org/show_bug.cgi?id=174679
3337
3338         Reviewed by Sam Weinig.
3339
3340         Drop legacy XPathException type and use DOMException instead. Both Firefox and Chrome
3341         no longer expose XPathException.
3342
3343         * UIProcess/Automation/atoms/FindNodes.js:
3344         (tryToFindNode):
3345
3346 2017-07-20  Chris Dumez  <cdumez@apple.com>
3347
3348         Avoid unnecessary WorkQueue dispatch in WebResourceLoadStatisticsStore::processStatisticsAndDataRecords()
3349         https://bugs.webkit.org/show_bug.cgi?id=174686
3350
3351         Reviewed by Geoffrey Garen.
3352
3353         Avoid unnecessary WorkQueue dispatch in WebResourceLoadStatisticsStore::processStatisticsAndDataRecords(). The most common
3354         call site is already on the right thread.
3355
3356         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
3357         (-[WKWebsiteDataStore _resourceLoadStatisticsProcessStatisticsAndDataRecords]):
3358         * UIProcess/WebResourceLoadStatisticsStore.cpp:
3359         (WebKit::WebResourceLoadStatisticsStore::scheduleStatisticsAndDataRecordsProcessing):
3360         (WebKit::WebResourceLoadStatisticsStore::processStatisticsAndDataRecords):
3361         * UIProcess/WebResourceLoadStatisticsStore.h:
3362
3363 2017-07-20  Chris Dumez  <cdumez@apple.com>
3364
3365         Regression(ITP): May get frequently logged out of wsj.com
3366         https://bugs.webkit.org/show_bug.cgi?id=174661
3367         <rdar://problem/32343256>
3368
3369         Reviewed by Geoffrey Garen.
3370
3371         Bump statistics file version to blow away old statistics on disk since those do not
3372         take into account associated domains.
3373
3374         * UIProcess/WebResourceLoadStatisticsStore.cpp:
3375
3376 2017-07-20  Chris Dumez  <cdumez@apple.com>
3377
3378         Replace calls to Vector::resize() with calls to more efficient shrink() / grow() when applicable
3379         https://bugs.webkit.org/show_bug.cgi?id=174660
3380
3381         Reviewed by Geoffrey Garen.
3382
3383         Replace calls to Vector::resize() with calls to more efficient shrink() / grow() when applicable.
3384         This essentially replaces a branch to figure out if the new size is less or greater than the
3385         current size by an assertion.
3386
3387         * Platform/IPC/ArgumentCoders.h:
3388         * UIProcess/Gamepad/UIGamepadProvider.cpp:
3389         (WebKit::UIGamepadProvider::platformGamepadConnected):
3390         * UIProcess/WebProcessPool.cpp:
3391         (WebKit::WebProcessPool::setInitialConnectedGamepads):
3392         * WebProcess/Network/WebLoaderStrategy.cpp:
3393         (WebKit::WebLoaderStrategy::loadResourceSynchronously):
3394         * WebProcess/WebCoreSupport/WebPasteboardOverrides.cpp:
3395         (WebKit::WebPasteboardOverrides::getDataForOverride):
3396         * WebProcess/WebPage/ios/WebPageIOS.mm:
3397         (WebKit::WebPage::requestAutocorrectionData):
3398
3399 2017-07-20  Chris Dumez  <cdumez@apple.com>
3400
3401         Regression(ITP): Can no longer log in on abc.go.com
3402         https://bugs.webkit.org/show_bug.cgi?id=174533
3403         <rdar://problem/33325881>
3404
3405         Reviewed by Geoffrey Garen.
3406
3407         Bump statistics database version to blow away any existing statistics. Without this, SSO providers
3408         for which we added a quirk may already be in the database and identified as trackers. The quirk
3409         merely prevents the specified SSO providers from being identified as trackers.
3410
3411         * UIProcess/WebResourceLoadStatisticsStore.cpp:
3412
3413 2017-07-19  Simon Fraser  <simon.fraser@apple.com>
3414
3415         getBoundingClientRects not updated for programmatic scrolls
3416         https://bugs.webkit.org/show_bug.cgi?id=174538
3417         rdar://problem/33049012
3418
3419         Reviewed by Tim Horton.
3420