[iOS DnD] Upstream iOS drag and drop implementation into OpenSource WebKit
[WebKit.git] / Source / WebKit2 / ChangeLog
1 2017-06-16  Wenson Hsieh  <wenson_hsieh@apple.com>
2
3         [iOS DnD] Upstream iOS drag and drop implementation into OpenSource WebKit
4         https://bugs.webkit.org/show_bug.cgi?id=173366
5         <rdar://problem/32767014>
6
7         Reviewed by Tim Horton.
8
9         Move pieces of iOS WebKit2 drag and drop implementation into OpenSource. No change in behavior.
10
11         * Configurations/FeatureDefines.xcconfig:
12         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
13         (WebKit::WebPageProxy::setDragImage):
14         (WebKit::WebPageProxy::setPromisedDataForImage):
15         (WebKit::WebPageProxy::setPromisedDataForAttachment):
16         (WebKit::WebPageProxy::setDragCaretRect):
17         * UIProcess/ios/WKContentViewInteraction.h:
18         * UIProcess/ios/WKContentViewInteraction.mm:
19         (longPressActionDelayAfterLift):
20         (-[WKContentView webViewUIDelegate]):
21         (-[WKContentView setupDataInteractionDelegates]):
22         (-[WKContentView teardownDataInteractionDelegates]):
23         (-[WKContentView _startDataInteractionWithImage:withIndicatorData:atClientPosition:anchorPoint:action:]):
24         (-[WKContentView _didHandleStartDataInteractionRequest:]):
25         (uiImageForImage):
26         (shouldUseTextIndicatorToCreatePreviewForDragAction):
27         (-[WKContentView dragPreviewForImage:frameInRootViewCoordinates:clippingRectsInFrameCoordinates:backgroundColor:]):
28         (-[WKContentView dragPreviewForCurrentDataInteractionState]):
29         (-[WKContentView performDeferredActionAtDragOrigin]):
30         (-[WKContentView cancelDeferredActionAtDragOrigin]):
31         (-[WKContentView computeClientAndGlobalPointsForDropSession:outClientPoint:outGlobalPoint:]):
32         (dropOperationForWebCoreDragOperation):
33         (-[WKContentView dragDataForDropSession:dragDestinationAction:]):
34         (-[WKContentView cleanUpDragSourceSessionState]):
35         (extractItemProvidersFromDragItems):
36         (extractItemProvidersFromDropSession):
37         (-[WKContentView _didConcludeEditDataInteraction:]):
38         (-[WKContentView _didPerformDataInteractionControllerOperation:]):
39         (-[WKContentView _transitionDragPreviewToImageIfNecessary:]):
40         (-[WKContentView _didChangeDataInteractionCaretRect:currentRect:]):
41         (-[WKContentView _dragDestinationActionForDropSession:]):
42         (positionInformationMayStartDataInteraction):
43         (-[WKContentView currentDragOrDropSession]):
44         (-[WKContentView _dragInteraction:prepareForSession:completion:]):
45         (-[WKContentView dragInteraction:itemsForBeginningSession:]):
46         (-[WKContentView _api_dragInteraction:previewForLiftingItem:session:]):
47         (-[WKContentView dragInteraction:sessionWillBegin:]):
48         (-[WKContentView _api_dragInteraction:session:didEndWithOperation:]):
49         (-[WKContentView dragInteraction:previewForCancellingItem:withDefault:]):
50         (-[WKContentView _api_dragInteraction:item:willAnimateCancelWithAnimator:]):
51         (-[WKContentView dropInteraction:canHandleSession:]):
52         (-[WKContentView _api_dropInteraction:sessionDidEnter:]):
53         (-[WKContentView _api_dropInteraction:sessionDidUpdate:]):
54         (-[WKContentView dropInteraction:sessionDidExit:]):
55         (-[WKContentView dropInteraction:performDrop:]):
56         (-[WKContentView dropInteraction:previewForDroppingItem:withDefault:]):
57         (-[WKContentView dropInteraction:sessionDidEnd:]):
58         (-[WKContentView _simulateDataInteractionEntered:]):
59         (-[WKContentView _simulateDataInteractionUpdated:]):
60         (-[WKContentView _simulateDataInteractionEnded:]):
61         (-[WKContentView _simulateDataInteractionPerformOperation:]):
62         (-[WKContentView _simulateDataInteractionSessionDidEnd:]):
63         (-[WKContentView _simulateWillBeginDataInteractionWithSession:]):
64         (-[WKContentView _simulatedItemsForSession:]):
65         (-[WKContentView _simulatePrepareForDataInteractionSession:completion:]):
66         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
67         (WebKit::convertCGImageToBitmap):
68         (WebKit::WebDragClient::startDrag):
69         (WebKit::WebDragClient::declareAndWriteDragImage):
70         (WebKit::WebDragClient::didConcludeEditDrag):
71         (WebKit::WebDragClient::declareAndWriteAttachment):
72
73 2017-06-16  Youenn Fablet  <youenn@apple.com>
74
75         WebRTC sockets should be closed at destruction time if not closed explicitly
76         https://bugs.webkit.org/show_bug.cgi?id=173479
77
78         Reviewed by Eric Carlson.
79
80         * WebProcess/Network/webrtc/LibWebRTCSocket.cpp:
81         (WebKit::LibWebRTCSocket::~LibWebRTCSocket):
82         (WebKit::LibWebRTCSocket::Close):
83
84 2017-06-16  Chris Dumez  <cdumez@apple.com>
85
86         [WK2] Add WKProcessPool SPI to efficiently reset all plugin load client policies
87         https://bugs.webkit.org/show_bug.cgi?id=173472
88         <rdar://problem/28858817>
89
90         Reviewed by Brady Eidson.
91
92         Add WKProcessPool SPI to efficiently reset all plugin load client policies:
93         [WKProcessPool _resetPluginLoadClientPolicies]. This new SPI clears all
94         existing policies and then sets all of them with new values, with a
95         minimal amount of IPC.
96
97         To achieve this, clients would previously have to call
98         1. WKContextClearPluginClientPolicies() which would cause a broadcast IPC to
99            every WebContent process.
100         2. WKContextSetPluginLoadClientPolicy() repeatedly to add each policy one by
101            one. Each call to WKContextSetPluginLoadClientPolicy() would cause a broadcast
102            IPC to every WebContent process.
103
104         The new SPI does the same job with a single broadcast IPC to every WebContent
105         process.
106
107         * UIProcess/API/Cocoa/WKProcessPool.mm:
108         (isPluginLoadClientPolicyAcceptable):
109         (toPluginLoadClientPoliciesHashMap):
110         (policiesHashMapToDictionary):
111         (-[WKProcessPool _resetPluginLoadClientPolicies:]):
112         (-[WKProcessPool _pluginLoadClientPolicies]):
113         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
114         * UIProcess/WebProcessPool.cpp:
115         (WebKit::WebProcessPool::setPluginLoadClientPolicy):
116         (WebKit::WebProcessPool::resetPluginLoadClientPolicies):
117         * UIProcess/WebProcessPool.h:
118         * WebProcess/WebProcess.cpp:
119         (WebKit::WebProcess::initializeWebProcess):
120         (WebKit::WebProcess::resetPluginLoadClientPolicies):
121         * WebProcess/WebProcess.h:
122         * WebProcess/WebProcess.messages.in:
123
124 2017-06-16  Brent Fulgham  <bfulgham@apple.com>
125
126         [WK2][macOS] Expand sandbox to better support video playback on mac mini
127         https://bugs.webkit.org/show_bug.cgi?id=173492
128         <rdar://problem/32804073>
129
130         Reviewed by Alex Christensen.
131
132         Hardware differences in Mac Mini's require some different IOKit preferences to be accessible.
133
134         * WebProcess/com.apple.WebProcess.sb.in:
135
136 2017-06-16  Brent Fulgham  <bfulgham@apple.com>
137
138         [WK2][iOS][macOS] Extend the sandbox to allow reading of AVFoundation's VideoPerformanceHUD preference
139         https://bugs.webkit.org/show_bug.cgi?id=173476
140         <rdar://problem/31594568>
141
142         Reviewed by Alex Christensen.
143
144         Update the sandbox to permit WebContent process to read the AVFoundation preferences for the performance HUD.
145
146         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
147         * WebProcess/com.apple.WebProcess.sb.in:
148
149 2017-06-16  Daniel Bates  <dabates@apple.com>
150
151         Use the term icon instead of favicon
152         https://bugs.webkit.org/show_bug.cgi?id=173400
153
154         Reviewed by Alex Christensen.
155
156         * WebProcess/Network/WebLoaderStrategy.cpp:
157         (WebKit::maximumBufferingTime):
158
159 2017-06-16  Carlos Garcia Campos  <cgarcia@igalia.com>
160
161         [GTK][WPE] Remove WKCookieManagerSoup
162         https://bugs.webkit.org/show_bug.cgi?id=173467
163
164         Reviewed by Michael Catanzaro.
165
166         It's unused.
167
168         * PlatformGTK.cmake:
169         * PlatformWPE.cmake:
170         * UIProcess/API/C/soup/WKCookieManagerSoup.cpp: Removed.
171         * UIProcess/API/C/soup/WKCookieManagerSoup.h: Removed.
172
173 2017-06-16  Carlos Garcia Campos  <cgarcia@igalia.com>
174
175         Unreviewed. Remove wrong headers check from some GTK+ API files.
176
177         Remove the __WEBKIT_WEB_EXTENSION_H_INSIDE__ check since these are not actually shared.
178
179         * UIProcess/API/gtk/WebKitEditorState.h:
180         * UIProcess/API/gtk/WebKitOptionMenu.h:
181         * UIProcess/API/gtk/WebKitPrintCustomWidget.h:
182
183 2017-06-15  Carlos Garcia Campos  <cgarcia@igalia.com>
184
185         REGRESSION(r218325): [GTK] Runtime critical warnings running layout tests that show a popup menu
186         https://bugs.webkit.org/show_bug.cgi?id=173421
187
188         Reviewed by Carlos Alberto Lopez Perez.
189
190         In r218325 I forgot to create a WebKitPopupMenu or WebPopupMenuProxyGtk depending on whether the view is a
191         WebKitWebView or not.
192
193         * UIProcess/API/gtk/PageClientImpl.cpp:
194         (WebKit::PageClientImpl::createPopupMenuProxy):
195
196 2017-06-15  Tim Horton  <timothy_horton@apple.com>
197
198         Null deref under ViewGestureController::endSwipeGesture (navigationGestureDidEnd)
199         https://bugs.webkit.org/show_bug.cgi?id=173441
200         <rdar://problem/25876512>
201
202         Reviewed by Simon Fraser.
203
204         This is a speculative fix for a crash that we don't have repro steps for.
205
206         In a few places, ViewGestureController looks itself up by pageID (in cases
207         where we're in an asynchronous callback), and then calls some
208         function on it (endSwipeGesture, or something that will get there).
209         However, if in the meantime an API client has turned the swipe gesture
210         on and off, the page's ViewGestureController will be a different one
211         than the one that originally started this process, with fresh state,
212         and nullptrs in all sorts of places, ripe for dereferencing.
213
214         To fix this, instead of just looking ViewGestureController up by 
215         pageID, also keep track of the current gestureID, process-wide (previously
216         the gestureID was per-ViewGestureController), and only return the
217         ViewGestureController if it's currently processing the same gesture
218         that started the asynchronous task.
219
220         * UIProcess/Cocoa/ViewGestureController.cpp:
221         (WebKit::ViewGestureController::controllerForGesture):
222         (WebKit::ViewGestureController::takeNextGestureID):
223         (WebKit::ViewGestureController::willBeginGesture):
224         (WebKit::ViewGestureController::didEndGesture):
225         (WebKit::ViewGestureController::gestureControllerForPage): Deleted.
226         * UIProcess/Cocoa/ViewGestureController.h:
227         Add helpers that set and reset activeGestureType and currentGestureID together.
228         Make gesture IDs process global, to avoid two ViewGestureControllers using the same IDs.
229
230         * UIProcess/ios/ViewGestureControllerIOS.mm:
231         (WebKit::ViewGestureController::beginSwipeGesture):
232         (WebKit::ViewGestureController::endSwipeGesture):
233         (WebKit::ViewGestureController::removeSwipeSnapshot):
234         * UIProcess/mac/ViewGestureControllerMac.mm:
235         (WebKit::ViewGestureController::didCollectGeometryForMagnificationGesture):
236         (WebKit::ViewGestureController::handleMagnificationGestureEvent):
237         (WebKit::ViewGestureController::endMagnificationGesture):
238         (WebKit::ViewGestureController::beginSwipeGesture):
239         (WebKit::ViewGestureController::forceRepaintIfNeeded):
240         (WebKit::ViewGestureController::removeSwipeSnapshot):
241         Adopt willBeginGesture/didEndGesture and controllerForGesture.
242
243 2017-06-15  Simon Fraser  <simon.fraser@apple.com>
244
245         [iOS WK2] YouTube videos flash at the wrong place at the end of rotation
246         https://bugs.webkit.org/show_bug.cgi?id=173445
247         rdar://problem/31584852
248
249         Reviewed by Tim Horton.
250
251         In MobileSafari where WKWebView rotation uses _dynamicViewportUpdateModes, we could do a
252         visibleContentRect update at the end of rotation which computed a bad layoutViewportRect,
253         because it used a m_baseLayoutViewportSize from the old orientation.
254
255         We have actually sent a new m_baseLayoutViewportSize to the UI process by this point in 
256         a layer tree commit, but _didCommitLayerTree: ignored it because we had a _dynamicViewportUpdateMode.
257
258         Fix is to always update the layout viewport data from the web process, since during dynamic
259         viewport updates, we still need these data to compute rectangles sent back to the web process via
260         visible content rect updates.
261
262         * UIProcess/API/Cocoa/WKWebView.mm:
263         (-[WKWebView _didCommitLayerTree:]):
264         * UIProcess/ios/WebPageProxyIOS.mm:
265         (WebKit::WebPageProxy::computeCustomFixedPositionRect):
266         (WebKit::WebPageProxy::updateLayoutViewportParameters): Cleanup.
267
268 2017-06-15  Wenson Hsieh  <wenson_hsieh@apple.com>
269
270         Using -[WebItemProviderPasteboard setItemProviders:] to swap out item providers before a drop breaks item provider loading
271         https://bugs.webkit.org/show_bug.cgi?id=173338
272         <rdar://problem/32777720>
273
274         Reviewed by Tim Horton.
275
276         Rename updatePreferredTypeIdentifiers to updateSupportedTypeIdentifiers. Also, introduce
277         _webView:willPerformDropWithSession: as SPI on WKUIDelegate.
278
279         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
280         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
281         (WebKit::WebPasteboardProxy::updateSupportedTypeIdentifiers):
282         (WebKit::WebPasteboardProxy::updatePreferredTypeIdentifiers): Deleted.
283         * UIProcess/WebPasteboardProxy.h:
284         * UIProcess/WebPasteboardProxy.messages.in:
285         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
286         (WebKit::WebPlatformStrategies::updateSupportedTypeIdentifiers):
287         (WebKit::WebPlatformStrategies::updatePreferredTypeIdentifiers): Deleted.
288         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
289
290 2017-06-15  Carlos Garcia Campos  <cgarcia@igalia.com>
291
292         [GTK] Cleanup headers includes in GTK+ API files
293         https://bugs.webkit.org/show_bug.cgi?id=173415
294
295         Reviewed by Michael Catanzaro.
296
297         - Remove WTFGType.h from WebKitPrivate.h and include it in all other files instead of WebKitPrivate if needed.
298         - Stop including WebKitPrivate.h in all other private headers.
299         - Remove all C API includes.
300
301         * UIProcess/API/gtk/WebKitAuthenticationDialog.cpp:
302         * UIProcess/API/gtk/WebKitAuthenticationRequest.cpp:
303         * UIProcess/API/gtk/WebKitAuthenticationRequestPrivate.h:
304         * UIProcess/API/gtk/WebKitAutomationSession.cpp:
305         * UIProcess/API/gtk/WebKitBackForwardList.cpp:
306         * UIProcess/API/gtk/WebKitBackForwardListItem.cpp:
307         * UIProcess/API/gtk/WebKitColorChooser.h:
308         * UIProcess/API/gtk/WebKitColorChooserRequest.cpp:
309         * UIProcess/API/gtk/WebKitContextMenu.cpp:
310         * UIProcess/API/gtk/WebKitContextMenuItem.cpp:
311         * UIProcess/API/gtk/WebKitContextMenuItemPrivate.h:
312         * UIProcess/API/gtk/WebKitContextMenuPrivate.h:
313         * UIProcess/API/gtk/WebKitCookieManager.cpp:
314         * UIProcess/API/gtk/WebKitCookieManagerPrivate.h:
315         * UIProcess/API/gtk/WebKitCredentialPrivate.h:
316         * UIProcess/API/gtk/WebKitDownload.cpp:
317         * UIProcess/API/gtk/WebKitDownloadClient.cpp:
318         * UIProcess/API/gtk/WebKitDownloadPrivate.h:
319         * UIProcess/API/gtk/WebKitEditorState.cpp:
320         * UIProcess/API/gtk/WebKitEditorStatePrivate.h:
321         * UIProcess/API/gtk/WebKitError.cpp:
322         * UIProcess/API/gtk/WebKitFaviconDatabase.cpp:
323         * UIProcess/API/gtk/WebKitFileChooserRequest.cpp:
324         * UIProcess/API/gtk/WebKitFileChooserRequestPrivate.h:
325         * UIProcess/API/gtk/WebKitFindController.cpp:
326         * UIProcess/API/gtk/WebKitFormClient.cpp:
327         * UIProcess/API/gtk/WebKitFormSubmissionRequest.cpp:
328         * UIProcess/API/gtk/WebKitFormSubmissionRequestPrivate.h:
329         * UIProcess/API/gtk/WebKitGeolocationPermissionRequest.cpp:
330         * UIProcess/API/gtk/WebKitGeolocationPermissionRequestPrivate.h:
331         * UIProcess/API/gtk/WebKitHitTestResult.cpp:
332         * UIProcess/API/gtk/WebKitHitTestResultPrivate.h:
333         * UIProcess/API/gtk/WebKitInstallMissingMediaPluginsPermissionRequest.cpp:
334         * UIProcess/API/gtk/WebKitInstallMissingMediaPluginsPermissionRequestPrivate.h:
335         * UIProcess/API/gtk/WebKitJavascriptResult.cpp:
336         * UIProcess/API/gtk/WebKitJavascriptResultPrivate.h:
337         * UIProcess/API/gtk/WebKitMimeInfoPrivate.h:
338         * UIProcess/API/gtk/WebKitNavigationActionPrivate.h:
339         * UIProcess/API/gtk/WebKitNavigationPolicyDecision.cpp:
340         * UIProcess/API/gtk/WebKitNavigationPolicyDecisionPrivate.h:
341         * UIProcess/API/gtk/WebKitNetworkProxySettings.cpp:
342         * UIProcess/API/gtk/WebKitNetworkProxySettingsPrivate.h:
343         * UIProcess/API/gtk/WebKitNotification.cpp:
344         * UIProcess/API/gtk/WebKitNotificationPermissionRequest.cpp:
345         * UIProcess/API/gtk/WebKitNotificationPermissionRequestPrivate.h:
346         * UIProcess/API/gtk/WebKitNotificationPrivate.h:
347         * UIProcess/API/gtk/WebKitOptionMenu.cpp:
348         * UIProcess/API/gtk/WebKitPlugin.cpp:
349         * UIProcess/API/gtk/WebKitPluginPrivate.h:
350         * UIProcess/API/gtk/WebKitPolicyDecision.cpp:
351         * UIProcess/API/gtk/WebKitPolicyDecisionPrivate.h:
352         * UIProcess/API/gtk/WebKitPrintCustomWidget.cpp:
353         * UIProcess/API/gtk/WebKitPrintCustomWidgetPrivate.h:
354         * UIProcess/API/gtk/WebKitPrintOperation.cpp:
355         * UIProcess/API/gtk/WebKitPrivate.h:
356         * UIProcess/API/gtk/WebKitResponsePolicyDecision.cpp:
357         * UIProcess/API/gtk/WebKitResponsePolicyDecisionPrivate.h:
358         * UIProcess/API/gtk/WebKitSecurityManager.cpp:
359         * UIProcess/API/gtk/WebKitSecurityOrigin.cpp:
360         * UIProcess/API/gtk/WebKitSecurityOriginPrivate.h:
361         * UIProcess/API/gtk/WebKitSettings.cpp:
362         * UIProcess/API/gtk/WebKitUIClient.cpp:
363         * UIProcess/API/gtk/WebKitURIRequest.cpp:
364         * UIProcess/API/gtk/WebKitURIResponse.cpp:
365         * UIProcess/API/gtk/WebKitURISchemeRequest.cpp:
366         * UIProcess/API/gtk/WebKitURISchemeRequestPrivate.h:
367         * UIProcess/API/gtk/WebKitUserContent.cpp:
368         * UIProcess/API/gtk/WebKitUserContentManager.cpp:
369         * UIProcess/API/gtk/WebKitUserMediaPermissionRequest.cpp:
370         * UIProcess/API/gtk/WebKitUserMediaPermissionRequestPrivate.h:
371         * UIProcess/API/gtk/WebKitWebContext.cpp:
372         * UIProcess/API/gtk/WebKitWebContextPrivate.h:
373         * UIProcess/API/gtk/WebKitWebInspector.cpp:
374         * UIProcess/API/gtk/WebKitWebInspectorPrivate.h:
375         * UIProcess/API/gtk/WebKitWebResource.cpp:
376         * UIProcess/API/gtk/WebKitWebResourcePrivate.h:
377         * UIProcess/API/gtk/WebKitWebView.cpp:
378         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
379         * UIProcess/API/gtk/WebKitWebViewBaseAccessible.cpp:
380         * UIProcess/API/gtk/WebKitWebViewBasePrivate.h:
381         * UIProcess/API/gtk/WebKitWebViewPrivate.h:
382         * UIProcess/API/gtk/WebKitWebsiteDataManager.cpp:
383         * UIProcess/API/gtk/WebKitWebsiteDataManagerPrivate.h:
384         * UIProcess/API/gtk/WebKitWebsiteDataPrivate.h:
385         * UIProcess/API/gtk/WebKitWindowProperties.cpp:
386         * UIProcess/API/gtk/WebKitWindowPropertiesPrivate.h:
387         * WebProcess/InjectedBundle/API/gtk/WebKitFrame.cpp:
388         * WebProcess/InjectedBundle/API/gtk/WebKitScriptWorld.cpp:
389         * WebProcess/InjectedBundle/API/gtk/WebKitWebEditor.cpp:
390         * WebProcess/InjectedBundle/API/gtk/WebKitWebExtension.cpp:
391         * WebProcess/InjectedBundle/API/gtk/WebKitWebHitTestResult.cpp:
392         * WebProcess/InjectedBundle/API/gtk/WebKitWebPage.cpp:
393
394 2017-06-15  Carlos Garcia Campos  <cgarcia@igalia.com>
395
396         [GTK] Do not use the C API in WebGtkExtensionManager
397         https://bugs.webkit.org/show_bug.cgi?id=173408
398
399         Reviewed by Michael Catanzaro.
400
401         Use the C++ API instead.
402
403         * WebProcess/gtk/WebGtkExtensionManager.cpp:
404         (WebKit::parseUserData):
405         (WebKit::WebGtkExtensionManager::initialize):
406         * WebProcess/gtk/WebGtkExtensionManager.h:
407         * WebProcess/gtk/WebGtkInjectedBundleMain.cpp:
408         (WKBundleInitialize):
409
410 2017-06-15  Adrian Perez de Castro  <aperez@igalia.com>
411
412         [GTK] Stop using GtkAction in WebPopupMenuProxyGtk
413         https://bugs.webkit.org/show_bug.cgi?id=173417
414
415         Reviewed by Carlos Garcia Campos.
416
417         This gets rid of GtkAction in WebPopupMenuProxyGtk, which was deprecated in GTK+ 3.10
418         and will not be available in GTK+ 4.0. Using GtkMenuItem directly makes populating
419         long menus slightly faster, which can be noticeable in lower-end machines.
420
421         * UIProcess/gtk/WebPopupMenuProxyGtk.cpp:
422         (WebKit::WebPopupMenuProxyGtk::populatePopupMenu):
423         (WebKit::WebPopupMenuProxyGtk::menuItemActivated):
424         (WebKit::WebPopupMenuProxyGtk::createGtkActionForMenuItem): Deleted.
425         * UIProcess/gtk/WebPopupMenuProxyGtk.h:
426         (WebKit::WebPopupMenuProxyGtk::setCurrentlySelectedMenuItem):
427         Instantiate GtkMenuItem objects directly when populating the menu.
428
429 2017-06-15  Carlos Garcia Campos  <cgarcia@igalia.com>
430
431         Unreviewed. Fix copy-paste error in GTK+ WEBKIT_JAVASCRIPT_ERROR definition.
432
433         The print one was copied there.
434
435         * UIProcess/API/gtk/WebKitError.h:
436
437 2017-06-15  Carlos Garcia Campos  <cgarcia@igalia.com>
438
439         [GTK] Add API to allow overriding popup menus
440         https://bugs.webkit.org/show_bug.cgi?id=172905
441
442         Reviewed by Michael Catanzaro.
443
444         The GTK+ API uses GTK+ for the default implementation of several UI elements like the file chooser, print dialog,
445         color picker, context menu, etc. but in all those cases it allows to override the default implementation. It's
446         not possible to override the popup menu used for select elements. This patch adds WebKitOptionMenu to represent
447         a select dropdown menu. It's passed as an argument of the new signal WebKitWebView::show-option-menu, and
448         contains WebKitOptionMenuItem elements representing the items to be displayed.
449
450         * PlatformGTK.cmake:
451         * UIProcess/API/gtk/PageClientImpl.cpp:
452         (WebKit::PageClientImpl::createPopupMenuProxy): Create a WebKitPopupMenu.
453         * UIProcess/API/gtk/WebKitOptionMenu.cpp: Added.
454         (webkitOptionMenuCreate):
455         (webkit_option_menu_get_n_items):
456         (webkit_option_menu_get_item):
457         (webkit_option_menu_select_item):
458         (webkit_option_menu_activate_item):
459         (webkit_option_menu_close):
460         * UIProcess/API/gtk/WebKitOptionMenu.h: Added.
461         * UIProcess/API/gtk/WebKitOptionMenuItem.cpp: Added.
462         (webkit_option_menu_item_copy):
463         (webkit_option_menu_item_free):
464         (webkit_option_menu_item_get_label):
465         (webkit_option_menu_item_get_tooltip):
466         (webkit_option_menu_item_is_group_label):
467         (webkit_option_menu_item_is_group_child):
468         (webkit_option_menu_item_is_enabled):
469         (webkit_option_menu_item_is_selected):
470         * UIProcess/API/gtk/WebKitOptionMenuItem.h: Added.
471         * UIProcess/API/gtk/WebKitOptionMenuItemPrivate.h: Added.
472         (_WebKitOptionMenuItem::_WebKitOptionMenuItem):
473         * UIProcess/API/gtk/WebKitOptionMenuPrivate.h: Added.
474         * UIProcess/API/gtk/WebKitPopupMenu.cpp: Added.
475         (WebKit::WebKitPopupMenu::WebKitPopupMenu):
476         (WebKit::menuCloseCallback):
477         (WebKit::WebKitPopupMenu::showPopupMenu): Call webkitWebViewShowOptionMenu() falling back to default
478         implementation if the user didn't handle the signal.
479         (WebKit::WebKitPopupMenu::hidePopupMenu):
480         (WebKit::WebKitPopupMenu::cancelTracking):
481         (WebKit::WebKitPopupMenu::selectItem):
482         (WebKit::WebKitPopupMenu::activateItem):
483         * UIProcess/API/gtk/WebKitPopupMenu.h: Added.
484         * UIProcess/API/gtk/WebKitWebView.cpp:
485         (webkit_web_view_class_init):
486         (webkitWebViewShowOptionMenu): Emit WebKitWebView::show-option-menu.
487         * UIProcess/API/gtk/WebKitWebView.h:
488         * UIProcess/API/gtk/WebKitWebViewPrivate.h:
489         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt: Add new symbols.
490         * UIProcess/API/gtk/docs/webkit2gtk-4.0.types: Add new get_type functions.
491         * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml: Add new sections.
492         * UIProcess/API/gtk/webkit2.h: Add new public headers.
493         * UIProcess/gtk/WebPopupMenuProxyGtk.cpp:
494         (WebKit::WebPopupMenuProxyGtk::WebPopupMenuProxyGtk): Do not create the GtkMenu in constructor.
495         (WebKit::WebPopupMenuProxyGtk::showPopupMenu): Create the GtkMenu and connect to the signals here.
496         (WebKit::WebPopupMenuProxyGtk::hidePopupMenu): Return early if the Gtk hasn't been shown.
497         * UIProcess/gtk/WebPopupMenuProxyGtk.h: Make constructor and webview protected.
498
499 2017-06-14  Carlos Garcia Campos  <cgarcia@igalia.com>
500
501         [GTK] Use API::InjectedBundle::ResourceLoadClient in WebKitWebPage
502         https://bugs.webkit.org/show_bug.cgi?id=173364
503
504         Reviewed by Michael Catanzaro.
505
506         Instead of the C API.
507
508         * WebProcess/InjectedBundle/API/gtk/WebKitWebPage.cpp:
509         (webkitWebPageCreate):
510         (didInitiateLoadForResource): Deleted.
511         (willSendRequestForFrame): Deleted.
512         (didReceiveResponseForResource): Deleted.
513         (didReceiveContentLengthForResource): Deleted.
514         (didFinishLoadForResource): Deleted.
515         (didFailLoadForResource): Deleted.
516
517 2017-06-14  Carlos Garcia Campos  <cgarcia@igalia.com>
518
519         [GTK] Use API::InjectedBundle::Client in WebKitWebExtension
520         https://bugs.webkit.org/show_bug.cgi?id=173358
521
522         Reviewed by Michael Catanzaro.
523
524         Instead of the C API.
525
526         * WebProcess/InjectedBundle/API/gtk/WebKitWebExtension.cpp:
527         (webkitWebExtensionCreate):
528         (webkitWebExtensionPageCreated): Deleted.
529         (webkitWebExtensionPageDestroy): Deleted.
530         (webkitWebExtensionDidReceiveMessage): Deleted.
531         (didCreatePage): Deleted.
532         (willDestroyPage): Deleted.
533         (didReceiveMessage): Deleted.
534         (didReceiveMessageToPage): Deleted.
535
536 2017-06-15  Carlos Garcia Campos  <cgarcia@igalia.com>
537
538         [GTK] Use API::NotificationProvider
539         https://bugs.webkit.org/show_bug.cgi?id=173312
540
541         Reviewed by Žan Doberšek.
542
543         Also cleanup a bit the WebKitNotificationProvider implementation, it doesn't need to be refcounted.
544
545         * UIProcess/API/gtk/WebKitNotificationProvider.cpp:
546         (WebKitNotificationProvider::WebKitNotificationProvider):
547         (WebKitNotificationProvider::~WebKitNotificationProvider):
548         (WebKitNotificationProvider::show):
549         (WebKitNotificationProvider::clearNotifications):
550         (WebKitNotificationProvider::notificationPermissions):
551         (WebKitNotificationProvider::setNotificationPermissions):
552         * UIProcess/API/gtk/WebKitNotificationProvider.h:
553         * UIProcess/API/gtk/WebKitWebContext.cpp:
554         (webkitWebContextConstructed):
555         (addOriginToMap):
556         (webkit_web_context_initialize_notification_permissions):
557
558 2017-06-14  Carlos Garcia Campos  <cgarcia@igalia.com>
559
560         Add API::InjectedBundle::ResourceLoadClient
561         https://bugs.webkit.org/show_bug.cgi?id=173362
562
563         Reviewed by Alex Christensen.
564
565         It will be used by the GTK+ port instead of the C API.
566
567         * WebKit2.xcodeproj/project.pbxproj:
568         * WebProcess/InjectedBundle/API/APIInjectedBundlePageResourceLoadClient.h: Copied from Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageResourceLoadClient.h.
569         (API::InjectedBundle::ResourceLoadClient::didInitiateLoadForResource):
570         (API::InjectedBundle::ResourceLoadClient::willSendRequestForFrame):
571         (API::InjectedBundle::ResourceLoadClient::didReceiveResponseForResource):
572         (API::InjectedBundle::ResourceLoadClient::didReceiveContentLengthForResource):
573         (API::InjectedBundle::ResourceLoadClient::didFinishLoadForResource):
574         (API::InjectedBundle::ResourceLoadClient::didFailLoadForResource):
575         (API::InjectedBundle::ResourceLoadClient::shouldCacheResponse):
576         (API::InjectedBundle::ResourceLoadClient::shouldUseCredentialStorage):
577         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
578         (WKBundlePageSetResourceLoadClient):
579         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
580         (setUpResourceLoadClient):
581         (-[WKWebProcessPlugInBrowserContextController setLoadDelegate:]):
582         * WebProcess/InjectedBundle/InjectedBundlePageResourceLoadClient.cpp:
583         (WebKit::InjectedBundlePageResourceLoadClient::InjectedBundlePageResourceLoadClient):
584         (WebKit::InjectedBundlePageResourceLoadClient::didInitiateLoadForResource):
585         (WebKit::InjectedBundlePageResourceLoadClient::willSendRequestForFrame):
586         (WebKit::InjectedBundlePageResourceLoadClient::didReceiveResponseForResource):
587         (WebKit::InjectedBundlePageResourceLoadClient::didReceiveContentLengthForResource):
588         (WebKit::InjectedBundlePageResourceLoadClient::didFinishLoadForResource):
589         (WebKit::InjectedBundlePageResourceLoadClient::didFailLoadForResource):
590         (WebKit::InjectedBundlePageResourceLoadClient::shouldCacheResponse):
591         (WebKit::InjectedBundlePageResourceLoadClient::shouldUseCredentialStorage):
592         * WebProcess/InjectedBundle/InjectedBundlePageResourceLoadClient.h:
593         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
594         (WebKit::WebFrameLoaderClient::assignIdentifierToInitialRequest):
595         (WebKit::WebFrameLoaderClient::dispatchWillSendRequest):
596         (WebKit::WebFrameLoaderClient::shouldUseCredentialStorage):
597         (WebKit::WebFrameLoaderClient::dispatchDidReceiveResponse):
598         (WebKit::WebFrameLoaderClient::dispatchDidReceiveContentLength):
599         (WebKit::WebFrameLoaderClient::dispatchDidFinishLoading):
600         (WebKit::WebFrameLoaderClient::dispatchDidFailLoading):
601         (WebKit::WebFrameLoaderClient::willCacheResponse):
602         * WebProcess/WebPage/WebPage.cpp:
603         (WebKit::WebPage::setInjectedBundleResourceLoadClient):
604         (WebKit::WebPage::close):
605         * WebProcess/WebPage/WebPage.h:
606         (WebKit::WebPage::injectedBundleResourceLoadClient):
607
608 2017-06-14  Carlos Garcia Campos  <cgarcia@igalia.com>
609
610         Add API::InjectedBundle::Client
611         https://bugs.webkit.org/show_bug.cgi?id=173357
612
613         Reviewed by Alex Christensen.
614
615         It will be used by the GTK+ port instead of the C API.
616
617         * WebKit2.xcodeproj/project.pbxproj:
618         * WebProcess/InjectedBundle/API/APIInjectedBundleBundleClient.h: Copied from Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleClient.h.
619         (API::InjectedBundle::Client::didCreatePage):
620         (API::InjectedBundle::Client::willDestroyPage):
621         (API::InjectedBundle::Client::didInitializePageGroup):
622         (API::InjectedBundle::Client::didReceiveMessage):
623         (API::InjectedBundle::Client::didReceiveMessageToPage):
624         * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
625         (WKBundleSetClient):
626         * WebProcess/InjectedBundle/API/gtk/WebKitWebExtension.cpp:
627         (webkitWebExtensionPageCreated): Deleted.
628         (webkitWebExtensionPageDestroy): Deleted.
629         (webkitWebExtensionDidReceiveMessage): Deleted.
630         (didCreatePage): Deleted.
631         (willDestroyPage): Deleted.
632         (didReceiveMessage): Deleted.
633         (didReceiveMessageToPage): Deleted.
634         * WebProcess/InjectedBundle/InjectedBundle.cpp:
635         (WebKit::InjectedBundle::setClient):
636         (WebKit::InjectedBundle::didCreatePage):
637         (WebKit::InjectedBundle::willDestroyPage):
638         (WebKit::InjectedBundle::didInitializePageGroup):
639         (WebKit::InjectedBundle::didReceiveMessage):
640         (WebKit::InjectedBundle::didReceiveMessageToPage):
641         * WebProcess/InjectedBundle/InjectedBundle.h:
642         * WebProcess/InjectedBundle/InjectedBundleClient.cpp:
643         (WebKit::InjectedBundleClient::InjectedBundleClient):
644         (WebKit::InjectedBundleClient::didCreatePage):
645         (WebKit::InjectedBundleClient::willDestroyPage):
646         (WebKit::InjectedBundleClient::didInitializePageGroup):
647         (WebKit::InjectedBundleClient::didReceiveMessage):
648         (WebKit::InjectedBundleClient::didReceiveMessageToPage):
649         * WebProcess/InjectedBundle/InjectedBundleClient.h:
650
651 2017-06-14  Carlos Garcia Campos  <cgarcia@igalia.com>
652
653         WKErrorGetErrorCode should not return the API::Error enum values directly
654         https://bugs.webkit.org/show_bug.cgi?id=173367
655
656         Reviewed by Alex Christensen.
657
658         Even if the values are the same, we should use a switch to ensure we return the C API values, and not all
659         API::Error enum values are exposed in the C API.
660
661         * Shared/API/c/WKErrorRef.cpp:
662         (WKErrorGetErrorCode):
663
664 2017-06-14  Commit Queue  <commit-queue@webkit.org>
665
666         Unreviewed, rolling out r218285.
667         https://bugs.webkit.org/show_bug.cgi?id=173391
668
669         API test fails on iOS (Requested by alexchristensen on
670         #webkit).
671
672         Reverted changeset:
673
674         "Add SPI for immediate injection of user scripts"
675         https://bugs.webkit.org/show_bug.cgi?id=173342
676         http://trac.webkit.org/changeset/218285
677
678 2017-06-14  Commit Queue  <commit-queue@webkit.org>
679
680         Unreviewed, rolling out r218267.
681         https://bugs.webkit.org/show_bug.cgi?id=173390
682
683         "The previous rollout of r218263, r218265, and r218266 by
684         mlewis13 on bug 173383 missed r218267 and broke the GTK+
685         build" (Requested by clopez_ on #webkit).
686
687         Reverted changeset:
688
689         "[GTK] Use API::InjectedBundle::ResourceLoadClient in
690         WebKitWebPage"
691         https://bugs.webkit.org/show_bug.cgi?id=173364
692         http://trac.webkit.org/changeset/218267
693
694 2017-06-14  Chris Dumez  <cdumez@apple.com>
695
696         WebKit falsely reports that a web process is unresponsive if you close a page shortly after stopping a load
697         https://bugs.webkit.org/show_bug.cgi?id=173384
698         <rdar://problem/32723779>
699
700         Reviewed by Dan Bernstein.
701
702         WebKit falsely reports that a web process is unresponsive if you close a page shortly after stopping a load.
703         This is because WebPageProxy::stopLoad() starts the responsiveness timer and expects a StopResponsinessTimer
704         IPC from the WebProcess to stop the timer so we don't report the process as unresponsive. However, if
705         WebPageProxy::close() is called before the StopResponsinessTimer IPC has been received, the page will remove
706         itself from the message receiver map and we would no longer be able to receive the StopResponsinessTimer
707         IPC and stop the timer, even if the WebProcess sent it to the UIProcess.
708
709         To address the issue, we now send the IPC Message to the WebProcessProxy instead of the WebPageProxy, so we
710         can stop the responsiveness timer, even after the WebPageProxy has been called.
711
712         * UIProcess/WebPageProxy.cpp:
713         * UIProcess/WebPageProxy.h:
714         * UIProcess/WebPageProxy.messages.in:
715         * UIProcess/WebProcessProxy.cpp:
716         (WebKit::WebProcessProxy::stopResponsivenessTimer):
717         * UIProcess/WebProcessProxy.h:
718         * UIProcess/WebProcessProxy.messages.in:
719         * WebProcess/WebPage/WebPage.cpp:
720         (WebKit::SendStopResponsivenessTimer::~SendStopResponsivenessTimer):
721         (WebKit::WebPage::tryClose):
722         (WebKit::WebPage::loadRequest):
723         (WebKit::WebPage::loadDataImpl):
724         (WebKit::WebPage::stopLoading):
725         (WebKit::WebPage::reload):
726         (WebKit::WebPage::goForward):
727         (WebKit::WebPage::goBack):
728         (WebKit::WebPage::goToBackForwardItem):
729
730 2017-06-14  Commit Queue  <commit-queue@webkit.org>
731
732         Unreviewed, rolling out r218263, r218265, and r218266.
733         https://bugs.webkit.org/show_bug.cgi?id=173383
734
735         "These revisions caused multiple API test to Time out on
736         macOS" (Requested by mlewis13 on #webkit).
737
738         Reverted changesets:
739
740         "Add API::InjectedBundle::Client"
741         https://bugs.webkit.org/show_bug.cgi?id=173357
742         http://trac.webkit.org/changeset/218263
743
744         "[GTK] Use API::InjectedBundle::Client in WebKitWebExtension"
745         https://bugs.webkit.org/show_bug.cgi?id=173358
746         http://trac.webkit.org/changeset/218265
747
748         "Add API::InjectedBundle::ResourceLoadClient"
749         https://bugs.webkit.org/show_bug.cgi?id=173362
750         http://trac.webkit.org/changeset/218266
751
752 2017-06-14  Brent Fulgham  <bfulgham@apple.com>
753
754         [WK2][iOS] Remove dead-code "import "removed-dev-nodes.sb” from sandboxes (173378)
755         https://bugs.webkit.org/show_bug.cgi?id=173378
756         <rdar://problem/32773230>
757
758         Reviewed by Alexey Proskuryakov.
759
760         Clean up the sandboxes to remove a couple of dead functions (and imports):
761         1. Remove the import "removed-dev-nodes.sb" from the sandbox, since this file is now empty.
762         2. Also remove the call to "instruments-support" as this is a no-op function in modern iOS.
763
764         * Resources/SandboxProfiles/ios/com.apple.WebKit.Databases.sb:
765         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
766         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
767
768 2017-06-14  Alex Christensen  <achristensen@webkit.org>
769
770         Add SPI for immediate injection of user scripts
771         https://bugs.webkit.org/show_bug.cgi?id=173342
772         <rdar://problem/29202285>
773
774         Reviewed by Brady Eidson.
775
776         * UIProcess/API/C/WKPageGroup.cpp:
777         (WKPageGroupAddUserScript):
778         * UIProcess/API/C/WKUserContentControllerRef.cpp:
779         (WKUserContentControllerAddUserScript):
780         * UIProcess/API/Cocoa/WKUserContentController.mm:
781         (-[WKUserContentController addUserScript:]):
782         (-[WKUserContentController _addUserScriptImmediately:]):
783         * UIProcess/API/Cocoa/WKUserContentControllerPrivate.h:
784         * UIProcess/UserContent/WebUserContentControllerProxy.cpp:
785         (WebKit::WebUserContentControllerProxy::addUserScript):
786         * UIProcess/UserContent/WebUserContentControllerProxy.h:
787         * WebProcess/UserContent/WebUserContentController.cpp:
788         (WebKit::WebUserContentController::addUserScripts):
789         (WebKit::WebUserContentController::addUserScriptInternal):
790         If we are to inject the script internally, inject it into the appropriate pages.
791         If we're injecting into the top frame only, there's no need to traverse the frame tree.
792         (WebKit::WebUserContentController::addUserScript):
793         * WebProcess/UserContent/WebUserContentController.h:
794         * WebProcess/UserContent/WebUserContentController.messages.in:
795         * WebProcess/WebPage/WebPage.cpp:
796         (WebKit::m_cpuLimit):
797
798 2017-06-14  Jonathan Bedard  <jbedard@apple.com>
799
800         Configure screen scale for running layout tests on plus devices
801         https://bugs.webkit.org/show_bug.cgi?id=173319
802
803         Reviewed by Tim Horton.
804
805         * Platform/spi/ios/UIKitSPI.h: Both this and UIKitTestSPI.h define UIKeyboard. Use
806         a define guard to prevent re-definition.
807
808 2017-06-14  Carlos Garcia Campos  <cgarcia@igalia.com>
809
810         [GTK] Use API::InjectedBundle::ResourceLoadClient in WebKitWebPage
811         https://bugs.webkit.org/show_bug.cgi?id=173364
812
813         Reviewed by Michael Catanzaro.
814
815         Instead of the C API.
816
817         * WebProcess/InjectedBundle/API/gtk/WebKitWebPage.cpp:
818         (webkitWebPageCreate):
819         (didInitiateLoadForResource): Deleted.
820         (willSendRequestForFrame): Deleted.
821         (didReceiveResponseForResource): Deleted.
822         (didReceiveContentLengthForResource): Deleted.
823         (didFinishLoadForResource): Deleted.
824         (didFailLoadForResource): Deleted.
825
826 2017-06-14  Carlos Garcia Campos  <cgarcia@igalia.com>
827
828         Add API::InjectedBundle::ResourceLoadClient
829         https://bugs.webkit.org/show_bug.cgi?id=173362
830
831         Reviewed by Alex Christensen.
832
833         It will be used by the GTK+ port instead of the C API.
834
835         * WebKit2.xcodeproj/project.pbxproj:
836         * WebProcess/InjectedBundle/API/APIInjectedBundlePageResourceLoadClient.h: Copied from Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageResourceLoadClient.h.
837         (API::InjectedBundle::ResourceLoadClient::didInitiateLoadForResource):
838         (API::InjectedBundle::ResourceLoadClient::willSendRequestForFrame):
839         (API::InjectedBundle::ResourceLoadClient::didReceiveResponseForResource):
840         (API::InjectedBundle::ResourceLoadClient::didReceiveContentLengthForResource):
841         (API::InjectedBundle::ResourceLoadClient::didFinishLoadForResource):
842         (API::InjectedBundle::ResourceLoadClient::didFailLoadForResource):
843         (API::InjectedBundle::ResourceLoadClient::shouldCacheResponse):
844         (API::InjectedBundle::ResourceLoadClient::shouldUseCredentialStorage):
845         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
846         (WKBundlePageSetResourceLoadClient):
847         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
848         (setUpResourceLoadClient):
849         (-[WKWebProcessPlugInBrowserContextController setLoadDelegate:]):
850         * WebProcess/InjectedBundle/InjectedBundlePageResourceLoadClient.cpp:
851         (WebKit::InjectedBundlePageResourceLoadClient::InjectedBundlePageResourceLoadClient):
852         (WebKit::InjectedBundlePageResourceLoadClient::didInitiateLoadForResource):
853         (WebKit::InjectedBundlePageResourceLoadClient::willSendRequestForFrame):
854         (WebKit::InjectedBundlePageResourceLoadClient::didReceiveResponseForResource):
855         (WebKit::InjectedBundlePageResourceLoadClient::didReceiveContentLengthForResource):
856         (WebKit::InjectedBundlePageResourceLoadClient::didFinishLoadForResource):
857         (WebKit::InjectedBundlePageResourceLoadClient::didFailLoadForResource):
858         (WebKit::InjectedBundlePageResourceLoadClient::shouldCacheResponse):
859         (WebKit::InjectedBundlePageResourceLoadClient::shouldUseCredentialStorage):
860         * WebProcess/InjectedBundle/InjectedBundlePageResourceLoadClient.h:
861         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
862         (WebKit::WebFrameLoaderClient::assignIdentifierToInitialRequest):
863         (WebKit::WebFrameLoaderClient::dispatchWillSendRequest):
864         (WebKit::WebFrameLoaderClient::shouldUseCredentialStorage):
865         (WebKit::WebFrameLoaderClient::dispatchDidReceiveResponse):
866         (WebKit::WebFrameLoaderClient::dispatchDidReceiveContentLength):
867         (WebKit::WebFrameLoaderClient::dispatchDidFinishLoading):
868         (WebKit::WebFrameLoaderClient::dispatchDidFailLoading):
869         (WebKit::WebFrameLoaderClient::willCacheResponse):
870         * WebProcess/WebPage/WebPage.cpp:
871         (WebKit::WebPage::setInjectedBundleResourceLoadClient):
872         (WebKit::WebPage::close):
873         * WebProcess/WebPage/WebPage.h:
874         (WebKit::WebPage::injectedBundleResourceLoadClient):
875
876 2017-06-14  Carlos Garcia Campos  <cgarcia@igalia.com>
877
878         [GTK] Use API::InjectedBundle::Client in WebKitWebExtension
879         https://bugs.webkit.org/show_bug.cgi?id=173358
880
881         Reviewed by Michael Catanzaro.
882
883         Instead of the C API.
884
885         * WebProcess/InjectedBundle/API/gtk/WebKitWebExtension.cpp:
886         (webkitWebExtensionCreate):
887         (webkitWebExtensionPageCreated): Deleted.
888         (webkitWebExtensionPageDestroy): Deleted.
889         (webkitWebExtensionDidReceiveMessage): Deleted.
890         (didCreatePage): Deleted.
891         (willDestroyPage): Deleted.
892         (didReceiveMessage): Deleted.
893         (didReceiveMessageToPage): Deleted.
894
895 2017-06-14  Carlos Garcia Campos  <cgarcia@igalia.com>
896
897         Add API::InjectedBundle::Client
898         https://bugs.webkit.org/show_bug.cgi?id=173357
899
900         Reviewed by Alex Christensen.
901
902         It will be used by the GTK+ port instead of the C API.
903
904         * WebKit2.xcodeproj/project.pbxproj:
905         * WebProcess/InjectedBundle/API/APIInjectedBundleBundleClient.h: Copied from Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleClient.h.
906         (API::InjectedBundle::Client::didCreatePage):
907         (API::InjectedBundle::Client::willDestroyPage):
908         (API::InjectedBundle::Client::didInitializePageGroup):
909         (API::InjectedBundle::Client::didReceiveMessage):
910         (API::InjectedBundle::Client::didReceiveMessageToPage):
911         * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
912         (WKBundleSetClient):
913         * WebProcess/InjectedBundle/API/gtk/WebKitWebExtension.cpp:
914         (webkitWebExtensionPageCreated): Deleted.
915         (webkitWebExtensionPageDestroy): Deleted.
916         (webkitWebExtensionDidReceiveMessage): Deleted.
917         (didCreatePage): Deleted.
918         (willDestroyPage): Deleted.
919         (didReceiveMessage): Deleted.
920         (didReceiveMessageToPage): Deleted.
921         * WebProcess/InjectedBundle/InjectedBundle.cpp:
922         (WebKit::InjectedBundle::setClient):
923         (WebKit::InjectedBundle::didCreatePage):
924         (WebKit::InjectedBundle::willDestroyPage):
925         (WebKit::InjectedBundle::didInitializePageGroup):
926         (WebKit::InjectedBundle::didReceiveMessage):
927         (WebKit::InjectedBundle::didReceiveMessageToPage):
928         * WebProcess/InjectedBundle/InjectedBundle.h:
929         * WebProcess/InjectedBundle/InjectedBundleClient.cpp:
930         (WebKit::InjectedBundleClient::InjectedBundleClient):
931         (WebKit::InjectedBundleClient::didCreatePage):
932         (WebKit::InjectedBundleClient::willDestroyPage):
933         (WebKit::InjectedBundleClient::didInitializePageGroup):
934         (WebKit::InjectedBundleClient::didReceiveMessage):
935         (WebKit::InjectedBundleClient::didReceiveMessageToPage):
936         * WebProcess/InjectedBundle/InjectedBundleClient.h:
937
938 2017-06-14  Carlos Garcia Campos  <cgarcia@igalia.com>
939
940         [GTK] Use API::InjectedBundleClient in WebKitInjectedBundleClient
941         https://bugs.webkit.org/show_bug.cgi?id=173351
942
943         Reviewed by Michael Catanzaro.
944
945         Instead of the C API.
946
947         * UIProcess/API/gtk/WebKitInjectedBundleClient.cpp:
948         (attachInjectedBundleClientToContext):
949         (didReceiveWebViewMessageFromInjectedBundle): Deleted.
950         (didReceiveMessageFromInjectedBundle): Deleted.
951         (getInjectedBundleInitializationUserData): Deleted.
952
953 2017-06-14  Carlos Garcia Campos  <cgarcia@igalia.com>
954
955         Add API::InjectedBundleClient
956         https://bugs.webkit.org/show_bug.cgi?id=173350
957
958         Reviewed by Alex Christensen.
959
960         It will be used by the GTK+ port instead of the C API.
961
962         * UIProcess/API/APIInjectedBundleClient.h: Copied from Source/WebKit2/UIProcess/WebContextInjectedBundleClient.h.
963         (API::InjectedBundleClient::didReceiveMessageFromInjectedBundle):
964         (API::InjectedBundleClient::didReceiveSynchronousMessageFromInjectedBundle):
965         (API::InjectedBundleClient::getInjectedBundleInitializationUserData):
966         * UIProcess/API/C/WKContext.cpp:
967         (WKContextSetInjectedBundleClient):
968         * UIProcess/API/gtk/WebKitWebContext.cpp:
969         (webkitWebContextDispose):
970         * UIProcess/WebContextInjectedBundleClient.cpp:
971         (WebKit::WebContextInjectedBundleClient::WebContextInjectedBundleClient):
972         (WebKit::WebContextInjectedBundleClient::didReceiveMessageFromInjectedBundle):
973         (WebKit::WebContextInjectedBundleClient::didReceiveSynchronousMessageFromInjectedBundle):
974         (WebKit::WebContextInjectedBundleClient::getInjectedBundleInitializationUserData):
975         * UIProcess/WebContextInjectedBundleClient.h:
976         * UIProcess/WebProcessPool.cpp:
977         (WebKit::WebProcessPool::WebProcessPool):
978         (WebKit::WebProcessPool::setInjectedBundleClient):
979         (WebKit::WebProcessPool::createNewWebProcess):
980         (WebKit::WebProcessPool::handleMessage):
981         (WebKit::WebProcessPool::handleSynchronousMessage):
982         * UIProcess/WebProcessPool.h:
983         * WebKit2.xcodeproj/project.pbxproj:
984
985 2017-06-14  Carlos Garcia Campos  <cgarcia@igalia.com>
986
987         Add API::NotificationProvider
988         https://bugs.webkit.org/show_bug.cgi?id=173309
989
990         Reviewed by Alex Christensen.
991
992         It will be used by the GTK+ port instead of the C API.
993
994         * UIProcess/API/APINotificationProvider.h: Copied from Source/WebKit2/UIProcess/Notifications/WebNotificationProvider.h.
995         (API::NotificationProvider::show):
996         (API::NotificationProvider::cancel):
997         (API::NotificationProvider::didDestroyNotification):
998         (API::NotificationProvider::clearNotifications):
999         (API::NotificationProvider::addNotificationManager):
1000         (API::NotificationProvider::removeNotificationManager):
1001         (API::NotificationProvider::notificationPermissions):
1002         * UIProcess/API/C/WKNotificationManager.cpp:
1003         (WKNotificationManagerSetProvider):
1004         * UIProcess/Notifications/WebNotificationManagerProxy.cpp:
1005         (WebKit::WebNotificationManagerProxy::WebNotificationManagerProxy):
1006         (WebKit::WebNotificationManagerProxy::setProvider):
1007         (WebKit::WebNotificationManagerProxy::processPoolDestroyed):
1008         (WebKit::WebNotificationManagerProxy::notificationPermissions):
1009         (WebKit::WebNotificationManagerProxy::show):
1010         (WebKit::WebNotificationManagerProxy::cancel):
1011         (WebKit::WebNotificationManagerProxy::didDestroyNotification):
1012         (WebKit::WebNotificationManagerProxy::clearNotifications):
1013         * UIProcess/Notifications/WebNotificationManagerProxy.h:
1014         * UIProcess/Notifications/WebNotificationProvider.cpp:
1015         (WebKit::WebNotificationProvider::WebNotificationProvider):
1016         (WebKit::WebNotificationProvider::show):
1017         (WebKit::WebNotificationProvider::cancel):
1018         (WebKit::WebNotificationProvider::didDestroyNotification):
1019         (WebKit::WebNotificationProvider::addNotificationManager):
1020         (WebKit::WebNotificationProvider::removeNotificationManager):
1021         (WebKit::WebNotificationProvider::notificationPermissions):
1022         * UIProcess/Notifications/WebNotificationProvider.h:
1023         * UIProcess/WebProcessPool.cpp:
1024         (WebKit::WebProcessPool::createNewWebProcess):
1025         * WebKit2.xcodeproj/project.pbxproj:
1026
1027 2017-06-14  Carlos Garcia Campos  <cgarcia@igalia.com>
1028
1029         API clients should not be passed by value to the setters
1030         https://bugs.webkit.org/show_bug.cgi?id=173266
1031
1032         Reviewed by Alex Christensen.
1033
1034         By using a rvalue reference we make it more explicit that the ownership is transferred and we avoid the
1035         parameter construction.
1036
1037         * UIProcess/Automation/WebAutomationSession.cpp:
1038         (WebKit::WebAutomationSession::setClient):
1039         * UIProcess/Automation/WebAutomationSession.h:
1040         * UIProcess/WebGeolocationManagerProxy.cpp:
1041         (WebKit::WebGeolocationManagerProxy::setProvider):
1042         * UIProcess/WebGeolocationManagerProxy.h:
1043         * UIProcess/WebIconDatabase.cpp:
1044         (WebKit::WebIconDatabase::setClient):
1045         * UIProcess/WebIconDatabase.h:
1046         * UIProcess/WebPageProxy.cpp:
1047         (WebKit::WebPageProxy::WebPageProxy):
1048         (WebKit::WebPageProxy::setHistoryClient):
1049         (WebKit::WebPageProxy::setNavigationClient):
1050         (WebKit::WebPageProxy::setLoaderClient):
1051         (WebKit::WebPageProxy::setPolicyClient):
1052         (WebKit::WebPageProxy::setFormClient):
1053         (WebKit::WebPageProxy::setUIClient):
1054         (WebKit::WebPageProxy::setIconLoadingClient):
1055         (WebKit::WebPageProxy::setFindClient):
1056         (WebKit::WebPageProxy::setFindMatchesClient):
1057         (WebKit::WebPageProxy::setDiagnosticLoggingClient):
1058         (WebKit::WebPageProxy::setContextMenuClient):
1059         (WebKit::WebPageProxy::close):
1060         (WebKit::WebPageProxy::setFullscreenClient):
1061         (WebKit::WebPageProxy::getLoadDecisionForIcon):
1062         * UIProcess/WebPageProxy.h:
1063         * UIProcess/WebProcessPool.cpp:
1064         (WebKit::WebProcessPool::setHistoryClient):
1065         (WebKit::WebProcessPool::setDownloadClient):
1066         (WebKit::WebProcessPool::setAutomationClient):
1067         * UIProcess/WebProcessPool.h:
1068         * WebProcess/WebPage/WebPage.cpp:
1069         (WebKit::WebPage::setInjectedBundleContextMenuClient):
1070         (WebKit::WebPage::setInjectedBundleEditorClient):
1071         (WebKit::WebPage::setInjectedBundleFormClient):
1072         (WebKit::WebPage::setInjectedBundlePageLoaderClient):
1073         (WebKit::WebPage::setInjectedBundleUIClient):
1074         * WebProcess/WebPage/WebPage.h:
1075
1076 2017-06-14  Carlos Garcia Campos  <cgarcia@igalia.com>
1077
1078         [GTK] Use API::InjectedBundle::EditorClient in WebKitWebEditor
1079         https://bugs.webkit.org/show_bug.cgi?id=173355
1080
1081         Reviewed by Žan Doberšek.
1082
1083         Instead of the C API.
1084
1085         * WebProcess/InjectedBundle/API/gtk/WebKitWebEditor.cpp:
1086         (webkitWebEditorCreate):
1087         (didChangeSelection): Deleted.
1088
1089 2017-06-14  Carlos Garcia Campos  <cgarcia@igalia.com>
1090
1091         Unreviewed. Fix GTK+ build with GCC 4.9 after r218244.
1092
1093         It seems that GCC 4.9 gets confused by enum named General and value of Print enum named General too. This
1094         renames the Print enum value as Generic.
1095
1096         * Shared/API/APIError.h:
1097         * Shared/gtk/WebErrorsGtk.cpp:
1098         (WebKit::printError):
1099         * UIProcess/API/gtk/WebKitPrivate.cpp:
1100         (toWebKitError):
1101         (toWebCoreError):
1102
1103 2017-06-13  Carlos Garcia Campos  <cgarcia@igalia.com>
1104
1105         Do not mix C and C++ API error constants
1106         https://bugs.webkit.org/show_bug.cgi?id=173311
1107
1108         Reviewed by Alex Christensen.
1109
1110         In r214934 I added error constants to API::Error, but not for all errors exposed in the C API. Because of this
1111         we are mixing both constants in WebErrors and in GTk+ WebKitPrivate.
1112
1113         * Shared/API/APIError.h:
1114         * Shared/WebErrors.cpp:
1115         (WebKit::blockedError):
1116         (WebKit::blockedByContentBlockerError):
1117         (WebKit::cannotShowURLError):
1118         (WebKit::interruptedForPolicyChangeError):
1119         (WebKit::blockedByContentFilterError):
1120         (WebKit::cannotShowMIMETypeError):
1121         (WebKit::pluginWillHandleLoadError):
1122         (WebKit::internalError):
1123         * UIProcess/API/gtk/WebKitPrivate.cpp:
1124         (toWebKitError):
1125         (toWebCoreError):
1126
1127 2017-06-13  Matt Rajca  <mrajca@apple.com>
1128
1129         WebsitePolicies: let clients select specific autoplay quirks
1130         https://bugs.webkit.org/show_bug.cgi?id=173343
1131
1132         Reviewed by Alex Christensen.
1133         
1134         Replace the 'allowsAutoplayQuirks' bool with an OptionSet so clients can selectively
1135         pick auto-play quirks.
1136
1137         * Shared/WebsitePolicies.h:
1138         (WebKit::WebsitePolicies::encode):
1139         (WebKit::WebsitePolicies::decode):
1140         * UIProcess/API/APIWebsitePolicies.h:
1141         * UIProcess/API/C/WKWebsitePolicies.cpp:
1142         (WKWebsitePoliciesSetAllowedAutoplayQuirks):
1143         (WKWebsitePoliciesGetAllowedAutoplayQuirks):
1144         (WKWebsitePoliciesSetAllowsAutoplayQuirks): Deleted.
1145         (WKWebsitePoliciesGetAllowsAutoplayQuirks): Deleted.
1146         * UIProcess/API/C/WKWebsitePolicies.h:
1147         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
1148         * UIProcess/API/Cocoa/_WKWebsitePolicies.mm:
1149         (-[_WKWebsitePolicies setAllowedAutoplayQuirks:]):
1150         (-[_WKWebsitePolicies allowedAutoplayQuirks]):
1151         (-[_WKWebsitePolicies setAllowsAutoplayQuirks:]): Deleted.
1152         (-[_WKWebsitePolicies allowsAutoplayQuirks]): Deleted.
1153         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1154         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
1155         * WebProcess/WebPage/WebPage.cpp:
1156         (WebKit::WebPage::updateWebsitePolicies):
1157
1158 2017-06-13  Wenson Hsieh  <wenson_hsieh@apple.com>
1159
1160         Add missing availability declarations to SPI in WKUIDelegatePrivate.h
1161         https://bugs.webkit.org/show_bug.cgi?id=173336
1162
1163         Reviewed by Tim Horton.
1164
1165         Add missing availability macros to two recently-introduced SPI delegate methods.
1166         No change in behavior.
1167
1168         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
1169
1170 2017-06-13  Chris Dumez  <cdumez@apple.com>
1171
1172         Add API::InjectedBundle::PageLoaderClient
1173         https://bugs.webkit.org/show_bug.cgi?id=173265
1174
1175         Reviewed by Alex Christensen.
1176
1177         Add missing null check that is causing crashes on iOS.
1178
1179         * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp:
1180         (WebKit::InjectedBundlePageLoaderClient::userAgentForURL):
1181
1182 2017-06-13  Brent Fulgham  <bfulgham@apple.com>
1183
1184         [WK2][macOS] Allow AppleEvents in Citrix View Plugin
1185         https://bugs.webkit.org/show_bug.cgi?id=173280
1186         <rdar://problem/31913624>
1187
1188         Reviewed by Alexey Proskuryakov.
1189
1190         A slightly better fix: Allow AppleEvents for non-sandboxed plugins. This should
1191         avoid inadvertently breaking custom plugins, etc.
1192
1193         * PluginProcess/mac/PluginProcessMac.mm:
1194         (WebKit::PluginProcess::platformInitializeProcess): Switch check from a specific Citrix
1195         test, to just allowing non-sandboxed plugins to use AppleEvents.
1196
1197 2017-06-13  Chris Dumez  <cdumez@apple.com>
1198
1199         Include PID in some UIProcess-side release logging that relates to a particular WebProcess
1200         https://bugs.webkit.org/show_bug.cgi?id=173299
1201
1202         Reviewed by Ryosuke Niwa.
1203
1204         * UIProcess/BackgroundProcessResponsivenessTimer.cpp:
1205         (WebKit::BackgroundProcessResponsivenessTimer::setResponsive):
1206         * UIProcess/WebProcessProxy.cpp:
1207         (WebKit::WebProcessProxy::didExceedActiveMemoryLimit):
1208         (WebKit::WebProcessProxy::didExceedInactiveMemoryLimit):
1209         (WebKit::WebProcessProxy::didExceedCPULimit):
1210
1211 2017-06-13  Daniel Bates  <dabates@apple.com>
1212
1213         Implement W3C Secure Contexts Draft Specification
1214         https://bugs.webkit.org/show_bug.cgi?id=158121
1215         <rdar://problem/26012994>
1216
1217         Reviewed by Brent Fulgham.
1218
1219         Part 4
1220
1221         Adds a preference to toggle the runtime enabled feature flag isSecureContextAttributeEnabled.
1222
1223         * Shared/WebPreferencesDefinitions.h:
1224         * UIProcess/API/C/WKPreferences.cpp:
1225         (WKPreferencesSetIsSecureContextAttributeEnabled):
1226         (WKPreferencesGetIsSecureContextAttributeEnabled):
1227         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1228         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1229         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
1230         * WebProcess/WebPage/WebPage.cpp:
1231         (WebKit::WebPage::updatePreferences):
1232
1233 2017-06-13  Brent Fulgham  <bfulgham@apple.com>
1234
1235         [WK2][macOS] Allow AppleEvents in Citrix View Plugin
1236         https://bugs.webkit.org/show_bug.cgi?id=173280
1237         <rdar://problem/31913624>
1238
1239         Reviewed by Alexey Proskuryakov.
1240
1241         Allow the Citrix Viewer plugin to issue Apple Events.
1242
1243         * PluginProcess/mac/PluginProcessMac.mm:
1244         (WebKit::PluginProcess::platformInitializeProcess): Allow AppleEvents for the Citrix Viewer plugin.
1245
1246 2017-06-13  Carlos Garcia Campos  <cgarcia@igalia.com>
1247
1248         [GTK] Blob download doesn't work
1249         https://bugs.webkit.org/show_bug.cgi?id=172442
1250
1251         Reviewed by Carlos Alberto Lopez Perez.
1252
1253         GTK+ API uses URIs for download destination paths, and passes that URIs to the WebKit internals. But WebKit
1254         expects download destination location to be a local path. This is not a problem for normal downloads, because
1255         the soup backend handles the cases of download destination being a URI and a path. For blob downloads
1256         NetworkDataTaskBlob is used, and it always expects the download destination to be a local path, failing in
1257         FileSystem::openFile() when a URI is passed. We need to keep using local files internally and convert to URIs
1258         only when exposing those paths to the API.
1259
1260         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
1261         (WebKit::NetworkDataTaskSoup::download): Stop handling URIs here, we should always expect local files.
1262         * UIProcess/API/gtk/WebKitDownload.cpp:
1263         (webkitDownloadDecideDestinationWithSuggestedFilename): Convert destination URI to filanme before pasing it to DownloadClient.
1264         (webkitDownloadDestinationCreated): Convert the destination path to a URI before passing it to WebKitDownload::created-destionation signal.
1265         * UIProcess/API/gtk/WebKitDownloadClient.cpp:
1266         * UIProcess/API/gtk/WebKitDownloadPrivate.h:
1267
1268 2017-06-13  Wenson Hsieh  <wenson_hsieh@apple.com>
1269
1270         Unable to paste text that was copied from a page into the universal search field
1271         https://bugs.webkit.org/show_bug.cgi?id=173293
1272         <rdar://problem/32440918>
1273
1274         Reviewed by Ryosuke Niwa.
1275
1276         Add boilerplate SPI on WKPreferences to enable JavaScript access to copy and paste.
1277
1278         * UIProcess/API/Cocoa/WKPreferences.mm:
1279         (-[WKPreferences _setJavaScriptCanAccessClipboard:]):
1280         (-[WKPreferences _javaScriptCanAccessClipboard]):
1281         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
1282
1283 2017-06-13  Sam Weinig  <sam@webkit.org>
1284
1285         Rename JSDOMWindowShell to JSDOMWindowProxy to match the HTML5 spec.
1286         https://bugs.webkit.org/show_bug.cgi?id=80733
1287
1288         Reviewed by Chris Dumez.
1289
1290         * WebProcess/Plugins/PluginView.cpp:
1291         (WebKit::PluginView::windowScriptNPObject):
1292
1293 2017-06-13  Carlos Garcia Campos  <cgarcia@igalia.com>
1294
1295         Unreviewed. Remove unused code from GTK+ WebKitPrivate.
1296
1297         * UIProcess/API/gtk/WebKitPrivate.cpp:
1298         (wkEventModifiersToGdkModifiers): Deleted.
1299         (wkEventMouseButtonToWebKitMouseButton): Deleted.
1300         * UIProcess/API/gtk/WebKitPrivate.h:
1301
1302 2017-06-13  Carlos Garcia Campos  <cgarcia@igalia.com>
1303
1304         Unreviewed. Fix return value of PageLoaderClient::shouldGoToBackForwardListItem after r218164.
1305
1306         It should return true as InjectedBundlePageLoaderClient does. This caused several timeouts in GTK+ unit tests
1307         after r218171.
1308
1309         * WebProcess/InjectedBundle/API/APIInjectedBundlePageLoaderClient.h:
1310         (API::InjectedBundle::PageLoaderClient::shouldGoToBackForwardListItem):
1311
1312 2017-06-13  Carlos Garcia Campos  <cgarcia@igalia.com>
1313
1314         [GTK] Use API::GeolocationProvider in WebKitGeolocationProvider
1315         https://bugs.webkit.org/show_bug.cgi?id=173151
1316
1317         Reviewed by Žan Doberšek.
1318
1319         Also cleanup a bit the WebKitGeolocationProvider implementation, it doesn't need to be refcounted.
1320
1321         * UIProcess/API/gtk/WebKitGeolocationProvider.cpp:
1322         (WebKit::GeolocationProvider::GeolocationProvider):
1323         (WebKit::WebKitGeolocationProvider::~WebKitGeolocationProvider):
1324         (WebKit::WebKitGeolocationProvider::WebKitGeolocationProvider):
1325         (toGeolocationProvider): Deleted.
1326         (startUpdatingCallback): Deleted.
1327         (stopUpdatingCallback): Deleted.
1328         (WebKitGeolocationProvider::~WebKitGeolocationProvider): Deleted.
1329         (WebKitGeolocationProvider::create): Deleted.
1330         (WebKitGeolocationProvider::WebKitGeolocationProvider): Deleted.
1331         (WebKitGeolocationProvider::startUpdating): Deleted.
1332         (WebKitGeolocationProvider::stopUpdating): Deleted.
1333         (WebKitGeolocationProvider::notifyPositionChanged): Deleted.
1334         (WebKitGeolocationProvider::notifyErrorOccurred): Deleted.
1335         * UIProcess/API/gtk/WebKitGeolocationProvider.h:
1336         * UIProcess/API/gtk/WebKitWebContext.cpp:
1337         (webkitWebContextConstructed):
1338
1339 2017-06-13  Carlos Garcia Campos  <cgarcia@igalia.com>
1340
1341         [GTK] Use API::IconDatabaseClient in WebKitFaviconDatabase
1342         https://bugs.webkit.org/show_bug.cgi?id=173146
1343
1344         Reviewed by Žan Doberšek.
1345
1346         * UIProcess/API/gtk/WebKitFaviconDatabase.cpp:
1347         (_WebKitFaviconDatabasePrivate::~_WebKitFaviconDatabasePrivate):
1348         (webkitFaviconDatabaseCreate):
1349         (didChangeIconForPageURLCallback): Deleted.
1350         (iconDataReadyForPageURLCallback): Deleted.
1351
1352 2017-06-13  Carlos Garcia Campos  <cgarcia@igalia.com>
1353
1354         [GTK] Use API::InjectedBundle::PageLoaderClient in WebKitWebPage
1355         https://bugs.webkit.org/show_bug.cgi?id=173304
1356
1357         Reviewed by Alex Christensen.
1358
1359         * WebProcess/InjectedBundle/API/gtk/WebKitWebPage.cpp:
1360         (webkitWebPageCreate):
1361         (getDocumentLoaderURL): Deleted.
1362         (didStartProvisionalLoadForFrame): Deleted.
1363         (didReceiveServerRedirectForProvisionalLoadForFrame): Deleted.
1364         (didSameDocumentNavigationForFrame): Deleted.
1365         (didCommitLoadForFrame): Deleted.
1366         (didFinishDocumentLoadForFrame): Deleted.
1367         (didClearWindowObjectForFrame): Deleted.
1368
1369 2017-06-13  Gwang Yoon Hwang  <yoon@igalia.com>
1370
1371         [GStreamerGL] Release GstVideoFrame when there is a flush event from the pipeline
1372         https://bugs.webkit.org/show_bug.cgi?id=172427
1373
1374         Reviewed by Žan Doberšek.
1375
1376         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
1377         (WebKit::CoordinatedGraphicsScene::texmapGL):
1378         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
1379         Provides current texmapGL to platform layer proxies to create and copy
1380         bitmap textures.
1381
1382 2017-06-13  Youenn Fablet  <youenn@apple.com>
1383
1384         Switch off Legacy WebRTC API flag by default
1385         https://bugs.webkit.org/show_bug.cgi?id=173241
1386
1387         Reviewed by Sam Weinig.
1388
1389         * Shared/WebPreferencesDefinitions.h:
1390
1391 2017-06-12  Carlos Garcia Campos  <cgarcia@igalia.com>
1392
1393         Add API::GeolocationProvider
1394         https://bugs.webkit.org/show_bug.cgi?id=173150
1395
1396         Reviewed by Alex Christensen.
1397
1398         It will be used by GTK+ port instead of the C API.
1399
1400         * UIProcess/API/APIGeolocationProvider.h: Added.
1401         (API::GeolocationProvider::~GeolocationProvider):
1402         (API::GeolocationProvider::startUpdating):
1403         (API::GeolocationProvider::stopUpdating):
1404         (API::GeolocationProvider::setEnableHighAccuracy):
1405         * UIProcess/API/C/WKGeolocationManager.cpp:
1406         (WKGeolocationManagerSetProvider):
1407         * UIProcess/WebGeolocationManagerProxy.cpp:
1408         (WebKit::WebGeolocationManagerProxy::WebGeolocationManagerProxy):
1409         (WebKit::WebGeolocationManagerProxy::setProvider):
1410         (WebKit::WebGeolocationManagerProxy::processPoolDestroyed):
1411         (WebKit::WebGeolocationManagerProxy::startUpdating):
1412         (WebKit::WebGeolocationManagerProxy::removeRequester):
1413         (WebKit::WebGeolocationManagerProxy::setEnableHighAccuracy):
1414         * UIProcess/WebGeolocationManagerProxy.h:
1415         * UIProcess/WebGeolocationProvider.cpp:
1416         (WebKit::WebGeolocationProvider::WebGeolocationProvider):
1417         (WebKit::WebGeolocationProvider::startUpdating):
1418         (WebKit::WebGeolocationProvider::stopUpdating):
1419         (WebKit::WebGeolocationProvider::setEnableHighAccuracy):
1420         * UIProcess/WebGeolocationProvider.h:
1421         * WebKit2.xcodeproj/project.pbxproj:
1422
1423 2017-06-12  Carlos Garcia Campos  <cgarcia@igalia.com>
1424
1425         Add API::InjectedBundle::PageLoaderClient
1426         https://bugs.webkit.org/show_bug.cgi?id=173265
1427
1428         Reviewed by Alex Christensen.
1429
1430         It will be used by the GTK+ port instead of the C API.
1431
1432         * WebKit2.xcodeproj/project.pbxproj:
1433         * WebProcess/InjectedBundle/API/APIInjectedBundlePageLoaderClient.h: Added.
1434         (API::InjectedBundle::PageLoaderClient::willLoadURLRequest):
1435         (API::InjectedBundle::PageLoaderClient::willLoadDataRequest):
1436         (API::InjectedBundle::PageLoaderClient::shouldGoToBackForwardListItem):
1437         (API::InjectedBundle::PageLoaderClient::didStartProvisionalLoadForFrame):
1438         (API::InjectedBundle::PageLoaderClient::didReceiveServerRedirectForProvisionalLoadForFrame):
1439         (API::InjectedBundle::PageLoaderClient::didFailProvisionalLoadWithErrorForFrame):
1440         (API::InjectedBundle::PageLoaderClient::didCommitLoadForFrame):
1441         (API::InjectedBundle::PageLoaderClient::didFinishDocumentLoadForFrame):
1442         (API::InjectedBundle::PageLoaderClient::didFinishLoadForFrame):
1443         (API::InjectedBundle::PageLoaderClient::didFinishProgress):
1444         (API::InjectedBundle::PageLoaderClient::didFailLoadWithErrorForFrame):
1445         (API::InjectedBundle::PageLoaderClient::didSameDocumentNavigationForFrame):
1446         (API::InjectedBundle::PageLoaderClient::didReceiveTitleForFrame):
1447         (API::InjectedBundle::PageLoaderClient::didRemoveFrameFromHierarchy):
1448         (API::InjectedBundle::PageLoaderClient::didDisplayInsecureContentForFrame):
1449         (API::InjectedBundle::PageLoaderClient::didRunInsecureContentForFrame):
1450         (API::InjectedBundle::PageLoaderClient::didDetectXSSForFrame):
1451         (API::InjectedBundle::PageLoaderClient::didFirstLayoutForFrame):
1452         (API::InjectedBundle::PageLoaderClient::didFirstVisuallyNonEmptyLayoutForFrame):
1453         (API::InjectedBundle::PageLoaderClient::didLayoutForFrame):
1454         (API::InjectedBundle::PageLoaderClient::didReachLayoutMilestone):
1455         (API::InjectedBundle::PageLoaderClient::didClearWindowObjectForFrame):
1456         (API::InjectedBundle::PageLoaderClient::didCancelClientRedirectForFrame):
1457         (API::InjectedBundle::PageLoaderClient::willPerformClientRedirectForFrame):
1458         (API::InjectedBundle::PageLoaderClient::didHandleOnloadEventsForFrame):
1459         (API::InjectedBundle::PageLoaderClient::globalObjectIsAvailableForFrame):
1460         (API::InjectedBundle::PageLoaderClient::willDisconnectDOMWindowExtensionFromGlobalObject):
1461         (API::InjectedBundle::PageLoaderClient::didReconnectDOMWindowExtensionToGlobalObject):
1462         (API::InjectedBundle::PageLoaderClient::willDestroyGlobalObjectForDOMWindowExtension):
1463         (API::InjectedBundle::PageLoaderClient::shouldForceUniversalAccessFromLocalURL):
1464         (API::InjectedBundle::PageLoaderClient::featuresUsedInPage):
1465         (API::InjectedBundle::PageLoaderClient::willDestroyFrame):
1466         (API::InjectedBundle::PageLoaderClient::userAgentForURL):
1467         (API::InjectedBundle::PageLoaderClient::layoutMilestones):
1468         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
1469         (WKBundlePageSetPageLoaderClient):
1470         * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp:
1471         (WebKit::InjectedBundlePageLoaderClient::InjectedBundlePageLoaderClient):
1472         (WebKit::InjectedBundlePageLoaderClient::willLoadURLRequest):
1473         (WebKit::InjectedBundlePageLoaderClient::willLoadDataRequest):
1474         (WebKit::InjectedBundlePageLoaderClient::shouldGoToBackForwardListItem):
1475         (WebKit::InjectedBundlePageLoaderClient::didStartProvisionalLoadForFrame):
1476         (WebKit::InjectedBundlePageLoaderClient::didReceiveServerRedirectForProvisionalLoadForFrame):
1477         (WebKit::InjectedBundlePageLoaderClient::didFailProvisionalLoadWithErrorForFrame):
1478         (WebKit::InjectedBundlePageLoaderClient::didCommitLoadForFrame):
1479         (WebKit::InjectedBundlePageLoaderClient::didFinishDocumentLoadForFrame):
1480         (WebKit::InjectedBundlePageLoaderClient::didFinishLoadForFrame):
1481         (WebKit::InjectedBundlePageLoaderClient::didFinishProgress):
1482         (WebKit::InjectedBundlePageLoaderClient::didFailLoadWithErrorForFrame):
1483         (WebKit::InjectedBundlePageLoaderClient::didSameDocumentNavigationForFrame):
1484         (WebKit::InjectedBundlePageLoaderClient::didReceiveTitleForFrame):
1485         (WebKit::InjectedBundlePageLoaderClient::didRemoveFrameFromHierarchy):
1486         (WebKit::InjectedBundlePageLoaderClient::didDisplayInsecureContentForFrame):
1487         (WebKit::InjectedBundlePageLoaderClient::didRunInsecureContentForFrame):
1488         (WebKit::InjectedBundlePageLoaderClient::didDetectXSSForFrame):
1489         (WebKit::InjectedBundlePageLoaderClient::didFirstLayoutForFrame):
1490         (WebKit::InjectedBundlePageLoaderClient::didFirstVisuallyNonEmptyLayoutForFrame):
1491         (WebKit::InjectedBundlePageLoaderClient::didLayoutForFrame):
1492         (WebKit::InjectedBundlePageLoaderClient::didReachLayoutMilestone):
1493         (WebKit::InjectedBundlePageLoaderClient::didClearWindowObjectForFrame):
1494         (WebKit::InjectedBundlePageLoaderClient::didCancelClientRedirectForFrame):
1495         (WebKit::InjectedBundlePageLoaderClient::willPerformClientRedirectForFrame):
1496         (WebKit::InjectedBundlePageLoaderClient::didHandleOnloadEventsForFrame):
1497         (WebKit::InjectedBundlePageLoaderClient::globalObjectIsAvailableForFrame):
1498         (WebKit::InjectedBundlePageLoaderClient::willDisconnectDOMWindowExtensionFromGlobalObject):
1499         (WebKit::InjectedBundlePageLoaderClient::didReconnectDOMWindowExtensionToGlobalObject):
1500         (WebKit::InjectedBundlePageLoaderClient::willDestroyGlobalObjectForDOMWindowExtension):
1501         (WebKit::InjectedBundlePageLoaderClient::shouldForceUniversalAccessFromLocalURL):
1502         (WebKit::InjectedBundlePageLoaderClient::featuresUsedInPage):
1503         (WebKit::InjectedBundlePageLoaderClient::userAgentForURL):
1504         (WebKit::InjectedBundlePageLoaderClient::layoutMilestones):
1505         * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h:
1506         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1507         (WebKit::WebFrameLoaderClient::detachedFromParent2):
1508         (WebKit::WebFrameLoaderClient::dispatchDidDispatchOnloadEvents):
1509         (WebKit::WebFrameLoaderClient::dispatchDidReceiveServerRedirectForProvisionalLoad):
1510         (WebKit::WebFrameLoaderClient::dispatchDidCancelClientRedirect):
1511         (WebKit::WebFrameLoaderClient::dispatchWillPerformClientRedirect):
1512         (WebKit::WebFrameLoaderClient::dispatchDidChangeLocationWithinPage):
1513         (WebKit::WebFrameLoaderClient::dispatchDidPushStateWithinPage):
1514         (WebKit::WebFrameLoaderClient::dispatchDidReplaceStateWithinPage):
1515         (WebKit::WebFrameLoaderClient::dispatchDidPopStateWithinPage):
1516         (WebKit::WebFrameLoaderClient::dispatchDidStartProvisionalLoad):
1517         (WebKit::WebFrameLoaderClient::dispatchDidReceiveTitle):
1518         (WebKit::WebFrameLoaderClient::dispatchDidCommitLoad):
1519         (WebKit::WebFrameLoaderClient::dispatchDidFailProvisionalLoad):
1520         (WebKit::WebFrameLoaderClient::dispatchDidFailLoad):
1521         (WebKit::WebFrameLoaderClient::dispatchDidFinishDocumentLoad):
1522         (WebKit::WebFrameLoaderClient::dispatchDidFinishLoad):
1523         (WebKit::WebFrameLoaderClient::dispatchDidReachLayoutMilestone):
1524         (WebKit::WebFrameLoaderClient::dispatchDidLayout):
1525         (WebKit::WebFrameLoaderClient::shouldGoToHistoryItem):
1526         (WebKit::WebFrameLoaderClient::didDisplayInsecureContent):
1527         (WebKit::WebFrameLoaderClient::didRunInsecureContent):
1528         (WebKit::WebFrameLoaderClient::didDetectXSS):
1529         (WebKit::WebFrameLoaderClient::dispatchDidClearWindowObjectInWorld):
1530         (WebKit::WebFrameLoaderClient::dispatchGlobalObjectAvailable):
1531         (WebKit::WebFrameLoaderClient::dispatchWillDisconnectDOMWindowExtensionFromGlobalObject):
1532         (WebKit::WebFrameLoaderClient::dispatchDidReconnectDOMWindowExtensionToGlobalObject):
1533         (WebKit::WebFrameLoaderClient::dispatchWillDestroyGlobalObjectForDOMWindowExtension):
1534         (WebKit::WebFrameLoaderClient::shouldForceUniversalAccessFromLocalURL):
1535         * WebProcess/WebCoreSupport/WebProgressTrackerClient.cpp:
1536         (WebKit::WebProgressTrackerClient::progressFinished):
1537         * WebProcess/WebPage/WebPage.cpp:
1538         (WebKit::WebPage::setInjectedBundlePageLoaderClient):
1539         (WebKit::WebPage::close):
1540         (WebKit::WebPage::loadRequest):
1541         (WebKit::WebPage::loadDataImpl):
1542         (WebKit::WebPage::userAgent):
1543         (WebKit::WebPage::reportUsedFeatures):
1544         (WebKit::WebPage::dispatchDidReachLayoutMilestone):
1545         * WebProcess/WebPage/WebPage.h:
1546         (WebKit::WebPage::injectedBundleLoaderClient):
1547
1548 2017-06-12  Simon Fraser  <simon.fraser@apple.com>
1549
1550         [iOS WK2] Peeking on an image could result in a preview at the wrong size
1551         https://bugs.webkit.org/show_bug.cgi?id=173274
1552         rdar://problem/30404627
1553
1554         Reviewed by Tim Horton.
1555
1556         There were a couple of issues with the way the page scale is communicated between the web process
1557         and the UI process.
1558
1559         Generally, the page scale is computed by the web process, and sent to the UI process via
1560         layer tree commits. UI-side scale is them communicated back to the web process via visibleContentRect
1561         updates. When receiving a new scale, WebPage has a "scale was set by the UI process" flag to handle
1562         the case where user interaction overrides the viewport-computed page scale. However, this flag would
1563         get set erroneously in a couple of situations.
1564
1565         First, during page loading, layer flushing is suspended temporarily, so web process scale changes never
1566         make it to the UI process. In that scenario, the UI process could send an old scale back to the web process,
1567         setting the "scale was set by the UI process" when it really wasn't.
1568
1569         Secondly, web -> UI layer commit messages, and UI -> web updateVisibleContentRect messages can be in flight at the
1570         same time, again causing a stale scale to reach the web process.
1571
1572         Fix this by only setting the "scale was set by the UI process" when we know the UI scale should be in sync, by comparing
1573         commit IDs of sent and received scales.
1574
1575         * WebProcess/WebPage/WebPage.h:
1576         * WebProcess/WebPage/ios/WebPageIOS.mm:
1577         (WebKit::WebPage::scaleFromUIProcess):
1578         (WebKit::WebPage::updateVisibleContentRects):
1579         * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h:
1580         (WebKit::RemoteLayerTreeDrawingArea::lastCommittedTransactionID):
1581
1582 2017-06-12  Alex Christensen  <achristensen@webkit.org>
1583
1584         Modernize UserScript.h
1585         https://bugs.webkit.org/show_bug.cgi?id=173273
1586
1587         Reviewed by Tim Horton.
1588
1589         * Shared/WebCoreArgumentCoders.cpp:
1590         (IPC::ArgumentCoder<UserScript>::encode): Deleted.
1591         (IPC::ArgumentCoder<UserScript>::decode): Deleted.
1592         * Shared/WebCoreArgumentCoders.h:
1593         * UIProcess/API/C/WKPageGroup.cpp:
1594         (WKPageGroupAddUserScript):
1595         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1596         (WebKit::InjectedBundle::addUserScript):
1597         * WebProcess/InjectedBundle/InjectedBundle.h:
1598         * WebProcess/WebPage/WebPage.cpp:
1599         (WebKit::WebPage::addUserScript):
1600         * WebProcess/WebPage/WebPage.h:
1601
1602 2017-06-12  Tim Horton  <timothy_horton@apple.com>
1603
1604         [iOS] Cmd-C doesn't copy text from WKWebView
1605         https://bugs.webkit.org/show_bug.cgi?id=173277
1606         <rdar://problem/32396742>
1607
1608         Reviewed by Dan Bernstein.
1609
1610         * UIProcess/API/Cocoa/WKWebView.mm:
1611         * UIProcess/API/Cocoa/WKWebViewInternal.h:
1612         * UIProcess/ios/WKContentViewInteraction.h:
1613         * UIProcess/ios/WKContentViewInteraction.mm:
1614         (-[WKContentView _lookupForWebView:]):
1615         (-[WKContentView _shareForWebView:]):
1616         (-[WKContentView _addShortcutForWebView:]):
1617         (-[WKContentView _promptForReplaceForWebView:]):
1618         (-[WKContentView _transliterateChineseForWebView:]):
1619         (-[WKContentView _reanalyzeForWebView:]):
1620         (-[WKContentView replaceForWebView:]):
1621         (-[WKContentView canPerformAction:withSender:]):
1622         (-[WKContentView copyForWebView:]):
1623         (-[WKContentView cutForWebView:]):
1624         (-[WKContentView pasteForWebView:]):
1625         (-[WKContentView selectForWebView:]):
1626         (-[WKContentView selectAllForWebView:]):
1627         (-[WKContentView toggleBoldfaceForWebView:]):
1628         (-[WKContentView toggleItalicsForWebView:]):
1629         (-[WKContentView toggleUnderlineForWebView:]):
1630         (-[WKContentView _showTextStyleOptionsForWebView:]):
1631         (-[WKContentView _defineForWebView:]):
1632         (-[WKContentView _arrowKeyForWebView:]):
1633         (-[WKContentView _lookup:]): Deleted.
1634         (-[WKContentView _share:]): Deleted.
1635         (-[WKContentView _addShortcut:]): Deleted.
1636         (-[WKContentView _promptForReplace:]): Deleted.
1637         (-[WKContentView _transliterateChinese:]): Deleted.
1638         (-[WKContentView _reanalyze:]): Deleted.
1639         (-[WKContentView replace:]): Deleted.
1640         (-[WKContentView copy:]): Deleted.
1641         (-[WKContentView cut:]): Deleted.
1642         (-[WKContentView paste:]): Deleted.
1643         (-[WKContentView select:]): Deleted.
1644         (-[WKContentView selectAll:]): Deleted.
1645         (-[WKContentView toggleBoldface:]): Deleted.
1646         (-[WKContentView toggleItalics:]): Deleted.
1647         (-[WKContentView toggleUnderline:]): Deleted.
1648         (-[WKContentView _showTextStyleOptions:]): Deleted.
1649         (-[WKContentView _define:]): Deleted.
1650         (-[WKContentView _arrowKey:]): Deleted.
1651         Similar to what r211897 did for canPerformAction, and other patches
1652         have done for other selectors, forward methods for standard editing
1653         commands from WKContentView up to WKWebView, and back down to WKContentView.
1654
1655         This is necessary because these are not treated as normal
1656         responder-chain-respecting methods, so they do not bubble up the view tree.
1657         
1658         In 211897, WKContentView (who is usually first responder and thus receives
1659         the actions) stopped claiming to be able to perform these actions, depending
1660         on this non-existent bubbling behavior to keep them working.
1661
1662 2017-06-12  Chris Dumez  <cdumez@apple.com>
1663
1664         Null dereference under WebProcessPool::pageRemovedFromProcess()
1665         https://bugs.webkit.org/show_bug.cgi?id=173271
1666         <rdar://problem/32038814>
1667
1668         Reviewed by Ryosuke Niwa.
1669
1670         Null-check networkProcess() before dereferencing it in WebProcessPool::pageRemovedFromProcess().
1671         This is the only place in this class where we failed to null check before dereferencing
1672         networkProcess(). To my knowledge, there is no guarantee there is a network process.
1673
1674         * UIProcess/WebProcessPool.cpp:
1675         (WebKit::WebProcessPool::pageRemovedFromProcess):
1676
1677 2017-06-12  Jiewen Tan  <jiewen_tan@apple.com>
1678
1679         [WebCrypto] Remove experimental feature flag of SubtleCrypto
1680         https://bugs.webkit.org/show_bug.cgi?id=173197
1681         <rdar://problem/32688148>
1682
1683         Reviewed by Brent Fulgham.
1684
1685         * Shared/WebPreferencesDefinitions.h:
1686         * UIProcess/API/C/WKPreferences.cpp:
1687         (WKPreferencesSetSubtleCryptoEnabled): Deleted.
1688         (WKPreferencesGetSubtleCryptoEnabled): Deleted.
1689         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1690         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1691         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
1692         * WebProcess/WebPage/WebPage.cpp:
1693         (WebKit::WebPage::updatePreferences):
1694
1695 2017-06-12  Wenson Hsieh  <wenson_hsieh@apple.com>
1696
1697         [iOS DnD] Allow the injected bundle to add client data when writing an image to the pasteboard
1698         https://bugs.webkit.org/show_bug.cgi?id=173238
1699         <rdar://problem/31943370>
1700
1701         Reviewed by Ryosuke Niwa and Tim Horton.
1702
1703         Send PasteboardImage.clientTypes and PasteboardImage.clientData over IPC.
1704
1705         * Shared/WebCoreArgumentCoders.cpp:
1706         (IPC::encodeClientTypesAndData):
1707         (IPC::decodeClientTypesAndData):
1708
1709         Factor out common logic used to encode and decode client types and data into static helpers.
1710
1711         (IPC::ArgumentCoder<PasteboardWebContent>::encode):
1712         (IPC::ArgumentCoder<PasteboardWebContent>::decode):
1713         (IPC::ArgumentCoder<PasteboardImage>::encode):
1714         (IPC::ArgumentCoder<PasteboardImage>::decode):
1715
1716 2017-06-12  Wenson Hsieh  <wenson_hsieh@apple.com>
1717
1718         [iOS DnD] Introduce hooks to override targeted drag previews when lifting and cancelling
1719         https://bugs.webkit.org/show_bug.cgi?id=173240
1720         <rdar://problem/31943370>
1721
1722         Reviewed by Ryosuke Niwa and Tim Horton.
1723
1724         Adds two new delegate hooks: _webView:previewForLiftingItem:session: and
1725         _webView:previewForCancellingItem:withDefault:.
1726
1727         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
1728
1729 2017-06-12  Chris Dumez  <cdumez@apple.com>
1730
1731         Regression(r217867): Legacy SessionHistoryEntryData format should not change
1732         https://bugs.webkit.org/show_bug.cgi?id=173267
1733         <rdar://problem/32701257>
1734
1735         Reviewed by Simon Fraser.
1736
1737         Revert changes to Legacy SessionHistoryEntryData format that were made in r217867,
1738         as this apparently breaks compatiblity.
1739
1740         * UIProcess/mac/LegacySessionStateCoding.cpp:
1741         (WebKit::encodeFrameStateNode):
1742         (WebKit::decodeBackForwardTreeNode):
1743
1744 2017-06-12  Brent Fulgham  <bfulgham@apple.com>
1745
1746         [WK2][macOS] Alow iokit-get-properties for additional media features
1747         https://bugs.webkit.org/show_bug.cgi?id=173082
1748         <rdar://problem/32597547>
1749
1750         Reviewed by Alex Christensen.
1751
1752         * WebProcess/com.apple.WebProcess.sb.in:
1753
1754 2017-06-12  Carlos Garcia Campos  <cgarcia@igalia.com>
1755
1756         Add API::IconDatabaseClient
1757         https://bugs.webkit.org/show_bug.cgi?id=173145
1758
1759         Reviewed by Alex Christensen.
1760
1761         It will be used by GTK+ port instead of the C API.
1762
1763         * UIProcess/API/APIIconDatabaseClient.h:
1764         (API::IconDatabaseClient::~IconDatabaseClient):
1765         (API::IconDatabaseClient::didChangeIconForPageURL):
1766         (API::IconDatabaseClient::didRemoveAllIcons):
1767         (API::IconDatabaseClient::iconDataReadyForPageURL):
1768         * UIProcess/API/C/WKIconDatabase.cpp:
1769         (WKIconDatabaseSetIconDatabaseClient):
1770         * UIProcess/WebIconDatabase.cpp:
1771         (WebKit::WebIconDatabase::WebIconDatabase):
1772         (WebKit::WebIconDatabase::setClient):
1773         (WebKit::WebIconDatabase::didChangeIconForPageURL):
1774         (WebKit::WebIconDatabase::didRemoveAllIcons):
1775         (WebKit::WebIconDatabase::notifyIconDataReadyForPageURL):
1776         * UIProcess/WebIconDatabase.h:
1777         * UIProcess/WebIconDatabaseClient.cpp:
1778         (WebKit::WebIconDatabaseClient::WebIconDatabaseClient):
1779         (WebKit::WebIconDatabaseClient::didChangeIconForPageURL):
1780         (WebKit::WebIconDatabaseClient::didRemoveAllIcons):
1781         (WebKit::WebIconDatabaseClient::iconDataReadyForPageURL):
1782         * UIProcess/WebIconDatabaseClient.h:
1783         * WebKit2.xcodeproj/project.pbxproj:
1784
1785 2017-06-12  Carlos Garcia Campos  <cgarcia@igalia.com>
1786
1787         [GTK] Stop dismissing menus attached to the web view for every injected event
1788         https://bugs.webkit.org/show_bug.cgi?id=172708
1789
1790         Reviewed by Alex Christensen.
1791
1792         To actually simulate a right-click event we should also send the button release after the press, and let the page
1793         handle the events in addition to sending the event to the context menu controller, like we do with normal
1794         events. So, this is mostly the same as a real right-click event but without actually showing the menu.
1795
1796         * WebProcess/WebPage/WebPage.cpp:
1797         (WebKit::WebPage::contextMenuAtPointInWindow):
1798
1799 2017-06-12  Daewoong Jang  <daewoong.jang@navercorp.com>
1800
1801         [CoordinatedGraphics] Behavior change of DrawingAreaImpl after r217779
1802         https://bugs.webkit.org/show_bug.cgi?id=173153
1803
1804         Reviewed by Carlos Garcia Campos.
1805
1806         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
1807         (WebKit::AcceleratedDrawingArea::mainFrameContentSizeChanged):
1808
1809 2017-06-12  Carlos Garcia Campos  <cgarcia@igalia.com>
1810
1811         [GTK] Prefer to use private WebKitWebView API over WebKitWebViewBase
1812         https://bugs.webkit.org/show_bug.cgi?id=173254
1813
1814         Reviewed by Žan Doberšek.
1815
1816         WebKitWebViewBase is specific to the GTK+ API, but WebKitWebView should be present in any glib-based API. Add
1817         webkitWebViewCreatePage() and webkitWebViewGetPage() and use them when possible instead of the WebKitWebViewBase
1818         ones.
1819
1820         * UIProcess/API/gtk/WebKitAutomationSession.cpp:
1821         * UIProcess/API/gtk/WebKitContextMenuClient.cpp:
1822         (attachContextMenuClientToView):
1823         * UIProcess/API/gtk/WebKitFindController.cpp:
1824         (getPage):
1825         (webkitFindControllerDispose):
1826         (webkitFindControllerConstructed):
1827         (webKitFindControllerPerform):
1828         (webkit_find_controller_search_finish):
1829         * UIProcess/API/gtk/WebKitFormClient.cpp:
1830         (attachFormClientToView):
1831         * UIProcess/API/gtk/WebKitLoaderClient.cpp:
1832         (attachLoaderClientToView):
1833         * UIProcess/API/gtk/WebKitPolicyClient.cpp:
1834         (attachPolicyClientToView):
1835         * UIProcess/API/gtk/WebKitPrintOperation.cpp:
1836         (drawPagesForPrintingCompleted):
1837         (webkitPrintOperationPrintPagesForFrame):
1838         (webkit_print_operation_run_dialog):
1839         (webkit_print_operation_print):
1840         * UIProcess/API/gtk/WebKitUIClient.cpp:
1841         (attachUIClientToView):
1842         * UIProcess/API/gtk/WebKitWebContext.cpp:
1843         (webkitWebContextCreatePageForWebView):
1844         (webkitWebContextWebViewDestroyed):
1845         * UIProcess/API/gtk/WebKitWebView.cpp:
1846         (webkitWebViewCreatePage):
1847         (webkitWebViewGetPage):
1848         * UIProcess/API/gtk/WebKitWebViewPrivate.h:
1849
1850 2017-06-12  Carlos Garcia Campos  <cgarcia@igalia.com>
1851
1852         [GTK] getPage() in WebKitWebView should return a reference instead of a pointer
1853         https://bugs.webkit.org/show_bug.cgi?id=173251
1854
1855         Reviewed by Žan Doberšek.
1856
1857         The WebPageProxy is created on WebKitWebView construction, so getPage() can only return nullptr if it's called
1858         during construction. And that can only happen when construct properties are set. It's better to check that the
1859         view has been constructed only in these particular cases and make getPage() return a reference.
1860
1861         * UIProcess/API/gtk/WebKitWebView.cpp:
1862         (webkitWebViewCreateJavaScriptDialog):
1863         (allowModalDialogsChanged): Settings signals are only connected after the page has been created, so we don't
1864         need to check page is available here.
1865         (zoomTextOnlyChanged):
1866         (userAgentChanged):
1867         (webkitWebViewIsConstructed): Helper method to check if the view has been constructed.
1868         (webkitWebViewUpdateSettings): Return early if view hasn't been constructed.
1869         (webkitWebViewDisconnectSettingsSignalHandlers): Ditto.
1870         (webkitWebViewConstructed):
1871         (webkitWebViewDispose):
1872         (webkitWebViewCreateNewPage):
1873         (webkitWebViewSelectionDidChange):
1874         (webkit_web_view_try_close):
1875         (webkit_web_view_load_uri):
1876         (webkit_web_view_load_html):
1877         (webkit_web_view_load_alternate_html):
1878         (webkit_web_view_load_plain_text):
1879         (webkit_web_view_load_bytes):
1880         (webkit_web_view_load_request):
1881         (webkit_web_view_get_page_id):
1882         (webkit_web_view_reload):
1883         (webkit_web_view_reload_bypass_cache):
1884         (webkit_web_view_stop_loading):
1885         (webkit_web_view_is_playing_audio):
1886         (webkit_web_view_go_back):
1887         (webkit_web_view_can_go_back):
1888         (webkit_web_view_go_forward):
1889         (webkit_web_view_can_go_forward):
1890         (webkit_web_view_get_custom_charset):
1891         (webkit_web_view_set_custom_charset):
1892         (webkit_web_view_get_estimated_load_progress):
1893         (webkit_web_view_go_to_back_forward_list_item):
1894         (webkit_web_view_set_zoom_level):
1895         (webkit_web_view_get_zoom_level):
1896         (webkit_web_view_can_execute_editing_command):
1897         (webkit_web_view_execute_editing_command):
1898         (webkit_web_view_execute_editing_command_with_argument):
1899         (webkit_web_view_run_javascript):
1900         (resourcesStreamReadCallback):
1901         (webkit_web_view_get_inspector):
1902         (webkit_web_view_can_show_mime_type):
1903         (webkit_web_view_save):
1904         (webkit_web_view_save_to_file):
1905         (webkit_web_view_download_uri):
1906         (webkit_web_view_get_tls_info):
1907         (webkit_web_view_get_snapshot):
1908         (webkit_web_view_set_background_color):
1909         (webkit_web_view_get_background_color):
1910         (webkit_web_view_is_editable):
1911         (webkit_web_view_set_editable):
1912         (webkit_web_view_get_editor_state):
1913         (webkit_web_view_get_session_state):
1914         (webkit_web_view_restore_session_state):
1915
1916 2017-06-12  Carlos Garcia Campos  <cgarcia@igalia.com>
1917
1918         [GTK] Move WebKit GType macros to WTF
1919         https://bugs.webkit.org/show_bug.cgi?id=173249
1920
1921         Reviewed by Žan Doberšek.
1922
1923         Moving to a common place where they could be shared by all ports using a glib-based API.
1924
1925         * UIProcess/API/gtk/WebKitPrivate.h:
1926
1927 2017-06-11  Carlos Garcia Campos  <cgarcia@igalia.com>
1928
1929         [GTK] Remove WKInspectorClientGtk
1930         https://bugs.webkit.org/show_bug.cgi?id=173142
1931
1932         Reviewed by Michael Catanzaro.
1933
1934         It's only used internally in GTk+ API, we can simplify it by using a C++ client instead.
1935
1936         * PlatformGTK.cmake:
1937         * UIProcess/API/C/gtk/WKInspectorClientGtk.cpp: Removed.
1938         * UIProcess/API/C/gtk/WKInspectorClientGtk.h: Removed.
1939         * UIProcess/API/gtk/WebKitPrivate.h:
1940         * UIProcess/API/gtk/WebKitWebInspector.cpp:
1941         (_WebKitWebInspectorPrivate::~_WebKitWebInspectorPrivate):
1942         (webkitWebInspectorCreate):
1943         * UIProcess/WebInspectorProxy.cpp:
1944         * UIProcess/WebInspectorProxy.h:
1945         * UIProcess/gtk/WebInspectorClientGtk.cpp: Removed.
1946         * UIProcess/gtk/WebInspectorProxyClient.h: Renamed from Source/WebKit2/UIProcess/gtk/WebInspectorClientGtk.h.
1947         * UIProcess/gtk/WebInspectorProxyGtk.cpp:
1948         (WebKit::WebInspectorProxy::setClient):
1949         (WebKit::WebInspectorProxy::createInspectorWindow):
1950         (WebKit::WebInspectorProxy::platformDidClose):
1951         (WebKit::WebInspectorProxy::platformBringToFront):
1952         (WebKit::WebInspectorProxy::platformInspectedURLChanged):
1953         (WebKit::WebInspectorProxy::platformAttach):
1954         (WebKit::WebInspectorProxy::platformDetach):
1955         (WebKit::WebInspectorProxy::platformSetAttachedWindowHeight):
1956         (WebKit::WebInspectorProxy::platformSetAttachedWindowWidth):
1957         (WebKit::WebInspectorProxy::platformAttachAvailabilityChanged):
1958
1959 2017-06-11  Tim Horton  <timothy_horton@apple.com>
1960
1961         REGRESSION (r217870): Null deref under PageOverlayController::uninstallPageOverlay using find in page
1962         https://bugs.webkit.org/show_bug.cgi?id=173196
1963         <rdar://problem/32686871>
1964
1965         Reviewed by Simon Fraser.
1966
1967         * WebProcess/WebPage/ios/FindControllerIOS.mm:
1968         (WebKit::FindController::updateFindIndicator):
1969         The reason this caused a crash instead of just a missing indicator
1970         is that FindControllerIOS would early return after uninstalling
1971         the old overlay, before installing a new one, and leave m_isShowingFindIndicator
1972         set to true. Instead, reset it (and m_findIndicatorOverlay, which
1973         we would never re-use but might as well be freed immediately).
1974
1975         This likely already crashed in other less reproducible cases where a
1976         TextIndicator was not created for a find match, so clean it up.
1977
1978 2017-06-10  Carlos Garcia Campos  <cgarcia@igalia.com>
1979
1980         [GTK] Remove WKFullScreenClientGtk
1981         https://bugs.webkit.org/show_bug.cgi?id=173140
1982
1983         Reviewed by Michael Catanzaro.
1984
1985         It's only used internally in the GTK+ API. Implementation is a lot simpler without using it, we can simply use
1986         either WebKitWebView or WebKitWebViewBase from PageClient directly.
1987
1988         * PlatformGTK.cmake:
1989         * UIProcess/API/C/gtk/WKFullScreenClientGtk.cpp: Removed.
1990         * UIProcess/API/C/gtk/WKFullScreenClientGtk.h: Removed.
1991         * UIProcess/API/gtk/PageClientImpl.cpp:
1992         (WebKit::PageClientImpl::isFullScreen):
1993         (WebKit::PageClientImpl::enterFullScreen):
1994         (WebKit::PageClientImpl::exitFullScreen):
1995         * UIProcess/API/gtk/WebKitFullscreenClient.cpp: Removed.
1996         * UIProcess/API/gtk/WebKitFullscreenClient.h: Removed.
1997         * UIProcess/API/gtk/WebKitPrivate.h:
1998         * UIProcess/API/gtk/WebKitWebView.cpp:
1999         (webkitWebViewConstructed):
2000         (webkitWebViewEnterFullScreen):
2001         (webkitWebViewExitFullScreen):
2002         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
2003         (webkitWebViewBaseEnterFullScreen):
2004         (webkitWebViewBaseExitFullScreen):
2005         (webkitWebViewBaseIsFullScreen):
2006         * UIProcess/API/gtk/WebKitWebViewBasePrivate.h:
2007         * UIProcess/API/gtk/WebKitWebViewPrivate.h:
2008         * UIProcess/gtk/WebFullScreenClientGtk.cpp: Removed.
2009         * UIProcess/gtk/WebFullScreenClientGtk.h: Removed.
2010
2011 2017-06-10  Carlos Garcia Campos  <cgarcia@igalia.com>
2012
2013         [GTK] Handle page download request in WebKitWebView directly
2014         https://bugs.webkit.org/show_bug.cgi?id=173137
2015
2016         Reviewed by Žan Doberšek.
2017
2018         We don't need to pass through WebKitWebViewBase, since the base doesn't have an implementation.
2019
2020         * UIProcess/API/gtk/PageClientImpl.cpp:
2021         (WebKit::PageClientImpl::handleDownloadRequest):
2022         * UIProcess/API/gtk/WebKitWebView.cpp:
2023         (webkitWebViewConstructed):
2024         (webkitWebViewHandleDownloadRequest):
2025         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
2026         (webkitWebViewBaseSetDownloadRequestHandler): Deleted.
2027         (webkitWebViewBaseHandleDownloadRequest): Deleted.
2028         * UIProcess/API/gtk/WebKitWebViewBasePrivate.h:
2029         * UIProcess/API/gtk/WebKitWebViewPrivate.h:
2030
2031 2017-06-10  Carlos Garcia Campos  <cgarcia@igalia.com>
2032
2033         [GTK] Use a lambda in webkit_cookie_manager_get_accept_policy instead of toGenericCallbackFunction
2034         https://bugs.webkit.org/show_bug.cgi?id=173134
2035
2036         Reviewed by Žan Doberšek.
2037
2038         It's simpler and easier to read.
2039
2040         * UIProcess/API/gtk/WebKitCookieManager.cpp:
2041         (webkit_cookie_manager_get_accept_policy):
2042         (webkitCookieManagerGetAcceptPolicyCallback): Deleted.
2043
2044 2017-06-10  Dan Bernstein  <mitz@apple.com>
2045
2046         Reverted r218056 because it made the IDE reindex constantly.
2047
2048         * Configurations/DebugRelease.xcconfig:
2049
2050 2017-06-10  Dan Bernstein  <mitz@apple.com>
2051
2052         [Xcode] With Xcode 9 developer beta, everything rebuilds when switching between command-line and IDE
2053         https://bugs.webkit.org/show_bug.cgi?id=173223
2054
2055         Reviewed by Sam Weinig.
2056
2057         The rebuilds were happening due to a difference in the compiler options that the IDE and
2058         xcodebuild were specifying. Only the IDE was passing the -index-store-path option. To make
2059         xcodebuild pass that option, too, set CLANG_INDEX_STORE_ENABLE to YES if it is unset, and
2060         specify an appropriate path in CLANG_INDEX_STORE_PATH.
2061
2062         * Configurations/DebugRelease.xcconfig:
2063
2064 2017-06-09  Ryosuke Niwa  <rniwa@webkit.org>
2065
2066         Crash inside WebKit::PluginView::getAuthenticationInfo
2067         https://bugs.webkit.org/show_bug.cgi?id=173083
2068         <rdar://problem/32513144>
2069
2070         Address Darin's review comment.
2071
2072         * WebProcess/Plugins/PluginView.cpp:
2073         (WebKit::PluginView::getAuthenticationInfo):
2074
2075 2017-06-09  Chris Dumez  <cdumez@apple.com>
2076
2077         Use WTF::Function instead of std::function in NetworkProcess code
2078         https://bugs.webkit.org/show_bug.cgi?id=173182
2079
2080         Reviewed by Alex Christensen.
2081
2082         Use WTF::Function instead of std::function in NetworkProcess code to avoid
2083         unnecessary copying.
2084
2085         * NetworkProcess/NetworkProcess.h:
2086         * NetworkProcess/cache/NetworkCacheIOChannel.h:
2087         * NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm:
2088         (WebKit::NetworkCache::IOChannel::read):
2089         (WebKit::NetworkCache::IOChannel::write):
2090         * NetworkProcess/cache/NetworkCacheIOChannelSoup.cpp:
2091         (WebKit::NetworkCache::IOChannel::read):
2092         (WebKit::NetworkCache::IOChannel::readSyncInThread):
2093         (WebKit::NetworkCache::IOChannel::write):
2094         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.h:
2095         * NetworkProcess/cache/NetworkCacheStatistics.h:
2096         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
2097         (WebKit::clearNSURLCache):
2098         (WebKit::NetworkProcess::clearDiskCache):
2099         * NetworkProcess/soup/NetworkProcessSoup.cpp:
2100         (WebKit::NetworkProcess::clearDiskCache):
2101
2102 2017-06-09  Tim Horton  <timothy_horton@apple.com>
2103
2104         REGRESSION (r213584): WeChat app can not switch to next text field
2105         https://bugs.webkit.org/show_bug.cgi?id=173183
2106         <rdar://problem/32323478>
2107
2108         Reviewed by Wenson Hsieh.
2109
2110         * Platform/spi/ios/UIKitSPI.h:
2111         * UIProcess/ios/InputViewUpdateDeferrer.mm:
2112         (WebKit::InputViewUpdateDeferrer::~InputViewUpdateDeferrer):
2113         It turns out that _endIgnoringReloadInputViews doesn't actually perform
2114         the update if there was one ignored. It does, however, return whether
2115         there was a change ignored, and we can force an update.
2116
2117         This remains untestable without sizable additional API test infrastructure
2118         for the same reasons as the original patch.
2119
2120 2017-06-09  Chris Dumez  <cdumez@apple.com>
2121
2122         Make sure we protect |this| in lambdas in WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver()
2123         https://bugs.webkit.org/show_bug.cgi?id=173174
2124         <rdar://problem/32598919>
2125
2126         Reviewed by Darin Adler.
2127
2128         Follow-up fix to r218006, which caused a crash on the bots. We cannot WTFMove() protectedThis
2129         here because the callback gets called several times.
2130
2131         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2132         (WebKit::WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver):
2133
2134 2017-06-09  Jer Noble  <jer.noble@apple.com>
2135
2136         Crash in -[WKWebView _initializeWithConfiguration:]
2137         https://bugs.webkit.org/show_bug.cgi?id=173126
2138         <rdar://problem/32664993>
2139
2140         Reviewed by Darin Adler.
2141
2142         Follow up to previous fix; when setting NSString properties, store a copy of
2143         the string rather than the NSString itself.
2144
2145         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2146         (-[WKWebViewConfiguration copyWithZone:]):
2147         (-[WKWebViewConfiguration _overrideContentSecurityPolicy]):
2148         (-[WKWebViewConfiguration _setOverrideContentSecurityPolicy:]):
2149         (-[WKWebViewConfiguration _setMediaContentTypesRequiringHardwareSupport:]):
2150
2151 2017-06-09  Chris Dumez  <cdumez@apple.com>
2152
2153         Use WTF::Function instead of std::function in StorageManager
2154         https://bugs.webkit.org/show_bug.cgi?id=173177
2155
2156         Reviewed by Brady Eidson.
2157
2158         Use WTF::Function instead of std::function in StorageManager. This eliminates some
2159         potential implicit copying of captured variables, which is important here because
2160         we pass those lambdas to other threads.
2161
2162         * UIProcess/Storage/StorageManager.cpp:
2163         (WebKit::StorageManager::getSessionStorageOrigins):
2164         (WebKit::StorageManager::deleteSessionStorageOrigins):
2165         (WebKit::StorageManager::deleteSessionStorageEntriesForOrigins):
2166         (WebKit::StorageManager::getLocalStorageOrigins):
2167         (WebKit::StorageManager::getLocalStorageOriginDetails):
2168         (WebKit::StorageManager::deleteLocalStorageOriginsModifiedSince):
2169         (WebKit::StorageManager::deleteLocalStorageEntriesForOrigins):
2170         * UIProcess/Storage/StorageManager.h:
2171
2172 2017-06-09  Daniel Bates  <dabates@apple.com>
2173
2174         CSP: Apply img-src directive to favicon loads
2175         https://bugs.webkit.org/show_bug.cgi?id=172733
2176         <rdar://problem/32082654>
2177
2178         Reviewed by Brady Eidson.
2179
2180         Return 0 seconds for the maximum buffering time for favicons (no change in behavior).
2181
2182         * WebProcess/Network/WebLoaderStrategy.cpp:
2183         (WebKit::maximumBufferingTime):
2184
2185 2017-06-09  Wenson Hsieh  <wenson_hsieh@apple.com>
2186
2187         [iOS DnD] Add a hook to perform two-step drops in editable content
2188         https://bugs.webkit.org/show_bug.cgi?id=172992
2189         <rdar://problem/32590174>
2190
2191         Reviewed by Tim Horton.
2192
2193         Add plumbing to support an injected bundle hook for overriding two-step drops. See WebCore ChangeLog.
2194
2195         * WebProcess/InjectedBundle/API/APIInjectedBundleEditorClient.h:
2196         (API::InjectedBundle::EditorClient::performTwoStepDrop):
2197         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInEditingDelegate.h:
2198         * WebProcess/InjectedBundle/API/c/WKBundlePageEditorClient.h:
2199         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
2200         (-[WKWebProcessPlugInBrowserContextController _setEditingDelegate:]):
2201         * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp:
2202         (WebKit::InjectedBundlePageEditorClient::performTwoStepDrop):
2203         * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h:
2204         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
2205         (WebKit::WebEditorClient::performTwoStepDrop):
2206         * WebProcess/WebCoreSupport/WebEditorClient.h:
2207
2208 2017-06-09  Brent Fulgham  <bfulgham@apple.com>
2209
2210         Use Function rather than std::function for thread safety in WebsiteDataStore
2211         https://bugs.webkit.org/show_bug.cgi?id=173172
2212
2213         Reviewed by Chris Dumez.
2214         <rdar://problem/32679311>
2215
2216         Remove a few more instances of std::function in the WebsiteDataStore, and WTFMove completion handler to
2217         avoid unnecessary copies.
2218
2219         * Shared/WebsiteData/WebsiteDataType.h: Remove redundant WebsiteDataType from name.
2220         * UIProcess/API/Cocoa/WKWebsiteDataRecordInternal.h:
2221         (WebKit::toWebsiteDataType): Update for revised name.
2222         (WebKit::toWKWebsiteDataTypes): Ditto.
2223         * UIProcess/WebProcessProxy.cpp:
2224         (WebKit::WebProcessProxy::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores): ASSERT that
2225         this function, as well as its completion handler, are getting called from the main thread.
2226         (WebKit::WebProcessProxy::topPrivatelyControlledDomainsWithWebiteData): Ditto.
2227         (WebKit::WebProcessProxy::fetchWebsiteData): Move the completionHandler.
2228         (WebKit::WebProcessProxy::deleteWebsiteData): Ditto.
2229         (WebKit::WebProcessProxy::deleteWebsiteDataForOrigins): Ditto.
2230         * UIProcess/WebProcessProxy.h:
2231         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2232         (WebKit::WebsiteDataStore::fetchData): Switch to Function, and move completion handler.
2233         (WebKit::WebsiteDataStore::fetchDataForTopPrivatelyControlledDomains): Ditto.
2234         (WebKit::WebsiteDataStore::topPrivatelyControlledDomainsWithWebsiteData): Ditto.
2235         (WebKit::WebsiteDataStore::removeData): Ditto.
2236         (WebKit::WebsiteDataStore::removeDataForTopPrivatelyControlledDomains): Ditto.
2237         * UIProcess/WebsiteData/WebsiteDataStore.h:
2238
2239 2017-06-09  Chris Dumez  <cdumez@apple.com>
2240
2241         Make sure we protect |this| in lambdas in WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver()
2242         https://bugs.webkit.org/show_bug.cgi?id=173174
2243         <rdar://problem/32598919>
2244
2245         Reviewed by Darin Adler.
2246
2247         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2248         (WebKit::WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver):
2249
2250 2017-06-09  Chris Dumez  <cdumez@apple.com>
2251
2252         Avoid some ref counting churn in WebResourceLoadStatisticsStore
2253         https://bugs.webkit.org/show_bug.cgi?id=173168
2254
2255         Reviewed by Brent Fulgham.
2256
2257         Move the protectedThis around instead of ref'ing it every time we capture it
2258         in a lambda. Also add a missing protectedThis in WebResourceLoadStatisticsStore::removeDataRecords()
2259         which likely fixes crashes.
2260
2261         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2262         (WebKit::WebResourceLoadStatisticsStore::removeDataRecords):
2263         (WebKit::WebResourceLoadStatisticsStore::grandfatherExistingWebsiteData):
2264
2265 2017-06-09  Sam Weinig  <sam@webkit.org>
2266
2267         Add SubresourceIntegrity as an experimental feature
2268         https://bugs.webkit.org/show_bug.cgi?id=173164
2269
2270         Reviewed by Darin Adler.
2271
2272         * Shared/WebPreferencesDefinitions.h:
2273         * WebProcess/WebPage/WebPage.cpp:
2274         (WebKit::WebPage::updatePreferences):
2275         Add SubresourceIntegrity to the list of experimental features. Also, sort the experimental features
2276         as requested by the comment above it.
2277
2278 2017-06-09  Chris Dumez  <cdumez@apple.com>
2279
2280         Make sure |this| is protected in lambda capture in WebResourceLoadStatisticsStore::grandfatherExistingWebsiteData()
2281         https://bugs.webkit.org/show_bug.cgi?id=173163
2282
2283         Reviewed by Brent Fulgham.
2284
2285         Make sure |this| is protected in lambda capture in WebResourceLoadStatisticsStore::grandfatherExistingWebsiteData()
2286         or it may end up getting destroyed before the lambda executing and crash when calling m_statisticsQueue->dispatch().
2287
2288         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2289         (WebKit::WebResourceLoadStatisticsStore::grandfatherExistingWebsiteData):
2290
2291 2017-06-09  Daewoong Jang  <daewoong.jang@navercorp.com>
2292
2293         [CoordinatedGraphics] Remove unneeded interfaces in PageClient
2294         https://bugs.webkit.org/show_bug.cgi?id=173149
2295
2296         Reviewed by Michael Catanzaro.
2297
2298         * UIProcess/PageClient.h:
2299
2300 2017-06-09  Chris Dumez  <cdumez@apple.com>
2301
2302         Use WTF::Function instead of std::function in SpeculativeLoadManager::ExpiringEntry
2303         https://bugs.webkit.org/show_bug.cgi?id=173125
2304
2305         Reviewed by Antti Koivisto.
2306
2307         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
2308         (WebKit::NetworkCache::SpeculativeLoadManager::ExpiringEntry::ExpiringEntry):
2309         (WebKit::NetworkCache::SpeculativeLoadManager::PreloadedEntry::PreloadedEntry):
2310
2311 2017-06-09  Daewoong Jang  <daewoong.jang@navercorp.com>
2312
2313         Use WTF::getCurrentProcessID() instead of getpid()
2314         https://bugs.webkit.org/show_bug.cgi?id=173130
2315
2316         Reviewed by Tim Horton.
2317
2318         * UIProcess/API/APIProcessPoolConfiguration.h:
2319
2320 2017-06-09  Claudio Saavedra  <csaavedra@igalia.com>
2321
2322         struct does not accept initializer-form if member has initializers in GCC 4.9
2323
2324         Unreviewed speculative build fix.
2325
2326         Remove the default initializers for DeniedRequest struct,
2327         since it's only initialized in one place, to keep gcc 4.9
2328         happy.
2329         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
2330
2331 2017-06-09  Adrien Plazas  <aplazas@igalia.com>
2332
2333         [GTK] Add kinetic scrolling
2334         https://bugs.webkit.org/show_bug.cgi?id=155750
2335
2336         Reviewed by Carlos Garcia Campos.
2337
2338         Patch by Adrien Plazas and Yusuke Suzuki.
2339
2340         Add the notion of phase and momentum phase to WebWheelEvent.
2341
2342         Make WebWheelEvent manage the 'is_stop' attribute of GdkEventScroll to create the corresponding WebWheelEvent
2343         with the correct phases and deltas.
2344
2345         Make GestureController manage swipes to create the corresponding WebWheelEvent with the correct phases and
2346         deltas.
2347
2348         * Shared/NativeWebWheelEvent.h:
2349         * Shared/WebEvent.h:
2350         * Shared/WebEventConversion.cpp:
2351         (WebKit::WebKit2PlatformWheelEvent::WebKit2PlatformWheelEvent):
2352         * Shared/WebWheelEvent.cpp:
2353         (WebKit::WebWheelEvent::WebWheelEvent):
2354         (WebKit::WebWheelEvent::encode):
2355         (WebKit::WebWheelEvent::decode):
2356         * Shared/gtk/NativeWebWheelEventGtk.cpp:
2357         (WebKit::NativeWebWheelEvent::NativeWebWheelEvent):
2358         * Shared/gtk/WebEventFactory.cpp:
2359         (WebKit::WebEventFactory::createWebWheelEvent):
2360         * Shared/gtk/WebEventFactory.h:
2361         * UIProcess/WebPageProxy.cpp:
2362         (WebKit::WebPageProxy::handleWheelEvent):
2363         (WebKit::WebPageProxy::shouldProcessWheelEventNow):
2364         * UIProcess/WebPageProxy.h:
2365         * UIProcess/gtk/GestureController.cpp:
2366         (WebKit::GestureController::GestureController):
2367         (WebKit::GestureController::handleEvent):
2368         (WebKit::GestureController::isProcessingGestures):
2369         (WebKit::createScrollEvent):
2370         (WebKit::GestureController::DragGesture::startDrag):
2371         (WebKit::GestureController::DragGesture::handleDrag):
2372         (WebKit::GestureController::DragGesture::begin):
2373         (WebKit::GestureController::DragGesture::end):
2374         (WebKit::GestureController::SwipeGesture::startMomentumScroll):
2375         (WebKit::GestureController::SwipeGesture::swipe):
2376         (WebKit::GestureController::SwipeGesture::SwipeGesture):
2377         * UIProcess/gtk/GestureController.h:
2378
2379 2017-06-09  Jer Noble  <jer.noble@apple.com>
2380
2381         Crash in -[WKWebView _initializeWithConfiguration:]
2382         https://bugs.webkit.org/show_bug.cgi?id=173126
2383
2384         Reviewed by Antti Koivisto.
2385
2386         Crash occurs when passing an autoreleased NSString into _setMediaContentTypesRequiringHardwareSupport.
2387         The ivar should be a RetainPtr rather than a bare NSString *.
2388
2389         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2390         (-[WKWebViewConfiguration _mediaContentTypesRequiringHardwareSupport]):
2391
2392 2017-06-08  Carlos Garcia Campos  <cgarcia@igalia.com>
2393
2394         [GTK] Use API::FormClient instead of the C API in WebKitFormClient
2395         https://bugs.webkit.org/show_bug.cgi?id=173098
2396
2397         Reviewed by Žan Doberšek.
2398
2399         * UIProcess/API/gtk/WebKitFormClient.cpp:
2400         (attachFormClientToView):
2401         (willSubmitForm): Deleted.
2402         * UIProcess/API/gtk/WebKitFormSubmissionRequest.cpp:
2403         (webkitFormSubmissionRequestCreate):
2404         (webkit_form_submission_request_get_text_fields):
2405         * UIProcess/API/gtk/WebKitFormSubmissionRequestPrivate.h:
2406         * WebProcess/InjectedBundle/API/gtk/WebKitWebPage.cpp:
2407         (webkitWebPageCreate):
2408
2409 2017-06-08  Carlos Garcia Campos  <cgarcia@igalia.com>
2410
2411         [GTK] Use API::Findclient instead of the C API in WebKitFindController
2412         https://bugs.webkit.org/show_bug.cgi?id=173095
2413
2414         Reviewed by Žan Doberšek.
2415
2416         * UIProcess/API/gtk/WebKitFindController.cpp:
2417         (getPage):
2418         (webkitFindControllerDispose):
2419         (webkitFindControllerConstructed):
2420         (webkit_find_controller_class_init):
2421
2422 2017-06-08  Carlos Garcia Campos  <cgarcia@igalia.com>
2423
2424         [GTK] Get rid of custom marshallers of signals
2425         https://bugs.webkit.org/show_bug.cgi?id=173094
2426
2427         Reviewed by Žan Doberšek.
2428
2429         Use g_cclosure_marshal_generic instead.
2430
2431         * PlatformGTK.cmake:
2432         * UIProcess/API/gtk/WebKitBackForwardList.cpp:
2433         * UIProcess/API/gtk/WebKitDownload.cpp:
2434         (webkit_download_class_init):
2435         * UIProcess/API/gtk/WebKitFaviconDatabase.cpp:
2436         (webkit_favicon_database_class_init):
2437         * UIProcess/API/gtk/WebKitWebInspector.cpp:
2438         (webkit_web_inspector_class_init):
2439         * UIProcess/API/gtk/WebKitWebResource.cpp:
2440         (webkit_web_resource_class_init):
2441         * UIProcess/API/gtk/WebKitWebView.cpp:
2442         (webkit_web_view_class_init):
2443         * UIProcess/API/gtk/webkit2marshal.list: Removed.
2444         * WebProcess/InjectedBundle/API/gtk/WebKitScriptWorld.cpp:
2445         * WebProcess/InjectedBundle/API/gtk/WebKitWebPage.cpp:
2446         (webkit_web_page_class_init):
2447
2448 2017-06-08  Simon Fraser  <simon.fraser@apple.com>
2449
2450         Crash under -[WKWebView _updateVisibleContentRects]
2451         https://bugs.webkit.org/show_bug.cgi?id=173123
2452         rdar://problem/32650112
2453
2454         Reviewed by Tim Horton.
2455
2456         Make sure the WKWebView is valid in places where we dispatch_async or use
2457         a pre-commit handler.
2458
2459         Speculative fix for a rare crasher.
2460
2461         * UIProcess/API/Cocoa/WKWebView.mm:
2462         (-[WKWebView _isValid]):
2463         (-[WKWebView _addUpdateVisibleContentRectPreCommitHandler]):
2464         (-[WKWebView _scheduleVisibleContentRectUpdateAfterScrollInView:]):
2465
2466 2017-06-07  Simon Fraser  <simon.fraser@apple.com>
2467
2468         Use initializers in WebPageProxy
2469         https://bugs.webkit.org/show_bug.cgi?id=173073
2470
2471         Reviewed by Tim Horton.
2472
2473         Initialize the member variables the modern way.
2474
2475         * UIProcess/WebPageProxy.cpp:
2476         (WebKit::WebPageProxy::WebPageProxy):
2477         * UIProcess/WebPageProxy.h:
2478
2479 2017-06-08  Jeremy Jones  <jeremyj@apple.com>
2480
2481         Implement additional AVPlayerController interfaces for minTime and maxTime.
2482         https://bugs.webkit.org/show_bug.cgi?id=172396
2483         rdar://problem/30737452
2484
2485         Reviewed by Jer Noble.
2486
2487         Add support for new HLS UI in AVKit.
2488
2489         Plumb seekableTimeRangesLastModifiedTime and liveUpdateInterval across process boundaries.
2490
2491         * UIProcess/Cocoa/WebPlaybackSessionManagerProxy.h:
2492         * UIProcess/Cocoa/WebPlaybackSessionManagerProxy.messages.in:
2493         * UIProcess/Cocoa/WebPlaybackSessionManagerProxy.mm:
2494         (WebKit::WebPlaybackSessionModelContext::setSeekableRanges):
2495         (WebKit::WebPlaybackSessionManagerProxy::setSeekableRangesVector):
2496         * WebProcess/cocoa/WebPlaybackSessionManager.h:
2497         * WebProcess/cocoa/WebPlaybackSessionManager.mm:
2498         (WebKit::WebPlaybackSessionInterfaceContext::seekableRangesChanged):
2499         (WebKit::WebPlaybackSessionManager::seekableRangesChanged):
2500
2501 2017-06-08  Chris Dumez  <cdumez@apple.com>
2502
2503         Use WTF::Function more in SpeculativeLoadManager
2504         https://bugs.webkit.org/show_bug.cgi?id=173109
2505
2506         Reviewed by Antti Koivisto.
2507
2508         Use WTF::Function more in SpeculativeLoadManager.
2509
2510         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
2511         (WebKit::NetworkCache::SpeculativeLoadManager::PendingFrameLoad::create):
2512         (WebKit::NetworkCache::SpeculativeLoadManager::PendingFrameLoad::PendingFrameLoad):
2513         (WebKit::NetworkCache::SpeculativeLoadManager::registerLoad):
2514         (WebKit::NetworkCache::SpeculativeLoadManager::retrieveSubresourcesEntry):
2515         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.h:
2516
2517 2017-06-08  Youenn Fablet  <youenn@apple.com>
2518
2519         getUserMedia should not be prompted again if user denied access
2520         https://bugs.webkit.org/show_bug.cgi?id=173104
2521
2522         Reviewed by Geoff Garen.
2523
2524         Store denied requests to be able to replay them.
2525         If mic is denied, user might be prompted for camera, not for mic and camera.
2526         Same principle applies to the case of denied camera.
2527         Clearing the stored denied requests when reloading/navigating away.
2528
2529         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
2530         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasDenied):
2531         (WebKit::UserMediaPermissionRequestManagerProxy::resetAccess):
2532         (WebKit::UserMediaPermissionRequestManagerProxy::isRequestDenied):
2533         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
2534         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
2535
2536 2017-06-08  Jer Noble  <jer.noble@apple.com>
2537
2538         Clients of the WK2 C-API don't have their mediaContentTypesRequiringHardwareSupport setting initialized correctly.
2539         https://bugs.webkit.org/show_bug.cgi?id=173091
2540
2541         Reviewed by Eric Carlson.
2542
2543         Rather than add yet a third way of setting this preference, centralize everything by moving the
2544         definition of the default value into WebCore.
2545
2546         * Shared/WebPreferencesDefinitions.h:
2547         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2548         (-[WKWebViewConfiguration init]):
2549         * WebProcess/WebPage/WebPage.cpp:
2550         (WebKit::WebPage::updatePreferences):
2551
2552 2017-06-08  Jer Noble  <jer.noble@apple.com>
2553
2554         [WK2] mediaContentTypesRequiringHardwareSupport setting not being propogated
2555         https://bugs.webkit.org/show_bug.cgi?id=173090
2556
2557         Reviewed by Eric Carlson.
2558
2559         Passing a NSString* into the WebPreferencesStore::Value constructor would rather cast the NSString*
2560         into a bool than a const String&. So explicitly cast the NSString* into a String before passing.
2561
2562         * UIProcess/API/Cocoa/WKWebView.mm:
2563         (-[WKWebView _initializeWithConfiguration:]):
2564
2565 2017-06-08  Youenn Fablet  <youenn@apple.com>
2566
2567         getUserMedia request should not be allowed for background tabs unless the tab is already capturing
2568         https://bugs.webkit.org/show_bug.cgi?id=172989
2569
2570         Reviewed by Eric Carlson.
2571
2572         Covered by updated test and manual testing.
2573
2574         In case a getUserMedia can be granted, we check for visbility of the view.
2575         If the view is visible, the getUserMedia request is allowed and promise is resolved.
2576         Otherwise we store the pregranted request and will allow it when the view gets visible.
2577         Pregranted requests will be cleared if the document of the view is changed.
2578
2579         Pregranted requests will not be used when capture page is muted.
2580         In that case, a prompt will appear.
2581
2582         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
2583         (WebKit::UserMediaPermissionRequestManagerProxy::removeGrantedAccess):
2584         (WebKit::allowRequest):
2585         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
2586         (WebKit::UserMediaPermissionRequestManagerProxy::processPregrantedRequests):
2587         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
2588         * UIProcess/WebPageProxy.cpp:
2589         (WebKit::WebPageProxy::dispatchActivityStateChange):
2590         (WebKit::WebPageProxy::viewIsBecomingVisible):
2591         * UIProcess/WebPageProxy.h:
2592
2593 2017-06-07  Carlos Garcia Campos  <cgarcia@igalia.com>
2594
2595         [WPE] Enable resource usage
2596         https://bugs.webkit.org/show_bug.cgi?id=173054
2597
2598         Reviewed by Žan Doberšek.
2599
2600         Enable/disable the resources overlay with CTRL + Shift + G.
2601
2602         * UIProcess/API/wpe/WPEView.cpp:
2603         (WKWPE::m_compositingManagerProxy):
2604
2605 2017-06-07  Carlos Garcia Campos  <cgarcia@igalia.com>
2606
2607         Remove legacy INSPECTOR_SERVER implementation
2608         https://bugs.webkit.org/show_bug.cgi?id=172966
2609
2610         Reviewed by Žan Doberšek.
2611
2612         * CMakeLists.txt:
2613         * Platform/Logging.h:
2614         * PlatformWPE.cmake:
2615         * UIProcess/InspectorServer/HTTPRequest.cpp: Removed.
2616         * UIProcess/InspectorServer/HTTPRequest.h: Removed.
2617         * UIProcess/InspectorServer/WebInspectorServer.cpp: Removed.
2618         * UIProcess/InspectorServer/WebInspectorServer.h: Removed.
2619         * UIProcess/InspectorServer/WebSocketServer.cpp: Removed.
2620         * UIProcess/InspectorServer/WebSocketServer.h: Removed.
2621         * UIProcess/InspectorServer/WebSocketServerClient.h: Removed.
2622         * UIProcess/InspectorServer/WebSocketServerConnection.cpp: Removed.
2623         * UIProcess/InspectorServer/WebSocketServerConnection.h: Removed.
2624         * UIProcess/InspectorServer/front-end/inspectorPageIndex.html: Removed.
2625         * UIProcess/InspectorServer/soup/WebSocketServerSoup.cpp: Removed.
2626         * UIProcess/WebInspectorProxy.cpp:
2627         (WebKit::WebInspectorProxy::invalidate):
2628         * UIProcess/WebInspectorProxy.h:
2629         * UIProcess/WebInspectorProxy.messages.in:
2630         * UIProcess/WebPageProxy.cpp:
2631         (WebKit::WebPageProxy::initializeWebPage):
2632         (WebKit::WebPageProxy::preferencesDidChange):
2633         * UIProcess/wpe/WebProcessPoolWPE.cpp:
2634         * WebProcess/WebPage/WebInspector.cpp:
2635         (WebKit::WebInspector::sendMessageToFrontend):
2636         * WebProcess/WebPage/WebInspector.h:
2637         * WebProcess/WebPage/WebInspector.messages.in:
2638
2639 2017-06-07  Dan Bernstein  <mitz@apple.com>
2640
2641         [Cocoa] additionalReadAccessAllowedURLs doesn’t preserve non-Latin-1 paths
2642         https://bugs.webkit.org/show_bug.cgi?id=173086
2643
2644         Reviewed by Andy Estes.
2645
2646         We were incorrectly passing the fileSystemRepresentation of an NSURL into the WTF::String
2647         constructor that expects a Latin-1 string. However, in general, fileSystemRepresentation is
2648         not Latin-1.
2649
2650         * UIProcess/API/APIProcessPoolConfiguration.h: Changed m_additionalReadAccessAllowedPaths
2651           from a Vector<WTF::String> into a Vector<WTF::CString>.
2652
2653         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
2654         (-[_WKProcessPoolConfiguration additionalReadAccessAllowedURLs]): Updated for the change.
2655         (-[_WKProcessPoolConfiguration setAdditionalReadAccessAllowedURLs:]): Ditto.
2656
2657         * UIProcess/WebProcessPool.cpp:
2658         (WebKit::WebProcessPool::resolvePathsForSandboxExtensions): Ditto.
2659
2660 2017-06-07  Ryosuke Niwa  <rniwa@webkit.org>
2661
2662         Crash inside WebKit::PluginView::getAuthenticationInfo
2663         https://bugs.webkit.org/show_bug.cgi?id=173083
2664
2665         Reviewed by Chris Dumez.
2666
2667         Added a null pointer check. The content document may have went away by the time we get there from IPC.
2668
2669         * WebProcess/Plugins/PluginView.cpp:
2670         (WebKit::PluginView::getAuthenticationInfo):
2671
2672 2017-06-07  Youenn Fablet  <youenn@apple.com>
2673
2674         getUserMedia is prompting too often
2675         https://bugs.webkit.org/show_bug.cgi?id=172859
2676         <rdar://problem/32589950>
2677
2678         Reviewed by Eric Carlson.
2679
2680         Introduce a storage of granted requests to skip prompting when needed.
2681         This is a partial implementation as granted requests should not happen for background tabs.
2682         This will be covered in a follow-up patch.
2683         Covered by manual tests.
2684
2685         A granted request keeps its mainFrameID.
2686         Whenever the document of the main frame changes, the granted requests for that mainFrameID will be removed.
2687         This handles the case of navigating, reloading... while still supporting the case of granting getUserMedia after in page navigation.
2688
2689         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
2690         (WebKit::UserMediaPermissionRequestManagerProxy::createRequest):
2691         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasGranted):
2692         (WebKit::UserMediaPermissionRequestManagerProxy::removeGrantedAccess):
2693         (WebKit::UserMediaPermissionRequestManagerProxy::searchForGrantedRequest):
2694         (WebKit::UserMediaPermissionRequestManagerProxy::grantAccess):
2695         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
2696         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
2697         * UIProcess/UserMediaPermissionRequestProxy.cpp:
2698         (WebKit::UserMediaPermissionRequestProxy::UserMediaPermissionRequestProxy):
2699         * UIProcess/UserMediaPermissionRequestProxy.h:
2700         (WebKit::UserMediaPermissionRequestProxy::create):
2701         (WebKit::UserMediaPermissionRequestProxy::mainFrameID):
2702         (WebKit::UserMediaPermissionRequestProxy::frameID):
2703         (WebKit::UserMediaPermissionRequestProxy::userMediaDocumentSecurityOrigin):
2704         * UIProcess/WebPageProxy.cpp:
2705         (WebKit::WebPageProxy::didChangeMainDocument):
2706         (WebKit::WebPageProxy::backForwardGoToItem):
2707         * UIProcess/WebPageProxy.h:
2708         * UIProcess/WebPageProxy.messages.in:
2709         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2710         (WebKit::WebFrameLoaderClient::dispatchDidChangeMainDocument):
2711         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
2712
2713 2017-06-07  Dan Bernstein  <mitz@apple.com>
2714
2715         [Cocoa] additionalReadAccessAllowedURLs should be consumed before loading the injected bundle
2716         https://bugs.webkit.org/show_bug.cgi?id=173078
2717
2718         Reviewed by Anders Carlsson.
2719
2720         * WebProcess/WebProcess.cpp:
2721         (WebKit::WebProcess::initializeWebProcess): Changed the order.
2722
2723 2017-06-07  Per Arne Vollan  <pvollan@apple.com>
2724
2725         Support removal of authentication data through the Website data store API.
2726         https://bugs.webkit.org/show_bug.cgi?id=171217
2727         <rdar://problem/29522573>
2728
2729         Reviewed by Brady Eidson.
2730
2731         Add support to remove and fetch credential data through the Website data store API.
2732         Credential data is removed and fetched from both the network process and web process.
2733         Authentication data stored in the keychain will not be cleared.
2734
2735         * NetworkProcess/NetworkProcess.cpp:
2736         (WebKit::NetworkProcess::fetchWebsiteData):
2737         (WebKit::NetworkProcess::deleteWebsiteData):
2738         * Shared/WebsiteData/WebsiteData.cpp:
2739         (WebKit::WebsiteData::encode):
2740         (WebKit::WebsiteData::decode):
2741         * Shared/WebsiteData/WebsiteData.h:
2742         * Shared/WebsiteData/WebsiteDataType.h:
2743         * UIProcess/API/Cocoa/WKWebsiteDataRecord.h:
2744         * UIProcess/API/Cocoa/WKWebsiteDataRecord.mm:
2745         (dataTypesToString):
2746         * UIProcess/API/Cocoa/WKWebsiteDataRecordInternal.h:
2747         (WebKit::toWebsiteDataType):
2748         (WebKit::toWKWebsiteDataTypes):
2749         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
2750         (+[WKWebsiteDataStore allWebsiteDataTypes]):
2751         * UIProcess/WebsiteData/WebsiteDataRecord.cpp:
2752         (WebKit::WebsiteDataRecord::addOriginWithCredential):
2753         * UIProcess/WebsiteData/WebsiteDataRecord.h:
2754         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2755         (WebKit::WebsiteDataStore::fetchData):
2756         * WebProcess/WebProcess.cpp:
2757         (WebKit::WebProcess::fetchWebsiteData):
2758         (WebKit::WebProcess::deleteWebsiteData):
2759
2760 2017-06-06  Dan Bernstein  <mitz@apple.com>
2761
2762         Fixed building with the macOS 10.13 Apple Internal SDK when targeting macOS 10.12.
2763
2764         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
2765         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didAuthorizePayment:handler:]):
2766         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectPaymentMethod:handler:]):
2767         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingMethod:handler:]):
2768         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingContact:handler:]):
2769
2770 2017-06-06  Brent Fulgham  <bfulgham@apple.com>
2771
2772         [WK2][Cocoa] Allow network process to bind addresses without webrtc extension
2773         https://bugs.webkit.org/show_bug.cgi?id=173032
2774         <rdar://problem/32597426>
2775
2776         Reviewed by Youenn Fablet.
2777
2778         Remove the unnecessary WebRTC sandbox extension handle and conditional sandbox rules, since we've
2779         decided that all WebKit clients should be able to use the WebRTC protocol.
2780
2781         * NetworkProcess/NetworkProcessCreationParameters.cpp:
2782         (WebKit::NetworkProcessCreationParameters::encode): Remove unused sandbox extension from serialization.
2783         (WebKit::NetworkProcessCreationParameters::decode): Ditto.
2784         * NetworkProcess/NetworkProcessCreationParameters.h:
2785         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
2786         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa): We no longer send the sandbox extension,
2787         so don't attempt to consume it.
2788         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in: Remove check for 'com.apple.webkit.webrtc'
2789         extension. Make rules conditional on building with WEB_RTC feature enabled.
2790         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb: Remove check for 'com.apple.webkit.webrtc'
2791         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2792         (WebKit::WebProcessPool::platformInitializeNetworkProcess): Do not create unnecessary sandbox extension
2793         handle.
2794
2795 2017-06-06  Tim Horton  <timothy_horton@apple.com>
2796
2797         Crash trying to drag the entire text of a long book out of Mail compose view
2798         https://bugs.webkit.org/show_bug.cgi?id=173042
2799         <rdar://problem/32382059>
2800
2801         Reviewed by Simon Fraser.
2802
2803         * WebProcess/WebPage/ios/FindControllerIOS.mm:
2804         * WebProcess/WebPage/ios/WebPageIOS.mm:
2805         (WebKit::WebPage::didConcludeEditDataInteraction):
2806         Adapt to the new name.
2807
2808 2017-06-06  Chris Dumez  <cdumez@apple.com>
2809
2810         RELEASE_ASSERT(static_cast<size_t>(enumerationValue) < WTF_ARRAY_LENGTH(values)) hit in convertEnumerationToJS<WebCore::History::ScrollRestoration>()
2811         https://bugs.webkit.org/show_bug.cgi?id=173033
2812         <rdar://problem/32591099>
2813
2814         Reviewed by Simon Fraser.
2815
2816         * Shared/SessionState.h:
2817         Make sure FrameState::shouldRestoreScrollPosition and other struct members are always
2818         intialized.
2819
2820         * UIProcess/mac/LegacySessionStateCoding.cpp:
2821         (WebKit::encodeFrameStateNode):
2822         (WebKit::decodeBackForwardTreeNode):
2823         Make sure FrameState::shouldRestoreScrollPosition is properly encoded / decoded.
2824
2825 2017-06-06  Andy Estes  <aestes@apple.com>
2826
2827         REGRESSION (r199558): WKWebView upload file which name contains Chinese character results in garbled code
2828         https://bugs.webkit.org/show_bug.cgi?id=172849
2829         <rdar://problem/32567454>
2830
2831         Reviewed by Darin Adler.
2832
2833         This is the Mac equivalent of what was fixed in r208295. This time we use -[NSURL path] to
2834         construct a WTF::String instead of calling String::fromUTF8() on -[NSURL fileSystemRepresentation].
2835
2836         * UIProcess/Cocoa/UIDelegate.mm:
2837         (WebKit::UIDelegate::UIClient::runOpenPanel):
2838
2839 2017-06-06  Yoav Weiss  <yoav@yoav.ws>
2840
2841         [preload] Conditional support for media preloading and align media `as` values.
2842         https://bugs.webkit.org/show_bug.cgi?id=172501
2843
2844         Reviewed by Dean Jackson.
2845
2846         Add media preloading preference and hook it up to runtime enabled features.
2847
2848         * Shared/WebPreferencesDefinitions.h: Added a macro defining media preloading preference.
2849         * UIProcess/API/C/WKPreferences.cpp:
2850         (WebKit2::WKPreferences::WKPreferencesSetMediaPreloadingEnabled):
2851         (WebKit2::WKPreferences::WKPreferencesGetMediaPreloadingEnabled):
2852         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2853         * WebProcess/WebPage/WebPage.cpp: Set runtime enabled feature based on preference.
2854
2855 2017-06-06  Don Olmstead  <don.olmstead@am.sony.com>
2856
2857         [WebCore] Enable REQUEST_ANIMATION_FRAME_TIMER for all ports
2858         https://bugs.webkit.org/show_bug.cgi?id=172780
2859
2860         Reviewed by Alex Christensen.
2861
2862         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2863         (WebKit::WebChromeClient::scheduleAnimation): Deleted.
2864         * WebProcess/WebCoreSupport/WebChromeClient.h:
2865         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
2866         (WebKit::CompositingCoordinator::syncDisplayState):
2867
2868 2017-06-06  Beth Dakin  <bdakin@apple.com>
2869
2870         Netflix seeking quirk should also apply to Now Playing, and should always use the 
2871         livestream UI
2872         https://bugs.webkit.org/show_bug.cgi?id=173030
2873         -and corresponding-
2874         rdar://problem/32228660
2875
2876         Reviewed by Darin Adler.
2877
2878         See WebCore ChangeLog for more details. We can roll out allowsTouchBarScrubbing() 
2879         and rely on supportsSeeking().
2880
2881         * UIProcess/Cocoa/WebPlaybackSessionManagerProxy.h:
2882         * UIProcess/Cocoa/WebPlaybackSessionManagerProxy.messages.in:
2883         * UIProcess/Cocoa/WebPlaybackSessionManagerProxy.mm:
2884         (WebKit::WebPlaybackSessionModelContext::setAllowsTouchBarScrubbing): Deleted.
2885         (WebKit::WebPlaybackSessionManagerProxy::setAllowsTouchBarScrubbing): Deleted.
2886         * WebProcess/cocoa/WebPlaybackSessionManager.h:
2887         * WebProcess/cocoa/WebPlaybackSessionManager.mm:
2888         (WebKit::WebPlaybackSessionInterfaceContext::allowsTouchBarScrubbingChanged): Deleted.
2889         (WebKit::WebPlaybackSessionManager::allowsTouchBarScrubbingChanged): Deleted.
2890
2891 2017-06-06  Jer Noble  <jer.noble@apple.com>
2892
2893         [Cocoa] Set defaults for mediaContentTypesRequiringHardwareSupport setting
2894         https://bugs.webkit.org/show_bug.cgi?id=173008
2895
2896         Reviewed by Eric Carlson.
2897
2898         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2899         (-[WKWebViewConfiguration init]):
2900
2901 2017-06-06  Joseph Pecoraro  <pecoraro@apple.com>
2902
2903         Move Resource Timing / User Timing from experimental features into main preferences
2904         https://bugs.webkit.org/show_bug.cgi?id=172950
2905
2906         Reviewed by Darin Adler.
2907
2908         * Shared/WebPreferencesDefinitions.h:
2909         Move Resource Timing and User Timing out of the Experimental Features section.
2910
2911 2017-06-06  Youenn Fablet  <youenn@apple.com>
2912
2913         Add an option to disable getUserMedia prompt in case of mock capture sources
2914         https://bugs.webkit.org/show_bug.cgi?id=172981
2915         <rdar://problem/32580325>
2916
2917         Reviewed by Eric Carlson.
2918
2919         Adding mockCaptureDevicesPromptEnabled option.
2920         Allowing any getUserMedia request if mock is on and prompt is off.
2921
2922         Renaming UserMediaProcessManager::willEnableMediaStreamInPage to muteCaptureMediaStreamsExceptIn.
2923         This eases reading the code.
2924         Making sure that a page for which a new getUserMedia MediaStream will be created is capture-unmuted.
2925
2926         * Shared/WebPreferencesDefinitions.h:
2927         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
2928         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
2929         * UIProcess/UserMediaProcessManager.cpp:
2930         (WebKit::UserMediaProcessManager::muteCaptureMediaStreamsExceptIn):
2931         (WebKit::UserMediaProcessManager::willCreateMediaStream):
2932         * UIProcess/UserMediaProcessManager.h:
2933         * UIProcess/WebPageProxy.cpp:
2934         (WebKit::WebPageProxy::setMuted):
2935         * UIProcess/WebPageProxy.h:
2936         (WebKit::WebPageProxy::activateMediaStreamCaptureInPage):
2937
2938 2017-06-06  Carlos Garcia Campos  <cgarcia@igalia.com>
2939
2940         [WPE] Enable remote inspector
2941         https://bugs.webkit.org/show_bug.cgi?id=172971
2942
2943         Reviewed by Žan Doberšek.
2944
2945         Initialize the remote inpector if needed.
2946
2947         * UIProcess/wpe/WebProcessPoolWPE.cpp:
2948         (WebKit::initializeRemoteInspectorServer):
2949         (WebKit::WebProcessPool::platformInitialize):
2950
2951 2017-06-06  Carlos Garcia Campos  <cgarcia@igalia.com>
2952
2953         [GLIB] Make remote inspector DBus protocol common to all glib based ports
2954         https://bugs.webkit.org/show_bug.cgi?id=172970
2955
2956         Reviewed by Žan Doberšek.
2957
2958         Use webkit instead of webkitgtk and reomve platform idfeds.
2959
2960         * UIProcess/glib/RemoteInspectorClient.cpp:
2961
2962 2017-06-06  Zan Dobersek  <zdobersek@igalia.com>
2963
2964         [WPE] Don't disable Web security preference by default
2965         https://bugs.webkit.org/show_bug.cgi?id=172964
2966
2967         Reviewed by Carlos Garcia Campos.
2968
2969         * UIProcess/API/wpe/WPEView.cpp:
2970         (WKWPE::View::View): Don't disable Web security by default.
2971
2972 2017-06-05  Chris Dumez  <cdumez@apple.com>
2973
2974         ASSERTION FAILED: RunLoop::isMain() in com.apple.WebKit: IPC::Connection::sendSyncMessage + 128
2975         https://bugs.webkit.org/show_bug.cgi?id=172943
2976         <rdar://problem/31288058>
2977
2978         Reviewed by Alexey Proskuryakov.
2979
2980         In Connection::sendMessage(), make sure we only ever transform asynchronous messages into synchronous
2981         ones if sendMessage() is called on the main thread. This is necessary because we no longer support
2982         sending synchronous messages from a background thread since r205125.
2983
2984         * Platform/IPC/Connection.cpp:
2985         (IPC::Connection::sendMessage):
2986         (IPC::Connection::sendSyncMessage):
2987
2988 2017-06-05  Joseph Pecoraro  <pecoraro@apple.com>
2989
2990         Revert r217405, this headerpad increase is no longer needed.
2991
2992         Rubber-stamped by Dan Bernstein.
2993
2994         * Configurations/BaseXPCService.xcconfig:
2995
2996 2017-06-05  Dan Bernstein  <mitz@apple.com>
2997
2998         Tried to fix the build when targrting macOS 10.12 using the macOS 10.13 developer beta SDK.
2999
3000         * UIProcess/Cocoa/WebViewImpl.h:
3001         * UIProcess/Cocoa/WebViewImpl.mm:
3002         (WebKit::WebViewImpl::mediaPlaybackControlsView):
3003
3004 2017-06-05  Jer Noble  <jer.noble@apple.com>
3005
3006         Allow clients to specify a list of codecs which should require hardware decode support.
3007         https://bugs.webkit.org/show_bug.cgi?id=172787
3008
3009         Reviewed by Alex Christensen.
3010
3011         Add a WKWebPageConfiguration (and associated WebPreferences and WKPreferencesRef) properties
3012         allowing clients to require specified codecs have hardware decode support. Also open up the
3013         sandbox on Cocoa ports to services required to check for hardware decode availability.
3014
3015         * Shared/WebPreferencesDefinitions.h:
3016         * UIProcess/API/C/WKPreferences.cpp:
3017         (WKPreferencesSetMediaCodecsRequiringHardwareSupport):
3018         (WKPreferencesCopyMediaCodecsRequiringHardwareSupport):
3019         * UIProcess/API/C/WKPreferencesRefPrivate.h:
3020         * UIProcess/API/Cocoa/WKWebView.mm:
3021         (-[WKWebView _initializeWithConfiguration:]):
3022         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
3023         (-[WKWebViewConfiguration copyWithZone:]):
3024         (-[WKWebViewConfiguration _mediaCodecsRequiringHardwareSupport]):
3025         (-[WKWebViewConfiguration _setMediaCodecsRequiringHardwareSupport:]):
3026         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
3027         * WebProcess/com.apple.WebProcess.sb.in:
3028
3029 2017-06-05  Beth Dakin  <bdakin@apple.com>
3030
3031         Modify Netflix controlsManager quirk to prevent only scrubbing
3032         https://bugs.webkit.org/show_bug.cgi?id=172881
3033         -and corresponding-
3034         rdar://problem/32228660
3035
3036         Reviewed by Andy Estes.
3037
3038         Plumbing for allowsTouchBarScrubbing. See WebCore ChangeLog for more details.
3039
3040         * UIProcess/Cocoa/WebPlaybackSessionManagerProxy.h:
3041         * UIProcess/Cocoa/WebPlaybackSessionManagerProxy.messages.in:
3042         * UIProcess/Cocoa/WebPlaybackSessionManagerProxy.mm:
3043         (WebKit::WebPlaybackSessionModelContext::setAllowsTouchBarScrubbing):
3044         (WebKit::WebPlaybackSessionManagerProxy::setAllowsTouchBarScrubbing):
3045         * WebProcess/cocoa/WebPlaybackSessionManager.h:
3046         * WebProcess/cocoa/WebPlaybackSessionManager.mm:
3047         (WebKit::WebPlaybackSessionInterfaceContext::allowsTouchBarScrubbingChanged):
3048         (WebKit::WebPlaybackSessionManager::allowsTouchBarScrubbingChanged):
3049
3050 2017-06-05  Carlos Garcia Campos  <cgarcia@igalia.com>
3051
3052         Unreviewed. Fix GTK+ build with OpenGL disabled after r217779.
3053
3054         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
3055         (WebKit::AcceleratedDrawingArea::mainFrameContentSizeChanged):
3056
3057 2017-06-05  Carlos Garcia Campos  <cgarcia@igalia.com>
3058
3059         [WPE] Use AcceleratedDrawingArea instead of its fork
3060         https://bugs.webkit.org/show_bug.cgi?id=172496
3061
3062         Reviewed by Žan Doberšek.
3063
3064         WPE uses its own drawing area implementation, which is actually a fork of AcceleratedDrawingArea, but simplified
3065         for the case of compositing being always forced. AcceleratedDrawingArea already handles the case of compositing
3066         being forced, so now that WPE is upstream we could simply use AcceleratedDrawingArea instead.
3067
3068         * PlatformWPE.cmake:
3069         * Shared/DrawingAreaInfo.h: Remove DrawingAreaTypeWPE type.
3070         * UIProcess/API/wpe/DrawingAreaProxyWPE.cpp: Removed.
3071         * UIProcess/API/wpe/DrawingAreaProxyWPE.h: Removed.
3072         * UIProcess/API/wpe/PageClientImpl.cpp:
3073         (WebKit::PageClientImpl::createDrawingAreaProxy): Create an AcceleratedDrawingAreaProxy.
3074         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
3075         (WebKit::AcceleratedDrawingArea::mainFrameContentSizeChanged): Moved from DrawingAreaImpl since it actually
3076         belongs here.
3077         * WebProcess/WebPage/DrawingArea.cpp:
3078         (WebKit::DrawingArea::create): Create an AcceleratedDrawingArea for WPE port.
3079         * WebProcess/WebPage/DrawingAreaImpl.cpp: Remove mainFrameContentSizeChanged() that doesn't belong here.
3080         * WebProcess/WebPage/DrawingAreaImpl.h:
3081         * WebProcess/WebPage/wpe/DrawingAreaWPE.cpp: Removed.
3082         * WebProcess/WebPage/wpe/DrawingAreaWPE.h: Removed.
3083
3084 2017-06-03  Simon Fraser  <simon.fraser@apple.com>
3085
3086         Sort the project file.
3087
3088         * WebKit2.xcodeproj/project.pbxproj:
3089
3090 2017-06-02  Chris Dumez  <cdumez@apple.com>
3091
3092         ResourceLoadStatistics are not using unique paths during test runs
3093         https://bugs.webkit.org/show_bug.cgi?id=172861
3094         <rdar://problem/32442251>
3095
3096         Reviewed by Darin Adler.
3097
3098         Add WKContextConfigurationSetResourceLoadStatisticsDirectory() C API to allow
3099         WKTR to use a custom directory.
3100
3101         * UIProcess/API/APIProcessPoolConfiguration.cpp:
3102         (API::ProcessPoolConfiguration::createWithWebsiteDataStoreConfiguration):
3103         (API::ProcessPoolConfiguration::ProcessPoolConfiguration):
3104         (API::ProcessPoolConfiguration::copy):
3105         * UIProcess/API/APIProcessPoolConfiguration.h:
3106         * UIProcess/API/C/WKContextConfigurationRef.cpp:
3107         (WKContextConfigurationCopyResourceLoadStatisticsDirectory):
3108         (WKContextConfigurationSetResourceLoadStatisticsDirectory):
3109         * UIProcess/API/C/WKContextConfigurationRef.h:
3110         * UIProcess/WebProcessPool.cpp:
3111         (WebKit::legacyWebsiteDataStoreConfiguration):
3112
3113 2017-06-02  Brady Eidson  <beidson@apple.com>
3114
3115         Prevent scheme handlers from handling all built-in URL schemes.
3116         <rdar://problem/32404790> and https://bugs.webkit.org/show_bug.cgi?id=172869
3117
3118         Reviewed by Andy Estes.
3119
3120         * UIProcess/API/Cocoa/WKWebView.mm:
3121         (+[WKWebView handlesURLScheme:]): Check against WebCore's new master list of URL schemes.
3122
3123 2017-06-02  Simon Fraser  <simon.fraser@apple.com>
3124
3125         All scroll peformance logging should happen in the UI process
3126         https://bugs.webkit.org/show_bug.cgi?id=172874
3127         rdar://problem/24474830
3128
3129         Reviewed by Tim Horton.
3130
3131         Printing to stdout from the WebProcess doesn't show up anywhere in non-development builds,
3132         so we have to log from the UI process.
3133
3134         Achieve this by adding a PerformanceLoggingClient to Page which forwards messages to
3135         WebPageProxy, which prints them with the same format they had before. Some plumbing through
3136         PlatformCALayerClient and GraphicsLayerClient is required to get messages from TileControllers
3137         through to something that can get to Page.
3138
3139         * UIProcess/WebPageProxy.cpp:
3140         (WebKit::WebPageProxy::logScrollingEvent):
3141         * UIProcess/WebPageProxy.h:
3142         * UIProcess/WebPageProxy.messages.in:
3143         * WebKit2.xcodeproj/project.pbxproj:
3144         * WebProcess/WebCoreSupport/WebPerformanceLoggingClient.cpp: Added.
3145         (WebKit::WebPerformanceLoggingClient::WebPerformanceLoggingClient):
3146         (WebKit::WebPerformanceLoggingClient::logScrollingEvent):
3147         * WebProcess/WebCoreSupport/WebPerformanceLoggingClient.h: Added.
3148         * WebProcess/WebPage/WebPage.cpp:
3149         (WebKit::m_cpuLimit):
3150
3151 2017-06-02  Chris Dumez  <cdumez@apple.com>
3152
3153         REGRESSION (r206386): Xactimate Website Crashes @ com.apple.WebKit: WebKit::NPRuntimeObjectMap::convertJSValueToNPVariant + 255
3154         https://bugs.webkit.org/show_bug.cgi?id=172846
3155         <rdar://problem/31093005>
3156
3157         Reviewed by Mark Lam.
3158
3159         Follow-up to r217695 to deal with exceptions potentially thrown by
3160         NPRuntimeObjectMap::convertJSValueToNPVariant() as well.
3161
3162         * WebProcess/Plugins/Netscape/NPJSObject.cpp:
3163         (WebKit::NPJSObject::invoke):
3164
3165 2017-06-02  Jeremy Jones  <jeremyj@apple.com>
3166
3167         Add abilility to specify presentingApplicationPID for a WebProcessPool.
3168         https://bugs.webkit.org/show_bug.cgi?id=172839
3169         rdar://problem/32247170
3170
3171         Reviewed by Tim Horton.
3172
3173         Expose presentingApplicationPID through WebProcessPoolConfiguration.
3174         This allows rehosted WebViews to specify the hosting application.
3175
3176         * UIProcess/API/APIProcessPoolConfiguration.cpp:
3177         (API::ProcessPoolConfiguration::copy):
3178         * UIProcess/API/APIProcessPoolConfiguration.h:
3179         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
3180         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
3181         (-[_WKProcessPoolConfiguration setPresentingApplicationPID:]):
3182         (-[_WKProcessPoolConfiguration presentingApplicationPID]):
3183         * UIProcess/WebProcessPool.cpp:
3184         (WebKit::WebProcessPool::ensureNetworkProcess):
3185         (WebKit::WebProcessPool::createNewWebProcess):
3186
3187 2017-06-02  Frederic Wang  <fwang@igalia.com>
3188
3189         [Mac] Use compositing for frames when ScrollingTreeIncludesFrames=true
3190         https://bugs.webkit.org/show_bug.cgi?id=172851
3191
3192         Reviewed by Simon Fraser.
3193
3194         When fast frame scrolling is supported on mac (bug 171667), scrollable frames will require
3195         special composited layer. This commit enables that on mac but only when
3196         ScrollingTreeIncludesFrames=true, so that the default behavior is unchanged.
3197
3198         * WebProcess/WebCoreSupport/WebChromeClient.h: Make scrollable inner frame trigger
3199         compositing on Mac by default. This is ignored on mac when ScrollingTreeIncludesFrames=false.
3200         Rename ScrollableInnerFrameTrigger to ScrollableNonMainFrameTrigger.
3201
3202 2017-06-02  Zalan Bujtas  <zalan@apple.com>
3203
3204         Allow clients to override viewport size for CSS viewport units.
3205         https://bugs.webkit.org/show_bug.cgi?id=172838
3206         <rdar://problem/32523441>
3207
3208         Reviewed by Tim Horton.
3209
3210         This enables auto-sizing clients to ensure that styles relative to the viewport are
3211         resolved to a set value (presumably the size of the container) as opposed to the preferred
3212         document size (which is set as the FrameView size).
3213
3214         * Shared/WebPageCreationParameters.cpp:
3215         (WebKit::WebPageCreationParameters::encode):
3216         (WebKit::WebPageCreationParameters::decode):
3217         * Shared/WebPageCreationParameters.h:
3218         * UIProcess/API/Cocoa/WKWebView.mm:
3219         (-[WKWebView _viewportSizeForCSSViewportUnits]):
3220         (-[WKWebView _setViewportSizeForCSSViewportUnits:]):
3221         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3222         * UIProcess/WebPageProxy.cpp:
3223         (WebKit::WebPageProxy::creationParameters):
3224         (WebKit::WebPageProxy::setViewportSizeForCSSViewportUnits):
3225         * UIProcess/WebPageProxy.h:
3226         (WebKit::WebPageProxy::viewportSizeForCSSViewportUnits):
3227         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3228         (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage):
3229         * WebProcess/WebPage/WebPage.cpp:
3230         (WebKit::m_cpuLimit):
3231         (WebKit::WebPage::setViewportSizeForCSSViewportUnits):
3232         * WebProcess/WebPage/WebPage.h:
3233         (WebKit::WebPage::viewportSizeForCSSViewportUnits):
3234         * WebProcess/WebPage/WebPage.messages.in:
3235
3236 2017-06-02  Simon Fraser  <simon.fraser@apple.com>
3237
3238         Get <chrono> out of StdLibExtras.h
3239         https://bugs.webkit.org/show_bug.cgi?id=172744
3240
3241         Reviewed by Zalan Bujtas.
3242
3243         Only bring in <chrono> and namespace std::literals::chrono_literals when necessary.
3244
3245         * NetworkProcess/cache/NetworkCache.cpp:
3246         * NetworkProcess/cache/NetworkCacheFileSystem.h:
3247         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
3248         * NetworkProcess/cache/NetworkCacheStorage.cpp:
3249         (WebKit::NetworkCache::computeRecordWorth):
3250         * Shared/mac/RemoteLayerBackingStoreCollection.mm:
3251         * WebProcess/Cookies/WebCookieManager.h:
3252
3253 2017-06-02  Andy Estes  <aestes@apple.com>
3254
3255         [Cocoa] Add a "supportedCountries" property to ApplePayPaymentRequest
3256         https://bugs.webkit.org/show_bug.cgi?id=172832
3257         <rdar://problem/30735544>
3258
3259         Reviewed by Alex Christensen.
3260
3261         * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
3262         (IPC::ArgumentCoder<PaymentRequest>::encode):
3263         (IPC::ArgumentCoder<PaymentRequest>::decode):
3264         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
3265         (WebKit::toNSSet):
3266         (WebKit::toPKPaymentRequest):
3267
3268 2017-06-02  Dan Bernstein  <mitz@apple.com>
3269
3270         [Xcode] Header postprocessing should be based on the target OS version rather than the builder OS version
3271         https://bugs.webkit.org/show_bug.cgi?id=172860
3272
3273         Reviewed by Anders Carlsson.
3274
3275         * Configurations/WebKit.xcconfig: Use TARGET_MAC_OS_X_VERSION_MAJOR
3276
3277 2017-06-02  Gwang Yoon Hwang  <yoon@igalia.com>
3278
3279         REGRESSION(r217214): [Coordinated Graphics] UpdateAtlas didn't released while resetting testrunner
3280         https://bugs.webkit.org/show_bug.cgi?id=172746
3281
3282         Reviewed by Žan Doberšek.
3283
3284         After clearing update atlases in CompositingCoordinator, we should
3285         release update atlases at the compositing thread, too.
3286
3287         We cannot remove update atlases from the CoordinatedGraphicsScene
3288         without regard to update scheduling, since previously committed scene
3289         states can try to use already released update atlases.
3290         To prevent this timing problem, releasing update atlases should be done
3291         with a update scheduler.
3292
3293         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
3294         (WebKit::CoordinatedGraphicsScene::syncRemoteContent):
3295         (WebKit::CoordinatedGraphicsScene::appendUpdate):
3296         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
3297         Use WTF::Function instead of std::function
3298         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
3299         (WebKit::ThreadedCompositor::updateSceneState):
3300         (WebKit::ThreadedCompositor::releaseUpdateAtlases):
3301         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
3302         (WebKit::ThreadedCompositor::flushPendingLayerChanges):
3303         Release UpdateAtlases at the end of compositing states update, too.
3304         (WebKit::CompositingCoordinator::clearUpdateAtlases):
3305
3306 2017-06-01  Andreas Kling  <akling@apple.com>
3307
3308         [Mac] Remove backing store for layers that are outside the viewport
3309         https://bugs.webkit.org/show_bug.cgi?id=170082
3310         <rdar://problem/31245009>
3311
3312         Reviewed by Simon Fraser.
3313
3314         * WebProcess/WebPage/mac/PlatformCALayerRemote.h:
3315
3316 2017-06-01  Chris Dumez  <cdumez@apple.com>
3317
3318         REGRESSION (r206386): Xactimate Website Crashes @ com.apple.WebKit: WebKit::NPRuntimeObjectMap::convertJSValueToNPVariant + 255
3319         https://bugs.webkit.org/show_bug.cgi?id=172846
3320         <rdar://problem/31093005>
3321
3322         Reviewed by Andreas Kling.
3323
3324         In NPJSObject::invoke(), return early if there was an exception when calling JSC::call().
3325         Using the value returned by JSC::call() when an exception occurred is unsafe.
3326
3327         * WebProcess/Plugins/Netscape/NPJSObject.cpp:
3328         (WebKit::NPJSObject::invoke):
3329
3330 2017-06-01  Jon Lee  <jonlee@apple.com>
3331
3332         Rename an experimental feature item
3333         https://bugs.webkit.org/show_bug.cgi?id=172830
3334
3335         Reviewed by Joseph Pecoraro.
3336
3337         * Shared/WebPreferencesDefinitions.h:
3338
3339 2017-06-01  Andy Estes  <aestes@apple.com>
3340
3341         REGRESSION (r217626): ENABLE_APPLE_PAY_SESSION_V3 was disabled by mistake
3342         https://bugs.webkit.org/show_bug.cgi?id=172828
3343
3344         Reviewed by Beth Dakin.
3345
3346         * Configurations/FeatureDefines.xcconfig:
3347
3348 2017-06-01  Chris Dumez  <cdumez@apple.com>
3349
3350         [WK2] Update plugin process sandbox profile for flash plugin on HBONow
3351         https://bugs.webkit.org/show_bug.cgi?id=172820
3352         <rdar://problem/32513297>
3353
3354         Reviewed by Brent Fulgham.
3355
3356         Relax the IOKit whitelist to silence sandbox violations by Flash plugin on
3357         HBONow.
3358
3359         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
3360
3361 2017-06-01  Andy Estes  <aestes@apple.com>
3362
3363         [Cocoa] Upstream support for JCB as a supported payment network
3364         https://bugs.webkit.org/show_bug.cgi?id=172819
3365
3366         Reviewed by Tim Horton.
3367
3368         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
3369         (WebKit::toSupportedNetwork):
3370         (WebKit::toAdditionalSupportedNetwork): Deleted.
3371
3372 2017-05-31  Andy Estes  <aestes@apple.com>
3373
3374         [Cocoa] "administrativeArea" contact field maps to the wrong CNPostalAddress key when creating NSErrors
3375         https://bugs.webkit.org/show_bug.cgi?id=172784
3376         <rdar://problem/32414416>
3377
3378         Reviewed by Beth Dakin.
3379
3380         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
3381         (WebKit::toNSError): Used CNPostalAddressStateKey instead of CNPostalAddressCityKey.
3382
3383 2017-05-31  Andy Estes  <aestes@apple.com>
3384
3385         Rename ENABLE_APPLE_PAY_DELEGATE to ENABLE_APPLE_PAY_SESSION_V3 and bump the supported version number
3386         https://bugs.webkit.org/show_bug.cgi?id=172366
3387
3388         Reviewed by Daniel Bates.
3389
3390         * Configurations/FeatureDefines.xcconfig:
3391         * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
3392         (WebKit::WebPaymentCoordinator::supportsVersion):
3393
3394 2017-05-31  Chris Dumez  <cdumez@apple.com>
3395
3396         [WK2] Fix bad assertion in BackgroundProcessResponsivenessTimer::scheduleNextResponsivenessCheck()
3397         https://bugs.webkit.org/show_bug.cgi?id=172763
3398
3399         Reviewed by Zalan Bujtas.
3400
3401         Fix bad assertion in BackgroundProcessResponsivenessTimer::scheduleNextResponsivenessCheck().
3402         It gets hit when a process becomes unresponsive. The reason is that RunLoop::Timer::isActive()
3403         still returns true while the timerFired() callback is called.
3404
3405         * UIProcess/BackgroundProcessResponsivenessTimer.cpp:
3406         (WebKit::BackgroundProcessResponsivenessTimer::scheduleNextResponsivenessCheck):
3407
3408 2017-05-31  Youenn Fablet  <youenn@apple.com>
3409
3410         Make WebRTC legacy API switch an experimental feature
3411         https://bugs.webkit.org/show_bug.cgi?id=172760
3412
3413         Reviewed by Eric Carlson.
3414
3415         This patch adds an experimental feature to disable WebRTC legacy API.
3416         We keep the runtime flag as "enable WebRTC legacy API" to minimize the changes and as it is clearer in the code.
3417
3418         * Shared/WebPreferencesDefinitions.h:
3419         * UIProcess/API/C/WKPreferences.cpp:
3420         (WKPreferencesSetWebRTCLegacyAPIEnabled):
3421         (WKPreferencesGetWebRTCLegacyAPIEnabled):
3422         * UIProcess/API/Cocoa/WKPreferences.mm:
3423         (-[WKPreferences _webRTCLegacyAPIEnabled]):
3424         (-[WKPreferences _setWebRTCLegacyAPIEnabled:]):
3425         * WebProcess/WebPage/WebPage.cpp:
3426         (WebKit::WebPage::updatePreferences):
3427
3428 2017-05-31  Matt Lewis  <jlewis3@apple.com>
3429
3430         Unreviewed, rolling out r217603.
3431
3432         This patch broke the internal builds.
3433
3434         Reverted changeset:
3435
3436         "Get <chrono> out of StdLibExtras.h"
3437         https://bugs.webkit.org/show_bug.cgi?id=172744
3438         http://trac.webkit.org/changeset/217603
3439
3440 2017-05-31  Brent Fulgham  <bfulgham@apple.com>
3441
3442         Make ResourceLoadStatistics testing more reliable
3443         https://bugs.webkit.org/show_bug.cgi?id=172730
3444         <rdar://problem/32028373>
3445
3446         Reviewed by Andy Estes.
3447
3448         * UIProcess/WebProcessProxy.cpp:
3449         (WebKit::WebProcessProxy::notifyPageStatisticsAndDataRecordsProcessed): Add a convenience method to notify the
3450         WebProcess when the UIProcess has finished processing the load statistics data.
3451         * UIProcess/WebProcessProxy.h:
3452         * UIProcess/WebResourceLoadStatisticsStore.cpp:
3453         (WebKit::WebResourceLoadStatisticsStore::processStatisticsAndDataRecords): Notify clients (if they requested) when
3454         statistics have been processed.
3455
3456 2017-05-31  Simon Fraser  <simon.fraser@apple.com>
3457
3458         Get <chrono> out of StdLibExtras.h
3459         https://bugs.webkit.org/show_bug.cgi?id=172744
3460
3461         Reviewed by Saam Barati.
3462
3463         Only bring in <chrono> and namespace std::literals::chrono_literals when necessary.
3464
3465         * NetworkProcess/cache/NetworkCache.cpp:
3466         * NetworkProcess/cache/NetworkCacheFileSystem.h:
3467         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
3468         * NetworkProcess/cache/NetworkCacheStorage.cpp:
3469         (WebKit::NetworkCache::computeRecordWorth):
3470         * Shared/mac/RemoteLayerBackingStoreCollection.mm:
3471         * WebProcess/Cookies/WebCookieManager.h:
3472
3473 2017-05-31  Zan Dobersek  <zdobersek@igalia.com>
3474
3475         CoordinatedLayerTreeHost: properly support async force repaints
3476         https://bugs.webkit.org/show_bug.cgi?id=172444
3477
3478         Reviewed by Carlos Garcia Campos.
3479
3480         Before these changes the force-repaint callbacks were executed once
3481         the next layer flush was performed. This is not appropriate since
3482         with the threaded compositor this was done even before the flushed
3483         state was handled on the rendering thread.
3484
3485         Instead, the callback should be invoked once the first following
3486         flushed state is rendered through the compositor and the update
3487         finish is reported back to CoordinatedLayerTreeHost through invoking
3488         the renderNextFrame() method.
3489
3490         If the force-repaint callback is registered while a state update is
3491         already being processed by the renderer (i.e. the threaded compositor),
3492         the callback is invoked only after the following flush, which is
3493         executed when renderNextFrame() is called for the current state update.
3494
3495         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
3496         Add the forceFrameSync() method that forces the following state flush
3497         to produce a state update that will be handled by the compositor.
3498         This ensures that the compositor informs the CoordinatedLayerTreeHost
3499         once this state update is done, invoking renderNextFrame() which would
3500         handle the force-repaint callback.
3501         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
3502         (WebKit::CoordinatedLayerTreeHost::forceRepaintAsync):
3503         (WebKit::CoordinatedLayerTreeHost::renderNextFrame):
3504         (WebKit::CoordinatedLayerTreeHost::layerFlushTimerFired):
3505         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h:
3506         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h:
3507         Remove the forceRepaintAsync() override that returned false.
3508
3509 2017-05-31  Carlos Garcia Campos  <cgarcia@igalia.com>
3510
3511         Unreviewed. Fix copy-paste error added in r217209.
3512
3513         It seems I pasted twice.
3514
3515         * UIProcess/API/gtk/WebKitContextMenuItem.h:
3516
3517 2017-05-30  Tim Horton  <timothy_horton@apple.com>
3518
3519         Keyboard autocorrections do not apply with an active selection (but keyboard acts like they did)
3520         https://bugs.webkit.org/show_bug.cgi?id=172735
3521         <rdar://problem/32015977>
3522
3523         Reviewed by Enrica Casucci.
3524
3525         * UIProcess/API/Cocoa/WKWebView.mm:
3526         (-[WKWebView applyAutocorrection:toString:withCompletionHandler:]):
3527         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3528         Expose applyAutocorrection on the WKTesting category for use from UIScriptController.
3529
3530         * WebProcess/WebPage/ios/WebPageIOS.mm:
3531         (WebKit::WebPage::syncApplyAutocorrection):
3532         If there is a range selection and it precisely matches the autocorrection's "before"
3533         string, allow the autocorrection to take place.
3534
3535 2017-05-30  Joseph Pecoraro  <pecoraro@apple.com>
3536
3537         Web Inspector: images dragged from Inspector to Desktop are named "Unknown.png"
3538         https://bugs.webkit.org/show_bug.cgi?id=141515
3539         <rdar://problem/9251308>
3540
3541         Reviewed by Wenson Hsieh.
3542
3543         In Web&n