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