Crash child processes if they receive an invalid message
[WebKit-https.git] / Source / WebKit2 / ChangeLog
1 2017-02-06  Anders Carlsson  <andersca@apple.com>
2
3         Crash child processes if they receive an invalid message
4         https://bugs.webkit.org/show_bug.cgi?id=167900
5
6         Reviewed by Dan Bernstein.
7
8         Previously, some processes would try to gracefully exit, others would just drop messages leading to weird bugs.
9         Instead, set app-specific crash information to the message that failed to be decoded, and then crash.
10
11         * DatabaseProcess/DatabaseProcess.cpp:
12         (WebKit::DatabaseProcess::didReceiveInvalidMessage): Deleted.
13         * DatabaseProcess/DatabaseProcess.h:
14         * NetworkProcess/NetworkProcess.cpp:
15         (WebKit::NetworkProcess::didReceiveInvalidMessage): Deleted.
16         * NetworkProcess/NetworkProcess.h:
17         * PluginProcess/PluginProcess.cpp:
18         (WebKit::PluginProcess::didReceiveInvalidMessage): Deleted.
19         * PluginProcess/PluginProcess.h:
20         * Shared/ChildProcess.h:
21         * Shared/Cocoa/ChildProcessCocoa.mm: Added.
22         (WebKit::ChildProcess::didReceiveInvalidMessage):
23         * WebKit2.xcodeproj/project.pbxproj:
24         * WebProcess/WebProcess.cpp:
25         (WebKit::WebProcess::didReceiveInvalidMessage): Deleted.
26         * WebProcess/WebProcess.h:
27
28 2017-02-06  Chris Dumez  <cdumez@apple.com>
29
30         [WK2] Drop legacy WKBundlePageDiagnosticLoggingClient API
31         https://bugs.webkit.org/show_bug.cgi?id=167883
32         <rdar://problem/30376695>
33
34         Reviewed by Sam Weinig.
35
36         Drop legacy WKBundlePageDiagnosticLoggingClient API as I am not aware of any remaining client.
37         All clients have now switched to the equivalent UIProcess-side API.
38
39         * WebKit2.xcodeproj/project.pbxproj:
40         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
41         (WKBundlePageSetDiagnosticLoggingClient): Deleted.
42         * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
43         * WebProcess/InjectedBundle/API/c/WKBundlePageDiagnosticLoggingClient.h: Removed.
44         * WebProcess/InjectedBundle/InjectedBundlePageDiagnosticLoggingClient.cpp: Removed.
45         * WebProcess/InjectedBundle/InjectedBundlePageDiagnosticLoggingClient.h: Removed.
46         * WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.cpp:
47         (WebKit::WebDiagnosticLoggingClient::logDiagnosticMessage):
48         (WebKit::WebDiagnosticLoggingClient::logDiagnosticMessageWithResult):
49         (WebKit::WebDiagnosticLoggingClient::logDiagnosticMessageWithValue):
50         * WebProcess/WebPage/WebPage.cpp:
51         (WebKit::WebPage::close):
52         (WebKit::WebPage::initializeInjectedBundleDiagnosticLoggingClient): Deleted.
53         * WebProcess/WebPage/WebPage.h:
54         (WebKit::WebPage::injectedBundleUIClient):
55         (WebKit::WebPage::injectedBundleDiagnosticLoggingClient): Deleted.
56
57 2017-02-06  Anders Carlsson  <andersca@apple.com>
58
59         Null check the WebKit::RemoteObjectProxy object before calling it
60         https://bugs.webkit.org/show_bug.cgi?id=167891
61         rdar://problem/30229358
62
63         Reviewed by Tim Horton.
64
65         If a _WKRemoteObjectRegistry invocation reply block outlives its underlying WebKit::RemoteObjectProxy object,
66         we'll crash trying to send an unused reply to it. Work around this crash by adding a null check before calling
67         sendUnusedReply. 
68
69         While this fixes the crash it will lead to leaks in the process that holds on to the reply block. A more long term fix
70         would be to manage the reply block checkers and call sendUnusedReply when invalidating the _WKRemoteObjectRegistry.
71
72         * Shared/API/Cocoa/_WKRemoteObjectRegistry.mm:
73         (-[_WKRemoteObjectRegistry _invokeMethod:]):
74
75 2017-02-06  Carlos Garcia Campos  <cgarcia@igalia.com>
76
77         [Soup] Deadlock in NetworkProcess
78         https://bugs.webkit.org/show_bug.cgi?id=167876
79
80         Reviewed by Michael Catanzaro.
81
82         WebKitSoupRequestInputStream uses a read lock. What is happening is that webkitSoupRequestInputStreamAddData
83         takes the lock, and it calls webkitSoupRequestInputStreamPendingReadAsyncComplete with the lock help. That
84         causes webkitSoupRequestInputStreamReadAsync to be called again to read the next chunk, but in the same run loop
85         operation. We don't really need the read lock because both webkitSoupRequestInputStreamAddData and
86         webkitSoupRequestInputStreamReadAsync shoudl always be called from the main thread.
87
88         * WebProcess/soup/WebKitSoupRequestInputStream.cpp:
89         (webkitSoupRequestInputStreamReadAsync): Remove the read lock and assert if called from a secondary thread.
90         (webkitSoupRequestInputStreamAddData): Ditto.
91
92 2017-02-03  Anders Carlsson  <andersca@apple.com>
93
94         Guard and unguard ports in a much less intrusive way
95         https://bugs.webkit.org/show_bug.cgi?id=167813
96
97         Reviewed by Sam Weinig.
98
99         Instead of adopting mach_port_construct/mach_port_destruct, just guard and unguard the ports where appropriate.
100
101         * Platform/IPC/mac/ConnectionMac.mm:
102         (IPC::Connection::platformInitialize):
103         (IPC::Connection::open):
104
105 2017-02-06  Miguel Gomez  <magomez@igalia.com>
106
107         [GTK][EFL] Release unused UpdateAtlas when in memory pressure situation
108         https://bugs.webkit.org/show_bug.cgi?id=167872
109
110         Reviewed by Carlos Garcia Campos.
111
112         In a memory pressure situation, release all the unused UpdateAtlas as soon as possible, instead
113         of waiting 3 seconds before releasing them.
114
115         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
116         (WebKit::CompositingCoordinator::releaseInactiveAtlasesTimerFired):
117         (WebKit::CompositingCoordinator::releaseAtlases):
118         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
119
120 2017-02-05  Simon Fraser  <simon.fraser@apple.com>
121
122         Remove unparentsOffscreenTiles logic in TileController
123         https://bugs.webkit.org/show_bug.cgi?id=167823
124
125         Reviewed by Tim Horton.
126         
127         Drive-by fix: make sure we put the tiled scrolling indicator's layer back when switching tabs.
128
129         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
130         (WebKit::TiledCoreAnimationDrawingArea::updateRootLayers):
131
132 2017-02-04  Wenson Hsieh  <wenson_hsieh@apple.com>
133
134         Data interaction on an image should make it stand out when presenting the action sheet
135         https://bugs.webkit.org/show_bug.cgi?id=167846
136         <rdar://problem/30363014>
137
138         Reviewed by Tim Horton.
139
140         Adds infrastructure to improve the behavior of data interaction for images. We make two changes to accomplish
141         this: first, add some plumbing to WebKit so the web process can tell the UI process when it is done handling a
142         request to start data interaction, so that the UI process is able to clean up UI-side state in the event that
143         the page prevented the default behavior.
144
145         Secondly, this patch tweaks the heuristic used to present action sheets as popovers. For image elements, if
146         there is sufficient space around the element, we will use the element rect as the target rect; otherwise, we
147         fall back to presenting the popover at the touch location.
148
149         * UIProcess/PageClient.h:
150         * UIProcess/WebPageProxy.h:
151         * UIProcess/WebPageProxy.messages.in:
152         * UIProcess/ios/PageClientImplIOS.h:
153         * UIProcess/ios/PageClientImplIOS.mm:
154         (WebKit::PageClientImpl::didHandleStartDataInteractionRequest):
155         * UIProcess/ios/WKActionSheet.h:
156         * UIProcess/ios/WKActionSheet.mm:
157         (-[WKActionSheet presentSheet:]):
158
159         Added a presentation style parameter, used to specify whether or not WKActionSheet should present the popover
160         using the element rect as the target rect, or the touch location.
161
162         (-[WKActionSheet doneWithSheet]):
163         (-[WKActionSheet updateSheetPosition]):
164         (-[WKActionSheet presentSheet]): Deleted.
165         * UIProcess/ios/WKActionSheetAssistant.mm:
166         (-[WKActionSheetAssistant presentationRectForIndicatedElement]):
167
168         Returns the (inflated) bounds of the element that is currently being indicated.
169
170         (-[WKActionSheetAssistant showImageSheet]):
171         (-[WKActionSheetAssistant _presentationStyleForImageAtElementRect:]):
172         (-[WKActionSheetAssistant showLinkSheet]):
173         (-[WKActionSheetAssistant showDataDetectorsSheet]):
174         * UIProcess/ios/WKContentViewInteraction.h:
175         * UIProcess/ios/WebPageProxyIOS.mm:
176         (WebKit::WebPageProxy::didHandleStartDataInteractionRequest):
177         * UIProcess/mac/PageClientImpl.h:
178         * UIProcess/mac/PageClientImpl.mm:
179
180         Remove unnecessary function declarations and implementations.
181
182         (WebKit::PageClientImpl::didPerformDataInteractionControllerOperation): Deleted.
183         (WebKit::PageClientImpl::startDataInteractionWithImage): Deleted.
184         * WebProcess/WebPage/ios/WebPageIOS.mm:
185         (WebKit::WebPage::requestStartDataInteraction):
186
187         Notify the UI process that the web process is done handling a data interaction request, specifying whether or
188         not the request was granted.
189
190 2017-02-04  Carlos Garcia Campos  <cgarcia@igalia.com>
191
192         Unreviewed. Fix the key shortcut to enable resource usage overlay in GTK+.
193
194         The condition to check for CTRL and Shift modifiers is wrong, causing the overlay to be shown on Shit+G and
195         making it impossible to write a 'G'.
196
197         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
198         (webkitWebViewBaseKeyPressEvent):
199
200 2017-02-03  Joseph Pecoraro  <pecoraro@apple.com>
201
202         Unreviewed rollout of r211486, r211629.
203
204         Original change is not ideal and is causing issues.
205
206         * Shared/WebKit2Initialize.cpp:
207         (WebKit::InitializeWebKit2):
208
209 2017-02-03  Daniel Bates  <dabates@apple.com>
210
211         [Mac][WK2] Add SPI to override the Content Security Policy of a page
212         https://bugs.webkit.org/show_bug.cgi?id=167810
213         <rdar://problem/30102568>
214
215         Reviewed by Anders Carlsson.
216
217         Add SPI to WKWebViewConfiguration so that an embedding client can define a custom Content Security
218         Policy that overrides the Content Security Policy of any page loaded in the web view.
219
220         * Shared/WebPageCreationParameters.cpp:
221         (WebKit::WebPageCreationParameters::encode): Encode instance variable overrideContentSecurityPolicy.
222         (WebKit::WebPageCreationParameters::decode): Decode instance variable overrideContentSecurityPolicy.
223         * Shared/WebPageCreationParameters.h:
224         * UIProcess/API/APIPageConfiguration.cpp:
225         (API::PageConfiguration::copy): Copy instance variable overrideContentSecurityPolicy.
226         * UIProcess/API/APIPageConfiguration.h:
227         (API::PageConfiguration::overrideContentSecurityPolicy): Added.
228         (API::PageConfiguration::setOverrideContentSecurityPolicy): Added.
229         * UIProcess/API/Cocoa/WKWebView.mm:
230         (-[WKWebView _initializeWithConfiguration:]): Copy overrideContentSecurityPolicy set on the WKWebViewConfiguration
231         object to the API::PageConfiguration object if non-nil.
232         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
233         (-[WKWebViewConfiguration copyWithZone:]):  Copy the instance variable overrideContentSecurityPolicy.
234         (-[WKWebViewConfiguration _overrideContentSecurityPolicy]): Added.
235         (-[WKWebViewConfiguration _setOverrideContentSecurityPolicy:]): Added.
236         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h: Define SPI property _overrideContentSecurityPolicy.
237         * UIProcess/WebPageProxy.cpp:
238         (WebKit::WebPageProxy::WebPageProxy): Initialize m_overrideContentSecurityPolicy from the passed
239         page configuration.
240         (WebKit::WebPageProxy::creationParameters): Set WebPageCreationParameters::overrideContentSecurityPolicy
241         so that the WebPage object (in the WebProcess) will know the overridden Content Security Policy
242         to apply to the document.
243         * UIProcess/WebPageProxy.h:
244         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
245         (WebKit::WebFrameLoaderClient::overrideContentSecurityPolicy): Added. Returns the custom Content
246         Security Policy to apply to a new document.
247         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
248         * WebProcess/WebPage/WebPage.cpp:
249         * WebProcess/WebPage/WebPage.h:
250         (WebKit::WebPage::overrideContentSecurityPolicy): Added.
251
252 2017-02-03  Anders Carlsson  <andersca@apple.com>
253
254         Revert toString behavior to what we had in the last version we shipped
255         https://bugs.webkit.org/show_bug.cgi?id=167814
256         rdar://problem/30344753
257
258         Reviewed by Tim Horton.
259
260         This is a speculative fix for a crash that we've seen on recent builds. It simply reverts the toString call back to
261         what we have in the last version of Safari we shipped.
262
263         * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp:
264         (WebKit::NPRuntimeObjectMap::convertJSValueToNPVariant):
265
266 2017-02-03  Chris Dumez  <cdumez@apple.com>
267
268         Dismiss HTML form validation popover when pressing Escape key
269         https://bugs.webkit.org/show_bug.cgi?id=167716
270         <rdar://problem/29872943>
271
272         Reviewed by Simon Fraser.
273
274         Override ValidationMessageClient::hideAnyValidationMessage().
275
276         * WebProcess/WebCoreSupport/WebValidationMessageClient.cpp:
277         (WebKit::WebValidationMessageClient::hideAnyValidationMessage):
278         * WebProcess/WebCoreSupport/WebValidationMessageClient.h:
279
280 2017-02-03  Jeremy Jones  <jeremyj@apple.com>
281
282         Require keyboard focus for pointer lock.
283         https://bugs.webkit.org/show_bug.cgi?id=167750
284
285         Reviewed by Tim Horton.
286
287         When keyboard focus leaves the page, end pointer lock
288         Prevent pointer lock when the page doesn't have keyboard focus.
289
290         * UIProcess/WebPageProxy.cpp:
291         (WebKit::WebPageProxy::dispatchActivityStateChange):
292         (WebKit::WebPageProxy::requestPointerLock):
293
294 2017-02-03  Anders Carlsson  <andersca@apple.com>
295
296         Stash away the ports - they will be nulled out before the cancel handlers are called
297         https://bugs.webkit.org/show_bug.cgi?id=167812
298
299         Reviewed by Geoffrey Garen.
300
301         * Platform/IPC/mac/ConnectionMac.mm:
302         (IPC::Connection::open):
303
304 2017-02-03  Anders Carlsson  <andersca@apple.com>
305
306         Inline createReceiveSource in its two call sites
307         https://bugs.webkit.org/show_bug.cgi?id=167809
308
309         Reviewed by Alex Christensen.
310
311         * Platform/IPC/mac/ConnectionMac.mm:
312         (IPC::Connection::open):
313         (IPC::createReceiveSource): Deleted.
314
315 2017-02-03  Wenson Hsieh  <wenson_hsieh@apple.com>
316
317         WKActionSheet should dismiss with animation when done with the sheet
318         https://bugs.webkit.org/show_bug.cgi?id=167804
319         <rdar://problem/30334861>
320
321         Reviewed by Tim Horton.
322
323         Currently, we do not dismiss the action menu when -doneWithSheet is invoked. While this is okay when the menu is
324         dismissed via tap (since it will be dismissed as default behavior by the popover controller) we need to manually
325         dismiss it if we are trying to programmatically dismiss the action sheet/menu.
326
327         * UIProcess/ios/WKActionSheet.mm:
328         (-[WKActionSheet presentSheetFromRect:]):
329         (-[WKActionSheet doneWithSheet]):
330         * UIProcess/ios/WKContentViewInteraction.mm:
331         (-[WKContentView setupInteraction]):
332         (-[WKContentView resignFirstResponder]):
333
334 2017-02-03  Olivier Blin  <olivier.blin@softathome.com>
335
336         Doc generation failure in WebKitSecurityOrigin
337         https://bugs.webkit.org/show_bug.cgi?id=167796
338
339         Reviewed by Michael Catanzaro.
340
341         * UIProcess/API/gtk/WebKitSecurityOrigin.cpp:
342         warning: Free-form return value description in webkit_security_origin_get_protocol. Use `Returns:' to avoid ambiguities.
343
344 2017-02-03  Carlos Garcia Campos  <cgarcia@igalia.com>
345
346         [GTK] Add initial implementation of resource usage overlay
347         https://bugs.webkit.org/show_bug.cgi?id=167731
348
349         Reviewed by Michael Catanzaro.
350
351         Toggle the resource usage overlay visibility by pressing CTRL + Shift + G. Only available when building with
352         developer mode enabled.
353
354         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
355         (webkitWebViewBaseKeyPressEvent):
356
357 2017-02-03  Carlos Garcia Campos  <cgarcia@igalia.com>
358
359         REGRESSION(r211486) [GTK] The MiniBrowser doesn't work anymore.
360         https://bugs.webkit.org/show_bug.cgi?id=167776
361
362         Reviewed by Yusuke Suzuki.
363
364         Since r211486 JSC::initializeThreading() also initializes the main run loop. It would be possible that RunLoop
365         need to know if it's the main one or not in its constructor, like the GLib impementation does, so we need to
366         ensure that WTF threading and MainThread are initialized before creating the main RunLoop. This is a quick fix
367         because the regression made impossible to load anything in a WebView, but I think we should review all the
368         initialize methods, what they do and how they are called in all the code.
369
370         * Shared/WebKit2Initialize.cpp:
371         (WebKit::InitializeWebKit2): Call WTF::initializeThreading() and WTF::initializeMainThread() before
372         JSC::initializeThreading() and do not call RunLoop::initializeMainRunLoop() because it's already called by JSC.
373
374 2017-02-03  Csaba Osztrogonác  <ossy@webkit.org>
375
376         [Mac][cmake] One more unreviewed speculative buildfix after r211403.
377         https://bugs.webkit.org/show_bug.cgi?id=165478
378
379         * UIProcess/API/Cocoa/WKWebView.mm: WebSQLiteDatabaseTrackerClient.h is an iOS specific
380         header in platform/ios directory which shouldn't and can't be included on non iOS build.
381
382 2017-02-03  Csaba Osztrogonác  <ossy@webkit.org>
383
384         [Mac][cmake] Unreviewed speculative buildfix after r211403.
385         https://bugs.webkit.org/show_bug.cgi?id=165478
386
387         * UIProcess/API/Cocoa/WKWebView.mm: WebBackgroundTaskController.h is an iOS specific
388         header in platform/ios directory which shouldn't and can't be included on non iOS build.
389
390
391 2017-02-02  Andreas Kling  <akling@apple.com>
392
393         [Mac] In-process memory pressure monitor for WebContent processes AKA websam
394         <https://webkit.org/b/167491>
395         <rdar://problem/30116072>
396
397         Reviewed by Antti Koivisto.
398
399         Enable the in-process memory monitor for WebContent processes on macOS 10.12+
400
401         * WebProcess/WebProcess.cpp:
402         (WebKit::WebProcess::initializeWebProcess):
403
404 2017-02-02  Commit Queue  <commit-queue@webkit.org>
405
406         Unreviewed, rolling out r211535, r211566, and r211568.
407         https://bugs.webkit.org/show_bug.cgi?id=167765
408
409         Causing timeouts? (Requested by andersca_ on #webkit).
410
411         Reverted changesets:
412
413         "IPC::Connection receive ports should be guarded"
414         https://bugs.webkit.org/show_bug.cgi?id=167704
415         http://trac.webkit.org/changeset/211535
416
417         "<rdar://problem/30323148> Webkit Nightly on 10.10 broken"
418         http://trac.webkit.org/changeset/211566
419
420         "<rdar://problem/30323148> Webkit Nightly on 10.10 broken"
421         http://trac.webkit.org/changeset/211568
422
423 2017-02-02  Megan Gardner  <megan_gardner@apple.com>
424
425         Don't attempt wide gammut on older OSes
426         https://bugs.webkit.org/show_bug.cgi?id=167754
427         <rdar://problem/29931587>
428
429         Reviewed by Tim Horton.
430
431         We need to guard our extended color checks the same way throughout the code, or we will attempt to set up
432         support for wide gamut partially, which causes crashes when using sharable bitmap.
433
434         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
435         (WebKit::convertImageToBitmap):
436         * WebProcess/WebPage/ios/WebPageIOS.mm:
437         (WebKit::WebPage::getPositionInformation):
438
439 2017-02-02  Enrica Casucci  <enrica@apple.com>
440
441         WK2: cannot tap on candidate view with hardware keyboard.
442         https://bugs.webkit.org/show_bug.cgi?id=167761
443         rdar://problem/28775395
444
445         Reviewed by Tim Horton.
446
447         The candidate view is a subview of the view returned by
448         automaticallySelectedOverlay and it should be the unscaled view
449         instead of the WKContentView.
450
451         * UIProcess/ios/WKContentViewInteraction.mm:
452         (-[WKContentView automaticallySelectedOverlay]):
453
454 2017-02-02  Wenson Hsieh  <wenson_hsieh@apple.com>
455
456         Drag images should be anchored to the mouse location
457         https://bugs.webkit.org/show_bug.cgi?id=167690
458         <rdar://problem/30295261>
459
460         Reviewed by Enrica Casucci.
461
462         Adds some plumbing for the mouse anchor point in the UI process. Additionally, refactors some unrelated code
463         for handling data interaction.
464
465         * UIProcess/PageClient.h:
466         * UIProcess/WebPageProxy.h:
467         * UIProcess/WebPageProxy.messages.in:
468         * UIProcess/ios/PageClientImplIOS.h:
469         * UIProcess/ios/PageClientImplIOS.mm:
470         (WebKit::PageClientImpl::startDataInteractionWithImage):
471         * UIProcess/ios/WKContentViewInteraction.h:
472         * UIProcess/mac/PageClientImpl.h:
473         * UIProcess/mac/PageClientImpl.mm:
474         (WebKit::PageClientImpl::startDataInteractionWithImage):
475         * UIProcess/mac/WebPageProxyMac.mm:
476         (WebKit::WebPageProxy::setDragImage):
477         * WebProcess/WebCoreSupport/WebDragClient.cpp:
478         (WebKit::WebDragClient::startDrag):
479         * WebProcess/WebCoreSupport/WebDragClient.h:
480         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
481         (WebKit::WebDragClient::startDrag):
482
483 2017-02-02  Commit Queue  <commit-queue@webkit.org>
484
485         Unreviewed, rolling out r211571 and r211582.
486         https://bugs.webkit.org/show_bug.cgi?id=167751
487
488         This change caused API test WebKit1.MemoryPressureHandler to
489         fail with an assertion. (Requested by ryanhaddad on #webkit).
490
491         Reverted changesets:
492
493         "[Mac] In-process memory pressure monitor for WebContent
494         processes."
495         https://bugs.webkit.org/show_bug.cgi?id=167491
496         http://trac.webkit.org/changeset/211571
497
498         "Unreviewed attempt to fix the Windows build after r211571."
499         http://trac.webkit.org/changeset/211582
500
501 2017-02-02  Dan Bernstein  <mitz@apple.com>
502
503         The Make Frameworks Symbolic Link build phase can end up creating a symlink inside the Frameworks subdirectory
504         https://bugs.webkit.org/show_bug.cgi?id=167745
505
506         Reviewed by Tim Horton.
507
508         * WebKit2.xcodeproj/project.pbxproj: Pass the -h option to ln(1) so that it will replace,
509           rather than follow, an existing symlink.
510
511 2017-02-02  Andreas Kling  <akling@apple.com>
512
513         [Mac] In-process memory pressure monitor for WebContent processes.
514         <https://webkit.org/b/167491>
515         <rdar://problem/30116072>
516
517         Reviewed by Antti Koivisto.
518
519         Enable the in-process memory monitor for WebContent processes on macOS 10.12+
520
521         * WebProcess/WebProcess.cpp:
522         (WebKit::WebProcess::initializeWebProcess):
523
524 2017-02-02  Chris Dumez  <cdumez@apple.com>
525
526         [Crash] com.apple.WebKit.WebContent at WebKit: WebKit::WebPage::fromCorePage()
527         https://bugs.webkit.org/show_bug.cgi?id=167738
528         <rdar://problem/30229990>
529
530         Reviewed by Andreas Kling.
531
532         The BackForwardClient no longer needs to worry about removing HistoryItems
533         from the PageCache now that WebCore takes care of it.
534
535         * WebProcess/WebPage/WebBackForwardListProxy.cpp:
536         (WebKit::WebBackForwardListProxy::addItemFromUIProcess):
537         (WebKit::WebBackForwardListProxy::addItem):
538         (WebKit::WebBackForwardListProxy::close):
539         * WebProcess/WebPage/WebBackForwardListProxy.h:
540
541 2017-02-02  Anders Carlsson  <andersca@apple.com>
542
543         <rdar://problem/30323148> Webkit Nightly on 10.10 broken
544
545         Follow-up fix.
546
547         * Platform/IPC/mac/ConnectionMac.mm:
548         (IPC::Connection::open):
549
550 2017-02-02  Anders Carlsson  <andersca@apple.com>
551
552         <rdar://problem/30323148> Webkit Nightly on 10.10 broken
553
554         Try to fix the 10.10 build.
555
556         * Platform/IPC/mac/ConnectionMac.mm:
557         (IPC::Connection::open):
558
559 2017-02-01  Anders Carlsson  <andersca@apple.com>
560
561         Handle m_processLauncher being null in ChildProcessProxy::processIdentifier()
562         https://bugs.webkit.org/show_bug.cgi?id=167713
563         rdar://problem/28896113
564
565         Reviewed by Dan Bernstein.
566
567         This can happen if the process has been explicitly terminated.
568
569         * UIProcess/ChildProcessProxy.h:
570         (WebKit::ChildProcessProxy::processIdentifier):
571
572 2017-02-02  Yongjun Zhang  <yongjun_zhang@apple.com>
573
574         In iOS, we should take background assertion when accessing localstorage databases.
575         https://bugs.webkit.org/show_bug.cgi?id=165478
576
577         Just like in WebKit1, when initializing a WKWebView, initialize the database transaction
578         tracker client. Also, we should set up the start and end background task blocks here. In
579         WebKit1, this is done inside UIKit.
580
581         Reviewed by Brady Eidson.
582
583         * UIProcess/API/Cocoa/WKWebView.mm:
584         (-[WKWebView _initializeWithConfiguration:]):
585         (-[WKWebView _setUpSQLiteDatabaseTrackerClient]): Set up the start/end background task blocks
586             and database transaction tracker client.
587
588 2017-02-01  Wenson Hsieh  <wenson_hsieh@apple.com>
589
590         Unreviewed, fix the nightly open source build.
591
592         Adds more header checks when importing from WebKitAdditions.
593
594         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
595         * UIProcess/ios/WKContentViewInteraction.h:
596         * UIProcess/ios/WKContentViewInteraction.mm:
597         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
598
599 2017-02-01  Simon Fraser  <simon.fraser@apple.com>
600
601         [iOS WK2] With visual viewports, a fixed bottom bar can be clipped out when the keyboard is visible
602         https://bugs.webkit.org/show_bug.cgi?id=167710
603         rdar://problem/30100286
604
605         Reviewed by Wenson Hsieh.
606
607         The unobscuredRectInContentCoordinates passed to -didUpdateVisibleRect:... could project outside
608         of the bounds of the document, which is OK when rubber-banding, but not when we're in a stable state,
609         because that can cause fixed elements to get pushed outside the doc. This happened when the keyboard
610         triggered bottom content insets on the scroll view.
611
612         Fix by computing a rectangle which is the "allowed" bounds of fixed content, which is permitted
613         to extend outside the document bounds only when rubber-banding, and intersect unobscuredRectInContentCoordinates
614         with that rectangle.
615
616         * UIProcess/API/Cocoa/WKWebView.mm:
617         (-[WKWebView _contentBoundsExtendedForRubberbandingWithScale:]):
618         (-[WKWebView _updateContentRectsWithState:]):
619
620 2017-02-01  Enrica Casucci  <enrica@apple.com>
621
622         WebProcess crashes in  int WTF::__throw_bad_variant_access<int> when expanding/shrinking a block selection.
623         https://bugs.webkit.org/show_bug.cgi?id=167673
624         rdar://problem/30229620
625
626         Reviewed by Anders Carlsson
627
628         This is a speculative fix for a bug that might have been introduced
629         with http://trac.webkit.org/changeset/208479.
630         The code in containsRange inline fuction in WebPageIOS.mm has not been
631         updated when the return value of Range::compareBoundaryPoints was changed
632         to ExceptionOr<short>.
633         Since there is already a method containsRange in the Range class that
634         does the right thing, expandedRangeFromHandle now uses that.
635
636         * WebProcess/WebPage/ios/WebPageIOS.mm:
637         (WebKit::WebPage::expandedRangeFromHandle):
638         (WebKit::containsRange): Deleted.
639
640 2017-02-01  Anders Carlsson  <andersca@apple.com>
641
642         IPC::Connection receive ports should be guarded
643         https://bugs.webkit.org/show_bug.cgi?id=167704
644
645         Reviewed by Tim Horton.
646
647         Guarding receive rights will make sure that they won't be closed accidentally. They are created
648         with a context pointer and can only be unguarded or destructed with the same context pointer.
649
650         * Platform/IPC/mac/ConnectionMac.mm:
651         (IPC::Connection::platformInvalidate):
652         Use mach_port_destruct and pass the connection pointer as the context.
653
654         (IPC::Connection::platformInitialize):
655         Guard the server port with the connection pointer as the context.
656
657         (IPC::Connection::open):
658         Use mach_port_construct to create the port which lets us avoid a call to mach_port_set_attributes and setMachPortQueueLength.
659         Make the port guarded and use the connection pointer as the context.
660
661         (IPC::createReceiveSource):
662         Get rid of this and just duplicate the five lines of code in two places. For the receive port we want to use mach_port_destruct
663         in our cancel handler.
664
665 2017-02-01  Andreas Kling  <akling@apple.com>
666
667         Implement the alwaysRunsAtBackgroundPriority WK2 setting using thread QoS.
668         <https://webkit.org/b/167387>
669         <rdar://problem/29711409>
670
671         Reviewed by Antti Koivisto.
672
673         Remove the old ProcessThrottlerClient implementation of alwaysRunsAtBackgroundPriority
674         and replace it with WTF::setGlobalMaxQOSClass().
675
676         If the setting is enabled, it's passed over to each WK2 child process along with its
677         bootstrap parameter, and we notify WTF in XPCServiceInitializer(), before anything
678         too threading related happens.
679
680         * Platform/IPC/Connection.cpp:
681         (IPC::Connection::processIncomingMessage):
682         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h:
683         (WebKit::XPCServiceInitializer):
684         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm:
685         (WebKit::XPCServiceInitializerDelegate::getExtraInitializationData):
686         * UIProcess/API/APIProcessPoolConfiguration.h:
687         * UIProcess/ChildProcessProxy.cpp:
688         (WebKit::ChildProcessProxy::ChildProcessProxy):
689         (WebKit::ChildProcessProxy::getLaunchOptions):
690         * UIProcess/ChildProcessProxy.h:
691         * UIProcess/Databases/DatabaseProcessProxy.cpp:
692         (WebKit::DatabaseProcessProxy::DatabaseProcessProxy):
693         * UIProcess/Network/NetworkProcessProxy.cpp:
694         (WebKit::NetworkProcessProxy::NetworkProcessProxy):
695         (WebKit::NetworkProcessProxy::alwaysRunsAtBackgroundPriority): Deleted.
696         * UIProcess/Network/NetworkProcessProxy.h:
697         * UIProcess/ProcessThrottler.cpp:
698         (WebKit::ProcessThrottler::assertionState):
699         * UIProcess/ProcessThrottlerClient.h:
700         * UIProcess/WebProcessProxy.cpp:
701         (WebKit::WebProcessProxy::WebProcessProxy):
702         (WebKit::WebProcessProxy::alwaysRunsAtBackgroundPriority): Deleted.
703         * UIProcess/WebProcessProxy.h:
704
705 2017-02-01  Tomas Popela  <tpopela@redhat.com>
706
707         [GTK] Add an API to add a custom tab into the print dialog
708         https://bugs.webkit.org/show_bug.cgi?id=151998
709
710         Reviewed by Carlos Garcia Campos.
711
712         Add a new create-custom-widget signal to the WebKitPrintOperation. The
713         signal is emitted before the dialog is displayed and it gives an
714         opportunity to embed a custom widget in the dialog. You can do so by
715         creating a new WebKitPrintCustomWidget and returning it from the
716         create-custom-widget signal handler. The WebKitPrintCustomWidget is
717         emitting two signals:
718           - update - emitted when the currently selected printer is changed,
719                      to be able to actualize the custom widget based on the
720                      current printer
721           - apply - emitted when the dialog is closed, just before the
722                     printing will start, to be able e.g. to change content
723                     based on the custom widget state.
724
725         * PlatformGTK.cmake:
726         * UIProcess/API/gtk/WebKitAutocleanups.h:
727         * UIProcess/API/gtk/WebKitPrintCustomWidget.cpp: Added.
728         (webkitPrintCustomWidgetSetProperty):
729         (webkit_print_custom_widget_class_init):
730         (webkit_print_custom_widget_new):
731         (webkit_print_custom_widget_get_widget):
732         (webkit_print_custom_widget_get_title):
733         (webkitPrintCustomWidgetEmitCustomWidgetApplySignal):
734         (webkitPrintCustomWidgetEmitUpdateCustomWidgetSignal):
735         * UIProcess/API/gtk/WebKitPrintCustomWidget.h: Added.
736         * UIProcess/API/gtk/WebKitPrintCustomWidgetPrivate.h: Added.
737         * UIProcess/API/gtk/WebKitPrintOperation.cpp:
738         (webkitPrintOperationAccumulatorObjectHandled):
739         (webkit_print_operation_class_init):
740         (notifySelectedPrinterCallback):
741         (webkitPrintOperationRunDialog):
742         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
743         * UIProcess/API/gtk/docs/webkit2gtk-4.0.types:
744         * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml:
745         * UIProcess/API/gtk/webkit2.h:
746
747 2017-02-01  Antti Koivisto  <antti@apple.com>
748
749         Load resources speculatively
750         https://bugs.webkit.org/show_bug.cgi?id=167660
751
752         Reviewed by Andreas Kling.
753
754         * NetworkProcess/cache/NetworkCache.cpp:
755         (WebKit::NetworkCache::Cache::makeEntry):
756
757             Factor to a function.
758
759         (WebKit::NetworkCache::Cache::store):
760         * NetworkProcess/cache/NetworkCache.h:
761         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
762         (WebKit::NetworkCache::SpeculativeLoad::SpeculativeLoad):
763
764             Support loads where we don't have existing cache entry to validate.
765
766         (WebKit::NetworkCache::SpeculativeLoad::didReceiveBuffer):
767
768             Synthesize a NetworkCache::Entry if we can't store it.
769
770         (WebKit::NetworkCache::SpeculativeLoad::didFinishLoading):
771         (WebKit::NetworkCache::SpeculativeLoad::didFailLoading):
772         (WebKit::NetworkCache::SpeculativeLoad::abort):
773         (WebKit::NetworkCache::SpeculativeLoad::didComplete):
774         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.h:
775         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
776         (WebKit::NetworkCache::constructRevalidationRequest):
777
778             Make having existing cache entry optional.
779
780         (WebKit::NetworkCache::SpeculativeLoadManager::retrieveEntryFromStorage):
781
782             Allow validation without validation headers (that is, normal load).
783
784         (WebKit::NetworkCache::SpeculativeLoadManager::revalidateSubresource):
785
786             Make having existing cache entry optional.
787
788         (WebKit::NetworkCache::canRevalidate):
789
790             Allow speculative loads without validation headers if we have high confidence that the
791             page is going to request this resource again. This is based on the time span we have
792             seen this resource being loaded on a given page and how much time has elapsed since we
793             last loaded it.
794
795             For example if we have seen the resource over the last 10 days we'll speculate that it will
796             be required for the next 5 days.
797
798         (WebKit::NetworkCache::SpeculativeLoadManager::preloadEntry):
799         (WebKit::NetworkCache::SpeculativeLoadManager::revalidateEntry): Deleted.
800         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.h:
801         * NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp:
802         (WebKit::NetworkCache::SubresourceInfo::encode):
803         (WebKit::NetworkCache::SubresourceInfo::decode):
804
805             Encode the firstSeen and lastSeen time stamps.
806
807         (WebKit::NetworkCache::SubresourceInfo::SubresourceInfo):
808         (WebKit::NetworkCache::makeSubresourceInfoVector):
809         (WebKit::NetworkCache::SubresourcesEntry::SubresourcesEntry):
810         (WebKit::NetworkCache::SubresourcesEntry::updateSubresourceLoads):
811         * NetworkProcess/cache/NetworkCacheSubresourcesEntry.h:
812         (WebKit::NetworkCache::SubresourceInfo::lastSeen):
813         (WebKit::NetworkCache::SubresourceInfo::firstSeen):
814         (WebKit::NetworkCache::SubresourceInfo::setNonTransient):
815         (WebKit::NetworkCache::SubresourceInfo::SubresourceInfo): Deleted.
816         (WebKit::NetworkCache::SubresourceInfo::setTransient): Deleted.
817
818 2017-02-01  Csaba Osztrogonác  <ossy@webkit.org>
819
820         [Mac][cmake] Unreviewed speculative buildfix after r211403.
821         https://bugs.webkit.org/show_bug.cgi?id=167601
822
823         * UIProcess/API/Cocoa/WKWebView.mm:
824
825 2017-01-31  Antti Koivisto  <antti@apple.com>
826
827         Teach cache coders to encode time_points
828         https://bugs.webkit.org/show_bug.cgi?id=167670
829
830         Reviewed by Andreas Kling.
831
832         Encode time_point instead of duration.
833
834         * NetworkProcess/cache/NetworkCacheStorage.cpp:
835         (WebKit::NetworkCache::decodeRecordMetaData):
836         (WebKit::NetworkCache::Storage::readRecord):
837         (WebKit::NetworkCache::encodeRecordMetaData):
838         (WebKit::NetworkCache::Storage::encodeRecord):
839         (WebKit::NetworkCache::Storage::traverse):
840
841 2017-01-31  Brent Fulgham  <bfulgham@apple.com>
842
843         [WebRTC][WebKit2] Support expanding the sandbox to allow microphone access at process launch
844         https://bugs.webkit.org/show_bug.cgi?id=167669
845         <rdar://problem/29974333>
846
847         Reviewed by Alexey Proskuryakov.
848
849         This change implements a temporary workaround to <rdar://problem/29448368> to allow us to do live
850         testing of WebRTC microphone access. It should be removed when that underlying bug is fixed.
851
852         This change adds a new process creation parameter that indicates whether we wish to expand the
853         sandbox to allow microphone access.
854
855         Tested by WebRTC suite (part of another set of bugs).
856
857         * Shared/WebProcessCreationParameters.cpp:
858         (WebKit::WebProcessCreationParameters::encode): Serialize the audio access entitlement handle.
859         (WebKit::WebProcessCreationParameters::decode): Ditto.
860         * Shared/WebProcessCreationParameters.h:
861         * UIProcess/WebProcessPool.cpp:
862         (WebKit::WebProcessPool::createNewWebProcess): Create an entitlement handle and pass along to
863         the child process.
864         * WebProcess/cocoa/WebProcessCocoa.mm:
865         (WebKit::WebProcess::platformInitializeWebProcess): If an audio entitlement (for the microphone)
866         was desired, expand the sandbox to include access.
867
868 2017-01-31  Tim Horton  <timothy_horton@apple.com>
869
870         Fix the build.
871
872         * UIProcess/API/Cocoa/WKWebView.mm:
873         (-[WKWebView _snapshotRect:intoImageOfWidth:completionHandler:]):
874
875 2017-01-31  Anders Carlsson  <andersca@apple.com>
876
877         Add more CRASH calls to try to figure out why we're failing to send mach ports over the wire
878         https://bugs.webkit.org/show_bug.cgi?id=167657
879
880         Reviewed by Tim Horton.
881
882         * WebProcess/WebPage/WebInspector.cpp:
883         (WebKit::WebInspector::openFrontendConnection):
884
885 2017-01-31  Wenson Hsieh  <wenson_hsieh@apple.com>
886
887         Crash when trying to compute global location when the WKContentView does not have a window
888         https://bugs.webkit.org/show_bug.cgi?id=167627
889         <rdar://problem/30272380>
890
891         Reviewed by Beth Dakin.
892
893         Moves data interaction state out of OpenSource and into WebKitAdditions. Work towards fixing a crash in
894         <rdar://problem/30272380>.
895
896         * UIProcess/ios/WKContentViewInteraction.h:
897         * UIProcess/ios/WKContentViewInteraction.mm:
898         (-[WKContentView resignFirstResponder]):
899
900 2017-01-31  Youenn Fablet  <youennf@gmail.com>
901
902         [WebRTC] Add support for WK2 libwebrtc endpoint
903         https://bugs.webkit.org/show_bug.cgi?id=167306
904         <rdar://problem/30245426>
905
906         Reviewed by Alex Christensen.
907
908         Implementation of the LibWebRTC networking in WebKit2.
909         The following features are required to be moved from WebProcess to NetworkProcess:
910         1 Resolution of DNS names (RTCResolver)
911         2 Enumeration of interfaces/gathering of host addresses (RTCMonitor)
912         3 Implementation of Packet Socket for TCP/UDP communication (RTCSocket).
913
914         This patch implements the related classes in WebProcess/NetworkProcess and the integration with libwebrtc.
915         NetworkProcess implementation is using libwebetc for NetworkRTCMonitor and NetworkRTCSocket.
916         This ensures an as-close implementation to libwebrtc as possible.
917         In the future, after getting a better test infrastructure we should try to implement these using native APIs.
918
919         Currently, the implementation is as follow:
920         - libwebrtc is calling WebProcess stack on the rtc network thread
921         - WebProcess stack is forwarding calls to the main thread and makes related IPC calls
922         - NetworkProcess receives the IPC calls and forward them to the rtc network thread.
923         - The calls are processed in the rtc network thread
924         Conversely, when the rtc network thread wants to notify its client, the reverse path is used.
925
926         This patch also implements the LibWebRTCProvider for WebKit2.
927         This provider uses the related classes to create a peer connection factory that will use them.
928
929         * CMakeLists.txt:
930         * DerivedSources.make:
931         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
932         (WebKit::NetworkConnectionToWebProcess::~NetworkConnectionToWebProcess):
933         (WebKit::NetworkConnectionToWebProcess::didReceiveMessage):
934         (WebKit::NetworkConnectionToWebProcess::rtcProvider):
935         (WebKit::NetworkConnectionToWebProcess::didClose):
936         * NetworkProcess/NetworkConnectionToWebProcess.h:
937         * NetworkProcess/webrtc/LibWebRTCSocketClient.cpp: Added.
938         (WebKit::LibWebRTCSocketClient::LibWebRTCSocketClient):
939         (WebKit::LibWebRTCSocketClient::sendTo):
940         (WebKit::LibWebRTCSocketClient::close):
941         (WebKit::LibWebRTCSocketClient::setOption):
942         (WebKit::LibWebRTCSocketClient::signalReadPacket):
943         (WebKit::LibWebRTCSocketClient::signalSentPacket):
944         (WebKit::LibWebRTCSocketClient::signalAddressReady):
945         (WebKit::LibWebRTCSocketClient::signalConnect):
946         (WebKit::LibWebRTCSocketClient::signalClose):
947         * NetworkProcess/webrtc/LibWebRTCSocketClient.h: Added.
948         * NetworkProcess/webrtc/NetworkRTCMonitor.cpp: Added.
949         (WebKit::NetworkRTCMonitor::startUpdating):
950         (WebKit::NetworkRTCMonitor::stopUpdating):
951         (WebKit::NetworkRTCMonitor::onNetworksChanged):
952         * NetworkProcess/webrtc/NetworkRTCMonitor.h: Added.
953         * NetworkProcess/webrtc/NetworkRTCMonitor.messages.in: Added.
954         * NetworkProcess/webrtc/NetworkRTCProvider.cpp: Added.
955         (WebKit::createThread):
956         (WebKit::NetworkRTCProvider::NetworkRTCProvider):
957         (WebKit::NetworkRTCProvider::close):
958         (WebKit::NetworkRTCProvider::createUDPSocket):
959         (WebKit::NetworkRTCProvider::createServerTCPSocket):
960         (WebKit::NetworkRTCProvider::createClientTCPSocket):
961         (WebKit::NetworkRTCProvider::addSocket):
962         (WebKit::NetworkRTCProvider::takeSocket):
963         (WebKit::NetworkRTCProvider::didReceiveNetworkRTCSocketMessage):
964         (WebKit::NetworkRTCProvider::createResolver):
965         (WebKit::NetworkRTCProvider::stopResolver):
966         (WebKit::NetworkRTCProvider::resolvedName):
967         (WebKit::NetworkMessageData::NetworkMessageData):
968         (WebKit::NetworkRTCProvider::OnMessage):
969         (WebKit::NetworkRTCProvider::callOnRTCNetworkThread):
970         (WebKit::NetworkRTCProvider::callSocket):
971         (WebKit::NetworkRTCProvider::sendFromMainThread):
972         * NetworkProcess/webrtc/NetworkRTCProvider.h: Added.
973         (WebKit::NetworkRTCProvider::create):
974         (WebKit::NetworkRTCProvider::didReceiveNetworkRTCMonitorMessage):
975         (WebKit::NetworkRTCProvider::Resolver::Resolver):
976         (WebKit::NetworkRTCProvider::Resolver::~Resolver):
977         * NetworkProcess/webrtc/NetworkRTCProvider.messages.in: Added.
978         * NetworkProcess/webrtc/NetworkRTCSocket.cpp: Added.
979         (WebKit::NetworkRTCSocket::NetworkRTCSocket):
980         (WebKit::NetworkRTCSocket::sendTo):
981         (WebKit::NetworkRTCSocket::close):
982         (WebKit::NetworkRTCSocket::setOption):
983         * NetworkProcess/webrtc/NetworkRTCSocket.h: Added.
984         * NetworkProcess/webrtc/NetworkRTCSocket.messages.in: Added.
985         * Shared/RTCNetwork.cpp: Added.
986         (WebKit::RTCNetwork::RTCNetwork):
987         (WebKit::ips):
988         (WebKit::RTCNetwork::value):
989         (WebKit::RTCNetwork::IPAddress::decode):
990         (WebKit::RTCNetwork::IPAddress::encode):
991         (WebKit::RTCNetwork::decode):
992         (WebKit::RTCNetwork::encode):
993         * Shared/RTCNetwork.h: Added.
994         (WebKit::RTCNetwork::IPAddress::IPAddress):
995         * WebKit2.xcodeproj/project.pbxproj:
996         * WebProcess/Network/NetworkProcessConnection.cpp:
997         (WebKit::NetworkProcessConnection::didReceiveMessage):
998         * WebProcess/Network/webrtc/LibWebRTCNetwork.h: Added.
999         (WebKit::LibWebRTCNetwork::monitor):
1000         (WebKit::LibWebRTCNetwork::socketFactory):
1001         (WebKit::LibWebRTCNetwork::socket):
1002         (WebKit::LibWebRTCNetwork::resolver):
1003         * WebProcess/Network/webrtc/LibWebRTCProvider.cpp: Added.
1004         (WebKit::LibWebRTCProvider::createPeerConnection):
1005         * WebProcess/Network/webrtc/LibWebRTCProvider.h: Added.
1006         * WebProcess/Network/webrtc/LibWebRTCResolver.cpp: Added.
1007         (WebKit::sendOnMainThread):
1008         (WebKit::LibWebRTCResolver::Start):
1009         (WebKit::LibWebRTCResolver::GetResolvedAddress):
1010         (WebKit::LibWebRTCResolver::Destroy):
1011         (WebKit::LibWebRTCResolver::setResolvedAddress):
1012         (WebKit::LibWebRTCResolver::setError):
1013         * WebProcess/Network/webrtc/LibWebRTCResolver.h: Added.
1014         * WebProcess/Network/webrtc/LibWebRTCSocket.cpp: Added.
1015         (WebKit::sendOnMainThread):
1016         (WebKit::LibWebRTCSocket::LibWebRTCSocket):
1017         (WebKit::LibWebRTCSocket::~LibWebRTCSocket):
1018         (WebKit::LibWebRTCSocket::GetLocalAddress):
1019         (WebKit::LibWebRTCSocket::GetRemoteAddress):
1020         (WebKit::LibWebRTCSocket::signalAddressReady):
1021         (WebKit::LibWebRTCSocket::signalReadPacket):
1022         (WebKit::LibWebRTCSocket::signalSentPacket):
1023         (WebKit::LibWebRTCSocket::signalConnect):
1024         (WebKit::LibWebRTCSocket::signalClose):
1025         (WebKit::authKey):
1026         (WebKit::LibWebRTCSocket::willSend):
1027         (WebKit::LibWebRTCSocket::SendTo):
1028         (WebKit::LibWebRTCSocket::Close):
1029         (WebKit::LibWebRTCSocket::GetOption):
1030         (WebKit::LibWebRTCSocket::SetOption):
1031         * WebProcess/Network/webrtc/LibWebRTCSocket.h: Added.
1032         * WebProcess/Network/webrtc/LibWebRTCSocketFactory.cpp: Added.
1033         (WebKit::LibWebRTCSocketFactory::CreateServerTcpSocket):
1034         (WebKit::LibWebRTCSocketFactory::CreateUdpSocket):
1035         (WebKit::LibWebRTCSocketFactory::CreateClientTcpSocket):
1036         (WebKit::LibWebRTCSocketFactory::detach):
1037         (WebKit::LibWebRTCSocketFactory::CreateAsyncResolver):
1038         * WebProcess/Network/webrtc/LibWebRTCSocketFactory.h: Added.
1039         * WebProcess/Network/webrtc/WebRTCMonitor.cpp: Added.
1040         (WebKit::sendOnMainThread):
1041         (WebKit::WebRTCMonitor::StartUpdating):
1042         (WebKit::WebRTCMonitor::StopUpdating):
1043         (WebKit::WebRTCMonitor::networksChanged):
1044         * WebProcess/Network/webrtc/WebRTCMonitor.h: Added.
1045         * WebProcess/Network/webrtc/WebRTCMonitor.messages.in: Added.
1046         * WebProcess/Network/webrtc/WebRTCResolver.cpp: Added.
1047         (WebKit::WebRTCResolver::WebRTCResolver):
1048         (WebKit::WebRTCResolver::setResolvedAddress):
1049         (WebKit::WebRTCResolver::resolvedAddressError):
1050         * WebProcess/Network/webrtc/WebRTCResolver.h: Added.
1051         * WebProcess/Network/webrtc/WebRTCResolver.messages.in: Added.
1052         * WebProcess/Network/webrtc/WebRTCSocket.cpp: Added.
1053         (WebKit::WebRTCSocket::signalOnNetworkThread):
1054         (WebKit::WebRTCSocket::WebRTCSocket):
1055         (WebKit::WebRTCSocket::signalAddressReady):
1056         (WebKit::WebRTCSocket::signalReadPacket):
1057         (WebKit::WebRTCSocket::signalSentPacket):
1058         (WebKit::WebRTCSocket::signalConnect):
1059         (WebKit::WebRTCSocket::signalClose):
1060         * WebProcess/Network/webrtc/WebRTCSocket.h: Added.
1061         * WebProcess/Network/webrtc/WebRTCSocket.messages.in: Added.
1062         * WebProcess/WebPage/WebPage.cpp:
1063         (WebKit::m_userInterfaceLayoutDirection):
1064         * WebProcess/WebProcess.cpp:
1065         (WebKit::WebProcess::initializeLibWebRTC):
1066         * WebProcess/WebProcess.h:
1067         (WebKit::WebProcess::libWebRTC):
1068
1069 2017-01-31  Jessie Berlin  <jberlin@webkit.org>
1070
1071         Build fix.
1072
1073         * UIProcess/Cocoa/WebViewImpl.mm:
1074         (WebKit::WebViewImpl::dragImageForView):
1075         * WebProcess/Plugins/PDF/DeprecatedPDFPlugin.mm:
1076         (-[WKPDFLayerControllerDelegate writeItemsToPasteboard:withTypes:]):
1077         (WebKit::PDFPlugin::handleEditingCommand):
1078         * WebProcess/Plugins/PDF/PDFPlugin.mm:
1079         (-[WKPDFLayerControllerDelegate pdfLayerController:copyItems:withTypes:]):
1080         (WebKit::PDFPlugin::handleEditingCommand):
1081         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
1082         (WebKit::WebDragClient::declareAndWriteAttachment):
1083         (WebKit::WebDragClient::declareAndWriteDragImage):
1084
1085 2017-01-31  Carlos Garcia Campos  <cgarcia@igalia.com>
1086
1087         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.15.4 release.
1088
1089         * gtk/NEWS: Add release notes for 2.15.4.
1090
1091 2017-01-31  Carlos Garcia Campos  <cgarcia@igalia.com>
1092
1093         Unreviewed. Fix syntax error in GTK+ API docs.
1094
1095         * UIProcess/API/gtk/WebKitWebContext.cpp:
1096
1097 2017-01-31  Manuel Rego Casasnovas  <rego@igalia.com>
1098
1099         [css-grid] Enable CSS Grid Layout by default
1100         https://bugs.webkit.org/show_bug.cgi?id=167578
1101
1102         Reviewed by Michael Catanzaro.
1103
1104         Now that Safari 10.1 is shipping CSS Grid Layout it seems safe to enable the feature by default:
1105         https://developer.apple.com/library/prerelease/content/releasenotes/General/WhatsNewInSafari/Articles/Safari_10_1.html
1106
1107         * Shared/WebPreferencesDefinitions.h: Remove Grid Layout from the list of experimental flags and enable it by default.
1108
1109 2017-01-31  Fujii Hironori  <Hironori.Fujii@sony.com>
1110
1111         [CoordinatedGraphics] WebCoordinatedSurface::create should do null-check of the return value of ShareableBitmap::createShareable
1112         https://bugs.webkit.org/show_bug.cgi?id=167631
1113
1114         Reviewed by Carlos Garcia Campos.
1115
1116         * Shared/CoordinatedGraphics/WebCoordinatedSurface.cpp:
1117         (WebKit::WebCoordinatedSurface::create): Do null-check of the
1118         return value of ShareableBitmap::createShareable.
1119
1120 2017-01-31  Carlos Garcia Campos  <cgarcia@igalia.com>
1121
1122         [GTK] Environment variables for enabling/disabling AC mode should take precedence over the API.
1123         https://bugs.webkit.org/show_bug.cgi?id=167605
1124
1125         Reviewed by Žan Doberšek.
1126
1127         Add HardwareAccelerationManager singleton helper to handle the global values for enabling, disabling or forcing
1128         accelerated compositing. This is used by WebPreferences to initialize the values like always, but also by
1129         WebKitSettings to ensure those values are honored and are not changed when it's not possible. This new class can
1130         be used in the future to implement the GPU blacklist.
1131
1132         * PlatformGTK.cmake: Add new files to compilation.
1133         * UIProcess/API/gtk/WebKitSettings.cpp:
1134         (webkit_settings_class_init): Document that the setting depends on actual hardware capabilities.
1135         (webkit_settings_set_hardware_acceleration_policy): Check HardwareAccelerationManager before trying to change
1136         the settings.
1137         * UIProcess/gtk/HardwareAccelerationManager.cpp: Added.
1138         (WebKit::HardwareAccelerationManager::singleton):
1139         (WebKit::HardwareAccelerationManager::HardwareAccelerationManager): Initialize m_canUseHardwareAcceleration and
1140         m_forceHardwareAcceleration dependoing on hardware and system capabilites and
1141         WEBKIT_DISABLE_COMPOSITING_MODE/WEBKIT_FORCE_COMPOSITING_MODE variables.
1142         * UIProcess/gtk/HardwareAccelerationManager.h: Added.
1143         (WebKit::HardwareAccelerationManager::canUseHardwareAcceleration):
1144         (WebKit::HardwareAccelerationManager::forceHardwareAcceleration):
1145         * UIProcess/gtk/WebPreferencesGtk.cpp:
1146         (WebKit::WebPreferences::platformInitializeStore): Use HardwareAccelerationManager to set the initial values.
1147
1148 2017-01-30  Carlos Garcia Campos  <cgarcia@igalia.com>
1149
1150         [GTK] HTTP authentication is not implemented for downloads
1151         https://bugs.webkit.org/show_bug.cgi?id=167583
1152
1153         Reviewed by Michael Catanzaro.
1154
1155         When a normal load is converted to a download, the HTTP authentication happens before the load is converted, and
1156         the download starts already authenticated. However, downloads started by DownloadManager::startDownload use the
1157         DownloadClient API to do the authentication. We don't implement didReceiveAuthenticationChallenge() in our
1158         download client, what makes the load to be cancelled and then fail silently. We should probably add API to
1159         handle downloads authentication, but we can also forward the authentication to the web view for downloads having
1160         a web view associated. That would cover most of the cases, like downloading from the context menu.
1161
1162         * UIProcess/API/gtk/WebKitDownloadClient.cpp: Add didReceiveAuthenticationChallenge implementation.
1163
1164 2017-01-30  Sam Weinig  <sam@webkit.org>
1165
1166         JSDOMBinding is too big. Split it up!
1167         https://bugs.webkit.org/show_bug.cgi?id=167601
1168
1169         Reviewed by Darin Adler.
1170
1171         * Shared/WebCoreArgumentCoders.cpp:
1172         Replace include of JSDOMBinding with JSDOMExceptionHandling.
1173
1174 2017-01-30  Andy Estes  <aestes@apple.com>
1175
1176         [QuickLook] FrameLoaderClient should return the new QuickLookHandleClient it creates
1177         https://bugs.webkit.org/show_bug.cgi?id=167625
1178
1179         Reviewed by Andreas Kling.
1180
1181         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: Declared createQuickLookHandleClient().
1182         * WebProcess/WebCoreSupport/ios/WebFrameLoaderClientIOS.mm:
1183         (WebKit::WebFrameLoaderClient::createQuickLookHandleClient): Renamed from didCreateQuickLookHandle().
1184         (WebKit::WebFrameLoaderClient::didCreateQuickLookHandle): Renamed to createQuickLookHandleClient().
1185         * WebProcess/WebCoreSupport/ios/WebQuickLookHandleClient.cpp:
1186         (WebKit::WebQuickLookHandleClient::WebQuickLookHandleClient): Set m_fileName and m_uti from
1187         the constructor arguments instead of from handle.
1188         * WebProcess/WebCoreSupport/ios/WebQuickLookHandleClient.h:
1189
1190 2017-01-30  Anders Carlsson  <andersca@apple.com>
1191
1192         Add some more crash reporter information to diagnose a failed mach_msg
1193         https://bugs.webkit.org/show_bug.cgi?id=167610
1194
1195         Reviewed by Dean Jackson.
1196
1197         Include the receive port name as well.
1198
1199         * Platform/IPC/mac/ConnectionMac.mm:
1200         (IPC::readFromMachPort):
1201
1202 2017-01-30  Simon Fraser  <simon.fraser@apple.com>
1203
1204         [iOS] position:fixed inside touch-scrollable overflow is mispositioned
1205         https://bugs.webkit.org/show_bug.cgi?id=167604
1206         rdar://problem/29500273
1207
1208         Reviewed by Zalan Bujtas.
1209
1210         Make sure we tell m_webPageProxy.computeCustomFixedPositionRect() when visual viewports are enabled.
1211
1212         * UIProcess/ios/RemoteScrollingCoordinatorProxyIOS.mm:
1213         (WebKit::RemoteScrollingCoordinatorProxy::customFixedPositionRect):
1214
1215 2017-01-30  Simon Fraser  <simon.fraser@apple.com>
1216
1217         Fixed elements should not rubber-band in WK2, nor remain at negative offsets
1218         https://bugs.webkit.org/show_bug.cgi?id=167484
1219         rdar://problem/29453068
1220
1221         Reviewed by Dean Jackson.
1222
1223         Pass in StickToViewportBounds as we did before visual viewports.
1224
1225         * UIProcess/ios/WebPageProxyIOS.mm:
1226         (WebKit::WebPageProxy::computeCustomFixedPositionRect):
1227
1228 2017-01-30  Chris Dumez  <cdumez@apple.com>
1229
1230         Update DiagnosticLoggingClient::logDiagnosticMessageWithValue() to take in the value as a double
1231         https://bugs.webkit.org/show_bug.cgi?id=167536
1232
1233         Reviewed by Darin Adler.
1234
1235         Update DiagnosticLoggingClient::logDiagnosticMessageWithValue() to take in the value as a double
1236         instead of a string. The value needs to be numeric and the current API is error-prone.
1237
1238         * NetworkProcess/NetworkProcess.cpp:
1239         (WebKit::NetworkProcess::logDiagnosticMessage):
1240         (WebKit::NetworkProcess::logDiagnosticMessageWithResult):
1241         (WebKit::NetworkProcess::logDiagnosticMessageWithValue):
1242         * NetworkProcess/NetworkProcess.h:
1243         * Scripts/webkit/messages.py:
1244         (headers_for_type):
1245         * Shared/WebCoreArgumentCoders.h:
1246         * UIProcess/HighPerformanceGraphicsUsageSampler.cpp:
1247         (WebKit::HighPerformanceGraphicsUsageSampler::timerFired):
1248         * UIProcess/Network/NetworkProcessProxy.cpp:
1249         (WebKit::NetworkProcessProxy::logDiagnosticMessage):
1250         (WebKit::NetworkProcessProxy::logDiagnosticMessageWithResult):
1251         (WebKit::NetworkProcessProxy::logDiagnosticMessageWithValue):
1252         * UIProcess/Network/NetworkProcessProxy.h:
1253         * UIProcess/Network/NetworkProcessProxy.messages.in:
1254         * UIProcess/PerActivityStateCPUUsageSampler.cpp:
1255         (WebKit::PerActivityStateCPUUsageSampler::loggingTimerFired):
1256         * UIProcess/WebBackForwardList.cpp:
1257         (WebKit::WebBackForwardList::goToItem):
1258         * UIProcess/WebPageProxy.cpp:
1259         (WebKit::WebPageProxy::logDiagnosticMessage):
1260         (WebKit::WebPageProxy::logDiagnosticMessageWithResult):
1261         (WebKit::WebPageProxy::logDiagnosticMessageWithValue):
1262         * UIProcess/WebPageProxy.h:
1263         * UIProcess/WebPageProxy.messages.in:
1264         * WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.cpp:
1265         (WebKit::WebDiagnosticLoggingClient::logDiagnosticMessage):
1266         (WebKit::WebDiagnosticLoggingClient::logDiagnosticMessageWithResult):
1267         (WebKit::WebDiagnosticLoggingClient::logDiagnosticMessageWithValue):
1268         * WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.h:
1269
1270 2017-01-30  Csaba Osztrogonác  <ossy@webkit.org>
1271
1272         [Mac][cmake] Fix the build after r211354.
1273         https://bugs.webkit.org/show_bug.cgi?id=167565
1274
1275         Unreviewed buildfix.
1276
1277         * PlatformMac.cmake:
1278
1279 2017-01-30  Miguel Gomez  <magomez@igalia.com>
1280
1281         [GTK] Scrolling iframes, doesn't redraw their content
1282         https://bugs.webkit.org/show_bug.cgi?id=167581
1283
1284         Reviewed by Carlos Garcia Campos.
1285
1286         Take into account whether we are using AC or not in order to repaint an area after scrolling.
1287
1288         No behaviour change, no new tests.
1289
1290         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1291         (WebKit::WebChromeClient::invalidateContentsForSlowScroll):
1292
1293 2017-01-30  Carlos Garcia Campos  <cgarcia@igalia.com>
1294
1295         Unreviewed. Fix GTK+ debug build after r211365.
1296
1297         Remove invalid assert.
1298
1299         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
1300         (WebKit::AcceleratedDrawingArea::exitAcceleratedCompositingModeNow):
1301
1302 2017-01-30  Carlos Garcia Campos  <cgarcia@igalia.com>
1303
1304         [GTK] Do not release OpenGL resource immediately when leaving accelerated compositing mode
1305         https://bugs.webkit.org/show_bug.cgi?id=167544
1306
1307         Reviewed by Michael Catanzaro.
1308
1309         Sometimes the conditions to be in AC mode or not change quickly, and then we leave AC mode just enter it again
1310         after a very short period of time. In those cases we are dropping all the GL resources and the compositor
1311         thread, and creating it again. We could keep the layer tree host alive for a while when exiting AC mode, and
1312         reuse it if we enter AC mode before the previous one has been discarded. While the previous layer tree host is
1313         alive we still need to keep it up to date, for example if the web view is resized or contents size change, and
1314         synchronize with the threaded compositor when it becomes the layer tree host again.
1315
1316         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
1317         (WebKit::AcceleratedDrawingArea::~AcceleratedDrawingArea): Discard the previous layer tree host.
1318         (WebKit::AcceleratedDrawingArea::AcceleratedDrawingArea): Initialize the timer to discard the previous layer
1319         tree host.
1320         (WebKit::AcceleratedDrawingArea::pageBackgroundTransparencyChanged): Notify the previous layer tree host if needed.
1321         (WebKit::AcceleratedDrawingArea::mainFrameContentSizeChanged): Ditto.
1322         (WebKit::AcceleratedDrawingArea::updateBackingStoreState): Ditto.
1323         (WebKit::AcceleratedDrawingArea::enterAcceleratedCompositingMode): Reuse the previous layer tree host if possible.
1324         (WebKit::AcceleratedDrawingArea::exitAcceleratedCompositingModeNow): Exit AC mode and save the layer tree host
1325         starting a timer of 5 seconds to discard it if not reused.
1326         (WebKit::AcceleratedDrawingArea::discardPreviousLayerTreeHost): Invalidate and destroy the previous layer tree host.
1327         (WebKit::AcceleratedDrawingArea::didChangeViewportAttributes): Notify the previous layer tree host if needed.
1328         (WebKit::AcceleratedDrawingArea::deviceOrPageScaleFactorChanged): Ditto.
1329         * WebProcess/WebPage/AcceleratedDrawingArea.h:
1330         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp:
1331         (WebKit::ThreadedCoordinatedLayerTreeHost::scrollNonCompositedContents): If it's discardable add the action to
1332         be synchronized instead.
1333         (WebKit::ThreadedCoordinatedLayerTreeHost::contentsSizeChanged): Ditto.
1334         (WebKit::ThreadedCoordinatedLayerTreeHost::deviceOrPageScaleFactorChanged): Ditto.
1335         (WebKit::ThreadedCoordinatedLayerTreeHost::pageBackgroundTransparencyChanged): Ditto.
1336         (WebKit::ThreadedCoordinatedLayerTreeHost::sizeDidChange): Ditto.
1337         (WebKit::ThreadedCoordinatedLayerTreeHost::didChangeViewportAttributes): Ditto.
1338         (WebKit::ThreadedCoordinatedLayerTreeHost::setIsDiscardable): When the layer tree host becomes discardable,
1339         reset the sync actions and return. When it becomes the real layer tree host again, apply all pending actions to
1340         synchronize with the threaded compositor.
1341         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h:
1342         * WebProcess/WebPage/DrawingAreaImpl.cpp:
1343         (WebKit::DrawingAreaImpl::scroll): Notify the previous layer tree host if needed.
1344         (WebKit::DrawingAreaImpl::mainFrameContentSizeChanged): Ditto.
1345         (WebKit::DrawingAreaImpl::exitAcceleratedCompositingMode): Use AcceleratedDrawingArea::exitAcceleratedCompositingModeNow().
1346         * WebProcess/WebPage/LayerTreeHost.h:
1347         (WebKit::LayerTreeHost::setIsDiscardable): Added.
1348
1349 2017-01-30  Manuel Rego Casasnovas  <rego@igalia.com>
1350
1351         [GTK] Remove support to enable/disable experimental features
1352         https://bugs.webkit.org/show_bug.cgi?id=167586
1353
1354         Reviewed by Michael Catanzaro.
1355
1356         As requested in bug #167578 we should remove the support to enable/disable
1357         experimental features in WebKitGTK+.
1358         One reason is that CSS Grid Layout is going to be enabled by default now,
1359         so we don't need it to be in this file.
1360         Another is that this support needs to be rewritten to use
1361         the enumerable experimental features API.
1362
1363         * PlatformGTK.cmake:
1364         * UIProcess/API/gtk/WebKitSettings.cpp:
1365         (webKitSettingsConstructed):
1366         * UIProcess/gtk/ExperimentalFeatures.cpp: Removed.
1367         * UIProcess/gtk/ExperimentalFeatures.h: Removed.
1368
1369 2017-01-30  Carlos Garcia Campos  <cgarcia@igalia.com>
1370
1371         [GTK] Add API to handle the accelerated compositing policy
1372         https://bugs.webkit.org/show_bug.cgi?id=167509
1373
1374         Reviewed by Michael Catanzaro.
1375
1376         Now that we have brought back the on demand mode, we should allow applications to choose the policy, without
1377         having to deal with environment variables. Settings also allows to set different policy depending on the web
1378         view, so for example evolution could disable AC for the composer, but leave the on demand mode for the email
1379         viewer. This patch adds a single new setting hardware-acceleration-policy to handle both
1380         acceleratedCompositingEnabled and forceCompositingMode preferences using an enum with values
1381         WEBKIT_HARDWARE_ACCELERATION_POLICY_ON_DEMAND, WEBKIT_HARDWARE_ACCELERATION_POLICY_ALWAYS and
1382         WEBKIT_HARDWARE_ACCELERATION_POLICY_NEVER.
1383
1384         * UIProcess/API/gtk/WebKitSettings.cpp:
1385         (webKitSettingsSetProperty): Add setter for hardware-acceleration-policy property.
1386         (webKitSettingsGetProperty): Add getter for hardware-acceleration-policy property.
1387         (webkit_settings_class_init): Add hardware-acceleration-policy property.
1388         (webkit_settings_get_hardware_acceleration_policy): Return policy according to the preferences.
1389         (webkit_settings_set_hardware_acceleration_policy): set preferences according to the given policy.
1390         * UIProcess/API/gtk/WebKitSettings.h:
1391         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt: Add new symbols.
1392         * WebProcess/WebPage/DrawingAreaImpl.cpp:
1393         (WebKit::DrawingAreaImpl::updatePreferences):
1394
1395 2017-01-29  Carlos Garcia Campos  <cgarcia@igalia.com>
1396
1397         [Threaded Compositor] Crash on WebCore::GLContext::version()
1398         https://bugs.webkit.org/show_bug.cgi?id=167559
1399
1400         Reviewed by Michael Catanzaro.
1401
1402         This is happening because TextureMapperPlatformLayerProxy::compositorThreadUpdateTimerFired() is fired after the
1403         threaded compositor is deleted. CoordinatedGraphicsScene::purgeGLResources() should invalidate the proxies
1404         before clearing the map.
1405
1406         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
1407         (WebKit::CoordinatedGraphicsScene::purgeGLResources):
1408
1409 2017-01-29  Nan Wang  <n_wang@apple.com>
1410
1411         AX: WKContentView needs to implement UITextInput methods to make speak selection highlighting work
1412         https://bugs.webkit.org/show_bug.cgi?id=166955
1413
1414         Reviewed by Ryosuke Niwa.
1415
1416         Implemented methods that Speak Selection can use to retrieve the word/sentence highlighting rects.
1417
1418         * Scripts/webkit/messages.py:
1419         (headers_for_type):
1420         * UIProcess/WebPageProxy.h:
1421         * UIProcess/WebPageProxy.messages.in:
1422         * UIProcess/ios/WKContentViewInteraction.h:
1423         * UIProcess/ios/WKContentViewInteraction.mm:
1424         (-[WKContentView webSelectionRectsForSelectionRects:]):
1425         (-[WKContentView webSelectionRects]):
1426         (-[WKContentView _accessibilityRetrieveRectsEnclosingSelectionOffset:withGranularity:]):
1427         (-[WKContentView _accessibilityRetrieveRectsAtSelectionOffset:withText:]):
1428         * UIProcess/ios/WebPageProxyIOS.mm:
1429         (WebKit::WebPageProxy::selectionRectsCallback):
1430         (WebKit::WebPageProxy::requestRectsForGranularityWithSelectionOffset):
1431         (WebKit::WebPageProxy::requestRectsAtSelectionOffsetWithText):
1432         * WebProcess/WebPage/WebPage.h:
1433         * WebProcess/WebPage/WebPage.messages.in:
1434         * WebProcess/WebPage/ios/WebPageIOS.mm:
1435         (WebKit::visiblePositionForPositionWithOffset):
1436         (WebKit::WebPage::getRectsForGranularityWithSelectionOffset):
1437         (WebKit::rangeNearPositionMatchesText):
1438         (WebKit::WebPage::getRectsAtSelectionOffsetWithText):
1439
1440 2017-01-29  Dan Bernstein  <mitz@apple.com>
1441
1442         [iOS] Expose WebCore::DataDetection::detectContentInRange WKWebProcessPlugInRangeHandle
1443         https://bugs.webkit.org/show_bug.cgi?id=167565
1444
1445         Reviewed by Sam Weinig.
1446
1447         Test: TestWebKitAPI/Tests/WebKit2Cocoa/BundleRangeHandle.mm
1448
1449         * Shared/API/Cocoa/WKDataDetectorTypes.h: Added. Moved the enum definition from
1450           WKWebViewConfiguration.h to here.
1451         * Shared/API/Cocoa/WKDataDetectorTypesInternal.h: Added.
1452         (fromWKDataDetectorTypes): Moved from WKWebView.mm.
1453
1454         * UIProcess/API/Cocoa/WKWebView.mm:
1455         (fromWKDataDetectorTypes): Moved to WKDataDetectorTypesInternal.h.
1456
1457         * UIProcess/API/Cocoa/WKWebViewConfiguration.h: Moved WKDataDetectorTypes definition out
1458           to WKDataDetectorTypes.h.
1459
1460         * WebKit2.xcodeproj/project.pbxproj: Added references to new files.
1461
1462         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.h:
1463         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.mm:
1464         (-[WKWebProcessPlugInRangeHandle detectDataWithTypes:context:]): Added. Calls
1465           DataDetection::detectContentInRange.
1466
1467 2017-01-29  Carlos Garcia Campos  <cgarcia@igalia.com>
1468
1469         [Coordinated Graphics] WebPage shouldn't use the layerTreeHost directly
1470         https://bugs.webkit.org/show_bug.cgi?id=167494
1471
1472         Reviewed by Michael Catanzaro.
1473
1474         In Coordinated Graphics we have a couple of methods that the WebPage uses directly from the layer tree host,
1475         instead of using the drawing area interface. This patch adds DrawingArea::didChangeViewportAttributes and
1476         DrawingArea::deviceOrPageScaleFactorChanged and renames LayerTreeHost::didChangeViewportProperties as
1477         LayerTreeHost::didChangeViewportAttributes for consistency.
1478
1479         * Shared/CoordinatedGraphics/SimpleViewportController.cpp:
1480         (WebKit::SimpleViewportController::didChangeViewportAttributes): Receive an rvalue reference to avoid copies.
1481         * Shared/CoordinatedGraphics/SimpleViewportController.h:
1482         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
1483         (WebKit::AcceleratedDrawingArea::didChangeViewportAttributes): Forward it to the layer tree host if any.
1484         (WebKit::AcceleratedDrawingArea::deviceOrPageScaleFactorChanged): Ditto.
1485         * WebProcess/WebPage/AcceleratedDrawingArea.h:
1486         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp:
1487         (WebKit::ThreadedCoordinatedLayerTreeHost::didChangeViewportAttributes): Renamed and updated to pass an rvalue reference.
1488         (WebKit::ThreadedCoordinatedLayerTreeHost::didChangeViewportProperties): Deleted.
1489         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h:
1490         * WebProcess/WebPage/DrawingArea.h:
1491         * WebProcess/WebPage/LayerTreeHost.h:
1492         (WebKit::LayerTreeHost::didChangeViewportAttributes): Renamed and updated to pass an rvalue reference.
1493         (WebKit::LayerTreeHost::didChangeViewportProperties): Deleted.
1494         * WebProcess/WebPage/WebPage.cpp:
1495         (WebKit::WebPage::sendViewportAttributesChanged): Use the drawing area.
1496         (WebKit::WebPage::scalePage): Ditto
1497         (WebKit::WebPage::setDeviceScaleFactor): Ditto.
1498         (WebKit::WebPage::viewportPropertiesDidChange): Ditto.
1499
1500 2017-01-28  Carlos Garcia Campos  <cgarcia@igalia.com>
1501
1502         [Threaded Compositor] Crash when detaching the CoordinatedGraphicsScene
1503         https://bugs.webkit.org/show_bug.cgi?id=167547
1504
1505         Reviewed by Michael Catanzaro.
1506
1507         It seems that commitSceneState() can be called after the CoordinatedGraphicsScene has been detached.
1508
1509         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
1510         (WebKit::CoordinatedGraphicsScene::commitSceneState): Return early if scene has been detached.
1511         (WebKit::CoordinatedGraphicsScene::detach): Take the render queue lock before clearing the render queue.
1512
1513 2017-01-28  Carlos Garcia Campos  <cgarcia@igalia.com>
1514
1515         [Threaded Compositor] Crash when deleting the compositor run loop
1516         https://bugs.webkit.org/show_bug.cgi?id=167545
1517
1518         Reviewed by Michael Catanzaro.
1519
1520         The problem is that we are releasing the WorkQueue before the update timer that keeps a reference to the run
1521         loop, destroyed by the WorkQueue. So, invalidate the WorkQueue in the next run loop iteration to ensure it
1522         happens after the CompositingRunLoop destructor.
1523
1524         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:
1525         (WebKit::CompositingRunLoop::~CompositingRunLoop):
1526
1527 2017-01-28  Carlos Garcia Campos  <cgarcia@igalia.com>
1528
1529         [GTK] ASSERTION FAILED: !m_layerTreeHost in DrawingAreaImpl::display()
1530         https://bugs.webkit.org/show_bug.cgi?id=167548
1531
1532         Reviewed by Michael Catanzaro.
1533
1534         The problem is that non accelerated compositing forceRepaint implementation is doing a layout and then calling
1535         display. The layout makes the drawing area enter in AC mode and display asserts that we have a layer tree
1536         host. forceRepaint shouldn't do the layout because display already does that and it correctly handles the case
1537         of entering AC mode during the layout. It shouldn't call setNeedsDisplay either, because that schedules a
1538         display, but we are going to display synchronously.
1539
1540         * WebProcess/WebPage/DrawingAreaImpl.cpp:
1541         (WebKit::DrawingAreaImpl::forceRepaint):
1542
1543 2017-01-28  Tim Horton  <timothy_horton@apple.com>
1544
1545         Don't flash a tap highlight for the entirety of an editable WKWebView
1546         https://bugs.webkit.org/show_bug.cgi?id=167486
1547         <rdar://problem/30193996>
1548
1549         Reviewed by Dan Bernstein.
1550
1551         * WebProcess/WebPage/ios/WebPageIOS.mm:
1552         (WebKit::WebPage::sendTapHighlightForNodeIfNecessary):
1553         Bail from providing a tap highlight if we are about to highlight
1554         the entire body of an editable web view.
1555
1556 2017-01-28  Wenson Hsieh  <wenson_hsieh@apple.com>
1557
1558         Check USE(APPLE_INTERNAL_SDK) instead of specific headers when importing from WebKitAdditions
1559         https://bugs.webkit.org/show_bug.cgi?id=167555
1560
1561         Reviewed by Dan Bernstein.
1562
1563         Instead of guarding #import <WebKitAdditions/*> on the existence of the imported file, consult
1564         USE(APPLE_INTERNAL_SDK) instead.
1565
1566         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
1567         * UIProcess/ios/WKContentViewInteraction.h:
1568         * UIProcess/ios/WKContentViewInteraction.mm:
1569         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
1570
1571 2017-01-28  Yoav Weiss  <yoav@yoav.ws>
1572
1573         Add Link Preload as an off-by-default experimental feature menu item.
1574         https://bugs.webkit.org/show_bug.cgi?id=167201
1575
1576         Reviewed by Ryosuke Niwa.
1577
1578         * Shared/WebPreferencesDefinitions.h:
1579         * UIProcess/API/C/WKPreferences.cpp:
1580         (WKPreferencesSetLinkPreloadEnabled):
1581         (WKPreferencesGetLinkPreloadEnabled):
1582         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1583         * WebProcess/WebPage/WebPage.cpp:
1584         (WebKit::WebPage::updatePreferences):
1585
1586 2017-01-28  Joseph Pecoraro  <pecoraro@apple.com>
1587
1588         Add User Timing Experimental Feature
1589         https://bugs.webkit.org/show_bug.cgi?id=167542
1590         <rdar://problem/22746307>
1591
1592         Reviewed by Ryosuke Niwa.
1593
1594         * Shared/WebPreferencesDefinitions.h:
1595         * UIProcess/API/C/WKPreferences.cpp:
1596         (WKPreferencesSetUserTimingEnabled):
1597         (WKPreferencesGetUserTimingEnabled):
1598         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1599         * WebProcess/WebPage/WebPage.cpp:
1600         (WebKit::WebPage::updatePreferences):
1601         Experimental feature. Off for now while we update ResourceTiming
1602         and NavigationTiming to be compatible with Performance Timing 2.
1603
1604 2017-01-28  Dan Bernstein  <mitz@apple.com>
1605
1606         <rdar://problem/30247736> WebKit2-7604.1.5 has failed to build: error: only virtual member functions can be marked 'override'
1607
1608         * UIProcess/ios/PageClientImplIOS.h: Guard the declaration of requestPasswordForQuickLookDocument
1609           with USE(QUICK_LOOK) to match the base class.
1610         * UIProcess/ios/PageClientImplIOS.mm: Guard the implementation as well.
1611
1612 2017-01-27  Dan Bernstein  <mitz@apple.com>
1613
1614         [Cocoa] No way to get the text from a WKWebProcessPlugInRangeHandle
1615         https://bugs.webkit.org/show_bug.cgi?id=167535
1616
1617         Reviewed by Sam Weinig.
1618
1619         Added a text property to WKWebProcessPlugInRangeHandle.
1620
1621         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.h: Declare new property.
1622         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.mm:
1623         (-[WKWebProcessPlugInRangeHandle text]): Added. Calls InjectedBundleRangeHandle::text.
1624
1625         * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
1626         (WebKit::InjectedBundleRangeHandle::text): Added. Calls WebCore::Range::text.
1627         * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.h:
1628
1629 2017-01-27  Alex Christensen  <achristensen@webkit.org>
1630
1631         Move smartInsertDeleteEnabled to WebPageCreationParameters
1632         https://bugs.webkit.org/show_bug.cgi?id=167530
1633
1634         Reviewed by Brady Eidson.
1635
1636         * Shared/WebPageCreationParameters.h:
1637         * UIProcess/WebPageProxy.cpp:
1638         (WebKit::WebPageProxy::initializeWebPage):
1639         (WebKit::WebPageProxy::creationParameters):
1640         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1641         (WebKit::WebChromeClient::createWindow):
1642         * WebProcess/WebPage/WebPage.cpp:
1643         (WebKit::WebPage::create):
1644         (WebKit::WebPage::WebPage):
1645         (WebKit::m_userInterfaceLayoutDirection):
1646         (WebKit::WebPage::reinitializeWebPage):
1647         * WebProcess/WebPage/WebPage.h:
1648         * WebProcess/WebProcess.cpp:
1649         (WebKit::WebProcess::createWebPage):
1650         * WebProcess/WebProcess.h:
1651         Instead of making a WebPage then immediately sending it a message to set smartInsertDeleteEnabled,
1652         just call setSmartInsertDeleteEnabled at the end of the WebPage creation.  No change in behaviour.
1653
1654 2017-01-27  Brady Eidson  <beidson@apple.com>
1655
1656         IconLoadingClient API doesn't work asynchronously.
1657         <rdar://problem/30243429> and https://bugs.webkit.org/show_bug.cgi?id=167532
1658
1659         Reviewed by Alex Christensen.
1660
1661         Make a WTF::Function (inherently not compatible with ObjC blocks as they must be copyable)
1662         into a std::function, which is copyable.
1663
1664         * UIProcess/API/APIIconLoadingClient.h:
1665         (API::IconLoadingClient::getLoadDecisionForIcon):
1666         
1667         * UIProcess/API/mac/WKView.mm:
1668         (-[WKView maybeInstallIconLoadingClient]):
1669         
1670         * UIProcess/Cocoa/IconLoadingDelegate.h:
1671         * UIProcess/Cocoa/IconLoadingDelegate.mm:
1672         (WebKit::IconLoadingDelegate::IconLoadingClient::getLoadDecisionForIcon):
1673         
1674         * UIProcess/WebPageProxy.cpp:
1675         (WebKit::WebPageProxy::getLoadDecisionForIcon):
1676
1677 2017-01-27  Chris Dumez  <cdumez@apple.com>
1678
1679         Fix remaining bad uses of logDiagnosticMessageWithValue()
1680         https://bugs.webkit.org/show_bug.cgi?id=167526
1681
1682         Reviewed by Alex Christensen.
1683
1684         Fix remaining bad uses of logDiagnosticMessageWithValue(). It can only
1685         be called with numeric values.
1686
1687         * NetworkProcess/cache/NetworkCacheStatistics.cpp:
1688         (WebKit::NetworkCache::Statistics::recordNotUsingCacheForRequest):
1689         (WebKit::NetworkCache::Statistics::recordRetrievalFailure):
1690         (WebKit::NetworkCache::Statistics::recordRetrievedCachedEntry):
1691         * UIProcess/WebBackForwardList.cpp:
1692         (WebKit::WebBackForwardList::goToItem):
1693         * WebProcess/WebPage/ios/WebPageIOS.mm:
1694         (WebKit::WebPage::willStartUserTriggeredZooming):
1695
1696 2017-01-27  Chris Dumez  <cdumez@apple.com>
1697
1698         Round CPU Usage diagnostic logging to 2 significant digits
1699         https://bugs.webkit.org/show_bug.cgi?id=167515
1700         <rdar://problem/30236297>
1701
1702         Reviewed by Antti Koivisto.
1703
1704         Round CPU Usage diagnostic logging to 2 significant digits
1705         as requested by diagnostic logging team.
1706
1707         * UIProcess/PerActivityStateCPUUsageSampler.cpp:
1708         (WebKit::toStringRoundingSignificantFigures):
1709         (WebKit::PerActivityStateCPUUsageSampler::loggingTimerFired):
1710
1711 2017-01-27  Carlos Garcia Campos  <cgarcia@igalia.com>
1712
1713         [Threaded Compositor] Stop creating the GLContext on demand the first time makeContextCurrent is called
1714         https://bugs.webkit.org/show_bug.cgi?id=167496
1715
1716         Reviewed by Žan Doberšek.
1717
1718         This is causing problems with animations when entering AC mode on demand. What happens is that the threaded
1719         compositor is created, then the animation is scheduled and during the first animation iteration the GLContext is
1720         created, making the first frame of the animation quite slow. In my computer creating the GLContext takes 0.8
1721         seconds. If the animation duration is less than the time it takes to create the GLContext, the animation ends
1722         without iterating. This causing timeouts in the bots in tests like
1723         animations/animation-iteration-event-destroy-renderer.html that expect webkitAnimationIteration events that
1724         never fire.
1725
1726         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
1727         (WebKit::ThreadedCompositor::ThreadedCompositor): Create the GLContext right after the compositing thread is
1728         created if we already have a native surface handle.
1729         (WebKit::ThreadedCompositor::createGLContext): Helper to create the GLContext.
1730         (WebKit::ThreadedCompositor::setNativeSurfaceHandleForCompositing): Create the GLContext when a native surface
1731         handle is given.
1732         (WebKit::ThreadedCompositor::makeContextCurrent): Deleted.
1733         (WebKit::ThreadedCompositor::renderLayerTree): Make the context cunrrent directly here.
1734         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
1735
1736 2017-01-27  Carlos Garcia Campos  <cgarcia@igalia.com>
1737
1738         [GTK] Stop forcing accelerated compositing by default
1739         https://bugs.webkit.org/show_bug.cgi?id=167492
1740
1741         Reviewed by Žan Doberšek.
1742
1743         We are now ready to bring back the on demand accelerated compositing mode with the threaded
1744         compositor. Unfortunately, having AC always enabled brought a lot of issues for many people. Not only it
1745         requires a lot more memory but also caused rendering issues (or even nothing rendered at all) with some graphics
1746         drivers. People started to use WEBKIT_DISABLE_COMPOSITING_MODE as a workaround, but that was not expected to be
1747         used by users. So, entering/leaving AC when required by web contents is not actually the solution but a huge
1748         improvement for many people. If we are eventually ready to force AC mode again, we'll change this again. Note
1749         that we still have WEBKIT_DISABLE_COMPOSITING_MODE, but now also WEBKIT_FORCE_COMPOSITING_MODE for testing and debugging.
1750
1751         * UIProcess/gtk/WebPreferencesGtk.cpp:
1752         (WebKit::WebPreferences::platformInitializeStore):
1753
1754 2017-01-26  Chris Dumez  <cdumez@apple.com>
1755
1756         Crash when navigating back to a page in PacheCache when one of its frames has been removed
1757         https://bugs.webkit.org/show_bug.cgi?id=167421
1758         <rdar://problem/30188490>
1759
1760         Reviewed by Darin Adler.
1761
1762         Add a new setting allowing layout tests to enable PageCache in a window
1763         that has an opener, for convenience.
1764
1765         * Shared/WebPreferencesDefinitions.h:
1766         * UIProcess/API/C/WKPreferences.cpp:
1767         (WKPreferencesSetAllowsPageCacheWithWindowOpener):
1768         (WKPreferencesGetAllowsPageCacheWithWindowOpener):
1769         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1770         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1771         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
1772         * WebProcess/WebPage/WebPage.cpp:
1773         (WebKit::WebPage::updatePreferences):
1774
1775 2017-01-26  Keith Miller  <keith_miller@apple.com>
1776
1777         classInfo should take a VM so it is not materialized from the object on each call
1778         https://bugs.webkit.org/show_bug.cgi?id=167424
1779
1780         Rubber Stamped by Michael Saboff.
1781
1782         Previously, classInfo() would get the VM from the target's
1783         MarkedBlock.  Most callers already have a VM on hand, so it is
1784         wasteful to compute the VM from the marked block every time. This
1785         patch refactors some of the most common callers of classInfo(),
1786         jsDynamicCast and inherits to take a VM as well.
1787
1788         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
1789         (WebKit::WebAutomationSessionProxy::elementForNodeHandle):
1790         * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:
1791         (WebKit::InjectedBundleNodeHandle::getOrCreate):
1792         * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
1793         (WebKit::InjectedBundleRangeHandle::getOrCreate):
1794         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1795         (WebKit::InjectedBundle::reportException):
1796         (WebKit::InjectedBundle::webNotificationID):
1797         (WebKit::InjectedBundle::createWebDataFromUint8Array):
1798         * WebProcess/Plugins/Netscape/JSNPMethod.cpp:
1799         (WebKit::JSNPMethod::finishCreation):
1800         (WebKit::callMethod):
1801         * WebProcess/Plugins/Netscape/JSNPObject.cpp:
1802         (WebKit::JSNPObject::finishCreation):
1803         (WebKit::callNPJSObject):
1804         (WebKit::constructWithConstructor):
1805         * WebProcess/Plugins/Netscape/NPJSObject.cpp:
1806         (WebKit::NPJSObject::create):
1807         * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp:
1808         (WebKit::NPRuntimeObjectMap::getOrCreateNPObject):
1809         * WebProcess/WebPage/WebFrame.cpp:
1810         (WebKit::WebFrame::frameForContext):
1811         (WebKit::WebFrame::counterValue):
1812
1813 2017-01-26  Chris Dumez  <cdumez@apple.com>
1814
1815         Fix CPU usage diagnostic logging in PerActivityStateCPUUsageSampler
1816         https://bugs.webkit.org/show_bug.cgi?id=167471
1817         <rdar://problem/30221723>
1818
1819         Reviewed by Alex Christensen.
1820
1821         Fix CPU usage diagnostic logging in PerActivityStateCPUUsageSampler
1822         to use numeric values for logDiagnosticMessageWithValue().
1823
1824         * UIProcess/PerActivityStateCPUUsageSampler.cpp:
1825         (WebKit::PerActivityStateCPUUsageSampler::loggingTimerFired):
1826         (WebKit::loggingKeyForCPUUsage): Deleted.
1827
1828 2017-01-26  Jeremy Jones  <jeremyj@apple.com>
1829
1830         Request pointer unlock on navigation and re-enable pointer-lock tests for WK2.
1831         https://bugs.webkit.org/show_bug.cgi?id=166765
1832
1833         Reviewed by Tim Horton.
1834
1835         When the main frame is load is committed, pointer lock should end.
1836         This resets pointer lock state between tests and allows tests to succeed.
1837
1838         * UIProcess/WebPageProxy.cpp:
1839         (WebKit::WebPageProxy::didCommitLoadForFrame):
1840
1841 2017-01-26  Chris Dumez  <cdumez@apple.com>
1842
1843         Fix WebGL diagnostic logging
1844         https://bugs.webkit.org/show_bug.cgi?id=167463
1845         <rdar://problem/30216981>
1846
1847         Reviewed by Alex Christensen.
1848
1849         Fix WebGL diagnostic logging so that it no longer uses logDiagnosticMessageWithValue().
1850         This is because the value apparently needs to be numeric on Mac.
1851
1852         * UIProcess/HighPerformanceGraphicsUsageSampler.cpp:
1853         (WebKit::HighPerformanceGraphicsUsageSampler::timerFired):
1854
1855 2017-01-26  Wenson Hsieh  <wenson_hsieh@apple.com>
1856
1857         Add support for recognizing data interaction gestures in WebKit2
1858         https://bugs.webkit.org/show_bug.cgi?id=167444
1859
1860         Reviewed by Beth Dakin.
1861
1862         Adds a new data interaction gesture recognizer, responsible for determining when to begin data interaction. This
1863         is a new long press gesture recognizer that fires simultaneously with the existing long press gesture
1864         recognizers (for performing long-press actions, and for showing the tap highlight).
1865
1866         Also tweaks logic for determining whether selection gesture recognizers should fire to account for data
1867         interaction -- in particular, we don't want selection gesture recognizers to cause the current selection to
1868         change while data interaction is possible. See -hasSelectablePositionAtPoint and -pointIsInAssistedNode for
1869         more details.
1870
1871         * UIProcess/ios/PageClientImplIOS.mm:
1872         (WebKit::PageClientImpl::didPerformDataInteractionControllerOperation):
1873         (WebKit::PageClientImpl::startDataInteractionWithImage):
1874         * UIProcess/ios/WKContentViewInteraction.h:
1875         * UIProcess/ios/WKContentViewInteraction.mm:
1876         (-[WKContentView _createAndConfigureLongPressGestureRecognizer]):
1877         (-[WKContentView setupInteraction]):
1878         (-[WKContentView cleanupInteraction]):
1879         (-[WKContentView _removeDefaultGestureRecognizers]):
1880         (-[WKContentView _addDefaultGestureRecognizers]):
1881         (-[WKContentView resignFirstResponder]):
1882         (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
1883         (-[WKContentView gestureRecognizerShouldBegin:]):
1884         (-[WKContentView hasSelectablePositionAtPoint:]):
1885         (-[WKContentView pointIsInDataInteractionContent:]):
1886         (-[WKContentView pointIsInAssistedNode:]):
1887
1888 2017-01-26  Matt Rajca  <mrajca@apple.com>
1889
1890         Notify clients when the user plays media otherwise prevented from autoplaying
1891         https://bugs.webkit.org/show_bug.cgi?id=167390
1892
1893         Reviewed by Alex Christensen.
1894
1895         * UIProcess/API/APIUIClient.h:
1896         (API::UIClient::didPlayMediaPreventedFromPlayingWithoutUserGesture):
1897         * UIProcess/API/C/WKPage.cpp:
1898         (WKPageSetPageUIClient):
1899         * UIProcess/API/C/WKPageUIClient.h:
1900         * UIProcess/WebPageProxy.cpp:
1901         (WebKit::WebPageProxy::didPlayMediaPreventedFromPlayingWithoutUserGesture):
1902         * UIProcess/WebPageProxy.h:
1903         * UIProcess/WebPageProxy.messages.in:
1904         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1905         (WebKit::WebChromeClient::didPlayMediaPreventedFromPlayingWithoutUserGesture):
1906         * WebProcess/WebCoreSupport/WebChromeClient.h:
1907
1908 2017-01-26  Anders Carlsson  <andersca@apple.com>
1909
1910         Don't use _CFBundleCreateUnique on Yosemite, it's not available there
1911         https://bugs.webkit.org/show_bug.cgi?id=167459
1912         rdar://problem/30181179
1913
1914         Reviewed by Beth Dakin.
1915
1916         * Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm:
1917         (WebKit::NetscapePluginModule::getPluginInfo):
1918
1919 2017-01-26  Alex Christensen  <achristensen@webkit.org>
1920
1921         Add SPI for updating WebsitePolicies
1922         https://bugs.webkit.org/show_bug.cgi?id=167040
1923
1924         Reviewed by Brady Eidson.
1925         
1926         In r209558 we added a way to send a WebsitePolicies structure to the WebProcess during navigation.
1927         If the UIProcess wants to update these policies on a WKWebView while a page is open, we will
1928         need to have SPI for doing so. This adds such SPI, but it's not hooked up to change functionality yet.
1929
1930         * UIProcess/API/C/WKPage.cpp:
1931         (WKPageUpdateWebsitePolicies):
1932         * UIProcess/API/C/WKPage.h:
1933         * UIProcess/API/Cocoa/WKWebView.mm:
1934         (-[WKWebView _updateWebsitePolicies:]):
1935         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1936         * UIProcess/WebPageProxy.cpp:
1937         (WebKit::WebPageProxy::updateWebsitePolicies):
1938         * UIProcess/WebPageProxy.h:
1939         * WebProcess/WebPage/WebPage.cpp:
1940         (WebKit::WebPage::updateWebsitePolicies):
1941         * WebProcess/WebPage/WebPage.h:
1942         * WebProcess/WebPage/WebPage.messages.in:
1943
1944 2017-01-26  Carlos Garcia Campos  <cgarcia@igalia.com>
1945
1946         [Threaded Compositor] Update also the contents size when creating the threaded compositor
1947         https://bugs.webkit.org/show_bug.cgi?id=167452
1948
1949         Reviewed by Žan Doberšek.
1950
1951         In r210954 we ensured that the threaded compositor and the viewport controller were created with the initial web
1952         page size. If we don't update the contents size, the visible rectangle will be empty and tiles won't be created
1953         until contentsSizeDidChange is called. It's even possible, when entering AC mode on demand, that we create the
1954         layer tree host after the contents size changed, in which case nothing is rendered unless we resize the window.
1955
1956         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp:
1957         (WebKit::ThreadedCoordinatedLayerTreeHost::ThreadedCoordinatedLayerTreeHost):
1958
1959 2017-01-26  Csaba Osztrogonác  <ossy@webkit.org>
1960
1961         [Mac][cmake] Fix the build after r211160
1962         https://bugs.webkit.org/show_bug.cgi?id=167451
1963
1964         Unreviewed buildfix.
1965
1966         * UIProcess/API/Cocoa/WKWebView.mm:
1967
1968 2017-01-25  Ryan Haddad  <ryanhaddad@apple.com>
1969
1970         Unreviewed, rolling out r211193.
1971
1972         This change broke internal builds.
1973
1974         Reverted changeset:
1975
1976         "Notify clients when the user plays media otherwise prevented
1977         from autoplaying"
1978         https://bugs.webkit.org/show_bug.cgi?id=167390
1979         http://trac.webkit.org/changeset/211193
1980
1981 2017-01-25  Wenson Hsieh  <wenson_hsieh@apple.com>
1982
1983         Add infrastructure to support data interaction in WebKit2
1984         https://bugs.webkit.org/show_bug.cgi?id=167443
1985
1986         Reviewed by Simon Fraser.
1987
1988         Adds plumbing for two new XPC messages: WebPageProxy::DidPerformDataInteractionControllerOperation and
1989         WebPage::RequestStartDataInteraction. Additionally, adds a new field to InteractionInformationAtPosition that
1990         indicates whether or not there is data to interact with at a given location.
1991
1992         This patch only adds infrastructure, and does not change any behavior.
1993
1994         * Shared/ios/InteractionInformationAtPosition.h:
1995         * Shared/ios/InteractionInformationAtPosition.mm:
1996         (WebKit::InteractionInformationAtPosition::encode):
1997         (WebKit::InteractionInformationAtPosition::decode):
1998         * UIProcess/PageClient.h:
1999         * UIProcess/WebPageProxy.h:
2000         * UIProcess/WebPageProxy.messages.in:
2001         * UIProcess/ios/PageClientImplIOS.h:
2002         * UIProcess/ios/PageClientImplIOS.mm:
2003         (WebKit::PageClientImpl::didPerformDataInteractionControllerOperation):
2004         (WebKit::PageClientImpl::startDataInteractionWithImage):
2005         * UIProcess/ios/WebPageProxyIOS.mm:
2006         (WebKit::WebPageProxy::didPerformDataInteractionControllerOperation):
2007         (WebKit::requestStartDataInteraction):
2008         * UIProcess/mac/PageClientImpl.h:
2009         * UIProcess/mac/PageClientImpl.mm:
2010         (WebKit::PageClientImpl::didPerformDataInteractionControllerOperation):
2011         (WebKit::PageClientImpl::startDataInteractionWithImage):
2012         * WebProcess/WebPage/WebPage.cpp:
2013         * WebProcess/WebPage/WebPage.h:
2014         * WebProcess/WebPage/WebPage.messages.in:
2015         * WebProcess/WebPage/ios/WebPageIOS.mm:
2016         (WebKit::WebPage::requestStartDataInteraction):
2017         (WebKit::WebPage::getPositionInformation):
2018
2019 2017-01-25  Tim Horton  <timothy_horton@apple.com>
2020
2021         Stop inheriting from UIWebScrollView, just use UIScrollView
2022         https://bugs.webkit.org/show_bug.cgi?id=167440
2023         <rdar://problem/7729691>
2024
2025         Reviewed by Simon Fraser.
2026
2027         * UIProcess/API/Cocoa/WKWebView.mm:
2028         (-[WKWebView scrollViewWillBeginDragging:]):
2029         * UIProcess/ios/WKScrollView.h:
2030         * UIProcess/ios/WKScrollView.mm:
2031         (-[WKScrollView initWithFrame:]): Deleted.
2032         (-[WKScrollView setDecelerationRate:]): Deleted.
2033         Inherit directly from UIScrollView, no need for UIWebScrollView.
2034         Set the few settings we care about directly.
2035         This has the side effect of reducing the default rate of scroll deceleration.
2036
2037 2017-01-25  Matt Rajca  <mrajca@apple.com>
2038
2039         Notify clients when the user plays media otherwise prevented from autoplaying
2040         https://bugs.webkit.org/show_bug.cgi?id=167390
2041
2042         Reviewed by Alex Christensen.
2043
2044         * UIProcess/API/APIUIClient.h:
2045         (API::UIClient::didPlayMediaPreventedFromPlayingWithoutUserGesture):
2046         * UIProcess/API/C/WKPage.cpp:
2047         (WKPageSetPageUIClient):
2048         * UIProcess/API/C/WKPageUIClient.h:
2049         * UIProcess/WebPageProxy.cpp:
2050         (WebKit::WebPageProxy::didPlayMediaPreventedFromPlayingWithoutUserGesture):
2051         * UIProcess/WebPageProxy.h:
2052         * UIProcess/WebPageProxy.messages.in:
2053         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2054         (WebKit::WebChromeClient::didPlayMediaPreventedFromPlayingWithoutUserGesture):
2055         * WebProcess/WebCoreSupport/WebChromeClient.h:
2056
2057 2017-01-25  Wenson Hsieh  <wenson_hsieh@apple.com>
2058
2059         Refactor drag and drop implementation on Mac
2060         https://bugs.webkit.org/show_bug.cgi?id=167427
2061
2062         Reviewed by Enrica Casucci.
2063
2064         See WebCore ChangeLog for more details.
2065
2066         * Shared/WebCoreArgumentCoders.cpp:
2067         (IPC::ArgumentCoder<DragData>::encode):
2068         (IPC::ArgumentCoder<DragData>::decode):
2069         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
2070         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
2071
2072 2017-01-25  Andy Estes  <aestes@apple.com>
2073
2074         Use #pragma once in a few places
2075         https://bugs.webkit.org/show_bug.cgi?id=167435
2076
2077         Reviewed by Alex Christensen.
2078
2079         * UIProcess/PageClient.h:
2080         * UIProcess/ios/PageClientImplIOS.h:
2081         * WebProcess/WebCoreSupport/ios/WebQuickLookHandleClient.h:
2082
2083 2017-01-25  Andy Estes  <aestes@apple.com>
2084
2085         [QuickLook] Display a WKPasswordView when a document is password-protected
2086         https://bugs.webkit.org/show_bug.cgi?id=167407
2087         <rdar://problem/28544527>
2088
2089         Reviewed by Alex Christensen.
2090
2091         * UIProcess/API/Cocoa/WKWebView.mm:
2092         (-[WKWebView _hidePasswordView]): Added an early return if there is no _passwordView.
2093         * UIProcess/PageClient.h: Declared requestPasswordForQuickLookDocument().
2094         (WebKit::PageClient::didStartProvisionalLoadForMainFrame): Added an no-op base class
2095         implementation.
2096         (WebKit::PageClient::didFailProvisionalLoadForMainFrame): Ditto.
2097         * UIProcess/WebPageProxy.cpp:
2098         (WebKit::WebPageProxy::didStartProvisionalLoadForFrame): Called
2099         PageClient::didStartProvisionalLoadForMainFrame() if frame is the main frame.
2100         (WebKit::WebPageProxy::didFailProvisionalLoadForFrame): Ditto for
2101         PageClient::didFailProvisionalLoadForMainFrame().
2102         * UIProcess/WebPageProxy.h: Declared didRequestPasswordForQuickLookDocumentInMainFrame().
2103         * UIProcess/WebPageProxy.messages.in: Added message
2104         DidRequestPasswordForQuickLookDocumentInMainFrame.
2105         * UIProcess/ios/PageClientImplIOS.h: Overrode requestPasswordForQuickLookDocument(),
2106         didStartProvisionalLoadForMainFrame(), and didFailProvisionalLoadForMainFrame().
2107         * UIProcess/ios/PageClientImplIOS.mm:
2108         (WebKit::PageClientImpl::didStartProvisionalLoadForMainFrame): Called
2109         -[WKWebView _hidePasswordView].
2110         (WebKit::PageClientImpl::didFailProvisionalLoadForMainFrame): Ditto.
2111         (WebKit::PageClientImpl::didCommitLoadForMainFrame): Ditto.
2112         (WebKit::PageClientImpl::requestPasswordForQuickLookDocument): If there is already a
2113         password view, assert that it is for the same fileName. Call
2114         -[WKPasswordView showPasswordFailureAlert] and update the userDidEnterPassword block.
2115         Otherwise, call -[WKWebView _showPasswordViewWithDocumentName:passwordHandler:].
2116         * UIProcess/ios/WebPageProxyIOS.mm:
2117         (WebKit::WebPageProxy::didRequestPasswordForQuickLookDocumentInMainFrame): Called
2118         PageClient::requestPasswordForQuickLookDocument() with a completion handler that send
2119         message WebPage::DidReceivePasswordForQuickLookDocument.
2120         * WebProcess/WebCoreSupport/ios/WebQuickLookHandleClient.cpp:
2121         (WebKit::passwordCallbacks): Stores a map of page IDs to completion handler functions.
2122         (WebKit::WebQuickLookHandleClient::~WebQuickLookHandleClient): Removes the current page ID
2123         from passwordCallbacks().
2124         (WebKit::WebQuickLookHandleClient::didRequestPassword): Asserts there is no current function
2125         for this page ID in passwordCallbacks(), adds completionHandler to passwordCallbacks(), and
2126         sends message WebPageProxy::DidRequestPasswordForQuickLookDocumentInMainFrame.
2127         (WebKit::WebQuickLookHandleClient::didReceivePassword): Asserts there is a function for this
2128         page ID in passwordCallbacks(), takes the completionHandler from passwordCallbacks(), and
2129         calls it with the received password.
2130         * WebProcess/WebCoreSupport/ios/WebQuickLookHandleClient.h: Declared didReceivePassword()
2131         and overrode supportsPasswordEntry() and didRequestPassword().
2132         * WebProcess/WebPage/WebPage.h: Declared didReceivePasswordForQuickLookDocument().
2133         * WebProcess/WebPage/WebPage.messages.in: Added message
2134         DidReceivePasswordForQuickLookDocument.
2135         * WebProcess/WebPage/ios/WebPageIOS.mm:
2136         (WebKit::WebPage::didReceivePasswordForQuickLookDocument): Called
2137         WebQuickLookHandleClient::didReceivePassword() with the received password and current page ID.
2138
2139 2017-01-25  Youenn Fablet  <youennf@gmail.com>
2140
2141         [WebRTC] Introduce libwebrtc abstraction for WK1/WK2 implementations
2142         https://bugs.webkit.org/show_bug.cgi?id=167294
2143
2144         Reviewed by Alex Christensen.
2145
2146         * WebProcess/WebPage/WebPage.cpp:
2147         (WebKit::m_userInterfaceLayoutDirection):
2148
2149 2017-01-25  Andy Estes  <aestes@apple.com>
2150
2151         [iOS] Move WKPDFView's password view to WKWebView
2152         https://bugs.webkit.org/show_bug.cgi?id=167401
2153
2154         Reviewed by Tim Horton.
2155
2156         r210943 moved the PDF password view into the new class WKPasswordView but left it as a
2157         subview of the WKPDFView. To show the password view for Web content, my original plan was to
2158         teach WKContentView to host its own password view, but this turned out not to work. Since
2159         QuickLook needs to unlock a document before determining its preview's MIME type, we have to
2160         ask for a password during provisional navigation, but if the still-committed document is a
2161         PDF then the WKContentView will not be in the view hierarchy.
2162
2163         To ensure password view visibility, this patch moves the ownership of WKPasswordView to
2164         WKWebView and creates an internal API for showing and hiding it. When
2165         -_showPasswordViewWithDocumentName:passwordHandler: is called, WKWebView inserts a new
2166         WKPasswordView as a subview of the scroll view and hides the current content view. The
2167         password view is removed and the current content view is unhidden by -_hidePasswordView.
2168
2169         This also fixes a bug in WKPDFView where a PDF document is laid out incorrectly if the view
2170         size changes while the password view is displayed.
2171
2172         * UIProcess/API/Cocoa/WKWebView.mm: Declared _passwordView.
2173         (-[WKWebView _processDidExit]): Hid the password view.
2174         (-[WKWebView _didCommitLayerTree:]): Ignored if not showing the standard content view.
2175         (-[WKWebView _restorePageScrollPosition:scrollOrigin:previousObscuredInset:scale:]): Ditto.
2176         (-[WKWebView _restorePageStateToUnobscuredCenter:scale:]): Ditto.
2177         (-[WKWebView usesStandardContentView]): Changed to return false if _passwordView is non-nil.
2178         (-[WKWebView _updateContentRectsWithState:]): Updated _passwordView's frame with the current
2179         bounds size.
2180         (-[WKWebView _showPasswordViewWithDocumentName:passwordHandler:]): Created a WKPasswordView,
2181         called -showInScrollView:, and hid _currentContentView.
2182         (-[WKWebView _hidePasswordView]): Removed _passwordView from its superview, set
2183         _passwordView to nil, and unhid _currentContentView.
2184         (-[WKWebView _passwordView]): Returned _passwordView.
2185         (-[WKWebView _beginAnimatedResizeWithUpdates:]): Called -usesStandardContentView instead of
2186         checking for a non-nil _customContentView when deciding whether to do a non-animated resize.
2187         * UIProcess/API/Cocoa/WKWebViewInternal.h:
2188         * UIProcess/ios/WKPDFView.mm: Removed _passwordView.
2189         (-[WKPDFView web_setMinimumSize:]): Set m_minimumSize and updated the frame size even when a
2190         password view is displayed.
2191         (-[WKPDFView _computePageAndDocumentFrames]): Removed password view code.
2192         (-[WKPDFView _showPasswordEntryField]): Ditto.
2193         (-[WKPDFView _passwordViewFrame]): Deleted.
2194         * UIProcess/ios/WKPasswordView.h:
2195         * UIProcess/ios/WKPasswordView.mm:
2196         (-[WKPasswordView initWithFrame:documentName:]): Stored a copy of documentName in
2197         _documentName.
2198         (-[WKPasswordView documentName]): Added. Returns _documentName.
2199         (-[WKPasswordView showInScrollView:]): Renamed from displayInContentView:. Started saving
2200         zoomScale and contentSize.
2201         (-[WKPasswordView hide]): Started restoring zoomeScale and contentSize.
2202         (-[WKPasswordView showPasswordFailureAlert]): Renamed from -displayPasswordFailureAlert.
2203         (-[WKPasswordView displayInContentView:]): Renamed to -showInScrollView:
2204         (-[WKPasswordView displayPasswordFailureAlert]): Renamed to -showPasswordFailureAlert.
2205
2206 2017-01-25  Wenson Hsieh  <wenson_hsieh@apple.com>
2207
2208         Add support for named pasteboards, pasteboard strategies and platform pasteboards
2209         https://bugs.webkit.org/show_bug.cgi?id=167404
2210
2211         Reviewed by Enrica Casucci.
2212
2213         Adds support for delivering the pasteboard name to the UI process when writing to or reading from the pasteboard.
2214
2215         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
2216         (WebKit::WebPasteboardProxy::writeWebContentToPasteboard):
2217         (WebKit::WebPasteboardProxy::writeImageToPasteboard):
2218         (WebKit::WebPasteboardProxy::writeStringToPasteboard):
2219         (WebKit::WebPasteboardProxy::readStringFromPasteboard):
2220         (WebKit::WebPasteboardProxy::readURLFromPasteboard):
2221         (WebKit::WebPasteboardProxy::readBufferFromPasteboard):
2222         (WebKit::WebPasteboardProxy::getPasteboardItemsCount):
2223         * UIProcess/WebPasteboardProxy.h:
2224         * UIProcess/WebPasteboardProxy.messages.in:
2225         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
2226         (WebKit::WebPlatformStrategies::writeToPasteboard):
2227         (WebKit::WebPlatformStrategies::getPasteboardItemsCount):
2228         (WebKit::WebPlatformStrategies::readBufferFromPasteboard):
2229         (WebKit::WebPlatformStrategies::readURLFromPasteboard):
2230         (WebKit::WebPlatformStrategies::readStringFromPasteboard):
2231         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
2232
2233 2017-01-25  Carlos Garcia Campos  <cgarcia@igalia.com>
2234
2235         [GTK] Icon Database should be in private browsing mode for ephemeral web views
2236         https://bugs.webkit.org/show_bug.cgi?id=167414
2237
2238         Reviewed by Michael Catanzaro.
2239
2240         This is already done by WebProcessPool for the legacy private session setting, but only checking the setting and not
2241         whether there are ephemeral web pages or not.
2242
2243         * UIProcess/API/gtk/WebKitWebContext.cpp:
2244         (webkitWebContextEnableIconDatabasePrivateBrowsingIfNeeded): Enable icon database private browsing if there's
2245         any ephemeral web view.
2246         (webkitWebContextDisableIconDatabasePrivateBrowsingIfNeeded): Disable icon database private browsing if there
2247         aren't ephemeral web views anymore.
2248         (webkit_web_context_set_favicon_database_directory): Enable icon database private browsing if the web context is ephemeral.
2249         (webkitWebContextCreatePageForWebView): Call webkitWebContextEnableIconDatabasePrivateBrowsingIfNeeded().
2250         (webkitWebContextWebViewDestroyed): Call webkitWebContextDisableIconDatabasePrivateBrowsingIfNeeded().
2251         * UIProcess/API/gtk/WebKitWebView.cpp:
2252         (webkitWebViewDispose): Ensure webkitWebContextWebViewDestroyed is called only once.
2253
2254 2017-01-25  Carlos Garcia Campos  <cgarcia@igalia.com>
2255
2256         [GTK] UIProcess from WebKitGtk+ 2.15.x SIGSEGVs because of X Error BadDamage in WebKit::AcceleratedBackingStoreX11::update(WebKit::LayerTreeContext const&) () at Source/WebKit2/UIProcess/gtk/AcceleratedBackingStoreX11.cpp:145
2257         https://bugs.webkit.org/show_bug.cgi?id=165656
2258
2259         Reviewed by Michael Catanzaro.
2260
2261         We are incorrectly handling BadDamage errors because the BadDamage value we pass to the XErrorTrapper is not
2262         the actual error code used by X11. Since XDamage is an extension, it has its own errors and a base error
2263         code. We need to use the base error code we get when calling XDamageQueryExtension to pass the right error code
2264         to the XErrorTrapper.
2265
2266         * UIProcess/gtk/AcceleratedBackingStoreX11.cpp:
2267         (WebKit::AcceleratedBackingStoreX11::create): Get also the damage base error.
2268         (WebKit::xDamageErrorCode): Helper to get the actual error code.
2269         (WebKit::AcceleratedBackingStoreX11::~AcceleratedBackingStoreX11): Use xDamageErrorCode().
2270         (WebKit::AcceleratedBackingStoreX11::update): Ditto.
2271
2272 2017-01-25  Miguel Gomez  <magomez@igalia.com>
2273
2274         [GTK] The inspector is broken when AC support is disabled
2275         https://bugs.webkit.org/show_bug.cgi?id=165237
2276
2277         Reviewed by Carlos Garcia Campos.
2278
2279         WebInspector must not use PageOverlays or GraphicsLayers when AC is not avaialable.
2280
2281         No new tests added.
2282
2283         * WebProcess/WebCoreSupport/WebInspectorClient.cpp:
2284         (WebKit::WebInspectorClient::highlight):
2285         (WebKit::WebInspectorClient::showPaintRect):
2286
2287 2017-01-25  Carlos Garcia Campos  <cgarcia@igalia.com>
2288
2289         [SOUP] Custom protocols don't work in private browsing mode
2290         https://bugs.webkit.org/show_bug.cgi?id=167236
2291
2292         Reviewed by Sergio Villar Senin.
2293
2294         We only register them in the default session, they should be registered in all existing sessions, and also on
2295         newly created ones.
2296
2297         * NetworkProcess/CustomProtocols/soup/CustomProtocolManagerSoup.cpp:
2298         (WebKit::CustomProtocolManager::registerProtocolClass): Set the WEBKIT_TYPE_SOUP_REQUEST_GENERIC as type for
2299         custom protocols.
2300         (WebKit::CustomProtocolManager::registerScheme): Use g_type_class_peek instead of g_type_class_ref since we know
2301         the class was already created in registerProtocolClass(). Setup custom protocols in all existing sessions.
2302
2303 2017-01-24  Carlos Garcia Campos  <cgarcia@igalia.com>
2304
2305         [GTK] Add API to create ephemeral web views and deprecate the private browsing setting
2306         https://bugs.webkit.org/show_bug.cgi?id=167370
2307
2308         Reviewed by Michael Catanzaro.
2309
2310         Add API to create ephemeral WebKitWebView, WebKitWebsiteDataManager and WebKitWebContext.
2311
2312         * UIProcess/API/gtk/WebKitSettings.cpp:
2313         (webKitSettingsSetProperty): Ignore deprecation warnings.
2314         (webKitSettingsGetProperty): Ditto.
2315         (webkit_settings_class_init): Mark WebKitSettings:enable-private-browsing as deprecated.
2316         * UIProcess/API/gtk/WebKitSettings.h:
2317         * UIProcess/API/gtk/WebKitWebContext.cpp:
2318         (webkit_web_context_new_ephemeral): Create an ephemeral WebKitWebContext. This is just a convenient method to
2319         create a WebKitWebContext with an ephemeral WebKitWebsiteDataManager without having to deal with the manager.
2320         (webkit_web_context_is_ephemeral): Return whether the context is ephemeral.
2321         (webkitWebContextCreatePageForWebView): Configure page with the web view WebKitWebsiteDataManager if it has one.
2322         * UIProcess/API/gtk/WebKitWebContext.h:
2323         * UIProcess/API/gtk/WebKitWebView.cpp:
2324         (webkitWebViewConstructed): Check if the WebView is or should be ephemeral and create a non persistent website
2325         data manager if it's an ephemeral web view in a non ephemeral web context.
2326         (webkitWebViewSetProperty): Add setter for is-ephemeral property.
2327         (webkitWebViewGetProperty): Add getter for is-ephemeral property.
2328         (webkit_web_view_class_init): Add is-ephemeral property.
2329         (webkitWebViewHandleAuthenticationChallenge): Check also whether web view is ephemeral.
2330         (webkitWebViewGetWebsiteDataManager): Helper private to return the web view data manager.
2331         (webkit_web_view_new_with_context): Also set is-ephemeral property depending on the context.
2332         (webkit_web_view_is_ephemeral): Return whether the view is ephemeral.
2333         * UIProcess/API/gtk/WebKitWebView.h:
2334         * UIProcess/API/gtk/WebKitWebViewPrivate.h:
2335         * UIProcess/API/gtk/WebKitWebsiteDataManager.cpp:
2336         (webkitWebsiteDataManagerGetProperty): Add setter for is-ephemeral property.
2337         (webkitWebsiteDataManagerSetProperty): Add getter for is-ephemeral property.
2338         (webkit_website_data_manager_class_init): Add is-ephemeral property.
2339         (webkit_website_data_manager_new_ephemeral): Create a new ephemeral WebKitWebsiteDataManager.
2340         (webkit_website_data_manager_is_ephemeral): Return whether the website data manager is ephemeral.
2341         (webkit_website_data_manager_get_base_data_directory): Return nullptr if manager is ephemeral.
2342         (webkit_website_data_manager_get_base_cache_directory): Ditto.
2343         (webkit_website_data_manager_get_local_storage_directory): Ditto.
2344         (webkit_website_data_manager_get_disk_cache_directory): Ditto.
2345         (webkit_website_data_manager_get_offline_application_cache_directory): Ditto.
2346         (webkit_website_data_manager_get_indexeddb_directory): Ditto.
2347         (webkit_website_data_manager_get_websql_directory): Ditto.
2348         * UIProcess/API/gtk/WebKitWebsiteDataManager.h:
2349         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt: Add new symbols.
2350
2351 2017-01-24  Zalan Bujtas  <zalan@apple.com>
2352
2353         Add simple line layout toggle to MiniBrowser
2354         https://bugs.webkit.org/show_bug.cgi?id=167405
2355
2356         Reviewed by Andreas Kling.
2357
2358         * UIProcess/API/Cocoa/WKPreferences.mm:
2359         (-[WKPreferences _simpleLineLayoutEnabled]):
2360         (-[WKPreferences _setSimpleLineLayoutEnabled:]):
2361         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
2362
2363 2017-01-24  Joseph Pecoraro  <pecoraro@apple.com>
2364
2365         Fold USER_TIMING into WEB_TIMING and make it a RuntimeEnabledFeature
2366         https://bugs.webkit.org/show_bug.cgi?id=167394
2367
2368         Reviewed by Ryosuke Niwa.
2369
2370         * Configurations/FeatureDefines.xcconfig:
2371
2372 2017-01-24  Simon Fraser  <simon.fraser@apple.com>
2373
2374         [iOS WK2] Avoid IOSurface readback for snapshot creation
2375         https://bugs.webkit.org/show_bug.cgi?id=167397
2376         rdar://problem/30174873
2377
2378         Reviewed by Tim Horton.
2379
2380         Use IOSurface::sinkIntoImage() for snapshots, to avoid GPU readback.
2381
2382         * UIProcess/API/Cocoa/WKWebView.mm:
2383         (-[WKWebView _snapshotRect:intoImageOfWidth:completionHandler:]):
2384
2385 2017-01-24  Tim Horton  <timothy_horton@apple.com>
2386
2387         Script gets touch events even after navigation swipe begins
2388         https://bugs.webkit.org/show_bug.cgi?id=167383
2389         <rdar://problem/22938927>
2390
2391         Reviewed by Simon Fraser.
2392
2393         * Platform/spi/ios/UIKitSPI.h:
2394         * UIProcess/API/Cocoa/WKWebView.mm:
2395         (-[WKWebView _isNavigationSwipeGestureRecognizer:]):
2396         * UIProcess/API/Cocoa/WKWebViewInternal.h:
2397         * UIProcess/Cocoa/ViewGestureController.h:
2398         * UIProcess/ios/ViewGestureControllerIOS.mm:
2399         (-[WKSwipeTransitionController isNavigationSwipeGestureRecognizer:]):
2400         (WebKit::ViewGestureController::isNavigationSwipeGestureRecognizer):
2401         * UIProcess/ios/WKContentViewInteraction.mm:
2402         (-[WKContentView gestureRecognizer:shouldRequireFailureOfGestureRecognizer:]):
2403         Require the navigation swipe gesture recognizer to fail before the
2404         UIWebTouchEventsGestureRecognizer can recognize. This way, the page
2405         doesn't get touch events during the swipe, which previously led to
2406         e.g. carousels scrolling while swiping.
2407
2408 2017-01-24  Matt Rajca  <mrajca@apple.com>
2409
2410         Pass down website autoplay policies to media elements
2411         https://bugs.webkit.org/show_bug.cgi?id=167355
2412
2413         Reviewed by Alex Christensen.
2414
2415         Autoplay policies can be specified at the global web view preferences level or on a per-page
2416         basis during navigation. This patch ensures that policies specified on a per-page basis hold
2417         precedence over global policies. If no policies are specified during navigation, global
2418         policies are used. A WebsiteAutoplayPolicy::Default option has been added to let clients
2419         explicitly specify web view defaults should be used.
2420
2421         * Shared/WebsitePolicies.h:
2422         * UIProcess/API/C/WKWebsitePolicies.cpp:
2423         (WKWebsitePoliciesGetAutoplayPolicy):
2424         (WKWebsitePoliciesSetAutoplayPolicy):
2425         * UIProcess/API/C/WKWebsitePolicies.h:
2426         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
2427         * UIProcess/API/Cocoa/_WKWebsitePolicies.mm:
2428         (-[_WKWebsitePolicies setAutoplayPolicy:]):
2429         (-[_WKWebsitePolicies autoplayPolicy]):
2430         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2431         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
2432
2433 2017-01-24  Nan Wang  <n_wang@apple.com>
2434
2435         AX: Speak Selection does not work in an iframe
2436         https://bugs.webkit.org/show_bug.cgi?id=166794
2437         <rdar://problem/29913013>
2438
2439         Reviewed by Chris Fleizach.
2440
2441         Making sure WebPage::getSelectionOrContentsAsString() is getting the
2442         selection content in the right frame. 
2443
2444         * UIProcess/API/Cocoa/WKWebView.mm:
2445         (-[WKWebView _accessibilityRetrieveSpeakSelectionContent]):
2446         (-[WKWebView _accessibilityDidGetSpeakSelectionContent:]):
2447         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2448         * UIProcess/ios/WKContentViewInteraction.h:
2449         * UIProcess/ios/WKContentViewInteraction.mm:
2450         (-[WKContentView accessibilityRetrieveSpeakSelectionContent]):
2451         * WebProcess/WebPage/WebPage.cpp:
2452         (WebKit::WebPage::getSelectionOrContentsAsString):
2453
2454 2017-01-24  Jer Noble  <jer.noble@apple.com>
2455
2456         Make _WKFullscreenDelegate available to users of the WebKit2 C-API.
2457         https://bugs.webkit.org/show_bug.cgi?id=165255
2458
2459         Reviewed by Anders Carlsson.
2460
2461         Add a getter and setter to WKPagePrivate allowing clients to set/get the
2462         _WKFullscreenDelegate associated with the page.
2463
2464         * UIProcess/API/C/mac/WKPagePrivateMac.h:
2465         * UIProcess/API/C/mac/WKPagePrivateMac.mm:
2466         (WKPageSetFullscreenDelegate):
2467         (WKPageGetFullscreenDelegate):
2468
2469 2017-01-23  Anders Carlsson  <andersca@apple.com>
2470
2471         The Score Esports crashes on launch
2472         https://bugs.webkit.org/show_bug.cgi?id=167338
2473         rdar://problem/29948645
2474
2475         Reviewed by Dan Bernstein.
2476
2477         * Shared/Cocoa/WKObject.mm:
2478         (+[WKObject conformsToProtocol:]):
2479         Add a class method implementation in case an app ends up calling +[WKObject conformsToProtocol:] for some reason.
2480
2481 2017-01-24  Miguel Gomez  <magomez@igalia.com>
2482
2483         [Coordinated Graphics] Ensure that we're in AC mode before trying to create GraphicsLayers
2484         https://bugs.webkit.org/show_bug.cgi?id=167365
2485
2486         Reviewed by Carlos Garcia Campos.
2487
2488         When entering AC on demand, the RenderLayerCompositor wants to create the root GraphicsLayer before the
2489         AcceleratedDrawingArea is in AC mode. This means there's no LayerTreeHost to request the GraphicsLayerFactory,
2490         so no layers are created. Ensure that we are in AC mode before requesting the GraphicsLayerFactory.
2491
2492         No behaviour change, no new tests.
2493
2494         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
2495         (WebKit::AcceleratedDrawingArea::graphicsLayerFactory):
2496
2497 2017-01-23  Carlos Garcia Campos  <cgarcia@igalia.com>
2498
2499         [GTK] Add API to WebKitWebsiteDataManager to handle website data
2500         https://bugs.webkit.org/show_bug.cgi?id=146589
2501
2502         Reviewed by Michael Catanzaro.
2503
2504         Add WebKitWebsiteData boxed type to wrap a WebsiteDataRecord and new methods to WebKitWebsiteDataManager to
2505         fetch, remove and clear website data.
2506
2507         * PlatformGTK.cmake: Add new files to compilation.
2508         * UIProcess/API/gtk/WebKitWebsiteData.cpp: Added.
2509         (_WebKitWebsiteData::_WebKitWebsiteData):
2510         (recordContainsSupportedDataTypes): Helper function to check if the WebsiteDataRecord contains any type exposed
2511         by our API.
2512         (toWebKitWebsiteDataTypes): Convert from WebKit::WebsiteDataType to the GTK+ public API types.
2513         (webkitWebsiteDataCreate): Create a new WebKitWebsiteData for the given WebsiteDataRecord if it contains any
2514         supported type.
2515         (webkitWebsiteDataGetRecord): Returns the wrapped WebsiteDataRecord.
2516         (webkit_website_data_ref):
2517         (webkit_website_data_unref):
2518         (webkit_website_data_get_name): Return the display name.
2519         (webkit_website_data_get_types): Returns the mask of types.
2520         (webkit_website_data_get_size): Returns the size for the given types.
2521         * UIProcess/API/gtk/WebKitWebsiteData.h: Added.
2522         * UIProcess/API/gtk/WebKitWebsiteDataManager.cpp:
2523         (toWebsiteDataTypes): Convert from GTK+ public API types to WebKit::WebsiteDataType.
2524         (webkit_website_data_manager_fetch): Fetch website data of the given types.
2525         (webkit_website_data_manager_fetch_finish):
2526         (webkit_website_data_manager_remove): Remove the website data of the given types for the given WebKitWebsiteData list.
2527         (webkit_website_data_manager_remove_finish):
2528         (webkit_website_data_manager_clear): Clear all website data of the given types modified since the given time span.
2529         (webkit_website_data_manager_clear_finish):
2530         * UIProcess/API/gtk/WebKitWebsiteDataManager.h:
2531         * UIProcess/API/gtk/WebKitWebsiteDataPrivate.h: Added.
2532         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt: Add new symbols.
2533         * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml: Add new section.
2534         * UIProcess/API/gtk/webkit2.h: Inlcude WebKitWebsiteData.h
2535
2536 2017-01-23  Antti Koivisto  <antti@apple.com>
2537
2538         Maintain ordering when doing speculative loads
2539         https://bugs.webkit.org/show_bug.cgi?id=167324
2540
2541         Forgot to implement a review comment.
2542
2543         * NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp:
2544         (WebKit::NetworkCache::makeSubresourceInfoVector):
2545
2546         Allocated initial capacity and use uncheckedAppend.
2547
2548 2017-01-23  Commit Queue  <commit-queue@webkit.org>
2549
2550         Unreviewed, rolling out r211062.
2551         https://bugs.webkit.org/show_bug.cgi?id=167354
2552
2553         broke API tests (Requested by alexchristensen on #webkit).
2554
2555         Reverted changeset:
2556
2557         "Pass down website autoplay policies to media elements"
2558         https://bugs.webkit.org/show_bug.cgi?id=167132
2559         http://trac.webkit.org/changeset/211062
2560
2561 2017-01-23  Antti Koivisto  <antti@apple.com>
2562
2563         Maintain ordering when doing speculative loads
2564         https://bugs.webkit.org/show_bug.cgi?id=167324
2565
2566         Reviewed by Chris Dumez.
2567
2568         We currently randomize the ordering of speculative loads because they are serialized as a hash map.
2569         It would be better to load in the same order as the requests were originally issued as that is
2570         likely to match the order the document needs them.
2571
2572         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
2573         (WebKit::NetworkCache::SpeculativeLoadManager::startSpeculativeRevalidation):
2574         * NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp:
2575         (WebKit::NetworkCache::SubresourceInfo::encode):
2576         (WebKit::NetworkCache::SubresourceInfo::decode):
2577
2578             Include key into SubresourceInfo.
2579
2580         (WebKit::NetworkCache::makeSubresourcesVector):
2581
2582             Deduplicate the entries.
2583
2584         (WebKit::NetworkCache::SubresourcesEntry::SubresourcesEntry):
2585         (WebKit::NetworkCache::SubresourcesEntry::updateSubresourceLoads):
2586         * NetworkProcess/cache/NetworkCacheSubresourcesEntry.h:
2587         (WebKit::NetworkCache::SubresourceInfo::SubresourceInfo):
2588         (WebKit::NetworkCache::SubresourceInfo::key):
2589         (WebKit::NetworkCache::SubresourceInfo::setTransient):
2590         (WebKit::NetworkCache::SubresourcesEntry::subresources):
2591
2592             Keep the resources in a Vector instead of a HashMap to maintain order.
2593
2594 2017-01-23  Matt Rajca  <mrajca@apple.com>
2595
2596         Pass down website autoplay policies to media elements
2597         https://bugs.webkit.org/show_bug.cgi?id=167132
2598
2599         Reviewed by Alex Christensen.
2600
2601         The playbackRequiresUserGesture APIs are already covered by tests. This patch adds API tests
2602         for autoplay website policies.
2603
2604         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2605         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
2606
2607 2017-01-23  Joseph Pecoraro  <pecoraro@apple.com>
2608
2609         Web Inspector: Asserts seen opening and closing Remote Web Inspector windows
2610         https://bugs.webkit.org/show_bug.cgi?id=167316
2611         <rdar://problem/28891161>
2612
2613         Reviewed by Alexey Proskuryakov.
2614
2615         * UIProcess/RemoteWebInspectorProxy.cpp:
2616         (WebKit::RemoteWebInspectorProxy::createFrontendPageAndWindow):
2617         Assume read access, like the local web inspector, to Web Inspector resources.
2618
2619         * WebProcess/WebPage/RemoteWebInspectorUI.cpp:
2620         (WebKit::RemoteWebInspectorUI::closeWindow):
2621         Clear ourselves as the inspector frontend client when closing.
2622
2623 2017-01-20  Anders Carlsson  <andersca@apple.com>
2624
2625         When Safari reloads pages with Flash objects after Flash is installed, placeholders don't paint (but do work!)
2626         https://bugs.webkit.org/show_bug.cgi?id=167268
2627         rdar://problem/29857388
2628
2629         Reviewed by Sam Weinig.
2630
2631         * WebProcess/Plugins/WebPluginInfoProvider.h:
2632         Make refreshPlugins() private.
2633
2634         * WebProcess/WebProcess.cpp:
2635         (WebKit::WebProcess::refreshPlugins):
2636         Call the newly added PluginInfoProvider::refresh().
2637
2638 2017-01-23  Antti Koivisto  <antti@apple.com>
2639
2640         Use priorities in speculative revalidation
2641         https://bugs.webkit.org/show_bug.cgi?id=167314
2642
2643         Reviewed by Chris Dumez.
2644
2645         We currently do all speculative cache operations with 'Medium' priority
2646         and network operations with 'Low'. We should use the actual request priorities instead.
2647
2648         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
2649         (WebKit::NetworkCache::constructRevalidationRequest):
2650
2651             Use priority when constructing validation request.
2652
2653         (WebKit::NetworkCache::SpeculativeLoadManager::retrieveEntryFromStorage):
2654
2655             Use priority when retrieving from cache.
2656
2657         (WebKit::NetworkCache::SpeculativeLoadManager::preloadEntry):
2658         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.h:
2659         * NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp:
2660         (WebKit::NetworkCache::SubresourceInfo::encode):
2661         (WebKit::NetworkCache::SubresourceInfo::decode):
2662
2663             Save and restore the priority.
2664
2665         * NetworkProcess/cache/NetworkCacheSubresourcesEntry.h:
2666         (WebKit::NetworkCache::SubresourceInfo::SubresourceInfo):
2667         (WebKit::NetworkCache::SubresourceInfo::priority):
2668
2669 2017-01-23  Jer Noble  <jer.noble@apple.com>
2670
2671         Video details does not apear and missing scrubber in Control Center
2672         https://bugs.webkit.org/show_bug.cgi?id=167233
2673
2674         Reviewed by Alex Christensen.
2675
2676         Make requestActiveNowPlayingSessionInfo() and handleActiveNowPlayingSessionInfoResponse()
2677         work in PLATFORM(IOS).
2678
2679         * UIProcess/API/Cocoa/WKWebView.mm:
2680         (-[WKWebView _requestActiveNowPlayingSessionInfo]):
2681         (-[WKWebView _handleActiveNowPlayingSessionInfoResponse:title:duration:elapsedTime:]):
2682         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2683         * UIProcess/PageClient.h:
2684         * UIProcess/WebPageProxy.cpp:
2685         (WebKit::WebPageProxy::requestActiveNowPlayingSessionInfo):
2686         (WebKit::WebPageProxy::handleActiveNowPlayingSessionInfoResponse):
2687         * UIProcess/WebPageProxy.h:
2688         * UIProcess/WebPageProxy.messages.in:
2689         * UIProcess/ios/PageClientImplIOS.h:
2690         * UIProcess/ios/PageClientImplIOS.mm:
2691         (WebKit::PageClientImpl::handleActiveNowPlayingSessionInfoResponse):
2692         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
2693         (WebKit::WebPage::requestActiveNowPlayingSessionInfo):
2694         * WebProcess/WebPage/WebPage.h:
2695         * WebProcess/WebPage/WebPage.messages.in:
2696         * WebProcess/WebPage/mac/WebPageMac.mm:
2697         (WebKit::WebPage::requestActiveNowPlayingSessionInfo): Deleted.
2698
2699 2017-01-23  Chris Dumez  <cdumez@apple.com>
2700
2701         REGRESSION (r211033): ASSERTION FAILED: m_ptr in com.apple.WebCore: WTF::RefPtr<WebCore::Element>::operator* const + 70
2702         https://bugs.webkit.org/show_bug.cgi?id=167308
2703         <rdar://problem/30144964>
2704
2705         Unreviewed, do a partial revert of r211033 to fix assertion.
2706
2707         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2708         (WebKit::WebChromeClient::exitFullScreenForElement):
2709         * WebProcess/WebCoreSupport/WebChromeClient.h:
2710
2711 2017-01-20  Gustavo Noronha Silva  <gustavo.noronha@collabora.co.uk>
2712
2713         urlParserEnabled parameter is only encoded for COCOA ports
2714         https://bugs.webkit.org/show_bug.cgi?id=167238
2715
2716         Reviewed by Alex Christensen.
2717
2718         This leads to URLParser being enabled on the UI process, since it is
2719         the default, but disabled on the WebProcess, which is the default for
2720         WebProcessCreationParameters, casuing asserts like on tests such as these
2721         due to differences in parsing:
2722
2723         - fast/loader/redirect-to-invalid-url-using-javascript-calls-policy-delegate.html
2724         - fast/loader/window-open-to-invalid-url-calls-policy-delegate.html
2725         - http/tests/inspector/network/copy-as-curl.html
2726
2727         * Shared/WebProcessCreationParameters.cpp:
2728         (WebKit::WebProcessCreationParameters::encode): encode urlParserEnabled
2729         (WebKit::WebProcessCreationParameters::decode): decode urlParserEnabled
2730
2731 2017-01-20  Darin Adler  <darin@apple.com>
2732
2733         Remove PassRefPtr from "page" directory of WebCore, also deploy references
2734         https://bugs.webkit.org/show_bug.cgi?id=167224
2735
2736         Reviewed by Chris Dumez.
2737
2738         * UIProcess/Scrolling/RemoteScrollingTree.cpp:
2739         (WebKit::RemoteScrollingTree::createScrollingTreeNode): Return a Ref
2740         instead of PassRefPtr.
2741         * UIProcess/Scrolling/RemoteScrollingTree.h: Updated for the above.
2742
2743         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
2744         (WKBundlePageInstallPageOverlay): Pass a reference.
2745         (WKBundlePageUninstallPageOverlay): Ditto.
2746         (WKBundlePageInstallPageOverlayWithAnimation): Ditto.
2747         (WKBundlePageUninstallPageOverlayWithAnimation): Ditto.
2748         * WebProcess/Plugins/PDF/DeprecatedPDFPlugin.mm:
2749         (WebKit::PDFPlugin::jsPDFDocPrint): Ditto.
2750         * WebProcess/Plugins/PluginView.cpp:
2751         (WebKit::PluginView::focusPluginElement): Ditto.
2752         (WebKit::PluginView::setStatusbarText): Ditto.
2753
2754         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2755         (WebKit::WebChromeClient::elementDidFocus): Updated for changes to ChromeClient.
2756         (WebKit::WebChromeClient::elementDidBlur): Ditto.
2757         (WebKit::WebChromeClient::makeFirstResponder): Ditto.
2758         (WebKit::WebChromeClient::createWindow): Ditto.
2759         (WebKit::WebChromeClient::runBeforeUnloadConfirmPanel): Ditto.
2760         (WebKit::WebChromeClient::runJavaScriptAlert): Ditto.
2761         (WebKit::WebChromeClient::runJavaScriptConfirm): Ditto.
2762         (WebKit::WebChromeClient::runJavaScriptPrompt): Ditto.
2763         (WebKit::WebChromeClient::contentsSizeChanged): Ditto.
2764         (WebKit::WebChromeClient::unavailablePluginButtonClicked): Ditto.
2765         (WebKit::WebChromeClient::print): Ditto.
2766         (WebKit::WebChromeClient::exceededDatabaseQuota): Ditto.
2767         (WebKit::WebChromeClient::reachedApplicationCacheOriginQuota): Ditto.
2768         (WebKit::WebChromeClient::createColorChooser): Ditto.
2769         (WebKit::WebChromeClient::createPopupMenu): Ditto.
2770         (WebKit::WebChromeClient::createSearchPopupMenu): Ditto.
2771         (WebKit::WebChromeClient::attachRootGraphicsLayer): Ditto.
2772         (WebKit::WebChromeClient::attachViewOverlayGraphicsLayer): Ditto.
2773         (WebKit::WebChromeClient::createScrollingCoordinator): Ditto.
2774         (WebKit::WebChromeClient::supportsFullScreenForElement): Ditto.
2775         (WebKit::WebChromeClient::enterFullScreenForElement): Ditto.
2776         (WebKit::WebChromeClient::exitFullScreenForElement): Ditto.
2777         (WebKit::WebChromeClient::didAddHeaderLayer): Ditto.
2778         (WebKit::WebChromeClient::didAddFooterLayer): Ditto.
2779         (WebKit::WebChromeClient::shouldUseTiledBackingForFrameView): Ditto.
2780         * WebProcess/WebCoreSupport/WebChromeClient.h: Ditto.
2781         * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
2782         (WebKit::WebChromeClient::elementDidRefocus): Ditto.
2783         (WebKit::WebChromeClient::didReceiveMobileDocType): Ditto.
2784         (WebKit::WebChromeClient::observedContentChange): Ditto.
2785         (WebKit::WebChromeClient::clearContentChangeObservers): Ditto.
2786         (WebKit::WebChromeClient::notifyRevealedSelectionByScrollingFrame): Ditto.
2787
2788         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2789         (WebKit::WebFrameLoaderClient::dispatchCreatePage): Pass reference.
2790         * WebProcess/WebCoreSupport/WebInspectorClient.cpp:
2791         (WebKit::WebInspectorClient::~WebInspectorClient): Ditto.
2792         (WebKit::WebInspectorClient::hideHighlight): Ditto.
2793         (WebKit::WebInspectorClient::showPaintRect): Ditto.
2794         * WebProcess/WebPage/FindController.cpp:
2795         (WebKit::FindController::updateFindUIAfterPageScroll): Ditto.
2796         (WebKit::FindController::hideFindUI): Ditto.
2797
2798         * WebProcess/WebPage/WebFrame.cpp:
2799         (WebKit::WebFrame::createWithCoreMainFrame): Return Ref instead of
2800         PassRefPtr.
2801         (WebKit::WebFrame::createSubframe): Ditto.
2802         (WebKit::WebFrame::create): Ditto.
2803         * WebProcess/WebPage/WebFrame.h: Updated for the above.
2804
2805         * WebProcess/WebPage/WebInspector.cpp:
2806         (WebKit::WebInspector::openInNewTab): Pass reference.
2807
2808         * WebProcess/WebPage/ios/FindControllerIOS.mm:
2809         (WebKit::FindController::updateFindIndicator): Use reference.
2810         (WebKit::FindController::hideFindIndicator): Ditto.
2811
2812 2017-01-21  Carlos Garcia Campos  <cgarcia@igalia.com>
2813
2814         Unreviewed, rolling out r211012.
2815
2816         It caused a lot of crashes in the network process
2817
2818         Reverted changeset:
2819
2820         "[SOUP] Custom protocols don't work in private browsing mode"
2821         https://bugs.webkit.org/show_bug.cgi?id=167236
2822         http://trac.webkit.org/changeset/211012
2823
2824 2017-01-20  Joseph Pecoraro  <pecoraro@apple.com>
2825
2826         Remove never changing IndexedDB RuntimeEnabledFeature
2827         https://bugs.webkit.org/show_bug.cgi?id=167278
2828
2829         Reviewed by Darin Adler.
2830
2831         * WebProcess/WebProcess.cpp:
2832         (WebKit::m_resourceLoadStatisticsStorage):
2833
2834 2017-01-20  Carlos Garcia Campos  <cgarcia@igalia.com>
2835
2836         [SOUP] Custom protocols don't work in private browsing mode
2837         https://bugs.webkit.org/show_bug.cgi?id=167236
2838
2839         Reviewed by Sergio Villar Senin.
2840
2841         We only register them in the default session.
2842
2843         * NetworkProcess/CustomProtocols/soup/CustomProtocolManagerSoup.cpp:
2844         (WebKit::CustomProtocolManager::registerProtocolClass): Set the WEBKIT_TYPE_SOUP_REQUEST_GENERIC as type for
2845         custom protocols, and setup custom protocols in all existing sessions.
2846         (WebKit::CustomProtocolManager::registerScheme): Use g_type_class_peek instead of g_type_class_ref since we know
2847         the class was already created in registerProtocolClass().
2848
2849 2017-01-20  Brady Eidson  <beidson@apple.com>
2850
2851         Require a button press on a gamepad for them to be exposed to the DOM.
2852         <rdar://problem/28620919> and https://bugs.webkit.org/show_bug.cgi?id=167272
2853
2854         Reviewed by Alex Christensen.
2855
2856         * UIProcess/Gamepad/UIGamepadProvider.cpp:
2857         (WebKit::UIGamepadProvider::gamepadSyncTimerFired):
2858         (WebKit::UIGamepadProvider::platformGamepadInputActivity):
2859         * UIProcess/Gamepad/UIGamepadProvider.h:
2860
2861         * UIProcess/WebPageProxy.cpp:
2862         (WebKit::WebPageProxy::gamepadActivity):
2863         * UIProcess/WebPageProxy.h:
2864
2865         * WebProcess/Gamepad/WebGamepadProvider.cpp:
2866         (WebKit::WebGamepadProvider::gamepadActivity):
2867         * WebProcess/Gamepad/WebGamepadProvider.h:
2868
2869         * WebProcess/WebPage/WebPage.cpp:
2870         (WebKit::WebPage::gamepadActivity):
2871         * WebProcess/WebPage/WebPage.h:
2872         * WebProcess/WebPage/WebPage.messages.in:
2873
2874 2017-01-20  Joseph Pecoraro  <pecoraro@apple.com>
2875
2876         Cleanup RuntimeEnabledFeatures
2877         https://bugs.webkit.org/show_bug.cgi?id=167228
2878
2879         Reviewed by Simon Fraser.
2880
2881         * WebProcess/WebProcess.cpp:
2882         (WebKit::m_resourceLoadStatisticsStorage):
2883
2884 2017-01-20  Joseph Pecoraro  <pecoraro@apple.com>
2885
2886         Remove outdated ENABLE(CSP_NEXT) build flag
2887         https://bugs.webkit.org/show_bug.cgi?id=167252
2888
2889         Reviewed by Brent Fulgham.
2890
2891         * Configurations/FeatureDefines.xcconfig:
2892
2893 2017-01-20  Alex Christensen  <achristensen@webkit.org>
2894
2895         Fix Mac CMake build.
2896
2897         * CMakeLists.txt:
2898         * PlatformMac.cmake:
2899
2900 2017-01-20  Antoine Quint  <graouts@apple.com>
2901
2902         Web Animations should be off by default and enabled as an experimental feature
2903         https://bugs.webkit.org/show_bug.cgi?id=167115
2904         <rdar://problem/30048963>
2905
2906         Reviewed by Joseph Pecoraro.
2907
2908         Promote, or relegate depending on how you see things, the Web Animations preference
2909         to an experimental feature.
2910
2911         * Shared/WebPreferencesDefinitions.h:
2912
2913 2017-01-20  Antoine Quint  <graouts@apple.com>
2914
2915         [Modern Media Controls] Turn modern media controls on by default
2916         https://bugs.webkit.org/show_bug.cgi?id=165668
2917
2918         Reviewed by Dean Jackson.
2919
2920         Use DEFAULT_EXPERIMENTAL_FEATURES_ENABLED as the default value for modern media controls, which is true.
2921
2922         * Shared/WebPreferencesDefinitions.h:
2923
2924 2017-01-20  Carlos Garcia Campos  <cgarcia@igalia.com>
2925
2926         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.15.3 release.
2927
2928         * gtk/NEWS: Add release notes for 2.15.3.
2929
2930 2017-01-19  Carlos Garcia Campos  <cgarcia@igalia.com>
2931
2932         [Threaded Compositor] Initialize the threaded compositor with the current size
2933         https://bugs.webkit.org/show_bug.cgi?id=167196
2934
2935         Reviewed by Žan Doberšek.
2936
2937         We are always creating the threaded compositor with an empty size and then a sizeDidChange always happen when
2938         the backing store state changes. This is always happening because the threaded compositor is created before the
2939         first backing store state, but if we wanted to create it later, for example to enter/leave AC mode on demand,
2940         the threaded compositor will not have the viewport size unless the window is resized, or sizeDidChange is called
2941         manually when entering AC mode. Creating the threaded compositor is sync and changing the size too, so it's
2942         better to do both things at the same time using the same sync operation.
2943
2944         * Shared/CoordinatedGraphics/SimpleViewportController.cpp:
2945         (WebKit::SimpleViewportController::SimpleViewportController): Pass an initial size to the constructor.
2946         * Shared/CoordinatedGraphics/SimpleViewportController.h:
2947         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
2948         (WebKit::ThreadedCompositor::create): Add viewportSize and scaleFactor construction parameters,
2949         (WebKit::ThreadedCompositor::ThreadedCompositor): Ditto. Also mark as needs resize if the given size is not empty.
2950         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
2951         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp:
2952         (WebKit::ThreadedCoordinatedLayerTreeHost::ThreadedCoordinatedLayerTreeHost): Initialize the threaded compositor
2953         with an initial viewport size and scale factor.
2954
2955 2017-01-19  Chris Dumez  <cdumez@apple.com>
2956
2957         iterable<> should be enabled on WK1
2958         https://bugs.webkit.org/show_bug.cgi?id=167221
2959         <rdar://problem/30108531>
2960
2961         Reviewed by Youenn Fablet.
2962
2963         * Shared/WebPreferencesDefinitions.h:
2964         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2965         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
2966         * WebProcess/WebPage/WebPage.cpp:
2967         (WebKit::WebPage::updatePreferences):
2968
2969 2017-01-19  Alex Christensen  <achristensen@webkit.org>
2970
2971         Construct URLSearchParams from array or object
2972         https://bugs.webkit.org/show_bug.cgi?id=166973
2973
2974         Reviewed by Sam Weinig.
2975
2976         * NetworkProcess/capture/NetworkCaptureManager.cpp:
2977         (WebKit::NetworkCapture::Manager::fuzzyMatchURLs):
2978         Change std::pair's first/second to WTF::KeyValuePair's key/value.
2979
2980 2017-01-19  Andy Estes  <aestes@apple.com>
2981
2982         [iOS] Move the PDF password view into its own class for possible reuse
2983         https://bugs.webkit.org/show_bug.cgi?id=167192
2984
2985         Reviewed by Tim Horton.
2986
2987         * UIProcess/ios/WKPDFView.h: Stopped conforming to UIDocumentPasswordViewDelegate.
2988         * UIProcess/ios/WKPDFView.mm: Changed _passwordView to a WKPasswordView.
2989         (-[WKPDFView _passwordViewFrame]): Returns the frame to set on _passwordView.
2990         (-[WKPDFView _updatePasswordEntryField]): Removed.
2991         (-[WKPDFView _showPasswordEntryField]): Created a WKPasswordView, set a lambda on its
2992         userDidEnterPassword property to do the work previously done in -_tryToUnlockWithPassword:,
2993         and showed the password view.
2994         (-[WKPDFView _keyboardDidShow:]): Moved to WKPasswordView.
2995         (-[WKPDFView _hidePasswordEntryField]): Deleted. The userDidEnterPassword lambda now calls
2996         -[WKPasswordView hide] when the document is unlocked.
2997         (-[WKPDFView userDidEnterPassword:forPasswordView:]): Moved to WKPasswordView.
2998         (-[WKPDFView didBeginEditingPassword:inView:]): Ditto.
2999         (-[WKPDFView didEndEditingPassword:inView:]): Ditto.
3000         (-[WKPDFView _didFailToUnlock]): Ditto.
3001         (-[WKPDFView _tryToUnlockWithPassword:]): Moved into _passwordView's userDidEnterPassword lambda.
3002         * UIProcess/ios/WKPasswordView.h: Added.
3003         * UIProcess/ios/WKPasswordView.mm: Added.
3004         (-[WKPasswordView initWithFrame:documentName:]): Created a UIDocumentPasswordView with
3005         documentName, set self as its passwordDelegate, and added it as a subview.
3006         (-[WKPasswordView layoutSubviews]): Updated _scrollView's contentSize if we are displaying
3007         the view.
3008         (-[WKPasswordView displayInContentView:]): Saved the scroll view's previous minimum/maximum
3009         zoom scale and color, set new values for minimum/maximum zoom scale and color, and added
3010         self as a subview of contentView.
3011         (-[WKPasswordView hide]): Restored the saved minimum/maximum zoom scale and color on the
3012         scroll view and removed self from its superview.
3013         (-[WKPasswordView displayPasswordFailureAlert]): Displayed the alert previously shown by
3014         -[WKPDFView _didFailToUnlock].
3015         (-[WKPasswordView _keyboardDidShow:]): Moved from WKPDFView.
3016         (-[WKPasswordView userDidEnterPassword:forPasswordView:]): Retained self and called the
3017         _userDidEnterPassword block with the password.
3018         (-[WKPasswordView didBeginEditingPassword:inView:]): Moved from WKPDFView.
3019         (-[WKPasswordView didEndEditingPassword:inView:]): Ditto.
3020         * WebKit2.xcodeproj/project.pbxproj:
3021
3022 2017-01-19  Chris Dumez  <cdumez@apple.com>
3023
3024         Make sure HTML validation bubble gets dismissed when its associated element's frame gets detached
3025         https://bugs.webkit.org/show_bug.cgi?id=167215
3026         <rdar://problem/29885052>
3027
3028         Reviewed by Andreas Kling.
3029
3030         Make sure HTML validation bubble gets dismissed when its associated
3031         element's frame gets detached and that we do not crash.
3032
3033         * WebProcess/WebCoreSupport/WebValidationMessageClient.cpp:
3034         (WebKit::WebValidationMessageClient::documentDetached):
3035         * WebProcess/WebCoreSupport/WebValidationMessageClient.h:
3036
3037 2017-01-19  Chris Dumez  <cdumez@apple.com>
3038
3039         Implement per activity state CPU usage reporting using diagnostic logging
3040         https://bugs.webkit.org/show_bug.cgi?id=167163
3041         <rdar://problem/30058349>
3042
3043         Reviewed by Andreas Kling.
3044
3045         Implement per activity state CPU usage reporting using diagnostic logging.
3046
3047         * Platform/Logging.h:
3048         * UIProcess/PerActivityStateCPUUsageSampler.cpp: Added.
3049         (WebKit::PerActivityStateCPUUsageSampler::PerActivityStateCPUUsageSampler):
3050         (WebKit::PerActivityStateCPUUsageSampler::~PerActivityStateCPUUsageSampler):
3051         (WebKit::PerActivityStateCPUUsageSampler::reportWebContentCPUTime):
3052         (WebKit::loggingKeyForActivityState):
3053         (WebKit::loggingKeyForCPUUsage):
3054         (WebKit::PerActivityStateCPUUsageSampler::loggingTimerFired):
3055         (WebKit::PerActivityStateCPUUsageSampler::pageForLogging):
3056         * UIProcess/PerActivityStateCPUUsageSampler.h: Copied from Source/WebCore/page/ActivityState.h.
3057         * UIProcess/WebProcessPool.cpp:
3058         (WebKit::WebProcessPool::WebProcessPool):
3059         (WebKit::WebProcessPool::reportWebContentCPUTime):
3060         * UIProcess/WebProcessPool.h:
3061         * UIProcess/WebProcessPool.messages.in:
3062         * WebKit2.xcodeproj/project.pbxproj:
3063         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
3064         (WebKit::WebChromeClient::reportProcessCPUTime):
3065         * WebProcess/WebCoreSupport/WebChromeClient.h:
3066
3067 2017-01-19  Dan Bernstein  <mitz@apple.com>
3068
3069         Build fix.
3070
3071         Rubber-stamped by Anders Carlsson.
3072
3073         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
3074         (WebKit::toPKPaymentAuthorizationStatus): Suppressed deprecation warnings.
3075
3076 2017-01-19  Myles C. Maxfield  <mmaxfield@apple.com>
3077
3078         [Cocoa] Variation fonts are erroneously disabled on iOS
3079         https://bugs.webkit.org/show_bug.cgi?id=167172
3080
3081         Reviewed by Simon Fraser.
3082
3083         OpenSource builders don't seem to understand sdk=embedded*.
3084
3085         * Configurations/FeatureDefines.xcconfig:
3086
3087 2017-01-18  Anders Carlsson  <andersca@apple.com>
3088
3089         Install WebKit.apinotes with the public headers of WebKit framework
3090         https://bugs.webkit.org/show_bug.cgi?id=167182
3091         rdar://problem/29008989
3092
3093         Reviewed by Sam Weinig.
3094
3095         * Shared/API/Cocoa/WebKit.apinotes: Added.
3096         * WebKit2.xcodeproj/project.pbxproj:
3097
3098 2017-01-19  Brian Burg  <bburg@apple.com>
3099
3100         Web Inspector: move Mac-specific automation commands to a separate implementation file
3101         https://bugs.webkit.org/show_bug.cgi?id=163297
3102         <rdar://problem/28718990>
3103
3104         Reviewed by Timothy Hatcher.
3105
3106         Not all Automation commands are available on all platforms. Start splitting out
3107         command declarations and implementations based on the target platform.
3108
3109         * DerivedSources.make:
3110         Set an appropriate --platform so the correct backend interface is generated.
3111
3112         * UIProcess/Automation/Automation.json:
3113         Guard commands that should not be available on iOS:
3114             - resizeWindowOfBrowsingContext
3115             - moveWindowOfBrowsingContext
3116             - inspectBrowsingContext
3117
3118         * UIProcess/Automation/WebAutomationSession.cpp:
3119         (WebKit::WebAutomationSession::platformSimulateKeySequence): Deleted.
3120         - Move shared convenience macros to header file.
3121         - Move out Cocoa-only or Mac-only command implementations.
3122
3123         * UIProcess/Automation/WebAutomationSession.h:
3124         Rearrange some declarations and switch from USE(APPKIT) to PLATFORM(MAC).
3125
3126         * UIProcess/Automation/WebAutomationSessionMacros.h: Added.
3127
3128         * UIProcess/Automation/cocoa/WebAutomationSessionCocoa.mm: Added.
3129         (WebKit::WebAutomationSession::platformGetBase64EncodedPNGData):
3130         Moved from WebAutomationSessionCocoa.mm. Add iOS-specific header includes.
3131
3132         * UIProcess/Automation/mac/WebAutomationSessionMac.mm: Renamed from Source/WebKit2/UIProcess/Cocoa/WebAutomationSessionCocoa.mm.
3133         (WebKit::WebAutomationSession::resizeWindowOfBrowsingContext):
3134         (WebKit::WebAutomationSession::moveWindowOfBrowsingContext):
3135         (WebKit::WebAutomationSession::inspectBrowsingContext):
3136         Move macOS platform command implementations to here. If other desktop ports want
3137         to use these commands, we can move them somewhere else later.
3138
3139         (WebKit::WebAutomationSession::sendSynthesizedEventsToPage):
3140         (WebKit::WebAutomationSession::markEventAsSynthesizedForAutomation):
3141         (WebKit::WebAutomationSession::wasEventSynthesizedForAutomation):
3142         Move out AppKit-specific event simulation code to here.
3143
3144         (WebKit::WebAutomationSession::platformSimulateMouseInteraction):
3145         (WebKit::WebAutomationSession::platformSimulateKeyStroke):
3146         (WebKit::WebAutomationSession::platformSimulateKeySequence):
3147         Move out Mac platformFoo implementations to here.
3148
3149         * WebKit2.xcodeproj/project.pbxproj:
3150         - Added UIProcess/Automation/{mac,cocoa} groups.
3151         - Add new platform-specific implementation files.
3152
3153 2017-01-19  Carlos Garcia Campos  <cgarcia@igalia.com>
3154
3155         [GTK] Provide API to set proxy settings
3156         https://bugs.webkit.org/show_bug.cgi?id=128674
3157
3158         Reviewed by Michael Catanzaro.
3159
3160         Add new method webkit_web_context_set_network_proxy_settings() that allows to set proxy settings in a
3161         WebKitWebContext. It receives an enum WebKitNetworkProxyMode with modes Default, NoProxy and Custom, and an
3162         optional WebKitNetworkProxySettings that is used when mode is Custom. WebKitNetworkProxySettings is a simple
3163         boxed type that user can create to set proxy settins with a similar API to GSimpleProxyResolver.
3164
3165         * NetworkProcess/NetworkProcess.h:
3166         * NetworkProcess/NetworkProcess.messages.in: Add SetNetworkProxySettings message.
3167         * NetworkProcess/NetworkProcessCreationParameters.cpp:
3168         (WebKit::NetworkProcessCreationParameters::encode): Encode proxy settings.
3169         (WebKit::NetworkProcessCreationParameters::decode): Decode proxy settings.
3170         * NetworkProcess/NetworkProcessCreationParameters.h:
3171         * NetworkProcess/efl/NetworkProcessMainEfl.cpp: Use SoupNetworkSession::setProxySettingsFromEnvironment().
3172         * NetworkProcess/soup/NetworkProcessSoup.cpp:
3173         (WebKit::NetworkProcess::platformInitializeNetworkProcess): Set proxy settings if provided by the user.
3174         (WebKit::NetworkProcess::setNetworkProxySettings): Set global proxy settings and setup the proxy for all
3175         existing contexts.
3176         * PlatformGTK.cmake: Add new files to compilation.
3177         * Shared/WebCoreArgumentCoders.h:
3178         * Shared/WebProcessCreationParameters.cpp:
3179         (WebKit::WebProcessCreationParameters::encode): Encode proxy settings.
3180         (WebKit::WebProcessCreationParameters::decode): Decode proxy settings.
3181         * Shared/WebProcessCreationParameters.h:
3182         * Shared/soup/WebCoreArgumentCodersSoup.cpp:
3183         (IPC::ArgumentCoder<SoupNetworkProxySettings>::encode): Add encoder implementation for SoupNetworkProxySettings.
3184         (IPC::ArgumentCoder<SoupNetworkProxySettings>::decode): add decoder implementation for SoupNetworkProxySettings.
3185         * UIProcess/API/gtk/WebKitNetworkProxySettings.cpp: Added.
3186         (_WebKitNetworkProxySettings::_WebKitNetworkProxySettings):
3187         (webkitNetworkProxySettingsGetNetworkProxySettings):
3188         (webkit_network_proxy_settings_new): Create a new WebKitNetworkProxySettings with optional default proxy uri and
3189         ignore hosts list.
3190         (webkit_network_proxy_settings_copy):
3191         (webkit_network_proxy_settings_free):
3192         (webkit_network_proxy_settings_add_proxy): Add a proxy uri for a given uri scheme.
3193         * UIProcess/API/gtk/WebKitNetworkProxySettings.h: Added.
3194         * UIProcess/API/gtk/WebKitNetworkProxySettingsPrivate.h: Added.
3195         * UIProcess/API/gtk/WebKitWebContext.cpp:
3196         (webkit_web_context_set_network_proxy_settings): Set proxy settings.
3197         * UIProcess/API/gtk/WebKitWebContext.h:
3198         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt: Add new symbols to the documentation.
3199         * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml: Add new section for WebKitNetworkProxySettings.
3200         * UIProcess/API/gtk/webkit2.h: Include WebKitNetworkProxySettings.h.
3201         * UIProcess/WebProcessPool.h: Add m_networkProxySettings and a setter for soup.
3202         * UIProcess/efl/WebProcessPoolEfl.cpp:
3203         (WebKit::WebProcessPool::platformInitializeWebProcess): Set m_networkProxySettings to parameters.
3204         * UIProcess/gtk/WebProcessPoolGtk.cpp:
3205         (WebKit::WebProcessPool::platformInitializeWebProcess): Ditto.
3206         * UIProcess/soup/WebProcessPoolSoup.cpp:
3207         (WebKit::WebProcessPool::platformInitializeNetworkProcess): Ditto.
3208         (WebKit::WebProcessPool::setNetworkProxySettings): Update m_networkProxySettings and notify all processes.
3209         * WebProcess/WebProcess.h:
3210         * WebProcess/WebProcess.messages.in: Add SetNetworkProxySettings message.
3211         * WebProcess/efl/WebProcessMainEfl.cpp: Use SoupNetworkSession::setProxySettingsFromEnvironment().
3212         * WebProcess/soup/WebProcessSoup.cpp:
3213         (WebKit::WebProcess::platformSetCacheModel): Remove comment that is no longer true.
3214         (WebKit::WebProcess::platformInitializeWebProcess): Set proxy settings if provided by the user.
3215         (WebKit::WebProcess::setNetworkProxySettings): Set global proxy settings and setup the proxy for all
3216         existing contexts.
3217
3218 2017-01-19  Carlos Garcia Campos  <cgarcia@igalia.com>
3219
3220         [GTK] Do not update the backing store state unnecessarily when page visibility changes
3221         https://bugs.webkit.org/show_bug.cgi?id=167195
3222
3223         Reviewed by Sergio Villar Senin.
3224
3225         I've noticed that we are receiving UpdateBackingStoreState messages in the web process even when size and scale
3226         factor didn't change. That's quite unfortunate because we do a lot of work unnecessarily and we tell the
3227         threaded compositor that the size changed. This is not only a problem because it's not true, but also because
3228         changing the size is a sync operation in the threaded compositor, so we block the compositing thread for
3229         nothing. This is happening because the WebPageProxy notifies the drawing area that the backing store is
3230         discardable when the page is not visible, and that always produces a new backing store state. In accelerating
3231         compositing mode we don't even have a backing store to discard, so we should check we have something to discard
3232         and also make sure we only generate a new backing store state if we really discarded the backing store.
3233
3234         * UIProcess/DrawingAreaProxyImpl.cpp:
3235         (WebKit::DrawingAreaProxyImpl::discardBackingStoreSoon):
3236         (WebKit::DrawingAreaProxyImpl::discardBackingStore):
3237
3238 2017-01-18  Said Abou-Hallawa  <sabouhallawa@apple.com>
3239
3240         [iOS][WK2] Remove the WebView private configuration contentUpdateFrequency
3241         https://bugs.webkit.org/show_bug.cgi?id=167188
3242
3243         Reviewed by Simon Fraser.
3244
3245         This patch reverts r209294. This configuration is not needed anymore.
3246         The CADisplayLink::preferredFramesPerSecond for WK2 will be set to the
3247         default value always.
3248
3249         * UIProcess/API/APIPageConfiguration.h:
3250         (API::PageConfiguration::setAlwaysRunsAtForegroundPriority):
3251         (API::PageConfiguration::contentUpdateFrequency): Deleted.
3252         (API::PageConfiguration::setContentUpdateFrequency): Deleted.
3253         (): Deleted.
3254         * UIProcess/API/Cocoa/WKWebView.mm:
3255         (-[WKWebView _initializeWithConfiguration:]):
3256         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
3257         (-[WKWebViewConfiguration init]):
3258         (-[WKWebViewConfiguration copyWithZone:]):
3259         (-[WKWebViewConfiguration _setAllowsInlineMediaPlaybackAfterFullscreen:]):
3260         (-[WKWebViewConfiguration _contentUpdateFrequency]): Deleted.
3261         (-[WKWebViewConfiguration _setContentUpdateFrequency:]): Deleted.
3262         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
3263         * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h:
3264         * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
3265         (-[WKOneShotDisplayLinkHandler initWithDrawingAreaProxy:]):
3266         (WebKit::RemoteLayerTreeDrawingAreaProxy::contentUpdateFrequency): Deleted.
3267
3268 2017-01-18  Ryan Haddad  <ryanhaddad@apple.com>
3269
3270         Unreviewed, rolling out r210848.
3271
3272         This change introduced media-related LayoutTest failures and
3273         crashes on macOS.
3274
3275         Reverted changeset:
3276
3277         "[Modern Media Controls] Turn modern media controls on by
3278         default"
3279         https://bugs.webkit.org/show_bug.cgi?id=165668
3280         http://trac.webkit.org/changeset/210848
3281
3282 2017-01-18  Anders Carlsson  <andersca@apple.com>
3283
3284         Add instrumentation for when we fail to receive a message
3285         https://bugs.webkit.org/show_bug.cgi?id=167179
3286
3287         Reviewed by Alexey Proskuryakov.
3288
3289         This will help us diagnose what the error from mach_msg is.
3290
3291         * Platform/IPC/mac/ConnectionMac.mm:
3292         (IPC::readFromMachPort):
3293
3294 2017-01-18  Alex Christensen  <achristensen@webkit.org>
3295
3296         Fix CFURLConnection build on Mac
3297         https://bugs.webkit.org/show_bug.cgi?id=167168
3298
3299         Reviewed by Andy Estes.
3300
3301         * NetworkProcess/Downloads/mac/DownloadMac.mm:
3302         (WebKit::Download::resume):
3303         (WebKit::Download::platformDidFinish):
3304         (WebKit::Download::platformCancelNetworkLoad):
3305         (WebKit::Download::startNetworkLoadWithHandle):
3306         (WebKit::Download::startNetworkLoad):
3307         (WebKit::Download::platformInvalidate):
3308         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
3309         (WebKit::NetworkDataTaskCocoa::allowsSpecificHTTPSCertificateForHost):
3310         (WebKit::serverTrustCredential):
3311         * Shared/Authentication/mac/AuthenticationManager.mac.mm:
3312         (WebKit::AuthenticationManager::tryUseCertificateInfoForChallenge):
3313         * config.h:
3314
3315 2017-01-18  Alex Christensen  <achristensen@webkit.org>
3316
3317         Modernize DelayedReply IPC code
3318         https://bugs.webkit.org/show_bug.cgi?id=167176
3319
3320         Reviewed by Brady Eidson.
3321
3322         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3323         (WebKit::NetworkConnectionToWebProcess::performSynchronousLoad):
3324         * NetworkProcess/NetworkConnectionToWebProcess.h:
3325         * Platform/IPC/HandleMessage.h:
3326         (IPC::callMemberFunctionImpl):
3327         (IPC::callMemberFunction):
3328         (IPC::handleMessageDelayed):
3329         * Scripts/webkit/messages.py:
3330         (message_to_struct_declaration):
3331         (generate_message_handler):
3332         * UIProcess/Databases/DatabaseProcessProxy.cpp:
3333         (WebKit::DatabaseProcessProxy::getDatabaseProcessConnection):
3334         * UIProcess/Databases/DatabaseProcessProxy.h:
3335         * UIProcess/Network/NetworkProcessProxy.cpp:
3336         (WebKit::NetworkProcessProxy::getNetworkProcessConnection):
3337         (WebKit::NetworkProcessProxy::networkProcessCrashedOrFailedToLaunch):
3338         * UIProcess/Network/NetworkProcessProxy.h:
3339         * UIProcess/Plugins/PluginProcessManager.cpp:
3340         (WebKit::PluginProcessManager::getPluginProcessConnection):
3341         * UIProcess/Plugins/PluginProcessManager.h:
3342         * UIProcess/Plugins/PluginProcessProxy.cpp:
3343         (WebKit::PluginProcessProxy::getPluginProcessConnection):
3344         * UIProcess/Plugins/PluginProcessProxy.h:
3345         * UIProcess/WebPageProxy.cpp:
3346         (WebKit::WebPageProxy::runJavaScriptAlert):
3347         (WebKit::WebPageProxy::runJavaScriptConfirm):
3348         * UIProcess/WebPageProxy.h:
3349         * UIProcess/WebProcessPool.cpp:
3350         (WebKit::WebProcessPool::getNetworkProcessConnection):
3351         (WebKit::WebProcessPool::getDatabaseProcessConnection):
3352         * UIProcess/WebProcessPool.h:
3353         * UIProcess/WebProcessProxy.cpp:
3354         (WebKit::WebProcessProxy::getPluginProcessConnection):
3355         (WebKit::WebProcessProxy::getNetworkProcessConnection):
3356         (WebKit::WebProcessProxy::getDatabaseProcessConnection):
3357         * UIProcess/WebProcessProxy.h:
3358
3359 2017-01-18  Alex Christensen  <achristensen@webkit.org>
3360
3361         Fix CMake build.
3362
3363         * PlatformMac.cmake:
3364
3365 2017-01-18  Megan Gardner  <megan_gardner@apple.com>
3366
3367         Ignore Connection Assertion if we are not using connection to send messages
3368         https://bugs.webkit.org/show_bug.cgi?id=167022
3369
3370         Reviewed by Darin Adler.
3371
3372         Ask the process about a particular connection rather that getting it and making the     
3373         comparison ourselves. 
3374
3375         * UIProcess/ChildProcessProxy.h:
3376         (WebKit::ChildProcessProxy::hasConnection):
3377         Check to see the the ProcessProxy has this particular connection. This get around the assert
3378         that we would run into when just requesting the connection directly.
3379         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
3380         (WebKit::WebPasteboardProxy::setPasteboardPathnamesForType):
3381         Use the new check instead of getting the raw connection.
3382
3383 2017-01-18  Andreas Kling  <akling@apple.com>
3384
3385         Document::securityOrigin() should return a reference.
3386         <https://webkit.org/b/167124>
3387
3388         Reviewed by Sam Weinig.
3389
3390         * UIProcess/Storage/StorageManager.cpp:
3391         (WebKit::StorageManager::createTransientLocalStorageMap):
3392         * WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp:
3393         (WebKit::GeolocationPermissionRequestManager::startRequestForGeolocation):
3394         * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp:
3395         (WKBundleFrameCopySecurityOrigin):
3396         * WebProcess/Plugins/PluginView.cpp:
3397         (WebKit::PluginView::storageBlockingStateChanged):
3398         (WebKit::PluginView::performFrameLoadURLRequest):
3399         (WebKit::PluginView::isPrivateBrowsingEnabled):
3400         * WebProcess/Plugins/WebPluginInfoProvider.cpp:
3401         (WebKit::WebPluginInfoProvider::getWebVisiblePluginInfo):
3402         * WebProcess/Storage/StorageAreaMap.cpp:
3403         (WebKit::StorageAreaMap::dispatchSessionStorageEvent):
3404         (WebKit::StorageAreaMap::dispatchLocalStorageEvent):
3405         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
3406         (WebKit::WebChromeClient::exceededDatabaseQuota):
3407         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3408         (WebKit::WebFrameLoaderClient::didRunInsecureContent):
3409         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
3410         * WebProcess/WebPage/WebFrame.cpp:
3411         (WebKit::WebFrame::allowsFollowingLink):
3412
3413 2017-01-18  Antoine Quint  <graouts@apple.com>
3414
3415         [Modern Media Controls] Turn modern media controls on by default
3416         https://bugs.webkit.org/show_bug.cgi?id=165668
3417
3418         Reviewed by Dean Jackson.
3419