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