Fix CMake build.
[WebKit-https.git] / Source / WebKit2 / ChangeLog
1 2016-12-13  Alex Christensen  <achristensen@webkit.org>
2
3         Fix CMake build.
4
5         * PlatformMac.cmake:
6
7 2016-12-13  Jer Noble  <jer.noble@apple.com>
8
9         Fullscreen in WebKit2 does not restore topContentInset upon exiting; leaves top of page not visible
10         https://bugs.webkit.org/show_bug.cgi?id=165697
11
12         Delegate the values of topContentInset() from WebViewImpl (used by WKWebView and WKView) to the
13         WebPageProxy, so that setting the topContentInset() on WebPageProxy is reflected in the getters
14         for the two view classes.
15
16         Reviewed by Tim Horton.
17
18         * UIProcess/Cocoa/WebViewImpl.h:
19         (WebKit::WebViewImpl::topContentInset): Deleted.
20         * UIProcess/Cocoa/WebViewImpl.mm:
21         (WebKit::WebViewImpl::updateContentInsetsIfAutomatic):
22         (WebKit::WebViewImpl::topContentInset):
23         (WebKit::WebViewImpl::setTopContentInset):
24         (WebKit::WebViewImpl::dispatchSetTopContentInset):
25         * UIProcess/mac/WKFullScreenWindowController.mm:
26         (-[WKFullScreenWindowController enterFullScreen:]):
27         (-[WKFullScreenWindowController finishedEnterFullScreenAnimation:]):
28         (-[WKFullScreenWindowController finishedExitFullScreenAnimation:]):
29         (-[WKFullScreenWindowController _saveTopContentInset]): Deleted.
30         (-[WKFullScreenWindowController _restoreTopContentInset]): Deleted.
31
32 2016-12-13  Brent Fulgham  <bfulgham@apple.com>
33
34         [Mac][WK2] Tighten Keychain directory access
35         https://bugs.webkit.org/show_bug.cgi?id=165818
36         <rdar://problem/16863857>
37
38         Reviewed by Anders Carlsson.
39
40         Lock down Keychain directory access to just the file-read-data, file-read-metadata, and
41         file-write-data operations we actually need.
42
43         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
44         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
45         * WebProcess/com.apple.WebProcess.sb.in:
46
47 2016-12-13  Andy Estes  <aestes@apple.com>
48
49         [Cocoa] Implement -shouldInsertText: on WKWebProcessPlugInEditingDelegate
50         https://bugs.webkit.org/show_bug.cgi?id=165785
51         <rdar://problem/26929398>
52
53         Reviewed by Darin Adler.
54
55         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInEditingDelegate.h: Defined
56         WKEditorInsertAction and declared
57         -_webProcessPlugInBrowserContextController:shouldInsertText:replacingRange:givenAction:.
58         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
59         (toWK): Added. Mapped a WebCore::EditorInsertAction to a WKEditorInsertAction.
60         (-[WKWebProcessPlugInBrowserContextController _setEditingDelegate:]): Implemented
61         EditorClient::shouldInsertText() by calling
62         -_webProcessPlugInBrowserContextController:shouldInsertText:replacingRange:givenAction: with
63         the text, wrapped range handle, and action. Added shouldInsertText to DelegateMethods and
64         initialized it according to whether the delegate responds to shouldInsertText:.
65
66 2016-12-13  Joseph Pecoraro  <pecoraro@apple.com>
67
68         NSArray leaks seen in Safari, allocated under WKIconDatabaseTryCopyCGImageArrayForURL
69         https://bugs.webkit.org/show_bug.cgi?id=165809
70
71         Reviewed by Dan Bernstein.
72
73         * UIProcess/API/C/cg/WKIconDatabaseCG.cpp:
74         (WKIconDatabaseTryCopyCGImageArrayForURL):
75         Avoid an extra retain on already newly created array.
76
77 2016-12-13  Eric Carlson  <eric.carlson@apple.com>
78
79         Annotate MediaStream and WebRTC idl with EnabledAtRuntime flag
80         https://bugs.webkit.org/show_bug.cgi?id=165251
81
82         Reviewed by Youenn Fablet.
83
84         * WebProcess/WebPage/WebPage.cpp:
85         (WebKit::WebPage::updatePreferences): Update the media stream and peer connection runtime
86         feature instead of the setting.
87
88 2016-12-13  Sergio Villar Senin  <svillar@igalia.com>
89
90         Fix GTK build after r209733
91         https://bugs.webkit.org/show_bug.cgi?id=165794
92
93         Document::visibilityState() now returns an IDL string enumeration.
94
95         Reviewed by Žan Doberšek.
96
97         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocument.cpp:
98         (webkit_dom_document_get_visibility_state):
99
100 2016-12-12  Dean Jackson  <dino@apple.com>
101
102         [iOS] MediaDocument "Done" button should navigate the page back
103         https://bugs.webkit.org/show_bug.cgi?id=165779
104
105         Reviewed by Sam Weinig.
106
107         * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h:
108         * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm:
109         (WebKit::WebVideoFullscreenModelContext::requestFullscreenMode):
110         (WebKit::WebVideoFullscreenManagerProxy::requestFullscreenMode):
111         * WebProcess/cocoa/WebVideoFullscreenManager.h:
112         * WebProcess/cocoa/WebVideoFullscreenManager.messages.in:
113         * WebProcess/cocoa/WebVideoFullscreenManager.mm:
114         (WebKit::WebVideoFullscreenManager::requestFullscreenMode):
115
116 2016-12-12  Tim Horton  <timothy_horton@apple.com>
117
118         Provide SPI to avoid blocking on painting when coming into view
119         https://bugs.webkit.org/show_bug.cgi?id=165780
120         <rdar://problem/29009559>
121
122         Reviewed by Simon Fraser.
123
124         By default, when parenting a WKWebView which was previously in-window,
125         we block on painting to ensure that we don't flash stale content.
126         We added SPI to disable this behavior to WKWebViewConfiguration, but
127         some clients might want the behavior most of the time, but sometimes
128         instead want to not block the UI process main thread, but instead do
129         their own work (e.g. removing a snapshot) when painting eventually occurs.
130
131         * UIProcess/API/Cocoa/WKWebView.mm:
132         (-[WKWebView _doAfterNextPresentationUpdateWithoutWaitingForPainting:]):
133         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
134         Tell WebPageProxy not to block on painting next time we are parented,
135         and use doAfterNextPresentationUpdate to call the block when the painting
136         does eventually happen. This SPI must be called before - but in the same
137         runloop cycle - the WKWebView is brought back in-window to work correctly.
138         
139         * UIProcess/WebPageProxy.cpp:
140         (WebKit::WebPageProxy::dispatchActivityStateChange):
141         * UIProcess/WebPageProxy.h:
142         (WebKit::WebPageProxy::skipWaitingForPaintAfterNextViewDidMoveToWindow):
143         If we would block because we're coming in-window, but the bit to skip
144         blocking the next time we get brought in-window is set, reset the bit, 
145         and avoid blocking.
146
147 2016-12-12  Chris Dumez  <cdumez@apple.com>
148
149         Document.visibilityState should use an IDL string enumeration
150         https://bugs.webkit.org/show_bug.cgi?id=165774
151
152         Reviewed by Daniel Bates.
153
154         * Shared/API/c/WKSharedAPICast.h:
155         (WebKit::toPageVisibilityState):
156
157 2016-12-11  Konstantin Tokarev  <annulen@yandex.ru>
158
159         Unreviewed attempt to fix EFL and Mac/cmake builds after r209665.
160         https://bugs.webkit.org/show_bug.cgi?id=165686
161
162         * PlatformEfl.cmake: WebKit2 should precede other target so that right
163         config.h comes first in include path.
164
165 2016-12-11  Tim Horton  <timothy_horton@apple.com>
166
167         Quarter-second stalls scrolling images that are links because of sync getPositionInformation
168         https://bugs.webkit.org/show_bug.cgi?id=165707
169
170         Reviewed by Simon Fraser.
171
172         * UIProcess/ios/WKContentViewInteraction.mm:
173         (-[WKContentView positionInformationForActionSheetAssistant:]):
174         (-[WKContentView updatePositionInformationForActionSheetAssistant:]):
175         For now, synchronously block when presenting the action sheet if we
176         don't have a snapshot ready.
177
178         * WebProcess/WebPage/ios/WebPageIOS.mm:
179         (WebKit::WebPage::getPositionInformation):
180         Respect includeSnapshot in another place in getPositionInformation,
181         so that many getPositionInformations don't have to do extra snapshotting work.
182
183 2016-12-10  Filip Pizlo  <fpizlo@apple.com>
184
185         The DOM should have an advancing wavefront opaque root barrier
186         https://bugs.webkit.org/show_bug.cgi?id=165712
187
188         Reviewed by Yusuke Suzuki.
189         
190         Propagate the JSDOMWindowBase::commonVM() -> commonVM() change.
191
192         * Shared/linux/WebMemorySamplerLinux.cpp:
193         (WebKit::WebMemorySampler::sampleWebKit):
194         * Shared/mac/WebMemorySampler.mac.mm:
195         (WebKit::WebMemorySampler::sampleWebKit):
196         * WebProcess/InjectedBundle/InjectedBundle.cpp:
197         (WebKit::InjectedBundle::javaScriptObjectsCount):
198         * WebProcess/Plugins/Netscape/JSNPObject.cpp:
199         (WebKit::JSNPObject::callMethod):
200         (WebKit::JSNPObject::callObject):
201         (WebKit::JSNPObject::callConstructor):
202         (WebKit::JSNPObject::put):
203         (WebKit::JSNPObject::deleteProperty):
204         (WebKit::JSNPObject::getOwnPropertyNames):
205         (WebKit::JSNPObject::propertyGetter):
206         * WebProcess/WebPage/WebPage.cpp:
207         (WebKit::WebPage::runJavaScriptInMainFrame):
208         (WebKit::WebPage::getBytecodeProfile):
209         (WebKit::WebPage::getSamplingProfilerOutput):
210         * WebProcess/WebProcess.cpp:
211         (WebKit::WebProcess::getWebCoreStatistics):
212
213 2016-12-11  Konstantin Tokarev  <annulen@yandex.ru>
214
215         Unreviewed build fix for EFL after r209665
216
217         * UIProcess/efl/TextCheckerClientEfl.h:
218
219 2016-12-10  Konstantin Tokarev  <annulen@yandex.ru>
220
221         [cmake] Include WTF, JSC, and WebCore headers automatically to targers using them
222         https://bugs.webkit.org/show_bug.cgi?id=165686
223
224         Reviewed by Michael Catanzaro.
225
226         This change reduces duplication of include path lists between modules,
227         and reduces future need for fixes like r209605 (broken build because of
228         WebCore header suddenly becoming used in WebKit2).
229
230         * CMakeLists.txt:
231         * PlatformEfl.cmake:
232         * PlatformGTK.cmake:
233         * PlatformMac.cmake:
234
235 2016-12-10  Antti Koivisto  <antti@apple.com>
236
237         CrashTracer: com.apple.WebKit.Networking at WTF::ThreadSafeRefCounted<WebKit::NetworkCache::IOChannel>::deref
238         https://bugs.webkit.org/show_bug.cgi?id=165659
239         <rdar://problem/27077977>
240
241         Reviewed by Darin Adler.
242
243         * NetworkProcess/cache/NetworkCacheIOChannel.h:
244         * NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm:
245         (WebKit::NetworkCache::IOChannel::~IOChannel):
246
247             Add non-inlined destructor and release assert against double deletion to narrow down this crash.
248
249 2016-12-09  Brent Fulgham  <bfulgham@apple.com>
250
251         WebCore::Timer is not compatible with UIProcess
252         https://bugs.webkit.org/show_bug.cgi?id=165706
253         <rdar://problem/29360564>
254
255         Reviewed by Andy Estes.
256
257         Anders has explained to me (at least twice) that WebCore::Timer must not
258         be used in UIProcess code. A recent bug fix introduced a WebCore::Timer,
259         which led to another crash.
260         
261         This patch switches from WebCore::Timer to WTF::RunLoop::Timer to avoid
262         the problem.
263
264         * UIProcess/Cocoa/NavigationState.h:
265         * UIProcess/Cocoa/NavigationState.mm:
266         (WebKit::NavigationState::NavigationState):
267
268 2016-12-09  Eric Carlson  <eric.carlson@apple.com>
269
270         Annotate MediaStream and WebRTC idl with EnabledAtRuntime flag
271         https://bugs.webkit.org/show_bug.cgi?id=165251
272
273         Reviewed by Dean Jackson.
274
275         Based on a patch by Dr Alex Gouaillard <agouaillard@gmail.com>
276
277         * Shared/WebPreferencesDefinitions.h: Add peerConnectionEnabled.
278
279         * UIProcess/API/C/WKPreferences.cpp:
280         (WKPreferencesSetPeerConnectionEnabled): Added.
281         (WKPreferencesGetPeerConnectionEnabled): Added.
282         * UIProcess/API/C/WKPreferencesRef.h:
283
284         * WebProcess/InjectedBundle/InjectedBundle.cpp:
285         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner): Add WebKitMediaStreamEnabled
286           and WebKitPeerConnectionEnabled.
287
288         * WebProcess/WebPage/WebPage.cpp:
289         (WebKit::WebPage::updatePreferences): Initialize the peerConnection preference.
290
291 2016-12-09  Brady Eidson  <beidson@apple.com>
292
293         Re-landing:
294         Add _WKIconLoadingDelegate SPI.
295         https://bugs.webkit.org/show_bug.cgi?id=164894
296
297         Reviewed by Alex Christensen.
298
299         With this client, WebCore will ask the FrameLoaderClient about each icon found in the <head>.
300
301         WebKit2 will then ask the embedding app - for each icon - if it wants that icon to load.
302
303         For icons the app decides to load, WebKit will pass the data to the app without storing locally.
304
305         * UIProcess/API/APIIconLoadingClient.h: Copied from Source/WebCore/html/LinkIconCollector.h.
306         (API::IconLoadingClient::~IconLoadingClient):
307         (API::IconLoadingClient::getLoadDecisionForIcon):
308
309         * UIProcess/API/Cocoa/WKWebView.mm:
310         (-[WKWebView _initializeWithConfiguration:]):
311         (-[WKWebView _iconLoadingDelegate]):
312         (-[WKWebView _setIconLoadingDelegate:]):
313         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
314
315         * UIProcess/API/Cocoa/_WKIconLoadingDelegate.h: Copied from Source/WebCore/html/LinkIconCollector.h.
316
317         * UIProcess/API/Cocoa/_WKLinkIconParameters.h: Copied from Source/WebCore/html/LinkIconCollector.h.
318         * UIProcess/API/Cocoa/_WKLinkIconParameters.mm: Copied from Source/WebCore/html/LinkIconCollector.h.
319         (-[_WKLinkIconParameters _initWithLinkIcon:]):
320         (-[_WKLinkIconParameters url]):
321         (-[_WKLinkIconParameters mimeType]):
322         (-[_WKLinkIconParameters size]):
323         (-[_WKLinkIconParameters iconType]):
324         * UIProcess/API/Cocoa/_WKLinkIconParametersInternal.h: Copied from Source/WebCore/html/LinkIconCollector.h.
325
326         * UIProcess/Cocoa/IconLoadingDelegate.h: Copied from Source/WebCore/html/LinkIconCollector.h.
327         * UIProcess/Cocoa/IconLoadingDelegate.mm: Added.
328         (WebKit::IconLoadingDelegate::IconLoadingDelegate):
329         (WebKit::IconLoadingDelegate::~IconLoadingDelegate):
330         (WebKit::IconLoadingDelegate::createIconLoadingClient):
331         (WebKit::IconLoadingDelegate::delegate):
332         (WebKit::IconLoadingDelegate::setDelegate):
333         (WebKit::IconLoadingDelegate::IconLoadingClient::IconLoadingClient):
334         (WebKit::IconLoadingDelegate::IconLoadingClient::~IconLoadingClient):
335         (WebKit::IconLoadingDelegate::IconLoadingClient::getLoadDecisionForIcon):
336
337         * UIProcess/WebPageProxy.cpp:
338         (WebKit::WebPageProxy::setIconLoadingClient):
339         (WebKit::WebPageProxy::getLoadDecisionForIcon):
340         (WebKit::WebPageProxy::finishedLoadingIcon):
341         * UIProcess/WebPageProxy.h:
342         (WebKit::WebPageProxy::iconLoadingClient):
343         * UIProcess/WebPageProxy.messages.in:
344
345         * WebKit2.xcodeproj/project.pbxproj:
346
347         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
348         (WebKit::WebFrameLoaderClient::useIconLoadingClient):
349         (WebKit::WebFrameLoaderClient::getLoadDecisionForIcon):
350         (WebKit::WebFrameLoaderClient::finishedLoadingIcon):
351         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
352         (WebKit::WebFrameLoaderClient::setUseIconLoadingClient):
353
354         * WebProcess/WebPage/WebPage.cpp:
355         (WebKit::WebPage::didGetLoadDecisionForIcon):
356         (WebKit::WebPage::setUseIconLoadingClient):
357         * WebProcess/WebPage/WebPage.h:
358         * WebProcess/WebPage/WebPage.messages.in:
359
360 2016-12-09  Simon Fraser  <simon.fraser@apple.com>
361
362         Fix initialization of contentUpdateFrequency
363         https://bugs.webkit.org/show_bug.cgi?id=165705
364         rdar://problem/29602039
365
366         Reviewed by Tim Horton.
367
368         The value that controls web content update frequency was not being initialized.
369
370         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
371         (-[WKWebViewConfiguration init]):
372
373 2016-12-09  Anders Carlsson  <andersca@apple.com>
374
375         Once we can send Mach messages again, make sure to send any pending outgoing messages
376         https://bugs.webkit.org/show_bug.cgi?id=165693
377
378         Reviewed by Brady Eidson.
379
380         * Platform/IPC/mac/ConnectionMac.mm:
381         (IPC::Connection::initializeSendSource):
382
383 2016-12-09  Beth Dakin  <bdakin@apple.com>
384
385         Password fields should not show the emoji button in TouchBar
386         https://bugs.webkit.org/show_bug.cgi?id=165673
387         -and corresponding-
388         rdar://problem/29235739
389
390         Reviewed by Wenson Hsieh.
391
392         This patch adds a new member variable for the password touch bar and password 
393         candidateListTouchBarItem. Since this TouchBar will actually have a different set 
394         of identifiers than the plain text TouchBar, it should just have its own variable.
395         * UIProcess/Cocoa/WebViewImpl.h:
396         * UIProcess/Cocoa/WebViewImpl.mm:
397
398         Return m_passwordTextCandidateListTouchBarItem when appropriate.
399         (WebKit::WebViewImpl::candidateListTouchBarItem):
400
401         The candidate list should be the only item for passwords.
402         (WebKit::passwordTextTouchBarDefaultItemIdentifiers):
403
404         Account for m_passwordTextTouchBar.
405         (WebKit::WebViewImpl::updateTouchBarAndRefreshTextBarIdentifiers):
406         (WebKit::WebViewImpl::setUpTextTouchBar):
407         (WebKit::WebViewImpl::textTouchBar):
408
409         The empty candidates array is not needed. We can just set @[ ] as the candidates 
410         for the m_passwordTextCandidateListTouchBarItem. Safe guards already exist in the 
411         other parts of the code to prevent us from requesting or setting other candidates 
412         when in a password field. 
413         (WebKit::WebViewImpl::updateTextTouchBar):
414
415 2016-12-09  Keith Rollin  <krollin@apple.com>
416
417         Fix string specification in print format
418         https://bugs.webkit.org/show_bug.cgi?id=165650
419
420         Reviewed by Alex Christensen.
421
422         Change "%{public}s" string specifier to something that can be changed
423         to "%s" at compile time when the build environment doesn't support the
424         former.
425
426         * NetworkProcess/capture/NetworkCaptureLogging.h:
427         * NetworkProcess/capture/NetworkCaptureManager.cpp:
428         (WebKit::NetworkCapture::Manager::initialize):
429         (WebKit::NetworkCapture::Manager::findMatch):
430         (WebKit::NetworkCapture::Manager::findExactMatch):
431         (WebKit::NetworkCapture::Manager::findBestFuzzyMatch):
432         (WebKit::NetworkCapture::Manager::fuzzyMatchURLs):
433         (WebKit::NetworkCapture::Manager::logPlayedBackResource):
434         (WebKit::NetworkCapture::Manager::openCacheFile):
435         (WebKit::NetworkCapture::Manager::getLine):
436         * NetworkProcess/capture/NetworkCaptureRecorder.cpp:
437         (WebKit::NetworkCapture::Recorder::recordRequestSent):
438         (WebKit::NetworkCapture::Recorder::recordResponseReceived):
439         (WebKit::NetworkCapture::Recorder::recordRedirectReceived):
440         (WebKit::NetworkCapture::Recorder::recordRedirectSent):
441         (WebKit::NetworkCapture::Recorder::writeEvents):
442         * NetworkProcess/capture/NetworkCaptureResource.cpp:
443         (WebKit::NetworkCapture::Resource::url):
444         (WebKit::NetworkCapture::Resource::EventStream::nextEvent):
445         * NetworkProcess/capture/NetworkDataTaskReplay.cpp:
446         (WebKit::NetworkCapture::NetworkDataTaskReplay::NetworkDataTaskReplay):
447         (WebKit::NetworkCapture::NetworkDataTaskReplay::~NetworkDataTaskReplay):
448         (WebKit::NetworkCapture::NetworkDataTaskReplay::resume):
449         (WebKit::NetworkCapture::NetworkDataTaskReplay::suspend):
450         (WebKit::NetworkCapture::NetworkDataTaskReplay::complete):
451         (WebKit::NetworkCapture::NetworkDataTaskReplay::invalidateAndCancel):
452         (WebKit::NetworkCapture::NetworkDataTaskReplay::enqueueEventHandler):
453         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayRequestSent):
454         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayResponseReceived):
455         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayRedirectReceived):
456         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayRedirectSent):
457         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayDataReceived):
458         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayFinished):
459         (WebKit::NetworkCapture::NetworkDataTaskReplay::didReceiveResponse):
460
461 2016-12-09  Jeremy Jones  <jeremyj@apple.com>
462
463         WebView doesn't become first responder in element fullscreen.
464         https://bugs.webkit.org/show_bug.cgi?id=165664
465         rdar://problem/28927252
466
467         Reviewed by Tim Horton.
468
469         WebView was being set as the first responder while the contentView was still hidden.
470         A view can not become first responder while it or its ancestor is hidden.
471
472         This change waits until after the contentView is visible to make the web view the first responder.
473
474         * UIProcess/mac/WKFullScreenWindowController.mm:
475         (-[WKFullScreenWindowController enterFullScreen:]):
476         (-[WKFullScreenWindowController _startEnterFullScreenAnimationWithDuration:]):
477
478 2016-12-09  Gustavo Noronha Silva  <gustavo.noronha@collabora.co.uk>
479
480         Unreviewed build fix. Thanks to Konstantin Tokarev and Csaba Osztrogonác
481         for pointing out the fix.
482
483         * CMakeLists.txt: add WebCore/html/canvas to include paths.
484
485 2016-12-09  Gustavo Noronha Silva  <gustavo.noronha@collabora.co.uk>
486
487         [GTK] Fix build after r209558
488         https://bugs.webkit.org/show_bug.cgi?id=165653
489
490         Unreviewed build fix.
491
492         * UIProcess/API/APIPolicyClient.h: include WebsitePolicies.h.
493         * UIProcess/API/gtk/WebKitPolicyClient.cpp: ditto.
494         * UIProcess/API/gtk/WebKitPolicyDecision.cpp:
495         (webkit_policy_decision_use):  pass empty structure to new required argument.
496
497 2016-12-09  Gavin Barraclough  <barraclough@apple.com>
498
499         Revert - Add _WKIconLoadingDelegate SPI
500         https://bugs.webkit.org/show_bug.cgi?id=164894
501
502         Unreviewed rollout due to performance regression.
503
504         * PlatformMac.cmake:
505         * UIProcess/API/APIIconLoadingClient.h: Removed.
506         * UIProcess/API/Cocoa/WKWebView.mm:
507         (-[WKWebView _initializeWithConfiguration:]):
508         (-[WKWebView _iconLoadingDelegate]): Deleted.
509         (-[WKWebView _setIconLoadingDelegate:]): Deleted.
510         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
511         * UIProcess/API/Cocoa/_WKIconLoadingDelegate.h: Removed.
512         * UIProcess/API/Cocoa/_WKLinkIconParameters.h: Removed.
513         * UIProcess/API/Cocoa/_WKLinkIconParameters.mm: Removed.
514         * UIProcess/API/Cocoa/_WKLinkIconParametersInternal.h: Removed.
515         * UIProcess/Cocoa/IconLoadingDelegate.h: Removed.
516         * UIProcess/Cocoa/IconLoadingDelegate.mm: Removed.
517         * UIProcess/WebPageProxy.cpp:
518         (WebKit::WebPageProxy::setIconLoadingClient): Deleted.
519         (WebKit::WebPageProxy::getLoadDecisionForIcon): Deleted.
520         (WebKit::WebPageProxy::finishedLoadingIcon): Deleted.
521         * UIProcess/WebPageProxy.h:
522         (WebKit::WebPageProxy::iconLoadingClient): Deleted.
523         * UIProcess/WebPageProxy.messages.in:
524         * WebKit2.xcodeproj/project.pbxproj:
525         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
526         (WebKit::WebFrameLoaderClient::useIconLoadingClient): Deleted.
527         (WebKit::WebFrameLoaderClient::getLoadDecisionForIcon): Deleted.
528         (WebKit::WebFrameLoaderClient::finishedLoadingIcon): Deleted.
529         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
530         (WebKit::WebFrameLoaderClient::setUseIconLoadingClient): Deleted.
531         (): Deleted.
532         * WebProcess/WebPage/WebPage.cpp:
533         (WebKit::WebPage::didGetLoadDecisionForIcon): Deleted.
534         (WebKit::WebPage::setUseIconLoadingClient): Deleted.
535         * WebProcess/WebPage/WebPage.h:
536         * WebProcess/WebPage/WebPage.messages.in:
537
538 2016-12-08  Keith Rollin  <krollin@apple.com>
539
540         Move FileHandle to WebCore FileHandle.h
541         https://bugs.webkit.org/show_bug.cgi?id=165562
542
543         Reviewed by Alex Christensen.
544
545         Move FileHandle from NetworkCaptureTypes.h (which can now be deleted)
546         to WebCore. Update client code to use the new version.
547
548         * NetworkProcess/capture/NetworkCaptureEvent.cpp:
549         * NetworkProcess/capture/NetworkCaptureEvent.h:
550         * NetworkProcess/capture/NetworkCaptureManager.cpp:
551         (WebKit::NetworkCapture::Manager::initialize):
552         (WebKit::NetworkCapture::Manager::terminate):
553         (WebKit::NetworkCapture::Manager::logRecordedResource):
554         (WebKit::NetworkCapture::Manager::logLoadedResource):
555         (WebKit::NetworkCapture::Manager::logPlayedBackResource):
556         (WebKit::NetworkCapture::Manager::openCacheFile):
557         (WebKit::NetworkCapture::Manager::ensureFileHandle): Deleted.
558         (WebKit::NetworkCapture::Manager::printToFile): Deleted.
559         * NetworkProcess/capture/NetworkCaptureManager.h:
560         * NetworkProcess/capture/NetworkCaptureRecorder.cpp:
561         (WebKit::NetworkCapture::Recorder::writeEvents):
562         * NetworkProcess/capture/NetworkCaptureTypes.h: Removed.
563         * WebKit2.xcodeproj/project.pbxproj:
564
565 2016-12-08  Anders Carlsson  <andersca@apple.com>
566
567         Attempt to fix the iOS build.
568
569         * Platform/IPC/mac/MachMessage.cpp:
570
571 2016-12-08  Anders Carlsson  <andersca@apple.com>
572
573         Defer sending Mach messages if the queue is full
574         https://bugs.webkit.org/show_bug.cgi?id=165622
575         rdar://problem/29518036
576
577         Reviewed by Brady Eidson.
578
579         * Platform/IPC/Connection.cpp:
580         Include MachMessage.h so the Connection destructor can do its thing.
581
582         * Platform/IPC/Connection.h:
583         Add new members.
584
585         * Platform/IPC/mac/ConnectionMac.mm:
586         (IPC::Connection::platformInvalidate):
587         Null out the pending outgoing mach message.
588
589         (IPC::Connection::sendMessage):
590         New helper that will send a Mach message. If we time out, store the message in m_pendingOutgoingMachMessage.
591         When our send source will be triggered we'll try to send the message again.
592
593         (IPC::Connection::platformCanSendOutgoingMessages):
594         We can only send messages if we don't have a pending outgoing message.
595
596         (IPC::Connection::sendOutgoingMessage):
597         Call the newly added sendMessage function.
598
599         (IPC::Connection::initializeSendSource):
600         Add the DISPATCH_MACH_SEND_POSSIBLE mask (and DISPATCH_MACH_SEND_DEAD which was previously implicit).
601         In our event handler, check for DISPATCH_MACH_SEND_POSSIBLE and try to send the pending outgoing message again.
602
603         * Platform/IPC/mac/MachMessage.cpp:
604         (IPC::MachMessage::create):
605         Rename length to size.
606
607         (IPC::MachMessage::MachMessage):
608         Initialize m_shouldFreeDescriptors.
609
610         (IPC::MachMessage::~MachMessage):
611         Call mach_msg_destroy, which will free the descriptors.
612
613         (IPC::MachMessage::leakDescriptors):
614         Set m_shouldFreeDescriptors to false.
615
616         * Platform/IPC/mac/MachMessage.h:
617         (IPC::MachMessage::size):
618         (IPC::MachMessage::length): Deleted.
619
620 2016-12-08  Chelsea Pugh  <cpugh@apple.com>
621
622         [iOS] WKWebView should not allow app links to be opened on back or forward navigation
623         https://bugs.webkit.org/show_bug.cgi?id=165502
624
625         Reviewed by Dan Bernstein.
626
627         * UIProcess/WebPageProxy.cpp:
628         (WebKit::WebPageProxy::decidePolicyForNavigationAction): Add a condition to shouldOpenAppLinks
629         (which we use when creating a NavigationAction) that the navigationActionData is not a navigation
630         of type BackForward. This way, we don't open app links when a navigation is done via back or
631         forward.
632
633 2016-12-08  Filip Pizlo  <fpizlo@apple.com>
634
635         Enable SharedArrayBuffer, remove the flag
636         https://bugs.webkit.org/show_bug.cgi?id=165614
637
638         Rubber stamped by Geoffrey Garen.
639
640         * UIProcess/API/C/WKPreferencesRefPrivate.h:
641         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
642
643 2016-12-08  Alex Christensen  <achristensen@webkit.org>
644
645         Add SPI for sending WebsiteSettings to WebProcess during navigation
646         https://bugs.webkit.org/show_bug.cgi?id=165517
647         <rdar://29341068>
648
649         We add the ability for the navigation client to send settings to the WebProcess 
650         based on the URL of the document being navigated to. This approach adds no new IPC 
651         messages and allows the application to decide what settings to use during navigation 
652         instead of declaratively before navigation. Right now there is only one setting, 
653         whether to disable content blockers, but this infrastructure can be used for more settings.
654
655         Reviewed by Anders Carlsson.
656
657         * CMakeLists.txt:
658         * PlatformMac.cmake:
659         * Shared/API/APIObject.h:
660         * Shared/API/c/WKBase.h:
661         * Shared/WebsitePolicies.h: Added.
662         (WebKit::WebsitePolicies::encode):
663         (WebKit::WebsitePolicies::decode):
664         * UIProcess/API/APINavigationClient.h:
665         (API::NavigationClient::decidePolicyForNavigationAction):
666         (API::NavigationClient::decidePolicyForNavigationResponse):
667         * UIProcess/API/APIPolicyClient.h:
668         (API::PolicyClient::decidePolicyForNavigationAction):
669         (API::PolicyClient::decidePolicyForNewWindowAction):
670         (API::PolicyClient::decidePolicyForResponse):
671         * UIProcess/API/APIWebsitePolicies.cpp: Added.
672         (API::WebsitePolicies::create):
673         * UIProcess/API/APIWebsitePolicies.h: Added.
674         * UIProcess/API/C/WKAPICast.h:
675         * UIProcess/API/C/WKFramePolicyListener.cpp:
676         (WKFramePolicyListenerUse):
677         (WKFramePolicyListenerUseWithPolicies):
678         * UIProcess/API/C/WKFramePolicyListener.h:
679         * UIProcess/API/C/WKPage.cpp:
680         (WKPageSetPagePolicyClient):
681         * UIProcess/API/C/WKWebsitePolicies.cpp: Added.
682         (WKWebsitePoliciesGetTypeID):
683         (WKWebsitePoliciesCreate):
684         (WKWebsitePoliciesSetContentBlockersEnabled):
685         (WKWebsitePoliciesGetContentBlockersEnabled):
686         * UIProcess/API/C/WKWebsitePolicies.h: Added.
687         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
688         * UIProcess/API/Cocoa/_WKWebsitePolicies.h: Added.
689         * UIProcess/API/Cocoa/_WKWebsitePolicies.mm: Added.
690         (-[_WKWebsitePolicies dealloc]):
691         (-[_WKWebsitePolicies init]):
692         (-[_WKWebsitePolicies setContentBlockersEnabled:]):
693         (-[_WKWebsitePolicies contentBlockersEnabled]):
694         (-[_WKWebsitePolicies description]):
695         (-[_WKWebsitePolicies _apiObject]):
696         * UIProcess/API/Cocoa/_WKWebsitePoliciesInternal.h: Added.
697         (WebKit::wrapper):
698         * UIProcess/Automation/WebAutomationSession.cpp:
699         (WebKit::WebAutomationSession::reloadBrowsingContext):
700         * UIProcess/Cocoa/NavigationState.h:
701         * UIProcess/Cocoa/NavigationState.mm:
702         (WebKit::NavigationState::setNavigationDelegate):
703         (WebKit::tryAppLink):
704         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
705         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationResponse):
706         * UIProcess/WebFormSubmissionListenerProxy.cpp:
707         (WebKit::WebFormSubmissionListenerProxy::continueSubmission):
708         * UIProcess/WebFrameListenerProxy.cpp:
709         (WebKit::WebFrameListenerProxy::receivedPolicyDecision):
710         * UIProcess/WebFrameListenerProxy.h:
711         * UIProcess/WebFramePolicyListenerProxy.cpp:
712         (WebKit::WebFramePolicyListenerProxy::use):
713         (WebKit::WebFramePolicyListenerProxy::download):
714         (WebKit::WebFramePolicyListenerProxy::ignore):
715         * UIProcess/WebFramePolicyListenerProxy.h:
716         (WebKit::WebFramePolicyListenerProxy::create):
717         * UIProcess/WebFrameProxy.cpp:
718         (WebKit::WebFrameProxy::receivedPolicyDecision):
719         * UIProcess/WebFrameProxy.h:
720         * UIProcess/WebInspectorProxy.cpp:
721         (WebKit::decidePolicyForNavigationAction):
722         * UIProcess/WebPageProxy.cpp:
723         (WebKit::WebPageProxy::receivedPolicyDecision):
724         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
725         * UIProcess/WebPageProxy.h:
726         * UIProcess/WebPageProxy.messages.in:
727         * WebKit2.xcodeproj/project.pbxproj:
728         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
729         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
730
731 2016-12-08  Antti Koivisto  <antti@apple.com>
732
733         Salt network cache hashes
734         https://bugs.webkit.org/show_bug.cgi?id=164924
735
736         Reviewed by Alex Christensen.
737
738         To enhance privacy make cache content unidentifiable from file names alone.
739         This is done by generating a unique persistent salt for each cache instance.
740         It is used when computing hashes used in file names.
741
742         The patch also replaces plain text partition directory names with salted hashes.
743
744         * NetworkProcess/cache/NetworkCache.cpp:
745         (WebKit::NetworkCache::Cache::makeCacheKey):
746         (WebKit::NetworkCache::makeCacheKey): Deleted.
747         * NetworkProcess/cache/NetworkCache.h:
748
749             Increment cache version.
750
751         * NetworkProcess/cache/NetworkCacheBlobStorage.cpp:
752         (WebKit::NetworkCache::BlobStorage::BlobStorage):
753         (WebKit::NetworkCache::BlobStorage::add):
754         (WebKit::NetworkCache::BlobStorage::get):
755
756             Use salt for blob content hash.
757
758         * NetworkProcess/cache/NetworkCacheBlobStorage.h:
759         * NetworkProcess/cache/NetworkCacheData.cpp:
760         (WebKit::NetworkCache::computeSHA1):
761
762             For simplicity all SHA1s are now salted.
763
764         (WebKit::NetworkCache::makeSalt):
765         (WebKit::NetworkCache::readOrMakeSalt):
766
767             Read salt if it exists, generate and persist it otherwise.
768
769         * NetworkProcess/cache/NetworkCacheData.h:
770         * NetworkProcess/cache/NetworkCacheKey.cpp:
771         (WebKit::NetworkCache::Key::Key):
772
773             Remove the "No partition" string and just empty.
774             That was only needed to have a directory name of some sort.
775
776         (WebKit::NetworkCache::Key::computeHash):
777
778             Use salt for key hash.
779
780         (WebKit::NetworkCache::Key::computePartitionHash):
781
782             Separate hash for partition.
783
784         * NetworkProcess/cache/NetworkCacheKey.h:
785         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
786         (WebKit::NetworkCache::makeSubresourcesKey):
787         (WebKit::NetworkCache::SpeculativeLoadManager::PendingFrameLoad::saveToDiskIfReady):
788         (WebKit::NetworkCache::SpeculativeLoadManager::retrieveSubresourcesEntry):
789         * NetworkProcess/cache/NetworkCacheStorage.cpp:
790         (WebKit::NetworkCache::makeSaltFilePath):
791         (WebKit::NetworkCache::Storage::open):
792
793             Cache can't be opened if we can't read or persist a salt.
794
795         (WebKit::NetworkCache::traverseRecordsFiles):
796         (WebKit::NetworkCache::Storage::Storage):
797         (WebKit::NetworkCache::Storage::synchronize):
798         (WebKit::NetworkCache::Storage::recordDirectoryPathForKey):
799
800             Use the partition hash in the directory name instead of a plain text name.
801
802         (WebKit::NetworkCache::decodeRecordHeader):
803         (WebKit::NetworkCache::Storage::readRecord):
804         (WebKit::NetworkCache::Storage::encodeRecord):
805         (WebKit::NetworkCache::Storage::traverse):
806         (WebKit::NetworkCache::Storage::clear):
807         * NetworkProcess/cache/NetworkCacheStorage.h:
808         (WebKit::NetworkCache::Storage::salt):
809
810 2016-12-08  Eric Carlson  <eric.carlson@apple.com>
811
812         Fix the EFL build.
813
814         * UIProcess/WebPageProxy.cpp:
815         (WebKit::WebPageProxy::isPlayingMediaDidChange): Add another ENABLE(MEDIA_STREAM) guard.
816
817 2016-12-08  Tomas Popela  <tpopela@redhat.com>
818
819         [GTK] Process accelerated compositing env variables only if they are really enabled
820         https://bugs.webkit.org/show_bug.cgi?id=165300
821
822         Don't process the WEBKIT_FORCE_COMPOSITING_MODE and
823         WEBKIT_DISABLE_COMPOSITING_MODE env variables if they are disabled
824         (eg. WEBKIT_DISABLE_COMPOSITING_MODE=0).
825
826         Reviewed by Michael Catanzaro.
827
828         * UIProcess/gtk/WebPreferencesGtk.cpp:
829         (WebKit::WebPreferences::platformInitializeStore):
830
831 2016-12-08  Alex Christensen  <achristensen@webkit.org>
832
833         Fix CMake build.
834
835         * CMakeLists.txt:
836         Add the new NetworkProcess/capture include directory to find new headers from r209498.
837         * NetworkProcess/capture/NetworkCaptureEvent.cpp:
838         (WebKit::NetworkCapture::Response::Response):
839         (WebKit::NetworkCapture::Error::Error):
840         The String constructor was ambiguous after r209498 because URL has an operator NSString* and String has an NSString constructor.
841         We should get rid of operator NSString* and operator String on URL.
842         * UIProcess/WebPageProxy.cpp:
843         * UIProcess/WebPageProxy.h:
844         Add some ENABLE(MEDIA_STREAM) macros to fix the build without it enabled after r209512.
845
846 2016-12-08  Alex Christensen  <achristensen@webkit.org>
847
848         Fix iOS debug build after r209498
849         https://bugs.webkit.org/show_bug.cgi?id=164527
850
851         * NetworkProcess/capture/NetworkCaptureLogging.h:
852         Logs were causing compile warnings/errors.  Disable logs for now.
853
854 2016-12-07  Dean Jackson  <dino@apple.com>
855
856         Remove runtime toggle for pointer-lock
857         https://bugs.webkit.org/show_bug.cgi?id=165577
858         <rdar://problems/29566996>
859
860         Reviewed by Jon Lee.
861
862         Remove any runtime calls to check if pointer-lock is enabled. It's
863         either compiled in or out.
864
865         * Shared/WebPreferencesDefinitions.h:
866         * UIProcess/API/C/WKPreferences.cpp:
867         (WKPreferencesSetPointerLockEnabled): Deleted.
868         (WKPreferencesGetPointerLockEnabled): Deleted.
869         * UIProcess/API/C/WKPreferencesRefPrivate.h:
870         * WebProcess/WebPage/WebPage.cpp:
871         (WebKit::WebPage::updatePreferences):
872
873 2016-12-07  Eric Carlson  <eric.carlson@apple.com>
874
875         [MediaStream][Mac] Revoke sandbox extensions when capture ends
876         https://bugs.webkit.org/show_bug.cgi?id=165476
877
878         Reviewed by Brady Eidson.
879
880         Track media capture by process so it is possible to revoke the sandbox extensions issued to
881         a web process when capture stops. Allocate WK2 user media permission manager lazily rather
882         than every time a page is created as most pages won't need one.
883
884         * CMakeLists.txt: Add new files.
885
886         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
887         (WebKit::UserMediaPermissionRequestManagerProxy::UserMediaPermissionRequestManagerProxy): Register
888           with process manager.
889         (WebKit::UserMediaPermissionRequestManagerProxy::~UserMediaPermissionRequestManagerProxy):
890         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasGranted): Move sandbox 
891           extension code to the process manager.
892         (WebKit::UserMediaPermissionRequestManagerProxy::stopCapture): New.
893         (WebKit::UserMediaPermissionRequestManagerProxy::startedCaptureSession): New, report state
894           change to the process manager.
895         (WebKit::UserMediaPermissionRequestManagerProxy::endedCaptureSession): Ditto.
896         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
897
898         * UIProcess/UserMediaProcessManager.cpp: Added.
899         (WebKit::ProcessState::ProcessState):
900         (WebKit::ProcessState::managers):
901         (WebKit::ProcessState::sandboxExtensionsGranted):
902         (WebKit::ProcessState::setSandboxExtensionsGranted):
903         (WebKit::stateMap):
904         (WebKit::processState):
905         (WebKit::ProcessState::addRequestManager):
906         (WebKit::ProcessState::removeRequestManager):
907         (WebKit::UserMediaProcessManager::singleton):
908         (WebKit::UserMediaProcessManager::addUserMediaPermissionRequestManagerProxy):
909         (WebKit::UserMediaProcessManager::removeUserMediaPermissionRequestManagerProxy):
910         (WebKit::UserMediaProcessManager::willCreateMediaStream):
911         (WebKit::UserMediaProcessManager::startedCaptureSession):
912         (WebKit::UserMediaProcessManager::endedCaptureSession):
913         * UIProcess/UserMediaProcessManager.h: Added.
914
915         * UIProcess/WebPageProxy.cpp:
916         (WebKit::WebPageProxy::WebPageProxy): Don't allocate m_userMediaPermissionRequestManager.
917         (WebKit::WebPageProxy::resetState): Set m_userMediaPermissionRequestManager to null.
918         (WebKit::WebPageProxy::userMediaPermissionRequestManager): Allocate m_userMediaPermissionRequestManager
919           lazily as most pages don't need it.
920         (WebKit::WebPageProxy::requestUserMediaPermissionForFrame): Call userMediaPermissionRequestManager().
921         (WebKit::WebPageProxy::enumerateMediaDevicesForFrame): Ditto.
922         (WebKit::WebPageProxy::clearUserMediaState): Ditto.
923         (WebKit::WebPageProxy::isPlayingMediaDidChange): Report capture state changes to the request
924           manager proxy.
925         * UIProcess/WebPageProxy.h:
926
927         * WebKit2.xcodeproj/project.pbxproj: Add new files.
928
929         * WebProcess/MediaStream/MediaDeviceSandboxExtensions.cpp: Added.
930         (WebKit::MediaDeviceSandboxExtensions::MediaDeviceSandboxExtensions):
931         (WebKit::MediaDeviceSandboxExtensions::encode):
932         (WebKit::MediaDeviceSandboxExtensions::decode):
933         (WebKit::MediaDeviceSandboxExtensions::operator[]):
934         (WebKit::MediaDeviceSandboxExtensions::size):
935         * WebProcess/MediaStream/MediaDeviceSandboxExtensions.h: Added.
936
937         * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
938         (WebKit::UserMediaPermissionRequestManager::~UserMediaPermissionRequestManager): Sandbox extension
939           is now in a HashMap, not a Vector.
940         (WebKit::UserMediaPermissionRequestManager::grantUserMediaDeviceSandboxExtensions): Record
941           IDs with extensions so they can be revoked later.
942         (WebKit::UserMediaPermissionRequestManager::revokeUserMediaDeviceSandboxExtensions): New.
943         (WebKit::UserMediaPermissionRequestManager::grantUserMediaDevicesSandboxExtension): Deleted.
944         * WebProcess/MediaStream/UserMediaPermissionRequestManager.h:
945
946         * WebProcess/WebPage/WebPage.cpp:
947         (WebKit::WebPage::grantUserMediaDeviceSandboxExtensions):
948         (WebKit::WebPage::revokeUserMediaDeviceSandboxExtensions):
949         (WebKit::WebPage::grantUserMediaDevicesSandboxExtension): Deleted.
950         * WebProcess/WebPage/WebPage.h:
951         * WebProcess/WebPage/WebPage.messages.in:
952
953 2016-12-07  Jeremy Jones  <jeremyj@apple.com>
954
955         One esc to exit fullscreen and pointer lock
956         https://bugs.webkit.org/show_bug.cgi?id=165416
957         rdar://problem/29430711
958
959         Reviewed by Jer Noble.
960
961         Fix a crash when didLosePointerLock is not specified.
962
963         * UIProcess/API/C/WKPage.cpp:
964         (WKPageSetPageUIClient):
965
966 2016-12-07  Keith Rollin  <krollin@apple.com>
967
968         Network event record/replay
969         https://bugs.webkit.org/show_bug.cgi?id=164527
970         <rdar://problem/29168157>
971
972         Reviewed by Alex Christensen.
973
974         Add WebKit2/NetworkProcess/capture/* for recording the network events
975         that occur when loading a page and for replaying them later. Update
976         NetworkLoad to invoke capture facilities. Add preferences for enabling
977         record or replay.
978
979         * CMakeLists.txt:
980         * NetworkProcess/NetworkLoad.cpp:
981         (WebKit::NetworkLoad::NetworkLoad):
982         (WebKit::NetworkLoad::initializeForRecord):
983         (WebKit::NetworkLoad::initializeForReplay):
984         (WebKit::NetworkLoad::initialize):
985         (WebKit::NetworkLoad::setDefersLoading):
986         (WebKit::NetworkLoad::continueWillSendRequest):
987         (WebKit::NetworkLoad::sharedWillSendRedirectedRequest):
988         (WebKit::NetworkLoad::notifyDidReceiveResponse):
989         (WebKit::NetworkLoad::didReceiveData):
990         (WebKit::NetworkLoad::didCompleteWithError):
991         * NetworkProcess/NetworkLoad.h:
992         * NetworkProcess/NetworkProcess.cpp:
993         (WebKit::NetworkProcess::initializeNetworkProcess):
994         (WebKit::NetworkProcess::terminate):
995         * NetworkProcess/NetworkProcessCreationParameters.cpp:
996         (WebKit::NetworkProcessCreationParameters::encode):
997         (WebKit::NetworkProcessCreationParameters::decode):
998         * NetworkProcess/NetworkProcessCreationParameters.h:
999         * NetworkProcess/capture/NetworkCaptureEvent.cpp: Added.
1000         (WebKit::NetworkCapture::copyHeaders):
1001         (WebKit::NetworkCapture::KeyValuePair::KeyValuePair):
1002         (WebKit::NetworkCapture::ResourceRequest::ResourceRequest):
1003         (WebKit::NetworkCapture::ResourceRequest::operator WebCore::ResourceRequest):
1004         (WebKit::NetworkCapture::ResourceResponse::ResourceResponse):
1005         (WebKit::NetworkCapture::ResourceResponse::operator WebCore::ResourceResponse):
1006         (WebKit::NetworkCapture::ResourceError::ResourceError):
1007         (WebKit::NetworkCapture::ResourceError::operator WebCore::ResourceError):
1008         (WebKit::NetworkCapture::JSONCoder::encode):
1009         (WebKit::NetworkCapture::JSONCoder::decode):
1010         (WebKit::NetworkCapture::JSONCoder<String>::encode):
1011         (WebKit::NetworkCapture::JSONCoder<String>::decode):
1012         (WebKit::NetworkCapture::JSONCoder<CaptureTimeType>::encode):
1013         (WebKit::NetworkCapture::JSONCoder<CaptureTimeType>::decode):
1014         (WebKit::NetworkCapture::JSONCoder<KeyValuePair>::encode):
1015         (WebKit::NetworkCapture::JSONCoder<KeyValuePair>::decode):
1016         (WebKit::NetworkCapture::JSONCoder<Vector<T>>::encode):
1017         (WebKit::NetworkCapture::JSONCoder<Vector<T>>::decode):
1018         (WebKit::NetworkCapture::JSONCoder<ResourceRequest>::encode):
1019         (WebKit::NetworkCapture::JSONCoder<ResourceRequest>::decode):
1020         (WebKit::NetworkCapture::JSONCoder<ResourceResponse>::encode):
1021         (WebKit::NetworkCapture::JSONCoder<ResourceResponse>::decode):
1022         (WebKit::NetworkCapture::JSONCoder<ResourceError>::encode):
1023         (WebKit::NetworkCapture::JSONCoder<ResourceError>::decode):
1024         (WebKit::NetworkCapture::JSONCoder<WebCore::SharedBuffer>::encode):
1025         (WebKit::NetworkCapture::JSONCoder<WebCore::SharedBuffer>::decode):
1026         (WebKit::NetworkCapture::JSONCoder<RequestSentEvent>::encode):
1027         (WebKit::NetworkCapture::JSONCoder<RequestSentEvent>::decode):
1028         (WebKit::NetworkCapture::JSONCoder<ResponseReceivedEvent>::encode):
1029         (WebKit::NetworkCapture::JSONCoder<ResponseReceivedEvent>::decode):
1030         (WebKit::NetworkCapture::JSONCoder<RedirectReceivedEvent>::encode):
1031         (WebKit::NetworkCapture::JSONCoder<RedirectReceivedEvent>::decode):
1032         (WebKit::NetworkCapture::JSONCoder<RedirectSentEvent>::encode):
1033         (WebKit::NetworkCapture::JSONCoder<RedirectSentEvent>::decode):
1034         (WebKit::NetworkCapture::JSONCoder<DataReceivedEvent>::encode):
1035         (WebKit::NetworkCapture::JSONCoder<DataReceivedEvent>::decode):
1036         (WebKit::NetworkCapture::JSONCoder<FinishedEvent>::encode):
1037         (WebKit::NetworkCapture::JSONCoder<FinishedEvent>::decode):
1038         (WebKit::NetworkCapture::eventToString):
1039         (WebKit::NetworkCapture::stringToEvent):
1040         * NetworkProcess/capture/NetworkCaptureEvent.h: Added.
1041         (WebKit::NetworkCapture::TimedEvent::TimedEvent):
1042         * NetworkProcess/capture/NetworkCaptureLogging.h: Added.
1043         * NetworkProcess/capture/NetworkCaptureManager.cpp: Added.
1044         (WebKit::NetworkCapture::Manager::singleton):
1045         (WebKit::NetworkCapture::Manager::initialize):
1046         (WebKit::NetworkCapture::Manager::terminate):
1047         (WebKit::NetworkCapture::Manager::findMatch):
1048         (WebKit::NetworkCapture::Manager::findExactMatch):
1049         (WebKit::NetworkCapture::Manager::findBestFuzzyMatch):
1050         (WebKit::NetworkCapture::Manager::fuzzyMatchURLs):
1051         (WebKit::NetworkCapture::Manager::loadResources):
1052         (WebKit::NetworkCapture::Manager::reportLoadPath):
1053         (WebKit::NetworkCapture::Manager::reportRecordPath):
1054         (WebKit::NetworkCapture::Manager::reportReplayPath):
1055         (WebKit::NetworkCapture::Manager::requestToPath):
1056         (WebKit::NetworkCapture::Manager::stringToHash):
1057         (WebKit::NetworkCapture::Manager::hashToPath):
1058         (WebKit::NetworkCapture::Manager::logRecordedResource):
1059         (WebKit::NetworkCapture::Manager::logLoadedResource):
1060         (WebKit::NetworkCapture::Manager::logPlayedBackResource):
1061         (WebKit::NetworkCapture::Manager::ensureFileHandle):
1062         (WebKit::NetworkCapture::Manager::openCacheFile):
1063         (WebKit::NetworkCapture::Manager::readFile):
1064         (WebKit::NetworkCapture::Manager::getLine):
1065         (WebKit::NetworkCapture::Manager::getWord):
1066         (WebKit::NetworkCapture::Manager::printToFile):
1067         * NetworkProcess/capture/NetworkCaptureManager.h: Added.
1068         (WebKit::NetworkCapture::Manager::isRecording):
1069         (WebKit::NetworkCapture::Manager::isReplaying):
1070         (WebKit::NetworkCapture::Manager::mode):
1071         * NetworkProcess/capture/NetworkCaptureRecorder.cpp: Added.
1072         (WebKit::NetworkCapture::Recorder::recordRequestSent):
1073         (WebKit::NetworkCapture::Recorder::recordResponseReceived):
1074         (WebKit::NetworkCapture::Recorder::recordRedirectReceived):
1075         (WebKit::NetworkCapture::Recorder::recordRedirectSent):
1076         (WebKit::NetworkCapture::Recorder::recordDataReceived):
1077         (WebKit::NetworkCapture::Recorder::recordFinish):
1078         (WebKit::NetworkCapture::Recorder::writeEvents):
1079         * NetworkProcess/capture/NetworkCaptureRecorder.h: Added.
1080         (WebKit::NetworkCapture::Recorder::recordEvent):
1081         * NetworkProcess/capture/NetworkCaptureReplayer.cpp: Added.
1082         (WebKit::NetworkCapture::Replayer::replayResource):
1083         * NetworkProcess/capture/NetworkCaptureReplayer.h: Added.
1084         * NetworkProcess/capture/NetworkCaptureResource.cpp: Added.
1085         (WebKit::NetworkCapture::Resource::Resource):
1086         (WebKit::NetworkCapture::Resource::url):
1087         (WebKit::NetworkCapture::Resource::baseURL):
1088         (WebKit::NetworkCapture::Resource::queryParameters):
1089         (WebKit::NetworkCapture::Resource::eventStream):
1090         (WebKit::NetworkCapture::Resource::EventStream::EventStream):
1091         (WebKit::NetworkCapture::Resource::EventStream::nextEvent):
1092         * NetworkProcess/capture/NetworkCaptureResource.h: Added.
1093         * NetworkProcess/capture/NetworkCaptureTypes.h: Added.
1094         (WebKit::NetworkCapture::TypeHolder::forEachTypeImpl):
1095         (WebKit::NetworkCapture::TypeHolder::forEachType):
1096         * NetworkProcess/capture/NetworkDataTaskReplay.cpp: Added.
1097         (WebKit::NetworkCapture::NetworkDataTaskReplay::NetworkDataTaskReplay):
1098         (WebKit::NetworkCapture::NetworkDataTaskReplay::~NetworkDataTaskReplay):
1099         (WebKit::NetworkCapture::NetworkDataTaskReplay::resume):
1100         (WebKit::NetworkCapture::NetworkDataTaskReplay::suspend):
1101         (WebKit::NetworkCapture::NetworkDataTaskReplay::cancel):
1102         (WebKit::NetworkCapture::NetworkDataTaskReplay::complete):
1103         (WebKit::NetworkCapture::NetworkDataTaskReplay::invalidateAndCancel):
1104         (WebKit::NetworkCapture::NetworkDataTaskReplay::enqueueEventHandler):
1105         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayRequestSent):
1106         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayResponseReceived):
1107         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayRedirectReceived):
1108         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayRedirectSent):
1109         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayDataReceived):
1110         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayFinished):
1111         (WebKit::NetworkCapture::NetworkDataTaskReplay::didReceiveResponse):
1112         (WebKit::NetworkCapture::NetworkDataTaskReplay::didFinish):
1113         * NetworkProcess/capture/NetworkDataTaskReplay.h: Added.
1114         (WebKit::NetworkCapture::NetworkDataTaskReplay::create):
1115         * NetworkProcess/capture/json.hpp: Added.
1116         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1117         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
1118         * WebKit2.xcodeproj/project.pbxproj:
1119         * config.h:
1120
1121 2016-12-07  Anders Carlsson  <andersca@apple.com>
1122
1123         Fix build.
1124
1125         * Platform/IPC/mac/ConnectionMac.mm:
1126         (IPC::Connection::open):
1127
1128 2016-12-07  Anders Carlsson  <andersca@apple.com>
1129
1130         Rename the connection sources to better indicate what data direction they are used for
1131         https://bugs.webkit.org/show_bug.cgi?id=165548
1132
1133         Reviewed by Tim Horton.
1134
1135         * Platform/IPC/Connection.h:
1136         * Platform/IPC/mac/ConnectionMac.mm:
1137         (IPC::Connection::platformInvalidate):
1138         (IPC::Connection::platformInitialize):
1139         (IPC::createReceiveSource):
1140         (IPC::Connection::initializeSendSource):
1141         (IPC::Connection::receiveSourceEventHandler):
1142         (IPC::createDataAvailableSource): Deleted.
1143         (IPC::Connection::initializeDeadNameSource): Deleted.
1144         Rename m_deadNameSource to m_sendSource, and m_receivePortDataAvailableSource to m_receiveSource.
1145
1146         (IPC::Connection::open):
1147         Initialize the send source before we attempt to send a first message.
1148
1149 2016-12-07  Simon Fraser  <simon.fraser@apple.com>
1150
1151         Fix use of enum in a WK2 C SPI header.
1152         rdar://problem/28725583
1153
1154         Followup to correctly prefix the enum values.
1155
1156         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
1157         (WKBundlePageSetEventThrottlingBehaviorOverride):
1158         * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
1159
1160 2016-12-07  Simon Fraser  <simon.fraser@apple.com>
1161
1162         Fix use of enum in a WK2 C SPI header.
1163         rdar://problem/28725583
1164
1165         Reviewed by Dan Bernstein.
1166
1167         Use correct enum style for a C SPI header and fix the callers.
1168
1169         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
1170         (WKBundlePageSetEventThrottlingBehaviorOverride):
1171         * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
1172
1173 2016-12-07  Beth Dakin  <bdakin@apple.com>
1174
1175         Remove iCloud Pages and Keynote site-specific hacks
1176         https://bugs.webkit.org/show_bug.cgi?id=165544
1177         -and corresponding-
1178         rdar://problem/29082536
1179
1180         Reviewed by Wenson Hsieh.
1181
1182         * WebProcess/WebPage/WebPage.cpp:
1183         (WebKit::needsHiddenContentEditableQuirk):
1184         (WebKit::needsPlainTextQuirk):
1185
1186 2016-12-05  Ada Chan  <adachan@apple.com>
1187
1188         Add a getter for serverTrust in _WKObservablePageState
1189         https://bugs.webkit.org/show_bug.cgi?id=165433
1190
1191         Reviewed by Anders Carlsson.
1192
1193         * UIProcess/API/C/mac/WKPagePrivateMac.h:
1194         * UIProcess/API/C/mac/WKPagePrivateMac.mm:
1195         (-[WKObservablePageState serverTrust]):
1196
1197 2016-12-07  Jer Noble  <jer.noble@apple.com>
1198
1199         Exiting Element Fullscreen mode loses focus on WKWebView.
1200         https://bugs.webkit.org/show_bug.cgi?id=165512
1201
1202         Reviewed by Eric Carlson.
1203
1204         Setting 'window.contentView.hidden = YES' will reset the first-responder (whereas
1205         previously setting 'window.contentView.layer.hidden = YES' did not). Grab the first-
1206         responder before doing so, so that it can be reset correctly when moving the WKWebView
1207         back to it's original window.
1208
1209         * UIProcess/mac/WKFullScreenWindowController.mm:
1210         (-[WKFullScreenWindowController finishedExitFullScreenAnimation:]):
1211
1212 2016-12-07  Alex Christensen  <achristensen@webkit.org>
1213
1214         Fix CMake build after r209418.
1215         https://bugs.webkit.org/show_bug.cgi?id=165484
1216
1217         * PlatformMac.cmake:
1218
1219 2016-12-07  Philippe Normand  <pnormand@igalia.com>
1220
1221         Unreviewed, GTK build fix after r209407.
1222
1223         * Platform/IPC/unix/ConnectionUnix.cpp:
1224         (IPC::Connection::processMessage):
1225         * UIProcess/LegacySessionStateCodingNone.cpp:
1226         (WebKit::decodeLegacySessionState):
1227
1228 2016-12-06  Ryan Haddad  <ryanhaddad@apple.com>
1229
1230         Unreviewed, rolling out r209422.
1231
1232         This change caused assertion failures during API tests.
1233
1234         Reverted changeset:
1235
1236         "[MediaStream][Mac] Revoke sandbox extensions when capture
1237         ends"
1238         https://bugs.webkit.org/show_bug.cgi?id=165476
1239         http://trac.webkit.org/changeset/209422
1240
1241 2016-12-06  Dean Jackson  <dino@apple.com>
1242
1243         Include default value in Experimental Feature information
1244         https://bugs.webkit.org/show_bug.cgi?id=165509
1245         <rdar://problems/29547177>
1246
1247         Reviewed by Tim Horton.
1248
1249         Add a defaultValue member variable to experimental
1250         features, both the C++ and ObjC interfaces.
1251
1252         * UIProcess/API/APIExperimentalFeature.cpp:
1253         (API::ExperimentalFeature::create):
1254         (API::ExperimentalFeature::ExperimentalFeature):
1255         * UIProcess/API/APIExperimentalFeature.h:
1256         * UIProcess/API/Cocoa/_WKExperimentalFeature.h:
1257         * UIProcess/API/Cocoa/_WKExperimentalFeature.mm:
1258         (-[_WKExperimentalFeature description]):
1259         (-[_WKExperimentalFeature defaultValue]):
1260         * UIProcess/WebPreferences.cpp:
1261         (WebKit::createExperimentalFeaturesVector):
1262
1263 2016-12-06  Commit Queue  <commit-queue@webkit.org>
1264
1265         Unreviewed, rolling out r209391.
1266         https://bugs.webkit.org/show_bug.cgi?id=165501
1267
1268         requires explicit nullptr checks so missing env vars don't
1269         flip AC mode (Requested by mcatanzaro on #webkit).
1270
1271         Reverted changeset:
1272
1273         "[GTK] Process accelerated compositing env variables only if
1274         they are really enabled"
1275         https://bugs.webkit.org/show_bug.cgi?id=165300
1276         http://trac.webkit.org/changeset/209391
1277
1278 2016-12-06  Alexey Proskuryakov  <ap@apple.com>
1279
1280         Correct SDKROOT values in xcconfig files
1281         https://bugs.webkit.org/show_bug.cgi?id=165487
1282         rdar://problem/29539209
1283
1284         Reviewed by Dan Bernstein.
1285
1286         Fix suggested by Dan Bernstein.
1287
1288         * Configurations/DebugRelease.xcconfig:
1289
1290 2016-12-06  Andreas Kling  <akling@apple.com>
1291
1292         [Cocoa] Add some memory usage related information to sysdiagnose state dumps
1293         <https://webkit.org/b/165375>
1294         <rdar://problem/29057243>
1295
1296         Reviewed by Darin Adler.
1297
1298         Follow-up to address two more review comments.
1299
1300         * WebProcess/cocoa/WebProcessCocoa.mm:
1301         (WebKit::WebProcess::registerWithStateDumper): Use adoptNS() instead of autorelease for NSStrings.
1302
1303 2016-12-06  Eric Carlson  <eric.carlson@apple.com>
1304
1305         [MediaStream][Mac] Revoke sandbox extensions when capture ends
1306         https://bugs.webkit.org/show_bug.cgi?id=165476
1307
1308         Reviewed by Brady Eidson.
1309         
1310         Track media capture by process so it is possible to revoke the sandbox extensions issued to
1311         a web process when capture stops.
1312
1313         * CMakeLists.txt: Add new files.
1314
1315         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
1316         (WebKit::UserMediaPermissionRequestManagerProxy::UserMediaPermissionRequestManagerProxy): Register
1317           with process manager.
1318         (WebKit::UserMediaPermissionRequestManagerProxy::~UserMediaPermissionRequestManagerProxy):
1319         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasGranted): Move sandbox 
1320           extension code to the process manager.
1321         (WebKit::UserMediaPermissionRequestManagerProxy::stopCapture): New.
1322         (WebKit::UserMediaPermissionRequestManagerProxy::startedCaptureSession): New, report state
1323           change to the process manager.
1324         (WebKit::UserMediaPermissionRequestManagerProxy::endedCaptureSession): Ditto.
1325         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
1326
1327         * UIProcess/UserMediaProcessManager.cpp: Added.
1328         (WebKit::ProcessState::ProcessState):
1329         (WebKit::ProcessState::managers):
1330         (WebKit::ProcessState::sandboxExtensionsGranted):
1331         (WebKit::ProcessState::setSandboxExtensionsGranted):
1332         (WebKit::stateMap):
1333         (WebKit::processState):
1334         (WebKit::ProcessState::addRequestManager):
1335         (WebKit::ProcessState::removeRequestManager):
1336         (WebKit::UserMediaProcessManager::singleton):
1337         (WebKit::UserMediaProcessManager::addUserMediaPermissionRequestManagerProxy):
1338         (WebKit::UserMediaProcessManager::removeUserMediaPermissionRequestManagerProxy):
1339         (WebKit::UserMediaProcessManager::willCreateMediaStream):
1340         (WebKit::UserMediaProcessManager::startedCaptureSession):
1341         (WebKit::UserMediaProcessManager::endedCaptureSession):
1342         * UIProcess/UserMediaProcessManager.h: Added.
1343
1344         * UIProcess/WebPageProxy.cpp:
1345         (WebKit::WebPageProxy::isPlayingMediaDidChange): Report capture state changes to the request
1346           manager proxy.
1347         * UIProcess/WebPageProxy.h:
1348
1349         * WebKit2.xcodeproj/project.pbxproj: Add new files.
1350
1351         * WebProcess/MediaStream/MediaDeviceSandboxExtensions.cpp: Added.
1352         (WebKit::MediaDeviceSandboxExtensions::MediaDeviceSandboxExtensions):
1353         (WebKit::MediaDeviceSandboxExtensions::encode):
1354         (WebKit::MediaDeviceSandboxExtensions::decode):
1355         (WebKit::MediaDeviceSandboxExtensions::operator[]):
1356         (WebKit::MediaDeviceSandboxExtensions::size):
1357         * WebProcess/MediaStream/MediaDeviceSandboxExtensions.h: Added.
1358
1359         * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
1360         (WebKit::UserMediaPermissionRequestManager::~UserMediaPermissionRequestManager): Sandbox extension
1361           is now in a HashMap, not a Vector.
1362         (WebKit::UserMediaPermissionRequestManager::grantUserMediaDeviceSandboxExtensions): Record
1363           IDs with extensions so they can be revoked later.
1364         (WebKit::UserMediaPermissionRequestManager::revokeUserMediaDeviceSandboxExtensions): New.
1365         (WebKit::UserMediaPermissionRequestManager::grantUserMediaDevicesSandboxExtension): Deleted.
1366         * WebProcess/MediaStream/UserMediaPermissionRequestManager.h:
1367
1368         * WebProcess/WebPage/WebPage.cpp:
1369         (WebKit::WebPage::grantUserMediaDeviceSandboxExtensions):
1370         (WebKit::WebPage::revokeUserMediaDeviceSandboxExtensions):
1371         (WebKit::WebPage::grantUserMediaDevicesSandboxExtension): Deleted.
1372         * WebProcess/WebPage/WebPage.h:
1373         * WebProcess/WebPage/WebPage.messages.in:
1374
1375 2016-12-06  Anders Carlsson  <andersca@apple.com>
1376
1377         Add a new MachMessage class and use it for sending outgoing messages
1378         https://bugs.webkit.org/show_bug.cgi?id=165484
1379
1380         Reviewed by Sam Weinig.
1381
1382         * Platform/IPC/mac/ConnectionMac.mm:
1383         (IPC::Connection::sendOutgoingMessage):
1384         Instead of trying to randomly use memory from the stack as well as using mmap for the message data for out of line messages
1385         (which makes no sense at all, since the body data is already mmapped), just always create a MachMessage object and use it.
1386         
1387         (IPC::machMessageSize): Deleted.
1388         This has been moved to MachMessage::messageSize().
1389         
1390         * Platform/IPC/mac/MachMessage.cpp: Added.
1391         (IPC::MachMessage::create):
1392         Allocate extra memory to store the actual buffer.
1393
1394         (IPC::MachMessage::MachMessage):
1395         Initialize variables. m_size isn't really used right now, but will be in a subsequent patch.
1396
1397         (IPC::MachMessage::header):
1398         Return the header.
1399         
1400         * Platform/IPC/mac/MachMessage.h: Added.
1401         (IPC::MachMessage::length):
1402
1403         * WebKit2.xcodeproj/project.pbxproj:
1404         Add new files.
1405
1406 2016-12-06  Simon Fraser  <simon.fraser@apple.com>
1407
1408         Enable visual viewports by default on Mac, and iOS Wk2
1409         https://bugs.webkit.org/show_bug.cgi?id=165452
1410
1411         Reviewed by Zalan Bujtas.
1412
1413         Turn visual viewports on by default for WK2.
1414
1415         * Shared/WebPreferencesDefinitions.h:
1416
1417 2016-12-06  Daniel Bates  <dabates@apple.com>
1418
1419         WebKitTestRunner: Plugins are disabled in new windows
1420         https://bugs.webkit.org/show_bug.cgi?id=165410
1421
1422         Reviewed by Alex Christensen.
1423
1424         Remove SPI exposed to explicitly toggle plugins from WebKitTestRunner.
1425         Instead we will update WebKitTestRunner to make use of the SPI
1426         WKBundleOverrideBoolPreferenceForTestRunner() to toggle plugins in
1427         all windows.
1428
1429         * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
1430         (WKBundleSetPluginsEnabled): Deleted.
1431         * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h:
1432         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1433         (WebKit::InjectedBundle::setPluginsEnabled): Deleted.
1434
1435 2016-12-05  Anders Carlsson  <andersca@apple.com>
1436
1437         Don't memcpy out of line data
1438         https://bugs.webkit.org/show_bug.cgi?id=165434
1439
1440         Reviewed by Sam Weinig.
1441
1442         Change the Decoder constructor to take a buffer deallocator parameter. If the buffer deallocator is null, the
1443         data will be copied as before. Otherwise, the memory will be adopted by the Decoder object, and will be deallocated
1444         by invoking the data deallocator.
1445
1446         * Platform/IPC/Decoder.cpp:
1447         (IPC::copyBuffer):
1448         Add a new helper.
1449
1450         (IPC::Decoder::Decoder):
1451         Copy the buffer if the deallocator is null.
1452
1453         (IPC::Decoder::~Decoder):
1454         Invoke the deallocator or call fastFree if it is null.
1455
1456         (IPC::Decoder::unwrapForTesting):
1457         Update constructor.
1458         
1459         (IPC::roundUpToAlignment):
1460         (IPC::Decoder::alignBufferPosition):
1461         (IPC::Decoder::decodeVariableLengthByteArray):
1462         (IPC::decodeValueFromBuffer):
1463         Change all these to deal with const pointers.
1464
1465         * Platform/IPC/Decoder.h:
1466         Add new members.
1467
1468         * Platform/IPC/mac/ConnectionMac.mm:
1469         (IPC::createMessageDecoder):
1470         When we have out of line data, pass a deallocator that calls vm_deallocate, instead of copying the data
1471         and then immediately throwing the original away.
1472
1473 2016-12-06  Tim Horton  <timothy_horton@apple.com>
1474
1475         Almost half-second stall scrolling apple.com because of synchronous getPositionInformation
1476         https://bugs.webkit.org/show_bug.cgi?id=165403
1477         <rdar://problem/29493285>
1478
1479         Reviewed by Enrica Casucci.
1480
1481         When retrieving interaction information, we don't always need to do
1482         snapshots for 3D Touch or the action sheet, especially if we're
1483         synchronously blocking the UI process main thread waiting for the reply.
1484
1485         Add a new InteractionInformationRequest, which allows callers of
1486         getPositionInformation and requestPositionInformation to specify which
1487         optional pieces of information they would like to compute.
1488
1489         * Shared/AssistedNodeInformation.h:
1490         Fix a incorrect comment.
1491
1492         * Shared/ios/InteractionInformationRequest.cpp: Added.
1493         (WebKit::InteractionInformationRequest::encode):
1494         (WebKit::InteractionInformationRequest::decode):
1495         (WebKit::InteractionInformationRequest::isValidForRequest):
1496         * Shared/ios/InteractionInformationRequest.h: Added.
1497         (WebKit::InteractionInformationRequest::InteractionInformationRequest):
1498         * WebKit2.xcodeproj/project.pbxproj:
1499         Add InteractionInformationRequest, which encapsulates all of the
1500         parameters required to generate an InteractionInformationAtPosition.
1501         Previously, that was just a point, but now we have two new parameters:
1502         whether we should generate a snapshot of the element, and whether
1503         we should generate a TextIndicator if the element is a link.
1504
1505         * Shared/ios/InteractionInformationAtPosition.h:
1506         * Shared/ios/InteractionInformationAtPosition.mm:
1507         (WebKit::InteractionInformationAtPosition::encode):
1508         (WebKit::InteractionInformationAtPosition::decode):
1509         (WebKit::InteractionInformationAtPosition::mergeCompatibleOptionalInformation):
1510         Adopt InteractionInformationRequest.
1511
1512         * UIProcess/WebPageProxy.h:
1513         * UIProcess/ios/WebPageProxyIOS.mm:
1514         (WebKit::WebPageProxy::getPositionInformation):
1515         (WebKit::WebPageProxy::requestPositionInformation):
1516         * UIProcess/ios/WKActionSheetAssistant.mm:
1517         (-[WKActionSheetAssistant initialPresentationRectInHostViewForSheet]):
1518         (-[WKActionSheetAssistant presentationRectInHostViewForSheet]):
1519         (-[WKActionSheetAssistant showImageSheet]):
1520         (-[WKActionSheetAssistant showLinkSheet]):
1521         * UIProcess/ios/WKPDFView.mm:
1522         (-[WKPDFView annotation:isBeingPressedAtPoint:controller:]):
1523         * WebProcess/WebPage/WebPage.h:
1524         * WebProcess/WebPage/WebPage.messages.in:
1525         Adopt InteractionInformationRequest.
1526         
1527         * UIProcess/ios/WKContentViewInteraction.h:
1528         * UIProcess/ios/WKContentViewInteraction.mm:
1529         (-[WKContentView _showAttachmentSheet]):
1530         (-[WKContentView ensurePositionInformationIsUpToDate:]):
1531         If we have a outstanding asynchronous position information request
1532         for the current point, instead of sending a second separate request,
1533         just wait for the async one to come in.
1534
1535         (-[WKContentView requestAsynchronousPositionInformationUpdate:]):
1536         If asked to do an asynchronous request with more optional bits than
1537         the current otherwise-valid response's request, update the position information.
1538
1539         (-[WKContentView gestureRecognizerShouldBegin:]):
1540         The design of this mechanism is that during the highlight long press,
1541         we do an async position information update, and then when we actually
1542         begin a 3D Touch gesture, we hope to already have the requisite snapshots
1543         ready (so that we can avoid synchronously blocking for them, there).
1544         So, in the highlight long-press async request, ask for all the goodies.
1545
1546         (-[WKContentView hasSelectablePositionAtPoint:]):
1547         (-[WKContentView pointIsNearMarkedText:]):
1548         (-[WKContentView pointIsInAssistedNode:]):
1549         (-[WKContentView _didNotHandleTapAsClick:]):
1550         (-[WKContentView _positionInformationDidChange:]):
1551         If we get a position information update for the same point, but with less
1552         goodies attached (the snapshot/link indicator), copy them over from the old
1553         position information, so that we never accidentally "downgrade" our info.
1554
1555         (-[WKContentView updatePositionInformationForActionSheetAssistant:]):
1556         (-[WKContentView actionSheetAssistant:willStartInteractionWithElement:]):
1557         (-[WKContentView _interactionShouldBeginFromPreviewItemController:forPosition:]):
1558         (-[WKContentView _dataForPreviewItemController:atPosition:type:]):
1559         (-[WKContentView _presentedViewControllerForPreviewItemController:]):        
1560         More adoption.
1561         
1562         * WebProcess/WebPage/ios/WebPageIOS.mm:
1563         (WebKit::WebPage::handleTap):
1564         (WebKit::WebPage::handleTwoFingerTapAtPoint):
1565         (WebKit::WebPage::commitPotentialTap):
1566         Adopt InteractionInformationRequest.
1567
1568         (WebKit::WebPage::getPositionInformation):
1569         (WebKit::WebPage::requestPositionInformation):
1570         Copy the request into the response.
1571         Only snapshot if the request wants a snapshot.
1572         Only make a link indicator if the request wants one.
1573
1574 2016-12-06  Daniel Bates  <dabates@apple.com>
1575
1576         Cleanup: Rename some HTTP 0.9-specific functions to conform to WebKit Code Style Guidelines
1577         https://bugs.webkit.org/show_bug.cgi?id=165451
1578
1579         Reviewed by Alex Christensen.
1580
1581         * NetworkProcess/NetworkDataTask.cpp:
1582         (WebKit::NetworkDataTask::didReceiveResponse):
1583
1584 2016-12-06  Daniel Bates  <dabates@apple.com>
1585
1586         Remove unused InjectedBundle::overrideXSSAuditorEnabledForTestRunner()
1587         https://bugs.webkit.org/show_bug.cgi?id=165408
1588
1589         Reviewed by Alex Christensen.
1590
1591         InjectedBundle::overrideXSSAuditorEnabledForTestRunner() is unused. This function was only
1592         called by WKBundleOverrideXSSAuditorEnabledForTestRunner(), which was removed in r106005.
1593
1594         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1595         (WebKit::InjectedBundle::overrideXSSAuditorEnabledForTestRunner): Deleted.
1596         * WebProcess/InjectedBundle/InjectedBundle.h:
1597
1598 2016-12-04  Darin Adler  <darin@apple.com>
1599
1600         Use ASCIICType more, and improve it a little bit
1601         https://bugs.webkit.org/show_bug.cgi?id=165360
1602
1603         Reviewed by Sam Weinig.
1604
1605         * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
1606         (WebKit::capitalizeRFC822HeaderFieldName): Removed unneeded checks to simplify code.
1607
1608 2016-12-06  Dave Hyatt  <hyatt@apple.com>
1609
1610         [CSS Parser] Turn on the new CSS parser
1611         https://bugs.webkit.org/show_bug.cgi?id=165213
1612
1613         Reviewed by Zalan Bujtas.
1614
1615         * Shared/WebPreferencesDefinitions.h:
1616
1617 2016-12-06  Tomas Popela  <tpopela@redhat.com>
1618
1619         [GTK] Process accelerated compositing env variables only if they are really enabled
1620         https://bugs.webkit.org/show_bug.cgi?id=165300
1621
1622         Don't process the WEBKIT_FORCE_COMPOSITING_MODE and
1623         WEBKIT_DISABLE_COMPOSITING_MODE env variables if they are disabled
1624         (eg. WEBKIT_DISABLE_COMPOSITING_MODE=0).
1625
1626         Reviewed by Michael Catanzaro.
1627
1628         * UIProcess/gtk/WebPreferencesGtk.cpp:
1629         (WebKit::WebPreferences::platformInitializeStore):
1630
1631 2016-12-06  Sam Weinig  <sam@webkit.org>
1632
1633         [WebIDL] Add support for converting dictionaries to JS
1634         https://bugs.webkit.org/show_bug.cgi?id=165367
1635
1636         Reviewed by Darin Adler and Alex Christensen.
1637
1638         * CMakeLists.txt:
1639         Add missing directories to look in for headers.
1640
1641 2016-12-05  Tim Horton  <timothy_horton@apple.com>
1642
1643         Try to fix the iOS Simulator build.
1644
1645         * UIProcess/mac/RemoteLayerTreeHost.mm:
1646         (WebKit::RemoteLayerTreeHost::mapAllIOSurfaceBackingStore):
1647
1648 2016-12-03  Simon Fraser  <simon.fraser@apple.com>
1649
1650         Minor reformat and renames in -didUpdateVisibleRect:
1651         https://bugs.webkit.org/show_bug.cgi?id=165365
1652
1653         Reviewed by Dave Hyatt.
1654         
1655         didUpdateVisibleRect:... has lots of parameters. Put one on each line.
1656
1657         Rename the rects to make it clear they are "content" rects (i.e. in document coordinates).
1658
1659         * UIProcess/ios/WKContentView.h:
1660         * UIProcess/ios/WKContentView.mm:
1661         (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInset:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]):
1662
1663 2016-12-05  Tim Horton  <timothy_horton@apple.com>
1664
1665         Adopt CAMachPort-as-layer-contents
1666         https://bugs.webkit.org/show_bug.cgi?id=141687
1667         <rdar://problem/19393233>
1668
1669         Reviewed by Darin Adler.
1670
1671         * Shared/mac/RemoteLayerBackingStore.h:
1672         * Shared/mac/RemoteLayerBackingStore.mm:
1673         (WebKit::RemoteLayerBackingStore::decode):
1674         On the UI process side, instead of actually looking up the surface,
1675         just keep the MachSendRight around, to later be turned into a CAMachPort.
1676
1677         (WebKit::RemoteLayerBackingStore::applyBackingStoreToLayer):
1678         Make a CAMachPort and leak our send right into it. CAMachPort
1679         will adopt the port and destroy it when needed.
1680
1681         (WebKit::RemoteLayerBackingStore::setBufferVolatility):
1682         Tiny style fix.
1683
1684         * Shared/mac/RemoteLayerTreePropertyApplier.h:
1685         * Shared/mac/RemoteLayerTreePropertyApplier.mm:
1686         (WebKit::applyPropertiesToLayer):
1687         (WebKit::RemoteLayerTreePropertyApplier::applyProperties):
1688         * UIProcess/DrawingAreaProxy.h:
1689         (WebKit::DrawingAreaProxy::prepareForAppSuspension):
1690         * UIProcess/ios/WebPageProxyIOS.mm:
1691         (WebKit::WebPageProxy::applicationDidFinishSnapshottingAfterEnteringBackground):
1692         * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h:
1693         * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
1694         (WebKit::RemoteLayerTreeDrawingAreaProxy::prepareForAppSuspension):
1695         * UIProcess/mac/RemoteLayerTreeHost.h:
1696         * UIProcess/mac/RemoteLayerTreeHost.mm:
1697         (WebKit::RemoteLayerTreeHost::updateLayerTree):
1698         (WebKit::RemoteLayerTreeHost::mapAllIOSurfaceBackingStore):
1699         * WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
1700         (WebKit::PlatformCALayerRemote::recursiveBuildTransaction):
1701         Two supporting changes in order to fix the two regressions that this
1702         caused when we tried to land it two years ago:
1703
1704         When an app is being suspended, resolve all CAMachPort backing store
1705         into actual IOSurfaces. Otherwise, any live CAMachPorts will keep a
1706         +1 on their respective IOSurface's use count, causing us to fail to
1707         mark them volatile, keeping the app alive for more time (re-trying the
1708         volatility change), and increasing the likelihood of background jetsam.
1709
1710         If the debugging tile map is enabled, do not use CAMachPort, because
1711         we don't have a great way to plumb the same CAMachPort to two layers
1712         (and it doesn't seem to work even if you do). Instead, just map the
1713         IOSurface into the UI process like we used to.
1714
1715 2016-12-05  Dean Jackson  <dino@apple.com>
1716
1717         pointer lock needs to be feature detectable
1718         https://bugs.webkit.org/show_bug.cgi?id=165426
1719         <rdar://problem/29486715>
1720
1721         Reviewed by Antoine Quint.
1722
1723         Set the RuntimeEnabledFeature as preferences
1724         change.
1725
1726         * UIProcess/API/C/WKPreferences.cpp:
1727         (WKPreferencesSetPointerLockEnabled):
1728         (WKPreferencesGetPointerLockEnabled):
1729         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1730         * WebProcess/WebPage/WebPage.cpp:
1731         (WebKit::WebPage::updatePreferences):
1732
1733 2016-12-05  Andreas Kling  <akling@apple.com>
1734
1735         [Cocoa] Add some memory usage related information to sysdiagnose state dumps
1736         <https://webkit.org/b/165375>
1737         <rdar://problem/29057243>
1738
1739         Reviewed by Darin Adler.
1740
1741         Add two new entries to the sysdiagnose state dumps for WebContent processes:
1742         "Memory Usage Stats" and "JavaScript Object Counts".
1743
1744         The first category contains all the interesting stuff from task_info()
1745         along with some WebCore and JavaScriptCore object/memory counters.
1746
1747         The second category contains a list of all the JS object types currently live
1748         on the heap, along with a count.
1749
1750         * WebProcess/cocoa/WebProcessCocoa.mm:
1751         (WebKit::WebProcess::registerWithStateDumper): Add two new entries to the
1752         state dictionary: "Memory Usage Stats" and "JavaScript Object Counts".
1753
1754 2016-12-05  Csaba Osztrogonác  <ossy@webkit.org>
1755
1756         Unreviewed cmake buildfix after r209307.
1757
1758         * PlatformMac.cmake:
1759
1760 2016-12-03  Dan Bernstein  <mitz@apple.com>
1761
1762         [Cocoa] Expose InjectedBundlePageEditorClient via the Objective-C bundle SPI
1763         https://bugs.webkit.org/show_bug.cgi?id=165276
1764         <rdar://problem/29467040>
1765
1766         Reviewed by Darin Adler.
1767
1768         Test: TestWebKitAPI/Tests/WebKit2Cocoa/BundleEditingDelegate.mm
1769
1770         * Shared/Cocoa/APIObject.mm:
1771         (API::Object::newObject): Wrap InjectedBundleRangeHandle in WKWebProcessPlugInRangeHandle.
1772
1773         * WebKit2.xcodeproj/project.pbxproj: Added references to new files, making
1774           WKWebProcessPlugInEditingDelegate.h and WKWebProcessPlugInRangeHandle.h private headers.
1775
1776         * WebProcess/InjectedBundle/API/APIInjectedBundleEditorClient.h: Added. An base class
1777           based on InjectedBundlePageEditorClient.
1778         (API::InjectedBundle::EditorClient::~EditorClient):
1779         (API::InjectedBundle::EditorClient::shouldBeginEditing):
1780         (API::InjectedBundle::EditorClient::shouldEndEditing):
1781         (API::InjectedBundle::EditorClient::shouldInsertNode):
1782         (API::InjectedBundle::EditorClient::shouldInsertText):
1783         (API::InjectedBundle::EditorClient::shouldDeleteRange):
1784         (API::InjectedBundle::EditorClient::shouldChangeSelectedRange):
1785         (API::InjectedBundle::EditorClient::shouldApplyStyle):
1786         (API::InjectedBundle::EditorClient::didBeginEditing):
1787         (API::InjectedBundle::EditorClient::didEndEditing):
1788         (API::InjectedBundle::EditorClient::didChange):
1789         (API::InjectedBundle::EditorClient::didChangeSelection):
1790         (API::InjectedBundle::EditorClient::willWriteToPasteboard):
1791         (API::InjectedBundle::EditorClient::getPasteboardDataForRange):
1792         (API::InjectedBundle::EditorClient::didWriteToPasteboard):
1793
1794         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInEditingDelegate.h: Added. Declares
1795           the new delegate protocol, currently comprising three methods corresponding to
1796           willWriteToPasteboard, getPasteboardDataForRange, and didWriteToPasteboard.
1797
1798         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.h:
1799         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.mm:
1800         (-[WKWebProcessPlugInFrame jsRangeForRangeHandle:inWorld:]): Added. Gets the JS wrapper for
1801           the specified range handle.
1802
1803         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.h: Added.
1804         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.mm: Added.
1805         (-[WKWebProcessPlugInRangeHandle dealloc]): Call the InjectedBundleRangeHandle destructor.
1806         (+[WKWebProcessPlugInRangeHandle rangeHandleWithJSValue:inContext:]): Get or create an
1807           InjectedBundleRangeHandle for the specified object.
1808         (-[WKWebProcessPlugInRangeHandle frame]): Return the range’s owner document’s frame.
1809         (-[WKWebProcessPlugInRangeHandle _rangeHandle]): Return the InjectedBundleRangeHandle.
1810         (-[WKWebProcessPlugInRangeHandle _apiObject]): Ditto.
1811
1812         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandleInternal.h: Added.
1813         (WebKit::wrapper):
1814
1815         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
1816         (WKBundlePageSetEditorClient): Updated for WebPage change.
1817
1818         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
1819         (-[WKWebProcessPlugInBrowserContextController _editingDelegate]): Added. Returns the
1820           delegate.
1821         (-[WKWebProcessPlugInBrowserContextController _setEditingDelegate:]): Added. Defines a
1822           Client class, which derives from API::InjectedBundle::EditorClient, and invokes the
1823           delegate methods. Instantiates a Client and sets it on the WebPage.
1824
1825         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextControllerPrivate.h:
1826           Declared new _editingDelegate property.
1827
1828         * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
1829         (WebKit::InjectedBundleRangeHandle::document): Added. Returns an InjectedBundleNodeHandle
1830           for the range’s owner document.
1831         * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.h:
1832
1833         * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp:
1834         (WebKit::InjectedBundlePageEditorClient::InjectedBundlePageEditorClient): Added. Calls
1835           initialize().
1836         (WebKit::InjectedBundlePageEditorClient::shouldBeginEditing): Updated for type change.
1837         (WebKit::InjectedBundlePageEditorClient::shouldEndEditing): Ditto.
1838         (WebKit::InjectedBundlePageEditorClient::shouldInsertNode): Ditto.
1839         (WebKit::InjectedBundlePageEditorClient::shouldInsertText): Ditto.
1840         (WebKit::InjectedBundlePageEditorClient::shouldDeleteRange): Ditto.
1841         (WebKit::InjectedBundlePageEditorClient::shouldChangeSelectedRange): Ditto.
1842         (WebKit::InjectedBundlePageEditorClient::shouldApplyStyle): Ditto.
1843         (WebKit::InjectedBundlePageEditorClient::didBeginEditing): Ditto.
1844         (WebKit::InjectedBundlePageEditorClient::didEndEditing): Ditto.
1845         (WebKit::InjectedBundlePageEditorClient::didChange): Ditto.
1846         (WebKit::InjectedBundlePageEditorClient::didChangeSelection): Ditto.
1847         (WebKit::InjectedBundlePageEditorClient::willWriteToPasteboard): Ditto.
1848         (WebKit::InjectedBundlePageEditorClient::getPasteboardDataForRange): Ditto.
1849         (WebKit::InjectedBundlePageEditorClient::didWriteToPasteboard): Ditto.
1850         * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h: Now derives from
1851           API::InjectedBundle::EditorClient.
1852
1853         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
1854         (WebKit::WebEditorClient::shouldDeleteRange): Ditto.
1855         (WebKit::WebEditorClient::shouldBeginEditing): Ditto.
1856         (WebKit::WebEditorClient::shouldEndEditing): Ditto.
1857         (WebKit::WebEditorClient::shouldInsertNode): Ditto.
1858         (WebKit::WebEditorClient::shouldInsertText): Ditto.
1859         (WebKit::WebEditorClient::shouldChangeSelectedRange): Ditto.
1860         (WebKit::WebEditorClient::shouldApplyStyle): Ditto.
1861         (WebKit::WebEditorClient::didBeginEditing): Ditto.
1862         (WebKit::WebEditorClient::respondToChangedContents): Ditto.
1863         (WebKit::WebEditorClient::respondToChangedSelection): Ditto.
1864         (WebKit::WebEditorClient::didEndEditing): Ditto.
1865         (WebKit::WebEditorClient::didWriteSelectionToPasteboard): Ditto.
1866         (WebKit::WebEditorClient::willWriteSelectionToPasteboard): Ditto.
1867         (WebKit::WebEditorClient::getClientPasteboardDataForRange): Ditto.
1868
1869         * WebProcess/WebPage/WebPage.cpp:
1870         (WebKit::WebPage::WebPage): Initialize m_editorClient.
1871         (WebKit::WebPage::setInjectedBundleEditorClient): Replaces
1872           initializeInjectedBundleEditorClient and just sets m_editorClient.
1873         (WebKit::WebPage::close): Resets m_editorClient.
1874
1875         * WebProcess/WebPage/WebPage.h: Changed m_editorClient to a unique_ptr.
1876
1877 2016-12-02  Said Abou-Hallawa  <sabouhallawa@apple.com>
1878
1879         [iOS] Add a WebView private configuration for changing the WebContent update frequency
1880         https://bugs.webkit.org/show_bug.cgi?id=165289
1881         <rdar://problem/29472577>
1882
1883         Reviewed by Tim Horton.
1884         
1885         Expose a preference which allows us to control the fps of web content updates.
1886
1887         * UIProcess/API/APIPageConfiguration.h:
1888         (API::PageConfiguration::contentUpdateFrequency):
1889         (API::PageConfiguration::setContentUpdateFrequency):
1890         * UIProcess/API/Cocoa/WKWebView.mm:
1891         (-[WKWebView _initializeWithConfiguration:]):
1892         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
1893         (-[WKWebViewConfiguration copyWithZone:]):
1894         (-[WKWebViewConfiguration _contentUpdateFrequency]):
1895         (-[WKWebViewConfiguration _setContentUpdateFrequency:]):
1896         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
1897         * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h:
1898         * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
1899         (-[WKOneShotDisplayLinkHandler initWithDrawingAreaProxy:]):
1900         (WebKit::RemoteLayerTreeDrawingAreaProxy::contentUpdateFrequency):
1901
1902 2016-12-02  Andy Estes  <aestes@apple.com>
1903
1904         [Cocoa] Adopt the PRODUCT_BUNDLE_IDENTIFIER build setting
1905         https://bugs.webkit.org/show_bug.cgi?id=164492
1906
1907         Reviewed by Dan Bernstein.
1908
1909         * Configurations/DatabaseService.xcconfig: Set PRODUCT_BUNDLE_IDENTIFIER to
1910         $(PRODUCT_NAME).
1911         * Configurations/NetworkService.xcconfig: Ditto.
1912         * Configurations/PluginService.32.xcconfig: Ditto.
1913         * Configurations/PluginService.64.xcconfig: Ditto.
1914         * Configurations/WebContentService.xcconfig: Ditto.
1915         * Configurations/WebKit.xcconfig: Set PRODUCT_BUNDLE_IDENTIFIER to
1916         com.apple.$(PRODUCT_NAME:rfc1034identifier).
1917         * DatabaseProcess/EntryPoint/mac/XPCService/DatabaseService/Info.plist: Changed
1918         CFBundleIdentifier's value from ${PRODUCT_NAME} to ${PRODUCT_BUNDLE_IDENTIFIER}.
1919         * Info.plist: Changed CFBundleIdentifier's value from com.apple.${PRODUCT_NAME} to
1920         ${PRODUCT_BUNDLE_IDENTIFIER}.
1921         * NetworkProcess/EntryPoint/mac/XPCService/NetworkService/Info-OSX-10.9-10.10.plist: Changed
1922         CFBundleIdentifier's value from ${PRODUCT_NAME} to ${PRODUCT_BUNDLE_IDENTIFIER}.
1923         * NetworkProcess/EntryPoint/mac/XPCService/NetworkService/Info-OSX.plist: Ditto.
1924         * NetworkProcess/EntryPoint/mac/XPCService/NetworkService/Info-iOS.plist: Ditto.
1925         * PluginProcess/EntryPoint/mac/XPCService/PluginService.32-64-10.9-10.10.Info.plist: Ditto.
1926         * PluginProcess/EntryPoint/mac/XPCService/PluginService.32-64.Info.plist: Ditto.
1927         * WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-OSX-10.9-10.10.plist: Ditto.
1928         * WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-OSX.plist: Ditto.
1929         * WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-iOS.plist: Ditto.
1930
1931 2016-12-02  Brent Fulgham  <bfulgham@apple.com>
1932
1933         [Mac] Update sandbox profiles to use modern syntax and avoid duplication
1934         https://bugs.webkit.org/show_bug.cgi?id=165332
1935         <rdar://problem/26898991>
1936
1937         Reviewed by Anders Carlsson.
1938
1939         Update the Mac sandbox profiles to reflect that modern Cocoa applications
1940         communicate with cfprefsd, rather than plists on disk (and have done so
1941         for the past several releases).
1942
1943         Get rid of some duplicated rules, as well as old compatibility rules that
1944         are never triggered under supported operating systems.
1945
1946         * DatabaseProcess/mac/com.apple.WebKit.Databases.sb.in:
1947         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
1948         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
1949         * WebProcess/com.apple.WebProcess.sb.in:
1950
1951 2016-12-02  Gustavo Sverzut Barbieri  <barbieri@profusion.mobi>
1952
1953         Fix build break when disabling some features.
1954         https://bugs.webkit.org/show_bug.cgi?id=165254
1955
1956         The EFL port was broken if SPELLCHECK was disabled or
1957         PLUGIN_ARCHITECTURE is not x11.
1958
1959         Reviewed by Michael Catanzaro.
1960
1961         * UIProcess/efl/TextCheckerEfl.cpp:
1962         (WebKit::TextChecker::checkTextOfParagraph):
1963         (WebKit::TextChecker::checkSpellingOfString):
1964         Fix UNUSED_PARAM() usage if SPELLCHECK is disabled.
1965         * UIProcess/efl/WebPageProxyEfl.cpp:
1966         Isolate methods within #if PLUGIN_ARCHITECTURE(X11).
1967
1968 2016-12-01  Jiewen Tan  <jiewen_tan@apple.com>
1969
1970         Add a runtime flag for SubtleCrypto
1971         https://bugs.webkit.org/show_bug.cgi?id=164982
1972
1973         Reviewed by Brent Fulgham.
1974
1975         * Shared/WebPreferencesDefinitions.h:
1976         * UIProcess/API/C/WKPreferences.cpp:
1977         (WKPreferencesSetSubtleCryptoEnabled):
1978         (WKPreferencesGetSubtleCryptoEnabled):
1979         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1980         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1981         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
1982         * WebProcess/WebPage/WebPage.cpp:
1983         (WebKit::WebPage::updatePreferences):
1984
1985 2016-12-01  Saam Barati  <sbarati@apple.com>
1986
1987         Rename CallFrame::callee() to CallFrame::jsCallee()
1988         https://bugs.webkit.org/show_bug.cgi?id=165293
1989
1990         Reviewed by Keith Miller.
1991
1992         * WebProcess/Plugins/Netscape/JSNPMethod.cpp:
1993         (WebKit::callMethod):
1994         * WebProcess/Plugins/Netscape/JSNPObject.cpp:
1995         (WebKit::callNPJSObject):
1996         (WebKit::constructWithConstructor):
1997
1998 2016-12-01  Chris Dumez  <cdumez@apple.com>
1999
2000         [iOS][WK2] Tapping an element generates a 'click' event that has 0 as timeStamp
2001         https://bugs.webkit.org/show_bug.cgi?id=165270
2002         <rdar://problem/29224355>
2003
2004         Reviewed by Simon Fraser.
2005
2006         Tapping an element generates a 'click' event that has 0 as timeStamp
2007         instead of having a proper timeStamp value. This is breaking some
2008         sites.
2009
2010         * WebProcess/WebPage/ios/WebPageIOS.mm:
2011         (WebKit::WebPage::handleSyntheticClick):
2012         (WebKit::WebPage::completeSyntheticClick):
2013
2014 2016-12-01  Tim Horton  <timothy_horton@apple.com>
2015
2016         Try to fix the EFL/Gtk build
2017
2018         * UIProcess/efl/WebProcessPoolEfl.cpp:
2019         (WebKit::WebProcessPool::platformResolvePathsForSandboxExtensions):
2020         * UIProcess/gtk/WebProcessPoolGtk.cpp:
2021         (WebKit::WebProcessPool::platformResolvePathsForSandboxExtensions):
2022
2023 2016-12-01  Tim Horton  <timothy_horton@apple.com>
2024
2025         Every WKWebView initialization spends a few milliseconds hitting the disk
2026         https://bugs.webkit.org/show_bug.cgi?id=165268
2027         <rdar://problem/29010113>
2028
2029         Reviewed by Brady Eidson.
2030
2031         Every WKWebView init currently involves doing directory creation and
2032         symlink resolution for a number of paths (to create sandbox extensions
2033         for all of our storage directories), which means touching the disk a
2034         lot during init. All of these paths are immutable per-WebProcessPool,
2035         so, instead, cache them on WebProcessPool and create sandbox extensions
2036         from the already-resolved paths. This is a sizable (~4x) speedup when
2037         initializing subsequent web views.
2038
2039         * Shared/SandboxExtension.h:
2040         (WebKit::SandboxExtension::createHandleWithoutResolvingPath):
2041         Add createHandleWithoutResolvingPath, which makes a sandbox extension
2042         handle without doing symlink resolution.
2043
2044         (WebKit::resolvePathForSandboxExtension):
2045         (WebKit::resolveAndCreateReadWriteDirectoryForSandboxExtension):
2046         Add two functions that do the same resolution that SandboxExtension::createHandle
2047         and ::createHandleForReadWriteDirectory do, but just return the paths,
2048         for later use with createHandleWithoutResolvingPath.
2049
2050         * Shared/mac/SandboxExtensionMac.mm:
2051         (WebKit::resolveAndCreateReadWriteDirectoryForSandboxExtension):
2052         (WebKit::resolvePathForSandboxExtension):
2053         (WebKit::SandboxExtension::createHandleWithoutResolvingPath):
2054         (WebKit::SandboxExtension::createHandle):
2055         (WebKit::SandboxExtension::createHandleForReadWriteDirectory):
2056         Implement the aforementioned functions, and reimplement the existing
2057         createHandle{ForReadWriteDirectory} functions in terms of them.
2058
2059         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2060         (WebKit::WebProcessPool::platformDefaultIconDatabasePath):
2061         Stop wasting time generating and resolving a platform default icon
2062         database path, since we don't actually use it for anything anymore except
2063         to determine whether the icon database is enabled, and we only want to
2064         enable it if the client has provided a path.
2065
2066         (WebKit::WebProcessPool::platformResolvePathsForSandboxExtensions):
2067         (WebKit::WebProcessPool::platformInitializeWebProcess):
2068         * UIProcess/WebProcessPool.cpp:
2069         (WebKit::m_hiddenPageThrottlingTimer):
2070         (WebKit::WebProcessPool::resolvePathsForSandboxExtensions):
2071         (WebKit::WebProcessPool::createNewWebProcess):
2072         * UIProcess/WebProcessPool.h:
2073         Resolve paths in resolvePathsForSandboxExtensions, and use the resolved
2074         paths along with createHandleWithoutResolvingPath in order to effectively
2075         cache the resolution operation.
2076
2077 2016-12-01  Antti Koivisto  <antti@apple.com>
2078
2079         Revert r208931
2080         https://bugs.webkit.org/show_bug.cgi?id=164924
2081
2082         PLT regression.
2083
2084         * NetworkProcess/cache/NetworkCache.cpp:
2085         (WebKit::NetworkCache::makeCacheKey):
2086         (WebKit::NetworkCache::Cache::makeCacheKey): Deleted.
2087         * NetworkProcess/cache/NetworkCache.h:
2088         * NetworkProcess/cache/NetworkCacheBlobStorage.cpp:
2089         (WebKit::NetworkCache::BlobStorage::BlobStorage):
2090         (WebKit::NetworkCache::BlobStorage::add):
2091         (WebKit::NetworkCache::BlobStorage::get):
2092         * NetworkProcess/cache/NetworkCacheBlobStorage.h:
2093         * NetworkProcess/cache/NetworkCacheData.cpp:
2094         (WebKit::NetworkCache::computeSHA1):
2095         (WebKit::NetworkCache::makeSalt): Deleted.
2096         (WebKit::NetworkCache::readOrMakeSalt): Deleted.
2097         * NetworkProcess/cache/NetworkCacheData.h:
2098         * NetworkProcess/cache/NetworkCacheKey.cpp:
2099         (WebKit::NetworkCache::noPartitionString):
2100         (WebKit::NetworkCache::Key::Key):
2101         (WebKit::NetworkCache::Key::hasPartition):
2102         (WebKit::NetworkCache::Key::computeHash):
2103         (WebKit::NetworkCache::Key::hashAsString):
2104         (WebKit::NetworkCache::Key::computePartitionHash): Deleted.
2105         * NetworkProcess/cache/NetworkCacheKey.h:
2106         (WebKit::NetworkCache::Key::hash):
2107         (WebKit::NetworkCache::Key::partitionHash): Deleted.
2108         (WebKit::NetworkCache::Key::hashAsString): Deleted.
2109         (WebKit::NetworkCache::Key::partitionHashAsString): Deleted.
2110         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
2111         (WebKit::NetworkCache::makeSubresourcesKey):
2112         (WebKit::NetworkCache::constructRevalidationRequest):
2113         (WebKit::NetworkCache::SpeculativeLoadManager::PendingFrameLoad::saveToDiskIfReady):
2114         (WebKit::NetworkCache::SpeculativeLoadManager::retrieveSubresourcesEntry):
2115         * NetworkProcess/cache/NetworkCacheStorage.cpp:
2116         (WebKit::NetworkCache::Storage::open):
2117         (WebKit::NetworkCache::traverseRecordsFiles):
2118         (WebKit::NetworkCache::Storage::Storage):
2119         (WebKit::NetworkCache::Storage::recordDirectoryPathForKey):
2120         (WebKit::NetworkCache::decodeRecordHeader):
2121         (WebKit::NetworkCache::Storage::readRecord):
2122         (WebKit::NetworkCache::Storage::encodeRecord):
2123         (WebKit::NetworkCache::Storage::traverse):
2124         (WebKit::NetworkCache::makeSaltFilePath): Deleted.
2125         * NetworkProcess/cache/NetworkCacheStorage.h:
2126         (WebKit::NetworkCache::Storage::salt): Deleted.
2127
2128 2016-11-30  Sam Weinig  <sam@webkit.org>
2129
2130         [WebIDL] Remove custom bindings for File and Blob constructors
2131         https://bugs.webkit.org/show_bug.cgi?id=165218
2132
2133         Reviewed by Darin Adler.
2134
2135         * NetworkProcess/FileAPI/NetworkBlobRegistry.cpp:
2136         (WebKit::NetworkBlobRegistry::registerBlobURL):
2137         * NetworkProcess/FileAPI/NetworkBlobRegistry.h:
2138         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2139         (WebKit::NetworkConnectionToWebProcess::registerBlobURL):
2140         * NetworkProcess/NetworkConnectionToWebProcess.h:
2141         * WebProcess/FileAPI/BlobRegistryProxy.cpp:
2142         (WebKit::BlobRegistryProxy::registerBlobURL):
2143         * WebProcess/FileAPI/BlobRegistryProxy.h:
2144         Avoid copies of the BlobPart Vector.
2145
2146 2016-11-30  Carlos Garcia Campos  <cgarcia@igalia.com>
2147
2148         [GTK] UI process crash in WebKit::WaylandCompositor::Surface::prepareTextureForPainting
2149         https://bugs.webkit.org/show_bug.cgi?id=164911
2150
2151         Reviewed by Michael Catanzaro.
2152
2153         The problem is that m_buffer is nullptr in Surface::prepareTextureForPainting() even though we have already an
2154         image. We only use the buffer to get the image size, so we could save the image size when the image is created,
2155         and then we don't need to care about the buffer anymore.
2156
2157         * UIProcess/gtk/WaylandCompositor.cpp:
2158         (WebKit::WaylandCompositor::Surface::prepareTextureForPainting):
2159         (WebKit::WaylandCompositor::Surface::commit):
2160         * UIProcess/gtk/WaylandCompositor.h:
2161
2162 2016-11-30  Antoine Quint  <graouts@apple.com>
2163
2164         [Modern Media Controls] Add an HTML comment flag to turn the feature on
2165         https://bugs.webkit.org/show_bug.cgi?id=165226
2166
2167         Reviewed by Dean Jackson.
2168
2169         Add new methods to set the Modern Media Controls preference.
2170
2171         * UIProcess/API/C/WKPreferences.cpp:
2172         (WKPreferencesSetModernMediaControlsEnabled):
2173         (WKPreferencesGetModernMediaControlsEnabled):
2174         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2175
2176 2016-11-30  Said Abou-Hallawa  <sabouhallawa@apple.com>
2177
2178         Add separate settings and preferences to enable/disable async decoding for large images and animated images
2179         https://bugs.webkit.org/show_bug.cgi?id=165177
2180
2181         Reviewed by Simon Fraser.
2182         
2183         Hook up the async image decoding settings for WebKit2.
2184
2185         * Shared/WebPreferencesDefinitions.h:
2186         * UIProcess/API/Cocoa/WKPreferences.mm:
2187         (-[WKPreferences _largeImageAsyncDecodingEnabled]):
2188         (-[WKPreferences _setLargeImageAsyncDecodingEnabled:]):
2189         (-[WKPreferences _animatedImageAsyncDecodingEnabled]):
2190         (-[WKPreferences _setAnimatedImageAsyncDecodingEnabled:]):
2191         (-[WKPreferences _asyncImageDecodingEnabled]): Deleted.
2192         (-[WKPreferences _setAsyncImageDecodingEnabled:]): Deleted.
2193         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
2194         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2195         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
2196         * WebProcess/WebPage/WebPage.cpp:
2197         (WebKit::WebPage::updatePreferences):
2198
2199 2016-11-30  Chris Dumez  <cdumez@apple.com>
2200
2201         [iOS][WK2] Turn on HTML interactive form validation feature
2202         https://bugs.webkit.org/show_bug.cgi?id=165212
2203         <rdar://problem/29444356>
2204
2205         Reviewed by Simon Fraser.
2206
2207         Turn on HTML interactive form validation feature on iOS WK2
2208         now that we have a native UI.
2209
2210         * Shared/WebPreferencesDefinitions.h:
2211
2212 2016-11-30  Brent Fulgham  <bfulgham@apple.com>
2213
2214         Correct plugin sandbox after r208611
2215         https://bugs.webkit.org/show_bug.cgi?id=165187
2216         <rdar://problem/29431165>
2217
2218         Reviewed by Alex Christensen.
2219
2220         In r208611 I removed the 'else' clause of a Scheme conditional
2221         that was needed to properly run plugins (such as Flash Player).
2222
2223         This change retains the relevant current sandbox content, while
2224         still stripping out the old code that is no longer needed.
2225
2226         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
2227
2228 2016-11-29  Carlos Garcia Campos  <cgarcia@igalia.com>
2229
2230         [GTK] Database process should not initialize gtk
2231         https://bugs.webkit.org/show_bug.cgi?id=165138
2232
2233         Reviewed by Sergio Villar Senin.
2234
2235         It doesn't use GTK+ at all.
2236
2237         * DatabaseProcess/gtk/DatabaseProcessMainGtk.cpp:
2238         (WebKit::DatabaseProcessMainUnix):
2239         (): Deleted.
2240
2241 2016-11-29  Gavin Barraclough  <barraclough@apple.com>
2242
2243         Remove WebPage::SetPageSuppressed
2244         https://bugs.webkit.org/show_bug.cgi?id=165158
2245
2246         Unreviewed revert accidental change.
2247
2248         * WebProcess/WebPage/WebPage.cpp:
2249         (WebKit::WebPage::setActivityState):
2250
2251 2016-11-29  Gavin Barraclough  <barraclough@apple.com>
2252
2253         Remove WebPage::SetPageSuppressed
2254         https://bugs.webkit.org/show_bug.cgi?id=165158
2255
2256         Reviewed by Tim Horton.
2257
2258         This was scaffolding. We've now refactored to the point that the information driving throttling originates
2259         from the UI process (so UI and web processes can have a consistent view of what should throttle), but we
2260         don't need a separate message to handle this - necessary state to determine is provided in ActivityState.
2261
2262         * UIProcess/WebPageProxy.cpp:
2263         (WebKit::WebPageProxy::updateThrottleState):
2264             - used to send SetPageSuppressed; no longer does.
2265         * UIProcess/WebPageProxy.h:
2266             - removed m_pageSuppressed (was used to avoid duplicated messages).
2267         * WebProcess/WebPage/WebPage.cpp:
2268         (WebKit::WebPage::updateThrottleState):
2269             - compute throttle state based on m_activityState.
2270         (WebKit::WebPage::setActivityState):
2271             - update throttle state whenever activity state changes.
2272         (WebKit::WebPage::updatePreferences):
2273             - update throttle state whenever preferences change (throttling can be disabled via preference).
2274         (WebKit::WebPage::setPageSuppressed): Deleted.
2275             - Removed WebPage::SetPageSuppressed.
2276         * WebProcess/WebPage/WebPage.h:
2277             - Removed WebPage::SetPageSuppressed.
2278             - Added m_processSuppressionEnabled, to cache preference state.
2279         * WebProcess/WebPage/WebPage.messages.in:
2280             - Removed WebPage::SetPageSuppressed.
2281
2282 2016-11-29  Andy Estes  <aestes@apple.com>
2283
2284         [Cocoa] Enable two clang warnings recommended by Xcode
2285         https://bugs.webkit.org/show_bug.cgi?id=164498
2286
2287         Reviewed by Mark Lam.
2288
2289         * Configurations/Base.xcconfig: Enabled CLANG_WARN_INFINITE_RECURSION and CLANG_WARN_SUSPICIOUS_MOVE.
2290
2291 2016-11-29  Eric Carlson  <eric.carlson@apple.com>
2292
2293         [MediaStream] Don't request user permission for a device if it has already been granted in the current browsing context
2294         https://bugs.webkit.org/show_bug.cgi?id=164760
2295         <rdar://problem/29261266>
2296
2297         Reviewed by Youenn Fablet.
2298
2299         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
2300         (WebKit::FrameAuthorizationState::FrameAuthorizationState):
2301         (WebKit::FrameAuthorizationState::hasPermissionToUseCaptureDevice):
2302         (WebKit::FrameAuthorizationState::setHasPermissionToUseCaptureDevice):
2303         (WebKit::FrameAuthorizationState::reset):
2304         (WebKit::FrameAuthorizationState::securityOriginsAreEqual):
2305         (WebKit::UserMediaPermissionRequestManagerProxy::stateForRequest):
2306         (WebKit::UserMediaPermissionRequestManagerProxy::invalidateRequests):
2307         (WebKit::UserMediaPermissionRequestManagerProxy::createRequest):
2308         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasDenied):
2309         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasGranted):
2310         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
2311         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
2312         (WebKit::FrameAuthorizationState::~FrameAuthorizationState):
2313         (WebKit::FrameAuthorizationState::frameID):
2314         * UIProcess/UserMediaPermissionRequestProxy.cpp:
2315         (WebKit::UserMediaPermissionRequestProxy::UserMediaPermissionRequestProxy):
2316         * UIProcess/UserMediaPermissionRequestProxy.h:
2317         (WebKit::UserMediaPermissionRequestProxy::create):
2318         (WebKit::UserMediaPermissionRequestProxy::frameID):
2319         (WebKit::UserMediaPermissionRequestProxy::userMediaDocumentSecurityOrigin):
2320         (WebKit::UserMediaPermissionRequestProxy::topLevelDocumentSecurityOrigin):
2321         * UIProcess/WebPageProxy.cpp:
2322         (WebKit::WebPageProxy::didCommitLoadForFrame):
2323         * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
2324         (WebKit::UserMediaPermissionRequestManager::removeMediaRequestFromMaps):
2325
2326 2016-11-29  Wenson Hsieh  <wenson_hsieh@apple.com>
2327
2328         Scroll snapping on Mac should use AppKit animations
2329         https://bugs.webkit.org/show_bug.cgi?id=147261
2330         <rdar://problem/29395293>
2331
2332         Reviewed by Brent Fulgham.
2333
2334         Add some logic to plumb filtered wheel velocity over to WebCore in the case of mainframe scrolling. See
2335         WebCore/ChangeLog for more details.
2336
2337         * WebProcess/WebPage/EventDispatcher.cpp:
2338         (WebKit::EventDispatcher::wheelEvent):
2339
2340 2016-11-21  Brian Burg  <bburg@apple.com>
2341
2342         Web Automation: add ObjC SPI to set whether a page is controlled by automation
2343         https://bugs.webkit.org/show_bug.cgi?id=165001
2344         <rdar://problem/29350432>
2345
2346         Reviewed by Dan Bernstein.
2347
2348         Add SPI property to WKWebViewConfiguration and plumb it through to
2349         initialize WebPageProxy::m_controlledByAutomation. This is propagated
2350         to the WebProcess on creation via WebPageCreationParameters.
2351
2352         * UIProcess/API/APIPageConfiguration.cpp:
2353         (API::PageConfiguration::copy):
2354         * UIProcess/API/APIPageConfiguration.h:
2355         (API::PageConfiguration::isControlledByAutomation):
2356         (API::PageConfiguration::setControlledByAutomation):
2357         * UIProcess/API/Cocoa/WKWebView.mm:
2358         (-[WKWebView _initializeWithConfiguration:]):
2359         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2360         (-[WKWebViewConfiguration init]):
2361         (-[WKWebViewConfiguration copyWithZone:]):
2362         (-[WKWebViewConfiguration _isControlledByAutomation]):
2363         (-[WKWebViewConfiguration _setControlledByAutomation:]):
2364         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
2365         * UIProcess/WebPageProxy.cpp:
2366         (WebKit::WebPageProxy::WebPageProxy):
2367
2368 2016-11-28  Carlos Garcia Campos  <cgarcia@igalia.com>
2369
2370         [GTK] BadDamage X Window System error in WebKit::AcceleratedBackingStoreX11::update when called from WebPageProxy::exitAcceleratedCompositingMode
2371         https://bugs.webkit.org/show_bug.cgi?id=164303
2372
2373         Reviewed by Michael Catanzaro.
2374
2375         Trap also BadDrawable and BadDamage X errors when creating the surface and damage.
2376
2377         * UIProcess/gtk/AcceleratedBackingStoreX11.cpp:
2378         (WebKit::AcceleratedBackingStoreX11::update):
2379
2380 2016-11-28  Chris Dumez  <cdumez@apple.com>
2381
2382         [Mac][WK2] Enable HTML interactive form validation
2383         https://bugs.webkit.org/show_bug.cgi?id=165123
2384         <rdar://problem/28944652>
2385
2386         Reviewed by Simon Fraser.
2387
2388         Enable HTML interactive form validation now that we have a native UI
2389         for it.
2390
2391         * Shared/WebPreferencesDefinitions.h:
2392
2393 2016-11-28  Brent Fulgham  <bfulgham@apple.com>
2394
2395         Generated sandbox profile is not being put in the correct Resources directory
2396         https://bugs.webkit.org/show_bug.cgi?id=165126
2397
2398         Reviewed by Tim Horton.
2399
2400         * WebKit2.xcodeproj/project.pbxproj: Copy the generated file to the 'PlugInSandboxProfiles'
2401         sub-directory.
2402
2403 2016-11-28  Ryan Haddad  <ryanhaddad@apple.com>
2404
2405         Unreviewed, rolling out r209008.
2406
2407         This change appears to have caused two fast/mediastrem
2408         LayoutTests to fail.
2409
2410         Reverted changeset:
2411
2412         "[MediaStream] Don't request user permission for a device if
2413         it has already been granted in the current browsing context"
2414         https://bugs.webkit.org/show_bug.cgi?id=164760
2415         http://trac.webkit.org/changeset/209008
2416
2417 2016-11-28  Andrew Gold  <agold@apple.com>
2418
2419         Support for HTML Media Capture API
2420         https://bugs.webkit.org/show_bug.cgi?id=43239
2421
2422         Reviewed by Tim Horton.
2423
2424         In order to enable media capture on iOS, we must first use the AVFoundation API to 
2425         check/request capture permission from the user for Safari. Then, Safari must request
2426         permission on behalf of the webpage to use the capture devices. Additionally, Safari
2427         must present UI when the capture is taking place, so WebKit needs to notify the client
2428         of a capture session beginning and ending. To do this, we added four methods to 
2429         WKUIDelegatePrivate to request permission from the user, check for permissions, notify
2430         that a capture session has begun, and notify that a capture session has ended. Additionally,
2431         we added a private method to WKWebView that allows the client to stop a capture session.
2432
2433         * UIProcess/API/APIUIClient.h:
2434         (API::UIClient::didBeginCaptureSession): Notifies the client of a capture session beginning.
2435         (API::UIClient::didEndCaptureSession): Notifies the client of a capture session ending.
2436
2437         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: Added new delegate methods to request permission,
2438         check for permission, notify of a capture session beginning, and notify of a capture session
2439         ending.
2440
2441         * UIProcess/API/Cocoa/WKWebView.mm:
2442         (-[WKWebView _stopMediaCapture]): Cancels a media capture session.
2443         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2444
2445         * UIProcess/Cocoa/UIDelegate.h:
2446         * UIProcess/Cocoa/UIDelegate.mm:
2447         (WebKit::UIDelegate::setDelegate): Added the new delegate methods.
2448         (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest):
2449         First checks if the user has authorized the client application access capture devices,
2450         then uses the WKUIDelegate to request permission for a site from the user.
2451         (WebKit::UIDelegate::UIClient::checkUserMediaPermissionForOrigin): Checks the client
2452         for permission to access capture devices.
2453         (WebKit::UIDelegate::UIClient::didBeginCaptureSession): Notifies the client of a capture
2454         session beginning.
2455         (WebKit::UIDelegate::UIClient::didEndCaptureSession): Notifies the client of a capture
2456         session ending.
2457
2458         * UIProcess/WebPageProxy.cpp:
2459         (WebKit::WebPageProxy::isPlayingMediaDidChange): Calls UIDelegate method to notify the
2460         client of a capture session beginning/ending.
2461
2462 2016-11-28  Eric Carlson  <eric.carlson@apple.com>
2463
2464         [MediaStream] Don't request user permission for a device if it has already been granted in the current browsing context
2465         https://bugs.webkit.org/show_bug.cgi?id=164760
2466         <rdar://problem/29261266>
2467
2468         Reviewed by Youenn Fablet.
2469
2470         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
2471         (WebKit::FrameAuthorizationState::FrameAuthorizationState):
2472         (WebKit::FrameAuthorizationState::hasPermissionToUseCaptureDevice):
2473         (WebKit::FrameAuthorizationState::setHasPermissionToUseCaptureDevice):
2474         (WebKit::FrameAuthorizationState::reset):
2475         (WebKit::FrameAuthorizationState::securityOriginsAreEqual):
2476         (WebKit::UserMediaPermissionRequestManagerProxy::stateForRequest):
2477         (WebKit::UserMediaPermissionRequestManagerProxy::invalidateRequests):
2478         (WebKit::UserMediaPermissionRequestManagerProxy::createRequest):
2479         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasDenied):
2480         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasGranted):
2481         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
2482         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
2483         (WebKit::FrameAuthorizationState::~FrameAuthorizationState):
2484         (WebKit::FrameAuthorizationState::frameID):
2485         * UIProcess/UserMediaPermissionRequestProxy.cpp:
2486         (WebKit::UserMediaPermissionRequestProxy::UserMediaPermissionRequestProxy):
2487         * UIProcess/UserMediaPermissionRequestProxy.h:
2488         (WebKit::UserMediaPermissionRequestProxy::create):
2489         (WebKit::UserMediaPermissionRequestProxy::frameID):
2490         (WebKit::UserMediaPermissionRequestProxy::userMediaDocumentSecurityOrigin):
2491         (WebKit::UserMediaPermissionRequestProxy::topLevelDocumentSecurityOrigin):
2492         * UIProcess/WebPageProxy.cpp:
2493         (WebKit::WebPageProxy::didCommitLoadForFrame):
2494         * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
2495         (WebKit::UserMediaPermissionRequestManager::removeMediaRequestFromMaps):
2496
2497 2016-11-27  Dean Jackson  <dino@apple.com>
2498
2499         Removed a WTFLogAlways I left in with a recent commit.
2500
2501         * UIProcess/Cocoa/WebViewImpl.mm:
2502         (-[WKAccessibilitySettingsObserver _settingsDidChange:]):
2503
2504 2016-11-27  Csaba Osztrogonác  <ossy@webkit.org>
2505
2506         Fix unused-private-field build warning in WebKit2/Platform/SharedMemory.h
2507         https://bugs.webkit.org/show_bug.cgi?id=165069
2508
2509         Reviewed by Darin Adler.
2510
2511         * Platform/SharedMemory.h:
2512
2513 2016-11-26  Simon Fraser  <simon.fraser@apple.com>
2514
2515         Fix the iOS build.
2516
2517         * WebProcess/WebPage/ios/WebPageIOS.mm:
2518         (WebKit::WebPage::eventThrottlingDelay):
2519
2520 2016-11-26  Yusuke Suzuki  <utatane.tea@gmail.com>
2521
2522         [WTF] Import std::optional reference implementation as WTF::Optional
2523         https://bugs.webkit.org/show_bug.cgi?id=164199
2524
2525         Reviewed by Saam Barati and Sam Weinig.
2526
2527         * NetworkProcess/NetworkDataTask.cpp:
2528         (WebKit::NetworkDataTask::didReceiveResponse):
2529         * NetworkProcess/NetworkLoad.h:
2530         * NetworkProcess/cache/NetworkCache.cpp:
2531         (WebKit::NetworkCache::responseHasExpired):
2532         * NetworkProcess/cache/NetworkCacheCoders.h:
2533         (WebKit::NetworkCache::Coder<std::optional<T>>::encode):
2534         (WebKit::NetworkCache::Coder<std::optional<T>>::decode):
2535         (WebKit::NetworkCache::Coder<Optional<T>>::encode): Deleted.
2536         (WebKit::NetworkCache::Coder<Optional<T>>::decode): Deleted.
2537         * NetworkProcess/cache/NetworkCacheData.cpp:
2538         (WebKit::NetworkCache::readOrMakeSalt):
2539         * NetworkProcess/cache/NetworkCacheData.h:
2540         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
2541         (WebKit::NetworkCache::SpeculativeLoadManager::PreloadedEntry::PreloadedEntry):
2542         (WebKit::NetworkCache::SpeculativeLoadManager::PreloadedEntry::revalidationRequest):
2543         (WebKit::NetworkCache::SpeculativeLoadManager::addPreloadedEntry):
2544         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.h:
2545         * NetworkProcess/cache/NetworkCacheStatistics.cpp:
2546         (WebKit::NetworkCache::Statistics::recordNotUsingCacheForRequest):
2547         (WebKit::NetworkCache::Statistics::recordRetrievalFailure):
2548         (WebKit::NetworkCache::Statistics::queryWasEverRequested):
2549         * NetworkProcess/cache/NetworkCacheStatistics.h:
2550         * NetworkProcess/cache/NetworkCacheStorage.cpp:
2551         (WebKit::NetworkCache::Storage::storeBodyAsBlob):
2552         (WebKit::NetworkCache::Storage::encodeRecord):
2553         (WebKit::NetworkCache::Storage::dispatchWriteOperation):
2554         * NetworkProcess/cache/NetworkCacheStorage.h:
2555         * Platform/IPC/ArgumentCoders.h:
2556         (IPC::ArgumentCoder<std::optional<T>>::encode):
2557         (IPC::ArgumentCoder<std::optional<T>>::decode):
2558         (IPC::ArgumentCoder<WTF::Optional<T>>::encode): Deleted.
2559         (IPC::ArgumentCoder<WTF::Optional<T>>::decode): Deleted.
2560         * Platform/IPC/Connection.h:
2561         (IPC::Connection::sendWithReply):
2562         * Platform/SharedMemory.h:
2563         * Platform/unix/SharedMemoryUnix.cpp:
2564         (WebKit::SharedMemory::map):
2565         * Scripts/webkit/messages.py:
2566         (class_template_headers):
2567         * Shared/API/APISecurityOrigin.h:
2568         (API::SecurityOrigin::create):
2569         * Shared/API/Cocoa/_WKRemoteObjectInterface.mm:
2570         * Shared/API/c/WKSecurityOriginRef.cpp:
2571         (WKSecurityOriginGetPort):
2572         * Shared/SessionState.h:
2573         * Shared/WebPageCreationParameters.h:
2574         * Shared/mac/ObjCObjectGraph.mm:
2575         (WebKit::typeFromObject):
2576         * Shared/mac/SecItemShim.cpp:
2577         (WebKit::sendSecItemRequest):
2578         * UIProcess/API/C/WKKeyValueStorageManager.cpp:
2579         (WKKeyValueStorageManagerGetStorageDetailsByOrigin):
2580         * UIProcess/API/Cocoa/WKSecurityOrigin.mm:
2581         (-[WKSecurityOrigin port]):
2582         * UIProcess/API/Cocoa/WKWebView.mm:
2583         (-[WKWebView _didCommitLayerTree:]):
2584         (-[WKWebView _navigationGestureDidEnd]):
2585         * UIProcess/API/Cocoa/WKWebsiteDataRecordInternal.h:
2586         (WebKit::toWebsiteDataType):
2587         * UIProcess/API/efl/EwkView.cpp:
2588         (EwkView::setCursor):
2589         * UIProcess/API/mac/WKView.mm:
2590         (toCoreScrollbarStyle):
2591         (toAPIScrollbarStyle):
2592         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp:
2593         (WebKit::WebPaymentCoordinatorProxy::completeShippingMethodSelection):
2594         (WebKit::WebPaymentCoordinatorProxy::completeShippingContactSelection):
2595         (WebKit::WebPaymentCoordinatorProxy::completePaymentMethodSelection):
2596         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.h:
2597         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.messages.in:
2598         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
2599         (WebKit::toPKPaymentSummaryItem):
2600         (WebKit::WebPaymentCoordinatorProxy::platformCompleteShippingMethodSelection):
2601         (WebKit::WebPaymentCoordinatorProxy::platformCompleteShippingContactSelection):
2602         (WebKit::WebPaymentCoordinatorProxy::platformCompletePaymentMethodSelection):
2603         * UIProcess/Automation/WebAutomationSession.cpp:
2604         (WebKit::WebAutomationSession::webFrameIDForHandle):
2605         (WebKit::WebAutomationSession::switchToBrowsingContext):
2606         (WebKit::WebAutomationSession::evaluateJavaScriptFunction):
2607         (WebKit::WebAutomationSession::resolveChildFrameHandle):
2608         (WebKit::WebAutomationSession::resolveParentFrameHandle):
2609         (WebKit::WebAutomationSession::computeElementLayout):
2610         * UIProcess/Automation/WebAutomationSession.h:
2611         * UIProcess/Cocoa/WebViewImpl.h:
2612         * UIProcess/Cocoa/WebViewImpl.mm:
2613         (WebKit::WebViewImpl::updateViewExposedRect):
2614         (WebKit::WebViewImpl::setOverlayScrollbarStyle):
2615         (WebKit::WebViewImpl::overlayScrollbarStyle):
2616         * UIProcess/DrawingAreaProxy.cpp:
2617         (WebKit::DrawingAreaProxy::setViewExposedRect):
2618         * UIProcess/DrawingAreaProxy.h:
2619         (WebKit::DrawingAreaProxy::viewExposedRect):
2620         * UIProcess/InspectorServer/WebSocketServerConnection.cpp:
2621         (WebKit::WebSocketServerConnection::didReceiveSocketStreamData):
2622         * UIProcess/InspectorServer/WebSocketServerConnection.h:
2623         * UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp:
2624         (WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidScroll):
2625         * UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h:
2626         * UIProcess/Scrolling/RemoteScrollingTree.cpp:
2627         (WebKit::RemoteScrollingTree::scrollingTreeNodeDidScroll):
2628         * UIProcess/Scrolling/RemoteScrollingTree.h:
2629         * UIProcess/Storage/LocalStorageDatabaseTracker.cpp:
2630         (WebKit::fileCreationTime):
2631         (WebKit::fileModificationTime):
2632         * UIProcess/Storage/LocalStorageDatabaseTracker.h:
2633         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
2634         (WebKit::UserMediaPermissionRequestManagerProxy::enumerateMediaDevicesForFrame):
2635         * UIProcess/WebBackForwardList.cpp:
2636         (WebKit::WebBackForwardList::backForwardListState):
2637         (WebKit::WebBackForwardList::restoreFromState):
2638         * UIProcess/WebPageProxy.cpp:
2639         (WebKit::WebPageProxy::didCommitLoadForFrame):
2640         (WebKit::WebPageProxy::creationParameters):
2641         (WebKit::WebPageProxy::setOverlayScrollbarStyle):
2642         * UIProcess/WebPageProxy.h:
2643         (WebKit::WebPageProxy::overlayScrollbarStyle):
2644         * UIProcess/WebPageProxy.messages.in:
2645         * UIProcess/WebsiteData/WebsiteDataRecord.h:
2646         * UIProcess/efl/WebView.cpp:
2647         (WebKit::WebView::transformFromScene):
2648         * UIProcess/gtk/AcceleratedBackingStoreX11.cpp:
2649         * UIProcess/gtk/WebPreferencesGtk.cpp:
2650         (WebKit::WebPreferences::platformInitializeStore):
2651         * UIProcess/ios/WKContentViewInteraction.mm:
2652         (-[WKContentView _scrollOffsetForEvent:]):
2653         (-[WKContentView _interpretKeyEvent:isCharEvent:]):
2654         * UIProcess/mac/LegacySessionStateCoding.cpp:
2655         (WebKit::encodeFormDataElement):
2656         (WebKit::decodeFormDataElement):
2657         (WebKit::decodeV1SessionHistory):
2658         * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h:
2659         * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
2660         (WebKit::RemoteLayerTreeDrawingAreaProxy::setViewExposedRect):
2661         * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
2662         (WebKit::WebPaymentCoordinator::completeShippingMethodSelection):
2663         (WebKit::WebPaymentCoordinator::completeShippingContactSelection):
2664         (WebKit::WebPaymentCoordinator::completePaymentMethodSelection):
2665         * WebProcess/ApplePay/WebPaymentCoordinator.h:
2666         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
2667         (WKBundlePageSetEventThrottlingBehaviorOverride):
2668         * WebProcess/Plugins/PDF/DeprecatedPDFPlugin.mm:
2669         (WebKit::PDFPlugin::convertFromPDFViewToRootView):
2670         (WebKit::PDFPlugin::convertFromPDFViewToScreen):
2671         (WebKit::PDFPlugin::boundsOnScreen):
2672         (WebKit::PDFPlugin::geometryDidChange):
2673         * WebProcess/Plugins/PDF/PDFPlugin.mm:
2674         (WebKit::PDFPlugin::geometryDidChange):
2675         * WebProcess/Plugins/PluginView.cpp:
2676         (WebKit::PluginView::performFrameLoadURLRequest):
2677         (WebKit::PluginView::evaluate):
2678         * WebProcess/Plugins/WebPluginInfoProvider.cpp:
2679         (WebKit::WebPluginInfoProvider::pluginLoadClientPolicyForHost):
2680         * WebProcess/Plugins/WebPluginInfoProvider.h:
2681         * WebProcess/Scrolling/RemoteScrollingCoordinator.mm:
2682         (WebKit::RemoteScrollingCoordinator::scrollPositionChangedForNode):
2683         * WebProcess/WebCoreSupport/SessionStateConversion.cpp:
2684         (WebKit::toFormData):
2685         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2686         (WebKit::WebChromeClient::preferredScrollbarOverlayStyle):
2687         * WebProcess/WebCoreSupport/WebChromeClient.h:
2688         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2689         (WebKit::WebFrameLoaderClient::dispatchDidCommitLoad):
2690         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
2691         * WebProcess/WebPage/DrawingArea.h:
2692         * WebProcess/WebPage/DrawingArea.messages.in:
2693         * WebProcess/WebPage/WebFrame.cpp:
2694         (WebKit::WebFrame::certificateInfo):
2695         * WebProcess/WebPage/WebPage.cpp:
2696         (WebKit::m_userInterfaceLayoutDirection):
2697         (WebKit::WebPage::setScrollbarOverlayStyle):
2698         * WebProcess/WebPage/WebPage.h:
2699         (WebKit::WebPage::scrollbarOverlayStyle):
2700         * WebProcess/WebPage/WebPage.messages.in:
2701         * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h:
2702         * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
2703         (WebKit::RemoteLayerTreeDrawingArea::setViewExposedRect):
2704         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
2705         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
2706         (WebKit::TiledCoreAnimationDrawingArea::setViewExposedRect):
2707
2708 2016-11-26  Sam Weinig  <sam@webkit.org>
2709
2710         Convert IntersectionObserver over to using RuntimeEnabledFeatures so it can be properly excluded from script
2711         https://bugs.webkit.org/show_bug.cgi?id=164965
2712
2713         Reviewed by Simon Fraser.
2714
2715         * Shared/WebPreferencesDefinitions.h:
2716         * UIProcess/API/C/WKPreferences.cpp:
2717         (WKPreferencesSetIntersectionObserverEnabled):
2718         (WKPreferencesGetIntersectionObserverEnabled):
2719         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2720         * WebProcess/WebPage/WebPage.cpp:
2721         (WebKit::WebPage::updatePreferences):
2722         Add a preference, defaulting to off, for enabling IntersectionObserver.
2723
2724 2016-11-26  Simon Fraser  <simon.fraser@apple.com>
2725
2726         Migrate some layout timer-related code from std::chrono to Seconds and MonotonicTime
2727         https://bugs.webkit.org/show_bug.cgi?id=164992
2728
2729         Reviewed by Darin Adler.
2730         
2731         No more ugly conversion from seconds to milliseconds.
2732
2733         * WebProcess/WebPage/WebPage.cpp:
2734         (WebKit::WebPage::updatePreferences):
2735         * WebProcess/WebPage/ios/WebPageIOS.mm:
2736         (WebKit::WebPage::eventThrottlingDelay):
2737
2738 2016-11-25  Michael Catanzaro  <mcatanzaro@igalia.com>
2739
2740         [GTK] Follow-up fixes to r208974
2741         https://bugs.webkit.org/show_bug.cgi?id=164771
2742
2743         Unreviewed, implement Carlos's review feedback.
2744
2745         * UIProcess/API/gtk/WebKitNotification.cpp:
2746         (webkit_notification_get_tag):
2747         * UIProcess/API/gtk/WebKitNotificationProvider.cpp:
2748         (WebKitNotificationProvider::withdrawAnyPreviousNotificationMatchingTag):
2749         (WebKitNotificationProvider::show):
2750         * UIProcess/API/gtk/WebKitNotificationProvider.h:
2751
2752 2016-11-24  Michael Catanzaro  <mcatanzaro@igalia.com>
2753
2754         [GTK] Notifications API does not expose or respect the "tag" attribute
2755         https://bugs.webkit.org/show_bug.cgi?id=164771
2756
2757         Reviewed by Gustavo Noronha Silva.
2758
2759         Expose a tag property on WebKitNotification. Ensure that any previous notification with the
2760         same tag is closed when showing a new notification with that tag.
2761
2762         * UIProcess/API/gtk/WebKitNotification.cpp:
2763         (webkit_notification_class_init):
2764         (webkitNotificationCreate):
2765         (webkit_notification_get_tag):
2766         * UIProcess/API/gtk/WebKitNotification.h:
2767         * UIProcess/API/gtk/WebKitNotificationProvider.cpp:
2768         (WebKitNotificationProvider::withdrawAnyPreviousNotificationMatchingTag):
2769         (WebKitNotificationProvider::show):
2770         * UIProcess/API/gtk/WebKitNotificationProvider.h:
2771         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
2772
2773 2016-11-22  Sergio Villar Senin  <svillar@igalia.com>
2774
2775         [GTK] Fix introspection warning
2776         https://bugs.webkit.org/show_bug.cgi?id=165026
2777
2778         Reviewed by Michael Catanzaro.
2779
2780         This fixes an introspection annotation for a new API added in r208532.
2781
2782         * WebProcess/InjectedBundle/API/gtk/WebKitWebPage.cpp:
2783         (webkit_web_page_class_init):
2784
2785 2016-11-21  Carlos Garcia Campos  <cgarcia@igalia.com>
2786
2787         [SOUP] Simplify custom protocols handler implementation
2788         https://bugs.webkit.org/show_bug.cgi?id=164922
2789
2790         Reviewed by Michael Catanzaro.
2791
2792         We are using too many classes for this and also the C API that is not needed, because both GTK+ and EFL have
2793         their own APIs and this is not used by WTR at all.
2794
2795         * PlatformEfl.cmake: Remove files from compilation.
2796         * PlatformGTK.cmake: Ditto.
2797         * Shared/API/c/WKBase.h:
2798         * Shared/API/c/soup/WKBaseSoup.h: Removed.
2799         * UIProcess/API/APICustomProtocolManagerClient.h: Added.
2800         (API::CustomProtocolManagerClient::~CustomProtocolManagerClient):
2801         (API::CustomProtocolManagerClient::startLoading):
2802         (API::CustomProtocolManagerClient::stopLoading):
2803         (API::CustomProtocolManagerClient::invalidate):
2804         * UIProcess/API/C/WKAPICast.h:
2805         * UIProcess/API/C/soup/WKAPICastSoup.h: Removed.
2806         * UIProcess/API/C/soup/WKContextSoup.h: Removed.
2807         * UIProcess/API/C/soup/WKSoupCustomProtocolRequestManager.cpp: Removed.
2808         * UIProcess/API/C/soup/WKSoupCustomProtocolRequestManager.h: Removed.
2809         * UIProcess/API/C/soup/WKSoupRequestManager.h: Removed.
2810         * UIProcess/API/efl/ewk_context.cpp: Remove unneeded include.
2811         * UIProcess/API/efl/ewk_url_scheme_request.cpp: Use CustomProtocolManagerProxy instead of WKSoupCustomProtocolRequestManagerRef.
2812         (EwkUrlSchemeRequest::EwkUrlSchemeRequest):
2813         (EwkUrlSchemeRequest::finish):
2814         (EwkUrlSchemeRequest::invalidate):
2815         * UIProcess/API/efl/ewk_url_scheme_request_private.h:
2816         (EwkUrlSchemeRequest::create):
2817         (EwkUrlSchemeRequest::manager):
2818         * UIProcess/API/gtk/WebKitCustomProtocolManagerClient.cpp: Added.
2819         (attachCustomProtocolManagerClientToContext):
2820         * UIProcess/API/gtk/WebKitCustomProtocolManagerClient.h: Renamed from Source/WebKit2/UIProcess/API/gtk/WebKitRequestManagerClient.h.
2821         * UIProcess/API/gtk/WebKitPrivate.h:
2822         * UIProcess/API/gtk/WebKitRequestManagerClient.cpp: Removed.
2823         * UIProcess/API/gtk/WebKitRequestManagerClient.h: Removed.
2824         * UIProcess/API/gtk/WebKitURISchemeRequest.cpp: Use CustomProtocolManagerProxy instead of WebSoupCustomProtocolRequestManager.
2825         (webkitURISchemeRequestCreate):
2826         (webkitURISchemeRequestCancel):
2827         (webkitURISchemeRequestGetManager):
2828         (webkitURISchemeRequestInvalidate):
2829         (webkitURISchemeRequestReadCallback):
2830         (webkit_uri_scheme_request_finish_error):
2831         * UIProcess/API/gtk/WebKitURISchemeRequestPrivate.h:
2832         * UIProcess/API/gtk/WebKitWebContext.cpp:
2833         (webkitWebContextConstructed):
2834         (webkitWebContextDispose):
2835         (webkit_web_context_register_uri_scheme):
2836         (webkitWebContextStartLoadingCustomProtocol):
2837         (webkitWebContextInvalidateCustomProtocolRequests):
2838         * UIProcess/API/gtk/WebKitWebContextPrivate.h:
2839         * UIProcess/Network/CustomProtocols/CustomProtocolManagerProxy.h:
2840         * UIProcess/Network/CustomProtocols/mac/CustomProtocolManagerProxyMac.mm:
2841         (WebKit::CustomProtocolManagerProxy::processDidClose):
2842         * UIProcess/Network/CustomProtocols/soup/CustomProtocolManagerProxySoup.cpp:
2843         (WebKit::CustomProtocolManagerProxy::processDidClose): Invalidate the client.
2844         (WebKit::CustomProtocolManagerProxy::startLoading): Notify the client.
2845         (WebKit::CustomProtocolManagerProxy::stopLoading): Ditto.
2846         (WebKit::CustomProtocolManagerProxy::didReceiveResponse): Notify the network process.
2847         (WebKit::CustomProtocolManagerProxy::didLoadData): Ditto.
2848         (WebKit::CustomProtocolManagerProxy::didFailWithError): Ditto.
2849         (WebKit::CustomProtocolManagerProxy::didFinishLoading): Ditto.
2850         * UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManager.cpp: Removed.
2851         * UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManager.h: Removed.
2852         * UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManagerClient.cpp: Removed.
2853         * UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManagerClient.h: Removed.
2854         * UIProcess/Network/NetworkProcessProxy.cpp:
2855         (WebKit::NetworkProcessProxy::didClose): Notify the CustomProtocolManagerProxy.
2856         * UIProcess/WebProcessPool.cpp:
2857         (WebKit::WebProcessPool::WebProcessPool): Initialize the CustomProtocolManagerClient and remove the all supplement.
2858         (WebKit::WebProcessPool::setCustomProtocolManagerClient):
2859         (WebKit::WebProcessPool::registerSchemeForCustomProtocol): In case of soup cache the given protocol.
2860         (WebKit::WebProcessPool::unregisterSchemeForCustomProtocol): In case of soup delete the given protocol from the cache.
2861         * UIProcess/WebProcessPool.h:
2862         * UIProcess/efl/RequestManagerClientEfl.cpp: Do not use the C API, but API::CustomProtocolManagerClient.
2863         (WebKit::RequestManagerClientEfl::RequestManagerClientEfl):
2864         (WebKit::RequestManagerClientEfl::registerURLSchemeHandler):
2865         * UIProcess/efl/RequestManagerClientEfl.h:
2866         * UIProcess/efl/WebProcessPoolEfl.cpp:
2867         * UIProcess/gtk/WebProcessPoolGtk.cpp:
2868         * UIProcess/soup/WebProcessPoolSoup.cpp:
2869         (WebKit::WebProcessPool::platformInitializeNetworkProcess): Use m_urlSchemesRegisteredForCustomProtocols to
2870         build the list of custom protocols to send to the network process.
2871
2872 2016-11-21  Alex Christensen  <achristensen@webkit.org>
2873
2874         Fix Sierra CMake build after r208452
2875         https://bugs.webkit.org/show_bug.cgi?id=164437
2876
2877         * UIProcess/Cocoa/WebViewImpl.mm:
2878         (WebKit::WebViewImpl::updateMediaTouchBar):
2879         I haven't enabled VIDEO_PRESENTATION_MODE in the CMake build yet.
2880         It's needed for WebPlaybackSessionInterfaceMac to exist.
2881
2882 2016-11-21  Carlos Garcia Campos  <cgarcia@igalia.com>
2883
2884         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.15.2 release.
2885
2886         * gtk/NEWS: Add release notes for 2.15.2.
2887
2888 2016-11-21  Carlos Garcia Campos  <cgarcia@igalia.com>
2889
2890         Remove m_customProtocolManagerProxy from WebProcessProxy
2891         https://bugs.webkit.org/show_bug.cgi?id=164908
2892
2893         Reviewed by Andreas Kling.
2894
2895         Since the network process is mandatory, the custom protocol manager proxy of WebProcessProxy is unused and can
2896         be removed.
2897
2898         * UIProcess/WebProcessProxy.cpp:
2899         (WebKit::WebProcessProxy::WebProcessProxy):
2900         * UIProcess/WebProcessProxy.h:
2901
2902 2016-11-20  Zan Dobersek  <zdobersek@igalia.com>
2903
2904         [EncryptedMedia] Make EME API runtime-enabled
2905         https://bugs.webkit.org/show_bug.cgi?id=164927
2906
2907         Reviewed by Jer Noble.
2908
2909         Add the new EncryptedMediaAPI preference. Set the same feature
2910         flag on the shared RuntimeEnabledFeatures object to the
2911         corresponding value that's stored in the WebPreferencesStore.
2912
2913         InjectedBundle::overrideBoolPreferenceForTestRunner() does the
2914         same when the 'WebKitEncryptedMediaAPIEnabled' preference is
2915         overridden in WKTR for testing purposes.
2916
2917         * Shared/WebPreferencesDefinitions.h:
2918         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2919         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
2920         * WebProcess/WebPage/WebPage.cpp:
2921         (WebKit::WebPage::updatePreferences):
2922
2923 2016-11-19  Antti Koivisto  <antti@apple.com>
2924
2925         Salt network cache hashes
2926         https://bugs.webkit.org/show_bug.cgi?id=164924
2927
2928         Reviewed by Alex Christensen.
2929
2930         To enhance privacy make cache content unidentifiable from file names alone.
2931         This is done by generating a unique persistent salt for each cache instance.
2932         It is used when computing hashes used in file names.
2933
2934         The patch also replaces plain text partition directory names with salted hashes.
2935
2936         * NetworkProcess/cache/NetworkCache.cpp:
2937         (WebKit::NetworkCache::Cache::makeCacheKey):
2938         (WebKit::NetworkCache::makeCacheKey): Deleted.
2939         * NetworkProcess/cache/NetworkCache.h:
2940
2941             Increment cache version.
2942
2943         * NetworkProcess/cache/NetworkCacheBlobStorage.cpp:
2944         (WebKit::NetworkCache::BlobStorage::BlobStorage):
2945         (WebKit::NetworkCache::BlobStorage::add):
2946         (WebKit::NetworkCache::BlobStorage::get):
2947
2948             Use salt for blob content hash.
2949
2950         * NetworkProcess/cache/NetworkCacheBlobStorage.h:
2951         * NetworkProcess/cache/NetworkCacheData.cpp:
2952         (WebKit::NetworkCache::computeSHA1):
2953
2954             For simplicity all SHA1s are now salted.
2955
2956         (WebKit::NetworkCache::makeSalt):
2957         (WebKit::NetworkCache::readOrMakeSalt):
2958
2959             Read salt if it exists, generate and persist it otherwise.
2960
2961         * NetworkProcess/cache/NetworkCacheData.h:
2962         * NetworkProcess/cache/NetworkCacheKey.cpp:
2963         (WebKit::NetworkCache::Key::Key):
2964
2965             Remove the "No partition" string and just empty.
2966             That was only needed to have a directory name of some sort.
2967
2968         (WebKit::NetworkCache::Key::computeHash):
2969
2970             Use salt for key hash.
2971
2972         (WebKit::NetworkCache::Key::computePartitionHash):
2973
2974             Separate hash for partition.
2975
2976         * NetworkProcess/cache/NetworkCacheKey.h:
2977         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
2978         (WebKit::NetworkCache::makeSubresourcesKey):
2979         (WebKit::NetworkCache::SpeculativeLoadManager::PendingFrameLoad::saveToDiskIfReady):
2980         (WebKit::NetworkCache::SpeculativeLoadManager::retrieveSubresourcesEntry):
2981         * NetworkProcess/cache/NetworkCacheStorage.cpp:
2982         (WebKit::NetworkCache::makeSaltFilePath):
2983         (WebKit::NetworkCache::Storage::open):
2984
2985             Cache can't be opened if we can't read or persist a salt.
2986
2987         (WebKit::NetworkCache::traverseRecordsFiles):
2988         (WebKit::NetworkCache::Storage::Storage):
2989         (WebKit::NetworkCache::Storage::synchronize):
2990         (WebKit::NetworkCache::Storage::recordDirectoryPathForKey):
2991
2992             Use the partition hash in the directory name instead of a plain text name.
2993
2994         (WebKit::NetworkCache::decodeRecordHeader):
2995         (WebKit::NetworkCache::Storage::readRecord):
2996         (WebKit::NetworkCache::Storage::encodeRecord):
2997         (WebKit::NetworkCache::Storage::traverse):
2998         (WebKit::NetworkCache::Storage::clear):
2999         * NetworkProcess/cache/NetworkCacheStorage.h:
3000         (WebKit::NetworkCache::Storage::salt):
3001
3002 2016-11-19  Simon Fraser  <simon.fraser@apple.com>
3003
3004         [iOS WK2] When zoomed in and panning on pages with fixed bars, parts of the bars are sometimes missing
3005         https://bugs.webkit.org/show_bug.cgi?id=164855
3006
3007         Reviewed by Sam Weinig.
3008
3009         During UI-process panning and zooming, we send visible rect updates to the web process
3010         with inStableState=false, and don't update GraphicsLayers until we get into a stable state.
3011
3012         This causes a problem where the web process has a stale notion of where the GraphicsLayers
3013         for position:fixed elements are, but is then told to update tiling coverage with an up-to-date
3014         visible rect. The existing "sync layer positions" path isn't useful to fix this, because it
3015         breaks the relationship between the GraphicsLayer positions and their FixedPositionViewportConstraints
3016         in the scrolling tree.
3017
3018         To address this, add the notion of an Optional<> approximatePosition on GraphicsLayers. This is used
3019         only by the coverageRect computation code path, and is cleared by a setPosition(). ApproximatePositions
3020         are pushed onto GraphicsLayers via the syncViewportConstrainedLayerPositions() code path (renamed to
3021         reconcileViewportConstrainedLayerPositions).
3022
3023         Tested by scrollingcoordinator/ios/non-stable-viewport-scroll.html
3024
3025         * UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp:
3026         (WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidScroll):
3027         * UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h:
3028         * UIProcess/Scrolling/RemoteScrollingTree.cpp:
3029         (WebKit::RemoteScrollingTree::scrollingTreeNodeDidScroll):
3030         * UIProcess/Scrolling/RemoteScrollingTree.h:
3031         * WebProcess/Scrolling/RemoteScrollingCoordinator.mm:
3032         (WebKit::RemoteScrollingCoordinator::scrollPositionChangedForNode):
3033         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
3034         (WebKit::CompositingCoordinator::flushPendingLayerChanges):
3035         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
3036         (WebKit::CoordinatedLayerTreeHost::didFlushRootLayer):
3037         * WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp:
3038         (WebKit::LayerTreeHostGtk::flushPendingLayerChanges):
3039         * WebProcess/WebPage/ios/WebPageIOS.mm:
3040         (WebKit::WebPage::updateVisibleContentRects): Always push the custom fixed position rect down, but send
3041         ScrollingLayerPositionAction::SetApproximate if the state is not stable.
3042         * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
3043         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
3044         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
3045         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
3046
3047 2016-11-18  Simon Fraser  <simon.fraser@apple.com>
3048
3049         Make it possible to test non-stable-state scrolling on iOS
3050         https://bugs.webkit.org/show_bug.cgi?id=164905
3051
3052         Reviewed by Dan Bernstein.
3053
3054         Make it possible for an iOS layout test to force every visible rect update
3055         from the UI process to the web process to be in a non-stable state. This emulates
3056         what happens during panning and zooming interactions, and allows us to test the
3057         scrolling and layer trees in these transient states.
3058
3059         This is done by adding a testing property on WKWebView, _stableStateOverride, whose
3060         getters and setters are overridden in TestRunnerWKWebView. When non-nil, we _updateVisibleContentRectAfterScrollInView
3061         consults the NSNumber's boolValue and uses it to override the stable state.
3062
3063         To facilitate this kind of testing, also add immediateScrollToOffset() and
3064         immediateZoomToScale() to UIScriptController. Finally, add doAfterPresentationUpdate()
3065         which provides a callback that fires after one trip to the web process and back.
3066
3067         * UIProcess/API/Cocoa/WKWebView.mm:
3068         (-[WKWebView _updateVisibleContentRectAfterScrollInView:]):
3069         (-[WKWebView _stableStateOverride]):
3070         (-[WKWebView _setStableStateOverride:]):
3071         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3072
3073 2016-11-18  Simon Fraser  <simon.fraser@apple.com>
3074
3075         [iOS WK2] Eliminate a source of flakiness in layout tests by forcing WebPage into "responsive" mode for all tests, with an internals override
3076         https://bugs.webkit.org/show_bug.cgi?id=164980
3077
3078         Reviewed by Chris Dumez.
3079
3080         WebPage::eventThrottlingDelay() uses a latency estimate based on the round-trip time from the UI process
3081         to affect behavior, including whether scroll events are fired. This also affects the FrameView "scrolledByUser"
3082         flag that impacts tile coverage.
3083
3084         During testing, latency falling above or below the 16ms threshold could affect behavior. Fix by forcing
3085         WebPage into "responsive" mode while running tests, via InjectedBundlePage::prepare().
3086
3087         Add a nullable internals property so that a test can specify responsive, unresponsive or default behavior.
3088
3089         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
3090         (WKBundlePageSetEventThrottlingBehaviorOverride):
3091         * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
3092         * WebProcess/WebPage/ios/WebPageIOS.mm:
3093         (WebKit::WebPage::eventThrottlingDelay):
3094
3095 2016-11-18  Simon Fraser  <simon.fraser@apple.com>
3096
3097         Remove use of std::chrono in WebPage and entrained code
3098         https://bugs.webkit.org/show_bug.cgi?id=164967
3099
3100         Reviewed by Tim Horton.
3101
3102         Replace std::chrono with Seconds and Monotonic Time.
3103
3104         Use more C++11 initialization for WebPage data members.
3105
3106         * Shared/VisibleContentRectUpdateInfo.cpp:
3107         (WebKit::operator<<):
3108         * Shared/VisibleContentRectUpdateInfo.h:
3109         (WebKit::VisibleContentRectUpdateInfo::VisibleContentRectUpdateInfo):
3110         (WebKit::VisibleContentRectUpdateInfo::timestamp):
3111         * Shared/WebCoreArgumentCoders.cpp:
3112         (IPC::ArgumentCoder<MonotonicTime>::encode):
3113         (IPC::ArgumentCoder<MonotonicTime>::decode):
3114         (IPC::ArgumentCoder<Seconds>::encode):
3115         (IPC::ArgumentCoder<Seconds>::decode):
3116         * Shared/WebCoreArgumentCoders.h:
3117         * UIProcess/ios/WKContentView.mm:
3118         (WebKit::HistoricalVelocityData::HistoricalVelocityData):
3119         (WebKit::HistoricalVelocityData::velocityForNewData):
3120         (WebKit::HistoricalVelocityData::append):
3121         (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInset:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]):
3122         * WebProcess/WebCoreSupport/WebChromeClient.h:
3123         * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
3124         (WebKit::WebChromeClient::eventThrottlingDelay):
3125         * WebProcess/WebPage/ViewUpdateDispatcher.h:
3126         * WebProcess/WebPage/WebPage.cpp:
3127         (WebKit::WebPage::WebPage):
3128         (WebKit::m_userActivityHysteresis):
3129         (WebKit::WebPage::didFlushLayerTreeAtTime):
3130         (WebKit::WebPage::didCommitLoad):
3131         * WebProcess/WebPage/WebPage.h:
3132         * WebProcess/WebPage/ios/WebPageIOS.mm:
3133         (WebKit::WebPage::eventThrottlingDelay):
3134         (WebKit::WebPage::updateVisibleContentRects):
3135         * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
3136         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
3137
3138 2016-11-18  Dean Jackson  <dino@apple.com>
3139
3140         AX: "(inverted-colors)" media query only matches on page reload; should match on change
3141         https://bugs.webkit.org/show_bug.cgi?id=163564
3142         <rdar://problem/28807350>
3143
3144         Reviewed by Simon Fraser.
3145
3146         Listen for the appropriate notifications that accessibility settings
3147         have changed. This is a single notification on macOS, which uses WebViewImpl,
3148         and more fine-grained notifications on iOS, using WKWebView.
3149
3150         When we see the notification, send a message to the WebProcess which will
3151         then tell the WebCore::Page.
3152
3153         * UIProcess/API/Cocoa/WKWebView.mm:
3154         (-[WKWebView _initializeWithConfiguration:]):
3155         (-[WKWebView _accessibilitySettingsDidChange:]):
3156         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3157         * UIProcess/Cocoa/WebViewImpl.h:
3158         * UIProcess/Cocoa/WebViewImpl.mm:
3159         (-[WKAccessibilitySettingsObserver initWithImpl:]):
3160         (-[WKAccessibilitySettingsObserver dealloc]):
3161         (-[WKAccessibilitySettingsObserver _settingsDidChange:]):
3162         (WebKit::WebViewImpl::WebViewImpl):
3163         (WebKit::WebViewImpl::accessibilitySettingsDidChange):
3164         * UIProcess/WebPageProxy.cpp:
3165         (WebKit::WebPageProxy::accessibilitySettingsDidChange):
3166         * UIProcess/WebPageProxy.h:
3167         * WebProcess/WebPage/WebPage.cpp:
3168         (WebKit::WebPage::accessibilitySettingsDidChange):
3169         * WebProcess/WebPage/WebPage.h:
3170         * WebProcess/WebPage/WebPage.messages.in:
3171
3172 2016-11-18  Jeremy Jones  <jeremyj@apple.com>
3173
3174         USE WK_MAC_TBA for version number in _webViewRequestPointerLock:(WKWebView *)webView WK_API_AVAILABLE(macosx(10.12))
3175         https://bugs.webkit.org/show_bug.cgi?id=164962
3176
3177         Reviewed by Dean Jackson.
3178
3179         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
3180
3181 2016-11-18  Enrica Casucci  <enrica@apple.com>
3182
3183         Refactor drag and drop for WebKit2 to encode DragData message exchange.
3184         https://bugs.webkit.org/show_bug.cgi?id=164945
3185
3186         Reviewed by Tim Horton.
3187
3188         * Shared/WebCoreArgumentCoders.cpp:
3189         (IPC::ArgumentCoder<DragData>::encode):
3190         (IPC::ArgumentCoder<DragData>::decode):
3191         * Shared/WebCoreArgumentCoders.h:
3192         * UIProcess/WebPageProxy.cpp:
3193         (WebKit::WebPageProxy::performDragControllerAction):
3194         * WebProcess/WebCoreSupport/WebDragClient.cpp:
3195         (WebKit::WebDragClient::willPerformDragDestinationAction):
3196         (WebKit::WebDragClient::actionMaskForDrag):
3197         * WebProcess/WebCoreSupport/WebDragClient.h:
3198         * WebProcess/WebPage/WebPage.cpp:
3199         (WebKit::WebPage::performDragControllerAction):
3200         * WebProcess/WebPage/WebPage.h:
3201         * WebProcess/WebPage/WebPage.messages.in:
3202
3203 2016-11-18  Jeremy Jones  <jeremyj@apple.com>
3204
3205         Add runtime flag to enable pointer lock. Enable pointer lock feature for mac.
3206         https://bugs.webkit.org/show_bug.cgi?id=163801
3207
3208         Reviewed by Simon Fraser.
3209
3210         Add SPI to notify client of pointer lock and for client to allow or deny.
3211         Unlock pointer when view is not longer active.
3212
3213         * Configurations/FeatureDefines.xcconfig:
3214         * Shared/WebPreferencesDefinitions.h:
3215         * UIProcess/API/APIUIClient.h:
3216         (API::UIClient::requestPointerLock):
3217         (API::UIClient::didLosePointerLock):
3218         * UIProcess/API/C/WKPage.cpp:
3219         (WKPageSetPageUIClient):
3220         (WKPageDidAllowPointerLock):
3221         (WKPageDidDenyPointerLock):
3222         * UIProcess/API/C/WKPagePrivate.h:
3223         * UIProcess/API/C/WKPageUIClient.h:
3224         * UIProcess/API/C/WKPreferences.cpp:
3225         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
3226         * UIProcess/Cocoa/UIDelegate.h:
3227         * UIProcess/Cocoa/UIDelegate.mm:
3228         (WebKit::UIDelegate::setDelegate):
3229         (WebKit::UIDelegate::UIClient::requestPointerLock):
3230         (WebKit::UIDelegate::UIClient::didLosePointerLock):
3231         * UIProcess/WebPageProxy.cpp:
3232         (WebKit::WebPageProxy::dispatchActivityStateChange):
3233         (WebKit::WebPageProxy::resetStateAfterProcessExited):
3234         (WebKit::WebPageProxy::requestPointerLock):
3235         (WebKit::WebPageProxy::didAllowPointerLock):
3236         (WebKit::WebPageProxy::didDenyPointerLock):
3237         (WebKit::WebPageProxy::requestPointerUnlock):
3238         * UIProcess/WebPageProxy.h:
3239         * WebProcess/WebPage/WebPage.cpp:
3240         (WebKit::WebPage::updatePreferences):
3241
3242 2016-11-17  Carlos Garcia Campos  <cgarcia@igalia.com>
3243
3244         Downloads started by context menu actions should also have a web view associated
3245         https://bugs.webkit.org/show_bug.cgi?id=164364
3246
3247         Reviewed by Michael Catanzaro.
3248
3249         When a request is converted to a download WebPageProxy calls handleDownloadRequest() and clients handle that to
3250         associate the web view to the download. When a download is started by a context menu action, WebPageProxy calls
3251         WebProcessPool::download() with this as initiatingPage parameter, but clients are not notified in this case.
3252
3253         * UIProcess/API/gtk/WebKitDownload.cpp:
3254         (webkitDownloadCreateForRequest): Deleted.
3255         * UIProcess/API/gtk/WebKitDownloadPrivate.h:
3256         * UIProcess/API/gtk/WebKitWebContext.cpp:
3257         (webkitWebContextStartDownload): Use webkitWebContextGetOrCreateDownload() after WebProcessPool::download()
3258         because the WebKitDownload could have already been created by the web view download handler at this point.
3259         * UIProcess/API/gtk/WebKitWebView.cpp:
3260         (webkit_web_view_download_uri): We no longer need to associate the web view to the download here.
3261         * UIProcess/WebProcessPool.cpp:
3262         (WebKit::WebProcessPool::download): If an initiatingPage has been passed, call handleDownloadRequest() to notify
3263         the page client.
3264
3265 2016-11-17  Alex Christensen  <achristensen@webkit.org>
3266
3267         REGRESSION: API test _WKDownload.ConvertResponseToDownload is a flaky timeout
3268         https://bugs.webkit.org/show_bug.cgi?id=164631
3269
3270         Reviewed by Carlos Garcia Campos.
3271
3272         * NetworkProcess/NetworkResourceLoader.cpp:
3273         (WebKit::NetworkResourceLoader::convertToDownload):
3274         I could reproduce the flaky failure 100% of the time when not using NETWORK_SESSION
3275         by adding a usleep(1000000) in NetworkResourceLoader::convertToDownload.  m_networkLoad
3276         was not being set to nullptr before it was being checked in NetworkResourceLoader::abort
3277
3278 2016-11-17  Alex Christensen  <achristensen@webkit.org>
3279
3280         Fix CMake build after r208865
3281         https://bugs.webkit.org/show_bug.cgi?id=164894
3282
3283         * PlatformMac.cmake:
3284         Add new files.
3285
3286 2016-11-17  Ryosuke Niwa  <rniwa@webkit.org>
3287
3288         WKBundleNodeHandleSetHTMLInputElementSpellcheckEnabled should keep text replacement enabled
3289         https://bugs.webkit.org/show_bug.cgi?id=164857
3290         <rdar://problem/27721742>
3291
3292         Reviewed by Wenson Hsieh.
3293
3294         * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:
3295         (WebKit::InjectedBundleNodeHandle::setHTMLInputElementSpellcheckEnabled):
3296
3297 2016-11-17  John Wilander  <wilander@apple.com>
3298
3299         Resource load statistics: Cover further data records, count removed data records, and only fire handler when needed
3300         https://bugs.webkit.org/show_bug.cgi?id=164659
3301
3302         Reviewed by Andy Estes.
3303
3304         * UIProcess/WebResourceLoadStatisticsStore.cpp:
3305         (WebKit::WebResourceLoadStatisticsStore::removeDataRecords):
3306             Consistent naming with 'remove' rather than 'delete'.
3307             Now removes localStorage, IndexDB, disk cache, and memory cache too.
3308             Updates statistics with number of times it has removed data records.
3309         (WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated):
3310             No longer checks whether it has enough data since the classification rules
3311             are absolute, not relative.
3312         (WebKit::WebResourceLoadStatisticsStore::clearDataRecords): Deleted.
3313         * UIProcess/WebResourceLoadStatisticsStore.h:
3314             Consistent naming with 'remove' rather than 'delete'.
3315
3316 2016-11-17  Brady Eidson  <beidson@apple.com>
3317
3318         Add _WKIconLoadingDelegate SPI.
3319         https://bugs.webkit.org/show_bug.cgi?id=164894
3320
3321         Reviewed by Alex Christensen.
3322
3323         With this client, WebCore will ask the FrameLoaderClient about each icon found in the <head>.
3324
3325         WebKit2 will then ask the embedding app - for each icon - if it wants that icon to load.
3326
3327         For icons the app decides to load, WebKit will pass the data to the app without storing locally.
3328
3329         * UIProcess/API/APIIconLoadingClient.h: Copied from Source/WebCore/html/LinkIconCollector.h.
3330         (API::IconLoadingClient::~IconLoadingClient):
3331         (API::IconLoadingClient::getLoadDecisionForIcon):
3332
3333         * UIProcess/API/Cocoa/WKWebView.mm:
3334         (-[WKWebView _initializeWithConfiguration:]):
3335         (-[WKWebView _iconLoadingDelegate]):
3336         (-[WKWebView _setIconLoadingDelegate:]):
3337         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3338
3339         * UIProcess/API/Cocoa/_WKIconLoadingDelegate.h: Copied from Source/WebCore/html/LinkIconCollector.h.
3340
3341         * UIProcess/API/Cocoa/_WKLinkIconParameters.h: Copied from Source/WebCore/html/LinkIconCollector.h.
3342         * UIProcess/API/Cocoa/_WKLinkIconParameters.mm: Copied from Source/WebCore/html/LinkIconCollector.h.
3343         (-[_WKLinkIconParameters _initWithLinkIcon:]):
3344         (-[_WKLinkIconParameters url]):
3345         (-[_WKLinkIconParameters mimeType]):
3346         (-[_WKLinkIconParameters size]):
3347         (-[_WKLinkIconParameters iconType]):
3348         * UIProcess/API/Cocoa/_WKLinkIconParametersInternal.h: Copied from Source/WebCore/html/LinkIconCollector.h.
3349
3350         * UIProcess/Cocoa/IconLoadingDelegate.h: Copied from Source/WebCore/html/LinkIconCollector.h.
3351         * UIProcess/Cocoa/IconLoadingDelegate.mm: Added.
3352         (WebKit::IconLoadingDelegate::IconLoadingDelegate):
3353         (WebKit::IconLoadingDelegate::~IconLoadingDelegate):
3354         (WebKit::IconLoadingDelegate::createIconLoadingClient):
3355         (WebKit::IconLoadingDelegate::delegate):
3356         (WebKit::IconLoadingDelegate::setDelegate):
3357         (WebKit::IconLoadingDelegate::IconLoadingClient::IconLoadingClient):
3358         (WebKit::IconLoadingDelegate::IconLoadingClient::~IconLoadingClient):
3359         (WebKit::IconLoadingDelegate::IconLoadingClient::getLoadDecisionForIcon):
3360
3361         * UIProcess/WebPageProxy.cpp:
3362         (WebKit::WebPageProxy::setIconLoadingClient):
3363         (WebKit::WebPageProxy::getLoadDecisionForIcon):
3364         (WebKit::WebPageProxy::finishedLoadingIcon):
3365         * UIProcess/WebPageProxy.h:
3366         (WebKit::WebPageProxy::iconLoadingClient):
3367         * UIProcess/WebPageProxy.messages.in:
3368
3369         * WebKit2.xcodeproj/project.pbxproj:
3370
3371         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3372         (WebKit::WebFrameLoaderClient::useIconLoadingClient):
3373         (WebKit::WebFrameLoaderClient::getLoadDecisionForIcon):
3374         (WebKit::WebFrameLoaderClient::finishedLoadingIcon):
3375         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
3376         (WebKit::WebFrameLoaderClient::setUseIconLoadingClient):
3377
3378         * WebProcess/WebPage/WebPage.cpp:
3379         (WebKit::WebPage::didGetLoadDecisionForIcon):
3380         (WebKit::WebPage::setUseIconLoadingClient):
3381         * WebProcess/WebPage/WebPage.h:
3382         * WebProcess/WebPage/WebPage.messages.in:
3383
3384 2016-11-17  Saam Barati  <sbarati@apple.com>
3385
3386         Remove async/await compile time flag and enable tests
3387         https://bugs.webkit.org/show_bug.cgi?id=164828
3388         <rdar://problem/28639334>
3389
3390         Reviewed by Yusuke Suzuki.
3391
3392         * Configurations/FeatureDefines.xcconfig:
3393
3394 2016-11-17  Yusuke Suzuki  <utatane.tea@gmail.com>
3395
3396         [JSC] WTF::TemporaryChange with WTF::SetForScope
3397         https://bugs.webkit.org/show_bug.cgi?id=164761
3398
3399         Reviewed by Saam Barati.
3400
3401         * PluginProcess/PluginControllerProxy.cpp:
3402         (WebKit::PluginControllerProxy::initialize):
3403         * PluginProcess/WebProcessConnection.cpp:
3404         (WebKit::WebProcessConnection::didReceiveMessage):
3405         (WebKit::WebProcessConnection::didReceiveSyncMessage):
3406         * Shared/API/Cocoa/WKRemoteObjectCoder.mm:
3407         (createEncodedObject):
3408         (decodeObject):
3409         * UIProcess/API/Cocoa/WKWebView.mm:
3410         (-[WKWebView _keyboardChangedWithInfo:adjustScrollView:]):
3411         * UIProcess/Cocoa/WebViewImpl.mm:
3412         (WebKit::WebViewImpl::updateTextTouchBar):
3413         * UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
3414         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::commitStateAfterChildren):
3415         * UIProcess/gtk/WebPasteboardProxyGtk.cpp:
3416         (WebKit::WebPasteboardProxy::writeToClipboard):
3417         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
3418         (WebKit::CompositingCoordinator::flushPendingLayerChanges):
3419         (WebKit::CompositingCoordinator::purgeBackingStores):
3420         * WebProcess/WebPage/WebPage.cpp:
3421         (WebKit::WebPage::mouseEvent):
3422         (WebKit::WebPage::keyEvent):
3423         (WebKit::WebPage::dispatchTouchEvent):
3424         (WebKit::WebPage::setInitialFocus):
3425         (WebKit::WebPage::insertTextAsync):
3426         * WebProcess/WebPage/ios/WebPageIOS.mm:
3427         (WebKit::WebPage::dynamicViewportSizeUpdate):
3428         * WebProcess/WebPage/mac/RemoteLayerTreeContext.mm:
3429         * WebProcess/WebPage/mac/WebPageMac.mm:
3430
3431 2016-11-16  Brent Fulgham  <bfulgham@apple.com>
3432
3433         Unreviewed build fix after r208589
3434
3435         The generated com.apple.WebKit.plugin-common.sb file was not getting copied into
3436         the Resources folder, so was not deployed with WebKit. We need to treat it like
3437         com.apple.WebProcess.sb and the other generated files.
3438
3439         * WebKit2.xcodeproj/project.pbxproj: Tell Xcode to include the generated file in
3440         the framework Resources.
3441
3442 2016-11-16  Yusuke Suzuki  <utatane.tea@gmail.com>
3443
3444         [ES6][WebCore] Change ES6_MODULES compile time flag to runtime flag
3445         https://bugs.webkit.org/show_bug.cgi?id=164827
3446
3447         Reviewed by Ryosuke Niwa.
3448
3449         * Configurations/FeatureDefines.xcconfig:
3450         * Shared/WebPreferencesDefinitions.h:
3451         Annotated ES6 Modules option with DEFAULT_EXPERIMENTAL_FEATURES_ENABLED.
3452         * UIProcess/API/C/WKPreferences.cpp:
3453         (WKPreferencesSetES6ModulesEnabled):
3454         (WKPreferencesGetES6ModulesEnabled):
3455         * UIProcess/API/C/WKPreferencesRefPrivate.h:
3456         * WebProcess/InjectedBundle/InjectedBundle.cpp:
3457         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
3458         * WebProcess/WebPage/WebPage.cpp:
3459         (WebKit::WebPage::updatePreferences):
3460
3461 2016-11-16  Simon Fraser  <simon.fraser@apple.com>
3462
3463         Add logging support to VisibleContentRectUpdateInfo
3464         https://bugs.webkit.org/show_bug.cgi?id=164825
3465
3466         Reviewed by Zalan Bujtas.
3467
3468         Add TextStream output to VisibleContentRectUpdateInfo. Just piping it into a logging
3469         stream does single-line output, so also make a convenience dump() function that will
3470         product multiline output. Result look like:
3471
3472             (VisibleContentRectUpdateInfo
3473               (lastLayerTreeTransactionID 54)
3474               (exposedContentRect (523.44,1258.63) width=676.20 height=901.60)
3475               (unobscuredContentRect (523.44,1293.41) width=676.20 height=866.82)
3476               (unobscuredRectInScrollViewCoordinates (0,39.50) width=768 height=984.50)
3477               (customFixedPositionRect (219.64,935) width=980 height=1225)
3478               (obscuredInset width=0 height=39.50)
3479               (scale 1.14)
3480               (inStableState 0)
3481               (timestamp 736446.61)
3482               (verticalVelocity -11.36))
3483
3484         * Shared/VisibleContentRectUpdateInfo.cpp:
3485         (WebKit::VisibleContentRectUpdateInfo::dump):
3486         (WebKit::operator<<):
3487         * Shared/VisibleContentRectUpdateInfo.h:
3488         * UIProcess/ios/WKContentView.mm:
3489         (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInset:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]):
3490
3491 2016-11-15  Simon Fraser  <simon.fraser@apple.com>
3492
3493         [iOS WK2] Scroll view scrolling and zooming animations can keep running across page loads
3494         https://bugs.webkit.org/show_bug.cgi?id=164810
3495
3496         Reviewed by Tim Horton.
3497         
3498         Scrolling and zooming animations can leak across page loads, which makes tests flakey,
3499         and is unexpected by users.
3500
3501         Tested by scrollingcoordinator/ios/sync-layer-positions-after-scroll.html followed by
3502         scrollingcoordinator/ios/ui-scrolling-tree.html
3503
3504         * UIProcess/API/Cocoa/WKWebView.mm:
3505         (-[WKWebView _didCommitLoadForMainFrame]):
3506
3507 2016-11-15  Jon Lee  <jonlee@apple.com>
3508
3509         Report active video and audio capture devices separately
3510         https://bugs.webkit.org/show_bug.cgi?id=164769
3511
3512         Reviewed by Eric Carlson.
3513
3514         Replace kWKMediaHasActiveCaptureDevice with kWKMediaHasActiveAudioCaptureDevice and
3515         kWKMediaHasActiveVideoCaptureDevice
3516
3517         * UIProcess/API/C/WKPage.cpp:
3518         (WKPageGetMediaState):
3519         * UIProcess/API/C/WKPagePrivate.h:
3520         * UIProcess/WebPageProxy.cpp:
3521         (WebKit::WebPageProxy::isPlayingMediaDidChange): Update the mask to include the two
3522         bits.
3523
3524 2016-11-14  Simon Fraser  <simon.fraser@apple.com>
3525
3526         [iOS WK2] Implement support for visual viewports
3527         https://bugs.webkit.org/show_bug.cgi?id=164765
3528
3529         Reviewed by Tim Horton.
3530
3531         Adopt the visual viewport scrolling model in iOS WK2.
3532
3533         Pass the parameters used for computing the layout viewport up to WK2 via RemoteLayerTreeTransaction.
3534         These are stored on WebPageProxy. When they change, _didCommitLayerTree triggers a -_updateVisibleContentRects.
3535         
3536         WebPageProxy::computeCustomFixedPositionRect() is the function that computes the "override" layout viewport.
3537         It starts with the baseLayoutViewportSize from the web process (which is based on the initial containing block
3538         size), then ensures that it's no smaller than the unobscured content rect, since it makes no sense for the
3539         layout viewport to be smaller than the visual viewport. The static FrameView::computeLayoutViewportOrigin()
3540         is then use to "push" the layout viewport around as the visual viewport changes.
3541
3542         * Shared/VisibleContentRectUpdateInfo.h:
3543         * Shared/WebCoreArgumentCoders.cpp: Encode LayoutSize and LayoutPoint.
3544         (IPC::ArgumentCoder<LayoutSize>::encode):
3545         (IPC::ArgumentCoder<LayoutSize>::decode):
3546         (IPC::ArgumentCoder<LayoutPoint>::encode):
3547         (IPC::ArgumentCoder<LayoutPoint>::decode):
3548         * Shared/WebCoreArgumentCoders.h:
3549         * Shared/mac/RemoteLayerTreeTransaction.h:
3550         (WebKit::RemoteLayerTreeTransaction::baseLayoutViewportSize):
3551         (WebKit::RemoteLayerTreeTransaction::setBaseLayoutViewportSize):
3552         (WebKit::RemoteLayerTreeTransaction::minStableLayoutViewportOrigin):
3553         (WebKit::RemoteLayerTreeTransaction::setMinStableLayoutViewportOrigin):
3554         (WebKit::RemoteLayerTreeTransaction::maxStableLayoutViewportOrigin):
3555         (WebKit::RemoteLayerTreeTransaction::setMaxStableLayoutViewportOrigin):
3556         * Shared/mac/RemoteLayerTreeTransaction.mm:
3557         (WebKit::RemoteLayerTreeTransaction::encode):
3558         (WebKit::RemoteLayerTreeTransaction::decode):
3559         (WebKit::RemoteLayerTreeTransaction::description):
3560         * UIProcess/API/Cocoa/WKWebView.mm:
3561         (-[WKWebView _didCommitLayerTree:]):
3562         * UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h:
3563         (WebKit::RemoteScrollingCoordinatorProxy::visualViewportEnabled): Accessor.
3564         * UIProcess/WebPageProxy.h:
3565         (WebKit::WebPageProxy::customFixedPositionRect):
3566         * UIProcess/ios/RemoteScrollingCoordinatorProxyIOS.mm:
3567         (WebKit::RemoteScrollingCoordinatorProxy::customFixedPositionRect):
3568         * UIProcess/ios/WKContentView.mm:
3569         (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInset:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]):
3570         (-[WKContentView _didCommitLayerTree:]):
3571         * UIProcess/ios/WebPageProxyIOS.mm:
3572         (WebKit::WebPageProxy::computeCustomFixedPositionRect): When visual viewports are enabled, compute
3573         the layout viewport rect, taking the baseLayoutViewportSize and the current unobscured rect into account.
3574         (WebKit::WebPageProxy::updateLayoutViewportParameters):
3575         * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
3576         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
3577         * WebProcess/WebPage/WebPage.cpp: Encode in the transaction the layout viewport parameters (with minor refactor).
3578         (WebKit::WebPage::willCommitLayerTree):
3579         * WebProcess/WebPage/ios/WebPageIOS.mm:
3580         (WebKit::WebPage::updateVisibleContentRects): This is where the web process receives the new override layout viewport
3581         from the web process (with some logging).
3582
3583 2016-11-15  Jon Lee  <jonlee@apple.com>
3584
3585         Remove HasMediaCaptureDevice
3586         https://bugs.webkit.org/show_bug.cgi?id=164767
3587         <rdar://problem/29263696>
3588
3589         Reviewed by Eric Carlson.
3590
3591         * UIProcess/API/C/WKPage.cpp: Remove kWKMediaHasCaptureDevice.
3592         (WKPageGetMediaState):
3593         * UIProcess/API/C/WKPagePrivate.h:
3594
3595 2016-11-15  Daniel Bates  <dabates@apple.com>
3596
3597         Disallow loads using HTTP 0.9 at the ResourceHandle/NetworkDataTask level
3598         https://bugs.webkit.org/show_bug.cgi?id=164662
3599         <rdar://problem/29268514>
3600
3601         Reviewed by Alex Christensen and Brady Eidson.
3602
3603         Make changes to NetworkDataTask similar to the changes made to ResourceHandle so as to
3604         disallow non-default port HTTP 0.9 loads when using the ENABLE(NETWORK_SESSION) networking
3605         code path in WebKit2.
3606
3607         * NetworkProcess/NetworkDataTask.cpp:
3608         (WebKit::NetworkDataTask::didReceiveResponse): Added. Fail the load if it is using HTTP 0.9.
3609         Otherwise notify the client that we received a response.
3610         * NetworkProcess/NetworkDataTask.h:
3611         * NetworkProcess/NetworkDataTaskBlob.cpp:
3612         (WebKit::NetworkDataTaskBlob::resume): Substitute dispatchDidReceiveResponse() for didReceiveResponse()
3613         as the latter has been renamed to the former.
3614         (WebKit::NetworkDataTaskBlob::getSizeForNext): Ditto.
3615         (WebKit::NetworkDataTaskBlob::dispatchDidReceiveResponse): Renamed from didReceiveResponse().
3616         * NetworkProcess/NetworkDataTaskBlob.h:
3617         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
3618         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
3619         (WebKit::NetworkDataTaskCocoa::didReceiveResponse): Deleted.
3620         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
3621         (WebKit::NetworkDataTaskSoup::didSendRequest): Substitute dispatchDidReceiveResponse() for didReceiveResponse()
3622         as the latter has been renamed to the former.
3623         (WebKit::NetworkDataTaskSoup::dispatchDidReceiveResponse): Renamed from didReceiveResponse(). Also
3624         remove the local variable response and inline its value into the call to ResourceHandle::didReceiveResponse()
3625         as this variable is used exactly once in this function and its name does not describe its purpose any more
3626         than its value.
3627         (WebKit::NetworkDataTaskSoup::didRequestNextPart): Substitute dispatchDidReceiveResponse() for didReceiveResponse()
3628         as the latter has been renamed to the former.
3629         * NetworkProcess/soup/NetworkDataTaskSoup.h:
3630
3631 2016-11-14  Alex Christensen  <achristensen@webkit.org>
3632
3633         Move SecurityOrigin::createFromDatabaseIdentifier to SecurityOriginData
3634         https://bugs.webkit.org/show_bug.cgi?id=164720
3635
3636         Reviewed by Brady Eidson.
3637
3638         * DatabaseProcess/DatabaseProcess.cpp:
3639         (WebKit::DatabaseProcess::indexedDatabaseOrigins):
3640         * DatabaseProcess/DatabaseProcess.h:
3641         * NetworkProcess/NetworkProcess.cpp:
3642         (WebKit::fetchDiskCacheEntries):
3643         * Shared/API/c/WKSecurityOriginRef.cpp:
3644         (WKSecurityOriginCreateFromDatabaseIdentifier):
3645         * Shared/WebsiteData/WebsiteData.cpp:
3646         (WebKit::WebsiteData::Entry::encode):
3647         (WebKit::WebsiteData::Entry::decode):
3648         * Shared/WebsiteData/WebsiteData.h:
3649         * UIProcess/API/C/WKKeyValueStorageManager.cpp:
3650         (WKKeyValueStorageManagerGetStorageDetailsByOrigin):
3651         * UIProcess/Storage/LocalStorageDatabaseTracker.cpp:
3652         (WebKit::LocalStorageDatabaseTracker::deleteDatabasesModifiedSince):
3653         (WebKit::LocalStorageDatabaseTracker::origins):
3654         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
3655         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
3656         (WebKit::UserMediaPermissionRequestManagerProxy::enumerateMediaDevicesForFrame):
3657         * UIProcess/WebPageProxy.cpp:
3658         (WebKit::WebPageProxy::exceededDatabaseQuota):
3659         (WebKit::WebPageProxy::reachedApplicationCacheOriginQuota):
3660         (WebKit::WebPageProxy::requestGeolocationPermissionForFrame):
3661         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3662         (WebKit::WebsiteDataStore::fetchData):
3663         (WebKit::WebsiteDataStore::removeData):
3664         (WebKit::WebsiteDataStore::mediaKeyOrigins):
3665         * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
3666         (WKBundleSetDatabaseQuota):
3667         * WebProcess/MediaCache/WebMediaKeyStorageManager.cpp:
3668         (WebKit::WebMediaKeyStorageManager::getMediaKeyOrigins):
3669         * WebProcess/Storage/StorageAreaImpl.cpp:
3670         (WebKit::StorageAreaImpl::create):
3671         (WebKit::StorageAreaImpl::StorageAreaImpl):
3672         (WebKit::StorageAreaImpl::securityOrigin):
3673         * WebProcess/Storage/StorageAreaImpl.h:
3674         * WebProcess/Storage/StorageAreaMap.cpp:
3675         (WebKit::StorageAreaMap::dispatchSessionStorageEvent):
3676         (WebKit::StorageAreaMap::dispatchLocalStorageEvent):
3677         * WebProcess/Storage/StorageAreaMap.h:
3678         (WebKit::StorageAreaMap::securityOrigin):
3679         * WebProcess/Storage/StorageNamespaceImpl.cpp:
3680         (WebKit::StorageNamespaceImpl::didDestroyStorageAreaMap):
3681         (WebKit::StorageNamespaceImpl::storageArea):
3682         * WebProcess/Storage/StorageNamespaceImpl.h:
3683         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
3684         (WebKit::WebChromeClient::exceededDatabaseQuota):
3685         * WebProcess/WebProcess.cpp:
3686         (WebKit::WebProcess::fetchWebsiteData):
3687
3688 2016-11-14  Brent Fulgham  <bfulgham@apple.com>
3689
3690         [Mac][iOS][WK2] Tighten permissions to change CapsLock delay
3691         https://bugs.webkit.org/show_bug.cgi?id=164725
3692         <rdar://problem/28970910>
3693
3694         Reviewed by Alexey Proskuryakov.
3695
3696         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in: Limit access
3697         to the IOKit connection that actually needs it.
3698
3699 2016-11-14  Brent Fulgham  <bfulgham@apple.com>
3700
3701         Unreviewed sandbox fix after r208702
3702
3703         Correct version check to avoid breaking users in Safari Technology Preview
3704         or WebKit nightlies.
3705
3706         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
3707         * WebProcess/com.apple.WebProcess.sb.in:
3708
3709 2016-11-14  Pranjal Jumde  <pjumde@apple.com>
3710
3711         Keychain access in WebKit should be limited to a single process. Earlier this was blocked on the networking framework requiring direct access to keychain, this will be resolved in the upcoming version of macOS.
3712         https://bugs.webkit.org/show_bug.cgi?id=163710
3713         <rdar://problem/24357468>
3714
3715         Reviewed by Darin Adler.
3716
3717         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
3718         * WebProcess/com.apple.WebProcess.sb.in:
3719
3720 2016-11-13  Darin Adler  <darin@apple.com>
3721
3722         Remove many includes of ExceptionCode.h
3723         https://bugs.webkit.org/show_bug.cgi?id=164706
3724
3725         Reviewed by Alex Christensen.
3726
3727         * WebProcess/Storage/StorageAreaImpl.cpp: Removed include of ExceptionCode.h.
3728
3729 2016-11-13  Darin Adler  <darin@apple.com>
3730
3731         Fix exception handling in SQL database code, streamline and update code
3732         https://bugs.webkit.org/show_bug.cgi?id=164685
3733
3734         Reviewed by Sam Weinig.
3735
3736         * UIProcess/API/efl/ewk_database_manager.cpp:
3737         (EwkDatabaseManager::getDatabaseOrigins): Update for change to the
3738         DatabaseTracker::origins function.
3739         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3740         (WebKit::WebsiteDataStore::fetchData): Use DatabaseTracker.
3741         (WebKit::WebsiteDataStore::removeData): Ditto.
3742         * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
3743         (WKBundleSetDatabaseQuota): Ditto.
3744         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
3745         (WebKit::WebChromeClient::exceededDatabaseQuota): Ditto.
3746         * WebProcess/WebProcess.cpp:
3747         (WebKit::WebProcess::processWillSuspendImminently): Ditto.
3748
3749 2016-11-12  Simon Fraser  <simon.fraser@apple.com>
3750
3751         Add a way to get the UI-side scrolling tree as text via UIScriptController
3752         https://bugs.webkit.org/show_bug.cgi?id=164697
3753
3754         Reviewed by Zalan Bujtas.
3755
3756         Add a property to WKWebView to retrieve the scrolling tree as text, for testing.
3757         Expose it via the RemoteScrollingCoordinatorProxy.
3758
3759         * UIProcess/API/Cocoa/WKWebView.mm:
3760         (-[WKWebView _scrollingTreeAsText]):
3761         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3762         * UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp:
3763         (WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeAsText):
3764         * UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h:
3765
3766 2016-11-12  Daniel Bates  <dabates@apple.com>
3767
3768         Incorrect release log message emitted when waiting/not waiting for the WebProcess continue a load
3769         https://bugs.webkit.org/show_bug.cgi?id=164605
3770
3771         Reviewed by Darin Adler.
3772
3773         Currently we emit a release log message of the form "didReceiveResponse: Should wait for
3774         message from WebContent process ..." when we are not waiting for the WebProcess and emit
3775         a message of the form "didReceiveResponse: Should not wait for message from WebContent
3776         process" when we are waiting on the WebProcess. Invert these messages to reflect whether
3777         we are waiting for the WebProcess to send message NetworkResourceLoader::ContinueDidReceiveResponsewhether.
3778
3779         For the main resource NetworkResourceLoader::didReceiveResponse() returns ShouldContinueDidReceiveResponse::No
3780         because we are waiting for the WebProcess to send message NetworkResourceLoader::ContinueDidReceiveResponse
3781         to continue the load. For a subresource we do not need to wait for the WebProcess to allow the load to continue
3782         and hence NetworkResourceLoader::didReceiveResponse() returns ShouldContinueDidReceiveResponse::Yes.
3783
3784         * NetworkProcess/NetworkResourceLoader.cpp:
3785
3786 2016-11-12  Simon Fraser  <simon.fraser@apple.com>
3787
3788         [iOS WK2] Share some code with Mac for post-async-scroll state reconciliation
3789         https://bugs.webkit.org/show_bug.cgi?id=164694
3790
3791         Reviewed by Zalan Bujtas.
3792
3793         Rather than calling FrameView directly, call reconcileScrollingState() on the scrolling
3794         coordinator.
3795
3796         * WebProcess/WebPage/ios/WebPageIOS.mm:
3797         (WebKit::WebPage::updateVisibleContentRects):
3798
3799 2016-11-12  Brian Burg  <bburg@apple.com>
3800
3801         Web Automation: terminate the automation session if the web process crashes
3802         https://bugs.webkit.org/show_bug.cgi?id=164671
3803         <rdar://problem/29028964>
3804
3805         Reviewed by Joseph Pecoraro.
3806
3807         * UIProcess/Automation/WebAutomationSession.h:
3808         * UIProcess/Automation/WebAutomationSession.cpp:
3809         (WebKit::WebAutomationSession::disconnect):
3810         (WebKit::WebAutomationSession::terminate):
3811         Factor out code that disconnects the remote, unpairs, and notifies the client.
3812         Then, expose terminate() which can be called without a FrontendChannel.
3813         Calling this causes the _WKAutomationDelegate to clear the local-side session in the
3814         browser, and disconnecting from the remote will hang up the remote-side session.
3815
3816         * UIProcess/WebPageProxy.cpp:
3817         (WebKit::WebPageProxy::processDidCrash):
3818         Terminate the session.
3819
3820 2016-11-11  Alex Christensen  <achristensen@webkit.org>
3821
3822         Use SecurityOriginData as keys in StorageManager
3823         https://bugs.webkit.org/show_bug.cgi?id=159834
3824         <rdar://problem/27346948>
3825
3826         Reviewed by Brady Eidson.
3827
3828         * Platform/IPC/HandleMessage.h:
3829         (IPC::callMemberFunctionImpl):
3830         Add a missing std::forward so we can use this callMemberFunctionImpl with rvalues.
3831         * UIProcess/API/C/WKApplicationCacheManager.cpp:
3832         (WKApplicationCacheManagerGetApplicationCacheOrigins):
3833         (WKApplicationCacheManagerDeleteEntriesForOrigin):
3834         * UIProcess/API/C/WKKeyValueStorageManager.cpp:
3835         (WKKeyValueStorageManagerGetKeyValueStorageOrigins):
3836         (WKKeyValueStorageManagerDeleteEntriesForOrigin):
3837         * UIProcess/API/C/WKResourceCacheManager.cpp:
3838         (WKResourceCacheManagerGetCacheOrigins):
3839         (WKResourceCacheManagerClearCacheForOrigin):
3840         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
3841         (-[WKWebsiteDataStore _fetchDataRecordsOfTypes:withOptions:completionHandler:]):
3842         * UIProcess/Databases/DatabaseProcessProxy.cpp:
3843         (WebKit::DatabaseProcessProxy::deleteWebsiteDataForOrigins):
3844         * UIProcess/Databases/DatabaseProcessProxy.h:
3845         * UIProcess/Network/NetworkProcessProxy.cpp:
3846         (WebKit::NetworkProcessProxy::getNetworkProcessConnection):
3847         (WebKit::NetworkProcessProxy::deleteWebsiteDataForOrigins):
3848         * UIProcess/Network/NetworkProcessProxy.h:
3849         * UIProcess/Storage/LocalStorageDatabase.cpp:
3850         (WebKit::LocalStorageDatabase::create):
3851         (WebKit::LocalStorageDatabase::LocalStorageDatabase):
3852         (WebKit::LocalStorageDatabase::openDatabase):
3853         (WebKit::LocalStorageDatabase::close):
3854         * UIProcess/Storage/LocalStorageDatabase.h:
3855         * UIProcess/Storage/LocalStorageDatabaseTracker.cpp:
3856         (WebKit::LocalStorageDatabaseTracker::databasePath):
3857         (WebKit::LocalStorageDatabaseTracker::didOpenDatabaseWithOrigin):
3858         (WebKit::LocalStorageDatabaseTracker::deleteDatabaseWithOrigin):
3859         (WebKit::LocalStorageDatabaseTracker::deleteDatabasesModifiedSince):
3860         (WebKit::LocalStorageDatabaseTracker::origins):
3861         * UIProcess/Storage/LocalStorageDatabaseTracker.h:
3862         * UIProcess/Storage/StorageManager.cpp:
3863         (WebKit::StorageManager::StorageArea::securityOrigin):
3864         (WebKit::StorageManager::TransientLocalStorageNamespace::getOrCreateStorageArea):
3865         (WebKit::StorageManager::TransientLocalStorageNamespace::origins):
3866         (WebKit::StorageManager::TransientLocalStorageNamespace::clearStorageAreasMatchingOrigin):
3867         (WebKit::StorageManager::StorageArea::StorageArea):
3868         (WebKit::StorageManager::StorageArea::clone):
3869         (WebKit::StorageManager::StorageArea::items):
3870         (WebKit::StorageManager::StorageArea::openDatabaseAndImportItemsIfNeeded):
3871         (WebKit::StorageManager::LocalStorageNamespace::didDestroyStorageArea):
3872         (WebKit::StorageManager::LocalStorageNamespace::clearStorageAreasMatchingOrigin):
3873         (WebKit::StorageManager::LocalStorageNamespace::clearAllStorageAreas):
3874         (WebKit::StorageManager::SessionStorageNamespace::origins):
3875         (WebKit::StorageManager::SessionStorageNamespace::clearStorageAreasMatchingOrigin):
3876         (WebKit::StorageManager::SessionStorageNamespace::cloneTo):
3877         (WebKit::StorageManager::getSessionStorageOrigins):
3878         (WebKit::StorageManager::deleteSessionStorageOrigins):
3879         (WebKit::StorageManager::deleteSessionStorageEntriesForOrigins):
3880         (WebKit::StorageManager::getLocalStorageOrigins):
3881         (WebKit::StorageManager::deleteLocalStorageEntriesForOrigin):
3882         (WebKit::StorageManager::deleteLocalStorageOriginsModifiedSince):
3883         (WebKit::StorageManager::deleteLocalStorageEntriesForOrigins):
3884         (WebKit::StorageManager::createLocalStorageMap):
3885         (WebKit::StorageManager::createTransientLocalStorageMap):
3886         (WebKit::StorageManager::createSessionStorageMap):
3887         (WebKit::StorageManager::getOrCreateLocalStorageNamespace):
3888         (WebKit::StorageManager::getOrCreateTransientLocalStorageNamespace):
3889         (WebKit::StorageManager::StorageArea::create): Deleted.
3890         (WebKit::StorageManager::LocalStorageNamespace::getOrCreateStorageArea): Deleted.
3891         (WebKit::StorageManager::SessionStorageNamespace::getOrCreateStorageArea): Deleted.
3892         * UIProcess/Storage/StorageManager.h:
3893         * UIProcess/WebProcessProxy.cpp:
3894         (WebKit::WebProcessProxy::deleteWebsiteDataForOrigins):
3895         * UIProcess/WebProcessProxy.h:
3896         * UIProcess/WebsiteData/WebsiteDataRecord.cpp:
3897         (WebKit::WebsiteDataRecord::displayNameForOrigin):
3898         (WebKit::WebsiteDataRecord::add):
3899         * UIProcess/WebsiteData/WebsiteDataRecord.h:
3900         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3901         (WebKit::WebsiteDataStore::fetchData):
3902         (WebKit::WebsiteDataStore::removeData):
3903         (WebKit::WebsiteDataStore::mediaKeyOrigins):
3904         (WebKit::WebsiteDataStore::removeMediaKeys):
3905         * UIProcess/WebsiteData/WebsiteDataStore.h:
3906         Fewer SecurityOrigin uses in the UIProcess!  Hooray!
3907
3908 2016-11-11  Ryosuke Niwa  <rniwa@webkit.org>
3909
3910         Hovering over a slotted Text node clears hover state
3911         https://bugs.webkit.org/show_bug.cgi?id=164002
3912         <rdar://problem/29040471>
3913
3914         Reviewed by Simon Fraser.
3915
3916         * WebProcess/WebPage/WebPage.cpp:
3917         (WebKit::WebPage::determinePrimarySnapshottedPlugIn):
3918         * WebProcess/WebPage/mac/WebPageMac.mm:
3919         (WebKit::WebPage::performImmediateActionHitTestAtLocation):
3920
3921 2016-11-11  Wenson Hsieh  <wenson_hsieh@apple.com>
3922
3923         [WK2] autocorrect and autocapitalize attributes do not work in contenteditable elements
3924         https://bugs.webkit.org/show_bug.cgi?id=164538
3925         <rdar://problem/8418711>
3926
3927         Reviewed by Ryosuke Niwa.
3928
3929         Consult HTMLElement::autocorrect() and HTMLElement::autocapitalizeType() when assembling the assisted node
3930         information for the currently assisted node.
3931
3932         * Shared/AssistedNodeInformation.h:
3933         * UIProcess/ios/WKContentViewInteraction.mm:
3934         (toUITextAutocapitalize):
3935         * WebProcess/WebPage/ios/WebPageIOS.mm:
3936         (WebKit::WebPage::getAssistedNodeInformation):
3937
3938 2016-11-11  Beth Dakin  <bdakin@apple.com>
3939
3940         Move to modern TouchBar methods
3941         https://bugs.webkit.org/show_bug.cgi?id=164655
3942         -and corresponding-
3943         rdar://problem/29226911
3944
3945         Reviewed by Wenson Hsieh.
3946
3947         customizationDefaultItemIdentifiers -> defaultItemIdentifiers
3948         itemIdentifiers -> defaultItemIdentifiers
3949         defaultItems -> templateItems
3950
3951         * UIProcess/Cocoa/WebViewImpl.mm:
3952         (WebKit::plainTextTouchBarDefaultItemIdentifiers):
3953         (WebKit::richTextTouchBarDefaultItemIdentifiers):
3954         (WebKit::WebViewImpl::setUpTextTouchBar):
3955         (WebKit::WebViewImpl::updateTextTouchBar):
3956         (WebKit::plainTextTouchBarCustomizationDefaultItemIdentifiers): Deleted.
3957         (WebKit::richTextTouchBarCustomizationDefaultItemIdentifiers): Deleted.
3958
3959 2016-11-11  Brent Fulgham  <bfulgham@apple.com>
3960
3961         Get rid of old sandbox rules for OS's we no longer support
3962         https://bugs.webkit.org/show_bug.cgi?id=164638
3963
3964         Reviewed by Simon Fraser.
3965
3966         Clean up the various sandbox profiles to get rid of rules that applied to operating system
3967         versions we no longer support, or were added in support of bugs that have long since been
3968         fixed.
3969
3970         This should introduce no change in behavior.
3971
3972         * DatabaseProcess/mac/com.apple.WebKit.Databases.sb.in:
3973         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
3974         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
3975         * Resources/PlugInSandboxProfiles/com.oracle.java.JavaAppletPlugin.sb:
3976         * WebProcess/com.apple.WebProcess.sb.in:
3977
3978 2016-11-11  Brady Eidson  <beidson@apple.com>
3979
3980         IndexedDB 2.0: "close pending flag" and firing blocked events all need fixing.
3981         https://bugs.webkit.org/show_bug.cgi?id=164641
3982
3983         Reviewed by Alex Christensen.
3984
3985         * DatabaseProcess/IndexedDB/WebIDBConnectionToClient.cpp:
3986         (WebKit::WebIDBConnectionToClient::databaseConnectionPendingClose):
3987         * DatabaseProcess/IndexedDB/WebIDBConnectionToClient.h:
3988         * DatabaseProcess/IndexedDB/WebIDBConnectionToClient.messages.in:
3989
3990         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
3991         (WebKit::WebIDBConnectionToServer::databaseConnectionPendingClose):
3992         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h:
3993
3994 2016-11-11  Eric Carlson  <eric.carlson@apple.com>
3995
3996         [MediaStream] defer resolution of getUserMedia promise made in a background tab
3997         https://bugs.webkit.org/show_bug.cgi?id=164643
3998         <rdar://problem/29048317>
3999
4000         Reviewed by Brady Eidson.
4001
4002         Do not ask for user for access to capture devices when the document does not
4003         allow media to play, wait until playback is allowed.
4004
4005         * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
4006         (WebKit::UserMediaPermissionRequestManager::startUserMediaRequest):
4007         (WebKit::UserMediaPermissionRequestManager::sendUserMediaRequest):
4008         (WebKit::UserMediaPermissionRequestManager::mediaCanStart):
4009         (WebKit::UserMediaPermissionRequestManager::grantUserMediaDevicesSandboxExtension):
4010         * WebProcess/MediaStream/UserMediaPermissionRequestManager.h:
4011         * WebProcess/Plugins/PluginView.cpp:
4012         (WebKit::PluginView::mediaCanStart):
4013         * WebProcess/Plugins/PluginView.h: