b370db590401820c5d104fe2632d237ef53c8868
[WebKit-https.git] / Source / WebKit2 / ChangeLog
1 2016-08-12  Dan Bernstein  <mitz@apple.com>
2
3         [Cocoa] Instances of WKObject subclasses don’t work correctly with CFGetTypeID()
4         https://bugs.webkit.org/show_bug.cgi?id=160820
5         <rdar://problem/27825875>
6
7         Reviewed by Anders Carlsson.
8
9         * Shared/Cocoa/WKObject.mm:
10         (-[WKObject _cfTypeID]): Override this internal method and forward to the target object.
11
12 2016-08-12  Johan K. Jensen  <johan_jensen@apple.com>
13
14         Rename DocumentLoadTiming and ResourceLoadTiming
15         https://bugs.webkit.org/show_bug.cgi?id=160821
16
17         Reviewed by Alex Christensen.
18
19         Rename ResourceLoadTiming to NetworkLoadTiming.
20
21         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
22         (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]):
23
24 2016-08-12  Anders Carlsson  <andersca@apple.com>
25
26         message loading never finishes in Mail
27         https://bugs.webkit.org/show_bug.cgi?id=160806
28         rdar://problem/27624095
29
30         Reviewed by Dan Bernstein.
31
32         Add more checks for when a process goes away before we've established a proper connection to it.
33
34         * Platform/IPC/mac/ConnectionMac.mm:
35         (IPC::Connection::receiveSourceEventHandler):
36         Handle the MACH_NOTIFY_NO_SENDERS and MACH_NOTIFY_SEND_ONCE messages here. Also, once we receive a send
37         right from the other side, stop listening for the MACH_NOTIFY_NO_SENDERS notification.
38
39         * UIProcess/ChildProcessProxy.cpp:
40         (WebKit::ChildProcessProxy::didFinishLaunching):
41         Null check the connection identifier.
42
43         * UIProcess/Launcher/ProcessLauncher.cpp:
44         (WebKit::ProcessLauncher::ProcessLauncher):
45         (WebKit::processLauncherWorkQueue): Deleted.
46         Get rid of the process launcher queue - we're not doing any blocking work here.
47
48         * UIProcess/Launcher/ProcessLauncher.h:
49         Add a weak factory.
50
51         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
52         (WebKit::systemDirectoryPath):
53         Move this before launchProcess().
54
55         (WebKit::ProcessLauncher::launchProcess):
56         Merge createService and connectToService into launchProcess. Also make the following changes:
57         - Use mach_port_request_notification to get a notification for when our receive right loses all its senders.
58         This lets us listen for the other process going away before we have a send right for it.
59         - Use xpc_connection_set_event_handler to listen for errors, so we can detect the process going away before
60         we've sent a message to it.
61         
62         (WebKit::connectToService): Deleted.
63         (WebKit::createService): Deleted.
64
65         * UIProcess/Network/NetworkProcessProxy.cpp:
66         (WebKit::NetworkProcessProxy::didFinishLaunching):
67         If we failed to launch, call networkProcessCrashedOrFailedToLaunch so we'll unblock any waiting web processes.
68
69         * UIProcess/WebProcessProxy.cpp:
70         (WebKit::WebProcessProxy::didFinishLaunching):
71         Null check the connection and XPC connection before trying to get its pid.
72
73 2016-08-11  Brady Eidson  <beidson@apple.com>
74
75         [WK2] Don't monitor gamepads at all unless an interested WebPageProxy is in the active window.
76         https://bugs.webkit.org/show_bug.cgi?id=160760
77
78         Reviewed by Tim Horton.
79         
80         This patch makes it such that the UIProcess will only listen to the platform gamepad mechanism
81         if a WebPageProxy that is interested in gamepads is in the active window.
82
83         * UIProcess/Cocoa/WebViewImpl.mm:
84         (WebKit::WebViewImpl::windowDidBecomeKey):
85         (WebKit::WebViewImpl::windowDidResignKey):
86
87         * UIProcess/Gamepad/UIGamepadProvider.cpp:
88         (WebKit::UIGamepadProvider::UIGamepadProvider):
89         (WebKit::UIGamepadProvider::gamepadSyncTimerFired):
90         (WebKit::UIGamepadProvider::scheduleGamepadStateSync):
91         (WebKit::UIGamepadProvider::platformGamepadConnected):
92         (WebKit::UIGamepadProvider::platformGamepadDisconnected):
93         (WebKit::UIGamepadProvider::platformGamepadInputActivity):
94         (WebKit::UIGamepadProvider::processPoolStartedUsingGamepads):
95         (WebKit::UIGamepadProvider::processPoolStoppedUsingGamepads):
96         (WebKit::UIGamepadProvider::viewBecameActive):
97         (WebKit::UIGamepadProvider::viewBecameInactive):
98         (WebKit::UIGamepadProvider::scheduleDisableGamepadMonitoring):
99         (WebKit::UIGamepadProvider::disableMonitoringTimerFired):
100         (WebKit::UIGamepadProvider::startMonitoringGamepads):
101         (WebKit::UIGamepadProvider::stopMonitoringGamepads):
102         (WebKit::UIGamepadProvider::updateTimerFired): Deleted.
103         (WebKit::UIGamepadProvider::startOrStopSynchingGamepadState): Deleted.
104         * UIProcess/Gamepad/UIGamepadProvider.h:
105
106 2016-08-11  Brady Eidson  <beidson@apple.com>
107
108         Make Gamepads be a WK2 ExperimentalFeature.
109         https://bugs.webkit.org/show_bug.cgi?id=160788
110
111         Reviewed by Alex Christensen.
112
113         * Shared/WebPreferencesDefinitions.h:
114
115 2016-08-11  Alex Christensen  <achristensen@webkit.org>
116
117         Don't use a NetworkingContext when creating SocketStreamHandles
118         https://bugs.webkit.org/show_bug.cgi?id=160732
119
120         Reviewed by Brady Eidson.
121
122         * WebProcess/Network/WebSocketProvider.cpp:
123         (WebKit::WebSocketProvider::createSocketStreamHandle):
124         * WebProcess/Network/WebSocketProvider.h:
125
126 2016-08-11  Alex Christensen  <achristensen@webkit.org>
127
128         Use StringBuilder::appendLiteral when possible don't append result of makeString
129         https://bugs.webkit.org/show_bug.cgi?id=160772
130
131         Reviewed by Sam Weinig.
132
133         * Shared/Gamepad/GamepadData.cpp:
134         (WebKit::GamepadData::isNull):
135         (WebKit::GamepadData::loggingString):
136         * Shared/Gamepad/GamepadData.h:
137         * UIProcess/WebProcessPool.h:
138
139 2016-08-10  Alex Christensen  <achristensen@webkit.org>
140
141         Fix crash when changing cookie accept policy after r204327
142         https://bugs.webkit.org/show_bug.cgi?id=160758
143
144         Reviewed by Simon Fraser.
145
146         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
147         (WebKit::WebFrameNetworkingContext::setCookieAcceptPolicyForAllContexts):
148
149 2016-08-10  Simon Fraser  <simon.fraser@apple.com>
150
151         Sort the feature flags in the FEATURE_DEFINES lines
152         https://bugs.webkit.org/show_bug.cgi?id=160742
153
154         Reviewed by Anders Carlsson.
155
156         * Configurations/FeatureDefines.xcconfig:
157
158 2016-08-09  Alex Christensen  <achristensen@webkit.org>
159
160         Move NetworkStorageSession management to WebCore
161         https://bugs.webkit.org/show_bug.cgi?id=160173
162
163         Reviewed by Brady Eidson.
164
165         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
166         (WebKit::storageSession):
167         * NetworkProcess/NetworkProcess.cpp:
168         (WebKit::NetworkProcess::fetchWebsiteData):
169         (WebKit::NetworkProcess::deleteWebsiteData):
170         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
171         * NetworkProcess/NetworkSession.h:
172         (WebKit::NetworkSession::sessionID):
173         NetworkSessions no longer own NetworkStorageSessions, but they should still have the same lifetime.
174         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
175         (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
176         (WebKit::NetworkSession::setSourceApplicationAuditTokenData):
177         (WebKit::NetworkSession::create):
178         (WebKit::NetworkSession::defaultSession):
179         (WebKit::NetworkSession::NetworkSession):
180         (WebKit::NetworkSession::networkStorageSession):
181         (WebKit::NetworkSession::clearCredentials):
182         * NetworkProcess/mac/RemoteNetworkingContext.mm:
183         (WebKit::RemoteNetworkingContext::storageSession):
184         (WebKit::RemoteNetworkingContext::ensurePrivateBrowsingSession):
185         * Shared/SessionTracker.cpp:
186         (WebKit::SessionTracker::networkSession):
187         (WebKit::SessionTracker::setSession):
188         (WebKit::SessionTracker::destroySession):
189         (WebKit::SessionTracker::storageSession): Deleted.
190         (WebKit::staticStorageSessionMap): Deleted.
191         (WebKit::SessionTracker::sessionID): Deleted.
192         (WebKit::SessionTracker::forEachNetworkStorageSession): Deleted.
193         * Shared/SessionTracker.h:
194         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
195         (WebKit::WebPlatformStrategies::cookiesForDOM):
196         (WebKit::WebPlatformStrategies::setCookiesFromDOM):
197         (WebKit::WebPlatformStrategies::cookiesEnabled):
198         (WebKit::WebPlatformStrategies::cookieRequestHeaderFieldValue):
199         (WebKit::WebPlatformStrategies::getRawCookies):
200         (WebKit::WebPlatformStrategies::deleteCookie):
201         (WebKit::WebPlatformStrategies::addCookie):
202         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
203         (WebKit::WebFrameNetworkingContext::ensurePrivateBrowsingSession):
204         (WebKit::WebFrameNetworkingContext::setCookieAcceptPolicyForAllContexts):
205         (WebKit::WebFrameNetworkingContext::storageSession):
206         * WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp:
207         (WebKit::WebFrameNetworkingContext::ensurePrivateBrowsingSession):
208         (WebKit::WebFrameNetworkingContext::setCookieAcceptPolicyForAllContexts):
209         * WebProcess/WebPage/mac/WebPageMac.mm:
210         * WebProcess/WebProcess.cpp:
211
212 2016-08-09  Anders Carlsson  <andersca@apple.com>
213
214         Fix iOS build.
215
216         * UIProcess/WebProcessPool.cpp:
217         (WebKit::WebProcessPool::setPluginLoadClientPolicy): Deleted.
218         (WebKit::WebProcessPool::clearPluginClientPolicies): Deleted.
219
220 2016-08-09  Anders Carlsson  <andersca@apple.com>
221
222         Instantiate WebKit plug-ins at layout time, instead of at style resolution time
223         https://bugs.webkit.org/show_bug.cgi?id=160715
224
225         Reviewed by Tim Horton.
226
227         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
228         (WebKit::WebFrameLoaderClient::objectContentType):
229
230 2016-08-09  Brady Eidson  <beidson@apple.com>
231
232         [WK2] Only send gamepad input events to the currently focused page.
233         https://bugs.webkit.org/show_bug.cgi?id=160699
234
235         Reviewed by Tim Horton.
236         
237         * UIProcess/Gamepad/UIGamepadProvider.cpp:
238         (WebKit::UIGamepadProvider::updateTimerFired):
239         (WebKit::UIGamepadProvider::platformWebProcessProxyForGamepadInput):
240         * UIProcess/Gamepad/UIGamepadProvider.h:
241         * UIProcess/Gamepad/mac/UIGamepadProviderMac.mm: Copied from Source/WebKit2/UIProcess/API/mac/WKViewInternal.h.
242         (WebKit::UIGamepadProvider::platformWebPageProxyForGamepadInput):
243         
244         * UIProcess/WebPageProxy.cpp:
245         (WebKit::WebPageProxy::gamepadActivity):
246         * UIProcess/WebPageProxy.h:
247         
248         * UIProcess/WebProcessPool.cpp:
249         (WebKit::WebProcessPool::gamepadActivity): Deleted.
250         * UIProcess/WebProcessPool.h:
251         
252         * WebKit2.xcodeproj/project.pbxproj:
253         
254         * WebProcess/WebPage/WebPage.cpp:
255         (WebKit::WebPage::gamepadActivity):
256         * WebProcess/WebPage/WebPage.h:
257         * WebProcess/WebPage/WebPage.messages.in:
258         
259         * WebProcess/WebProcess.cpp:
260         (WebKit::WebProcess::gamepadActivity): Deleted.
261         * WebProcess/WebProcess.h:
262         * WebProcess/WebProcess.messages.in:
263
264 2016-08-09  Anders Carlsson  <andersca@apple.com>
265
266         Remove code that would tell clients whenever the list of installed plug-ins changes
267         https://bugs.webkit.org/show_bug.cgi?id=160719
268
269         Reviewed by Tim Horton.
270
271         * UIProcess/Plugins/PluginInfoStore.cpp:
272         (WebKit::PluginInfoStore::PluginInfoStore): Deleted.
273         (WebKit::PluginInfoStore::loadPluginsIfNecessary): Deleted.
274         * UIProcess/Plugins/PluginInfoStore.h:
275         (WebKit::PluginInfoStoreClient::~PluginInfoStoreClient): Deleted.
276         (WebKit::PluginInfoStoreClient::PluginInfoStoreClient): Deleted.
277         (WebKit::PluginInfoStore::setClient): Deleted.
278         (WebKit::PluginInfoStore::client): Deleted.
279         * UIProcess/WebContextClient.cpp:
280         (WebKit::WebContextClient::plugInInformationBecameAvailable): Deleted.
281         * UIProcess/WebContextClient.h:
282         * UIProcess/WebProcessPool.cpp:
283         (WebKit::m_hiddenPageThrottlingTimer): Deleted.
284         (WebKit::WebProcessPool::pluginInfoStoreDidLoadPlugins): Deleted.
285         * UIProcess/WebProcessPool.h:
286
287 2016-08-09  George Ruan  <gruan@apple.com>
288
289         Implement functionality of media capture on iOS
290         https://bugs.webkit.org/show_bug.cgi?id=158945
291         <rdar://problem/26893343>
292
293         Reviewed by Tim Horton.
294
295         For a input type file element on iOS, the media capture attribute can
296         now be used to specify which camera to pull up immediately, as opposed
297         to having to select the camera from a file picker menu. If the
298         specified capture type camera device is unavailable, the other
299         built-in camera will be pulled up instead. If no camera is available,
300         then the file picker menu will be presented to the user.
301
302         * Configurations/FeatureDefines.xcconfig: Enable Media Capture feature
303         on iOS.
304         * Shared/WebCoreArgumentCoders.cpp:
305         (IPC::ArgumentCoder<FileChooserSettings>::encode): Encode enum
306         MediaCaptureType.
307         (IPC::ArgumentCoder<FileChooserSettings>::decode): Decode enum
308         MediaCaptureType.
309         * UIProcess/API/APIOpenPanelParameters.cpp:
310         (API::OpenPanelParameters::mediaCaptureType):
311         (API::OpenPanelParameters::capture): Deleted.
312         * UIProcess/API/APIOpenPanelParameters.h: Capture attribute is now
313         represented with MediaCaptureType instead of boolean.
314         * UIProcess/API/C/WKOpenPanelParametersRef.cpp:
315         (WKOpenPanelParametersGetMediaCaptureType): Change function name to
316         better represent function.
317         (WKOpenPanelParametersGetCaptureEnabled): Deleted.
318         * UIProcess/API/C/WKOpenPanelParametersRef.h:
319         * UIProcess/ios/forms/WKFileUploadPanel.mm:
320         (cameraDeviceForMediaCaptureType): Translate MediaCaptureType to media
321         device.
322         (-[WKFileUploadPanel presentWithParameters:resultListener:]):
323         Immediately pull up media capture device if devices are available and
324         capture attribute is present.
325         (-[WKFileUploadPanel _showDocumentPickerMenu]): Only show option to
326         use media capture device if it is available for the source type.
327         (-[WKFileUploadPanel _adjustMediaCaptureType]): Determines correct
328         fallback option for the media capture device.
329         (-[WKFileUploadPanel _shouldMediaCaptureOpenMediaDevice]): Checks if
330         the media capture device should be immediately pulled up.
331         (-[WKFileUploadPanel _showPhotoPickerWithSourceType:]): Specified the
332         media capture device to use.
333
334 2016-08-09  Brady Eidson  <beidson@apple.com>
335
336         Implement "dumb" WK2 support for gamepads.
337         https://bugs.webkit.org/show_bug.cgi?id=160700
338
339         Reviewed by Alex Christensen.
340         
341         With this patch, gamepads work in WK2.
342
343         Things known to be missing to make this mechanism more "smart":
344           - Refresh values along with display sync instead of on a 60hz timer (bug 160673)
345           - Only send updated values to the current focused web page (bug 160699)
346
347         * CMakeLists.txt:
348         * WebKit2.xcodeproj/project.pbxproj:
349         
350         * Shared/Gamepad/GamepadData.cpp: Copied from Source/WebKit2/UIProcess/Gamepad/mac/UIGamepadProviderHID.cpp.
351         (WebKit::GamepadData::encode):
352         (WebKit::GamepadData::decode):
353         (WebKit::GamepadData::isNull):
354         (WebKit::GamepadData::loggingString):
355         * Shared/Gamepad/GamepadData.h: Copied from Source/WebKit2/WebProcess/Gamepad/WebGamepad.h.
356         
357         * UIProcess/Gamepad/UIGamepad.cpp: Copied from Source/WebKit2/UIProcess/Gamepad/mac/UIGamepadProviderHID.cpp.
358         (WebKit::UIGamepad::UIGamepad):
359         (WebKit::UIGamepad::updateFromPlatformGamepad):
360         (WebKit::UIGamepad::gamepadData):
361         * UIProcess/Gamepad/UIGamepad.h: Copied from Source/WebKit2/WebProcess/Gamepad/WebGamepad.h.
362         (WebKit::UIGamepad::index):
363         
364         * UIProcess/Gamepad/UIGamepadProvider.cpp:
365         (WebKit::UIGamepadProvider::UIGamepadProvider):
366         (WebKit::UIGamepadProvider::updateTimerFired):
367         (WebKit::UIGamepadProvider::startOrStopSynchingGamepadState):
368         (WebKit::UIGamepadProvider::platformGamepadConnected):
369         (WebKit::UIGamepadProvider::platformGamepadDisconnected):
370         (WebKit::UIGamepadProvider::platformGamepadInputActivity):
371         (WebKit::UIGamepadProvider::processPoolStartedUsingGamepads):
372         (WebKit::UIGamepadProvider::processPoolStoppedUsingGamepads):
373         (WebKit::UIGamepadProvider::platformGamepads):
374         * UIProcess/Gamepad/UIGamepadProvider.h:
375         * UIProcess/Gamepad/mac/UIGamepadProviderHID.cpp:
376         (WebKit::UIGamepadProvider::platformGamepads):
377         
378         * UIProcess/WebProcessPool.cpp:
379         (WebKit::WebProcessPool::gamepadConnected):
380         (WebKit::WebProcessPool::gamepadDisconnected):
381         (WebKit::WebProcessPool::gamepadActivity):
382         * UIProcess/WebProcessPool.h:
383         
384         * WebProcess/Gamepad/WebGamepad.cpp:
385         (WebKit::WebGamepad::WebGamepad):
386         (WebKit::WebGamepad::axisValues):
387         (WebKit::WebGamepad::buttonValues):
388         (WebKit::WebGamepad::updateValues):
389         * WebProcess/Gamepad/WebGamepad.h:
390         
391         * WebProcess/Gamepad/WebGamepadProvider.cpp:
392         (WebKit::WebGamepadProvider::gamepadConnected):
393         (WebKit::WebGamepadProvider::gamepadDisconnected):
394         (WebKit::WebGamepadProvider::gamepadActivity):
395         (WebKit::WebGamepadProvider::platformGamepads):
396         * WebProcess/Gamepad/WebGamepadProvider.h:
397         
398         * WebProcess/WebProcess.cpp:
399         (WebKit::WebProcess::gamepadConnected):
400         (WebKit::WebProcess::gamepadDisconnected):
401         (WebKit::WebProcess::gamepadActivity):
402         * WebProcess/WebProcess.h:
403         * WebProcess/WebProcess.messages.in:
404
405 2016-08-09  Anders Carlsson  <andersca@apple.com>
406
407         Get rid of PluginStrategy
408         https://bugs.webkit.org/show_bug.cgi?id=160696
409
410         Reviewed by Dan Bernstein.
411
412         * NetworkProcess/NetworkProcessPlatformStrategies.cpp:
413         (WebKit::NetworkProcessPlatformStrategies::createPluginStrategy): Deleted.
414         * NetworkProcess/NetworkProcessPlatformStrategies.h:
415         * WebProcess/Plugins/WebPluginInfoProvider.h:
416         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
417         (WebKit::WebPlatformStrategies::createPluginStrategy): Deleted.
418         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
419
420 2016-08-09  Dan Bernstein  <mitz@apple.com>
421
422         Add WKPage SPI for looking up a WKFrame given a WKFrameHandle
423         https://bugs.webkit.org/show_bug.cgi?id=160695
424
425         Reviewed by Anders Carlsson.
426
427         * UIProcess/API/C/WKPage.cpp:
428         (WKPageLookUpFrameFromHandle): Added. Gets the frame from the map in the page’s process and
429           returns it if it belongs to the page.
430         * UIProcess/API/C/WKPagePrivate.h:
431
432 2016-08-08  Anders Carlsson  <andersca@apple.com>
433
434         Move plug-in code from WebPlatformStrategies to WebPluginInfoProvider
435         https://bugs.webkit.org/show_bug.cgi?id=160679
436
437         Reviewed by Alex Christensen.
438
439         * WebProcess/Plugins/WebPluginInfoProvider.cpp:
440         (WebKit::WebPluginInfoProvider::setPluginLoadClientPolicy):
441         (WebKit::WebPluginInfoProvider::clearPluginClientPolicies):
442         (WebKit::WebPluginInfoProvider::refreshPlugins):
443         (WebKit::WebPluginInfoProvider::getPluginInfo):
444         (WebKit::WebPluginInfoProvider::getWebVisiblePluginInfo):
445         (WebKit::WebPluginInfoProvider::populatePluginCache):
446         (WebKit::WebPluginInfoProvider::pluginLoadClientPolicyForHost):
447         (WebKit::WebPluginInfoProvider::longestMatchedWildcardHostForHost):
448         (WebKit::WebPluginInfoProvider::replaceHostWithMatchedWildcardHost):
449         * WebProcess/Plugins/WebPluginInfoProvider.h:
450         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
451         (WebKit::WebPlatformStrategies::createPluginStrategy):
452         (WebKit::WebPlatformStrategies::WebPlatformStrategies): Deleted.
453         (WebKit::WebPlatformStrategies::refreshPlugins): Deleted.
454         (WebKit::WebPlatformStrategies::getPluginInfo): Deleted.
455         (WebKit::WebPlatformStrategies::getWebVisiblePluginInfo): Deleted.
456         (WebKit::WebPlatformStrategies::setPluginLoadClientPolicy): Deleted.
457         (WebKit::WebPlatformStrategies::clearPluginClientPolicies): Deleted.
458         (WebKit::WebPlatformStrategies::longestMatchedWildcardHostForHost): Deleted.
459         (WebKit::WebPlatformStrategies::replaceHostWithMatchedWildcardHost): Deleted.
460         (WebKit::WebPlatformStrategies::pluginLoadClientPolicyForHost): Deleted.
461         (WebKit::WebPlatformStrategies::populatePluginCache): Deleted.
462         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
463         * WebProcess/WebProcess.cpp:
464         (WebKit::WebProcess::initializeWebProcess):
465         (WebKit::WebProcess::setPluginLoadClientPolicy):
466         (WebKit::WebProcess::clearPluginClientPolicies):
467
468 2016-08-08  Anders Carlsson  <andersca@apple.com>
469
470         Add a new PluginInfoProvider class, to replace PluginStrategy
471         https://bugs.webkit.org/show_bug.cgi?id=160670
472
473         Reviewed by Sam Weinig.
474
475         Add a new WebPluginInfoProvider - it just calls through to the plug-in strategy for now.
476
477         * WebKit2.xcodeproj/project.pbxproj:
478         * WebProcess/Plugins/WebPluginInfoProvider.cpp: Added.
479         (WebKit::WebPluginInfoProvider::singleton):
480         (WebKit::WebPluginInfoProvider::WebPluginInfoProvider):
481         (WebKit::WebPluginInfoProvider::~WebPluginInfoProvider):
482         (WebKit::WebPluginInfoProvider::refreshPlugins):
483         (WebKit::WebPluginInfoProvider::getPluginInfo):
484         (WebKit::WebPluginInfoProvider::getWebVisiblePluginInfo):
485         (WebKit::WebPluginInfoProvider::setPluginLoadClientPolicy):
486         (WebKit::WebPluginInfoProvider::clearPluginClientPolicies):
487         * WebProcess/Plugins/WebPluginInfoProvider.h: Added.
488         * WebProcess/WebPage/WebPage.cpp:
489         (WebKit::m_userInterfaceLayoutDirection):
490
491 2016-08-08  Brady Eidson  <beidson@apple.com>
492
493         Addressing late review feedback in bug 160605
494         https://bugs.webkit.org/show_bug.cgi?id=160605
495
496         Reviewed by Darin's suggestions.
497
498         * UIProcess/Gamepad/UIGamepadProvider.cpp:
499         (WebKit::UIGamepadProvider::processPoolStartedUsingGamepads):
500         (WebKit::UIGamepadProvider::processPoolStoppedUsingGamepads):
501         * UIProcess/Gamepad/UIGamepadProvider.h:
502         
503         * UIProcess/Gamepad/mac/UIGamepadProviderHID.cpp:
504         (WebKit::UIGamepadProvider::platformStartMonitoringGamepads):
505         (WebKit::UIGamepadProvider::platformStopMonitoringGamepads):
506         
507         * UIProcess/WebProcessPool.cpp:
508         (WebKit::WebProcessPool::disconnectProcess):
509         (WebKit::WebProcessPool::startedUsingGamepads):
510         (WebKit::WebProcessPool::stoppedUsingGamepads):
511         (WebKit::WebProcessPool::processStoppedUsingGamepads):
512         * UIProcess/WebProcessPool.h:
513         
514         * WebProcess/Gamepad/WebGamepadProvider.cpp:
515         (WebKit::WebGamepadProvider::startMonitoringGamepads):
516         (WebKit::WebGamepadProvider::stopMonitoringGamepads):
517         * WebProcess/Gamepad/WebGamepadProvider.h:
518
519 2016-08-07  Carlos Garcia Campos  <cgarcia@igalia.com>
520
521         [GTK] Bad performance in accelerated compositing mode with the modesetting intel driver and DRI3 enabled
522         https://bugs.webkit.org/show_bug.cgi?id=160491
523
524         Reviewed by Michael Catanzaro.
525
526         This is becoming the default in several linux distributions and it makes WebKitGTK+ unusable in accelerated
527         compositing mode, which is now always enabled because since we switched to use the threaded compositor. The
528         problem seems to be an optimization of the intel driver for windows that are offscreen, and our redirected
529         window is always positioned at ScreenWidth + 1, 0. Using negative coordinates to position the redirected window
530         offscreen fixes the problem.
531         See also https://bugs.freedesktop.org/show_bug.cgi?id=85064.
532
533         * WebProcess/WebPage/gtk/RedirectedXCompositeWindow.cpp:
534         (WebKit::RedirectedXCompositeWindow::RedirectedXCompositeWindow): Position the parent window at -1, -1.
535
536 2016-08-07  Carlos Garcia Campos  <cgarcia@igalia.com>
537
538         Duplicated code in DrawingAreaProxyImpl and CoordinatedDrawingAreaProxy
539         https://bugs.webkit.org/show_bug.cgi?id=160506
540
541         Reviewed by Michael Catanzaro.
542
543         Same logic as in r202855 but in the UI process. CoordinatedDrawingAreaProxy is just a copy paste of
544         DrawingAreaProxyImpl with non-accelerated code path removed. There's actually nothing (or very little) specific
545         to coordinated graphics in the CoordinatedDrawingAreaProxy implementation. This patch renames
546         CoordinatedDrawingAreaProxy as AcceleratedDrawingAreaProxy and makes DrawingAreaProxyImpl inherit from it, so
547         that in case of accelerated compositing the parent class is used, and DrawingAreaProxyImpl only adds the non
548         accelerated code path.
549         To simplify the common API of AcceleratedDrawingAreaProxy, I have changed CoordinatedLayerTreeHostProxy to
550         receive a WebPageProxy in the constructor instead of a drawing area, since the drawing area was used just to get
551         the page proxy.
552
553         * PlatformEfl.cmake:
554         * PlatformGTK.cmake:
555         * UIProcess/AcceleratedDrawingAreaProxy.cpp: Renamed from Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedDrawingAreaProxy.cpp.
556         (WebKit::AcceleratedDrawingAreaProxy::AcceleratedDrawingAreaProxy):
557         (WebKit::AcceleratedDrawingAreaProxy::~AcceleratedDrawingAreaProxy):
558         (WebKit::AcceleratedDrawingAreaProxy::alwaysUseCompositing):
559         (WebKit::AcceleratedDrawingAreaProxy::dispatchAfterEnsuringDrawing):
560         (WebKit::AcceleratedDrawingAreaProxy::sizeDidChange):
561         (WebKit::AcceleratedDrawingAreaProxy::deviceScaleFactorDidChange):
562         (WebKit::AcceleratedDrawingAreaProxy::visibilityDidChange):
563         (WebKit::AcceleratedDrawingAreaProxy::waitForBackingStoreUpdateOnNextPaint):
564         (WebKit::AcceleratedDrawingAreaProxy::didUpdateBackingStoreState):
565         (WebKit::AcceleratedDrawingAreaProxy::enterAcceleratedCompositingMode):
566         (WebKit::AcceleratedDrawingAreaProxy::exitAcceleratedCompositingMode):
567         (WebKit::AcceleratedDrawingAreaProxy::updateAcceleratedCompositingMode):
568         (WebKit::AcceleratedDrawingAreaProxy::backingStoreStateDidChange):
569         (WebKit::AcceleratedDrawingAreaProxy::sendUpdateBackingStoreState):
570         (WebKit::AcceleratedDrawingAreaProxy::waitForAndDispatchDidUpdateBackingStoreState):
571         (WebKit::AcceleratedDrawingAreaProxy::setNativeSurfaceHandleForCompositing):
572         (WebKit::AcceleratedDrawingAreaProxy::destroyNativeSurfaceHandleForCompositing):
573         * UIProcess/AcceleratedDrawingAreaProxy.h: Renamed from Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedDrawingAreaProxy.h.
574         (WebKit::AcceleratedDrawingAreaProxy::isInAcceleratedCompositingMode):
575         (WebKit::AcceleratedDrawingAreaProxy::coordinatedLayerTreeHostProxy):
576         * UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.cpp:
577         (WebKit::CoordinatedLayerTreeHostProxy::CoordinatedLayerTreeHostProxy):
578         (WebKit::CoordinatedLayerTreeHostProxy::~CoordinatedLayerTreeHostProxy):
579         (WebKit::CoordinatedLayerTreeHostProxy::updateViewport):
580         (WebKit::CoordinatedLayerTreeHostProxy::commitCoordinatedGraphicsState):
581         (WebKit::CoordinatedLayerTreeHostProxy::setVisibleContentsRect):
582         (WebKit::CoordinatedLayerTreeHostProxy::renderNextFrame):
583         (WebKit::CoordinatedLayerTreeHostProxy::commitScrollOffset):
584         * UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.h:
585         * UIProcess/CoordinatedGraphics/PageViewportController.cpp:
586         (WebKit::PageViewportController::syncVisibleContents):
587         * UIProcess/DrawingAreaProxyImpl.cpp:
588         (WebKit::DrawingAreaProxyImpl::DrawingAreaProxyImpl):
589         (WebKit::DrawingAreaProxyImpl::paint):
590         (WebKit::DrawingAreaProxyImpl::didUpdateBackingStoreState):
591         (WebKit::DrawingAreaProxyImpl::exitAcceleratedCompositingMode):
592         (WebKit::DrawingAreaProxyImpl::enterAcceleratedCompositingMode):
593         (WebKit::DrawingAreaProxyImpl::~DrawingAreaProxyImpl): Deleted.
594         (WebKit::DrawingAreaProxyImpl::update): Deleted.
595         (WebKit::DrawingAreaProxyImpl::incorporateUpdate): Deleted.
596         (WebKit::DrawingAreaProxyImpl::discardBackingStoreSoon): Deleted.
597         (WebKit::DrawingAreaProxyImpl::discardBackingStore): Deleted.
598         * UIProcess/DrawingAreaProxyImpl.h:
599         * UIProcess/efl/WebView.cpp:
600         (WebKit::WebView::setVisible):
601         (WebKit::WebView::coordinatedGraphicsScene):
602         (WebKit::WebView::updateViewportSize):
603         (WebKit::WebView::createDrawingAreaProxy):
604
605 2016-08-07  Dan Bernstein  <mitz@apple.com>
606
607         [Cocoa] Reply block leaks if the remote object doesn’t call it
608         https://bugs.webkit.org/show_bug.cgi?id=160642
609
610         Reviewed by Sam Weinig.
611
612         * Shared/API/Cocoa/RemoteObjectRegistry.h: Declared new member functions.
613         * Shared/API/Cocoa/RemoteObjectRegistry.messages.in: Added ReleaseUnusedReplyBlock message.
614         * Shared/API/Cocoa/RemoteObjectRegistry.mm:
615         (WebKit::RemoteObjectRegistry::sendUnusedReply): Send the ReleaseUnusedReplyBlock message.
616         (WebKit::RemoteObjectRegistry::releaseUnusedReplyBlock): Message receiver that call through
617           to -_releaseReplyWithID:.
618
619         * Shared/API/Cocoa/_WKRemoteObjectRegistry.mm:
620         (-[_WKRemoteObjectRegistry _invokeMethod:]): Define a ReplyBlockCallChecker object and
621           capture an instance of it in the reply block we pass to the exported object. Have that
622           block set a flag on the checker when it’s called. If the checker gets destroyed without
623           the block having been called, which means that the block got destroyed without being
624           called, call sendUnusedReply to let the other side know that the block will not be invoked.
625         (-[_WKRemoteObjectRegistry _releaseReplyWithID:]): Added. Removed the pending reply from the
626           map, which release the block.
627         * Shared/API/Cocoa/_WKRemoteObjectRegistryInternal.h:
628
629 2016-08-07  Chris Dumez  <cdumez@apple.com>
630
631         Write API test to cover crash fix in r204135
632         https://bugs.webkit.org/show_bug.cgi?id=160587
633
634         Reviewed by Darin Adler.
635
636         * UIProcess/WebPageProxy.cpp:
637         (WebKit::WebPageProxy::terminateProcess):
638         Stop calling resetStateAfterProcessExited() after calling
639         requestTermination() because requestTermination() now calls
640         didClose() which calls processDidCrash() which already calls
641         resetStateAfterProcessExited(). Because the processDidCrash()
642         delegates may start new loads, we really do not want to
643         reset the state again after calling the delegates.
644
645         * UIProcess/WebProcessProxy.cpp:
646         (WebKit::WebProcessProxy::requestTermination):
647         - Call didClose() in WebProcessProxy::requestTermination() so that
648           the processDidCrash() delegates get called in API tests whenever
649           a WebContent process is terminated to simulate a crash.
650         - Stop calling shutDown() and webConnection()->didClose() because
651           didClose() already does this for us.
652
653 2016-08-06  Chris Dumez  <cdumez@apple.com>
654
655         Unreviewed, rolling out r204226.
656
657         Broke some API tests
658
659         Reverted changeset:
660
661         "Write API test to cover crash fix in r204135"
662         https://bugs.webkit.org/show_bug.cgi?id=160587
663         http://trac.webkit.org/changeset/204226
664
665 2016-08-06  Dan Bernstein  <mitz@apple.com>
666
667         [Cocoa] -[_WKRemoteObjectRegistry() _invokeMethod:] leaks a block
668         https://bugs.webkit.org/show_bug.cgi?id=160636
669
670         Reviewed by Darin Adler.
671
672         * Shared/API/Cocoa/_WKRemoteObjectRegistry.mm:
673         (-[_WKRemoteObjectRegistry _invokeMethod:]): Release the block returned from
674           __NSMakeSpecialForwardingCaptureBlock.
675
676 2016-08-06  Chris Dumez  <cdumez@apple.com>
677
678         Write API test to cover crash fix in r204135
679         https://bugs.webkit.org/show_bug.cgi?id=160587
680
681         Reviewed by Darin Adler.
682
683         Call didClose() in WebProcessProxy::requestTermination() so that
684         the processDidCrash() delegates get called in API tests whenever
685         a WebContent process is terminated to simulate a crash.
686
687         * UIProcess/WebProcessProxy.cpp:
688         (WebKit::WebProcessProxy::requestTermination):
689
690 2016-08-06  Brady Eidson  <beidson@apple.com>
691
692         Lay WebProcess/UIProcess groundwork for an IPC GamepadProvider.
693         https://bugs.webkit.org/show_bug.cgi?id=160605
694
695         Reviewed by Alex Christensen.
696
697         This patch:
698           - Introduces the GamepadProvider that the WebProcess will use (WebGamepadProvider)
699           - Has that provider message to the UIProcess notifying interest in gamepad state
700           - Introduces a GamepadProviderClient in the UIProcess (UIGamepadProvider) that will use
701             one of the existing GamepadProviders to pass gamepad state along to WebProcesses.
702           - Adds an empty skeleton for the soon-to-be-used WebGamepad, which will be the 
703             "PlatformGamepad" for WebProcesses.
704
705         * CMakeLists.txt:
706         * WebKit2.xcodeproj/project.pbxproj:
707
708         * UIProcess/Gamepads/UIGamepadProvider.cpp: Added.
709         (WebKit::UIGamepadProvider::singleton):
710         (WebKit::UIGamepadProvider::UIGamepadProvider):
711         (WebKit::UIGamepadProvider::~UIGamepadProvider):
712         (WebKit::UIGamepadProvider::platformGamepadConnected):
713         (WebKit::UIGamepadProvider::platformGamepadDisconnected):
714         (WebKit::UIGamepadProvider::platformGamepadInputActivity):
715         (WebKit::UIGamepadProvider::processPoolStartedUsingGamepads):
716         (WebKit::UIGamepadProvider::processPoolStoppedUsingGamepads):
717         (WebKit::UIGamepadProvider::platformStartMonitoringGamepads):
718         (WebKit::UIGamepadProvider::platformStopMonitoringGamepads):
719         * UIProcess/Gamepads/UIGamepadProvider.h: Added.
720
721         * UIProcess/Gamepads/mac/UIGamepadProviderHID.cpp: Added.
722         (WebKit::UIGamepadProvider::platformStartMonitoringGamepads):
723         (WebKit::UIGamepadProvider::platformStopMonitoringGamepads):
724
725         * UIProcess/WebProcessPool.cpp:
726         (WebKit::WebProcessPool::~WebProcessPool):
727         (WebKit::WebProcessPool::disconnectProcess):
728         (WebKit::WebProcessPool::startedUsingGamepads):
729         (WebKit::WebProcessPool::stoppedUsingGamepads):
730         (WebKit::WebProcessPool::processStoppedUsingGamepads):
731         * UIProcess/WebProcessPool.h:
732         * UIProcess/WebProcessPool.messages.in:
733                 
734         * WebProcess/Gamepad/WebGamepad.cpp: Added.
735         * WebProcess/Gamepad/WebGamepad.h: Added.
736         
737         * WebProcess/Gamepad/WebGamepadProvider.cpp: Added.
738         (WebKit::WebGamepadProvider::singleton):
739         (WebKit::WebGamepadProvider::WebGamepadProvider):
740         (WebKit::WebGamepadProvider::~WebGamepadProvider):
741         (WebKit::WebGamepadProvider::startMonitoringGamepads):
742         (WebKit::WebGamepadProvider::stopMonitoringGamepads):
743         (WebKit::WebGamepadProvider::platformGamepads):
744         * WebProcess/Gamepad/WebGamepadProvider.h: Added.
745         * WebProcess/WebProcess.cpp:
746         (WebKit::WebProcess::initializeWebProcess):
747
748 2016-08-05  Commit Queue  <commit-queue@webkit.org>
749
750         Unreviewed, rolling out r204195.
751         https://bugs.webkit.org/show_bug.cgi?id=160623
752
753         This change causes assertion failures in LayoutTests and API
754         tests. (Requested by ryanhaddad on #webkit).
755
756         Reverted changeset:
757
758         "Lay WebProcess/UIProcess groundwork for an IPC
759         GamepadProvider."
760         https://bugs.webkit.org/show_bug.cgi?id=160605
761         http://trac.webkit.org/changeset/204195
762
763 2016-08-05  Brady Eidson  <beidson@apple.com>
764
765         Lay WebProcess/UIProcess groundwork for an IPC GamepadProvider.
766         https://bugs.webkit.org/show_bug.cgi?id=160605
767
768         Reviewed by Alex Christensen.
769
770         This patch:
771           - Introduces the GamepadProvider that the WebProcess will use (WebGamepadProvider)
772           - Has that provider message to the UIProcess notifying interest in gamepad state
773           - Introduces a GamepadProviderClient in the UIProcess (UIGamepadProvider) that will use
774             one of the existing GamepadProviders to pass gamepad state along to WebProcesses.
775           - Adds an empty skeleton for the soon-to-be-used WebGamepad, which will be the 
776             "PlatformGamepad" for WebProcesses.
777
778         * CMakeLists.txt:
779         * WebKit2.xcodeproj/project.pbxproj:
780
781         * UIProcess/Gamepads/UIGamepadProvider.cpp: Added.
782         (WebKit::UIGamepadProvider::singleton):
783         (WebKit::UIGamepadProvider::UIGamepadProvider):
784         (WebKit::UIGamepadProvider::~UIGamepadProvider):
785         (WebKit::UIGamepadProvider::platformGamepadConnected):
786         (WebKit::UIGamepadProvider::platformGamepadDisconnected):
787         (WebKit::UIGamepadProvider::platformGamepadInputActivity):
788         (WebKit::UIGamepadProvider::processPoolStartedUsingGamepads):
789         (WebKit::UIGamepadProvider::processPoolStoppedUsingGamepads):
790         (WebKit::UIGamepadProvider::platformStartMonitoringGamepads):
791         (WebKit::UIGamepadProvider::platformStopMonitoringGamepads):
792         * UIProcess/Gamepads/UIGamepadProvider.h: Added.
793
794         * UIProcess/Gamepads/mac/UIGamepadProviderHID.cpp: Added.
795         (WebKit::UIGamepadProvider::platformStartMonitoringGamepads):
796         (WebKit::UIGamepadProvider::platformStopMonitoringGamepads):
797
798         * UIProcess/WebProcessPool.cpp:
799         (WebKit::WebProcessPool::~WebProcessPool):
800         (WebKit::WebProcessPool::disconnectProcess):
801         (WebKit::WebProcessPool::startedUsingGamepads):
802         (WebKit::WebProcessPool::stoppedUsingGamepads):
803         (WebKit::WebProcessPool::processStoppedUsingGamepads):
804         * UIProcess/WebProcessPool.h:
805         * UIProcess/WebProcessPool.messages.in:
806                 
807         * WebProcess/Gamepad/WebGamepad.cpp: Added.
808         * WebProcess/Gamepad/WebGamepad.h: Added.
809         
810         * WebProcess/Gamepad/WebGamepadProvider.cpp: Added.
811         (WebKit::WebGamepadProvider::singleton):
812         (WebKit::WebGamepadProvider::WebGamepadProvider):
813         (WebKit::WebGamepadProvider::~WebGamepadProvider):
814         (WebKit::WebGamepadProvider::startMonitoringGamepads):
815         (WebKit::WebGamepadProvider::stopMonitoringGamepads):
816         (WebKit::WebGamepadProvider::platformGamepads):
817         * WebProcess/Gamepad/WebGamepadProvider.h: Added.
818         * WebProcess/WebProcess.cpp:
819         (WebKit::WebProcess::initializeWebProcess):
820
821 2016-08-05  Dan Bernstein  <mitz@apple.com>
822
823         [Cocoa] WKRemoteObjectCoder doesn’t handle NSRange
824         https://bugs.webkit.org/show_bug.cgi?id=160589
825
826         Reviewed by Tim Horton.
827
828         * Shared/API/Cocoa/WKRemoteObjectCoder.mm:
829         (encodeInvocationArguments): Encode NSRange by wrapping in an NSValue.
830         (decodeInvocationArguments): Decode wrapped NSRange.
831
832 2016-08-04  Chris Dumez  <cdumez@apple.com>
833
834         Crash under NavigationState::NavigationClient::processDidCrash()
835         https://bugs.webkit.org/show_bug.cgi?id=160563
836         <rdar://problem/19814215>
837
838         Reviewed by Sam Weinig.
839
840         When WebPageProxy::close() gets called, make sure we destroy the page's
841         navigationClient. If we don't then the navigationClient can outlive the
842         navigationState, causing crashes when navigationClient tries to use its
843         stale navigationState member reference later on. This happens when the
844         WebPageProxy outlives its WKWebView because:
845         1. WebPageProxy owns the navigationClient
846         2. WKWebView owns the navigationState
847         3. navigationClient has a reference to the navigationState as member.
848
849         WebPageProxy can outlive the WKWebView because it is refCounted. It
850         can happen for example when the client application uses the
851         RelatedPage API as this extend the lifetime of the related WebPage's
852         proxy but the application may not keep the related WKWebView alive.
853
854         * UIProcess/WebPageProxy.cpp:
855         (WebKit::WebPageProxy::close):
856         Note that it is safe to null out m_navigationClient here instead of
857         creating a fresh one because there is a null check before every use
858         of m_navigationClient in WebPageProxy.
859
860 2016-08-03  Michael Catanzaro  <mcatanzaro@igalia.com>
861
862         [SOUP] Deduplicate WebProcessPool::setIgnoreTLSErrors
863         https://bugs.webkit.org/show_bug.cgi?id=160489
864
865         Reviewed by Alex Christensen.
866
867         WebProcessPool::setIgnoreTLSErrors has identical implementation in WebProcessPoolEfl.cpp
868         and WebProcessPoolGtk.cpp. We have WebProcessPoolSoup.cpp and this function is specific to
869         the soup network backend, so move it there.
870
871         * UIProcess/efl/WebProcessPoolEfl.cpp:
872         (WebKit::WebProcessPool::setIgnoreTLSErrors): Deleted.
873         * UIProcess/gtk/WebProcessPoolGtk.cpp:
874         (WebKit::WebProcessPool::setIgnoreTLSErrors): Deleted.
875         * UIProcess/soup/WebProcessPoolSoup.cpp:
876         (WebKit::WebProcessPool::setIgnoreTLSErrors):
877
878 2016-08-03  Michael Catanzaro  <mcatanzaro@igalia.com>
879
880         [GTK] Document how to initialize WebKitFaviconDatabase
881         https://bugs.webkit.org/show_bug.cgi?id=160391
882
883         Reviewed by Carlos Garcia Campos.
884
885         * UIProcess/API/gtk/WebKitFaviconDatabase.cpp:
886
887 2016-08-02  Tim Horton  <timothy_horton@apple.com>
888
889         REGRESSION (r203385): Frequent RELEASE_ASSERT in WebKit::RemoteLayerTreeDrawingArea::flushLayers()
890         https://bugs.webkit.org/show_bug.cgi?id=160481
891         <rdar://problem/27534205>
892
893         Reviewed by Simon Fraser.
894
895         * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h:
896         * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
897         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
898         (WebKit::RemoteLayerTreeDrawingAreaProxy::didRefreshDisplay):
899         (WebKit::RemoteLayerTreeDrawingAreaProxy::waitForDidUpdateViewState):
900         If the UI process sends a didUpdate message while the Web process is in
901         the middle of flushing on a background thread, the drawing area will
902         allow another commit to start on the main thread, which then (rightfully)
903         causes the RELEASE_ASSERT.
904
905         This is normally not a problem, because didRefreshDisplay (which sends the didUpdate)
906         bails if m_didUpdateMessageState is anything other than NotSent, and m_didUpdateMessageState
907         is only NotSent if the Web process has sent a commit (and thus will not commit again until
908         it gets a didUpdate). This is the fundamental mechanism that avoids multiple commits being
909         in flight at once.
910
911         In r203385, I added a path where didRefreshDisplay could be called
912         before the first commit arrived (by way of
913         _applicationWillEnterForeground -> viewStateDidChange -> waitForDidUpdateViewState).
914
915         This caused trouble because m_didUpdateMessageState is initialized to NotSent,
916         which means that we could end up sending a didUpdate immediately, before the first
917         commit arrives - even worse, while the first commit is being flushed on a background thread,
918         leading the aforementioned RELEASE_ASSERT to fire.
919
920         Instead, initialize it to Sent (which I've renamed to DoesNotNeedDidUpdate), so that
921         we won't send a didUpdate until after the first commit arrives (at which point
922         the two processes are in agreement about the order of things).
923
924         It's not currently possible to API test this for multiple reasons, though it is fairly
925         easy to write a test app that reproduces reliably (by simulating suspend/resume notifications
926         inside the didFinishNavigation: callback).
927
928 2016-08-02  Enrica Casucci  <enrica@apple.com>
929
930         Allow building with content filtering disabled.
931         https://bugs.webkit.org/show_bug.cgi?id=160454
932
933         Reviewed by Simon Fraser.
934
935         * Configurations/FeatureDefines.xcconfig:
936         * Shared/mac/WebCoreArgumentCodersMac.mm:
937         (IPC::ArgumentCoder<KeypressCommand>::decode):
938         (IPC::ArgumentCoder<ContentFilterUnblockHandler>::encode):
939         (IPC::ArgumentCoder<ContentFilterUnblockHandler>::decode):
940         * WebProcess/WebCoreSupport/mac/WebErrorsMac.mm:
941         (WebKit::blockedByContentFilterError):
942
943 2016-08-02  Brady Eidson  <beidson@apple.com>
944
945         Refactor data passed along for a "GetRecord" request.
946         https://bugs.webkit.org/show_bug.cgi?id=160352
947
948         Reviewed by Tim Horton.
949
950         * DatabaseProcess/IndexedDB/WebIDBConnectionToClient.cpp:
951         (WebKit::WebIDBConnectionToClient::getRecord):
952         * DatabaseProcess/IndexedDB/WebIDBConnectionToClient.h:
953         * DatabaseProcess/IndexedDB/WebIDBConnectionToClient.messages.in:
954
955         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
956         (WebKit::WebIDBConnectionToServer::getRecord):
957         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h:
958
959 2016-08-01  Carlos Garcia Campos  <cgarcia@igalia.com>
960
961         [GTK] Move the redirected XComposite window to the web process
962         https://bugs.webkit.org/show_bug.cgi?id=160389
963
964         Reviewed by Žan Doberšek.
965
966         In the current code, the UI process creates the redirected window that the web process uses to render
967         accelerated contents. The redirected window is sent to the web process as native surface handle, and using
968         XDamage extension the UI process takes a pixmap of the redirected window to render into the widget when there
969         are updates. This requires several points of synchronization between UI and web processes. When the web view is
970         resized, the UI process first resizes the redirected window and then sends a new backing store ID to the web
971         process. The time between the redirected window is resized and the web process renders the new contents the UI
972         process keeps rendering the previous contents with the previous size in the new window with the new size. This
973         makes the resize process slow, and it produces rendering artifacts quite often. The redirected window is created
974         when the web view is realized, to be able to inherit the XVisual from the parent window, and the native window
975         handle is sent to the web process. The time until the window is realized, the web process doesn't have a context
976         to render into, so the UI process simply renders an empty page. When the web view is unrealized, for example if
977         the web view is reparented, the redirected window is destroyed, and a sync message is sent to the web process to
978         destroy the current gl context and stop drawing. This needs to happen synchronously, because the UI process
979         can't remove the redirected window until the web process has stopped rendering into it. This makes also the
980         reparenting process quite unstable and risky.
981         To all those synchronization points we now have to add the synchronization with the compositing thread when
982         using the threaded compositor. The threaded compositor made resizing, reparenting, etc. even worse. We can't
983         avoid the synchronization with the threaded compositor, but we can reduce the synchronization points and improve
984         the current ones by moving the redirected window to the web process. In this case is web process who creates the
985         redirected window, so we can be sure that it always has a valid native surface handle to render into. This means
986         we no longer need the IPC message to send the native surface handle from the UI process to the web process, nor
987         the sync message to destroy it either. This also means we no longer need to wait until the view is realized to
988         start rendering accelerated contents, and we don't need to stop when it's unrealized either. We don't really
989         need to inherit the XVisual from the parent window if the redirected window always uses always a RGBA visual
990         when available. That way we always render into a transparent window that is composed into the web view
991         widget. And when the web view is resized, we no longer need to destroy the GL context either, because we use the
992         same redirected window as the native handle, but create a new pixmap that is what we send to the UI process as
993         layer tree context ID. The layer tree context ID is already sent to the UI process by the drawing area as part
994         of the backing store update process, so we don't need any new IPC message for this. When the web view is
995         resized, the UI process sends a backing store state update message to the web process that updates its size,
996         relayouts and then renders the new contents, so that when the update backing store state reply gets to the UI
997         process, we already have a new pixmap with the new contents updated. This makes resizing smooth again, and
998         avoids flickering and rendering artifacts. And finally all this also prevents several race conditions that were
999         causing X errors and web process crashes.
1000
1001         * PlatformGTK.cmake:
1002         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
1003         (WebKit::ThreadedCompositor::create): Make it possible to optionally pass a native surface handle for
1004         compositing to the ThreadedCompositor contructor.
1005         (WebKit::ThreadedCompositor::ThreadedCompositor): Initialize the native surface handle and make the scene active
1006         after the thread initialization if we already have a valid handle.
1007         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
1008         * UIProcess/API/gtk/PageClientImpl.cpp:
1009         (WebKit::PageClientImpl::enterAcceleratedCompositingMode): Pass the layer tree context ID to the web view.
1010         (WebKit::PageClientImpl::updateAcceleratedCompositingMode): Notify the web view about the update.
1011         (WebKit::PageClientImpl::willEnterAcceleratedCompositingMode): Deleted.
1012         * UIProcess/API/gtk/PageClientImpl.h:
1013         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
1014         (webkitWebViewBaseSetAcceleratedCompositingPixmap): Helper function to update the pixmap used to render the
1015         accelerated contents.
1016         (webkitWebViewBaseRealize): Remove the code to create the redirected window.
1017         (webkitWebViewBaseUnrealize): Remove the code to destroy the redirected window.
1018         (webkitWebViewBaseDispose): Reset the accelerated compositing pixmap.
1019         (webkitWebViewRenderAcceleratedCompositingResults): Use the accelerated compositing pixmap surface.
1020         (webkitWebViewBaseSizeAllocate): Remove the code to resize the redirected window.
1021         (webkitWebViewBaseEnterAcceleratedCompositingMode): Update the accelerated compositing pixmap.
1022         (webkitWebViewBaseUpdateAcceleratedCompositingMode): Ditto.
1023         (webkitWebViewBaseExitAcceleratedCompositingMode): Reset the accelerated compositing pixmap.
1024         (webkitWebViewBaseDidRelaunchWebProcess): Remove the code to send native surface handle to the web process.
1025         (webkitWebViewBasePageClosed): Reset the accelerated compositing pixmap.
1026         (_WebKitWebViewBasePrivate::updateViewStateTimerFired): Deleted.
1027         * UIProcess/API/gtk/WebKitWebViewBasePrivate.h:
1028         * UIProcess/DrawingAreaProxy.h:
1029         * UIProcess/DrawingAreaProxy.messages.in:
1030         * UIProcess/DrawingAreaProxyImpl.cpp:
1031         (WebKit::DrawingAreaProxyImpl::didUpdateBackingStoreState): Handle the case when the layer tree context ID
1032         changes without leaving the accelerated compositing mode, calling updateAcceleratedCompositingMode().
1033         (WebKit::DrawingAreaProxyImpl::exitAcceleratedCompositingMode): Let the web view know we are leaving accelerated
1034         compositing mode even when it's forced, since in case of web process crash we need to leave the accelerated
1035         compositing mode in the UI process.
1036         (WebKit::DrawingAreaProxyImpl::willEnterAcceleratedCompositingMode): This message was added only to prepare the
1037         redirected window when the web process was about to enter accelerated compositing mode, so it's no longer needed.
1038         (WebKit::DrawingAreaProxyImpl::setNativeSurfaceHandleForCompositing): This is now only used when building
1039         without redirected XComposite window support.
1040         * UIProcess/DrawingAreaProxyImpl.h:
1041         * UIProcess/PageClient.h:
1042         * UIProcess/WebPageProxy.cpp:
1043         (WebKit::WebPageProxy::willEnterAcceleratedCompositingMode): Deleted.
1044         * UIProcess/WebPageProxy.h:
1045         * UIProcess/efl/WebView.h:
1046         * UIProcess/gtk/RedirectedXCompositeWindow.cpp: Removed.
1047         * UIProcess/gtk/XDamageNotifier.cpp: Helper class to be notified about XDamage events.
1048         (WebKit::XDamageNotifier::singleton):
1049         (WebKit::XDamageNotifier::XDamageNotifier):
1050         (WebKit::XDamageNotifier::add):
1051         (WebKit::XDamageNotifier::remove):
1052         (WebKit::XDamageNotifier::filterXDamageEvent):
1053         (WebKit::XDamageNotifier::notify):
1054         * UIProcess/gtk/XDamageNotifier.h: Added.
1055         * UIProcess/ios/PageClientImplIOS.h:
1056         * UIProcess/ios/PageClientImplIOS.mm:
1057         (WebKit::PageClientImpl::willEnterAcceleratedCompositingMode): Deleted.
1058         * UIProcess/mac/PageClientImpl.h:
1059         * UIProcess/mac/PageClientImpl.mm:
1060         (WebKit::PageClientImpl::willEnterAcceleratedCompositingMode): Deleted.
1061         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
1062         (WebKit::AcceleratedDrawingArea::enterAcceleratedCompositingMode): Remove code to send
1063         WillEnterAcceleratedCompositingMode message.
1064         (WebKit::AcceleratedDrawingArea::setNativeSurfaceHandleForCompositing): This is now only used when building
1065         without redirected XComposite window support.
1066         * WebProcess/WebPage/AcceleratedDrawingArea.h:
1067         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp:
1068         (WebKit::ThreadedCoordinatedLayerTreeHost::ThreadedCoordinatedLayerTreeHost): Create a redirected window and
1069         pass the window ID as native surface handle to the threaded compositor. Use the redirected window pixmap as
1070         layer tree context.
1071         (WebKit::ThreadedCoordinatedLayerTreeHost::invalidate): Destroy the redirected window.
1072         (WebKit::ThreadedCoordinatedLayerTreeHost::deviceOrPageScaleFactorChanged): Resize the redirected window and
1073         update the layer tree context.
1074         (WebKit::ThreadedCoordinatedLayerTreeHost::sizeDidChange): Ditto.
1075         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h:
1076         * WebProcess/WebPage/DrawingArea.h:
1077         * WebProcess/WebPage/DrawingArea.messages.in:
1078         * WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp:
1079         (WebKit::LayerTreeHostGtk::LayerTreeHostGtk): Create a redirected window and texture mapper that uses the window
1080         ID as native surface handle. Use the redirected window pixmap as layer tree context.
1081         (WebKit::LayerTreeHostGtk::makeContextCurrent): Use the redirected window as native handle.
1082         (WebKit::LayerTreeHostGtk::invalidate): Destroy the redirected window.
1083         (WebKit::LayerTreeHostGtk::sizeDidChange): Resize the redirected window and update the layer tree context.
1084         (WebKit::LayerTreeHostGtk::deviceOrPageScaleFactorChanged): Ditto.
1085         (WebKit::LayerTreeHostGtk::createTextureMapper): Helper function to create the texture mapper.
1086         (WebKit::LayerTreeHostGtk::setNativeSurfaceHandleForCompositing): Use createTextureMapper().
1087         * WebProcess/WebPage/gtk/LayerTreeHostGtk.h:
1088         * WebProcess/WebPage/gtk/RedirectedXCompositeWindow.cpp: Added.
1089         (WebKit::RedirectedXCompositeWindow::create):
1090         (WebKit::RedirectedXCompositeWindow::RedirectedXCompositeWindow):
1091         (WebKit::RedirectedXCompositeWindow::~RedirectedXCompositeWindow):
1092         (WebKit::RedirectedXCompositeWindow::resize):
1093         * WebProcess/WebPage/gtk/RedirectedXCompositeWindow.h: Renamed from Source/WebKit2/UIProcess/gtk/RedirectedXCompositeWindow.h.
1094         (WebKit::RedirectedXCompositeWindow::window):
1095         (WebKit::RedirectedXCompositeWindow::pixmap):
1096
1097 2016-08-01  Carlos Garcia Campos  <cgarcia@igalia.com>
1098
1099         Database Process: ASSERTION FAILED: filePaths.size() == result.handles().size() with SANDBOX_EXTENSIONS disabled
1100         https://bugs.webkit.org/show_bug.cgi?id=160398
1101
1102         Reviewed by Brady Eidson.
1103
1104         Same assert as in bug #160188, but this time in preregisterSandboxExtensionsIfNecessary.
1105
1106         * DatabaseProcess/DatabaseProcess.cpp:
1107         * DatabaseProcess/DatabaseProcess.h:
1108         * DatabaseProcess/DatabaseProcess.messages.in:
1109         * DatabaseProcess/IndexedDB/WebIDBConnectionToClient.cpp:
1110         (WebKit::WebIDBConnectionToClient::handleGetResult):
1111         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1112         (WebKit::NetworkConnectionToWebProcess::preregisterSandboxExtensionsForOptionallyFileBackedBlob):
1113         * UIProcess/Databases/DatabaseProcessProxy.cpp:
1114         * UIProcess/Databases/DatabaseProcessProxy.h:
1115         * UIProcess/Databases/DatabaseProcessProxy.messages.in:
1116         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
1117         (WebKit::preregisterSandboxExtensionsIfNecessary):
1118
1119 2016-08-01  Alex Christensen  <achristensen@webkit.org>
1120
1121         _WKDownloadDelegate.didReceiveResponse should be called before decideDestinationWithSuggestedFilename
1122         https://bugs.webkit.org/show_bug.cgi?id=160437
1123         <rdar://problem/27578272>
1124
1125         Reviewed by Brady Eidson.
1126
1127         This preserves the behavior of the NSURLConnection/NSURLDownload code path.
1128         decideDestinationWithSuggestedFilename might need some information from the didReceiveResponse callback
1129         in order to decide what the suggested filename should be.
1130
1131         * NetworkProcess/Downloads/Download.cpp:
1132         (WebKit::Download::didReceiveAuthenticationChallenge):
1133         (WebKit::Download::didReceiveResponse):
1134         (WebKit::Download::didReceiveData):
1135         * NetworkProcess/Downloads/Download.h:
1136         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1137         (WebKit::NetworkConnectionToWebProcess::convertMainResourceLoadToDownload):
1138         * NetworkProcess/NetworkLoad.cpp:
1139         (WebKit::NetworkLoad::convertTaskToDownload):
1140         (WebKit::NetworkLoad::setPendingDownloadID):
1141         (WebKit::NetworkLoad::didReceiveResponseNetworkSession):
1142         * NetworkProcess/NetworkLoad.h:
1143         (WebKit::NetworkLoad::pendingDownloadID):
1144         * NetworkProcess/NetworkProcess.cpp:
1145         (WebKit::NetworkProcess::pendingDownloadCanceled):
1146         (WebKit::NetworkProcess::findPendingDownloadLocation):
1147         * NetworkProcess/NetworkProcess.h:
1148         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1149         (-[WKNetworkSessionDelegate URLSession:dataTask:didBecomeDownloadTask:]):
1150
1151 2016-07-31  Adrian Perez de Castro  <aperez@igalia.com>
1152
1153         [GTK][Unix] Implement missing WebKit::SharedMemory::create() function
1154         https://bugs.webkit.org/show_bug.cgi?id=160364
1155
1156         Reviewed by Carlos Garcia Campos.
1157
1158         The WebKit::SharedMemory::create() function is missing for the Unix
1159         platform, which is also used by the GTK+ port. The latter is going
1160         to need this in place to use the common content filtering code.
1161
1162         * Platform/unix/SharedMemoryUnix.cpp:
1163         (WebKit::accessModeMMap): Added helper function to convert a
1164         SharedMemory::Protection value into flags useable with mmap().
1165         (WebKit::SharedMemory::create): Added. Implementation reuses code
1166         existing in the SharedMemory::allocate() function.
1167         (WebKit::SharedMemory::allocate): Reimplemented in terms of
1168         SharedMemory::create().
1169
1170 2016-07-30  Dan Bernstein  <mitz@apple.com>
1171
1172         [Xcode] WebKit.framework is touched on incremental build even if nothing’s changed
1173         https://bugs.webkit.org/show_bug.cgi?id=160383
1174
1175         Reviewed by Tim Horton.
1176
1177         * WebKit2.xcodeproj/project.pbxproj: Removed the output files listed under the
1178           Copy iOS Sandbox Profiles for Manual Sandboxing script build phase, because it doesn’t
1179           produce those files on macOS. With no outputs listed, the script will still run every
1180           time, but the fact that it has run won’t trigger touching the framework.
1181
1182 2016-07-28  Ryosuke Niwa  <rniwa@webkit.org>
1183
1184         Crash with an Invalid Web Process IPC Message ID: WebPageProxy.AttributedStringForCharacterRangeCallback
1185         https://bugs.webkit.org/show_bug.cgi?id=160334
1186         <rdar://problem/27078089>
1187
1188         Reviewed by Alexey Proskuryakov.
1189
1190         The crash is most likely caused by an MESSAGE_CHECK failure in WebPageProxy::attributedStringForCharacterRangeCallback
1191         which marks the currently dispatching message was invalid inside the macro.
1192
1193         Make sure we never fail this check by sending an empty EditingRange in attributedSubstringForCharacterRangeAsync when
1194         the editing range we're about to send to the UIProcess is invalid in WebProcess.
1195
1196         Unfortunately, no new tests since we don't have any reproduction and I couldn't spot any code path in which we end up
1197         with an invalid EditingRage here with multiple inspection of the relevant code.
1198
1199         * WebProcess/WebPage/mac/WebPageMac.mm:
1200         (WebKit::WebPage::attributedSubstringForCharacterRangeAsync):
1201
1202 2016-07-28  Carlos Garcia Campos  <cgarcia@igalia.com>
1203
1204         Split calculateCacheSizes in two methods
1205         https://bugs.webkit.org/show_bug.cgi?id=160237
1206
1207         Reviewed by Darin Adler.
1208
1209         It's used to calculate memory and disk cache sizes, but only the web process is interested in memory caches, and
1210         the network process in disk cache. We can also avoid a lot of duplicated code between ports to set the cache model.
1211
1212         * NetworkProcess/NetworkProcess.cpp:
1213         (WebKit::NetworkProcess::setCacheModel): Use calculateURLCacheSizes to set the disk cache size and call
1214         platformSetURLCacheSize if not set to allow ports to setup platform specific cache.
1215         * NetworkProcess/NetworkProcess.h:
1216         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1217         (WebKit::NetworkProcess::platformSetURLCacheSize): Remove common code that is now in cross-platform file.
1218         (WebKit::volumeFreeSize): Deleted.
1219         (WebKit::NetworkProcess::platformSetCacheModel): Renamed to platformSetURLCacheSize().
1220         * NetworkProcess/soup/NetworkProcessSoup.cpp:
1221         (WebKit::NetworkProcess::platformSetURLCacheSize): Remove common code that is now in cross-platform file.
1222         (WebKit::getCacheDiskFreeSize): Deleted.
1223         (WebKit::NetworkProcess::platformSetCacheModel): Renamed to platformSetURLCacheSize().
1224         * Shared/CacheModel.cpp:
1225         (WebKit::calculateMemoryCacheSizes): Calculate the memory and page cache sizes.
1226         (WebKit::calculateURLCacheSizes): Calculate the disk cache size.
1227         (WebKit::calculateCacheSizes): Deleted.
1228         * Shared/CacheModel.h:
1229         * WebProcess/WebProcess.cpp:
1230         (WebKit::WebProcess): Tell the page cache to clear backing stores for GTK+ port too. This was done before when
1231         setting the cache model.
1232         (WebKit::WebProcess::setCacheModel): Use calculateMemoryCacheSizes to setup memory caches and call
1233         platformSetCacheModel to allow ports do more setup according to the cache model.
1234         (WebKit::WebProcess::clearResourceCaches): Deleted.
1235         * WebProcess/WebProcess.h:
1236         * WebProcess/cocoa/WebProcessCocoa.mm:
1237         (WebKit::WebProcess::platformSetCacheModel): Remove common code that is now in cross-platform file.
1238         (WebKit::volumeFreeSize): Deleted.
1239         (WebKit::WebProcess::platformClearResourceCaches): Deleted.
1240         * WebProcess/soup/WebProcessSoup.cpp:
1241         (WebKit::WebProcess::platformSetCacheModel): Remove common code that is now in cross-platform file.
1242         (WebKit::WebProcess::platformInitializeWebProcess):
1243         (WebKit::WebProcess::platformClearResourceCaches): Deleted.
1244
1245 2016-07-28  Carlos Garcia Campos  <cgarcia@igalia.com>
1246
1247         Database Process: ASSERTION FAILED: paths.size() == handles.size() with SANDBOX_EXTENSIONS disabled
1248         https://bugs.webkit.org/show_bug.cgi?id=160188
1249
1250         Reviewed by Sergio Villar Senin.
1251
1252         This happens in ports with sandbox extensions disabled, and it's making several tests to crash in debug
1253         builds. The SandboxExtension implementation is empty in case of building with sandbox extensions disabled, so
1254         that we are actually allocating no extensions at all in
1255         NetworkProcessProxy::grantSandboxExtensionsToDatabaseProcessForBlobs(). When the message arrives to database
1256         process, we have a list of paths, but an empty list of hanldes which causes the assertion. We can just avoid
1257         that message entirely in case of building without sandbox extensions.
1258
1259         * DatabaseProcess/DatabaseProcess.cpp:
1260         * DatabaseProcess/DatabaseProcess.h:
1261         * DatabaseProcess/DatabaseProcess.messages.in:
1262         * UIProcess/Network/NetworkProcessProxy.cpp:
1263         (WebKit::NetworkProcessProxy::grantSandboxExtensionsToDatabaseProcessForBlobs):
1264
1265 2016-07-28  Myles C. Maxfield  <mmaxfield@apple.com>
1266
1267         Remove deprecated SPI for video inline / fullscreen controls
1268         https://bugs.webkit.org/show_bug.cgi?id=160318
1269
1270         Reviewed by Tim Horton.
1271
1272         * Shared/WebPreferencesDefinitions.h:
1273         * UIProcess/API/C/WKPreferences.cpp:
1274         (WKPreferencesSetAllowsInlineMediaPlaybackWithPlaysInlineAttribute): Deleted.
1275         (WKPreferencesGetAllowsInlineMediaPlaybackWithPlaysInlineAttribute): Deleted.
1276         (WKPreferencesSetAllowsInlineMediaPlaybackWithWebKitPlaysInlineAttribute): Deleted.
1277         (WKPreferencesGetAllowsInlineMediaPlaybackWithWebKitPlaysInlineAttribute): Deleted.
1278         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1279         * UIProcess/API/Cocoa/WKWebView.mm:
1280         (-[WKWebView _initializeWithConfiguration:]): Deleted.
1281         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
1282         (-[WKWebViewConfiguration init]): Deleted.
1283         (-[WKWebViewConfiguration copyWithZone:]): Deleted.
1284         (-[WKWebViewConfiguration _allowsInlineMediaPlaybackWithPlaysInlineAttribute]): Deleted.
1285         (-[WKWebViewConfiguration _setAllowsInlineMediaPlaybackWithPlaysInlineAttribute:]): Deleted.
1286         (-[WKWebViewConfiguration _allowsInlineMediaPlaybackWithWebKitPlaysInlineAttribute]): Deleted.
1287         (-[WKWebViewConfiguration _setAllowsInlineMediaPlaybackWithWebKitPlaysInlineAttribute:]): Deleted.
1288         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
1289         * WebProcess/WebPage/WebPage.cpp:
1290         (WebKit::WebPage::updatePreferences): Deleted.
1291
1292 2016-07-28  Tim Horton  <timothy_horton@apple.com>
1293
1294         Frequent animation lags when interacting with Safari (sidebar, tab switching, etc.)
1295         https://bugs.webkit.org/show_bug.cgi?id=160289
1296         <rdar://problem/27553464>
1297
1298         Reviewed by Simon Fraser.
1299
1300         API Tests: WebKit2.AnimatedResizeDoesNotHang, WebKit2.ResizeWithHiddenContentDoesNotHang
1301
1302         * UIProcess/API/Cocoa/WKWebView.mm:
1303         (-[WKWebView _didCommitLayerTree:]):
1304         Avoid calling _endAnimatedResize when a commit comes in when we haven't yet received
1305         a dynamic viewport update reply (and thus don't have a transaction ID to wait on).
1306         Previously, in this case, _resizeAnimationTransformTransactionID would be 0,
1307         and *any* commit would cause _endAnimatedResize to be called, causing us to always
1308         fall into the worst-case sync wait.
1309         
1310         * UIProcess/ios/WebPageProxyIOS.mm:
1311         (WebKit::WebPageProxy::synchronizeDynamicViewportUpdate):
1312         Make use of waitForDidUpdateViewState instead of having a separate waitForAndDispatchImmediately
1313         here, because it knows to do things like dispatch the didUpdate message if it's still
1314         pending. This also shortens the sync wait timeout from 1s to 500ms, which makes it
1315         consistent with e.g. the newly-parented-view timeout duration, and should be nothing
1316         but positive.
1317
1318         * Platform/IPC/Connection.cpp:
1319         (IPC::Connection::timeoutRespectingIgnoreTimeoutsForTesting):
1320         (IPC::Connection::waitForMessage):
1321         (IPC::Connection::sendSyncMessageFromSecondaryThread):
1322         (IPC::Connection::waitForSyncReply):
1323         * Platform/IPC/Connection.h:
1324         (IPC::Connection::ignoreTimeoutsForTesting):
1325         * UIProcess/API/APIProcessPoolConfiguration.cpp:
1326         (API::ProcessPoolConfiguration::copy):
1327         * UIProcess/API/APIProcessPoolConfiguration.h:
1328         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
1329         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
1330         (-[_WKProcessPoolConfiguration ignoreSynchronousMessagingTimeoutsForTesting]):
1331         (-[_WKProcessPoolConfiguration setIgnoreSynchronousMessagingTimeoutsForTesting:]):
1332         * UIProcess/WebProcessPool.cpp:
1333         (WebKit::WebProcessPool::processDidFinishLaunching):
1334         Add a mechanism for clients to cause all synchronous message timeouts to be effectively infinite.
1335         The new API tests use this to ensure that the test will time out if they ever enter
1336         the bad state (otherwise, the shorter sync wait timeout could make the test still pass).
1337
1338 2016-07-27  Andy Estes  <aestes@apple.com>
1339
1340         [iOS] Add WKUIDelegate SPI for specifying that an attachment list is from a managed source
1341         https://bugs.webkit.org/show_bug.cgi?id=160280
1342         <rdar://problem/27471815>
1343
1344         Reviewed by Dan Bernstein.
1345
1346         * Platform/spi/ios/UIKitSPI.h: Declared
1347         UIPreviewItemTypeAttachment, UIPreviewDataAttachmentList, and UIPreviewDataAttachmentIndex.
1348         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: Declared -_attachmentListForWebView:sourceIsManaged:.
1349         * UIProcess/ios/WKContentViewInteraction.mm:
1350         (-[WKContentView _dataForPreviewItemController:atPosition:type:]): Used UIPreviewItemTypeAttachment,
1351         UIPreviewDataAttachmentList, and UIPreviewDataAttachmentIndex. If uiDelegate responds to
1352         -_attachmentListForWebView:sourceIsManaged:, called it instead of -_attachmentListForWebView:.
1353         Set sourceIsManaged as the value for the UIPreviewDataAttachmentListSourceIsManaged key in dataForPreview.
1354
1355 2016-07-27  Chelsea Pugh  <cpugh@apple.com>
1356
1357         [iOS] Remove unused textContentType SPI from _WKFormInputSession
1358         https://bugs.webkit.org/show_bug.cgi?id=160260
1359
1360         Reviewed by Dan Bernstein.
1361
1362         * UIProcess/API/Cocoa/_WKFormInputSession.h: Remove unused SPI.
1363
1364         * UIProcess/ios/WKContentViewInteraction.mm:
1365         (-[WKContentView textInputTraits]): Set textContentType of _traits to whatever we classify it as based
1366         on the assisted node info. The default textContentType is nil, and that is our fallback in our method
1367         for determining textContentType.
1368         (-[WKFormInputSession textContentType]): Deleted.
1369         (-[WKFormInputSession setTextContentType:]): Deleted.
1370
1371 2016-07-27  Chris Dumez  <cdumez@apple.com>
1372
1373         Fix m_isInBackground initialization for Safari View Services
1374         https://bugs.webkit.org/show_bug.cgi?id=160255
1375         <rdar://problem/27569255>
1376
1377         Reviewed by Tim Horton.
1378
1379         Fix m_isInBackground initialization for Safari View Services. The
1380         code was using m_applicationStateMonitor without initializing it.
1381         Instead, use the local applicationStateMonitor and make sure we
1382         invalidate it before it gets released.
1383
1384         * UIProcess/ApplicationStateTracker.mm:
1385         (WebKit::ApplicationStateTracker::ApplicationStateTracker):
1386
1387 2016-07-27  Carlos Garcia Campos  <cgarcia@igalia.com>
1388
1389         [Coordinated Graphics] Improve scheduling of tasks between threads in CoordinatedGraphicsScene
1390         https://bugs.webkit.org/show_bug.cgi?id=160238
1391
1392         Reviewed by Michael Catanzaro.
1393
1394         This patch makes the following improvements:
1395
1396          - Avoid scheduling tasks to the main thread if the scene is detached.
1397          - Do not take references when not actually sending tasks to another threads.
1398          - Use Function instead of std::function on dispatch methods.
1399          - Remove purgeBackingStores that is actually never called. It's only scheduled from purgeGLResources() that
1400            is always called after detach.
1401
1402         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
1403         (WebKit::CoordinatedGraphicsScene::dispatchOnMainThread):
1404         (WebKit::CoordinatedGraphicsScene::dispatchOnClientRunLoop):
1405         (WebKit::CoordinatedGraphicsScene::paintToCurrentGLContext):
1406         (WebKit::CoordinatedGraphicsScene::updateViewport):
1407         (WebKit::CoordinatedGraphicsScene::onNewBufferAvailable):
1408         (WebKit::CoordinatedGraphicsScene::commitSceneState):
1409         (WebKit::CoordinatedGraphicsScene::renderNextFrame):
1410         (WebKit::CoordinatedGraphicsScene::purgeGLResources):
1411         (WebKit::CoordinatedGraphicsScene::commitScrollOffset):
1412         (WebKit::CoordinatedGraphicsScene::detach):
1413         (WebKit::CoordinatedGraphicsScene::setActive):
1414         (WebKit::CoordinatedGraphicsScene::dispatchCommitScrollOffset): Deleted.
1415         (WebKit::CoordinatedGraphicsScene::purgeBackingStores): Deleted.
1416         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
1417         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
1418         (WebKit::ThreadedCompositor::purgeBackingStores): Deleted.
1419         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
1420         * UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.cpp:
1421         (WebKit::CoordinatedLayerTreeHostProxy::purgeBackingStores): Deleted.
1422         * UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.h:
1423         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
1424         (WebKit::CompositingCoordinator::invalidate):
1425         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
1426         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
1427         (WebKit::CoordinatedLayerTreeHost::invalidate):
1428         (WebKit::CoordinatedLayerTreeHost::purgeBackingStores): Deleted.
1429         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h:
1430         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.messages.in:
1431         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h:
1432
1433 2016-07-27  Carlos Garcia Campos  <cgarcia@igalia.com>
1434
1435         [GTK] Remove network setup from web process
1436         https://bugs.webkit.org/show_bug.cgi?id=160236
1437
1438         Reviewed by Michael Catanzaro.
1439
1440         We are still doing network init and finish in th web process. It's useless since we switched to mandatory
1441         network process.
1442
1443         * WebProcess/gtk/WebProcessMainGtk.cpp:
1444
1445 2016-07-27  Carlos Garcia Campos  <cgarcia@igalia.com>
1446
1447         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.13.4 release.
1448
1449         * gtk/NEWS: Add release notes for 2.13.4.
1450
1451 2016-07-26  Simon Fraser  <simon.fraser@apple.com>
1452
1453         Sort the project files.
1454
1455         * WebKit2.xcodeproj/project.pbxproj:
1456
1457 2016-07-26  Myles C. Maxfield  <mmaxfield@apple.com>
1458
1459         [iPhone] Playing a video on tudou.com plays only sound, no video
1460         https://bugs.webkit.org/show_bug.cgi?id=160178
1461         <rdar://problem/27535468>
1462
1463         Reviewed by Eric Carlson and Dan Bernstein.
1464
1465         * Shared/WebPreferencesDefinitions.h:
1466         * UIProcess/API/C/WKPreferences.cpp:
1467         (WKPreferencesSetInlineMediaPlaybackRequiresPlaysInlineAttribute):
1468         (WKPreferencesGetInlineMediaPlaybackRequiresPlaysInlineAttribute):
1469         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1470         * UIProcess/API/Cocoa/WKWebView.mm:
1471         (-[WKWebView _initializeWithConfiguration:]):
1472         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
1473         (-[WKWebViewConfiguration init]):
1474         (-[WKWebViewConfiguration copyWithZone:]):
1475         (-[WKWebViewConfiguration _inlineMediaPlaybackRequiresPlaysInlineAttribute]):
1476         (-[WKWebViewConfiguration _setInlineMediaPlaybackRequiresPlaysInlineAttribute:]):
1477         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
1478         * WebProcess/WebPage/WebPage.cpp:
1479         (WebKit::WebPage::updatePreferences):
1480
1481 2016-07-26  Alex Christensen  <achristensen@webkit.org>
1482
1483         Remove unused DownloadAuthenticationClient
1484         https://bugs.webkit.org/show_bug.cgi?id=160220
1485
1486         Reviewed by Darin Adler.
1487
1488         * CMakeLists.txt:
1489         * NetworkProcess/Downloads/Download.cpp:
1490         * NetworkProcess/Downloads/Download.h:
1491         * NetworkProcess/Downloads/DownloadAuthenticationClient.cpp: Removed.
1492         * NetworkProcess/Downloads/DownloadAuthenticationClient.h: Removed.
1493         * WebKit2.xcodeproj/project.pbxproj:
1494
1495 2016-07-26  Simon Fraser  <simon.fraser@apple.com>
1496
1497         Allow LOG macros to be used outside the namespace, and other logging cleanup
1498         https://bugs.webkit.org/show_bug.cgi?id=160216
1499
1500         Reviewed by Anders Carlsson.
1501
1502         Fix some issues with the LOG macros.
1503         
1504         First, they were not usable outside the WebKit namespace in WebKit2 code. Fix by moving
1505         its log channels outside of the namespace (they are protected by a unique prefix anyway).
1506         
1507         Second, allow LOG_WITH_STREAM to be used in WebKit2 by moving that and a helper macro
1508         into LogMacros.h, which is exported from WebCore as a private header.
1509         
1510         Third, split the Logging.h header into two. Logging.h remains for framework-internal
1511         log channels and log macros. Add LogInitialization.h which is external, and used to
1512         initialize the channels.
1513         
1514         Finally unify "initializeLogChannels" and "initializeLoggingChannels" terminology everywhere.
1515
1516         * NetworkProcess/NetworkProcess.cpp:
1517         * Platform/LogInitialization.h: Copied from Source/WebKit2/Platform/foundation/LoggingFoundation.mm.
1518         * Platform/Logging.cpp:
1519         (WebKit::initializeLogChannelsIfNecessary):
1520         * Platform/Logging.h:
1521         * Platform/foundation/LoggingFoundation.mm:
1522         * Shared/WebKit2Initialize.cpp:
1523         (WebKit::InitializeWebKit2):
1524         * UIProcess/API/Cocoa/WKWebView.mm:
1525         (-[WKWebView _updateContentRectsWithState:]):
1526         (-[WKWebView _navigationGestureDidBegin]):
1527         * UIProcess/WebProcessPool.cpp:
1528         (WebKit::m_hiddenPageThrottlingTimer):
1529         * WebKit2.xcodeproj/project.pbxproj:
1530
1531 2016-07-26  David Kilzer <ddkilzer@apple.com>
1532
1533         Networking process crash due to missing -[WebCoreAuthenticationClientAsChallengeSender performDefaultHandlingForAuthenticationChallenge:] implementation
1534         https://bugs.webkit.org/show_bug.cgi?id=156947
1535         <rdar://problem/23325160>
1536
1537         Reviewed by Alex Christensen.
1538
1539         * UIProcess/API/C/WKAuthenticationDecisionListener.cpp:
1540         (WKAuthenticationDecisionListenerRejectProtectionSpaceAndContinue): 
1541         * UIProcess/API/C/WKAuthenticationDecisionListener.h:
1542         Added new SPI for testing corresponding to calling the completion handler of
1543         WKWebView.didReceiveAuthenticationChallenge with NSURLSessionAuthChallengeRejectProtectionSpace.
1544
1545 2016-07-26  Anders Carlsson  <andersca@apple.com>
1546
1547         Payment session does not end if user closes all Safari windows
1548         https://bugs.webkit.org/show_bug.cgi?id=160213
1549         rdar://problem/27480873
1550
1551         Reviewed by Tim Horton.
1552
1553         Listen for the NSWindowWillCloseNotification of the sheet window and hide the payment UI when
1554         the sheet window is going to be closed.
1555
1556         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.h:
1557         * UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
1558         (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI):
1559         (WebKit::WebPaymentCoordinatorProxy::hidePaymentUI):
1560
1561 2016-07-26  Carlos Garcia Campos  <cgarcia@igalia.com>
1562
1563         [Threaded Compositor] ASSERTION FAILED: canAccessThreadLocalDataForThread(m_thread) after r203718
1564         https://bugs.webkit.org/show_bug.cgi?id=160201
1565
1566         Reviewed by Michael Catanzaro.
1567
1568         I forgot to call purgeGLResources() before invalidating the scene in the compositing thread.
1569
1570         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
1571         (WebKit::ThreadedCompositor::invalidate):
1572
1573 2016-07-26  Enrica Casucci  <enrica@apple.com>
1574
1575         Support configurable autocapitalization.
1576         https://bugs.webkit.org/show_bug.cgi?id=158860
1577         rdar://problem/27536113
1578
1579         Reviewed by Tim Horton.
1580
1581         Autocapitalization should be enabled/disabled regardless of whether
1582         we are using advance spelling feature.
1583
1584         * UIProcess/mac/TextCheckerMac.mm:
1585         (WebKit::TextChecker::checkTextOfParagraph):
1586         (WebKit::TextChecker::getGuessesForWord):
1587
1588
1589 2016-07-26  Carlos Garcia Campos  <cgarcia@igalia.com>
1590
1591         [Coordinated Graphics] Test fast/fixed-layout/fixed-layout.html crashes in debug
1592         https://bugs.webkit.org/show_bug.cgi?id=160117
1593
1594         Reviewed by Michael Catanzaro.
1595
1596         The problem is that WebPage has its own m_useFixedLayout that is only updated when changed from the UI
1597         process. However, layout tests doing internals.setUseFixedLayout() change the frame view directly, and the
1598         WebPage doesn't notice it.
1599
1600         * WebProcess/WebPage/WebPage.cpp:
1601         (WebKit::WebPage::setFixedVisibleContentRect): Deleted.
1602         (WebKit::WebPage::sendViewportAttributesChanged): Change the assert to check the main FrameView is in fixed
1603         layout mode.
1604         * WebProcess/WebPage/WebPage.h:
1605
1606 2016-07-26  Carlos Garcia Campos  <cgarcia@igalia.com>
1607
1608         [Threaded Compositor] ASSERTION FAILED: isMainThread() when ThreadedCompositor is destroyed since r203718
1609         https://bugs.webkit.org/show_bug.cgi?id=160197
1610
1611         Reviewed by Žan Doberšek.
1612
1613         ThreadedCompositor can be destroyed from a secondary thread, for example, when a task takes a reference and the
1614         main threads derefs it, when the task finishes in the secondary thread the lambda ends up deleting the threaded
1615         compositor. This is ok for the Threaded compositor but not for the CompositingRunLoop class. this was not a
1616         problem before r203718 because the CompositingRunLoop object was created and destroyed in the same thread
1617         always, but now it's part of the ThreadedCompositor class. This patch uses std:unique_ptr again to explicitly
1618         create the CompositingRunLoop in the ThreadedCompositor constructor and delete in the invalidate() method to
1619         make sure it happens in the main thread in both cases.
1620
1621         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:
1622         (WebKit::WorkQueuePool::invalidate):
1623         (WebKit::WorkQueuePool::getOrCreateWorkQueueForContext):
1624         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.h:
1625         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
1626         (WebKit::ThreadedCompositor::ThreadedCompositor):
1627         (WebKit::ThreadedCompositor::invalidate):
1628         (WebKit::ThreadedCompositor::setNativeSurfaceHandleForCompositing):
1629         (WebKit::ThreadedCompositor::setDeviceScaleFactor):
1630         (WebKit::ThreadedCompositor::setDrawsBackground):
1631         (WebKit::ThreadedCompositor::didChangeViewportSize):
1632         (WebKit::ThreadedCompositor::didChangeViewportAttribute):
1633         (WebKit::ThreadedCompositor::didChangeContentsSize):
1634         (WebKit::ThreadedCompositor::scrollTo):
1635         (WebKit::ThreadedCompositor::scrollBy):
1636         (WebKit::ThreadedCompositor::updateViewport):
1637         (WebKit::ThreadedCompositor::scheduleDisplayImmediately):
1638         (WebKit::ThreadedCompositor::forceRepaint):
1639         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
1640
1641 2016-07-26  Youenn Fablet  <youenn@apple.com>
1642
1643         Remove ClientCredentialPolicy cross-origin option from ResourceLoaderOptions
1644         https://bugs.webkit.org/show_bug.cgi?id=159413
1645
1646         Reviewed by Alex Christensen.
1647
1648         Renaming of ClientCredentialPolicy values.
1649
1650         * NetworkProcess/Downloads/DownloadManager.cpp:
1651         (WebKit::DownloadManager::startDownload):
1652         * NetworkProcess/NetworkLoad.cpp:
1653         (WebKit::NetworkLoad::continueCanAuthenticateAgainstProtectionSpace):
1654         (WebKit::NetworkLoad::didReceiveAuthenticationChallenge):
1655         * NetworkProcess/NetworkLoadParameters.h:
1656         * NetworkProcess/NetworkResourceLoadParameters.cpp:
1657         (WebKit::NetworkResourceLoadParameters::NetworkResourceLoadParameters):
1658         * NetworkProcess/NetworkResourceLoader.cpp:
1659         (WebKit::NetworkResourceLoader::NetworkResourceLoader):
1660         * WebProcess/Network/WebLoaderStrategy.cpp:
1661         (WebKit::WebLoaderStrategy::scheduleLoad):
1662         * WebProcess/Network/WebResourceLoader.cpp:
1663         (WebKit::WebResourceLoader::willSendRequest):
1664
1665 2016-07-26  Carlos Garcia Campos  <cgarcia@igalia.com>
1666
1667         [Threaded Compositor] Crashes and deadlocks in single web process mode
1668         https://bugs.webkit.org/show_bug.cgi?id=160160
1669
1670         Reviewed by Žan Doberšek.
1671
1672         Every WebPage has its own threaded compositor that runs its own compositing thread. That means that when there's
1673         more than one WebPage in the same process, we are running OpenGL stuff in different secondary threads. That's
1674         causing crashes and deadlocks in X and graphics drivers. We should ensure there's a single compositing thread
1675         per process when multiple threads is not supported. This is causing unit test
1676         WebKit2.WKPageGetScaleFactorNotZero to time out since we switched to the threaded compositor. That test is
1677         creating two pages in the same web process, and most of the times the web process crashes or deadlocks causing
1678         the test to never finish and time out.
1679         This patch makes CompositingRunLoop use a thread pool that spawns the compositing threads and schedules the tasks
1680         there.
1681
1682         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:
1683         (WebKit::WorkQueuePool::singleton):
1684         (WebKit::WorkQueuePool::dispatch):
1685         (WebKit::WorkQueuePool::runLoop):
1686         (WebKit::WorkQueuePool::invalidate):
1687         (WebKit::WorkQueuePool::WorkQueuePool):
1688         (WebKit::WorkQueuePool::getOrCreateWorkQueueForContext):
1689         (WebKit::CompositingRunLoop::CompositingRunLoop):
1690         (WebKit::CompositingRunLoop::~CompositingRunLoop):
1691         (WebKit::CompositingRunLoop::performTask):
1692         (WebKit::CompositingRunLoop::performTaskSync):
1693         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.h:
1694         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
1695         (WebKit::ThreadedCompositor::ThreadedCompositor):
1696         (WebKit::ThreadedCompositor::invalidate):
1697         (WebKit::ThreadedCompositor::setNativeSurfaceHandleForCompositing):
1698         (WebKit::ThreadedCompositor::setDeviceScaleFactor):
1699         (WebKit::ThreadedCompositor::setDrawsBackground):
1700         (WebKit::ThreadedCompositor::didChangeViewportSize):
1701         (WebKit::ThreadedCompositor::didChangeViewportAttribute):
1702         (WebKit::ThreadedCompositor::didChangeContentsSize):
1703         (WebKit::ThreadedCompositor::scrollTo):
1704         (WebKit::ThreadedCompositor::scrollBy):
1705         (WebKit::ThreadedCompositor::purgeBackingStores):
1706         (WebKit::ThreadedCompositor::renderNextFrame):
1707         (WebKit::ThreadedCompositor::commitScrollOffset):
1708         (WebKit::ThreadedCompositor::updateViewport):
1709         (WebKit::ThreadedCompositor::scheduleDisplayImmediately):
1710         (WebKit::ThreadedCompositor::forceRepaint):
1711         (WebKit::ThreadedCompositor::tryEnsureGLContext): Deleted.
1712         (WebKit::ThreadedCompositor::glContext): Deleted.
1713         (WebKit::ThreadedCompositor::updateSceneState): Deleted.
1714         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
1715
1716 2016-07-25  Sam Weinig  <sam@webkit.org>
1717
1718         Fix assertion.
1719
1720         * NetworkProcess/cache/NetworkCacheCodersCocoa.cpp:
1721         (WebKit::NetworkCache::encodeCertificateChain):
1722
1723 2016-07-25  Sam Weinig  <sam@webkit.org>
1724
1725         Split platform specific parts of NetworkCacheCoders.cpp into separate files
1726         https://bugs.webkit.org/show_bug.cgi?id=160151
1727
1728         Reviewed by Alex Christensen.
1729
1730         * NetworkProcess/cache/NetworkCacheCoders.cpp:
1731         (WebKit::NetworkCache::Coder<WebCore::CertificateInfo>::encode): Deleted.
1732         (WebKit::NetworkCache::Coder<WebCore::CertificateInfo>::decode): Deleted.
1733         * NetworkProcess/cache/NetworkCacheCodersCocoa.cpp: Copied from Source/WebKit2/NetworkProcess/cache/NetworkCacheCoders.cpp.
1734         (WebKit::NetworkCache::encodeCFData): Moved.
1735         (WebKit::NetworkCache::decodeCFData): Moved.
1736         (WebKit::NetworkCache::encodeSecTrustRef): Moved.
1737         (WebKit::NetworkCache::decodeSecTrustRef): Moved.
1738         (WebKit::NetworkCache::encodeCertificateChain): Moved.
1739         (WebKit::NetworkCache::decodeCertificateChain): Moved.
1740         (WebKit::NetworkCache::Coder<WebCore::CertificateInfo>::encode): Moved.
1741         (WebKit::NetworkCache::Coder<WebCore::CertificateInfo>::decode): Moved.
1742         * NetworkProcess/cache/NetworkCacheCodersSoup.cpp: Copied from Source/WebKit2/NetworkProcess/cache/NetworkCacheCoders.cpp.
1743         (WebKit::NetworkCache::Coder<WebCore::CertificateInfo>::encode): Moved.
1744         (WebKit::NetworkCache::Coder<WebCore::CertificateInfo>::decode): Moved.
1745
1746         * PlatformGTK.cmake:
1747         * PlatformMac.cmake:
1748         * WebKit2.xcodeproj/project.pbxproj:
1749         Add new files.
1750
1751 2016-07-25  Chris Dumez  <cdumez@apple.com>
1752
1753         [iOS] Make sure we call the ProcessAssertion invalidation handler on the main thread
1754         https://bugs.webkit.org/show_bug.cgi?id=160140
1755         <rdar://problem/27399998>
1756
1757         Reviewed by Darin Adler.
1758
1759         Based on crash traces, it appears BKSProcessAssertion is calling our
1760         invalidation handler on a background thread. This was not anticipated
1761         and therefore, this would lead to thread safety issues and crashes.
1762
1763         We now make sure to call our invalidation handler on the main thread.
1764         We also use a WeakPtr to ensure that the ProcessAssertion is still
1765         alive once on the main thread and before calling the invalidation
1766         handler.
1767
1768         * UIProcess/ProcessAssertion.cpp:
1769         (WebKit::ProcessAssertion::ProcessAssertion):
1770         * UIProcess/ProcessAssertion.h:
1771         (WebKit::ProcessAssertion::ProcessAssertion):
1772         (WebKit::ProcessAssertion::createWeakPtr):
1773         * UIProcess/ios/ProcessAssertionIOS.mm:
1774         (WebKit::ProcessAssertion::ProcessAssertion):
1775         (WebKit::ProcessAssertion::markAsInvalidated):
1776
1777 2016-07-24  Carlos Garcia Campos  <cgarcia@igalia.com>
1778
1779         [GTK][Threaded Compositor] ASSERTION FAILED: !!handle ^ !!m_nativeSurfaceHandle with several layout tests
1780         https://bugs.webkit.org/show_bug.cgi?id=160143
1781
1782         Reviewed by Michael Catanzaro.
1783
1784         We have a message to set the native surface handle and another one for destroying it, the former is a normal
1785         message while the latter is sync. This assertion happens if the web view is realized before the web process is
1786         launched. This is the sequence:
1787
1788         1.- DrawingAreaProxyImpl sends SetNativeSurfaceHandleForCompositing message to the web process, since the
1789         process hasn't been launched yet, the message is queued.
1790         2.- Web process is launched and queued messages are now sent to the web process.
1791         3.- The page is closed right after the web process is launched, and DrawingAreaProxyImpl sends
1792         DestroyNativeSurfaceHandleForCompositing to the web process.
1793         4.- The web process processes incoming messages, and DestroyNativeSurfaceHandleForCompositing is processed before
1794         SetNativeSurfaceHandleForCompositing because it's sync.
1795         5.- The web process processes SetNativeSurfaceHandleForCompositing message.
1796
1797         This is not only producing the assertion, it's also setting a handle for a X window already destroyed in the UI
1798         process, so this could be producing the X errors we have seen in other tests. So, we need to make sure
1799         SetNativeSurfaceHandleForCompositing and DestroyNativeSurfaceHandleForCompositing are handled in order by the
1800         web process. We could make SetNativeSurfaceHandleForCompositing sync as well, but sync messages are just ignored
1801         when sent before the web process has been launched (only normal messages are queued for obvious reasons). The
1802         other option is sending the SetNativeSurfaceHandleForCompositing message with the
1803         IPC::DispatchMessageEvenWhenWaitingForSyncReply flag. In this case the message is queued and dispatched on
1804         process launch, but it's dispatched before other messages also queued without that flag, like
1805         CreateWebPage. Since there's no WebPage the web process doesn't find a valid message receiver for it and
1806         it's discarded. We need to ensure the DrawinArea object has been created before sending the
1807         SetNativeSurfaceHandleForCompositing with the PC::DispatchMessageEvenWhenWaitingForSyncReply flag.
1808
1809         * UIProcess/DrawingAreaProxyImpl.cpp:
1810         (WebKit::DrawingAreaProxyImpl::didUpdateBackingStoreState): If we have received the first update and there's a
1811         SetNativeSurfaceHandleForCompositing message pending, send it.
1812         (WebKit::DrawingAreaProxyImpl::setNativeSurfaceHandleForCompositing): Do not send the message before the first
1813         update is received.
1814         (WebKit::DrawingAreaProxyImpl::destroyNativeSurfaceHandleForCompositing): If there was a
1815         SetNativeSurfaceHandleForCompositing message pending, just ignore this destroy since the web process never
1816         received the handle.
1817         * UIProcess/DrawingAreaProxyImpl.h:
1818
1819 2016-07-25  Philippe Normand  <pnormand@igalia.com>
1820
1821         Improve GDB backtrace generation for GTK/EFL
1822         https://bugs.webkit.org/show_bug.cgi?id=128928
1823
1824         Reviewed by Carlos Garcia Campos.
1825
1826         Move the Web, Database and Network ProcessIdentifier functions to
1827         the cross-platform WKContext and WKPage implementations.
1828
1829         * UIProcess/API/C/WKContext.cpp:
1830         (WKContextGetNetworkProcessIdentifier):
1831         (WKContextGetDatabaseProcessIdentifier):
1832         * UIProcess/API/C/WKContextPrivate.h:
1833         * UIProcess/API/C/WKPage.cpp:
1834         (WKPageGetProcessIdentifier):
1835         * UIProcess/API/C/WKPagePrivate.h:
1836         * UIProcess/API/C/mac/WKContextPrivateMac.h:
1837         * UIProcess/API/C/mac/WKContextPrivateMac.mm:
1838         * UIProcess/API/C/mac/WKPagePrivateMac.h:
1839         * UIProcess/API/C/mac/WKPagePrivateMac.mm:
1840
1841 2016-07-24  Sam Weinig  <sam@webkit.org>
1842
1843         Add specialization for encoding/decoding WebCore::CertificateInfos in the Network Cache
1844         <rdar://problem/27409315>
1845         https://bugs.webkit.org/show_bug.cgi?id=160144
1846
1847         Reviewed by Chris Dumez.
1848
1849         * NetworkProcess/cache/NetworkCacheCoders.cpp:
1850         (WebKit::NetworkCache::encodeCFData):
1851         (WebKit::NetworkCache::decodeCFData):
1852         (WebKit::NetworkCache::encodeSecTrustRef):
1853         (WebKit::NetworkCache::decodeSecTrustRef):
1854         (WebKit::NetworkCache::encodeCertificateChain):
1855         (WebKit::NetworkCache::decodeCertificateChain):
1856         (WebKit::NetworkCache::Coder<WebCore::CertificateInfo>::encode):
1857         (WebKit::NetworkCache::Coder<WebCore::CertificateInfo>::decode):
1858
1859         * NetworkProcess/cache/NetworkCacheStorage.h:
1860         (WebKit::NetworkCache::Storage::version):
1861         Bump the version and lastStableVersion to account for the format change.
1862
1863 2016-07-22  Joseph Pecoraro  <pecoraro@apple.com>
1864
1865         Web Automation: All key events should be processed before sending response
1866         https://bugs.webkit.org/show_bug.cgi?id=160114
1867         <rdar://problem/27505943>
1868
1869         Reviewed by Darin Adler.
1870
1871         When evaluating performKeyboardInteractions, we were sending all
1872         NSEvents synchronously, but because WebPageProxy was doing its
1873         own queueing and asynchronous processing of those key events, we
1874         would receive and respond to the next Automation command before
1875         having completed all of the key events.
1876
1877         This change makes performKeyboardInteractions asynchronous. It
1878         will be notified only after WebPageProxy has exhausted its queue
1879         of key events.
1880
1881         * UIProcess/Automation/Automation.json:
1882         * UIProcess/Automation/WebAutomationSession.cpp:
1883         (WebKit::WebAutomationSession::keyboardEventsFlushedForPage):
1884         (WebKit::WebAutomationSession::evaluateJavaScriptFunction):
1885         (WebKit::WebAutomationSession::performKeyboardInteractions):
1886         * UIProcess/Automation/WebAutomationSession.h:
1887         * UIProcess/WebPageProxy.cpp:
1888         (WebKit::WebPageProxy::didReceiveEvent):
1889
1890 2016-07-22  Joseph Pecoraro  <pecoraro@apple.com>
1891
1892         Web Automation: WebAutomationSession::deleteAllCookies never calls callback, hangs automation session
1893         https://bugs.webkit.org/show_bug.cgi?id=160113
1894         <rdar://problem/27308124>
1895
1896         Reviewed by Darin Adler.
1897
1898         Delete all cookies appears to be a straightforward action
1899         where we don't need to wait for a callback. So drop the
1900         async altogether and implicitly complete the action.
1901
1902         * UIProcess/Automation/Automation.json:
1903         * UIProcess/Automation/WebAutomationSession.cpp:
1904         (WebKit::WebAutomationSession::deleteAllCookies):
1905         * UIProcess/Automation/WebAutomationSession.h:
1906
1907 2016-07-22  Zalan Bujtas  <zalan@apple.com>
1908
1909         Handle cases when IOSurface initialization fails.
1910         https://bugs.webkit.org/show_bug.cgi?id=160006
1911         <rdar://problem/27495102>
1912
1913         Reviewed by Tim Horton and Simon Fraser.
1914
1915         This is an additional fix to r203514 to check if IOSurface initialization was successful.
1916
1917         Unable to test.
1918
1919         * Shared/mac/RemoteLayerBackingStore.mm:
1920         (WebKit::RemoteLayerBackingStore::encode):
1921         (WebKit::RemoteLayerBackingStore::display):
1922         (WebKit::RemoteLayerBackingStore::applyBackingStoreToLayer):
1923         * UIProcess/API/Cocoa/WKWebView.mm:
1924         (-[WKWebView _takeViewSnapshot]):
1925         (-[WKWebView _snapshotRect:intoImageOfWidth:completionHandler:]):
1926
1927 2016-07-22  Chelsea Pugh  <cpugh@apple.com>
1928
1929         [iOS] Clients should be able to decide if they want secure text entry in a form field
1930         https://bugs.webkit.org/show_bug.cgi?id=160109
1931         rdar://problem/27504958
1932
1933         Reviewed by Dan Bernstein.
1934
1935         * UIProcess/API/Cocoa/_WKFormInputSession.h:
1936         * UIProcess/ios/WKContentViewInteraction.mm:
1937         (-[WKFormInputSession forceSecureTextEntry]): Getter.
1938         (-[WKFormInputSession setForceSecureTextEntry:]): Setter.
1939         (-[WKContentView textInputTraits]): If the form input session has specified that secure text
1940         entry is desired, we should use secure text entry.
1941
1942 2016-07-22  Anders Carlsson  <andersca@apple.com>
1943
1944         Get rid of an unused API typedef
1945         https://bugs.webkit.org/show_bug.cgi?id=160103
1946
1947         Reviewed by Sam Weinig.
1948
1949         * Shared/API/c/WKSharedAPICast.h:
1950
1951 2016-07-22  Dan Bernstein  <mitz@apple.com>
1952
1953         run-safari doesn't work with Safari 10 on 10.11
1954         https://bugs.webkit.org/show_bug.cgi?id=159958
1955         <rdar://problem/27422805>
1956
1957         Reviewed by Alexey Proskuryakov.
1958
1959         Safari’s injected bundle may depend on the newer versions of frameworks installed in a
1960         staging location. Have the engineering builds of the Web Content service look for newer
1961         versions in that location.
1962
1963         * Configurations/BaseTarget.xcconfig: Shortened a linker flag.
1964
1965         * Configurations/BaseXPCService.xcconfig: Increased Mach-O header padding in production
1966           builds to allow for more dyld environment commands to be added after the fact.
1967
1968         * Configurations/DebugRelease.xcconfig: Have the new
1969           WK_WEBCONTENT_SERVICE_NEEDS_VERSIONED_FRAMEWORK_PATH_LDFLAG set to YES for macOS
1970           engineering builds.
1971
1972         * Configurations/WebContentService.xcconfig: Include the versioned frameworks whenever
1973           WK_WEBCONTENT_SERVICE_NEEDS_VERSIONED_FRAMEWORK_PATH_LDFLAG is set to YES. Have the
1974           value of WK_WEBCONTENT_SERVICE_NEEDS_VERSIONED_FRAMEWORK_PATH_LDFLAG default to
1975           the value of USE_STAGING_INSTALL_PATH, while letting DebugRelease.xcconfig override it.
1976
1977 2016-07-21  Myles C. Maxfield  <mmaxfield@apple.com>
1978
1979         Remove support for deprecated SPI inlineMediaPlaybackRequiresPlaysInlineAttribute
1980         https://bugs.webkit.org/show_bug.cgi?id=160066
1981
1982         Reviewed by Dean Jackson.
1983
1984         * Shared/WebPreferencesDefinitions.h:
1985         * UIProcess/API/C/WKPreferences.cpp:
1986         (WKPreferencesSetInlineMediaPlaybackRequiresPlaysInlineAttribute): Deleted.
1987         (WKPreferencesGetInlineMediaPlaybackRequiresPlaysInlineAttribute): Deleted.
1988         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1989         * UIProcess/API/Cocoa/WKWebView.mm:
1990         (-[WKWebView _initializeWithConfiguration:]): Deleted.
1991         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
1992         (-[WKWebViewConfiguration init]): Deleted.
1993         (-[WKWebViewConfiguration copyWithZone:]): Deleted.
1994         (-[WKWebViewConfiguration _inlineMediaPlaybackRequiresPlaysInlineAttribute]): Deleted.
1995         (-[WKWebViewConfiguration _setInlineMediaPlaybackRequiresPlaysInlineAttribute:]): Deleted.
1996         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
1997         * WebProcess/WebPage/WebPage.cpp:
1998         (WebKit::WebPage::updatePreferences): Deleted.
1999
2000 2016-07-21  Chelsea Pugh  <cpugh@apple.com>
2001
2002         [iOS] Apps using WKWebView will crash if they set the scroll view's delegate and don't nil it out later
2003         https://bugs.webkit.org/show_bug.cgi?id=159980
2004         rdar://problem/27450825
2005
2006         Reviewed by Dan Bernstein.
2007
2008         The root cause of this crash is that we are not abiding the UIScrollView API that the scroll view
2009         delegate property should be weak. If setters of this delegate do not know that, since the WKWebView
2010         exposes the scroll view as a UIScrollView, they may forget to nil out the delegate they set and will
2011         then crash.
2012
2013         * UIProcess/ios/WKScrollView.mm:
2014         (-[WKScrollViewDelegateForwarder methodSignatureForSelector:]): Get a RetainPtr holding the
2015         external delegate and use where needed.
2016         (-[WKScrollViewDelegateForwarder respondsToSelector:]): Ditto.
2017         (-[WKScrollViewDelegateForwarder forwardInvocation:]): Ditto.
2018         (-[WKScrollViewDelegateForwarder forwardingTargetForSelector:]): Ditto. When returning a reference
2019         to the external delegate, get a retained and autoreleased reference so the caller needn't release
2020         the object when done.
2021         (-[WKScrollView delegate]): Ditto.
2022         (-[WKScrollView _updateDelegate]): Get a RetainPtr holding the external delegate that can be
2023         used throughout this method. Use the RetainPtr to get the external delegate for setting super's
2024         delegate as well as creating the delegate forwarder.
2025         (-[WKScrollView setDelegate:]): Get a RetainPtr holding the external delegate and use its value for
2026         comparison to the object we are setting the external delegate to.
2027
2028 2016-07-21  Myles C. Maxfield  <mmaxfield@apple.com>
2029
2030         [iPhone] Playing a video on tudou.com plays only sound, no video
2031         https://bugs.webkit.org/show_bug.cgi?id=159967
2032         <rdar://problem/26964090>
2033
2034         Reviewed by Jon Lee, Jeremy Jones, and Anders Carlsson.
2035
2036         Add the two preferences to WKWebViewConfiguration and WKPreferences to cover both
2037         the Obj-C API and the C SPI.
2038
2039         * Shared/WebPreferencesDefinitions.h:
2040         * UIProcess/API/C/WKPreferences.cpp:
2041         (WKPreferencesSetAllowsInlineMediaPlaybackWithPlaysInlineAttribute):
2042         (WKPreferencesGetAllowsInlineMediaPlaybackWithPlaysInlineAttribute):
2043         (WKPreferencesSetAllowsInlineMediaPlaybackWithWebKitPlaysInlineAttribute):
2044         (WKPreferencesGetAllowsInlineMediaPlaybackWithWebKitPlaysInlineAttribute):
2045         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2046         * UIProcess/API/Cocoa/WKWebView.mm:
2047         (-[WKWebView _initializeWithConfiguration:]):
2048         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2049         (-[WKWebViewConfiguration init]):
2050         (-[WKWebViewConfiguration copyWithZone:]):
2051         (-[WKWebViewConfiguration _allowsInlineMediaPlaybackWithPlaysInlineAttribute]):
2052         (-[WKWebViewConfiguration _setAllowsInlineMediaPlaybackWithPlaysInlineAttribute:]):
2053         (-[WKWebViewConfiguration _allowsInlineMediaPlaybackWithWebKitPlaysInlineAttribute]):
2054         (-[WKWebViewConfiguration _setAllowsInlineMediaPlaybackWithWebKitPlaysInlineAttribute:]):
2055         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
2056         * WebProcess/WebPage/WebPage.cpp:
2057         (WebKit::WebPage::updatePreferences):
2058
2059 2016-07-21  Yongjun Zhang  <yongjun_zhang@apple.com>
2060
2061         WebBackForwardList's currentIndex could get out of bounds when filtering items.
2062         https://bugs.webkit.org/show_bug.cgi?id=159986
2063
2064         When generating a new BackForwardListState object, if we filter out multiple items in the list, the currentIndex could get
2065         out of bounds.
2066
2067         Reviewed by Dan Bernstein.
2068
2069         * UIProcess/WebBackForwardList.cpp:
2070         (WebKit::WebBackForwardList::backForwardListState): Make currentIndex point to the last item if it is out of bounds.
2071
2072 2016-07-21  Joseph Pecoraro  <pecoraro@apple.com>
2073
2074         Web Automation: Allow JavaScript evaluation to return an InvalidElementState error
2075         https://bugs.webkit.org/show_bug.cgi?id=160015
2076         <rdar://problem/27434529>
2077
2078         Reviewed by Brian Burg.
2079
2080         * UIProcess/Automation/Automation.json:
2081         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
2082         (WebKit::WebAutomationSessionProxy::evaluateJavaScriptFunction):
2083
2084 2016-07-21  Carlos Garcia Campos  <cgarcia@igalia.com>
2085
2086         [GTK][Threaded Compositor] WTR generates fully white images for pixel tests most of the time
2087         https://bugs.webkit.org/show_bug.cgi?id=160016
2088
2089         Reviewed by Žan Doberšek.
2090
2091         WTR sends a force repaint message to the web process before taking a snapshot of the web view. With the threaded
2092         compositor, the UI process is notified about the force repaint callback before the contents have been actually
2093         painted. We need to ensure that the contents are rendered before the UI process is notified.
2094
2095         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
2096         (WebKit::ThreadedCompositor::forceRepaint): Synchronously render the layer tree.
2097         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
2098         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
2099         (webkitWebViewRenderAcceleratedCompositingResults): Always mark the redirected window surface as dirty before
2100         rendering, since it can be modified by the web process at any time.
2101         * UIProcess/gtk/RedirectedXCompositeWindow.cpp:
2102         (WebKit::XDamageNotifier::add):
2103         (WebKit::RedirectedXCompositeWindow::RedirectedXCompositeWindow): Do not mark the surface as dirty on every
2104         damage since the view will do it before rendering.
2105         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp:
2106         (WebKit::ThreadedCoordinatedLayerTreeHost::forceRepaint): Call ThreadedCompositor::forceRepaint().
2107         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h:
2108
2109 2016-07-21  Carlos Garcia Campos  <cgarcia@igalia.com>
2110
2111         [GTK] White page when loaded tab is visited until it's hovered when AC mode is always on
2112         https://bugs.webkit.org/show_bug.cgi?id=159512
2113
2114         Reviewed by Michael Catanzaro.
2115
2116         The redirected window is always mapped, but offscreen, to ensure that the web process can always render
2117         there. When the web process renders something into the offscreen window, we receive a damage event in the UI
2118         process and queue a redraw of the web view. However, when the web view is not mapped, even if we still receive
2119         the damage events, the web view redraws are ignored until the view is mapped again (gtk_widget_queue_draw()
2120         returns early when the widget is not visible). The redirected window updates its pixmap on demand when the
2121         surface is requested, which happens when the web view draws its contents. So when the web view becames visible,
2122         the redirected window creates a new pixmap and surface (the first time or if the web view was resized), that we
2123         initialize to avoid artifacts when the web process hasn't render anything yet. That initialization is actually
2124         overwriting anything rendered into the redirected window while the view was unmapped. That's why see white pages
2125         the first time, and previous contents after a resize, and we don't see the actual contents until the web process
2126         renders again and we reuse the existing pixmap. The white page didn't happen for tabs with accelerated content,
2127         because in those cases the web process was rendering a new frame every 16ms, but instead there was a flickering
2128         effect due to the current frame being overwritten when the view is mapped until the next frame.
2129         So, instead of lazily create and initialize the redirected window pixmap and surface, we should always create
2130         the new pixmap as soon as the window is created or resized (and not empty) This fixes the issues but also makes
2131         resizing the window a bit smoother when AC mode is enabled.
2132
2133         * UIProcess/gtk/RedirectedXCompositeWindow.cpp:
2134         (WebKit::RedirectedXCompositeWindow::RedirectedXCompositeWindow): Create the pixmap and surface if the window is
2135         not empty.
2136         (WebKit::RedirectedXCompositeWindow::resize): Ditto.
2137         (WebKit::RedirectedXCompositeWindow::createNewPixampAndPixampSurface): Create the pixmap and surface.
2138         (WebKit::RedirectedXCompositeWindow::surface): Deleted.
2139         * UIProcess/gtk/RedirectedXCompositeWindow.h:
2140         (WebKit::RedirectedXCompositeWindow::surface):
2141
2142 2016-07-21  Carlos Garcia Campos  <cgarcia@igalia.com>
2143
2144         [GTK][Threaded Compositor] Web view background colors don't work
2145         https://bugs.webkit.org/show_bug.cgi?id=159465
2146
2147         Reviewed by Michael Catanzaro.
2148
2149         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
2150         (WebKit::ThreadedCompositor::setDrawsBackground): Set m_drawsBackground in compositing thread and schedule a
2151         layer flush.
2152         (WebKit::ThreadedCompositor::renderLayerTree): Clear the area when not rendering backgrounds.
2153         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
2154         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp:
2155         (WebKit::ThreadedCoordinatedLayerTreeHost::pageBackgroundTransparencyChanged): Notify the compositor.
2156         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h:
2157
2158 2016-07-21  Carlos Garcia Campos  <cgarcia@igalia.com>
2159
2160         [GTK] Web view background colors don't work in accelerated compositing mode
2161         https://bugs.webkit.org/show_bug.cgi?id=159455
2162
2163         Reviewed by Michael Catanzaro.
2164
2165         In non AC mode it's the drawing area backing store the one drawing the background, and the web process just
2166         renders into a transparent bitmap. In AC mode we need to make the redirected window pixmap transparent for the
2167         web process to render there, and let the web view fill the background color before rendering the redirected
2168         window pixmap on top. To be able to make the redirected window surface transparent, we need to ensure the parent
2169         window has an RGBA visual, even when setting a fully opaque background, because we still need the web process
2170         to render on the transparent xwindow.
2171
2172         * UIProcess/API/gtk/WebKitWebView.cpp: Update documentation of webkit_web_view_set_background_color() since now
2173         it's required to set the RGBA visual even for opaque colors in case AC mode is enabled.
2174         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
2175         (webkitWebViewRenderAcceleratedCompositingResults): When a background color has been set, fill it before
2176         rendering the redirected window surface.
2177         * UIProcess/gtk/RedirectedXCompositeWindow.cpp:
2178         (WebKit::RedirectedXCompositeWindow::RedirectedXCompositeWindow): Mark the surface as dirty after every damage
2179         event, since the web process has modified it.
2180         (WebKit::RedirectedXCompositeWindow::surface): Initialize the surface after creating it, to avoid flickering and
2181         rendering artifacts when waiting for the first damage event from the web process.
2182         * WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp:
2183         (WebKit::LayerTreeHostGtk::compositeLayersToContext): Use a fully transparent color to clear the context when the page
2184         is resized or when a view background color has been set.
2185
2186 2016-07-20  Carlos Garcia Campos  <cgarcia@igalia.com>
2187
2188         [GTK] Avoid the redirected window resize when the view is realized in AC mode
2189         https://bugs.webkit.org/show_bug.cgi?id=159463
2190
2191         Reviewed by Michael Catanzaro.
2192
2193         We are always creating the redirected window at 1x1 and then resizing it if we are in AC mode. When the view is
2194         realized and AC mode is already enabled, which happens for example when AC mode is forced, or when the threaded
2195         compositor is enabled, we could just pass the initial size to the redirected window constructor to create the
2196         XWindow at the right size.
2197
2198         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
2199         (webkitWebViewBaseResizeRedirectedWindow): We no longer need to pass the device scale factor, since the
2200         RedirectedXCompositeWindow already knows it.
2201         (webkitWebViewBaseRealize): Pass the WebPageProxy and an initial size to the RedirectedXCompositeWindow
2202         constructor instead of the parent GdkWindow. If AC mode is disabled, the initial size will be empty. With the
2203         WebPageProxy the redirected window has access to the device scale factor and view widget to get the parent
2204         GdkWindow.
2205         (deviceScaleFactorChanged): Resize the redirected window when device scale factor changes.
2206         * UIProcess/gtk/RedirectedXCompositeWindow.cpp:
2207         (WebKit::RedirectedXCompositeWindow::create):
2208         (WebKit::RedirectedXCompositeWindow::RedirectedXCompositeWindow):
2209         (WebKit::RedirectedXCompositeWindow::resize):
2210         (WebKit::RedirectedXCompositeWindow::surface):
2211         (WebKit::RedirectedXCompositeWindow::~RedirectedXCompositeWindow):
2212         * UIProcess/gtk/RedirectedXCompositeWindow.h:
2213
2214 2016-07-20  Carlos Garcia Campos  <cgarcia@igalia.com>
2215
2216         [GTK][Threaded Compositor] Web Process crash when the page is closed before the web view is realized
2217         https://bugs.webkit.org/show_bug.cgi?id=159918
2218
2219         Reviewed by Michael Catanzaro.
2220
2221         When the web view is unrealized, we send a sync message to the web process to destroy the native surface handle
2222         for compositing, and then we actually destroy the redirected window. But if the page is closed explicitly before
2223         the web view is unrealized, the drawing area proxy is destroyed so that when the web view is unrealized we can't
2224         notify the web process that keeps trying to render to a now deleted window handle. That produces a BadDrawable
2225         X error and the web process crashes.
2226
2227         * UIProcess/API/gtk/PageClientImpl.cpp:
2228         (WebKit::PageClientImpl::pageClosed): Call webkitWebViewBasePageClosed().
2229         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
2230         (webkitWebViewBasePageClosed): If the web view is still realized, destroy the native surface handle and the
2231         redirected window.
2232         * UIProcess/API/gtk/WebKitWebViewBasePrivate.h: Add webkitWebViewBasePageClosed().
2233
2234 2016-07-20  Commit Queue  <commit-queue@webkit.org>
2235
2236         Unreviewed, rolling out r203471.
2237         https://bugs.webkit.org/show_bug.cgi?id=160003
2238
2239         many iOS-simulator tests are failing (Requested by litherum on
2240         #webkit).
2241
2242         Reverted changeset:
2243
2244         "[iPhone] Playing a video on tudou.com plays only sound, no
2245         video"
2246         https://bugs.webkit.org/show_bug.cgi?id=159967
2247         http://trac.webkit.org/changeset/203471
2248
2249 2016-07-20  Simon Fraser  <simon.fraser@apple.com>
2250
2251         REGRESSION (r203189): Webpage snapshots are partially or fully blank when edge swiping back
2252         https://bugs.webkit.org/show_bug.cgi?id=160000
2253         rdar://problem/27455589
2254         
2255         Reviewed by Zalan Bujtas.
2256
2257         r203189 triggered a call to -_updateContentRectsWithState: in the middle of a swipe,
2258         during which we'd compute the visible rect of the view as having zero width, causing us
2259         to not create tiles.
2260
2261         -_navigationGestureDidBegin already snapshots the visibleContentRect in _frozenVisibleContentRect,
2262         but -_visibleContentRect then clipped that with ancestor views, causing the issue.
2263
2264         Fix by having -_visibleContentRect just return _frozenVisibleContentRect if we have one.
2265
2266         * UIProcess/API/Cocoa/WKWebView.mm:
2267         (-[WKWebView _visibleContentRect]):
2268
2269 2016-07-20  Myles C. Maxfield  <mmaxfield@apple.com>
2270
2271         [iPhone] Playing a video on tudou.com plays only sound, no video
2272         https://bugs.webkit.org/show_bug.cgi?id=159967
2273         <rdar://problem/26964090>
2274
2275         Reviewed by Jon Lee.
2276
2277         Add the two preferences to WKWebViewConfiguration and WKPreferences to cover both
2278         the Obj-C API and the C SPI.
2279
2280         * Shared/WebPreferencesDefinitions.h:
2281         * UIProcess/API/C/WKPreferences.cpp:
2282         (WKPreferencesSetAllowsInlineMediaPlaybackWithPlaysInlineAttribute):
2283         (WKPreferencesGetAllowsInlineMediaPlaybackWithPlaysInlineAttribute):
2284         (WKPreferencesSetAllowsInlineMediaPlaybackWithWebKitPlaysInlineAttribute):
2285         (WKPreferencesGetAllowsInlineMediaPlaybackWithWebKitPlaysInlineAttribute):
2286         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2287         * UIProcess/API/Cocoa/WKWebView.mm:
2288         (-[WKWebView _initializeWithConfiguration:]):
2289         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2290         (-[WKWebViewConfiguration init]):
2291         (-[WKWebViewConfiguration copyWithZone:]):
2292         (-[WKWebViewConfiguration _allowsInlineMediaPlaybackWithPlaysInlineAttribute]):
2293         (-[WKWebViewConfiguration _setAllowsInlineMediaPlaybackWithPlaysInlineAttribute:]):
2294         (-[WKWebViewConfiguration _allowsInlineMediaPlaybackWithWebKitPlaysInlineAttribute]):
2295         (-[WKWebViewConfiguration _setAllowsInlineMediaPlaybackWithWebKitPlaysInlineAttribute:]):
2296         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
2297         * WebProcess/WebPage/WebPage.cpp:
2298         (WebKit::WebPage::updatePreferences):
2299
2300 2016-07-20  ChangSeok Oh  <changseok@webkit.org>
2301
2302         Fix a linking failure caused by NetworkCache::Data::~Data()
2303         https://bugs.webkit.org/show_bug.cgi?id=159931
2304
2305         Linking is failed with clang 3.6. It says WebKit::NetworkCache::Data::~Data is undefined.
2306         It is fixed by adding a destructor for NetworkCache::Data.
2307
2308         Reviewed by Alex Christensen.
2309
2310         * NetworkProcess/cache/NetworkCacheData.h:
2311         (WebKit::NetworkCache::Data::~Data):
2312
2313 2016-07-20  Tim Horton  <timothy_horton@apple.com>
2314
2315         Explain the default value of WKWebViewConfiguration's ignoresViewportScaleLimits
2316         https://bugs.webkit.org/show_bug.cgi?id=159978
2317         <rdar://problem/27453189>
2318
2319         Reviewed by Dan Bernstein.
2320
2321         * UIProcess/API/Cocoa/WKWebViewConfiguration.h:
2322         This defaults to NO.
2323
2324 2016-07-20  Carlos Garcia Campos  <cgarcia@igalia.com>
2325
2326         [Linux] MemoryPressureMonitor fallback code to get memory available in older linux kernels doesn't work
2327         https://bugs.webkit.org/show_bug.cgi?id=159970
2328
2329         Reviewed by Antonio Gomes.
2330
2331         We are failing to detect zones when parsing /proc/zoneinfo.
2332
2333         * UIProcess/linux/MemoryPressureMonitor.cpp:
2334         (WebKit::lowWatermarkPages): Use strncmp since we want to know whether the line starts with "Node".
2335         (WebKit::MemoryPressureMonitor::MemoryPressureMonitor): Stop the polling if we fail to get the memory available,
2336         because that means it's not sopported in the system for whatever reason.
2337
2338 2016-07-20  Carlos Garcia Campos  <cgarcia@igalia.com>
2339
2340         [Threaded Compositor] Web Process crash when the layer tree host is destroyed
2341         https://bugs.webkit.org/show_bug.cgi?id=159922
2342
2343         Reviewed by Sergio Villar Senin.
2344
2345         It happens when the layer tree host is destroyed after the didChangeVisibleRect is scheduled to be run in the
2346         main thread, but before it's actually dispatched. In that case the threaded compositor client points to a
2347         deleted object and crashes when trying to dereference it.
2348
2349         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
2350         (WebKit::ThreadedCompositor::~ThreadedCompositor): Add an assert to ensure invalidate is always called before
2351         the object is deleted.
2352         (WebKit::ThreadedCompositor::invalidate): Terminate the compositing thread and nullify the client.
2353         (WebKit::ThreadedCompositor::didChangeVisibleRect): Return early if the client is null when the task is
2354         dispatched in the main thread.
2355         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h: Add invalidate().
2356         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp:
2357         (WebKit::ThreadedCoordinatedLayerTreeHost::invalidate): Invalidate the ThreadedCompositor and chain up.
2358         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h:
2359
2360 2016-07-19  Brian Burg  <bburg@apple.com>
2361
2362         Web Automation: WebAutomationSessionProxy's HashMaps should support '0' as valid keys
2363         https://bugs.webkit.org/show_bug.cgi?id=159957
2364         <rdar://problem/27376446>
2365
2366         Reviewed by Joseph Pecoraro.
2367
2368         * WebProcess/Automation/WebAutomationSessionProxy.h:
2369         Use UnsignedWithZeroKeyHashTraits to avoid problems with zero as a key.
2370
2371 2016-07-19  Anders Carlsson  <andersca@apple.com>
2372
2373         Some payment authorization status values should keep the sheet active
2374         https://bugs.webkit.org/show_bug.cgi?id=159936
2375         rdar://problem/26756701
2376
2377         Reviewed by Tim Horton.
2378
2379         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp:
2380         (WebKit::WebPaymentCoordinatorProxy::completePaymentSession):
2381         If the status isn't a final state status, bounce the current state back to active.
2382
2383         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h:
2384         Rename the _authorized ivar to _didReachFinalState.
2385
2386         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
2387         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewControllerDidFinish:]):
2388         (WebKit::WebPaymentCoordinatorProxy::platformCompletePaymentSession):
2389         Set _didReachFinalState based on the return value of isFinalStateStatus.
2390
2391 2016-07-18  Csaba Osztrogonác  <ossy@webkit.org>
2392
2393         Fix the --minimal build fail in InjectedBundle.cpp
2394         https://bugs.webkit.org/show_bug.cgi?id=159770
2395
2396         Reviewed by Benjamin Poulain.
2397
2398         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2399
2400 2016-07-18  Alex Christensen  <achristensen@webkit.org>
2401
2402         webbookmarksd needs to use the same AppCache directory as MobileSafari
2403         https://bugs.webkit.org/show_bug.cgi?id=159912
2404         <rdar://problem/27056844>
2405
2406         Reviewed by Alexey Proskuryakov.
2407
2408         * UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm:
2409         (API::WebsiteDataStore::defaultApplicationCacheDirectory):
2410         Make webbookmarksd match MobileSafari by adding a matching runtime exception.
2411
2412 2016-07-18  Anders Carlsson  <andersca@apple.com>
2413
2414         Don't null out the IPC::Connection's XPC connection
2415         https://bugs.webkit.org/show_bug.cgi?id=159911
2416         rdar://problem/27018065
2417
2418         Reviewed by Alex Christensen.
2419
2420         The function that nulls out the XPC connection, platformInvalidate(), is called from the connection queue,
2421         whereas the XPC connection is normally accessed from the main thread leading to inconsistencies when the
2422         connection is being invalidated while the main thread is trying to access it.
2423         
2424         Fix this by simply never nulling out the XPC connection. It will be released when the IPC::Connection is destroyed anyway.
2425
2426         * Platform/IPC/mac/ConnectionMac.mm:
2427         (IPC::Connection::platformInvalidate):
2428
2429 2016-07-18  Tim Horton  <timothy_horton@apple.com>
2430
2431         Tapping on an apple.com tab in tab overview stutters when switching to it
2432         https://bugs.webkit.org/show_bug.cgi?id=159904
2433         <rdar://problem/27192350>
2434
2435         Reviewed by Simon Fraser.
2436
2437         * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
2438         (WebKit::RemoteLayerTreeDrawingAreaProxy::waitForDidUpdateViewState):
2439         In any case where we get to waitForDidUpdateViewState (usually a tab switch),
2440         if we have an outstanding didUpdate message, the Web process will not commit
2441         a new layer tree until it receives the didUpdate message. However, since
2442         waitForDidUpdateViewState synchronously blocks the UI process, we also
2443         won't *send* the didUpdate message, so we block for the full timeout duration.
2444
2445         Instead, if we get to waitForDidUpdateViewState, just send the didUpdate without
2446         waiting for the DisplayLink or anything else, because calling rAF slightly too
2447         quickly, once, is certainly better than blocking the UI process for a whole second.
2448
2449 2016-07-18  Carlos Alberto Lopez Perez  <clopez@igalia.com>
2450
2451         [GTK] ENABLE_OPENGL=OFF build broken since r201802
2452         https://bugs.webkit.org/show_bug.cgi?id=159909
2453
2454         Reviewed by Antonio Gomes.
2455
2456         * WebProcess/WebPage/LayerTreeHost.h: Add missing include.
2457
2458 2016-07-18  Anders Carlsson  <andersca@apple.com>
2459
2460         WebKit nightly fails to build on macOS Sierra
2461         https://bugs.webkit.org/show_bug.cgi?id=159902
2462         rdar://problem/27365672
2463
2464         Reviewed by Tim Horton.
2465
2466         * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
2467         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h:
2468         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
2469         * UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
2470         Use new PassKitSPI header.
2471
2472 2016-07-18  Tim Horton  <timothy_horton@apple.com>
2473
2474         Mail contents are temporarily obscured by black rectangles when returning from suspend and in app switcher
2475         https://bugs.webkit.org/show_bug.cgi?id=159894
2476         <rdar://problem/26973202>
2477
2478         Reviewed by Simon Fraser.
2479
2480         * UIProcess/ApplicationStateTracker.h:
2481         * UIProcess/ApplicationStateTracker.mm:
2482         (WebKit::ApplicationStateTracker::ApplicationStateTracker):
2483         (WebKit::ApplicationStateTracker::~ApplicationStateTracker):
2484         (WebKit::ApplicationStateTracker::applicationDidCreateWindowContext):
2485         * UIProcess/ios/WKContentView.mm:
2486         (-[WKContentView didMoveToWindow]):
2487         (-[WKContentView _applicationDidCreateWindowContext]):
2488         (-[WKContentView _applicationWillEnterForeground]): Deleted.
2489         * UIProcess/ios/WKPDFView.mm:
2490         (-[WKPDFView didMoveToWindow]):
2491         (-[WKPDFView _applicationDidCreateWindowContext]):
2492         * UIProcess/ios/WebPageProxyIOS.mm:
2493         (WebKit::WebPageProxy::applicationDidFinishSnapshottingAfterEnteringBackground):
2494         Hide content at window context creation time, instead of when the application
2495         becomes foregrounded. Otherwise, background snapshots (which create/destroy
2496         window contexts, but do not bring the app into the foreground) can have
2497         parented layers that have volatile surfaces in them. In the normal case,
2498         we will subsequently get foregrounded and re-build the layer tree; in the
2499         background snapshot case, we will just have an empty layer tree.
2500
2501         In the future, we should consider making ApplicationStateTracker use
2502         window context creation/destruction to drive web process lifetime, so
2503         that we can actually paint correctly for background snapshots.
2504
2505 2016-07-18  Carlos Garcia Campos  <cgarcia@igalia.com>
2506
2507         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.13.3 release.
2508
2509         * gtk/NEWS: Add release notes for 2.13.3.
2510
2511 2016-07-18  Csaba Osztrogonác  <ossy@webkit.org>
2512
2513         [Mac][cmake] Unreviewed buildfix after r203338. Just for fun.
2514
2515         * PlatformMac.cmake:
2516
2517 2016-07-18  Carlos Garcia Campos  <cgarcia@igalia.com>
2518
2519         MemoryPressureHandler doesn't work if cgroups aren't present in Linux
2520         https://bugs.webkit.org/show_bug.cgi?id=155255
2521
2522         Reviewed by Sergio Villar Senin.
2523
2524         There's no way to get notifications about memory pressure in Linux without using cgroups that doesn't require a
2525         manual polling. We can get that information from /proc/meminfo, but that's not pollable so it requires to
2526         manually check its contents in a loop sleeping for a while between checks. This means we would be waking up the
2527         process on every poll iteration, most of the times for nothing. That's specially problematic on devices running
2528         on battery. And taking into account that there's a memory pressure handler in every secondary process (Web,
2529         Network and Plugin), we would be waking up all those process all the time. However, not having a memory pressure
2530         handler is even more problematic than the manual polling.
2531         This patch adds a class MemoryPressureMonitor to the manual polling of /proc/meminfo, but runs in the UI
2532         process, to avoid the weakups in all other secondary processes, and uses an eventFD to notify all other
2533         processes. It's only used in case cgroups is not available. The eventFD descriptor is sent to all other
2534         processes at startup, and passed to the MemoryPressureHandler before install() is called for the first
2535         time. To minimize the wakeups even in the UI process, the poll interval is calculated from 1 to 5 seconds
2536         depending on the current memory used, so in case of low memory level we sleep for a longer time.
2537         It's also important to make the memory calculations as accurate as possible to avoid cleaning resources in the
2538         secondary processes unnecessarily.
2539
2540         * NetworkProcess/NetworkProcess.cpp:
2541         (WebKit::NetworkProcess::initializeNetworkProcess): Pass the memory pressure monitor file descriptor to the MemoryPressureHandler.
2542         * NetworkProcess/NetworkProcess.h:
2543         * NetworkProcess/NetworkProcessCreationParameters.cpp:
2544         (WebKit::NetworkProcessCreationParameters::encode): Encode memory pressure monitor handle.
2545         (WebKit::NetworkProcessCreationParameters::decode): Decode memory pressure monitor handle.
2546         * NetworkProcess/NetworkProcessCreationParameters.h:
2547         * PlatformEfl.cmake: Add new file to compilation, and update include dirs.
2548         * PlatformGTK.cmake: Ditto.
2549         * PluginProcess/PluginProcess.cpp:
2550         (WebKit::PluginProcess::initializePluginProcess): Pass the memory pressure monitor file descriptor to the MemoryPressureHandler.
2551         * Shared/Plugins/PluginProcessCreationParameters.cpp:
2552         (WebKit::PluginProcessCreationParameters::encode): Encode memory pressure monitor handle.
2553         (WebKit::PluginProcessCreationParameters::decode): Decode memory pressure monitor handle.
2554         * Shared/Plugins/PluginProcessCreationParameters.h:
2555         * Shared/WebProcessCreationParameters.cpp:
2556         (WebKit::WebProcessCreationParameters::encode): Encode memory pressure monitor handle.
2557         (WebKit::WebProcessCreationParameters::decode): Decode memory pressure monitor handle.
2558         * Shared/WebProcessCreationParameters.h:
2559         * UIProcess/Plugins/PluginProcessProxy.cpp:
2560         (WebKit::PluginProcessProxy::didFinishLaunching): Create the memory pressure monitor handle for the plugin
2561         process if needed.
2562         * UIProcess/WebProcessPool.cpp:
2563         (WebKit::WebProcessPool::ensureNetworkProcess): Create the memory pressure monitor handle for the network
2564         process if needed.
2565         (WebKit::WebProcessPool::createNewWebProcess): Create the memory pressure monitor handle for the web process if
2566         needed.
2567         * UIProcess/linux/MemoryPressureMonitor.cpp: Added.
2568         (WebKit::lowWatermarkPages):
2569         (WebKit::systemPageSize):
2570         (WebKit::calculateMemoryAvailable):
2571         (WebKit::systemMemoryUsedAsPercentage):
2572         (WebKit::pollIntervalForUsedMemoryPercentage):
2573         (WebKit::isSystemdMemoryPressureMonitorAvailable):
2574         (WebKit::MemoryPressureMonitor::isEnabled):
2575         (WebKit::MemoryPressureMonitor::singleton):
2576         (WebKit::MemoryPressureMonitor::MemoryPressureMonitor):
2577         (WebKit::MemoryPressureMonitor::createHandle):
2578         * UIProcess/linux/MemoryPressureMonitor.h:
2579         * WebProcess/WebProcess.cpp:
2580         (WebKit::WebProcess::initializeWebProcess): Pass the memory pressure monitor file descriptor to the MemoryPressureHandler.
2581
2582 2016-07-17  Carlos Garcia Campos  <cgarcia@igalia.com>
2583
2584         REGRESSION(r202855): [GTK] ASSERTION FAILED: m_webPage.bounds().contains(bounds)
2585         https://bugs.webkit.org/show_bug.cgi?id=159806
2586
2587         Reviewed by Žan Doberšek.
2588
2589         The problem is that since r202855, in case of non accelerated mode, the dirty region is updated too late when
2590         updating backing store state.
2591
2592         * WebProcess/WebPage/DrawingAreaImpl.cpp:
2593         (WebKit::DrawingAreaImpl::updateBackingStoreState): Update the dirty region to the new size when not in
2594         accelerated compositing mode.
2595         * WebProcess/WebPage/WebPage.cpp:
2596         (WebKit::WebPage::setSize): Update the WebPage size before resizing the frame and calling setNeedsDisplay() to
2597         ensure that any call to setNeedsDisplay() uses the new web page bounds. This is actually a regression introduced
2598         in r143472, where setNeedsDisplay was changed to use the web page bounds as directy rectangle. Before r143472
2599         the dirty rectangle was passed to setNeedsDisplay and it passed the right one.
2600
2601 2016-07-16  Sam Weinig  <sam@webkit.org>
2602
2603         [WebKit API] Add SPI to track multiple navigations caused by a single user gesture
2604         <rdar://problem/26554137>
2605         https://bugs.webkit.org/show_bug.cgi?id=159856
2606
2607         Reviewed by Dan Bernstein.
2608
2609         * Shared/API/APIObject.h:
2610         * Shared/Cocoa/APIObject.mm:
2611         (API::Object::newObject):
2612         * UIProcess/API/APIUserInitiatedAction.h: Added.
2613         Add new APIObject type, UserInitiatedAction.
2614
2615         * UIProcess/API/Cocoa/WKNavigationAction.mm:
2616         * UIProcess/API/Cocoa/WKNavigationActionPrivate.h:
2617         Expose a _WKUserInitiatedAction on the WKNavigationAction.
2618
2619         * UIProcess/API/Cocoa/_WKUserInitiatedAction.h: Added.
2620         * UIProcess/API/Cocoa/_WKUserInitiatedAction.mm: Added.
2621         (-[_WKUserInitiatedAction consume]):
2622         (-[_WKUserInitiatedAction isConsumed]):
2623         (-[_WKUserInitiatedAction _apiObject]):
2624         * UIProcess/API/Cocoa/_WKUserInitiatedActionInternal.h: Added.
2625         Add new _WKUserInitiatedAction type wrapping API::UserInitiatedAction.
2626
2627         * Shared/NavigationActionData.cpp:
2628         (WebKit::NavigationActionData::encode):
2629         (WebKit::NavigationActionData::decode):
2630         * Shared/NavigationActionData.h:
2631         Store the userGestureTokenIdentifier (as determined from the WebProcess's map) rather
2632         than just a single bit. This allows us to track if a user gesture is used for multiple navigations.
2633
2634         * UIProcess/API/APINavigationAction.h:
2635         Add UserInitiatedAction member and re-implement isProcessingUserGesture in terms of it.
2636
2637         * UIProcess/API/C/WKPage.cpp:
2638         (WKPageSetPageUIClient):
2639         * UIProcess/Cocoa/UIDelegate.mm:
2640         (WebKit::UIDelegate::UIClient::createNewPage):
2641         * UIProcess/WebPageProxy.cpp:
2642         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2643         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
2644         Get the API::UserInitiatedAction from the WebProcessProxy (if it exists), and pass
2645         it along to the API::NavigationAction.
2646
2647         * UIProcess/WebProcessProxy.cpp:
2648         (WebKit::WebProcessProxy::shutDown):
2649         (WebKit::WebProcessProxy::userInitiatedActivity):
2650         (WebKit::WebProcessProxy::didDestroyUserGestureToken):
2651         * UIProcess/WebProcessProxy.h:
2652         Keep a map of active userInitiatedActivity objects.
2653
2654         * UIProcess/WebProcessProxy.messages.in:
2655         Add DidDestroyUserGestureToken message to manager API::UserInitiatedActivity lifetimes.
2656
2657         * WebKit2.xcodeproj/project.pbxproj:
2658         Add new files.
2659
2660         * WebProcess/Notifications/WebNotificationManager.cpp:
2661         (WebKit::WebNotificationManager::didClickNotification):
2662         * WebProcess/Plugins/PluginView.cpp:
2663         (WebKit::PluginView::performFrameLoadURLRequest):
2664         (WebKit::PluginView::evaluate):
2665         * WebProcess/WebCoreSupport/WebContextMenuClient.cpp:
2666         (WebKit::WebContextMenuClient::searchWithGoogle):
2667         * WebProcess/cocoa/WebPlaybackSessionManager.mm:
2668         (WebKit::WebPlaybackSessionManager::play):
2669         (WebKit::WebPlaybackSessionManager::pause):
2670         (WebKit::WebPlaybackSessionManager::togglePlayState):
2671         (WebKit::WebPlaybackSessionManager::beginScrubbing):
2672         (WebKit::WebPlaybackSessionManager::endScrubbing):
2673         (WebKit::WebPlaybackSessionManager::seekToTime):
2674         (WebKit::WebPlaybackSessionManager::fastSeek):
2675         (WebKit::WebPlaybackSessionManager::beginScanningForward):
2676         (WebKit::WebPlaybackSessionManager::beginScanningBackward):
2677         (WebKit::WebPlaybackSessionManager::endScanning):
2678         (WebKit::WebPlaybackSessionManager::selectAudioMediaOption):
2679         (WebKit::WebPlaybackSessionManager::selectLegibleMediaOption):
2680         Update for new UserGestureIndicator interface.
2681
2682         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2683         (WebKit::WebChromeClient::createWindow):
2684         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2685         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction):
2686         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
2687         Get an identifier for the UserGestureToken from the WebProcess singleton
2688         to pass to the WebProcess.
2689
2690         * WebProcess/WebProcess.cpp:
2691         (WebKit::nextUserGestureTokenIdentifier):
2692         (WebKit::WebProcess::userGestureTokenIdentifier):
2693         (WebKit::WebProcess::userGestureTokenDestroyed):
2694         * WebProcess/WebProcess.h:
2695         Track UserGestureToken lifetimes utilizing the destructionObserver mechanism
2696         off the tokens to indicate destruction. When destroyed, notify the UIProcess
2697         to avoid leaks.
2698
2699 2016-07-17  Ryosuke Niwa  <rniwa@webkit.org>
2700
2701         Rename fastHasAttribute to hasAttributeWithoutSynchronization
2702         https://bugs.webkit.org/show_bug.cgi?id=159864
2703
2704         Reviewed by Chris Dumez.
2705
2706         * WebProcess/WebPage/ios/WebPageIOS.mm:
2707         (WebKit::WebPage::getAssistedNodeInformation):
2708
2709 2016-07-17  Jeremy Jones  <jeremyj@apple.com>
2710
2711         REGRESSION (r191907): Maxthon Browser -After exit full screen video playback the browser window is blank with audio running
2712         https://bugs.webkit.org/show_bug.cgi?id=159731
2713         <rdar://problem/26674003>
2714
2715         Reviewed by Tim Horton.
2716
2717         Primarily written by Jer Noble  <jer.noble@apple.com>.
2718
2719         When a view is removed from it's superview, and that superview's constraints property references
2720         the removed superview, those constraints are removed as well. Make sure to save off a copy of
2721         the superview's constraints before swapping in the placeholder view, and reapply those constraints
2722         when swapping the web view back into its original superview.
2723
2724         * UIProcess/mac/WKFullScreenWindowController.h:
2725         * UIProcess/mac/WKFullScreenWindowController.mm:
2726         (-[WKFullScreenWindowController setSavedConstraints:]):
2727         (-[WKFullScreenWindowController savedConstraints]):
2728         (-[WKFullScreenWindowController enterFullScreen:]):
2729         (-[WKFullScreenWindowController finishedEnterFullScreenAnimation:]):
2730         (-[WKFullScreenWindowController finishedExitFullScreenAnimation:]):
2731
2732 2016-07-16  Ryosuke Niwa  <rniwa@webkit.org>
2733
2734         Rename fastGetAttribute to attributeWithoutSynchronization
2735         https://bugs.webkit.org/show_bug.cgi?id=159852
2736
2737         Reviewed by Darin Adler.
2738
2739         * WebProcess/WebPage/ios/WebPageIOS.mm:
2740         (WebKit::WebPage::getPositionInformation):
2741         (WebKit::WebPage::performActionOnElement):
2742         (WebKit::WebPage::getAssistedNodeInformation):
2743
2744 2016-07-15  Timothy Hatcher  <timothy@apple.com>
2745
2746         Web Automation: Fix element and event coord space issues
2747         https://bugs.webkit.org/show_bug.cgi?id=159851
2748         rdar://problem/27375780
2749
2750         Reviewed by Brian Burg.
2751
2752         * UIProcess/Automation/WebAutomationSession.cpp:
2753         (WebKit::WebAutomationSession::performMouseInteraction): Subtract topContentInset() before
2754         it goes back out to WebDriver.
2755         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
2756         (WebKit::WebAutomationSessionProxy::computeElementLayout): When using useViewportCoordinates,
2757         subtract topContentInset() so it matches expectations.
2758
2759 2016-07-15  Beth Dakin  <bdakin@apple.com>
2760
2761         Mac UI process needs to know about element focus and blur, much like iOS
2762         https://bugs.webkit.org/show_bug.cgi?id=159843
2763         -and corresponding-
2764         rdar://problem/27229504
2765
2766         Reviewed by Tim Horton.
2767
2768         This patch makes the existing iOS machinery to handle focus and blurring of 
2769         elements cross-platform. Instead of using the existing iOS messages for 
2770         startAssistingNode/stopAssistingNode, this patch adds a new message that 
2771         require only a boolean parameter: setEditableElementIsFocused.
2772
2773         Now that more of this code is shared, this patch teases 
2774         m_hasFocusedDueToUserInteraction out into two variables. I realized that it 
2775         was being used to mean two slightly different things on Mac and iOS, which 
2776         was very confusing. Now we have m_isAssistingNodeDueToUserInteraction to 
2777         represent the way iOS was using the variable, and we have 
2778         m_hasEverFocusedElementDueToUserInteractionSincePageTransition to represent 
2779         how Mac was using the variable. There should not be any behavior changes with 
2780         this re-name, just added clarity.
2781
2782         WebViewImpl has a new member variable m_editableElementIsFocused.
2783         * UIProcess/Cocoa/WebViewImpl.h:
2784         * UIProcess/Cocoa/WebViewImpl.mm:
2785         (WebKit::WebViewImpl::setEditableElementIsFocused):
2786
2787         Pipe the new setEditableElementIsFocused message to WebViewImpl.
2788         * UIProcess/PageClient.h:
2789         * UIProcess/WebPageProxy.cpp:
2790         (WebKit::WebPageProxy::setEditableElementIsFocused):
2791         * UIProcess/WebPageProxy.h:
2792         * UIProcess/WebPageProxy.messages.in:
2793         * UIProcess/mac/PageClientImpl.h:
2794         * UIProcess/mac/PageClientImpl.mm:
2795         (WebKit::PageClientImpl::setEditableElementIsFocused):
2796
2797         elementDidFocus() and elementDidBlur() are now PLATFORM(COCOA) instead of 
2798         PLATFORM(IOS)
2799         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2800         (WebKit::WebChromeClient::elementDidFocus):
2801         (WebKit::WebChromeClient::elementDidBlur):
2802         * WebProcess/WebCoreSupport/WebChromeClient.h:
2803         * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
2804         (WebKit::WebChromeClient::elementDidFocus): Deleted.
2805         (WebKit::WebChromeClient::elementDidBlur): Deleted.
2806
2807         m_hasPendingBlurNotification is no longer iOS-only.
2808         * WebProcess/WebPage/WebPage.cpp:
2809
2810         Use our two new bools m_isAssistingNodeDueToUserInteraction and 
2811         m_hasEverFocusedElementDueToUserInteractionSincePageTransition 
2812         (WebKit::WebPage::didStartPageTransition):
2813         (WebKit::WebPage::didChangeSelection):
2814
2815         These functions are all newly cross-platform. The Messages they send are 
2816         still platform-specific, but otherwise the logic is the same. We 
2817         dispatch_async the blur messages so that the UI process features won’t be 
2818         flashy when the user is tapping, tabbing, or clicking through form fields.
2819         (WebKit::WebPage::resetAssistedNodeForFrame):
2820         (WebKit::WebPage::elementDidFocus):
2821         (WebKit::WebPage::elementDidBlur):
2822
2823         resetAssistedNodeForFrame() is no longer iOS-only. 
2824         (WebKit::WebPage::didCommitLoad):
2825
2826         Move variables and functions around so that they are defined for the right 
2827         platform, and declare the two new bools in place of the old one.
2828         * WebProcess/WebPage/WebPage.h:
2829
2830         These functions are now defined in WebPage.cpp
2831         * WebProcess/WebPage/ios/WebPageIOS.mm:
2832         (WebKit::WebPage::resetAssistedNodeForFrame): Deleted.
2833         (WebKit::WebPage::elementDidFocus): Deleted.
2834         (WebKit::WebPage::elementDidBlur): Deleted.
2835
2836 2016-07-15  Geoffrey Garen  <ggaren@apple.com>
2837
2838         Added a makeRef<T> helper
2839         https://bugs.webkit.org/show_bug.cgi?id=159835
2840
2841         Reviewed by Andreas Kling.
2842
2843         Anders told me to!
2844
2845         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2846         (WebKit::NetworkConnectionToWebProcess::writeBlobsToTemporaryFiles):
2847         * NetworkProcess/NetworkResourceLoader.cpp:
2848         (WebKit::NetworkResourceLoader::tryStoreAsCacheEntry):
2849         * Platform/IPC/Connection.cpp:
2850         (IPC::Connection::addWorkQueueMessageReceiver):
2851         (IPC::Connection::removeWorkQueueMessageReceiver):
2852         (IPC::Connection::invalidate):
2853         (IPC::Connection::sendMessage):
2854         (IPC::Connection::processIncomingMessage):
2855         (IPC::Connection::postConnectionDidCloseOnConnectionWorkQueue):
2856         (IPC::Connection::connectionDidClose):
2857         (IPC::Connection::enqueueIncomingMessage):
2858         * Platform/IPC/mac/ConnectionMac.mm:
2859         (IPC::Connection::receiveSourceEventHandler):
2860         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
2861         (WebKit::ThreadedCompositor::setNativeSurfaceHandleForCompositing):
2862         (WebKit::ThreadedCompositor::setDeviceScaleFactor):
2863         (WebKit::ThreadedCompositor::didChangeViewportSize):
2864         (WebKit::ThreadedCompositor::didChangeViewportAttribute):
2865         (WebKit::ThreadedCompositor::didChangeContentsSize):
2866         (WebKit::ThreadedCompositor::scrollTo):
2867         (WebKit::ThreadedCompositor::scrollBy):
2868         (WebKit::ThreadedCompositor::didChangeVisibleRect):
2869         * UIProcess/API/APIUserContentExtensionStore.cpp:
2870         (API::UserContentExtensionStore::lookupContentExtension):
2871         (API::UserContentExtensionStore::compileContentExtension):
2872         (API::UserContentExtensionStore::removeContentExtension):
2873         * UIProcess/Launcher/ProcessLauncher.cpp:
2874         (WebKit::ProcessLauncher::ProcessLauncher):
2875         * UIProcess/Storage/LocalStorageDatabaseTracker.cpp:
2876         (WebKit::LocalStorageDatabaseTracker::LocalStorageDatabaseTracker):
2877         * UIProcess/Storage/StorageManager.cpp:
2878         (WebKit::StorageManager::createSessionStorageNamespace):
2879         (WebKit::StorageManager::destroySessionStorageNamespace):
2880         (WebKit::StorageManager::setAllowedSessionStorageNamespaceConnection):
2881         (WebKit::StorageManager::cloneSessionStorageNamespace):
2882         (WebKit::StorageManager::processDidCloseConnection):
2883         (WebKit::StorageManager::getSessionStorageOrigins):
2884         (WebKit::StorageManager::deleteSessionStorageOrigins):
2885         (WebKit::StorageManager::deleteSessionStorageEntriesForOrigins):
2886         (WebKit::StorageManager::getLocalStorageOrigins):
2887         (WebKit::StorageManager::getLocalStorageOriginDetails):
2888         (WebKit::StorageManager::deleteLocalStorageEntriesForOrigin):
2889         (WebKit::StorageManager::deleteLocalStorageOriginsModifiedSince):
2890         (WebKit::StorageManager::deleteLocalStorageEntriesForOrigins):
2891         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2892         (WebKit::WebResourceLoadStatisticsStore::readDataFromDiskIfNeeded):
2893         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2894         (WebKit::WebsiteDataStore::fetchData):
2895         * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
2896         (WebKit::NetscapePlugin::pluginThreadAsyncCall):
2897         * WebProcess/WebPage/EventDispatcher.cpp:
2898         (WebKit::EventDispatcher::wheelEvent):
2899         (WebKit::EventDispatcher::gestureEvent):
2900         (WebKit::EventDispatcher::touchEvent):
2901         * WebProcess/WebPage/ViewUpdateDispatcher.cpp:
2902         (WebKit::ViewUpdateDispatcher::visibleContentRectUpdate):
2903
2904 2016-07-15  Chris Dumez  <cdumez@apple.com>
2905
2906         Use fastGetAttribute() / setAttributeWithoutSynchronization() when possible
2907         https://bugs.webkit.org/show_bug.cgi?id=159793
2908
2909         Reviewed by Ryosuke Niwa.
2910
2911         Use fastGetAttribute() / setAttributeWithoutSynchronization() when possible, for performance.
2912
2913         * WebProcess/Plugins/PDF/DeprecatedPDFPlugin.mm:
2914         (WebKit::PDFPlugin::PDFPlugin):
2915         * WebProcess/Plugins/PDF/PDFPlugin.mm:
2916         (WebKit::PDFPlugin::createPasswordEntryForm):
2917         * WebProcess/Plugins/PDF/PDFPluginAnnotation.mm:
2918         (WebKit::PDFPluginAnnotation::attach):
2919         * WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.mm:
2920         (WebKit::PDFPluginChoiceAnnotation::createAnnotationElement):
2921
2922 2016-07-15  Ryosuke Niwa  <rniwa@webkit.org>
2923
2924         Disable custom elements in Safari Tech Preview
2925         https://bugs.webkit.org/show_bug.cgi?id=159829
2926
2927         Reviewed by Chris Dumez.
2928  
2929         Disable custom elements API in Safari Technology Preview. Our implementation is so out of sync
2930         with the latest spec that it's actively harmful to have this feature enabled.
2931
2932         * Shared/WebPreferencesDefinitions.h:
2933
2934 2016-07-15  Jer Noble  <jer.noble@apple.com>
2935
2936         Full screen ePub embedded video is playing on 1/4 screen, cut off
2937         https://bugs.webkit.org/show_bug.cgi?id=159737
2938         <rdar://problem/26259404>
2939
2940         Reviewed by Tim Horton.
2941
2942         Set the fixedLayoutSize to CGSizeZero when disabling fixed layout due to the 
2943         WebView not supporting arbitrary layout modes, and reset to the saved value
2944         when the view does begin supporting arbitrary layout modes.
2945
2946         * UIProcess/Cocoa/WebViewImpl.h:
2947         * UIProcess/Cocoa/WebViewImpl.mm:
2948         (WebKit::WebViewImpl::setFixedLayoutSize):
2949         (WebKit::WebViewImpl::updateSupportsArbitraryLayoutModes):
2950
2951 2016-07-14  Ryan Haddad  <ryanhaddad@apple.com>
2952
2953         Unreviewed, rolling out r203248.
2954
2955         This change causes LayoutTests to crash and exit early
2956
2957         Reverted changeset:
2958
2959         "Use more Refs with WorkQueues"
2960         https://bugs.webkit.org/show_bug.cgi?id=159792
2961         http://trac.webkit.org/changeset/203248
2962
2963 2016-07-14  Chris Dumez  <cdumez@apple.com>
2964
2965         Use emptyString() instead of "" when possible
2966         https://bugs.webkit.org/show_bug.cgi?id=159789
2967
2968         Reviewed by Alex Christensen.
2969
2970         Use emptyString() instead of "" when possible to reduce String allocations.
2971
2972         * UIProcess/Cocoa/WebViewImpl.mm:
2973         (WebKit::WebViewImpl::pasteboardChangedOwner):
2974         * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
2975         (WebKit::parseRFC822HeaderFields):
2976         (WebKit::NPN_Status):
2977
2978 2016-07-14  Alex Christensen  <achristensen@webkit.org>
2979
2980         Use more Refs with WorkQueues
2981         https://bugs.webkit.org/show_bug.cgi?id=159792
2982
2983         Reviewed by Brady Eidson.
2984
2985         * NetworkProcess/CustomProtocols/CustomProtocolManager.h:
2986         * Platform/IPC/Connection.cpp:
2987         (IPC::Connection::setShouldExitOnSyncMessageSendFailure):
2988         (IPC::Connection::addWorkQueueMessageReceiver):
2989         * Platform/IPC/Connection.h:
2990         * Shared/mac/SecItemShim.cpp:
2991         (WebKit::SecItemShim::initializeConnection):
2992         * UIProcess/Storage/LocalStorageDatabaseTracker.cpp:
2993         (WebKit::LocalStorageDatabaseTracker::create):
2994         (WebKit::LocalStorageDatabaseTracker::LocalStorageDatabaseTracker):
2995         * UIProcess/Storage/LocalStorageDatabaseTracker.h:
2996         * UIProcess/Storage/StorageManager.cpp:
2997         (WebKit::StorageManager::StorageArea::openDatabaseAndImportItemsIfNeeded):
2998         (WebKit::StorageManager::StorageManager):
2999         * UIProcess/Storage/StorageManager.h:
3000         * UIProcess/WebResourceLoadStatisticsStore.cpp:
3001         (WebKit::WebResourceLoadStatisticsStore::processWillOpenConnection):
3002         (WebKit::WebResourceLoadStatisticsStore::processDidCloseConnection):
3003         * UIProcess/mac/SecItemShimProxy.cpp:
3004         (WebKit::SecItemShimProxy::initializeConnection):
3005         (WebKit::SecItemShimProxy::secItemRequest):
3006         * WebProcess/Plugins/PluginProcessConnectionManager.cpp:
3007         (WebKit::PluginProcessConnectionManager::initializeConnection):
3008         (WebKit::PluginProcessConnectionManager::getPluginProcessConnection):
3009         * WebProcess/WebPage/EventDispatcher.cpp:
3010         (WebKit::EventDispatcher::initializeConnection):
3011         (WebKit::EventDispatcher::wheelEvent):
3012         * WebProcess/WebPage/ViewUpdateDispatcher.cpp:
3013         (WebKit::ViewUpdateDispatcher::initializeConnection):
3014         (WebKit::ViewUpdateDispatcher::visibleContentRectUpdate):
3015
3016 2016-07-14  Timothy Hatcher  <timothy@apple.com>
3017
3018         Web Automation: FrameNotFound errors happen a lot for the main frame
3019         https://bugs.webkit.org/show_bug.cgi?id=159777
3020         rdar://problem/27224628
3021
3022         Send both pageID and frameID, and have the WebProcess side resolve the
3023         mainFrame from 0 based on the known pageID. This avoids a race waiting
3024         for the DidCreateMainFrame message.
3025
3026         Reviewed by Brian Burg.
3027
3028         * UIProcess/Automation/WebAutomationSession.cpp:
3029         (WebKit::WebAutomationSession::webFrameIDForHandle):
3030         (WebKit::WebAutomationSession::switchToBrowsingContext):
3031         (WebKit::WebAutomationSession::evaluateJavaScriptFunction):
3032         (WebKit::WebAutomationSession::resolveChildFrameHandle):
3033         (WebKit::WebAutomationSession::resolveParentFrameHandle):
3034         (WebKit::WebAutomationSession::computeElementLayout):
3035         (WebKit::WebAutomationSession::getAllCookies):
3036         (WebKit::WebAutomationSession::deleteSingleCookie):
3037         (WebKit::WebAutomationSession::webFrameProxyForHandle): Deleted.
3038         (WebKit::WebAutomationSession::webFrameIDForHandle): Added.
3039         * UIProcess/Automation/WebAutomationSession.h:
3040         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
3041         (WebKit::WebAutomationSessionProxy::evaluateJavaScriptFunction):
3042         (WebKit::WebAutomationSessionProxy::resolveChildFrameWithOrdinal):
3043         (WebKit::WebAutomationSessionProxy::resolveChildFrameWithNodeHandle):
3044         (WebKit::WebAutomationSessionProxy::resolveChildFrameWithName):
3045         (WebKit::WebAutomationSessionProxy::resolveParentFrame):
3046         (WebKit::WebAutomationSessionProxy::focusFrame):
3047         (WebKit::WebAutomationSessionProxy::computeElementLayout):
3048         (WebKit::WebAutomationSessionProxy::takeScreenshot):
3049         (WebKit::WebAutomationSessionProxy::getCookiesForFrame):
3050         (WebKit::WebAutomationSessionProxy::deleteCookie):
3051         * WebProcess/Automation/WebAutomationSessionProxy.h:
3052         * WebProcess/Automation/WebAutomationSessionProxy.messages.in:
3053
3054 2016-07-14  Alex Christensen  <achristensen@webkit.org>
3055
3056         Use SocketProvider to create SocketStreamHandles
3057         https://bugs.webkit.org/show_bug.cgi?id=159774
3058
3059         Reviewed by Brady Eidson.
3060
3061         * WebProcess/Network/WebSocketProvider.cpp:
3062         (WebKit::WebSocketProvider::createSocketStreamHandle):
3063         (WebKit::WebSocketProvider::createWebSocketChannel): Deleted.
3064         * WebProcess/Network/WebSocketProvider.h:
3065
3066 2016-07-14  Chris Dumez  <cdumez@apple.com>
3067
3068         [WK2][iOS] Potential null dereference under ViewGestureController::beginSwipeGesture()
3069         https://bugs.webkit.org/show_bug.cgi?id=159776
3070         <rdar://problem/22467100>
3071
3072         Reviewed by Tim Horton.
3073
3074         Potential null dereference under ViewGestureController::beginSwipeGesture() of:
3075         m_webPageProxy.backForwardList().currentItem()
3076
3077         The client side is expected to call ViewGestureController::canSwipeInDirection() but
3078         this only guarantees that the m_alternateBackForwardListSourceView's currentItem is
3079         non-null when m_alternateBackForwardListSourceView is non-null. It does not guarantee
3080         that m_webPageProxy's currentItem is non-null.
3081
3082         * UIProcess/ios/ViewGestureControllerIOS.mm:
3083         (WebKit::ViewGestureController::beginSwipeGesture):
3084
3085 2016-07-14  Csaba Osztrogonác  <ossy@webkit.org>
3086
3087         Fix the !ENABLE(WEB_SOCKETS) build after r202930
3088         https://bugs.webkit.org/show_bug.cgi?id=159768
3089
3090         Reviewed by Alex Christensen.
3091
3092         * WebProcess/Network/WebSocketProvider.h:
3093
3094 2016-07-14  Chris Dumez  <cdumez@apple.com>
3095
3096         Possible crash under NavigationState::NavigationClient::processDidCrash()
3097         https://bugs.webkit.org/show_bug.cgi?id=159773
3098         <rdar://problem/19814215>
3099
3100         Reviewed by Anders Carlsson.
3101
3102         Add a m_navigationState.m_navigationDelegateMethods.webViewWebProcessDidCrash before
3103         trying to call it to avoid crashing if the client does not implement it.
3104
3105         At the beginning of the method, we abort early only if both webViewWebContentProcessDidTerminate
3106         and webViewWebProcessDidCrash are implemented. However, if webViewWebContentProcessDidTerminate
3107         implemented but not webViewWebProcessDidCrash we can end up crashing as we fail to check later
3108         on before trying to call it.
3109
3110         * UIProcess/Cocoa/NavigationState.mm:
3111         (WebKit::NavigationState::NavigationClient::processDidCrash):
3112
3113 2016-07-14  Csaba Osztrogonác  <ossy@webkit.org>
3114
3115         Fix the DatabaseProcess build with disabled IDB
3116         https://bugs.webkit.org/show_bug.cgi?id=159769
3117
3118         Reviewed by Alex Christensen.
3119
3120         * WebProcess/Databases/WebToDatabaseProcessConnection.cpp:
3121         (WebKit::WebToDatabaseProcessConnection::didClose):
3122
3123 2016-07-14  Hyunjun Ko  <zzoon@igalia.com>
3124
3125         [ThreadedCompositor] Build fails in debug mode after r202040
3126         https://bugs.webkit.org/show_bug.cgi?id=159757
3127
3128         Reviewed by Michael Catanzaro.
3129
3130         Debug mode build failed due to call getter method, which is
3131         removed, in ASSERT().
3132
3133         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
3134         (WebKit::ThreadedCompositor::glContext): Deleted.
3135         (WebKit::ThreadedCompositor::didChangeVisibleRect): Deleted.
3136         (WebKit::ThreadedCompositor::renderLayerTree): Deleted.
3137
3138 2016-07-13  Alex Christensen  <achristensen@webkit.org>
3139
3140         Modernize WebSocket handle
3141         https://bugs.webkit.org/show_bug.cgi?id=159750
3142
3143         Reviewed by Brady Eidson.
3144
3145         * UIProcess/InspectorServer/soup/WebSocketServerSoup.cpp:
3146         (WebKit::connectionCallback):
3147
3148 2016-07-13  Carlos Garcia Campos  <cgarcia@igalia.com>
3149
3150         REGRESSION(r202273): [GTK] Redirected X window is resized to the previous size on size allocate
3151         https://bugs.webkit.org/show_bug.cgi?id=159551
3152
3153         Reviewed by Michael Catanzaro.
3154
3155         In r202273 I added webkitWebViewBaseResizeRedirectedWindow() helper to remove duplicated code in all places
3156         where we were resizing the redirected window to the current drawing area size. But on size allocate, we were
3157         updating the redirected window first, and then the drawing area, to ensure that when the drawing area notifies
3158         the web process the redirected window is already at the new size. This regression doesn't have any visual
3159         effect, because we are ensure the right size always before rendering, but there's a small extra resize in this case.
3160
3161         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
3162         (webkitWebViewBaseSizeAllocate): Resize the redirected window before updating the drawing area size.
3163
3164 2016-07-13  Chris Dumez  <cdumez@apple.com>
3165
3166         [WK2] Use more references for connections
3167         https://bugs.webkit.org/show_bug.cgi?id=159739
3168
3169         Reviewed by Alex Christensen.
3170
3171         Use more references for connections to make it more obvious they cannot
3172         be null.
3173
3174         * DatabaseProcess/DatabaseToWebProcessConnection.cpp:
3175         (WebKit::DatabaseToWebProcessConnection::DatabaseToWebProcessConnection):
3176         * DatabaseProcess/DatabaseToWebProcessConnection.h:
3177         (WebKit::DatabaseToWebProcessConnection::connection):
3178         * DatabaseProcess/IndexedDB/WebIDBConnectionToClient.cpp:
3179         (WebKit::WebIDBConnectionToClient::messageSenderConnection):
3180         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3181         (WebKit::NetworkConnectionToWebProcess::NetworkConnectionToWebProcess):
3182         (WebKit::NetworkConnectionToWebProcess::writeBlobsToTemporaryFiles):
3183         * NetworkProcess/NetworkConnectionToWebProcess.h:
3184         (WebKit::NetworkConnectionToWebProcess::connection):
3185         * NetworkProcess/NetworkResourceLoader.cpp:
3186         (WebKit::NetworkResourceLoader::messageSenderConnection):
3187         * Shared/mac/CookieStorageShim.mm:
3188         (WebKit::webKitCookieStorageCopyRequestHeaderFieldsForURL):
3189         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
3190         (WebKit::WebIDBConnectionToServer::messageSenderConnection):
3191         (WebKit::preregisterSandboxExtensionsIfNecessary):
3192         * WebProcess/Databases/WebToDatabaseProcessConnection.cpp:
3193         (WebKit::WebToDatabaseProcessConnection::WebToDatabaseProcessConnection):
3194         * WebProcess/Databases/WebToDatabaseProcessConnection.h:
3195         (WebKit::WebToDatabaseProcessConnection::connection):
3196         * WebProcess/FileAPI/BlobRegistryProxy.cpp:
3197         (WebKit::BlobRegistryProxy::registerFileBlobURL):
3198         (WebKit::BlobRegistryProxy::registerBlobURL):
3199         (WebKit::BlobRegistryProxy::registerBlobURLOptionallyFileBacked):
3200         (WebKit::BlobRegistryProxy::unregisterBlobURL):
3201         (WebKit::BlobRegistryProxy::registerBlobURLForSlice):
3202         (WebKit::BlobRegistryProxy::blobSize):
3203         (WebKit::BlobRegistryProxy::writeBlobsToTemporaryFiles):
3204         * WebProcess/Network/NetworkProcessConnection.cpp:
3205         (WebKit::NetworkProcessConnection::NetworkProcessConnection):
3206         (WebKit::NetworkProcessConnection::writeBlobsToTemporaryFiles):
3207         * WebProcess/Network/NetworkProcessConnection.h:
3208         (WebKit::NetworkProcessConnection::connection):
3209         * WebProcess/Network/WebLoaderStrategy.cpp:
3210         (WebKit::WebLoaderStrategy::scheduleLoad):
3211         (WebKit::WebLoaderStrategy::remove):
3212         (WebKit::WebLoaderStrategy::setDefersLoading):
3213         (WebKit::WebLoaderStrategy::loadResourceSynchronously):
3214         (WebKit::WebLoaderStrategy::createPingHandle):
3215         * WebProcess/Network/WebResourceLoader.cpp:
3216         (WebKit::WebResourceLoader::messageSenderConnection):
3217         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
3218         (WebKit::WebPlatformStrategies::cookiesForDOM):
3219         (WebKit::WebPlatformStrategies::setCookiesFromDOM):
3220         (WebKit::WebPlatformStrategies::cookiesEnabled):
3221         (WebKit::WebPlatformStrategies::cookieRequestHeaderFieldValue):
3222         (WebKit::WebPlatformStrategies::getRawCookies):
3223         (WebKit::WebPlatformStrategies::deleteCookie):
3224         (WebKit::WebPlatformStrategies::addCookie):
3225         * WebProcess/WebPage/WebFrame.cpp:
3226         (WebKit::WebFrame::startDownload):
3227         (WebKit::WebFrame::convertMainResourceLoadToDownload):
3228         * WebProcess/WebProcess.cpp:
3229         (WebKit::WebProcess::ensureLegacyPrivateBrowsingSessionInNetworkProcess):
3230         (WebKit::WebProcess::networkConnection):
3231         (WebKit::WebProcess::prefetchDNS):
3232         * WebProcess/WebProcess.h:
3233
3234 2016-07-13  Anders Carlsson  <andersca@apple.com>
3235
3236         Move WKPreferencesRef functions to the correct file
3237         https://bugs.webkit.org/show_bug.cgi?id=159741
3238
3239         Reviewed by Sam Weinig.
3240
3241         Also, get rid of WKPreferencesGetPaymentsEnabled and WKPreferencesSetPaymentsEnabled.
3242
3243         * UIProcess/API/C/WKPreferences.cpp:
3244         (WKPreferencesGetApplePayEnabled):
3245         (WKPreferencesSetApplePayEnabled):
3246         (WKPreferencesGetApplePayCapabilityDisclosureAllowed):
3247         (WKPreferencesSetApplePayCapabilityDisclosureAllowed):
3248         * UIProcess/API/C/WKPreferencesRef.h:
3249         * UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
3250         (WKPreferencesGetApplePayEnabled): Deleted.
3251         (WKPreferencesSetApplePayEnabled): Deleted.
3252         (WKPreferencesGetApplePayCapabilityDisclosureAllowed): Deleted.
3253         (WKPreferencesSetApplePayCapabilityDisclosureAllowed): Deleted.
3254         (WKPreferencesGetPaymentsEnabled): Deleted.
3255         (WKPreferencesSetPaymentsEnabled): Deleted.
3256
3257 2016-07-13  Anders Carlsson  <andersca@apple.com>
3258
3259         Add _applePayCapabilityDisclosureAllowed SPI declaration
3260         https://bugs.webkit.org/show_bug.cgi?id=159740
3261
3262         Reviewed by Dan Bernstein.
3263
3264         Also, delete an old method that is no longer used.
3265
3266         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
3267         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
3268         (-[WKWebViewConfiguration _paymentsEnabled]): Deleted.
3269         (-[WKWebViewConfiguration _setPaymentsEnabled:]): Deleted.
3270
3271 2016-07-13  Zalan Bujtas  <zalan@apple.com>
3272
3273         Blank news article on kottke.org
3274         https://bugs.webkit.org/show_bug.cgi?id=159733
3275         <rdar://problem/26743065>
3276
3277         Reviewed by Simon Fraser.
3278
3279         This patch ensures that we update the visible content rect, when Auto Layout moves the WKWebView around.
3280         We normally expect setFrameRect to be called to position WKWebView. However Auto Layout relies on layoutSubviews,
3281         and in order to always have up-to-date visible content rect, we need to override layoutSubviews in WKWebView. 
3282
3283         * UIProcess/API/Cocoa/WKWebView.mm:
3284         (-[WKWebView layoutSubviews]):
3285
3286 2016-07-13  Chris Dumez  <cdumez@apple.com>
3287
3288         WebKit2 shouldn't signal custom protocol clients from the NSURLConnection loader thread.
3289         https://bugs.webkit.org/show_bug.cgi?id=159725
3290         <rdar://problem/27323131>
3291
3292         Reviewed by Andy Estes.
3293
3294         WebKit2 shouldn't signal custom protocol clients from the NSURLConnection
3295         loader thread. Instead, use the RunLoop the WKCustomProtocol was initialized
3296         on.
3297
3298         * NetworkProcess/CustomProtocols/Cocoa/CustomProtocolManagerCocoa.mm:
3299         (-[WKCustomProtocol initWithRequest:cachedResponse:client:]):
3300         (WebKit::dispatchOnInitializationRunLoop):
3301         (WebKit::CustomProtocolManager::didFailWithError):
3302         (WebKit::CustomProtocolManager::didLoadData):
3303         (WebKit::CustomProtocolManager::didReceiveResponse):
3304         (WebKit::CustomProtocolManager::didFinishLoading):
3305         (WebKit::CustomProtocolManager::wasRedirectedToRequest):
3306         (WebKit::dispatchOnResourceLoaderRunLoop): Deleted.
3307
3308 2016-07-13  Enrica Casucci  <enrica@apple.com>
3309
3310         Update supported platforms in xcconfig files to match the sdk names.
3311         https://bugs.webkit.org/show_bug.cgi?id=159728
3312
3313         Reviewed by Tim Horton.
3314
3315         * Configurations/Base.xcconfig:
3316
3317 2016-07-13  Carlos Garcia Campos  <cgarcia@igalia.com>
3318
3319         [Coordinated Graphics] Remove toCoordinatedGraphicsLayer and use downcast instead
3320         https://bugs.webkit.org/show_bug.cgi?id=159469
3321
3322         Reviewed by Michael Catanzaro.
3323
3324         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
3325         (WebKit::CompositingCoordinator::flushPendingLayerChanges):
3326         (WebKit::CompositingCoordinator::initializeRootCompositingLayerIfNeeded):
3327         (WebKit::CompositingCoordinator::mainContentsLayer):
3328
3329 2016-07-13  Carlos Garcia Campos  <cgarcia@igalia.com>
3330
3331         [GTK] WebKitGtk+ uses too many file descriptors
3332         https://bugs.webkit.org/show_bug.cgi?id=152316
3333
3334         Reviewed by Michael Catanzaro.
3335
3336         The problem is that we are keeping file descriptors open in SharedMemory objects. Those objects can be kept
3337         alive for a long time, for example in case of cached resources sent from the network process as shareable
3338         resources. The thing is that we keep the file descriptor in the SharedMemory object only to be able to create a
3339         Handle, duplicating the file descriptor. However, we are also assuming that we create handles for SharedMemory
3340         objects created by another handle which is wrong. SharedMemory objects are created to map a file or data and
3341         then a handle is created to send it to another process, or to map an existing file or data for a given handle
3342         received from another process. They can also be created to wrap another map, but in that case we don't own the
3343         file descritor nor the mapped data. So, after mapping from a handle, we no longer need the file descriptor, and
3344         it can be closed to release it, while the mapped memory data will still be alive until munmap() is called. This
3345         drastically reduces the amount of file descriptors used by WebKitGTK+.
3346
3347         * Platform/IPC/unix/ConnectionUnix.cpp:
3348         (IPC::readBytesFromSocket): Use setCloseOnExec().
3349         (IPC::Connection::createPlatformConnection): Ditto.
3350         * Platform/SharedMemory.h:
3351         * Platform/unix/SharedMemoryUnix.cpp:
3352         (WebKit::SharedMemory::map): Close the file descriptor right after mmap.
3353         (WebKit::SharedMemory::~SharedMemory): Close the file descriptor only if it hasn't been closed yet.
3354         (WebKit::SharedMemory::createHandle): Add an ASSERT to ensure we only try to create a handle for SharedMemory
3355         objects having a valid file descriptor. Use dupCloseOnExec() to duplicate the handle and set the close on exec flag.
3356         * UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp:
3357         (WebKit::ProcessLauncher::launchProcess): Use setCloseOnExec().
3358
3359 2016-07-12  Simon Fraser  <simon.fraser@apple.com>
3360
3361         [iOS WK2] After zooming and when under memory pressure, page tiles sometimes don't redraw while panning
3362         https://bugs.webkit.org/show_bug.cgi?id=159697
3363         rdar://problem/26314075
3364
3365         Reviewed by Benjamin Poulain.
3366
3367         When under memory pressure, and after pinching back to minimum scale, WebPage::updateVisibleContentRects()
3368         would sometimes always bail under the "boundedScale != currentScale..." condition.
3369
3370         This happened because the visibleContentRectUpdateInfo.scale() is a double, but m_page->pageScaleFactor()
3371         is a float, and the constraining between min and max scale (which are doubles) caused boundedScale
3372         to be always different from currentScale.
3373
3374         Fix by using floats throughout.
3375
3376         No test because there's no way to simulate memory pressure for testing.
3377
3378         * WebProcess/WebPage/ios/WebPageIOS.mm:
3379         (WebKit::WebPage::updateVisibleContentRects):
3380
3381 2016-07-12  Chris Dumez  <cdumez@apple.com>
3382
3383         [WK2][NetworkSession] Fix unsafe RunLoop::dispatch() in NetworkLoad constructor
3384         https://bugs.webkit.org/show_bug.cgi?id=159691
3385
3386         Reviewed by Brady Eidson.
3387
3388         Remove unsafe RunLoop::dispatch() in NetworkLoad constructor. It captured |this| but there
3389         was no guarantee the NetworkLoad would still be alive by the time the lambda gets executed.
3390
3391         Instead, the constructor now takes a NetworkSession& parameter so that the call sites
3392         have to retrieve the NetworkSession for a given SessionID and deal with the fact that
3393         there may be no such NetworkSession before constructing the NetworkLoad.
3394
3395         * NetworkProcess/Downloads/DownloadManager.cpp:
3396         (WebKit::DownloadManager::startDownload):
3397         * NetworkProcess/Downloads/PendingDownload.cpp:
3398         (WebKit::PendingDownload::PendingDownload):
3399         * NetworkProcess/Downloads/PendingDownload.h:
3400         * NetworkProcess/NetworkLoad.cpp:
3401         (WebKit::NetworkLoad::NetworkLoad):
3402         * NetworkProcess/NetworkLoad.h:
3403         * NetworkProcess/NetworkResourceLoader.cpp:
3404         (WebKit::NetworkResourceLoader::startNetworkLoad):
3405         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
3406         (WebKit::NetworkCache::SpeculativeLoad::SpeculativeLoad):
3407
3408 2016-07-12  Chris Dumez  <cdumez@apple.com>
3409
3410         [WK2] Protect against bad database data in LocalStorageDatabase::importItems()
3411         https://bugs.webkit.org/show_bug.cgi?id=159663
3412         <rdar://problem/18995873>
3413
3414         Reviewed by Benjamin Poulain.
3415
3416         Protect against bad database data in LocalStorageDatabase::importItems(). We
3417         crash if the database contains a null key or a null value so protect against
3418         it given that we have evidence it can happen.
3419
3420         With this change, I can no longer reproduce the UIProcess crash on evernote.com
3421         that is documented at <rdar://problem/18995873>.
3422
3423         * UIProcess/Storage/LocalStorageDatabase.cpp:
3424         (WebKit::LocalStorageDatabase::importItems):
3425
3426 2016-07-12  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
3427
3428         Remove ENABLE_CSS3_TEXT_LINE_BREAK flag
3429         https://bugs.webkit.org/show_bug.cgi?id=159671
3430
3431         Reviewed by Csaba Osztrogonác.
3432
3433         ENABLE_CSS3_TEXT_LINE_BREAK feature was implemented without guards.
3434         https://bugs.webkit.org/show_bug.cgi?id=89235
3435
3436         So this guard can be removed in build scripts.
3437
3438         * Configurations/FeatureDefines.xcconfig:
3439
3440 2016-07-11  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
3441
3442         Purge PassRefPtr in platform/efl and platform/mac 
3443         https://bugs.webkit.org/show_bug.cgi?id=159548
3444
3445         Reviewed by Alex Christensen.
3446
3447         Remove all use of PassRefPtr and clean up unnecessary tabs and spaces.
3448         WebKit2 codes are also changed because of setBufferForType()'s modification.
3449
3450         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
3451         (WebKit::WebPasteboardProxy::setPasteboardBufferForType):
3452         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
3453         (WebKit::WebPlatformStrategies::setBufferForType):
3454         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
3455
3456 2016-07-11  Chris Dumez  <cdumez@apple.com>
3457
3458         [WK2][iOS] Intermittent crash in [UIApplication beginBackgroundTaskWithName] expiration handler
3459         https://bugs.webkit.org/show_bug.cgi?id=159648
3460         <rdar://problem/27219361>
3461
3462         Reviewed by Anders Carlsson.
3463
3464         We see an intermittent crash in [UIApplication beginBackgroundTaskWithName] expiration handler.
3465         From the traces, we noticed the expiration handler can get called on a non-main thread under
3466         certain conditions, which our code is designed to deal with.
3467
3468         In particular, we get called on a non-main thread when UIKit fails to acquire the assertion.
3469         Update our expiration handler to always notify the clients on the main thread.
3470
3471         * UIProcess/ios/ProcessAssertionIOS.mm:
3472         (-[WKProcessAssertionBackgroundTaskManager _updateBackgroundTask]):
3473
3474 2016-07-11  Dan Bernstein  <mitz@apple.com>
3475
3476         Tried to fix the macOS build.
3477
3478         * UIProcess/API/Cocoa/WKNavigationAction.mm:
3479         (-[WKNavigationAction description]):
3480
3481 2016-07-11  Dan Bernstein  <mitz@apple.com>
3482
3483         Cleaned up API availability.
3484
3485         Requested by Tim Horton.
3486
3487         * UIProcess/API/Cocoa/WKNavigationAction.mm:
3488         * UIProcess/API/Cocoa/WKNavigationActionPrivate.h:
3489
3490 2016-07-11  Enrica Casucci  <enrica@apple.com>
3491
3492         Add synthetic click origin to WKNavigationAction.
3493         https://bugs.webkit.org/show_bug.cgi?id=159584
3494         rdar://problem/25610422
3495
3496         Reviewed by Tim Horton.
3497
3498         Adds a private property to WKNavigationAction to retrieve
3499         the origin of the synthetic click.
3500
3501         * Shared/NavigationActionData.cpp:
3502         (WebKit::NavigationActionData::encode):
3503         (WebKit::NavigationActionData::decode):
3504         * Shared/NavigationActionData.h:
3505         * Shared/WebEvent.h:
3506         (WebKit::WebMouseEvent::button):
3507         (WebKit::WebMouseEvent::menuTypeForEvent):
3508         (WebKit::WebMouseEvent::force):
3509         (WebKit::WebMouseEvent::syntheticClickType):
3510         * Shared/WebMouseEvent.cpp:
3511         (WebKit::WebMouseEvent::WebMouseEvent):
3512         (WebKit::WebMouseEvent::encode):
3513         (WebKit::WebMouseEvent::decode):
3514         * Shared/mac/WebEventFactory.mm:
3515         (WebKit::WebEventFactory::createWebMouseEvent):
3516         (WebKit::WebEventFactory::createWebWheelEvent):
3517         * UIProcess/API/APINavigationAction.h:
3518         * UIProcess/API/Cocoa/WKNavigationAction.mm:
3519         (toWKNavigationType):
3520         (toWKSyntheticClickType):
3521         (-[WKNavigationAction description]):
3522         (-[WKNavigationAction sourceFrame]):
3523         (-[WKNavigationAction request]):
3524         (-[WKNavigationAction _syntheticClickType]):
3525         (-[WKNavigationAction modifierFlags]):
3526         * UIProcess/API/Cocoa/WKNavigationActionPrivate.h:
3527         * UIProcess/WebPageProxy.h:
3528         * UIProcess/ios/WKContentViewInteraction.mm:
3529         (-[WKContentView _twoFingerSingleTapGestureRecognized:]):
3530         (-[WKContentView _longPressRecognized:]):
3531         * UIProcess/ios/WebPageProxyIOS.mm:
3532         (WebKit::WebPageProxy::getSelectionContext):
3533         (WebKit::WebPageProxy::handleTwoFingerTapAtPoint):
3534         (WebKit::WebPageProxy::selectWithTwoTouches):
3535         * WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp:
3536         (WebKit::mouseButtonForMouseEvent):
3537         (WebKit::syntheticClickTypeForMouseEvent):
3538         (WebKit::InjectedBundleNavigationAction::modifiersForNavigationAction):
3539         (WebKit::InjectedBundleNavigationAction::mouseButtonForNavigationAction):
3540         (WebKit::InjectedBundleNavigationAction::syntheticClickTypeForNavigationAction):
3541         (WebKit::InjectedBundleNavigationAction::create):
3542         (WebKit::InjectedBundleNavigationAction::InjectedBundleNavigationAction):
3543         * WebProcess/InjectedBundle/InjectedBundleNavigationAction.h:
3544         (WebKit::InjectedBundleNavigationAction::navigationType):
3545         (WebKit::InjectedBundleNavigationAction::modifiers):
3546         (WebKit::InjectedBundleNavigationAction::mouseButton):
3547         (WebKit::InjectedBundleNavigationAction::hitTestResult):
3548         (WebKit::InjectedBundleNavigationAction::formElement):
3549         (WebKit::InjectedBundleNavigationAction::syntheticClickType):
3550         (WebKit::InjectedBundleNavigationAction::shouldOpenExternalURLs):
3551         (WebKit::InjectedBundleNavigationAction::shouldTryAppLinks):
3552         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
3553         (WebKit::WebChromeClient::createWindow):
3554         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3555         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction):
3556         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
3557         * WebProcess/WebPage/WebPage.cpp:
3558         (WebKit::WebPage::navigateToPDFLinkWithSimulatedClick):
3559         (WebKit::WebPage::contextMenuAtPointInWindow):
3560         (WebKit::WebPage::dragEnded):
3561         (WebKit::WebPage::simulateMouseDown):
3562         (WebKit::WebPage::simulateMouseUp):
3563         (WebKit::WebPage::simulateMouseMotion):
3564         (WebKit::WebPage::setCompositionForTesting):
3565         * WebProcess/WebPage/WebPage.h:
3566         * WebProcess/WebPage/WebPage.messages.in:
3567         * WebProcess/WebPage/ios/WebPageIOS.mm:
3568         (WebKit::WebPage::handleSyntheticClick):
3569         (WebKit::WebPage::completePendingSyntheticClickForContentChangeObserver):
3570         (WebKit::WebPage::completeSyntheticClick):
3571         (WebKit::WebPage::sendTapHighlightForNodeIfNecessary):
3572         (WebKit::WebPage::handleTwoFingerTapAtPoint):
3573         (WebKit::WebPage::potentialTapAtPosition):
3574         (WebKit::WebPage::inspectorNodeSearchMovedToPosition):
3575
3576 2016-07-11  Anders Carlsson  <andersca@apple.com>
3577
3578         Able to open multiple payment sheets in Safari at the same time
3579         https://bugs.webkit.org/show_bug.cgi?id=159637
3580         rdar://problem/26411339
3581
3582         Reviewed by Beth Dakin.
3583
3584         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp:
3585         (WebKit::WebPaymentCoordinatorProxy::showPaymentUI):
3586         Add result out parameter. Set the result to false if isShowingPaymentUI is true, otherwise set isShowingPaymentUI to true.
3587     
3588         (WebKit::WebPaymentCoordinatorProxy::didReachFinalState):
3589         Set isShowingPaymentUI to false.
3590
3591         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.h:
3592         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.messages.in:
3593         * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
3594         (WebKit::WebPaymentCoordinator::showPaymentUI):
3595         * WebProcess/ApplePay/WebPaymentCoordinator.h:
3596         The showPaymentUI message and client functions now return booleans.
3597
3598 2016-07-11  Commit Queue  <commit-queue@webkit.org>
3599
3600         Unreviewed, rolling out r203064.
3601         https://bugs.webkit.org/show_bug.cgi?id=159642
3602
3603         This change causes LayoutTest crashes on WK1 ASan (Requested
3604         by ryanhaddad on #webkit).
3605
3606         Reverted changeset:
3607
3608         "Use refs for ResourceLoaders"
3609         https://bugs.webkit.org/show_bug.cgi?id=159592
3610         http://trac.webkit.org/changeset/203064
3611
3612 2016-07-11  Nan Wang  <n_wang@apple.com>
3613
3614         AX: WKWebView should have API to prevent pinch-to-zoom always being allowed
3615         https://bugs.webkit.org/show_bug.cgi?id=158364
3616
3617         Reviewed by Anders Carlsson.
3618
3619         Added a property in WKWebViewConfiguration so that developers can toggle the ignoring
3620         viewport scale limits setting.
3621
3622         Changes are covered in modified tests.
3623
3624         * Shared/WebPageCreationParameters.cpp:
3625         (WebKit::WebPageCreationParameters::encode):
3626         (WebKit::WebPageCreationParameters::decode):
3627         * Shared/WebPageCreationParameters.h:
3628         * UIProcess/API/C/WKPage.cpp:
3629         (WKPageSetResourceCachingDisabled):
3630         (WKPageSetIgnoresViewportScaleLimits):
3631         * UIProcess/API/C/WKPagePrivate.h:
3632         * UIProcess/API/Cocoa/WKWebView.mm:
3633         (shouldAllowPictureInPictureMediaPlayback):
3634         (-[WKWebView _initializeWithConfiguration:]):
3635         (-[WKWebView _navigationGestureDidEnd]):
3636         (forceAlwaysUserScalableChangedCallback): Deleted.
3637         (-[WKWebView _updateForceAlwaysUserScalable]): Deleted.
3638         * UIProcess/API/Cocoa/WKWebViewConfiguration.h:
3639         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
3640         (-[WKWebViewConfiguration init]):
3641         (-[WKWebViewConfiguration encodeWithCoder:]):
3642         (-[WKWebViewConfiguration initWithCoder:]):
3643         (-[WKWebViewConfiguration copyWithZone:]):
3644         * UIProcess/API/Cocoa/WKWebViewInternal.h:
3645         * UIProcess/WebPageProxy.cpp:
3646         (WebKit::WebPageProxy::creationParameters):
3647         * UIProcess/WebPageProxy.h:
3648         * UIProcess/ios/WebPageProxyIOS.mm:
3649         (WebKit::WebPageProxy::setViewportConfigurationMinimumLayoutSize):
3650         (WebKit::WebPageProxy::setForceAlwaysUserScalable):
3651         (WebKit::WebPageProxy::setMaximumUnobscuredSize):
3652         (WebKit::WebPageProxy::updateForceAlwaysUserScalable): Deleted.
3653         * WebProcess/WebPage/WebPage.cpp:
3654         (WebKit::WebPage::updatePreferences):
3655         * WebProcess/WebPage/WebPage.h:
3656         * WebProcess/WebPage/WebPage.messages.in:
3657         * WebProcess/WebPage/ios/WebPageIOS.mm:
3658         (WebKit::WebPage::disableInspectorNodeSearch):
3659         (WebKit::WebPage::setForceAlwaysUserScalable):
3660         (WebKit::innerFrameQuad):
3661         (WebKit::WebPage::updateForceAlwaysUserScalable): Deleted.
3662
3663 2016-07-08  Alex Christensen  <achristensen@webkit.org>
3664
3665         Use refs for ResourceLoaders
3666         https://bugs.webkit.org/show_bug.cgi?id=159592
3667
3668         Reviewed by Chris Dumez.
3669
3670         * WebProcess/Network/WebLoaderStrategy.cpp:
3671         (WebKit::WebLoaderStrategy::scheduleInternallyFailedLoad):
3672         (WebKit::WebLoaderStrategy::internallyFailedLoadTimerFired):
3673         (WebKit::WebLoaderStrategy::startLocalLoad):
3674         (WebKit::WebLoaderStrategy::remove):
3675         (WebKit::WebLoaderStrategy::setDefersLoading):
3676         (WebKit::WebLoaderStrategy::crossOriginRedirectReceived):
3677         * WebProcess/Network/WebLoaderStrategy.h:
3678
3679 2016-07-11  Antti Koivisto  <antti@apple.com>
3680
3681         Update stable cache version in NetworkCache::Storage::deleteOldVersions()
3682         https://bugs.webkit.org/show_bug.cgi?id=159618
3683         rdar://problem/26715745
3684
3685         Reviewed by Chris Dumez.
3686
3687         NetworkCache::Storage::deleteOldVersions() keeps the previous shipped cache version (4) for Mac around so
3688         development WebKit doesn’t clobber system Safari cache. Update this to the current version so old caches
3689         go away in customer systems.
3690
3691         * NetworkProcess/cache/NetworkCacheStorage.cpp:
3692         (WebKit::NetworkCache::Storage::deleteOldVersions):
3693         * NetworkProcess/cache/NetworkCacheStorage.h:
3694
3695             Move lastStableVersion to header next to the current version.
3696
3697 2016-07-10  Beth Dakin  <bdakin@apple.com>
3698
3699         Update mediaIcon.pdf
3700         https://bugs.webkit.org/show_bug.cgi?id=159613
3701         -and corresponding-
3702         rdar://problem/27268111
3703
3704         Reviewed by Sam Weinig.
3705
3706         * Resources/mediaIcon.pdf: Replaced.
3707
3708 2016-07-10  Alex Christensen  <achristensen@webkit.org>
3709
3710         Add self to WebKit2 Owners
3711         https://bugs.webkit.org/show_bug.cgi?id=159499
3712
3713         Reviewed by Sam Weinig.
3714
3715         * Owners:
3716
3717 2016-07-10  Alex Christensen  <achristensen@webkit.org>
3718
3719         Fix client certificate authentication after r200463
3720         https://bugs.webkit.org/show_bug.cgi?id=159574
3721         <rdar://problem/26931006>
3722
3723         Reviewed by Sam Weinig.
3724
3725         * Shared/Authentication/mac/AuthenticationManager.mac.mm:
3726         (WebKit::leafCertificate):
3727         (WebKit::chain):
3728         Handle the different types of CertificateInfos.
3729
3730 2016-07-08  Yongjun Zhang  <yongjun_zhang@apple.com>
3731
3732         When WKWebView prepares the session state blob, we should be able to filter it.
3733         https://bugs.webkit.org/show_bug.cgi?id=159410
3734
3735         Add a SPI to WKWebView so that a client can decide how to filter backforward items
3736         when WKWebView perparing session state.
3737
3738         Reviewed by Brady Eidson.
3739
3740         * UIProcess/API/Cocoa/WKWebView.mm:
3741         (-[WKWebView _sessionStateWithFilter:]): When preparing session state, check each
3742         backforward item against the filter block.
3743         * UIProcess/API/Cocoa/WKWebViewPrivate.h: Add the SPI _sessionStateWithFilter:
3744
3745
3746 2016-07-08  Tim Horton  <timothy_horton@apple.com>
3747
3748         Mail messages don't start loading until scrolling completes
3749         https://bugs.webkit.org/show_bug.cgi?id=159585
3750         <rdar://problem/27088405>
3751
3752         Reviewed by Andy Estes.
3753
3754         * UIProcess/Network/CustomProtocols/mac/CustomProtocolManagerProxyMac.mm:
3755         (-[WKCustomProtocolLoader initWithCustomProtocolManagerProxy:customProtocolID:request:connection:]):
3756         When scrolling, NSDefaultRunLoopMode isn't run, but NSRunLoopCommonModes are.
3757         CFNetwork uses NSDefaultRunLoopMode if we tell NSURLConnection to "start immediately",
3758         but we can instead schedule our NSURLConnection into NSRunLoopCommonModes
3759         and start it ourselves, ensuring that it will be able to do work while scrolling is happening.
3760
3761 2016-07-08  Andy Estes  <aestes@apple.com>
3762
3763         [Content Filtering] Load blocked pages more like other error pages are loaded
3764         https://bugs.webkit.org/show_bug.cgi?id=159485
3765         <rdar://problem/26014076>
3766
3767         Reviewed by Brady Eidson.
3768
3769         * Shared/API/c/WKErrorRef.h: Defined kWKErrorCodeFrameLoadBlockedByContentFilter.
3770         * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
3771         (WebKit::WebProcessProxy::platformPathsWithAssumedReadAccess): Added the resource directories
3772         of WebCore.framework and WebKit.framework as paths with assumed read access.
3773         * UIProcess/WebProcessProxy.cpp:
3774         (WebKit::WebProcessProxy::hasAssumedReadAccessToURL): Checked platformPathsWithAssumedReadAccess()
3775         as well as m_localPathsWithAssumedReadAccess.
3776         (WebKit::WebProcessProxy::platformPathsWithAssumedReadAccess): Added a non-Cocoa implementation.
3777         * UIProcess/WebProcessProxy.h:
3778         * WebProcess/WebCoreSupport/WebErrors.h:
3779         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3780         (WebKit::WebFrameLoaderClient::blockedByContentFilterError): Called WebKit::blockedByContentFilterError().
3781         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
3782         * WebProcess/WebCoreSupport/mac/WebErrorsMac.mm:
3783         (WebKit::blockedByContentFilterError): Returned a ResourceError for kWKErrorCodeFrameLoadBlockedByContentFilter.
3784
3785 2016-07-08  Anders Carlsson  <andersca@apple.com>
3786
3787         Fix 32-bit build.
3788
3789         * PluginProcess/mac/PluginProcessShim.mm:
3790
3791 2016-07-07  Anders Carlsson  <andersca@apple.com>
3792
3793         REGRESSION (r196321): Adobe Reader DC + Safari : Zoom level pulldown is not displayed at the correct position
3794         https://bugs.webkit.org/show_bug.cgi?id=159531
3795         rdar://problem/26382579
3796
3797         Reviewed by Tim Horton.
3798
3799         There's code in the Adobe Acrobat framework that checks if the main bundle identifier is "com.apple.WebKit.PluginProcess"
3800         and assumes that it's running inside the Adobe Reader app if it's something else. Since we're now using the XPC service
3801         for all plug-ins, the bundle identifier is "com.apple.WebKit.Plugin.64", so the Acrobat framework assumes it's running in the app
3802         and doesn't use any special tricks to show the popup menu.
3803         
3804         Work around this by shimming CFStringCompare, and looking for the exact conditions when this can happen and return kCFCompareEqualTo
3805         when all conditions are true.
3806         
3807         * PluginProcess/mac/PluginProcessMac.mm:
3808         (WebKit::isAdobeAcrobatAddress):
3809         (WebKit::stringCompare):
3810         (WebKit::initializeShim):
3811         (WebKit::PluginProcess::platformInitializeProcess):
3812         * PluginProcess/mac/PluginProcessShim.h:
3813         * PluginProcess/mac/PluginProcessShim.mm:
3814         (WebKit::shimCFStringCompare):
3815
3816 2016-07-08  Brady Eidson  <beidson@apple.com>
3817
3818         Unreviewed: Fix case-sensitive filesystem build.
3819
3820         * UIProcess/Storage/LocalStorageDatabaseTracker.cpp:
3821
3822 2016-07-08  Commit Queue  <commit-queue@webkit.org>
3823
3824         Unreviewed, rolling out r202944.
3825         https://bugs.webkit.org/show_bug.cgi?id=159570
3826
3827         caused some tests to crash under GuardMalloc (Requested by
3828         estes on #webkit).
3829
3830         Reverted changeset:
3831
3832         "[Content Filtering] Load blocked pages more like other error
3833         pages are loaded"
3834         https://bugs.webkit.org/show_bug.cgi?id=159485
3835         http://trac.webkit.org/changeset/202944
3836
3837 2016-07-08  Keith Rollin  <krollin@apple.com>
3838
3839         Add always-on logging for downloads
3840         https://bugs.webkit.org/show_bug.cgi?id=159521
3841         <rdar://problem/26630645>
3842
3843         Reviewed by Alex Christensen.
3844
3845         Add logging statements that track when a download starts, when it
3846         first receives data, and when the download is done (due to completion,
3847         cancelation, or failure).
3848
3849         * NetworkProcess/Downloads/Download.cpp:
3850         (WebKit::Download::Download):
3851         (WebKit::Download::didReceiveResponse):
3852         (WebKit::Download::didReceiveData):
3853         (WebKit::Download::didFinish):
3854         (WebKit::Download::didFail):
3855         (WebKit::Download::didCancel):
3856         (WebKit::Download::isAlwaysOnLoggingAllowed):
3857         * NetworkProcess/Downloads/Download.h:
3858         (WebKit::Download::Download):
3859         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3860         (-[WKNetworkSessionDelegate URLSession:dataTask:didBecomeDownloadTask:]):
3861
3862 2016-07-08  Brady Eidson  <beidson@apple.com>
3863
3864         Clearing LocalStorage doesn't also delete -wal and -shm files.
3865         <rdar://problem/27206772> and https://bugs.webkit.org/show_bug.cgi?id=159566
3866
3867         Reviewed by Brent Fulgham.
3868         Also helpfully picked over by Andy "Never Forgets" Estes.
3869
3870         * UIProcess/Storage/LocalStorageDatabaseTracker.cpp:
3871         (WebKit::LocalStorageDatabaseTracker::removeDatabaseWithOriginIdentifier):
3872
3873 2016-07-07  Andy Estes  <aestes@apple.com>
3874
3875         [Content Filtering] Load blocked pages more like other error pages are loaded
3876         https://bugs.webkit.org/show_bug.cgi?id=159485
3877         <rdar://problem/26014076>
3878
3879         Reviewed by Brady Eidson.
3880
3881         * Shared/API/c/WKErrorRef.h: Defined kWKErrorCodeFrameLoadBlockedByContentFilter.
3882         * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
3883         (WebKit::WebProcessProxy::platformPathsWithAssumedReadAccess): Added the resource directories
3884         of WebCore.framework and WebKit.framework as paths with assumed read access.
3885         * UIProcess/WebProcessProxy.cpp:
3886         (WebKit::WebProcessProxy::hasAssumedReadAccessToURL): Checked platformPathsWithAssumedReadAccess()
3887         as well as m_localPathsWithAssumedReadAccess.
3888         (WebKit::WebProcessProxy::platformPathsWithAssumedReadAccess): Added a non-Cocoa implementation.
3889         * UIProcess/WebProcessProxy.h:
3890         * WebProcess/WebCoreSupport/WebErrors.h:
3891         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3892         (WebKit::WebFrameLoaderClient::blockedByContentFilterError): Called WebKit::blockedByContentFilterError().
3893         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
3894         * WebProcess/WebCoreSupport/mac/WebErrorsMac.mm:
3895         (WebKit::blockedByContentFilterError): Returned a ResourceError for kWKErrorCodeFrameLoadBlockedByContentFilter.
3896
3897 2016-07-07  Alex Christensen  <achristensen@webkit.org>
3898
3899         Followup to r202939.
3900         https://bugs.webkit.org/show_bug.cgi?id=159526
3901
3902         * NetworkProcess/NetworkResourceLoader.cpp:
3903         (WebKit::NetworkResourceLoader::didFailLoading):
3904         We need the correct destination id when sending a message.
3905
3906 2016-07-07  Alex Christensen  <achristensen@webkit.org>
3907
3908         Fix crash when sending failure message to closed WebProcess
3909         https://bugs.webkit.org/show_bug.cgi?id=159526
3910         <rdar://problem/26767037>
3911
3912         Reviewed by Brady Eidson.
3913
3914         * NetworkProcess/NetworkResourceLoader.cpp:
3915         (WebKit::NetworkResourceLoader::didFailLoading):
3916         Check to see if there is a connection before using it to send a message.
3917         Sometimes it was null.
3918         I think this could be tested if we had real network loading from TestWebKitAPI
3919         by cancelling slow loads and closing WebProcesses around the same time, but no such infrastructure exists yet.
3920
3921 2016-07-07  Alex Christensen  <achristensen@webkit.org>
3922
3923         Use SocketProvider to create WebSocketChannels
3924         https://bugs.webkit.org/show_bug.cgi?id=158776
3925
3926         Reviewed by Brent Fulgham.
3927
3928         * CMakeLists.txt:
3929         * WebKit2.xcodeproj/project.pbxproj:
3930         * WebProcess/Network/WebSo