[WK2][Mac] Stop allowing access to disk arbitration process
[WebKit-https.git] / Source / WebKit2 / ChangeLog
1 2017-04-12  Brent Fulgham  <bfulgham@apple.com>
2
3         [WK2][Mac] Stop allowing access to disk arbitration process
4         https://bugs.webkit.org/show_bug.cgi?id=170517
5         <rdar://problem/31071151>
6
7         Reviewed by Alex Christensen.
8
9         * WebProcess/com.apple.WebProcess.sb.in:
10
11 2017-04-12  Beth Dakin  <bdakin@apple.com>
12
13         32-bit build fix.
14
15         * UIProcess/API/mac/WKView.mm:
16         (-[WKView _mediaPlaybackControlsView]):
17
18 2017-04-12  Beth Dakin  <bdakin@apple.com>
19
20         More 32-bit build fix.
21
22         * UIProcess/API/Cocoa/WKWebView.mm:
23         (-[WKWebView _mediaPlaybackControlsView]):
24         (-[WKWebView _addMediaPlaybackControlsView:]):
25         * UIProcess/API/mac/WKView.mm:
26         (-[WKView _mediaPlaybackControlsView]):
27         (-[WKView _addMediaPlaybackControlsView:]):
28
29 2017-04-12  Beth Dakin  <bdakin@apple.com>
30
31         Another 32 bit build fix.
32
33         * UIProcess/Cocoa/WebViewImpl.h:
34         * UIProcess/Cocoa/WebViewImpl.mm:
35         (WebKit::WebViewImpl::mediaPlaybackControlsView):
36
37 2017-04-12  Alex Christensen  <achristensen@webkit.org>
38
39         Stop using didReceiveDataArray callback on El Capitan
40         https://bugs.webkit.org/show_bug.cgi?id=170780
41
42         Reviewed by Brady Eidson.
43
44         * NetworkProcess/NetworkLoad.cpp:
45         (WebKit::NetworkLoad::supportsDataArray): Deleted.
46         (WebKit::NetworkLoad::didReceiveDataArray): Deleted.
47         * NetworkProcess/NetworkLoad.h:
48
49 2017-04-12  Beth Dakin  <bdakin@apple.com>
50
51         Speculative build fix.
52
53         * UIProcess/API/Cocoa/WKViewPrivate.h:
54
55 2017-04-12  Beth Dakin  <bdakin@apple.com>
56
57         Attempted build fix.
58
59         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
60
61 2017-04-12  Beth Dakin  <bdakin@apple.com>
62
63         Adopt AVKit name change from AVFunctionBar* to AVTouchBar*
64         https://bugs.webkit.org/show_bug.cgi?id=170693
65         -and corresponding-
66         rdar://problem/31230018
67
68         Reviewed by Sam Weinig.
69
70         Since the new names only apply to some versions of macOS, this patch uses typedefs 
71         for the older OS’s. SO:
72
73         AVFunctionBarScrubber is now AVTouchBarScrubber
74
75         AVFunctionBarPlaybackControlsProvider is now AVTouchBarPlaybackControlsProvider
76
77         AVFunctionBarMediaSelectionOption is now AVTouchBarMediaSelectionOption
78
79         And the protocol AVFunctionBarPlaybackControlsControlling is now 
80         AVTouchBarPlaybackControlsControlling
81
82         Use the new name.
83         * UIProcess/API/Cocoa/WKViewPrivate.h:
84         * UIProcess/API/Cocoa/WKWebView.mm:
85         (-[WKWebView _mediaPlaybackControlsView]):
86         (-[WKWebView _addMediaPlaybackControlsView:]):
87         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
88         * UIProcess/API/mac/WKView.mm:
89         (-[WKView _mediaPlaybackControlsView]):
90         (-[WKView _addMediaPlaybackControlsView:]):
91         * UIProcess/Cocoa/WebViewImpl.h:
92
93         Soft links and allocations cannot use the typedefs.
94         * UIProcess/Cocoa/WebViewImpl.mm:
95         (WebKit::WebViewImpl::mediaPlaybackControlsView):
96         (WebKit::WebViewImpl::updateMediaTouchBar):
97
98 2017-04-12  Eric Carlson  <eric.carlson@apple.com>
99
100         [MediaStream] Audio source in UI process not identified as capture source
101         https://bugs.webkit.org/show_bug.cgi?id=170776
102
103         Reviewed by Youenn Fablet.
104
105         * WebProcess/cocoa/UserMediaCaptureManager.cpp: Override isCaptureSource.
106
107 2017-04-12  Andrew Gold  <agold@apple.com>
108
109         Allow iOS to toggle webRTCAPI legacy flag.
110         https://bugs.webkit.org/show_bug.cgi?id=170735
111
112         Reviewed by Eric Carlson.
113
114         * UIProcess/API/Cocoa/WKPreferences.mm:
115         (-[WKPreferences _webRTCLegacyAPIEnabled]):
116         (-[WKPreferences _setWebRTCLegacyAPIEnabled:]):
117         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
118
119 2017-04-12  Yusuke Suzuki  <utatane.tea@gmail.com>
120
121         Unreviewed, build fix for GTK port after r215262
122         https://bugs.webkit.org/show_bug.cgi?id=170758
123
124         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
125         (WebKit::NetworkDataTaskSoup::didRead):
126
127 2017-04-12  Yusuke Suzuki  <utatane.tea@gmail.com>
128
129         [WTF] Introduce Thread class and use RefPtr<Thread> and align Windows Threading implementation semantics to Pthread one
130         https://bugs.webkit.org/show_bug.cgi?id=170502
131
132         Reviewed by Mark Lam.
133
134         Mechanical change. Use Thread:: APIs.
135
136         * NetworkProcess/NetworkProcess.cpp:
137         (WebKit::NetworkProcess::initializeNetworkProcess):
138         * NetworkProcess/cache/NetworkCacheIOChannelSoup.cpp:
139         (WebKit::NetworkCache::IOChannel::readSyncInThread):
140         * Platform/IPC/Connection.cpp:
141         (IPC::Connection::processIncomingMessage):
142         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h:
143         (WebKit::XPCServiceInitializer):
144         * UIProcess/linux/MemoryPressureMonitor.cpp:
145         (WebKit::MemoryPressureMonitor::MemoryPressureMonitor):
146         * WebProcess/WebProcess.cpp:
147         (WebKit::WebProcess::initializeWebProcess):
148
149 2017-04-10  Antti Koivisto  <antti@apple.com>
150
151         Cache small media resources in disk cache
152         https://bugs.webkit.org/show_bug.cgi?id=170676
153         <rdar://problem/31532649>
154
155         Reviewed by Andreas Kling.
156
157         * NetworkProcess/cache/NetworkCache.cpp:
158         (WebKit::NetworkCache::makeRetrieveDecision):
159
160             Allow retrieving media resources.
161
162         (WebKit::NetworkCache::expectedTotalResourceSizeFromContentRange):
163         (WebKit::NetworkCache::expectedTotalResourceSize):
164         (WebKit::NetworkCache::makeStoreDecision):
165
166             Store media resource if we can figure out its total size and it is less than 5MB
167             (and it is cacheable by the usual rules).
168
169 2017-04-12  Alex Christensen  <achristensen@webkit.org>
170
171         Modernize vector adoption
172         https://bugs.webkit.org/show_bug.cgi?id=170758
173
174         Reviewed by Geoffrey Garen.
175
176         * NetworkProcess/capture/NetworkCaptureEvent.cpp:
177         (WebKit::NetworkCapture::JSONCoder<WebCore::SharedBuffer>::decode):
178         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
179         (WebKit::WebPlatformStrategies::bufferForType):
180
181 2017-04-12  Zan Dobersek  <zdobersek@igalia.com>
182
183         Unreviewed GTK+ debug build fix. Drop an unused debug-only member
184         variable in the CompositingRunLoop class.
185
186         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.h:
187
188 2017-04-11  Zan Dobersek  <zdobersek@igalia.com>
189
190         [GTK] Use the DisplayRefreshMonitor facilities
191         https://bugs.webkit.org/show_bug.cgi?id=170599
192
193         Reviewed by Carlos Garcia Campos.
194
195         ThreadedCompositor gains a DisplayRefreshMonitor member that it can use
196         to better coordinate display refresh callbacks on the main thread. Still,
197         because currently the GTK+ port doesn't have a reliable way of notifying
198         the ThreadedCompositor of a vsync event, a timer targeting 60FPS is used
199         in order to keep the updates at a reasonable rate. When the timer is fired,
200         the ThreadedCompositor decides how to proceed based on state changes that
201         might have occurred during composition or whether there's any display
202         refresh callbacks that require handling on the main thread.
203
204         CompositingRunLoop now stores its state in an atomic variable that's then
205         inspected whenever a new update is scheduled or completed. When scheduled,
206         if there's no update in progress, a new update is requested through the
207         timer. If there's already an update in progress, a new update is marked
208         as pending after the current one completes. In that case, when the update
209         is completed, a new update is requested through the timer.
210
211         ThreadedDisplayRefreshMonitor is used to coordinate updates between the
212         main and the composition thread whenever the CoordinatedGraphics state
213         demands it, or whenever there are clients registered to that monitor that
214         require an update (e.g. a requestAnimationFrame() callback). After the
215         update on the composition thread is finished, and the DisplayRefreshMonitor
216         object requires an update, a callback at the same priority as the layer
217         flush timer is scheduled on the main thread. In that callback we handle
218         any clients registered for this DisplayRefreshMonitor before proceeding
219         to handle any changes to the CoordinatedGraphics scene. In case the
220         DisplayRefreshMonitor clients or the layer flushes already queued up
221         any changes to the state, we immediately ask the ThreadedCompositor for
222         an update.
223
224         * PlatformGTK.cmake:
225         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
226         (WebKit::CoordinatedGraphicsScene::updateViewport):
227         (WebKit::CoordinatedGraphicsScene::commitSceneState):
228         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
229         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:
230         (WebKit::CompositingRunLoop::CompositingRunLoop):
231         (WebKit::CompositingRunLoop::isActive):
232         (WebKit::CompositingRunLoop::scheduleUpdate):
233         (WebKit::CompositingRunLoop::stopUpdates):
234         (WebKit::CompositingRunLoop::updateCompleted):
235         (WebKit::CompositingRunLoop::updateTimerFired):
236         (WebKit::CompositingRunLoop::isCurrent):
237         (WebKit::CompositingRunLoop::startUpdateTimer): Deleted.
238         (WebKit::CompositingRunLoop::stopUpdateTimer): Deleted.
239         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.h:
240         (): Deleted.
241         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
242         (WebKit::m_displayRefreshMonitor):
243         (WebKit::ThreadedCompositor::invalidate):
244         (WebKit::ThreadedCompositor::setNativeSurfaceHandleForCompositing):
245         (WebKit::ThreadedCompositor::updateViewport):
246         (WebKit::ThreadedCompositor::scheduleDisplayImmediately):
247         (WebKit::ThreadedCompositor::renderLayerTree):
248         (WebKit::ThreadedCompositor::sceneUpdateFinished):
249         (WebKit::ThreadedCompositor::updateSceneState):
250         (WebKit::ThreadedCompositor::displayRefreshMonitor):
251         (WebKit::ThreadedCompositor::renderNextFrameIfNeeded):
252         (WebKit::ThreadedCompositor::completeCoordinatedUpdateIfNeeded):
253         (WebKit::ThreadedCompositor::coordinateUpdateCompletionWithClient):
254         (WebKit::ThreadedCompositor::performFrameCompletion):
255         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
256         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.cpp: Added.
257         (WebKit::ThreadedDisplayRefreshMonitor::ThreadedDisplayRefreshMonitor):
258         (WebKit::ThreadedDisplayRefreshMonitor::requestRefreshCallback):
259         (WebKit::ThreadedDisplayRefreshMonitor::requiresDisplayRefreshCallback):
260         (WebKit::ThreadedDisplayRefreshMonitor::dispatchDisplayRefreshCallback):
261         (WebKit::ThreadedDisplayRefreshMonitor::invalidate):
262         (WebKit::ThreadedDisplayRefreshMonitor::displayRefreshCallback):
263         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.h: Copied from Source/WebKit2/Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.h.
264         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
265         (WebKit::AcceleratedDrawingArea::createDisplayRefreshMonitor):
266         * WebProcess/WebPage/AcceleratedDrawingArea.h:
267         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp:
268         (WebKit::ThreadedCoordinatedLayerTreeHost::createDisplayRefreshMonitor):
269         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h:
270         * WebProcess/WebPage/LayerTreeHost.h:
271         (WebKit::LayerTreeHost::createDisplayRefreshMonitor):
272
273 2017-04-11  Alex Christensen  <achristensen@webkit.org>
274
275         Modernize and clean up code
276         https://bugs.webkit.org/show_bug.cgi?id=170752
277
278         Reviewed by Sam Weinig.
279
280         * NetworkProcess/NetworkResourceLoader.h:
281         * Shared/WebPreferencesStore.h:
282         * UIProcess/API/APIHitTestResult.cpp:
283         (API::HitTestResult::create):
284         * UIProcess/API/APIHitTestResult.h:
285         * UIProcess/API/C/WKPreferences.cpp:
286         (WKPreferencesCreate):
287         (WKPreferencesCreateWithIdentifier):
288         (WKPreferencesCreateCopy):
289         * UIProcess/Authentication/AuthenticationChallengeProxy.h:
290         * UIProcess/WebPreferences.cpp:
291         (WebKit::WebPreferences::createWithLegacyDefaults):
292         (WebKit::WebPreferences::copy):
293         * UIProcess/WebPreferences.h:
294         * WebProcess/Network/WebLoaderStrategy.h:
295         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
296         (WebKit::WebEditorClient::requestCheckingOfString):
297         * WebProcess/WebPage/WebPage.cpp:
298         (WebKit::WebPage::addTextCheckingRequest):
299         * WebProcess/WebPage/WebPage.h:
300         * WebProcess/WebPage/ios/WebPageIOS.mm:
301         (WebKit::WebPage::rangeForWebSelectionAtPosition):
302         (WebKit::WebPage::rangeForBlockAtPoint):
303         (WebKit::WebPage::expandedRangeFromHandle):
304         (WebKit::WebPage::contractedRangeFromHandle):
305         (WebKit::WebPage::computeExpandAndShrinkThresholdsForHandle):
306         (WebKit::WebPage::changeBlockSelection):
307         (WebKit::WebPage::rangeForGranularityAtPoint):
308         (WebKit::WebPage::computePagesForPrintingAndDrawToPDF):
309
310 2017-04-11  Dean Jackson  <dino@apple.com>
311
312         Disable outdated WritableStream API
313         https://bugs.webkit.org/show_bug.cgi?id=170749
314         <rdar://problem/31446233>
315
316         Reviewed by Tim Horton.
317
318         The API we implement is no longer accurate. Disable it until we
319         are compatible with the new specification
320
321         * Configurations/FeatureDefines.xcconfig:
322
323 2017-04-11  Dan Bernstein  <mitz@apple.com>
324
325         [Cocoa] WebKit unnecessarily soft-links CorePrediction
326         https://bugs.webkit.org/show_bug.cgi?id=170644
327
328         Reviewed by Sam Weinig.
329
330         * Configurations/BaseTarget.xcconfig: Defined HAVE_CORE_PREDICTION and added
331           HAVE_CORE_PREDICTION to the preprocessor defintions when the former is YES.
332
333         * Configurations/WebKit.xcconfig: Have the linker link against CorePrediction where
334           available. On macOS, use weak linking, because CorePrediction is not available in the
335           Base System.
336
337         * Platform/classifier/cocoa/CorePredictionSoftLink.h: Removed.
338
339         * Platform/classifier/cocoa/ResourceLoadStatisticsClassifierCocoa.cpp: Guarded with
340           #if HAVE(CORE_PREDICTION).
341         (WebKit::isNullFunctionPointer): Added this helper.
342         (WebKit::ResourceLoadStatisticsClassifierCocoa::canUseCorePrediction): Replaced
343           dlopen()-based runtime check with a null check.
344
345         * Platform/classifier/cocoa/ResourceLoadStatisticsClassifierCocoa.h: Guarded with #if
346           HAVE(CORE_PREDICTION).
347
348         * Platform/spi/Cocoa/CorePredictionSPI.h: Added.
349
350         * UIProcess/WebResourceLoadStatisticsStore.h: Updated guards to include HAVE(CORE_PREDICTION).
351
352         * WebKit2.xcodeproj/project.pbxproj: pdated file references for removal and addition.
353
354 2017-04-11  David Quesada  <david_quesada@apple.com>
355
356         Add SPI for handling geolocation authorization requests
357         https://bugs.webkit.org/show_bug.cgi?id=170362
358         rdar://problem/17508627
359
360         Reviewed by Alex Christensen.
361
362         Add a new WKUIDelegate method for the WKGeolocationProviderIOS to call when a web page
363         requests geolocation access. To support testing this change, make it possible to override
364         the CoreLocation abstraction WKGeolocationProviderIOS uses. There is now a configurable
365         object on the process pool that implements a protocol for providing location updates for
366         web views in the process pool. If the client doesn't provide this object,
367         WKGeolocationProviderIOS falls back to an object that wraps the existing WebKit1
368         WebGeolocationCoreLocationProvider and conforms to the new protocol.
369
370         * Shared/Cocoa/APIObject.mm:
371         (API::Object::newObject):
372         * Shared/WebGeolocationPosition.h:
373         (WebKit::WebGeolocationPosition::create):
374         * UIProcess/API/C/WKGeolocationPosition.cpp:
375         (WKGeolocationPositionCreate_b):
376         * UIProcess/API/Cocoa/WKProcessPool.mm:
377         (-[WKProcessPool _coreLocationProvider]):
378         (-[WKProcessPool _setCoreLocationProvider:]):
379         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
380         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
381         * UIProcess/API/Cocoa/_WKGeolocationCoreLocationProvider.h: Copied from Source/WebKit2/UIProcess/API/C/WKGeolocationPosition.cpp.
382         * UIProcess/API/Cocoa/_WKGeolocationPosition.h: Copied from Source/WebKit2/UIProcess/API/C/WKGeolocationPosition.cpp.
383         * UIProcess/API/Cocoa/_WKGeolocationPosition.mm: Added.
384         (WebKit::if):
385         (-[_WKGeolocationPosition dealloc]):
386         (-[_WKGeolocationPosition _apiObject]):
387         * UIProcess/API/Cocoa/_WKGeolocationPositionInternal.h: Copied from Source/WebKit2/UIProcess/API/C/WKGeolocationPosition.cpp.
388         (WebKit::wrapper):
389         * UIProcess/ios/WKGeolocationProviderIOS.mm:
390         (kit):
391         (-[WKGeolocationProviderIOS initWithProcessPool:]):
392         (-[WKGeolocationProviderIOS geolocationAuthorizationGranted]):
393         (-[WKGeolocationProviderIOS positionChanged:]):
394         (-[WKLegacyCoreLocationProvider setListener:]):
395         (-[WKLegacyCoreLocationProvider requestGeolocationAuthorization]):
396         (-[WKLegacyCoreLocationProvider start]):
397         (-[WKLegacyCoreLocationProvider stop]):
398         (-[WKLegacyCoreLocationProvider setEnableHighAccuracy:]):
399         (-[WKLegacyCoreLocationProvider geolocationAuthorizationGranted]):
400         (-[WKLegacyCoreLocationProvider geolocationAuthorizationDenied]):
401         (-[WKLegacyCoreLocationProvider positionChanged:]):
402         (-[WKLegacyCoreLocationProvider errorOccurred:]):
403         (-[WKLegacyCoreLocationProvider resetGeolocation]):
404         Implement a new class that bridges the currently used WebGeolocationCoreLocationProvider
405         to conform to the _WKGeolocationCoreLocationProvider protocol that WKGeolocationProviderIOS
406         expects.
407         * WebKit2.xcodeproj/project.pbxproj:
408
409 2017-04-11  Eric Carlson  <eric.carlson@apple.com>
410
411         [MediaStream] Set correct audio session category when capturing audio
412         https://bugs.webkit.org/show_bug.cgi?id=170736
413         <rdar://problem/31559405>
414
415         Reviewed by Jer Noble.
416
417         * UIProcess/WebPageProxy.cpp:
418         (WebKit::WebPageProxy::isPlayingMediaDidChange):
419
420 2017-04-11  Youenn Fablet  <youenn@apple.com>
421
422         Activate WebRTC data channel tests for WK1
423         https://bugs.webkit.org/show_bug.cgi?id=170710
424
425         Reviewed by Eric Carlson.
426
427         * WebProcess/Network/webrtc/LibWebRTCProvider.h: Making sure networking is not done in the Web process.
428
429 2017-04-11  Chris Fleizach  <cfleizach@apple.com>
430
431         AX: PDF plugin needs to support PDF-DOM Mode
432         https://bugs.webkit.org/show_bug.cgi?id=170589
433
434         Reviewed by Tim Horton.
435
436         Provide access to DOM objects with PDF document. This mean:
437            1) Support a different set of attributes for WKPDFPluginAccessibilityObject.
438                 WKPDFPluginAccessibilityObject is now a group instead of forwarding attribute calls to the pdf layer.
439            2) Connect the focused UI element to the active annotation if possible.
440            3) Mark the PDF associated nodes with an attribute so they can be identified later so their correct parent can be found.
441
442         * WebProcess/Plugins/PDF/PDFLayerControllerSPI.h:
443         * WebProcess/Plugins/PDF/PDFPlugin.h:
444         * WebProcess/Plugins/PDF/PDFPlugin.mm:
445         (-[WKPDFPluginAccessibilityObject pdfLayerController]):
446         (-[WKPDFPluginAccessibilityObject setPdfLayerController:]):
447         (-[WKPDFPluginAccessibilityObject convertRectToScreenSpace:]):
448         (-[WKPDFPluginAccessibilityObject accessibilityAttributeValue:]):
449         (-[WKPDFPluginAccessibilityObject accessibilityAttributeNames]):
450         (-[WKPDFPluginAccessibilityObject accessibilityActionNames]):
451         (-[WKPDFPluginAccessibilityObject accessibilityParameterizedAttributeNames]):
452         (-[WKPDFPluginAccessibilityObject accessibilityFocusedUIElement]):
453         (-[WKPDFPluginAccessibilityObject accessibilityAssociatedControlForAnnotation:]):
454         (-[WKPDFPluginAccessibilityObject accessibilityHitTest:]):
455         (WebKit::PDFPlugin::convertFromRootViewToPDFView):
456         (WebKit::PDFPlugin::convertFromPDFViewToScreen):
457         (WebKit::PDFPlugin::pluginHandlesContentOffsetForAccessibilityHitTest):
458         (WebKit::PDFPlugin::axObjectCache):
459         (WebKit::PDFPlugin::accessibilityShadowPluginParentForElement):
460         * WebProcess/Plugins/PDF/PDFPluginAnnotation.mm:
461         (WebKit::PDFPluginAnnotation::attach):
462         * WebProcess/Plugins/Plugin.h:
463         (WebKit::Plugin::accessibilityShadowPluginParentForElement):
464         (WebKit::Plugin::pluginHandlesContentOffsetForAccessibilityHitTest):
465         * WebProcess/Plugins/PluginView.cpp:
466         (WebKit::PluginView::accessibilityShadowPluginParentForElement):
467         * WebProcess/Plugins/PluginView.h:
468         * WebProcess/WebPage/WebPage.h:
469         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:
470         (-[WKAccessibilityWebPageObject accessibilityHitTest:]):
471
472 2017-04-11  Adrian Perez de Castro  <aperez@igalia.com>
473
474         [GTK] Attach popup menu to web view widget
475         https://bugs.webkit.org/show_bug.cgi?id=145866
476
477         Use gtk_menu_attach_to_widget() to let GTK+ know that popup menus belong to a certain web view.
478         This improves the positioning choices that the toolkit can do, and solves a long-standing issue
479         that caused long popup menus to hang outside of the available display area under Wayland.
480
481         Based on a patch by Jonas Ådahl <jadahl@gmail.com>.
482
483         Reviewed by Carlos Garcia Campos.
484
485         * UIProcess/gtk/WebPopupMenuProxyGtk.cpp:
486         (WebKit::WebPopupMenuProxyGtk::showPopupMenu):
487
488 2017-04-10  Alex Christensen  <achristensen@webkit.org>
489
490         Revert r215217
491         https://bugs.webkit.org/show_bug.cgi?id=170703
492
493         * Configurations/FeatureDefines.xcconfig:
494
495 2017-04-10  Alex Christensen  <achristensen@webkit.org>
496
497         Continue enabling WebRTC
498         https://bugs.webkit.org/show_bug.cgi?id=170703
499
500         Reviewed by Youenn Fablet.
501
502         * Configurations/FeatureDefines.xcconfig:
503
504 2017-04-10  Alex Christensen  <achristensen@webkit.org>
505
506         REGRESSION(r195479) First main resource load in new WebProcess bypasses content extensions
507         https://bugs.webkit.org/show_bug.cgi?id=170707
508         <rdar://problem/27788755>
509
510         Reviewed by Tim Horton.
511
512         We fix this by sending the UserContentController with the WebPageCreationParameters
513         instead of in a IPC message immediately following creation.  By the time the WebPage
514         receives its second message, it has already started loading the first main resource.
515         
516         I also changed all instances of calling ChildProcessProxy::connection() to send a message
517         in favor of calling ChildProcessProxy::send, which does the same thing except if a child
518         process has not started, it will put the message in a queue and send it when the process
519         is finished launching.  This was necessary because the UserContentController is now connected
520         to the process sooner, so there were some API tests that would try to send messages between
521         initiating a process launch and finishing a process launch, and this change preserves the
522         existing behavior in those cases.
523
524         * Shared/WebPageCreationParameters.cpp:
525         (WebKit::WebPageCreationParameters::encode):
526         (WebKit::WebPageCreationParameters::decode):
527         * Shared/WebPageCreationParameters.h:
528         * UIProcess/Databases/DatabaseProcessProxy.cpp:
529         (WebKit::DatabaseProcessProxy::getDatabaseProcessConnection):
530         (WebKit::DatabaseProcessProxy::didFinishLaunching):
531         * UIProcess/Downloads/DownloadProxy.cpp:
532         (WebKit::DownloadProxy::cancel):
533         (WebKit::DownloadProxy::canAuthenticateAgainstProtectionSpace):
534         (WebKit::DownloadProxy::willSendRequest):
535         (WebKit::DownloadProxy::decideDestinationWithSuggestedFilenameAsync):
536         * UIProcess/UserContent/WebUserContentControllerProxy.cpp:
537         (WebKit::WebUserContentControllerProxy::addProcess):
538         (WebKit::WebUserContentControllerProxy::addUserContentWorldUse):
539         (WebKit::WebUserContentControllerProxy::removeUserContentWorldUses):
540         (WebKit::WebUserContentControllerProxy::addUserScript):
541         (WebKit::WebUserContentControllerProxy::removeUserScript):
542         (WebKit::WebUserContentControllerProxy::removeAllUserScripts):
543         (WebKit::WebUserContentControllerProxy::addUserStyleSheet):
544         (WebKit::WebUserContentControllerProxy::removeUserStyleSheet):
545         (WebKit::WebUserContentControllerProxy::removeAllUserStyleSheets):
546         (WebKit::WebUserContentControllerProxy::addUserScriptMessageHandler):
547         (WebKit::WebUserContentControllerProxy::removeUserMessageHandlerForName):
548         (WebKit::WebUserContentControllerProxy::removeAllUserMessageHandlers):
549         (WebKit::WebUserContentControllerProxy::addContentExtension):
550         (WebKit::WebUserContentControllerProxy::removeContentExtension):
551         (WebKit::WebUserContentControllerProxy::removeAllContentExtensions):
552         * UIProcess/UserContent/WebUserContentControllerProxy.h:
553         * UIProcess/VisitedLinkStore.cpp:
554         (WebKit::VisitedLinkStore::removeAll):
555         (WebKit::VisitedLinkStore::pendingVisitedLinksTimerFired):
556         (WebKit::VisitedLinkStore::sendTable):
557         * UIProcess/WebPageProxy.cpp:
558         (WebKit::WebPageProxy::finishInitializingWebPageAfterProcessLaunch):
559         (WebKit::WebPageProxy::creationParameters):
560         * UIProcess/WebProcessProxy.cpp:
561         (WebKit::WebProcessProxy::addWebUserContentControllerProxy):
562         * UIProcess/WebProcessProxy.h:
563         * WebProcess/UserContent/WebUserContentController.h:
564         * WebProcess/WebPage/WebPage.cpp:
565         (WebKit::m_backgroundCPULimit):
566
567 2017-04-10  Alex Christensen  <achristensen@webkit.org>
568
569         Add API to get available content extension identifiers in a WKContentExtensionStore
570         https://bugs.webkit.org/show_bug.cgi?id=170093
571
572         Reviewed by Geoffrey Garen.
573
574         * UIProcess/API/APIContentExtensionStore.cpp:
575         (API::constructedPathPrefix):
576         (API::constructedPathFilter):
577         (API::constructedPath):
578         (API::ContentExtensionStore::getAvailableContentExtensionIdentifiers):
579         * UIProcess/API/APIContentExtensionStore.h:
580         * UIProcess/API/Cocoa/WKContentExtensionStore.h:
581         * UIProcess/API/Cocoa/WKContentExtensionStore.mm:
582         (-[WKContentExtensionStore _compileContentExtensionForIdentifier:encodedContentExtension:completionHandler:releasesArgument:]):
583         (-[WKContentExtensionStore lookUpContentExtensionForIdentifier:completionHandler:]):
584         (-[WKContentExtensionStore getAvailableContentExtensionIdentifiers:]):
585         (-[WKContentExtensionStore removeContentExtensionForIdentifier:completionHandler:]):
586
587 2017-04-10  Jeremy Jones  <jeremyj@apple.com>
588
589         Add CoreAudioCaptureSource.
590         https://bugs.webkit.org/show_bug.cgi?id=170112
591         rdar://problem/30293338
592
593         Reviewed by Tim Horton.
594
595         Add UseAVFoundationAudioCapture preference to switch back from the new default of CoreAudio.
596
597         * Shared/WebPreferencesDefinitions.h:
598         * UIProcess/API/C/WKPreferences.cpp:
599         (WKPreferencesSetUseAVFoundationAudioCapture):
600         (WKPreferencesGetUseAVFoundationAudioCapture):
601         * UIProcess/API/C/WKPreferencesRefPrivate.h:
602         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
603         (WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints):
604         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
605         (WebKit::UserMediaPermissionRequestManagerProxy::syncWithWebCorePrefs):
606         * WebProcess/WebPage/WebPage.cpp:
607         (WebKit::WebPage::updatePreferences):
608
609 2017-04-10  Brent Fulgham  <bfulgham@apple.com>
610
611         [WK2][macOS] Block access to Apple Events before launch.
612         https://bugs.webkit.org/show_bug.cgi?id=170626
613         <rdar://problem/16079334>
614
615         Reviewed by Alexey Proskuryakov.
616
617         Clear the environment of the AppleEvent server name before initializing
618         AppKit so we never bother connecting.
619
620         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.mm:
621         (main):
622
623 2017-04-10  Adrian Perez de Castro  <aperez@igalia.com>
624
625         [GTK] Misplaced right click menu on web page due to deprecated gtk_menu_popup()
626         https://bugs.webkit.org/show_bug.cgi?id=170553
627
628         Reviewed by Michael Catanzaro.
629
630         Use gtk_menu_popup_at_pointer() and gtk_menu_popup_at_rect() when building with GTK+ 3.22 or
631         newer. This allows the Wayland GTK+ backend to properly position popup menus, and also avoids
632         using functions which were deprecated starting at that GTK+ release.
633
634         * UIProcess/gtk/WebContextMenuProxyGtk.cpp:
635         (WebKit::WebContextMenuProxyGtk::show): Use gtk_menu_popup_at_pointer() as there is always a
636         pointer event that can be passed to it.
637         * UIProcess/gtk/WebPopupMenuProxyGtk.cpp:
638         (WebKit::WebPopupMenuProxyGtk::showPopupMenu): Use gtk_menu_popup_at_rect(), using the coordinates
639         of the control passed as reference rectangle. Some conditional code is needed because with newer
640         GTK+ versions a relative offset instead of an absolute position is needed.
641
642 2017-04-10  Adrian Perez de Castro  <aperez@igalia.com>
643
644         [GTK] Opening a popup menu does not pre-select the active item
645         https://bugs.webkit.org/show_bug.cgi?id=170680
646
647         Reviewed by Michael Catanzaro.
648
649         * UIProcess/gtk/WebPopupMenuProxyGtk.cpp:
650         (WebKit::WebPopupMenuProxyGtk::showPopupMenu): Use gtk_menu_shell_select_item() to
651         ensure that the active item appears selected right after popping up the menu.
652
653 2017-04-10  Carlos Garcia Campos  <cgarcia@igalia.com>
654
655         [GTK] Enable DOM timer throttling and CSS animations suspension
656         https://bugs.webkit.org/show_bug.cgi?id=170669
657
658         Reviewed by Žan Doberšek.
659
660         * Shared/WebPreferencesDefinitions.h:
661
662 2017-04-10  Chris Dumez  <cdumez@apple.com>
663
664         Drop Timer::startOneShot() overload taking a double
665         https://bugs.webkit.org/show_bug.cgi?id=170659
666
667         Reviewed by Yusuke Suzuki.
668
669         Drop Timer::startOneShot() overload taking a double as people should use Seconds type now.
670
671         * NetworkProcess/PingLoad.h:
672         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
673         (WebKit::NetworkDataTaskSoup::startTimeout):
674         * Platform/IPC/Connection.h:
675         * Platform/IPC/mac/ConnectionMac.mm:
676         (IPC::ConnectionTerminationWatchdog::createConnectionTerminationWatchdog):
677         (IPC::ConnectionTerminationWatchdog::ConnectionTerminationWatchdog):
678         (IPC::Connection::terminateSoon):
679         * PluginProcess/PluginProcess.cpp:
680         (WebKit::PluginProcess::setMinimumLifetime):
681         * PluginProcess/PluginProcess.h:
682         * Shared/ChildProcess.cpp:
683         (WebKit::ChildProcess::ChildProcess):
684         * Shared/ChildProcess.h:
685         (WebKit::ChildProcess::setTerminationTimeout):
686         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:
687         (WebKit::CompositingRunLoop::startUpdateTimer):
688         * Shared/Plugins/PluginProcessCreationParameters.h:
689         * Shared/WebMemorySampler.cpp:
690         (WebKit::WebMemorySampler::initializeTimers):
691         * Shared/WebProcessCreationParameters.h:
692         * UIProcess/API/Cocoa/APISerializedScriptValueCocoa.mm:
693         (API::SharedJSContext::ensureContext):
694         * UIProcess/ChildProcessProxy.cpp:
695         (WebKit::ChildProcessProxy::shutDownProcess):
696         * UIProcess/Cocoa/NavigationState.mm:
697         (WebKit::NavigationState::didChangeIsLoading):
698         * UIProcess/Cocoa/ViewGestureController.cpp:
699         (WebKit::ViewGestureController::SnapshotRemovalTracker::startWatchdog):
700         * UIProcess/Cocoa/ViewGestureController.h:
701         * UIProcess/DrawingAreaProxyImpl.cpp:
702         (WebKit::DrawingAreaProxyImpl::discardBackingStoreSoon):
703         (WebKit::DrawingAreaProxyImpl::DrawingMonitor::start):
704         (WebKit::DrawingAreaProxyImpl::DrawingMonitor::didDraw):
705         * UIProcess/Gamepad/UIGamepadProvider.cpp:
706         * UIProcess/Plugins/PluginProcessProxy.cpp:
707         * UIProcess/ProcessThrottler.cpp:
708         * UIProcess/ResponsivenessTimer.cpp:
709         * UIProcess/WebProcessPool.cpp:
710         (WebKit::WebProcessPool::createNewWebProcess):
711         * UIProcess/gtk/GestureController.cpp:
712         (WebKit::GestureController::DragGesture::begin):
713         * UIProcess/mac/WebInspectorProxyMac.mm:
714         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
715         (WebKit::AcceleratedDrawingArea::exitAcceleratedCompositingModeNow):
716         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
717         (WebKit::CoordinatedLayerTreeHost::scheduleAnimation):
718         * WebProcess/WebPage/WebPage.cpp:
719         (WebKit::WebPage::determinePrimarySnapshottedPlugIn):
720         * WebProcess/WebProcess.cpp:
721
722 2017-04-09  Wenson Hsieh  <wenson_hsieh@apple.com>
723
724         [WK2] Add infrastructure to perform actions after an asynchronous position information request finishes
725         https://bugs.webkit.org/show_bug.cgi?id=170658
726         <rdar://problem/31431450>
727
728         Reviewed by Tim Horton.
729
730         Introduces doAfterPositionInformationUpdate:forRequest:, which WKContentView can use internally to perform
731         an action requiring InteractionInformationAtPosition asynchronously. See below for additional details.
732
733         New API unit test: DataInteractionTests.UnresponsivePageDoesNotHangUI.
734
735         * UIProcess/ios/WKContentViewInteraction.h:
736         * UIProcess/ios/WKContentViewInteraction.mm:
737         (-[WKContentView _actionForLongPressFromPositionInformation:]):
738         (-[WKContentView _actionForLongPress]):
739         (-[WKContentView doAfterPositionInformationUpdate:forRequest:]):
740
741         If current position information satisfies the request, then perform the given block immediately; otherwise, we
742         save the block and request as a pair in a list of pending position information handlers, and then make a new
743         request to the web process for position information if the currently outgoing request does not already satisfy
744         the given request.
745
746         (-[WKContentView ensurePositionInformationIsUpToDate:]):
747
748         Fire all asynchronous position information handlers that are satisfied by the incoming position information.
749
750         (-[WKContentView requestAsynchronousPositionInformationUpdate:]):
751         (-[WKContentView _currentPositionInformationIsValidForRequest:]):
752         (-[WKContentView _hasValidOutstandingPositionInformationRequest:]):
753
754         Pulled out common logic for managing InteractionInformationRequests into separate helper methods.
755
756         (-[WKContentView _invokeAndRemovePendingHandlersValidForCurrentPositionInformation]):
757         (-[WKContentView gestureRecognizerShouldBegin:]):
758
759         Refactored to use ensurePositionInformationIsUpToDate:. There is no behavior change here, but it makes sure that
760         this particular request will also any valid pending position information handlers.
761
762         (-[WKContentView _positionInformationDidChange:]):
763
764         Fire all asynchronous position information handlers that are satisfied by the incoming position information.
765
766         (-[WKContentView pointIsInDataInteractionContent:]): Deleted.
767
768         We should no longer use this method, since it makes a synchronous request to the web process -- see
769         positionInformationMayStartDataInteraction.
770
771 2017-04-09  Chris Dumez  <cdumez@apple.com>
772
773         Drop Timer::startRepeating() overload taking a double
774         https://bugs.webkit.org/show_bug.cgi?id=170656
775
776         Reviewed by Yusuke Suzuki.
777
778         Drop Timer::startRepeating() overload taking a double as people should use Seconds type now.
779
780         * Shared/WebMemorySampler.cpp:
781         (WebKit::WebMemorySampler::initializeTimers):
782         * UIProcess/Cocoa/ViewGestureController.cpp:
783         * UIProcess/HighPerformanceGraphicsUsageSampler.cpp:
784         * UIProcess/PerActivityStateCPUUsageSampler.cpp:
785         * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
786         (WebKit::NetscapePlugin::Timer::start):
787         * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
788         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
789         (WebKit::CompositingCoordinator::scheduleReleaseInactiveAtlases):
790
791 2017-04-09  Jon Lee  <jonlee@apple.com>
792
793         [WK2][iOS] Add CoreMedia entitlement for WebProcess
794         https://bugs.webkit.org/show_bug.cgi?id=170623
795         rdar://problem/30020073
796
797         Reviewed by Youenn Fablet.
798
799         * Configurations/WebContent-iOS.entitlements: Update entitlement to an array of strings instead of bool.
800
801 2017-04-09  Chris Dumez  <cdumez@apple.com>
802
803         Start dropping Timer API dealing with double
804         https://bugs.webkit.org/show_bug.cgi?id=170649
805
806         Reviewed by Yusuke Suzuki.
807
808         Start dropping Timer API dealing with double as people should use Seconds now.
809
810         * NetworkProcess/NetworkDataTask.cpp:
811         (WebKit::NetworkDataTask::scheduleFailure):
812         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
813         (WebKit::NetworkDataTaskCocoa::resume):
814         * PluginProcess/PluginControllerProxy.cpp:
815         (WebKit::PluginControllerProxy::destroy):
816         (WebKit::PluginControllerProxy::startPaintTimer):
817         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
818         (webkitWebViewBaseScheduleUpdateActivityState):
819         * UIProcess/DrawingAreaProxy.cpp:
820         (WebKit::DrawingAreaProxy::setViewExposedRect):
821         * UIProcess/DrawingAreaProxyImpl.cpp:
822         (WebKit::DrawingAreaProxyImpl::DrawingMonitor::start):
823         * UIProcess/Plugins/gtk/PluginInfoCache.cpp:
824         (WebKit::PluginInfoCache::updatePluginInfo):
825         * UIProcess/VisitedLinkStore.cpp:
826         (WebKit::VisitedLinkStore::addVisitedLinkHash):
827         * UIProcess/WebProcessPool.cpp:
828         (WebKit::m_hiddenPageThrottlingAutoIncreasesCounter):
829         * UIProcess/gtk/GestureController.cpp:
830         (WebKit::GestureController::ZoomGesture::scaleChanged):
831         * UIProcess/gtk/WebPopupMenuProxyGtk.cpp:
832         (WebKit::WebPopupMenuProxyGtk::menuUnmappedCallback):
833         * WebProcess/Network/WebLoaderStrategy.cpp:
834         (WebKit::WebLoaderStrategy::scheduleInternallyFailedLoad):
835         * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp:
836         (WebKit::NPRuntimeObjectMap::addToInvalidationQueue):
837         * WebProcess/Plugins/Netscape/NetscapePluginStream.cpp:
838         (WebKit::NetscapePluginStream::deliverDataToPlugin):
839         * WebProcess/Plugins/PluginView.cpp:
840         (WebKit::PluginView::pendingURLRequestsTimerFired):
841         (WebKit::PluginView::loadURL):
842         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
843         (WebKit::AcceleratedDrawingArea::exitAcceleratedCompositingModeSoon):
844         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
845         (WebKit::CoordinatedLayerTreeHost::scheduleLayerFlush):
846         * WebProcess/WebPage/DrawingAreaImpl.cpp:
847         (WebKit::DrawingAreaImpl::scheduleDisplay):
848         * WebProcess/WebPage/WebPage.cpp:
849         (WebKit::WebPage::updateIsInWindow):
850         (WebKit::WebPage::addPluginView):
851         (WebKit::WebPage::setMayStartMediaWhenInWindow):
852         (WebKit::WebPage::didFinishLoad):
853         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
854         (WebKit::TiledCoreAnimationDrawingArea::activityStateDidChange):
855
856 2017-04-08  Chris Dumez  <cdumez@apple.com>
857
858         Drop std::chrono support from Timer class
859         https://bugs.webkit.org/show_bug.cgi?id=170645
860
861         Reviewed by Sam Weinig.
862
863         Drop std::chrono support from Timer class now that we prefer using Seconds type.
864
865         * NetworkProcess/NetworkLoad.cpp:
866         (WebKit::NetworkLoad::Throttle::Throttle):
867         (WebKit::NetworkLoad::didReceiveResponseNetworkSession):
868         * NetworkProcess/NetworkProcess.h:
869         (WebKit::NetworkProcess::loadThrottleLatency):
870         * NetworkProcess/NetworkProcessCreationParameters.cpp:
871         * NetworkProcess/NetworkProcessCreationParameters.h:
872         * NetworkProcess/NetworkResourceLoadParameters.h:
873         * NetworkProcess/NetworkResourceLoader.cpp:
874         (WebKit::NetworkResourceLoader::startNetworkLoad):
875         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
876         * NetworkProcess/cache/NetworkCacheStatistics.cpp:
877         * NetworkProcess/cache/NetworkCacheStorage.cpp:
878         (WebKit::NetworkCache::Storage::dispatchReadOperation):
879         (WebKit::NetworkCache::Storage::store):
880         * Shared/CacheModel.cpp:
881         (WebKit::calculateMemoryCacheSizes):
882         * Shared/CacheModel.h:
883         * Shared/mac/RemoteLayerBackingStoreCollection.mm:
884         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
885         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
886         * WebProcess/Network/WebLoaderStrategy.cpp:
887         (WebKit::maximumBufferingTime):
888         * WebProcess/Plugins/PluginView.cpp:
889         * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
890         (WebKit::RemoteLayerTreeDrawingArea::scheduleCompositingLayerFlushImmediately):
891         (WebKit::RemoteLayerTreeDrawingArea::scheduleCompositingLayerFlush):
892         * WebProcess/WebProcess.cpp:
893         (WebKit::m_resourceLoadStatisticsStore):
894         (WebKit::WebProcess::setCacheModel):
895
896 2017-04-08  Chris Dumez  <cdumez@apple.com>
897
898         Unreviewed attempt to fix GTK build after r215138.
899
900         * UIProcess/API/gtk/WebKitUIClient.cpp:
901
902 2017-04-08  Youenn Fablet  <youenn@apple.com>
903
904         WebRTC tests gardening
905         https://bugs.webkit.org/show_bug.cgi?id=170508
906
907         Reviewed by Eric Carlson.
908
909         * Configurations/FeatureDefines.xcconfig:
910
911 2017-04-08  Chris Dumez  <cdumez@apple.com>
912
913         Timer's nextFireInterval() / repeatInterval() should return Seconds
914         https://bugs.webkit.org/show_bug.cgi?id=170639
915
916         Reviewed by Simon Fraser.
917
918         Timer's nextFireInterval() / repeatInterval() should return Seconds, not double.
919
920         * WebProcess/WebPage/WebPage.cpp:
921         (WebKit::WebPage::layerVolatilityTimerFired):
922         (WebKit::WebPage::markLayersVolatile):
923
924 2017-04-07  Alex Christensen  <achristensen@webkit.org>
925
926         Modernize WebPage.h
927         https://bugs.webkit.org/show_bug.cgi?id=170633
928
929         Reviewed by Joseph Pecoraro.
930
931         * UIProcess/API/APIUIClient.h:
932         (API::UIClient::createNewPage):
933         * UIProcess/API/C/WKPage.cpp:
934         (WebKit::RunBeforeUnloadConfirmPanelResultListener::create):
935         (WebKit::RunJavaScriptAlertResultListener::create):
936         (WebKit::RunJavaScriptConfirmResultListener::create):
937         (WebKit::RunJavaScriptConfirmResultListener::RunJavaScriptConfirmResultListener):
938         (WebKit::RunJavaScriptPromptResultListener::create):
939         (WebKit::RunJavaScriptPromptResultListener::RunJavaScriptPromptResultListener):
940         (WKPageSetPageUIClient):
941         * UIProcess/Cocoa/UIDelegate.h:
942         * UIProcess/Cocoa/UIDelegate.mm:
943         (WebKit::UIDelegate::UIClient::createNewPage):
944         * WebProcess/WebPage/WebPage.cpp:
945         (WebKit::WebPage::loadDataImpl):
946         (WebKit::WebPage::loadStringImpl):
947         (WebKit::WebPage::loadData):
948         (WebKit::WebPage::scaledSnapshotWithOptions):
949         (WebKit::WebPage::SandboxExtensionTracker::willPerformLoadDragDestinationAction):
950         (WebKit::WebPage::SandboxExtensionTracker::setPendingProvisionalSandboxExtension):
951         * WebProcess/WebPage/WebPage.h:
952
953 2017-04-07  Alex Christensen  <achristensen@webkit.org>
954
955         Use audit_token_t instead of pid_t for checking sandbox of other processes
956         https://bugs.webkit.org/show_bug.cgi?id=170616
957         <rdar://problem/31158189>
958
959         Reviewed by Daniel Bates.
960
961         pid's can be reused, so it's theoretically unsafe to use the pid of another process to check whether it's sandboxed.
962         Use an audit_token_t instead to be more sure that we are not mistakenly checking a new process that has reused the
963         old process's pid. For the current process, though, we have no xpc_connection_t to the process because we are the process.
964
965         * PluginProcess/mac/PluginProcessMac.mm:
966         (WebKit::PluginProcess::initializeSandbox):
967         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm:
968         (WebKit::XPCServiceInitializerDelegate::isClientSandboxed):
969         * Shared/mac/SandboxUtilities.h:
970         * Shared/mac/SandboxUtilities.mm:
971         (WebKit::currentProcessIsSandboxed):
972         (WebKit::connectedProcessIsSandboxed):
973         (WebKit::processIsSandboxed): Deleted.
974         * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
975         (WebKit::WebProcessProxy::platformIsBeingDebugged):
976         * UIProcess/Plugins/mac/PluginInfoStoreMac.mm:
977         (WebKit::PluginInfoStore::shouldUsePlugin):
978         * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
979         (WebKit::PluginProcessProxy::platformGetLaunchOptions):
980
981 2017-04-07  Brent Fulgham  <bfulgham@apple.com>
982
983         [WK2][iOS] Add CoreMedia entitlement for WebProcess
984         https://bugs.webkit.org/show_bug.cgi?id=170623
985         <rdar://problem/30020073>
986
987         Reviewed by Youenn Fablet.
988
989         Add new "com.apple.tcc.delegated-services" entitlement to allow CoreMedia
990         to work properly in WebRTC.
991
992         * Configurations/WebContent-iOS.entitlements:
993
994 2017-04-07  Alex Christensen  <achristensen@webkit.org>
995
996         Private browsing sessions should not look in keychain for client certificates
997         https://bugs.webkit.org/show_bug.cgi?id=170618
998         <rdar://problem/18457427>
999
1000         Reviewed by Dan Bernstein.
1001
1002         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1003         (WebKit::configurationForSessionID):
1004
1005 2017-04-07  Chris Dumez  <cdumez@apple.com>
1006
1007         We should log how much CPU a background process was using when killing it due to CPU limiting
1008         https://bugs.webkit.org/show_bug.cgi?id=170619
1009
1010         Reviewed by Andreas Kling.
1011
1012         * WebProcess/cocoa/WebProcessCocoa.mm:
1013         (WebKit::WebProcess::updateBackgroundCPUMonitorState):
1014
1015 2017-04-07  Wenson Hsieh  <wenson_hsieh@apple.com>
1016
1017         Missing conversion from window to content coordinates when adjusting unobscured content rects for input view
1018         https://bugs.webkit.org/show_bug.cgi?id=170603
1019
1020         Reviewed by Simon Fraser.
1021
1022         Refactors -[WKContentView _computeUnobscuredContentRectRespectingInputViewBounds:unobscuredContentRect:inputViewBounds:scale:]
1023         to convert the input view bounds into content coordinates instead of using the zoom scale to adjust the height of inputViewBounds.
1024         Covered by the existing LayoutTest, fixed-element-on-bottom-with-keyboard.html.
1025
1026         * UIProcess/ios/WKContentView.mm:
1027         (-[WKContentView _computeUnobscuredContentRectRespectingInputViewBounds:unobscuredContentRect:inputViewBounds:scale:]):
1028
1029 2017-04-07  Michael Catanzaro  <mcatanzaro@igalia.com>
1030
1031         [GTK] Various build errors when plugin support is disabled
1032         https://bugs.webkit.org/show_bug.cgi?id=170015
1033
1034         Reviewed by Carlos Garcia Campos.
1035
1036         * PluginProcess/unix/PluginControllerProxyUnix.cpp:
1037         * UIProcess/API/gtk/WebKitWebsiteData.cpp:
1038         (recordContainsSupportedDataTypes):
1039         (toWebKitWebsiteDataTypes):
1040         * UIProcess/API/gtk/WebKitWebsiteDataManager.cpp:
1041         (toWebsiteDataTypes):
1042
1043 2017-04-07  John Wilander  <wilander@apple.com>
1044
1045         WebSocket streams should have network usage attributed to correct process
1046         https://bugs.webkit.org/show_bug.cgi?id=170322
1047         <rdar://problem/26413551>
1048
1049         Reviewed by Alex Christensen.
1050
1051         Changes here are due to the added WebCore::SourceApplicationAuditToken parameter
1052         in WebCore::SocketStreamHandleImpl::create().
1053         WebKit::NetworkSocketStream takes it and passes it on.
1054
1055         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1056         (WebKit::NetworkConnectionToWebProcess::createSocketStream):
1057         * NetworkProcess/NetworkSocketStream.cpp:
1058         (WebKit::NetworkSocketStream::create):
1059         (WebKit::NetworkSocketStream::NetworkSocketStream):
1060         * NetworkProcess/NetworkSocketStream.h:
1061
1062 2017-04-07  Michael Catanzaro  <mcatanzaro@igalia.com>
1063
1064         Unreviewed, fix missing return value warning
1065
1066         * UIProcess/WebProcessProxy.cpp:
1067         (WebKit::diagnosticLoggingKeyForSimulatedCrashReason):
1068
1069 2017-04-07  Carlos Garcia Campos  <cgarcia@igalia.com>
1070
1071         [GTK] Update the priorities used in glib main loop sources
1072         https://bugs.webkit.org/show_bug.cgi?id=170457
1073
1074         Reviewed by Žan Doberšek.
1075
1076         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:
1077         (WebKit::CompositingRunLoop::CompositingRunLoop):
1078         * UIProcess/DrawingAreaProxyImpl.cpp:
1079         (WebKit::DrawingAreaProxyImpl::DrawingAreaProxyImpl):
1080         (WebKit::DrawingAreaProxyImpl::DrawingMonitor::DrawingMonitor):
1081         * UIProcess/gtk/WaylandCompositor.cpp:
1082         (WebKit::createWaylandLoopSource):
1083         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
1084         (WebKit::AcceleratedDrawingArea::AcceleratedDrawingArea):
1085         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
1086         (WebKit::CompositingCoordinator::CompositingCoordinator):
1087         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
1088         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
1089         (WebKit::CoordinatedLayerTreeHost::CoordinatedLayerTreeHost):
1090         * WebProcess/WebPage/DrawingAreaImpl.cpp:
1091         (WebKit::DrawingAreaImpl::DrawingAreaImpl):
1092
1093 2017-04-06  Alex Christensen  <achristensen@webkit.org>
1094
1095         Add WKContentExtensionStore.h and WKContentExtension.h to public WebKit.h
1096         https://bugs.webkit.org/show_bug.cgi?id=170533
1097
1098         Reviewed by Daniel Bates.
1099
1100         * Shared/API/Cocoa/WebKit.h:
1101         In r213696 I added two public headers.  All public headers in WebKit are included with
1102         #import <WebKit/WebKit.h>
1103
1104 2017-04-06  Joseph Pecoraro  <pecoraro@apple.com>
1105
1106         Web Inspector: Hangs when loading under SpeculativeLoad::shouldCaptureExtraNetworkLoadMetrics
1107         https://bugs.webkit.org/show_bug.cgi?id=170575
1108
1109         Rubber-stamped by Brian Burg.
1110
1111         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
1112         (WebKit::NetworkCache::SpeculativeLoad::shouldCaptureExtraNetworkLoadMetrics): Deleted.
1113         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.h:
1114         m_networkLoad is a wrapper around `this` as the client, so we would infinite loop here.
1115
1116 2017-04-06  Commit Queue  <commit-queue@webkit.org>
1117
1118         Unreviewed, rolling out r214973.
1119         https://bugs.webkit.org/show_bug.cgi?id=170578
1120
1121         Causes issues in Safari (Requested by bradee-oh on #webkit).
1122
1123         Reverted changeset:
1124
1125         "Refactor so WebsiteDataStores always have a StorageManager."
1126         https://bugs.webkit.org/show_bug.cgi?id=170521
1127         http://trac.webkit.org/changeset/214973
1128
1129 2017-04-06  Ryan Haddad  <ryanhaddad@apple.com>
1130
1131         Unreviewed, rolling out r215046.
1132
1133         This change broke internal builds.
1134
1135         Reverted changeset:
1136
1137         "WebRTC tests gardening"
1138         https://bugs.webkit.org/show_bug.cgi?id=170508
1139         http://trac.webkit.org/changeset/215046
1140
1141 2017-04-06  Joseph Pecoraro  <pecoraro@apple.com>
1142
1143         Web Inspector: Only Capture Extra Network Load Metrics when there is a Web Inspector Frontend
1144         https://bugs.webkit.org/show_bug.cgi?id=170525
1145
1146         Reviewed by Youenn Fablet.
1147
1148         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1149         (-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]):
1150         Only collect extra metrics if the WebProcess this load is for has enabled
1151         collecting extra metrics.
1152
1153         * WebProcess/Network/WebLoaderStrategy.cpp:
1154         (WebKit::WebLoaderStrategy::setCaptureExtraNetworkLoadMetricsEnabled):
1155         * WebProcess/Network/WebLoaderStrategy.h:
1156         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1157         (WebKit::NetworkConnectionToWebProcess::setCaptureExtraNetworkLoadMetricsEnabled):
1158         * NetworkProcess/NetworkConnectionToWebProcess.h:
1159         (WebKit::NetworkConnectionToWebProcess::captureExtraNetworkLoadMetricsEnabled):
1160         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
1161         New bool state toggled through the loader policy.
1162
1163         * NetworkProcess/NetworkDataTask.cpp:
1164         (WebKit::NetworkDataTask::shouldCaptureExtraNetworkLoadMetrics):
1165         * NetworkProcess/NetworkDataTask.h:
1166         (WebKit::NetworkDataTaskClient::shouldCaptureExtraNetworkLoadMetrics):
1167         * NetworkProcess/NetworkLoad.cpp:
1168         (WebKit::NetworkLoad::shouldCaptureExtraNetworkLoadMetrics):
1169         * NetworkProcess/NetworkLoad.h:
1170         * NetworkProcess/NetworkLoadClient.h:
1171         (WebKit::NetworkLoadClient::shouldCaptureExtraNetworkLoadMetrics):
1172         * NetworkProcess/NetworkResourceLoader.cpp:
1173         (WebKit::NetworkResourceLoader::shouldCaptureExtraNetworkLoadMetrics):
1174         * NetworkProcess/NetworkResourceLoader.h:
1175         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
1176         (WebKit::NetworkCache::SpeculativeLoad::shouldCaptureExtraNetworkLoadMetrics):
1177         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.h:
1178         Default handling for network loads is to not include extra data. Thread
1179         client messages back from the NetworkLoads / SpeculativeLoads to check
1180         the NetworkConnectionToWebProcess state on whether or not we should collect
1181         extra metrics.
1182
1183 2017-04-06  Joseph Pecoraro  <pecoraro@apple.com>
1184
1185         Web Inspector: Show all headers in the Request Headers section of the Resource details sidebar
1186         https://bugs.webkit.org/show_bug.cgi?id=16531
1187         <rdar://problem/5712895>
1188
1189         Reviewed by Timothy Hatcher.
1190
1191         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1192         (-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]):
1193         Include a complete list of the request headers sent for this load.
1194         There may be headers that WebCore did not know about and developer
1195         tools should be informed of.
1196
1197 2017-04-06  Anders Carlsson  <andersca@apple.com>
1198
1199         OptionSet options need to be powers of two
1200         https://bugs.webkit.org/show_bug.cgi?id=170565
1201
1202         Reviewed by Chris Dumez.
1203
1204         Change Cache::Option to be powers of two.
1205
1206         * NetworkProcess/cache/NetworkCache.h:
1207
1208 2017-04-06  Youenn Fablet  <youenn@apple.com>
1209
1210         WebRTC tests gardening
1211         https://bugs.webkit.org/show_bug.cgi?id=170508
1212
1213         Reviewed by Eric Carlson.
1214
1215         * Configurations/FeatureDefines.xcconfig:
1216
1217 2017-04-06  Antti Koivisto  <antti@apple.com>
1218
1219         Implement testing mode for disk cache
1220         https://bugs.webkit.org/show_bug.cgi?id=170547
1221
1222         Reviewed by Andreas Kling.
1223
1224         Disable read timeouts and cache shrinking in TestRunner to eliminate potential sources of randomness.
1225
1226         Cache directories are deleted by TestRunner so lack of shrinking does not consume the disk.
1227
1228         This is enabled by the existing WKContextUseTestingNetworkSession SPI.
1229
1230         * NetworkProcess/cache/NetworkCache.cpp:
1231         (WebKit::NetworkCache::Cache::initialize):
1232         * NetworkProcess/cache/NetworkCache.h:
1233         * NetworkProcess/cache/NetworkCacheStorage.cpp:
1234         (WebKit::NetworkCache::Storage::open):
1235         (WebKit::NetworkCache::Storage::Storage):
1236         (WebKit::NetworkCache::Storage::dispatchReadOperation):
1237         (WebKit::NetworkCache::Storage::shrinkIfNeeded):
1238         * NetworkProcess/cache/NetworkCacheStorage.h:
1239         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1240         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
1241
1242 2017-04-06  Chris Dumez  <cdumez@apple.com>
1243
1244         [WK2] Add C private API to toggle invisibleAutoplayNotPermitted setting
1245         https://bugs.webkit.org/show_bug.cgi?id=170524
1246         <rdar://problem/31461472>
1247
1248         Reviewed by Eric Carlson.
1249
1250         Add C private API to toggle invisibleAutoplayNotPermitted setting.
1251
1252         * UIProcess/API/C/WKPreferences.cpp:
1253         (WKPreferencesSetInvisibleMediaAutoplayPermitted):
1254         (WKPreferencesGetInvisibleMediaAutoplayPermitted):
1255         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1256
1257 2017-04-06  Adrian Perez de Castro  <aperez@igalia.com>
1258
1259         [GTK] Fix build with MEDIA_CAPTURE enabled
1260         https://bugs.webkit.org/show_bug.cgi?id=170539
1261
1262         Reviewed by Carlos Garcia Campos.
1263
1264         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDeprecated.cpp:
1265         (webkit_dom_html_input_element_get_capture): Add missing namespace in usage of WebCore::MediaCaptureTypeNone.
1266
1267 2017-04-05  Brent Fulgham  <bfulgham@apple.com>
1268
1269         [WK2][iOS] Remove access to features not present on iOS 
1270         https://bugs.webkit.org/show_bug.cgi?id=170531
1271         <rdar://problem/31352258>
1272
1273         Reviewed by Alexey Proskuryakov.
1274
1275         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1276
1277 2017-04-05  Eric Carlson  <eric.carlson@apple.com>
1278
1279         [MediaStream] Host application should be able to mute and unmute media streams
1280         https://bugs.webkit.org/show_bug.cgi?id=170519
1281         <rdar://problem/31174326>
1282
1283         Reviewed by Youenn Fablet.
1284
1285         * UIProcess/API/C/WKPage.cpp:
1286         (WKPageGetMediaState): Support new media stream state flags.
1287         * UIProcess/API/C/WKPagePrivate.h:
1288         * UIProcess/API/Cocoa/WKWebViewPrivate.h: Ditto.
1289         * UIProcess/Cocoa/UIDelegate.mm: Ditto.
1290
1291 2017-04-05  Brady Eidson  <beidson@apple.com>
1292
1293         Refactor so WebsiteDataStores always have a StorageManager.
1294         https://bugs.webkit.org/show_bug.cgi?id=170521
1295
1296         Reviewed by Geoff Garen.
1297
1298         This basically involves teaching StorageManager how to work without a LocalStorageDatabaseTracker,
1299         since there will never be ephemeral bits on disk to track.
1300         
1301         * UIProcess/Storage/StorageManager.cpp:
1302         (WebKit::StorageManager::StorageArea::openDatabaseAndImportItemsIfNeeded):
1303         (WebKit::StorageManager::createEphemeral):
1304         (WebKit::StorageManager::StorageManager):
1305         (WebKit::StorageManager::getLocalStorageOrigins):
1306         (WebKit::StorageManager::getLocalStorageOriginDetails):
1307         (WebKit::StorageManager::deleteLocalStorageEntriesForOrigin):
1308         (WebKit::StorageManager::deleteLocalStorageOriginsModifiedSince):
1309         (WebKit::StorageManager::deleteLocalStorageEntriesForOrigins):
1310         * UIProcess/Storage/StorageManager.h:
1311         
1312         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1313         (WebKit::WebsiteDataStore::WebsiteDataStore):
1314
1315 2017-04-05  Brent Fulgham  <bfulgham@apple.com>
1316
1317         [WK2][iOS] Add entitlements to enable audio/video capture in WebProcess
1318         https://bugs.webkit.org/show_bug.cgi?id=170507
1319         <rdar://problem/31121248>
1320
1321         Reviewed by Youenn Fablet.
1322
1323         Add two entitlements that are required to access audio/video capture on iOS.
1324
1325         * Configurations/WebContent-iOS.entitlements:
1326
1327 2017-04-05  Carlos Garcia Campos  <cgarcia@igalia.com>
1328
1329         Show a log message when an invalid message is received in non cocoa ports
1330         https://bugs.webkit.org/show_bug.cgi?id=170506
1331
1332         Reviewed by Michael Catanzaro.
1333
1334         We just crash, but without knowing the details about the message it's impossible to debug.
1335
1336         * Shared/ChildProcess.cpp:
1337         (WebKit::ChildProcess::didReceiveInvalidMessage):
1338
1339 2017-04-04  Carlos Garcia Campos  <cgarcia@igalia.com>
1340
1341         Move WebErrors from WebProcess to Shared and get rid of ErrorsGtk in WebCore
1342         https://bugs.webkit.org/show_bug.cgi?id=156974
1343
1344         Reviewed by Sam Weinig.
1345
1346         WebErrors are not only used by the frame loader client in the web process, but also by the network process. So,
1347         move them to Shared make most of the implementation cross-platform.
1348
1349         * CMakeLists.txt: Add new files to compilation.
1350         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
1351         (WebKit::NetworkDataTaskSoup::download): Use WebErrors directly instead of platform methods that are no longer needed.
1352         (WebKit::NetworkDataTaskSoup::writeDownloadCallback): Ditto.
1353         (WebKit::NetworkDataTaskSoup::didFinishDownload): Ditto.
1354         (WebKit::NetworkDataTaskSoup::didFail): Ditto.
1355         * PlatformGTK.cmake: Add new files to compilation and remove DownloadSoupErrorsGtk.cpp
1356         * PlatformMac.cmake:
1357         * Shared/API/APIError.cpp: Add error domains used by glib based ports.
1358         (API::Error::webKitNetworkErrorDomain):
1359         (API::Error::webKitPolicyErrorDomain):
1360         (API::Error::webKitPluginErrorDomain):
1361         (API::Error::webKitDownloadErrorDomain):
1362         (API::Error::webKitPrintErrorDomain):
1363         * Shared/API/APIError.h:
1364         * Shared/Cocoa/WebErrorsCocoa.mm: Copied from Source/WebKit2/WebProcess/WebCoreSupport/WebErrors.h.
1365         (WebKit::createNSError):
1366         (WebKit::cancelledError):
1367         (WebKit::fileDoesNotExistError):
1368         * Shared/WebErrors.cpp: Copied from Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebErrorsGtk.cpp.
1369         (WebKit::blockedError):
1370         (WebKit::blockedByContentBlockerError):
1371         (WebKit::cannotShowURLError):
1372         (WebKit::interruptedForPolicyChangeError):
1373         (WebKit::blockedByContentFilterError):
1374         (WebKit::cannotShowMIMETypeError):
1375         (WebKit::pluginWillHandleLoadError):
1376         (WebKit::internalError):
1377         * Shared/WebErrors.h: Renamed from Source/WebKit2/WebProcess/WebCoreSupport/WebErrors.h.
1378         * Shared/glib/WebErrorsGlib.cpp: Renamed from Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebErrorsGtk.cpp.
1379         (WebKit::cancelledError):
1380         (WebKit::fileDoesNotExistError):
1381         * Shared/gtk/WebErrorsGtk.cpp: Copied from Source/WebKit2/NetworkProcess/Downloads/gtk/DownloadSoupErrorsGtk.cpp.
1382         (WebKit::printError):
1383         (WebKit::printerNotFoundError):
1384         (WebKit::invalidPageRangeToPrint):
1385         * Shared/soup/WebErrorsSoup.cpp: Renamed from Source/WebKit2/NetworkProcess/Downloads/gtk/DownloadSoupErrorsGtk.cpp.
1386         (WebKit::downloadNetworkError):
1387         (WebKit::downloadCancelledByUserError):
1388         (WebKit::downloadDestinationError):
1389         * UIProcess/API/gtk/WebKitDownload.cpp:
1390         * UIProcess/API/gtk/WebKitError.cpp:
1391         (webkit_network_error_quark):
1392         (webkit_policy_error_quark):
1393         (webkit_plugin_error_quark):
1394         (webkit_download_error_quark):
1395         (webkit_print_error_quark):
1396         * UIProcess/API/gtk/WebKitPrivate.cpp:
1397         (toWebKitError):
1398         (toWebCoreError):
1399         * WebKit2.xcodeproj/project.pbxproj:
1400         * WebProcess/WebCoreSupport/mac/WebErrorsMac.mm: Removed.
1401         * WebProcess/WebPage/gtk/WebPrintOperationGtk.cpp:
1402
1403 2017-04-04  Youenn Fablet  <youenn@apple.com>
1404
1405         [Mac] Add back web audio support for getUserMedia MediaStreamTrack
1406         https://bugs.webkit.org/show_bug.cgi?id=170482
1407
1408         Reviewed by Eric Carlson.
1409
1410         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
1411         (WebKit::UserMediaCaptureManager::Source::setStorage):
1412
1413 2017-04-04  Tim Horton  <timothy_horton@apple.com>
1414
1415         [Mac] -[WKWebView findMatchesForString:relativeToMatch:findOptions:maxResults:resultCollector:] invokes the resultCollector with didWrap = NO even when it wraps
1416         https://bugs.webkit.org/show_bug.cgi?id=165801
1417         <rdar://problem/29649535>
1418
1419         Reviewed by Wenson Hsieh.
1420
1421         Previously, when doing an incremental find that wrapped, we would 
1422         say that it did not, leading NSTextFinder to not provide its usual
1423         wrapping UI, and other clients of the NSTextFinderClient protocol to
1424         get confused by the lack of wrapping.
1425
1426         * UIProcess/WebPageProxy.cpp:
1427         (WebKit::WebPageProxy::didFindString):
1428         * UIProcess/WebPageProxy.h:
1429         * UIProcess/WebPageProxy.messages.in:
1430         * UIProcess/API/APIFindClient.h:
1431         (API::FindClient::didFindString):
1432         * UIProcess/API/C/WKPage.cpp:
1433         (WKPageSetPageFindClient):
1434         * UIProcess/Cocoa/FindClient.h:
1435         * UIProcess/Cocoa/FindClient.mm:
1436         (WebKit::FindClient::didFindString):
1437         * WebProcess/WebPage/FindController.cpp:
1438         (WebKit::FindController::updateFindUIAfterPageScroll):
1439         (WebKit::FindController::findString):
1440         * WebProcess/WebPage/FindController.h:
1441         Plumb DidWrap from FindController's call to findString back through
1442         the DidFindString message.
1443
1444         * UIProcess/mac/WKTextFinderClient.mm:
1445         (-[WKTextFinderClient didFindStringMatchesWithRects:didWrapAround:]):
1446         (-[WKTextFinderClient didFindStringMatchesWithRects:]): Deleted.
1447         Make use of the new DidWrap information to stop lying to NSTextFinder
1448         about whether a wrap actually occurred.
1449
1450 2017-04-03  Wenson Hsieh  <wenson_hsieh@apple.com>
1451
1452         Data interaction should register type identifiers in order of priority
1453         https://bugs.webkit.org/show_bug.cgi?id=170428
1454         <rdar://problem/30633296>
1455
1456         Reviewed by Tim Horton.
1457
1458         Serialize PasteboardWebContent.dataInAttributedStringFormat when sending over IPC. Refer to WebCore ChangeLog
1459         for more details.
1460
1461         * Shared/WebCoreArgumentCoders.cpp:
1462         (IPC::ArgumentCoder<PasteboardWebContent>::encode):
1463         (IPC::ArgumentCoder<PasteboardWebContent>::decode):
1464         * UIProcess/API/Cocoa/WKWebView.mm:
1465
1466 2017-04-03  Joseph Pecoraro  <pecoraro@apple.com>
1467
1468         Remove no longer needed forward declarations
1469         https://bugs.webkit.org/show_bug.cgi?id=170415
1470
1471         Reviewed by Dan Bernstein.
1472
1473         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1474
1475 2017-04-03  Anders Carlsson  <andersca@apple.com>
1476
1477         Tweak ApplePaySession API
1478         https://bugs.webkit.org/show_bug.cgi?id=170409
1479         rdar://problem/31405459
1480
1481         Reviewed by Tim Horton.
1482
1483         Update for WebCore changes.
1484
1485         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
1486         (WebKit::toNSError):
1487
1488 2017-04-03  Carlos Garcia Campos  <cgarcia@igalia.com>
1489
1490         [SOUP] URI Fragment is lost after redirect
1491         https://bugs.webkit.org/show_bug.cgi?id=170058
1492
1493         Reviewed by Michael Catanzaro.
1494
1495         In case of redirection check if the current request has a fragment identifier and apply it to the redirection
1496         only when it doesn't have a fragment identifier yet.
1497
1498         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
1499         (WebKit::NetworkDataTaskSoup::NetworkDataTaskSoup):
1500         (WebKit::NetworkDataTaskSoup::createRequest):
1501         (WebKit::NetworkDataTaskSoup::continueHTTPRedirection):
1502         * NetworkProcess/soup/NetworkDataTaskSoup.h:
1503
1504 2017-04-03  Antti Koivisto  <antti@apple.com>
1505
1506         Mutex may be freed too late in NetworkCache::Storage::traverse
1507         https://bugs.webkit.org/show_bug.cgi?id=170400
1508         <rdar://problem/30515865>
1509
1510         Reviewed by Carlos Garcia Campos and Andreas Kling.
1511
1512         Fix a race.
1513
1514         * NetworkProcess/cache/NetworkCacheStorage.cpp:
1515         (WebKit::NetworkCache::Storage::traverse):
1516
1517             Ensure the mutex is not accessed after we dispatch to the main thread.
1518             The main thread call deletes the owning TraverseOperation.
1519
1520 2017-04-01  Dan Bernstein  <mitz@apple.com>
1521
1522         [iOS] <input type=file> label should be specified using plural rules
1523         https://bugs.webkit.org/show_bug.cgi?id=170388
1524
1525         Reviewed by Alexey Proskuryakov.
1526
1527         * UIProcess/ios/forms/WKFileUploadPanel.mm:
1528         (-[WKFileUploadPanel _processMediaInfoDictionaries:atIndex:processedResults:processedImageCount:processedVideoCount:successBlock:failureBlock:]):
1529           Instead of calling -_displayStringForPhotos:videos:, use
1530           +[NSString localizedStringWithFormat:] with the new format string "%lu photo(s) and
1531           %lu video(s)" for which there are plural rules.
1532         (-[WKFileUploadPanel _displayStringForPhotos:videos:]): Deleted.
1533
1534 2017-04-01  Dan Bernstein  <mitz@apple.com>
1535
1536         [Xcode] In engineering builds, linker warns about libwebrtc.dylib’s install name being invalid
1537         https://bugs.webkit.org/show_bug.cgi?id=170385
1538
1539         Reviewed by Tim Horton.
1540
1541         * Configurations/WebKit.xcconfig: When WebKit is relocatable, tell the linker that it’s
1542           not going to be in the shared cache, even if its install name implies that it might be.
1543
1544 2017-03-31  Simon Fraser  <simon.fraser@apple.com>
1545
1546         Remove a logging statement left in by mistake.
1547
1548         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1549         (WebKit::WebFrameLoaderClient::restoreViewState):
1550
1551 2017-03-31  Wenson Hsieh  <wenson_hsieh@apple.com>
1552
1553         Address post-review feedback after r214692
1554         https://bugs.webkit.org/show_bug.cgi?id=170328
1555
1556         Reviewed by Dan Bernstein.
1557
1558         Clearing the selection when UIKit calls into WKContentView to set its selected text range to nil is a rule
1559         that should be applied when using a text interaction assistant, not just when using character granularity
1560         for selecting text.
1561
1562         * UIProcess/ios/WKContentViewInteraction.mm:
1563         (-[WKContentView setSelectedTextRange:]):
1564
1565 2017-03-31  Wenson Hsieh  <wenson_hsieh@apple.com>
1566
1567         [WK2] Tapping away to dismiss the selection does not update the selected DOM range using character granularity
1568         https://bugs.webkit.org/show_bug.cgi?id=170328
1569         <rdar://problem/30904558>
1570
1571         Reviewed by Tim Horton.
1572
1573         When UIKit clears the selection while in text interaction mode, it notifies its document view (i.e., the
1574         WKContentView) by setting its selected text range to nil. When character granularity selection is enabled, use
1575         this as a cue to notify the web process that the selection is being cleared out.
1576
1577         -setSelectedTextRange: is a noop in the general case because the web process acts as the source of truth for what
1578         the selection currently consists of, and notifies the UI process and UIKit via WKTextPosition and WKTextRange.
1579         However, in the case of character granularity selections, tapping away to clear the selection is handled by
1580         UIKit's text gesture recognizer cluster, which then informs the document (via -setSelectedTextRange:) that the
1581         selection should be cleared out.
1582
1583         Adds a new Layout test: editing/selection/character-granularity-selected-range-after-dismissing-selection.html.
1584
1585         * UIProcess/ios/WKContentViewInteraction.mm:
1586         (-[WKContentView setSelectedTextRange:]):
1587
1588 2017-03-31  Wenson Hsieh  <wenson_hsieh@apple.com>
1589
1590         [WK2] Tapping editable text inside of a range selection no longer changes the selection to a caret
1591         https://bugs.webkit.org/show_bug.cgi?id=170327
1592         <rdar://problem/31363816>
1593
1594         Reviewed by Tim Horton.
1595
1596         Currently, we're forcing all text interaction gestures to duck in lieu of data interaction gestures
1597         when we should only be doing so for gestures that begin a loupe. This prevents other gestures, such as
1598         single taps, from changing the selection when they should be allowed to.
1599
1600         Hooks into new UIKit SPI to make this tweak.
1601         Introduces a new LayoutTest: editing/selection/caret-after-tap-in-editable-selection.html.
1602
1603         * UIProcess/ios/WKContentViewInteraction.mm:
1604         (-[WKContentView pointIsInAssistedNode:]):
1605         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
1606
1607 2017-03-31  Tim Horton  <timothy_horton@apple.com>
1608
1609         Mail can get stuck underneath FindController::findStringMatches after searching in a long message
1610         https://bugs.webkit.org/show_bug.cgi?id=170326
1611         <rdar://problem/30330395>
1612
1613         Reviewed by Simon Fraser.
1614
1615         * UIProcess/mac/WKTextFinderClient.mm:
1616         (-[WKTextFinderClient findMatchesForString:relativeToMatch:findOptions:maxResults:resultCollector:]):
1617         Cap the number of find matches at 1000, the same maximum that Safari uses.
1618
1619 2017-03-31  Brady Eidson  <beidson@apple.com>
1620
1621         Clean up the "StorageType" enum.
1622         https://bugs.webkit.org/show_bug.cgi?id=170349
1623
1624         Reviewed by Tim Horton.
1625
1626         * WebProcess/Storage/StorageAreaMap.cpp:
1627         (WebKit::StorageAreaMap::StorageAreaMap):
1628         (WebKit::StorageAreaMap::dispatchStorageEvent):
1629         (WebKit::StorageAreaMap::dispatchSessionStorageEvent):
1630         (WebKit::StorageAreaMap::dispatchLocalStorageEvent):
1631         
1632         * WebProcess/Storage/StorageNamespaceImpl.cpp:
1633         (WebKit::StorageNamespaceImpl::createSessionStorageNamespace):
1634         (WebKit::StorageNamespaceImpl::createLocalStorageNamespace):
1635         (WebKit::StorageNamespaceImpl::createTransientLocalStorageNamespace):
1636
1637 2017-03-31  Tim Horton  <timothy_horton@apple.com>
1638
1639         Remove bundle checks for attachmentElementEnabled
1640         https://bugs.webkit.org/show_bug.cgi?id=170329
1641         <rdar://problem/25135244>
1642
1643         Reviewed by Simon Fraser.
1644
1645         * UIProcess/API/Cocoa/WKWebView.mm:
1646         (-[WKWebView _initializeWithConfiguration:]):
1647         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
1648         (-[WKWebViewConfiguration init]):
1649         Remove bundle checks.
1650
1651 2017-03-29  Anders Carlsson  <andersca@apple.com>
1652
1653         Adopt PKCanMakePaymentsWithMerchantIdentifierAndDomainAndSourceApplication
1654         https://bugs.webkit.org/show_bug.cgi?id=170257
1655         rdar://problem/31289764
1656
1657         Reviewed by Beth Dakin.
1658
1659         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
1660         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePaymentsWithActiveCard):
1661
1662 2017-03-31  Csaba Osztrogonác  <ossy@webkit.org>
1663
1664         Mac cmake buildfix after r214403
1665         https://bugs.webkit.org/show_bug.cgi?id=170346
1666
1667         Unreviewed speculative buildfix.
1668
1669         * UIProcess/API/Cocoa/WKWebView.mm:
1670
1671 2017-03-31  Brady Eidson  <beidson@apple.com>
1672
1673         Remove erroneously committed changes from r214078
1674
1675         Unreviewed.
1676
1677         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1678         (WebKit::WebProcessPool::platformInitializeNetworkProcess): Whoops!
1679
1680 2017-03-31  Carlos Garcia Campos  <cgarcia@igalia.com>
1681
1682         Modern media controls should never be enabled in non cocoa ports
1683         https://bugs.webkit.org/show_bug.cgi?id=170338
1684
1685         Reviewed by Michael Catanzaro.
1686
1687         It's currently enabled, because it uses the default value for all other runtime features, but modern media
1688         controls are not a cross-platform feature. I think this is why media/video-click-dblckick-standalone.html
1689         started to fail in GTK+ port after r214426. I can't reprouduce the failure locally, so I can't confirm it,
1690         though.
1691
1692         * Shared/WebPreferencesDefinitions.h:
1693
1694 2017-03-30  Zan Dobersek  <zdobersek@igalia.com>
1695
1696         Unreviewed GTK+ build fix. List WebCore before JavaScriptCore as the
1697         two WebKit2 dependency libraries to avoid WTF directiories being
1698         listed for inclusion before WebCore directories at compile-time.
1699
1700         * CMakeLists.txt:
1701
1702 2017-03-30  Megan Gardner  <megan_gardner@apple.com>
1703
1704         Allow for extended color in snapshots
1705         https://bugs.webkit.org/show_bug.cgi?id=170314
1706         <rdar://problem/28676092> WKImageCreateCGImage should support WideGamut in WebKit2 on macOS
1707
1708         Reviewed by Simon Fraser.
1709
1710         Piping options through snapshots to allow for wide gamut support.
1711
1712         * Shared/API/c/WKImage.h:
1713         * Shared/API/c/WKSharedAPICast.h:
1714         (WebKit::snapshotOptionsFromImageOptions):
1715         * Shared/ImageOptions.h:
1716         (WebKit::snapshotOptionsToImageOptions):
1717         * Shared/WebImage.cpp:
1718         (WebKit::WebImage::create):
1719
1720 2017-03-30  Sam Weinig  <sam@webkit.org>
1721
1722         Expose the WKView SPI, _prepareForMoveToWindow:withCompletionHandler as WKWebView SPI
1723         <rdar://problem/31350588>
1724         https://bugs.webkit.org/show_bug.cgi?id=170315
1725
1726         Reviewed by Simon Fraser.
1727
1728         * UIProcess/API/Cocoa/WKWebView.mm:
1729         (-[WKWebView _prepareForMoveToWindow:completionHandler:]):
1730         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1731         Copy SPI to WKWebView. Remove 'with' prefix to match conventions.
1732
1733 2017-03-30  Wenson Hsieh  <wenson_hsieh@apple.com>
1734
1735         [WK2] Touches should not cancel when showing a custom action sheet while data interaction is active
1736         https://bugs.webkit.org/show_bug.cgi?id=170291
1737         <rdar://problem/31301388>
1738
1739         Reviewed by Tim Horton.
1740
1741         Currently, when presenting a custom popover, we will cancel all touches in the application. This makes data
1742         interaction when a custom popover is shown impossible -- to address this, we should only cancel touches when
1743         the view is not an active data interaction source.
1744
1745         New API test: DataInteractionTests.CustomActionSheetPopover.
1746
1747         * UIProcess/ios/WKContentViewInteraction.mm:
1748         (-[WKContentView actionSheetAssistant:showCustomSheetForElement:]):
1749
1750 2017-03-30  Youenn Fablet  <youenn@apple.com>
1751
1752         NetworkConnectionToWebProcess should stop web sockets when being destroyed
1753         https://bugs.webkit.org/show_bug.cgi?id=170286
1754
1755         Reviewed by Brady Eidson.
1756
1757         * NetworkProcess/NetworkSocketStream.cpp:
1758         (WebKit::NetworkSocketStream::~NetworkSocketStream): Stopping the socket handle if not done already.
1759         * NetworkProcess/NetworkSocketStream.h:
1760
1761 2017-03-29  Tim Horton  <timothy_horton@apple.com>
1762
1763         Remove unused PageClient::removeNavigationGestureSnapshot
1764         https://bugs.webkit.org/show_bug.cgi?id=170249
1765
1766         Reviewed by Beth Dakin.
1767
1768         * UIProcess/PageClient.h:
1769         * UIProcess/WebPageProxy.cpp:
1770         (WebKit::WebPageProxy::removeNavigationGestureSnapshot): Deleted.
1771         * UIProcess/WebPageProxy.h:
1772         * UIProcess/mac/PageClientImpl.h:
1773         * UIProcess/mac/PageClientImpl.mm:
1774         (WebKit::PageClientImpl::removeNavigationGestureSnapshot): Deleted.
1775
1776 2017-03-29  Antti Koivisto  <antti@apple.com>
1777
1778         Increment the last stable network cache version on Mac
1779         https://bugs.webkit.org/show_bug.cgi?id=170248
1780         <rdar://problem/31326040>
1781
1782         Reviewed by Chris Dumez.
1783
1784         Bump to the latest release.
1785
1786         * NetworkProcess/cache/NetworkCacheStorage.h:
1787
1788 2017-03-28  Timothy Horton  <timothy_horton@apple.com>
1789
1790         Stop overriding scroll view inset defaults
1791         https://bugs.webkit.org/show_bug.cgi?id=170221
1792         <rdar://problem/31260325>
1793
1794         Reviewed by Simon Fraser.
1795
1796         * Platform/spi/ios/UIKitSPI.h:
1797         * UIProcess/API/Cocoa/WKWebView.mm:
1798         (-[WKWebView _initializeWithConfiguration:]):
1799         The default behavior is sufficient for us.
1800
1801 2017-03-28  Timothy Horton  <timothy_horton@apple.com>
1802
1803         Safari crashes when attempting to close tab that is displaying PDF
1804         https://bugs.webkit.org/show_bug.cgi?id=170201
1805         <rdar://problem/31242019>
1806
1807         Reviewed by Wenson Hsieh.
1808
1809         * UIProcess/API/Cocoa/WKWebView.mm:
1810         (-[WKWebView _doAfterNextStablePresentationUpdate:]):
1811         Adopt BlockPtr to fix a leak.
1812
1813         (-[WKWebView _firePresentationUpdateForPendingStableStatePresentationCallbacks]):
1814         dispatch_async in the doAfterNextPresentationUpdate callback; since this
1815         recursively calls itself, in cases where doAfterNextPresentationUpdate
1816         returns synchronously (e.g. if the Web Process is missing), we would
1817         recurse infinitely.
1818
1819 2017-03-27  Youenn Fablet  <youenn@apple.com>
1820
1821         Remove WebPage::m_shouldDoICECandidateFiltering
1822         https://bugs.webkit.org/show_bug.cgi?id=170150
1823
1824         Reviewed by Sam Weinig.
1825
1826         It is redundant with RTCController::m_shouldFilterICECandidates.
1827         Manually tested on webrtc test samples.
1828         This code path is currently untested by rwt as we hook it to getUserMedia which is mocked in rwt.
1829         Additional testing will be added as a follow-up patch.
1830
1831         * WebProcess/WebPage/WebPage.cpp:
1832         (WebKit::WebPage::disableICECandidateFiltering):
1833         (WebKit::WebPage::enableICECandidateFiltering):
1834         * WebProcess/WebPage/WebPage.h:
1835
1836 2017-03-27  Wenson Hsieh  <wenson_hsieh@apple.com>
1837
1838         [WK2] UIKit assertion when rotating device after dismissing popover
1839         https://bugs.webkit.org/show_bug.cgi?id=170159
1840         <rdar://problem/31283829>
1841
1842         Reviewed by Tim Horton.
1843
1844         Ensure that when we are finished presenting a WKActionSheet, we unregister with the shared notifications center.
1845
1846         * UIProcess/ios/WKActionSheet.mm:
1847         (-[WKActionSheet dealloc]):
1848         (-[WKActionSheet _cleanup]):
1849         (-[WKActionSheet doneWithSheet:]):
1850
1851 2017-03-27  Andy Estes  <aestes@apple.com>
1852
1853         [iOS] Suppress page count recalc when setting a snapshot paper rect
1854         https://bugs.webkit.org/show_bug.cgi?id=170156
1855         <rdar://problem/30787872>
1856
1857         Reviewed by Tim Horton.
1858
1859         When _WKWebViewPrintFormatter computes a page count for snapshotting, it updates the paper
1860         rect, which triggers UIKit to ask for the page count again while we're in the middle of
1861         printing, putting us in a bad state.
1862
1863         Suppress page count recalc while setting the new paper rect, since we know this will not
1864         cause it to change.
1865
1866         * UIProcess/_WKWebViewPrintFormatter.mm:
1867         (-[_WKWebViewPrintFormatter _setSnapshotPaperRect:]): Temporarily set
1868         _suppressPageCountRecalc to YES before updating the paper rect.
1869         (-[_WKWebViewPrintFormatter _setNeedsRecalc]): Only call [super _setNeedsRecalc] if
1870         _suppressPageCountRecalc is NO.
1871         * UIProcess/_WKWebViewPrintFormatterInternal.h: Declared -_setNeedsRecalc.
1872
1873 2017-03-26  Wenson Hsieh  <wenson_hsieh@apple.com>
1874
1875         [WK2] Callout Bar should be dismissed during data interaction
1876         https://bugs.webkit.org/show_bug.cgi?id=170109
1877         <rdar://problem/31171570>
1878
1879         Reviewed by Tim Horton.
1880
1881         Minor tweak to get the callout bar to duck during data interaction. Import a new UIKit SPI header in WebKit2.
1882
1883         * Platform/spi/ios/UIKitSPI.h:
1884
1885 2017-03-27  Keith Rollin  <krollin@apple.com>
1886
1887         Update NetworkResourceLoader logging statement
1888         https://bugs.webkit.org/show_bug.cgi?id=170126
1889
1890         Reviewed by Alex Christensen.
1891
1892         NetworkResourceLoader contains a logging statement that prints, in
1893         part: "start: Retrieving resource from cache". This is misleading,
1894         since it's not necessarily the case that the resource will be loaded
1895         from the cache. What is actually happening at the point where that is
1896         logged is that the cache is being checked for the resource. It still
1897         remains to be seen if the resource will be found in it. To address
1898         this, change the logging to say "start: Checking cache for resource".
1899
1900         * NetworkProcess/NetworkResourceLoader.cpp:
1901         (WebKit::NetworkResourceLoader::start):
1902
1903 2017-03-27  Joseph Pecoraro  <pecoraro@apple.com>
1904
1905         Web Inspector: Saving files should not suggest the top level directory
1906         https://bugs.webkit.org/show_bug.cgi?id=170085
1907         <rdar://problem/30197794>
1908
1909         Reviewed by Matt Baker.
1910
1911         * UIProcess/mac/RemoteWebInspectorProxyMac.mm:
1912         (WebKit::RemoteWebInspectorProxy::platformSave):
1913         * UIProcess/mac/WebInspectorProxyMac.mm:
1914         (WebKit::WebInspectorProxy::platformSave):
1915         Don't set panel.directoryURL unless we have a good suggestion.
1916
1917 2017-03-27  Yongjun Zhang  <yongjun_zhang@apple.com>
1918
1919         Add delegate method to let an WebKit client provide a custom image preview controller.
1920         https://bugs.webkit.org/show_bug.cgi?id=170076
1921         rdar://problem/31153051
1922
1923         Add a new delegate method (_webView:previewViewControllerForImage:alternateURL:defaultActions:elementInfo:) to
1924         WKUIDelegatePrivate, an client can use this method to provide a custom image preview view controller if the image
1925         has alternated URL or custom image info.
1926
1927         Reviewed by Beth Dakin.
1928
1929         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: Add delegate method _webView:previewViewControllerForImage:alternateURL:defaultActions:elementInfo:.
1930         * UIProcess/ios/WKContentViewInteraction.mm:
1931         (-[WKContentView _presentedViewControllerForPreviewItemController:]): If the image has alternated URL or custom info, try to use the client-provided
1932             preview view controller. Otherwise, use the default WKImagePreviewViewController.
1933
1934 2017-03-27  Anders Carlsson  <andersca@apple.com>
1935
1936         Fix uses of deprecated API
1937         https://bugs.webkit.org/show_bug.cgi?id=170138
1938         rdar://problem/28882449
1939
1940         Reviewed by Tim Horton.
1941
1942         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
1943         (WebKit::toPKContactFields):
1944         (WebKit::toPKAddressField):
1945         (WebKit::toPKPaymentRequest):
1946         Don't use deprecated APIs.
1947
1948         (WebKit::toNSError):
1949         Don't try to insert nil in a dictionary.
1950
1951 2017-03-27  Alex Christensen  <achristensen@webkit.org>
1952
1953         Make WebSockets work in network process
1954         https://bugs.webkit.org/show_bug.cgi?id=169930
1955
1956         Reviewed by Youenn Fablet.
1957
1958         This adds WebSocketStream, which is a SocketStreamHandle that sends asynchronous 
1959         messages to a NetworkSocketStream in the NetworkProcess.  WebKit1 uses a SocketStreamHandleImpl
1960         still, but WebKit2 now has a SocketStreamHandleImpl in the NetworkProcess owned by the 
1961         NetworkSocketStream, which is a SocketStreamHandleClient that sends asynchronous messages back
1962         to the WebProcess.  WebSocketStream's implementation of SocketStreamHandle::platformSend is special
1963         because it stores the completion handler in a map and asynchronously reports to the caller whether
1964         it succeeded or not.  If the network processes crashes before the completion handlers are called,
1965         then they are called indicating failure and an error is reported, but that never happens, right?
1966
1967         * CMakeLists.txt:
1968         * DerivedSources.make:
1969         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1970         (WebKit::NetworkConnectionToWebProcess::didReceiveMessage):
1971         (WebKit::NetworkConnectionToWebProcess::createSocketStream):
1972         (WebKit::NetworkConnectionToWebProcess::destroySocketStream):
1973         * NetworkProcess/NetworkConnectionToWebProcess.h:
1974         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
1975         * NetworkProcess/NetworkProcess.cpp:
1976         (WebKit::NetworkProcess::setAllowsAnySSLCertificateForWebSocket):
1977         * NetworkProcess/NetworkProcess.h:
1978         * NetworkProcess/NetworkProcess.messages.in:
1979         * NetworkProcess/NetworkSocketStream.cpp: Added.
1980         (WebKit::NetworkSocketStream::create):
1981         (WebKit::NetworkSocketStream::NetworkSocketStream):
1982         (WebKit::NetworkSocketStream::sendData):
1983         (WebKit::NetworkSocketStream::close):
1984         (WebKit::NetworkSocketStream::didOpenSocketStream):
1985         (WebKit::NetworkSocketStream::didCloseSocketStream):
1986         (WebKit::NetworkSocketStream::didReceiveSocketStreamData):
1987         (WebKit::NetworkSocketStream::didFailToReceiveSocketStreamData):
1988         (WebKit::NetworkSocketStream::didUpdateBufferedAmount):
1989         (WebKit::NetworkSocketStream::didFailSocketStream):
1990         (WebKit::NetworkSocketStream::messageSenderConnection):
1991         (WebKit::NetworkSocketStream::messageSenderDestinationID):
1992         * NetworkProcess/NetworkSocketStream.h: Added.
1993         * NetworkProcess/NetworkSocketStream.messages.in: Added.
1994         * UIProcess/API/C/WKContext.cpp:
1995         (WKContextSetAllowsAnySSLCertificateForWebSocketTesting):
1996         (WKContextTerminateNetworkProcess):
1997         * UIProcess/API/C/WKContextPrivate.h:
1998         * UIProcess/WebProcessPool.cpp:
1999         (WebKit::WebProcessPool::sendSyncToNetworkingProcess):
2000         (WebKit::WebProcessPool::setAllowsAnySSLCertificateForWebSocket):
2001         (WebKit::WebProcessPool::terminateNetworkProcess):
2002         * UIProcess/WebProcessPool.h:
2003         * WebKit2.xcodeproj/project.pbxproj:
2004         * WebProcess/Network/NetworkProcessConnection.cpp:
2005         (WebKit::NetworkProcessConnection::didReceiveMessage):
2006         * WebProcess/Network/WebSocketProvider.cpp:
2007         (WebKit::WebSocketProvider::createSocketStreamHandle):
2008         * WebProcess/Network/WebSocketStream.cpp: Added.
2009         (WebKit::globalWebSocketStreamMap):
2010         (WebKit::WebSocketStream::streamWithIdentifier):
2011         (WebKit::WebSocketStream::networkProcessCrashed):
2012         (WebKit::WebSocketStream::create):
2013         (WebKit::WebSocketStream::WebSocketStream):
2014         (WebKit::WebSocketStream::~WebSocketStream):
2015         (WebKit::WebSocketStream::messageSenderConnection):
2016         (WebKit::WebSocketStream::messageSenderDestinationID):
2017         (WebKit::WebSocketStream::platformSend):
2018         (WebKit::WebSocketStream::didSendData):
2019         (WebKit::WebSocketStream::platformClose):
2020         (WebKit::WebSocketStream::bufferedAmount):
2021         (WebKit::WebSocketStream::didOpenSocketStream):
2022         (WebKit::WebSocketStream::didCloseSocketStream):
2023         (WebKit::WebSocketStream::didReceiveSocketStreamData):
2024         (WebKit::WebSocketStream::didFailToReceiveSocketStreamData):
2025         (WebKit::WebSocketStream::didUpdateBufferedAmount):
2026         (WebKit::WebSocketStream::didFailSocketStream):
2027         * WebProcess/Network/WebSocketStream.h: Added.
2028         * WebProcess/Network/WebSocketStream.messages.in: Added.
2029         * WebProcess/WebProcess.cpp:
2030         (WebKit::WebProcess::networkProcessConnectionClosed):
2031
2032 2017-03-27  Adrian Perez de Castro  <aperez@igalia.com>
2033
2034         [GTK] NetscapePluginX11::m_windowID is unused/unneeded
2035         https://bugs.webkit.org/show_bug.cgi?id=170115
2036
2037         Reviewed by Michael Catanzaro.
2038
2039         * WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp:
2040         (WebKit::NetscapePluginX11::NetscapePluginX11):
2041         Remove the unneeded NetscapePluginX11::m_windowID member.
2042         * WebProcess/Plugins/Netscape/x11/NetscapePluginX11.h:
2043         Remove the unneeded NetscapePluginX11::m_windowID member.
2044
2045 2017-03-25  Andy Estes  <aestes@apple.com>
2046
2047         [iOS] Use snapshotting instead of printing to draw single-page PDFs
2048         https://bugs.webkit.org/show_bug.cgi?id=170103
2049         <rdar://problem/30542960>
2050
2051         Reviewed by Tim Horton.
2052
2053         * WebProcess/WebPage/WebPage.cpp:
2054         (WebKit::paintSnapshotAtSize): Moved the painting logic from WebPage::snapshotAtSize() to here.
2055         (WebKit::WebPage::snapshotAtSize): Changed to call paintSnapshotAtSize() with the
2056         WebImage's graphics context.
2057         (WebKit::WebPage::pdfSnapshotAtSize): Created a CGPDFGraphicsContext, passed it to
2058         paintSnapshotAtSize(), and returned the context's data.
2059         * WebProcess/WebPage/WebPage.h: Made snapshotAtSize() and snapshotNode() private, changed
2060         their return values from PassRefPtr to RefPtr, and declared pdfSnapshotAtSize().
2061         * WebProcess/WebPage/ios/WebPageIOS.mm:
2062         (WebKit::WebPage::computePagesForPrintingAndDrawToPDF): If snapshotting the first page,
2063         returned a page count of 1 and created a PDF using pdfSnapshotAtSize().
2064
2065 2017-03-25  John Wilander  <wilander@apple.com>
2066
2067         Re-enable the web process' keychain access to fix client certificate authentication
2068         https://bugs.webkit.org/show_bug.cgi?id=170074
2069         <rdar://problem/31095987>
2070
2071         Reviewed by Brent Fulgham.
2072
2073         This is a follow-up patch to
2074         https://trac.webkit.org/changeset/214389/webkit
2075         since according to Alexey Proskuryakov, resource
2076         loading has always required identical sandbox
2077         rules in WebContent and Networking processes.
2078
2079         * WebProcess/com.apple.WebProcess.sb.in:
2080             Reverted remaining change from
2081             https://trac.webkit.org/changeset/208702/webkit and
2082             https://trac.webkit.org/changeset/208707/webkit.
2083
2084 2017-03-24  Wenson Hsieh  <wenson_hsieh@apple.com>
2085
2086         [WK2] Add a UI delegate SPI hook to enable or disable navigation on drop
2087         https://bugs.webkit.org/show_bug.cgi?id=169168
2088         <rdar://problem/30688374>
2089
2090         Reviewed by Tim Horton.
2091
2092         Support customizing the set of allowed actions on drop in WebKit2 by introducing a new method to WKUIDelegatePrivate
2093         that returns a WKDragDestinationAction given platform dragging info. These flags are then used to initialize the
2094         DragData sent over to the web process, where they update DragController's view of the allowed destination actions.
2095
2096         Moving forward, the default action mask for WKWebViews will include everything except WKDragDestinationActionLoad,
2097         though for applciations linked on or before 10.12, we will still default to WKDragDestinationActionAny to mitigate
2098         any compatibility risk.
2099
2100         * Shared/API/Cocoa/WKDragDestinationAction.h:
2101
2102         Introduce WK2 client-facing versions of WebCore::DragDestinationAction flags.
2103
2104         * Shared/WebCoreArgumentCoders.cpp:
2105         (IPC::ArgumentCoder<DragData>::encode):
2106         (IPC::ArgumentCoder<DragData>::decode):
2107
2108         Serialize DragData's destination actions when sending DragData over IPC.
2109
2110         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
2111         * UIProcess/API/Cocoa/WKWebView.mm:
2112         (-[WKWebView _web_dragDestinationActionForDraggingInfo:]):
2113
2114         For WKWebView, allow all drag destination actions except for loading (i.e. drop-to-navigate).
2115
2116         * UIProcess/API/mac/WKView.mm:
2117         (-[WKView _web_dragDestinationActionForDraggingInfo:]):
2118
2119         For WKView, allow all types of drag destination actions.
2120
2121         * UIProcess/Cocoa/VersionChecks.h:
2122         * UIProcess/Cocoa/WebViewImpl.h:
2123         * UIProcess/Cocoa/WebViewImpl.mm:
2124         (WebKit::WebViewImpl::draggingEntered):
2125         (WebKit::WebViewImpl::draggingUpdated):
2126         * WebKit2.xcodeproj/project.pbxproj:
2127         * WebProcess/WebCoreSupport/WebDragClient.cpp:
2128         (WebKit::WebDragClient::actionMaskForDrag):
2129         * WebProcess/WebCoreSupport/WebDragClient.h:
2130
2131 2017-03-24  Simon Fraser  <simon.fraser@apple.com>
2132
2133         [iOS WK2] Move from a pre-commit handler to dispatch_async for visible content rect updates
2134         https://bugs.webkit.org/show_bug.cgi?id=170091
2135         rdar://problem/30682584
2136
2137         Reviewed by Tim Horton.
2138         
2139         [CATransaction addCommitHandler:forPhase:] is sometimes not called when running inside another
2140         commit callback (rdar://problem/31253952), and we don't yet have a reliable way to detect this.
2141
2142         So dispatch_async() to postpone the call to [CATransaction addCommitHandler:forPhase:] to a known-
2143         good time.
2144
2145         * UIProcess/API/Cocoa/WKWebView.mm:
2146         (-[WKWebView _scheduleVisibleContentRectUpdateAfterScrollInView:]):
2147
2148 2017-03-24  John Wilander  <wilander@apple.com>
2149
2150         Re-enable the network process' keychain access to fix client certificate authentication
2151         https://bugs.webkit.org/show_bug.cgi?id=170074
2152         <rdar://problem/31095987>
2153
2154         Reviewed by Brent Fulgham.
2155
2156         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
2157             Reverted remaining change from
2158             https://trac.webkit.org/changeset/208702/webkit and
2159             https://trac.webkit.org/changeset/208707/webkit.
2160
2161 2017-03-24  Eric Carlson  <eric.carlson@apple.com>
2162
2163         [MediaStream] "ideal" constraints passed to getUserMedia should affect fitness score
2164         https://bugs.webkit.org/show_bug.cgi?id=170056
2165
2166         Reviewed by Youenn Fablet.
2167
2168         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
2169         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame): When
2170         short-circuiting the user prompt because the page is already authorized, return the first
2171         audio and/or video device because so the page gets the one with the best fitness distance.
2172
2173 2017-03-24  Simon Fraser  <simon.fraser@apple.com>
2174
2175         Make UI-side compositing on macOS a bit more usable
2176         https://bugs.webkit.org/show_bug.cgi?id=170073
2177
2178         Reviewed by Tim Horton.
2179         
2180         Mach port as layer contents doesn't work on macOS, so don't use it there.
2181
2182         Also remove two assertions that hit with UI-side compositing in MiniBrowser.
2183
2184         * UIProcess/DrawingAreaProxy.cpp:
2185         (WebKit::DrawingAreaProxy::createFence):
2186         * UIProcess/mac/PageClientImpl.mm:
2187         (WebKit::PageClientImpl::requestScroll):
2188         * UIProcess/mac/RemoteLayerTreeHost.mm:
2189         (WebKit::RemoteLayerTreeHost::updateLayerTree):
2190
2191 2017-03-24  Alex Christensen  <achristensen@webkit.org>
2192
2193         Fix assertions after r214358.
2194         https://bugs.webkit.org/show_bug.cgi?id=169167
2195
2196         * UIProcess/API/APIContentExtensionStore.cpp:
2197         (API::ContentExtensionStore::compileContentExtension):
2198         AtomicString::init must be called for the first time from the main thread.
2199         We were calling it for the first time from a non-main thread sometimes.
2200         Call it from the main thread before initiating compiling on another thread.
2201
2202 == Rolled over to ChangeLog-2017-03-23 ==