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