Unreviewed, rolling out r197698.
[WebKit-https.git] / Source / WebKit2 / ChangeLog
1 2016-03-09  Commit Queue  <commit-queue@webkit.org>
2
3         Unreviewed, rolling out r197698.
4         https://bugs.webkit.org/show_bug.cgi?id=155252
5
6         Caused assertions, and wasn't reviewed by a WK2 owner
7         (Requested by andersca on #webkit).
8
9         Reverted changeset:
10
11         "Last opened tab does not receive
12         SetHiddenPageTimerThrottlingIncreaseLimit message"
13         https://bugs.webkit.org/show_bug.cgi?id=155126
14         http://trac.webkit.org/changeset/197698
15
16 2016-03-09  Conrad Shultz  <conrad_shultz@apple.com>
17
18         WebsiteDataStore::Configuration::legacyWebsiteDataStoreConfiguration() should respect the passed-in configuration
19         https://bugs.webkit.org/show_bug.cgi?id=155250
20
21         Reviewed by Anders Carlsson.
22
23         Note that the legacy directories are already set by default in ProcessPoolConfiguration::createWithLegacyOptions(),
24         which is also where the shouldHaveLegacyDataStore flag, which will cause this code path to be reached, is set.
25
26         * UIProcess/WebProcessPool.cpp:
27         (WebKit::legacyWebsiteDataStoreConfiguration):
28         Use the passed-in configuration to set the application cache, network cache, and media keys storage directories.
29
30 2016-03-09  Chris Dumez  <cdumez@apple.com>
31
32         Speculative disk cache resource revalidations are sometimes wasted
33         https://bugs.webkit.org/show_bug.cgi?id=155187
34         <rdar://problem/25032905>
35
36         Reviewed by Antti Koivisto.
37
38         Speculative disk cache resource revalidations were sometimes wasted.
39
40         We would sometimes correctly revalidate a resource but the
41         NetworkResourceLoader then either:
42         1. Fail to reuse the speculatively validated entry
43         2. Reuse the speculatively validated entry but then validate it again
44
45         Bug 1 was caused by the revalidated entry key sometimes being
46         different from the cached entry key. This could happen when
47         revalidation fails (the server did not send back a 304) in
48         which case we call NetworkCache::store() which creates a new
49         cache Entry, generating a cache key from our revalidation
50         request. If the original request has a cache partition or a
51         range, then the keys would not match because we did not set
52         the cache partition or the range on the revalidation request.
53         This has been addressed by setting the cache partition on the
54         revalidation request in constructRevalidationRequest() and by
55         not doing revalidation if the original request had a 'range'
56         header.
57
58         Bug 2 was caused by us marking a speculatively revalidated entry
59         as "not needing revalidating" only in Cache::update(). Cache::update()
60         is only called in the case the revalidation was successful (server
61         returned a 304). If revalidation was not successful, Cache::store()
62         would be called instead was we would fail to update the
63         needsRevalidation flag. NetworkResourceLoader would then validate
64         again the resource that was already speculatively revalidated.
65         To address the problem, we now update the 'needsRevalidation' flag
66         as soon as the speculative revalidation completes, in
67         SpeculativeLoad::didComplete().
68
69         * NetworkProcess/cache/NetworkCache.cpp:
70         (WebKit::NetworkCache::Cache::retrieve):
71         (WebKit::NetworkCache::makeCacheKey):
72         (WebKit::NetworkCache::Cache::update):
73         * NetworkProcess/cache/NetworkCacheEntry.cpp:
74         (WebKit::NetworkCache::Entry::setNeedsValidation):
75         * NetworkProcess/cache/NetworkCacheEntry.h:
76         * NetworkProcess/cache/NetworkCacheKey.cpp:
77         (WebKit::NetworkCache::noPartitionString):
78         (WebKit::NetworkCache::Key::Key):
79         (WebKit::NetworkCache::Key::hasPartition):
80         * NetworkProcess/cache/NetworkCacheKey.h:
81         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
82         (WebKit::NetworkCache::SpeculativeLoad::didComplete):
83         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
84         (WebKit::NetworkCache::constructRevalidationRequest):
85         (WebKit::NetworkCache::SpeculativeLoadManager::retrieveEntryFromStorage):
86         (WebKit::NetworkCache::SpeculativeLoadManager::revalidateEntry):
87
88 2016-03-09  Brent Fulgham  <bfulgham@apple.com>
89
90         Local HTML should be blocked from localStorage access unless "Disable Local File Restrictions" is checked
91         https://bugs.webkit.org/show_bug.cgi?id=155185
92
93         Reviewed by Anders Carlsson.
94         <rdar://problem/11101440>
95
96         Tested by TestWebKitAPI tests IndexedDB.IndexedDBMultiProcess and IndexedDB.IndexedDBPersistence.
97
98         Allow Cocoa WKWebViewConfiguration access to the 'allowUniversalAccessFromFileURLs' setting.
99
100         * UIProcess/API/Cocoa/WKWebView.mm:
101         (- [WKWebView _initializeWithConfiguration]): Set 'allowUniversalAccessFromFileURLsKey' in
102         page configuration.
103         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
104         (-[WKWebViewConfiguration _allowUniversalAccessFromFileURLs]): Added,
105         (-[WKWebViewConfiguration _setAllowUniversalAccessFromFileURLs:]): Added.
106         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
107
108 2016-03-09  Enrica Casucci  <enrica@apple.com>
109
110         Add two finger tap on links.
111         https://bugs.webkit.org/show_bug.cgi?id=155205
112         rdar://problem/22937516
113
114         Reviewed by Sam Weinig.
115
116         Adds two finger tap gesture recognizer. When performed
117         on a link, it calls the delegate.
118
119         * Platform/spi/ios/UIKitSPI.h:
120         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
121         * UIProcess/WebPageProxy.h:
122         * UIProcess/ios/WKContentViewInteraction.h:
123         * UIProcess/ios/WKContentViewInteraction.mm:
124         (-[WKContentView setupInteraction]):
125         (-[WKContentView cleanupInteraction]):
126         (-[WKContentView _removeDefaultGestureRecognizers]):
127         (-[WKContentView _addDefaultGestureRecognizers]):
128         (-[WKContentView _twoFingerSingleTapGestureRecognized:]):
129         * UIProcess/ios/WebPageProxyIOS.mm:
130         (WebKit::WebPageProxy::handleTwoFingerTapAtPoint):
131         * WebProcess/WebPage/WebPage.h:
132         * WebProcess/WebPage/WebPage.messages.in:
133         * WebProcess/WebPage/ios/WebPageIOS.mm:
134         (WebKit::WebPage::handleTwoFingerTapAtPoint):
135
136 2016-03-09  Alex Christensen  <achristensen@webkit.org>
137
138         Always call NSURLSession completion handlers
139         https://bugs.webkit.org/show_bug.cgi?id=155137
140
141         Reviewed by Darin Adler.
142
143         There are some edge cases which should not be hit, but if they are they would cause the
144         network process to hang and network resources to be leaked.  This can be avoided.
145         There are also a few release asserts that do not need to crash release builds.
146
147         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
148         (WebKit::NetworkDataTask::NetworkDataTask):
149         (WebKit::NetworkDataTask::didReceiveChallenge):
150         (WebKit::NetworkDataTask::didCompleteWithError):
151         (WebKit::NetworkDataTask::didReceiveResponse):
152         (WebKit::NetworkDataTask::didReceiveData):
153         (WebKit::NetworkDataTask::willPerformHTTPRedirection):
154         (WebKit::NetworkDataTask::scheduleFailure):
155         (WebKit::NetworkDataTask::tryPasswordBasedAuthentication):
156         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
157         (-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]):
158         (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
159         (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]):
160
161 2016-03-08  Sam Weinig  <sam@webkit.org>
162
163         Roll r197632 back in now that the bots have caught up.
164
165         * UIProcess/ios/WKContentViewInteraction.mm:
166         (-[WKContentView textInputTraits]):
167
168 2016-03-08  Oliver Hunt  <oliver@apple.com>
169
170         Start moving to separated writable and executable mappings in the JIT
171         https://bugs.webkit.org/show_bug.cgi?id=155178
172
173         Reviewed by Fil Pizlo.
174
175         Update feature defines.
176
177         * Configurations/FeatureDefines.xcconfig:
178
179 2016-03-08  Brent Fulgham  <bfulgham@apple.com>
180
181         [WK2][Mac] Allow processes to set "fast-dev-casheable" bit in Network Process
182         https://bugs.webkit.org/show_bug.cgi?id=155189
183         <rdar://problem/25042678>
184
185         Reviewed by Alexey Proskuryakov.
186
187         Update the NetworkProcess sandbox profiles with a declaration that using the
188         system-fctl to touch the "hot file" flag (to support caching operations)
189         is allowed. I should have done this in Bug 154503, but did not.
190
191         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in: Add sandbox permission.
192
193 2016-03-08  Commit Queue  <commit-queue@webkit.org>
194
195         Unreviewed, rolling out r197793 and r197799.
196         https://bugs.webkit.org/show_bug.cgi?id=155195
197
198         something weird happened while landing this and everything
199         broke (Requested by olliej on #webkit).
200
201         Reverted changesets:
202
203         "Start moving to separated writable and executable mappings in
204         the JIT"
205         https://bugs.webkit.org/show_bug.cgi?id=155178
206         http://trac.webkit.org/changeset/197793
207
208         "arm64 build fix after r197793."
209         http://trac.webkit.org/changeset/197799
210
211 2016-03-08  Brent Fulgham  <bfulgham@apple.com>
212
213         [WK2] Grant explicit read access to ManagedPreferences
214         https://bugs.webkit.org/show_bug.cgi?id=155173
215         <rdar://problem/24910550>
216
217         Reviewed by Alexey Proskuryakov.
218
219         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: Add new
220         read permission.
221
222 2016-03-08  Anders Carlsson  <andersca@apple.com>
223
224         Ignore deprecation warnings.
225
226         * Shared/mac/ChildProcessMac.mm:
227         (WebKit::ChildProcess::stopNSAppRunLoop):
228         * Shared/mac/WebEventFactory.mm:
229         (WebKit::mouseButtonForEvent):
230         (WebKit::mouseEventTypeForEvent):
231         (WebKit::clickCountForEvent):
232         (WebKit::globalPointForEvent):
233         (WebKit::pointForEvent):
234         (WebKit::textFromEvent):
235         (WebKit::unmodifiedTextFromEvent):
236         (WebKit::isKeypadEvent):
237         (WebKit::isKeyUpEvent):
238         (WebKit::modifiersForEvent):
239         (WebKit::WebEventFactory::createWebKeyboardEvent):
240         * UIProcess/API/Cocoa/WKNavigationAction.mm:
241         (toNSEventModifierFlags):
242         * UIProcess/Cocoa/WebViewImpl.mm:
243         (WebKit::WebViewImpl::becomeFirstResponder):
244         (WebKit::WebViewImpl::updateContentInsetsIfAutomatic):
245         (WebKit::WebViewImpl::viewDidMoveToWindow):
246         (WebKit::WebViewImpl::postFakeMouseMovedEventForFlagsChangedEvent):
247         (WebKit::WebViewImpl::createFullScreenWindow):
248         (WebKit::WebViewImpl::sendToolTipMouseExited):
249         (WebKit::WebViewImpl::sendToolTipMouseEntered):
250         (WebKit::applicationFlagsForDrag):
251         (WebKit::WebViewImpl::setLastMouseDownEvent):
252         (WebKit::WebViewImpl::doneWithKeyEvent):
253         (WebKit::WebViewImpl::collectKeyboardLayoutCommandsForEvent):
254         (WebKit::WebViewImpl::performKeyEquivalent):
255         * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
256         (WebKit::PluginProcessProxy::beginModal):
257         * UIProcess/mac/WebContextMenuProxyMac.mm:
258         (WebKit::WebContextMenuProxyMac::showContextMenu):
259         * UIProcess/mac/WebInspectorProxyMac.mm:
260         (WebKit::WebInspectorProxy::platformCanAttach):
261         * UIProcess/mac/WebPopupMenuProxyMac.mm:
262         (WebKit::WebPopupMenuProxyMac::populate):
263         (WebKit::WebPopupMenuProxyMac::showPopupMenu):
264         * WebProcess/Plugins/PDF/DeprecatedPDFPlugin.mm:
265         (WebKit::modifierFlagsFromWebEvent):
266         (WebKit::getEventTypeFromWebEvent):
267         * WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm:
268         (WebKit::cssAlignmentValueForNSTextAlignment):
269         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
270         (WebKit::convertImageToBitmap):
271
272 2016-03-08  Oliver Hunt  <oliver@apple.com>
273
274         Start moving to separated writable and executable mappings in the JIT
275         https://bugs.webkit.org/show_bug.cgi?id=155178
276
277         Reviewed by Filip Pizlo.
278
279         Update feature defines.
280
281         * Configurations/FeatureDefines.xcconfig:
282
283 2016-03-08  Commit Queue  <commit-queue@webkit.org>
284
285         Unreviewed, rolling out r197766.
286         https://bugs.webkit.org/show_bug.cgi?id=155183
287
288         Has platform-specific code in non-platform files (Requested by
289         smfr on #webkit).
290
291         Reverted changeset:
292
293         "AX: Force allow user zoom"
294         https://bugs.webkit.org/show_bug.cgi?id=155056
295         http://trac.webkit.org/changeset/197766
296
297 2016-03-04  Ada Chan  <adachan@apple.com>
298
299         Fix lifetime issues regarding WebVideoFullscreenInterfaceMac
300         https://bugs.webkit.org/show_bug.cgi?id=155130
301
302         Reviewed by Beth Dakin.
303
304         Now that both fullscreen and video controls manager rely on WebVideoFullscreenInterface,
305         we now keep track of a "client count" for each context ID so we'll only remove it
306         from the context map after all the "clients" are done with it.
307
308         Before this change, every time WebVideoFullscreenManager::setUpVideoControlsManager()
309         is called, the existing interface is cleared and a new one is created even when there's
310         an existing interface for that. With this change, we reuse the existing interface for
311         the video element.
312
313         * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h:
314         * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm:
315         (WebKit::WebVideoFullscreenManagerProxy::invalidate):
316         Also clear out m_clientCounts.
317         (WebKit::WebVideoFullscreenManagerProxy::addClientForContext):
318         If the context ID is not in m_clientCounts yet, add the count of 1 to
319         that table for that ID. Otherwise, increment the count by 1.
320         (WebKit::WebVideoFullscreenManagerProxy::removeClientForContext):
321         Assert that we have added this context id to m_clientCounts before.
322         Decrement the count. If it reaches 0, remove this context ID from both
323         m_clientCounts and m_contextMap.
324         (WebKit::WebVideoFullscreenManagerProxy::setupFullscreenWithID):
325         We have started a new fullscreen session using this interface. Call
326         addClientForContext() to update the client count.
327         (WebKit::WebVideoFullscreenManagerProxy::setUpVideoControlsManagerWithID):
328         If the current controls manager set up has the same context ID as the one
329         passed in, we don't have to do anything. Otherwise, if we have set up
330         the video controls manager with a different ID before, call removeClientForContext()
331         on the old ID to decrement its client count. Set m_controlsManagerContextId
332         to the new value and call addClientForContext() with it.
333         (WebKit::WebVideoFullscreenManagerProxy::didCleanupFullscreen):
334         Instead of removing the mapping from m_contextMap directly, reset the fullscreen
335         mode on the interface and call removeClientForContext(), which removes the mapping
336         only if there's no more client using the interface.
337         * WebProcess/cocoa/WebVideoFullscreenManager.h:
338         * WebProcess/cocoa/WebVideoFullscreenManager.mm:
339         (WebKit::WebVideoFullscreenManager::~WebVideoFullscreenManager):
340         Clear m_clientCounts.
341         (WebKit::WebVideoFullscreenManager::removeContext):
342         Add a helper method for removing the context.
343         (WebKit::WebVideoFullscreenManager::addClientForContext):
344         If the context ID is not in m_clientCounts yet, add the count of 1 to
345         that table for that ID. Otherwise, increment the count by 1.
346         (WebKit::WebVideoFullscreenManager::removeClientForContext):
347         Assert that we have added this context id to m_clientCounts before.
348         Decrement the count. If it reaches 0, remove this context ID from
349         m_clientCounts and call removeContext() to clean up this context.
350         (WebKit::WebVideoFullscreenManager::enterVideoFullscreenForVideoElement):
351         We have started a new fullscreen session using this interface. Call
352         addClientForContext() to update the client count. Create a layer hosting
353         context if it's not there.
354         (WebKit::WebVideoFullscreenManager::setUpVideoControlsManager):
355         If we have set up a context for this video element before, see if it's
356         the one we are currently managing video controls for. If it is, return early.
357         Otherwise, call removeClientForContext() on the previous m_controlsManagerContextId
358         and update m_controlsManagerContextId to the context ID of this video element.
359         If there's no context created for this video element yet, set one up.
360         Send a SetUpVideoControlsManagerWithID message to the proxy object in the UI process
361         so it'll update its controls manager context ID. Also, conditionalize all of this
362         under PLATFORM(MAC) to be consistent with WebVideoFullscreenManagerProxy.
363         (WebKit::WebVideoFullscreenManager::didCleanupFullscreen):
364         Just reset the fullscreen mode on the interface and call removeClientForContext() which
365         only cleans up the context if there's no more client using it.
366
367 2016-03-08  Timothy Hatcher  <timothy@apple.com>
368
369         Web Inspector: Add automation protocol methods for navigation
370
371         https://bugs.webkit.org/show_bug.cgi?id=155163
372         rdar://problem/25029054
373
374         Reviewed by Darin Adler.
375
376         * UIProcess/Automation/Automation.json:
377         * UIProcess/Automation/WebAutomationSession.cpp:
378         (WebKit::WebAutomationSession::getBrowsingContexts): Set url.
379         (WebKit::WebAutomationSession::getBrowsingContext): Added.
380         (WebKit::WebAutomationSession::navigateBrowsingContext): Added.
381         (WebKit::WebAutomationSession::goBackInBrowsingContext): Added.
382         (WebKit::WebAutomationSession::goForwardInBrowsingContext): Added.
383         (WebKit::WebAutomationSession::reloadBrowsingContext): Added.
384         * UIProcess/Automation/WebAutomationSession.h:
385
386 2016-03-08  Nan Wang  <n_wang@apple.com>
387
388         AX: Force allow user zoom
389         https://bugs.webkit.org/show_bug.cgi?id=155056
390
391         Reviewed by Chris Fleizach.
392
393         Soft linked libAccessibility library so that we can observe the accessibility
394         setting change for the force always user scalable feature.
395
396         * WebProcess/WebPage/WebPage.cpp:
397         (WebKit::forceAlwaysUserScalableChangedCallback):
398         (WebKit::WebPage::create):
399         (WebKit::m_shouldDispatchFakeMouseMoveEvents):
400         (WebKit::WebPage::~WebPage):
401         (WebKit::WebPage::preferencesDidChange):
402         (WebKit::WebPage::updateForceAlwaysUserScalable):
403         (WebKit::WebPage::updatePreferences):
404         * WebProcess/WebPage/WebPage.h:
405
406 2016-03-08  Csaba Osztrogonác  <ossy@webkit.org>
407
408         One more unreviewed speculative buildfix after r197728.
409
410         * NetworkProcess/NetworkResourceLoader.cpp:
411         (WebKit::NetworkResourceLoader::didFinishLoading):
412         (WebKit::NetworkResourceLoader::continueWillSendRequest):
413
414 2016-03-08  Csaba Osztrogonác  <ossy@webkit.org>
415
416         Unreviewed speculative buildfix after r197728.
417
418         * WebProcess/Network/WebLoaderStrategy.cpp:
419         (WebKit::WebLoaderStrategy::scheduleLoad):
420
421 2016-03-08  Timothy Hatcher  <timothy@apple.com>
422
423         Web Inspector: Make WebAutomationSession::closeBrowsingContext work as expected
424
425         https://bugs.webkit.org/show_bug.cgi?id=155162
426         rdar://problem/25027191
427
428         Reviewed by Brian Burg.
429
430         * UIProcess/Automation/WebAutomationSession.cpp:
431         (WebKit::WebAutomationSession::closeBrowsingContext):
432         Call closePage, the same method ultimately used by window.close().
433
434         * UIProcess/WebPageProxy.h: Make closePage public.
435
436 2016-03-07  Carlos Garcia Campos  <cgarcia@igalia.com>
437
438         REGRESSION(r197062): [GTK] Transparent backgrounds no longer work after r197062
439         https://bugs.webkit.org/show_bug.cgi?id=155119
440
441         Reviewed by Martin Robinson.
442
443         This is because after r197062 we are now realizing the view too
444         early, even before the toplevel window has been realized, forcing
445         the toplevel window to be realized. If the RGBA visual is set on
446         the window after it has been realzied it doesn't have any
447         effect. We should wait until the toplevel window is realized to
448         realize the web view, giving time to the application to set RGBA
449         visual and background color. If the toplevel window is already
450         realized we realize the web view immediately, so that this doesn't
451         affect the tearing problems fixed in r197062.
452
453         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
454         (toplevelWindowRealized):
455         (webkitWebViewBaseSetToplevelOnScreenWindow):
456
457 2016-03-07  Keith Rollin  <krollin@apple.com>
458
459         Enhance logging: Use "always on" macros
460         https://bugs.webkit.org/show_bug.cgi?id=154499
461         <rdar://problem/24757730>
462
463         Reviewed by Chris Dumez.
464
465         Make use of new logging macros by reporting on frame and resource
466         load activity.
467
468         Connection updated to report IPC errors, helping us identify when
469         messaging between processes breaks down.
470
471         ChildProcess updated to log if it is terminating early. Some
472         sysdiagnose logging from customers indicate that this is happening in
473         the wild.
474
475         * NetworkProcess/NetworkResourceLoader.cpp:
476         (WebKit::NetworkResourceLoader::startNetworkLoad):
477         (WebKit::NetworkResourceLoader::didFinishLoading):
478         (WebKit::NetworkResourceLoader::didFailLoading):
479         (WebKit::NetworkResourceLoader::continueWillSendRequest):
480         (WebKit::NetworkResourceLoader::isAlwaysOnLoggingAllowed):
481         * NetworkProcess/NetworkResourceLoader.h:
482         * Platform/IPC/Connection.cpp:
483         (IPC::Connection::waitForSyncReply):
484         * Shared/ChildProcess.cpp:
485         (WebKit::didCloseOnConnectionWorkQueue):
486         * WebProcess/Network/WebLoaderStrategy.cpp:
487         (WebKit::WebLoaderStrategy::scheduleLoad):
488         * WebProcess/Network/WebResourceLoader.cpp:
489         (WebKit::WebResourceLoader::willSendRequest):
490         (WebKit::WebResourceLoader::didReceiveResponse):
491         (WebKit::WebResourceLoader::didReceiveData):
492         (WebKit::WebResourceLoader::didFinishResourceLoad):
493         (WebKit::WebResourceLoader::didFailResourceLoad):
494         (WebKit::WebResourceLoader::didReceiveResource):
495         (WebKit::WebResourceLoader::isAlwaysOnLoggingAllowed):
496         * WebProcess/Network/WebResourceLoader.h:
497
498 2016-03-07  Brent Fulgham  <bfulgham@apple.com>
499
500         Reduce startup and shutdown cost of resource load statistics
501         https://bugs.webkit.org/show_bug.cgi?id=155120
502         <rdar://problem/25010167>
503
504         Reviewed by Andy Estes.
505
506         Use a dedicated WorkQueue to process resource load statistics data. Allow
507         processing to load (and save) previously stored statistics asynchronously so
508         that it does not delay startup.
509         
510         Now that we have a more rational storage situation, get rid of the 'writeToDisk'
511         method since it is no longer needed in the WK2 layer.
512
513         Move all of the Resource Load Statistics file handling code from WebCore to this
514         API layer.
515
516         * UIProcess/WebResourceLoadStatisticsStore.cpp:
517         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore): Initialize
518         member variable with storage path, rather than passing to WebCore code.
519         (WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated): Revised to
520         use the new WorkQueue code.
521         (WebKit::WebResourceLoadStatisticsStore::setResourceLoadStatisticsEnabled): When
522         activating the feature, purge any old statistics before loading from disk.
523         (WebKit::WebResourceLoadStatisticsStore::readDataFromDiskIfNeeded): Added.
524         (WebKit::WebResourceLoadStatisticsStore::processWillOpenConnection): Added.
525         (WebKit::WebResourceLoadStatisticsStore::processDidCloseConnection): Added.
526         (WebKit::WebResourceLoadStatisticsStore::applicationWillTerminate): Make sure all
527         of the WorkQueue tasks are done before terminating.
528         (WebKit::WebResourceLoadStatisticsStore::persistentStoragePath): Moved from WebCore.
529         (WebKit::WebResourceLoadStatisticsStore::writeEncoderToDisk): Ditto.
530         (WebKit::WebResourceLoadStatisticsStore::createDecoderFromDisk): Ditto.
531         (WebKit::WebResourceLoadStatisticsStore::writeToDisk): Deleted.
532         * UIProcess/WebResourceLoadStatisticsStore.h:
533         (WebKit::WebResourceLoadStatisticsStore::coreStore):
534         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
535         (WebKit::WebsiteDataStore::webProcessWillOpenConnection): Call new WebResourceLoadStatisticsStore code.
536         (WebKit::WebsiteDataStore::webProcessDidCloseConnection): Ditto.
537
538 2016-03-07  Alex Christensen  <achristensen@webkit.org>
539
540         Fix cookies with private browsing and NetworkSession
541         https://bugs.webkit.org/show_bug.cgi?id=155147
542         rdar://problem/25018279
543
544         Reviewed by Brady Eidson.
545
546         In the NetworkSession constructor, we look for a NetworkStorageSession in the SessionTracker
547         and use that NetworkStorageSession's CFHTTPCookieStorageRef in the NSURLSessionConfiguration.
548         NetworkStorageSessions were being set in SessionTracker's storageSessionMap after NetworkSessions
549         were created, causing the NSHTTPCookieStorage of the NSURLSession to be different from the
550         CFHTTPCookieStorageRef used by document.cookie in newly created private browsing sessions.
551         This fixes that problem by passing the NetworkStorageSession as a constructor parameter to the
552         NetworkSession so it can use the correct CFHTTPCookieStorageRef in its NSURLSessionConfiguration
553         before it is in the storageSessionMap.
554
555         * NetworkProcess/NetworkSession.h:
556         (WebKit::NetworkSession::sessionID):
557         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
558         (WebKit::NetworkSession::defaultSession):
559         (WebKit::NetworkSession::NetworkSession):
560         * NetworkProcess/mac/RemoteNetworkingContext.mm:
561         (WebKit::RemoteNetworkingContext::ensurePrivateBrowsingSession):
562         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
563         (WebKit::WebFrameNetworkingContext::ensurePrivateBrowsingSession):
564
565 2016-03-07  Brent Fulgham  <bfulgham@apple.com>
566
567         Correct bug in resource load statistics debug flag for legacy clients
568         https://bugs.webkit.org/show_bug.cgi?id=155118
569         <rdar://problem/25020088>
570
571         Reviewed by Andy Estes.
572
573         Some clients launch WebKit2 using the "legacy" configuration for the website data store.
574         The Resource Load Statistics code was not added to this type of configuration, which
575         prevents various WebKit2 clients from using this code.
576
577         * UIProcess/WebProcessPool.cpp:
578         (WebKit::legacyWebsiteDataStoreConfiguration): Tell the legacy initializer where to
579         find the resource load statistics data.
580
581 2016-03-07  Daniel Bates  <dabates@apple.com>
582
583         Cleanup: Add convenience function URL::procotolIsBlob()
584         https://bugs.webkit.org/show_bug.cgi?id=155127
585         <rdar://problem/25016829>
586
587         Reviewed by Brent Fulgham.
588
589         * NetworkProcess/NetworkLoad.cpp:
590         (WebKit::NetworkLoad::NetworkLoad): Modified to use URL::protocolIsBlob().
591         * NetworkProcess/NetworkResourceLoader.cpp:
592         (WebKit::NetworkResourceLoader::NetworkResourceLoader): Ditto.
593         * WebProcess/WebPage/WebPage.cpp:
594         (WebKit::WebPage::canHandleRequest): Ditto.
595
596 2016-03-07  Simon Fraser  <simon.fraser@apple.com>
597
598         Use CGColorSpaceCopyICCData instead of CGColorSpaceCopyICCProfile
599         https://bugs.webkit.org/show_bug.cgi?id=155123
600         rdar://problem/24990256
601
602         Reviewed by Tim Horton.
603         
604         On newer OSes, use CGColorSpaceCopyICCData().
605
606         * Shared/mac/ColorSpaceData.mm:
607         (WebKit::ColorSpaceData::encode):
608
609 2016-03-07  Gavin Barraclough  <barraclough@apple.com>
610
611         Last opened tab does not receive SetHiddenPageTimerThrottlingIncreaseLimit message
612         https://bugs.webkit.org/show_bug.cgi?id=155126
613
614         Reviewed by Chris Dumez.
615
616         WebPageProxy will increment the hidden page throttling counter from within its constructor,
617         which currently causes the WebProcessPool to try to synchronously message all processes.
618         The web page triggering the increment then fails to receive the message, since it was
619         still being constructed. Make the update of the limit async, such that the page is fully
620         constructed before the WebProcessPool processes the update.
621
622         * UIProcess/WebProcessPool.cpp:
623         (WebKit::m_hiddenPageThrottlingAutoIncreasesCounter):
624             - This now schedules a zero-delay timer to handle the update.
625         (WebKit::m_hiddenPageThrottlingTimer):
626             - This is now responsible for calling updateHiddenPageThrottlingAutoIncreaseLimit.
627         * UIProcess/WebProcessPool.h:
628             - Added m_hiddenPageThrottlingTimer.
629
630 2016-03-05  Enrica Casucci  <enrica@apple.com>
631
632         Support preview on attachment elements.
633         https://bugs.webkit.org/show_bug.cgi?id=155074
634         rdar://problem/24806079
635
636         Reviewed by Sam Weinig.
637
638         Allowing preview to start on attachment elements.
639         Adding a private UIDelegate method to provide the data for the preview.
640
641         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
642         * UIProcess/ios/WKContentViewInteraction.mm:
643         (-[WKContentView _interactionShouldBeginFromPreviewItemController:forPosition:]):
644         (-[WKContentView _dataForPreviewItemController:atPosition:type:]):
645
646 2016-03-06  Andreas Kling  <akling@apple.com>
647
648         Reduce page cache capacity from 3 to 2.
649         <https://webkit.org/b/155087>
650
651         Reviewed by Antti Koivisto.
652
653         It's extremely rare that users go back more than 2 pages in the page cache,
654         and nowadays the network cache makes even un-cached pages fast to reload.
655
656         Trimming the page cache from 3 to 2 entries has a very nice effect on heap
657         fragmentation. I'm seeing a ~5% progression on the iPad PLUM test locally;
658         average memory usage across 300 loads goes from ~121MB to ~114MB.
659
660         * Shared/CacheModel.cpp:
661         (WebKit::calculateCacheSizes):
662
663 2016-03-05  Sam Weinig  <sam@webkit.org>
664
665         Revert usage of autofill field name for use with UITextInputTraits
666         until our bots can catch up.
667
668         * UIProcess/ios/WKContentViewInteraction.mm:
669         (-[WKContentView textInputTraits]):
670
671 2016-03-05  Chris Dumez  <cdumez@apple.com>
672
673         Consolidate RuntimeApplicationChecks and RuntimeApplicationChecksIOS
674         https://bugs.webkit.org/show_bug.cgi?id=155035
675
676         Reviewed by Darin Adler.
677
678         Update runtime application checks.
679
680         * UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm:
681         (API::WebsiteDataStore::defaultApplicationCacheDirectory):
682         * UIProcess/Cocoa/VersionChecks.mm:
683         (WebKit::linkedOnOrAfter):
684         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
685         (WebKit::WebProcessPool::platformInitializeWebProcess):
686         (WebKit::WebProcessPool::legacyPlatformDefaultApplicationCacheDirectory):
687         * UIProcess/ios/WKContentViewInteraction.mm:
688         * UIProcess/mac/WebPageProxyMac.mm:
689         (WebKit::expectsLegacyImplicitRubberBandControl):
690         (WebKit::WebPageProxy::appleMailPaginationQuirkEnabled):
691
692 2016-03-05  Sam Weinig  <sam@webkit.org>
693
694         Add support for processing the autofill field name out of form control elements ultimately to aid input methods
695         <rdar://problem/23041180>
696         https://bugs.webkit.org/show_bug.cgi?id=155079
697
698         Reviewed by Enrica Casucci.
699
700         * Shared/AssistedNodeInformation.cpp:
701         (WebKit::AssistedNodeInformation::encode):
702         (WebKit::AssistedNodeInformation::decode):
703         * Shared/AssistedNodeInformation.h:
704         Add AutofillFieldName. Convert some coders to use encodeEnum/decodeEnum instead of casting.
705
706         * UIProcess/ios/WKContentViewInteraction.mm:
707         (-[WKContentView textInputTraits]):
708         Map AutofillFieldNames to the associated UITextContentTypes.
709
710         * WebProcess/WebPage/ios/WebPageIOS.mm:
711         (WebKit::WebPage::getAssistedNodeInformation):
712         Extract the AutofillFieldNames onto the AssistedNodeInformation for <input> elements 
713         and <textarea> elements.
714
715 2016-03-05  Timothy Hatcher  <timothy@apple.com>
716
717         Implement the Automation protocol commands by tracking WebPageProxy objects
718         that are controlled by automation and assigning them a UUID handle.
719
720         https://bugs.webkit.org/show_bug.cgi?id=154953
721         rdar://problem/24947489
722
723         Reviewed by Brian Burg.
724
725         * UIProcess/API/APIAutomationSessionClient.h:
726         (API::AutomationSessionClient::didRequestNewWindow):
727         Return a WebPageProxy instead of void so it can be assigned a UUID handle.
728
729         * UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h:
730         Return a WKPageRef from _automationSessionDidRequestNewWindow:.
731
732         * UIProcess/Automation/WebAutomationSession.cpp:
733         (WebKit::WebAutomationSession::webPageProxyForHandle):
734         (WebKit::WebAutomationSession::handleForWebPageProxy):
735         (WebKit::WebAutomationSession::getBrowsingContexts):
736         (WebKit::WebAutomationSession::createBrowsingContext):
737         (WebKit::WebAutomationSession::closeBrowsingContext):
738         (WebKit::WebAutomationSession::switchToBrowsingContext):
739
740         * UIProcess/Automation/WebAutomationSession.h:
741         Added new methods and maps to track pages and handles.
742
743         * UIProcess/Cocoa/AutomationSessionClient.h:
744         * UIProcess/Cocoa/AutomationSessionClient.mm:
745         (WebKit::AutomationSessionClient::didRequestNewWindow):
746         Return a WebPageProxy from the WKPageRef.
747
748         * UIProcess/WebPageProxy.h: Make setFocus public.
749
750         * UIProcess/WebProcessPool.cpp:
751         (WebKit::WebProcessPool::setAutomationSession):
752         Set the WebProcessPool on the WebAutomationSession so it can be used to find
753         WebPageProxy objects controlled by automation.
754
755 2016-03-05  Timothy Hatcher  <timothy@apple.com>
756
757         Rename Automation protocol methods to use "BrowsingContext" instead of "Window".
758         Also flesh out the protocol commands more by adding switchToBrowsingContext
759         and return a BrowsingContextHandle for createBrowsingContext.
760
761         https://bugs.webkit.org/show_bug.cgi?id=154953
762         rdar://problem/24947489
763
764         Reviewed by Brian Burg.
765
766         * UIProcess/Automation/Automation.json:
767         * UIProcess/Automation/WebAutomationSession.cpp:
768         (WebKit::WebAutomationSession::getBrowsingContexts):
769         (WebKit::WebAutomationSession::createBrowsingContext):
770         (WebKit::WebAutomationSession::closeBrowsingContext):
771         (WebKit::WebAutomationSession::switchToBrowsingContext):
772         (WebKit::WebAutomationSession::getWindows): Deleted.
773         (WebKit::WebAutomationSession::openWindow): Deleted.
774         (WebKit::WebAutomationSession::closeWindow): Deleted.
775         * UIProcess/Automation/WebAutomationSession.h:
776
777 2016-03-05  Yusuke Suzuki  <utatane.tea@gmail.com>
778
779         [ES6] Support Reflect.construct
780         https://bugs.webkit.org/show_bug.cgi?id=147330
781
782         Reviewed by Saam Barati.
783
784         * WebProcess/Plugins/Netscape/JSNPMethod.cpp:
785         (WebKit::JSNPMethod::getCallData):
786         * WebProcess/Plugins/Netscape/JSNPObject.cpp:
787         (WebKit::JSNPObject::getCallData):
788         (WebKit::JSNPObject::getConstructData):
789         * WebProcess/Plugins/Netscape/NPJSObject.cpp:
790         (WebKit::NPJSObject::hasMethod):
791         (WebKit::NPJSObject::construct):
792         (WebKit::NPJSObject::invoke):
793
794 2016-03-04  Alex Christensen  <achristensen@webkit.org>
795
796         Fix file mime-types when using NetworkSession
797         https://bugs.webkit.org/show_bug.cgi?id=155058
798
799         Reviewed by Andy Estes.
800
801         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
802         (WebKit::NetworkDataTask::NetworkDataTask):
803         Call adjustMIMETypeIfNecessary like we do in connection didReceiveResponse in 
804         WebCoreResourceHandleAsOperationQueueDelegate.mm.
805         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
806         (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]):
807         Don't content sniff file urls.  This check is analogous to ResourceHandle::shouldContentSniffURL.
808
809 2016-03-04  Sam Weinig  <sam@webkit.org>
810
811         [WebKit2] Add WebKit2 equivalent of -[WebView _insertNewlineInQuotedContent]
812         <rdar://problem/24943591>
813         https://bugs.webkit.org/show_bug.cgi?id=155057
814
815         Reviewed by Tim Horton.
816
817         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
818         (WKBundlePageInsertNewlineInQuotedContent):
819         * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
820         * WebProcess/WebPage/WebPage.cpp:
821         (WebKit::WebPage::insertNewlineInQuotedContent):
822         * WebProcess/WebPage/WebPage.h:
823         Expose WKBundlePageInsertNewlineInQuotedContent as SPI.
824
825 2016-03-04  Brent Fulgham  <bfulgham@apple.com>
826
827         Stub API to support a debug menu option for measuring resource load statistics
828         https://bugs.webkit.org/show_bug.cgi?id=154998
829         <rdar://problem/24944604>
830
831         Reviewed by Andy Estes.
832
833         * UIProcess/API/APIWebsiteDataStore.cpp:
834         (API::WebsiteDataStore::resourceLoadStatisticsEnabled): Added stub.
835         (API::WebsiteDataStore::setResourceLoadStatisticsEnabled): Ditto.
836         * UIProcess/API/APIWebsiteDataStore.h:
837         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
838         (WKWebsiteDataStoreSetResourceLoadStatisticsEnabled): Added method that calls through
839         to the underlying APIWebsiteDataStore class.
840         (WKWebsiteDataStoreGetResourceLoadStatisticsEnabled): Ditto.
841         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
842
843 2016-03-03  Enrica Casucci  <enrica@apple.com>
844
845         Add a mechanism to customize the long press action.
846         https://bugs.webkit.org/show_bug.cgi?id=154995
847         rdar://problem/24823732
848
849         Reviewed by Tim Horton.
850
851         Adding a new private delegate method to allow clients to
852         replace the action sheet displayed for images and links.
853         The change also adds support for attachment elements.
854
855         * Shared/ios/InteractionInformationAtPosition.h:
856         * Shared/ios/InteractionInformationAtPosition.mm:
857         (WebKit::InteractionInformationAtPosition::encode):
858         (WebKit::InteractionInformationAtPosition::decode):
859         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
860         * UIProcess/API/Cocoa/_WKActivatedElementInfo.h:
861         * UIProcess/ios/WKActionSheetAssistant.h:
862         * UIProcess/ios/WKActionSheetAssistant.mm:
863         (-[WKActionSheetAssistant showImageSheet]):
864         (-[WKActionSheetAssistant showLinkSheet]):
865         * UIProcess/ios/WKContentViewInteraction.mm:
866         (-[WKContentView _showImageSheet]):
867         (-[WKContentView _showAttachmentSheet]):
868         (-[WKContentView _showLinkSheet]):
869         (-[WKContentView _actionForLongPress]):
870         (-[WKContentView actionSheetAssistant:shouldIncludeAppLinkActionsForElement:]):
871         (-[WKContentView actionSheetAssistant:showCustomSheetForElement:]):
872         (-[WKContentView actionSheetAssistant:decideActionsForElement:defaultActions:]):
873         * WebProcess/WebPage/ios/WebPageIOS.mm:
874         (WebKit::WebPage::getPositionInformation):
875
876 2016-03-04  Brent Fulgham  <bfulgham@apple.com>
877
878         [WK2] Gather resource load statistics
879         https://bugs.webkit.org/show_bug.cgi?id=154278
880         <rdar://problem/24702892>
881
882         Reviewed by Andy Estes.
883
884         Revise the WebProcess to notify the UIProcess about resource load statistics. These
885         updates are not time-critical, and do not need to be done in concert with the actual
886         load. As resource loads are made, each WebProcess notifies the UIProcess of the new
887         load counts, then clears its local state. These statistics are then aggregated in
888         the UIProcess.
889
890         * CMakeLists.txt: Add new ResourceLoadStatisticsState files to build.
891         * DerivedSources.make: Ditto.
892         * Platform/IPC/ArgumentCoders.h: Update to support HashCountedSets.
893         * PlatformEfl.cmake: Add new ResourceLoadStatisticsState files to build.
894         * PlatformGTK.cmake: Ditto.
895         * PlatformMac.cmake: Ditto.
896         * Shared/API/APIObject.h: Add new ResourceLoadStatistics type.
897         * Shared/WebCoreArgumentCoders.cpp:
898         (IPC::ArgumentCoder<ExceptionDetails>::decode): Support new ResourceLoadStatistics type.
899         (IPC::ArgumentCoder<ResourceLoadStatistics>::encode): Added.
900         (IPC::ArgumentCoder<ResourceLoadStatistics>::decode): Added.
901         * Shared/WebCoreArgumentCoders.h:
902         * Shared/WebProcessCreationParameters.cpp:
903         (WebKit::WebProcessCreationParameters::encode): Handle 'resourceLoadStatisticsEnabled' flag.
904         (WebKit::WebProcessCreationParameters::decode): Ditto.
905         * Shared/WebProcessCreationParameters.h:
906         * UIProcess/API/APIProcessPoolConfiguration.cpp:
907         (API::ProcessPoolConfiguration::ProcessPoolConfiguration): Add storage location for the
908         resource load statistics.
909         (API::ProcessPoolConfiguration::copy): Handle the new storage location and the feature flag.
910         * UIProcess/API/APIProcessPoolConfiguration.h:
911         * UIProcess/API/APIWebsiteDataStore.cpp:
912         (API::WebsiteDataStore::defaultResourceLoadStatisticsDirectory): Added stub.
913         * UIProcess/API/APIWebsiteDataStore.h:
914         * UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm:
915         (API::WebsiteDataStore::defaultResourceLoadStatisticsDirectory): Added.
916         (API::WebsiteDataStore::defaultDataStoreConfiguration): Added support for the new resource
917         load statistics storage location.
918         * UIProcess/API/Cocoa/WKWebView.mm:
919         (-[WKWebView _initializeWithConfiguration:]): Sync Process Pool configuration parameters
920         with the state of our websiteData object's "ResourceLoadStatisticsEnabled" flag, so that
921         new processes are created in the right state.
922         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
923         (-[WKWebsiteDataStore _resourceLoadStatisticsEnabled]): Added.
924         (-[WKWebsiteDataStore _setResourceLoadStatisticsEnabled:]): Added.
925         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
926         * UIProcess/WebProcessPool.cpp:
927         (WebKit::WebProcessPool::createNewWebProcess): Handle new flag for enabling resource
928         load statistics.
929         * UIProcess/WebResourceLoadStatisticsStore.cpp: Added.
930         (WebKit::WebResourceLoadStatisticsStore::create):
931         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
932         (WebKit::WebResourceLoadStatisticsStore::~WebResourceLoadStatisticsStore):
933         (WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated):
934         (WebKit::WebResourceLoadStatisticsStore::setResourceLoadStatisticsEnabled):
935         (WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsEnabled):
936         (WebKit::WebResourceLoadStatisticsStore::readDataFromDiskIfNeeded):
937         (WebKit::WebResourceLoadStatisticsStore::writeToDisk):
938         (WebKit::WebResourceLoadStatisticsStore::applicationWillTerminate):
939         * UIProcess/WebResourceLoadStatisticsStore.h: Added.
940         (WebKit::WebResourceLoadStatisticsStore::coreStore):
941         * UIProcess/WebResourceLoadStatisticsStore.messages.in: Added.
942         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
943         (WebKit::WebsiteDataStore::platformInitialize): Register a termination handler
944         to close down the resource load statistics store.
945         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
946         (WebKit::WebsiteDataStore::WebsiteDataStore): Initialize the new WebResourceLoadStatisticsStore
947         member.
948         (WebKit::WebsiteDataStore::webProcessWillOpenConnection): Register the WebResourceLoadStatisticsStore
949         object as a work queue message receiver
950         (WebKit::WebsiteDataStore::webProcessDidCloseConnection): Unregister WebResourceLoadStatisticsStore.
951         (WebKit::WebsiteDataStore::resourceLoadStatisticsEnabled): Added.
952         (WebKit::WebsiteDataStore::setResourceLoadStatisticsEnabled): Ditto.
953         * UIProcess/WebsiteData/WebsiteDataStore.h:
954         (WebKit::WebsiteDataStore::resourceLoadStatisticsStore): Added.
955         * WebKit2.xcodeproj/project.pbxproj: Add new ResourceLoadStatisticsState files to build.
956         * WebProcess/WebProcess.cpp:
957         (WebKit::WebProcess::initializeWebProcess): Take into account the new parameter
958         specifying whether resource load statistics are being captured.
959         (WebKit::WebProcess::WebProcess): Initialized statistics changed notification timer.
960         (WebKit::WebProcess::statisticsChangedTimerFired): Added. Send bundles of site load
961         statistics to the UIProcess on a set interval. Clear out local cache after each send.
962         (WebKit::WebProcess::setResourceLoadStatisticsEnabled): Added.
963         * WebProcess/WebProcess.h:
964         * WebProcess/WebProcess.messages.in: Add new SetResourceLoadStatisticsEnabled message.
965
966 2016-03-04  Daniel Bates  <dabates@apple.com>
967
968         Temporarily use bundle identifier as part of user directory suffix
969         https://bugs.webkit.org/show_bug.cgi?id=155042
970         <rdar://problem/24983174>
971
972         Reviewed by Brent Fulgham and Brady Eidson.
973
974         * Shared/mac/ChildProcessMac.mm:
975         (WebKit::ChildProcess::initializeSandbox):
976
977 2016-03-04  Alex Christensen  <achristensen@webkit.org>
978
979         Release build fix after r197572.
980         https://bugs.webkit.org/show_bug.cgi?id=154993
981
982         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
983         (-[WKNetworkSessionDelegate URLSession:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:]):
984
985 2016-03-04  Alex Christensen  <achristensen@webkit.org>
986
987         Use NSURLSession for loading in WebKit2
988         https://bugs.webkit.org/show_bug.cgi?id=154993
989
990         Reviewed by Sam Weinig.
991
992         * config.h:
993
994 2016-03-04  Alex Christensen  <achristensen@webkit.org>
995
996         Use NetworkSession for pings
997         https://bugs.webkit.org/show_bug.cgi?id=154984
998
999         Reviewed by Antti Koivisto.
1000
1001         Before this patch, we were using NSURLConnection for pings when the rest of the loading was being 
1002         done with NSURLSession.  To fix this, I implemented PingLoad, which is the NetworkSession equivalent
1003         of PingHandle.
1004
1005         This fixes http/tests/security/contentSecurityPolicy/report-status-code-zero-when-using-https.html
1006
1007         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1008         (WebKit::NetworkConnectionToWebProcess::loadPing):
1009         (WebKit::NetworkConnectionToWebProcess::removeLoadIdentifier):
1010         * NetworkProcess/PingLoad.h: Added.
1011         (WebKit::PingLoad::PingLoad):
1012         (WebKit::PingLoad::willPerformHTTPRedirection):
1013         (WebKit::PingLoad::didReceiveChallenge):
1014         (WebKit::PingLoad::didReceiveResponseNetworkSession):
1015         (WebKit::PingLoad::didReceiveData):
1016         (WebKit::PingLoad::didCompleteWithError):
1017         (WebKit::PingLoad::didBecomeDownload):
1018         (WebKit::PingLoad::didSendData):
1019         (WebKit::PingLoad::wasBlocked):
1020         (WebKit::PingLoad::cannotShowURL):
1021         (WebKit::PingLoad::timeoutTimerFired):
1022         (WebKit::PingLoad::~PingLoad):
1023         * WebKit2.xcodeproj/project.pbxproj:
1024
1025 2016-03-04  Timothy Hatcher  <timothy@apple.com>
1026
1027         Inform WebKit and WebCore if a page is controlled by automation.
1028
1029         https://bugs.webkit.org/show_bug.cgi?id=154991
1030         rdar://problem/24965784
1031
1032         Reviewed by Joseph Pecoraro.
1033
1034         * Shared/WebPageCreationParameters.cpp:
1035         (WebKit::WebPageCreationParameters::encode):
1036         (WebKit::WebPageCreationParameters::decode):
1037         * Shared/WebPageCreationParameters.h:
1038         * UIProcess/API/C/WKPage.cpp:
1039         (WKPageGetIsControlledByAutomation):
1040         (WKPageSetControlledByAutomation):
1041         * UIProcess/API/C/WKPagePrivate.h:
1042         * UIProcess/WebPageProxy.cpp:
1043         (WebKit::WebPageProxy::setControlledByAutomation):
1044         (WebKit::WebPageProxy::creationParameters):
1045         * UIProcess/WebPageProxy.h:
1046         (WebKit::WebPageProxy::isControlledByAutomation):
1047         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
1048         (WKBundlePageIsControlledByAutomation):
1049         * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
1050         * WebProcess/WebPage/WebPage.cpp:
1051         (WebKit::m_shouldDispatchFakeMouseMoveEvents):
1052         (WebKit::WebPage::isControlledByAutomation):
1053         (WebKit::WebPage::setControlledByAutomation):
1054         * WebProcess/WebPage/WebPage.h:
1055         * WebProcess/WebPage/WebPage.messages.in:
1056
1057 2016-03-03  Chris Dumez  <cdumez@apple.com>
1058
1059         Regression(r196770): Unable to use HipChat Mac app
1060         https://bugs.webkit.org/show_bug.cgi?id=154999
1061         <rdar://problem/24931959>
1062
1063         Reviewed by Darin Adler.
1064
1065         Have the NetworkProcess and the WebProcess pass the UIProcess bundle
1066         identifier to WebCore so that we can do app detection of applications
1067         using a WK2 WebView (such as HipChat).
1068
1069         * NetworkProcess/NetworkProcess.cpp:
1070         (WebKit::NetworkProcess::initializeNetworkProcess):
1071         * WebProcess/WebProcess.cpp:
1072         (WebKit::WebProcess::initializeWebProcess):
1073
1074 2016-03-03  Simon Fraser  <simon.fraser@apple.com>
1075
1076         Use larger tiles when possible to reduce per-tile painting overhead
1077         https://bugs.webkit.org/show_bug.cgi?id=154985
1078         rdar://problem/23635219
1079
1080         Reviewed by Tim Horton.
1081
1082         Do a bit of #include cleanup.
1083
1084         * Shared/mac/RemoteLayerBackingStore.mm:
1085         * WebProcess/WebPage/mac/PlatformCALayerRemote.h:
1086         * WebProcess/WebPage/mac/PlatformCALayerRemoteTiledBacking.cpp:
1087         * WebProcess/WebPage/mac/PlatformCALayerRemoteTiledBacking.h:
1088
1089 2016-03-03  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
1090
1091         Use std::make_unique<> when creating std::unique_ptr<>
1092         https://bugs.webkit.org/show_bug.cgi?id=154574
1093
1094         Reviewed by Darin Adler.
1095
1096         * NetworkProcess/cache/NetworkCacheStatistics.cpp:
1097         (WebKit::NetworkCache::Statistics::open):
1098         * NetworkProcess/cache/NetworkCacheStatistics.h:
1099         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1100         (WebKit::WebChromeClient::createColorChooser):
1101
1102 2016-03-03  Alex Christensen  <achristensen@webkit.org>
1103
1104         Move SPI to CFNetworkSPI.h
1105         https://bugs.webkit.org/show_bug.cgi?id=154992
1106
1107         Reviewed by Andy Estes.
1108
1109         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
1110         (WebKit::applyBasicAuthorizationHeader):
1111
1112 2016-03-03  Alex Christensen  <achristensen@webkit.org>
1113
1114         Use CredentialStorage with NetworkSession
1115         https://bugs.webkit.org/show_bug.cgi?id=154939
1116
1117         Reviewed by Darin Adler.
1118
1119         * config.h:
1120         Added compile-time flag to help us be able to keep track and remove this code when we can.
1121         * NetworkProcess/NetworkDataTask.h:
1122         (WebKit::NetworkDataTask::pendingDownloadLocation):
1123         * NetworkProcess/NetworkProcess.cpp:
1124         (WebKit::NetworkProcess::clearCachedCredentials):
1125         (WebKit::NetworkProcess::ensurePrivateBrowsingSession):
1126         * NetworkProcess/NetworkSession.h:
1127         (WebKit::NetworkSession::sessionID):
1128         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
1129         (WebKit::applyBasicAuthorizationHeader):
1130         (WebKit::NetworkDataTask::NetworkDataTask):
1131         Use a credential storage and preemptively apply basic authentication headers if we have credentials from the storage.
1132         This is analogous to code in ResourceHandle::createNSURLConnection.
1133         
1134         (WebKit::NetworkDataTask::didReceiveChallenge):
1135         Make this look more like ResourceHandle::didReceiveAuthenticationChallenge.
1136         The call to tryPasswordBasedAuthentication was moved from the delegate callback to here.
1137         
1138         (WebKit::NetworkDataTask::willPerformHTTPRedirection):
1139         Use credentials from the credential storage if they exist.  This is analogous to code in ResourceHandle::willSendRequest.
1140         
1141         (WebKit::NetworkDataTask::tryPasswordBasedAuthentication):
1142         Use credentials from the credential storage if they exist.  This is analogous to code in ResourceHandle::tryHandlePasswordBasedAuthentication.
1143         
1144         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1145         (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
1146         If we are given a credential with CredentialPersistenceForSession, put it in the credential storage and give 
1147         CFNetwork a credential with CredentialPersistenceNone so it won't automatically be used again until the credential
1148         storage says its ok to use again.  This gives us the ability to clear session credentials when logout credentials are used.
1149         This is analogous to code in ResourceHandle::receivedCredential.
1150         
1151         (WebKit::NetworkSession::defaultSession):
1152         (WebKit::NetworkSession::NetworkSession):
1153         (WebKit::NetworkSession::~NetworkSession):
1154         (WebKit::NetworkSession::dataTaskForIdentifier):
1155         (WebKit::NetworkSession::clearCredentials): Deleted.
1156         * WebProcess/WebProcess.cpp:
1157         (WebKit::WebProcess::clearCachedCredentials):
1158         (WebKit::WebProcess::focusedWebPage):
1159         We no longer need to clear credentials from the NSURLSessions because we don't store session credentials in them.
1160         Instead, calling CredentialStorage.clearCredentials is sufficient.
1161
1162 2016-03-03  Andy Estes  <aestes@apple.com>
1163
1164         Adopt CFNetwork storage partitioning SPI
1165         https://bugs.webkit.org/show_bug.cgi?id=154957
1166         rdar://problem/23614620
1167
1168         Reviewed by Darin Adler.
1169
1170         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
1171         (WebKit::NetworkDataTask::NetworkDataTask): Computed the storage partition identifier for the new session task.
1172         If non-empty, set it using a NSURLSessionTask SPI.
1173
1174 2016-03-03  Alex Christensen  <achristensen@webkit.org>
1175
1176         [WK2] testRunner.setPrivateBrowsingEnabled doesn't work with NetworkProcess
1177         https://bugs.webkit.org/show_bug.cgi?id=115274
1178
1179         Reviewed by Darin Adler.
1180
1181         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1182         (WebKit::NetworkConnectionToWebProcess::blobSize):
1183         (WebKit::NetworkConnectionToWebProcess::ensureLegacyPrivateBrowsingSession):
1184         * NetworkProcess/NetworkConnectionToWebProcess.h:
1185         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
1186         * NetworkProcess/NetworkProcess.h:
1187         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1188         (WebKit::InjectedBundle::setPrivateBrowsingEnabled):
1189         * WebProcess/WebProcess.cpp:
1190         (WebKit::WebProcess::destroyPrivateBrowsingSession):
1191         (WebKit::WebProcess::ensureLegacyPrivateBrowsingSessionInNetworkProcess):
1192         (WebKit::WebProcess::pluginProcessConnectionManager):
1193         * WebProcess/WebProcess.h:
1194
1195 2016-03-02  Alex Christensen  <achristensen@webkit.org>
1196
1197         Properly cancel downloads when using NetworkSession
1198         https://bugs.webkit.org/show_bug.cgi?id=154893
1199
1200         Reviewed by Brady Eidson.
1201
1202         * NetworkProcess/Downloads/Download.cpp:
1203         (WebKit::Download::Download):
1204         * NetworkProcess/Downloads/Download.h:
1205         * NetworkProcess/Downloads/cocoa/DownloadCocoa.mm:
1206         (WebKit::Download::cancel):
1207         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1208         (-[WKNetworkSessionDelegate URLSession:dataTask:didBecomeDownloadTask:]):
1209
1210 2016-03-01  Ada Chan  <adachan@apple.com>
1211
1212         Update the media element's presentation mode properly after going in and out of full screen via the Full Screen API
1213         https://bugs.webkit.org/show_bug.cgi?id=154834
1214
1215         Reviewed by Simon Fraser.
1216
1217         * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h:
1218         * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.messages.in:
1219         * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm:
1220         (WebKit::WebVideoFullscreenManagerProxy::exitFullscreenWithoutAnimationToMode):
1221         Call the new exitFullscreenWithoutAnimationToMode() method on WebVideoFullscreenInterfaceMac.
1222         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1223         (WebKit::WebChromeClient::exitVideoFullscreenToModeWithoutAnimation):
1224         * WebProcess/WebCoreSupport/WebChromeClient.h:
1225         * WebProcess/cocoa/WebVideoFullscreenManager.h:
1226         * WebProcess/cocoa/WebVideoFullscreenManager.mm:
1227         (WebKit::WebVideoFullscreenManager::exitVideoFullscreenToModeWithoutAnimation):
1228
1229 2016-03-02  Beth Dakin  <bdakin@apple.com>
1230
1231         Crashes in media tests after http://trac.webkit.org/changeset/197461
1232         https://bugs.webkit.org/show_bug.cgi?id=154933
1233
1234         Reviewed by Eric Carlson.
1235
1236         Since the controlsManagerInterface is not guaranteed to exist, it doesn't 
1237         make sense to return a reference. Return a pointer instead.
1238         * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h:
1239         * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm:
1240         (WebKit::WebVideoFullscreenManagerProxy::isVisible):
1241         (WebKit::WebVideoFullscreenManagerProxy::controlsManagerInterface):
1242         (WebKit::WebVideoFullscreenManagerProxy::fullscreenMayReturnToInline):
1243
1244 2016-03-02  Beth Dakin  <bdakin@apple.com>
1245
1246         Add support for playbackControlsManager
1247         https://bugs.webkit.org/show_bug.cgi?id=154742
1248         -and corresponding-
1249         rdar://problem/23833753
1250
1251         Reviewed by Jer Noble.
1252
1253         WebVideoFullscreenManagerProxy ensures the model and interface for the 
1254         UIProcess side of the playbackControlsManager. It also caches the 
1255         m_controlsManagerContextId so that it can return the 
1256         controlsManagerInterface.
1257         * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h:
1258         * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.messages.in:
1259         * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm:
1260         (WebKit::WebVideoFullscreenManagerProxy::setUpVideoControlsManagerWithID):
1261         (WebKit::WebVideoFullscreenManagerProxy::controlsManagerInterface):
1262
1263         Pipe isPlayingMediaDidChange() to WebViewImpl, and use that information to 
1264         update WebViewImplAdditions.
1265         * UIProcess/Cocoa/WebViewImpl.h:
1266         * UIProcess/Cocoa/WebViewImpl.mm:
1267         (WebKit::WebViewImpl::isPlayingMediaDidChange):
1268         * UIProcess/PageClient.h:
1269         * UIProcess/WebPageProxy.cpp:
1270         (WebKit::WebPageProxy::isPlayingMediaDidChange):
1271         (WebKit::WebPageProxy::isPlayingVideoWithAudio):
1272         * UIProcess/WebPageProxy.h:
1273         (WebKit::WebPageProxy::isPlayingAudio):
1274         * UIProcess/mac/PageClientImpl.h:
1275         * UIProcess/mac/PageClientImpl.mm:
1276         (WebKit::PageClientImpl::isPlayingMediaDidChange):
1277
1278         Pipe setUpVideoControlsManager to the WebVideoFullscreenManager.
1279         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1280         (WebKit::WebChromeClient::setUpVideoControlsManager):
1281         * WebProcess/WebCoreSupport/WebChromeClient.h:
1282
1283         Ensure the model an interface for the playbackControlsManager on the 
1284         WebProcess side and pass the message to the UIProcess to do the same.
1285         * WebProcess/cocoa/WebVideoFullscreenManager.h:
1286         * WebProcess/cocoa/WebVideoFullscreenManager.mm:
1287         (WebKit::WebVideoFullscreenManager::setUpVideoControlsManager):
1288
1289 2016-03-02  Carlos Garcia Campos  <cgarcia@igalia.com>
1290
1291         REGRESSION(r197409): [GTK] Web process always crashes on WebPage construction after r197409
1292         https://bugs.webkit.org/show_bug.cgi?id=154918
1293
1294         Reviewed by Žan Doberšek.
1295
1296         We have an incorrect check in DrawingAreaImpl constructor that has
1297         never actually worked because it uses the page settings before
1298         they were initialized. But that has been fixed in r197409 and now
1299         we are always forcing accelerated compositing mode incorrectly,
1300         because m_alwaysUseCompositing is set in the constructor and never
1301         changed again.
1302
1303         * WebProcess/WebPage/DrawingAreaImpl.cpp:
1304         (WebKit::DrawingAreaImpl::DrawingAreaImpl): Remove code to set
1305         settings and m_alwaysUseCompositing, since that should be done in
1306         updatePreferences().
1307         (WebKit::DrawingAreaImpl::updatePreferences): Update the settings
1308         accordingly and always update m_alwaysUseCompositing when AC is
1309         enabled and forced in the settings.
1310         * WebProcess/WebPage/WebPage.cpp:
1311         (WebKit::WebPage::WebPage): WebPage::updatePreferences() calls
1312         DrawingArea::updatePreferences(), but since r197409 it happens
1313         before the drawing area has been created. So, call
1314         DrawingArea::updatePreferences() in the constructor right after
1315         the main frame has been created, since
1316         DrawingArea::updatePreferences() uses the main frame.
1317
1318 2016-02-29  Ada Chan  <adachan@apple.com>
1319
1320         Adopt the new version of AVOutputDeviceMenuController's showMenuForRect method.
1321         https://bugs.webkit.org/show_bug.cgi?id=154823
1322
1323         Reviewed by Tim Horton.
1324
1325         * UIProcess/WebPageProxy.cpp:
1326         (WebKit::WebPageProxy::showPlaybackTargetPicker):
1327         (WebKit::WebPageProxy::customPlaybackActionSelected):
1328         * UIProcess/WebPageProxy.h:
1329         * UIProcess/WebPageProxy.messages.in:
1330         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1331         (WebKit::WebChromeClient::showPlaybackTargetPicker):
1332         * WebProcess/WebCoreSupport/WebChromeClient.h:
1333         * WebProcess/WebPage/WebPage.h:
1334         * WebProcess/WebPage/WebPage.messages.in:
1335         * WebProcess/WebPage/mac/WebPageMac.mm:
1336         (WebKit::WebPage::customPlaybackActionSelected):
1337
1338 2016-02-29  Brent Fulgham  <bfulgham@apple.com>
1339
1340         [WK2] Stub support for WebsiteDataTypeResourceLoadStatistics
1341         https://bugs.webkit.org/show_bug.cgi?id=154689
1342         <rdar://problem/24702576>
1343
1344         Reviewed by Sam Weinig.
1345
1346         * Shared/WebsiteData/WebsiteDataType.h: Add new WebsiteDataTypeResourceLoadStatistics.
1347         * UIProcess/API/Cocoa/WKWebsiteDataRecord.mm:
1348         (dataTypesToString): Handle new type.
1349         * UIProcess/API/Cocoa/WKWebsiteDataRecordInternal.h:
1350         (WebKit::toWebsiteDataTypes): Ditto.
1351         (WebKit::toWKWebsiteDataTypes): Ditto.
1352         * UIProcess/API/Cocoa/WKWebsiteDataRecordPrivate.h: Add new _WebsiteDataTypeResourceLoadStatistics.
1353
1354 2016-03-01  Alex Christensen  <achristensen@webkit.org>
1355
1356         Correctly keep track of NetworkDataTasks with and without credentials when using NetworkSession
1357         https://bugs.webkit.org/show_bug.cgi?id=154876
1358
1359         Reviewed by Brady Eidson.
1360
1361         I was seeing an assertion failure from ASSERT(!m_session.m_dataTaskMap.contains(taskIdentifier()))
1362         in the NetworkDataTask constructor sometimes.  This is because a task identifier is not enough information
1363         to uniquely find a NetworkDataTask in a NetworkSession since r196034 because there are two NSURLSessions
1364         in a NetworkSession, one with credentials and one without.  The assertion would fire in a case like if we
1365         made the first NetworkDataTask with credentials (taskIdentifier is 1) and the first NetworkDataTask 
1366         without credentials before the first NetworkDataTask with credentials was finished.  In that case, the 
1367         taskIdentifier would also be 1, which would conflict with the other taskIdentifier.  That taskIdentifier
1368         would uniquely identify the task in the correct NSURLSession, though, so the solution is to keep a map
1369         for each NSURLSession in the NetworkSession.
1370
1371         * NetworkProcess/NetworkDataTask.h:
1372         * NetworkProcess/NetworkSession.h:
1373         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
1374         (WebKit::NetworkDataTask::NetworkDataTask):
1375         (WebKit::NetworkDataTask::~NetworkDataTask):
1376         (WebKit::NetworkDataTask::suspend):
1377         (WebKit::serverTrustCredential):
1378         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1379         (-[WKNetworkSessionDelegate URLSession:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:]):
1380         (-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]):
1381         (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
1382         (-[WKNetworkSessionDelegate URLSession:task:didCompleteWithError:]):
1383         (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]):
1384         (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveData:]):
1385         (-[WKNetworkSessionDelegate URLSession:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:]):
1386         (-[WKNetworkSessionDelegate URLSession:dataTask:didBecomeDownloadTask:]):
1387         (WebKit::NetworkSession::clearCredentials):
1388         (WebKit::NetworkSession::dataTaskForIdentifier):
1389         (WebKit::NetworkSession::addDownloadID):
1390
1391 2016-03-01  Andreas Kling  <akling@apple.com>
1392
1393         REGRESSION (r154616): Accelerated drawing is off during the initial load
1394         <https://webkit.org/b/123812>
1395
1396         Reviewed by Tim Horton.
1397
1398         Load preferences before instantiating the first DrawingArea. This ensures that we do the
1399         initial paint using accelerated drawing, and avoids allocating persistent data structures
1400         only needed by the software rendering path.
1401
1402         * WebProcess/WebPage/WebPage.cpp:
1403
1404 2016-03-01  Alex Christensen  <achristensen@webkit.org>
1405
1406         Fix tests when using NetworkSession
1407         https://bugs.webkit.org/show_bug.cgi?id=154866
1408
1409         Reviewed by Brady Eidson.
1410
1411         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1412         (WebKit::globalCustomProtocolManager):
1413         (WebKit::NetworkSession::setCustomProtocolManager):
1414         
1415         Use a static NeverDestroyed instead of a local NeverDestroyed.
1416         This fix was suggested by Darin after I broke the custom protocol tests in r197362.
1417         
1418         (WebKit::NetworkSession::clearCredentials):
1419         
1420         In r197223 I added code that I thought cleared the credentials of a session, but it was
1421         actually trying (and failing) to remove the credentials from the NSURLCredentialStorage that
1422         were stored with NSURLCredentialPersistencePermanent.
1423         This was causing credentials stored in an NSURLSession with NSURLCredentialPersistenceForSession
1424         to remain for the next tests, and was causing credentials from previous tests, usually from
1425         http/tests/loading/basic-credentials-sent-automatically.html, to be used in future tests.
1426         Creating a new NSURLSession is the equivalent of CredentialStorage::clearCredentials because it
1427         removes all credentials stored with NSURLCredentialPersistenceForSession.
1428
1429 2016-03-01  Carlos Garcia Campos  <cgarcia@igalia.com>
1430
1431         NetworkCache: Web process leaks resource buffer when using shareable reasources
1432         https://bugs.webkit.org/show_bug.cgi?id=154852
1433
1434         Reviewed by Darin Adler.
1435
1436         ResourceLoader::didReceiveBuffer() expects a PassRefPtr, but we
1437         are passing a raw pointer making PassRefPtr to take another
1438         reference instead of transfering the ownership as expected.
1439
1440         * WebProcess/Network/WebResourceLoader.cpp:
1441         (WebKit::WebResourceLoader::didReceiveResource):
1442
1443 2016-02-29  Zan Dobersek  <zdobersek@igalia.com>
1444
1445         ThreadedCompositor: clean up composition-specific resources before shutting down the thread
1446         https://bugs.webkit.org/show_bug.cgi?id=154793
1447
1448         Reviewed by Carlos Garcia Campos.
1449
1450         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
1451         (WebKit::ThreadedCompositor::runCompositingThread): Before concluding the
1452         compositing thread run, clean up all the resources that were allocated at
1453         the start, and in the reverse order. Specifically, we now also deallocate
1454         the CoordinatedGraphicsScene and the SimpleViewportController objects. This
1455         way these are not deallocated on the main thread when the ThreadedCompositor
1456         destructor would otherwise clean them up.
1457
1458 2016-02-29  Zan Dobersek  <zdobersek@igalia.com>
1459
1460         ThreadSafeCoordinatedSurface: remove the unused private create() static method
1461         https://bugs.webkit.org/show_bug.cgi?id=154792
1462
1463         Reviewed by Carlos Garcia Campos.
1464
1465         Remove the static ThreadSafeCoordinatedSurface::create() method that accepted
1466         a std::unique_ptr<ImageBuffer> object as its third parameter. This was not used
1467         anywhere.
1468
1469         * Shared/CoordinatedGraphics/threadedcompositor/ThreadSafeCoordinatedSurface.cpp:
1470         (WebKit::ThreadSafeCoordinatedSurface::create): Deleted.
1471         * Shared/CoordinatedGraphics/threadedcompositor/ThreadSafeCoordinatedSurface.h:
1472
1473 2016-02-29  Simon Fraser  <simon.fraser@apple.com>
1474
1475         Remove the experimental feature of antialiased font dilation
1476         https://bugs.webkit.org/show_bug.cgi?id=154843
1477
1478         Reviewed by Zalan Bujtas.
1479
1480         Remove the "antialiased font dilation" code path, and related prefs.
1481
1482         * Shared/WebPreferencesDefinitions.h:
1483         * UIProcess/API/C/WKPreferences.cpp:
1484         (WKPreferencesSetAntialiasedFontDilationEnabled):
1485         (WKPreferencesGetAntialiasedFontDilationEnabled):
1486         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1487         * UIProcess/API/Cocoa/WKPreferences.mm:
1488         (-[WKPreferences _antialiasedFontDilationEnabled]): Deleted.
1489         (-[WKPreferences _setAntialiasedFontDilationEnabled:]): Deleted.
1490         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
1491         * WebProcess/WebPage/WebPage.cpp:
1492         (WebKit::WebPage::updatePreferences): Deleted.
1493
1494 2016-02-29  Brady Eidson  <beidson@apple.com>
1495
1496         Modern IDB: WebKit 2 IPC layer easily confused about multiple web processes being connected.
1497         https://bugs.webkit.org/show_bug.cgi?id=154837
1498
1499         Reviewed by Alex Christensen.
1500
1501         The crux of the bug is that WebProcesses cannot assign themselves server-unique identifiers...
1502         The server must do that for them.
1503         
1504         A once-per-session-per-WebProcess sync message and a few updates to connection management fix this.
1505         
1506         * DatabaseProcess/DatabaseToWebProcessConnection.cpp:
1507         (WebKit::DatabaseToWebProcessConnection::didReceiveSyncMessage):
1508         (WebKit::generateConnectionToServerIdentifier):
1509         (WebKit::DatabaseToWebProcessConnection::establishIDBConnectionToServer):
1510         * DatabaseProcess/DatabaseToWebProcessConnection.h:
1511         * DatabaseProcess/DatabaseToWebProcessConnection.messages.in:
1512
1513         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
1514         (WebKit::WebIDBConnectionToServer::WebIDBConnectionToServer):
1515         (WebKit::generateConnectionToServerIdentifier): Deleted.
1516
1517         * WebProcess/Databases/WebToDatabaseProcessConnection.cpp:
1518         (WebKit::WebToDatabaseProcessConnection::didReceiveMessage):
1519         (WebKit::WebToDatabaseProcessConnection::idbConnectionToServerForSession):
1520         * WebProcess/Databases/WebToDatabaseProcessConnection.h:
1521
1522 2016-02-29  Alex Christensen  <achristensen@webkit.org>
1523
1524         Don't call NetworkProcess::singleton from WebProcess when using NetworkSession
1525         https://bugs.webkit.org/show_bug.cgi?id=154829
1526
1527         Reviewed by Anders Carlsson.
1528
1529         We were calling NetworkProcess::singleton when making the default session in the 
1530         WebProcess, which caused bad things to happen.  We also were never clearing the 
1531         credentials in the WebProcess between tests because it used to always call
1532         NetworkProcess::singleton, which caused flaky tests.
1533
1534         This fixes repeatable crashes in http/tests/media/media-document-referer.html and 
1535         http/tests/media/media-document.html when using NetworkSession.
1536
1537         * NetworkProcess/NetworkProcess.cpp:
1538         (WebKit::NetworkProcess::NetworkProcess):
1539         (WebKit::NetworkProcess::~NetworkProcess):
1540         * NetworkProcess/NetworkSession.h:
1541         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1542         (WebKit::configurationForType):
1543         (WebKit::globalCustomProtocolManager):
1544         (WebKit::NetworkSession::setCustomProtocolManager):
1545         (WebKit::NetworkSession::defaultSession):
1546         * WebProcess/WebProcess.cpp:
1547         (WebKit::WebProcess::clearCachedCredentials):
1548
1549 2016-02-29  Gavin Barraclough  <barraclough@apple.com>
1550
1551         RefCounter<T>::Event -> RefCounterEvent
1552         https://bugs.webkit.org/show_bug.cgi?id=154767
1553
1554         Reviewed by Darin Adler.
1555
1556         RefCounter<T>::Event is kinda verbose to use, and there is no need for this
1557         to be specific to a particular typeof RefCounter. Move the enum class up to
1558         the top level & rename to RefCounterEvent.
1559
1560         Also remove UserObservablePageToken - this is vestigial & not really offering
1561         anything over just using UserObservablePageCounter::Token directly.
1562
1563         * UIProcess/Plugins/PluginProcessManager.cpp:
1564         (WebKit::PluginProcessManager::PluginProcessManager):
1565         * UIProcess/Plugins/PluginProcessManager.h:
1566         * UIProcess/Plugins/mac/PluginProcessManagerMac.mm:
1567         (WebKit::PluginProcessManager::updateProcessSuppressionDisabled):
1568         * UIProcess/ProcessThrottler.cpp:
1569         (WebKit::ProcessThrottler::ProcessThrottler):
1570         (WebKit::m_backgroundCounter):
1571         (WebKit::m_suspendMessageCount):
1572         * UIProcess/ProcessThrottler.h:
1573         * UIProcess/WebPageProxy.h:
1574         * UIProcess/WebProcessPool.cpp:
1575         (WebKit::WebProcessPool::WebProcessPool):
1576         (WebKit::m_processSuppressionDisabledForPageCounter):
1577         (WebKit::m_hiddenPageThrottlingAutoIncreasesCounter):
1578         * UIProcess/WebProcessPool.h:
1579
1580 2016-02-29  Konstantin Tokarev  <annulen@yandex.ru>
1581
1582         Fixed compilation with !ENABLE(DATABASE_PROCESS).
1583         https://bugs.webkit.org/show_bug.cgi?id=154813
1584
1585         Reviewed by Michael Catanzaro.
1586
1587         * UIProcess/WebProcessPool.cpp:
1588         (WebKit::WebProcessPool::terminateDatabaseProcess): Added missing #if
1589         guard.
1590
1591 2016-02-29  Adrien Plazas  <aplazas@igalia.com>
1592
1593         [GTK] Touch slider test fails due to assertion in webkitWebViewBaseTouchEvent()
1594         https://bugs.webkit.org/show_bug.cgi?id=153829
1595
1596         Reviewed by Carlos Garcia Campos.
1597
1598         Once a touch event sequence is identified as a gesture, remove it
1599         from the list of handled touch events.
1600
1601         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
1602         (webkitWebViewBaseTouchEvent):
1603
1604 2016-02-29  Csaba Osztrogonác  <ossy@webkit.org>
1605
1606         [Mac][cmake] Unreviewed buildfix after r197177. Just for fun.
1607
1608         * PlatformMac.cmake:
1609
1610 2016-02-28  Sam Weinig  <sam@webkit.org>
1611
1612         Reimplement WKPageGroup in terms of WKUserContentController
1613         https://bugs.webkit.org/show_bug.cgi?id=154804
1614
1615         Reviewed by Dan Bernstein.
1616
1617         Instead of having both WebPageGroup and WebUserContentControllerProxy both keep track
1618         of user scripts and user stylesheets, give WebPageGroup a WebUserContentControllerProxy
1619         and let it take care of things. This allows us to remove a ton of duplicate code, and
1620         provides a convenient way for clients currently using PageGroup based user content insertion
1621         to start using UserContentController, since they can now be used at the same time.
1622
1623         When using WKPageConfigurationRef, the rule is:
1624             - If you don't set a WKUserContentControllerRef, the one from the WKPageGroupRef will be used.
1625             - If you do set a WKUserContentControllerRef, it will be used, and the one from the WKPageGroupRef
1626               will do nothing for that web view.
1627
1628         * DerivedSources.make:
1629         Remove WebPageGroupProxy. It no longer is a MessageReceiver.
1630
1631         * Shared/WebPageGroupData.cpp:
1632         (WebKit::WebPageGroupData::encode):
1633         (WebKit::WebPageGroupData::decode):
1634         * Shared/WebPageGroupData.h:
1635         Stop encoding/decoding user content, instead just encode the identifier to the UserContentController.
1636
1637         * UIProcess/API/C/WKPageGroup.cpp:
1638         (WKPageGroupGetUserContentController):
1639         * UIProcess/API/C/WKPageGroup.h:
1640         Add getter for the underlying WKUserContentControllerRef.
1641
1642         * UIProcess/API/cpp/WKRetainPtr.h:
1643         (WebKit::retainWK):
1644         Add retainWK() helper to match RetainPtr's retainPtr() helper.
1645
1646         * UIProcess/WebPageGroup.cpp:
1647         (WebKit::WebPageGroup::WebPageGroup):
1648         (WebKit::WebPageGroup::userContentController):
1649         (WebKit::WebPageGroup::addUserStyleSheet):
1650         (WebKit::WebPageGroup::addUserScript):
1651         (WebKit::WebPageGroup::removeAllUserStyleSheets):
1652         (WebKit::WebPageGroup::removeAllUserScripts):
1653         (WebKit::WebPageGroup::removeAllUserContent):
1654         (WebKit::WebPageGroup::addUserContentExtension):
1655         (WebKit::WebPageGroup::removeUserContentExtension):
1656         (WebKit::WebPageGroup::removeAllUserContentExtensions):
1657         * UIProcess/WebPageGroup.h:
1658         Pass through to the WebUserContentControllerProxy.
1659
1660         * UIProcess/WebPageProxy.cpp:
1661         (WebKit::WebPageProxy::WebPageProxy):
1662         (WebKit::WebPageProxy::finishInitializingWebPageAfterProcessLaunch):
1663         (WebKit::WebPageProxy::creationParameters):
1664         * UIProcess/WebPageProxy.h:
1665         WebPageProxies always have a WebUserContentControllerProxy now, so it can go in a Ref and
1666         a few branches can be removed.
1667
1668         * UIProcess/WebProcessPool.cpp:
1669         (WebKit::WebProcessPool::createWebPage):
1670         If a UserContentController is not passed in, use the one from the PageGroup.
1671
1672         * WebKit2.xcodeproj/project.pbxproj:
1673         Remove files.
1674
1675         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1676         Add some #includes that are now needed.
1677
1678         * WebProcess/UserContent/WebUserContentController.cpp:
1679         (WebKit::WebUserContentController::getOrCreate):
1680         * WebProcess/UserContent/WebUserContentController.h:
1681         Modernize WebUserContentController::getOrCreate to return a Ref.
1682
1683         * WebProcess/WebPage/WebPage.cpp:
1684         (WebKit::WebPage::WebPage):
1685         (WebKit::m_shouldDispatchFakeMouseMoveEvents):
1686         (WebKit::WebPage::addUserScript):
1687         (WebKit::WebPage::addUserStyleSheet):
1688         (WebKit::WebPage::removeAllUserContent):
1689         * WebProcess/WebPage/WebPage.h:
1690         Store the WebUserContentController in Ref, remove unnecessary branches/asserts.
1691
1692         * WebProcess/WebPage/WebPageGroupProxy.cpp:
1693         (WebKit::WebPageGroupProxy::WebPageGroupProxy):
1694         (WebKit::WebPageGroupProxy::~WebPageGroupProxy):
1695         (WebKit::WebPageGroupProxy::userContentController):
1696         (WebKit::WebPageGroupProxy::addUserStyleSheet): Deleted.
1697         (WebKit::WebPageGroupProxy::addUserScript): Deleted.
1698         (WebKit::WebPageGroupProxy::removeAllUserStyleSheets): Deleted.
1699         (WebKit::WebPageGroupProxy::removeAllUserScripts): Deleted.
1700         (WebKit::WebPageGroupProxy::removeAllUserContent): Deleted.
1701         (WebKit::WebPageGroupProxy::addUserContentExtension): Deleted.
1702         (WebKit::WebPageGroupProxy::removeUserContentExtension): Deleted.
1703         (WebKit::WebPageGroupProxy::removeAllUserContentExtensions): Deleted.
1704         * WebProcess/WebPage/WebPageGroupProxy.h:
1705         Store a WebUserContentController in a Ref, remove now unnecessary message handling functions.
1706
1707         * WebProcess/WebPage/WebPageGroupProxy.messages.in:
1708         Removed.
1709
1710         * WebProcess/WebProcess.cpp:
1711         (WebKit::WebProcess::didReceiveMessage):
1712         Remove routing to WebPageGroupProxy, which is no longer a MessageReceiver.
1713
1714 2016-02-28  Sam Weinig  <sam@webkit.org>
1715
1716         Bind _WKUserStyleSheets to _WKUserContentWorlds to allow for grouping of user content by associating to a world
1717         https://bugs.webkit.org/show_bug.cgi?id=154798
1718
1719         Reviewed by Dan Bernstein.
1720
1721         Treat _WKUserStyleSheets like WKUserScripts and allow them to be bound to a _WKUserContentWorld.
1722         The immediate benefit of this is allowing a client to bind a set of user content (scripts and stylesheets
1723         for now) to a world and have them easily remove all user content associated with that world easily.
1724
1725         * Shared/API/APIArray.h:
1726         Add helpers removeAllMatching and removeAllOfTypeMatching.
1727
1728         * UIProcess/API/APIUserStyleSheet.h:
1729         Add API::UserContentWorld member.
1730
1731         * UIProcess/API/Cocoa/WKUserContentController.mm:
1732         (-[WKUserContentController _removeAllUserScriptsAssociatedWithUserContentWorld:]):
1733         (-[WKUserContentController _removeAllUserStyleSheetsAssociatedWithUserContentWorld:]):
1734         * UIProcess/API/Cocoa/WKUserContentControllerPrivate.h:
1735         Add _removeAllUserScriptsAssociatedWithUserContentWorld and _removeAllUserStyleSheetsAssociatedWithUserContentWorld.
1736
1737         * UIProcess/API/Cocoa/WKUserScript.mm:
1738         (-[WKUserScript _initWithSource:injectionTime:forMainFrameOnly:legacyWhitelist:legacyBlacklist:userContentWorld:]):
1739         (toStringVector): Deleted.
1740         * UIProcess/API/Cocoa/_WKUserContentWorldInternal.h:
1741         (API::toStringVector):
1742         Move toStringVector to a location where it can be shared.
1743
1744         * UIProcess/API/Cocoa/_WKUserStyleSheet.h:
1745         * UIProcess/API/Cocoa/_WKUserStyleSheet.mm:
1746         (-[_WKUserStyleSheet initWithSource:forMainFrameOnly:legacyWhitelist:legacyBlacklist:userContentWorld:]):
1747         Add new initializer which has a world to be bound to. While here, match WKUserScript and add support for the 
1748         legacy whitelist and blacklists.
1749
1750         * UIProcess/UserContent/WebUserContentControllerProxy.cpp:
1751         (WebKit::WebUserContentControllerProxy::addProcess):
1752         (WebKit::WebUserContentControllerProxy::removeProcess):
1753         (WebKit::WebUserContentControllerProxy::addUserContentWorldUse):
1754         (WebKit::WebUserContentControllerProxy::shouldSendRemoveUserContentWorldsMessage):
1755         (WebKit::WebUserContentControllerProxy::removeUserContentWorldUses):
1756         (WebKit::WebUserContentControllerProxy::addUserScript):
1757         (WebKit::WebUserContentControllerProxy::removeUserScript):
1758         (WebKit::WebUserContentControllerProxy::removeAllUserScripts):
1759         (WebKit::WebUserContentControllerProxy::addUserStyleSheet):
1760         (WebKit::WebUserContentControllerProxy::removeUserStyleSheet):
1761         (WebKit::WebUserContentControllerProxy::removeAllUserStyleSheets):
1762         * UIProcess/UserContent/WebUserContentControllerProxy.h:
1763         Refactor to share the code which decides whether to send AddUserContentWorlds/RemoveUserContentWorlds
1764         messages.
1765
1766         * WebProcess/UserContent/WebUserContentController.cpp:
1767         (WebKit::WebUserContentController::addUserContentWorlds):
1768         (WebKit::WebUserContentController::removeUserContentWorlds):
1769         (WebKit::WebUserContentController::addUserScripts):
1770         (WebKit::WebUserContentController::removeUserScript):
1771         (WebKit::WebUserContentController::removeAllUserScripts):
1772         (WebKit::WebUserContentController::addUserStyleSheets):
1773         (WebKit::WebUserContentController::removeUserStyleSheet):
1774         (WebKit::WebUserContentController::removeAllUserStyleSheets):
1775         * WebProcess/UserContent/WebUserContentController.h:
1776         * WebProcess/UserContent/WebUserContentController.messages.in:
1777         Add support for binding stylesheets to worlds and allow removing all the scripts/stylesheets from a 
1778         set of worlds at once by passing Vectors of world identifiers in the remove messages.
1779
1780 2016-02-27  Commit Queue  <commit-queue@webkit.org>
1781
1782         Unreviewed, rolling out r197204, r197207, r197211, r197217,
1783         r197218, and r197219.
1784         https://bugs.webkit.org/show_bug.cgi?id=154780
1785
1786         Caused crashes in WebVideoFullscreenManagerProxy (Requested by
1787         ap on #webkit).
1788
1789         Reverted changesets:
1790
1791         "Add support for playbackControlsManager"
1792         https://bugs.webkit.org/show_bug.cgi?id=154742
1793         http://trac.webkit.org/changeset/197204
1794
1795         "Attempted build fix."
1796         http://trac.webkit.org/changeset/197207
1797
1798         "Attempted build fix."
1799         http://trac.webkit.org/changeset/197211
1800
1801         "Attempted 32-bit build fix."
1802         http://trac.webkit.org/changeset/197217
1803
1804         "Another 32-bit build fix."
1805         http://trac.webkit.org/changeset/197218
1806
1807         "32-bit!!!"
1808         http://trac.webkit.org/changeset/197219
1809
1810 2016-02-26  Carlos Garcia Campos  <cgarcia@igalia.com>
1811
1812         Unreviewed. Fix GTK+ clean build.
1813
1814         Add missing header include.
1815
1816         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
1817
1818 2016-02-26  Carlos Garcia Campos  <cgarcia@igalia.com>
1819
1820         Network cache: old pages returned by disk cache on history navigation after session is restored
1821         https://bugs.webkit.org/show_bug.cgi?id=153230
1822
1823         Reviewed by Chris Dumez.
1824
1825         Since r181734, the network cache never revalidates resources for
1826         history navigation. This is good for the memory cache, but in the
1827         case of disk cache, we might end up with outdated pages when
1828         restoring the session. When restoring the session happens because
1829         of an API request (we also restore the session when recovering
1830         from a web process crash), we should revalidate back forward list
1831         requests in the disk cache if needed. This will only happen the
1832         first time they are loaded after a session restore. After a web process
1833         crash, resources will be used uncondionally from the disk cache.
1834
1835         * WebProcess/WebPage/WebBackForwardListProxy.cpp:
1836         (WebKit::WebBackForwardListProxy::addItemFromUIProcess): Use Ref&&
1837         instead of PassRefPtr.
1838         * WebProcess/WebPage/WebBackForwardListProxy.h:
1839         * WebProcess/WebPage/WebPage.cpp:
1840         (WebKit::WePage::WebPage): Call restoreSessionInternal passing
1841         No as restoredByAPIRequest parameter.
1842         (WebKit::WebPage::restoreSessionInternal): Set restoredFromSession
1843         flag to the created HistoryItem if the item was restored from
1844         session by an API request.
1845         (WebKit::WebPage::restoreSession): Call restoreSessionInternal
1846         passing Yes as restoredByAPIRequest parameter.
1847         * WebProcess/WebPage/WebPage.h:
1848
1849 2016-02-26  Michael Catanzaro  <mcatanzaro@igalia.com>
1850
1851         Fix a typo.
1852
1853         Unreviewed. Shame I didn't notice in the previous commit.
1854
1855         * WebProcess/UserContent/WebUserContentController.cpp:
1856         (WebKit::WebUserContentController::removeUserContentWorld):
1857
1858 2016-02-26  Michael Catanzaro  <mcatanzaro@igalia.com>
1859
1860         Fix GTK and maybe EFL build after r197172.
1861
1862         Unreviewed.
1863
1864         * CMakeLists.txt:
1865         * UIProcess/API/gtk/WebKitUserContent.cpp:
1866         (_WebKitUserScript::_WebKitUserScript):
1867         * WebProcess/UserContent/WebUserContentController.cpp:
1868         (WebKit::WebUserContentController::removeUserContentWorld):
1869         (WebKit::WebUserContentController::addUserScripts):
1870         (WebKit::WebUserContentController::removeUserScript):
1871         (WebKit::WebUserContentController::removeAllUserScripts):
1872
1873 2016-02-26  Michael Catanzaro  <mcatanzaro@igalia.com>
1874
1875         [GTK] Fix order of parameters in gtkdoc for webkit_web_view_get_snapshot
1876
1877         Unreviewed.
1878
1879         * UIProcess/API/gtk/WebKitWebView.cpp:
1880
1881 2016-02-26  Brady Eidson  <beidson@apple.com>
1882
1883         Modern IDB: New database versions are never committed to SQLite.
1884         <rdar://problem/24860952> and https://bugs.webkit.org/show_bug.cgi?id=154741
1885         
1886         Modern IDB: If a database handle is not open, files are not actually deleted from disk
1887         https://bugs.webkit.org/show_bug.cgi?id=154756
1888
1889         Reviewed by Alex Christensen.
1890
1891         Add WK2 SPI to force termination of the database process.
1892
1893         * UIProcess/API/Cocoa/WKProcessPool.mm:
1894         (-[WKProcessPool _terminateDatabaseProcess]):
1895         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
1896         * UIProcess/WebProcessPool.cpp:
1897         (WebKit::WebProcessPool::terminateDatabaseProcess):
1898         * UIProcess/WebProcessPool.h:
1899
1900 2016-02-26  Alex Christensen  <achristensen@webkit.org>
1901
1902         Clear credentials and prevent unauthorized credential storage when using NetworkSession
1903         https://bugs.webkit.org/show_bug.cgi?id=154755
1904
1905         Reviewed by Brady Eidson.
1906
1907         Credentials from previous tests were being used sometimes, notably in 
1908         http/tests/misc/401-alternative-content.php when running multiple credential-based
1909         tests with the same WebKitTestRunner.
1910
1911         * NetworkProcess/NetworkDataTask.h:
1912         * NetworkProcess/NetworkProcess.cpp:
1913         (WebKit::NetworkProcess::clearCachedCredentials):
1914         (WebKit::NetworkProcess::ensurePrivateBrowsingSession):
1915         * NetworkProcess/NetworkSession.h:
1916         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
1917         (WebKit::NetworkDataTask::NetworkDataTask):
1918         (WebKit::NetworkDataTask::tryPasswordBasedAuthentication):
1919         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1920         (WebKit::NetworkSession::~NetworkSession):
1921         (WebKit::NetworkSession::clearCredentials):
1922         (WebKit::NetworkSession::dataTaskForIdentifier):
1923
1924 2016-02-26  Gavin Barraclough  <barraclough@apple.com>
1925
1926         Page TimerAlignmentIntervalIncrease mechanism should have upper limit
1927         https://bugs.webkit.org/show_bug.cgi?id=154744
1928
1929         Reviewed by Geoff Garen.
1930
1931         There would be diminishing returns from throttling timers in background pages infinitely.
1932         Add a heuristic to limit appropriately.
1933
1934         The flow of data here is WebPageProxy informs WebProcessPool of the number of pages
1935         participating in this mechanism, WebProcessPool computes an apropriate limit and pushes
1936         this out to the WebProcesses, which in turn update each of their pages.
1937
1938         * UIProcess/WebPageProxy.cpp:
1939         (WebKit::WebPageProxy::WebPageProxy):
1940             - Call updateHidenPageThrottingAutoIncreases on creation.
1941         (WebKit::WebPageProxy::updateHidenPageThrottingAutoIncreases):
1942             - If increasing timer throttling is enabled increment the counter on WebProcessPool.
1943         (WebKit::WebPageProxy::preferencesDidChange):
1944             - Call updateHidenPageThrottingAutoIncreases on preferences change.
1945         * UIProcess/WebPageProxy.h:
1946         * UIProcess/WebProcessPool.cpp:
1947         (WebKit::WebProcessPool::WebProcessPool):
1948             - initialize new RefCounter.
1949         (WebKit::WebProcessPool::updateHidenPageThrottingAutoIncreaseLimit):
1950             - When count of participating pages changes, update the limit.
1951         * UIProcess/WebProcessPool.h:
1952         * WebProcess/WebPage/WebPage.h:
1953         (WebKit::WebPage::setHiddenPageTimerThrottlingIncreaseLimit):
1954             - Propagate limit to WebCore::Page.
1955         * WebProcess/WebProcess.cpp:
1956         (WebKit::WebProcess::setHiddenPageTimerThrottlingIncreaseLimit):
1957             - Propagate limit to WebPages.
1958         * WebProcess/WebProcess.h:
1959         * WebProcess/WebProcess.messages.in:
1960             - Added new message.
1961
1962 2016-02-26  Beth Dakin  <bdakin@apple.com>
1963
1964         Attempted build fix.
1965
1966         * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm:
1967         (WebKit::WebVideoFullscreenManagerProxy::setUpVideoControlsManagerWithID):
1968         (WebKit::WebVideoFullscreenManagerProxy::resetMediaState):
1969
1970 2016-02-26  Anders Carlsson  <andersca@apple.com>
1971
1972         Fix Yosemite build.
1973
1974         * UIProcess/API/Cocoa/_WKWebsiteDataSize.mm:
1975         (-[_WKWebsiteDataSize sizeOfDataTypes:]):
1976
1977 2016-02-26  Beth Dakin  <bdakin@apple.com>
1978
1979         Add support for playbackControlsManager
1980         https://bugs.webkit.org/show_bug.cgi?id=154742
1981         -and corresponding-
1982         rdar://problem/23833753
1983
1984         Reviewed by Jer Noble.
1985
1986         WebVideoFullscreenManagerProxy ensures the model and interface for the 
1987         UIProcess side of the playbackControlsManager. It also caches the 
1988         m_controlsManagerContextId so that it can return the 
1989         controlsManagerInterface.
1990         * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h:
1991         * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.messages.in:
1992         * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm:
1993         (WebKit::WebVideoFullscreenManagerProxy::setUpVideoControlsManagerWithID):
1994         (WebKit::WebVideoFullscreenManagerProxy::controlsManagerInterface):
1995
1996         Pipe isPlayingMediaDidChange() to WebViewImpl, and use that information to 
1997         update WebViewImplAdditions.
1998         * UIProcess/Cocoa/WebViewImpl.h:
1999         * UIProcess/Cocoa/WebViewImpl.mm:
2000         (WebKit::WebViewImpl::isPlayingMediaDidChange):
2001         * UIProcess/PageClient.h:
2002         * UIProcess/WebPageProxy.cpp:
2003         (WebKit::WebPageProxy::isPlayingMediaDidChange):
2004         (WebKit::WebPageProxy::isPlayingVideoWithAudio):
2005         * UIProcess/WebPageProxy.h:
2006         (WebKit::WebPageProxy::isPlayingAudio):
2007         * UIProcess/mac/PageClientImpl.h:
2008         * UIProcess/mac/PageClientImpl.mm:
2009         (WebKit::PageClientImpl::isPlayingMediaDidChange):
2010
2011         Pipe setUpVideoControlsManager to the WebVideoFullscreenManager.
2012         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2013         (WebKit::WebChromeClient::setUpVideoControlsManager):
2014         * WebProcess/WebCoreSupport/WebChromeClient.h:
2015
2016         Ensure the model an interface for the playbackControlsManager on the 
2017         WebProcess side and pass the message to the UIProcess to do the same.
2018         * WebProcess/cocoa/WebVideoFullscreenManager.h:
2019         * WebProcess/cocoa/WebVideoFullscreenManager.mm:
2020         (WebKit::WebVideoFullscreenManager::setUpVideoControlsManager):
2021
2022 2016-02-26  Anders Carlsson  <andersca@apple.com>
2023
2024         WKWebsiteDataStore/WKWebsiteDataRecord needs to provide size information about each type of data
2025         https://bugs.webkit.org/show_bug.cgi?id=154750
2026
2027         Reviewed by Tim Horton.
2028
2029         * DatabaseProcess/DatabaseProcess.cpp:
2030         (WebKit::DatabaseProcess::fetchWebsiteData):
2031         WebsiteData::Entry now takes a size.
2032
2033         * NetworkProcess/NetworkProcess.cpp:
2034         (WebKit::fetchDiskCacheEntries):
2035         If necessary, compute sizes.
2036
2037         (WebKit::NetworkProcess::fetchWebsiteData):
2038         Just pass 0 for the CF cache for now.
2039
2040         * NetworkProcess/NetworkProcess.h:
2041         * NetworkProcess/NetworkProcess.messages.in:
2042         FetchWebsiteData now takes a OptionSet<WebsiteDataFetchOption>.
2043
2044         * Shared/WebsiteData/WebsiteData.cpp:
2045         (WebKit::WebsiteData::Entry::encode):
2046         (WebKit::WebsiteData::Entry::decode):
2047         Encode and decode the size.
2048
2049         * Shared/WebsiteData/WebsiteData.h:
2050         Add size.
2051
2052         * Shared/WebsiteData/WebsiteDataFetchOption.h:
2053         Add new enum.
2054
2055         * UIProcess/API/C/WKApplicationCacheManager.cpp:
2056         (WKApplicationCacheManagerGetApplicationCacheOrigins):
2057         Pass an empty OptionSet<WebsiteDataFetchOption>.
2058
2059         * UIProcess/API/C/WKResourceCacheManager.cpp:
2060         (WKResourceCacheManagerGetCacheOrigins):
2061         Pass an empty OptionSet<WebsiteDataFetchOption>.
2062
2063         * UIProcess/API/Cocoa/WKWebsiteDataRecord.mm:
2064         (-[WKWebsiteDataRecord description]):
2065         If we have a size, print it out as well.
2066
2067         (-[WKWebsiteDataRecord _dataSize]):
2068         Return a size if we have one.
2069
2070         * UIProcess/API/Cocoa/WKWebsiteDataRecordPrivate.h:
2071         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
2072         (-[WKWebsiteDataStore fetchDataRecordsOfTypes:completionHandler:]):
2073         Call through to the SPI.
2074
2075         (-[WKWebsiteDataStore _fetchDataRecordsOfTypes:withOptions:completionHandler:]):
2076         Compute the right options.
2077
2078         * UIProcess/API/Cocoa/WKWebsiteDataStoreInternal.h:
2079         Import WKWebsiteDataStorePrivate.h.
2080
2081         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
2082         Add SPI.
2083
2084         * UIProcess/API/Cocoa/_WKWebsiteDataSize.h:
2085         * UIProcess/API/Cocoa/_WKWebsiteDataSize.mm:
2086         (-[_WKWebsiteDataSize initWithSize:]):
2087         (-[_WKWebsiteDataSize totalSize]):
2088         (-[_WKWebsiteDataSize sizeOfDataTypes:]):
2089         Add _WKWebsiteDataSize header.
2090
2091         * UIProcess/API/Cocoa/_WKWebsiteDataSizeInternal.h: Add IPI header.
2092
2093         * UIProcess/Network/NetworkProcessProxy.cpp:
2094         (WebKit::NetworkProcessProxy::fetchWebsiteData):
2095         This now takes a OptionSet<WebsiteDataFetchOption>.
2096
2097         * UIProcess/Network/NetworkProcessProxy.h:
2098         Update members.
2099
2100         * UIProcess/WebsiteData/WebsiteDataRecord.h:
2101         Add a hash map from types to sizes.
2102
2103         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2104         (WebKit::WebsiteDataStore::fetchData):
2105         This now takes a OptionSet<WebsiteDataFetchOption>.
2106
2107         * UIProcess/WebsiteData/WebsiteDataStore.h:
2108         Update member functions.
2109
2110         * WebKit2.xcodeproj/project.pbxproj:
2111         Add new files.
2112
2113         * WebProcess/WebProcess.cpp:
2114         (WebKit::WebProcess::fetchWebsiteData):
2115         This now takes a OptionSet<WebsiteDataFetchOption>.
2116
2117 2016-02-26  Anders Carlsson  <andersca@apple.com>
2118
2119         Add a toWebsiteDataType and reimplement toWebsiteDataTypes using it
2120         https://bugs.webkit.org/show_bug.cgi?id=154746
2121
2122         Reviewed by Sam Weinig.
2123
2124         * UIProcess/API/Cocoa/WKWebsiteDataRecordInternal.h:
2125         (WebKit::toWebsiteDataType):
2126         (WebKit::toWebsiteDataTypes):
2127         (WebKit::toWKWebsiteDataTypes):
2128
2129 2016-02-26  Anders Carlsson  <andersca@apple.com>
2130
2131         Add WTF::OptionSet and use it for the website data types enum
2132         https://bugs.webkit.org/show_bug.cgi?id=154733
2133
2134         Reviewed by Geoffrey Garen.
2135
2136         This is a pretty mechanical change:
2137         
2138         Convert all uses of the WebsiteDataTypes enum to WTF::OptionSet. Rename the WebsiteDataTypes enum to
2139         WebsiteDataType (since it only represents a single data type), and rename headers. Encode and decode WTF::OptionSet properly.
2140
2141         * DatabaseProcess/DatabaseProcess.cpp:
2142         (WebKit::DatabaseProcess::fetchWebsiteData):
2143         (WebKit::DatabaseProcess::deleteWebsiteData):
2144         (WebKit::DatabaseProcess::deleteWebsiteDataForOrigins):
2145         * DatabaseProcess/DatabaseProcess.h:
2146         * DatabaseProcess/DatabaseProcess.messages.in:
2147         * NetworkProcess/NetworkProcess.cpp:
2148         (WebKit::fetchDiskCacheEntries):
2149         (WebKit::NetworkProcess::fetchWebsiteData):
2150         (WebKit::NetworkProcess::deleteWebsiteData):
2151         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
2152         * NetworkProcess/NetworkProcess.h:
2153         * NetworkProcess/NetworkProcess.messages.in:
2154         * Platform/IPC/ArgumentCoders.h:
2155         (IPC::ArgumentCoder<OptionSet<T>>::encode):
2156         (IPC::ArgumentCoder<OptionSet<T>>::decode):
2157         * Scripts/webkit/messages.py:
2158         (class_template_headers):
2159         * Shared/WebsiteData/WebsiteData.h:
2160         * Shared/WebsiteData/WebsiteDataType.h: Renamed from Source/WebKit2/Shared/WebsiteData/WebsiteDataTypes.h.
2161         * UIProcess/API/C/WKApplicationCacheManager.cpp:
2162         (WKApplicationCacheManagerGetApplicationCacheOrigins):
2163         (WKApplicationCacheManagerDeleteEntriesForOrigin):
2164         (WKApplicationCacheManagerDeleteAllEntries):
2165         * UIProcess/API/C/WKResourceCacheManager.cpp:
2166         (toWebsiteDataTypes):
2167         (WKResourceCacheManagerClearCacheForOrigin):
2168         * UIProcess/API/Cocoa/WKWebsiteDataRecordInternal.h:
2169         (WebKit::toWebsiteDataTypes):
2170         (WebKit::toWKWebsiteDataTypes):
2171         * UIProcess/Databases/DatabaseProcessProxy.cpp:
2172         (WebKit::DatabaseProcessProxy::fetchWebsiteData):
2173         (WebKit::DatabaseProcessProxy::deleteWebsiteData):
2174         (WebKit::DatabaseProcessProxy::deleteWebsiteDataForOrigins):
2175         * UIProcess/Databases/DatabaseProcessProxy.h:
2176         * UIProcess/Network/NetworkProcessProxy.cpp:
2177         (WebKit::NetworkProcessProxy::fetchWebsiteData):
2178         (WebKit::NetworkProcessProxy::deleteWebsiteData):
2179         (WebKit::NetworkProcessProxy::deleteWebsiteDataForOrigins):
2180         * UIProcess/Network/NetworkProcessProxy.h:
2181         * UIProcess/WebProcessProxy.cpp:
2182         (WebKit::WebProcessProxy::fetchWebsiteData):
2183         (WebKit::WebProcessProxy::deleteWebsiteData):
2184         (WebKit::WebProcessProxy::deleteWebsiteDataForOrigins):
2185         * UIProcess/WebProcessProxy.h:
2186         * UIProcess/WebsiteData/WebsiteDataRecord.cpp:
2187         (WebKit::WebsiteDataRecord::add):
2188         (WebKit::WebsiteDataRecord::addCookieHostName):
2189         (WebKit::WebsiteDataRecord::addPluginDataHostName):
2190         * UIProcess/WebsiteData/WebsiteDataRecord.h:
2191         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2192         (WebKit::computeNetworkProcessAccessTypeForDataFetch):
2193         (WebKit::computeWebProcessAccessTypeForDataFetch):
2194         (WebKit::WebsiteDataStore::fetchData):
2195         (WebKit::computeNetworkProcessAccessTypeForDataRemoval):
2196         (WebKit::computeWebProcessAccessTypeForDataRemoval):
2197         (WebKit::WebsiteDataStore::removeData):
2198         * UIProcess/WebsiteData/WebsiteDataStore.h:
2199         * WebKit2.xcodeproj/project.pbxproj:
2200         * WebProcess/WebProcess.cpp:
2201         (WebKit::WebProcess::fetchWebsiteData):
2202         (WebKit::WebProcess::deleteWebsiteData):
2203         (WebKit::WebProcess::deleteWebsiteDataForOrigins):
2204         * WebProcess/WebProcess.h:
2205         * WebProcess/WebProcess.messages.in:
2206
2207 2016-02-26  Sam Weinig  <sam@webkit.org>
2208
2209         Try to fix the Yosemite build again.
2210
2211         * UIProcess/API/Cocoa/WKUserScript.mm:
2212         (toStringVector):
2213         (-[WKUserScript _initWithSource:injectionTime:forMainFrameOnly:legacyWhitelist:legacyBlacklist:userContentWorld:]):
2214
2215 2016-02-26  Sam Weinig  <sam@webkit.org>
2216
2217         Try to fix the Yosemite build.
2218
2219         * UIProcess/API/Cocoa/WKUserScriptPrivate.h:
2220
2221 2016-02-25  Anders Carlsson  <andersca@apple.com>
2222
2223         Cache::traverse should pass the record info to its traversal handler
2224         https://bugs.webkit.org/show_bug.cgi?id=154695
2225
2226         Reviewed by Antti Koivisto.
2227
2228         * NetworkProcess/NetworkProcess.cpp:
2229         (WebKit::fetchDiskCacheEntries):
2230         (WebKit::clearDiskCacheEntries):
2231         * NetworkProcess/cache/NetworkCache.cpp:
2232         (WebKit::NetworkCache::Cache::traverse):
2233         * NetworkProcess/cache/NetworkCache.h:
2234
2235 2016-02-25  Gavin Barraclough  <barraclough@apple.com>
2236
2237         RefCounter value changed callback should be called on all changes (not just zero edge).
2238         https://bugs.webkit.org/show_bug.cgi?id=154699
2239
2240         Reviewed by Anders Carlsson.
2241
2242         RefCounter currently only triggers a callback when the count goes from zero
2243         to non-zero and vice-versa. Change that, to be useful to more clients.
2244
2245         * UIProcess/Plugins/PluginProcessManager.cpp:
2246         (WebKit::PluginProcessManager::PluginProcessManager):
2247             - Updated for change in RefCounter callback siganture.
2248         * UIProcess/Plugins/PluginProcessManager.h:
2249             - Updated for change in RefCounter callback siganture.
2250         * UIProcess/Plugins/mac/PluginProcessManagerMac.mm:
2251         (WebKit::PluginProcessManager::updateProcessSuppressionDisabled):
2252             - updated logic for enabling process supression.
2253         * UIProcess/ProcessThrottler.cpp:
2254         (WebKit::ProcessThrottler::ProcessThrottler):
2255             - Updated for change in RefCounter callback siganture.
2256         * UIProcess/WebProcessPool.cpp:
2257         (WebKit::WebProcessPool::WebProcessPool):
2258             - Updated for change in RefCounter callback siganture.
2259
2260 2016-02-26  Andreas Kling  <akling@apple.com>
2261
2262         Remove unused CFNetwork disk cache mmap optimization in WebKit2.
2263         <https://webkit.org/b/154727>
2264
2265         Reviewed by Darin Adler.
2266
2267         Nuke all the code related to the mmap optimization we had for CFNetwork's disk cache.
2268         This code has not been used since we moved to the WebKit2 network cache.
2269
2270         * NetworkProcess/Downloads/PendingDownload.h:
2271         * NetworkProcess/NetworkLoadClient.h:
2272         * NetworkProcess/NetworkResourceLoader.cpp:
2273         (WebKit::NetworkResourceLoader::sendBufferMaybeAborting): Deleted.
2274         * NetworkProcess/NetworkResourceLoader.h:
2275         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.h:
2276         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
2277         (WebKit::NetworkProcess::platformLowMemoryHandler): Deleted.
2278         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa): Deleted.
2279         * NetworkProcess/mac/NetworkDiskCacheMonitor.h: Removed.
2280         * NetworkProcess/mac/NetworkDiskCacheMonitor.mm: Removed.
2281         * NetworkProcess/mac/NetworkLoadMac.mm:
2282         (WebKit::NetworkLoad::willCacheResponseAsync): Deleted.
2283         * NetworkProcess/mac/NetworkResourceLoaderMac.mm: Removed.
2284         * WebKit2.xcodeproj/project.pbxproj:
2285
2286 2016-02-26  Commit Queue  <commit-queue@webkit.org>
2287
2288         Unreviewed, rolling out r197168.
2289         https://bugs.webkit.org/show_bug.cgi?id=154728
2290
2291         crashing on some devices (Requested by kling on #webkit).
2292
2293         Reverted changeset:
2294
2295         "[Darwin] Use vm_kernel_page_size for WTF::pageSize()."
2296         https://bugs.webkit.org/show_bug.cgi?id=154726
2297         http://trac.webkit.org/changeset/197168
2298
2299 2016-02-25  Sam Weinig  <sam@webkit.org>
2300
2301         Allow WKUserScripts to be run in isolated worlds
2302         https://bugs.webkit.org/show_bug.cgi?id=154701
2303
2304         Reviewed by Anders Carlsson.
2305
2306         Adds support for using isolated worlds, called _WKUserContentWorlds in the SPI,
2307         from the UIProcess.
2308
2309         * Shared/API/APIObject.h:
2310         * Shared/Cocoa/APIObject.mm:
2311         * UIProcess/API/APIUserContentWorld.cpp: Added.
2312         (API::generateIdentifier):
2313         (API::UserContentWorld::worldWithName):
2314         (API::UserContentWorld::normalWorld):
2315         (API::UserContentWorld::UserContentWorld):
2316         (API::UserContentWorld::~UserContentWorld):
2317         * UIProcess/API/APIUserContentWorld.h: Added.
2318         Add new UserContentWorld type.
2319
2320         * UIProcess/API/APIUserScript.h:
2321         Bind each user script to a particular _WKUserContentWorld.
2322
2323         * UIProcess/API/C/WKUserScriptRef.cpp:
2324         (WKUserScriptCreateWithSource):
2325         (WKUserScriptCopySource):
2326         Existing APIs create user scripts for the normal world, preserving existing behavior.
2327
2328         * UIProcess/API/Cocoa/WKUserScript.mm:
2329         (-[WKUserScript initWithSource:injectionTime:forMainFrameOnly:]):
2330         Existing APIs create user scripts for the normal world, preserving existing behavior.
2331
2332         (-[WKUserScript _initWithSource:injectionTime:forMainFrameOnly:legacyWhitelist:legacyBlacklist:userContentWorld:]):
2333         Add a new initializer which takes a world to bind to.  Also add support for the legacy whitelist/blacklist mechanism
2334         while we are here, as the expected client needs these as well.
2335
2336         (-[WKUserScript _userContentWorld]):
2337         Add accessor for the bound world.
2338
2339         * UIProcess/API/Cocoa/WKUserScriptInternal.h:
2340         * UIProcess/API/Cocoa/WKUserScriptPrivate.h: Added.
2341         Add new private header.
2342
2343         * UIProcess/API/Cocoa/_WKUserContentWorld.h: Added.
2344         * UIProcess/API/Cocoa/_WKUserContentWorld.mm: Added.
2345         (+[_WKUserContentWorld worldWithName:]):
2346         (+[_WKUserContentWorld normalWorld]):
2347         (-[_WKUserContentWorld dealloc]):
2348         (-[_WKUserContentWorld name]):
2349         (-[_WKUserContentWorld _apiObject]):
2350         * UIProcess/API/Cocoa/_WKUserContentWorldInternal.h: Added.
2351         Add SPI wrapper.
2352
2353         * UIProcess/UserContent/WebUserContentControllerProxy.cpp:
2354         (WebKit::WebUserContentControllerProxy::addProcess):
2355         (WebKit::WebUserContentControllerProxy::addUserScript):
2356         (WebKit::WebUserContentControllerProxy::removeUserScript):
2357         (WebKit::WebUserContentControllerProxy::removeAllUserScripts):
2358         (WebKit::WebUserContentControllerProxy::addUserStyleSheet):
2359         * UIProcess/UserContent/WebUserContentControllerProxy.h:
2360         (WebKit::WebUserContentControllerProxy::userScripts):
2361         (WebKit::WebUserContentControllerProxy::userStyleSheets):
2362         Add support for registering the worlds with the associated WebContentProcesses and then using
2363         their identifiers to map user scripts to the correct world.
2364         
2365         * WebKit2.xcodeproj/project.pbxproj:
2366         Add new files.
2367
2368         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInScriptWorld.h:
2369         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInScriptWorld.mm:
2370         (-[WKWebProcessPlugInScriptWorld name]):
2371         Expose the name property.
2372
2373         * WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.cpp:
2374         (WKBundleScriptWorldCopyName):
2375         * WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.h:
2376         Expose the name property.
2377
2378         * WebProcess/InjectedBundle/InjectedBundleScriptWorld.cpp:
2379         (WebKit::allWorlds):
2380         (WebKit::InjectedBundleScriptWorld::create):
2381         (WebKit::InjectedBundleScriptWorld::getOrCreate):
2382         (WebKit::InjectedBundleScriptWorld::normalWorld):
2383         (WebKit::InjectedBundleScriptWorld::InjectedBundleScriptWorld):
2384         (WebKit::InjectedBundleScriptWorld::~InjectedBundleScriptWorld):
2385         (WebKit::InjectedBundleScriptWorld::coreWorld):
2386         (WebKit::InjectedBundleScriptWorld::clearWrappers):
2387         * WebProcess/InjectedBundle/InjectedBundleScriptWorld.h:
2388         (WebKit::InjectedBundleScriptWorld::name):
2389         Add the name property and do some drive-by RefPtr -> Ref conversions.
2390
2391         * WebProcess/UserContent/WebUserContentController.cpp:
2392         (WebKit::userContentControllers):
2393         (WebKit::worldMap):
2394         (WebKit::WebUserContentController::getOrCreate):
2395         (WebKit::WebUserContentController::~WebUserContentController):
2396         (WebKit::WebUserContentController::addUserContentWorlds):
2397         (WebKit::WebUserContentController::removeUserContentWorld):
2398         (WebKit::WebUserContentController::addUserScripts):
2399         (WebKit::WebUserContentController::removeUserScript):
2400         (WebKit::WebUserContentController::removeAllUserScripts):
2401         (WebKit::WebUserContentController::addUserStyleSheets):
2402         * WebProcess/UserContent/WebUserContentController.h:
2403         * WebProcess/UserContent/WebUserContentController.messages.in:
2404         Track and use worlds passed from the UIProcess.
2405
2406 2016-02-26  Andreas Kling  <akling@apple.com>
2407
2408         [Darwin] Use vm_kernel_page_size for WTF::pageSize().
2409         <https://webkit.org/b/154726>
2410
2411         Reviewed by Antti Koivisto.
2412
2413         Use WTF::pageSize() for the SharedMemory page size.
2414
2415         * Platform/mac/SharedMemoryMac.cpp:
2416         (WebKit::SharedMemory::systemPageSize):
2417
2418 2016-02-25  Ryuan Choi  <ryuan.choi@navercorp.com>
2419
2420         [EFL] Remove WebUIPopupMenuClient
2421         https://bugs.webkit.org/show_bug.cgi?id=154717
2422
2423         Reviewed by Gyuyoung Kim.
2424
2425         WebUIPopupMenuClient is only for EFL to expose WebPopupMenuProxy and WebPopupItem to WK C APIs.
2426         This patch removes it and related code.
2427
2428         * PlatformEfl.cmake: Removed WKPopupItem related files from source list.
2429         * UIProcess/API/C/efl/WKAPICastEfl.h: Removed WKPopupMenu related code.
2430         * UIProcess/API/C/efl/WKPageEfl.cpp: Removed.
2431         * UIProcess/API/C/efl/WKPageEfl.h: Removed.
2432         * UIProcess/API/C/efl/WKPopupItem.cpp: Removed.
2433         * UIProcess/API/C/efl/WKPopupItem.h: Removed.
2434         * UIProcess/API/C/efl/WKPopupMenuListener.cpp: Removed.
2435         * UIProcess/API/C/efl/WKPopupMenuListener.h: Removed.
2436         * UIProcess/API/efl/EwkView.cpp:
2437         (EwkView::requestPopupMenu):
2438         * UIProcess/API/efl/EwkView.h:
2439         * UIProcess/API/efl/ewk_popup_menu.cpp:
2440         (EwkPopupMenu::EwkPopupMenu):
2441         (EwkPopupMenu::close):
2442         (EwkPopupMenu::setSelectedIndex):
2443         * UIProcess/API/efl/ewk_popup_menu_item.cpp: Used WebPopupItem and others instead of WK C APIs.
2444         * UIProcess/API/efl/ewk_popup_menu_item_private.h: Ditto.
2445         * UIProcess/API/efl/ewk_popup_menu_private.h:
2446         * UIProcess/WebPageProxy.cpp:
2447         (WebKit::WebPageProxy::close): Removed unnecessary EFL guards.
2448         (WebKit::WebPageProxy::showPopupMenu): Ditto.
2449         (WebKit::WebPageProxy::hidePopupMenu): Ditto.
2450         * UIProcess/WebPageProxy.h:
2451         * UIProcess/WebPopupMenuProxy.h:
2452         * UIProcess/efl/PageUIClientEfl.cpp: Removed WKPopupMenuListener related code.
2453         (WebKit::PageUIClientEfl::PageUIClientEfl): Deleted.
2454         (WebKit::PageUIClientEfl::showPopupMenu): Deleted.
2455         (WebKit::PageUIClientEfl::hidePopupMenu): Deleted.
2456         * UIProcess/efl/PageUIClientEfl.h:
2457         * UIProcess/efl/WebPageProxyEfl.cpp:
2458         (WebKit::WebPageProxy::initializeUIPopupMenuClient): Deleted.
2459         * UIProcess/efl/WebPopupMenuListenerEfl.cpp:
2460         (WebKit::WebPopupMenuListenerEfl::WebPopupMenuListenerEfl): Deleted.
2461         (WebKit::WebPopupMenuListenerEfl::valueChanged): Deleted.
2462         * UIProcess/efl/WebPopupMenuListenerEfl.h:
2463         (WebKit::WebPopupMenuListenerEfl::create): Deleted.
2464         * UIProcess/efl/WebPopupMenuProxyEfl.cpp: Used WebPopupItem and others instead of WK C APIs.
2465         * UIProcess/efl/WebPopupMenuProxyEfl.h: Ditto.
2466         (WebKit::WebPopupMenuProxyEfl::create):
2467         * UIProcess/efl/WebUIPopupMenuClient.cpp: Removed.
2468         * UIProcess/efl/WebUIPopupMenuClient.h: Removed.
2469         * UIProcess/efl/WebView.cpp:
2470         (WebKit::WebView::createPopupMenuProxy): Used WebPopupItem and others instead of WK C APIs.
2471
2472 2016-02-25  Andreas Kling  <akling@apple.com>
2473
2474         [iOS] Enable PageCache backing store clearing optimization for WebKit2.
2475         <https://webkit.org/b/154712>
2476
2477         Reviewed by Anders Carlsson.
2478
2479         We had an optimization for iOS where we'd tear down the compositing tree for
2480         pages in the page cache, to save memory, but we were only enabling it when
2481         instantiating a WebKit1 web view.
2482
2483         This patch enables the optimization for WebKit2 as well.
2484
2485         * WebProcess/WebProcess.cpp:
2486         (WebKit::WebProcess::WebProcess):
2487
2488 2016-02-25  Ada Chan  <adachan@apple.com>
2489
2490         Update the definition of ENABLE_VIDEO_PRESENTATION_MODE for Mac platform
2491         https://bugs.webkit.org/show_bug.cgi?id=154702
2492
2493         Reviewed by Dan Bernstein.
2494
2495         * Configurations/FeatureDefines.xcconfig:
2496
2497 2016-02-25  Jiewen Tan  <jiewen_tan@apple.com>
2498
2499         Restrict information passed with navigation action which is triggered by untrusted event
2500         https://bugs.webkit.org/show_bug.cgi?id=154571
2501         <rdar://problem/15967937>
2502
2503         Reviewed by Andy Estes.
2504
2505         When navigation action is triggered by an untrusted event, we should be more restricted of
2506         what information should be passed to the clients to lower the risk that clients could
2507         be fooled by the untrusted event.
2508
2509         In this patch, we drop the modifiers for key state events and set the mouse button to NoButton
2510         for mouse events.
2511
2512         * WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp:
2513         (WebKit::InjectedBundleNavigationAction::modifiersForNavigationAction):
2514
2515 2016-02-25  Ada Chan  <adachan@apple.com>
2516
2517         Hook up fullscreenMayReturnToInline() in WKPageUIClient
2518         https://bugs.webkit.org/show_bug.cgi?id=154661
2519
2520         Reviewed by Tim Horton.
2521
2522         * UIProcess/API/C/WKPage.cpp:
2523         (WKPageSetPageUIClient):
2524         * UIProcess/API/C/WKPageUIClient.h:
2525
2526 2016-02-25  Gavin Barraclough  <barraclough@apple.com>
2527
2528         Should template RefCounter instead of RefCounter::Token
2529         https://bugs.webkit.org/show_bug.cgi?id=154691
2530
2531         Reviewed by Anders Carlsson.
2532
2533         Mechanical update per RefCounter interface change.
2534
2535         * UIProcess/Plugins/PluginProcessManager.h:
2536         (WebKit::PluginProcessManager::processSuppressionDisabledToken):
2537         (WebKit::PluginProcessManager::processSuppressionDisabled):
2538         * UIProcess/ProcessThrottler.h:
2539         (WebKit::ProcessThrottler::foregroundActivityToken):
2540         (WebKit::ProcessThrottler::backgroundActivityToken):
2541         * UIProcess/WebProcessPool.h:
2542
2543 2016-02-25  Brady Eidson  <beidson@apple.com>
2544
2545         Remove LegacyIDB.
2546         https://bugs.webkit.org/show_bug.cgi?id=150854
2547
2548         Reviewed by Alex Christensen.
2549
2550         * CMakeLists.txt:
2551         * DatabaseProcess/DatabaseProcess.cpp:
2552         (WebKit::DatabaseProcess::getOrCreateLegacyUniqueIDBDatabase): Deleted.
2553         (WebKit::DatabaseProcess::removeLegacyUniqueIDBDatabase): Deleted.
2554         * DatabaseProcess/DatabaseProcess.h:
2555         * DatabaseProcess/DatabaseToWebProcessConnection.cpp:
2556         (WebKit::DatabaseToWebProcessConnection::didClose):
2557         (WebKit::DatabaseToWebProcessConnection::didReceiveMessage): Deleted.
2558         (WebKit::DatabaseToWebProcessConnection::didReceiveSyncMessage): Deleted.
2559         (WebKit::DatabaseToWebProcessConnection::establishIDBConnection): Deleted.
2560         (WebKit::DatabaseToWebProcessConnection::removeDatabaseProcessIDBConnection): Deleted.
2561         * DatabaseProcess/DatabaseToWebProcessConnection.h:
2562         * DatabaseProcess/DatabaseToWebProcessConnection.messages.in:
2563         * DatabaseProcess/IndexedDB/DatabaseProcessIDBConnection.cpp: Removed.
2564         * DatabaseProcess/IndexedDB/DatabaseProcessIDBConnection.h: Removed.
2565         * DatabaseProcess/IndexedDB/DatabaseProcessIDBConnection.messages.in: Removed.
2566         * DatabaseProcess/IndexedDB/IDBIdentifier.h: Removed.
2567         * DatabaseProcess/IndexedDB/IDBSerialization.cpp: Removed.
2568         * DatabaseProcess/IndexedDB/IDBSerialization.h: Removed.
2569         * DatabaseProcess/IndexedDB/LegacyUniqueIDBDatabase.cpp: Removed.
2570         * DatabaseProcess/IndexedDB/LegacyUniqueIDBDatabase.h: Removed.
2571         * DatabaseProcess/IndexedDB/LegacyUniqueIDBDatabaseIdentifier.cpp: Removed.
2572         * DatabaseProcess/IndexedDB/LegacyUniqueIDBDatabaseIdentifier.h: Removed.
2573         * DatabaseProcess/IndexedDB/UniqueIDBDatabaseBackingStore.h: Removed.
2574         * DatabaseProcess/IndexedDB/WebIDBConnectionToClient.h:
2575         * DatabaseProcess/IndexedDB/sqlite/SQLiteIDBCursor.cpp: Removed.
2576         * DatabaseProcess/IndexedDB/sqlite/SQLiteIDBCursor.h: Removed.
2577         * DatabaseProcess/IndexedDB/sqlite/SQLiteIDBTransaction.cpp: Removed.
2578         * DatabaseProcess/IndexedDB/sqlite/SQLiteIDBTransaction.h: Removed.
2579         * DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.cpp: Removed.
2580         * DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.h: Removed.
2581         * DerivedSources.make:
2582         * Shared/WebCrossThreadCopier.cpp:
2583         (WebCore::LegacyUniqueIDBDatabaseIdentifier>::copy): Deleted.
2584         (WebCore::IDBIdentifier>::copy): Deleted.
2585         * Shared/WebCrossThreadCopier.h:
2586         * WebKit2.xcodeproj/project.pbxproj:
2587         * WebProcess/Databases/IndexedDB/WebIDBFactoryBackend.cpp: Removed.
2588         * WebProcess/Databases/IndexedDB/WebIDBFactoryBackend.h: Removed.
2589         * WebProcess/Databases/IndexedDB/WebIDBServerConnection.cpp: Removed.
2590         * WebProcess/Databases/IndexedDB/WebIDBServerConnection.h: Removed.
2591         * WebProcess/Databases/IndexedDB/WebIDBServerConnection.messages.in: Removed.
2592         * WebProcess/Databases/WebDatabaseProvider.cpp:
2593         (WebKit::WebDatabaseProvider::createIDBFactoryBackend): Deleted.
2594         * WebProcess/Databases/WebDatabaseProvider.h:
2595         * WebProcess/Databases/WebToDatabaseProcessConnection.cpp:
2596         (WebKit::WebToDatabaseProcessConnection::didReceiveMessage): Deleted.
2597         (WebKit::WebToDatabaseProcessConnection::registerWebIDBServerConnection): Deleted.
2598         (WebKit::WebToDatabaseProcessConnection::removeWebIDBServerConnection): Deleted.
2599         * WebProcess/Databases/WebToDatabaseProcessConnection.h:
2600         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
2601
2602 2016-02-25  Brady Eidson  <beidson@apple.com>
2603
2604         Modern IDB: WebKit 2 IPC layer.
2605         https://bugs.webkit.org/show_bug.cgi?id=153808
2606
2607         Reviewed by Alex Christensen.
2608
2609         * NetworkProcess/NetworkLoad.cpp:
2610         (WebKit::NetworkLoad::NetworkLoad): This ASSERT fires on most WK2 tests. Alex said remove it.
2611         
2612         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
2613         (WebKit::WebIDBConnectionToServer::putOrAdd): Properly encode the overwrite flag.
2614         
2615         * WebProcess/Databases/WebDatabaseProvider.h: Enable Modern IDB.
2616
2617 2016-02-25  Eric Carlson  <eric.carlson@apple.com>
2618
2619         [MediaStream] MediaDeviceInfo deviceId and groupId must be unique to the page's origin
2620         https://bugs.webkit.org/show_bug.cgi?id=153163
2621         <rdar://problem/24334526>
2622
2623         Reviewed by Tim Horton.
2624
2625         * CMakeLists.txt: Add WKFrameHandleRef.cpp.
2626
2627         * Shared/API/c/WKBase.h: Add WKFrameHandleRef.
2628         * UIProcess/API/APIUIClient.h:
2629         (API::UIClient::decidePolicyForUserMediaPermissionRequest): Add parameter top level document
2630           security context.
2631         (API::UIClient::checkUserMediaPermissionForOrigin): Ditto.
2632
2633         * UIProcess/API/C/WKAPICast.h: Add FrameHandle.
2634
2635         * UIProcess/API/C/WKFrameHandleRef.cpp: Added.
2636         * UIProcess/API/C/WKFrameHandleRef.h: Added.
2637
2638         * UIProcess/API/C/WKFrameInfoRef.cpp:
2639         (WKFrameInfoGetFrameHandleRef): Added.
2640         * UIProcess/API/C/WKFrameInfoRef.h:
2641
2642         * UIProcess/API/C/WKPage.cpp:
2643         (WKPageSetPageUIClient): Add parameters to decidePolicyForUserMediaPermissionRequest and
2644           checkUserMediaPermissionForOrigin for top level document security context.
2645
2646         * UIProcess/API/C/WKPageUIClient.h: Ditto.
2647
2648         * UIProcess/API/C/WKUserMediaPermissionCheck.cpp:
2649         (WKUserMediaPermissionCheckSetUserMediaAccessInfo): Renamed from WKUserMediaPermissionCheckSetHasPersistentPermission,
2650           add parameter for top level document security context.
2651         (WKUserMediaPermissionCheckSetHasPersistentPermission): Deleted.
2652         * UIProcess/API/C/WKUserMediaPermissionCheck.h:
2653
2654         * UIProcess/API/gtk/WebKitUserMediaPermissionRequest.cpp:
2655         (webkitUserMediaPermissionRequestCreate): Add top level document origin.
2656
2657         * UIProcess/UserMediaPermissionCheckProxy.cpp:
2658         (WebKit::UserMediaPermissionCheckProxy::setUserMediaAccessInfo): Renamed from setHasPersistentPermission.
2659         (WebKit::UserMediaPermissionCheckProxy::setHasPersistentPermission): Deleted.
2660         * UIProcess/UserMediaPermissionCheckProxy.h:
2661
2662         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
2663         (WebKit::UserMediaPermissionRequestManagerProxy::didCompleteUserMediaPermissionCheck): Add parameter
2664          for device id hash salt.
2665         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
2666
2667         * UIProcess/UserMediaPermissionRequestProxy.h:
2668         (WebKit::UserMediaPermissionRequestProxy::requiresAudio): Deleted, unused.
2669         (WebKit::UserMediaPermissionRequestProxy::requiresVideo): Ditto.
2670         (WebKit::UserMediaPermissionRequestProxy::firstVideoDeviceUID): Ditto.
2671         (WebKit::UserMediaPermissionRequestProxy::firstAudioDeviceUID): Ditto.
2672
2673         * UIProcess/WebPageProxy.cpp:
2674         (WebKit::WebPageProxy::requestUserMediaPermissionForFrame): Pass through parameter for top
2675           level document security context.
2676         (WebKit::WebPageProxy::checkUserMediaPermissionForFrame): Ditto.
2677         * UIProcess/WebPageProxy.h:
2678         * UIProcess/WebPageProxy.messages.in:
2679
2680         * WebKit2.xcodeproj/project.pbxproj: Add WKFrameHandleRef.cpp|.h.
2681
2682         * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
2683         (WebKit::UserMediaPermissionRequestManager::startUserMediaRequest): Pass through parameter for top
2684           level document security context.
2685         (WebKit::UserMediaPermissionRequestManager::startUserMediaPermissionCheck): Ditto.
2686         (WebKit::UserMediaPermissionRequestManager::didCompleteUserMediaPermissionCheck): Pass through
2687           device id hash salt.
2688         * WebProcess/MediaStream/UserMediaPermissionRequestManager.h:
2689
2690         * WebProcess/WebPage/WebPage.cpp:
2691         (WebKit::WebPage::didCompleteUserMediaPermissionCheck): Ditto.
2692         * WebProcess/WebPage/WebPage.h:
2693         * WebProcess/WebPage/WebPage.messages.in:
2694
2695 2016-02-24  Carlos Garcia Campos  <cgarcia@igalia.com>
2696
2697         [GTK] Tearing when entering AC mode
2698         https://bugs.webkit.org/show_bug.cgi?id=150955
2699
2700         Reviewed by Michael Catanzaro.
2701
2702         When entering accelerated compositing mode, we keep rendering the
2703         non accelerated contents until we have the first frame of
2704         accelerated compositing contents. When the view is created hidden,
2705         for example when the browser opens a link in a new tab, the view
2706         is not realized until it is mapped. The native surface handle for
2707         compositing, needed by the web process to render accelerated
2708         compositing contents, is not available until the view is realized,
2709         because it depends on the properties of the parent. When a web
2710         view is mapped for the first time, and then realized, we send the
2711         native surface handle for compositing to the web process, and keep
2712         rendering the non composited contents until we get the first
2713         frame, but in this case we never had non composited contents and
2714         we end up rendering an untinitalized surface. This sometimes just
2715         produces flickering and sometimes rendering artifacts.
2716         We can prevent this from happening by realizing the web view as
2717         soon as possible. A GtkWidget can't be realized until it has been
2718         added to a toplevel, so we can realize our view right after it is
2719         added to a toplevel window, and wait until the view is actually
2720         mapped to notify the web process that it has been added to a
2721         window. This way can we enter accelerated compositing mode before
2722         the web view is mapped, so that when mapped we don't try to paint
2723         the previous contents and don't need to wait for the first frame.
2724
2725         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
2726         (toplevelWindowFocusInEvent): Handle the case of the window being
2727         hidden when receiving focus in. According to
2728         gtk_window_focus_in_event, this can happen.
2729         (webkitWebViewBaseSetToplevelOnScreenWindow): When the web view is
2730         removed from its toplevel parent, update the IsInWindow and
2731         WindowIsActive flags accordingly. When the view is added to a
2732         toplevel, realize it and don't update the window flags, they will be
2733         updated when the view is mapped the first time.
2734         (webkitWebViewBaseMap): Also update IsInWindow and WindowIsActive
2735         flags if needed. This way, if for example you open a youtube video
2736         in a new tab, the video won't start playing until you visit the
2737         tab, like we did when the view was realized on map.
2738         (webkitWebViewBaseHierarchyChanged): Use hierarchy-changed signal
2739         instead of parent-set to be notified when the view is added to or
2740         removed from a toplevel.
2741         (webkit_web_view_base_class_init): Implement hierarchy-changed
2742         instead of parent-set.
2743         (webkitWebViewBaseRealize): Do not call
2744         webkitWebViewBaseSetToplevelOnScreenWindow on realize, it's now
2745         webkitWebViewBaseSetToplevelOnScreenWindow the one realizing the view.
2746         * UIProcess/cairo/BackingStoreCairo.cpp:
2747         (WebKit::BackingStore::createBackend): Do not realize the view
2748         here, it should be realized already at this point. If it's not
2749         realized at this point is because it hasn't been added to a
2750         toplevel and gtk_widget_realize will not work anyway.
2751         (WebKit::BackingStore::paint): This is changing the cairo source
2752         operator, so save/restore the cairo context to ensure it doesn't
2753         affect other drawing done after this.
2754
2755 2016-02-24  Nikos Andronikos  <nikos.andronikos-webkit@cisra.canon.com.au>
2756
2757         [web-animations] Add AnimationTimeline, DocumentTimeline and add extensions to Document interface
2758         https://bugs.webkit.org/show_bug.cgi?id=151688
2759
2760         Reviewed by Dean Jackson.
2761
2762         Enables the WEB_ANIMATIONS compiler switch.
2763
2764         * Configurations/FeatureDefines.xcconfig:
2765
2766 2016-02-24  Gavin Barraclough  <barraclough@apple.com>
2767
2768         Add WKPreference for HiddenPageDOMTimerThrottlingAutoIncreases
2769         https://bugs.webkit.org/show_bug.cgi?id=154655
2770
2771         Reviewed by Geoff Garen.
2772
2773         Just plumbing WebCore.settings.setHiddenPageDOMTimerThrottlingAutoIncreases through as
2774         WKPreferencesSetHiddenPageDOMTimerThrottlingAutoIncreases.
2775
2776         * Shared/WebPreferencesDefinitions.h:
2777         * UIProcess/API/C/WKPreferences.cpp:
2778         (WKPreferencesSetHiddenPageDOMTimerThrottlingAutoIncreases):
2779         (WKPreferencesGetHiddenPageDOMTimerThrottlingAutoIncreases):
2780         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2781         * UIProcess/API/Cocoa/WKPreferences.mm:
2782         (-[WKPreferences _hiddenPageDOMTimerThrottlingAutoIncreases]):
2783         (-[WKPreferences _setHiddenPageDOMTimerThrottlingAutoIncreases:]):
2784         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
2785         * WebProcess/WebPage/WebPage.cpp:
2786         (WebKit::WebPage::updatePreferences):
2787
2788 2016-02-24  Alex Christensen  <achristensen@webkit.org>
2789
2790         Fix downloads when using NetworkSession
2791         https://bugs.webkit.org/show_bug.cgi?id=154620
2792
2793         Reviewed by Brady Eidson.
2794
2795         This fixes all the _WKDownload API tests when using NetworkSession.
2796
2797         * NetworkProcess/Downloads/DownloadManager.cpp:
2798         (WebKit::DownloadManager::willDecidePendingDownloadDestination):
2799         When we store the NetworkDataTask in m_downloadsWaitingForDestination, we want to remove its owner
2800         from m_pendingDownloads to prevent memory leaks.
2801         (WebKit::DownloadManager::continueDecidePendingDownloadDestination):
2802         If a file exists and the UIProcess has told us to overwrite the file, delete the file
2803         before starting a new download in its place.  This used to be done by CFNetwork in
2804         NSURLDownload's setDestination:allowOverwrite:, but the NSURLSession equivalent (setting
2805         NSURLSessionDataTask's _pathToDownloadTaskFile attribute) does not overwrite the file for us.
2806         (WebKit::DownloadManager::cancelDownload):
2807         If a download is canceled while it is waiting for its destination from the UIProcess, the Download
2808         object does not exist yet.  Instead, we have a completion handler stored in m_downloadsWaitingForDestination.
2809         In this case, we want to send the UIProcess a DownloadProxy::DidCancel message, which I did through
2810         NetworkProcess::pendingDownloadCanceled because the DownloadManager is not a MessageSender, and then
2811         call the completion handler with PolicyIgnore to cancel the download.
2812         (WebKit::DownloadManager::downloadFinished):
2813         * NetworkProcess/Downloads/DownloadManager.h:
2814         * NetworkProcess/Downloads/PendingDownload.cpp:
2815         (WebKit::PendingDownload::continueCanAuthenticateAgainstProtectionSpace):
2816         (WebKit::PendingDownload::didBecomeDownload):
2817         (WebKit::PendingDownload::didFailLoading):
2818         (WebKit::PendingDownload::messageSenderConnection):
2819         (WebKit::PendingDownload::didConvertToDownload): Deleted.
2820         * NetworkProcess/Downloads/PendingDownload.h:
2821         * NetworkProcess/Downloads/cocoa/DownloadCocoa.mm:
2822         (WebKit::Download::cancel):
2823         Send a didCancel message to the UIProcess when a download was cancelled.
2824         Use cancelByProducingResumeData so we can resume canceled downloads.
2825         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2826         (WebKit::NetworkConnectionToWebProcess::convertMainResourceLoadToDownload):
2827         didConvertToDownload is needed when using NetworkSession to tell the NetworkResourceLoader
2828         not to call cancel on the NetworkLoad after converting it to a download.
2829         * NetworkProcess/NetworkDataTask.h:
2830         (WebKit::NetworkDataTask::setPendingDownload):
2831         (WebKit::NetworkDataTask::pendingDownloadLocation):
2832         * NetworkProcess/NetworkLoad.cpp:
2833         (WebKit::NetworkLoad::convertTaskToDownload):
2834         (WebKit::NetworkLoad::setPendingDownloadID):
2835         (WebKit::NetworkLoad::didReceiveResponseNetworkSession):
2836         Don't call findPendingDownloadLocation as a method on the NetworkDataTask to avoid memory leaks
2837         in DownloadManager.m_pendingDownloads.
2838         (WebKit::NetworkLoad::didBecomeDownload):
2839         Call m_client.didBecomeDownload which is being separated from didConvertToDownload.  The former is
2840         called after the NetworkDataTask becomes a Download, the latter is called as soon as 
2841         convertMainResourceLoadToDownload is called.
2842         * NetworkProcess/NetworkLoadClient.h:
2843         * NetworkProcess/NetworkProcess.cpp:
2844         (WebKit::NetworkProcess::continueWillSendRequest):
2845         (WebKit::NetworkProcess::pendingDownloadCanceled):
2846         Send a DownloadProxy::DidCancel message when a pending download is canceled.
2847         (WebKit::NetworkProcess::findPendingDownloadLocation):
2848         (WebKit::NetworkProcess::continueDecidePendingDownloadDestination):
2849         * NetworkProcess/NetworkProcess.h:
2850         * NetworkProcess/NetworkProcess.messages.in:
2851         * NetworkProcess/NetworkResourceLoader.cpp:
2852         (WebKit::NetworkResourceLoader::didConvertToDownload):
2853         (WebKit::NetworkResourceLoader::didBecomeDownload):
2854         Separate setting m_didConvertToDownload, which needs to happen before the didReceiveResponse completion
2855         handler is called to tell the NetworkResourceLoader not to call cancel in NetworkResourceLoader::abort,
2856         from deleting the NetworkLoad, which can be done after the NSURLSessionDataTask has been converted to a
2857         NSURLSessionDownloadTask.
2858         * NetworkProcess/NetworkResourceLoader.h:
2859         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.h:
2860         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
2861         (WebKit::NetworkDataTask::failureTimerFired):
2862         (WebKit::NetworkDataTask::setPendingDownloadLocation):
2863         (WebKit::NetworkDataTask::transferSandboxExtensionToDownload):
2864         (WebKit::NetworkDataTask::suggestedFilename):
2865         (WebKit::NetworkDataTask::currentRequest):
2866         (WebKit::NetworkDataTask::findPendingDownloadLocation): Deleted.
2867         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2868         (-[WKNetworkSessionDelegate URLSession:task:didCompleteWithError:]):
2869         Take the downloadID if it failed because we will report that download as failed and not use it again.
2870         (WebKit::NetworkSession::takeDownloadID):
2871         * UIProcess/Downloads/DownloadProxy.cpp:
2872         (WebKit::DownloadProxy::decideDestinationWithSuggestedFilenameAsync):
2873         (WebKit::DownloadProxy::decideDestinationWithSuggestedFilename):
2874
2875 2016-02-24  Anders Carlsson  <andersca@apple.com>
2876
2877         Add more WebKitAdditions extension points
2878         https://bugs.webkit.org/show_bug.cgi?id=154648
2879         rdar://problem/24820040
2880
2881         Reviewed by Beth Dakin.
2882
2883         * Shared/WebPreferencesDefinitions.h:
2884         * UIProcess/API/Cocoa/WKWebView.mm:
2885         (-[WKWebView _initializeWithConfiguration:]):
2886         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2887         (-[WKWebViewConfiguration copyWithZone:]):
2888         * WebProcess/WebPage/WebPage.cpp:
2889         (WebKit::WebPage::updatePreferences):
2890
2891 2016-02-24  Ryosuke Niwa  <rniwa@webkit.org>
2892
2893         Move FocusNavigationScope into FocusController.cpp
2894         https://bugs.webkit.org/show_bug.cgi?id=154630
2895
2896         Reviewed by Darin Adler.
2897
2898         * WebProcess/WebPage/ios/WebPageIOS.mm:
2899         (WebKit::nextAssistableElement):
2900
2901 2016-02-23  Brian Burg  <bburg@apple.com>
2902
2903         Web Inspector: don't run the protocol generator once per output file
2904         https://bugs.webkit.org/show_bug.cgi?id=154635
2905
2906         Reviewed by Myles C. Maxfield.
2907
2908         * DerivedSources.make: Use $(firstword, ...) to take just one file as
2909         the target to be built so that the generator runs only once. Make isn't
2910         really designed to coalesce multiple file outputs to one production rule.
2911
2912 2016-02-23  Dan Bernstein  <mitz@apple.com>
2913
2914         [Xcode] Linker errors display mangled names, but no longer should
2915         https://bugs.webkit.org/show_bug.cgi?id=154632
2916
2917         Reviewed by Sam Weinig.
2918
2919         * Configurations/Base.xcconfig: Stop setting LINKER_DISPLAYS_MANGLED_NAMES to YES.
2920
2921 2016-02-23  Gavin Barraclough  <barraclough@apple.com>
2922
2923         Remove HIDDEN_PAGE_DOM_TIMER_THROTTLING feature define
2924         https://bugs.webkit.org/show_bug.cgi?id=112323
2925
2926         Reviewed by Chris Dumez.
2927
2928         This feature is controlled by a runtime switch, and defaults off.
2929
2930         * Configurations/FeatureDefines.xcconfig:
2931         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2932         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
2933         * WebProcess/WebPage/WebPage.cpp:
2934         (WebKit::WebPage::updatePreferences):
2935
2936 2016-02-23  Anders Carlsson  <andersca@apple.com>
2937
2938         WKWebView should implement NSCoding
2939         https://bugs.webkit.org/show_bug.cgi?id=137160
2940         rdar://problem/17380562
2941
2942         Reviewed by Dan Bernstein.
2943
2944         * UIProcess/API/Cocoa/WKUserContentController.mm:
2945         (-[WKUserContentController initWithCoder:]):
2946         We need to call [self init] here, so that the wrapper will be initialized.
2947
2948         * UIProcess/API/Cocoa/WKWebView.h:
2949         -initWithCoder: shouldn't be unavailable, it should be a designated initializer.
2950
2951         * UIProcess/API/Cocoa/WKWebView.mm:
2952         (-[WKWebView _initializeWithConfiguration:]):
2953         Move initialization out into a common method.
2954
2955         (-[WKWebView initWithFrame:configuration:]):
2956         Call -initializeWithConfiguration: here.
2957
2958         (-[WKWebView initWithCoder:]):
2959         Decode everything.
2960
2961         (-[WKWebView encodeWithCoder:]):
2962         Encode everything.
2963
2964 2016-02-23  Anders Carlsson  <andersca@apple.com>
2965
2966         Fix an API test.
2967
2968         * UIProcess/API/APIWebsiteDataStore.cpp:
2969         (API::WebsiteDataStore::defaultDataStore):
2970         Make sure to initialize WebKit2.
2971
2972 2016-02-23  Anders Carlsson  <andersca@apple.com>
2973
2974         WKWebViewConfiguration should encode more of its properties
2975         https://bugs.webkit.org/show_bug.cgi?id=154611
2976
2977         Reviewed by Sam Weinig.
2978
2979         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2980         (-[WKWebViewConfiguration encodeWithCoder:]):
2981         (-[WKWebViewConfiguration initWithCoder:]):
2982
2983 2016-02-23  Anders Carlsson  <andersca@apple.com>
2984
2985         WKUserContentController should conform to NSCoding
2986         https://bugs.webkit.org/show_bug.cgi?id=154609
2987
2988         Reviewed by Sam Weinig.
2989
2990         Since we just want to be able to encode WKUserContentController from WKWebViewConfiguration,
2991         we don't encode anything inside WKUserContentController.
2992
2993         * UIProcess/API/Cocoa/WKUserContentController.h:
2994         * UIProcess/API/Cocoa/WKUserContentController.mm:
2995         (-[WKUserContentController encodeWithCoder:]):
2996         (-[WKUserContentController initWithCoder:]):
2997
2998 2016-02-23  Anders Carlsson  <andersca@apple.com>
2999
3000         WKProcessPool should conform to NSCoding
3001         https://bugs.webkit.org/show_bug.cgi?id=154608
3002
3003         Reviewed by Sam Weinig.
3004
3005         Add +[WKProcessPool _sharedProcessPool] and encode/decode whether the process pool is shared.
3006
3007         * UIProcess/API/Cocoa/WKProcessPool.h:
3008         * UIProcess/API/Cocoa/WKProcessPool.mm:
3009         (-[WKProcessPool encodeWithCoder:]):
3010         (-[WKProcessPool initWithCoder:]):
3011         (+[WKProcessPool _sharedProcessPool]):
3012         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
3013
3014 2016-02-23  Anders Carlsson  <andersca@apple.com>
3015
3016         WKWebsiteDataStore should conform to NSCoding
3017         https://bugs.webkit.org/show_bug.cgi?id=154605
3018
3019         Reviewed by Dan Bernstein.
3020
3021         * UIProcess/API/Cocoa/WKWebsiteDataStore.h:
3022         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
3023         (-[WKWebsiteDataStore initWithCoder:]):
3024         (-[WKWebsiteDataStore encodeWithCoder:]):
3025
3026 2016-02-23  Anders Carlsson  <andersca@apple.com>
3027
3028         Fix iOS build.
3029
3030         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
3031         (-[WKWebViewConfiguration initWithCoder:]):
3032
3033 2016-02-23  Anders Carlsson  <andersca@apple.com>
3034
3035         WKWebViewConfiguration should conform to NSCoding
3036         https://bugs.webkit.org/show_bug.cgi?id=154602
3037
3038         Reviewed by Beth Dakin.
3039
3040         * UIProcess/API/Cocoa/WKWebViewConfiguration.h:
3041         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
3042         (-[WKWebViewConfiguration encodeWithCoder:]):
3043         (-[WKWebViewConfiguration initWithCoder:]):
3044
3045 2016-02-23  Anders Carlsson  <andersca@apple.com>
3046
3047         WKPreferences should conform to NSCoding
3048         https://bugs.webkit.org/show_bug.cgi?id=154597
3049
3050         Reviewed by Sam Weinig.
3051
3052         Add NSCoding implementation.
3053
3054         * UIProcess/API/Cocoa/WKPreferences.h:
3055         * UIProcess/API/Cocoa/WKPreferences.mm:
3056         (-[WKPreferences encodeWithCoder:]):
3057         (-[WKPreferences initWithCoder:]):
3058
3059 2016-02-23  Alex Christensen  <achristensen@webkit.org>
3060
3061         Implement downloads with NetworkSession
3062         https://bugs.webkit.org/show_bug.cgi?id=154473
3063
3064         Reviewed by Brady Eidson.
3065
3066         * NetworkProcess/Downloads/Download.cpp:
3067         (WebKit::Download::~Download):
3068         (WebKit::Download::didStart):
3069         (WebKit::Download::shouldDecodeSourceDataOfMIMEType):
3070         (WebKit::Download::decideDestinationWithSuggestedFilename):
3071         (WebKit::Download::didCreateDestination):
3072         * NetworkProcess/Downloads/Download.h:
3073         (WebKit::Download::downloadID):
3074         (WebKit::Download::setSandboxExtension):
3075         * NetworkProcess/Downloads/DownloadManager.cpp:
3076         (WebKit::DownloadManager::startDownload):
3077         (WebKit::DownloadManager::dataTaskBecameDownloadTask):
3078         (WebKit::DownloadManager::continueCanAuthenticateAgainstProtectionSpace):
3079         (WebKit::DownloadManager::continueWillSendRequest):
3080         (WebKit::DownloadManager::willDecidePendingDownloadDestination):
3081         (WebKit::DownloadManager::continueDecidePendingDownloadDestination):
3082         (WebKit::DownloadManager::convertHandleToDownload):
3083         * NetworkProcess/Downloads/DownloadManager.h:
3084         * NetworkProcess/NetworkDataTask.h:
3085         (WebKit::NetworkDataTask::clearClient):
3086
3087         NetworkDataTasks can now outlive their client, so we need to make client a pointer
3088         with the ability to be nulled from the client's destructor.
3089
3090         (WebKit::NetworkDataTask::pendingDownloadID):
3091         (WebKit::NetworkDataTask::pendingDownload):
3092         (WebKit::NetworkDataTask::setPendingDownload):
3093         (WebKit::NetworkDataTask::pendingDownloadLocation):
3094         (WebKit::NetworkDataTask::client): Deleted.
3095         * NetworkProcess/NetworkLoad.cpp:
3096         (WebKit::NetworkLoad::~NetworkLoad):
3097         (WebKit::NetworkLoad::convertTaskToDownload):
3098         (WebKit::NetworkLoad::setPendingDownloadID):
3099         (WebKit::NetworkLoad::didReceiveResponseNetworkSession):
3100
3101         Don't call the didReceiveResponse completion handler immediately when we know we are
3102         going to turn the load into a download.  Instead, save the completion handler until
3103         after we have determined the download destination and set it in the NetworkDataTask.
3104
3105         * NetworkProcess/NetworkProcess.cpp:
3106         (WebKit::NetworkProcess::continueWillSendRequest):
3107         (WebKit::NetworkProcess::findPendingDownloadLocation):
3108         (WebKit::NetworkProcess::continueDecidePendingDownloadDestination):
3109         (WebKit::NetworkProcess::setCacheModel):
3110         * NetworkProcess/NetworkProcess.h:
3111         * NetworkProcess/NetworkProcess.messages.in:
3112         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
3113         (WebKit::NetworkDataTask::NetworkDataTask):
3114         (WebKit::NetworkDataTask::~NetworkDataTask):
3115         (WebKit::NetworkDataTask::didSendData):
3116         (WebKit::NetworkDataTask::didReceiveChallenge):
3117         (WebKit::NetworkDataTask::didCompleteWithError):
3118         (WebKit::NetworkDataTask::didReceiveResponse):
3119         (WebKit::NetworkDataTask::didReceiveData):
3120         (WebKit::NetworkDataTask::didBecomeDownload):
3121         (WebKit::NetworkDataTask::willPerformHTTPRedirection):
3122         (WebKit::NetworkDataTask::scheduleFailure):
3123         (WebKit::NetworkDataTask::failureTimerFired):
3124         (WebKit::NetworkDataTask::findPendingDownloadLocation):
3125         (WebKit::NetworkDataTask::setPendingDownloadLocation):
3126         (WebKit::NetworkDataTask::tryPasswordBasedAuthentication):
3127         (WebKit::NetworkDataTask::transferSandboxExtensionToDownload):
3128         (WebKit::NetworkDataTask::currentRequest):
3129         (WebKit::NetworkDataTask::cancel):
3130         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3131         (-[WKNetworkSessionDelegate URLSession:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:]):
3132         (-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]):
3133         (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
3134         (-[WKNetworkSessionDelegate URLSession:task:didCompleteWithError:]):
3135         
3136         This delegate callback is used for downloads, too.
3137
3138         (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]):
3139         (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveData:]):
3140         (-[WKNetworkSessionDelegate URLSession:downloadTask:didFinishDownloadingToURL:]):
3141         (-[WKNetworkSessionDelegate URLSession:dataTask:didBecomeDownloadTask:]):
3142         
3143         Call didCreateDestination now, which is after the file has been opened on the disk.
3144         A DownloadProxy::DidStart message is now sent from NetworkProcess::findPendingDownloadLocation before
3145         we ask the UIProcess where the download should end up on disk.
3146         Null check the NetworkDataTask's client before using it because it is now a pointer that could be null. 
3147         
3148         * UIProcess/Downloads/DownloadProxy.cpp:
3149         (WebKit::DownloadProxy::shouldDecodeSourceDataOfMIMEType):
3150         (WebKit::DownloadProxy::decideDestinationWithSuggestedFilenameAsync):
3151         (WebKit::DownloadProxy::decideDestinationWithSuggestedFilename):
3152         (WebKit::DownloadProxy::didCreateDestination):
3153         * UIProcess/Downloads/DownloadProxy.h:
3154         * UIProcess/Downloads/DownloadProxy.messages.in:
3155
3156 2016-02-23  Brian Burg  <bburg@apple.com>
3157
3158         Connect WebAutomationSession to its backend dispatcher as if it were an agent and add stub implementations
3159         https://bugs.webkit.org/show_bug.cgi?id=154518
3160         <rdar://problem/24761096>
3161
3162         Reviewed by Timothy Hatcher.
3163
3164         Add a domain dispatcher for the 'Automation' domain, and register the
3165         WebAutomationSession itself as the handler for Automation commands.
3166         Stub out these command implementations so the code will compile.
3167
3168         * UIProcess/Automation/Automation.json:
3169         Fix the createWindow command's parameters and description.
3170         Add an ErrorMessage string enumeration and document how it can be used
3171         to signal well-known errors to the frontend.
3172
3173         * UIProcess/Automation/WebAutomationSession.cpp:
3174         (WebKit::WebAutomationSession::WebAutomationSession):
3175         Add the domain backend dispatcher. It further parses commands that were deemed
3176         valid by the generic dispatcher and match the 'Automation' domain prefix.
3177
3178         (WebKit::WebAutomationSession::getWindows):
3179         (WebKit::WebAutomationSession::openWindow):
3180         (WebKit::WebAutomationSession::closeWindow):
3181         Stub these out with our new ErrorMessage enumeration and a macro to
3182         make this code pattern more readable.
3183
3184         * UIProcess/Automation/WebAutomationSession.h:
3185         Add new declarations and members.
3186
3187 2016-02-23  Antti Koivisto  <antti@apple.com>
3188
3189         Remove tab suspension code
3190         https://bugs.webkit.org/show_bug.cgi?id=154585
3191
3192         Reviewed by Andreas Kling.
3193
3194         * Shared/WebProcessCreationParameters.cpp:
3195         (WebKit::WebProcessCreationParameters::WebProcessCreationParameters):
3196         (WebKit::WebProcessCreationParameters::encode):
3197         (WebKit::WebProcessCreationParameters::decode):
3198         * Shared/WebProcessCreationParameters.h:
3199         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3200         (WebKit::registerUserDefaultsIfNeeded):
3201         (WebKit::WebProcessPool::platformInitializeWebProcess):
3202         * WebProcess/cocoa/WebProcessCocoa.mm:
3203         (WebKit::WebProcess::platformInitializeWebProcess):
3204
3205 2016-02-22  Ryuan Choi  <ryuan.choi@navercorp.com>
3206
3207         [EFL] Merge WebView and WebViewEfl
3208         https://bugs.webkit.org/show_bug.cgi?id=154445
3209
3210         Reviewed by Gyuyoung Kim.
3211
3212         * PlatformEfl.cmake: Removed WebViewEfl.cpp from source list.
3213         * UIProcess/API/C/efl/WKViewEfl.cpp: Removed type cast for WebViewEfl.
3214         * UIProcess/API/efl/EwkView.cpp: Ditto.
3215         * UIProcess/API/efl/EwkView.h:
3216         * UIProcess/API/efl/GestureRecognizer.cpp: Removed type cast for WebViewEfl.
3217         * UIProcess/API/efl/WebAccessibility.cpp: Removed unnecessary includes.
3218         * UIProcess/API/efl/ewk_view.cpp: Ditto.
3219         * UIProcess/efl/ViewClientEfl.cpp: Ditto.
3220         * UIProcess/efl/WebColorPickerClient.cpp: Ditto.
3221         * UIProcess/efl/WebColorPickerClient.h:
3222         * UIProcess/efl/WebColorPickerEfl.cpp:
3223         (WebKit::WebColorPickerEfl::WebColorPickerEfl):
3224         * UIProcess/efl/WebColorPickerEfl.h:
3225         (WebKit::WebColorPickerEfl::create):
3226         * UIProcess/efl/WebView.cpp:
3227         * UIProcess/efl/WebView.h:
3228         * UIProcess/efl/WebViewEfl.cpp: Removed.
3229         * UIProcess/efl/WebViewEfl.h: Ditto.
3230
3231 2016-02-22  Brian Burg  <bburg@apple.com>
3232
3233         Web Inspector: add 'Automation' protocol domain and generate its backend classes separately in WebKit2
3234         https://bugs.webkit.org/show_bug.cgi?id=154509
3235         <rdar://problem/24759098>
3236
3237         Reviewed by Timothy Hatcher.
3238
3239         Add a new 'Automation' domain which presents an RPC interface
3240         for sending automation commands to an active WebAutomationSession
3241         in the UIProcess via RemoteInspector. This is similar to how the
3242         Inspector backend communicates bidirectionally with a remote
3243         Inspector frontend.
3244
3245         Add build system logic to generate JSON-RPC protocol bindings
3246         for the 'Automation' domain using the inspector code generators.
3247
3248         Move automation-related files that are not API or SPI into their
3249         own directory.
3250
3251         * Configurations/BaseTarget.xcconfig: Tell where JavaScriptCore's
3252         private headers are, since that's where the code generators live.
3253
3254         * CMakeLists.txt: Look in UIProcess/Automation directory.
3255         * PlatformMac.cmake:
3256         * DerivedSources.make: Generate protocol bindings for a single domain.
3257         The names of the generated files will be improved in a follow-up patch
3258         so that they do not clash with generated files in JavaScriptCore.
3259
3260         * UIProcess/Automation/Automation.json: Added.
3261         * UIProcess/Automation/WebAutomationSession.cpp: Renamed from Source/WebKit2/UIProcess/WebAutomationSession.cpp.
3262         (WebKit::WebAutomationSession::WebAutomationSession):
3263         (WebKit::WebAutomationSession::~WebAutomationSession):
3264         Set up a backend dispatcher and frontend router. They will be used later.
3265
3266         (WebKit::WebAutomationSession::dispatchMessageFromRemote):
3267         Forward messages from the remote to the backend dispatcher. When
3268         an agent / command handler is registered, it will receive the message.
3269
3270         (WebKit::WebAutomationSession::connect):
3271         (WebKit::WebAutomationSession::disconnect):
3272         Connenct and disconnect the frontend router to the remote channel.
3273
3274         * UIProcess/Automation/WebAutomationSession.h: Renamed from Source/WebKit2/UIProcess/WebAutomationSession.h.
3275         * WebKit2.xcodeproj/project.pbxproj: Add and move files.
3276
3277 2016-02-16  Ada Chan  <adachan@apple.com>
3278
3279         Implement basic functionality in WebVideoFullscreenInterfaceMac.
3280         https://bugs.webkit.org/show_bug.cgi?id=153241
3281
3282         Reviewed by Beth Dakin.
3283
3284         * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm:
3285         (WebKit::WebVideoFullscreenManagerProxy::setupFullscreenWithID):
3286         (WebKit::WebVideoFullscreenManagerProxy::exitFullscreen):
3287         (WebKit::WebVideoFullscreenManagerProxy::preparedToReturnToInline):
3288         * UIProcess/PageClient.h:
3289         * UIProcess/WebPageProxy.h:
3290         * UIProcess/mac/PageClientImpl.h:
3291         * UIProcess/mac/PageClientImpl.mm:
3292         (WebKit::PageClientImpl::rootViewToWindow):
3293         * UIProcess/mac/WebPageProxyMac.mm:
3294         (WebKit::WebPageProxy::rootViewToWindow):
3295         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
3296         (WebKit::WebChromeClient::supportsVideoFullscreen):
3297         * WebProcess/cocoa/WebVideoFullscreenManager.h:
3298         * WebProcess/cocoa/WebVideoFullscreenManager.mm:
3299         (WebKit::WebVideoFullscreenManager::supportsVideoFullscreen):
3300
3301 2016-02-22  Commit Queue  <commit-queue@webkit.org>
3302
3303         Unreviewed, rolling out r196935.
3304         https://bugs.webkit.org/show_bug.cgi?id=154557
3305
3306         This change causes timeouts and crashes in LayoutTests
3307         (Requested by ryanhaddad on #webkit).
3308
3309         Reverted changeset:
3310
3311         "Enable AVFoundationNSURLSessionEnabled by default"
3312         https://bugs.webkit.org/show_bug.cgi?id=154469
3313         http://trac.webkit.org/changeset/196935
3314
3315 2016-02-22  Anders Carlsson  <andersca@apple.com>
3316
3317         Remove _mockCaptureDevicesEnabled getter and setter
3318         https://bugs.webkit.org/show_bug.cgi?id=154550
3319
3320         Reviewed by Beth Dakin.
3321
3322         The _mockCaptureDevicesEnabled property isn't declared anywhere, and this
3323         should be a WKWebViewConfiguration parameter if we ever want to expose it in the modern API.
3324
3325         * UIProcess/API/Cocoa/WKPreferences.mm:
3326         (-[WKPreferences _mockCaptureDevicesEnabled]): Deleted.
3327         (-[WKPreferences _setMockCaptureDevicesEnabled:]): Deleted.
3328
3329 2016-02-22  Konstantin Tokarev  <annulen@yandex.ru>
3330
3331         [cmake] Moved library setup code to WEBKIT_FRAMEWORK macro.
3332         https://bugs.webkit.org/show_bug.cgi?id=154450
3333
3334         Reviewed by Alex Christensen.
3335
3336         * CMakeLists.txt: Used WebKit2_SOURCES variable instead of separate
3337         WebKit2_DERIVED_SOURCES for compatibility with WEBKIT_FRAMEWORK macro.
3338         There is no real need to separate derived sources from others.
3339         * PlatformGTK.cmake: Ditto.
3340
3341 2016-02-22  Carlos Alberto Lopez Perez  <clopez@igalia.com>
3342
3343         [CMake] Unreviewed build fix after r196942.
3344
3345         * CMakeLists.txt: WKPluginSiteDataManager.cpp is gone.
3346
3347 2016-02-22  Keith Rollin  <krollin@apple.com>
3348
3349         Add mechanism to disable memory pressure handling
3350         https://bugs.webkit.org/show_bug.cgi?id=154254
3351         <rdar://problem/24662616>
3352
3353         Reviewed by Chris Dumez.
3354
3355         Add a mechanism to disable WebKit's response to memory pressure
3356         triggers. This was asked for by another group for testing purposes.
3357
3358         In order to disable WebKit's memory pressure handling, execute the
3359         following from the command line:
3360
3361             defaults write com.apple.Safari WebKitSuppressMemoryPressureHandler -bool true
3362
3363         To revert to standard behavior, delete the key or set it to False.
3364
3365         This flag is used when a new sub-process is being spawned. The value
3366         is read and stored in an initialization parameter block, which is then
3367         sent to the new sub-process.
3368
3369         In actuality, only the UI, WebContent, and Network processes heed the
3370         flag. The Plugin process isn't instrumented to heed this flag for
3371         three reasons. First, the Plugin process installs its memory pressure
3372         handler in initializeProcess, not initializePluginProcess. This is
3373         contrary to when the other processes install their handlers, which is
3374         in initialize<PluginType>Process, not initializeProcess. So in order
3375         to accomodate the Plugin process, we'd need to modify
3376         ChildProcessInitializationParameters. Doing this is awkward at best,
3377         but also seems to be opposed to what's supposed to be done in
3378         initializeProcess and conveyed in
3379         ChildProcessInitializationParameters. And even if we did add a boolean
3380         to this structure and added support for conveying it through the XPC
3381         port, it would end up being a Plugin process-only boolean in a general
3382         parameter block, which seems asymmetric with the other processes.
3383         Second, there's no convenient Cocoa function called in the flow that
3384         spawns the Plugin process, meaning that there's no convenient place to
3385         call NSUserDefaults to get the flag's value. And third, the Plugin
3386         process doesn't elegantly respond to the memory pressure trigger
3387         anyway. It might terminate itself, but that's it. As for the Database
3388         process, it doesn't seem to support responding to memory pressure at
3389         all, so we don't send it a flag telling it to ignore it.
3390
3391         Internally, the memory pressure handler is suppressed by not calling
3392         MemoryPressureHandler::install() if the flag is set. In the case of
3393         the Network process, the flag is saved so that it can be checked later
3394         in other places that manually kick off the memory pressure handling
3395         procedure.
3396
3397         * NetworkProcess/NetworkProcess.cpp:
3398         (WebKit::NetworkProcess::lowMemoryHandler):
3399         (WebKit::NetworkProcess::initializeNetworkProcess):
3400         * NetworkProcess/NetworkProcess.h:
3401         * NetworkProcess/NetworkProcessCreationParameters.cpp:
3402         (WebKit::NetworkProcessCreationParameters::encode):
3403         (WebKit::NetworkProcessCreationParameters::decode):
3404         * NetworkProcess/NetworkProcessCreationParameters.h:
3405         * Shared/WebProcessCreationParameters.cpp:
3406         (WebKit::WebProcessCreationParameters::encode):
3407         (WebKit::WebProcessCreationParameters::decode):
3408         * Shared/WebProcessCreationParameters.h:
3409         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3410         (WebKit::WebProcessPool::platformInitializeWebProcess):
3411         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
3412         * WebProcess/WebProcess.cpp:
3413         (WebKit::WebProcess::initializeWebProcess):
3414
3415 2016-02-22  Anders Carlsson  <andersca@apple.com>
3416
3417         Get rid of WKPluginSiteDataManager
3418         https://bugs.webkit.org/show_bug.cgi?id=154470
3419
3420         Reviewed by Tim Horton.
3421
3422         * Shared/API/c/WKBase.h:
3423         * UIProcess/API/C/WKContext.cpp:
3424         (WKContextGetPluginSiteDataManager): Deleted.
3425         * UIProcess/API/C/WKContext.h:
3426         * UIProcess/API/C/WKPluginSiteDataManager.cpp: Removed.
3427         (WKPluginSiteDataManagerGetTypeID): Deleted.
3428         (WKPluginSiteDataManagerGetSitesWithData): Deleted.
3429         (WKPluginSiteDataManagerClearSiteData): Deleted.
3430         (WKPluginSiteDataManagerClearAllSiteData): Deleted.