Add IconLoadingDelegate functionality to WKView.
[WebKit-https.git] / Source / WebKit2 / ChangeLog
1 2017-01-11  Brady Eidson  <beidson@apple.com>
2
3         Add IconLoadingDelegate functionality to WKView.
4         https://bugs.webkit.org/show_bug.cgi?id=166951
5
6         Reviewed by Tim Horton.
7         
8         * UIProcess/API/mac/WKView.mm:
9         (-[WKView dealloc]):
10         (-[WKView maybeInstallIconLoadingClient]): If the subclass implements the delegate method, install the
11           icon loading client. Otherwise, maintain the normal IconDatabase loading behavior.
12         (-[WKView initWithFrame:processPool:configuration:webView:]):
13
14 2017-01-11  Brent Fulgham  <bfulgham@apple.com>
15
16         [WK2][Cocoa] Avoid null dereference in FullScreen code.
17         https://bugs.webkit.org/show_bug.cgi?id=166957
18         <rdar://problem/27745004>
19
20         Reviewed by Eric Carlson.
21
22         * WebProcess/cocoa/WebVideoFullscreenManager.mm:
23         (WebKit::WebVideoFullscreenManager::didSetupFullscreen): Use protected reference to 'this', and check for valid
24         page before attempting to use it.
25
26 2017-01-11  Anders Carlsson  <andersca@apple.com>
27
28         navigator.plugins.refresh and WKContextRefreshPlugIns doesn't pick up changes to already-present plug-ins
29         https://bugs.webkit.org/show_bug.cgi?id=166942
30         rdar://problem/29839194
31
32         Reviewed by Sam Weinig.
33
34         Use _CFBundleCreateUnique so the resulting bundle won't be cached.
35
36         * Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm:
37         (WebKit::NetscapePluginModule::getPluginInfo):
38
39 2017-01-11  Anders Carlsson  <andersca@apple.com>
40
41         REGRESSION: Crash in com.apple.WebKit: IPC::Connection::sendMessage(std::__1::unique_ptr<IPC::MachMessage, std::__1::default_delete<IPC::MachMessage> >) + 27
42         https://bugs.webkit.org/show_bug.cgi?id=165854
43         rdar://problem/29757269
44
45         Reviewed by Tim Horton.
46
47         * Platform/IPC/mac/ConnectionMac.mm:
48         (IPC::Connection::sendMessage):
49         Add assertion.
50
51         (IPC::Connection::initializeSendSource):
52         Turns out the event handler can be called spuriously, so guard against that.
53
54 2017-01-11  Chris Dumez  <cdumez@apple.com>
55
56         [iOS][WK2] KeyboardEvent.key always returns an empty string
57         https://bugs.webkit.org/show_bug.cgi?id=166918
58         <rdar://problem/29861147>
59
60         Reviewed by Wenson Hsieh.
61
62         Make sure that KeyboardEvent.key gets properly initialized on iOS / WK2.
63
64         * Shared/WebEvent.h:
65         * Shared/WebKeyboardEvent.cpp:
66         (WebKit::WebKeyboardEvent::WebKeyboardEvent):
67         * Shared/ios/WebIOSEventFactory.mm:
68         (WebIOSEventFactory::createWebKeyboardEvent):
69
70 2017-01-10  Michael Catanzaro  <mcatanzaro@igalia.com>
71
72         [GTK] No way for applications to set notification permissions without waiting for permission request
73         https://bugs.webkit.org/show_bug.cgi?id=163366
74
75         Reviewed by Carlos Garcia Campos.
76
77         Websites can check the Notification.permission DOM property to check if they have permission
78         to show notifications *without triggering a permission request*. But the WebKitGTK+ API has
79         no way to affirmatively indicate notifications are allowed without a permission request. The
80         only way is via the permission request API, which is too late. It's a problem for Epiphany.
81         For example, open the Riot Matrix client in a web app; you will immediately see an info bar
82         informing the user that Riot does not have permission to send desktop notifications, even
83         though Epiphany automatically grants notification permission in web app mode when requested.
84         This problem is not exclusive to web apps; there is simply no way for notification
85         permission to be set correctly prior to a permission request for it. Fix this by introducing
86         a webkit_web_context_initialize_notification_permissions() API, and add a signal
87         WebKitWebContext::initialize-notification-permissions to indicate when it should be called.
88
89         * UIProcess/API/gtk/WebKitNotificationProvider.cpp:
90         (notificationPermissionsCallback):
91         (WebKitNotificationProvider::create):
92         (WebKitNotificationProvider::WebKitNotificationProvider):
93         (WebKitNotificationProvider::notificationPermissions):
94         (WebKitNotificationProvider::setNotificationPermissions):
95         * UIProcess/API/gtk/WebKitNotificationProvider.h:
96         * UIProcess/API/gtk/WebKitSecurityOrigin.cpp:
97         (webkitSecurityOriginGetSecurityOrigin):
98         * UIProcess/API/gtk/WebKitSecurityOriginPrivate.h:
99         * UIProcess/API/gtk/WebKitWebContext.cpp:
100         (webkitWebContextConstructed):
101         (webkit_web_context_class_init):
102         (addOriginToMap):
103         (webkit_web_context_initialize_notification_permissions):
104         (webkitWebContextInitializeNotificationPermissions):
105         * UIProcess/API/gtk/WebKitWebContext.h:
106         * UIProcess/API/gtk/WebKitWebContextPrivate.h:
107         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
108
109 2017-01-10  Keith Rollin  <krollin@apple.com>
110
111         Record/replay: fix range used for fuzzy matching
112         https://bugs.webkit.org/show_bug.cgi?id=166041
113
114         Reviewed by Darin Adler and Alex Christensen.
115
116         Because of two bugs, the attempt to determine the range of URLs to
117         check as part of the process of fuzzy matching was failing. The intent
118         was to find the range of URLs that started with the same
119         <scheme://host:port> as a given URL. However, because of a reversed
120         test, the upper end of the range ended up being the "end()" iterator
121         of the entire collection of URLs. With that fixed, there was another
122         bug due to one URL being given as <scheme://host:port> and the other
123         given as <scheme://host:port/> (note the trailing slash). Both of
124         these issues are now fixed.
125
126         * NetworkProcess/capture/NetworkCaptureManager.cpp:
127         (WebKit::NetworkCapture::Manager::initialize):
128         (WebKit::NetworkCapture::Manager::findBestFuzzyMatch):
129         (WebKit::NetworkCapture::Manager::urlIdentifyingCommonDomain):
130         * NetworkProcess/capture/NetworkCaptureManager.h:
131         * NetworkProcess/capture/NetworkCaptureResource.cpp:
132         (WebKit::NetworkCapture::Resource::url):
133         (WebKit::NetworkCapture::Resource::urlIdentifyingCommonDomain):
134         (WebKit::NetworkCapture::Resource::baseURL): Deleted.
135         * NetworkProcess/capture/NetworkCaptureResource.h:
136
137 2017-01-10  Wenson Hsieh  <wenson_hsieh@apple.com>
138
139         Implement "proximity" scroll snapping
140         https://bugs.webkit.org/show_bug.cgi?id=135994
141         <rdar://problem/18162418>
142
143         Reviewed by Dean Jackson.
144
145         Adds boilerplate support for plumbing lists of snap offset ranges from the web process to the UI process
146         alongside the list of snap offsets.
147
148         * Shared/Scrolling/RemoteScrollingCoordinatorTransaction.cpp:
149         (ArgumentCoder<ScrollingStateScrollingNode>::encode):
150         (ArgumentCoder<ScrollingStateScrollingNode>::decode):
151         * Shared/WebCoreArgumentCoders.cpp:
152         (IPC::ArgumentCoder<ScrollOffsetRange<float>>::encode):
153         (IPC::ArgumentCoder<ScrollOffsetRange<float>>::decode):
154         * Shared/WebCoreArgumentCoders.h:
155         * UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
156         (-[WKOverflowScrollViewDelegate scrollViewWillEndDragging:withVelocity:targetContentOffset:]):
157         * UIProcess/ios/RemoteScrollingCoordinatorProxyIOS.mm:
158
159         Adjust mainframe proximity scroll snapping logic to not subtract out the top content inset when there is no
160         active snap offset (i.e. when snapping rests in a snap offset range). Attempting to subtract out the top inset
161         in this case caused the scroll offset to jump after ending a drag with no momentum in a snap offset range.
162
163         (WebKit::RemoteScrollingCoordinatorProxy::adjustTargetContentOffsetForSnapping):
164         (WebKit::RemoteScrollingCoordinatorProxy::shouldSnapForMainFrameScrolling):
165         (WebKit::RemoteScrollingCoordinatorProxy::closestSnapOffsetForMainFrameScrolling):
166
167 2017-01-10  Zan Dobersek  <zdobersek@igalia.com>
168
169         ThreadedCoordinatedLayerTreeHost::renderNextFrame() should short-cut to layer flushing
170         https://bugs.webkit.org/show_bug.cgi?id=157614
171
172         Reviewed by Carlos Garcia Campos.
173
174         CoordinatedLayerTreeHost prevents any layer flushes while a previously-commited scene
175         state is still being rendered on the composition thread. renderNextFrame() is called
176         once that is complete, and a new layer flush is scheduled.
177
178         This change improves the whole ordeal by immediately performing the layer flush only if
179         it was requested during the time we were waiting on the renderer (i.e. when the latest
180         scene state was being composited), instead of scheduling it unconditionally.
181         m_scheduledWhileWaitingForRenderer member variable is added to track that occurrence.
182
183         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
184         (WebKit::CoordinatedLayerTreeHost::scheduleLayerFlush):
185         (WebKit::CoordinatedLayerTreeHost::renderNextFrame):
186         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h:
187
188 2017-01-09  Chris Dumez  <cdumez@apple.com>
189
190         [iOS] Drop VNodeTracker
191         https://bugs.webkit.org/show_bug.cgi?id=166868
192         <rdar://problem/29937587>
193
194         Reviewed by Andreas Kling.
195
196         * WebProcess/cocoa/WebProcessCocoa.mm:
197         (WebKit::WebProcess::platformInitializeWebProcess):
198
199 2017-01-09  Enrica Casucci  <enrica@apple.com>
200
201         Selection animation flashing on editable content when zooming.
202         https://bugs.webkit.org/show_bug.cgi?id=166863
203         rdar://problem/29931470
204
205         Reviewed by Tim Horton.
206
207         Implementing _allowAnimatedUpdateSelectionRectView and returning NO,
208         prevents the selection animation in UIKit.
209
210         * UIProcess/ios/WKContentViewInteraction.mm:
211         (-[WKContentView _allowAnimatedUpdateSelectionRectViews]):
212
213 2017-01-06  Gustavo Noronha Silva  <gustavo.noronha@collabora.co.uk>
214
215         [GTK] Should support key and code properties on keyboard events
216         https://bugs.webkit.org/show_bug.cgi?id=166759
217
218         Reviewed by Carlos Garcia Campos.
219
220         * Shared/WebEvent.h:
221         * Shared/WebKeyboardEvent.cpp:
222         (WebKit::WebKeyboardEvent::WebKeyboardEvent): accept web key value and code on construction.
223         * Shared/gtk/WebEventFactory.cpp:
224         (WebKit::WebEventFactory::createWebKeyboardEvent): pass web key value and code on construction.
225
226 2017-01-08  Antti Koivisto  <antti@apple.com>
227
228         Move cache coders to WTF
229         https://bugs.webkit.org/show_bug.cgi?id=166825
230
231         Rubber-stamped by Sam Weinig.
232
233         * NetworkProcess/cache/NetworkCache.h:
234         * NetworkProcess/cache/NetworkCacheCoder.h: Removed.
235         * NetworkProcess/cache/NetworkCacheCoders.cpp:
236         (WebKit::NetworkCache::Coder<AtomicString>::encode): Deleted.
237         (WebKit::NetworkCache::Coder<AtomicString>::decode): Deleted.
238         (WebKit::NetworkCache::Coder<CString>::encode): Deleted.
239         (WebKit::NetworkCache::Coder<CString>::decode): Deleted.
240         (WebKit::NetworkCache::Coder<String>::encode): Deleted.
241         (WebKit::NetworkCache::decodeStringText): Deleted.
242         (WebKit::NetworkCache::Coder<String>::decode): Deleted.
243         (WebKit::NetworkCache::Coder<SHA1::Digest>::encode): Deleted.
244         (WebKit::NetworkCache::Coder<SHA1::Digest>::decode): Deleted.
245         (WebKit::NetworkCache::Coder<WebCore::HTTPHeaderMap>::encode): Deleted.
246         (WebKit::NetworkCache::Coder<WebCore::HTTPHeaderMap>::decode): Deleted.
247         * NetworkProcess/cache/NetworkCacheCoders.h:
248         (): Deleted.
249         (WebKit::NetworkCache::Coder<std::optional<T>>::encode): Deleted.
250         (WebKit::NetworkCache::Coder<std::optional<T>>::decode): Deleted.
251         * NetworkProcess/cache/NetworkCacheCodersCocoa.cpp:
252         (WebKit::NetworkCache::encodeCFData): Deleted.
253         (WebKit::NetworkCache::decodeCFData): Deleted.
254         (WebKit::NetworkCache::encodeSecTrustRef): Deleted.
255         (WebKit::NetworkCache::decodeSecTrustRef): Deleted.
256         (WebKit::NetworkCache::encodeCertificateChain): Deleted.
257         (WebKit::NetworkCache::decodeCertificateChain): Deleted.
258         (WebKit::NetworkCache::Coder<WebCore::CertificateInfo>::encode): Deleted.
259         (WebKit::NetworkCache::Coder<WebCore::CertificateInfo>::decode): Deleted.
260         * NetworkProcess/cache/NetworkCacheDecoder.cpp: Removed.
261         * NetworkProcess/cache/NetworkCacheDecoder.h: Removed.
262         * NetworkProcess/cache/NetworkCacheEncoder.cpp: Removed.
263         * NetworkProcess/cache/NetworkCacheEncoder.h: Removed.
264         * NetworkProcess/cache/NetworkCacheEntry.cpp:
265         (WebKit::NetworkCache::Entry::encodeAsStorageRecord):
266         (WebKit::NetworkCache::Entry::decodeStorageRecord):
267         * NetworkProcess/cache/NetworkCacheKey.cpp:
268         (WebKit::NetworkCache::Key::encode):
269         (WebKit::NetworkCache::Key::decode):
270         * NetworkProcess/cache/NetworkCacheKey.h:
271         * NetworkProcess/cache/NetworkCacheStorage.cpp:
272         (WebKit::NetworkCache::decodeRecordMetaData):
273         (WebKit::NetworkCache::encodeRecordMetaData):
274         * NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp:
275         (WebKit::NetworkCache::SubresourceInfo::encode):
276         (WebKit::NetworkCache::SubresourceInfo::decode):
277         (WebKit::NetworkCache::SubresourcesEntry::encodeAsStorageRecord):
278         (WebKit::NetworkCache::SubresourcesEntry::decodeStorageRecord):
279         * NetworkProcess/cache/NetworkCacheSubresourcesEntry.h:
280         * UIProcess/API/APIUserContentExtensionStore.cpp:
281         (API::encodeContentExtensionMetaData):
282         (API::decodeContentExtensionMetaData):
283         * WebKit2.xcodeproj/project.pbxproj:
284
285 2017-01-09  Tomas Popela  <tpopela@redhat.com>
286
287         [GTK] Replace WebKitWebSettings with WebKitSettings in documentation
288         https://bugs.webkit.org/show_bug.cgi?id=166836
289
290         Reviewed by Carlos Garcia Campos.
291
292         Don't use WebKitWebSettings (it was a WebKit1 thing) in documentation,
293         but replace it with WebKitSettings.
294
295         * UIProcess/API/gtk/WebKitSettings.cpp:
296         (webkit_settings_class_init):
297         * UIProcess/API/gtk/WebKitWebView.cpp:
298
299 2017-01-06  Darin Adler  <darin@apple.com>
300
301         Remove PassRefPtr use from "inspector", "platform/sql", and "platform/text"
302         https://bugs.webkit.org/show_bug.cgi?id=166797
303
304         Reviewed by Alex Christensen.
305
306         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
307         (WebKit::WebEditorClient::requestCheckingOfString): Take a reference
308         instead of a PassRefPtr.
309         * WebProcess/WebCoreSupport/WebEditorClient.h: Updated for above change.
310
311 2017-01-07  Andy Estes  <aestes@apple.com>
312
313         [QuickLook] Consolidate usage of QuickLookHandle into SubresourceLoader
314         https://bugs.webkit.org/show_bug.cgi?id=166713
315
316         Reviewed by Alex Christensen.
317
318         * WebProcess/Network/WebResourceLoader.cpp:
319         (WebKit::WebResourceLoader::didReceiveResponse): Removed QuickLook code.
320         (WebKit::WebResourceLoader::didReceiveData): Ditto.
321         (WebKit::WebResourceLoader::didFinishResourceLoad): Ditto.
322         (WebKit::WebResourceLoader::didFailResourceLoad): Ditto.
323         (WebKit::WebResourceLoader::didReceiveResource): Ditto.
324
325 2017-01-06  Daniel Bates  <dabates@apple.com>
326
327         Attempt to fix the EFL build following <http://trac.webkit.org/changeset/210461>
328         (https://bugs.webkit.org/show_bug.cgi?id=166781)
329
330         * UIProcess/API/C/WKWebsitePolicies.cpp:
331         (WKWebsitePoliciesGetAutoplayPolicy): Invoke ASSERT_NOT_REACHED() and return kWKWebsiteAutoplayPolicyUseHeuristics
332         if the specified policy is not covered by a switch case.
333         (WKWebsitePoliciesSetAutoplayPolicy): Substituted "return" for "break" in each switch case and
334         invoke ASSERT_NOT_REACHED() if the specified policy is not covered by a switch case.
335
336 2017-01-06  Matt Rajca  <mrajca@apple.com>
337
338         Add infrastructure for sending autoplay website policies to WebKit
339         https://bugs.webkit.org/show_bug.cgi?id=166781
340
341         Reviewed by Alex Christensen.
342
343         * Shared/WebsitePolicies.h:
344         (WebKit::WebsitePolicies::encode):
345         (WebKit::WebsitePolicies::decode):
346         * UIProcess/API/APIWebsitePolicies.h:
347         * UIProcess/API/C/WKWebsitePolicies.cpp:
348         (WKWebsitePoliciesGetAutoplayPolicy):
349         (WKWebsitePoliciesSetAutoplayPolicy):
350         * UIProcess/API/C/WKWebsitePolicies.h:
351         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
352         * UIProcess/API/Cocoa/_WKWebsitePolicies.mm:
353         (-[_WKWebsitePolicies setAutoplayPolicy:]):
354         (-[_WKWebsitePolicies autoplayPolicy]):
355
356 2017-01-05  Carlos Garcia Campos  <cgarcia@igalia.com>
357
358         [SOUP] Network process crash in WebKit::CustomProtocolManagerImpl::didFailWithError
359         https://bugs.webkit.org/show_bug.cgi?id=165082
360
361         Reviewed by Alex Christensen.
362
363         CustomProtocolManager uses a Workqueue to receive the IPC messages since r149194. Then we added the Soup
364         implementation adopting that approach, but without making our implementation thread safe. The crash happens
365         because the CustomProtocolManager implementation is used by two threads at the same time, the main thread
366         because of a ping load (probably caused by an image load in the unload handler, I haven't been able to
367         reproduce the crash) and the work queue thread. The reasons to make CustomProtocolManager use a WorkQueue
368         are no longer valid because CustomProtocolManager is now only used in the network process and sync loads don't
369         use any nested run loop, they are just an IPC sync message. So this patch makes CustomProtocolManager a normal
370         message receiver again to ensure messages are handled in the main thread. It also adds the common implementation
371         to a new CustomProtocolManager.cpp file shared by Cocoa and Soup based ports.
372
373         * CMakeLists.txt: Add CustomProtocolManager.cpp.
374         * NetworkProcess/CustomProtocols/Cocoa/CustomProtocolManagerCocoa.mm:
375         (-[WKCustomProtocol initWithRequest:cachedResponse:client:]): Use new CustomProtocolManager API.
376         (-[WKCustomProtocol startLoading]): Ditto.
377         (-[WKCustomProtocol stopLoading]): Ditto.
378         (WebKit::CustomProtocolManager::registerProtocolClass): Register the NSURLProtocol class when not using the
379         network session.
380         (WebKit::CustomProtocolManager::didFailWithError): removeCustomProtocol now receives an ID.
381         (WebKit::CustomProtocolManager::didFinishLoading): Ditto.
382         * NetworkProcess/CustomProtocols/CustomProtocolManager.cpp: Added.
383         (WebKit::generateCustomProtocolID): Moved from CustomProtocolManagerCocoa.mm and CustomProtocolManagerSoup.cpp.
384         (WebKit::CustomProtocolManager::supplementName): Ditto.
385         (WebKit::CustomProtocolManager::CustomProtocolManager): Also removes the work queue initialization.
386         (WebKit::CustomProtocolManager::initialize): Copied and modernized the loop.
387         (WebKit::CustomProtocolManager::addCustomProtocol): Copied from CustomProtocolManagerCocoa.mm.
388         (WebKit::CustomProtocolManager::removeCustomProtocol): Ditto.
389         (WebKit::CustomProtocolManager::startLoading): Send the StartLoading message to the proxy.
390         (WebKit::CustomProtocolManager::stopLoading): Send the StopLoading message to the proxy.
391         * NetworkProcess/CustomProtocols/CustomProtocolManager.h:
392         * NetworkProcess/CustomProtocols/soup/CustomProtocolManagerImpl.cpp: Removed.
393         * NetworkProcess/CustomProtocols/soup/CustomProtocolManagerImpl.h: Removed.
394         * NetworkProcess/CustomProtocols/soup/CustomProtocolManagerSoup.cpp: Moved the implementation from
395         CustomProtocolManagerImpl and updated to the new CustomProtocolManager API.
396         (WebKit::CustomProtocolManager::WebSoupRequestAsyncData::WebSoupRequestAsyncData):
397         (WebKit::CustomProtocolManager::WebSoupRequestAsyncData::~WebSoupRequestAsyncData):
398         (WebKit::CustomProtocolManager::registerProtocolClass):
399         (WebKit::CustomProtocolManager::registerScheme):
400         (WebKit::CustomProtocolManager::supportsScheme):
401         (WebKit::CustomProtocolManager::didFailWithError):
402         (WebKit::CustomProtocolManager::didLoadData):
403         (WebKit::CustomProtocolManager::didReceiveResponse):
404         (WebKit::CustomProtocolManager::didFinishLoading):
405         (WebKit::CustomProtocolManager::wasRedirectedToRequest):
406         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
407         (WebKit::globalCustomProtocolManager):
408         (WebKit::NetworkSessionCocoa::defaultSession):
409         CustomProtocolManager is no longer refcounted, so just pass a pointer.
410         A static pointer has the same lifetime as the NetworkProcess object in the NetworkProcess,
411         and in the WebProcess it will remain nullptr, just like it used to.
412         * PlatformEfl.cmake:
413         * PlatformGTK.cmake:
414         * WebKit2.xcodeproj/project.pbxproj:
415
416 2017-01-05  Antti Koivisto  <antti@apple.com>
417
418         Use WTF::Function instead of std::function in network cache code
419         https://bugs.webkit.org/show_bug.cgi?id=166721
420
421         Reviewed by Andreas Kling.
422
423         Use better move-only type. Fix some unnecessary function copies.
424
425         * NetworkProcess/cache/NetworkCache.cpp:
426         (WebKit::NetworkCache::Cache::retrieve):
427         (WebKit::NetworkCache::Cache::clear):
428         * NetworkProcess/cache/NetworkCache.h:
429         * NetworkProcess/cache/NetworkCacheData.h:
430         * NetworkProcess/cache/NetworkCacheDataCocoa.mm:
431         (WebKit::NetworkCache::Data::apply):
432         * NetworkProcess/cache/NetworkCacheDataSoup.cpp:
433         (WebKit::NetworkCache::Data::apply):
434         * NetworkProcess/cache/NetworkCacheFileSystem.cpp:
435         (WebKit::NetworkCache::traverseDirectory):
436         * NetworkProcess/cache/NetworkCacheFileSystem.h:
437         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
438         (WebKit::NetworkCache::SpeculativeLoadManager::canRetrieve):
439         (WebKit::NetworkCache::SpeculativeLoadManager::retrieve):
440
441             Split retrieve() to canRetrieve() and retrieve() functions.
442             This avoids the need to copy the completion handler in the caller.
443
444         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.h:
445         * NetworkProcess/cache/NetworkCacheStorage.cpp:
446         (WebKit::NetworkCache::Storage::ReadOperation::ReadOperation):
447         (WebKit::NetworkCache::Storage::traverse):
448         (WebKit::NetworkCache::Storage::clear):
449         * NetworkProcess/cache/NetworkCacheStorage.h:
450
451 2017-01-05  Enrica Casucci  <enrica@apple.com>
452
453         Unreviewed build fix after https://trac.webkit.org/changeset/210360
454
455         * UIProcess/Cocoa/WebViewImpl.mm:
456         (WebKit::WebViewImpl::performDragOperation):
457
458 2017-01-05  Enrica Casucci  <enrica@apple.com>
459
460         Support File Promise during drag for macOS.
461         https://bugs.webkit.org/show_bug.cgi?id=165204
462         rdar://problem/19595567
463
464         Reviewed by Tim Horton.
465
466         Adds support for dropping a File Promise in a WKWebView.
467         The implementation uses new File Promise API available in Sierra.
468
469         * Shared/WebCoreArgumentCoders.cpp:
470         (IPC::ArgumentCoder<DragData>::encode):
471         (IPC::ArgumentCoder<DragData>::decode):
472         * Shared/mac/PasteboardTypes.mm:
473         (WebKit::PasteboardTypes::forURL):
474         * UIProcess/Cocoa/WebViewImpl.h:
475         * UIProcess/Cocoa/WebViewImpl.mm:
476         (WebKit::WebViewImpl::createSandboxExtensionsIfNeeded):
477         (WebKit::WebViewImpl::performDragOperation):
478         (WebKit::maybeCreateSandboxExtensionFromPasteboard): Deleted.
479         (WebKit::createSandboxExtensionsForFileUpload): Deleted.
480
481 2017-01-05  Andreas Kling  <akling@apple.com>
482
483         Remove ChromeClient::needTouchEvents().
484         <https://webkit.org/b/166723>
485
486         Rubber-stamped by Antti Koivisto.
487
488         * WebProcess/WebCoreSupport/WebChromeClient.h:
489
490 2017-01-04  Darin Adler  <darin@apple.com>
491
492         Remove PassRefPtr use from the "html" directory, other improvements
493         https://bugs.webkit.org/show_bug.cgi?id=166635
494
495         Reviewed by Alex Christensen.
496
497         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
498         (WebKit::WebChromeClient::loadIconForFiles): Take a reference instead of a pointer.
499         * WebProcess/WebCoreSupport/WebChromeClient.h: Ditto.
500
501 2017-01-04  Myles C. Maxfield  <mmaxfield@apple.com>
502
503         Remove runtime flag for variation fonts
504         https://bugs.webkit.org/show_bug.cgi?id=164251
505
506         Reviewed by Dean Jackson.
507
508         * Shared/WebPreferencesDefinitions.h:
509         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
510         (WebKit::registerUserDefaultsIfNeeded):
511         * WebProcess/WebPage/WebPage.cpp:
512         (WebKit::WebPage::updatePreferences):
513
514 2017-01-04  Ryan Haddad  <ryanhaddad@apple.com>
515
516         Unreviewed, rolling out r210287.
517
518         This change caused editing test failures on macOS.
519
520         Reverted changeset:
521
522         "Support File Promise during drag for macOS."
523         https://bugs.webkit.org/show_bug.cgi?id=165204
524         http://trac.webkit.org/changeset/210287
525
526 2017-01-04  Enrica Casucci  <enrica@apple.com>
527
528         Support File Promise during drag for macOS.
529         https://bugs.webkit.org/show_bug.cgi?id=165204
530         rdar://problem/19595567
531
532         Reviewed by Tim Horton.
533
534         Adds support for dropping a File Promise in a WKWebView.
535         The implementation uses new File Promise API available in Sierra.
536
537         * Shared/WebCoreArgumentCoders.cpp:
538         (IPC::ArgumentCoder<DragData>::encode):
539         (IPC::ArgumentCoder<DragData>::decode):
540         * Shared/mac/PasteboardTypes.mm:
541         (WebKit::PasteboardTypes::forURL):
542         * UIProcess/Cocoa/WebViewImpl.h:
543         * UIProcess/Cocoa/WebViewImpl.mm:
544         (WebKit::WebViewImpl::createSandboxExtensionsIfNeeded):
545         (WebKit::WebViewImpl::performDragOperation):
546         (WebKit::maybeCreateSandboxExtensionFromPasteboard): Deleted.
547         (WebKit::createSandboxExtensionsForFileUpload): Deleted.
548
549 2017-01-04  Jeremy Jones  <jeremyj@apple.com>
550
551         Release pointer lock when page state is reset for any reason, not just for process exited.
552         https://bugs.webkit.org/show_bug.cgi?id=166654
553         <rdar://problem/29849769>
554
555         Reviewed by Tim Horton.
556
557         Pointer lock was not being released when the window is closed.
558         Move the pointer lock to resetState() so it happens whenever the page is
559         reset, not just when it is reset after process exit.
560
561         * UIProcess/WebPageProxy.cpp:
562         (WebKit::WebPageProxy::resetState): Release here.
563         (WebKit::WebPageProxy::resetStateAfterProcessExited): Don't release here.
564
565 2017-01-03  Tim Horton  <timothy_horton@apple.com>
566
567         NSSpellChecker's recordResponse isn't called for unseen automatic corrections
568         https://bugs.webkit.org/show_bug.cgi?id=166450
569         <rdar://problem/29447824>
570
571         Reviewed by Darin Adler.
572
573         * UIProcess/mac/CorrectionPanel.h:
574         * UIProcess/mac/CorrectionPanel.mm:
575         (WebKit::CorrectionPanel::recordAutocorrectionResponse):
576         (WebKit::CorrectionPanel::handleAcceptedReplacement):
577         Funnel all calls to recordResponse:toCorrection:forWord:language:inSpellDocumentWithTag:
578         through recordAutocorrectionResponse, for debugging's sake.
579         Drop the NSView parameter because we don't need it, just the tag.
580
581         * UIProcess/mac/PageClientImpl.mm:
582         (WebKit::toCorrectionResponse):
583         (WebKit::PageClientImpl::recordAutocorrectionResponse):
584         Convert the new AutocorrectionResponseType value to its corresponding
585         NSCorrectionResponse value.
586
587 2017-01-03  Daniel Bates  <dabates@apple.com>
588
589         Another attempt to fix the Apple Sierra Release 32-bit Build following <https://trac.webkit.org/changeset/210075>
590         (https://bugs.webkit.org/show_bug.cgi?id=166367)
591
592         Guard more code in WebViewImpl::handleRequestedCandidates() inside HAVE(TOUCH_BAR).
593         Remove unused local variable weakThis.
594
595         * UIProcess/Cocoa/WebViewImpl.mm:
596         (WebKit::WebViewImpl::handleRequestedCandidates):
597
598 2017-01-03  Daniel Bates  <dabates@apple.com>
599
600         Attempt to fix the Apple Sierra Release 32-bit Build following <https://trac.webkit.org/changeset/210075>
601         (https://bugs.webkit.org/show_bug.cgi?id=166367)
602
603         Add HAVE(TOUCH_BAR)-guard around code that messages candidateListTouchBarItem() as
604         candidateListTouchBarItem() is only defined when building with Touch Bar support.
605
606         Also added an inline comment to help demarcate the code when building without Touch Bar
607         support. We should look to clean up WebViewImpl.mm including extracting out the Touch
608         Bar code to another file or better demarcating it so as to improve the hackability of
609         this code and prevent breaking the build when building without Touch Bar support.
610
611         * UIProcess/Cocoa/WebViewImpl.mm:
612         (WebKit::WebViewImpl::handleRequestedCandidates):
613
614 2017-01-03  Michael Catanzaro  <mcatanzaro@igalia.com> and Carlos Garcia Campos  <cgarcia@igalia.com>
615
616         [GTK] Expose WebKitSecurityOrigin API
617         https://bugs.webkit.org/show_bug.cgi?id=166632
618
619         Reviewed by Carlos Garcia Campos.
620
621         This API will be useful to have for various purposes, such as setting initial notification
622         permissions.
623
624         * PlatformGTK.cmake:
625         * UIProcess/API/gtk/WebKitAutocleanups.h:
626         * UIProcess/API/gtk/WebKitSecurityOrigin.cpp: Added.
627         (_WebKitSecurityOrigin::_WebKitSecurityOrigin):
628         (webkitSecurityOriginCreate):
629         (webkit_security_origin_new):
630         (webkit_security_origin_new_for_uri):
631         (webkit_security_origin_ref):
632         (webkit_security_origin_unref):
633         (webkit_security_origin_get_protocol):
634         (webkit_security_origin_get_host):
635         (webkit_security_origin_get_port):
636         (webkit_security_origin_is_opaque):
637         (webkit_security_origin_to_string):
638         * UIProcess/API/gtk/WebKitSecurityOrigin.h: Added.
639         * UIProcess/API/gtk/WebKitSecurityOriginPrivate.h: Added.
640         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
641         * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml:
642         * UIProcess/API/gtk/webkit2.h:
643
644 2017-01-03  Carlos Garcia Campos  <cgarcia@igalia.com>
645
646         [SOUP] Load options allowStoredCredentials = DoNotAllowStoredCredentials with clientCredentialPolicy = MayAskClientForCredentials doesn't work
647         https://bugs.webkit.org/show_bug.cgi?id=164471
648
649         Reviewed by Michael Catanzaro.
650
651         When DoNotAllowStoredCredentials is used we disable the SoupAuthManager feature for the message, but that
652         disables all HTTP authentication, causing the load to always fail with Authorization required even when
653         clientCredentialPolicy allows to ask the user for credentials. The problem is that even if we don't use the
654         WebCore credentials for that request, libsoup will always use its internal cache of SoupAuth if we enable the
655         SoupAuthManager feature. Libsoup 2.57.1 has new API to disable the use of cached credentials for a particular
656         message, adding the new message flag SOUP_MESSAGE_DO_NOT_USE_AUTH_CACHE.
657
658         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
659         (WebKit::NetworkDataTaskSoup::createRequest): Set SOUP_MESSAGE_DO_NOT_USE_AUTH_CACHE flag to disable cached
660         credentials for the message if libsoup >= 2.57.1 is used.
661
662 2017-01-03  Carlos Garcia Campos  <cgarcia@igalia.com>
663
664         [GTK] HTTP auth layout tests are flaky
665         https://bugs.webkit.org/show_bug.cgi?id=158919
666
667         Reviewed by Michael Catanzaro.
668
669         Implement NetworkSession::clearCredentials() for soup using the new libsoup API when available.
670
671         * NetworkProcess/soup/NetworkSessionSoup.cpp:
672         (WebKit::NetworkSessionSoup::clearCredentials):
673         * NetworkProcess/soup/NetworkSessionSoup.h:
674
675 2017-01-01  Jeff Miller  <jeffm@apple.com>
676
677         Update user-visible copyright strings to include 2017
678         https://bugs.webkit.org/show_bug.cgi?id=166278
679
680         Reviewed by Dan Bernstein.
681
682         * DatabaseProcess/EntryPoint/mac/XPCService/DatabaseService/Info.plist:
683         * Info.plist:
684         * NetworkProcess/EntryPoint/mac/XPCService/NetworkService/Info-OSX-10.9-10.10.plist:
685         * NetworkProcess/EntryPoint/mac/XPCService/NetworkService/Info-OSX.plist:
686         * NetworkProcess/EntryPoint/mac/XPCService/NetworkService/Info-iOS.plist:
687         * PluginProcess/EntryPoint/mac/XPCService/PluginService.32-64-10.9-10.10.Info.plist:
688         * PluginProcess/EntryPoint/mac/XPCService/PluginService.32-64.Info.plist:
689         * WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-OSX-10.9-10.10.plist:
690         * WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-OSX.plist:
691         * WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-iOS.plist:
692
693 2016-12-30  Darin Adler  <darin@apple.com>
694
695         Remove PassRefPtr use from the "dom" directory, related cleanup
696         https://bugs.webkit.org/show_bug.cgi?id=166569
697
698         Reviewed by Alex Christensen.
699
700         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
701         (WebKit::WebFrameLoaderClient::dispatchDidReceiveTitle): Updated to use struct.
702         (WebKit::WebFrameLoaderClient::updateGlobalHistory): Ditto.
703         (WebKit::WebFrameLoaderClient::setTitle): Ditto.
704
705 2016-12-27  Alex Christensen  <achristensen@webkit.org>
706
707         reduce PassRefPtr use in WebKit2
708         https://bugs.webkit.org/show_bug.cgi?id=166452
709
710         Reviewed by Yusuke Suzuki.
711
712         * Shared/API/c/cg/WKImageCG.cpp:
713         (WKImageCreateCGImage):
714         (WKImageCreateFromCGImage):
715         * Shared/ShareableBitmap.cpp:
716         (WebKit::ShareableBitmap::createHandle):
717         * Shared/ShareableBitmap.h:
718         * Shared/UserData.cpp:
719         (WebKit::UserData::encode):
720         (WebKit::UserData::decode):
721         * Shared/WebImage.cpp:
722         (WebKit::WebImage::create):
723         (WebKit::WebImage::WebImage):
724         * Shared/WebImage.h:
725         (WebKit::WebImage::bitmap):
726         * UIProcess/WebPageProxy.cpp:
727         (WebKit::WebPageProxy::didGetImageForFindMatch):
728         * UIProcess/mac/WKTextFinderClient.mm:
729         (-[WKTextFinderClient didGetImageForMatchResult:]):
730         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
731         (WebKit::WebAutomationSessionProxy::takeScreenshot):
732         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm:
733         (-[WKWebProcessPlugInNodeHandle renderedImageWithOptions:]):
734         * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:
735         (WebKit::imageForRect):
736         (WebKit::InjectedBundleNodeHandle::renderedImage):
737         (WebKit::InjectedBundleNodeHandle::visibleRange):
738         (WebKit::InjectedBundleNodeHandle::htmlTableCellElementCellAbove):
739         (WebKit::InjectedBundleNodeHandle::documentFrame):
740         (WebKit::InjectedBundleNodeHandle::htmlFrameElementContentFrame):
741         (WebKit::InjectedBundleNodeHandle::htmlIFrameElementContentFrame):
742         * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h:
743         * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
744         (WebKit::InjectedBundleRangeHandle::renderedImage):
745         * WebProcess/WebPage/WebPage.cpp:
746         (WebKit::WebPage::takeSnapshot):
747         (WebKit::WebPage::snapshotAtSize):
748         (WebKit::WebPage::snapshotNode):
749         (WebKit::WebPage::drawRectToImage):
750         * WebProcess/WebPage/ios/WebPageIOS.mm:
751         (WebKit::WebPage::getPositionInformation):
752         * WebProcess/WebPage/mac/WebPageMac.mm:
753         (WebKit::WebPage::setTopOverhangImage):
754         (WebKit::WebPage::setBottomOverhangImage):
755
756 2016-12-27  Emanuele Aina  <emanuele.aina@collabora.com>
757
758         Ensure NetworkProcess is ready before whitelisting TLS certificates
759         https://bugs.webkit.org/show_bug.cgi?id=162962
760
761         Reviewed by Alex Christensen.
762
763         If the API user tries to whitelist TLS certificates before any web
764         view has been created, the action will be ignored because the
765         NetworkProcess hasn't been fired up yet.
766
767         For example, the snippet below using the GTK+ API does not work,
768         unless the whitelisting is moved after the web view creation:
769
770           webkit_web_context_allow_tls_certificate_for_host(webkit_web_context_get_default(), crt, host);
771           webView = webkit_web_view_new();
772
773         * UIProcess/WebProcessPool.cpp:
774         (WebKit::WebProcessPool::allowSpecificHTTPSCertificateForHost): Ensure
775         that the NetworkProcess has been already fired up when adding
776         certificates, so they can be whitelisted before the first web view is
777         instantiated.
778
779 2016-12-25  Yusuke Suzuki  <utatane.tea@gmail.com>
780
781         Propagate the source origin as much as possible
782         https://bugs.webkit.org/show_bug.cgi?id=166348
783
784         Reviewed by Darin Adler.
785
786         * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp:
787         (WebKit::NPRuntimeObjectMap::evaluate):
788
789 2016-12-22  Andy Estes  <aestes@apple.com>
790
791         Reduce QuickLook.h include overhead
792         https://bugs.webkit.org/show_bug.cgi?id=166454
793
794         Reviewed by Andreas Kling.
795
796         * WebProcess/Network/WebLoaderStrategy.cpp: Included QuickLook.h for QLPreviewProtocol().
797         * WebProcess/Network/WebResourceLoader.cpp: Included QuickLook.h for QuickLookHandle.
798         * WebProcess/Network/WebResourceLoader.h: Stopped including QuickLook.h.
799
800 2016-12-22  Tim Horton  <timothy_horton@apple.com>
801
802         Null deref under WebPageProxy::applicationDidFinishSnapshottingAfterEnteringBackground
803         https://bugs.webkit.org/show_bug.cgi?id=166433
804         <rdar://problem/29732407>
805
806         Reviewed by Daniel Bates.
807
808         * UIProcess/ios/WebPageProxyIOS.mm:
809         (WebKit::WebPageProxy::applicationDidFinishSnapshottingAfterEnteringBackground):
810         m_drawingArea can be null if the process is not valid.
811
812 2016-12-22  Andy Estes  <aestes@apple.com>
813
814         Make WebCore::EditorInsertAction an enum class
815         https://bugs.webkit.org/show_bug.cgi?id=166424
816
817         Reviewed by Brent Fulgham.
818
819         * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h:
820         (WebKit::toAPI):
821         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
822         (toWK):
823
824 2016-12-22  Zhuo Li  <zachli@apple.com>
825
826         [Cocoa] SPI for setloadsImagesAutomatically
827         https://bugs.webkit.org/show_bug.cgi?id=166401
828
829         Reviewed by Darin Adler.
830
831         * UIProcess/API/Cocoa/WKPreferences.mm: Call the C API under the hood.
832         (-[WKPreferences _loadsImagesAutomatically]):
833         (-[WKPreferences _setLoadsImagesAutomatically:]):
834
835         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
836         Add `_loadsImagesAutomatically` property.
837
838 2016-12-22  Eric Carlson  <eric.carlson@apple.com>
839
840         AVPlayerLayer isn't available on every system
841         https://bugs.webkit.org/show_bug.cgi?id=166399
842
843         Reviewed by Jer Noble.
844
845         * WebProcess/WebPage/mac/PlatformCALayerRemoteCustom.mm: Use SOFT_LINK_CLASS_OPTIONAL.
846
847 2016-12-22  Nael Ouedraogo  <nael.ouedraogo@crf.canon.fr>
848
849         MediaStream: ASSERTION FAILED: m_ids.size() == m_handles.size() in MediaDeviceSandboxExtensions
850         https://bugs.webkit.org/show_bug.cgi?id=166328
851
852         Reviewed by Eric Carlson.
853
854         This assertion failure happens for ports with sandbox extensions disabled. SandboxExtension is empty and
855         HandleArray:size() always returns 0. Disable creation of MediaDevicesSandboxExtension in UserMediaProcessManager
856         when building without support of sandbox extension. Disable also WebPage::grantUserMediaDeviceSandboxExtensions
857         and WebPage::revokeUserMediaDeviceSandboxExtensions which can be avoided when sandbox extension is empty.
858
859         * UIProcess/UserMediaProcessManager.cpp:
860         (WebKit::UserMediaProcessManager::willCreateMediaStream):
861         (WebKit::UserMediaProcessManager::endedCaptureSession):
862         * WebProcess/WebPage/WebPage.cpp:
863         * WebProcess/WebPage/WebPage.h:
864         * WebProcess/WebPage/WebPage.messages.in:
865
866 2016-12-22  Alejandro G. Castro  <alex@igalia.com>
867
868         [WebRTC] Add support for runtime PeeConnection setting, required after r209757
869         https://bugs.webkit.org/show_bug.cgi?id=166346
870
871         Reviewed by Carlos Garcia Campos.
872
873         After that commit we have to enable the peerConnection runtime
874         flag if we want webrtc to work. We are not adding a new API for
875         the moment to control the peerConnection feature.
876
877         * UIProcess/API/gtk/WebKitSettings.cpp:
878         (webkit_settings_set_enable_media_stream): Use the mediaStream
879         setting to control the peerConnection
880
881 2016-12-21  Brent Fulgham  <bfulgham@apple.com>
882
883         [Mac][WK2] Stop using file* rules in WebProcess sandbox profiles
884         https://bugs.webkit.org/show_bug.cgi?id=165824
885         <rdar://problem/14024823>
886
887         Reviewed by Alexey Proskuryakov
888
889         Switch from blanket 'file*' sandbox rules, to the specific 'file-read*' and 'file-write*' rules
890         we actually need.
891
892         * DatabaseProcess/mac/com.apple.WebKit.Databases.sb.in:
893         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
894         * WebProcess/com.apple.WebProcess.sb.in:
895
896 2016-12-21  Beth Dakin  <bdakin@apple.com>
897
898         Holding down on candidates in the TouchBar should show panel on screen
899         https://bugs.webkit.org/show_bug.cgi?id=166367
900         -and corresponding-
901         <rdar://problem/28479236>
902
903         Reviewed by Tim Horton.
904
905         The showCandidates() helper function is not needed. We can call the AppKit method 
906         directly at the one call site.
907         * UIProcess/Cocoa/WebViewImpl.h:
908         * UIProcess/Cocoa/WebViewImpl.mm:
909
910         The panel should appear under the selection, so offset the selection rect.
911         (WebKit::WebViewImpl::handleRequestedCandidates):
912
913         No more showCandidates() since we can call it directly. 
914         (WebKit::WebViewImpl::showCandidates): Deleted.
915
916 2016-12-20  Taras Tsugrii  <ttsugrii@fb.com>
917
918         Fix undefined behavior caused by macro expansion producing 'defined'
919         https://bugs.webkit.org/show_bug.cgi?id=166047
920
921         Reviewed by Darin Adler.
922
923         * Shared/API/Cocoa/WKFoundation.h:
924
925 2016-12-20  Brent Fulgham  <bfulgham@apple.com>
926
927         Address some style problems found by static analysis
928         https://bugs.webkit.org/show_bug.cgi?id=165975
929
930         Reviewed by Alex Christensen.
931
932         Avoid passing large ANGLE data structures through the ANGLEWebKitBridge methods.
933
934         * Shared/WebBackForwardListItem.cpp:
935         (WebKit::WebBackForwardListItem::create):
936         (WebKit::WebBackForwardListItem::WebBackForwardListItem):
937         * Shared/WebBackForwardListItem.h:
938
939 2016-12-20  Simon Fraser  <simon.fraser@apple.com>
940
941         [iOS WK2] Switching or closing a tab leads to all-white tab content if the status bar is double height
942         https://bugs.webkit.org/show_bug.cgi?id=166286
943         rdar://problem/29593525
944
945         Reviewed by Tim Horton.
946
947         A double-height status bar triggers view resize while snapshotting in the background,
948         which also triggers calls to _endAnimatedResize on tab resume. However, it was possible
949         for _endAnimatedResize to re-enter via synchronizeDynamicViewportUpdate()/didCommitLayerTree(),
950         causing us to use a nil _resizeAnimationView for scale computations, thus setting a zero
951         scale on the WKContentView.
952
953         Fix by checking _dynamicViewportUpdateMode again after the call to synchronizeDynamicViewportUpdate(),
954         and do a belt-and-braces check for a nil _resizeAnimationView.
955
956         * UIProcess/API/Cocoa/WKWebView.mm:
957         (-[WKWebView _endAnimatedResize]):
958
959 2016-12-20  Andy Estes  <aestes@apple.com>
960
961         [Cocoa] REGRESSION (r209558): Calling decisionHandler multiple times in webView:decidePolicyForNavigationAction:decisionHandler: leads to a crash
962         https://bugs.webkit.org/show_bug.cgi?id=165992
963         <rdar://problem/29693817>
964
965         Reviewed by Brady Eidson.
966
967         r209558 added additional move semantics to the decisionHandler block passed to
968         -webView:decidePolicyForNavigationAction:decisionHandler:, resulting in a null pointer
969         dereference in clients that call the decisionHandler block more than once.
970
971         None of the completion handlers we expose in the WebKit API are intended to be called more
972         than once, and we ASSERT in CompletionHandlerCallChecker::didCallCompletionHandler() that
973         this doesn't happen.
974
975         This change strenghtens that protection by returning immediately in completion handlers
976         called more than once. And in programs linked on or after WebKit 603.1.17, an NSException is
977         thrown if a completion handler is called a second time, like we do for completion handlers
978         that are never called.
979
980         New API test: WebKit2.DuplicateCompletionHandlerCalls
981
982         * Shared/Cocoa/CompletionHandlerCallChecker.h: Declared completionHandlerHasBeenCalled().
983         * Shared/Cocoa/CompletionHandlerCallChecker.mm:
984         (WebKit::shouldThrowExceptionForDuplicateCompletionHandlerCall): Added. Returns true if the
985         program is linked on or after
986         LibraryVersion::FirstWithExceptionsForDuplicateCompletionHandlerCalls.
987         (WebKit::CompletionHandlerCallChecker::completionHandlerHasBeenCalled): Added. Returns
988         whether or not the completion handler has been called. If it has, and
989         shouldThrowExceptionForDuplicateCompletionHandlerCall() returns true, throws an
990         NSInternalInconsistencyException.
991         * UIProcess/API/Cocoa/WKWebView.mm:
992         (-[WKWebView _setInputDelegate:]): Added an early return if the completion handler has
993         already been called.
994         * UIProcess/Cocoa/NavigationState.mm:
995         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction): Ditto.
996         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationResponse): Ditto.
997         (WebKit::NavigationState::NavigationClient::didReceiveAuthenticationChallenge): Ditto.
998         * UIProcess/Cocoa/UIDelegate.mm:
999         (WebKit::UIDelegate::UIClient::runJavaScriptAlert): Ditto.
1000         (WebKit::UIDelegate::UIClient::runJavaScriptConfirm): Ditto.
1001         (WebKit::UIDelegate::UIClient::runJavaScriptPrompt): Ditto.
1002         (WebKit::UIDelegate::UIClient::exceededDatabaseQuota): Ditto.
1003         (WebKit::UIDelegate::UIClient::runOpenPanel): Ditto.
1004         (WebKit::UIDelegate::UIClient::reachedApplicationCacheOriginQuota): Ditto.
1005         * UIProcess/Cocoa/VersionChecks.h: Added
1006         FirstWithExceptionsForDuplicateCompletionHandlerCalls with the version number for 603.1.17.
1007
1008 2016-12-20  Dean Jackson  <dino@apple.com>
1009
1010         Remove INDIE_UI
1011         https://bugs.webkit.org/show_bug.cgi?id=165881
1012         <rdar://problem/29672532>
1013
1014         Reviewed by Simon Fraser.
1015
1016         The Indie UI work has been discontinued.
1017
1018         * Configurations/FeatureDefines.xcconfig:
1019
1020 2016-12-20  Wenson Hsieh  <wenson_hsieh@apple.com>
1021
1022         Implement the updated port/area-based Scroll Snap Module Level 1 Spec
1023         https://bugs.webkit.org/show_bug.cgi?id=165317
1024         <rdar://problem/29490956>
1025
1026         Reviewed by Dean Jackson.
1027
1028         Remove unused code for adopting scroll snapping in the PDF plugin.
1029
1030         * WebProcess/Plugins/PDF/PDFPlugin.mm:
1031         (WebKit::PDFPlugin::didCalculateSizes):
1032
1033 2016-12-19  Yusuke Suzuki  <utatane.tea@gmail.com>
1034
1035         [ES6] Enable ES6 Modules
1036         https://bugs.webkit.org/show_bug.cgi?id=165849
1037
1038         Reviewed by Geoffrey Garen.
1039
1040         * Shared/WebPreferencesDefinitions.h:
1041         * UIProcess/API/C/WKPreferences.cpp:
1042         (WKPreferencesSetES6ModulesEnabled): Deleted.
1043         (WKPreferencesGetES6ModulesEnabled): Deleted.
1044         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1045         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1046         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
1047         * WebProcess/WebPage/WebPage.cpp:
1048         (WebKit::WebPage::updatePreferences):
1049
1050 2016-12-19  Keith Rollin  <krollin@apple.com>
1051
1052         Fix unwanted deletion of record/replay files
1053         https://bugs.webkit.org/show_bug.cgi?id=166040
1054
1055         Reviewed by Alex Christensen.
1056
1057         As part of some refactoring, the objects that create the meta files
1058         that are part of the record/replay cache would get deleted. They were
1059         always getting opened in "write" mode", which would truncate the
1060         files. Fix this so that the files are opened in the right modes for
1061         record, replay, and neither.
1062
1063         * NetworkProcess/capture/NetworkCaptureManager.cpp:
1064         (WebKit::NetworkCapture::Manager::initialize):
1065
1066 2016-12-19  Gavin Barraclough  <barraclough@apple.com>
1067
1068         [CSS Parser] Enable CSS Deferred Parsing
1069         https://bugs.webkit.org/show_bug.cgi?id=165869
1070
1071         Unreviewed rollout – looks like this regressed performance.
1072
1073         * Shared/WebPreferencesDefinitions.h:
1074
1075 2016-12-19  Anders Carlsson  <andersca@apple.com>
1076
1077         REGRESSION: Crash in com.apple.WebKit:IPC::Connection::platformCanSendOutgoingMessages() const + 0
1078         https://bugs.webkit.org/show_bug.cgi?id=165817
1079         rdar://problem/29626731
1080
1081         Reviewed by Dan Bernstein.
1082
1083         If the receive right is invalidated before we send the message, the kernel won't be able to create a send right,
1084         and we'll crash due to mach_msg returning MACH_SEND_INVALID_RIGHT.
1085         
1086         Fix this by immediately creating a send right, and passing MACH_MSG_TYPE_MOVE_SEND to the attachment constructor.
1087
1088         * WebProcess/WebPage/WebInspector.cpp:
1089         (WebKit::WebInspector::openFrontendConnection):
1090
1091 2016-12-18  Simon Fraser  <simon.fraser@apple.com>
1092
1093         Expose a way for MiniBrowser to simulate header and footer banners
1094         https://bugs.webkit.org/show_bug.cgi?id=166005
1095
1096         Reviewed by Wenson Hsieh.
1097         
1098         Expose testing SPI that allows a client to simulate the presence of header
1099         and footer banners. These are simply plumbed through to set FrameView's
1100         m_headerHeight and m_footerHeight.
1101
1102         * UIProcess/API/Cocoa/WKWebView.mm:
1103         (-[WKWebView _setHeaderBannerHeightForTesting:]):
1104         (-[WKWebView _setFooterBannerHeightForTesting:]):
1105         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1106         * UIProcess/WebPageProxy.cpp:
1107         (WebKit::WebPageProxy::setHeaderBannerHeightForTesting):
1108         (WebKit::WebPageProxy::setFooterBannerHeightForTesting):
1109         * UIProcess/WebPageProxy.h:
1110         * WebProcess/WebPage/WebPage.cpp:
1111         (WebKit::WebPage::setHeaderBannerHeightForTesting):
1112         (WebKit::WebPage::setFooterBannerHeightForTesting):
1113         * WebProcess/WebPage/WebPage.h:
1114         * WebProcess/WebPage/WebPage.messages.in:
1115
1116 2016-12-16  Dave Hyatt  <hyatt@apple.com>
1117
1118         [CSS Values] Make separate wrapper classes for the deprecated CSS Values OM
1119         https://bugs.webkit.org/show_bug.cgi?id=165968
1120
1121         Reviewed by Andreas Kling.
1122
1123         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSValue.cpp:
1124         (WebKit::kit):
1125         (WebKit::core):
1126         (WebKit::wrapCSSValue):
1127         (webkit_dom_css_value_constructor):
1128         (webkit_dom_css_value_get_css_text):
1129         (webkit_dom_css_value_set_css_text):
1130         (webkit_dom_css_value_get_css_value_type):
1131         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSValuePrivate.h:
1132
1133 2016-12-17  Wenson Hsieh  <wenson_hsieh@apple.com>
1134
1135         Visual viewports: bottom fixed elements disappear behind the keyboard
1136         https://bugs.webkit.org/show_bug.cgi?id=165983
1137         <rdar://problem/29409852>
1138
1139         Reviewed by Simon Fraser.
1140
1141         Accounts for input view bounds in WebPageProxy::computeCustomFixedPositionRect. To do this, we introduce and
1142         pass unobscuredContentRectRespectingInputViewBounds along with the regular unobscuredContentRect (which does not
1143         respect the obscuring keyboard rect). This unobscuredContentRectRespectingInputViewBounds is then used when
1144         computing the origin of the updated layout viewport rect (and also, when we are _not_ below minimum scale),
1145         
1146         Additionally, the size is computed using the (unconstrained) unobscured rect. This is because we previously
1147         would use the document-constrained version of the unobscured rect, which caused the layout viewport to shrink
1148         when approaching the max scroll extents of the document while the keyboard is up, since the unobscured rect
1149         would spill out of the document rect. However, using this unconstrained rect's size also means that if the user
1150         rubber-bands out of the document rect, we would end up pushing the layout viewport rect out of the document,
1151         with no way of adjusting it back in without the user scrolling to push the layout viewport into back document
1152         bounds. To address this, we move the layout rect to be within document bounds after computing its size and
1153         location.
1154
1155         Added a new layout test: fast/visual-viewport/ios/fixed-element-on-bottom-with-keyboard.html, and also tweaked
1156         fixed-caret-position-after-scroll.html to cover these changes.
1157
1158         * Shared/VisibleContentRectUpdateInfo.cpp:
1159         (WebKit::operator<<):
1160         * Shared/VisibleContentRectUpdateInfo.h:
1161         (WebKit::VisibleContentRectUpdateInfo::VisibleContentRectUpdateInfo):
1162         (WebKit::VisibleContentRectUpdateInfo::unobscuredContentRectRespectingInputViewBounds):
1163         * UIProcess/API/Cocoa/WKWebView.mm:
1164         (-[WKWebView _updateContentRectsWithState:]):
1165         (-[WKWebView _inputViewBounds]):
1166
1167         Returns the current bounds of the input view. For testing purposes.
1168
1169         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1170         * UIProcess/WebPageProxy.h:
1171         (WebKit::WebPageProxy::unobscuredContentRectRespectingInputViewBounds):
1172         * UIProcess/ios/RemoteScrollingCoordinatorProxyIOS.mm:
1173         (WebKit::RemoteScrollingCoordinatorProxy::customFixedPositionRect):
1174         * UIProcess/ios/WKContentView.h:
1175         * UIProcess/ios/WKContentView.mm:
1176         (-[WKContentView _computeUnobscuredContentRectRespectingInputViewBounds:unobscuredContentRect:inputViewBounds:scale:]):
1177
1178         Helper to compute the unobscured rect, accounting for the bounds of the current input view.
1179
1180         (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInset:inputViewBounds:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]):
1181         (-[WKContentView _didCommitLayerTree:]):
1182         (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInset:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]): Deleted.
1183         * UIProcess/ios/WebPageProxyIOS.mm:
1184         (WebKit::WebPageProxy::computeCustomFixedPositionRect):
1185         * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
1186         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
1187
1188 2016-12-16  Ryosuke Niwa  <rniwa@webkit.org>
1189
1190         Deleting a character converted from pinyin after an image causes a Safari crash
1191         https://bugs.webkit.org/show_bug.cgi?id=165839
1192
1193         Reviewed by Darin Adler.
1194
1195         The crash was caused by the payload of the IPC not being decoded correctly when the encoded attributed string
1196         contains a NSTextAttachment but send<> would still gladly send it to the UIProcess.
1197
1198         Fixed it by omitting the image as done in r176412 since encoding NSFileWrapper, etc... would require
1199         quite a bit of work, and IME doesn't really need to see the image in its attributed string.
1200
1201         * WebProcess/WebPage/mac/WebPageMac.mm:
1202         (WebKit::WebPage::attributedSubstringForCharacterRangeAsync): Fixed the bug.
1203
1204 2016-12-16  Andy Estes  <aestes@apple.com>
1205
1206         Add a setting to suppress keyboard input during provisional navigation
1207         https://bugs.webkit.org/show_bug.cgi?id=165830
1208
1209         Reviewed by Brent Fulgham.
1210
1211         * Shared/WebPreferencesDefinitions.h: Defined
1212         shouldSuppressKeyboardDOMEventsDuringProvisionalNavigation.
1213         * UIProcess/API/C/WKPreferences.cpp:
1214         (WKPreferencesSetShouldSuppressKeyboardInputDuringProvisionalNavigation): Added.
1215         (WKPreferencesGetShouldSuppressKeyboardInputDuringProvisionalNavigation): Added.
1216         * UIProcess/API/C/WKPreferencesRefPrivate.h: Declared a getter and setter for the new
1217         preference.
1218         * UIProcess/API/Cocoa/WKPreferences.mm:
1219         (-[WKPreferences _shouldSuppressKeyboardInputDuringProvisionalNavigation]): Added.
1220         (-[WKPreferences _setShouldSuppressKeyboardInputDuringProvisionalNavigation:]): Added.
1221         * UIProcess/API/Cocoa/WKPreferencesPrivate.h: Declared a property for the new preference.
1222         * WebProcess/WebPage/WebPage.cpp:
1223         (WebKit::WebPage::updatePreferences): Mapped the new preference to its corresponding
1224         WebCore::Setting.
1225
1226 2016-12-16  Chris Dumez  <cdumez@apple.com>
1227
1228         HTML form validation bubble should be dismissed on navigation
1229         https://bugs.webkit.org/show_bug.cgi?id=165960
1230         <rdar://problem/29668086>
1231
1232         Reviewed by Simon Fraser.
1233
1234         Dismiss HTML form validation bubble on top-level navigation on WK2.
1235
1236         * UIProcess/WebPageProxy.cpp:
1237         (WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
1238
1239 2016-12-16  Jer Noble  <jer.noble@apple.com>
1240
1241         Small refactor: Use HashCountedSet rather than HashMap<..., int> to store client counts in WebPlaybackSessionManager{,Proxy}.
1242         https://bugs.webkit.org/show_bug.cgi?id=165807
1243
1244         Reviewed by Eric Carlson.
1245
1246         * UIProcess/Cocoa/WebPlaybackSessionManagerProxy.h:
1247         * UIProcess/Cocoa/WebPlaybackSessionManagerProxy.mm:
1248         (WebKit::WebPlaybackSessionManagerProxy::addClientForContext):
1249         (WebKit::WebPlaybackSessionManagerProxy::removeClientForContext):
1250         * WebProcess/cocoa/WebPlaybackSessionManager.h:
1251         * WebProcess/cocoa/WebPlaybackSessionManager.mm:
1252         (WebKit::WebPlaybackSessionManager::addClientForContext):
1253         (WebKit::WebPlaybackSessionManager::removeClientForContext):
1254
1255 2016-12-16  Wenson Hsieh  <wenson_hsieh@apple.com>
1256
1257         Visual viewports: carets and selection UI are incorrectly positioned when editing fixed elements
1258         https://bugs.webkit.org/show_bug.cgi?id=165767
1259         <rdar://problem/29602382>
1260
1261         Reviewed by Simon Fraser.
1262
1263         When focusing an input, the position of the caret on iOS is determined by the overridden layout viewport rect in
1264         the web process. However, this rect is not updated until the end the scroll gesture. Whereas this is fine for
1265         non-fixed inputs since their document location does not change, fixed inputs effectively change their position
1266         in the document as the user scrolls. This causes the caret to be 'left behind' in the document position it was
1267         in at the start of the scroll. To fix this, we deactivate the selection when exiting stable state if the
1268         assisted node is in a fixed position container, and reenable it upon receiving the next stable state EditorState
1269         update (as indicated by postLayoutData().isStableStateUpdate). Additionally, we apply similar treatment to the
1270         web selection assistant -- this time, we need to force the selection view to hide (analagous to deactivating
1271         the text selection assistant) and show it again upon receiving the next selection change update when the WebPage
1272         (in the web process) is stable.
1273
1274         Furthermore, adds test support for querying text caret and selection rects, as well as perform a callback after
1275         the WebPage has indicated that it is stable, both as SPI on the WKWebView.
1276
1277         Covered by 4 new layout tests in fast/editing/caret/ios and fast/editing/selection/ios.
1278
1279         * Platform/spi/ios/UIKitSPI.h:
1280         * Shared/EditorState.cpp:
1281         (WebKit::EditorState::PostLayoutData::encode):
1282         (WebKit::EditorState::PostLayoutData::decode):
1283         * Shared/EditorState.h:
1284
1285         Introduce isStableStateUpdate, which is true when the WebPage is known to be in stable state, as well as
1286         insideFixedPosition, which is true when the current selection is inside a fixed position container.
1287
1288         * Shared/mac/RemoteLayerTreeTransaction.h:
1289         (WebKit::RemoteLayerTreeTransaction::isInStableState):
1290         (WebKit::RemoteLayerTreeTransaction::setIsInStableState):
1291         * Shared/mac/RemoteLayerTreeTransaction.mm:
1292         (WebKit::RemoteLayerTreeTransaction::encode):
1293         (WebKit::RemoteLayerTreeTransaction::decode):
1294         (WebKit::RemoteLayerTreeTransaction::description):
1295         * UIProcess/API/Cocoa/WKWebView.mm:
1296         (-[WKWebView _didCommitLayerTree:]):
1297         (-[WKWebView _uiTextCaretRect]):
1298
1299         Introduced a new SPI method for fetching the current rect of the text assistant's caret view, at keyPath
1300         "selectionView.selection.caretRect".
1301
1302         (-[WKWebView _uiTextSelectionRects]):
1303
1304         Renamed (and refactored) from _uiTextSelectionRectViews, which was previously fetching an array of UIViews. I
1305         found this to cause character-granularity-rect.html to fail due to the array of UIViews here being empty, so I
1306         refactored this to simply return an array of rects from the keyPath "selectionView.selection.selectionRects" for
1307         the text selection assistant and @"selectionView.selectionRects" for the web selection assistant.
1308
1309         (-[WKWebView _doAfterNextStablePresentationUpdate:]):
1310
1311         Runs the given block after both the UI process and web processes agree that the visible content rect state is 
1312         stable. To do this, we fire presentation updates until the UI process (via RemoteLayerTreeTransactions)
1313         discovers that the web page is in stable state. This is used solely for testing purposes.
1314
1315         (-[WKWebView _firePresentationUpdateForPendingStableStatePresentationCallbacks]):
1316         (-[WKWebView _uiTextSelectionRectViews]): Deleted.
1317         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1318         * UIProcess/WebPageProxy.h:
1319         (WebKit::WebPageProxy::inStableState):
1320         * UIProcess/ios/WKContentView.mm:
1321         (-[WKContentView _didExitStableState]):
1322
1323         Deactivate the text selection if the assisted node is inside a fixed container.
1324
1325         (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInset:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]):
1326         * UIProcess/ios/WKContentViewInteraction.h:
1327         * UIProcess/ios/WKContentViewInteraction.mm:
1328         (-[WKContentView setupInteraction]):
1329         (-[WKContentView cleanupInteraction]):
1330         (-[WKContentView shouldHideSelectionWhenScrolling]):
1331         (-[WKContentView _uiTextSelectionRects]):
1332         (-[WKContentView _didEndScrollingOrZooming]):
1333         (-[WKContentView _updateChangedSelection:]):
1334
1335         If the EditorState was created after a stable state update, reactivate the text selection assistant if it exists.
1336         Additionally, if we are deferring the end scrolling selection update until after the first stable editor state
1337         update arrives from the web process, we need to also call [_textSelectionAssistant didEndScrollingOverflow]
1338         and [_webSelectionAssistant didEndScrollingOrZoomingPage] here instead of doing so immediately after scrolling
1339         finishes. This ensures that selection UI (the callout and selection highlights) do not flicker from their old
1340         position to the new position when scrolling finishes.
1341
1342         * WebProcess/WebPage/WebPage.cpp:
1343         (WebKit::WebPage::willCommitLayerTree):
1344         * WebProcess/WebPage/ios/WebPageIOS.mm:
1345         (WebKit::WebPage::platformEditorState):
1346         (WebKit::WebPage::updateVisibleContentRects):
1347
1348         When updating the layout viewport override rect, also recompute the caret if needed and send an updated
1349         EditorState over to the UI process.
1350
1351 2016-12-16  Claudio Saavedra  <csaavedra@igalia.com>
1352
1353         [WK2] SharedMemory: include cleanups
1354         https://bugs.webkit.org/show_bug.cgi?id=165950
1355
1356         Reviewed by Žan Doberšek.
1357
1358         The WTFString include is not needed in the header, so move to the
1359         Unix file. Use the existing UNIX_DOMAIN_SOCKETS define. Also
1360         include the WTFOptional header where needed.
1361
1362         * Platform/SharedMemory.h:
1363         * Platform/unix/SharedMemoryUnix.cpp:
1364
1365 2016-12-16  Joonghun Park  <jh718.park@samsung.com>
1366
1367         [EFL] Fix build break since r209907. Unreviewed.
1368         https://bugs.webkit.org/show_bug.cgi?id=165954
1369
1370         * UIProcess/efl/TextCheckerEfl.cpp: Change the remaining TextBreakIterator to UBreakIterator
1371         (WebKit::nextWordOffset):
1372         (WebKit::TextChecker::checkTextOfParagraph):
1373
1374 2016-12-15  Darin Adler  <darin@apple.com>
1375
1376         Use asString instead of toWTFString, toString, or getString when we already checked isString
1377         https://bugs.webkit.org/show_bug.cgi?id=165895
1378
1379         Reviewed by Yusuke Suzuki.
1380
1381         * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp:
1382         (WebKit::NPRuntimeObjectMap::convertJSValueToNPVariant): Use asString/value instead of toWTFString.
1383
1384 2016-12-15  Chris Dumez  <cdumez@apple.com>
1385
1386         Make sure HTML validation bubble's state is updated after layout
1387         https://bugs.webkit.org/show_bug.cgi?id=165922
1388         <rdar://problem/29694730>
1389
1390         Reviewed by Simon Fraser.
1391
1392         Make sure HTML validation bubble's state is updated after layout.
1393         In particular, if the validation bubble's associated element has
1394         moved or is no longer visible, we now hide the bubble.
1395
1396         * WebProcess/WebCoreSupport/WebValidationMessageClient.cpp:
1397         (WebKit::WebValidationMessageClient::showValidationMessage):
1398         (WebKit::WebValidationMessageClient::hideValidationMessage):
1399         (WebKit::WebValidationMessageClient::updateValidationBubbleStateIfNeeded):
1400         * WebProcess/WebCoreSupport/WebValidationMessageClient.h:
1401
1402 2016-12-15  Alex Christensen  <achristensen@webkit.org>
1403
1404         Improve NetworkSession logging
1405         https://bugs.webkit.org/show_bug.cgi?id=165941
1406
1407         Reviewed by Tim Horton.
1408
1409         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1410         (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
1411         (-[WKNetworkSessionDelegate URLSession:task:didCompleteWithError:]):
1412         (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]):
1413         One of the "didReceiveResponse completionHandler (cancel)" messages was wrong,
1414         and other messages could have more useful information without being overwhelming.
1415
1416 2016-12-15  Myles C. Maxfield  <mmaxfield@apple.com>
1417
1418         Sort Xcode project files
1419         https://bugs.webkit.org/show_bug.cgi?id=165937
1420
1421         Reviewed by Simon Fraser.
1422
1423         * WebKit2.xcodeproj/project.pbxproj:
1424
1425 2016-12-15  Anders Carlsson  <andersca@apple.com>
1426
1427         Add more mach_msg logging instrumentation
1428         https://bugs.webkit.org/show_bug.cgi?id=165914
1429
1430         Reviewed by Darin Adler.
1431
1432         * Platform/IPC/mac/ConnectionMac.mm:
1433         (IPC::Connection::sendMessage):
1434         (IPC::Connection::sendOutgoingMessage):
1435         * Platform/IPC/mac/MachMessage.h:
1436         (IPC::MachMessage::messageName):
1437         (IPC::MachMessage::setMessageName):
1438
1439 2016-12-15  Konstantin Tokarev  <annulen@yandex.ru>
1440
1441         Added missing override and final specifiers
1442         https://bugs.webkit.org/show_bug.cgi?id=165903
1443
1444         Reviewed by Darin Adler.
1445
1446         * UIProcess/API/gtk/WebKitGeolocationProvider.h:
1447         * UIProcess/WebFormSubmissionListenerProxy.h:
1448         * UIProcess/WebFramePolicyListenerProxy.h:
1449         * WebProcess/Automation/WebAutomationSessionProxy.h:
1450         * WebProcess/InjectedBundle/API/gtk/DOM/GObjectXPathNSResolver.h:
1451         * WebProcess/MediaCache/WebMediaKeyStorageManager.h:
1452         * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.h:
1453         * WebProcess/WebCoreSupport/WebPlugInClient.h:
1454         * WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.h:
1455         * WebProcess/WebPage/FindController.h:
1456
1457 2016-12-15  Simon Fraser  <simon.fraser@apple.com>
1458
1459         [iOS WK2] Don't disable position:fixed when a form element has focus
1460         https://bugs.webkit.org/show_bug.cgi?id=165891
1461         rdar://problem/29271694
1462
1463         Reviewed by Wenson Hsieh.
1464
1465         Before visual viewports, we had to lay out position:fixed relative to the document rect (effectively
1466         disabling position:fixed) when a form element was focused, to ensure that we could scroll to inputs
1467         inside position:Fixed.
1468
1469         When visual viewports are enabled, we can do a better job of this, and keep position:fixed active.
1470         
1471         Test: fast/visual-viewport/ios/zoomed-focus-in-fixed.html
1472
1473         * UIProcess/API/Cocoa/WKWebView.mm: 
1474         (-[WKWebView _zoomToFocusRect:selectionRect:insideFixed:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]): Soon this will use
1475         insideFixed to have better scroll-into-view behavior.
1476         (-[WKWebView _zoomToFocusRect:selectionRect:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]): Deleted.
1477         * UIProcess/API/Cocoa/WKWebViewInternal.h:
1478         * UIProcess/ios/WKContentView.h:
1479         * UIProcess/ios/WKContentView.mm:
1480         (-[WKContentView _zoomToFocusRect:selectionRect:insideFixed:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]):
1481         (-[WKContentView _zoomToFocusRect:selectionRect:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]): Deleted.
1482         * UIProcess/ios/WKContentViewInteraction.mm:
1483         (-[WKContentView _displayFormNodeInputView]):
1484         * UIProcess/ios/WebPageProxyIOS.mm:
1485         (WebKit::WebPageProxy::computeCustomFixedPositionRect): Don't fall back to using the documentRect as the fixed
1486         position rect if visual viewports are enabled.
1487         * WebProcess/WebPage/ios/WebPageIOS.mm:
1488         (WebKit::WebPage::getAssistedNodeInformation): Don't reset the customtFixedPositionRect around computing element
1489         coordinates if visual viewports are enabled.
1490
1491 2016-12-15  Andreas Kling  <akling@apple.com>
1492
1493         Always clear RenderLayer backing stores when going into page cache.
1494         <https://webkit.org/b/165901>
1495
1496         Reviewed by Simon Fraser.
1497
1498         * WebProcess/WebProcess.cpp:
1499         (WebKit::WebProcess::WebProcess):
1500
1501 2016-12-15  Darin Adler  <darin@apple.com>
1502
1503         Remove custom binding for MediaDevices
1504         https://bugs.webkit.org/show_bug.cgi?id=165894
1505
1506         Reviewed by Eric Carlson.
1507
1508         * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
1509         Added include of MediaConstraintsImpl.h, now needed because we
1510         removed some unneeded includes from the WebCore headers.
1511
1512 2016-12-15  Dave Hyatt  <hyatt@apple.com>
1513
1514         [CSS Parser] Enable CSS Deferred Parsing
1515         https://bugs.webkit.org/show_bug.cgi?id=165869
1516
1517         Reviewed by Sam Weinig.
1518
1519         * Shared/WebPreferencesDefinitions.h:
1520
1521 2016-12-14  Andreas Kling  <akling@apple.com>
1522
1523         Only send Messages::WebPageProxy::DidSaveToPageCache once when entering page cache.
1524         <https://webkit.org/b/165887>
1525
1526         Reviewed by Brady Eidson.
1527
1528         We were sending one of these IPC messages per frame when a page enters the page cache,
1529         and we really only need one, so only do it for the main frame.
1530
1531         (This message is used to adopt the page cache on the UI process side, in case another
1532         web process currently owns the cache. That happens in WebProcessPool::processDidCachePage().)
1533
1534         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1535         (WebKit::WebFrameLoaderClient::didSaveToPageCache):
1536
1537 2016-12-14  Simon Fraser  <simon.fraser@apple.com>
1538
1539         Fix cause of viewport-related flakiness in iOS tests
1540         https://bugs.webkit.org/show_bug.cgi?id=165878
1541
1542         Reviewed by Tim Horton.
1543
1544         When TestController::platformConfigureViewForTest() changes the view size for a flexible
1545         viewport test, the page would not have updated with the new scale by the time the load event
1546         fired, causing flakiness depending on test order.
1547
1548         This was caused by code added in r170325 that delayed visible content rect updates until
1549         after the UI process has received the transaction after didCommitLoad. So fix by overriding
1550         this mechanism if the view has been resized.
1551
1552         * Shared/VisibleContentRectUpdateInfo.cpp:
1553         (WebKit::VisibleContentRectUpdateInfo::encode):
1554         (WebKit::VisibleContentRectUpdateInfo::decode):
1555         (WebKit::operator<<):
1556         * Shared/VisibleContentRectUpdateInfo.h:
1557         (WebKit::VisibleContentRectUpdateInfo::VisibleContentRectUpdateInfo):
1558         (WebKit::VisibleContentRectUpdateInfo::isFirstUpdateForNewViewSize):
1559         (WebKit::operator==):
1560         * UIProcess/API/Cocoa/WKWebView.mm:
1561         (-[WKWebView _frameOrBoundsChanged]):
1562         (-[WKWebView _updateContentRectsWithState:]):
1563         * UIProcess/DrawingAreaProxy.cpp:
1564         (WebKit::DrawingAreaProxy::setSize):
1565         * UIProcess/DrawingAreaProxy.h:
1566         * UIProcess/WebPageProxy.cpp:
1567         (WebKit::WebPageProxy::WebPageProxy):
1568         * UIProcess/WebPageProxy.h:
1569         * UIProcess/ios/WKContentView.h:
1570         * UIProcess/ios/WKContentView.mm:
1571         (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInset:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]):
1572         * WebProcess/WebPage/ios/WebPageIOS.mm:
1573         (WebKit::WebPage::updateVisibleContentRects):
1574
1575 2016-12-04  Sam Weinig  <sam@webkit.org>
1576
1577         [WebIDL] Add support for converting dictionaries to JS
1578         https://bugs.webkit.org/show_bug.cgi?id=165367
1579
1580         Reviewed by Chris Dumez.
1581
1582         * CMakeLists.txt:
1583         Add missing directories to look in for headers.
1584
1585 2016-12-14  Anders Carlsson  <andersca@apple.com>
1586
1587         Add WKContextRefreshPlugIns
1588         https://bugs.webkit.org/show_bug.cgi?id=165879
1589         rdar://problem/29602414
1590
1591         Reviewed by Tim Horton.
1592
1593         * UIProcess/API/C/WKContext.cpp:
1594         (WKContextRefreshPlugIns):
1595         * UIProcess/API/C/WKContext.h:
1596         * UIProcess/WebProcessPool.cpp:
1597         (WebKit::WebProcessPool::refreshPlugins):
1598         * UIProcess/WebProcessPool.h:
1599         * WebProcess/Plugins/WebPluginInfoProvider.h:
1600         * WebProcess/WebProcess.cpp:
1601         (WebKit::WebProcess::refreshPlugins):
1602         * WebProcess/WebProcess.h:
1603         * WebProcess/WebProcess.messages.in:
1604
1605 2016-12-14  Tim Horton  <timothy_horton@apple.com>
1606
1607         API Test Fullscreen.TopContentInset is asserting on Yosemite
1608         https://bugs.webkit.org/show_bug.cgi?id=165877
1609
1610         Reviewed by Brady Eidson.
1611
1612         * UIProcess/WebPageProxy.cpp:
1613         (WebKit::WebPageProxy::setTopContentInset):
1614         * WebProcess/WebPage/WebPage.cpp:
1615         * WebProcess/WebPage/WebPage.h:
1616         * WebProcess/WebPage/WebPage.messages.in:
1617         We don't use fences on Yosemite, but this codepath still tried to.
1618         Instead of guarding with PLATFORM(COCOA), make use of the more accurate
1619         HAVE(COREANIMATION_FENCES) guard.
1620
1621 2016-12-14  Anders Carlsson  <andersca@apple.com>
1622
1623         Add some instrumentation to try to detect a crash on the bots
1624         https://bugs.webkit.org/show_bug.cgi?id=165866
1625
1626         Reviewed by Sam Weinig.
1627
1628         * Platform/IPC/mac/ConnectionMac.mm:
1629         (IPC::Connection::sendMessage):
1630
1631 2016-12-14  Dave Hyatt  <hyatt@apple.com>
1632
1633         [CSS Parser] Implement deferred parsing of properties, @media, @supports and @keyframes
1634         https://bugs.webkit.org/show_bug.cgi?id=165743
1635
1636         Reviewed by Dean Jackson.
1637
1638         Repurpose the newCSSParserEnabled preference for deferred parsing. Just change the name
1639         from "new" to "deferred."
1640
1641         * Shared/WebPreferencesDefinitions.h:
1642         * UIProcess/API/C/WKPreferences.cpp:
1643         (WKPreferencesSetDeferredCSSParserEnabled):
1644         (WKPreferencesGetDeferredCSSParserEnabled):
1645         (WKPreferencesSetNewCSSParserEnabled): Deleted.
1646         (WKPreferencesGetNewCSSParserEnabled): Deleted.
1647         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1648         * WebProcess/WebPage/WebPage.cpp:
1649         (WebKit::WebPage::updatePreferences):
1650
1651 2016-12-14  Brent Fulgham  <bfulgham@apple.com>
1652
1653         Unreviewed test fix after r209806.
1654
1655         Plugin-common doesn't define 'home-subpath'. Instead it has 'home-library-subpath'. Switch to the correct
1656         function. Also, 'home-library-subpath' adds '/Library' to the path, so revise the arguments so that we
1657         do not generate paths like '/home/username/Library/Library/Keychains'.
1658
1659         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
1660
1661 2016-12-14  Brent Fulgham  <bfulgham@apple.com>
1662
1663         Unreviewed test fix after r209779.
1664
1665         The 'Keygen' element requires the ability to create new keys in '$HOME/Library/Keychains'. Remove the
1666         WebProcess and Plugin sandbox restrictions on per-user Keychain creation to support this use.
1667
1668         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
1669         * WebProcess/com.apple.WebProcess.sb.in:
1670
1671 2016-12-13  Yusuke Suzuki  <utatane.tea@gmail.com>
1672
1673         Use JSValue::toWTFString instead of calling toString(exec) and value(exec)
1674         https://bugs.webkit.org/show_bug.cgi?id=165795
1675
1676         Reviewed by Saam Barati.
1677
1678         * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp:
1679         (WebKit::NPRuntimeObjectMap::convertJSValueToNPVariant):
1680
1681 2016-12-14  Enrique Ocaña González  <eocanha@igalia.com>
1682
1683         REGRESSION(r207879-207891): [GStreamer] Introduced many layout test failures and crashes, bots exiting early
1684         https://bugs.webkit.org/show_bug.cgi?id=164022
1685
1686         Reviewed by Xabier Rodriguez-Calvar.
1687
1688         * Shared/WebPreferencesDefinitions.h:
1689         New GStreamerEnabled preference, defaults to true.
1690         * WebProcess/WebPage/WebPage.cpp: Ditto.
1691         (WebKit::WebPage::updatePreferences):
1692
1693 2016-12-13  Commit Queue  <commit-queue@webkit.org>
1694
1695         Unreviewed, rolling out r209792.
1696         https://bugs.webkit.org/show_bug.cgi?id=165841
1697
1698         Cause build failures (Requested by yusukesuzuki on #webkit).
1699
1700         Reverted changeset:
1701
1702         "Use JSValue::toWTFString instead of calling toString(exec)
1703         and value(exec)"
1704         https://bugs.webkit.org/show_bug.cgi?id=165795
1705         http://trac.webkit.org/changeset/209792
1706
1707 2016-12-13  Yusuke Suzuki  <utatane.tea@gmail.com>
1708
1709         Use JSValue::toWTFString instead of calling toString(exec) and value(exec)
1710         https://bugs.webkit.org/show_bug.cgi?id=165795
1711
1712         Reviewed by Saam Barati.
1713
1714         * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp:
1715         (WebKit::NPRuntimeObjectMap::convertJSValueToNPVariant):
1716
1717 2016-12-13  Alex Christensen  <achristensen@webkit.org>
1718
1719         Fix CMake build.
1720
1721         * PlatformMac.cmake:
1722
1723 2016-12-13  Jer Noble  <jer.noble@apple.com>
1724
1725         Fullscreen in WebKit2 does not restore topContentInset upon exiting; leaves top of page not visible
1726         https://bugs.webkit.org/show_bug.cgi?id=165697
1727
1728         Delegate the values of topContentInset() from WebViewImpl (used by WKWebView and WKView) to the
1729         WebPageProxy, so that setting the topContentInset() on WebPageProxy is reflected in the getters
1730         for the two view classes.
1731
1732         Reviewed by Tim Horton.
1733
1734         * UIProcess/Cocoa/WebViewImpl.h:
1735         (WebKit::WebViewImpl::topContentInset): Deleted.
1736         * UIProcess/Cocoa/WebViewImpl.mm:
1737         (WebKit::WebViewImpl::updateContentInsetsIfAutomatic):
1738         (WebKit::WebViewImpl::topContentInset):
1739         (WebKit::WebViewImpl::setTopContentInset):
1740         (WebKit::WebViewImpl::dispatchSetTopContentInset):
1741         * UIProcess/mac/WKFullScreenWindowController.mm:
1742         (-[WKFullScreenWindowController enterFullScreen:]):
1743         (-[WKFullScreenWindowController finishedEnterFullScreenAnimation:]):
1744         (-[WKFullScreenWindowController finishedExitFullScreenAnimation:]):
1745         (-[WKFullScreenWindowController _saveTopContentInset]): Deleted.
1746         (-[WKFullScreenWindowController _restoreTopContentInset]): Deleted.
1747
1748 2016-12-13  Brent Fulgham  <bfulgham@apple.com>
1749
1750         [Mac][WK2] Tighten Keychain directory access
1751         https://bugs.webkit.org/show_bug.cgi?id=165818
1752         <rdar://problem/16863857>
1753
1754         Reviewed by Anders Carlsson.
1755
1756         Lock down Keychain directory access to just the file-read-data, file-read-metadata, and
1757         file-write-data operations we actually need.
1758
1759         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
1760         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
1761         * WebProcess/com.apple.WebProcess.sb.in:
1762
1763 2016-12-13  Andy Estes  <aestes@apple.com>
1764
1765         [Cocoa] Implement -shouldInsertText: on WKWebProcessPlugInEditingDelegate
1766         https://bugs.webkit.org/show_bug.cgi?id=165785
1767         <rdar://problem/26929398>
1768
1769         Reviewed by Darin Adler.
1770
1771         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInEditingDelegate.h: Defined
1772         WKEditorInsertAction and declared
1773         -_webProcessPlugInBrowserContextController:shouldInsertText:replacingRange:givenAction:.
1774         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
1775         (toWK): Added. Mapped a WebCore::EditorInsertAction to a WKEditorInsertAction.
1776         (-[WKWebProcessPlugInBrowserContextController _setEditingDelegate:]): Implemented
1777         EditorClient::shouldInsertText() by calling
1778         -_webProcessPlugInBrowserContextController:shouldInsertText:replacingRange:givenAction: with
1779         the text, wrapped range handle, and action. Added shouldInsertText to DelegateMethods and
1780         initialized it according to whether the delegate responds to shouldInsertText:.
1781
1782 2016-12-13  Joseph Pecoraro  <pecoraro@apple.com>
1783
1784         NSArray leaks seen in Safari, allocated under WKIconDatabaseTryCopyCGImageArrayForURL
1785         https://bugs.webkit.org/show_bug.cgi?id=165809
1786
1787         Reviewed by Dan Bernstein.
1788
1789         * UIProcess/API/C/cg/WKIconDatabaseCG.cpp:
1790         (WKIconDatabaseTryCopyCGImageArrayForURL):
1791         Avoid an extra retain on already newly created array.
1792
1793 2016-12-13  Eric Carlson  <eric.carlson@apple.com>
1794
1795         Annotate MediaStream and WebRTC idl with EnabledAtRuntime flag
1796         https://bugs.webkit.org/show_bug.cgi?id=165251
1797
1798         Reviewed by Youenn Fablet.
1799
1800         * WebProcess/WebPage/WebPage.cpp:
1801         (WebKit::WebPage::updatePreferences): Update the media stream and peer connection runtime
1802         feature instead of the setting.
1803
1804 2016-12-13  Sergio Villar Senin  <svillar@igalia.com>
1805
1806         Fix GTK build after r209733
1807         https://bugs.webkit.org/show_bug.cgi?id=165794
1808
1809         Document::visibilityState() now returns an IDL string enumeration.
1810
1811         Reviewed by Žan Doberšek.
1812
1813         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocument.cpp:
1814         (webkit_dom_document_get_visibility_state):
1815
1816 2016-12-12  Dean Jackson  <dino@apple.com>
1817
1818         [iOS] MediaDocument "Done" button should navigate the page back
1819         https://bugs.webkit.org/show_bug.cgi?id=165779
1820
1821         Reviewed by Sam Weinig.
1822
1823         * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h:
1824         * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm:
1825         (WebKit::WebVideoFullscreenModelContext::requestFullscreenMode):
1826         (WebKit::WebVideoFullscreenManagerProxy::requestFullscreenMode):
1827         * WebProcess/cocoa/WebVideoFullscreenManager.h:
1828         * WebProcess/cocoa/WebVideoFullscreenManager.messages.in:
1829         * WebProcess/cocoa/WebVideoFullscreenManager.mm:
1830         (WebKit::WebVideoFullscreenManager::requestFullscreenMode):
1831
1832 2016-12-12  Tim Horton  <timothy_horton@apple.com>
1833
1834         Provide SPI to avoid blocking on painting when coming into view
1835         https://bugs.webkit.org/show_bug.cgi?id=165780
1836         <rdar://problem/29009559>
1837
1838         Reviewed by Simon Fraser.
1839
1840         By default, when parenting a WKWebView which was previously in-window,
1841         we block on painting to ensure that we don't flash stale content.
1842         We added SPI to disable this behavior to WKWebViewConfiguration, but
1843         some clients might want the behavior most of the time, but sometimes
1844         instead want to not block the UI process main thread, but instead do
1845         their own work (e.g. removing a snapshot) when painting eventually occurs.
1846
1847         * UIProcess/API/Cocoa/WKWebView.mm:
1848         (-[WKWebView _doAfterNextPresentationUpdateWithoutWaitingForPainting:]):
1849         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1850         Tell WebPageProxy not to block on painting next time we are parented,
1851         and use doAfterNextPresentationUpdate to call the block when the painting
1852         does eventually happen. This SPI must be called before - but in the same
1853         runloop cycle - the WKWebView is brought back in-window to work correctly.
1854         
1855         * UIProcess/WebPageProxy.cpp:
1856         (WebKit::WebPageProxy::dispatchActivityStateChange):
1857         * UIProcess/WebPageProxy.h:
1858         (WebKit::WebPageProxy::skipWaitingForPaintAfterNextViewDidMoveToWindow):
1859         If we would block because we're coming in-window, but the bit to skip
1860         blocking the next time we get brought in-window is set, reset the bit, 
1861         and avoid blocking.
1862
1863 2016-12-12  Chris Dumez  <cdumez@apple.com>
1864
1865         Document.visibilityState should use an IDL string enumeration
1866         https://bugs.webkit.org/show_bug.cgi?id=165774
1867
1868         Reviewed by Daniel Bates.
1869
1870         * Shared/API/c/WKSharedAPICast.h:
1871         (WebKit::toPageVisibilityState):
1872
1873 2016-12-11  Konstantin Tokarev  <annulen@yandex.ru>
1874
1875         Unreviewed attempt to fix EFL and Mac/cmake builds after r209665.
1876         https://bugs.webkit.org/show_bug.cgi?id=165686
1877
1878         * PlatformEfl.cmake: WebKit2 should precede other target so that right
1879         config.h comes first in include path.
1880
1881 2016-12-11  Tim Horton  <timothy_horton@apple.com>
1882
1883         Quarter-second stalls scrolling images that are links because of sync getPositionInformation
1884         https://bugs.webkit.org/show_bug.cgi?id=165707
1885
1886         Reviewed by Simon Fraser.
1887
1888         * UIProcess/ios/WKContentViewInteraction.mm:
1889         (-[WKContentView positionInformationForActionSheetAssistant:]):
1890         (-[WKContentView updatePositionInformationForActionSheetAssistant:]):
1891         For now, synchronously block when presenting the action sheet if we
1892         don't have a snapshot ready.
1893
1894         * WebProcess/WebPage/ios/WebPageIOS.mm:
1895         (WebKit::WebPage::getPositionInformation):
1896         Respect includeSnapshot in another place in getPositionInformation,
1897         so that many getPositionInformations don't have to do extra snapshotting work.
1898
1899 2016-12-10  Filip Pizlo  <fpizlo@apple.com>
1900
1901         The DOM should have an advancing wavefront opaque root barrier
1902         https://bugs.webkit.org/show_bug.cgi?id=165712
1903
1904         Reviewed by Yusuke Suzuki.
1905         
1906         Propagate the JSDOMWindowBase::commonVM() -> commonVM() change.
1907
1908         * Shared/linux/WebMemorySamplerLinux.cpp:
1909         (WebKit::WebMemorySampler::sampleWebKit):
1910         * Shared/mac/WebMemorySampler.mac.mm:
1911         (WebKit::WebMemorySampler::sampleWebKit):
1912         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1913         (WebKit::InjectedBundle::javaScriptObjectsCount):
1914         * WebProcess/Plugins/Netscape/JSNPObject.cpp:
1915         (WebKit::JSNPObject::callMethod):
1916         (WebKit::JSNPObject::callObject):
1917         (WebKit::JSNPObject::callConstructor):
1918         (WebKit::JSNPObject::put):
1919         (WebKit::JSNPObject::deleteProperty):
1920         (WebKit::JSNPObject::getOwnPropertyNames):
1921         (WebKit::JSNPObject::propertyGetter):
1922         * WebProcess/WebPage/WebPage.cpp:
1923         (WebKit::WebPage::runJavaScriptInMainFrame):
1924         (WebKit::WebPage::getBytecodeProfile):
1925         (WebKit::WebPage::getSamplingProfilerOutput):
1926         * WebProcess/WebProcess.cpp:
1927         (WebKit::WebProcess::getWebCoreStatistics):
1928
1929 2016-12-11  Konstantin Tokarev  <annulen@yandex.ru>
1930
1931         Unreviewed build fix for EFL after r209665
1932
1933         * UIProcess/efl/TextCheckerClientEfl.h:
1934
1935 2016-12-10  Konstantin Tokarev  <annulen@yandex.ru>
1936
1937         [cmake] Include WTF, JSC, and WebCore headers automatically to targers using them
1938         https://bugs.webkit.org/show_bug.cgi?id=165686
1939
1940         Reviewed by Michael Catanzaro.
1941
1942         This change reduces duplication of include path lists between modules,
1943         and reduces future need for fixes like r209605 (broken build because of
1944         WebCore header suddenly becoming used in WebKit2).
1945
1946         * CMakeLists.txt:
1947         * PlatformEfl.cmake:
1948         * PlatformGTK.cmake:
1949         * PlatformMac.cmake:
1950
1951 2016-12-10  Antti Koivisto  <antti@apple.com>
1952
1953         CrashTracer: com.apple.WebKit.Networking at WTF::ThreadSafeRefCounted<WebKit::NetworkCache::IOChannel>::deref
1954         https://bugs.webkit.org/show_bug.cgi?id=165659
1955         <rdar://problem/27077977>
1956
1957         Reviewed by Darin Adler.
1958
1959         * NetworkProcess/cache/NetworkCacheIOChannel.h:
1960         * NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm:
1961         (WebKit::NetworkCache::IOChannel::~IOChannel):
1962
1963             Add non-inlined destructor and release assert against double deletion to narrow down this crash.
1964
1965 2016-12-09  Brent Fulgham  <bfulgham@apple.com>
1966
1967         WebCore::Timer is not compatible with UIProcess
1968         https://bugs.webkit.org/show_bug.cgi?id=165706
1969         <rdar://problem/29360564>
1970
1971         Reviewed by Andy Estes.
1972
1973         Anders has explained to me (at least twice) that WebCore::Timer must not
1974         be used in UIProcess code. A recent bug fix introduced a WebCore::Timer,
1975         which led to another crash.
1976         
1977         This patch switches from WebCore::Timer to WTF::RunLoop::Timer to avoid
1978         the problem.
1979
1980         * UIProcess/Cocoa/NavigationState.h:
1981         * UIProcess/Cocoa/NavigationState.mm:
1982         (WebKit::NavigationState::NavigationState):
1983
1984 2016-12-09  Eric Carlson  <eric.carlson@apple.com>
1985
1986         Annotate MediaStream and WebRTC idl with EnabledAtRuntime flag
1987         https://bugs.webkit.org/show_bug.cgi?id=165251
1988
1989         Reviewed by Dean Jackson.
1990
1991         Based on a patch by Dr Alex Gouaillard <agouaillard@gmail.com>
1992
1993         * Shared/WebPreferencesDefinitions.h: Add peerConnectionEnabled.
1994
1995         * UIProcess/API/C/WKPreferences.cpp:
1996         (WKPreferencesSetPeerConnectionEnabled): Added.
1997         (WKPreferencesGetPeerConnectionEnabled): Added.
1998         * UIProcess/API/C/WKPreferencesRef.h:
1999
2000         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2001         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner): Add WebKitMediaStreamEnabled
2002           and WebKitPeerConnectionEnabled.
2003
2004         * WebProcess/WebPage/WebPage.cpp:
2005         (WebKit::WebPage::updatePreferences): Initialize the peerConnection preference.
2006
2007 2016-12-09  Brady Eidson  <beidson@apple.com>
2008
2009         Re-landing:
2010         Add _WKIconLoadingDelegate SPI.
2011         https://bugs.webkit.org/show_bug.cgi?id=164894
2012
2013         Reviewed by Alex Christensen.
2014
2015         With this client, WebCore will ask the FrameLoaderClient about each icon found in the <head>.
2016
2017         WebKit2 will then ask the embedding app - for each icon - if it wants that icon to load.
2018
2019         For icons the app decides to load, WebKit will pass the data to the app without storing locally.
2020
2021         * UIProcess/API/APIIconLoadingClient.h: Copied from Source/WebCore/html/LinkIconCollector.h.
2022         (API::IconLoadingClient::~IconLoadingClient):
2023         (API::IconLoadingClient::getLoadDecisionForIcon):
2024
2025         * UIProcess/API/Cocoa/WKWebView.mm:
2026         (-[WKWebView _initializeWithConfiguration:]):
2027         (-[WKWebView _iconLoadingDelegate]):
2028         (-[WKWebView _setIconLoadingDelegate:]):
2029         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2030
2031         * UIProcess/API/Cocoa/_WKIconLoadingDelegate.h: Copied from Source/WebCore/html/LinkIconCollector.h.
2032
2033         * UIProcess/API/Cocoa/_WKLinkIconParameters.h: Copied from Source/WebCore/html/LinkIconCollector.h.
2034         * UIProcess/API/Cocoa/_WKLinkIconParameters.mm: Copied from Source/WebCore/html/LinkIconCollector.h.
2035         (-[_WKLinkIconParameters _initWithLinkIcon:]):
2036         (-[_WKLinkIconParameters url]):
2037         (-[_WKLinkIconParameters mimeType]):
2038         (-[_WKLinkIconParameters size]):
2039         (-[_WKLinkIconParameters iconType]):
2040         * UIProcess/API/Cocoa/_WKLinkIconParametersInternal.h: Copied from Source/WebCore/html/LinkIconCollector.h.
2041
2042         * UIProcess/Cocoa/IconLoadingDelegate.h: Copied from Source/WebCore/html/LinkIconCollector.h.
2043         * UIProcess/Cocoa/IconLoadingDelegate.mm: Added.
2044         (WebKit::IconLoadingDelegate::IconLoadingDelegate):
2045         (WebKit::IconLoadingDelegate::~IconLoadingDelegate):
2046         (WebKit::IconLoadingDelegate::createIconLoadingClient):
2047         (WebKit::IconLoadingDelegate::delegate):
2048         (WebKit::IconLoadingDelegate::setDelegate):
2049         (WebKit::IconLoadingDelegate::IconLoadingClient::IconLoadingClient):
2050         (WebKit::IconLoadingDelegate::IconLoadingClient::~IconLoadingClient):
2051         (WebKit::IconLoadingDelegate::IconLoadingClient::getLoadDecisionForIcon):
2052
2053         * UIProcess/WebPageProxy.cpp:
2054         (WebKit::WebPageProxy::setIconLoadingClient):
2055         (WebKit::WebPageProxy::getLoadDecisionForIcon):
2056         (WebKit::WebPageProxy::finishedLoadingIcon):
2057         * UIProcess/WebPageProxy.h:
2058         (WebKit::WebPageProxy::iconLoadingClient):
2059         * UIProcess/WebPageProxy.messages.in:
2060
2061         * WebKit2.xcodeproj/project.pbxproj:
2062
2063         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2064         (WebKit::WebFrameLoaderClient::useIconLoadingClient):
2065         (WebKit::WebFrameLoaderClient::getLoadDecisionForIcon):
2066         (WebKit::WebFrameLoaderClient::finishedLoadingIcon):
2067         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
2068         (WebKit::WebFrameLoaderClient::setUseIconLoadingClient):
2069
2070         * WebProcess/WebPage/WebPage.cpp:
2071         (WebKit::WebPage::didGetLoadDecisionForIcon):
2072         (WebKit::WebPage::setUseIconLoadingClient):
2073         * WebProcess/WebPage/WebPage.h:
2074         * WebProcess/WebPage/WebPage.messages.in:
2075
2076 2016-12-09  Simon Fraser  <simon.fraser@apple.com>
2077
2078         Fix initialization of contentUpdateFrequency
2079         https://bugs.webkit.org/show_bug.cgi?id=165705
2080         rdar://problem/29602039
2081
2082         Reviewed by Tim Horton.
2083
2084         The value that controls web content update frequency was not being initialized.
2085
2086         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2087         (-[WKWebViewConfiguration init]):
2088
2089 2016-12-09  Anders Carlsson  <andersca@apple.com>
2090
2091         Once we can send Mach messages again, make sure to send any pending outgoing messages
2092         https://bugs.webkit.org/show_bug.cgi?id=165693
2093
2094         Reviewed by Brady Eidson.
2095
2096         * Platform/IPC/mac/ConnectionMac.mm:
2097         (IPC::Connection::initializeSendSource):
2098
2099 2016-12-09  Beth Dakin  <bdakin@apple.com>
2100
2101         Password fields should not show the emoji button in TouchBar
2102         https://bugs.webkit.org/show_bug.cgi?id=165673
2103         -and corresponding-
2104         rdar://problem/29235739
2105
2106         Reviewed by Wenson Hsieh.
2107
2108         This patch adds a new member variable for the password touch bar and password 
2109         candidateListTouchBarItem. Since this TouchBar will actually have a different set 
2110         of identifiers than the plain text TouchBar, it should just have its own variable.
2111         * UIProcess/Cocoa/WebViewImpl.h:
2112         * UIProcess/Cocoa/WebViewImpl.mm:
2113
2114         Return m_passwordTextCandidateListTouchBarItem when appropriate.
2115         (WebKit::WebViewImpl::candidateListTouchBarItem):
2116
2117         The candidate list should be the only item for passwords.
2118         (WebKit::passwordTextTouchBarDefaultItemIdentifiers):
2119
2120         Account for m_passwordTextTouchBar.
2121         (WebKit::WebViewImpl::updateTouchBarAndRefreshTextBarIdentifiers):
2122         (WebKit::WebViewImpl::setUpTextTouchBar):
2123         (WebKit::WebViewImpl::textTouchBar):
2124
2125         The empty candidates array is not needed. We can just set @[ ] as the candidates 
2126         for the m_passwordTextCandidateListTouchBarItem. Safe guards already exist in the 
2127         other parts of the code to prevent us from requesting or setting other candidates 
2128         when in a password field. 
2129         (WebKit::WebViewImpl::updateTextTouchBar):
2130
2131 2016-12-09  Keith Rollin  <krollin@apple.com>
2132
2133         Fix string specification in print format
2134         https://bugs.webkit.org/show_bug.cgi?id=165650
2135
2136         Reviewed by Alex Christensen.
2137
2138         Change "%{public}s" string specifier to something that can be changed
2139         to "%s" at compile time when the build environment doesn't support the
2140         former.
2141
2142         * NetworkProcess/capture/NetworkCaptureLogging.h:
2143         * NetworkProcess/capture/NetworkCaptureManager.cpp:
2144         (WebKit::NetworkCapture::Manager::initialize):
2145         (WebKit::NetworkCapture::Manager::findMatch):
2146         (WebKit::NetworkCapture::Manager::findExactMatch):
2147         (WebKit::NetworkCapture::Manager::findBestFuzzyMatch):
2148         (WebKit::NetworkCapture::Manager::fuzzyMatchURLs):
2149         (WebKit::NetworkCapture::Manager::logPlayedBackResource):
2150         (WebKit::NetworkCapture::Manager::openCacheFile):
2151         (WebKit::NetworkCapture::Manager::getLine):
2152         * NetworkProcess/capture/NetworkCaptureRecorder.cpp:
2153         (WebKit::NetworkCapture::Recorder::recordRequestSent):
2154         (WebKit::NetworkCapture::Recorder::recordResponseReceived):
2155         (WebKit::NetworkCapture::Recorder::recordRedirectReceived):
2156         (WebKit::NetworkCapture::Recorder::recordRedirectSent):
2157         (WebKit::NetworkCapture::Recorder::writeEvents):
2158         * NetworkProcess/capture/NetworkCaptureResource.cpp:
2159         (WebKit::NetworkCapture::Resource::url):
2160         (WebKit::NetworkCapture::Resource::EventStream::nextEvent):
2161         * NetworkProcess/capture/NetworkDataTaskReplay.cpp:
2162         (WebKit::NetworkCapture::NetworkDataTaskReplay::NetworkDataTaskReplay):
2163         (WebKit::NetworkCapture::NetworkDataTaskReplay::~NetworkDataTaskReplay):
2164         (WebKit::NetworkCapture::NetworkDataTaskReplay::resume):
2165         (WebKit::NetworkCapture::NetworkDataTaskReplay::suspend):
2166         (WebKit::NetworkCapture::NetworkDataTaskReplay::complete):
2167         (WebKit::NetworkCapture::NetworkDataTaskReplay::invalidateAndCancel):
2168         (WebKit::NetworkCapture::NetworkDataTaskReplay::enqueueEventHandler):
2169         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayRequestSent):
2170         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayResponseReceived):
2171         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayRedirectReceived):
2172         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayRedirectSent):
2173         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayDataReceived):
2174         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayFinished):
2175         (WebKit::NetworkCapture::NetworkDataTaskReplay::didReceiveResponse):
2176
2177 2016-12-09  Jeremy Jones  <jeremyj@apple.com>
2178
2179         WebView doesn't become first responder in element fullscreen.
2180         https://bugs.webkit.org/show_bug.cgi?id=165664
2181         rdar://problem/28927252
2182
2183         Reviewed by Tim Horton.
2184
2185         WebView was being set as the first responder while the contentView was still hidden.
2186         A view can not become first responder while it or its ancestor is hidden.
2187
2188         This change waits until after the contentView is visible to make the web view the first responder.
2189
2190         * UIProcess/mac/WKFullScreenWindowController.mm:
2191         (-[WKFullScreenWindowController enterFullScreen:]):
2192         (-[WKFullScreenWindowController _startEnterFullScreenAnimationWithDuration:]):
2193
2194 2016-12-09  Gustavo Noronha Silva  <gustavo.noronha@collabora.co.uk>
2195
2196         Unreviewed build fix. Thanks to Konstantin Tokarev and Csaba Osztrogonác
2197         for pointing out the fix.
2198
2199         * CMakeLists.txt: add WebCore/html/canvas to include paths.
2200
2201 2016-12-09  Gustavo Noronha Silva  <gustavo.noronha@collabora.co.uk>
2202
2203         [GTK] Fix build after r209558
2204         https://bugs.webkit.org/show_bug.cgi?id=165653
2205
2206         Unreviewed build fix.
2207
2208         * UIProcess/API/APIPolicyClient.h: include WebsitePolicies.h.
2209         * UIProcess/API/gtk/WebKitPolicyClient.cpp: ditto.
2210         * UIProcess/API/gtk/WebKitPolicyDecision.cpp:
2211         (webkit_policy_decision_use):  pass empty structure to new required argument.
2212
2213 2016-12-09  Gavin Barraclough  <barraclough@apple.com>
2214
2215         Revert - Add _WKIconLoadingDelegate SPI
2216         https://bugs.webkit.org/show_bug.cgi?id=164894
2217
2218         Unreviewed rollout due to performance regression.
2219
2220         * PlatformMac.cmake:
2221         * UIProcess/API/APIIconLoadingClient.h: Removed.
2222         * UIProcess/API/Cocoa/WKWebView.mm:
2223         (-[WKWebView _initializeWithConfiguration:]):
2224         (-[WKWebView _iconLoadingDelegate]): Deleted.
2225         (-[WKWebView _setIconLoadingDelegate:]): Deleted.
2226         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2227         * UIProcess/API/Cocoa/_WKIconLoadingDelegate.h: Removed.
2228         * UIProcess/API/Cocoa/_WKLinkIconParameters.h: Removed.
2229         * UIProcess/API/Cocoa/_WKLinkIconParameters.mm: Removed.
2230         * UIProcess/API/Cocoa/_WKLinkIconParametersInternal.h: Removed.
2231         * UIProcess/Cocoa/IconLoadingDelegate.h: Removed.
2232         * UIProcess/Cocoa/IconLoadingDelegate.mm: Removed.
2233         * UIProcess/WebPageProxy.cpp:
2234         (WebKit::WebPageProxy::setIconLoadingClient): Deleted.
2235         (WebKit::WebPageProxy::getLoadDecisionForIcon): Deleted.
2236         (WebKit::WebPageProxy::finishedLoadingIcon): Deleted.
2237         * UIProcess/WebPageProxy.h:
2238         (WebKit::WebPageProxy::iconLoadingClient): Deleted.
2239         * UIProcess/WebPageProxy.messages.in:
2240         * WebKit2.xcodeproj/project.pbxproj:
2241         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2242         (WebKit::WebFrameLoaderClient::useIconLoadingClient): Deleted.
2243         (WebKit::WebFrameLoaderClient::getLoadDecisionForIcon): Deleted.
2244         (WebKit::WebFrameLoaderClient::finishedLoadingIcon): Deleted.
2245         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
2246         (WebKit::WebFrameLoaderClient::setUseIconLoadingClient): Deleted.
2247         (): Deleted.
2248         * WebProcess/WebPage/WebPage.cpp:
2249         (WebKit::WebPage::didGetLoadDecisionForIcon): Deleted.
2250         (WebKit::WebPage::setUseIconLoadingClient): Deleted.
2251         * WebProcess/WebPage/WebPage.h:
2252         * WebProcess/WebPage/WebPage.messages.in:
2253
2254 2016-12-08  Keith Rollin  <krollin@apple.com>
2255
2256         Move FileHandle to WebCore FileHandle.h
2257         https://bugs.webkit.org/show_bug.cgi?id=165562
2258
2259         Reviewed by Alex Christensen.
2260
2261         Move FileHandle from NetworkCaptureTypes.h (which can now be deleted)
2262         to WebCore. Update client code to use the new version.
2263
2264         * NetworkProcess/capture/NetworkCaptureEvent.cpp:
2265         * NetworkProcess/capture/NetworkCaptureEvent.h:
2266         * NetworkProcess/capture/NetworkCaptureManager.cpp:
2267         (WebKit::NetworkCapture::Manager::initialize):
2268         (WebKit::NetworkCapture::Manager::terminate):
2269         (WebKit::NetworkCapture::Manager::logRecordedResource):
2270         (WebKit::NetworkCapture::Manager::logLoadedResource):
2271         (WebKit::NetworkCapture::Manager::logPlayedBackResource):
2272         (WebKit::NetworkCapture::Manager::openCacheFile):
2273         (WebKit::NetworkCapture::Manager::ensureFileHandle): Deleted.
2274         (WebKit::NetworkCapture::Manager::printToFile): Deleted.
2275         * NetworkProcess/capture/NetworkCaptureManager.h:
2276         * NetworkProcess/capture/NetworkCaptureRecorder.cpp:
2277         (WebKit::NetworkCapture::Recorder::writeEvents):
2278         * NetworkProcess/capture/NetworkCaptureTypes.h: Removed.
2279         * WebKit2.xcodeproj/project.pbxproj:
2280
2281 2016-12-08  Anders Carlsson  <andersca@apple.com>
2282
2283         Attempt to fix the iOS build.
2284
2285         * Platform/IPC/mac/MachMessage.cpp:
2286
2287 2016-12-08  Anders Carlsson  <andersca@apple.com>
2288
2289         Defer sending Mach messages if the queue is full
2290         https://bugs.webkit.org/show_bug.cgi?id=165622
2291         rdar://problem/29518036
2292
2293         Reviewed by Brady Eidson.
2294
2295         * Platform/IPC/Connection.cpp:
2296         Include MachMessage.h so the Connection destructor can do its thing.
2297
2298         * Platform/IPC/Connection.h:
2299         Add new members.
2300
2301         * Platform/IPC/mac/ConnectionMac.mm:
2302         (IPC::Connection::platformInvalidate):
2303         Null out the pending outgoing mach message.
2304
2305         (IPC::Connection::sendMessage):
2306         New helper that will send a Mach message. If we time out, store the message in m_pendingOutgoingMachMessage.
2307         When our send source will be triggered we'll try to send the message again.
2308
2309         (IPC::Connection::platformCanSendOutgoingMessages):
2310         We can only send messages if we don't have a pending outgoing message.
2311
2312         (IPC::Connection::sendOutgoingMessage):
2313         Call the newly added sendMessage function.
2314
2315         (IPC::Connection::initializeSendSource):
2316         Add the DISPATCH_MACH_SEND_POSSIBLE mask (and DISPATCH_MACH_SEND_DEAD which was previously implicit).
2317         In our event handler, check for DISPATCH_MACH_SEND_POSSIBLE and try to send the pending outgoing message again.
2318
2319         * Platform/IPC/mac/MachMessage.cpp:
2320         (IPC::MachMessage::create):
2321         Rename length to size.
2322
2323         (IPC::MachMessage::MachMessage):
2324         Initialize m_shouldFreeDescriptors.
2325
2326         (IPC::MachMessage::~MachMessage):
2327         Call mach_msg_destroy, which will free the descriptors.
2328
2329         (IPC::MachMessage::leakDescriptors):
2330         Set m_shouldFreeDescriptors to false.
2331
2332         * Platform/IPC/mac/MachMessage.h:
2333         (IPC::MachMessage::size):
2334         (IPC::MachMessage::length): Deleted.
2335
2336 2016-12-08  Chelsea Pugh  <cpugh@apple.com>
2337
2338         [iOS] WKWebView should not allow app links to be opened on back or forward navigation
2339         https://bugs.webkit.org/show_bug.cgi?id=165502
2340
2341         Reviewed by Dan Bernstein.
2342
2343         * UIProcess/WebPageProxy.cpp:
2344         (WebKit::WebPageProxy::decidePolicyForNavigationAction): Add a condition to shouldOpenAppLinks
2345         (which we use when creating a NavigationAction) that the navigationActionData is not a navigation
2346         of type BackForward. This way, we don't open app links when a navigation is done via back or
2347         forward.
2348
2349 2016-12-08  Filip Pizlo  <fpizlo@apple.com>
2350
2351         Enable SharedArrayBuffer, remove the flag
2352         https://bugs.webkit.org/show_bug.cgi?id=165614
2353
2354         Rubber stamped by Geoffrey Garen.
2355
2356         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2357         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
2358
2359 2016-12-08  Alex Christensen  <achristensen@webkit.org>
2360
2361         Add SPI for sending WebsiteSettings to WebProcess during navigation
2362         https://bugs.webkit.org/show_bug.cgi?id=165517
2363         <rdar://29341068>
2364
2365         We add the ability for the navigation client to send settings to the WebProcess 
2366         based on the URL of the document being navigated to. This approach adds no new IPC 
2367         messages and allows the application to decide what settings to use during navigation 
2368         instead of declaratively before navigation. Right now there is only one setting, 
2369         whether to disable content blockers, but this infrastructure can be used for more settings.
2370
2371         Reviewed by Anders Carlsson.
2372
2373         * CMakeLists.txt:
2374         * PlatformMac.cmake:
2375         * Shared/API/APIObject.h:
2376         * Shared/API/c/WKBase.h:
2377         * Shared/WebsitePolicies.h: Added.
2378         (WebKit::WebsitePolicies::encode):
2379         (WebKit::WebsitePolicies::decode):
2380         * UIProcess/API/APINavigationClient.h:
2381         (API::NavigationClient::decidePolicyForNavigationAction):
2382         (API::NavigationClient::decidePolicyForNavigationResponse):
2383         * UIProcess/API/APIPolicyClient.h:
2384         (API::PolicyClient::decidePolicyForNavigationAction):
2385         (API::PolicyClient::decidePolicyForNewWindowAction):
2386         (API::PolicyClient::decidePolicyForResponse):
2387         * UIProcess/API/APIWebsitePolicies.cpp: Added.
2388         (API::WebsitePolicies::create):
2389         * UIProcess/API/APIWebsitePolicies.h: Added.
2390         * UIProcess/API/C/WKAPICast.h:
2391         * UIProcess/API/C/WKFramePolicyListener.cpp:
2392         (WKFramePolicyListenerUse):
2393         (WKFramePolicyListenerUseWithPolicies):
2394         * UIProcess/API/C/WKFramePolicyListener.h:
2395         * UIProcess/API/C/WKPage.cpp:
2396         (WKPageSetPagePolicyClient):
2397         * UIProcess/API/C/WKWebsitePolicies.cpp: Added.
2398         (WKWebsitePoliciesGetTypeID):
2399         (WKWebsitePoliciesCreate):
2400         (WKWebsitePoliciesSetContentBlockersEnabled):
2401         (WKWebsitePoliciesGetContentBlockersEnabled):
2402         * UIProcess/API/C/WKWebsitePolicies.h: Added.
2403         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
2404         * UIProcess/API/Cocoa/_WKWebsitePolicies.h: Added.
2405         * UIProcess/API/Cocoa/_WKWebsitePolicies.mm: Added.
2406         (-[_WKWebsitePolicies dealloc]):
2407         (-[_WKWebsitePolicies init]):
2408         (-[_WKWebsitePolicies setContentBlockersEnabled:]):
2409         (-[_WKWebsitePolicies contentBlockersEnabled]):
2410         (-[_WKWebsitePolicies description]):
2411         (-[_WKWebsitePolicies _apiObject]):
2412         * UIProcess/API/Cocoa/_WKWebsitePoliciesInternal.h: Added.
2413         (WebKit::wrapper):
2414         * UIProcess/Automation/WebAutomationSession.cpp:
2415         (WebKit::WebAutomationSession::reloadBrowsingContext):
2416         * UIProcess/Cocoa/NavigationState.h:
2417         * UIProcess/Cocoa/NavigationState.mm:
2418         (WebKit::NavigationState::setNavigationDelegate):
2419         (WebKit::tryAppLink):
2420         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
2421         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationResponse):
2422         * UIProcess/WebFormSubmissionListenerProxy.cpp:
2423         (WebKit::WebFormSubmissionListenerProxy::continueSubmission):
2424         * UIProcess/WebFrameListenerProxy.cpp:
2425         (WebKit::WebFrameListenerProxy::receivedPolicyDecision):
2426         * UIProcess/WebFrameListenerProxy.h:
2427         * UIProcess/WebFramePolicyListenerProxy.cpp:
2428         (WebKit::WebFramePolicyListenerProxy::use):
2429         (WebKit::WebFramePolicyListenerProxy::download):
2430         (WebKit::WebFramePolicyListenerProxy::ignore):
2431         * UIProcess/WebFramePolicyListenerProxy.h:
2432         (WebKit::WebFramePolicyListenerProxy::create):
2433         * UIProcess/WebFrameProxy.cpp:
2434         (WebKit::WebFrameProxy::receivedPolicyDecision):
2435         * UIProcess/WebFrameProxy.h:
2436         * UIProcess/WebInspectorProxy.cpp:
2437         (WebKit::decidePolicyForNavigationAction):
2438         * UIProcess/WebPageProxy.cpp:
2439         (WebKit::WebPageProxy::receivedPolicyDecision):
2440         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2441         * UIProcess/WebPageProxy.h:
2442         * UIProcess/WebPageProxy.messages.in:
2443         * WebKit2.xcodeproj/project.pbxproj:
2444         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2445         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
2446
2447 2016-12-08  Antti Koivisto  <antti@apple.com>
2448
2449         Salt network cache hashes
2450         https://bugs.webkit.org/show_bug.cgi?id=164924
2451
2452         Reviewed by Alex Christensen.
2453
2454         To enhance privacy make cache content unidentifiable from file names alone.
2455         This is done by generating a unique persistent salt for each cache instance.
2456         It is used when computing hashes used in file names.
2457
2458         The patch also replaces plain text partition directory names with salted hashes.
2459
2460         * NetworkProcess/cache/NetworkCache.cpp:
2461         (WebKit::NetworkCache::Cache::makeCacheKey):
2462         (WebKit::NetworkCache::makeCacheKey): Deleted.
2463         * NetworkProcess/cache/NetworkCache.h:
2464
2465             Increment cache version.
2466
2467         * NetworkProcess/cache/NetworkCacheBlobStorage.cpp:
2468         (WebKit::NetworkCache::BlobStorage::BlobStorage):
2469         (WebKit::NetworkCache::BlobStorage::add):
2470         (WebKit::NetworkCache::BlobStorage::get):
2471
2472             Use salt for blob content hash.
2473
2474         * NetworkProcess/cache/NetworkCacheBlobStorage.h:
2475         * NetworkProcess/cache/NetworkCacheData.cpp:
2476         (WebKit::NetworkCache::computeSHA1):
2477
2478             For simplicity all SHA1s are now salted.
2479
2480         (WebKit::NetworkCache::makeSalt):
2481         (WebKit::NetworkCache::readOrMakeSalt):
2482
2483             Read salt if it exists, generate and persist it otherwise.
2484
2485         * NetworkProcess/cache/NetworkCacheData.h:
2486         * NetworkProcess/cache/NetworkCacheKey.cpp:
2487         (WebKit::NetworkCache::Key::Key):
2488
2489             Remove the "No partition" string and just empty.
2490             That was only needed to have a directory name of some sort.
2491
2492         (WebKit::NetworkCache::Key::computeHash):
2493
2494             Use salt for key hash.
2495
2496         (WebKit::NetworkCache::Key::computePartitionHash):
2497
2498             Separate hash for partition.
2499
2500         * NetworkProcess/cache/NetworkCacheKey.h:
2501         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
2502         (WebKit::NetworkCache::makeSubresourcesKey):
2503         (WebKit::NetworkCache::SpeculativeLoadManager::PendingFrameLoad::saveToDiskIfReady):
2504         (WebKit::NetworkCache::SpeculativeLoadManager::retrieveSubresourcesEntry):
2505         * NetworkProcess/cache/NetworkCacheStorage.cpp:
2506         (WebKit::NetworkCache::makeSaltFilePath):
2507         (WebKit::NetworkCache::Storage::open):
2508
2509             Cache can't be opened if we can't read or persist a salt.
2510
2511         (WebKit::NetworkCache::traverseRecordsFiles):
2512         (WebKit::NetworkCache::Storage::Storage):
2513         (WebKit::NetworkCache::Storage::synchronize):
2514         (WebKit::NetworkCache::Storage::recordDirectoryPathForKey):
2515
2516             Use the partition hash in the directory name instead of a plain text name.
2517
2518         (WebKit::NetworkCache::decodeRecordHeader):
2519         (WebKit::NetworkCache::Storage::readRecord):
2520         (WebKit::NetworkCache::Storage::encodeRecord):
2521         (WebKit::NetworkCache::Storage::traverse):
2522         (WebKit::NetworkCache::Storage::clear):
2523         * NetworkProcess/cache/NetworkCacheStorage.h:
2524         (WebKit::NetworkCache::Storage::salt):
2525
2526 2016-12-08  Eric Carlson  <eric.carlson@apple.com>
2527
2528         Fix the EFL build.
2529
2530         * UIProcess/WebPageProxy.cpp:
2531         (WebKit::WebPageProxy::isPlayingMediaDidChange): Add another ENABLE(MEDIA_STREAM) guard.
2532
2533 2016-12-08  Tomas Popela  <tpopela@redhat.com>
2534
2535         [GTK] Process accelerated compositing env variables only if they are really enabled
2536         https://bugs.webkit.org/show_bug.cgi?id=165300
2537
2538         Don't process the WEBKIT_FORCE_COMPOSITING_MODE and
2539         WEBKIT_DISABLE_COMPOSITING_MODE env variables if they are disabled
2540         (eg. WEBKIT_DISABLE_COMPOSITING_MODE=0).
2541
2542         Reviewed by Michael Catanzaro.
2543
2544         * UIProcess/gtk/WebPreferencesGtk.cpp:
2545         (WebKit::WebPreferences::platformInitializeStore):
2546
2547 2016-12-08  Alex Christensen  <achristensen@webkit.org>
2548
2549         Fix CMake build.
2550
2551         * CMakeLists.txt:
2552         Add the new NetworkProcess/capture include directory to find new headers from r209498.
2553         * NetworkProcess/capture/NetworkCaptureEvent.cpp:
2554         (WebKit::NetworkCapture::Response::Response):
2555         (WebKit::NetworkCapture::Error::Error):
2556         The String constructor was ambiguous after r209498 because URL has an operator NSString* and String has an NSString constructor.
2557         We should get rid of operator NSString* and operator String on URL.
2558         * UIProcess/WebPageProxy.cpp:
2559         * UIProcess/WebPageProxy.h:
2560         Add some ENABLE(MEDIA_STREAM) macros to fix the build without it enabled after r209512.
2561
2562 2016-12-08  Alex Christensen  <achristensen@webkit.org>
2563
2564         Fix iOS debug build after r209498
2565         https://bugs.webkit.org/show_bug.cgi?id=164527
2566
2567         * NetworkProcess/capture/NetworkCaptureLogging.h:
2568         Logs were causing compile warnings/errors.  Disable logs for now.
2569
2570 2016-12-07  Dean Jackson  <dino@apple.com>
2571
2572         Remove runtime toggle for pointer-lock
2573         https://bugs.webkit.org/show_bug.cgi?id=165577
2574         <rdar://problems/29566996>
2575
2576         Reviewed by Jon Lee.
2577
2578         Remove any runtime calls to check if pointer-lock is enabled. It's
2579         either compiled in or out.
2580
2581         * Shared/WebPreferencesDefinitions.h:
2582         * UIProcess/API/C/WKPreferences.cpp:
2583         (WKPreferencesSetPointerLockEnabled): Deleted.
2584         (WKPreferencesGetPointerLockEnabled): Deleted.
2585         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2586         * WebProcess/WebPage/WebPage.cpp:
2587         (WebKit::WebPage::updatePreferences):
2588
2589 2016-12-07  Eric Carlson  <eric.carlson@apple.com>
2590
2591         [MediaStream][Mac] Revoke sandbox extensions when capture ends
2592         https://bugs.webkit.org/show_bug.cgi?id=165476
2593
2594         Reviewed by Brady Eidson.
2595
2596         Track media capture by process so it is possible to revoke the sandbox extensions issued to
2597         a web process when capture stops. Allocate WK2 user media permission manager lazily rather
2598         than every time a page is created as most pages won't need one.
2599
2600         * CMakeLists.txt: Add new files.
2601
2602         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
2603         (WebKit::UserMediaPermissionRequestManagerProxy::UserMediaPermissionRequestManagerProxy): Register
2604           with process manager.
2605         (WebKit::UserMediaPermissionRequestManagerProxy::~UserMediaPermissionRequestManagerProxy):
2606         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasGranted): Move sandbox 
2607           extension code to the process manager.
2608         (WebKit::UserMediaPermissionRequestManagerProxy::stopCapture): New.
2609         (WebKit::UserMediaPermissionRequestManagerProxy::startedCaptureSession): New, report state
2610           change to the process manager.
2611         (WebKit::UserMediaPermissionRequestManagerProxy::endedCaptureSession): Ditto.
2612         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
2613
2614         * UIProcess/UserMediaProcessManager.cpp: Added.
2615         (WebKit::ProcessState::ProcessState):
2616         (WebKit::ProcessState::managers):
2617         (WebKit::ProcessState::sandboxExtensionsGranted):
2618         (WebKit::ProcessState::setSandboxExtensionsGranted):
2619         (WebKit::stateMap):
2620         (WebKit::processState):
2621         (WebKit::ProcessState::addRequestManager):
2622         (WebKit::ProcessState::removeRequestManager):
2623         (WebKit::UserMediaProcessManager::singleton):
2624         (WebKit::UserMediaProcessManager::addUserMediaPermissionRequestManagerProxy):
2625         (WebKit::UserMediaProcessManager::removeUserMediaPermissionRequestManagerProxy):
2626         (WebKit::UserMediaProcessManager::willCreateMediaStream):
2627         (WebKit::UserMediaProcessManager::startedCaptureSession):
2628         (WebKit::UserMediaProcessManager::endedCaptureSession):
2629         * UIProcess/UserMediaProcessManager.h: Added.
2630
2631         * UIProcess/WebPageProxy.cpp:
2632         (WebKit::WebPageProxy::WebPageProxy): Don't allocate m_userMediaPermissionRequestManager.
2633         (WebKit::WebPageProxy::resetState): Set m_userMediaPermissionRequestManager to null.
2634         (WebKit::WebPageProxy::userMediaPermissionRequestManager): Allocate m_userMediaPermissionRequestManager
2635           lazily as most pages don't need it.
2636         (WebKit::WebPageProxy::requestUserMediaPermissionForFrame): Call userMediaPermissionRequestManager().
2637         (WebKit::WebPageProxy::enumerateMediaDevicesForFrame): Ditto.
2638         (WebKit::WebPageProxy::clearUserMediaState): Ditto.
2639         (WebKit::WebPageProxy::isPlayingMediaDidChange): Report capture state changes to the request
2640           manager proxy.
2641         * UIProcess/WebPageProxy.h:
2642
2643         * WebKit2.xcodeproj/project.pbxproj: Add new files.
2644
2645         * WebProcess/MediaStream/MediaDeviceSandboxExtensions.cpp: Added.
2646         (WebKit::MediaDeviceSandboxExtensions::MediaDeviceSandboxExtensions):
2647         (WebKit::MediaDeviceSandboxExtensions::encode):
2648         (WebKit::MediaDeviceSandboxExtensions::decode):
2649         (WebKit::MediaDeviceSandboxExtensions::operator[]):
2650         (WebKit::MediaDeviceSandboxExtensions::size):
2651         * WebProcess/MediaStream/MediaDeviceSandboxExtensions.h: Added.
2652
2653         * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
2654         (WebKit::UserMediaPermissionRequestManager::~UserMediaPermissionRequestManager): Sandbox extension
2655           is now in a HashMap, not a Vector.
2656         (WebKit::UserMediaPermissionRequestManager::grantUserMediaDeviceSandboxExtensions): Record
2657           IDs with extensions so they can be revoked later.
2658         (WebKit::UserMediaPermissionRequestManager::revokeUserMediaDeviceSandboxExtensions): New.
2659         (WebKit::UserMediaPermissionRequestManager::grantUserMediaDevicesSandboxExtension): Deleted.
2660         * WebProcess/MediaStream/UserMediaPermissionRequestManager.h:
2661
2662         * WebProcess/WebPage/WebPage.cpp:
2663         (WebKit::WebPage::grantUserMediaDeviceSandboxExtensions):
2664         (WebKit::WebPage::revokeUserMediaDeviceSandboxExtensions):
2665         (WebKit::WebPage::grantUserMediaDevicesSandboxExtension): Deleted.
2666         * WebProcess/WebPage/WebPage.h:
2667         * WebProcess/WebPage/WebPage.messages.in:
2668
2669 2016-12-07  Jeremy Jones  <jeremyj@apple.com>
2670
2671         One esc to exit fullscreen and pointer lock
2672         https://bugs.webkit.org/show_bug.cgi?id=165416
2673         rdar://problem/29430711
2674
2675         Reviewed by Jer Noble.
2676
2677         Fix a crash when didLosePointerLock is not specified.
2678
2679         * UIProcess/API/C/WKPage.cpp:
2680         (WKPageSetPageUIClient):
2681
2682 2016-12-07  Keith Rollin  <krollin@apple.com>
2683
2684         Network event record/replay
2685         https://bugs.webkit.org/show_bug.cgi?id=164527
2686         <rdar://problem/29168157>
2687
2688         Reviewed by Alex Christensen.
2689
2690         Add WebKit2/NetworkProcess/capture/* for recording the network events
2691         that occur when loading a page and for replaying them later. Update
2692         NetworkLoad to invoke capture facilities. Add preferences for enabling
2693         record or replay.
2694
2695         * CMakeLists.txt:
2696         * NetworkProcess/NetworkLoad.cpp:
2697         (WebKit::NetworkLoad::NetworkLoad):
2698         (WebKit::NetworkLoad::initializeForRecord):
2699         (WebKit::NetworkLoad::initializeForReplay):
2700         (WebKit::NetworkLoad::initialize):
2701         (WebKit::NetworkLoad::setDefersLoading):
2702         (WebKit::NetworkLoad::continueWillSendRequest):
2703         (WebKit::NetworkLoad::sharedWillSendRedirectedRequest):
2704         (WebKit::NetworkLoad::notifyDidReceiveResponse):
2705         (WebKit::NetworkLoad::didReceiveData):
2706         (WebKit::NetworkLoad::didCompleteWithError):
2707         * NetworkProcess/NetworkLoad.h:
2708         * NetworkProcess/NetworkProcess.cpp:
2709         (WebKit::NetworkProcess::initializeNetworkProcess):
2710         (WebKit::NetworkProcess::terminate):
2711         * NetworkProcess/NetworkProcessCreationParameters.cpp:
2712         (WebKit::NetworkProcessCreationParameters::encode):
2713         (WebKit::NetworkProcessCreationParameters::decode):
2714         * NetworkProcess/NetworkProcessCreationParameters.h:
2715         * NetworkProcess/capture/NetworkCaptureEvent.cpp: Added.
2716         (WebKit::NetworkCapture::copyHeaders):
2717         (WebKit::NetworkCapture::KeyValuePair::KeyValuePair):
2718         (WebKit::NetworkCapture::ResourceRequest::ResourceRequest):
2719         (WebKit::NetworkCapture::ResourceRequest::operator WebCore::ResourceRequest):
2720         (WebKit::NetworkCapture::ResourceResponse::ResourceResponse):
2721         (WebKit::NetworkCapture::ResourceResponse::operator WebCore::ResourceResponse):
2722         (WebKit::NetworkCapture::ResourceError::ResourceError):
2723         (WebKit::NetworkCapture::ResourceError::operator WebCore::ResourceError):
2724         (WebKit::NetworkCapture::JSONCoder::encode):
2725         (WebKit::NetworkCapture::JSONCoder::decode):
2726         (WebKit::NetworkCapture::JSONCoder<String>::encode):
2727         (WebKit::NetworkCapture::JSONCoder<String>::decode):
2728         (WebKit::NetworkCapture::JSONCoder<CaptureTimeType>::encode):
2729         (WebKit::NetworkCapture::JSONCoder<CaptureTimeType>::decode):
2730         (WebKit::NetworkCapture::JSONCoder<KeyValuePair>::encode):
2731         (WebKit::NetworkCapture::JSONCoder<KeyValuePair>::decode):
2732         (WebKit::NetworkCapture::JSONCoder<Vector<T>>::encode):
2733         (WebKit::NetworkCapture::JSONCoder<Vector<T>>::decode):
2734         (WebKit::NetworkCapture::JSONCoder<ResourceRequest>::encode):
2735         (WebKit::NetworkCapture::JSONCoder<ResourceRequest>::decode):
2736         (WebKit::NetworkCapture::JSONCoder<ResourceResponse>::encode):
2737         (WebKit::NetworkCapture::JSONCoder<ResourceResponse>::decode):
2738         (WebKit::NetworkCapture::JSONCoder<ResourceError>::encode):
2739         (WebKit::NetworkCapture::JSONCoder<ResourceError>::decode):
2740         (WebKit::NetworkCapture::JSONCoder<WebCore::SharedBuffer>::encode):
2741         (WebKit::NetworkCapture::JSONCoder<WebCore::SharedBuffer>::decode):
2742         (WebKit::NetworkCapture::JSONCoder<RequestSentEvent>::encode):
2743         (WebKit::NetworkCapture::JSONCoder<RequestSentEvent>::decode):
2744         (WebKit::NetworkCapture::JSONCoder<ResponseReceivedEvent>::encode):
2745         (WebKit::NetworkCapture::JSONCoder<ResponseReceivedEvent>::decode):
2746         (WebKit::NetworkCapture::JSONCoder<RedirectReceivedEvent>::encode):
2747         (WebKit::NetworkCapture::JSONCoder<RedirectReceivedEvent>::decode):
2748         (WebKit::NetworkCapture::JSONCoder<RedirectSentEvent>::encode):
2749         (WebKit::NetworkCapture::JSONCoder<RedirectSentEvent>::decode):
2750         (WebKit::NetworkCapture::JSONCoder<DataReceivedEvent>::encode):
2751         (WebKit::NetworkCapture::JSONCoder<DataReceivedEvent>::decode):
2752         (WebKit::NetworkCapture::JSONCoder<FinishedEvent>::encode):
2753         (WebKit::NetworkCapture::JSONCoder<FinishedEvent>::decode):
2754         (WebKit::NetworkCapture::eventToString):
2755         (WebKit::NetworkCapture::stringToEvent):
2756         * NetworkProcess/capture/NetworkCaptureEvent.h: Added.
2757         (WebKit::NetworkCapture::TimedEvent::TimedEvent):
2758         * NetworkProcess/capture/NetworkCaptureLogging.h: Added.
2759         * NetworkProcess/capture/NetworkCaptureManager.cpp: Added.
2760         (WebKit::NetworkCapture::Manager::singleton):
2761         (WebKit::NetworkCapture::Manager::initialize):
2762         (WebKit::NetworkCapture::Manager::terminate):
2763         (WebKit::NetworkCapture::Manager::findMatch):
2764         (WebKit::NetworkCapture::Manager::findExactMatch):
2765         (WebKit::NetworkCapture::Manager::findBestFuzzyMatch):
2766         (WebKit::NetworkCapture::Manager::fuzzyMatchURLs):
2767         (WebKit::NetworkCapture::Manager::loadResources):
2768         (WebKit::NetworkCapture::Manager::reportLoadPath):
2769         (WebKit::NetworkCapture::Manager::reportRecordPath):
2770         (WebKit::NetworkCapture::Manager::reportReplayPath):
2771         (WebKit::NetworkCapture::Manager::requestToPath):
2772         (WebKit::NetworkCapture::Manager::stringToHash):
2773         (WebKit::NetworkCapture::Manager::hashToPath):
2774         (WebKit::NetworkCapture::Manager::logRecordedResource):
2775         (WebKit::NetworkCapture::Manager::logLoadedResource):
2776         (WebKit::NetworkCapture::Manager::logPlayedBackResource):
2777         (WebKit::NetworkCapture::Manager::ensureFileHandle):
2778         (WebKit::NetworkCapture::Manager::openCacheFile):
2779         (WebKit::NetworkCapture::Manager::readFile):
2780         (WebKit::NetworkCapture::Manager::getLine):
2781         (WebKit::NetworkCapture::Manager::getWord):
2782         (WebKit::NetworkCapture::Manager::printToFile):
2783         * NetworkProcess/capture/NetworkCaptureManager.h: Added.
2784         (WebKit::NetworkCapture::Manager::isRecording):
2785         (WebKit::NetworkCapture::Manager::isReplaying):
2786         (WebKit::NetworkCapture::Manager::mode):
2787         * NetworkProcess/capture/NetworkCaptureRecorder.cpp: Added.
2788         (WebKit::NetworkCapture::Recorder::recordRequestSent):
2789         (WebKit::NetworkCapture::Recorder::recordResponseReceived):
2790         (WebKit::NetworkCapture::Recorder::recordRedirectReceived):
2791         (WebKit::NetworkCapture::Recorder::recordRedirectSent):
2792         (WebKit::NetworkCapture::Recorder::recordDataReceived):
2793         (WebKit::NetworkCapture::Recorder::recordFinish):
2794         (WebKit::NetworkCapture::Recorder::writeEvents):
2795         * NetworkProcess/capture/NetworkCaptureRecorder.h: Added.
2796         (WebKit::NetworkCapture::Recorder::recordEvent):
2797         * NetworkProcess/capture/NetworkCaptureReplayer.cpp: Added.
2798         (WebKit::NetworkCapture::Replayer::replayResource):
2799         * NetworkProcess/capture/NetworkCaptureReplayer.h: Added.
2800         * NetworkProcess/capture/NetworkCaptureResource.cpp: Added.
2801         (WebKit::NetworkCapture::Resource::Resource):
2802         (WebKit::NetworkCapture::Resource::url):
2803         (WebKit::NetworkCapture::Resource::baseURL):
2804         (WebKit::NetworkCapture::Resource::queryParameters):
2805         (WebKit::NetworkCapture::Resource::eventStream):
2806         (WebKit::NetworkCapture::Resource::EventStream::EventStream):
2807         (WebKit::NetworkCapture::Resource::EventStream::nextEvent):
2808         * NetworkProcess/capture/NetworkCaptureResource.h: Added.
2809         * NetworkProcess/capture/NetworkCaptureTypes.h: Added.
2810         (WebKit::NetworkCapture::TypeHolder::forEachTypeImpl):
2811         (WebKit::NetworkCapture::TypeHolder::forEachType):
2812         * NetworkProcess/capture/NetworkDataTaskReplay.cpp: Added.
2813         (WebKit::NetworkCapture::NetworkDataTaskReplay::NetworkDataTaskReplay):
2814         (WebKit::NetworkCapture::NetworkDataTaskReplay::~NetworkDataTaskReplay):
2815         (WebKit::NetworkCapture::NetworkDataTaskReplay::resume):
2816         (WebKit::NetworkCapture::NetworkDataTaskReplay::suspend):
2817         (WebKit::NetworkCapture::NetworkDataTaskReplay::cancel):
2818         (WebKit::NetworkCapture::NetworkDataTaskReplay::complete):
2819         (WebKit::NetworkCapture::NetworkDataTaskReplay::invalidateAndCancel):
2820         (WebKit::NetworkCapture::NetworkDataTaskReplay::enqueueEventHandler):
2821         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayRequestSent):
2822         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayResponseReceived):
2823         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayRedirectReceived):
2824         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayRedirectSent):
2825         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayDataReceived):
2826         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayFinished):
2827         (WebKit::NetworkCapture::NetworkDataTaskReplay::didReceiveResponse):
2828         (WebKit::NetworkCapture::NetworkDataTaskReplay::didFinish):
2829         * NetworkProcess/capture/NetworkDataTaskReplay.h: Added.
2830         (WebKit::NetworkCapture::NetworkDataTaskReplay::create):
2831         * NetworkProcess/capture/json.hpp: Added.
2832         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2833         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
2834         * WebKit2.xcodeproj/project.pbxproj:
2835         * config.h:
2836
2837 2016-12-07  Anders Carlsson  <andersca@apple.com>
2838
2839         Fix build.
2840
2841         * Platform/IPC/mac/ConnectionMac.mm:
2842         (IPC::Connection::open):
2843
2844 2016-12-07  Anders Carlsson  <andersca@apple.com>
2845
2846         Rename the connection sources to better indicate what data direction they are used for
2847         https://bugs.webkit.org/show_bug.cgi?id=165548
2848
2849         Reviewed by Tim Horton.
2850
2851         * Platform/IPC/Connection.h:
2852         * Platform/IPC/mac/ConnectionMac.mm:
2853         (IPC::Connection::platformInvalidate):
2854         (IPC::Connection::platformInitialize):
2855         (IPC::createReceiveSource):
2856         (IPC::Connection::initializeSendSource):
2857         (IPC::Connection::receiveSourceEventHandler):
2858         (IPC::createDataAvailableSource): Deleted.
2859         (IPC::Connection::initializeDeadNameSource): Deleted.
2860         Rename m_deadNameSource to m_sendSource, and m_receivePortDataAvailableSource to m_receiveSource.
2861
2862         (IPC::Connection::open):
2863         Initialize the send source before we attempt to send a first message.
2864
2865 2016-12-07  Simon Fraser  <simon.fraser@apple.com>
2866
2867         Fix use of enum in a WK2 C SPI header.
2868         rdar://problem/28725583
2869
2870         Followup to correctly prefix the enum values.
2871
2872         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
2873         (WKBundlePageSetEventThrottlingBehaviorOverride):
2874         * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
2875
2876 2016-12-07  Simon Fraser  <simon.fraser@apple.com>
2877
2878         Fix use of enum in a WK2 C SPI header.
2879         rdar://problem/28725583
2880
2881         Reviewed by Dan Bernstein.
2882
2883         Use correct enum style for a C SPI header and fix the callers.
2884
2885         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
2886         (WKBundlePageSetEventThrottlingBehaviorOverride):
2887         * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
2888
2889 2016-12-07  Beth Dakin  <bdakin@apple.com>
2890
2891         Remove iCloud Pages and Keynote site-specific hacks
2892         https://bugs.webkit.org/show_bug.cgi?id=165544
2893         -and corresponding-
2894         rdar://problem/29082536
2895
2896         Reviewed by Wenson Hsieh.
2897
2898         * WebProcess/WebPage/WebPage.cpp:
2899         (WebKit::needsHiddenContentEditableQuirk):
2900         (WebKit::needsPlainTextQuirk):
2901
2902 2016-12-05  Ada Chan  <adachan@apple.com>
2903
2904         Add a getter for serverTrust in _WKObservablePageState
2905         https://bugs.webkit.org/show_bug.cgi?id=165433
2906
2907         Reviewed by Anders Carlsson.
2908
2909         * UIProcess/API/C/mac/WKPagePrivateMac.h:
2910         * UIProcess/API/C/mac/WKPagePrivateMac.mm:
2911         (-[WKObservablePageState serverTrust]):
2912
2913 2016-12-07  Jer Noble  <jer.noble@apple.com>
2914
2915         Exiting Element Fullscreen mode loses focus on WKWebView.
2916         https://bugs.webkit.org/show_bug.cgi?id=165512
2917
2918         Reviewed by Eric Carlson.
2919
2920         Setting 'window.contentView.hidden = YES' will reset the first-responder (whereas
2921         previously setting 'window.contentView.layer.hidden = YES' did not). Grab the first-
2922         responder before doing so, so that it can be reset correctly when moving the WKWebView
2923         back to it's original window.
2924
2925         * UIProcess/mac/WKFullScreenWindowController.mm:
2926         (-[WKFullScreenWindowController finishedExitFullScreenAnimation:]):
2927
2928 2016-12-07  Alex Christensen  <achristensen@webkit.org>
2929
2930         Fix CMake build after r209418.
2931         https://bugs.webkit.org/show_bug.cgi?id=165484
2932
2933         * PlatformMac.cmake:
2934
2935 2016-12-07  Philippe Normand  <pnormand@igalia.com>
2936
2937         Unreviewed, GTK build fix after r209407.
2938
2939         * Platform/IPC/unix/ConnectionUnix.cpp:
2940         (IPC::Connection::processMessage):
2941         * UIProcess/LegacySessionStateCodingNone.cpp:
2942         (WebKit::decodeLegacySessionState):
2943
2944 2016-12-06  Ryan Haddad  <ryanhaddad@apple.com>
2945
2946         Unreviewed, rolling out r209422.
2947
2948         This change caused assertion failures during API tests.
2949
2950         Reverted changeset:
2951
2952         "[MediaStream][Mac] Revoke sandbox extensions when capture
2953         ends"
2954         https://bugs.webkit.org/show_bug.cgi?id=165476
2955         http://trac.webkit.org/changeset/209422
2956
2957 2016-12-06  Dean Jackson  <dino@apple.com>
2958
2959         Include default value in Experimental Feature information
2960         https://bugs.webkit.org/show_bug.cgi?id=165509
2961         <rdar://problems/29547177>
2962
2963         Reviewed by Tim Horton.
2964
2965         Add a defaultValue member variable to experimental
2966         features, both the C++ and ObjC interfaces.
2967
2968         * UIProcess/API/APIExperimentalFeature.cpp:
2969         (API::ExperimentalFeature::create):
2970         (API::ExperimentalFeature::ExperimentalFeature):
2971         * UIProcess/API/APIExperimentalFeature.h:
2972         * UIProcess/API/Cocoa/_WKExperimentalFeature.h:
2973         * UIProcess/API/Cocoa/_WKExperimentalFeature.mm:
2974         (-[_WKExperimentalFeature description]):
2975         (-[_WKExperimentalFeature defaultValue]):
2976         * UIProcess/WebPreferences.cpp:
2977         (WebKit::createExperimentalFeaturesVector):
2978
2979 2016-12-06  Commit Queue  <commit-queue@webkit.org>
2980
2981         Unreviewed, rolling out r209391.
2982         https://bugs.webkit.org/show_bug.cgi?id=165501
2983
2984         requires explicit nullptr checks so missing env vars don't
2985         flip AC mode (Requested by mcatanzaro on #webkit).
2986
2987         Reverted changeset:
2988
2989         "[GTK] Process accelerated compositing env variables only if
2990         they are really enabled"
2991         https://bugs.webkit.org/show_bug.cgi?id=165300
2992         http://trac.webkit.org/changeset/209391
2993
2994 2016-12-06  Alexey Proskuryakov  <ap@apple.com>
2995
2996         Correct SDKROOT values in xcconfig files
2997         https://bugs.webkit.org/show_bug.cgi?id=165487
2998         rdar://problem/29539209
2999
3000         Reviewed by Dan Bernstein.
3001
3002         Fix suggested by Dan Bernstein.
3003
3004         * Configurations/DebugRelease.xcconfig:
3005
3006 2016-12-06  Andreas Kling  <akling@apple.com>
3007
3008         [Cocoa] Add some memory usage related information to sysdiagnose state dumps
3009         <https://webkit.org/b/165375>
3010         <rdar://problem/29057243>
3011
3012         Reviewed by Darin Adler.
3013
3014         Follow-up to address two more review comments.
3015
3016         * WebProcess/cocoa/WebProcessCocoa.mm:
3017         (WebKit::WebProcess::registerWithStateDumper): Use adoptNS() instead of autorelease for NSStrings.
3018
3019 2016-12-06  Eric Carlson  <eric.carlson@apple.com>
3020
3021         [MediaStream][Mac] Revoke sandbox extensions when capture ends
3022         https://bugs.webkit.org/show_bug.cgi?id=165476
3023
3024         Reviewed by Brady Eidson.
3025         
3026         Track media capture by process so it is possible to revoke the sandbox extensions issued to
3027         a web process when capture stops.
3028
3029         * CMakeLists.txt: Add new files.
3030
3031         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
3032         (WebKit::UserMediaPermissionRequestManagerProxy::UserMediaPermissionRequestManagerProxy): Register
3033           with process manager.
3034         (WebKit::UserMediaPermissionRequestManagerProxy::~UserMediaPermissionRequestManagerProxy):
3035         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasGranted): Move sandbox 
3036           extension code to the process manager.
3037         (WebKit::UserMediaPermissionRequestManagerProxy::stopCapture): New.
3038         (WebKit::UserMediaPermissionRequestManagerProxy::startedCaptureSession): New, report state
3039           change to the process manager.
3040         (WebKit::UserMediaPermissionRequestManagerProxy::endedCaptureSession): Ditto.
3041         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
3042
3043         * UIProcess/UserMediaProcessManager.cpp: Added.
3044         (WebKit::ProcessState::ProcessState):
3045         (WebKit::ProcessState::managers):
3046         (WebKit::ProcessState::sandboxExtensionsGranted):
3047         (WebKit::ProcessState::setSandboxExtensionsGranted):
3048         (WebKit::stateMap):
3049         (WebKit::processState):
3050         (WebKit::ProcessState::addRequestManager):
3051         (WebKit::ProcessState::removeRequestManager):
3052         (WebKit::UserMediaProcessManager::singleton):
3053         (WebKit::UserMediaProcessManager::addUserMediaPermissionRequestManagerProxy):
3054         (WebKit::UserMediaProcessManager::removeUserMediaPermissionRequestManagerProxy):
3055         (WebKit::UserMediaProcessManager::willCreateMediaStream):
3056         (WebKit::UserMediaProcessManager::startedCaptureSession):
3057         (WebKit::UserMediaProcessManager::endedCaptureSession):
3058         * UIProcess/UserMediaProcessManager.h: Added.
3059
3060         * UIProcess/WebPageProxy.cpp:
3061         (WebKit::WebPageProxy::isPlayingMediaDidChange): Report capture state changes to the request
3062           manager proxy.
3063         * UIProcess/WebPageProxy.h:
3064
3065         * WebKit2.xcodeproj/project.pbxproj: Add new files.
3066
3067         * WebProcess/MediaStream/MediaDeviceSandboxExtensions.cpp: Added.
3068         (WebKit::MediaDeviceSandboxExtensions::MediaDeviceSandboxExtensions):
3069         (WebKit::MediaDeviceSandboxExtensions::encode):
3070         (WebKit::MediaDeviceSandboxExtensions::decode):
3071         (WebKit::MediaDeviceSandboxExtensions::operator[]):
3072         (WebKit::MediaDeviceSandboxExtensions::size):
3073         * WebProcess/MediaStream/MediaDeviceSandboxExtensions.h: Added.
3074
3075         * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
3076         (WebKit::UserMediaPermissionRequestManager::~UserMediaPermissionRequestManager): Sandbox extension
3077           is now in a HashMap, not a Vector.
3078         (WebKit::UserMediaPermissionRequestManager::grantUserMediaDeviceSandboxExtensions): Record
3079           IDs with extensions so they can be revoked later.
3080         (WebKit::UserMediaPermissionRequestManager::revokeUserMediaDeviceSandboxExtensions): New.
3081         (WebKit::UserMediaPermissionRequestManager::grantUserMediaDevicesSandboxExtension): Deleted.
3082         * WebProcess/MediaStream/UserMediaPermissionRequestManager.h:
3083
3084         * WebProcess/WebPage/WebPage.cpp:
3085         (WebKit::WebPage::grantUserMediaDeviceSandboxExtensions):
3086         (WebKit::WebPage::revokeUserMediaDeviceSandboxExtensions):
3087         (WebKit::WebPage::grantUserMediaDevicesSandboxExtension): Deleted.
3088         * WebProcess/WebPage/WebPage.h:
3089         * WebProcess/WebPage/WebPage.messages.in:
3090
3091 2016-12-06  Anders Carlsson  <andersca@apple.com>
3092
3093         Add a new MachMessage class and use it for sending outgoing messages
3094         https://bugs.webkit.org/show_bug.cgi?id=165484
3095
3096         Reviewed by Sam Weinig.
3097
3098         * Platform/IPC/mac/ConnectionMac.mm:
3099         (IPC::Connection::sendOutgoingMessage):
3100         Instead of trying to randomly use memory from the stack as well as using mmap for the message data for out of line messages
3101         (which makes no sense at all, since the body data is already mmapped), just always create a MachMessage object and use it.
3102         
3103         (IPC::machMessageSize): Deleted.
3104         This has been moved to MachMessage::messageSize().
3105         
3106         * Platform/IPC/mac/MachMessage.cpp: Added.
3107         (IPC::MachMessage::create):
3108         Allocate extra memory to store the actual buffer.
3109
3110         (IPC::MachMessage::MachMessage):
3111         Initialize variables. m_size isn't really used right now, but will be in a subsequent patch.
3112
3113         (IPC::MachMessage::header):
3114         Return the header.
3115         
3116         * Platform/IPC/mac/MachMessage.h: Added.
3117         (IPC::MachMessage::length):
3118
3119         * WebKit2.xcodeproj/project.pbxproj:
3120         Add new files.
3121
3122 2016-12-06  Simon Fraser  <simon.fraser@apple.com>
3123
3124         Enable visual viewports by default on Mac, and iOS Wk2
3125         https://bugs.webkit.org/show_bug.cgi?id=165452
3126
3127         Reviewed by Zalan Bujtas.
3128
3129         Turn visual viewports on by default for WK2.
3130
3131         * Shared/WebPreferencesDefinitions.h:
3132
3133 2016-12-06  Daniel Bates  <dabates@apple.com>
3134
3135         WebKitTestRunner: Plugins are disabled in new windows
3136         https://bugs.webkit.org/show_bug.cgi?id=165410
3137
3138         Reviewed by Alex Christensen.
3139
3140         Remove SPI exposed to explicitly toggle plugins from WebKitTestRunner.
3141         Instead we will update WebKitTestRunner to make use of the SPI
3142         WKBundleOverrideBoolPreferenceForTestRunner() to toggle plugins in
3143         all windows.
3144
3145         * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
3146         (WKBundleSetPluginsEnabled): Deleted.
3147         * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h:
3148         * WebProcess/InjectedBundle/InjectedBundle.cpp:
3149         (WebKit::InjectedBundle::setPluginsEnabled): Deleted.
3150
3151 2016-12-05  Anders Carlsson  <andersca@apple.com>
3152
3153         Don't memcpy out of line data
3154         https://bugs.webkit.org/show_bug.cgi?id=165434
3155
3156         Reviewed by Sam Weinig.
3157
3158         Change the Decoder constructor to take a buffer deallocator parameter. If the buffer deallocator is null, the
3159         data will be copied as before. Otherwise, the memory will be adopted by the Decoder object, and will be deallocated
3160         by invoking the data deallocator.
3161
3162         * Platform/IPC/Decoder.cpp:
3163         (IPC::copyBuffer):
3164         Add a new helper.
3165
3166         (IPC::Decoder::Decoder):
3167         Copy the buffer if the deallocator is null.
3168
3169         (IPC::Decoder::~Decoder):
3170         Invoke the deallocator or call fastFree if it is null.
3171
3172         (IPC::Decoder::unwrapForTesting):
3173         Update constructor.
3174         
3175         (IPC::roundUpToAlignment):
3176         (IPC::Decoder::alignBufferPosition):
3177         (IPC::Decoder::decodeVariableLengthByteArray):
3178         (IPC::decodeValueFromBuffer):
3179         Change all these to deal with const pointers.
3180
3181         * Platform/IPC/Decoder.h:
3182         Add new members.
3183
3184         * Platform/IPC/mac/ConnectionMac.mm:
3185         (IPC::createMessageDecoder):
3186         When we have out of line data, pass a deallocator that calls vm_deallocate, instead of copying the data
3187         and then immediately throwing the original away.
3188
3189 2016-12-06  Tim Horton  <timothy_horton@apple.com>
3190
3191         Almost half-second stall scrolling apple.com because of synchronous getPositionInformation
3192         https://bugs.webkit.org/show_bug.cgi?id=165403
3193         <rdar://problem/29493285>
3194
3195         Reviewed by Enrica Casucci.
3196
3197         When retrieving interaction information, we don't always need to do
3198         snapshots for 3D Touch or the action sheet, especially if we're
3199         synchronously blocking the UI process main thread waiting for the reply.
3200
3201         Add a new InteractionInformationRequest, which allows callers of
3202         getPositionInformation and requestPositionInformation to specify which
3203         optional pieces of information they would like to compute.
3204
3205         * Shared/AssistedNodeInformation.h:
3206         Fix a incorrect comment.
3207
3208         * Shared/ios/InteractionInformationRequest.cpp: Added.
3209         (WebKit::InteractionInformationRequest::encode):
3210         (WebKit::InteractionInformationRequest::decode):
3211         (WebKit::InteractionInformationRequest::isValidForRequest):
3212         * Shared/ios/InteractionInformationRequest.h: Added.
3213         (WebKit::InteractionInformationRequest::InteractionInformationRequest):
3214         * WebKit2.xcodeproj/project.pbxproj:
3215         Add InteractionInformationRequest, which encapsulates all of the
3216         parameters required to generate an InteractionInformationAtPosition.
3217         Previously, that was just a point, but now we have two new parameters:
3218         whether we should generate a snapshot of the element, and whether
3219         we should generate a TextIndicator if the element is a link.
3220
3221         * Shared/ios/InteractionInformationAtPosition.h:
3222         * Shared/ios/InteractionInformationAtPosition.mm:
3223         (WebKit::InteractionInformationAtPosition::encode):
3224         (WebKit::InteractionInformationAtPosition::decode):
3225         (WebKit::InteractionInformationAtPosition::mergeCompatibleOptionalInformation):
3226         Adopt InteractionInformationRequest.
3227
3228         * UIProcess/WebPageProxy.h:
3229         * UIProcess/ios/WebPageProxyIOS.mm:
3230         (WebKit::WebPageProxy::getPositionInformation):
3231         (WebKit::WebPageProxy::requestPositionInformation):
3232         * UIProcess/ios/WKActionSheetAssistant.mm:
3233         (-[WKActionSheetAssistant initialPresentationRectInHostViewForSheet]):
3234         (-[WKActionSheetAssistant presentationRectInHostViewForSheet]):
3235         (-[WKActionSheetAssistant showImageSheet]):
3236         (-[WKActionSheetAssistant showLinkSheet]):
3237         * UIProcess/ios/WKPDFView.mm:
3238         (-[WKPDFView annotation:isBeingPressedAtPoint:controller:]):
3239         * WebProcess/WebPage/WebPage.h:
3240         * WebProcess/WebPage/WebPage.messages.in:
3241         Adopt InteractionInformationRequest.
3242         
3243         * UIProcess/ios/WKContentViewInteraction.h:
3244         * UIProcess/ios/WKContentViewInteraction.mm:
3245         (-[WKContentView _showAttachmentSheet]):
3246         (-[WKContentView ensurePositionInformationIsUpToDate:]):
3247         If we have a outstanding asynchronous position information request
3248         for the current point, instead of sending a second separate request,
3249         just wait for the async one to come in.
3250
3251         (-[WKContentView requestAsynchronousPositionInformationUpdate:]):
3252         If asked to do an asynchronous request with more optional bits than
3253         the current otherwise-valid response's request, update the position information.
3254
3255         (-[WKContentView gestureRecognizerShouldBegin:]):
3256         The design of this mechanism is that during the highlight long press,
3257         we do an async position information update, and then when we actually
3258         begin a 3D Touch gesture, we hope to already have the requisite snapshots
3259         ready (so that we can avoid synchronously blocking for them, there).
3260         So, in the highlight long-press async request, ask for all the goodies.
3261
3262         (-[WKContentView hasSelectablePositionAtPoint:]):
3263         (-[WKContentView pointIsNearMarkedText:]):
3264         (-[WKContentView pointIsInAssistedNode:]):
3265         (-[WKContentView _didNotHandleTapAsClick:]):
3266         (-[WKContentView _positionInformationDidChange:]):
3267         If we get a position information update for the same point, but with less
3268         goodies attached (the snapshot/link indicator), copy them over from the old
3269         position information, so that we never accidentally "downgrade" our info.
3270
3271         (-[WKContentView updatePositionInformationForActionSheetAssistant:]):
3272         (-[WKContentView actionSheetAssistant:willStartInteractionWithElement:]):
3273         (-[WKContentView _interactionShouldBeginFromPreviewItemController:forPosition:]):
3274         (-[WKContentView _dataForPreviewItemController:atPosition:type:]):
3275         (-[WKContentView _presentedViewControllerForPreviewItemController:]):        
3276         More adoption.
3277         
3278         * WebProcess/WebPage/ios/WebPageIOS.mm:
3279         (WebKit::WebPage::handleTap):
3280         (WebKit::WebPage::handleTwoFingerTapAtPoint):
3281         (WebKit::WebPage::commitPotentialTap):
3282         Adopt InteractionInformationRequest.
3283
3284         (WebKit::WebPage::getPositionInformation):
3285         (WebKit::WebPage::requestPositionInformation):
3286         Copy the request into the response.
3287         Only snapshot if the request wants a snapshot.
3288         Only make a link indicator if the request wants one.
3289
3290 2016-12-06  Daniel Bates  <dabates@apple.com>
3291
3292         Cleanup: Rename some HTTP 0.9-specific functions to conform to WebKit Code Style Guidelines
3293         https://bugs.webkit.org/show_bug.cgi?id=165451
3294
3295         Reviewed by Alex Christensen.
3296
3297         * NetworkProcess/NetworkDataTask.cpp:
3298         (WebKit::NetworkDataTask::didReceiveResponse):
3299
3300 2016-12-06  Daniel Bates  <dabates@apple.com>
3301
3302         Remove unused InjectedBundle::overrideXSSAuditorEnabledForTestRunner()
3303         https://bugs.webkit.org/show_bug.cgi?id=165408
3304
3305         Reviewed by Alex Christensen.
3306
3307         InjectedBundle::overrideXSSAuditorEnabledForTestRunner() is unused. This function was only
3308         called by WKBundleOverrideXSSAuditorEnabledForTestRunner(), which was removed in r106005.
3309
3310         * WebProcess/InjectedBundle/InjectedBundle.cpp:
3311         (WebKit::InjectedBundle::overrideXSSAuditorEnabledForTestRunner): Deleted.
3312         * WebProcess/InjectedBundle/InjectedBundle.h:
3313
3314 2016-12-04  Darin Adler  <darin@apple.com>
3315
3316         Use ASCIICType more, and improve it a little bit
3317         https://bugs.webkit.org/show_bug.cgi?id=165360
3318
3319         Reviewed by Sam Weinig.
3320
3321         * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
3322         (WebKit::capitalizeRFC822HeaderFieldName): Removed unneeded checks to simplify code.
3323
3324 2016-12-06  Dave Hyatt  <hyatt@apple.com>
3325
3326         [CSS Parser] Turn on the new CSS parser
3327         https://bugs.webkit.org/show_bug.cgi?id=165213
3328
3329         Reviewed by Zalan Bujtas.
3330
3331         * Shared/WebPreferencesDefinitions.h:
3332
3333 2016-12-06  Tomas Popela  <tpopela@redhat.com>
3334
3335         [GTK] Process accelerated compositing env variables only if they are really enabled
3336         https://bugs.webkit.org/show_bug.cgi?id=165300
3337
3338         Don't process the WEBKIT_FORCE_COMPOSITING_MODE and
3339         WEBKIT_DISABLE_COMPOSITING_MODE env variables if they are disabled
3340         (eg. WEBKIT_DISABLE_COMPOSITING_MODE=0).
3341
3342         Reviewed by Michael Catanzaro.
3343
3344         * UIProcess/gtk/WebPreferencesGtk.cpp:
3345         (WebKit::WebPreferences::platformInitializeStore):
3346
3347 2016-12-06  Sam Weinig  <sam@webkit.org>
3348
3349         [WebIDL] Add support for converting dictionaries to JS
3350         https://bugs.webkit.org/show_bug.cgi?id=165367
3351
3352         Reviewed by Darin Adler and Alex Christensen.
3353
3354         * CMakeLists.txt:
3355         Add missing directories to look in for headers.
3356
3357 2016-12-05  Tim Horton  <timothy_horton@apple.com>
3358
3359         Try to fix the iOS Simulator build.
3360
3361         * UIProcess/mac/RemoteLayerTreeHost.mm:
3362         (WebKit::RemoteLayerTreeHost::mapAllIOSurfaceBackingStore):
3363
3364 2016-12-03  Simon Fraser  <simon.fraser@apple.com>
3365
3366         Minor reformat and renames in -didUpdateVisibleRect:
3367         https://bugs.webkit.org/show_bug.cgi?id=165365
3368
3369         Reviewed by Dave Hyatt.
3370         
3371         didUpdateVisibleRect:... has lots of parameters. Put one on each line.
3372
3373         Rename the rects to make it clear they are "content" rects (i.e. in document coordinates).
3374
3375         * UIProcess/ios/WKContentView.h:
3376         * UIProcess/ios/WKContentView.mm:
3377         (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInset:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]):
3378
3379 2016-12-05  Tim Horton  <timothy_horton@apple.com>
3380
3381         Adopt CAMachPort-as-layer-contents
3382         https://bugs.webkit.org/show_bug.cgi?id=141687
3383         <rdar://problem/19393233>
3384
3385         Reviewed by Darin Adler.
3386
3387         * Shared/mac/RemoteLayerBackingStore.h:
3388         * Shared/mac/RemoteLayerBackingStore.mm:
3389         (WebKit::RemoteLayerBackingStore::decode):
3390         On the UI process side, instead of actually looking up the surface,
3391         just keep the MachSendRight around, to later be turned into a CAMachPort.
3392
3393         (WebKit::RemoteLayerBackingStore::applyBackingStoreToLayer):
3394         Make a CAMachPort and leak our send right into it. CAMachPort
3395         will adopt the port and destroy it when needed.
3396
3397         (WebKit::RemoteLayerBackingStore::setBufferVolatility):
3398         Tiny style fix.
3399
3400         * Shared/mac/RemoteLayerTreePropertyApplier.h:
3401         * Shared/mac/RemoteLayerTreePropertyApplier.mm:
3402         (WebKit::applyPropertiesToLayer):
3403         (WebKit::RemoteLayerTreePropertyApplier::applyProperties):
3404         * UIProcess/DrawingAreaProxy.h:
3405         (WebKit::DrawingAreaProxy::prepareForAppSuspension):
3406         * UIProcess/ios/WebPageProxyIOS.mm:
3407         (WebKit::WebPageProxy::applicationDidFinishSnapshottingAfterEnteringBackground):
3408         * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h:
3409         * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
3410         (WebKit::RemoteLayerTreeDrawingAreaProxy::prepareForAppSuspension):
3411         * UIProcess/mac/RemoteLayerTreeHost.h:
3412         * UIProcess/mac/RemoteLayerTreeHost.mm:
3413         (WebKit::RemoteLayerTreeHost::updateLayerTree):
3414         (WebKit::RemoteLayerTreeHost::mapAllIOSurfaceBackingStore):
3415         * WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
3416         (WebKit::PlatformCALayerRemote::recursiveBuildTransaction):
3417         Two supporting changes in order to fix the two regressions that this
3418         caused when we tried to land it two years ago:
3419
3420         When an app is being suspended, resolve all CAMachPort backing store
3421         into actual IOSurfaces. Otherwise, any live CAMachPorts will keep a
3422         +1 on their respective IOSurface's use count, causing us to fail to
3423         mark them volatile, keeping the app alive for more time (re-trying the
3424         volatility change), and increasing the likelihood of background jetsam.
3425
3426         If the debugging tile map is enabled, do not use CAMachPort, because
3427         we don't have a great way to plumb the same CAMachPort to two layers
3428         (and it doesn't seem to work even if you do). Instead, just map the
3429         IOSurface into the UI process like we used to.
3430
3431 2016-12-05  Dean Jackson  <dino@apple.com>
3432
3433         pointer lock needs to be feature detectable
3434         https://bugs.webkit.org/show_bug.cgi?id=165426
3435         <rdar://problem/29486715>
3436
3437         Reviewed by Antoine Quint.
3438
3439         Set the RuntimeEnabledFeature as preferences
3440         change.
3441
3442         * UIProcess/API/C/WKPreferences.cpp:
3443         (WKPreferencesSetPointerLockEnabled):
3444         (WKPreferencesGetPointerLockEnabled):
3445         * UIProcess/API/C/WKPreferencesRefPrivate.h:
3446         * WebProcess/WebPage/WebPage.cpp:
3447         (WebKit::WebPage::updatePreferences):
3448
3449 2016-12-05  Andreas Kling  <akling@apple.com>
3450
3451         [Cocoa] Add some memory usage related information to sysdiagnose state dumps
3452         <https://webkit.org/b/165375>
3453         <rdar://problem/29057243>
3454
3455         Reviewed by Darin Adler.
3456
3457         Add two new entries to the sysdiagnose state dumps for WebContent processes:
3458         "Memory Usage Stats" and "JavaScript Object Counts".
3459
3460         The first category contains all the interesting stuff from task_info()
3461