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