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