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