1960b348f6102830c79b63ae8de16291f0fc365e
[WebKit.git] / Source / WebKit2 / ChangeLog
1 2016-03-26  Dan Bernstein  <mitz@apple.com>
2
3         Tried to fix the build.
4
5         * UIProcess/API/Cocoa/WKWebView.mm:
6         (-[WKWebView _takeViewSnapshot]):
7
8 2016-03-26  Dan Bernstein  <mitz@apple.com>
9
10         Tried to fix the build.
11
12         * UIProcess/API/Cocoa/WKWebView.mm:
13         (-[WKWebView _takeViewSnapshot]):
14
15 2016-03-26  Dean Jackson  <dino@apple.com>
16
17         Fix build after my most recent commit.
18
19         * UIProcess/API/Cocoa/WKWebView.mm:
20         (WebKit::bufferFormat): Delete the WebKitAdditions include.
21
22 2016-03-25  Dean Jackson  <dino@apple.com>
23
24         Move extended color detection into Open Source
25         https://bugs.webkit.org/show_bug.cgi?id=155909
26         <rdar://problem/25369754>
27
28         Reviewed by Anders Carlsson.
29
30         The code for detecting extended color displays
31         was hidden while the iPad Pro 9.7" was in development.
32         Now it is public, move the detection to Open Source.
33
34         While doing this, add a new method to PlatformScreen
35         so that we have a more obvious way to detect such
36         displays.
37
38         * Shared/mac/RemoteLayerBackingStore.mm:
39         (WebKit::bufferFormat): No need to use WebKitAdditions any
40         more.
41
42 2016-03-26  Dan Bernstein  <mitz@apple.com>
43
44         Treat SHA-1-signed certificates as insecure by default.
45
46         Reviewed by Sam Weinig.
47
48         * UIProcess/API/APIPageConfiguration.h: Initialize m_treatsSHA1SignedCertificatesAsInsecure
49           to true.
50         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
51         (-[WKWebViewConfiguration init]): Initialize _treatsSHA1SignedCertificatesAsInsecure to YES.
52
53 2016-03-25  Dean Jackson  <dino@apple.com>
54
55         Remove use of extern "C" to include QuartzCore files
56         https://bugs.webkit.org/show_bug.cgi?id=155905
57
58         Reviewed by Anders Carlson.
59
60         We can avoid having to wrap constants in extern "C", since they
61         are mangled the same in both C and C++.
62
63         * UIProcess/mac/RemoteLayerTreeHost.mm: Remove the
64         mention of CABackdropLayer.
65
66 2016-03-25  Brian Burg  <bburg@apple.com>
67
68         Web Inspector: protocol generator should prefix C++ filenames with the protocol group
69         https://bugs.webkit.org/show_bug.cgi?id=155859
70         <rdar://problem/25349859>
71
72         Reviewed by Alex Christensen and Joseph Pecoraro.
73
74         Adjust header include and build system paths.
75
76         * CMakeLists.txt:
77         Revert the workaround introduced in r198659 since this change fixes the
78         underlying issue.
79
80         * DerivedSources.make:
81         * UIProcess/Automation/WebAutomationSession.cpp:
82         * UIProcess/Automation/WebAutomationSession.h:
83         * WebKit2.xcodeproj/project.pbxproj:
84
85 2016-03-25  Alex Christensen  <achristensen@webkit.org>
86
87         Remove unused lambda capture after r196984.
88
89         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
90         (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]):
91         resourceResponse is not used in the lambda.
92
93 2016-03-25  Alex Christensen  <achristensen@webkit.org>
94
95         Fix Mac CMake build.
96
97         * PlatformMac.cmake:
98
99 2016-03-24  Alex Christensen  <achristensen@webkit.org>
100
101         Fix Mac CMake build.
102
103         * CMakeLists.txt:
104         Temporarily add DERIVED_SOURCES_JAVASCRIPTCORE_DIR after DERIVED_SOURCES_WEBCORE_DIR,
105         because both contain a unique header named InspectorBackendDispatchers.h and this include
106         order includes the correct one for WebKit2 first.
107         * PlatformMac.cmake:
108         Add new files.  Optionally link to AVFAudio.
109
110 2016-03-24  Said Abou-Hallawa  <sabouhallawa@apple,com>
111
112         Change NativeImagePtr for CG to be RetainPtr<CGImageRef>
113         https://bugs.webkit.org/show_bug.cgi?id=155412
114
115         Reviewed by Darin Adler.
116
117         * Shared/CoordinatedGraphics/WebCoordinatedSurface.cpp:
118         (WebKit::WebCoordinatedSurface::createWithSurface):
119         (WebKit::WebCoordinatedSurface::create):
120         (WebKit::WebCoordinatedSurface::WebCoordinatedSurface):
121         (WebKit::WebCoordinatedSurface::copyToTexture):
122         * Shared/CoordinatedGraphics/WebCoordinatedSurface.h:
123         * Shared/ShareableBitmap.cpp:
124         (WebKit::ShareableBitmap::create):
125         (WebKit::ShareableBitmap::createShareable):
126         (WebKit::ShareableBitmap::ShareableBitmap):
127         * Shared/ShareableBitmap.h:
128         Replace PassRefPtr with RefPtr and use WTFMove() instead of RefPtr::release()
129         when passing the RefPtr.
130         
131         * Shared/cairo/ShareableBitmapCairo.cpp:
132         (WebKit::createSurfaceFromData):
133         (WebKit::ShareableBitmap::createCairoSurface):
134         Replace PassRefPtr with RefPtr.
135         
136         (WebKit::ShareableBitmap::createImage):
137         * Shared/cg/ShareableBitmapCG.cpp:
138         (WebKit::ShareableBitmap::createImage):
139         Replace PassRefPtr with RefPtr and use the move semantics when calling
140         BitmapImage::create().
141
142         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
143         (WebKit::CoordinatedLayerTreeHost::createCoordinatedSurface):
144         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h:
145         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp:
146         (WebKit::ThreadedCoordinatedLayerTreeHost::createCoordinatedSurface):
147         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h:
148         Replace PassRefPtr with RefPtr
149
150 2016-03-24  Enrica Casucci  <enrica@apple.com>
151
152         Adopt new SPI from DataDetectorsCore to decide link behavior.
153         https://bugs.webkit.org/show_bug.cgi?id=155780
154         rdar://problem/25303631
155
156         Reviewed by Sam Weinig.
157
158         Changed use of data detection functions to take
159         a reference to Element instead of a pointer.
160
161         * WebProcess/WebPage/ios/WebPageIOS.mm:
162         (WebKit::WebPage::handleTap):
163         (WebKit::WebPage::commitPotentialTap):
164         (WebKit::WebPage::getPositionInformation):
165
166 2016-03-24  Chris Dumez  <cdumez@apple.com>
167
168         [WK2] Disable network cache speculative validation by default
169         https://bugs.webkit.org/show_bug.cgi?id=155857
170         <rdar://problem/25233210>
171
172         Reviewed by Alex Christensen.
173
174         Disable network cache speculative validation by default. Clients such
175         as Safari now use the API added in r198544 to enable if they want.
176
177         * UIProcess/API/APIProcessPoolConfiguration.h:
178
179 2016-03-24  Alex Christensen  <achristensen@webkit.org>
180
181         Fix null dereferencing in NetworkLoad::continueCanAuthenticateAgainstProtectionSpace
182         https://bugs.webkit.org/show_bug.cgi?id=155799
183         rdar://25289012
184
185         Reviewed by Tim Horton.
186
187         * NetworkProcess/NetworkLoad.cpp:
188         (WebKit::NetworkLoad::continueCanAuthenticateAgainstProtectionSpace):
189         Null-check all the things!
190
191 2016-03-23  Tim Horton  <timothy_horton@apple.com>
192
193         MiniBrowser doesn't use accelerated drawing in WebKit2 windows if a WebKit1 window was opened first
194         https://bugs.webkit.org/show_bug.cgi?id=141576
195         <rdar://problem/25304548>
196
197         Reviewed by Simon Fraser.
198
199         * UIProcess/API/Cocoa/WKPreferences.mm:
200         (-[WKPreferences init]):
201         Make the NSUserDefaults key prefix for debug preferences (the only ones read
202         from NSUserDefaults) "WebKitDebug" instead of just "WebKit" so that they
203         don't conflict with the names that WebKit1 registers default values for.
204
205 2016-03-23  Carlos Garcia Campos  <cgarcia@igalia.com>
206
207         Use Region instead of IntRect in PageClient and WebPageProxy setViewNeedsDisplay method
208         https://bugs.webkit.org/show_bug.cgi?id=155747
209
210         Reviewed by Darin Adler.
211
212         This way instead of calling setViewNeedsDisplay() for every
213         rectangle in the damage area, we can build a region and call
214         setViewNeedsDisplay() once. GTK+ has API to queue a redraw for a
215         given region, so we also avoid scheduling multiple redraws in GTK+
216         port.
217
218         * UIProcess/API/gtk/PageClientImpl.cpp:
219         (WebKit::PageClientImpl::setViewNeedsDisplay): Convert the Region
220         into a cairo_region_t and use gtk_widget_queue_draw_region()
221         instyead of gtk_widget_queue_draw_area().
222         * UIProcess/API/gtk/PageClientImpl.h:
223         * UIProcess/DrawingAreaProxyImpl.cpp:
224         (WebKit::DrawingAreaProxyImpl::incorporateUpdate): Build a Region
225         with the damage rectangles and call
226         WebPageProxy::setViewNeedsDisplay() once.
227         * UIProcess/PageClient.h:
228         * UIProcess/WebPageProxy.cpp:
229         (WebKit::WebPageProxy::setViewNeedsDisplay):
230         * UIProcess/WebPageProxy.h:
231         * UIProcess/efl/WebView.cpp:
232         (WebKit::WebView::setViewNeedsDisplay):
233         * UIProcess/efl/WebView.h:
234         * UIProcess/ios/PageClientImplIOS.h:
235         * UIProcess/ios/PageClientImplIOS.mm:
236         (WebKit::PageClientImpl::setViewNeedsDisplay):
237         * UIProcess/mac/PageClientImpl.h:
238         * UIProcess/mac/PageClientImpl.mm:
239         (WebKit::PageClientImpl::setViewNeedsDisplay):
240
241 2016-03-22  Tim Horton  <timothy_horton@apple.com>
242
243         Invoking a link preview on a complex link (e.g. an image) results in an empty TextIndicator
244         https://bugs.webkit.org/show_bug.cgi?id=155779
245         <rdar://problem/22408793>
246
247         Reviewed by Simon Fraser.
248
249         * WebProcess/WebPage/mac/WebPageMac.mm:
250         (WebKit::WebPage::dictionaryPopupInfoForRange):
251         (WebKit::WebPage::performImmediateActionHitTestAtLocation):
252         Use the TextIndicator mode where we give up on selection-only snapshotting
253         and just paint all content on Mac, similar to what we do for 3D Touch indicators.
254
255 2016-03-22  Alex Christensen  <achristensen@webkit.org>
256
257         Fix HTTPS on Mac using NSURLSession after r198457
258         https://bugs.webkit.org/show_bug.cgi?id=155774
259         <rdar://problem/25301027>
260
261         Reviewed by Anders Carlsson.
262
263         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
264         (WebKit::NetworkSession::NetworkSession):
265         r198457 was intended to fix an issue on iOS and have no change in behavior on Mac.
266         It did have a subtle change in behavior, setting the source application bundle identifier
267         on iOS and was causing problems with HTTPS connections using NSURLSession, so this patch
268         reverts that change.
269
270 2016-03-22  Beth Dakin  <bdakin@apple.com>
271
272         Advanced spell checking should be guarded behind 
273         HAVE(ADVANCED_SPELL_CHECKING)
274         https://bugs.webkit.org/show_bug.cgi?id=155738
275
276         Reviewed by Geoff Garen.
277
278         * UIProcess/Cocoa/WebViewImpl.mm:
279         (WebKit::WebViewImpl::requestCandidatesForSelectionIfNeeded):
280         (WebKit::WebViewImpl::handleRequestedCandidates):
281         (WebKit::WebViewImpl::insertText):
282         * UIProcess/mac/TextCheckerMac.mm:
283         (WebKit::TextChecker::checkTextOfParagraph):
284         (WebKit::TextChecker::getGuessesForWord):
285         * config.h:
286
287 2016-03-22  Chris Dumez  <cdumez@apple.com>
288
289         Add a setting to let the client toggle support for network cache speculative validation
290         https://bugs.webkit.org/show_bug.cgi?id=155622
291         <rdar://problem/25233209>
292
293         Reviewed by Antti Koivisto.
294
295         Copy new m_diskCacheSpeculativeValidationEnabled member introduced
296         in r198470 in ProcessPoolConfiguration::copy().
297
298         * UIProcess/API/APIProcessPoolConfiguration.cpp:
299         (API::ProcessPoolConfiguration::copy):
300
301 2016-03-22  Carlos Garcia Campos  <cgarcia@igalia.com>
302
303         [GTK] WebInspector broken after r197620
304         https://bugs.webkit.org/show_bug.cgi?id=155497
305         <rdar://problem/25171910>
306
307         Reviewed by Philippe Normand.
308
309         Stop registering resource:// URLs as local, because they are not
310         like a local file at all. Compare also the URL protocols when
311         checking whether requested URL is main or test inspector page
312         instead of checking that the protocol is registered as local.
313
314         * UIProcess/WebInspectorProxy.cpp:
315         (WebKit::isMainOrTestInspectorPage): Compare also the URL protocols.
316         * UIProcess/WebInspectorProxy.h:
317         * UIProcess/gtk/WebInspectorProxyGtk.cpp:
318         (WebKit::WebInspectorProxy::platformCreateInspectorPage): Do not
319         set setAllowFileAccessFromFileURLs setting to true.
320         * UIProcess/gtk/WebProcessPoolGtk.cpp:
321         (WebKit::WebProcessPool::platformInitializeWebProcess): Do not
322         register resource:// URLS as local.
323
324 2016-03-22  Alberto Garcia  <berto@igalia.com>
325
326         Unreviewed typo fixes.
327
328         * Shared/linux/WebMemorySamplerLinux.cpp:
329         (WebKit::WebMemorySampler::sampleWebKit): "Commited" => "Committed"
330         * UIProcess/API/gtk/WebKitFileChooserRequest.cpp:
331         (webkit_file_chooser_request_select_files): "choosen" => "chosen"
332         * UIProcess/API/gtk/WebKitUserMediaPermissionRequest.cpp:
333         (webkit_user_media_permission_request_class_init): "Wether" => "Whether"
334
335 2016-03-22  Carlos Garcia Campos  <cgarcia@igalia.com>
336
337         Remove unused display and scroll view methods from PageClient and WebPageProxy
338         https://bugs.webkit.org/show_bug.cgi?id=155744
339
340         Reviewed by Andreas Kling.
341
342         We have displayView(), canScrollView() and scrollView() that are
343         used by DrawingAreaProxyImpl which is only used by GTK+ port that
344         doesn't implement those methods.
345
346         * UIProcess/API/gtk/PageClientImpl.cpp:
347         (WebKit::PageClientImpl::displayView): Deleted.
348         (WebKit::PageClientImpl::scrollView): Deleted.
349         * UIProcess/API/gtk/PageClientImpl.h:
350         * UIProcess/DrawingAreaProxyImpl.cpp:
351         (WebKit::DrawingAreaProxyImpl::incorporateUpdate): Update the
352         whole view when scrolling, or the damage area otherwise.
353         * UIProcess/PageClient.h:
354         * UIProcess/WebPageProxy.cpp:
355         (WebKit::WebPageProxy::displayView): Deleted.
356         (WebKit::WebPageProxy::canScrollView): Deleted.
357         (WebKit::WebPageProxy::scrollView): Deleted.
358         * UIProcess/WebPageProxy.h:
359         * UIProcess/efl/WebView.cpp:
360         (WebKit::WebView::displayView): Deleted.
361         (WebKit::WebView::scrollView): Deleted.
362         * UIProcess/efl/WebView.h:
363         * UIProcess/ios/PageClientImplIOS.h:
364         * UIProcess/ios/PageClientImplIOS.mm:
365         (WebKit::PageClientImpl::displayView): Deleted.
366         (WebKit::PageClientImpl::canScrollView): Deleted.
367         (WebKit::PageClientImpl::scrollView): Deleted.
368         * UIProcess/mac/PageClientImpl.h:
369         * UIProcess/mac/PageClientImpl.mm:
370         (WebKit::PageClientImpl::displayView): Deleted.
371         (WebKit::PageClientImpl::canScrollView): Deleted.
372         (WebKit::PageClientImpl::scrollView): Deleted.
373
374 2016-03-22  Zan Dobersek  <zdobersek@igalia.com>
375
376         [CoordinatedGraphics] Polish std::function<> usage in ThreadedCompositor, CoordinatedGraphicsScene
377         https://bugs.webkit.org/show_bug.cgi?id=155726
378
379         Reviewed by Darin Adler.
380
381         Adjust the methods in ThreadedCompositor and CoordinatedGraphicsScene
382         classes to accept std::function<> arguments via rvalue references. This
383         should prevent both unnecessary copies and moves.
384
385         Fix lambda expressions that are most commonly used to construct the
386         std::function<> objects so that they don't capture-by-value by default,
387         but instead list the captured values verbosely. This part alone exposed
388         an issue in ThreadedCompositor::didChangeVisibleRect() where we were
389         capturing the `this' value by default, instead of a protector RefPtr.
390
391         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
392         (WebKit::CoordinatedGraphicsScene::dispatchOnMainThread):
393         (WebKit::CoordinatedGraphicsScene::dispatchOnClientRunLoop):
394         (WebKit::CoordinatedGraphicsScene::paintToCurrentGLContext):
395         (WebKit::CoordinatedGraphicsScene::onNewBufferAvailable):
396         (WebKit::CoordinatedGraphicsScene::commitSceneState):
397         (WebKit::CoordinatedGraphicsScene::purgeGLResources):
398         (WebKit::CoordinatedGraphicsScene::commitScrollOffset):
399         (WebKit::CoordinatedGraphicsScene::appendUpdate):
400         (WebKit::CoordinatedGraphicsScene::setActive):
401         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
402         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
403         (WebKit::CompositingRunLoop::CompositingRunLoop):
404         (WebKit::CompositingRunLoop::callOnCompositingRunLoop):
405         (WebKit::ThreadedCompositor::setNeedsDisplay):
406         (WebKit::ThreadedCompositor::setNativeSurfaceHandleForCompositing):
407         (WebKit::ThreadedCompositor::setDeviceScaleFactor):
408         (WebKit::ThreadedCompositor::didChangeViewportSize):
409         (WebKit::ThreadedCompositor::didChangeViewportAttribute):
410         (WebKit::ThreadedCompositor::didChangeContentsSize):
411         (WebKit::ThreadedCompositor::scrollTo):
412         (WebKit::ThreadedCompositor::scrollBy):
413         (WebKit::ThreadedCompositor::didChangeVisibleRect):
414         (WebKit::ThreadedCompositor::callOnCompositingThread):
415         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
416
417 2016-03-22  Zan Dobersek  <zdobersek@igalia.com>
418
419         [CoordinatedGraphics] Prefer RunLoop::main().dispatch() over callOnMainThread()
420         https://bugs.webkit.org/show_bug.cgi?id=155725
421
422         Reviewed by Darin Adler.
423
424         Unify the CoordinatedGraphics code in the WebKit2 layer to use RunLoop
425         for dispatching tasks on either the main thread or the composition thread
426         in case of using the threaded compositor. The latter is already the default,
427         so this patch just replaces calls to callOnMainThread() with calls to
428         RunLoop::main().dispatch().
429
430         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
431         (WebKit::CoordinatedGraphicsScene::dispatchOnMainThread):
432         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
433         (WebKit::ThreadedCompositor::didChangeVisibleRect):
434
435 2016-03-18  Enrica Casucci  <enrica@apple.com>
436
437         Enable preview of images as attachments.
438         https://bugs.webkit.org/show_bug.cgi?id=155674
439         rdar://problem/25242656
440
441         Reviewed by Darin Adler.
442
443         If the client cannot handle image preview, but can handle attachments,
444         let them handle images as attachments.
445
446         * UIProcess/ios/WKContentViewInteraction.mm:
447         (-[WKContentView _dataForPreviewItemController:atPosition:type:]):
448
449 2016-03-20  Dan Bernstein  <mitz@apple.com>
450
451         [Mac] Determine TARGET_MAC_OS_X_VERSION_MAJOR from MACOSX_DEPLOYMENT_TARGET rather than from MAC_OS_X_VERSION_MAJOR
452         https://bugs.webkit.org/show_bug.cgi?id=155707
453         <rdar://problem/24980691>
454
455         Reviewed by Darin Adler.
456
457         * Configurations/Base.xcconfig: Set TARGET_MAC_OS_X_VERSION_MAJOR based on the last
458           component of MACOSX_DEPLOYMENT_TARGET.
459         * Configurations/DebugRelease.xcconfig: For engineering builds, preserve the behavior of
460           TARGET_MAC_OS_X_VERSION_MAJOR being the host’s OS version.
461
462 2016-03-20  Darin Adler  <darin@apple.com>
463
464         Disable Caches in Safari's Develop menu does not disable caches.
465         https://bugs.webkit.org/show_bug.cgi?id=64483
466
467         Reviewed by Antti Koivisto.
468
469         Moved functions from WKPreferences to WKPage.
470
471         * Shared/WebPreferencesDefinitions.h: Removed ResourceCachingDisabled.
472
473         * UIProcess/API/C/WKPage.cpp:
474         (WKPageGetResourceCachingDisabled): Added.
475         (WKPageSetResourceCachingDisabled): Added.
476         * UIProcess/API/C/WKPagePrivate.h: Added above functions.
477         * UIProcess/API/C/WKPreferences.cpp:
478         (WKPreferencesSetResourceCachingDisabled): Deleted.
479         (WKPreferencesGetResourceCachingDisabled): Deleted.
480         * UIProcess/API/C/WKPreferencesRefPrivate.h: Deleted above functions.
481
482         * UIProcess/WebPageProxy.cpp:
483         (WebKit::WebPageProxy::setResourceCachingDisabled): Added.
484         * UIProcess/WebPageProxy.h:
485         (WebKit::WebPageProxy::isResourceCachingDisabled): Added.
486
487         * WebProcess/WebPage/WebPage.cpp:
488         (WebKit::WebPage::updatePreferences): Removed code to set the setting
489         for resourceCachingDisabled..
490         (WebKit::WebPage::setResourceCachingDisabled): Added.
491         * WebProcess/WebPage/WebPage.h: Declared setResourceCachingDisabled.
492         * WebProcess/WebPage/WebPage.messages.in: Added SetResourceCachingDisabled.
493
494 2016-03-20  Dan Bernstein  <mitz@apple.com>
495
496         Update build settings
497
498         Rubber-stamped by Andy Estes.
499
500         * Configurations/DebugRelease.xcconfig:
501         * Configurations/FeatureDefines.xcconfig:
502         * Configurations/Version.xcconfig:
503
504 2016-03-19  Chris Dumez  <cdumez@apple.com>
505
506         Add a setting to let the client toggle support for network cache speculative validation
507         https://bugs.webkit.org/show_bug.cgi?id=155622
508         <rdar://problem/25233209>
509
510         Reviewed by Darin Adler.
511
512         Add SPI to toggle support for network cache speculative validation.
513         Enable network cache speculative validation by default for now, until
514         I have a chance to update the clients to use the new SPI.
515
516         * UIProcess/API/APIProcessPoolConfiguration.h:
517         * UIProcess/API/C/WKContext.cpp:
518         (WKContextSetDiskCacheSpeculativeValidationEnabled):
519         * UIProcess/API/C/WKContextPrivate.h:
520         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
521         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
522         (-[_WKProcessPoolConfiguration diskCacheSpeculativeValidationEnabled]):
523         (-[_WKProcessPoolConfiguration setDiskCacheSpeculativeValidationEnabled:]):
524         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
525         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
526
527 2016-03-19  Yongjun Zhang  <yongjun_zhang@apple.com>
528
529         https://bugs.webkit.org/show_bug.cgi?id=155664
530         Consider to cap the size of session history data.
531
532         In iOS, if the total history entries data exceeds a threshold (2MB at the moment), don't
533         accumulate more data into the session state blob.
534
535         Reviewed by Darin Adler.
536
537         * UIProcess/mac/LegacySessionStateCoding.cpp:
538         (WebKit::encodeSessionHistory): Stop encoding further history entries data into session state
539             if the total size exceed 2MB in iOS.
540
541 2016-03-18  Alex Christensen  <achristensen@webkit.org>
542
543         Give NSURLSessionConfiguration information about parent process
544         https://bugs.webkit.org/show_bug.cgi?id=155661
545         rdar://problem/25225850
546
547         Reviewed by Anders Carlsson.
548
549         * NetworkProcess/NetworkProcess.cpp:
550         (WebKit::NetworkProcess::initializeNetworkProcess):
551         * NetworkProcess/NetworkProcess.h:
552         * NetworkProcess/NetworkSession.h:
553         (WebKit::NetworkSession::sessionID):
554         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
555         (WebKit::partitionName):
556         (WebKit::NetworkProcess::sourceApplicationAuditData):
557         (WebKit::NetworkProcess::cfURLCacheOrigins):
558         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
559         (WebKit::globalCustomProtocolManager):
560         (WebKit::globalSourceApplicationAuditTokenData):
561         (WebKit::NetworkSession::setCustomProtocolManager):
562         (WebKit::NetworkSession::setSourceApplicationAuditTokenData):
563         (WebKit::NetworkSession::defaultSession):
564         (WebKit::NetworkSession::NetworkSession):
565         Tell the NSURLSessionConfiguration what the source application bundle identifier
566         and audit token data are so we can correctly keep track of which application is using data.
567         This also gives CFNetwork enough information to determine if the application is allowed to
568         use cell data in Settings, so it seems like we do not need to explicitly set allowsCellularAccess.
569         * NetworkProcess/mac/RemoteNetworkingContext.mm:
570         (WebKit::RemoteNetworkingContext::sourceApplicationAuditData):
571         (WebKit::RemoteNetworkingContext::sourceApplicationIdentifier):
572         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
573         (WebKit::WebFrameNetworkingContext::sourceApplicationAuditData):
574         (WebKit::WebFrameNetworkingContext::sourceApplicationIdentifier):
575         * WebProcess/WebProcess.cpp:
576         (WebKit::WebProcess::initializeWebProcess):
577         * WebProcess/WebProcess.h:
578         * WebProcess/cocoa/WebProcessCocoa.mm:
579         (WebKit::WebProcess::platformTerminate):
580         (WebKit::WebProcess::sourceApplicationAuditData):
581         (WebKit::WebProcess::initializeSandbox):
582         I moved the calls to getAuditToken from RemoteNetworkingContext.mm and WebFrameNetworkingContext.mm 
583         to NetworkProcessCocoa.mm and WebProcessCocoa.mm, respectively, to share with NetworkSession code, 
584         which does not use NetworkingContexts.
585
586 2016-03-18  Simon Fraser  <simon.fraser@apple.com>
587
588         Build fix after r198455.
589
590         * UIProcess/WebPageProxy.cpp:
591         (WebKit::WebPageProxy::layerTreeCommitComplete):
592
593 2016-03-18  Simon Fraser  <simon.fraser@apple.com>
594
595         Sideways-scrollable RTL document has wrong initial and reload offset in WKWebView
596         https://bugs.webkit.org/show_bug.cgi?id=155660
597
598         Reviewed by Tim Horton.
599
600         There were two problems with the scroll position of RTL documents on initial and reload
601         in WKWebView.
602
603         First, in the delegatesScrolling() code path, ScrollView::updateScrollbars() needs to
604         tell someone that the scroll origin changed, to trigger a scroll to the page origin.
605
606         Secondly, WKWebView had scrollPosition/scrollOffset confusion in various places. In
607         the restorePageState() code path, WebCore passes an exposedRect; this patch makes
608         it explicit that it's an exposedContentRect, and passes scrollOrigin so that it can
609         be mapped into scrollOffset-relative coordinates that the UIScrollView wants.
610
611         When reloading an RTL page, there was an additional issue; restorePageState()
612         restored the exposedRect, but then we'd see the origin change as a programmatic scroll
613         to 0,0, clobbering the exposedRect. Fix by using a "_commitDidRestoreExposedRect" flag
614         on the WKWebView that is used to ignore the programmatic scroll in that case.
615
616         Ideally these changes would fix fast/scrolling/scroll-position-on-reload-rtl.html, but the
617         test still fails because of timing differences between OS X and iOS.
618
619         * UIProcess/API/Cocoa/WKWebView.mm:
620         (-[WKWebView _didCommitLayerTree:]):
621         (-[WKWebView _layerTreeCommitComplete]):
622         (-[WKWebView _restorePageStateToExposedRect:scrollOrigin:scale:]):
623         (-[WKWebView _scrollToContentScrollPosition:scrollOrigin:]):
624         (-[WKWebView _restorePageStateToExposedRect:scale:]): Deleted.
625         (-[WKWebView _scrollToContentOffset:scrollOrigin:]): Deleted.
626         * UIProcess/API/Cocoa/WKWebViewInternal.h:
627         * UIProcess/PageClient.h:
628         * UIProcess/WebPageProxy.h:
629         * UIProcess/WebPageProxy.messages.in:
630         * UIProcess/ios/PageClientImplIOS.h:
631         * UIProcess/ios/PageClientImplIOS.mm:
632         (WebKit::PageClientImpl::requestScroll):
633         (WebKit::PageClientImpl::layerTreeCommitComplete):
634         (WebKit::PageClientImpl::restorePageState):
635         * UIProcess/ios/WKContentView.h:
636         * UIProcess/ios/WKContentView.mm:
637         (-[WKContentView _layerTreeCommitComplete]):
638         * UIProcess/ios/WebPageProxyIOS.mm:
639         (WebKit::WebPageProxy::layerTreeCommitComplete):
640         (WebKit::WebPageProxy::restorePageState):
641         * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
642         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
643         * WebProcess/WebPage/ios/WebPageIOS.mm:
644         (WebKit::WebPage::restorePageState):
645
646 2016-03-18  Brady Eidson  <beidson@apple.com>
647
648         NSURLSession: Set download resume data when a download fails due to an error.
649         https://bugs.webkit.org/show_bug.cgi?id=155665
650
651         Reviewed by Alex Christensen.
652
653         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
654         (-[WKNetworkSessionDelegate URLSession:task:didCompleteWithError:]): Save the resume data from the
655           NSError userInfo if it exists.
656
657 2016-03-18  Chris Dumez  <cdumez@apple.com>
658
659         Speculative revalidation requests do not have their HTTP user-agent set
660         https://bugs.webkit.org/show_bug.cgi?id=155620
661         <rdar://problem/24657567>
662
663         Reviewed by Brady Eidson.
664
665         Speculative revalidation requests do not have their HTTP user-agent set
666         which could lead to different content getting returned by the server.
667
668         To address the problem, we save the original request's 'user-agent' in
669         the disk cache and re-use it later on for speculative validation
670         requests.
671
672         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
673         (WebKit::NetworkCache::constructRevalidationRequest):
674         (WebKit::NetworkCache::SpeculativeLoadManager::revalidateEntry):
675         (WebKit::NetworkCache::SpeculativeLoadManager::preloadEntry):
676         * NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp:
677         (WebKit::NetworkCache::SubresourceInfo::encode):
678         (WebKit::NetworkCache::SubresourceInfo::decode):
679         (WebKit::NetworkCache::SubresourceInfo::SubresourceInfo):
680         (WebKit::NetworkCache::SubresourceInfo::operator=):
681         (WebKit::NetworkCache::SubresourcesEntry::SubresourcesEntry):
682         (WebKit::NetworkCache::SubresourcesEntry::updateSubresourceLoads):
683         (WebKit::NetworkCache::SubresourcesEntry::decodeStorageRecord): Deleted.
684         * NetworkProcess/cache/NetworkCacheSubresourcesEntry.h:
685         (WebKit::NetworkCache::SubresourceInfo::SubresourceInfo):
686
687 2016-03-18  Enrica Casucci  <enrica@apple.com>
688
689         Add id attribute to _WKActivatedElementInfo.
690         https://bugs.webkit.org/show_bug.cgi?id=155666
691         rdar://problem/25181956
692
693         Reviewed by Beth Dakin.
694
695         * Shared/ios/InteractionInformationAtPosition.h:
696         * Shared/ios/InteractionInformationAtPosition.mm:
697         (WebKit::InteractionInformationAtPosition::encode):
698         (WebKit::InteractionInformationAtPosition::decode):
699         * UIProcess/API/Cocoa/_WKActivatedElementInfo.h:
700         * UIProcess/API/Cocoa/_WKActivatedElementInfo.mm:
701         (-[_WKActivatedElementInfo _initWithType:URL:location:title:ID:rect:image:]):
702         (-[_WKActivatedElementInfo ID]):
703         (-[_WKActivatedElementInfo _initWithType:URL:location:title:rect:image:]): Deleted.
704         * UIProcess/API/Cocoa/_WKActivatedElementInfoInternal.h:
705         * UIProcess/ios/WKActionSheetAssistant.mm:
706         (-[WKActionSheetAssistant showImageSheet]):
707         (-[WKActionSheetAssistant showLinkSheet]):
708         * UIProcess/ios/WKContentViewInteraction.mm:
709         (-[WKContentView _showAttachmentSheet]):
710         (-[WKContentView _showLinkSheet]):
711         (-[WKContentView _dataForPreviewItemController:atPosition:type:]):
712         (-[WKContentView _presentedViewControllerForPreviewItemController:]):
713         * WebProcess/WebPage/ios/WebPageIOS.mm:
714         (WebKit::WebPage::getPositionInformation):
715
716 2016-03-18  Antti Koivisto  <antti@apple.com>
717
718         Protect against excessive cache traversal
719         https://bugs.webkit.org/show_bug.cgi?id=155635
720         rdar://problem/24241008
721
722         Reviewed by Darin Adler.
723
724         We can't handle unlimited number of parallel cache traversal requests from the client.
725         We'll run out of dispatch queues and other system resources. CPU will spin.
726
727         * NetworkProcess/cache/NetworkCache.cpp:
728         (WebKit::NetworkCache::Cache::traverse):
729
730             Add limit of maximum 3 traversals. When exceeded return nothing and log an error.
731
732         * NetworkProcess/cache/NetworkCache.h:
733
734 2016-03-18  Darin Adler  <darin@apple.com>
735
736         Disable Caches in Safari's Develop menu does not disable caches.
737         https://bugs.webkit.org/show_bug.cgi?id=64483
738
739         Reviewed by Antti Koivisto.
740
741         * Shared/WebPreferencesDefinitions.h: Added ResourceCachingDisabled.
742         * UIProcess/API/C/WKPreferences.cpp:
743         (WKPreferencesSetResourceCachingDisabled): Added.
744         (WKPreferencesGetResourceCachingDisabled): Added.
745         * UIProcess/API/C/WKPreferencesRefPrivate.h: Ditto.
746         * WebProcess/WebPage/WebPage.cpp:
747         (WebKit::WebPage::updatePreferences): Push ResourceCachingDisabled setting
748         into WebCore.
749
750 2016-03-18  Carlos Garcia Campos  <cgarcia@igalia.com>
751
752         Unreviewed. Try to fix GTK+ debug build after r198364.
753
754         * WebProcess/gtk/WebProcessMainGtk.cpp: Use WTF::sleep().
755
756 2016-03-17  Alex Christensen  <achristensen@webkit.org>
757
758         SpeculativeLoad needs to continue NetworkLoad when it receives a redirect response
759         https://bugs.webkit.org/show_bug.cgi?id=155612
760
761         Reviewed by Andy Estes.
762
763         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
764         (WebKit::NetworkCache::SpeculativeLoad::willSendRedirectedRequest):
765         Call continueWillSendRequest.  Otherwise, we will hang a thread in the NetworkProcess
766         if we are using ResourceHandle or we will not call the willPerformHTTPRedirection 
767         completion handler if we are using NetworkSession.  This will cause us to stop loading
768         from the server after the maximum number of connections is reached.
769
770 2016-03-17  Tim Horton  <timothy_horton@apple.com>
771
772         Find-in-page indicator in Mail viewer is the wrong scale and cut off
773         https://bugs.webkit.org/show_bug.cgi?id=155605
774         <rdar://problem/23948165>
775
776         Reviewed by Simon Fraser.
777
778         * UIProcess/mac/WKTextFinderClient.mm:
779         (-[WKTextFinderClient didGetImageForMatchResult:]):
780         Initialize the NSImage with the correct size, instead of inferring the
781         size from the bitmap, so that we don't lose information about device pixel ratio.
782
783 2016-03-17  Anders Carlsson  <andersca@apple.com>
784
785         Remove use of dyld_register_image_state_change_handler() in PluginProcessMac.mm
786         https://bugs.webkit.org/show_bug.cgi?id=155596
787
788         Reviewed by Dan Bernstein.
789
790         Use _dyld_register_func_for_add_image instead which is API. Use dladdr to find the image path given its header.
791
792         * Platform/spi/Cocoa/DyldSPI.h: Removed.
793         * PluginProcess/mac/PluginProcessMac.mm:
794         (WebKit::PluginProcess::platformInitializeProcess):
795         * WebKit2.xcodeproj/project.pbxproj:
796
797 2016-03-17  Chris Dumez  <cdumez@apple.com>
798
799         Set the WebContent process's main thread QoS to USER-INTERACTIVE
800         https://bugs.webkit.org/show_bug.cgi?id=155595
801         <rdar://problem/22534965>
802
803         Reviewed by Antti Koivisto.
804
805         Increase the WebContent process main thread's QoS to USER-INTERACTIVE
806         instead of USER-INITIATED as it is drawing UI. However, use a relative
807         priority of -1 so that its priority is lower than the one of the
808         scrolling thread.
809
810         * WebProcess/WebProcess.cpp:
811         (WebKit::WebProcess::initializeWebProcess):
812
813 2016-03-17  Alex Christensen  <achristensen@webkit.org>
814
815         Support manually accepting invalid SSL certificates with NetworkSession
816         https://bugs.webkit.org/show_bug.cgi?id=155442
817         <rdar://problem/24847398>
818
819         Reviewed by Darin Adler.
820
821         When we click continue after getting a warning about an invalid SSL certificate, we call
822         NSURLRequest setAllowsSpecificHTTPSCertificate in NetworkProcess::allowSpecificHTTPSCertificateForHost,
823         which stores information in CFNetwork about the specific invalid SSL certificate we want to accept.
824         If we see such a certificate during a server trust evaluation, we want to tell CFNetwork to accept it.
825         This fixes a loop when going to https://badssl.com, clicking on expired, and clicking continue.
826
827         * NetworkProcess/NetworkDataTask.h:
828         * NetworkProcess/NetworkLoad.cpp:
829         (WebKit::NetworkLoad::didReceiveChallenge):
830         (WebKit::NetworkLoad::continueCanAuthenticateAgainstProtectionSpace):
831         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
832         (WebKit::NetworkDataTask::transferSandboxExtensionToDownload):
833         (WebKit::certificatesMatch):
834         (WebKit::NetworkDataTask::allowsSpecificHTTPSCertificateForHost):
835         (WebKit::NetworkDataTask::suggestedFilename):
836
837 2016-03-17  Csaba Osztrogonác  <ossy@webkit.org>
838
839         [Mac][cmake] Unreviewed buildfix after r198070. Just for fun.
840
841         * PlatformMac.cmake:
842
843 2016-03-17  Andy Estes  <aestes@apple.com>
844
845         [Mac] Enable Content-Disposition: attachment sandbox
846         https://bugs.webkit.org/show_bug.cgi?id=155578
847         <rdar://problem/21886326>
848
849         Reviewed by Dan Bernstein.
850
851         Covered by the existing set of attachment sandbox tests, which have always been run on Mac.
852
853         * WebProcess/WebPage/WebPage.cpp:
854         (WebKit::WebPage::WebPage):
855
856 2016-03-16  Beth Dakin  <bdakin@apple.com>
857
858         Provide NSSpellChecker spellChecking methods with the current insertion point
859         https://bugs.webkit.org/show_bug.cgi?id=155532
860         -and corresponding-
861         rdar://problem/24066952
862
863         Reviewed by Simon Fraser.
864
865         Pass the insertionPoint to the UIProcess
866         * UIProcess/TextChecker.h:
867         * UIProcess/WebPageProxy.cpp:
868         (WebKit::WebPageProxy::checkTextOfParagraph):
869         (WebKit::WebPageProxy::getGuessesForWord):
870         (WebKit::WebPageProxy::requestCheckingOfString):
871         * UIProcess/WebPageProxy.h:
872         * UIProcess/WebPageProxy.messages.in:
873         * UIProcess/efl/TextCheckerEfl.cpp:
874         (WebKit::TextChecker::checkTextOfParagraph):
875         (WebKit::TextChecker::getGuessesForWord):
876         (WebKit::TextChecker::requestCheckingOfString):
877         * UIProcess/gtk/TextCheckerGtk.cpp:
878         (WebKit::TextChecker::getGuessesForWord):
879         (WebKit::TextChecker::requestCheckingOfString):
880         (WebKit::TextChecker::checkTextOfParagraph):
881         * UIProcess/ios/TextCheckerIOS.mm:
882         (WebKit::TextChecker::checkTextOfParagraph):
883         (WebKit::TextChecker::getGuessesForWord):
884         (WebKit::TextChecker::requestCheckingOfString):
885         * UIProcess/mac/TextCheckerMac.mm:
886         (WebKit::TextChecker::checkTextOfParagraph):
887         (WebKit::TextChecker::getGuessesForWord):
888         (WebKit::TextChecker::ignoreWord):
889         (WebKit::TextChecker::requestCheckingOfString):
890
891         Extract the insertion point from the VisibleSelection that WebCore has 
892         passed. 
893         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
894         (WebKit::insertionPointFromCurrentSelection):
895         (WebKit::WebEditorClient::checkTextOfParagraph):
896         (WebKit::WebEditorClient::getGuessesForWord):
897         (WebKit::WebEditorClient::requestCheckingOfString):
898         * WebProcess/WebCoreSupport/WebEditorClient.h:
899
900 2016-03-16  Tim Horton  <timothy_horton@apple.com>
901
902         REGRESSION (r192184): CleanMyDrive 2's tutorial window is blank
903         https://bugs.webkit.org/show_bug.cgi?id=155550
904         <rdar://problem/24250689>
905
906         Reviewed by Dan Bernstein.
907
908         * UIProcess/API/Cocoa/WKWebView.mm:
909         (-[WKWebView _setDrawsTransparentBackground:]):
910         The app is using this SPI via key-value coding, so just keeping the implementation
911         is sufficient to make AppKit stop throwing an undefined key exception.
912         Log once that this is deprecated (... it's also SPI) and then forward to setDrawsBackground.
913
914 2016-03-16  Daniel Bates  <dabates@apple.com>
915
916         <video> and <audio> elements do not obey Content Security Policy on redirect
917         https://bugs.webkit.org/show_bug.cgi?id=155509
918         <rdar://problem/10234844>
919
920         Reviewed by Alex Christensen.
921
922         Use 0ms as the maximum buffering time for media resource just as we do currently.
923
924         * WebProcess/Network/WebLoaderStrategy.cpp:
925         (WebKit::maximumBufferingTime):
926
927 2016-03-16  Chris Dumez  <cdumez@apple.com>
928
929         Unreviewed, rolling out r198235, r198240, r198241, and
930         r198252.
931
932         Causing crashes on ARM
933
934         Reverted changesets:
935
936         "Remove compile time define for SEPARATED_HEAP"
937         https://bugs.webkit.org/show_bug.cgi?id=155508
938         http://trac.webkit.org/changeset/198235
939
940         "Gardening: build fix after r198235."
941         http://trac.webkit.org/changeset/198240
942
943         "Build fix."
944         http://trac.webkit.org/changeset/198241
945
946         "Rename performJITMemcpy to something more inline with our
947         normal webkit function names"
948         https://bugs.webkit.org/show_bug.cgi?id=155525
949         http://trac.webkit.org/changeset/198252
950
951 2016-03-16  Commit Queue  <commit-queue@webkit.org>
952
953         Unreviewed, rolling out r196803.
954         https://bugs.webkit.org/show_bug.cgi?id=155534
955
956         Introduced several rendering issues in popular websites
957         (Requested by KaL on #webkit).
958
959         Reverted changeset:
960
961         "[GTK] Limit the number of tiles according to the visible
962         area"
963         https://bugs.webkit.org/show_bug.cgi?id=126122
964         http://trac.webkit.org/changeset/196803
965
966 2016-03-15  Enrica Casucci  <enrica@apple.com>
967
968         Follow up to r195769.
969         https://bugs.webkit.org/show_bug.cgi?id=155519
970         rdar://problem/25146483
971
972         Reviewed by Tim Horton.
973
974         There are two code paths that lead to calling handleSyntheticClick()
975         where we need to check if the default action can be performed on the
976         data detector link.
977         Only one was covered in r195769 and this patch addresses the missing one.
978         I've also discovered that the point reported in DidNotHandleTapAsClick was
979         incorrectly always (0, 0) and I've fixed it.
980
981         * WebProcess/WebPage/ios/WebPageIOS.mm:
982         (WebKit::WebPage::handleTap):
983
984 2016-03-15  Ryan Haddad  <ryanhaddad@apple.com>
985
986         Unreviewed, rolling out r198230.
987
988         This change caused LayoutTests to fail on Mac
989
990         Reverted changeset:
991
992         "REGRESSION (r194660): Navigating to HTTPS sites may fail with
993         error"
994         https://bugs.webkit.org/show_bug.cgi?id=155455
995         http://trac.webkit.org/changeset/198230
996
997 2016-03-15  Oliver Hunt  <oliver@apple.com>
998
999         Remove compile time define for SEPARATED_HEAP
1000         https://bugs.webkit.org/show_bug.cgi?id=155508
1001
1002         Reviewed by Mark Lam.
1003
1004         Remove the feature define.
1005
1006         * Configurations/FeatureDefines.xcconfig:
1007
1008 2016-03-15  Daniel Bates  <dabates@apple.com>
1009
1010         REGRESSION (r194660): Navigating to HTTPS sites may fail with error
1011         https://bugs.webkit.org/show_bug.cgi?id=155455
1012         <rdar://problem/24308793>
1013
1014         Reviewed by Alexey Proskuryakov.
1015
1016         Fixes an issue where navigating to an HTTPS site may fail because the Security Framework uses
1017         a cache directory that it does not have permission to use.
1018
1019         * Shared/mac/ChildProcessMac.mm:
1020         (WebKit::codeSigningIdentifierForProcess): Queries the Security Framework for the code signed
1021         bundle identifier/code signing identifier.
1022         (WebKit::ChildProcess::initializeSandbox): Use the client identifier as part of the user directory
1023         suffix. Verify that the client identifier matches the code signed bundled identifier/code
1024         signing identifier for the code signed app/tool. Fix minor code style issue; use a C++-style cast
1025         instead of a C-style cast when casting an OSStatus to a long.
1026         (WebKit::findSecCodeForProcess): Deleted; incorporated logic into WebKit::codeSigningIdentifierForProcess().
1027
1028 2016-03-15  Antti Koivisto  <antti@apple.com>
1029
1030         Add Antti to WebKit2 Owners file
1031         https://bugs.webkit.org/show_bug.cgi?id=155504
1032
1033         Reviewed by Anders Carlsson and Sam Weinig.
1034
1035         * Owners:
1036
1037 2016-03-15  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
1038
1039         EFL build has been broken since r198180
1040         https://bugs.webkit.org/show_bug.cgi?id=155488
1041
1042         Unreviewed build fix.
1043
1044         * WebProcess/UserContent/WebUserContentController.h: Use ENABLE(USER_MESSAGE_HANDLERS) guard. 
1045
1046 2016-03-15  Chris Dumez  <cdumez@apple.com>
1047
1048         Regression(r197939): ASSERTION FAILED: url.containsOnlyASCII() in URL.cpp
1049         https://bugs.webkit.org/show_bug.cgi?id=155449
1050         <rdar://problem/25134826>
1051
1052         Reviewed by Carlos Garcia Campos.
1053
1054         Bump WK2 Network Disk Cache version after r197939 as the new cache format
1055         is not compatible with the old one and leads to assertions being hit when
1056         browsing in Debug builds.
1057
1058         SubresourceInfo used to only contain a boolean and would therefore be
1059         serialized as "0" / "1". However, after r197939, a URL field was added
1060         and when trying to decode old cache entries with the new format, we
1061         would try to construct a URL from the String "0" or "1". This would
1062         assert because these are not valid URLs.
1063
1064         * NetworkProcess/cache/NetworkCacheStorage.h:
1065
1066 2016-03-14  Chris Dumez  <cdumez@apple.com>
1067
1068         Unreviewed, rolling out r197981.
1069
1070         Caused a massive PLT regression on Mac.
1071
1072         Reverted changeset:
1073
1074         "Font antialiasing (smoothing) changes when elements are
1075         rendered into compositing layers"
1076         https://bugs.webkit.org/show_bug.cgi?id=23364
1077         http://trac.webkit.org/changeset/197981
1078
1079 2016-03-14  Sam Weinig  <sam@webkit.org>
1080
1081         Add a baseURL parameter to _WKUserStyleSheet
1082         https://bugs.webkit.org/show_bug.cgi?id=155219
1083
1084         Reviewed by Tim Horton.
1085
1086         - Moves to a model for user content where instead of using a WebCore::UserContentController
1087           object, we implement the new WebCore::UserContentProvider interface (on the existing 
1088           WebUserContentController object).
1089         - Uses this to maintain maps of UserStylesSheets and UserScripts along with their identifiers,
1090           freeing up the URL, which had been acting as the identifier, to be used as the baseURL which
1091           was what it was intended for.
1092         - Adds a baseURL property to _WKUserStyleSheet.
1093
1094         * WebKit2.xcodeproj/project.pbxproj:
1095         Add new files.
1096
1097         * Scripts/webkit/messages.py:
1098         (headers_for_type):
1099         Add support for sending WebUserContentControllerDataTypes.
1100
1101         * Shared/WebUserContentControllerDataTypes.cpp: Added.
1102         (WebKit::WebUserScriptData::encode):
1103         (WebKit::WebUserScriptData::decode):
1104         (WebKit::WebUserStyleSheetData::encode):
1105         (WebKit::WebUserStyleSheetData::decode):
1106         * Shared/WebUserContentControllerDataTypes.h: Added.
1107         Add helper types for sending user content over IPC.
1108
1109         * UIProcess/API/APIUserScript.cpp:
1110         (API::UserScript::generateUniqueURL):
1111         (API::UserScript::UserScript):
1112         * UIProcess/API/APIUserScript.h:
1113         * UIProcess/API/APIUserStyleSheet.cpp:
1114         (API::UserStyleSheet::generateUniqueURL):
1115         (API::UserStyleSheet::UserStyleSheet):
1116         * UIProcess/API/APIUserStyleSheet.h:
1117         Add identifiers for tracking across processes.
1118
1119         * UIProcess/API/Cocoa/_WKUserStyleSheet.h:
1120         * UIProcess/API/Cocoa/_WKUserStyleSheet.mm:
1121         (-[_WKUserStyleSheet initWithSource:forMainFrameOnly:legacyWhitelist:legacyBlacklist:baseURL:userContentWorld:]):
1122         (-[_WKUserStyleSheet baseURL]):
1123         Add new initializer which takes a baseURL as well as an accessor for the baseURL.
1124
1125         * UIProcess/UserContent/WebUserContentControllerProxy.cpp:
1126         (WebKit::WebUserContentControllerProxy::addProcess):
1127         (WebKit::WebUserContentControllerProxy::addUserScript):
1128         (WebKit::WebUserContentControllerProxy::removeUserScript):
1129         (WebKit::WebUserContentControllerProxy::addUserStyleSheet):
1130         (WebKit::WebUserContentControllerProxy::removeUserStyleSheet):
1131         Pass identifiers as well as user content.
1132
1133         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1134         (WebKit::InjectedBundle::addUserScript):
1135         (WebKit::InjectedBundle::addUserStyleSheet):
1136         Move user content in via move semantics rather than using a unique_ptr.
1137
1138         (WebKit::InjectedBundle::removeUserScript):
1139         (WebKit::InjectedBundle::removeUserStyleSheet):
1140         (WebKit::InjectedBundle::removeUserScripts):
1141         (WebKit::InjectedBundle::removeUserStyleSheets):
1142         (WebKit::InjectedBundle::removeAllUserContent):
1143         Update for new function signatures.
1144
1145         * WebProcess/UserContent/WebUserContentController.cpp:
1146         (WebKit::WebUserContentController::WebUserContentController):
1147         (WebKit::WebUserContentController::~WebUserContentController):
1148         (WebKit::WebUserContentController::addUserContentWorlds):
1149         (WebKit::WebUserContentController::removeUserContentWorlds):
1150         (WebKit::WebUserContentController::addUserScripts):
1151         (WebKit::WebUserContentController::removeUserScript):
1152         (WebKit::WebUserContentController::removeAllUserScripts):
1153         (WebKit::WebUserContentController::addUserStyleSheets):
1154         (WebKit::WebUserContentController::removeUserStyleSheet):
1155         (WebKit::WebUserContentController::removeAllUserStyleSheets):
1156         (WebKit::WebUserContentController::addUserScriptMessageHandlers):
1157         (WebKit::WebUserContentController::removeUserScriptMessageHandler):
1158         (WebKit::WebUserContentController::addUserContentExtensions):
1159         (WebKit::WebUserContentController::removeUserContentExtension):
1160         (WebKit::WebUserContentController::removeAllUserContentExtensions):
1161         (WebKit::WebUserContentController::addUserScriptInternal):
1162         (WebKit::WebUserContentController::addUserScript):
1163         (WebKit::WebUserContentController::removeUserScriptWithURL):
1164         (WebKit::WebUserContentController::removeUserScriptInternal):
1165         (WebKit::WebUserContentController::removeUserScripts):
1166         (WebKit::WebUserContentController::addUserStyleSheetInternal):
1167         (WebKit::WebUserContentController::addUserStyleSheet):
1168         (WebKit::WebUserContentController::removeUserStyleSheetWithURL):
1169         (WebKit::WebUserContentController::removeUserStyleSheetInternal):
1170         (WebKit::WebUserContentController::removeUserStyleSheets):
1171         (WebKit::WebUserContentController::removeAllUserContent):
1172         (WebKit::WebUserContentController::forEachUserScript):
1173         (WebKit::WebUserContentController::forEachUserStyleSheet):
1174         * WebProcess/UserContent/WebUserContentController.h:
1175         * WebProcess/UserContent/WebUserContentController.messages.in:
1176         Convert to inheriting from UserContentProvider, rather than containing a UserContentController.
1177         This means adding the storage for the user content, which has been simplified to avoid using
1178         unique_ptrs.
1179
1180         * WebProcess/WebPage/WebPage.cpp:
1181         (WebKit::WebPage::addUserScript):
1182         (WebKit::WebPage::addUserStyleSheet):
1183         (WebKit::WebPage::removeAllUserContent):
1184         Update to call the WebUserContentController, rather than going to the UserContentController, which
1185         no longer exists.
1186
1187         * WebProcess/WebPage/WebPageGroupProxy.cpp:
1188         (WebKit::WebPageGroupProxy::userContentController):
1189         * WebProcess/WebPage/WebPageGroupProxy.h:
1190         Return the WebUserContentController rather than old UserContentController.
1191
1192 2016-03-14  Joonghun Park  <jh718.park@samsung.com>
1193
1194         Purge PassRefPtr from ArrayBuffer, ArchiveResource, Pasteboard, LegacyWebArchive and DataObjectGtk
1195         https://bugs.webkit.org/show_bug.cgi?id=150497
1196
1197         Reviewed by Darin Adler.
1198
1199         * Shared/APIWebArchive.mm:
1200         (API::WebArchive::WebArchive):
1201         * Shared/APIWebArchiveResource.mm:
1202         (API::WebArchiveResource::data):
1203         * WebProcess/Plugins/PDF/DeprecatedPDFPlugin.mm:
1204         (WebKit::PDFPlugin::addArchiveResource):
1205         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
1206         (WebKit::WebPlatformStrategies::bufferForType):
1207         (WebKit::WebPlatformStrategies::readBufferFromPasteboard):
1208         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
1209         * WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm:
1210         (WebKit::WebEditorClient::documentFragmentFromAttributedString):
1211         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
1212         (WebKit::WebDragClient::declareAndWriteDragImage):
1213         * WebProcess/WebPage/WebFrame.cpp:
1214         (WebKit::WebFrame::webArchiveData):
1215         * WebProcess/WebPage/WebPage.cpp:
1216         (WebKit::resourceDataForFrame):
1217
1218 2016-03-14  Oliver Hunt  <oliver@apple.com>
1219
1220         Temporarily disable the separated heap.
1221         https://bugs.webkit.org/show_bug.cgi?id=155472
1222
1223         Reviewed by Geoffrey Garen.
1224
1225         Temporarily disable this.
1226
1227         * Configurations/FeatureDefines.xcconfig:
1228
1229 2016-03-14  Beth Dakin  <bdakin@apple.com>
1230
1231         [iOS] WKPreviewAction conforms to NSCopying but doesn’t override -
1232         copyWithZone:
1233         https://bugs.webkit.org/show_bug.cgi?id=155395
1234
1235         Reviewed by Sam Weinig.
1236
1237         * UIProcess/API/Cocoa/WKPreviewActionItem.mm:
1238         (-[WKPreviewAction copyWithZone:]):
1239
1240 2016-03-14  Anders Carlsson  <andersca@apple.com>
1241
1242         Remove usage of -[UIGestureRecognizer requireOtherGestureToFail:]
1243         https://bugs.webkit.org/show_bug.cgi?id=155461
1244         rdar://problem/25143282
1245
1246         Reviewed by Beth Dakin.
1247
1248         Use -[UIGestureRecognizer requireGestureRecognizerToFail:] instead, which has been API ever since UIGestureRecognizer was added.
1249
1250         * Platform/spi/ios/UIKitSPI.h:
1251         * UIProcess/ios/WKContentViewInteraction.mm:
1252         (-[WKContentView _createAndConfigureDoubleTapGestureRecognizer]):
1253
1254 2016-03-14  Anders Carlsson  <andersca@apple.com>
1255
1256         REGRESSION (r191691): Can't Share Selected Text
1257         https://bugs.webkit.org/show_bug.cgi?id=155459
1258         rdar://problem/24893625
1259
1260         Reviewed by Tim Horton.
1261
1262         Add the selected text as well. Somehow this got lost in the refactoring.
1263
1264         * UIProcess/mac/WebContextMenuProxyMac.mm:
1265         (WebKit::WebContextMenuProxyMac::createShareMenuItem):
1266
1267 2016-03-14  Tim Horton  <timothy_horton@apple.com>
1268
1269         Revert r194125 and r194186: We're going to fix this a different way.
1270
1271         * Shared/NativeWebGestureEvent.h:
1272         * Shared/mac/NativeWebGestureEventMac.mm:
1273         (WebKit::pointForEvent):
1274         (WebKit::NativeWebGestureEvent::NativeWebGestureEvent):
1275         (WebKit::distanceForTouches): Deleted.
1276         * UIProcess/API/Cocoa/WKWebView.mm:
1277         (-[WKWebView selectFindMatch:completionHandler:]):
1278         (-[WKWebView _web_superInputContext]):
1279         (-[WKWebView touchesBeganWithEvent:]): Deleted.
1280         (-[WKWebView touchesMovedWithEvent:]): Deleted.
1281         (-[WKWebView touchesEndedWithEvent:]): Deleted.
1282         (-[WKWebView touchesCancelledWithEvent:]): Deleted.
1283         * UIProcess/API/mac/WKView.mm:
1284         (-[WKView namesOfPromisedFilesDroppedAtDestination:]):
1285         (-[WKView initWithFrame:processPool:configuration:webView:]):
1286         (-[WKView touchesBeganWithEvent:]): Deleted.
1287         (-[WKView touchesMovedWithEvent:]): Deleted.
1288         (-[WKView touchesEndedWithEvent:]): Deleted.
1289         (-[WKView touchesCancelledWithEvent:]): Deleted.
1290         * UIProcess/Cocoa/WebViewImpl.h:
1291         * UIProcess/Cocoa/WebViewImpl.mm:
1292         (WebKit::WebViewImpl::WebViewImpl):
1293         (WebKit::WebViewImpl::magnifyWithEvent):
1294         (WebKit::WebViewImpl::smartMagnifyWithEvent):
1295         (WebKit::WebViewImpl::rotateWithEvent):
1296         (WebKit::WebViewImpl::touchesOrderedByAge): Deleted.
1297         (WebKit::WebViewImpl::touchesBeganWithEvent): Deleted.
1298         (WebKit::WebViewImpl::touchesMovedWithEvent): Deleted.
1299         (WebKit::WebViewImpl::touchesEndedWithEvent): Deleted.
1300         (WebKit::WebViewImpl::touchesCancelledWithEvent): Deleted.
1301
1302 2016-03-14  Anders Carlsson  <andersca@apple.com>
1303
1304         Fix build.
1305
1306         Create an empty PDF selection.
1307
1308         * Shared/mac/PDFKitImports.h:
1309         * Shared/mac/PDFKitImports.mm:
1310         (WebKit::pdfSelectionClass):
1311         * WebProcess/Plugins/PDF/DeprecatedPDFPlugin.mm:
1312         (WebKit::PDFPlugin::nextMatchForString):
1313
1314 2016-03-14  Beth Dakin  <bdakin@apple.com>
1315
1316         Unable to commit previews in Mobile Safari
1317         https://bugs.webkit.org/show_bug.cgi?id=155450
1318         -and corresponding-
1319         rdar://problem/25135529
1320
1321         Reviewed by Tim Horton.
1322
1323         _uiDelegateProvidedPreviewingViewController was being consulted before 
1324         invoking the old SPI, which was always wrong. It should have been consulted 
1325         before calling the new API! But also, it doesn’t seem to be necessary at all 
1326         since [WKContentView _previewItemController:commitPreview:] is only invoked 
1327         when a custom view controller has been provided.
1328
1329         * UIProcess/ios/WKContentViewInteraction.h:
1330         * UIProcess/ios/WKContentViewInteraction.mm:
1331         (-[WKContentView _registerPreview]):
1332         (-[WKContentView _unregisterPreview]):
1333         (-[WKContentView _interactionShouldBeginFromPreviewItemController:forPosition:]):
1334         (-[WKContentView _presentedViewControllerForPreviewItemController:]):
1335         (-[WKContentView _previewItemController:commitPreview:]):
1336
1337 2016-03-14  Brent Fulgham  <bfulgham@apple.com>
1338
1339         PingHandle delete's itself but pointer is still used by handleDataURL
1340         https://bugs.webkit.org/show_bug.cgi?id=154752
1341         <rdar://problem/24872347>
1342
1343         Reviewed by Alex Christensen.
1344
1345         When a PingLoad is destroyed, we should tell its client so that the client can clear the pointer it
1346         holds to the element to avoid accidentally attempting to use deallocated memory.
1347
1348         * NetworkProcess/PingLoad.h:
1349         (WebKit::PingLoad::~PingLoad): Notify the client we are being destroyed.
1350
1351 2016-03-14  Carlos Garcia Campos  <cgarcia@igalia.com>
1352
1353         Unreviewed. Fix the GTK+ build after r198124.
1354
1355         WebsiteDataTypes is now an OptionSet.
1356
1357         * UIProcess/API/gtk/WebKitWebContext.cpp:
1358         (webkit_web_context_clear_cache):
1359
1360 2016-03-14  Carlos Garcia Campos  <cgarcia@igalia.com>
1361
1362         [GTK] Reimplement webkit_web_context_clear_cache functionality.
1363         https://bugs.webkit.org/show_bug.cgi?id=146041
1364
1365         Reviewed by Michael Catanzaro.
1366
1367         * UIProcess/API/gtk/WebKitWebContext.cpp:
1368         (webkit_web_context_clear_cache):
1369
1370 2016-03-14  Jeremy Huddleston Sequoia  <jeremyhu@apple.com>
1371
1372         Install WebKit2 WebProcess NetworkProcess on OSX when not building the Mac PORT
1373         https://bugs.webkit.org/show_bug.cgi?id=152651
1374
1375         Reviewed by Philippe Normand.
1376
1377         * CMakeLists.txt:
1378
1379 2016-03-13  Joseph Pecoraro  <pecoraro@apple.com>
1380
1381         Remove ENABLE(ES6_TEMPLATE_LITERAL_SYNTAX) guards
1382         https://bugs.webkit.org/show_bug.cgi?id=155417
1383
1384         Reviewed by Yusuke Suzuki.
1385
1386         * Configurations/FeatureDefines.xcconfig:
1387
1388 2016-03-13  Dan Bernstein  <mitz@apple.com>
1389
1390         [Mac] Injected bundle in relocatable WebContent service can’t use XPC services from other relocatable frameworks
1391         https://bugs.webkit.org/show_bug.cgi?id=155414
1392         <rdar://problem/24428418>
1393
1394         Reviewed by Sam Weinig.
1395
1396         * Configurations/DebugRelease.xcconfig:
1397           Set WK_WEBCONTENT_SERVICE_NEEDS_XPC_DOMAIN_EXTENSION_ENTITLEMENT to NO, because
1398           engineering builds are ad-hoc signed and therefore can’t have a private entitlement.
1399
1400         * Configurations/WebContent-OSX.entitlements: Added. Includes the XPC domain extension
1401           entitlement.
1402
1403         * Configurations/WebContentService.xcconfig:
1404           Set WK_WEBCONTENT_SERVICE_NEEDS_XPC_DOMAIN_EXTENSION_ENTITLEMENT to YES if not already set
1405           and the framework is relocatable. Set CODE_SIGN_ENTITLEMENTS to the new entitlements file
1406           if the domain extension entitlement is needed.
1407
1408         * WebKit2.xcodeproj/project.pbxproj: Added reference to new file.
1409
1410 2016-03-13  Dean Jackson  <dino@apple.com>
1411
1412         <attachment> should be a runtime-enabled feature
1413         https://bugs.webkit.org/show_bug.cgi?id=155413
1414         <rdar://problem/25120753>
1415
1416         Reviewed by Sam Weinig and Anders Carlsson.
1417
1418         Add an internal setting on WKWebViewConfiguration
1419         to enable the <attachment> element support.
1420
1421         * Shared/WebPreferencesDefinitions.h:
1422         * UIProcess/API/Cocoa/WKWebView.mm:
1423         (-[WKWebView _initializeWithConfiguration:]):
1424         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
1425         (-[WKWebViewConfiguration init]):
1426         (-[WKWebViewConfiguration copyWithZone:]):
1427         (-[WKWebViewConfiguration _attachmentElementEnabled]):
1428         (-[WKWebViewConfiguration _setAttachmentElementEnabled:]):
1429         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
1430         * WebProcess/WebPage/WebPage.cpp:
1431         (WebKit::WebPage::updatePreferences):
1432
1433 2016-03-12  Sam Weinig  <sam@webkit.org>
1434
1435         WebKit can easily crash below NetworkSession::dataTaskForIdentifier() with NSURLSession enabled
1436         <rdar://problem/25129946>
1437         https://bugs.webkit.org/show_bug.cgi?id=155401
1438
1439         Reviewed by Alex Christensen.
1440
1441         The issue was that NSURLSessionDataTasks can continue to invoke their NSURLSession's delegate methods
1442         after -[NSURLSession invalidateAndCancel] is called. So, when the NetworkSession was destroyed, and
1443         still had outstanding data tasks, the session delegate would get called, try to use the session, and
1444         crash. To fix this I:
1445         
1446         - Made NetworkSession RefCounted.
1447         - Gave NetworkSession two delegates, one for each NSURLSession.
1448         - Made each delegate have a strong reference to the NetworkSession that gets cleared out in the
1449           newly implemented URLSession:didBecomeInvalidWithError: method.
1450         - Changed from simply destroying the NetworkSession in SessionTracker::destroySession(), to derefing
1451           it and explicitly calling invalidateAndCancel on the two associated NSURLSessions (which in turn 
1452           eventually cause the URLSession:didBecomeInvalidWithError: to fire).
1453         - To ensure the correct lifetime of the WebCore::NetworkStorageSession, I made it a member of the
1454           NetworkSession. This also allowed some simplification inside SessionTracker.
1455
1456         * NetworkProcess/NetworkDataTask.h:
1457         (WebKit::NetworkDataTask::setPendingDownload):
1458         (WebKit::NetworkDataTask::pendingDownloadLocation):
1459         * NetworkProcess/NetworkLoad.cpp:
1460         (WebKit::NetworkLoad::NetworkLoad):
1461         * NetworkProcess/NetworkSession.h:
1462         (WebKit::NetworkSession::sessionID):
1463         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
1464         (WebKit::NetworkDataTask::NetworkDataTask):
1465         (WebKit::NetworkDataTask::~NetworkDataTask):
1466         (WebKit::NetworkDataTask::willPerformHTTPRedirection):
1467         (WebKit::NetworkDataTask::tryPasswordBasedAuthentication):
1468         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1469         (-[WKNetworkSessionDelegate initWithNetworkSession:]):
1470         (-[WKNetworkSessionDelegate URLSession:didBecomeInvalidWithError:]):
1471         (WebKit::NetworkSession::setCustomProtocolManager):
1472         (WebKit::NetworkSession::create):
1473         (WebKit::NetworkSession::defaultSession):
1474         (WebKit::NetworkSession::NetworkSession):
1475         (WebKit::NetworkSession::~NetworkSession):
1476         (WebKit::NetworkSession::invalidateAndCancel):
1477         (WebKit::NetworkSession::networkStorageSession):
1478         (WebKit::NetworkSession::clearCredentials):
1479         * NetworkProcess/mac/RemoteNetworkingContext.mm:
1480         (WebKit::RemoteNetworkingContext::ensurePrivateBrowsingSession):
1481         * Shared/SessionTracker.cpp:
1482         (WebKit::identifierBase):
1483         (WebKit::SessionTracker::getIdentifierBase):
1484         (WebKit::SessionTracker::setIdentifierBase):
1485         (WebKit::staticSessionMap):
1486         (WebKit::SessionTracker::networkSession):
1487         (WebKit::SessionTracker::storageSession):
1488         (WebKit::staticStorageSessionMap):
1489         (WebKit::SessionTracker::sessionID):
1490         (WebKit::SessionTracker::setSession):
1491         (WebKit::SessionTracker::destroySession):
1492         (WebKit::SessionTracker::forEachNetworkStorageSession):
1493         (WebKit::storageSessionToID): Deleted.
1494         (WebKit::SessionTracker::storageSessionMap): Deleted.
1495         * Shared/SessionTracker.h:
1496         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
1497         (WebKit::WebFrameNetworkingContext::ensurePrivateBrowsingSession):
1498         (WebKit::WebFrameNetworkingContext::setCookieAcceptPolicyForAllContexts):
1499         (WebKit::WebFrameNetworkingContext::localFileContentSniffingEnabled):
1500         (WebKit::WebFrameNetworkingContext::scheduledRunLoopPairs):
1501         * WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp:
1502         (WebKit::WebFrameNetworkingContext::ensurePrivateBrowsingSession):
1503         (WebKit::WebFrameNetworkingContext::setCookieAcceptPolicyForAllContexts):
1504         (WebKit::WebFrameNetworkingContext::WebFrameNetworkingContext):
1505
1506 2016-03-12  Myles C. Maxfield  <mmaxfield@apple.com>
1507
1508         Delete dead SVG Font code
1509         https://bugs.webkit.org/show_bug.cgi?id=154718
1510
1511         Reviewed by Antti Koivisto.
1512
1513         * Configurations/FeatureDefines.xcconfig:
1514
1515 2016-03-12  Beth Dakin  <bdakin@apple.com>
1516
1517         Make preview inline navigation work API
1518         https://bugs.webkit.org/show_bug.cgi?id=155383
1519         -and corresponding-
1520         rdar://problem/25117985
1521
1522         Reviewed by Dan Bernstein.
1523
1524         With this patch:
1525         _WKElementInfo is now WKElementInfo in file and class names. Header is now 
1526         public.
1527
1528         _WKPreviewElementInfo is now WKPreviewElementInfo in file and class names. 
1529         Header is now public.
1530
1531         _WKPreviewAction is now WKPreviewActionItem in filenames (header is now 
1532         public), the protocol _WKPreviewActionItem is now WKPreviewActionItem, and 
1533         the _WKPreviewAction class is now WKPreviewAction. (The internal header is 
1534         still project, of course.)
1535         and
1536         WKPreviewActionIdentifiersPrivate.h/mm is now
1537         WKPreviewActionItemIdentifiers.h/mm and all the the identifiers have been 
1538         updated. Header is now public.
1539
1540         * Shared/API/Cocoa/WebKit.h:
1541         * UIProcess/API/Cocoa/WKElementInfo.h: Copied from UIProcess/API/Cocoa/_WKElementInfo.h.
1542         * UIProcess/API/Cocoa/WKElementInfo.mm: Copied from UIProcess/API/Cocoa/_WKElementInfo.mm.
1543         (-[WKElementInfo copyWithZone:]):
1544         (-[_WKElementInfo copyWithZone:]): Deleted.
1545         * UIProcess/API/Cocoa/WKElementInfoInternal.h: Copied from UIProcess/API/Cocoa/_WKElementInfoInternal.h.
1546         * UIProcess/API/Cocoa/WKPreviewActionIdentifiersPrivate.h: Removed.
1547         * UIProcess/API/Cocoa/WKPreviewActionIdentifiersPrivate.mm: Removed.
1548         * UIProcess/API/Cocoa/WKPreviewActionItem.h: Copied from UIProcess/API/Cocoa/_WKPreviewAction.h.
1549         * UIProcess/API/Cocoa/WKPreviewActionItem.mm: Copied from UIProcess/API/Cocoa/_WKPreviewAction.mm.
1550         * UIProcess/API/Cocoa/WKPreviewActionItemIdentifiers.h: Copied from UIProcess/API/Cocoa/WKPreviewActionIdentifiersPrivate.h.
1551         * UIProcess/API/Cocoa/WKPreviewActionItemIdentifiers.mm: Copied from UIProcess/API/Cocoa/WKPreviewActionIdentifiersPrivate.mm.
1552         * UIProcess/API/Cocoa/WKPreviewActionItemInternal.h: Copied from UIProcess/API/Cocoa/_WKPreviewActionInternal.h.
1553         * UIProcess/API/Cocoa/WKPreviewElementInfo.h: Copied from UIProcess/API/Cocoa/_WKPreviewElementInfo.h.
1554         * UIProcess/API/Cocoa/WKPreviewElementInfo.mm: Copied from UIProcess/API/Cocoa/_WKPreviewElementInfo.mm.
1555         (-[WKPreviewElementInfo _initWithLinkURL:]):
1556         (-[_WKPreviewElementInfo _initWithLinkURL:]): Deleted.
1557         * UIProcess/API/Cocoa/WKPreviewElementInfoInternal.h: Copied from UIProcess/API/Cocoa/_WKPreviewElementInfoInternal.h.
1558         * UIProcess/API/Cocoa/WKUIDelegate.h:
1559         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
1560         * UIProcess/API/Cocoa/_WKContextMenuElementInfo.h:
1561         * UIProcess/API/Cocoa/_WKElementInfo.h: Removed.
1562         * UIProcess/API/Cocoa/_WKElementInfo.mm: Removed.
1563         * UIProcess/API/Cocoa/_WKElementInfoInternal.h: Removed.
1564         * UIProcess/API/Cocoa/_WKPreviewAction.h: Removed.
1565         * UIProcess/API/Cocoa/_WKPreviewAction.mm: Removed.
1566         * UIProcess/API/Cocoa/_WKPreviewActionInternal.h: Removed.
1567         * UIProcess/API/Cocoa/_WKPreviewElementInfo.h: Removed.
1568         * UIProcess/API/Cocoa/_WKPreviewElementInfo.mm: Removed.
1569         * UIProcess/API/Cocoa/_WKPreviewElementInfoInternal.h: Removed.
1570         * UIProcess/ios/WKContentViewInteraction.mm:
1571         (-[WKContentView _interactionShouldBeginFromPreviewItemController:forPosition:]):
1572         (previewIdentifierForElementAction):
1573         (-[WKContentView _presentedViewControllerForPreviewItemController:]):
1574         (-[WKContentView _previewItemController:commitPreview:]):
1575         * WebKit2.xcodeproj/project.pbxproj:
1576
1577 2016-03-12  Jeremy Huddleston Sequoia  <jeremyhu@apple.com>
1578
1579         [GTK][Mac] Use DYLD_LIBRARY_PATH on OSX rather then LD_LIBRARY_PATH
1580         https://bugs.webkit.org/show_bug.cgi?id=152650
1581
1582         Reviewed by Carlos Garcia Campos.
1583
1584         * PlatformGTK.cmake:
1585
1586 2016-03-11  John Wilander  <wilander@apple.com>
1587
1588         Move prevalent resource classifier from WebCore to WebKit.
1589         https://bugs.webkit.org/show_bug.cgi?id=155242
1590         <rdar://problem/24913272>
1591
1592         Reviewed by Andy Estes.
1593
1594         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1595         (WebKit::WebResourceLoadStatisticsStore::create):
1596         (WebKit::WebResourceLoadStatisticsStore::~WebResourceLoadStatisticsStore):
1597         (WebKit::hasPrevalentResourceCharacteristics):
1598         (WebKit::classifyPrevalentResources):
1599             - Moved these two functions from WebCore.
1600         (WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated):
1601             - Calls processStatistics with a lamda function to classify prevalent resources.
1602         * WebKit2.xcodeproj/project.pbxproj:
1603             - Fixed the ordering of source files.
1604
1605 2016-03-11  Sam Weinig  <sam@webkit.org>
1606
1607         WebKit needs a new sandbox profile addition for DataDetectors
1608         <rdar://problem/25091102>
1609
1610         Reviewed by Brent Fulgham.
1611
1612         * WebProcess/com.apple.WebProcess.sb.in:
1613
1614 2016-03-11  Chris Dumez  <cdumez@apple.com>
1615
1616         Regression(r198040): WebKit2.DocumentStartUserScriptAlertCrashTest API test is crashing in debug
1617         https://bugs.webkit.org/show_bug.cgi?id=155382
1618
1619         Reviewed by Alexey Proskuryakov.
1620
1621         r198040 introduced an assertion to make sure we never call
1622         applicationBundleIsEqualTo() before setApplicationBundleIdentifier()
1623         is called. This new assertion found a bug as it turns out we were
1624         calling setApplicationBundleIdentifier() too late during the
1625         WebProcess initialization and some runtime applications checks were
1626         already done by then.
1627
1628         To address the problem, this patch moves the
1629         setApplicationBundleIdentifier() call as early as possible during
1630         the WebProcess and the NetworkProcess initialization. It also moves
1631         it to the Cocoa specific files for clarity.
1632
1633         * NetworkProcess/NetworkProcess.cpp:
1634         (WebKit::NetworkProcess::initializeNetworkProcess):
1635         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1636         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
1637         * WebProcess/WebProcess.cpp:
1638         (WebKit::WebProcess::initializeWebProcess):
1639         * WebProcess/cocoa/WebProcessCocoa.mm:
1640         (WebKit::WebProcess::platformInitializeWebProcess):
1641
1642 2016-03-11  Enrica Casucci  <enrica@apple.com>
1643
1644         Use only selected text for Look up.
1645         https://bugs.webkit.org/show_bug.cgi?id=155380
1646
1647         Reviewed by Tim Horton.
1648
1649         The corresponding piece that uses the extended context for Look up
1650         is not ready yet. For the moment default to retrieving the selected text.
1651
1652         * UIProcess/ios/WKContentViewInteraction.mm:
1653         (-[WKContentView _lookup:]):
1654
1655 2016-03-11  Chelsea Pugh  <cpugh@apple.com>
1656
1657         [iOS] Allow clients to specify text suggestions to be used for a form input session
1658         https://bugs.webkit.org/show_bug.cgi?id=155343
1659
1660         Reviewed by Dan Bernstein.
1661
1662         * UIProcess/API/Cocoa/_WKFormInputSession.h:
1663         * UIProcess/API/Cocoa/_WKInputDelegate.h:
1664         * UIProcess/ios/WKContentViewInteraction.mm:
1665         (-[WKFormInputSession suggestions]): Add a getter for suggestions.
1666         (-[WKFormInputSession setSuggestions:]): Add a setter, which calls setSuggestions with our suggestions on the input delegate.
1667         (-[WKContentView insertTextSuggestion:]): Call _webView:insertTextSuggestion:inInputSession: on our input delegate so clients know 
1668         a text suggestion was tapped.
1669
1670 2016-03-11  Anders Carlsson  <andersca@apple.com>
1671
1672         Creating and releasing a WKBackForwardListItem crashes
1673         https://bugs.webkit.org/show_bug.cgi?id=155376
1674         rdar://problem/17377712
1675
1676         Reviewed by Dan Bernstein.
1677
1678         Make init unavailable.
1679
1680         * UIProcess/API/Cocoa/WKBackForwardListItem.h:
1681
1682 2016-03-11  Beth Dakin  <bdakin@apple.com>
1683
1684         Follow-up to:
1685
1686         _WKPreviewAction should be in an internal header
1687         https://bugs.webkit.org/show_bug.cgi?id=155370
1688
1689         Rubber-stamped by Dan Bernstein.
1690
1691         * UIProcess/API/Cocoa/_WKPreviewActionInternal.h:
1692
1693 2016-03-11  Beth Dakin  <bdakin@apple.com>
1694
1695         _WKPreviewAction should be in an internal header
1696         https://bugs.webkit.org/show_bug.cgi?id=155370
1697
1698         Reviewed by Tim Horton.
1699
1700         Move _WKPreviewAction to an Internal header since only the protocol needs to 
1701         be SPI.
1702         * UIProcess/API/Cocoa/_WKPreviewAction.h:
1703         * UIProcess/API/Cocoa/_WKPreviewAction.mm:
1704         * UIProcess/API/Cocoa/_WKPreviewActionInternal.h: Added.
1705         * UIProcess/ios/WKContentViewInteraction.mm:
1706         * WebKit2.xcodeproj/project.pbxproj:
1707
1708 2016-03-11  Yusuke Suzuki  <utatane.tea@gmail.com>
1709
1710         [ES6] Implement Reflect.set without receiver support
1711         https://bugs.webkit.org/show_bug.cgi?id=155024
1712
1713         Reviewed by Geoffrey Garen.
1714
1715         NPJSObject::setProperty may call `methodTable()->put` operation, but we intentionally do not propagate it to the caller's ::put.
1716         In the current implementation, we just use the result of ::setProperty call.
1717         This is `true` when ::setProperty attempts to call `methodTable()->put`.
1718         In ::setProperty, after calling `methodTable()->put`, ::setProperty function clears the exception state.
1719         So this is not the same semantics to the simple data property store. Rather, this is like the accessor.
1720         In ECMA262 [[Set]], it returns true if there is a setter. So we just use the returned value of ::setProperty.
1721         This indicates that there is a setter for the given [[Set]] operation.
1722
1723         * WebProcess/Plugins/Netscape/JSNPObject.cpp:
1724         (WebKit::JSNPObject::put):
1725         * WebProcess/Plugins/Netscape/JSNPObject.h:
1726
1727 2016-03-10  David Kilzer  <ddkilzer@apple.com>
1728
1729         REGRESSION (r197986): Don't try to link to undefined $(WEBKIT_SYSTEM_INTERFACE_LIBRARY)
1730
1731         Follow-up build fix for:
1732             AX: Force allow user zoom
1733             <https://bugs.webkit.org/show_bug.cgi?id=155056>
1734
1735         Fixes the following build failure:
1736             ld: library not found for -l-lAccessibility
1737             clang: error: linker command failed with exit code 1 (use -v to see invocation)
1738
1739         * Configurations/WebKit.xcconfig: Remove
1740         "-l$(WEBKIT_SYSTEM_INTERFACE_LIBRARY)" from OTHER_LDFLAGS since
1741         that macro is not defined, and there is no need to link to
1742         libWebKitSystemInterface.a.
1743
1744 2016-03-10  Jeremy Jones  <jeremyj@apple.com>
1745
1746         Set AVURLAssetUsesNoPersistentCacheKey on AVAsset to match caching policy.
1747         https://bugs.webkit.org/show_bug.cgi?id=155117
1748         rdar://problem/6802240
1749
1750         Reviewed by Simon Fraser.
1751
1752         Make AVAsset AVURLAssetUsesNoPersistentCacheKey match !m_websiteDataStore->isPersistent()
1753         This will prevent persistent media caches when webkit is using in-memory caching.
1754
1755         * Shared/WebPageCreationParameters.cpp: Add mediaShouldUsePersistentCache.
1756         (WebKit::WebPageCreationParameters::encode):
1757         (WebKit::WebPageCreationParameters::decode):
1758         * Shared/WebPageCreationParameters.h:
1759         * UIProcess/WebPageProxy.cpp:
1760         (WebKit::WebPageProxy::creationParameters): Add mediaShouldUsePersistentCache.
1761         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1762         (WebKit::WebChromeClient::mediaShouldUsePersistentCache): Added.
1763         * WebProcess/WebCoreSupport/WebChromeClient.h:
1764         * WebProcess/WebPage/WebPage.cpp:
1765         (WebKit::m_mediaUsesPersistentCache): Added.
1766         * WebProcess/WebPage/WebPage.h:
1767         (WebKit::WebPage::mediaShouldUsePersistentCache): Added.
1768
1769 2016-03-10  Nan Wang  <n_wang@apple.com>
1770
1771         AX: Force allow user zoom
1772         https://bugs.webkit.org/show_bug.cgi?id=155056
1773
1774         Reviewed by Simon Fraser.
1775
1776         Linked libAccessibility library so that we can observe the accessibility
1777         setting change for the force always user scalable feature.
1778
1779         * Configurations/WebKit.xcconfig:
1780         * UIProcess/API/Cocoa/WKWebView.mm:
1781         (shouldAllowPictureInPictureMediaPlayback):
1782         (forceAlwaysUserScalableChangedCallback):
1783         (-[WKWebView _initializeWithConfiguration:]):
1784         (-[WKWebView dealloc]):
1785         (-[WKWebView _navigationGestureDidEnd]):
1786         (-[WKWebView _updateForceAlwaysUserScalable]):
1787         * UIProcess/API/Cocoa/WKWebViewInternal.h:
1788         * UIProcess/WebPageProxy.h:
1789         * UIProcess/ios/WebPageProxyIOS.mm:
1790         (WebKit::WebPageProxy::setViewportConfigurationMinimumLayoutSize):
1791         (WebKit::WebPageProxy::updateForceAlwaysUserScalable):
1792         (WebKit::WebPageProxy::setMaximumUnobscuredSize):
1793         * WebProcess/WebPage/WebPage.cpp:
1794         (WebKit::WebPage::updatePreferences):
1795         * WebProcess/WebPage/WebPage.h:
1796         * WebProcess/WebPage/WebPage.messages.in:
1797         * WebProcess/WebPage/ios/WebPageIOS.mm:
1798         (WebKit::WebPage::disableInspectorNodeSearch):
1799         (WebKit::WebPage::updateForceAlwaysUserScalable):
1800         (WebKit::innerFrameQuad):
1801
1802 2016-03-10  Simon Fraser  <simon.fraser@apple.com>
1803
1804         Font antialiasing (smoothing) changes when elements are rendered into compositing layers
1805         https://bugs.webkit.org/show_bug.cgi?id=23364
1806
1807         Reviewed by Tim Horton.
1808
1809         Send the ContentsFormat to the UI process (but nothing happens to it there yet).
1810
1811         Allow internal clients to turn off smoothed layer text, so that WebKitTestRunner
1812         can disable it.
1813
1814         * Shared/WebProcessCreationParameters.cpp:
1815         (WebKit::WebProcessCreationParameters::WebProcessCreationParameters):
1816         (WebKit::WebProcessCreationParameters::encode):
1817         (WebKit::WebProcessCreationParameters::decode):
1818         * Shared/WebProcessCreationParameters.h:
1819         * Shared/mac/RemoteLayerTreeTransaction.h:
1820         * Shared/mac/RemoteLayerTreeTransaction.mm:
1821         (WebKit::RemoteLayerTreeTransaction::LayerProperties::encode):
1822         (WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
1823         * UIProcess/API/C/WKContext.cpp:
1824         (WKContextEnableSmoothedLayerText):
1825         * UIProcess/API/C/WKContextPrivate.h:
1826         * UIProcess/WebProcessPool.cpp:
1827         (WebKit::WebProcessPool::createNewWebProcess):
1828         (WebKit::WebProcessPool::enableSmoothedLayerText):
1829         (WebKit::WebProcessPool::WebProcessPool): Deleted.
1830         * UIProcess/WebProcessPool.h:
1831         * WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
1832         (WebKit::PlatformCALayerRemote::setContentsFormat):
1833         (WebKit::PlatformCALayerRemote::contentsFormat):
1834         * WebProcess/WebPage/mac/PlatformCALayerRemote.h:
1835         * WebProcess/WebProcess.cpp:
1836         (WebKit::WebProcess::initializeWebProcess):
1837         (WebKit::WebProcess::enableSmoothedLayerText):
1838         * WebProcess/WebProcess.h:
1839         * WebProcess/WebProcess.messages.in:
1840
1841 2016-03-10  Enrica Casucci  <enrica@apple.com>
1842
1843         Expose additional WKDataDetectorTypes.
1844         https://bugs.webkit.org/show_bug.cgi?id=155331
1845         rdar://problem/24175813
1846
1847         Reviewed by Tim Horton.
1848
1849         Adding API to enable data detection of tracking numbers,
1850         flight number and spotlight suggestions.
1851
1852         * UIProcess/API/Cocoa/WKWebView.mm:
1853         (fromWKDataDetectorTypes):
1854         * UIProcess/API/Cocoa/WKWebViewConfiguration.h:
1855
1856 2016-03-10  Beth Dakin  <bdakin@apple.com>
1857
1858         defaultActions in UIDelegate method 
1859         _webView:previewingViewControllerForElement:defaultActions: need to be 
1860         use-able by a client
1861         https://bugs.webkit.org/show_bug.cgi?id=155304
1862         -and corresponding-
1863         rdar://problem/24269296
1864
1865         Reviewed by Anders Carlsson.
1866
1867         This patch adds a new protocol, WKPreviewActionItem, which is a sub-protocol 
1868         of UIPreviewActionItem. The new protocol adds an identifier so that clients 
1869         can identify which of our default actions they want to use. In order for a 
1870         client to use our default action items, they need to return those actions in 
1871         their UIViewController's implementation of previewActionItems.
1872
1873         Change the defaultActions to NSArray <id <WKPreviewActionItem>> *
1874         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
1875
1876         This new file defines our sub-protocol and sub-class for WKPreviewActions.
1877         * UIProcess/API/Cocoa/_WKPreviewAction.h: Added.
1878         * UIProcess/API/Cocoa/_WKPreviewAction.mm: Added.
1879         (+[_WKPreviewAction actionWithIdentifier:title:style:handler:]):
1880
1881         New BOOL _uiDelegateProvidedPreviewingViewController keeps track of whether 
1882         the client returned a view controller from 
1883         _webView:previewingViewControllerForElement:defaultActions:. If they did 
1884         return a view controller, then we should invoke 
1885         _webView:commitPreviewingViewController: at commit time. If they returned 
1886         nil, then they indicated that WebKit should continue with default previewing 
1887         behavior, so we will not invoke the UIDelegate’s commit method.
1888         * UIProcess/ios/WKContentViewInteraction.h:
1889         * UIProcess/ios/WKContentViewInteraction.mm:
1890         (-[WKContentView _registerPreview]):
1891         (-[WKContentView _unregisterPreview]):
1892         (-[WKContentView _interactionShouldBeginFromPreviewItemController:forPosition:]):
1893
1894         In order for our default actions to be useful, we have to create 
1895         _WKPreviewActions.
1896         (-[WKContentView _presentedViewControllerForPreviewItemController:]):
1897
1898         Only invoke _webView:commitPreviewedViewController: if 
1899         _uiDelegateProvidedPreviewingViewController is YES.
1900         (-[WKContentView _previewItemController:commitPreview:]):
1901         * WebKit2.xcodeproj/project.pbxproj:
1902
1903 2016-03-10  Jer Noble  <jer.noble@apple.com>
1904
1905         Add WebCore, WebKit, & WebKit2 preference/setting to enable Main Content heuristic.
1906         https://bugs.webkit.org/show_bug.cgi?id=155326
1907         <rdar://problem/25095408>
1908
1909         Reviewed by Beth Dakin.
1910
1911         Add SPI to get and set the new preference.
1912
1913         * Shared/WebPreferencesDefinitions.h:
1914         * UIProcess/API/C/WKPreferences.cpp:
1915         (WKPreferencesSetMainContentUserGestureOverrideEnabled):
1916         (WKPreferencesGetMainContentUserGestureOverrideEnabled):
1917         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1918         * UIProcess/API/Cocoa/WKWebView.mm:
1919         (-[WKWebView _initializeWithConfiguration:]):
1920         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
1921         (-[WKWebViewConfiguration init]):
1922         (-[WKWebViewConfiguration copyWithZone:]):
1923         (-[WKWebViewConfiguration _mainContentUserGestureOverrideEnabled]):
1924         (-[WKWebViewConfiguration _setMainContentUserGestureOverrideEnabled:]):
1925         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
1926         * WebProcess/WebPage/WebPage.cpp:
1927         (WebKit::WebPage::updatePreferences):
1928
1929 2016-03-10  Alex Christensen  <achristensen@webkit.org>
1930
1931         Remove firing assertion after r197865.
1932         https://bugs.webkit.org/show_bug.cgi?id=155137
1933         rdar://problem/25096835
1934
1935         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1936         (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]):
1937         (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveData:]):
1938         This assertion was firing.  I'm looking into why.
1939
1940 2016-03-07  Jer Noble  <jer.noble@apple.com>
1941
1942         Add separate WK and WK2 preferences for requiring user gestures for video media, distinct from user gestures for media generally
1943         https://bugs.webkit.org/show_bug.cgi?id=155141
1944
1945         Reviewed by Beth Dakin.
1946
1947         Add a new preference, videoPlaybackRequiresUserGesture, distinct from mediaPlaybackRequiresUserGesture. Legacy clients of 
1948         mediaPlaybackRequiresUserGesture will still be able to use it normally, as setting that preference to true will effectively
1949         set both audioPlaybackRequiresUserGesture and videoPlaybackRequiresUserGesture to true. Make these preferences all available
1950         universally, rather than just on PLATFORM(IOS). This requires adding a definition for -setRequiresUserActionForMediaPlayback:
1951         and -requiresUserActionForMediaPlayback on !PLATFORM(IOS).
1952
1953         * Shared/WebPreferencesDefinitions.h:
1954         * UIProcess/API/C/WKPreferences.cpp:
1955         (WKPreferencesSetVideoPlaybackRequiresUserGesture):
1956         (WKPreferencesGetVideoPlaybackRequiresUserGesture):
1957         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1958         * UIProcess/API/Cocoa/WKWebView.mm:
1959         (-[WKWebView _initializeWithConfiguration:]):
1960         (-[WKWebView _setObscuredInsets:]):
1961         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
1962         (-[WKWebViewConfiguration init]):
1963         (-[WKWebViewConfiguration encodeWithCoder:]):
1964         (-[WKWebViewConfiguration initWithCoder:]):
1965         (-[WKWebViewConfiguration copyWithZone:]):
1966         (-[WKWebViewConfiguration requiresUserActionForMediaPlayback]):
1967         (-[WKWebViewConfiguration setRequiresUserActionForMediaPlayback:]):
1968         (-[WKWebViewConfiguration allowsInlineMediaPlayback]):
1969         (-[WKWebViewConfiguration setAllowsInlineMediaPlayback:]):
1970         (-[WKWebViewConfiguration _requiresUserActionForVideoPlayback]):
1971         (-[WKWebViewConfiguration _setRequiresUserActionForVideoPlayback:]):
1972         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
1973         * WebProcess/WebPage/WebPage.cpp:
1974         (WebKit::WebPage::updatePreferences):
1975
1976 2016-03-10  Commit Queue  <commit-queue@webkit.org>
1977
1978         Unreviewed, rolling out r197943.
1979         https://bugs.webkit.org/show_bug.cgi?id=155317
1980
1981         This change broke Windows, WinCairo, GTK and EFL builds
1982         (Requested by ryanhaddad on #webkit).
1983
1984         Reverted changeset:
1985
1986         "Add a baseURL parameter to _WKUserStyleSheet"
1987         https://bugs.webkit.org/show_bug.cgi?id=155219
1988         http://trac.webkit.org/changeset/197943
1989
1990 2016-03-10  Eric Carlson  <eric.carlson@apple.com>
1991
1992         [MediaStream] push media stream state to the UI process
1993         https://bugs.webkit.org/show_bug.cgi?id=155281
1994
1995         Reviewed by Dean Jackson.
1996
1997         * UIProcess/WebPageProxy.cpp:
1998         (WebKit::WebPageProxy::didCommitLoadForFrame): Don't clear m_mediaState, it is done in
1999           WebPageProxy::resetState. This reverts a change added in r197929.
2000         
2001
2002 2016-03-08  Sam Weinig  <sam@webkit.org>
2003
2004         Add a baseURL parameter to _WKUserStyleSheet
2005         https://bugs.webkit.org/show_bug.cgi?id=155219
2006
2007         Reviewed by Tim Horton.
2008
2009         - Moves to a model for user content where instead of using a WebCore::UserContentController
2010           object, we implement the new WebCore::UserContentProvider interface (on the existing 
2011           WebUserContentController object).
2012         - Uses this to maintain maps of UserStylesSheets and UserScripts along with their identifiers,
2013           freeing up the URL, which had been acting as the identifier, to be used as the baseURL which
2014           was what it was intended for.
2015         - Adds a baseURL property to _WKUserStyleSheet.
2016
2017         * WebKit2.xcodeproj/project.pbxproj:
2018         Add new files.
2019
2020         * Scripts/webkit/messages.py:
2021         (headers_for_type):
2022         Add support for sending WebUserContentControllerDataTypes.
2023
2024         * Shared/WebUserContentControllerDataTypes.cpp: Added.
2025         (WebKit::WebUserScriptData::encode):
2026         (WebKit::WebUserScriptData::decode):
2027         (WebKit::WebUserStyleSheetData::encode):
2028         (WebKit::WebUserStyleSheetData::decode):
2029         * Shared/WebUserContentControllerDataTypes.h: Added.
2030         Add helper types for sending user content over IPC.
2031
2032         * UIProcess/API/APIUserScript.cpp:
2033         (API::UserScript::generateUniqueURL):
2034         (API::UserScript::UserScript):
2035         * UIProcess/API/APIUserScript.h:
2036         * UIProcess/API/APIUserStyleSheet.cpp:
2037         (API::UserStyleSheet::generateUniqueURL):
2038         (API::UserStyleSheet::UserStyleSheet):
2039         * UIProcess/API/APIUserStyleSheet.h:
2040         Add identifiers for tracking across processes.
2041
2042         * UIProcess/API/Cocoa/_WKUserStyleSheet.h:
2043         * UIProcess/API/Cocoa/_WKUserStyleSheet.mm:
2044         (-[_WKUserStyleSheet initWithSource:forMainFrameOnly:legacyWhitelist:legacyBlacklist:baseURL:userContentWorld:]):
2045         (-[_WKUserStyleSheet baseURL]):
2046         Add new initializer which takes a baseURL as well as an accessor for the baseURL.
2047
2048         * UIProcess/UserContent/WebUserContentControllerProxy.cpp:
2049         (WebKit::WebUserContentControllerProxy::addProcess):
2050         (WebKit::WebUserContentControllerProxy::addUserScript):
2051         (WebKit::WebUserContentControllerProxy::removeUserScript):
2052         (WebKit::WebUserContentControllerProxy::addUserStyleSheet):
2053         (WebKit::WebUserContentControllerProxy::removeUserStyleSheet):
2054         Pass identifiers as well as user content.
2055
2056         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2057         (WebKit::InjectedBundle::addUserScript):
2058         (WebKit::InjectedBundle::addUserStyleSheet):
2059         Move user content in via move semantics rather than using a unique_ptr.
2060
2061         (WebKit::InjectedBundle::removeUserScript):
2062         (WebKit::InjectedBundle::removeUserStyleSheet):
2063         (WebKit::InjectedBundle::removeUserScripts):
2064         (WebKit::InjectedBundle::removeUserStyleSheets):
2065         (WebKit::InjectedBundle::removeAllUserContent):
2066         Update for new function signatures.
2067
2068         * WebProcess/UserContent/WebUserContentController.cpp:
2069         (WebKit::WebUserContentController::WebUserContentController):
2070         (WebKit::WebUserContentController::~WebUserContentController):
2071         (WebKit::WebUserContentController::addUserContentWorlds):
2072         (WebKit::WebUserContentController::removeUserContentWorlds):
2073         (WebKit::WebUserContentController::addUserScripts):
2074         (WebKit::WebUserContentController::removeUserScript):
2075         (WebKit::WebUserContentController::removeAllUserScripts):
2076         (WebKit::WebUserContentController::addUserStyleSheets):
2077         (WebKit::WebUserContentController::removeUserStyleSheet):
2078         (WebKit::WebUserContentController::removeAllUserStyleSheets):
2079         (WebKit::WebUserContentController::addUserScriptMessageHandlers):
2080         (WebKit::WebUserContentController::removeUserScriptMessageHandler):
2081         (WebKit::WebUserContentController::addUserContentExtensions):
2082         (WebKit::WebUserContentController::removeUserContentExtension):
2083         (WebKit::WebUserContentController::removeAllUserContentExtensions):
2084         (WebKit::WebUserContentController::addUserScriptInternal):
2085         (WebKit::WebUserContentController::addUserScript):
2086         (WebKit::WebUserContentController::removeUserScriptWithURL):
2087         (WebKit::WebUserContentController::removeUserScriptInternal):
2088         (WebKit::WebUserContentController::removeUserScripts):
2089         (WebKit::WebUserContentController::addUserStyleSheetInternal):
2090         (WebKit::WebUserContentController::addUserStyleSheet):
2091         (WebKit::WebUserContentController::removeUserStyleSheetWithURL):
2092         (WebKit::WebUserContentController::removeUserStyleSheetInternal):
2093         (WebKit::WebUserContentController::removeUserStyleSheets):
2094         (WebKit::WebUserContentController::removeAllUserContent):
2095         (WebKit::WebUserContentController::forEachUserScript):
2096         (WebKit::WebUserContentController::forEachUserStyleSheet):
2097         * WebProcess/UserContent/WebUserContentController.h:
2098         * WebProcess/UserContent/WebUserContentController.messages.in:
2099         Convert to inheriting from UserContentProvider, rather than containing a UserContentController.
2100         This means adding the storage for the user content, which has been simplified to avoid using
2101         unique_ptrs.
2102
2103         * WebProcess/WebPage/WebPage.cpp:
2104         (WebKit::WebPage::addUserScript):
2105         (WebKit::WebPage::addUserStyleSheet):
2106         (WebKit::WebPage::removeAllUserContent):
2107         Update to call the WebUserContentController, rather than going to the UserContentController, which
2108         no longer exists.
2109
2110         * WebProcess/WebPage/WebPageGroupProxy.cpp:
2111         (WebKit::WebPageGroupProxy::userContentController):
2112         * WebProcess/WebPage/WebPageGroupProxy.h:
2113         Return the WebUserContentController rather than old UserContentController.
2114
2115 2016-03-10  Commit Queue  <commit-queue@webkit.org>
2116
2117         Unreviewed, rolling out r197923.
2118         https://bugs.webkit.org/show_bug.cgi?id=155301
2119
2120         Rolling out this change due to breaking the build and
2121         LayoutTests. (Requested by ryanhaddad on #webkit).
2122
2123         Reverted changeset:
2124
2125         "Font antialiasing (smoothing) changes when elements are
2126         rendered into compositing layers"
2127         https://bugs.webkit.org/show_bug.cgi?id=23364
2128         http://trac.webkit.org/changeset/197923
2129
2130 2016-03-10  Chris Dumez  <cdumez@apple.com>
2131
2132         Speculative revalidation requests do not have their 'first party for cookies' URL set
2133         https://bugs.webkit.org/show_bug.cgi?id=155284
2134         <rdar://problem/25053203>
2135
2136         Reviewed by Antti Koivisto.
2137
2138         Speculative revalidation requests did not have their 'first party for cookies'
2139         URL set. This means the underlying NSURLRequest has a nil mainDocumentURL.
2140         Without a way to determine whether the cookie is in a third-party context,
2141         CFNetwork defaults to accepting all cookies for these resources.
2142
2143         * NetworkProcess/cache/NetworkCacheCoders.cpp:
2144         (WebKit::NetworkCache::Coder<WebCore::URL>::encode):
2145         (WebKit::NetworkCache::Coder<WebCore::URL>::decode):
2146         * NetworkProcess/cache/NetworkCacheCoders.h:
2147         Add template specialization to support encoding / decoding WebCore::URL.
2148
2149         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
2150         (WebKit::NetworkCache::constructRevalidationRequest):
2151         Set the "first party for cookies" URL on the revalidation request.
2152
2153         (WebKit::NetworkCache::SpeculativeLoadManager::PendingFrameLoad::registerSubresourceLoad):
2154         (WebKit::NetworkCache::SpeculativeLoadManager::PendingFrameLoad::saveToDiskIfReady):
2155         Now keep the subresources' ResourceRequests, in addition to their key, so we can later
2156         extract the 'first party for cookies' URL from the request and save it to disk.
2157
2158         (WebKit::NetworkCache::SpeculativeLoadManager::registerLoad):
2159         Pass the ResourceRequest in addition to the key to
2160         PendingFrameLoad::registerSubresourceLoad().
2161
2162         (WebKit::NetworkCache::SpeculativeLoadManager::revalidateEntry):
2163         Add an extra SubresourceInfo parameter, in addition to the Entry, so we
2164         have access to the first party for cookies URL. Pass this URL to
2165         constructRevalidationRequest().
2166
2167         (WebKit::NetworkCache::SpeculativeLoadManager::preloadEntry):
2168         Add an extra SubresourceInfo parameter, in addition to the Entry, so we
2169         have access to the first party for cookies URL.
2170
2171         (WebKit::NetworkCache::SpeculativeLoadManager::startSpeculativeRevalidation):
2172         Pass the SubresourceInfo to preloadEntry().
2173
2174         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.h:
2175
2176         * NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp:
2177         (WebKit::NetworkCache::SubresourcesEntry::SubresourceInfo::encode):
2178         (WebKit::NetworkCache::SubresourcesEntry::SubresourceInfo::decode):
2179         Encode / Decode new firstPartyForCookies member.
2180
2181         (WebKit::NetworkCache::SubresourcesEntry::SubresourcesEntry):
2182         (WebKit::NetworkCache::SubresourcesEntry::updateSubresourceLoads):
2183         Take SubresourceLoad objects in, instead of simple Key objects so we have
2184         access to the ResourceRequest. We extract the first party for cookies URL
2185         from the request and pass it to the SubresourceInfo constructor.
2186
2187         * NetworkProcess/cache/NetworkCacheSubresourcesEntry.h:
2188         (WebKit::NetworkCache::SubresourcesEntry::SubresourceInfo::SubresourceInfo):
2189         (WebKit::NetworkCache::SubresourcesEntry::SubresourceLoad::SubresourceLoad):
2190
2191 2016-02-22  Jer Noble  <jer.noble@apple.com>
2192
2193         Enable AVFoundationNSURLSessionEnabled by default
2194         https://bugs.webkit.org/show_bug.cgi?id=154469
2195
2196         Reviewed by Sam Weinig.
2197
2198         * Shared/WebPreferencesDefinitions.h:
2199
2200 2016-03-10  Eric Carlson  <eric.carlson@apple.com>
2201
2202         Unreviewed, revert changes accidentally committed with previous patch.
2203
2204         * WebProcess/com.apple.WebProcess.sb.in:
2205
2206 2016-03-10  Eric Carlson  <eric.carlson@apple.com>
2207
2208         [MediaStream] push media stream state to the UI process
2209         https://bugs.webkit.org/show_bug.cgi?id=155281
2210
2211         Reviewed by Darin Adler.
2212
2213         * UIProcess/API/C/WKPage.cpp:
2214         (WKPageGetMediaState): New.
2215         * UIProcess/API/C/WKPagePrivate.h:
2216
2217         * UIProcess/WebPageProxy.cpp:
2218         (WebKit::WebPageProxy::didCommitLoadForFrame): Clear m_mediaState.
2219         (WebKit::WebPageProxy::isPlayingMediaDidChange): Call m_pageClient.isPlayingMediaDidChange when
2220           audio or video state changes, call m_uiClient->isPlayingAudioDidChange when audio, vidoe,
2221           or media stream state changes.
2222         * UIProcess/WebPageProxy.h:
2223         (WebKit::WebPageProxy::mediaStateFlags): New.
2224
2225 2016-03-09  Carlos Garcia Campos  <cgarcia@igalia.com>
2226
2227         [GTK] Artifacts when using web view background color
2228         https://bugs.webkit.org/show_bug.cgi?id=155229
2229
2230         Reviewed by Mario Sanchez Prada.
2231
2232         This is because when using a web view color, we fill with the
2233         color every rectangle updated by the web process, but we should
2234         always fill the entire backing store before rendering the actual
2235         contents on top.
2236
2237         * WebProcess/WebPage/DrawingAreaImpl.cpp:
2238         (WebKit::DrawingAreaImpl::display): Ensure the web process always
2239         renders the whole visible rectangle when background is rendered by
2240         the UI process.
2241
2242 2016-03-09  Simon Fraser  <simon.fraser@apple.com>
2243
2244         Font antialiasing (smoothing) changes when elements are rendered into compositing layers
2245         https://bugs.webkit.org/show_bug.cgi?id=23364
2246         rdar://problem/7288429
2247
2248         Reviewed by Tim Horton.
2249         
2250         Send the ContentsFormat to the UI process (but nothing happens to it there yet).
2251
2252         * Shared/mac/RemoteLayerTreeTransaction.h:
2253         * Shared/mac/RemoteLayerTreeTransaction.mm:
2254         (WebKit::RemoteLayerTreeTransaction::LayerProperties::encode):
2255         (WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
2256         * WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
2257         (WebKit::PlatformCALayerRemote::setContentsFormat):
2258         (WebKit::PlatformCALayerRemote::contentsFormat):
2259         * WebProcess/WebPage/mac/PlatformCALayerRemote.h:
2260
2261 2016-03-09  Ryosuke Niwa  <rniwa@webkit.org>
2262
2263         Add runtime flags for shadow DOM and custom elements
2264         https://bugs.webkit.org/show_bug.cgi?id=155213
2265
2266         Reviewed by Dean Jackson.
2267
2268         Set the runtime flag based on preferences. Enable shadow DOM and disable custom elements by default.
2269
2270         * Shared/WebPreferencesDefinitions.h:
2271         * UIProcess/API/C/WKPreferences.cpp:
2272         (WKPreferencesSetShadowDOMEnabled):
2273         (WKPreferencesGetShadowDOMEnabled):
2274         (WKPreferencesSetCustomElementsEnabled):
2275         (WKPreferencesGetCustomElementsEnabled):
2276         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2277         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2278         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
2279         * WebProcess/WebPage/WebPage.cpp:
2280         (WebKit::WebPage::updatePreferences):
2281
2282 2016-03-09  Brent Fulgham  <bfulgham@apple.com>
2283
2284         Handling 'allowUniversalAccessFromFileURLs' on WKWebViewConfiguration causes test breakage
2285         https://bugs.webkit.org/show_bug.cgi?id=155265
2286         <rdar://problem/11101440>
2287
2288         Reviewed by Andy Estes.
2289
2290         We require "AllowUniversalAccessFromFileURLs" to permit file URLs from accessing
2291         localStorage. However, this setting is not available on the Cocoa WKPreference (by design).
2292         Instead, you need to set this value on the WKWebViewConfiguration.
2293         
2294         Back out the work-around landed in r197889, 
2295
2296         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2297         (-[WKWebViewConfiguration init]): Remove test workaround.
2298         * UIProcess/mac/WebInspectorProxyMac.mm:
2299         (WebKit::WebInspectorProxy::platformCreateInspectorPage): Set the correct flag on
2300         the WKWebViewConfiguration.
2301
2302 2016-03-09  Enrica Casucci  <enrica@apple.com>
2303
2304         Retrieve additional context for some data detector link for preview and action menu.
2305         https://bugs.webkit.org/show_bug.cgi?id=155278
2306         rdar://problem/24884951
2307
2308         Reviewed by Tim Horton.
2309
2310         Data detector results for items like calendar events, can be augmented
2311         retrieving the text surrounding the link.
2312
2313         * Platform/spi/ios/DataDetectorsUISPI.h:
2314         * Shared/ios/InteractionInformationAtPosition.h:
2315         * Shared/ios/InteractionInformationAtPosition.mm:
2316         (WebKit::InteractionInformationAtPosition::encode):
2317         (WebKit::InteractionInformationAtPosition::decode):
2318         * UIProcess/ios/WKActionSheetAssistant.mm:
2319         (-[WKActionSheetAssistant showDataDetectorsSheet]):
2320         * UIProcess/ios/WKContentViewInteraction.mm:
2321         (-[WKContentView _dataForPreviewItemController:atPosition:type:]):
2322         * WebProcess/WebPage/ios/WebPageIOS.mm:
2323         (WebKit::WebPage::getPositionInformation):
2324
2325 2016-03-09  Gavin Barraclough  <barraclough@apple.com>
2326
2327         Last opened tab does not receive SetHiddenPageTimerThrottlingIncreaseLimit message
2328         https://bugs.webkit.org/show_bug.cgi?id=155126
2329
2330         Reviewed by Anders Carlson.
2331
2332         WebPageProxy will increment the hidden page throttling counter from within its constructor,
2333         which currently causes the WebProcessPool to try to synchronously message all processes.
2334         The web page triggering the increment then fails to receive the message, since it was
2335         still being constructed. Make the update of the limit async, such that the page is fully
2336         constructed before the WebProcessPool processes the update.
2337
2338         * UIProcess/WebProcessPool.cpp:
2339         (WebKit::m_hiddenPageThrottlingAutoIncreasesCounter):
2340             - This now schedules a zero-delay timer to handle the update.
2341         (WebKit::m_hiddenPageThrottlingTimer):
2342             - This is now responsible for calling updateHiddenPageThrottlingAutoIncreaseLimit.
2343         * UIProcess/WebProcessPool.h:
2344             - Added m_hiddenPageThrottlingTimer.
2345
2346 2016-03-09  David Kilzer  <ddkilzer@apple.com>
2347
2348         REGRESSION (r197149): Missing availability checks when soft-linking DataDetectors.framework
2349         <http://webkit.org/b/155258>
2350
2351         Reviewed by Andy Estes.
2352
2353         * Platform/mac/MenuUtilities.mm:
2354         (WebKit::menuItemForTelephoneNumber):
2355         (WebKit::menuForTelephoneNumber):
2356         - Add check that returns early if DataDetectors.framework is not
2357           available.
2358
2359         * Shared/mac/WebHitTestResultData.mm:
2360         (WebKit::WebHitTestResultData::platformDecode):
2361         - Add Debug assertion.  The soft-linked code should never be
2362           called if there was no actionContext passed in.
2363
2364         * UIProcess/Cocoa/WebViewImpl.mm:
2365         (WebKit::WebViewImpl::dismissContentRelativeChildWindowsFromViewOnly):
2366         - Protect calls to DDActionsManager with availability check.
2367
2368         * UIProcess/mac/WKImmediateActionController.mm:
2369         (-[WKImmediateActionController _clearImmediateActionState]):
2370         (-[WKImmediateActionController immediateActionRecognizerWillBeginAnimation:]):
2371         - Protect calls to DDActionsManager with availability check.
2372         (-[WKImmediateActionController _animationControllerForDataDetectedText]):
2373         (-[WKImmediateActionController _animationControllerForDataDetectedLink]):
2374         - Add check that returns early if DataDetectors.framework is not
2375           available.
2376
2377 2016-03-09  Keith Rollin  <krollin@apple.com>
2378
2379         Add state dumping facility
2380         https://bugs.webkit.org/show_bug.cgi?id=154930
2381         <rdar://problem/24939135>
2382
2383         Reviewed by Anders Carlsson.
2384
2385         Collect the times at which pages are loaded. Dump them when an OS
2386         state dump is triggered.
2387
2388         * WebProcess/WebPage/WebPage.cpp:
2389         (WebKit::WebPage::didCommitLoad):
2390         * WebProcess/WebPage/WebPage.h:
2391         (WebKit::WebPage::lastPageLoadTime):
2392         * WebProcess/WebProcess.h:
2393         * WebProcess/cocoa/WebProcessCocoa.mm:
2394         (WebKit::WebProcess::registerWithStateDumper):
2395         (WebKit::WebProcess::platformInitializeProcess):
2396
2397 2016-03-09  Anders Carlsson  <andersca@apple.com>
2398
2399         _WKWebsiteDataSize.h should be an SPI header.
2400
2401         Rubber-stamped by Tim Horton.
2402
2403         * WebKit2.xcodeproj/project.pbxproj:
2404
2405 2016-03-09  Brent Fulgham  <bfulgham@apple.com>
2406
2407         Handling 'allowUniversalAccessFromFileURLs' on WKWebViewConfiguration causes test breakage
2408         https://bugs.webkit.org/show_bug.cgi?id=155265
2409
2410         Unreviewed work-around to allow testing to continue.
2411
2412         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2413         (-[WKWebViewConfiguration init]): Workaround build break.
2414
2415 2016-03-09  Alex Christensen  <achristensen@webkit.org>
2416
2417         Fix use-after-free when cancelling synchronous XHR when using NetworkSession
2418         https://bugs.webkit.org/show_bug.cgi?id=155253
2419
2420         Reviewed by Brady Eidson.
2421
2422         * NetworkProcess/NetworkLoad.cpp:
2423         (WebKit::NetworkLoad::continueWillSendRequest):
2424         Store the completion handler on the stack before calling didFail, which deletes the
2425         NetworkLoad, so we don't access m_redirectCompletionHandler after deleting the NetworkLoad.
2426
2427 2016-03-09  Commit Queue  <commit-queue@webkit.org>
2428
2429         Unreviewed, rolling out r197698.
2430         https://bugs.webkit.org/show_bug.cgi?id=155252
2431
2432         Caused assertions, and wasn't reviewed by a WK2 owner
2433         (Requested by andersca on #webkit).
2434
2435         Reverted changeset:
2436
2437         "Last opened tab does not receive
2438         SetHiddenPageTimerThrottlingIncreaseLimit message"
2439         https://bugs.webkit.org/show_bug.cgi?id=155126
2440         http://trac.webkit.org/changeset/197698
2441
2442 2016-03-09  Conrad Shultz  <conrad_shultz@apple.com>
2443
2444         WebsiteDataStore::Configuration::legacyWebsiteDataStoreConfiguration() should respect the passed-in configuration
2445         https://bugs.webkit.org/show_bug.cgi?id=155250
2446
2447         Reviewed by Anders Carlsson.
2448
2449         Note that the legacy directories are already set by default in ProcessPoolConfiguration::createWithLegacyOptions(),
2450         which is also where the shouldHaveLegacyDataStore flag, which will cause this code path to be reached, is set.
2451
2452         * UIProcess/WebProcessPool.cpp:
2453         (WebKit::legacyWebsiteDataStoreConfiguration):
2454         Use the passed-in configuration to set the application cache, network cache, and media keys storage directories.
2455
2456 2016-03-09  Chris Dumez  <cdumez@apple.com>
2457
2458         Speculative disk cache resource revalidations are sometimes wasted
2459         https://bugs.webkit.org/show_bug.cgi?id=155187
2460         <rdar://problem/25032905>
2461
2462         Reviewed by Antti Koivisto.
2463
2464         Speculative disk cache resource revalidations were sometimes wasted.
2465
2466         We would sometimes correctly revalidate a resource but the
2467         NetworkResourceLoader then either:
2468         1. Fail to reuse the speculatively validated entry
2469         2. Reuse the speculatively validated entry but then validate it again
2470
2471         Bug 1 was caused by the revalidated entry key sometimes being
2472         different from the cached entry key. This could happen when
2473         revalidation fails (the server did not send back a 304) in
2474         which case we call NetworkCache::store() which creates a new
2475         cache Entry, generating a cache key from our revalidation
2476         request. If the original request has a cache partition or a
2477         range, then the keys would not match because we did not set
2478         the cache partition or the range on the revalidation request.
2479         This has been addressed by setting the cache partition on the
2480         revalidation request in constructRevalidationRequest() and by
2481         not doing revalidation if the original request had a 'range'
2482         header.
2483
2484         Bug 2 was caused by us marking a speculatively revalidated entry
2485         as "not needing revalidating" only in Cache::update(). Cache::update()
2486         is only called in the case the revalidation was successful (server
2487         returned a 304). If revalidation was not successful, Cache::store()
2488         would be called instead was we would fail to update the
2489         needsRevalidation flag. NetworkResourceLoader would then validate
2490         again the resource that was already speculatively revalidated.
2491         To address the problem, we now update the 'needsRevalidation' flag
2492         as soon as the speculative revalidation completes, in
2493         SpeculativeLoad::didComplete().
2494
2495         * NetworkProcess/cache/NetworkCache.cpp:
2496         (WebKit::NetworkCache::Cache::retrieve):
2497         (WebKit::NetworkCache::makeCacheKey):
2498         (WebKit::NetworkCache::Cache::update):
2499         * NetworkProcess/cache/NetworkCacheEntry.cpp:
2500         (WebKit::NetworkCache::Entry::setNeedsValidation):
2501         * NetworkProcess/cache/NetworkCacheEntry.h:
2502         * NetworkProcess/cache/NetworkCacheKey.cpp:
2503         (WebKit::NetworkCache::noPartitionString):
2504         (WebKit::NetworkCache::Key::Key):
2505         (WebKit::NetworkCache::Key::hasPartition):
2506         * NetworkProcess/cache/NetworkCacheKey.h:
2507         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
2508         (WebKit::NetworkCache::SpeculativeLoad::didComplete):
2509         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
2510         (WebKit::NetworkCache::constructRevalidationRequest):
2511         (WebKit::NetworkCache::SpeculativeLoadManager::retrieveEntryFromStorage):
2512         (WebKit::NetworkCache::SpeculativeLoadManager::revalidateEntry):
2513
2514 2016-03-09  Brent Fulgham  <bfulgham@apple.com>
2515
2516         Local HTML should be blocked from localStorage access unless "Disable Local File Restrictions" is checked
2517         https://bugs.webkit.org/show_bug.cgi?id=155185
2518
2519         Reviewed by Anders Carlsson.
2520         <rdar://problem/11101440>
2521
2522         Tested by TestWebKitAPI tests IndexedDB.IndexedDBMultiProcess and IndexedDB.IndexedDBPersistence.
2523
2524         Allow Cocoa WKWebViewConfiguration access to the 'allowUniversalAccessFromFileURLs' setting.
2525
2526         * UIProcess/API/Cocoa/WKWebView.mm:
2527         (- [WKWebView _initializeWithConfiguration]): Set 'allowUniversalAccessFromFileURLsKey' in
2528         page configuration.
2529         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2530         (-[WKWebViewConfiguration _allowUniversalAccessFromFileURLs]): Added,
2531         (-[WKWebViewConfiguration _setAllowUniversalAccessFromFileURLs:]): Added.
2532         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
2533
2534 2016-03-09  Enrica Casucci  <enrica@apple.com>
2535
2536         Add two finger tap on links.
2537         https://bugs.webkit.org/show_bug.cgi?id=155205
2538         rdar://problem/22937516
2539
2540         Reviewed by Sam Weinig.
2541
2542         Adds two finger tap gesture recognizer. When performed
2543         on a link, it calls the delegate.
2544
2545         * Platform/spi/ios/UIKitSPI.h:
2546         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
2547         * UIProcess/WebPageProxy.h:
2548         * UIProcess/ios/WKContentViewInteraction.h:
2549         * UIProcess/ios/WKContentViewInteraction.mm:
2550         (-[WKContentView setupInteraction]):
2551         (-[WKContentView cleanupInteraction]):
2552         (-[WKContentView _removeDefaultGestureRecognizers]):
2553         (-[WKContentView _addDefaultGestureRecognizers]):
2554         (-[WKContentView _twoFingerSingleTapGestureRecognized:]):
2555         * UIProcess/ios/WebPageProxyIOS.mm:
2556         (WebKit::WebPageProxy::handleTwoFingerTapAtPoint):
2557         * WebProcess/WebPage/WebPage.h:
2558         * WebProcess/WebPage/WebPage.messages.in:
2559         * WebProcess/WebPage/ios/WebPageIOS.mm:
2560         (WebKit::WebPage::handleTwoFingerTapAtPoint):
2561
2562 2016-03-09  Alex Christensen  <achristensen@webkit.org>
2563
2564         Always call NSURLSession completion handlers
2565         https://bugs.webkit.org/show_bug.cgi?id=155137
2566
2567         Reviewed by Darin Adler.
2568
2569         There are some edge cases which should not be hit, but if they are they would cause the
2570         network process to hang and network resources to be leaked.  This can be avoided.
2571         There are also a few release asserts that do not need to crash release builds.
2572
2573         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
2574         (WebKit::NetworkDataTask::NetworkDataTask):
2575         (WebKit::NetworkDataTask::didReceiveChallenge):
2576         (WebKit::NetworkDataTask::didCompleteWithError):
2577         (WebKit::NetworkDataTask::didReceiveResponse):
2578         (WebKit::NetworkDataTask::didReceiveData):
2579         (WebKit::NetworkDataTask::willPerformHTTPRedirection):
2580         (WebKit::NetworkDataTask::scheduleFailure):
2581         (WebKit::NetworkDataTask::tryPasswordBasedAuthentication):
2582         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2583         (-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]):
2584         (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
2585         (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]):
2586
2587 2016-03-08  Sam Weinig  <sam@webkit.org>
2588
2589         Roll r197632 back in now that the bots have caught up.
2590
2591         * UIProcess/ios/WKContentViewInteraction.mm:
2592         (-[WKContentView textInputTraits]):
2593
2594 2016-03-08  Oliver Hunt  <oliver@apple.com>
2595
2596         Start moving to separated writable and executable mappings in the JIT
2597         https://bugs.webkit.org/show_bug.cgi?id=155178
2598
2599         Reviewed by Fil Pizlo.
2600
2601         Update feature defines.
2602
2603         * Configurations/FeatureDefines.xcconfig:
2604
2605 2016-03-08  Brent Fulgham  <bfulgham@apple.com>
2606
2607         [WK2][Mac] Allow processes to set "fast-dev-casheable" bit in Network Process
2608         https://bugs.webkit.org/show_bug.cgi?id=155189
2609         <rdar://problem/25042678>
2610
2611         Reviewed by Alexey Proskuryakov.
2612
2613         Update the NetworkProcess sandbox profiles with a declaration that using the
2614         system-fctl to touch the "hot file" flag (to support caching operations)
2615         is allowed. I should have done this in Bug 154503, but did not.
2616
2617         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in: Add sandbox permission.
2618
2619 2016-03-08  Commit Queue  <commit-queue@webkit.org>
2620
2621         Unreviewed, rolling out r197793 and r197799.
2622         https://bugs.webkit.org/show_bug.cgi?id=155195
2623
2624         something weird happened while landing this and everything
2625         broke (Requested by olliej on #webkit).
2626
2627         Reverted changesets:
2628
2629         "Start moving to separated writable and executable mappings in
2630         the JIT"
2631         https://bugs.webkit.org/show_bug.cgi?id=155178
2632         http://trac.webkit.org/changeset/197793
2633
2634         "arm64 build fix after r197793."
2635         http://trac.webkit.org/changeset/197799
2636
2637 2016-03-08  Brent Fulgham  <bfulgham@apple.com>
2638
2639         [WK2] Grant explicit read access to ManagedPreferences
2640         https://bugs.webkit.org/show_bug.cgi?id=155173
2641         <rdar://problem/24910550>
2642
2643         Reviewed by Alexey Proskuryakov.
2644
2645         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: Add new
2646         read permission.
2647
2648 2016-03-08  Anders Carlsson  <andersca@apple.com>
2649
2650         Ignore deprecation warnings.
2651
2652         * Shared/mac/ChildProcessMac.mm:
2653         (WebKit::ChildProcess::stopNSAppRunLoop):
2654         * Shared/mac/WebEventFactory.mm:
2655         (WebKit::mouseButtonForEvent):
2656         (WebKit::mouseEventTypeForEvent):
2657         (WebKit::clickCountForEvent):
2658         (WebKit::globalPointForEvent):
2659         (WebKit::pointForEvent):
2660         (WebKit::textFromEvent):
2661         (WebKit::unmodifiedTextFromEvent):
2662         (WebKit::isKeypadEvent):
2663         (WebKit::isKeyUpEvent):
2664         (WebKit::modifiersForEvent):
2665         (WebKit::WebEventFactory::createWebKeyboardEvent):
2666         * UIProcess/API/Cocoa/WKNavigationAction.mm:
2667         (toNSEventModifierFlags):
2668         * UIProcess/Cocoa/WebViewImpl.mm:
2669         (WebKit::WebViewImpl::becomeFirstResponder):
2670         (WebKit::WebViewImpl::updateContentInsetsIfAutomatic):
2671         (WebKit::WebViewImpl::viewDidMoveToWindow):
2672         (WebKit::WebViewImpl::postFakeMouseMovedEventForFlagsChangedEvent):
2673         (WebKit::WebViewImpl::createFullScreenWindow):
2674         (WebKit::WebViewImpl::sendToolTipMouseExited):
2675         (WebKit::WebViewImpl::sendToolTipMouseEntered):
2676         (WebKit::applicationFlagsForDrag):
2677         (WebKit::WebViewImpl::setLastMouseDownEvent):
2678         (WebKit::WebViewImpl::doneWithKeyEvent):
2679         (WebKit::WebViewImpl::collectKeyboardLayoutCommandsForEvent):
2680         (WebKit::WebViewImpl::performKeyEquivalent):
2681         * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
2682         (WebKit::PluginProcessProxy::beginModal):
2683         * UIProcess/mac/WebContextMenuProxyMac.mm:
2684         (WebKit::WebContextMenuProxyMac::showContextMenu):
2685         * UIProcess/mac/WebInspectorProxyMac.mm:
2686         (WebKit::WebInspectorProxy::platformCanAttach):
2687         * UIProcess/mac/WebPopupMenuProxyMac.mm:
2688         (WebKit::WebPopupMenuProxyMac::populate):
2689         (WebKit::WebPopupMenuProxyMac::showPopupMenu):
2690         * WebProcess/Plugins/PDF/DeprecatedPDFPlugin.mm:
2691         (WebKit::modifierFlagsFromWebEvent):
2692         (WebKit::getEventTypeFromWebEvent):
2693         * WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm:
2694         (WebKit::cssAlignmentValueForNSTextAlignment):
2695         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
2696         (WebKit::convertImageToBitmap):
2697
2698 2016-03-08  Oliver Hunt  <oliver@apple.com>
2699
2700         Start moving to separated writable and executable mappings in the JIT
2701         https://bugs.webkit.org/show_bug.cgi?id=155178
2702
2703         Reviewed by Filip Pizlo.
2704
2705         Update feature defines.
2706
2707         * Configurations/FeatureDefines.xcconfig:
2708
2709 2016-03-08  Commit Queue  <commit-queue@webkit.org>
2710
2711         Unreviewed, rolling out r197766.
2712         https://bugs.webkit.org/show_bug.cgi?id=155183
2713
2714         Has platform-specific code in non-platform files (Requested by
2715         smfr on #webkit).
2716
2717         Reverted changeset:
2718
2719         "AX: Force allow user zoom"
2720         https://bugs.webkit.org/show_bug.cgi?id=155056
2721         http://trac.webkit.org/changeset/197766
2722
2723 2016-03-04  Ada Chan  <adachan@apple.com>
2724
2725         Fix lifetime issues regarding WebVideoFullscreenInterfaceMac
2726         https://bugs.webkit.org/show_bug.cgi?id=155130
2727
2728         Reviewed by Beth Dakin.
2729
2730         Now that both fullscreen and video controls manager rely on WebVideoFullscreenInterface,
2731         we now keep track of a "client count" for each context ID so we'll only remove it
2732         from the context map after all the "clients" are done with it.
2733
2734         Before this change, every time WebVideoFullscreenManager::setUpVideoControlsManager()
2735         is called, the existing interface is cleared and a new one is created even when there's
2736         an existing interface for that. With this change, we reuse the existing interface for
2737         the video element.
2738
2739         * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h:
2740         * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm:
2741         (WebKit::WebVideoFullscreenManagerProxy::invalidate):
2742         Also clear out m_clientCounts.
2743         (WebKit::WebVideoFullscreenManagerProxy::addClientForContext):
2744         If the context ID is not in m_clientCounts yet, add the count of 1 to
2745         that table for that ID. Otherwise, increment the count by 1.
2746         (WebKit::WebVideoFullscreenManagerProxy::removeClientForContext):
2747         Assert that we have added this context id to m_clientCounts before.
2748         Decrement the count. If it reaches 0, remove this context ID from both
2749         m_clientCounts and m_contextMap.
2750         (WebKit::WebVideoFullscreenManagerProxy::setupFullscreenWithID):
2751         We have started a new fullscreen session using this interface. Call
2752         addClientForContext() to update the client count.
2753         (WebKit::WebVideoFullscreenManagerProxy::setUpVideoControlsManagerWithID):
2754         If the current controls manager set up has the same context ID as the one
2755         passed in, we don't have to do anything. Otherwise, if we have set up
2756         the video controls manager with a different ID before, call removeClientForContext()
2757         on the old ID to decrement its client count. Set m_controlsManagerContextId
2758         to the new value and call addClientForContext() with it.
2759         (WebKit::WebVideoFullscreenManagerProxy::didCleanupFullscreen):
2760         Instead of removing the mapping from m_contextMap directly, reset the fullscreen
2761         mode on the interface and call removeClientForContext(), which removes the mapping
2762         only if there's no more client using the interface.
2763         * WebProcess/cocoa/WebVideoFullscreenManager.h:
2764         * WebProcess/cocoa/WebVideoFullscreenManager.mm:
2765         (WebKit::WebVideoFullscreenManager::~WebVideoFullscreenManager):
2766         Clear m_clientCounts.
2767         (WebKit::WebVideoFullscreenManager::removeContext):
2768         Add a helper method for removing the context.
2769         (WebKit::WebVideoFullscreenManager::addClientForContext):
2770         If the context ID is not in m_clientCounts yet, add the count of 1 to
2771         that table for that ID. Otherwise, increment the count by 1.
2772         (WebKit::WebVideoFullscreenManager::removeClientForContext):
2773         Assert that we have added this context id to m_clientCounts before.
2774         Decrement the count. If it reaches 0, remove this context ID from
2775         m_clientCounts and call removeContext() to clean up this context.
2776         (WebKit::WebVideoFullscreenManager::enterVideoFullscreenForVideoElement):
2777         We have started a new fullscreen session using this interface. Call
2778         addClientForContext() to update the client count. Create a layer hosting
2779         context if it's not there.
2780         (WebKit::WebVideoFullscreenManager::setUpVideoControlsManager):
2781         If we have set up a context for this video element before, see if it's
2782         the one we are currently managing video controls for. If it is, return early.
2783         Otherwise, call removeClientForContext() on the previous m_controlsManagerContextId
2784         and update m_controlsManagerContextId to the context ID of this video element.
2785         If there's no context created for this video element yet, set one up.
2786         Send a SetUpVideoControlsManagerWithID message to the proxy object in the UI process
2787         so it'll update its controls manager context ID. Also, conditionalize all of this
2788         under PLATFORM(MAC) to be consistent with WebVideoFullscreenManagerProxy.
2789         (WebKit::WebVideoFullscreenManager::didCleanupFullscreen):
2790         Just reset the fullscreen mode on the interface and call removeClientForContext() which
2791         only cleans up the context if there's no more client using it.
2792
2793 2016-03-08  Timothy Hatcher  <timothy@apple.com>
2794
2795         Web Inspector: Add automation protocol methods for navigation
2796
2797         https://bugs.webkit.org/show_bug.cgi?id=155163
2798         rdar://problem/25029054
2799
2800         Reviewed by Darin Adler.
2801
2802         * UIProcess/Automation/Automation.json:
2803         * UIProcess/Automation/WebAutomationSession.cpp:
2804         (WebKit::WebAutomationSession::getBrowsingContexts): Set url.
2805         (WebKit::WebAutomationSession::getBrowsingContext): Added.
2806         (WebKit::WebAutomationSession::navigateBrowsingContext): Added.
2807         (WebKit::WebAutomationSession::goBackInBrowsingContext): Added.
2808         (WebKit::WebAutomationSession::goForwardInBrowsingContext): Added.
2809         (WebKit::WebAutomationSession::reloadBrowsingContext): Added.
2810         * UIProcess/Automation/WebAutomationSession.h:
2811
2812 2016-03-08  Nan Wang  <n_wang@apple.com>
2813
2814         AX: Force allow user zoom
2815         https://bugs.webkit.org/show_bug.cgi?id=155056
2816
2817         Reviewed by Chris Fleizach.
2818
2819         Soft linked libAccessibility library so that we can observe the accessibility
2820         setting change for the force always user scalable feature.
2821
2822         * WebProcess/WebPage/WebPage.cpp:
2823         (WebKit::forceAlwaysUserScalableChangedCallback):
2824         (WebKit::WebPage::create):
2825         (WebKit::m_shouldDispatchFakeMouseMoveEvents):
2826         (WebKit::WebPage::~WebPage):
2827         (WebKit::WebPage::preferencesDidChange):
2828         (WebKit::WebPage::updateForceAlwaysUserScalable):
2829         (WebKit::WebPage::updatePreferences):
2830         * WebProcess/WebPage/WebPage.h:
2831
2832 2016-03-08  Csaba Osztrogonác  <ossy@webkit.org>
2833
2834         One more unreviewed speculative buildfix after r197728.
2835
2836         * NetworkProcess/NetworkResourceLoader.cpp:
2837         (WebKit::NetworkResourceLoader::didFinishLoading):
2838         (WebKit::NetworkResourceLoader::continueWillSendRequest):
2839
2840 2016-03-08  Csaba Osztrogonác  <ossy@webkit.org>
2841
2842         Unreviewed speculative buildfix after r197728.
2843
2844         * WebProcess/Network/WebLoaderStrategy.cpp:
2845         (WebKit::WebLoaderStrategy::scheduleLoad):
2846
2847 2016-03-08  Timothy Hatcher  <timothy@apple.com>
2848
2849         Web Inspector: Make WebAutomationSession::closeBrowsingContext work as expected
2850
2851         https://bugs.webkit.org/show_bug.cgi?id=155162
2852         rdar://problem/25027191
2853
2854         Reviewed by Brian Burg.
2855
2856         * UIProcess/Automation/WebAutomationSession.cpp:
2857         (WebKit::WebAutomationSession::closeBrowsingContext):
2858         Call closePage, the same method ultimately used by window.close().
2859
2860         * UIProcess/WebPageProxy.h: Make closePage public.
2861
2862 2016-03-07  Carlos Garcia Campos  <cgarcia@igalia.com>
2863
2864         REGRESSION(r197062): [GTK] Transparent backgrounds no longer work after r197062
2865         https://bugs.webkit.org/show_bug.cgi?id=155119
2866
2867         Reviewed by Martin Robinson.
2868
2869         This is because after r197062 we are now realizing the view too
2870         early, even before the toplevel window has been realized, forcing
2871         the toplevel window to be realized. If the RGBA visual is set on
2872         the window after it has been realzied it doesn't have any
2873         effect. We should wait until the toplevel window is realized to
2874         realize the web view, giving time to the application to set RGBA
2875         visual and background color. If the toplevel window is already
2876         realized we realize the web view immediately, so that this doesn't
2877         affect the tearing problems fixed in r197062.
2878
2879         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
2880         (toplevelWindowRealized):
2881         (webkitWebViewBaseSetToplevelOnScreenWindow):
2882
2883 2016-03-07  Keith Rollin  <krollin@apple.com>
2884
2885         Enhance logging: Use "always on" macros
2886         https://bugs.webkit.org/show_bug.cgi?id=154499
2887         <rdar://problem/24757730>
2888
2889         Reviewed by Chris Dumez.
2890
2891         Make use of new logging macros by reporting on frame and resource
2892         load activity.
2893
2894         Connection updated to report IPC errors, helping us identify when
2895         messaging between processes breaks down.
2896
2897         ChildProcess updated to log if it is terminating early. Some
2898         sysdiagnose logging from customers indicate that this is happening in
2899         the wild.
2900
2901         * NetworkProcess/NetworkResourceLoader.cpp:
2902         (WebKit::NetworkResourceLoader::startNetworkLoad):
2903         (WebKit::NetworkResourceLoader::didFinishLoading):
2904         (WebKit::NetworkResourceLoader::didFailLoading):
2905         (WebKit::NetworkResourceLoader::continueWillSendRequest):
2906         (WebKit::NetworkResourceLoader::isAlwaysOnLoggingAllowed):
2907         * NetworkProcess/NetworkResourceLoader.h:
2908         * Platform/IPC/Connection.cpp:
2909         (IPC::Connection::waitForSyncReply):
2910         * Shared/ChildProcess.cpp:
2911         (WebKit::didCloseOnConnectionWorkQueue):
2912         * WebProcess/Network/WebLoaderStrategy.cpp:
2913         (WebKit::WebLoaderStrategy::scheduleLoad):
2914         * WebProcess/Network/WebResourceLoader.cpp:
2915         (WebKit::WebResourceLoader::willSendRequest):
2916         (WebKit::WebResourceLoader::didReceiveResponse):
2917         (WebKit::WebResourceLoader::didReceiveData):
2918         (WebKit::WebResourceLoader::didFinishResourceLoad):
2919         (WebKit::WebResourceLoader::didFailResourceLoad):
2920         (WebKit::WebResourceLoader::didReceiveResource):
2921         (WebKit::WebResourceLoader::isAlwaysOnLoggingAllowed):
2922         * WebProcess/Network/WebResourceLoader.h:
2923
2924 2016-03-07  Brent Fulgham  <bfulgham@apple.com>
2925
2926         Reduce startup and shutdown cost of resource load statistics
2927         https://bugs.webkit.org/show_bug.cgi?id=155120
2928         <rdar://problem/25010167>
2929
2930         Reviewed by Andy Estes.
2931
2932         Use a dedicated WorkQueue to process resource load statistics data. Allow
2933         processing to load (and save) previously stored statistics asynchronously so
2934         that it does not delay startup.
2935         
2936         Now that we have a more rational storage situation, get rid of the 'writeToDisk'
2937         method since it is no longer needed in the WK2 layer.
2938
2939         Move all of the Resource Load Statistics file handling code from WebCore to this
2940         API layer.
2941
2942         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2943         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore): Initialize
2944         member variable with storage path, rather than passing to WebCore code.
2945         (WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated): Revised to
2946         use the new WorkQueue code.
2947         (WebKit::WebResourceLoadStatisticsStore::setResourceLoadStatisticsEnabled): When
2948         activating the feature, purge any old statistics before loading from disk.
2949         (WebKit::WebResourceLoadStatisticsStore::readDataFromDiskIfNeeded): Added.
2950         (WebKit::WebResourceLoadStatisticsStore::processWillOpenConnection): Added.
2951         (WebKit::WebResourceLoadStatisticsStore::processDidCloseConnection): Added.
2952         (WebKit::WebResourceLoadStatisticsStore::applicationWillTerminate): Make sure all
2953         of the WorkQueue tasks are done before terminating.
2954         (WebKit::WebResourceLoadStatisticsStore::persistentStoragePath): Moved from WebCore.
2955         (WebKit::WebResourceLoadStatisticsStore::writeEncoderToDisk): Ditto.
2956         (WebKit::WebResourceLoadStatisticsStore::createDecoderFromDisk): Ditto.
2957         (WebKit::WebResourceLoadStatisticsStore::writeToDisk): Deleted.
2958         * UIProcess/WebResourceLoadStatisticsStore.h:
2959         (WebKit::WebResourceLoadStatisticsStore::coreStore):
2960         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2961         (WebKit::WebsiteDataStore::webProcessWillOpenConnection): Call new WebResourceLoadStatisticsStore code.
2962         (WebKit::WebsiteDataStore::webProcessDidCloseConnection): Ditto.
2963
2964 2016-03-07  Alex Christensen  <achristensen@webkit.org>
2965
2966         Fix cookies with private browsing and NetworkSession
2967         https://bugs.webkit.org/show_bug.cgi?id=155147
2968         rdar://problem/25018279
2969
2970         Reviewed by Brady Eidson.
2971
2972         In the NetworkSession constructor, we look for a NetworkStorageSession in the SessionTracker
2973         and use that NetworkStorageSession's CFHTTPCookieStorageRef in the NSURLSessionConfiguration.
2974         NetworkStorageSessions were being set in SessionTracker's storageSessionMap after NetworkSessions
2975         were created, causing the NSHTTPCookieStorage of the NSURLSession to be different from the
2976         CFHTTPCookieStorageRef used by document.cookie in newly created private browsing sessions.
2977         This fixes that problem by passing the NetworkStorageSession as a constructor parameter to the
2978         NetworkSession so it can use the correct CFHTTPCookieStorageRef in its NSURLSessionConfiguration
2979         before it is in the storageSessionMap.
2980
2981         * NetworkProcess/NetworkSession.h:
2982         (WebKit::NetworkSession::sessionID):
2983         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2984         (WebKit::NetworkSession::defaultSession):
2985         (WebKit::NetworkSession::NetworkSession):
2986         * NetworkProcess/mac/RemoteNetworkingContext.mm:
2987         (WebKit::RemoteNetworkingContext::ensurePrivateBrowsingSession):
2988         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
2989         (WebKit::WebFrameNetworkingContext::ensurePrivateBrowsingSession):
2990
2991 2016-03-07  Brent Fulgham  <bfulgham@apple.com>
2992
2993         Correct bug in resource load statistics debug flag for legacy clients
2994         https://bugs.webkit.org/show_bug.cgi?id=155118
2995         <rdar://problem/25020088>
2996
2997         Reviewed by Andy Estes.
2998
2999         Some clients launch WebKit2 using the "legacy" configuration for the website data store.
3000         The Resource Load Statistics code was not added to this type of configuration, which
3001         prevents various WebKit2 clients from using this code.
3002
3003         * UIProcess/WebProcessPool.cpp:
3004         (WebKit::legacyWebsiteDataStoreConfiguration): Tell the legacy initializer where to
3005         find the resource load statistics data.
3006
3007 2016-03-07  Daniel Bates  <dabates@apple.com>
3008
3009         Cleanup: Add convenience function URL::procotolIsBlob()
3010         https://bugs.webkit.org/show_bug.cgi?id=155127
3011         <rdar://problem/25016829>
3012
3013         Reviewed by Brent Fulgham.
3014
3015         * NetworkProcess/NetworkLoad.cpp:
3016         (WebKit::NetworkLoad::NetworkLoad): Modified to use URL::protocolIsBlob().
3017         * NetworkProcess/NetworkResourceLoader.cpp:
3018         (WebKit::NetworkResourceLoader::NetworkResourceLoader): Ditto.
3019         * WebProcess/WebPage/WebPage.cpp:
3020         (WebKit::WebPage::canHandleRequest): Ditto.
3021
3022 2016-03-07  Simon Fraser  <simon.fraser@apple.com>
3023
3024         Use CGColorSpaceCopyICCData instead of CGColorSpaceCopyICCProfile
3025         https://bugs.webkit.org/show_bug.cgi?id=155123
3026         rdar://problem/24990256
3027
3028         Reviewed by Tim Horton.
3029         
3030         On newer OSes, use CGColorSpaceCopyICCData().
3031
3032         * Shared/mac/ColorSpaceData.mm:
3033         (WebKit::ColorSpaceData::encode):
3034
3035 2016-03-07  Gavin Barraclough  <barraclough@apple.com>
3036
3037         Last opened tab does not receive SetHiddenPageTimerThrottlingIncreaseLimit message
3038         https://bugs.webkit.org/show_bug.cgi?id=155126
3039
3040         Reviewed by Chris Dumez.
3041
3042         WebPageProxy will increment the hidden page throttling counter from within its constructor,
3043         which currently causes the WebProcessPool to try to synchronously message all processes.
3044         The web page triggering the increment then fails to receive the message, since it was
3045         still being constructed. Make the update of the limit async, such that the page is fully
3046         constructed before the WebProcessPool processes the update.
3047
3048         * UIProcess/WebProcessPool.cpp:
3049         (WebKit::m_hiddenPageThrottlingAutoIncreasesCounter):
3050             - This now schedules a zero-delay timer to handle the update.
3051         (WebKit::m_hiddenPageThrottlingTimer):
3052             - This is now responsible for calling updateHiddenPageThrottlingAutoIncreaseLimit.
3053         * UIProcess/WebProcessPool.h:
3054             - Added m_hiddenPageThrottlingTimer.
3055
3056 2016-03-05  Enrica Casucci  <enrica@apple.com>
3057
3058         Support preview on attachment elements.
3059         https://bugs.webkit.org/show_bug.cgi?id=155074
3060         rdar://problem/24806079
3061
3062         Reviewed by Sam Weinig.
3063
3064         Allowing preview to start on attachment elements.
3065         Adding a private UIDelegate method to provide the data for the preview.
3066
3067         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
3068         * UIProcess/ios/WKContentViewInteraction.mm:
3069         (-[WKContentView _interactionShouldBeginFromPreviewItemController:forPosition:]):
3070         (-[WKContentView _dataForPreviewItemController:atPosition:type:]):
3071
3072 2016-03-06  Andreas Kling  <akling@apple.com>
3073
3074         Reduce page cache capacity from 3 to 2.
3075         <https://webkit.org/b/155087>
3076
3077         Reviewed by Antti Koivisto.
3078
3079         It's extremely rare that users go back more than 2 pages in the page cache,
3080         and nowadays the network cache makes even un-cached pages fast to reload.
3081
3082         Trimming the page cache from 3 to 2 entries has a very nice effect on heap
3083         fragmentation. I'm seeing a ~5% progression on the iPad PLUM test locally;
3084         average memory usage across 300 loads goes from ~121MB to ~114MB.
3085
3086         * Shared/CacheModel.cpp:
3087         (WebKit::calculateCacheSizes):
3088
3089 2016-03-05  Sam Weinig  <sam@webkit.org>
3090
3091         Revert usage of autofill field name for use with UITextInputTraits
3092         until our bots can catch up.
3093
3094         * UIProcess/ios/WKContentViewInteraction.mm:
3095         (-[WKContentView textInputTraits]):
3096
3097 2016-03-05  Chris Dumez  <cdumez@apple.com>
3098
3099         Consolidate RuntimeApplicationChecks and RuntimeApplicationChecksIOS
3100         https://bugs.webkit.org/show_bug.cgi?id=155035
3101
3102         Reviewed by Darin Adler.
3103
3104         Update runtime application checks.
3105
3106         * UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm:
3107         (API::WebsiteDataStore::defaultApplicationCacheDirectory):
3108         * UIProcess/Cocoa/VersionChecks.mm:
3109         (WebKit::linkedOnOrAfter):
3110         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3111         (WebKit::WebProcessPool::platformInitializeWebProcess):
3112         (WebKit::WebProcessPool::legacyPlatformDefaultApplicationCacheDirectory):
3113         * UIProcess/ios/WKContentViewInteraction.mm:
3114         * UIProcess/mac/WebPageProxyMac.mm:
3115         (WebKit::expectsLegacyImplicitRubberBandControl):
3116         (WebKit::WebPageProxy::appleMailPaginationQuirkEnabled):
3117
3118 2016-03-05  Sam Weinig  <sam@webkit.org>
3119
3120         Add support for processing the autofill field name out of form control elements ultimately to aid input methods
3121         <rdar://problem/23041180>
3122         https://bugs.webkit.org/show_bug.cgi?id=155079
3123
3124         Reviewed by Enrica Casucci.
3125
3126         * Shared/AssistedNodeInformation.cpp:
3127         (WebKit::AssistedNodeInformation::encode):
3128         (WebKit::AssistedNodeInformation::decode):
3129         * Shared/AssistedNodeInformation.h:
3130         Add AutofillFieldName. Convert some coders to use encodeEnum/decodeEnum instead of casting.
3131
3132         * UIProcess/ios/WKContentViewInteraction.mm:
3133         (-[WKContentView textInputTraits]):
3134         Map AutofillFieldNames to the associated UITextContentTypes.
3135
3136         * WebProcess/WebPage/ios/WebPageIOS.mm:
3137         (WebKit::WebPage::getAssistedNodeInformation):
3138         Extract the AutofillFieldNames onto the AssistedNodeInformation for <input> elements 
3139         and <textarea> elements.
3140
3141 2016-03-05  Timothy Hatcher  <timothy@apple.com>
3142
3143         Implement the Automation protocol commands by tracking WebPageProxy objects
3144         that are controlled by automation and assigning them a UUID handle.
3145
3146         https://bugs.webkit.org/show_bug.cgi?id=154953
3147         rdar://problem/24947489
3148
3149         Reviewed by Brian Burg.
3150
3151         * UIProcess/API/APIAutomationSessionClient.h:
3152         (API::AutomationSessionClient::didRequestNewWindow):
3153         Return a WebPageProxy instead of void so it can be assigned a UUID handle.
3154
3155         * UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h:
3156         Return a WKPageRef from _automationSessionDidRequestNewWindow:.
3157
3158         * UIProcess/Automation/WebAutomationSession.cpp:
3159         (WebKit::WebAutomationSession::webPageProxyForHandle):
3160         (WebKit::WebAutomationSession::handleForWebPageProxy):
3161         (WebKit::WebAutomationSession::getBrowsingContexts):
3162         (WebKit::WebAutomationSession::createBrowsingContext):
3163         (WebKit::WebAutomationSession::closeBrowsingContext):
3164         (WebKit::WebAutomationSession::switchToBrowsingContext):
3165
3166         * UIProcess/Automation/WebAutomationSession.h:
3167         Added new methods and maps to track pages and handles.
3168
3169         * UIProcess/Cocoa/AutomationSessionClient.h:
3170         * UIProcess/Cocoa/AutomationSessionClient.mm:
3171         (WebKit::AutomationSessionClient::didRequestNewWindow):
3172         Return a WebPageProxy from the WKPageRef.
3173
3174         * UIProcess/WebPageProxy.h: Make setFocus public.
3175
3176         * UIProcess/WebProcessPool.cpp:
3177         (WebKit::WebProcessPool::setAutomationSession):
3178         Set the WebProcessPool on the WebAutomationSession so it can be used to find
3179         WebPageProxy objects controlled by automation.
3180
3181 2016-03-05  Timothy Hatcher  <timothy@apple.com>
3182
3183         Rename Automation protocol methods to use "BrowsingContext" instead of "Window".
3184         Also flesh out the protocol commands more by adding switchToBrowsingContext
3185         and return a BrowsingContextHandle for createBrowsingContext.
3186
3187         https://bugs.webkit.org/show_bug.cgi?id=154953
3188         rdar://problem/24947489
3189
3190         Reviewed by Brian Burg.
3191
3192         * UIProcess/Automation/Automation.json:
3193         * UIProcess/Automation/WebAutomationSession.cpp:
3194         (WebKit::WebAutomationSession::getBrowsingContexts):
3195         (WebKit::WebAutomationSession::createBrowsingContext):
3196         (WebKit::WebAutomationSession::closeBrowsingContext):
3197         (WebKit::WebAutomationSession::switchToBrowsingContext):
3198         (WebKit::WebAutomationSession::getWindows): Deleted.
3199         (WebKit::WebAutomationSession::openWindow): Deleted.
3200         (WebKit::WebAutomationSession::closeWindow): Deleted.
3201         * UIProcess/Automation/WebAutomationSession.h:
3202
3203 2016-03-05  Yusuke Suzuki  <utatane.tea@gmail.com>
3204
3205         [ES6] Support Reflect.construct
3206         https://bugs.webkit.org/show_bug.cgi?id=147330
3207
3208         Reviewed by Saam Barati.
3209
3210         * WebProcess/Plugins/Netscape/JSNPMethod.cpp:
3211         (WebKit::JSNPMethod::getCallData):
3212         * WebProcess/Plugins/Netscape/JSNPObject.cpp:
3213         (WebKit::JSNPObject::getCallData):
3214         (WebKit::JSNPObject::getConstructData):
3215         * WebProcess/Plugins/Netscape/NPJSObject.cpp:
3216         (WebKit::NPJSObject::hasMethod):
3217         (WebKit::NPJSObject::construct):
3218         (WebKit::NPJSObject::invoke):
3219
3220 2016-03-04  Alex Christensen  <achristensen@webkit.org>
3221
3222         Fix file mime-types when using NetworkSession
3223         https://bugs.webkit.org/show_bug.cgi?id=155058
3224
3225         Reviewed by Andy Estes.
3226
3227         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
3228         (WebKit::NetworkDataTask::NetworkDataTask):
3229         Call adjustMIMETypeIfNecessary like we do in connection didReceiveResponse in 
3230         WebCoreResourceHandleAsOperationQueueDelegate.mm.
3231         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3232         (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]):
3233         Don't content sniff file urls.  This check is analogous to ResourceHandle::shouldContentSniffURL.
3234
3235 2016-03-04  Sam Weinig  <sam@webkit.org>
3236
3237         [WebKit2] Add WebKit2 equivalent of -[WebView _insertNewlineInQuotedContent]
3238         <rdar://problem/24943591>
3239         https://bugs.webkit.org/show_bug.cgi?id=155057
3240
3241         Reviewed by Tim Horton.
3242
3243         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
3244         (WKBundlePageInsertNewlineInQuotedContent):
3245         * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
3246         * WebProcess/WebPage/WebPage.cpp:
3247         (WebKit::WebPage::insertNewlineInQuotedContent):
3248         * WebProcess/WebPage/WebPage.h:
3249         Expose WKBundlePageInsertNewlineInQuotedContent as SPI.
3250
3251 2016-03-04  Brent Fulgham  <bfulgham@apple.com>
3252
3253         Stub API to support a debug menu option for measuring resource load statistics
3254         https://bugs.webkit.org/show_bug.cgi?id=154998
3255         <rdar://problem/24944604>
3256
3257         Reviewed by Andy Estes.
3258
3259         * UIProcess/API/APIWebsiteDataStore.cpp:
3260         (API::WebsiteDataStore::resourceLoadStatisticsEnabled): Added stub.
3261         (API::WebsiteDataStore::setResourceLoadStatisticsEnabled): Ditto.
3262         * UIProcess/API/APIWebsiteDataStore.h:
3263         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
3264         (WKWebsiteDataStoreSetResourceLoadStatisticsEnabled): Added method that calls through
3265         to the underlying APIWebsiteDataStore class.
3266         (WKWebsiteDataStoreGetResourceLoadStatisticsEnabled): Ditto.
3267         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
3268
3269 2016-03-03  Enrica Casucci  <enrica@apple.com>
3270
3271         Add a mechanism to customize the long press action.
3272         https://bugs.webkit.org/show_bug.cgi?id=154995
3273         rdar://problem/24823732
3274
3275         Reviewed by Tim Horton.
3276
3277         Adding a new private delegate method to allow clients to
3278         replace the action sheet displayed for images and links.
3279         The change also adds support for attachment elements.
3280
3281         * Shared/ios/InteractionInformationAtPosition.h:
3282         * Shared/ios/InteractionInformationAtPosition.mm:
3283         (WebKit::InteractionInformationAtPosition::encode):
3284         (WebKit::InteractionInformationAtPosition::decode):
3285         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
3286         * UIProcess/API/Cocoa/_WKActivatedElementInfo.h:
3287         * UIProcess/ios/WKActionSheetAssistant.h:
3288         * UIProcess/ios/WKActionSheetAssistant.mm:
3289         (-[WKActionSheetAssistant showImageSheet]):
3290         (-[WKActionSheetAssistant showLinkSheet]):
3291         * UIProcess/ios/WKContentViewInteraction.mm:
3292         (-[WKContentView _showImageSheet]):
3293         (-[WKContentView _showAttachmentSheet]):
3294         (-[WKContentView _showLinkSheet]):
3295         (-[WKContentView _actionForLongPress]):
3296         (-[WKContentView actionSheetAssistant:shouldIncludeAppLinkActionsForElement:]):
3297         (-[WKContentView actionSheetAssistant:showCustomSheetForElement:]):
3298         (-[WKContentView actionSheetAssistant:decideActionsForElement:defaultActions:]):
3299         * WebProcess/WebPage/ios/WebPageIOS.mm:
3300         (WebKit::WebPage::getPositionInformation):
3301
3302 2016-03-04  Brent Fulgham  <bfulgham@apple.com>
3303
3304         [WK2] Gather resource load statistics
3305         https://bugs.webkit.org/show_bug.cgi?id=154278
3306         <rdar://problem/24702892>
3307
3308         Reviewed by Andy Estes.
3309
3310         Revise the WebProcess to notify the UIProcess about resource load statistics. These
3311         updates are not time-critical, and do not need to be done in concert with the actual
3312         load. As resource loads are made, each WebProcess notifies the UIProcess of the new
3313         load counts, then clears its local state. These statistics are then aggregated in
3314         the UIProcess.
3315
3316         * CMakeLists.txt: Add new ResourceLoadStatisticsState files to build.
3317         * DerivedSources.make: Ditto.
3318         * Platform/IPC/ArgumentCoders.h: Update to support HashCountedSets.
3319         * PlatformEfl.cmake: Add new ResourceLoadStatisticsState files to build.
3320         * PlatformGTK.cmake: Ditto.
3321         * PlatformMac.cmake: Ditto.
3322         * Shared/API/APIObject.h: Add new ResourceLoadStatistics type.
3323         * Shared/WebCoreArgumentCoders.cpp:
3324         (IPC::ArgumentCoder<ExceptionDetails>::decode): Support new ResourceLoadStatistics type.
3325         (IPC::ArgumentCoder<ResourceLoadStatistics>::encode): Added.
3326         (IPC::ArgumentCoder<ResourceLoadStatistics>::decode): Added.
3327         * Shared/WebCoreArgumentCoders.h:
3328         * Shared/WebProcessCreationParameters.cpp:
3329         (WebKit::WebProcessCreationParameters::encode): Handle 'resourceLoadStatisticsEnabled' flag.
3330         (WebKit::WebProcessCreationParameters::decode): Ditto.
3331         * Shared/WebProcessCreationParameters.h:
3332         * UIProcess/API/APIProcessPoolConfiguration.cpp:
3333         (API::ProcessPoolConfiguration::ProcessPoolConfiguration): Add storage location for the
3334         resource load statistics.
3335         (API::ProcessPoolConfiguration::copy): Handle the new storage location and the feature flag.
3336         * UIProcess/API/APIProcessPoolConfiguration.h:
3337         * UIProcess/API/APIWebsiteDataStore.cpp:
3338         (API::WebsiteDataStore::defaultResourceLoadStatisticsDirectory): Added stub.
3339         * UIProcess/API/APIWebsiteDataStore.h:
3340         * UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm:
3341         (API::WebsiteDataStore::defaultResourceLoadStatisticsDirectory): Added.
3342         (API::WebsiteDataStore::defaultDataStoreConfiguration): Added support for the new resource
3343         load statistics storage location.
3344         * UIProcess/API/Cocoa/WKWebView.mm:
3345         (-[WKWebView _initializeWithConfiguration:]): Sync Process Pool configuration parameters
3346         with the state of our websiteData object's "ResourceLoadStatisticsEnabled" flag, so that
3347         new processes are created in the right state.
3348         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
3349         (-[WKWebsiteDataStore _resourceLoadStatisticsEnabled]): Added.
3350         (-[WKWebsiteDataStore _setResourceLoadStatisticsEnabled:]): Added.
3351         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
3352         * UIProcess/WebProcessPool.cpp:
3353         (WebKit::WebProcessPool::createNewWebProcess): Handle new flag for enabling resource
3354         load statistics.
3355         * UIProcess/WebResourceLoadStatisticsStore.cpp: Added.
3356         (WebKit::WebResourceLoadStatisticsStore::create):
3357         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
3358         (WebKit::WebResourceLoadStatisticsStore::~WebResourceLoadStatisticsStore):
3359         (WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated):
3360         (WebKit::WebResourceLoadStatisticsStore::setResourceLoadStatisticsEnabled):
3361         (WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsEnabled):
3362         (WebKit::WebResourceLoadStatisticsStore::readDataFromDiskIfNeeded):
3363         (WebKit::WebResourceLoadStatisticsStore::writeToDisk):
3364         (WebKit::WebResourceLoadStatisticsStore::applicationWillTerminate):
3365         * UIProcess/WebResourceLoadStatisticsStore.h: Added.
3366         (WebKit::WebResourceLoadStatisticsStore::coreStore):
3367         * UIProcess/WebResourceLoadStatisticsStore.messages.in: Added.
3368         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
3369         (WebKit::WebsiteDataStore::platformInitialize): Register a termination handler
3370         to close down the resource load statistics store.
3371         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3372         (WebKit::WebsiteDataStore::WebsiteDataStore): Initialize the new WebResourceLoadStatisticsStore
3373         member.
3374         (WebKit::WebsiteDataStore::webProcessWillOpenConnection): Register the WebResourceLoadStatisticsStore
3375         object as a work queue message receiver
3376         (WebKit::WebsiteDataStore::webProcessDidCloseConnection): Unregister WebResourceLoadStatisticsStore.
3377         (WebKit::WebsiteDataStore::resourceLoadStatisticsEnabled): Added.
3378         (WebKit::WebsiteDataStore::setResourceLoadStatisticsEnabled): Ditto.
3379         * UIProcess/WebsiteData/WebsiteDataStore.h:
3380         (WebKit::WebsiteDataStore::resourceLoadStatisticsStore): Added.
3381         * WebKit2.xcodeproj/project.pbxproj: Add new ResourceLoadStatisticsState files to build.
3382         * WebProcess/WebProcess.cpp:
3383         (WebKit::WebProcess::initializeWebProcess): Take into account the new parameter
3384         specifying whether resource load statistics are being captured.
3385         (WebKit::WebProcess::WebProcess): Initialized statistics changed notification timer.
3386         (WebKit::WebProcess::statisticsChangedTimerFired): Added. Send bundles of site load
3387         statistics to the UIProcess on a set interval. Clear out local cache after each send.
3388         (WebKit::WebProcess::setResourceLoadStatisticsEnabled): Added.
3389         * WebProcess/WebProcess.h:
3390         * WebProcess/WebProcess.messages.in: Add new SetResourceLoadStatisticsEnabled message.
3391
3392 2016-03-04  Daniel Bates  <dabates@apple.com>
3393
3394         Temporarily use bundle identifier as part of user directory suffix
3395         https://bugs.webkit.org/show_bug.cgi?id=155042
3396         <rdar://problem/24983174>
3397
3398         Reviewed by Brent Fulgham and Brady Eidson.
3399
3400         * Shared/mac/ChildProcessMac.mm:
3401         (WebKit::ChildProcess::initializeSandbox):
3402
3403 2016-03-04  Alex Christensen  <achristensen@webkit.org>
3404
3405         Release build fix after r197572.
3406         https://bugs.webkit.org/show_bug.cgi?id=154993
3407
3408         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3409         (-[WKNetworkSessionDelegate URLSession:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:]):
3410
3411 2016-03-04  Alex Christensen  <achristensen@webkit.org>
3412
3413         Use NSURLSession for loading in WebKit2
3414         https://bugs.webkit.org/show_bug.cgi?id=154993
3415
3416         Reviewed by Sam Weinig.
3417
3418         * config.h:
3419
3420 2016-03-04  Alex Christensen  <achristensen@webkit.org>
3421
3422         Use NetworkSession for pings
3423         https://bugs.webkit.org/show_bug.cgi?id=154984
3424
3425         Reviewed by Antti Koivisto.
3426
3427         Before this patch, we were using NSURLConnection for pings when the rest of the loading was being 
3428         done with NSURLSession.  To fix this, I implemented PingLoad, which is the NetworkSession equivalent
3429         of PingHandle.
3430
3431         This fixes http/tests/security/contentSecurityPolicy/report-status-code-zero-when-using-https.html
3432
3433         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3434         (WebKit::NetworkConnectionToWebProcess::loadPing):
3435         (WebKit::NetworkConnectionToWebProcess::removeLoadIdentifier):
3436         * NetworkProcess/PingLoad.h: Added.
3437         (WebKit::PingLoad::PingLoad):
3438         (WebKit::PingLoad::willPerformHTTPRedirection):
3439         (WebKit::PingLoad::didReceiveChallenge):
3440         (WebKit::PingLoad::didReceiveResponseNetworkSession):
3441         (WebKit::PingLoad::didReceiveData):
3442         (WebKit::PingLoad::didCompleteWithError):
3443         (WebKit::PingLoad::didBecomeDownload):
3444         (WebKit::PingLoad::didSendData):
3445         (WebKit::PingLoad::wasBlocked):
3446         (WebKit::PingLoad::cannotShowURL):
3447         (WebKit::PingLoad::timeoutTimerFired):
3448         (WebKit::PingLoad::~PingLoad):
3449         * WebKit2.xcodeproj/project.pbxproj:
3450
3451 2016-03-04  Timothy Hatcher  <timothy@apple.com>
3452
3453         Inform WebKit and WebCore if a page is controlled by automation.
3454
3455         https://bugs.webkit.org/show_bug.cgi?id=154991
3456         rdar://problem/24965784
3457
3458         Reviewed by Joseph Pecoraro.
3459
3460         * Shared/WebPageCreationParameters.cpp:
3461         (WebKit::WebPageCreationParameters::encode):
3462         (WebKit::WebPageCreationParameters::decode):
3463         * Shared/WebPageCreationParameters.h:
3464         * UIProcess/API/C/WKPage.cpp:
3465         (WKPageGetIsControlledByAutomation):
3466         (WKPageSetControlledByAutomation):
3467         * UIProcess/API/C/WKPagePrivate.h:
3468         * UIProcess/WebPageProxy.cpp:
3469         (WebKit::WebPageProxy::setControlledByAutomation):
3470         (WebKit::WebPageProxy::creationParameters):
3471         * UIProcess/WebPageProxy.h:
3472         (WebKit::WebPageProxy::isControlledByAutomation):
3473         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
3474         (WKBundlePageIsControlledByAutomation):
3475         * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
3476         * WebProcess/WebPage/WebPage.cpp:
3477         (WebKit::m_shouldDispatchFakeMouseMoveEvents):
3478         (WebKit::WebPage::isControlledByAutomation):
3479         (WebKit::WebPage::setControlledByAutomation):
3480         * WebProcess/WebPage/WebPage.h:
3481         * WebProcess/WebPage/WebPage.messages.in:
3482
3483 2016-03-03  Chris Dumez  <cdumez@apple.com>
3484
3485         Regression(r196770): Unable to use HipChat Mac app
3486         https://bugs.webkit.org/show_bug.cgi?id=154999
3487         <rdar://problem/24931959>
3488
3489         Reviewed by Darin Adler.
3490
3491         Have the NetworkProcess and the WebProcess pass the UIProcess bundle
3492         identifier to WebCore so that we can do app detection of applications
3493         using a WK2 WebView (such as HipChat).
3494
3495         * NetworkProcess/NetworkProcess.cpp:
3496         (WebKit::NetworkProcess::initializeNetworkProcess):
3497         * WebProcess/WebProcess.cpp:
3498         (WebKit::WebProcess::initializeWebProcess):
3499
3500 2016-03-03  Simon Fraser  <simon.fraser@apple.com>
3501
3502         Use larger tiles when possible to reduce per-tile painting overhead
3503         https://bugs.webkit.org/show_bug.cgi?id=154985
3504         rdar://problem/23635219
3505
3506         Reviewed by Tim Horton.
3507
3508         Do a bit of #include cleanup.
3509
3510         * Shared/mac/RemoteLayerBackingStore.mm:
3511         * WebProcess/WebPage/mac/PlatformCALayerRemote.h:
3512         * WebProcess/WebPage/mac/PlatformCALayerRemoteTiledBacking.cpp:
3513         * WebProcess/WebPage/mac/PlatformCALayerRemoteTiledBacking.h:
3514
3515 2016-03-03  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
3516
3517         Use std::make_unique<> when creating std::unique_ptr<>
3518         https://bugs.webkit.org/show_bug.cgi?id=154574
3519
3520         Reviewed by Darin Adler.
3521
3522         * NetworkProcess/cache/NetworkCacheStatistics.cpp:
3523         (WebKit::NetworkCache::Statistics::open):
3524         * NetworkProcess/cache/NetworkCacheStatistics.h:
3525         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
3526         (WebKit::WebChromeClient::createColorChooser):
3527
3528 2016-03-03  Alex Christensen  <achristensen@webkit.org>
3529
3530         Move SPI to CFNetworkSPI.h
3531         https://bugs.webkit.org/show_bug.cgi?id=154992
3532
3533         Reviewed by Andy Estes.
3534
3535         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
3536         (WebKit::applyBasicAuthorizationHeader):
3537
3538 2016-03-03  Alex Christensen  <achristensen@webkit.org>
3539
3540         Use CredentialStorage with NetworkSession
3541         https://bugs.webkit.org/show_bug.cgi?id=154939
3542
3543         Reviewed by Darin Adler.
3544
3545         * config.h:
3546         Added compile-time flag to help us be able to keep track and remove this code when we can.
3547         * NetworkProcess/NetworkDataTask.h:
3548         (WebKit::NetworkDataTask::pendingDownloadLocation):
3549         * NetworkProcess/NetworkProcess.cpp:
3550         (WebKit::NetworkProcess::clearCachedCredentials):
3551         (WebKit::NetworkProcess::ensurePrivateBrowsingSession):
3552         * NetworkProcess/NetworkSession.h:
3553         (WebKit::NetworkSession::sessionID):
3554         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
3555         (WebKit::applyBasicAuthorizationHeader):
3556         (WebKit::NetworkDataTask::NetworkDataTask):
3557         Use a credential storage and preemptively apply basic authentication headers if we have credentials from the storage.
3558         This is analogous to code in ResourceHandle::createNSURLConnection.
3559         
3560         (WebKit::NetworkDataTask::didReceiveChallenge):
3561         Make this look more like ResourceHandle::didReceiveAuthenticationChallenge.
3562         The call to tryPasswordBasedAuthentication was moved from the delegate callback to here.
3563         
3564         (WebKit::NetworkDataTask::willPerformHTTPRedirection):
3565         Use credentials from the credential storage if they exist.  This is analogous to code in ResourceHandle::willSendRequest.
3566         
3567         (WebKit::NetworkDataTask::tryPasswordBasedAuthentication):
3568         Use credentials from the credential storage if they exist.  This is analogous to code in ResourceHandle::tryHandlePasswordBasedAuthentication.
3569         
3570         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3571         (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
3572         If we are given a credential with CredentialPersistenceForSession, put it in the credential storage and give 
3573         CFNetwork a credential with CredentialPersistenceNone so it won't automatically be used again until the credential
3574         storage says its ok to use again.  This gives us the ability to clear session credentials when logout credentials are used.
3575         This is analogous to code in ResourceHandle::receivedCredential.
3576         
3577         (WebKit::NetworkSession::defaultSession):
3578         (WebKit::NetworkSession::NetworkSession):
3579         (WebKit::NetworkSession::~NetworkSession):
3580         (WebKit::NetworkSession::dataTaskForIdentifier):
3581         (WebKit::NetworkSession::clearCredentials): Deleted.
3582         * WebProcess/WebProcess.cpp:
3583         (WebKit::WebProcess::clearCachedCredentials):
3584         (WebKit::WebProcess::focusedWebPage):
3585         We no longer need to clear credentials from the NSURLSessions because we don't store session credentials in them.
3586         Instead, calling CredentialStorage.clearCredentials is sufficient.
3587
3588 2016-03-03  Andy Estes  <aestes@apple.com>
3589
3590         Adopt CFNetwork storage partitioning SPI
3591         https://bugs.webkit.org/show_bug.cgi?id=154957
3592         rdar://problem/23614620
3593
3594         Reviewed by Darin Adler.
3595
3596         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
3597         (WebKit::NetworkDataTask::NetworkDataTask): Computed the storage partition identifier for the new session task.
3598         If non-empty, set it using a NSURLSessionTask SPI.
3599
3600 2016-03-03  Alex Christensen  <achristensen@webkit.org>
3601
3602         [WK2] testRunner.setPrivateBrowsingEnabled doesn't work with NetworkProcess
3603         https://bugs.webkit.org/show_bug.cgi?id=115274
3604
3605         Reviewed by Darin Adler.
3606
3607         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3608         (WebKit::NetworkConnectionToWebProcess::blobSize):
3609         (WebKit::NetworkConnectionToWebProcess::ensureLegacyPrivateBrowsingSession):
3610         * NetworkProcess/NetworkConnectionToWebProcess.h:
3611         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
3612         * NetworkProcess/NetworkProcess.h:
3613         * WebProcess/InjectedBundle/InjectedBundle.cpp:
3614         (WebKit::InjectedBundle::setPrivateBrowsingEnabled):
3615         * WebProcess/WebProcess.cpp:
3616         (WebKit::WebProcess::destroyPrivateBrowsingSession):
3617         (WebKit::WebProcess::ensureLegacyPrivateBrowsingSessionInNetworkProcess):
3618         (WebKit::WebProcess::pluginProcessConnectionManager):
3619         * WebProcess/WebProcess.h:
3620
3621 2016-03-02  Alex Christensen  <achristensen@webkit.org>
3622
3623         Properly cancel downloads when using NetworkSession
3624         https://bugs.webkit.org/show_bug.cgi?id=154893
3625
3626         Reviewed by Brady Eidson.
3627
3628         * NetworkProcess/Downloads/Download.cpp:
3629         (WebKit::Download::Download):
3630         * NetworkProcess/Downloads/Download.h:
3631         * NetworkProcess/Downloads/cocoa/DownloadCocoa.mm:
3632         (WebKit::Download::cancel):
3633         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3634         (-[WKNetworkSessionDelegate URLSession:dataTask:didBecomeDownloadTask:]):
3635
3636 2016-03-01  Ada Chan  <adachan@apple.com>
3637
3638         Update the media element's presentation mode properly after going in and out of full screen via the Full Screen API
3639         https://bugs.webkit.org/show_bug.cgi?id=154834
3640
3641         Reviewed by Simon Fraser.
3642
3643         * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h:
3644         * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.messages.in:
3645         * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm:
3646         (WebKit::WebVideoFullscreenManagerProxy::exitFullscreenWithoutAnimationToMode):
3647         Call the new exitFullscreenWithoutAnimationToMode() method on WebVideoFullscreenInterfaceMac.
3648         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
3649         (WebKit::WebChromeClient::exitVideoFullscreenToModeWithoutAnimation):
3650         * WebProcess/WebCoreSupport/WebChromeClient.h:
3651         * WebProcess/cocoa/WebVideoFullscreenManager.h:
3652         * WebProcess/cocoa/WebVideoFullscreenManager.mm:
3653         (WebKit::WebVideoFullscreenManager::exitVideoFullscreenToModeWithoutAnimation):
3654
3655 2016-03-02  Beth Dakin  <bdakin@apple.com>
3656
3657         Crashes in media tests after http://trac.webkit.org/changeset/197461
3658         https://bugs.webkit.org/show_bug.cgi?id=154933
3659
3660         Reviewed by Eric Carlson.
3661
3662         Since the controlsManagerInterface is not guaranteed to exist, it doesn't 
3663         make sense to return a reference. Return a pointer instead.
3664         * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h:
3665         * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm:
3666         (WebKit::WebVideoFullscreenManagerProxy::isVisible):
3667         (WebKit::WebVideoFullscreenManagerProxy::controlsManagerInterface):
3668         (WebKit::WebVideoFullscreenManagerProxy::fullscreenMayReturnToInline):
3669
3670 2016-03-02  Beth Dakin  <bdakin@apple.com>
3671
3672         Add support for playbackControlsManager
3673         https://bugs.webkit.org/show_bug.cgi?id=154742
3674         -and corresponding-
3675         rdar://problem/23833753
3676
3677         Reviewed by Jer Noble.
3678
3679         WebVideoFullscreenManagerProxy ensures the model and interface for the 
3680         UIProcess side of the playbackControlsManager. It also caches the 
3681         m_controlsManagerContextId so that it can return the 
3682         controlsManagerInterface.
3683         * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h:
3684         * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.messages.in:
3685         * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm:
3686         (WebKit::WebVideoFullscreenManagerProxy::setUpVideoControlsManagerWithID):
3687         (WebKit::WebVideoFullscreenManagerProxy::controlsManagerInterface):
3688
3689         Pipe isPlayingMediaDidChange() to WebViewImpl, and use that information to 
3690         update WebViewImplAdditions.
3691         * UIProcess/Cocoa/WebViewImpl.h:
3692         * UIProcess/Cocoa/WebViewImpl.mm:
3693         (WebKit::WebViewImpl::isPlayingMediaDidChange):
3694         * UIProcess/PageClient.h:
3695         * UIProcess/WebPageProxy.cpp:
3696         (WebKit::WebPageProxy::isPlayingMediaDidChange):
3697         (WebKit::WebPageProxy::isPlayingVideoWithAudio):
3698         * UIProcess/WebPageProxy.h:
3699         (WebKit::WebPageProxy::isPlayingAudio):
3700         * UIProcess/mac/PageClientImpl.h:
3701         * UIProcess/mac/PageClientImpl.mm:
3702         (WebKit::PageClientImpl::isPlayingMediaDidChange):
3703
3704         Pipe setUpVideoControlsManager to the WebVideoFullscreenManager.
3705         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
3706         (WebKit::WebChromeClient::setUpVideoControlsManager):
3707         * WebProcess/WebCoreSupport/WebChromeClient.h:
3708
3709         Ensure the model an interface for the playbackControlsManager on the 
3710         WebProcess side and pass the message to the UIProcess to do the same.
3711         * WebProcess/cocoa/WebVideoFullscreenManager.h:
3712         * WebProcess/cocoa/WebVideoFullscreenManager.mm:
3713         (WebKit::WebVideoFullscreenManager::setUpVideoControlsManager):
3714
3715 2016-03-02  Carlos Garcia Campos  <cgarcia@igalia.com>
3716
3717         REGRESSION(r197409): [GTK] Web process always crashes on WebPage construction after r197409
3718         https://bugs.webkit.org/show_bug.cgi?id=154918
3719
3720         Reviewed by Žan Doberšek.
3721
3722         We have an incorrect check in DrawingAreaImpl constructor that has
3723         never actually worked because it uses the page settings before
3724         they were initialized. But that has been fixed in r197409 and now
3725         we are always forcing accelerated compositing mode incorrectly,
3726         because m_alwaysUseCompositing is set in the constructor and never
3727         changed again.
3728
3729         * WebProcess/WebPage/DrawingAreaImpl.cpp:
3730         (WebKit::DrawingAreaImpl::DrawingAreaImpl): Remove code to set
3731         settings and m_alwaysUseCompositing, since that should be done in
3732         updatePreferences().
3733         (WebKit::DrawingAreaImpl::updatePreferences): Update the settings
3734         accordingly and always update m_alwaysUseCompositing when AC is
3735         enabled and forced in the settings.
3736         * WebProcess/WebPage/WebPage.cpp:
3737         (WebKit::WebPage::WebPage): WebPage::updatePreferences() calls
3738         DrawingArea::updatePreferences(), but since r197409 it happens
3739         before the drawing area has been created. So, call
3740         DrawingArea::updatePreferences() in the constructor right after
3741         the main frame has been created, since
3742         DrawingArea::updatePreferences() uses the main frame.
3743
3744 2016-02-29  Ada Chan  <adachan@apple.com>
3745
3746         Adopt the new version of AVOutputDeviceMenuController's showMenuForRect method.
3747         https://bugs.webkit.org/show_bug.cgi?id=154823
3748
3749         Reviewed by Tim Horton.
3750
3751         * UIProcess/WebPageProxy.cpp:
3752         (WebKit::WebPageProxy::showPlaybackTargetPicker):
3753         (WebKit::WebPageProxy::customPlaybackActionSelected):
3754         * UIProcess/WebPageProxy.h:
3755         * UIProcess/WebPageProxy.messages.in:
3756         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
3757         (WebKit::WebChromeClient::showPlaybackTargetPicker):
3758         * WebProcess/WebCoreSupport/WebChromeClient.h:
3759         * WebProcess/WebPage/WebPage.h:
3760         * WebProcess/WebPage/WebPage.messages.in:
3761         * WebProcess/WebPage/mac/WebPageMac.mm:
3762         (WebKit::WebPage::customPlaybackActionSelected):
3763
3764 2016-02-29  Brent Fulgham  <bfulgham@apple.com>
3765
3766         [WK2] Stub support for WebsiteDataTypeResourceLoadStatistics
3767         https://bugs.webkit.org/show_bug.cgi?id=154689
3768         <rdar://problem/24702576>
3769
3770         Reviewed by Sam Weinig.
3771
3772         * Shared/WebsiteData/WebsiteDataType.h: Add new WebsiteDataTypeResourceLoadStatistics.
3773         * UIProcess/API/Cocoa/WKWebsiteDataRecord.mm:
3774         (dataTypesToString): Handle new type.
3775         * UIProcess/API/Cocoa/WKWebsiteDataRecordInternal.h:
3776         (WebKit::toWebsiteDataTypes): Ditto.
3777         (WebKit::toWKWebsiteDataTypes): Ditto.
3778         * UIProcess/API/Cocoa/WKWebsiteDataRecordPrivate.h: Add new _WebsiteDataTypeResourceLoadStatistics.
3779
3780 2016-03-01  Alex Christensen  <achristensen@webkit.org>
3781
3782         Correctly keep track of NetworkDataTasks with and without credentials when using NetworkSession
3783         https://bugs.webkit.org/show_bug.cgi?id=154876
3784
3785         Reviewed by Brady Eidson.
3786
3787         I was seeing an assertion failure from ASSERT(!m_session.m_dataTaskMap.contains(taskIdentifier()))
3788         in the NetworkDataTask constructor sometimes.  This is because a task identifier is not enough information
3789         to uniquely find a NetworkDataTask in a NetworkSession since r196034 because there are two NSURLSessions
3790         in a NetworkSession, one with credentials and one without.  The assertion would fire in a case like if we
3791         made the first NetworkDataTask with credentials (taskIdentifier is 1) and the first NetworkDataTask 
3792         without credentials before the first NetworkDataTask with credentials was finished.  In that case, the 
3793         taskIdentifier would also be 1, which would conflict with the other taskIdentifier.  That taskIdentifier
3794         would uniquely identify the task in the correct NSURLSession, though, so the solution is to keep a map
3795         for each NSURLSession in the NetworkSession.
3796
3797         * NetworkProcess/NetworkDataTask.h:
3798         * NetworkProcess/NetworkSession.h:
3799         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
3800         (WebKit::NetworkDataTask::NetworkDataTask):
3801         (WebKit::NetworkDataTask::~NetworkDataTask):
3802         (WebKit::NetworkDataTask::suspend):
3803         (WebKit::serverTrustCredential):
3804         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3805         (-[WKNetworkSessionDelegate URLSession:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:]):
3806         (-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]):
3807         (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
3808         (-[WKNetworkSessionDelegate URLSession:task:didCompleteWithError:]):
3809         (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]):
3810         (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveData:]):
3811         (-[WKNetworkSessionDelegate URLSession:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:]):
3812         (-[WKNetworkSessionDelegate URLSession:dataTask:didBecomeDownloadTask:]):
3813         (WebKit::NetworkSession::clearCredentials):
3814         (WebKit::NetworkSession::dataTaskForIdentifier):
3815         (WebKit::NetworkSession::addDownloadID):
3816
3817 2016-03-01  Andreas Kling  <akling@apple.com>
3818
3819         REGRESSION (r154616): Accelerated drawing is off during the initial load
3820         <https://webkit.org/b/123812>
3821
3822         Reviewed by Tim Horton.
3823
3824         Load preferences before instantiating the first DrawingArea. This ensures that we do the
3825         initial paint using accelerated drawing, and avoids allocating persistent data structures
3826         only needed by the software rendering path.
3827
3828         * WebProcess/WebPage/WebPage.cpp:
3829
3830 2016-03-01  Alex Christensen  <achristensen@webkit.org>
3831
3832         Fix tests when using NetworkSession
3833         https://bugs.webkit.org/show_bug.cgi?id=154866
3834
3835         Reviewed by Brady Eidson.
3836
3837         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3838         (WebKit::globalCustomProtocolManager):
3839         (WebKit::NetworkSession::setCustomProtocolManager):
3840         
3841         Use a static NeverDestroyed instead of a local NeverDestroyed.
3842         This fix was suggested by Darin after I broke the custom protocol tests in r197362.
3843         
3844         (WebKit::NetworkSession::clearCredentials):
3845         
3846         In r197223 I added code that I thought cleared the credentials of a session, but it was
3847         actually trying (and failing) to remove the credentials from the NSURLCredentialStorage that
3848         were stored with NSURLCredentialPersistencePermanent.
3849         This was causing credentials stored in an NSURLSession with NSURLCredentialPersistenceForSession
3850         to remain for the next tests, and was causing credentials from previous tests, usually from
3851         http/tests/loading/basic-credentials-sent-automatically.html, to be used in future tests.
3852         Creating a new NSURLSession is the equivalent of CredentialStorage::clearCredentials because it
3853         removes all credentials stored with NSURLCredentialPersistenceForSession.
3854
3855 2016-03-01  Carlos Garcia Campos  <cgarcia@igalia.com>
3856
3857         NetworkCache: Web process leaks resource buffer when using shareable reasources
3858         https://bugs.webkit.org/show_bug.cgi?id=154852
3859
3860         Reviewed by Darin Adler.
3861
3862         ResourceLoader::didReceiveBuffer() expects a PassRefPtr, but we
3863         are passing a raw pointer making PassRefPtr to take another
3864         reference instead of transfering the ownership as expected.
3865
3866         * WebProcess/Network/WebResourceLoader.cpp:
3867         (WebKit::WebResourceLoader::didReceiveResource):
3868
3869 2016-02-29  Zan Dobersek  <zdobersek@igalia.com>
3870
3871         ThreadedCompositor: clean up composition-specific resources before shutting down the thread
3872         https://bugs.webkit.org/show_bug.cgi?id=154793
3873
3874         Reviewed by Carlos Garcia Campos.
3875
3876         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
3877         (WebKit::ThreadedCompositor::runCompositingThread): Before concluding the
3878         compositing thread run, clean up all the resources that were allocated at
3879         the start, and in the reverse order. Specifically, we now also deallocate
3880         the CoordinatedGraphicsScene and the SimpleViewportController objects. This
3881         way these are not deallocated on the main thread when the ThreadedCompositor
3882         destructor would otherwise clean them up.
3883
3884 2016-02-29  Zan Dobersek  <zdobersek@igalia.com>
3885
3886         ThreadSafeCoordinatedSurface: remove the unused private create() static method
3887         https://bugs.webkit.org/show_bug.cgi?id=154792
3888
3889         Reviewed by Carlos Garcia Campos.
3890
3891         Remove the static ThreadSafeCoordinatedSurface::create() method that accepted
3892         a std::unique_ptr<ImageBuffer> object as its third parameter. This was not used
3893         anywhere.
3894
3895         * Shared/CoordinatedGraphics/threadedcompositor/ThreadSafeCoordinatedSurface.cpp:
3896         (WebKit::ThreadSafeCoordinatedSurface::create): Deleted.
3897         * Shared/CoordinatedGraphics/threadedcompositor/ThreadSafeCoordinatedSurface.h:
3898
3899 2016-02-29  Simon Fraser  <simon.fraser@apple.com>
3900
3901         Remove the experimental feature of antialiased font dilation
3902         https://bugs.webkit.org/show_bug.cgi?id=154843
3903
3904         Reviewed by Zalan Bujtas.
3905
3906         Remove the "antialiased font dilation" code path, and related prefs.
3907
3908         * Shared/WebPreferencesDefinitions.h:
3909         * UIProcess/API/C/WKPreferences.cpp:
3910         (WKPreferencesSetAntialiasedFontDilationEnabled):
3911         (WKPreferencesGetAntialiasedFontDilationEnabled):
3912         * UIProcess/API/C/WKPreferencesRefPrivate.h:
3913         * UIProcess/API/Cocoa/WKPreferences.mm:
3914         (-[WKPreferences _antialiasedFontDilationEnabled]): Deleted.
3915         (-[WKPreferences _setAntialiasedFontDilationEnabled:]): Deleted.
3916         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
3917         * WebProcess/WebPage/WebPage.cpp:
3918         (WebKit::WebPage::updatePreferences): Deleted.
3919
3920 2016-02-29  Brady Eidson  <beidson@apple.com>
3921
3922         Modern IDB: WebKit 2 IPC layer easily confused about multiple web processes being connected.
3923         https://bugs.webkit.org/show_bug.cgi?id=154837
3924
3925         Reviewed by Alex Christensen.
3926
3927         The crux of the bug is that WebProcesses cannot assign themselves server-unique identifiers...
3928         The server must do that for them.
3929         
3930         A once-per-session-per-WebProcess sync message and a few updates to connection management fix this.
3931         
3932         * DatabaseProcess/DatabaseToWebProcessConnection.cpp:
3933         (WebKit::DatabaseToWebProcessConnection::didReceiveSyncMessage):
3934         (WebKit::generateConnectionToServerIdentifier):
3935         (WebKit::DatabaseToWebProcessConnection::establishIDBConnectionToServer):
3936         * DatabaseProcess/DatabaseToWebProcessConnection.h:
3937         * DatabaseProcess/DatabaseToWebProcessConnection.messages.in:
3938
3939         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
3940         (WebKit::WebIDBConnectionToServer::WebIDBConnectionToServer):
3941         (WebKit::generateConnectionToServerIdentifier): Deleted.
3942
3943         * WebProcess/Databases/WebToDatabaseProcessConnection.cpp:
3944         (WebKit::WebToDatabaseProcessConnection::didReceiveMessage):
3945         (WebKit::WebToDatabaseProcessConnection::idbConnectionToServerForSession):
3946         * WebProcess/Databases/WebToDatabaseProcessConnection.h:
3947
3948 2016-02-29  Alex Christensen  <achristensen@webkit.org>
3949
3950         Don't call NetworkProcess::singleton from WebProcess when using NetworkSession
3951         https://bugs.webkit.org/show_bug.cgi?id=154829
3952
3953         Reviewed by Anders Carlsson.
3954
3955         We were calling NetworkProcess::singleton when making the default session in the 
3956         WebProcess, which caused bad things to happen.  We also were never clearing the 
3957         credentials in the WebProcess between tests because it used to always call
3958         NetworkProcess::singleton, which caused flaky tests.
3959
3960         This fixes repeatable crashes in http/tests/media/media-document-referer.html and 
3961         http/tests/media/media-document.html when using NetworkSession.
3962
3963         * NetworkProcess/NetworkProcess.cpp:
3964         (WebKit::NetworkProcess::NetworkProcess):
3965         (WebKit::NetworkProcess::~NetworkProcess):
3966         * NetworkProcess/NetworkSession.h:
3967         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3968         (WebKit::configurationForType):
3969         (WebKit::globalCustomProtocolManager):
3970         (WebKit::NetworkSession::setCustomProtocolManager):
3971         (WebKit::NetworkSession::defaultSession):
3972         * WebProcess/WebProcess.cpp:
3973         (WebKit::WebProcess::clearCachedCredentials):
3974
3975 2016-02-29  Gavin Barraclough  <barraclough@apple.com>
3976
3977         RefCounter<T>::Event -> RefCounterEvent
3978         https://bugs.webkit.org/show_bug.cgi?id=154767
3979
3980         Reviewed by Darin Adler.
3981
3982         RefCounter<T>::Event is kinda verbose to use, and there is no need for this
3983         to be specific to a particular typeof RefCounter. Move the enum class up to
3984         the top level & rename to RefCounterEvent.
3985
3986         Also remove UserObservablePageToken - this is vestigial & not really offering
3987         anything over just using UserObservablePageCounter::Token directly.
3988
3989         * UIProcess/Plugins/PluginProcessManager.cpp:
3990         (WebKit::PluginProcessManager::PluginProcessManager):
3991         * UIProcess/Plugins/PluginProcessManager.h:
3992         * UIProcess/Plugins/mac/PluginProcessManagerMac.mm:
3993         (WebKit::PluginProcessManager::updateProcessSuppressionDisabled):
3994         * UIProcess/ProcessThrottler.cpp:
3995         (WebKit::ProcessThrottler::ProcessThrottler):
3996         (WebKit::m_backgroundCounter):
3997         (WebKit::m_suspendMessageCount):
3998         * UIProcess/ProcessThrottler.h:
3999         * UIProcess/WebPageProxy.h:
4000         * UIProcess/WebProcessPool.cpp:
4001         (WebKit::WebProcessPool::WebProcessPool):
4002         (WebKit::m_processSuppressionDisabledForPageCounter):
4003         (WebKit::m_hiddenPageThrottlingAutoIncreasesCounter):
4004         * UIProcess/WebProcessPool.h:
4005
4006 2016-02-29  Konstantin Tokarev  <annulen@yandex.ru>
4007
4008         Fixed compilation with !ENABLE(DATABASE_PROCESS).
4009         https://bugs.webkit.org/show_bug.cgi?id=154813
4010
4011         Reviewed by Michael Catanzaro.
4012
4013         * UIProcess/WebProcessPool.cpp:
4014         (WebKit::WebProcessPool::terminateDatabaseProcess): Added missing #if
4015         guard.
4016
4017 2016-02-29  Adrien Plazas  <aplazas@igalia.com>
4018
4019         [GTK] Touch slider test fails due to assertion in webkitWebViewBaseTouchEvent()
4020         https://bugs.webkit.org/show_bug.cgi?id=153829
4021
4022         Reviewed by Carlos Garcia Campos.
4023
4024         Once a touch event sequence is identified as a gesture, remove it
4025         from the list of handled touch events.
4026
4027         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
4028         (webkitWebViewBaseTouchEvent):
4029
4030 2016-02-29  Csaba Osztrogonác  <ossy@webkit.org>
4031
4032         [Mac][cmake] Unreviewed buildfix after r197177. Just for fun.
4033
4034         * PlatformMac.cmake:
4035
4036 2016-02-28  Sam Weinig  <sam@webkit.org>
4037
4038         Reimplement WKPageGroup in terms of WKUserContentController
4039         https://bugs.webkit.org/show_bug.cgi?id=154804
4040
4041         Reviewed by Dan Bernstein.
4042
4043         Instead of having both WebPageGroup and WebUserContentControllerProxy both keep track
4044         of user scripts and user stylesheets, give WebPageGroup a WebUserContentControllerProxy
4045         and let it take care of things. This allows us to remove a ton of duplicate code, and
4046         provides a convenient way for clients currently using PageGroup based user content insertion
4047         to start using UserContentController, since they can now be used at the same time.
4048
4049         When using WKPageConfigurationRef, the rule is:
4050             - If you don't set a WKUserContentControllerRef, the one from the WKPageGroupRef will be used.
4051             - If you do set a WKUserContentControllerRef, it will be used, and the one from the WKPageGroupRef
4052               will do nothing for that web view.
4053
4054         * DerivedSources.make:
4055         Remove WebPageGroupProxy. It no longer is a MessageReceiver.
4056
4057         * Shared/WebPageGroupData.cpp:
4058         (WebKit::WebPageGroupData::encode):
4059         (WebKit::WebPageGroupData::decode):
4060         * Shared/WebPageGroupData.h:
4061         Stop encoding/decoding user content, instead just encode the identifier to the UserContentController.
4062
4063         * UIProcess/API/C/WKPageGroup.cpp:
4064         (WKPageGroupGetUserContentController):
4065         * UIProcess/API/C/WKPageGroup.h:
4066         Add getter for the underlying WKUserContentControllerRef.
4067
4068         * UIProcess/API/cpp/WKRetainPtr.h:
4069         (WebKit::retainWK):
4070         Add retainWK() helper to match RetainPtr's retainPtr() helper.
4071
4072         * UIProcess/WebPageGroup.cpp:
4073         (WebKit::WebPageGroup::WebPageGroup):
4074         (WebKit::WebPageGroup::userContentController):
4075         (WebKit::WebPageGroup::addUserStyleSheet):
4076         (WebKit::WebPageGroup::addUserScript):
4077         (WebKit::WebPageGroup::removeAllUserStyleSheets):
4078         (WebKit::WebPageGroup::removeAllUserScripts):
4079         (WebKit::WebPageGroup::removeAllUserContent):
4080         (WebKit::WebPageGroup::addUserContentExtension):
4081         (WebKit::WebPageGroup::removeUserContentExtension):
4082         (WebKit::WebPageGroup::removeAllUserContentExtensions):
4083         * UIProcess/WebPageGroup.h:
4084         Pass through to the WebUserContentControllerProxy.
4085
4086         * UIProcess/WebPageProxy.cpp:
4087         (WebKit::WebPageProxy::WebPageProxy):
4088         (WebKit::WebPageProxy::finishInitializingWebPageAfterProcessLaunch):
4089         (WebKit::WebPageProxy::creationParameters):
4090         * UIProcess/WebPageProxy.h:
4091         WebPageProxies always have a WebUserContentControllerProxy now, so it can go in a Ref and
4092         a few branches can be removed.
4093
4094         * UIProcess/WebProcessPool.cpp:
4095         (WebKit::WebProcessPool::createWebPage):
4096         If a UserContentController is not passed in, use the one from the PageGroup.
4097
4098         * WebKit2.xcodeproj/project.pbxproj:
4099         Remove files.
4100
4101         * WebProcess/InjectedBundle/InjectedBundle.cpp:
4102         Add some #includes that are now needed.
4103
4104         * WebProcess/UserContent/WebUserContentController.cpp:
4105         (WebKit::WebUserContentController::getOrCreate):
4106         * WebProcess/UserContent/WebUserContentController.h:
4107         Modernize WebUserContentController::getOrCreate to return a Ref.
4108
4109         * WebProcess/WebPage/WebPage.cpp:
4110         (WebKit::WebPage::WebPage):
4111         (WebKit::m_shouldDispatchFakeMouseMoveEvents):
4112         (WebKit::WebPage::addUserScript):
4113         (WebKit::WebPage::addUserStyleSheet):
4114         (WebKit::WebPage::removeAllUserContent):
4115         * WebProcess/WebPage/WebPage.h:
4116         Store the WebUserContentController in Ref, remove unnecessary branches/asserts.
4117
4118         * WebProcess/WebPage/WebPageGroupProxy.cpp:
4119         (WebKit::WebPageGroupProxy::WebPageGroupProxy):
4120         (WebKit::WebPageGroupProxy::~WebPageGroupProxy):
4121         (WebKit::WebPageGroupProxy::userContentController):
4122         (WebKit::WebPageGroupProxy::addUserStyleSheet): Deleted.
4123         (WebKit::WebPageGroupProxy::addUserScript): Deleted.
4124         (WebKit::WebPageGroupProxy::removeAllUserStyleSheets): Deleted.
4125         (WebKit::WebPageGroupProxy::removeAllUserScripts): Deleted.
4126         (WebKit::WebPageGroupProxy::removeAllUserContent): Deleted.
4127         (WebKit::WebPageGroupProxy::addUserContentExtension): Deleted.
4128         (WebKit::WebPageGroupProxy::removeUserContentExtension): Deleted.
4129         (WebKit::WebPageGroupProxy::removeAllUserContentExtensions): Deleted.
4130         * WebProcess/WebPage/WebPageGroupProxy.h:
4131         Store a WebUserContentController in a Ref, remove now unnecessary message handling functions.
4132
4133         * WebProcess/WebPage/WebPageGroupProxy.messages.in:
4134         Removed.
4135
4136         * WebProcess/WebProcess.cpp:
4137         (WebKit::WebProcess::didReceiveMessage):
4138         Remove routing to WebPageGroupProxy, which is no longer a MessageReceiver.
4139
4140 2016-02-28  Sam Weinig  <sam@webkit.org>
4141
4142         Bind _WKUserStyleSheets to _WK