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