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