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