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