Network cache Bloom filter is too big
[WebKit-https.git] / Source / WebKit2 / ChangeLog
1 2015-04-04  Antti Koivisto  <antti@apple.com>
2
3         Network cache Bloom filter is too big
4         https://bugs.webkit.org/show_bug.cgi?id=143400
5
6         Reviewed by Chris Dumez.
7
8         It is currently 1MB.
9
10         This patch switches the cache from a counting filter (CountingBloomFilter) to a bit filter (BloomFilter).
11
12         It also reduces the filter size from 2^20 to 2^18 elements which is good for ~26000 cache entries while
13         still keeping false positive rate below 1%. The current cache capacity allows around 4000 entries
14         with typical web contents.
15
16         The new filter size is 32KB.
17
18         * NetworkProcess/cache/NetworkCacheStorage.cpp:
19         (WebKit::NetworkCache::Storage::Storage):
20         (WebKit::NetworkCache::Storage::synchronize):
21
22             Turn initialization function into general purpose synchronization function.
23
24         (WebKit::NetworkCache::Storage::addToContentsFilter):
25
26             Collect newly added hashes so we don't miss entries that were added during synchronization.
27
28         (WebKit::NetworkCache::Storage::mayContain):
29         (WebKit::NetworkCache::Storage::remove):
30         (WebKit::NetworkCache::Storage::retrieve):
31         (WebKit::NetworkCache::Storage::store):
32         (WebKit::NetworkCache::Storage::dispatchPendingWriteOperations):
33         (WebKit::NetworkCache::Storage::dispatchFullWriteOperation):
34         (WebKit::NetworkCache::Storage::dispatchHeaderWriteOperation):
35         (WebKit::NetworkCache::Storage::setMaximumSize):
36         (WebKit::NetworkCache::Storage::clear):
37         (WebKit::NetworkCache::Storage::shrinkIfNeeded):
38         (WebKit::NetworkCache::Storage::shrink):
39
40             Non-counting Bloom filter does not support removals so this requires a new strategy.
41
42             Shrink code now simply deletes entries. The filter is updated by calling synchronize() at the end.
43             While we could synchronize the filter during traversal it is better to just have one function for that.
44
45         (WebKit::NetworkCache::Storage::initialize): Deleted.
46         * NetworkProcess/cache/NetworkCacheStorage.h:
47         (WebKit::NetworkCache::Storage::mayContain):
48         (WebKit::NetworkCache::Storage::cacheMayContain): Deleted.
49
50 2015-04-04  Andy Estes  <aestes@apple.com>
51
52         [Content Filtering] Blocked page is not always displayed when it should be
53         https://bugs.webkit.org/show_bug.cgi?id=143410
54
55         Reviewed by Andreas Kling.
56
57         * UIProcess/WebFrameProxy.cpp:
58         (WebKit::WebFrameProxy::didStartProvisionalLoad): Stopped clearing m_contentFilterUnblockHandler here.
59         (WebKit::WebFrameProxy::didHandleContentFilterUnblockNavigation): Started doing it here instead.
60
61 2015-04-04  Chris Dumez  <cdumez@apple.com>
62
63         [WK2][Cocoa] Add a way to temporarily disable the WebKit Network Cache for testing
64         https://bugs.webkit.org/show_bug.cgi?id=143392
65         <rdar://problem/20315669>
66
67         Reviewed by Antti Koivisto.
68
69         Add a way to temporarily disable the WebKit Network Cache for testing.
70         It will be used temporarily for comparing page load times with and
71         without the WebKit network disk cache enabled.
72
73         This is in addition to the existing "WebKitNetworkCacheEnabled"
74         NSUserDefaults:
75         webkitNetworkCacheIsEnabled = [defaults boolForKey:WebKitNetworkCacheEnabledDefaultsKey]
76             && ![defaults boolForKey:WebKitNetworkCacheTemporarilyDisabledForTestingKey];
77
78         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
79         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
80
81 2015-04-04  Simon Fraser  <simon.fraser@apple.com>
82
83         REGRESSION (r182215): Feedly crashes when closing article
84         https://bugs.webkit.org/show_bug.cgi?id=143405
85         rdar://problem/20382734, rdar://problem/20395497
86
87         Reviewed by Tim Horton.
88         
89         Calling computeNonFastScrollableRegion() eagerly when scrollable areas come and go
90         is bad, because it can cause FrameView::layout() to get called in the middle of
91         RenderObject destruction, which leaves the render tree in a bad state.
92         
93         Fix by calling computeNonFastScrollableRegion() lazily, just before scrolling tree commit.
94         
95         AsyncScrollingCoordinator::frameViewNonFastScrollableRegionChanged() now just sets
96         a flag to say that the non-fast region needs to be recomputed, and that schedules
97         a scrolling tree commit. When the commit happens, we recompute the region. If the
98         region didn't change, and no other changes are pending, there's no need to commit.
99
100         * WebProcess/Scrolling/RemoteScrollingCoordinator.mm:
101         (WebKit::RemoteScrollingCoordinator::buildTransaction):
102         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
103         (WebKit::TiledCoreAnimationDrawingArea::flushLayers): Outdent #ifdefs.
104
105 2015-04-03  Beth Dakin  <bdakin@apple.com>
106
107         Attempted build fix.
108
109         * UIProcess/API/mac/WKView.mm:
110
111 2015-04-03  Simon Fraser  <simon.fraser@apple.com>
112
113         Fix the firing of the ReachedSessionRestorationRenderTreeSizeThreshold milestone on iOS
114         https://bugs.webkit.org/show_bug.cgi?id=143394
115
116         Reviewed by Tim Horton.
117         
118         A client reshuffle at some point broke the dispatch of the ReachedSessionRestorationRenderTreeSizeThreshold
119         milestone. Fix by using WebPageProxy::didLayout() to fire the milestone.
120
121         * UIProcess/ios/WebPageProxyIOS.mm:
122         (WebKit::WebPageProxy::didCommitLayerTree):
123
124 2015-04-03  Beth Dakin  <bdakin@apple.com>
125
126         https://bugs.webkit.org/show_bug.cgi?id=143387
127         Improvements to webkitmouseforce web API
128         -and corresponding-
129         rdar://problem/20281808
130         rdar://problem/20281853
131
132         Reviewed by Darin Adler.
133
134         This patch:
135         1. Dispatches webkitmouseforceup and webkitmouseforceclick at the right time.
136         2. Dispatches webkitmouseforcechanged from mousedown all the way through through 
137         mouseup.
138         3. Uses force values from pressureChangeWithEvent instead of the immediate action 
139         gesture recognizer.
140
141         Listen for this NSResponder method, and pass the relevant info to WebPageProxy to 
142         dispatch to the web process.
143         * UIProcess/API/mac/WKView.mm:
144         (-[WKView pressureChangeWithEvent:]):
145         * UIProcess/WebPageProxy.cpp:
146         (WebKit::WebPageProxy::inputDeviceForceDidChange):
147         (WebKit::WebPageProxy::immediateActionDidUpdate):
148         * UIProcess/WebPageProxy.h:
149
150         The web process still needs to know when the immediate action gesture recognizer 
151         is updating, but it doesn’t need the force information. That will come from 
152         pressureChangeWithEvent.
153         * UIProcess/mac/WKImmediateActionController.mm:
154         (-[WKImmediateActionController immediateActionRecognizerDidUpdateAnimation:]):
155
156         Cache m_lastForceStage so that we can determine if we are 
157         transitioning to a new stage.
158         * WebProcess/WebPage/WebPage.cpp:
159         (WebKit::WebPage::WebPage):
160         * WebProcess/WebPage/WebPage.h:
161
162         New message for InputDeviceForceDidChange and modified message for 
163         ImmediateActionDidUpdate
164         * WebProcess/WebPage/WebPage.messages.in:
165
166         inputDeviceForceDidChange now takes care of dispatching mouseforcechanged, 
167         mouseforcedown, mouseforceup, and mouseforceclick.
168         * WebProcess/WebPage/mac/WebPageMac.mm:
169         (WebKit::WebPage::inputDeviceForceDidChange):
170
171         We still need to keep track of the ImmediateActionStages in WebCore::EventHandler 
172         so that we can have the right default behavior on mouseup based on whether or not 
173         that action began and was completed. (In other words, to ensure we don’t navigate 
174         to a link after force clicking it.)
175         (WebKit::WebPage::immediateActionDidUpdate):
176         (WebKit::WebPage::immediateActionDidComplete):
177
178 2015-04-03  Said Abou-Hallawa  <sabouhallawa@apple.com>
179
180         InjectedBundleNodeHandle::renderedImage() needs to be exposed from the Cocoa WebAPI layer.
181         https://bugs.webkit.org/show_bug.cgi?id=143341.
182
183         Reviewed by Anders Carlsson.
184
185         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.h:
186         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm:
187         (-[WKWebProcessPlugInNodeHandle renderedImageWithOptions:]): Expose rendered
188         image injected bundle API from the Cocoa layer. A node in the page can be
189         rendered to an NSImage on MacOS and to a UIImage on iOS.
190
191 2015-04-03  Chris Dumez  <cdumez@apple.com>
192
193         [WK2][iOS] We should prevent NetworkProcess suspension while it has pending SQL transactions
194         https://bugs.webkit.org/show_bug.cgi?id=143278
195         <rdar://problem/20180799>
196
197         Reviewed by Anders Carlsson.
198
199         Prevent NetworkProcess suspension while it has pending SQL transactions,
200         similarly to what we already did for WebProcesses. This patch moves the
201         WebSQLiteDatabaseTracker from WebProcess/ to Shared/ and make it usable
202         by the NetworkProcess class as well.
203
204         Whenever there are locked files to due SQL transactions, the
205         NetworkProcess will send an IPC message to the NetworkProcessProxy
206         which will hold a background process assertion until the NetworkProcess'
207         SQL transactions are complete. This way, it is no longer possible for
208         the NetworkProcess to get suspended while SQL transactions are running
209         and a database file is locked.
210
211         * NetworkProcess/NetworkProcess.cpp:
212         (WebKit::NetworkProcess::initializeNetworkProcess):
213         * NetworkProcess/NetworkProcess.h:
214         * Shared/WebSQLiteDatabaseTracker.cpp: Renamed from Source/WebKit2/WebProcess/WebCoreSupport/WebSQLiteDatabaseTracker.cpp.
215         (WebKit::WebSQLiteDatabaseTracker::WebSQLiteDatabaseTracker):
216         (WebKit::m_childProcessType):
217         (WebKit::WebSQLiteDatabaseTracker::willBeginFirstTransaction):
218         (WebKit::WebSQLiteDatabaseTracker::didFinishLastTransaction):
219         (WebKit::WebSQLiteDatabaseTracker::hysteresisUpdated):
220         * Shared/WebSQLiteDatabaseTracker.h: Renamed from Source/WebKit2/WebProcess/WebCoreSupport/WebSQLiteDatabaseTracker.h.
221         * UIProcess/Network/NetworkProcessProxy.cpp:
222         (WebKit::NetworkProcessProxy::didClose):
223         (WebKit::NetworkProcessProxy::setIsHoldingLockedFiles):
224         * UIProcess/Network/NetworkProcessProxy.h:
225         * UIProcess/Network/NetworkProcessProxy.messages.in:
226         * WebKit2.xcodeproj/project.pbxproj:
227         * WebProcess/WebProcess.cpp:
228         (WebKit::WebProcess::WebProcess):
229         (WebKit::WebProcess::initializeConnection):
230         * WebProcess/WebProcess.h:
231
232 2015-04-03  Antti Koivisto  <antti@apple.com>
233
234         Add non-counting Bloom filter implementation
235         https://bugs.webkit.org/show_bug.cgi?id=143366
236
237         Reviewed by Sam Weinig.
238
239         * NetworkProcess/cache/NetworkCacheStorage.h:
240
241 2015-04-03  Zan Dobersek  <zdobersek@igalia.com>
242
243         Fix the EFL and GTK build after r182243
244         https://bugs.webkit.org/show_bug.cgi?id=143361
245
246         Reviewed by Csaba Osztrogonác.
247
248         * PlatformGTK.cmake: Add a custom command that copies the
249         InspectorBackendCommands.js file into the proper directory
250         under DerivedSources/WebInspectorUI/.
251
252 2015-04-03  Philippe Normand  <pnormand@igalia.com>
253
254         Unreviewed, GTK build fix.
255
256         * UIProcess/API/gtk/WebKitContextMenuClient.cpp:
257         * UIProcess/gtk/WebContextMenuProxyGtk.cpp:
258         * UIProcess/gtk/WebContextMenuProxyGtk.h:
259
260 2015-04-02  Csaba Osztrogonác  <ossy@webkit.org>
261
262         Typo fix.
263
264         * PlatformGTK.cmake:
265
266 2015-04-02  Csaba Osztrogonác  <ossy@webkit.org>
267
268         URTBF after r182303, stub NativeContextMenuItem implemetations added for EFL and GTK.
269
270         * PlatformEfl.cmake:
271         * PlatformGTK.cmake:
272         * Shared/efl/NativeContextMenuItemEfl.cpp: Added.
273         (WebKit::NativeContextMenuItem::NativeContextMenuItem):
274         * Shared/gtk/NativeContextMenuItemGtk.cpp: Added.
275         (WebKit::NativeContextMenuItem::NativeContextMenuItem):
276
277 2015-04-02  Timothy Horton  <timothy_horton@apple.com>
278
279         De-PLATFORM(IOS)-ify LayerHostingContext::setFencePort
280         https://bugs.webkit.org/show_bug.cgi?id=143342
281
282         * Platform/mac/LayerHostingContext.h:
283         * Platform/mac/LayerHostingContext.mm:
284         Actually, not available on Mavericks. Fix the build.
285
286 2015-04-02  Brady Eidson  <beidson@apple.com>
287
288         Unreviewed: Re-applied change after rollout.
289
290         Expose the "Share" menu for text selections on platforms where it's available.
291         rdar://problem/20034174 and https://bugs.webkit.org/show_bug.cgi?id=143318
292
293         * Shared/API/c/WKContextMenuItemTypes.h: Add a constant for the Share menu.
294         * Shared/API/c/WKSharedAPICast.h:
295         (WebKit::toAPI):
296         (WebKit::toImpl):
297
298         * Shared/ContextMenuContextData.cpp:
299         (WebKit::ContextMenuContextData::ContextMenuContextData):
300         (WebKit::ContextMenuContextData::encode):
301         (WebKit::ContextMenuContextData::decode):
302         * Shared/ContextMenuContextData.h:
303         (WebKit::ContextMenuContextData::selectedText):
304
305         Add a "cross platform" menu item wrapper, right now only for NSMenuItem.
306         * Shared/NativeContextMenuItem.h:
307         (WebKit::NativeContextMenuItem::~NativeContextMenuItem):
308         (WebKit::NativeContextMenuItem::nsMenuItem):
309         * Shared/mac/NativeContextMenuItem.mm:
310         (WebKit::NativeContextMenuItem::NativeContextMenuItem):
311
312         Let WebContextMenuItem hold on to a NativeContextMenuItem to maintain full fidelity of the platform.
313         * Shared/WebContextMenuItem.cpp:
314         (WebKit::WebContextMenuItem::WebContextMenuItem):
315         * Shared/WebContextMenuItem.h:
316         (WebKit::WebContextMenuItem::create):
317         (WebKit::WebContextMenuItem::nativeContextMenuItem):
318
319         * UIProcess/API/APIContextMenuClient.h:
320         (API::ContextMenuClient::getContextMenuFromProposedMenu):
321         (API::ContextMenuClient::showContextMenu):
322
323         * UIProcess/API/C/WKPage.cpp:
324         (WKPageSetPageContextMenuClient):
325
326         * UIProcess/WebContextMenuProxy.h:
327
328         * UIProcess/WebPageProxy.cpp:
329         (WebKit::WebPageProxy::internalShowContextMenu): Translate the placeholder item from the web process into the
330           native Share menu before consulting the context menu client. Also create the API items here so the native NSMenuItem
331           can be attached to them.
332
333         * UIProcess/mac/WebContextMenuProxyMac.h:
334         * UIProcess/mac/WebContextMenuProxyMac.mm:
335         (-[WKMenuTarget forwardContextMenuAction:]):
336         (WebKit::nsMenuItem):
337         (WebKit::nsMenuItemVector):
338         (WebKit::WebContextMenuProxyMac::populate):
339         (WebKit::WebContextMenuProxyMac::showContextMenu):
340
341         * WebKit2.xcodeproj/project.pbxproj:
342
343         * WebProcess/WebCoreSupport/WebContextMenuClient.h:
344         * WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm:
345         (WebKit::WebContextMenuClient::shareSelectedTextMenuItem): In the web process, mark the Share menu's place in the
346           context menu with a placeholder item. It will be translated into the real Share menu in the UI process.
347
348 2015-04-02  Commit Queue  <commit-queue@webkit.org>
349
350         Unreviewed, rolling out r182293.
351         https://bugs.webkit.org/show_bug.cgi?id=143355
352
353         Broke GTK and EFL builds. (Requested by bfulgham on #webkit).
354
355         Reverted changeset:
356
357         "Expose the "Share" menu for text selections on platforms
358         where it's available."
359         https://bugs.webkit.org/show_bug.cgi?id=143318
360         http://trac.webkit.org/changeset/182293
361
362 2015-04-02  Chris Dumez  <cdumez@apple.com>
363
364         [WK2][NetworkCache] Drop HTTP method from NetworkCache::Key
365         https://bugs.webkit.org/show_bug.cgi?id=143348
366
367         Reviewed by Antti Koivisto.
368
369         Drop HTTP method from NetworkCache::Key as we only cache GET responses
370         for now. Even when we start caching HEAD responses, we likely will not
371         want the method to be part of the key because:
372         - A HEAD response can be used to update the headers of a previously cached response to GET
373         - A cached GET response may be used to satisfy subsequent HEAD requests
374
375         * NetworkProcess/cache/NetworkCache.cpp:
376         (WebKit::NetworkCache::makeCacheKey):
377         * NetworkProcess/cache/NetworkCacheKey.cpp:
378         (WebKit::NetworkCache::Key::Key):
379         (WebKit::NetworkCache::Key::operator=):
380         (WebKit::NetworkCache::Key::computeHash):
381         (WebKit::NetworkCache::Key::operator==):
382         (WebKit::NetworkCache::Key::encode):
383         (WebKit::NetworkCache::Key::decode):
384         * NetworkProcess/cache/NetworkCacheKey.h:
385         (WebKit::NetworkCache::Key::method): Deleted.
386
387 2015-04-02  Jer Noble  <jer.noble@apple.com>
388
389         [Mac][WK2] Fullscreen animation incorrect when initiated on non-primary monitor
390         https://bugs.webkit.org/show_bug.cgi?id=143237
391
392         Reviewed by Brent Fulgham.
393
394         The animation calculations have an implicit assumptions of a screen whose origin is 0,0. Account
395         for the screen origin by passing the window's screen's frame into the zoomAnimation() and maskAnimation()
396         methods.
397
398         * UIProcess/mac/WKFullScreenWindowController.mm:
399         (-[WKFullScreenWindowController initWithWindow:webView:]):
400         (zoomAnimation):
401         (maskAnimation):
402         (-[WKFullScreenWindowController _startEnterFullScreenAnimationWithDuration:]):
403         (-[WKFullScreenWindowController _startExitFullScreenAnimationWithDuration:]):
404
405 2015-04-02  Brady Eidson  <beidson@apple.com>
406
407         Expose the "Share" menu for text selections on platforms where it's available.
408         rdar://problem/20034174 and https://bugs.webkit.org/show_bug.cgi?id=143318
409
410         Reviewed by Sam Weinig.
411
412         * Shared/API/c/WKContextMenuItemTypes.h: Add a constant for the Share menu.
413         * Shared/API/c/WKSharedAPICast.h:
414         (WebKit::toAPI):
415         (WebKit::toImpl):
416
417         * Shared/ContextMenuContextData.cpp:
418         (WebKit::ContextMenuContextData::ContextMenuContextData):
419         (WebKit::ContextMenuContextData::encode):
420         (WebKit::ContextMenuContextData::decode):
421         * Shared/ContextMenuContextData.h:
422         (WebKit::ContextMenuContextData::selectedText):
423
424         Add a "cross platform" menu item wrapper, right now only for NSMenuItem.
425         * Shared/NativeContextMenuItem.h:
426         (WebKit::NativeContextMenuItem::~NativeContextMenuItem):
427         (WebKit::NativeContextMenuItem::nsMenuItem):
428         * Shared/mac/NativeContextMenuItem.mm:
429         (WebKit::NativeContextMenuItem::NativeContextMenuItem):
430
431         Let WebContextMenuItem hold on to a NativeContextMenuItem to maintain full fidelity of the platform.
432         * Shared/WebContextMenuItem.cpp:
433         (WebKit::WebContextMenuItem::WebContextMenuItem):
434         * Shared/WebContextMenuItem.h:
435         (WebKit::WebContextMenuItem::create):
436         (WebKit::WebContextMenuItem::nativeContextMenuItem):
437
438         * UIProcess/API/APIContextMenuClient.h:
439         (API::ContextMenuClient::getContextMenuFromProposedMenu):
440         (API::ContextMenuClient::showContextMenu):
441
442         * UIProcess/API/C/WKPage.cpp:
443         (WKPageSetPageContextMenuClient):
444
445         * UIProcess/WebContextMenuProxy.h:
446
447         * UIProcess/WebPageProxy.cpp:
448         (WebKit::WebPageProxy::internalShowContextMenu): Translate the placeholder item from the web process into the
449           native Share menu before consulting the context menu client. Also create the API items here so the native NSMenuItem
450           can be attached to them.
451
452         * UIProcess/mac/WebContextMenuProxyMac.h:
453         * UIProcess/mac/WebContextMenuProxyMac.mm:
454         (-[WKMenuTarget forwardContextMenuAction:]):
455         (WebKit::nsMenuItem):
456         (WebKit::nsMenuItemVector):
457         (WebKit::WebContextMenuProxyMac::populate):
458         (WebKit::WebContextMenuProxyMac::showContextMenu):
459
460         * WebKit2.xcodeproj/project.pbxproj:
461
462         * WebProcess/WebCoreSupport/WebContextMenuClient.h:
463         * WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm:
464         (WebKit::WebContextMenuClient::shareSelectedTextMenuItem): In the web process, mark the Share menu's place in the
465           context menu with a placeholder item. It will be translated into the real Share menu in the UI process.
466
467 2015-04-02  Timothy Horton  <timothy_horton@apple.com>
468
469         De-PLATFORM(IOS)-ify LayerHostingContext::setFencePort
470         https://bugs.webkit.org/show_bug.cgi?id=143342
471
472         Reviewed by Myles C. Maxfield.
473
474         * Platform/mac/LayerHostingContext.h:
475         * Platform/mac/LayerHostingContext.mm:
476         (WebKit::LayerHostingContext::setFencePort):
477         There's nothing iOS specific about this.
478
479 2015-04-02  Oliver Hunt  <oliver@apple.com>
480
481         Ensure that we always set network ATS context in the network process
482         https://bugs.webkit.org/show_bug.cgi?id=143343
483
484         Reviewed by Dan Bernstein.
485
486         If a custom cache location or size we were early returning before setting
487         the CFNetwork ATS context. This is clearly an error.
488
489         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
490         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
491
492 2015-04-02  Alexey Proskuryakov  <ap@apple.com>
493
494         Make checkURLReceivedFromWebProcess not rely on details of platform URL implementation.
495         https://bugs.webkit.org/show_bug.cgi?id=143222
496         rdar://problem/19978997
497
498         Reviewed by Sam Weinig.
499
500         * UIProcess/WebProcessProxy.cpp:
501         (WebKit::WebProcessProxy::checkURLReceivedFromWebProcess):
502
503 2015-04-02  Yusuke Suzuki  <utatane.tea@gmail.com>
504
505         Clean up EnumerationMode to easily extend
506         https://bugs.webkit.org/show_bug.cgi?id=143276
507
508         Reviewed by Geoffrey Garen.
509
510         Use default EnumerationMode().
511
512         * WebProcess/Plugins/Netscape/NPJSObject.cpp:
513         (WebKit::NPJSObject::enumerate):
514
515 2015-04-02  Chris Dumez  <cdumez@apple.com>
516
517         [WK2][iOS] Update the WebContent process' sandbox profile for AWD
518         https://bugs.webkit.org/show_bug.cgi?id=143340
519         <rdar://problem/20375170>
520
521         Reviewed by Alexey Proskuryakov.
522
523         Update the WebContent process' sandbox profile for AWD.
524
525         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
526
527 2015-04-01  Antti Koivisto  <antti@apple.com>
528
529         Use std::chrono types to represent time in response and cache classes
530         https://bugs.webkit.org/show_bug.cgi?id=143316
531
532         Reviewed by Andreas Kling.
533
534         * NetworkProcess/NetworkResourceLoader.cpp:
535         (WebKit::NetworkResourceLoader::didFinishLoading):
536         * NetworkProcess/cache/NetworkCache.cpp:
537         (WebKit::NetworkCache::responseHasExpired):
538         (WebKit::NetworkCache::responseNeedsRevalidation):
539         (WebKit::NetworkCache::makeStoreDecision):
540         (WebKit::NetworkCache::Cache::store):
541         * NetworkProcess/cache/NetworkCacheEntry.cpp:
542         (WebKit::NetworkCache::Entry::Entry):
543         (WebKit::NetworkCache::Entry::asJSON):
544         * NetworkProcess/cache/NetworkCacheEntry.h:
545         (WebKit::NetworkCache::Entry::timeStamp):
546         * NetworkProcess/cache/NetworkCacheStorage.cpp:
547         (WebKit::NetworkCache::decodeRecordMetaData):
548         (WebKit::NetworkCache::decodeRecord):
549
550             Sanity check the timestamp on decode.
551
552         (WebKit::NetworkCache::encodeRecordMetaData):
553         (WebKit::NetworkCache::encodeRecordHeader):
554         (WebKit::NetworkCache::Storage::traverse):
555         * NetworkProcess/cache/NetworkCacheStorage.h:
556         * WebProcess/Plugins/PluginView.cpp:
557         (WebKit::lastModifiedDateMS):
558         (WebKit::PluginView::Stream::didReceiveResponse):
559         (WebKit::PluginView::manualLoadDidReceiveResponse):
560         (WebKit::lastModifiedDate): Deleted.
561
562 2015-04-01  Chris Dumez  <cdumez@apple.com>
563
564         [WK2][Cocoa] Add didFailProvisionalLoadWithErrorForFrame callback to WKWebProcessPlugInLoadDelegate
565         https://bugs.webkit.org/show_bug.cgi?id=143319
566         <rdar://problem/19463834>
567
568         Reviewed by Dan Bernstein.
569
570         Add didFailProvisionalLoadWithErrorForFrame callback to
571         WKWebProcessPlugInLoadDelegate so that the client side can track all
572         types page load completions:
573         - didFailProvisionalLoadWithErrorForFrame
574         - didFailLoadWithErrorForFrame
575         - didFinishLoadForFrame
576
577         Note that this event is already exposed on UIProcess side via the
578         WKPageLoaderClient.didFailLoadWithErrorForFrame callback.
579
580         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInLoadDelegate.h:
581         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
582         (didFailProvisionalLoadWithErrorForFrame):
583         (setUpPageLoaderClient):
584
585 2015-04-01  Enrica Casucci  <enrica@apple.com>
586
587         Injected bundle messages should be at the page level.
588         https://bugs.webkit.org/show_bug.cgi?id=143283
589
590         Reviewed by Alexey Proskuryakov.
591
592         All the messages between the injected bundle and the UI
593         process should be page level messages instead of context.
594         The author of this patch is Tim Horton, I just finished it.
595
596         * UIProcess/API/C/WKPage.cpp:
597         (WKPageSetPageInjectedBundleClient):
598         * UIProcess/API/C/WKPage.h:
599         * UIProcess/API/C/WKPageInjectedBundleClient.h: Added.
600         * UIProcess/API/Cocoa/WKWebView.mm:
601         (-[WKWebView _pageForTesting]):
602         * UIProcess/API/Cocoa/WKWebViewInternal.h:
603         * UIProcess/WebPageInjectedBundleClient.cpp: Added.
604         (WebKit::WebPageInjectedBundleClient::didReceiveMessageFromInjectedBundle):
605         (WebKit::WebPageInjectedBundleClient::didReceiveSynchronousMessageFromInjectedBundle):
606         * UIProcess/WebPageInjectedBundleClient.h: Added.
607         * UIProcess/WebPageProxy.cpp:
608         (WebKit::WebPageProxy::setInjectedBundleClient):
609         (WebKit::WebPageProxy::handleMessage):
610         (WebKit::WebPageProxy::handleSynchronousMessage):
611         * UIProcess/WebPageProxy.h:
612         (WebKit::WebPageProxy::injectedBundleClient):
613         * UIProcess/WebPageProxy.messages.in:
614         * UIProcess/WebProcessPool.cpp:
615         (WebKit::WebProcessPool::handleMessage):
616         * WebKit2.xcodeproj/project.pbxproj:
617         * CMakeLists.txt:
618         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
619         (WKBundlePagePostMessage):
620         (WKBundlePagePostSynchronousMessage):
621         * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
622         * WebProcess/WebPage/WebPage.cpp:
623         (WebKit::WebPage::postMessage):
624         (WebKit::WebPage::postSynchronousMessage):
625         * WebProcess/WebPage/WebPage.h:
626
627 2015-04-01  Alexey Proskuryakov  <ap@apple.com>
628
629         [iOS] WebContent should have access to the entirety of its caches directory
630         https://bugs.webkit.org/show_bug.cgi?id=143312
631         rdar://problem/20314916
632
633         Reviewed by Oliver Hunt.
634
635         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
636         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
637         * Shared/Network/NetworkProcessCreationParameters.cpp:
638         (WebKit::NetworkProcessCreationParameters::encode):
639         (WebKit::NetworkProcessCreationParameters::decode):
640         * Shared/Network/NetworkProcessCreationParameters.h:
641         * Shared/WebProcessCreationParameters.cpp:
642         (WebKit::WebProcessCreationParameters::encode):
643         (WebKit::WebProcessCreationParameters::decode):
644         * Shared/WebProcessCreationParameters.h:
645         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
646         (WebKit::WebProcessPool::networkingCachesDirectory):
647         (WebKit::WebProcessPool::webContentCachesDirectory):
648         (WebKit::WebProcessPool::openGLCacheDirectory): Deleted.
649         (WebKit::WebProcessPool::networkingHSTSDatabasePath): Deleted.
650         (WebKit::WebProcessPool::webContentHSTSDatabasePath): Deleted.
651         * UIProcess/WebProcessPool.cpp:
652         (WebKit::WebProcessPool::ensureNetworkProcess):
653         (WebKit::WebProcessPool::createNewWebProcess):
654         * UIProcess/WebProcessPool.h:
655         * WebProcess/cocoa/WebProcessCocoa.mm:
656         (WebKit::WebProcess::platformInitializeWebProcess):
657
658 2015-04-01  Timothy Horton  <timothy_horton@apple.com>
659
660         Smart magnification gesture sometimes shoots to the middle of the page
661         https://bugs.webkit.org/show_bug.cgi?id=143296
662         <rdar://problem/18209280>
663
664         Reviewed by Dean Jackson.
665
666         * UIProcess/mac/ViewGestureControllerMac.mm:
667         (WebKit::ViewGestureController::didCollectGeometryForSmartMagnificationGesture):
668         Constrain the target rect to the viewport, and if it had overflowed the viewport,
669         scroll halfway towards the gesture origin.
670
671 2015-03-31  Simon Fraser  <simon.fraser@apple.com>
672
673         Remove scrolling tree dependency on wheel event handler counts, and use fast scrolling even when there are wheel handlers
674         https://bugs.webkit.org/show_bug.cgi?id=143288
675         rdar://problem/16049624
676
677         Reviewed by Beth Dakin.
678
679         Remove the wheel event counting that Document does, and passes into the scrolling tree.
680         The ScrollingTree now just uses the non-fast scrollable region to determine when to
681         fast scroll on pages with wheel event handlers.
682         
683         If a handler includes position:fixed renderers, we just cover the whole document
684         with the slow-scrolling region currently. This could be improved.
685
686         * Shared/Scrolling/RemoteScrollingCoordinatorTransaction.cpp:
687         (ArgumentCoder<ScrollingStateFrameScrollingNode>::encode):
688         (ArgumentCoder<ScrollingStateFrameScrollingNode>::decode):
689         (WebKit::RemoteScrollingTreeTextStream::dump):
690         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
691         (WebKit::WebChromeClient::wheelEventHandlersChanged):
692         (WebKit::WebChromeClient::numWheelEventHandlersChanged): Deleted.
693         * WebProcess/WebCoreSupport/WebChromeClient.h:
694         * WebProcess/WebPage/WebPage.cpp:
695         (WebKit::WebPage::WebPage):
696         (WebKit::WebPage::wheelEventHandlersChanged):
697         (WebKit::WebPage::recomputeShortCircuitHorizontalWheelEventsState):
698         (WebKit::WebPage::numWheelEventHandlersChanged): Deleted.
699         * WebProcess/WebPage/WebPage.h:
700
701 2015-03-31  Dan Bernstein  <mitz@apple.com>
702
703         <rdar://problem/20365675> [iOS] Include Add to Reading List link action only where supported
704         https://bugs.webkit.org/show_bug.cgi?id=143289
705
706         Reviewed by Tim Horton.
707
708         * UIProcess/API/Cocoa/_WKElementAction.h: Excluded _WKElementActionTypeAddToReadingList from
709         the _WKElementActionType enum when Reading List is not supported.
710
711         * UIProcess/API/Cocoa/_WKElementAction.mm:
712         (+[_WKElementAction elementActionWithType:customTitle:]): Made Add to Reading List code
713         conditional on HAVE(SAFARI_SERVICES_FRAMEWORK).
714
715         * UIProcess/ios/WKActionSheetAssistant.mm:
716         (-[WKActionSheetAssistant showImageSheet]): Ditto.
717         (-[WKActionSheetAssistant showLinkSheet]): Ditto.
718
719         * config.h: Defined HAVE_SAFARI_SERVICES_FRAMEWORK.
720
721 2015-03-31  Timothy Horton  <timothy_horton@apple.com>
722
723         TextIndicator for <span> inside an <a> only highlights the <span>, should highlight the whole <a>
724         https://bugs.webkit.org/show_bug.cgi?id=143287
725         <rdar://problem/20318342>
726
727         Reviewed by Beth Dakin.
728
729         * WebProcess/WebPage/mac/WebPageMac.mm:
730         (WebKit::WebPage::performActionMenuHitTestAtLocation):
731         Instead of just highlighting the hit element, highlight the whole
732         element that the link URL comes from.
733
734 2015-03-31  Timothy Horton  <timothy_horton@apple.com>
735
736         WKView should stop using endGestureWithEvent
737         https://bugs.webkit.org/show_bug.cgi?id=143285
738         <rdar://problem/20357007>
739
740         Reviewed by Simon Fraser.
741
742         * UIProcess/API/mac/WKView.mm:
743         (-[WKView magnifyWithEvent:]):
744         (-[WKView endGestureWithEvent:]): Deleted.
745         * UIProcess/mac/ViewGestureController.h:
746         * UIProcess/mac/ViewGestureControllerMac.mm:
747         (WebKit::ViewGestureController::endMagnificationGesture):
748         (WebKit::ViewGestureController::endActiveGesture): Deleted.
749         While there is no visible symptom, it is recommended that we check
750         the phase of normal magnification events instead of using the
751         special gesture end events.
752
753 2015-03-31  Timothy Horton  <timothy_horton@apple.com>
754
755         Swipes occur in the wrong direction in RTL
756         https://bugs.webkit.org/show_bug.cgi?id=143257
757         <rdar://problem/20300862>
758
759         Reviewed by Simon Fraser.
760
761         * UIProcess/ios/ViewGestureControllerIOS.mm:
762         (-[WKSwipeTransitionController gestureRecognizerForInteractiveTransition:WithTarget:action:]):
763         When choosing which edge to attach our gesture recognizers to,
764         flip them in RTL.
765
766         (-[WKSwipeTransitionController directionForTransition:]):
767         (WebKit::ViewGestureController::beginSwipeGesture):
768         (WebKit::ViewGestureController::canSwipeInDirection):
769         * UIProcess/mac/ViewGestureController.h:
770         * UIProcess/mac/ViewGestureControllerMac.mm:
771         (WebKit::ViewGestureController::scrollEventCanBecomeSwipe):
772         (WebKit::ViewGestureController::trackSwipeGesture):
773         (WebKit::ViewGestureController::determineLayerAdjacentToSnapshotForParent):
774         (WebKit::ViewGestureController::beginSwipeGesture):
775         (WebKit::ViewGestureController::handleSwipeGesture):
776         Adjust SwipeDirection to be in logical back-forward list direction
777         instead of physical edge direction.
778
779 2015-03-31  Myles C. Maxfield  <mmaxfield@apple.com>
780
781         Move ExpansionBehaviorFlags and TextDirection to their own file
782         https://bugs.webkit.org/show_bug.cgi?id=143273
783
784         Reviewed by Simon Fraser.
785
786         This is a mechanical change. It just moves code around.
787
788         This is getting ready for https://bugs.webkit.org/show_bug.cgi?id=142608
789
790         * Shared/WebPopupItem.h:
791         * UIProcess/API/C/efl/WKAPICastEfl.h:
792         * UIProcess/API/efl/EwkView.h:
793         * UIProcess/WebPopupMenuProxy.h:
794         * UIProcess/efl/WebUIPopupMenuClient.h:
795
796 2015-03-31  Yusuke Suzuki  <utatane.tea@gmail.com>
797
798         Clean up Identifier factories to clarify the meaning of StringImpl*
799         https://bugs.webkit.org/show_bug.cgi?id=143146
800
801         Reviewed by Filip Pizlo.
802
803         Just change to Identifier::fromString.
804
805         * WebProcess/Plugins/Netscape/JSNPObject.cpp:
806         (WebKit::JSNPObject::getOwnPropertyNames):
807         * WebProcess/Plugins/Netscape/NPJSObject.cpp:
808         (WebKit::identifierFromIdentifierRep):
809
810 2015-03-31  Timothy Horton  <timothy_horton@apple.com>
811
812         WebKit briefly shows wrong webpage after swiping back (gigaom.com, or any site on a slow network)
813         https://bugs.webkit.org/show_bug.cgi?id=143256
814         <rdar://problem/19458648>
815
816         Reviewed by Dan Bernstein.
817
818         Instead of allowing a flash of the previous page when the swipe snapshot
819         timeouts fire (removing the snapshot before the new page is loaded), show
820         the snapshotted background color.
821
822         This fixes the problem on iOS, where UI-side compositing makes it easy to fix,
823         but not yet on OS X.
824
825         * UIProcess/API/Cocoa/WKWebView.mm:
826         (baseScrollViewBackgroundColor):
827         (scrollViewBackgroundColor):
828         If the ViewGestureController returns a valid background color, use that
829         instead of the page's background color.
830
831         * UIProcess/API/Cocoa/WKWebViewInternal.h:
832         Expose _updateScrollViewBackground.
833
834         * UIProcess/PageClient.h:
835         * UIProcess/ios/PageClientImplIOS.h:
836         * UIProcess/ios/PageClientImplIOS.mm:
837         (WebKit::PageClientImpl::didChangeBackgroundColor):
838         * UIProcess/mac/PageClientImpl.h:
839         * UIProcess/mac/PageClientImpl.mm:
840         (WebKit::PageClientImpl::didChangeBackgroundColor):
841         * UIProcess/WebPageProxy.cpp:
842         (WebKit::WebPageProxy::didChangeBackgroundColor):
843         * UIProcess/WebPageProxy.h:
844         Add and plumb didChangeBackgroundColor, which calls
845         _updateScrollViewBackground on iOS.
846         
847         * UIProcess/ios/ViewGestureControllerIOS.mm:
848         (WebKit::ViewGestureController::endSwipeGesture):
849         Hide the content of the drawing area until the next commit. This way,
850         even if the snapshot is removed (say, because a timeout fired), we won't
851         ever show the old page content (but we will show background color).
852
853         Store the background color associated with the current snapshot.
854
855         Let WKWebView know that it needs to recompute the background color.
856
857         (WebKit::ViewGestureController::removeSwipeSnapshot):
858         Clear the background color so that the next time we commit, WKWebView
859         will get an invalid color from ViewGestureController and fall back
860         to the page's extended background color instead.
861
862         * UIProcess/mac/ViewGestureController.h:
863         (WebKit::ViewGestureController::backgroundColorForCurrentSnapshot):
864         * UIProcess/mac/ViewGestureControllerMac.mm:
865         (WebKit::ViewGestureController::beginSwipeGesture):
866         (WebKit::ViewGestureController::removeSwipeSnapshot):
867         Keep backgroundColorForCurrentSnapshot up to date on Mac too, even
868         though we don't use it yet.
869
870 2015-03-31  Timothy Horton  <timothy_horton@apple.com>
871
872         [iOS] Rotating PDF in Safari scrolls to the wrong position
873         https://bugs.webkit.org/show_bug.cgi?id=143259
874         <rdar://problem/19872693>
875
876         Reviewed by Dan Bernstein.
877
878         * UIProcess/ios/WKPDFView.mm:
879         (-[WKPDFView web_setMinimumSize:]):
880         Maintan the relative top/left within the rescaled document.
881
882 2015-03-31  Chris Dumez  <cdumez@apple.com>
883
884         [WK2][iOS] Extend ProcessThrottler use to the NetworkProcess
885         https://bugs.webkit.org/show_bug.cgi?id=143249
886         <rdar://problem/20231539>
887
888         Reviewed by Gavin Barraclough.
889
890         Extend ProcessThrottler use to the NetworkProcess instead of only the
891         WebProcesses. This is needed so that the NetworkProcess gets notified
892         before suspension. We now use this notification to free-up memory
893         before suspending by calling the critical memory pressure handler, as
894         we already do for WebProcesses (rdar://problem/20231539). In the
895         future, this infrastructure will be used to delay suspension until the
896         pending SQL transactions are done as well (rdar://problem/20180799).
897
898         Previously, the NetworkProcessProxy would hold a foreground assertion
899         on behalf of the NetworkProcess but would never release that assertion.
900         In this patch, we change this so that WebProcessProxies hold assertions
901         on behalf of the NetworkProcess, and release those assertions before
902         suspending. As a result, the NetworkProcess gets suspended when all
903         WebProcesses are suspended.
904
905         * NetworkProcess/NetworkProcess.cpp:
906         (WebKit::NetworkProcess::processWillSuspend):
907         (WebKit::NetworkProcess::cancelProcessWillSuspend):
908         (WebKit::NetworkProcess::processDidResume):
909         * NetworkProcess/NetworkProcess.h:
910         * NetworkProcess/NetworkProcess.messages.in:
911         * UIProcess/Network/NetworkProcessProxy.cpp:
912         (WebKit::NetworkProcessProxy::NetworkProcessProxy):
913         (WebKit::NetworkProcessProxy::didFinishLaunching):
914         (WebKit::NetworkProcessProxy::sendProcessWillSuspend):
915         (WebKit::NetworkProcessProxy::sendCancelProcessWillSuspend):
916         (WebKit::NetworkProcessProxy::didCancelProcessSuspension):
917         (WebKit::NetworkProcessProxy::sendProcessDidResume):
918         (WebKit::NetworkProcessProxy::processReadyToSuspend):
919         * UIProcess/Network/NetworkProcessProxy.h:
920         (WebKit::NetworkProcessProxy::throttler):
921         * UIProcess/Network/NetworkProcessProxy.messages.in:
922         * UIProcess/ProcessThrottler.cpp:
923         (WebKit::ProcessThrottler::ProcessThrottler):
924         (WebKit::ProcessThrottler::didConnectToProcess):
925         (WebKit::ProcessThrottler::didConnnectToProcess): Deleted.
926         * UIProcess/ProcessThrottler.h:
927         * UIProcess/ProcessThrottlerClient.h: Added.
928         (WebKit::ProcessThrottlerClient::~ProcessThrottlerClient):
929         * UIProcess/WebProcessPool.cpp:
930         (WebKit::WebProcessPool::ensureNetworkProcess):
931         * UIProcess/WebProcessPool.h:
932         * UIProcess/WebProcessProxy.cpp:
933         (WebKit::WebProcessProxy::didFinishLaunching):
934         (WebKit::WebProcessProxy::initializeNetworkProcessActivityToken):
935         (WebKit::WebProcessProxy::sendProcessDidResume):
936         (WebKit::WebProcessProxy::processReadyToSuspend):
937         * UIProcess/WebProcessProxy.h:
938         * WebKit2.xcodeproj/project.pbxproj:
939
940 2015-03-31  Csaba Osztrogonác  <ossy@webkit.org>
941
942         Unreviewed, revert accidental change by r182138.
943
944         * Scripts/generate-forwarding-headers.pl:
945         (createForwardingHeadersForFramework):
946
947 2015-03-31  Carlos Garcia Campos  <cgarcia@igalia.com>
948
949         Unreviewed. Fix GTK+ build with REDIRECTED_XCOMPOSITE_WINDOW disabled in X11 platform.
950
951         Also fix some unused parameter warnings when
952         REDIRECTED_XCOMPOSITE_WINDOW is disabled.
953
954         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
955         (webkitWebViewRenderAcceleratedCompositingResults):
956         (resizeWebKitWebViewBaseFromAllocation):
957
958 2015-03-31  Carlos Garcia Campos  <cgarcia@igalia.com>
959
960         [GTK] DnD icon/widget has odd background
961         https://bugs.webkit.org/show_bug.cgi?id=143217
962
963         Reviewed by Martin Robinson.
964
965         Use gtk_drag_set_icon_surface() to set the drag icon image,
966         instead of DragIcon class.
967
968         * UIProcess/API/gtk/WebKitWebView.cpp:
969         * UIProcess/gtk/DragAndDropHandler.cpp:
970         (WebKit::DragAndDropHandler::startDrag):
971         * UIProcess/gtk/DragAndDropHandler.h:
972
973 2015-03-30  Commit Queue  <commit-queue@webkit.org>
974
975         Unreviewed, rolling out r182172.
976         https://bugs.webkit.org/show_bug.cgi?id=143250
977
978         Since this class is an API object, we don't know for sure when
979         it will be destroyed. (Requested by kling on #webkit).
980
981         Reverted changeset:
982
983         "WebBackForwardList doesn't need to manually clear the
984         snapshot of an entry when removing it."
985         https://bugs.webkit.org/show_bug.cgi?id=143231
986         http://trac.webkit.org/changeset/182172
987
988 2015-03-30  Andreas Kling  <akling@apple.com>
989
990         WebBackForwardList doesn't need to manually clear the snapshot of an entry when removing it.
991         <https://webkit.org/b/143231>
992
993         Reviewed by Tim Horton.
994
995         Now that we don't keep WebBackForwardListItem objects alive forever, it's not necessary
996         to clear the snapshot when removing them from the WebBackForwardList, since the entire
997         object will be deleted shortly after that anyway.
998
999         * UIProcess/WebBackForwardList.cpp:
1000         (WebKit::WebBackForwardList::didRemoveItem):
1001
1002 2015-03-30  Enrica Casucci  <enrica@apple.com>
1003
1004         [iOS] WebContent crashing at WebCore: WebCore::Range::collectSelectionRects.
1005         https://bugs.webkit.org/show_bug.cgi?id=143234
1006         <rdar://problem/18571345>
1007
1008         Reviewed by Tim Horton.
1009
1010         This is a speculative fix that adds a null check before referencing the range.
1011         In both places where the check has been added the range returned by the call
1012         that should create it could be null.
1013
1014         * WebProcess/WebPage/ios/WebPageIOS.mm:
1015         (WebKit::WebPage::platformEditorState):
1016
1017 2015-03-30  Sam Weinig  <sam@webkit.org>
1018
1019         [Content Extensions] Flesh out the UserContentExtensionStore
1020         https://bugs.webkit.org/show_bug.cgi?id=143123
1021
1022         Reviewed by Benjamin Poulain.
1023
1024         * Shared/WebCompiledContentExtension.cpp:
1025         (WebKit::WebCompiledContentExtension::createFromCompiledContentExtensionData):
1026         * Shared/WebCompiledContentExtensionData.cpp:
1027         (WebKit::WebCompiledContentExtensionData::encode):
1028         (WebKit::WebCompiledContentExtensionData::decode):
1029         * Shared/WebCompiledContentExtensionData.h:
1030         (WebKit::WebCompiledContentExtensionData::WebCompiledContentExtensionData):
1031         Switch the order in memory of actions and bytecode (and switch the order of the
1032         variables as well, to keep it clear). This will become necessary when streaming
1033         the data to disk, as actions are created before the bytecode and we would have to keep them
1034         in memory until the bytecode was finished compiling if they didn't come before in the file.
1035
1036         * UIProcess/API/APIUserContentExtensionStore.h:
1037         * UIProcess/API/APIUserContentExtensionStore.cpp:
1038         (API::UserContentExtensionStore::defaultStore):
1039         Add accessor for the processes default shared store.
1040
1041         (API::constructedPath):
1042         Helper for constructing the path to a file in the store based on identifier.
1043
1044         (API::encodeContentExtensionMetaData):
1045         (API::decodeContentExtensionMetaData):
1046         Helpers for encoding/decoding the file metadata (version, bytecode size, actions size).
1047
1048         (API::openAndMapContentExtension):
1049         Helper to open and map a filed back content extension.
1050
1051         (API::writeDataToFile):
1052         Helper to write a Data object to a file.
1053
1054         (API::compiledToFile):
1055         Helper to run the content extension compiler and write it to disk. It first
1056         writes it to a temporary file and then does an atomic rename operation to put
1057         the file in the final location. Doing this means that if the process crashes while
1058         the compile is taking place, the partially written file won't end up in the cache, 
1059         but rather, will be cleaned up by the OS.
1060  
1061         (API::UserContentExtensionStore::lookupContentExtension):
1062         API entry point to lookup an extension that has been compiled to disk. On a background queue,
1063         it attempts to open and map the extension (based on the identifier passed in) and return it
1064         to the caller via the callback function passed in.
1065         
1066         (API::UserContentExtensionStore::compileContentExtension):
1067         API entry point to compile an extension and write it to store. On a background queue, it 
1068         compiles the file to disk and if successful, returns the memory mapped data via the callback
1069         function passed in.
1070
1071         (API::UserContentExtensionStore::removeContentExtension):
1072         API entry point to remove an extension from the store. On a background queue, it 
1073         unlinks the extension (based on the identifier passed in) and tells the caller it completed
1074         the action vial the callback function passed in.
1075
1076         (API::UserContentExtensionStore::synchronousRemoveAllContentExtensions):
1077         Helper for testing which synchronously unlinks all the files in the store.
1078
1079         (API::userContentExtensionStoreErrorCategory):
1080         std::error_code adaptor for some generic errors that can happen in the store. We will want
1081         to flesh these out further.
1082
1083         * UIProcess/API/Cocoa/APIUserContentExtensionStoreCocoa.mm: Added.
1084         (API::UserContentExtensionStore::defaultStorePath):
1085         Helper to get the platform specific path for the store.
1086
1087         * UIProcess/API/C/WKUserContentExtensionStoreRef.cpp:
1088         (WKUserContentExtensionStoreGetTypeID):
1089         Add ENABLE(CONTENT_EXTENSIONS) guards.
1090
1091         * UIProcess/API/Cocoa/_WKUserContentExtensionStore.h:
1092         * UIProcess/API/Cocoa/_WKUserContentExtensionStore.mm:
1093         (-[_WKUserContentExtensionStore dealloc]):
1094         (+[_WKUserContentExtensionStore defaultStore]):
1095         (-[_WKUserContentExtensionStore compileContentExtensionForIdentifier:encodedContentExtension:completionHandler:]):
1096         (-[_WKUserContentExtensionStore lookupContentExtensionForIdentifier:completionHandler:]):
1097         (-[_WKUserContentExtensionStore removeContentExtensionForIdentifier:completionHandler:]):
1098         (-[_WKUserContentExtensionStore _removeAllContentExtensions]):
1099         (-[_WKUserContentExtensionStore init]): Deleted.
1100         * UIProcess/API/Cocoa/_WKUserContentExtensionStoreInternal.h:
1101         * UIProcess/API/Cocoa/_WKUserContentExtensionStorePrivate.h: Added.
1102         SPI wrappers for the store.
1103
1104         * WebKit2.xcodeproj/project.pbxproj:
1105         Add new files.
1106
1107 2015-03-30  Antti Koivisto  <antti@apple.com>
1108
1109         Don't cache resources that are very unlikely to be reused
1110         https://bugs.webkit.org/show_bug.cgi?id=143226
1111
1112         Reviewed by Chris Dumez.
1113
1114         Follow-up to cover Cache-control: no-cache case which also has zero cache lifetime.
1115
1116         * NetworkProcess/cache/NetworkCache.cpp:
1117         (WebKit::NetworkCache::makeStoreDecision):
1118
1119 2015-03-30  Antti Koivisto  <antti@apple.com>
1120
1121         Include cache entry worth to json dump
1122         https://bugs.webkit.org/show_bug.cgi?id=143202
1123
1124         Follow-up fix.
1125
1126         * NetworkProcess/cache/NetworkCacheStorage.cpp:
1127         (WebKit::NetworkCache::computeRecordWorth):
1128
1129             This accidentally gave the error case worth 1 rather than 0 as it should be.
1130
1131 2015-03-30  Antti Koivisto  <antti@apple.com>
1132
1133         Don't cache resources that are very unlikely to be reused
1134         https://bugs.webkit.org/show_bug.cgi?id=143226
1135         <rdar://problem/20347160>
1136
1137         Reviewed by Geoff Garen.
1138
1139         We are writing lots of resources to the cache that are never used again.
1140
1141         In browse-around-randomly test this reduced number of cache entries created by ~20% and bytes written by ~5%.
1142
1143         * NetworkProcess/cache/NetworkCache.cpp:
1144         (WebKit::NetworkCache::makeUseDecision):
1145         (WebKit::NetworkCache::makeRetrieveDecision):
1146
1147             Rename for clarity.
1148
1149         (WebKit::NetworkCache::makeStoreDecision):
1150
1151             Store only if the resource has non-zero expiration or has validation headers.
1152
1153             Very High priority resources (main resources) keep the existing policy to minimize impact
1154             on back navigation and tab restore.
1155
1156         (WebKit::NetworkCache::Cache::retrieve):
1157         (WebKit::NetworkCache::Cache::store):
1158         (WebKit::NetworkCache::canUse): Deleted.
1159         (WebKit::NetworkCache::canRetrieve): Deleted.
1160         (WebKit::NetworkCache::canStore): Deleted.
1161         * NetworkProcess/cache/NetworkCache.h:
1162         * NetworkProcess/cache/NetworkCacheStatistics.cpp:
1163         (WebKit::NetworkCache::storeDecisionToDiagnosticKey):
1164
1165 2015-03-30  Tim Horton  <timothy_horton@apple.com>
1166
1167         Swipe snapshot removed too early (jumps around) on arstechnica and NYT
1168         https://bugs.webkit.org/show_bug.cgi?id=143199
1169         <rdar://problem/18420467>
1170
1171         Reviewed by Dan Bernstein.
1172
1173         Make ViewGestureControllerIOS's snapshot removal timing behave more like the Mac version.
1174
1175         * UIProcess/API/Cocoa/WKWebView.mm:
1176         (-[WKWebView _didCommitLayerTree:]):
1177         Let ViewGestureController know when the page has finished state restoration.
1178
1179         (-[WKWebView _didFinishLoadForMainFrame]):
1180         (-[WKWebView _didSameDocumentNavigationForMainFrame:]):
1181         Forward these to ViewGestureController.
1182
1183         * UIProcess/API/Cocoa/WKWebViewInternal.h:
1184         * UIProcess/ios/PageClientImplIOS.mm:
1185         (WebKit::PageClientImpl::didFinishLoadForMainFrame):
1186         Forward didFinishLoadForMainFrame to WKWebView.
1187
1188         * UIProcess/ios/ViewGestureControllerIOS.mm:
1189         (WebKit::ViewGestureController::ViewGestureController):
1190         (WebKit::ViewGestureController::endSwipeGesture):
1191         Split the swipe snapshot removal state into a bunch of bools.
1192
1193         (WebKit::ViewGestureController::willCommitPostSwipeTransitionLayerTree):
1194         (WebKit::ViewGestureController::setRenderTreeSize):
1195         (WebKit::ViewGestureController::removeSwipeSnapshotIfReady):
1196         (WebKit::ViewGestureController::removeSwipeSnapshot):
1197         Unify the snapshot removal logic into one function; removeSwipeSnapshotIfReady
1198         completely owns the decision. For now, we're waiting for everything, but
1199         we can do better in the future (using firstVisuallyNonEmptyLayout like Mac used to).
1200
1201         (WebKit::ViewGestureController::didRestoreScrollPosition):
1202         (WebKit::ViewGestureController::didFinishLoadForMainFrame):
1203         (WebKit::ViewGestureController::didSameDocumentNavigationForMainFrame):
1204         (WebKit::ViewGestureController::activeLoadMonitoringTimerFired):
1205         Add more conditions for swipe snapshot removal. We'll now wait for
1206         didFinishLoadForMainFrame (or didSameDocumentNavigationForMainFrame),
1207         for active loads to finish, and for the scroll position to be restored.
1208         This brings the iOS implementation in line with the slightly better Mac
1209         implementation, and also sets the stage for deduplication of all of this code.
1210         
1211         * UIProcess/mac/ViewGestureController.h:
1212         * UIProcess/mac/ViewGestureControllerMac.mm:
1213         (WebKit::ViewGestureController::ViewGestureController):
1214
1215 2015-03-30  Chris Dumez  <cdumez@apple.com>
1216
1217         [WK2][NetworkCache] Add support for "Cache-Control: max-stale" request header
1218         https://bugs.webkit.org/show_bug.cgi?id=143159
1219         <rdar://problem/20333296>
1220
1221         Reviewed by Antti Koivisto.
1222
1223         Add support for "Cache-Control: max-stale" request header:
1224         https://tools.ietf.org/html/rfc7234#section-5.2.1.2
1225
1226         * NetworkProcess/cache/NetworkCache.cpp:
1227         (WebKit::NetworkCache::responseHasExpired):
1228         (WebKit::NetworkCache::requestRequiresRevalidation):
1229         (WebKit::NetworkCache::canUse):
1230
1231 2015-03-30  Csaba Osztrogonác  <ossy@webkit.org>
1232
1233         [EFL][GTK] WebKit2's generate-forwarding-headers.pl should fail if clashing headers found
1234         https://bugs.webkit.org/show_bug.cgi?id=142909
1235
1236         Reviewed by Philippe Normand.
1237
1238         * Scripts/generate-forwarding-headers.pl:
1239         (createForwardingHeadersForFramework):
1240
1241 2015-03-29  Antti Koivisto  <antti@apple.com>
1242
1243         Include cache entry worth to json dump
1244         https://bugs.webkit.org/show_bug.cgi?id=143202
1245
1246         Reviewed by Darin Adler.
1247
1248         This is useful for analyzing cache performance.
1249         Also include the body size, total item count and average worth.
1250
1251         * NetworkProcess/cache/NetworkCache.cpp:
1252         (WebKit::NetworkCache::Cache::traverse):
1253         (WebKit::NetworkCache::Cache::dumpContentsToFile):
1254         * NetworkProcess/cache/NetworkCacheEntry.cpp:
1255         (WebKit::NetworkCache::Entry::asJSON):
1256         * NetworkProcess/cache/NetworkCacheEntry.h:
1257         * NetworkProcess/cache/NetworkCacheStorage.cpp:
1258         (WebKit::NetworkCache::Storage::traverse):
1259
1260             Add flags for specificying what sort of information is needed.
1261
1262         (WebKit::NetworkCache::computeRecordWorth):
1263
1264             Factor to a function.
1265
1266         (WebKit::NetworkCache::deletionProbability):
1267         * NetworkProcess/cache/NetworkCacheStorage.h:
1268
1269 2015-03-29  Simon Fraser  <simon.fraser@apple.com>
1270
1271         Fix iOS scrollperf crash after a web process crash
1272         https://bugs.webkit.org/show_bug.cgi?id=143110
1273
1274         Reviewed by Dean Jackson.
1275         
1276         When we destroy the drawing area after a web process crash, we also need to destroy
1277         the scrollingPerformanceData which has a reference to the drawing area.
1278
1279         * UIProcess/WebPageProxy.cpp:
1280         (WebKit::WebPageProxy::resetState):
1281
1282 2015-03-29  Simon Fraser  <simon.fraser@apple.com>
1283
1284         Convert arguments to ScrollingCoordinator functions to references
1285         https://bugs.webkit.org/show_bug.cgi?id=143198
1286
1287         Reviewed by Darin Adler.
1288
1289         Convert all the FrameView* and ScrollableArea* arguments to ScrollingCoordinator functions to
1290         references, and use references in a few other places.
1291
1292         * WebProcess/Scrolling/RemoteScrollingCoordinator.h:
1293         * WebProcess/Scrolling/RemoteScrollingCoordinator.mm:
1294         (WebKit::RemoteScrollingCoordinator::coordinatesScrollingForFrameView):
1295
1296 2015-03-29  Enrica Casucci  <enrica@apple.com>
1297
1298         [iOS WK2] WKContentView should implement _selectionClipRect
1299         https://bugs.webkit.org/show_bug.cgi?id=143143
1300         rdar://problem/20330075
1301
1302         Reviewed by Benjamin Poulain.
1303
1304         UIKit checks if the text delegate responds to this selector
1305         to retrieve the clipping rectangle for the editable element
1306         where the selection is being create.
1307
1308         * UIProcess/ios/WKContentViewInteraction.mm:
1309         (-[WKContentView _selectionClipRect]):
1310
1311 2015-03-29  Antti Koivisto  <antti@apple.com>
1312
1313         Use st_mtime instead of st_atime to track file access time
1314         https://bugs.webkit.org/show_bug.cgi?id=143200
1315
1316         Reviewed by Darin Adler.
1317
1318         On OS X atime updates automatically on read so calling Storage::traverse() would always ends up updating access times
1319         for all cache entries to the current time. This would make entry worth computation produce unexpected results.
1320         We update mtime manually on successful cache retrieve only so switching to it fixes the problem.
1321
1322         * NetworkProcess/cache/NetworkCacheFileSystemPosix.h:
1323         (WebKit::NetworkCache::fileTimes):
1324         (WebKit::NetworkCache::updateFileModificationTimeIfNeeded):
1325         (WebKit::NetworkCache::updateFileAccessTimeIfNeeded): Deleted.
1326         * NetworkProcess/cache/NetworkCacheStorage.cpp:
1327         (WebKit::NetworkCache::Storage::updateFileModificationTime):
1328         (WebKit::NetworkCache::Storage::dispatchReadOperation):
1329         (WebKit::NetworkCache::deletionProbability):
1330         (WebKit::NetworkCache::Storage::updateFileAccessTime): Deleted.
1331         * NetworkProcess/cache/NetworkCacheStorage.h:
1332
1333 2015-03-27  Gwang Yoon Hwang  <yoon@igalia.com>
1334
1335         [TexMap] Seperate BitmapTexture related classes implementations from TextureMapper
1336         https://bugs.webkit.org/show_bug.cgi?id=142386
1337
1338         Reviewed by Žan Doberšek.
1339
1340         TextureMapper and TextureMapperGL are bloated and tightly coupled with
1341         BitmapTexture. We should move these classes to seperated file of their own.
1342         Also, this patch removes friend relationship from TextureMapperGL and  its
1343         subsidiary classes.
1344
1345         The main purpose of this refactoring is to expose BitmapTexturePool to
1346         renderers of platformlayers like Video and Canvas. By doing this, each
1347         renderer can acquire textures from the global texture pool to paint
1348         their contents directly.
1349
1350         * Shared/CoordinatedGraphics/WebCoordinatedSurface.cpp: Include BitmapTextureGL.h explicitly
1351
1352 2015-03-27  Anders Carlsson  <andersca@apple.com>
1353
1354         Use a typedef for the WKPluginLoadClientPolicy enum
1355         https://bugs.webkit.org/show_bug.cgi?id=143161
1356
1357         Reviewed by Tim Horton.
1358
1359         * UIProcess/API/C/WKPluginLoadPolicy.h:
1360
1361 2015-03-27  Chris Dumez  <cdumez@apple.com>
1362
1363         [WK2][NetworkCache] Use WTF::WorkQueue abstraction inside NetworkCacheStatistics
1364         https://bugs.webkit.org/show_bug.cgi?id=143154
1365
1366         Reviewed by Antti Koivisto.
1367
1368         Use WTF::WorkQueue abstraction inside NetworkCacheStatistics, like we
1369         already do in NetworkCacheStorage.
1370
1371         * NetworkProcess/cache/NetworkCacheStatistics.cpp: Renamed from Source/WebKit2/NetworkProcess/cache/NetworkCacheStatisticsCocoa.mm.
1372         (WebKit::NetworkCache::executeSQLCommand):
1373         (WebKit::NetworkCache::executeSQLStatement):
1374         (WebKit::NetworkCache::Statistics::open):
1375         (WebKit::NetworkCache::Statistics::Statistics):
1376         (WebKit::NetworkCache::Statistics::initialize):
1377         (WebKit::NetworkCache::Statistics::bootstrapFromNetworkCache):
1378         (WebKit::NetworkCache::Statistics::shrinkIfNeeded):
1379         (WebKit::NetworkCache::Statistics::recordRetrievalRequest):
1380         (WebKit::NetworkCache::Statistics::recordNotCachingResponse):
1381         (WebKit::NetworkCache::retrieveDecisionToDiagnosticKey):
1382         (WebKit::NetworkCache::Statistics::recordNotUsingCacheForRequest):
1383         (WebKit::NetworkCache::storeDecisionToDiagnosticKey):
1384         (WebKit::NetworkCache::Statistics::recordRetrievalFailure):
1385         (WebKit::NetworkCache::cachedEntryReuseFailureToDiagnosticKey):
1386         (WebKit::NetworkCache::Statistics::recordRetrievedCachedEntry):
1387         (WebKit::NetworkCache::Statistics::markAsRequested):
1388         (WebKit::NetworkCache::Statistics::writeTimerFired):
1389         (WebKit::NetworkCache::Statistics::queryWasEverRequested):
1390         (WebKit::NetworkCache::Statistics::clear):
1391         (WebKit::NetworkCache::Statistics::addHashesToDatabase):
1392         (WebKit::NetworkCache::Statistics::addStoreDecisionsToDatabase):
1393         * NetworkProcess/cache/NetworkCacheStatistics.h:
1394         (WebKit::NetworkCache::Statistics::serialBackgroundIOQueue):
1395         * WebKit2.xcodeproj/project.pbxproj:
1396
1397 2015-03-27  Ryosuke Niwa  <rniwa@webkit.org>
1398
1399         Safari clears selection when its window gets activated via mouse down
1400         https://bugs.webkit.org/show_bug.cgi?id=143157
1401
1402         Reviewed by Anders Carlsson.
1403
1404         The bug was caused by PlatformMouseEvent created in WebKit2 not having its event number
1405         even though we were correctly calling setActivationEventNumber in WebPage::acceptsFirstMouse.
1406
1407         Fixed the bug by storing [NSEvent eventNumber] in WebMouseEvent on Mac in WebKit2 as done in WebKit1.
1408
1409         * Shared/WebEvent.h:
1410         (WebKit::WebMouseEvent::eventNumber):
1411         * Shared/WebEventConversion.cpp:
1412         (WebKit::WebKit2PlatformMouseEvent::WebKit2PlatformMouseEvent):
1413         * Shared/WebMouseEvent.cpp:
1414         (WebKit::WebMouseEvent::WebMouseEvent):
1415         (WebKit::WebMouseEvent::encode):
1416         (WebKit::WebMouseEvent::decode):
1417         * Shared/mac/WebEventFactory.mm:
1418         (WebKit::WebEventFactory::createWebMouseEvent):
1419
1420 2015-03-27  Anders Carlsson  <andersca@apple.com>
1421
1422         Only do the Connection::setShouldCloseConnectionOnMachExceptions() hack where necessary
1423         https://bugs.webkit.org/show_bug.cgi?id=143141
1424         rdar://problem/19471284
1425
1426         Reviewed by Andreas Kling.
1427
1428         * Platform/IPC/Connection.h:
1429         * Platform/IPC/mac/ConnectionMac.mm:
1430         (IPC::Connection::platformInvalidate):
1431         (IPC::Connection::platformInitialize):
1432         (IPC::Connection::open):
1433         * Shared/ChildProcessProxy.cpp:
1434         (WebKit::ChildProcessProxy::didFinishLaunching):
1435         * UIProcess/Plugins/PluginProcessProxy.cpp:
1436         (WebKit::PluginProcessProxy::didFinishLaunching):
1437
1438 2015-03-27  Tim Horton  <timothy_horton@apple.com>
1439
1440         Implement iOS WebKit2 PDF Find-in-Page
1441         https://bugs.webkit.org/show_bug.cgi?id=143065
1442         <rdar://problem/16793370>
1443
1444         Reviewed by Dan Bernstein.
1445
1446         * Platform/spi/ios/CorePDFSPI.h:
1447         Add some SPI.
1448
1449         * UIProcess/API/Cocoa/WKWebView.mm:
1450         (-[WKWebView _countStringMatches:options:maxCount:]):
1451         (-[WKWebView _findString:options:maxCount:]):
1452         (-[WKWebView _hideFindUI]):
1453         If we have a custom content view, forward find-in-page methods to it.
1454         
1455         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1456         * UIProcess/API/Cocoa/_WKFindOptions.h:
1457         Move _WKFindOptions into its own file.
1458
1459         * UIProcess/Cocoa/WKWebViewContentProvider.h:
1460         Add find-related methods to the WKWebViewContentProvider protocol.
1461
1462         * UIProcess/ios/WKPDFView.mm:
1463         (-[WKPDFView web_initWithFrame:webView:]):
1464         (-[WKPDFView dealloc]):
1465         Maintain a dispatch queue for searching the PDF.
1466
1467         (-[WKPDFView web_setContentProviderData:suggestedFilename:]):
1468         Fix a type.
1469
1470         (-[WKPDFView _ensureViewForPage:]):
1471         Split the code to create/parent a page view out from _revalidateViews,
1472         so that the find code can create/parent the targetted UIPDFPageView
1473         in order to install the find highlight in it, but before it is scrolled into view.
1474
1475         (-[WKPDFView _revalidateViews]):
1476         Use the stored page index instead of counting again.
1477         Don't unparent page views that have find-in-page highlights in them, because
1478         we won't know enough to recreate them later.
1479
1480         (-[WKPDFView _computePageAndDocumentFrames]):
1481         Put the page index in PDFPageInfo, for reference elsewhere.
1482
1483         (-[WKPDFView _stringCompareOptionsFromWKFindOptions:]):
1484         (-[WKPDFView _computeMatchesForString:options:maxCount:completionHandler:]):
1485         Asynchronously (and on our serial queue) search the PDF for the given string.
1486         We'll cache the most recent results to avoid searching more than once,
1487         cancel existing searches when another begins (since it's a serial queue,
1488         this ensures we'll only have one search active at a time).
1489
1490         (-[WKPDFView web_countStringMatches:options:maxCount:]):
1491         Count the number of matches for the given string, and inform the FindClient
1492         of the result.
1493
1494         (-[WKPDFView _didFindMatch:]):
1495         When we find a match, create a view for it, highlight the match, and
1496         zoom so that it's in-view.
1497
1498         (-[WKPDFView web_findString:options:maxCount:]):
1499         Incrementally search the document for the given string. We do an incremental
1500         search even if we have all of the results so that we can anchor the search
1501         in the right place if the new string is a prefix of the old string, etc.
1502         Wrap around appropriately when searching past the beginning or end of the
1503         document. If we have all of the results (there were less than maxCount results),
1504         look through the cached matches for the incrementally-found result and
1505         report its index to the client.
1506
1507         (-[WKPDFView web_hideFindUI]):
1508         Dismiss the selection and clear some state so we start the next search afresh.
1509
1510         * WebKit2.xcodeproj/project.pbxproj:
1511
1512 2015-03-27  Andreas Kling  <akling@apple.com>
1513
1514         WebProcessProxy should not retain WebBackForwardListItems forever.
1515         <https://webkit.org/b/143152>
1516         <rdar://problem/19925709>
1517
1518         Reviewed by Anders Carlsson.
1519
1520         Have WebProcessProxy actually forget about a WebBackForwardListItem after it's removed from
1521         the WebBackForwardList.
1522
1523         This ensures that we don't accumulate too many of these objects, which can get quite large
1524         due to the session state encoded in them.
1525
1526         We already have graceful handling of the case where an incoming IPC message references
1527         a removed back/forward list item.
1528
1529         * UIProcess/WebBackForwardList.cpp:
1530         (WebKit::WebBackForwardList::didRemoveItem):
1531         * UIProcess/WebPageProxy.cpp:
1532         (WebKit::WebPageProxy::backForwardRemovedItem):
1533         * UIProcess/WebProcessProxy.cpp:
1534         (WebKit::WebProcessProxy::removeBackForwardItem):
1535         * UIProcess/WebProcessProxy.h:
1536
1537 2015-03-27  Simon Fraser  <simon.fraser@apple.com>
1538
1539         Use the correct timebase to log scrollperf blank pixel counts on iOS
1540         https://bugs.webkit.org/show_bug.cgi?id=143149
1541
1542         Reviewed by Tim Horton.
1543         
1544         MobileSafari and WebKit need to collect scrollperf data using the same timebase;
1545         MobileSafari can't call WTF::monotonicallyIncreasingTime(), so use CFAbsoluteTimeGetCurrent()
1546         everywhere.
1547
1548         * UIProcess/Cocoa/RemoteLayerTreeScrollingPerformanceData.mm:
1549         (WebKit::RemoteLayerTreeScrollingPerformanceData::appendBlankPixelCount):
1550
1551 2015-03-27  Chris Dumez  <cdumez@apple.com>
1552
1553         [WK2][NetworkCache] Rename requestNeedsRevalidation() to requestRequiresRevalidation()
1554         https://bugs.webkit.org/show_bug.cgi?id=143137
1555
1556         Reviewed by Antti Koivisto.
1557
1558         Rename requestNeedsRevalidation() to requestRequiresRevalidation() as I
1559         think it is more accurate. It is not the request that needs revalidating.
1560         The requests just requires us to revalidate the response.
1561
1562         * NetworkProcess/cache/NetworkCache.cpp:
1563         (WebKit::NetworkCache::requestRequiresRevalidation):
1564         (WebKit::NetworkCache::canUse):
1565         (WebKit::NetworkCache::requestNeedsRevalidation): Deleted.
1566
1567 2015-03-27  Oliver Hunt  <oliver@apple.com>
1568
1569         Forward additional CFNetwork ATS information to child processes
1570         https://bugs.webkit.org/show_bug.cgi?id=143136
1571
1572         Reviewed by Anders Carlsson.
1573
1574         Add additional process creation parameter information, and pass it
1575         to the child processes that actually use CFNetwork.
1576
1577         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1578         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
1579         * Shared/Network/NetworkProcessCreationParameters.cpp:
1580         (WebKit::NetworkProcessCreationParameters::encode):
1581         (WebKit::NetworkProcessCreationParameters::decode):
1582         * Shared/Network/NetworkProcessCreationParameters.h:
1583         * Shared/Plugins/PluginProcessCreationParameters.cpp:
1584         (WebKit::PluginProcessCreationParameters::encode):
1585         (WebKit::PluginProcessCreationParameters::decode):
1586         * Shared/Plugins/PluginProcessCreationParameters.h:
1587         * Shared/WebProcessCreationParameters.cpp:
1588         (WebKit::WebProcessCreationParameters::encode):
1589         (WebKit::WebProcessCreationParameters::decode):
1590         * Shared/WebProcessCreationParameters.h:
1591         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1592         (WebKit::WebProcessPool::platformInitializeWebProcess):
1593         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
1594         * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
1595         (WebKit::PluginProcessProxy::platformInitializePluginProcess):
1596         * WebProcess/cocoa/WebProcessCocoa.mm:
1597         (WebKit::WebProcess::platformInitializeWebProcess):
1598
1599 2015-03-27  Chris Dumez  <cdumez@apple.com>
1600
1601         [WK2][NetworkCache] We only cache responses with status codes that are cacheable by default
1602         https://bugs.webkit.org/show_bug.cgi?id=143125
1603         <rdar://problem/20321172>
1604
1605         Reviewed by Antti Koivisto.
1606
1607         We Previously only cached responses with status codes that are cacheable
1608         by default [1]. However, RFC 7234 [2] allows us to cache responses with
1609         other status codes, as long as they have explicit headers allowing
1610         caching:
1611         - 'Expires' header field
1612         - 'max-age' response directive
1613
1614         This patch updates our caching policy accordingly to improve efficiency.
1615
1616         [1] http://tools.ietf.org/html/rfc7231#page-48
1617         [2] http://tools.ietf.org/html/rfc7234#section-4.3.2
1618
1619         Test: http/tests/cache/disk-cache/disk-cache-307-status-code.html
1620
1621         * NetworkProcess/cache/NetworkCache.cpp:
1622         (WebKit::NetworkCache::canStore):
1623
1624 2015-03-26  Antti Koivisto  <antti@apple.com>
1625
1626         Respect cache-control directives in request
1627         https://bugs.webkit.org/show_bug.cgi?id=143121
1628         rdar://problem/19714040
1629
1630         Reviewed by Chris Dumez.
1631
1632         Better support for https://tools.ietf.org/html/rfc7234#section-5.2.1
1633
1634         * NetworkProcess/cache/NetworkCache.cpp:
1635         (WebKit::NetworkCache::canUse):
1636
1637             Consider requests with Cache-control: no-cache and max-age=0 expired.
1638
1639         (WebKit::NetworkCache::canStore):
1640
1641             Don't store requests with Cache-control: no-store.
1642
1643         (WebKit::NetworkCache::Cache::store):
1644         * NetworkProcess/cache/NetworkCache.h:
1645         * NetworkProcess/cache/NetworkCacheStatisticsCocoa.mm:
1646         (WebKit::NetworkCache::storeDecisionToDiagnosticKey):
1647
1648 2015-03-25  Jon Honeycutt  <jhoneycutt@apple.com>
1649
1650         iOS file upload panel menu items need icons
1651         <https://bugs.webkit.org/show_bug.cgi?id=143042>
1652         <rdar://problem/20178678>
1653
1654         Reviewed by Andy Estes.
1655
1656         * Platform/spi/ios/UIKitSPI.h:
1657         Declare new SPI methods _UIImageGetWebKitTakePhotoOrVideoIcon and
1658         _UIImageGetWebKitPhotoLibraryIcon().
1659
1660         * UIProcess/ios/forms/WKFileUploadPanel.mm:
1661         (photoLibraryIcon):
1662         (cameraIcon):
1663         If UIKit SPI exists, use it. Otherwise, return nil.
1664
1665         (-[WKFileUploadPanel _showDocumentPickerMenu]):
1666         Use icons.
1667
1668 2015-03-26  Enrica Casucci  <enrica@apple.com>
1669
1670         OS X build fix after r182037.
1671
1672         Unreviewed.
1673
1674         * UIProcess/API/mac/WKView.mm:
1675         (-[WKView _addFontPanelObserver]):
1676         (-[WKView removeWindowObservers]):
1677         (-[WKView observeValueForKeyPath:ofObject:change:context:]):
1678
1679 2015-03-26  Enrica Casucci  <enrica@apple.com>
1680
1681         iOS build fix after r182037.
1682
1683         Unreviewed.
1684
1685         * UIProcess/API/Cocoa/WKWebView.mm:
1686         (-[WKWebView _setEditable:]):
1687
1688 2015-03-26  Enrica Casucci  <enrica@apple.com>
1689
1690         REGRESSION(r1807689): Slower startup time for WKWebView.
1691         https://bugs.webkit.org/show_bug.cgi?id=143115
1692         rdar://problem/20233711
1693
1694         Reviewed by Anders Carlsson.
1695
1696         In http://trac.webkit.org/changeset/180768 we added an observer to
1697         track visibility of the NSFontPanel to ensure we could fetch the font
1698         information for the current selection when the panel first becomes visible.
1699         It turns out that adding the observer requires the shared font panel
1700         object to be created.
1701         That is apparently a very expensive operation that is regressing
1702         the initialization time for the WKWebView.
1703         We should initialize the NSFontPanel lazily, only when we make the entire
1704         view editable.
1705
1706         * UIProcess/API/Cocoa/WKWebView.mm:
1707         (-[WKWebView _setEditable:]):
1708         * UIProcess/API/mac/WKView.mm:
1709         (-[WKView addWindowObserversForWindow:]):
1710         (-[WKView _addFontPanelObserver]):
1711         (-[WKView removeWindowObservers]):
1712         (-[WKView observeValueForKeyPath:ofObject:change:context:]):
1713         * UIProcess/API/mac/WKViewInternal.h:
1714
1715 2015-03-26  Alex Christensen  <achristensen@webkit.org>
1716
1717         Progress towards CMake on Mac.
1718         https://bugs.webkit.org/show_bug.cgi?id=143112
1719
1720         Reviewed by Chris Dumez.
1721
1722         * CMakeLists.txt:
1723         * PlatformMac.cmake:
1724         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
1725
1726 2015-03-26  Chris Dumez  <cdumez@apple.com>
1727
1728         [WK2][Cocoa] Add private API to override the network disk cache size
1729         https://bugs.webkit.org/show_bug.cgi?id=143113
1730         <rdar://problem/20315669>
1731
1732         Reviewed by Antti Koivisto.
1733
1734         Add private API to let the client override the network disk cache size.
1735         By default, the network disk cache is automatically determined based on
1736         the CacheModel and the available disk space. However, for testing
1737         purposes, it can be used for the client-side to be able to override
1738         the disk cache size.
1739
1740         * NetworkProcess/NetworkProcess.cpp:
1741         (WebKit::NetworkProcess::initializeNetworkProcess):
1742         * NetworkProcess/NetworkProcess.h:
1743         * NetworkProcess/cache/NetworkCache.cpp:
1744         (WebKit::NetworkCache::Cache::setMaximumSize):
1745         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1746         (WebKit::NetworkProcess::platformSetCacheModel):
1747         * Shared/Network/NetworkProcessCreationParameters.cpp:
1748         (WebKit::NetworkProcessCreationParameters::encode):
1749         (WebKit::NetworkProcessCreationParameters::decode):
1750         * Shared/Network/NetworkProcessCreationParameters.h:
1751         * UIProcess/API/APIProcessPoolConfiguration.cpp:
1752         (API::ProcessPoolConfiguration::copy):
1753         * UIProcess/API/APIProcessPoolConfiguration.h:
1754         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
1755         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
1756         (-[_WKProcessPoolConfiguration diskCacheSizeOverride]):
1757         (-[_WKProcessPoolConfiguration setDiskCacheSizeOverride:]):
1758         * UIProcess/WebProcessPool.cpp:
1759         (WebKit::WebProcessPool::WebProcessPool):
1760         (WebKit::WebProcessPool::ensureNetworkProcess):
1761         * UIProcess/WebProcessPool.h:
1762
1763 2015-03-26  Andreas Kling  <akling@apple.com>
1764
1765         [Darwin] Boost the web process QoS level while handling a synchronous IPC message.
1766         <https://webkit.org/b/142988>
1767         <rdar://problem/20264346>
1768
1769         Reviewed by Antti Koivisto and Anders Carlsson.
1770
1771         Add a mechanism for IPC::Connection to boost the main thread for the duration
1772         of processing a synchronous message.
1773
1774         This fixes an issue where the UI process would block on a synchronous request
1775         to the web process that was being carried out at a lower QoS level.
1776
1777         * Platform/IPC/Connection.cpp:
1778         (IPC::Connection::Connection): Save the main thread's pthread_t while we have
1779         a chance to retreive it.
1780
1781         (IPC::Connection::processIncomingMessage): Optionally boost the main thread when
1782         processing an incoming message with the IsSyncMessage flag set.
1783
1784         * Platform/IPC/Connection.h:
1785         (IPC::Connection::setShouldBoostMainThreadOnSyncMessage): Added. When this mode is
1786         enabled, Connection will give a temporary QoS override to the main thread when
1787         receiving a synchronous message. Ownership of the override is handed to the
1788         MessageDecoder, which resets the main thread QoS in its destructor.
1789
1790         * Platform/IPC/MessageDecoder.cpp:
1791         (IPC::MessageDecoder::~MessageDecoder): Remove any QoS override owned by this message.
1792
1793         * Platform/IPC/MessageDecoder.h:
1794         (IPC::MessageDecoder::setQOSClassOverride): Added. Takes ownership of a QoS override
1795         to make sure it stays in effect until this message has been dispatched.
1796
1797         * WebProcess/WebProcess.cpp:
1798         (WebKit::WebProcess::initializeConnection): Set up main thread QoS boosting for the
1799         web process's connection to the UI process.
1800
1801 2015-03-26  Ryosuke Niwa  <rniwa@webkit.org>
1802
1803         Cursor doesn't change back to pointer when leaving Mail
1804         https://bugs.webkit.org/show_bug.cgi?id=132038
1805
1806         Reviewed by Anders Carlsson.
1807
1808         Fixed the bug by adding a cursor rect and making the primary tracking area update the cursor so that
1809         AppKit will reset the cursor as it leaves the WebView.
1810
1811         We use nil cursor here since we manually update the cursor by calling [NSCursor set].
1812
1813         * UIProcess/API/mac/WKView.mm:
1814         (-[WKView initWithFrame:processPool:configuration:webView:]):
1815         * UIProcess/mac/PageClientImpl.mm:
1816         (WebKit::PageClientImpl::recommendedScrollbarStyleDidChange):
1817
1818 2015-03-26  Michael Catanzaro  <mcatanzaro@igalia.com>
1819
1820         [Linux] SeccompFilters: improve the port-agnostic whitelist
1821         https://bugs.webkit.org/show_bug.cgi?id=140064
1822
1823         Reviewed by Žan Doberšek.
1824
1825         Allow the web process to access several files and directories that it
1826         was previously prohibited from accessing. This makes the web process
1827         much less likely to break.
1828
1829         * Shared/linux/SeccompFilters/SyscallPolicy.cpp:
1830         (WebKit::SyscallPolicy::addDefaultWebProcessPolicy):
1831
1832 2015-03-26  Antti Koivisto  <antti@apple.com>
1833
1834         Remove unneeded isConditionalRequest check from NetworkResourceLoader
1835         https://bugs.webkit.org/show_bug.cgi?id=143096
1836
1837         Reviewed by Anders Carlsson.
1838
1839         This check is leftover from implementation that allowed disk cache to validate conditional
1840         request itself. The case can't happen as NetworkCache canRetrieve test does not allow
1841         conditional requests in the first place.
1842
1843         * NetworkProcess/NetworkResourceLoader.cpp:
1844         (WebKit::NetworkResourceLoader::didReceiveResponseAsync):
1845         (WebKit::isConditionalRequest): Deleted.
1846
1847 2015-03-26  Antti Koivisto  <antti@apple.com>
1848
1849         Rename Storage::Entry to Storage::Record
1850         https://bugs.webkit.org/show_bug.cgi?id=143101
1851
1852         Reviewed by Chris Dumez.
1853
1854         Lets have just one type called Entry in the cache code.
1855
1856         * NetworkProcess/cache/NetworkCache.cpp:
1857         (WebKit::NetworkCache::Cache::retrieve):
1858         (WebKit::NetworkCache::Cache::store):
1859         (WebKit::NetworkCache::Cache::update):
1860         (WebKit::NetworkCache::Cache::traverse):
1861         (WebKit::NetworkCache::Cache::dumpContentsToFile):
1862         * NetworkProcess/cache/NetworkCacheEntry.cpp:
1863         (WebKit::NetworkCache::Entry::Entry):
1864         (WebKit::NetworkCache::Entry::encodeAsStorageRecord):
1865         (WebKit::NetworkCache::Entry::decodeStorageRecord):
1866         (WebKit::NetworkCache::Entry::initializeBufferFromStorageRecord):
1867         (WebKit::NetworkCache::Entry::buffer):
1868         (WebKit::NetworkCache::Entry::shareableResourceHandle):
1869         (WebKit::NetworkCache::Entry::encode): Deleted.
1870         (WebKit::NetworkCache::Entry::decode): Deleted.
1871         (WebKit::NetworkCache::Entry::initializeBufferFromStorageEntry): Deleted.
1872         * NetworkProcess/cache/NetworkCacheEntry.h:
1873         (WebKit::NetworkCache::Entry::sourceStorageRecord):
1874         (WebKit::NetworkCache::Entry::sourceStorageEntry): Deleted.
1875         * NetworkProcess/cache/NetworkCacheStorage.cpp:
1876         (WebKit::NetworkCache::RecordMetaData::RecordMetaData):
1877         (WebKit::NetworkCache::decodeRecordMetaData):
1878         (WebKit::NetworkCache::decodeRecordHeader):
1879         (WebKit::NetworkCache::decodeRecord):
1880         (WebKit::NetworkCache::encodeRecordMetaData):
1881         (WebKit::NetworkCache::encodeRecordHeader):
1882         (WebKit::NetworkCache::Storage::dispatchReadOperation):
1883         (WebKit::NetworkCache::retrieveFromMemory):
1884         (WebKit::NetworkCache::Storage::store):
1885         (WebKit::NetworkCache::Storage::update):
1886         (WebKit::NetworkCache::Storage::traverse):
1887         (WebKit::NetworkCache::Storage::dispatchPendingWriteOperations):
1888         (WebKit::NetworkCache::Storage::dispatchFullWriteOperation):
1889         (WebKit::NetworkCache::Storage::dispatchHeaderWriteOperation):
1890         (WebKit::NetworkCache::EntryMetaData::EntryMetaData): Deleted.
1891         (WebKit::NetworkCache::decodeEntryMetaData): Deleted.
1892         (WebKit::NetworkCache::decodeEntryHeader): Deleted.
1893         (WebKit::NetworkCache::decodeEntry): Deleted.
1894         (WebKit::NetworkCache::encodeEntryMetaData): Deleted.
1895         (WebKit::NetworkCache::encodeEntryHeader): Deleted.
1896         * NetworkProcess/cache/NetworkCacheStorage.h:
1897
1898 2015-03-26  Chris Dumez  <cdumez@apple.com>
1899
1900         [WK2] Let the compiler generate the NetworkCache::Key move constructor
1901         https://bugs.webkit.org/show_bug.cgi?id=143079
1902
1903         Reviewed by Antti Koivisto.
1904
1905         Let the compiler generate the NetworkCache::Key move constructor. The
1906         generated one will do exactly the same thing as the one we had except
1907         that it will move the m_hash member as well. I don't see any reason why
1908         we weren't moving this member before (it is an std::array<uint8_t, 16>).
1909
1910         Also have the compiler generate a move assignment operator for
1911         consistency. Although it is not currently useful, it could be at some
1912         point.
1913
1914         * NetworkProcess/cache/NetworkCacheKey.cpp:
1915         (WebKit::NetworkCache::Key::Key): Deleted.
1916         * NetworkProcess/cache/NetworkCacheKey.h:
1917
1918 2015-03-26  Chris Dumez  <cdumez@apple.com>
1919
1920         [WK2][NetworkCache] Compute if a cached response has expired only when actually needed
1921         https://bugs.webkit.org/show_bug.cgi?id=143070
1922
1923         Reviewed by Antti Koivisto.
1924
1925         Compute if a cached response has expired only when actually needed:
1926         - This is not a history navigation
1927         and
1928         - It does not have "Cache-Control: no-cache" header
1929
1930         Previously, we would always determine if the response has expired and
1931         we often end up not using this information.
1932
1933         * NetworkProcess/cache/NetworkCache.cpp:
1934         (WebKit::NetworkCache::responseHasExpired):
1935         (WebKit::NetworkCache::canUse):
1936
1937 2015-03-26  Zan Dobersek  <zdobersek@igalia.com>
1938
1939         Avoid the Vector<> copy in WebTouchEvent constructor
1940         https://bugs.webkit.org/show_bug.cgi?id=143043
1941
1942         Reviewed by Carlos Garcia Campos.
1943
1944         Have the WebTouchEvent accept a Vector<> rvalue.
1945         The relevant code is updated so the Vector<> object is moved
1946         through the call chain and finally into the WebTouchEvent constructor.
1947
1948         * Shared/NativeWebTouchEvent.h:
1949         * Shared/WebEvent.h:
1950         * Shared/WebTouchEvent.cpp:
1951         (WebKit::WebTouchEvent::WebTouchEvent):
1952         * Shared/efl/WebEventFactory.cpp:
1953         (WebKit::WebEventFactory::createWebTouchEvent):
1954         * Shared/gtk/NativeWebTouchEventGtk.cpp:
1955         (WebKit::NativeWebTouchEvent::NativeWebTouchEvent):
1956         * Shared/gtk/WebEventFactory.cpp:
1957         (WebKit::WebEventFactory::createWebTouchEvent):
1958         * Shared/gtk/WebEventFactory.h:
1959         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
1960         (webkitWebViewBaseTouchEvent):
1961
1962 2015-03-25  Chris Dumez  <cdumez@apple.com>
1963
1964         [WK2] WebFrameLoaderClient::dispatchDecidePolicyForResponse() should always call the FramePolicyFunction
1965         https://bugs.webkit.org/show_bug.cgi?id=143036
1966         <rdar://problem/20252438>
1967         <rdar://problem/13811738>
1968
1969         Reviewed by Alexey Proskuryakov.
1970
1971         WebFrameLoaderClient::dispatchDecidePolicyForResponse() should always
1972         call the FramePolicyFunction. Previously, it would fail to do in 2
1973         cases:
1974         - m_frame->page() returns null
1975         or
1976         - webPage->sendSync() returns false
1977
1978         If the FramePolicyFunction is not called, we will fail to clear the
1979         callback in the PolicyChecker and
1980         DocumentLoader::continueAfterContentPolicy() will not be called.
1981
1982         DocumentLoader::continueAfterContentPolicy() is in charge of resetting
1983         m_waitingForContentPolicy flag to false. This could therefore explain
1984         the following assertion being hit in DocumentLoader::detachFromFrame()
1985         (see <rdar://problem/20252438>):
1986         RELEASE_ASSERT(!m_waitingForContentPolicy)
1987
1988         Also, as the PolicyChecker callback is not cleared, it could make it
1989         possible for DocumentLoader::continueAfterContentPolicy() to be called
1990         *after* the load is finished, when later canceling the PolicyCallback:
1991         FrameLoader::stopAllLoaders()
1992          -> PolicyChecker::stopCheck()
1993           -> PolicyCallback::cancel()
1994            -> DocumentLoader::continueAfterContentPolicy(PolicyIgnore)
1995
1996         Calling continueAfterContentPolicy(PolicyIgnore) after the load is
1997         finished would be bad and could explain some of the crashes we've seen
1998         in DocumentLoader::continueAfterContentPolicy() ->
1999         DocumentLoader:: stopLoadingForPolicyChange() (see
2000         <rdar://problem/13811738>).
2001
2002         This patch also applies the same fix to
2003         dispatchDecidePolicyForNewWindowAction() and
2004         dispatchDecidePolicyForNavigationAction() as they use the same pattern.
2005
2006         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2007         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
2008         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction):
2009         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
2010
2011 2015-03-25  Tim Horton  <timothy_horton@apple.com>
2012
2013         Add a preference to prevent "user-scalable=no" from having any effect
2014         https://bugs.webkit.org/show_bug.cgi?id=143032
2015
2016         Reviewed by Sam Weinig.
2017
2018         * Shared/WebPreferencesDefinitions.h:
2019         * WebProcess/WebPage/WebPage.cpp:
2020         (WebKit::WebPage::updatePreferences):
2021         Add a preference and push it to the ViewportConfiguration.
2022
2023 2015-03-25  Beth Dakin  <bdakin@apple.com>
2024
2025         REGRESSION (r181660): Force click url preview doesn't have a TextIndicator in Mail
2026         https://bugs.webkit.org/show_bug.cgi?id=143064
2027         -and corresponding-
2028         rdar://problem/20251440
2029
2030         Reviewed by Tim Horton.
2031
2032         The TextIndicator was getting set to nil by the call to 
2033         _dismissContentRelativeChildWindows in mouseDown. That line of code was added by 
2034         http://trac.webkit.org/changeset/177242 to work around a bug in another component 
2035         that has now been resolved, so it no longer appears to be necessary. 
2036
2037         * UIProcess/API/mac/WKView.mm:
2038         (-[WKView mouseDown:]):
2039
2040 2015-03-25  Anders Carlsson  <andersca@apple.com>
2041
2042         Add network and application cache directories to WebsiteDataStore
2043         https://bugs.webkit.org/show_bug.cgi?id=143063
2044
2045         Reviewed by Sam Weinig.
2046
2047         Create a WebKit directory under ~/Library/Caches/<Bundle ID> for non-sandboxed applications,
2048         and ~/Library/Caches for sandboxed applications. Create NetworkCache and OfflineWebApplicationCache
2049         subdirectories. These directories will be used with the modern WebKit API.
2050
2051         * UIProcess/API/APIWebsiteDataStore.h:
2052         * UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm:
2053         (API::WebsiteDataStore::cacheDirectoryFileSystemRepresentation):
2054         (API::WebsiteDataStore::defaultDataStoreConfiguration):
2055         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2056         (WebKit::WebsiteDataStore::WebsiteDataStore):
2057         * UIProcess/WebsiteData/WebsiteDataStore.h:
2058
2059 2015-03-25  Sam Weinig  <sam@webkit.org>
2060
2061         Address additional review feedback from https://bugs.webkit.org/show_bug.cgi?id=143059.
2062
2063         * Shared/WebCompiledContentExtension.cpp:
2064         (WebKit::WebCompiledContentExtension::createFromCompiledContentExtensionData):
2065         * UIProcess/API/C/WKUserContentFilterRef.cpp:
2066         (WKUserContentFilterCreate):
2067         * UIProcess/API/Cocoa/_WKUserContentFilter.mm:
2068         (-[_WKUserContentFilter initWithName:serializedRules:]):
2069
2070 2015-03-25  Sam Weinig  <sam@webkit.org>
2071
2072         [Content Extensions] Convert content extension compiling to return error codes and write its output using a client
2073         https://bugs.webkit.org/show_bug.cgi?id=143059
2074
2075         Reviewed by Alex Christensen.
2076
2077         * Shared/WebCompiledContentExtension.cpp:
2078         * Shared/WebCompiledContentExtension.h:
2079         (WebKit::LegacyContentExtensionCompilationClient::LegacyContentExtensionCompilationClient):
2080         (WebKit::LegacyContentExtensionCompilationClient::writeBytecode):
2081         (WebKit::LegacyContentExtensionCompilationClient::writeActions):
2082         Add subclass of ContentExtensionCompilationClient for use with the non-file backed content
2083         extensions.
2084
2085         * UIProcess/API/C/WKUserContentFilterRef.cpp:
2086         (WKUserContentFilterCreate):
2087         * UIProcess/API/Cocoa/_WKUserContentFilter.mm:
2088         (-[_WKUserContentFilter initWithName:serializedRules:]):
2089         Update to use the new interface of compileRuleList().
2090
2091 2015-03-25  Ryosuke Niwa  <rniwa@webkit.org>
2092
2093         Web Inspector: Switching tabs to window with inspector open prohibits typing into console
2094         https://bugs.webkit.org/show_bug.cgi?id=126800
2095
2096         Reviewed by Anders Carlsson.
2097
2098         This is a regression from r85356 and r83814. These two patches made WKWebView clear its selection
2099         when WKView resigns the first responder without ever restoring it even if WKView later becomes
2100         the first responder again. This is problematic when a text field or a editing host element had been
2101         focused and selected prior to the resignation since the editing code uses the selection to determine
2102         the editability of the element.
2103
2104         Fixed the bug by restoring selection in [WKView becomeFirstResponder] if the selection is empty.
2105
2106         * UIProcess/API/mac/WKView.mm:
2107         (-[WKView becomeFirstResponder]):
2108         * UIProcess/WebPageProxy.cpp:
2109         (WebKit::WebPageProxy::restoreSelectionInFocusedEditableElement):
2110         * UIProcess/WebPageProxy.h:
2111         * WebProcess/WebPage/WebPage.cpp:
2112         (WebKit::WebPage::restoreSelectionInFocusedEditableElement):
2113         * WebProcess/WebPage/WebPage.h:
2114         * WebProcess/WebPage/WebPage.messages.in:
2115
2116 2015-03-25  Beth Dakin  <bdakin@apple.com>
2117
2118         REGRESSION (r181660): Safari navigates to link after a starting and canceling a 
2119         force preview
2120         https://bugs.webkit.org/show_bug.cgi?id=143057
2121         -and corresponding-
2122         rdar://problem/20251436
2123
2124         Reviewed by Tim Horton.
2125
2126         Always call _page->immediateActionDidUpdate() so that the EventHandler’s 
2127         ImmediateActionStage is appropriately updated.
2128         * UIProcess/mac/WKImmediateActionController.mm:
2129         (-[WKImmediateActionController immediateActionRecognizerDidUpdateAnimation:]):
2130
2131         Update the EventHandler’s ImmediateActionStage.
2132         * WebProcess/WebPage/mac/WebPageMac.mm:
2133         (WebKit::WebPage::immediateActionDidUpdate):
2134
2135 2015-03-25  Antti Koivisto  <antti@apple.com>
2136
2137         Separate entry decoding from validation
2138         https://bugs.webkit.org/show_bug.cgi?id=143052
2139
2140         Reviewed by Chris Dumez.
2141
2142         Make NetworkCache::Cache a class and move it to a file of its own.
2143         Move the encoding/decoding code there.
2144
2145         * NetworkProcess/NetworkProcess.cpp:
2146         (WebKit::fetchDiskCacheEntries):
2147         (WebKit::clearDiskCacheEntries):
2148         * NetworkProcess/NetworkResourceLoader.cpp:
2149         (WebKit::sendReplyToSynchronousRequest):
2150         (WebKit::NetworkResourceLoader::start):
2151         (WebKit::NetworkResourceLoader::sendBufferMaybeAborting):
2152         (WebKit::NetworkResourceLoader::didRetrieveCacheEntry):
2153         (WebKit::NetworkResourceLoader::validateCacheEntry):
2154         * NetworkProcess/NetworkResourceLoader.h:
2155         * NetworkProcess/cache/NetworkCache.cpp:
2156         (WebKit::NetworkCache::collectVaryingRequestHeaders):
2157         (WebKit::NetworkCache::canUse):
2158
2159             Focused function for deciding if we can use a cache entry and if it needs validation.
2160
2161         (WebKit::NetworkCache::Cache::retrieve):
2162         (WebKit::NetworkCache::Cache::store):
2163         (WebKit::NetworkCache::Cache::update):
2164         (WebKit::NetworkCache::Cache::traverse):
2165         (WebKit::NetworkCache::encodeStorageEntry): Deleted.
2166         (WebKit::NetworkCache::decodeStorageEntry): Deleted.
2167         * NetworkProcess/cache/NetworkCache.h:
2168         * NetworkProcess/cache/NetworkCacheEntry.cpp: Added.
2169         (WebKit::NetworkCache::Entry::Entry):
2170         (WebKit::NetworkCache::Entry::encode):
2171         (WebKit::NetworkCache::Entry::decode):
2172         (WebKit::NetworkCache::Entry::initializeBufferFromStorageEntry):
2173         (WebKit::NetworkCache::Entry::buffer):
2174         (WebKit::NetworkCache::Entry::shareableResourceHandle):
2175         (WebKit::NetworkCache::Entry::needsValidation):
2176         (WebKit::NetworkCache::Entry::setNeedsValidation):
2177         * NetworkProcess/cache/NetworkCacheEntry.h: Added.
2178         (WebKit::NetworkCache::Entry::key):
2179         (WebKit::NetworkCache::Entry::timeStamp):
2180         (WebKit::NetworkCache::Entry::response):
2181         (WebKit::NetworkCache::Entry::varyingRequestHeaders):
2182         (WebKit::NetworkCache::Entry::sourceStorageEntry):
2183         * NetworkProcess/cache/NetworkCacheStatistics.h:
2184         * NetworkProcess/cache/NetworkCacheStatisticsCocoa.mm:
2185         (WebKit::NetworkCache::cachedEntryReuseFailureToDiagnosticKey):
2186         (WebKit::NetworkCache::Statistics::recordRetrievedCachedEntry):
2187         * WebKit2.xcodeproj/project.pbxproj:
2188
2189 2015-03-25  David Hyatt  <hyatt@apple.com>
2190
2191         Add a pref to enable the new block-inside-inline model
2192         https://bugs.webkit.org/show_bug.cgi?id=143050
2193
2194         Reviewed by Sam Weinig.
2195
2196         * Shared/WebPreferencesDefinitions.h:
2197         * UIProcess/API/C/WKPreferences.cpp:
2198         (WKPreferencesSetNewBlockInsideInlineModelEnabled):
2199         (WKPreferencesGetNewBlockInsideInlineModelEnabled):
2200         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2201         * WebProcess/WebPage/WebPage.cpp:
2202         (WebKit::WebPage::updatePreferences):
2203
2204 2015-03-25  Zan Dobersek  <zdobersek@igalia.com>
2205
2206         [WK2] WebUserMediaClient::pageDestroyed() virtual method should be marked as override
2207         https://bugs.webkit.org/show_bug.cgi?id=143046
2208
2209         Reviewed by Carlos Garcia Campos.
2210
2211         * WebProcess/WebCoreSupport/WebUserMediaClient.h: Mark the WebUserMediaClient::pageDestroyed()
2212         method, inherited from the WebCore::UserMediaClient, as an override.
2213
2214 2015-03-25  Zan Dobersek  <zdobersek@igalia.com>
2215
2216         [GTK][WK2] WebPageProxy::failedToShowPopupMenu() virtual method should be marked as override
2217         https://bugs.webkit.org/show_bug.cgi?id=143045
2218
2219         Reviewed by Carlos Garcia Campos.
2220
2221         * UIProcess/WebPageProxy.h: Mark the failedToShowPopupMenu(), inherited from
2222         the WebPopupMenuProxy::Client class, as overridden.
2223
2224 2015-03-25  Zan Dobersek  <zdobersek@igalia.com>
2225
2226         [WK2] Clean up DrawingAreaImpl vtable overrides
2227         https://bugs.webkit.org/show_bug.cgi?id=143044
2228
2229         Reviewed by Carlos Garcia Campos.
2230
2231         Declare virtual methods of the DrawingAreaImpl class as overridden where necessary.
2232
2233         * WebProcess/WebPage/DrawingAreaImpl.h:
2234         (WebKit::DrawingAreaImpl::layerTreeStateIsFrozen): Deleted.
2235         (WebKit::DrawingAreaImpl::layerTreeHost): Deleted.
2236
2237 2015-03-24  Ryosuke Niwa  <rniwa@webkit.org>
2238
2239         Inspector doesn't get focused when opened in dock mode
2240         https://bugs.webkit.org/show_bug.cgi?id=143030
2241
2242         Reviewed by Anders Carlsson.
2243
2244         The bug was caused by platformBringToFront and platformAttach calling makeFirstResponder on WKWebView,
2245         which aren't intended to become the first responder. Fixed the bug by calling makeFirstResponder on the WKView
2246         subview of the WKWebView, which is intended to be used as the first responder on behalf of the web view.
2247
2248         * UIProcess/mac/WebInspectorProxyMac.mm:
2249         (WebKit::WebInspectorProxy::platformBringToFront):
2250         (WebKit::WebInspectorProxy::platformAttach):
2251
2252 2015-03-24  Chris Dumez  <cdumez@apple.com>
2253
2254         [WK2] Responses with 302 HTTP Status Code should not be cached
2255         https://bugs.webkit.org/show_bug.cgi?id=143028
2256         <rdar://problem/19714040>
2257
2258         Reviewed by Antti Koivisto.
2259
2260         Responses with 302 HTTP Status Code should not be cached as per
2261         RFC 7231:
2262         http://tools.ietf.org/html/rfc7231#section-6.1
2263
2264         This patch updates our disk cache policy accordingly.
2265
2266         Test: http/tests/cache/disk-cache/disk-cache-302-status-code.html
2267
2268         * NetworkProcess/cache/NetworkCache.cpp:
2269         (WebKit::NetworkCache::canStore):
2270
2271 2015-03-24  Anders Carlsson  <andersca@apple.com>
2272
2273         Fix crash in WebKit::RemoteObjectRegistry::sendInvocation
2274         https://bugs.webkit.org/show_bug.cgi?id=143027
2275         rdar://problem/20208674
2276
2277         Reviewed by Sam Weinig.
2278
2279         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
2280         (-[WKWebProcessPlugInBrowserContextController dealloc]):
2281         Make sure to invalidate the _WKRemoteObjectRegistry like we do in the UI process.
2282
2283 2015-03-24  Chris Dumez  <cdumez@apple.com>
2284
2285         [WK2] Responses with 204 HTTP Status Code should be cacheable by default
2286         https://bugs.webkit.org/show_bug.cgi?id=143020
2287         <rdar://problem/20281529>
2288
2289         Reviewed by Antti Koivisto.
2290
2291         Make responses with 204 HTTP Status Code cacheable by default, as
2292         per RFC 7231:
2293         http://tools.ietf.org/html/rfc7231#section-6.3.5
2294
2295         Test: http/tests/cache/disk-cache/disk-cache-204-status-code.html
2296
2297         * NetworkProcess/cache/NetworkCache.cpp:
2298         (WebKit::NetworkCache::canStore):
2299
2300 2015-03-24  Enrica Casucci  <enrica@apple.com>
2301
2302         [iOS] Remove unused keyboard code in WKSelectPopover class.
2303         https://bugs.webkit.org/show_bug.cgi?id=143021
2304
2305         Reviewed by Joseph Pecoraro.
2306
2307         WKSelectPopover created an instance of UIKeyboard that was
2308         initialized in initWithView but never used. Removing the
2309         obsolete code.
2310
2311         * UIProcess/ios/forms/WKFormSelectPopover.mm:
2312         (-[WKSelectPopover initWithView:hasGroups:]):
2313
2314 2015-03-24  Dan Bernstein  <mitz@apple.com>
2315
2316         WebKit2 part of <rdar://problem/20282863> Transforms are flattened in snapshots of on-screen WKWebViews
2317         https://bugs.webkit.org/show_bug.cgi?id=143023
2318
2319         Reviewed by Tim Horton.
2320
2321         * UIProcess/API/Cocoa/WKWebView.mm:
2322         (-[WKWebView _snapshotRect:intoImageOfWidth:completionHandler:]): If the view is in a
2323         window, use CARenderServerRenderLayerWithTransform to synchronously capture a snapshot of
2324         its layer tree into an IOSurfcae, then call the completion handler with an image created
2325         from the IOSurface.
2326
2327 2015-03-24  Beth Dakin  <bdakin@apple.com>
2328
2329         Add events related to force click gesture
2330         https://bugs.webkit.org/show_bug.cgi?id=142836
2331         -and corresponding-
2332         rdar://problem/20210239
2333
2334         Reviewed by Dean Jackson.
2335
2336         ActionMenuHitTestResult has a new bool indicating whether to not the HitTestResult 
2337         will prevent default. 
2338         * Shared/mac/ActionMenuHitTestResult.h:
2339         * Shared/mac/ActionMenuHitTestResult.mm:
2340         (WebKit::ActionMenuHitTestResult::encode):
2341         (WebKit::ActionMenuHitTestResult::decode):
2342
2343         Send immediateActionDidUpdate and the normalized force over the the WebProcess.
2344         * UIProcess/WebPageProxy.cpp:
2345         (WebKit::WebPageProxy::immediateActionDidUpdate):
2346         * UIProcess/WebPageProxy.h:
2347
2348         We need a dummy animation controller when web content is overriding the default 
2349         behavior.
2350         * UIProcess/mac/WKImmediateActionController.mm:
2351
2352         Send along the update information.
2353         (-[WKImmediateActionController immediateActionRecognizerDidUpdateAnimation:]):
2354
2355         Use the dummy animation controller if default has been prevented.
2356         (-[WKImmediateActionController _defaultAnimationController]):
2357         (-[WKImmediateActionController _updateImmediateActionItem]):
2358
2359         Keep track of whether m_lastActionMenuHitTes prevented the default immediate 
2360         action behavior.
2361         * WebProcess/WebPage/WebPage.cpp:
2362         (WebKit::WebPage::WebPage):
2363         * WebProcess/WebPage/WebPage.h:
2364         * WebProcess/WebPage/WebPage.messages.in:
2365
2366         Call dispatchMouseForceMayBegin() at hit test time.
2367         * WebProcess/WebPage/mac/WebPageMac.mm:
2368         (WebKit::WebPage::performActionMenuHitTestAtLocation):
2369
2370         Call dispatchMouseForceChanged() if appropriate.
2371         (WebKit::WebPage::immediateActionDidUpdate):
2372
2373         Call dispatchMouseForceCancelled() if appropriate.
2374         (WebKit::WebPage::immediateActionDidCancel):
2375
2376         Call dispatchMouseForceDown() if appropriate.
2377         (WebKit::WebPage::immediateActionDidComplete):
2378
2379 2015-03-24  Anders Carlsson  <andersca@apple.com>
2380
2381         Fix designated initializer violations
2382         https://bugs.webkit.org/show_bug.cgi?id=143016
2383         rdar://problem/20268858
2384
2385         Reviewed by Dan Bernstein.
2386
2387         Move -[WKProcessPool _initWithConfiguration:] to a class extension so we can make it the designated initializer.
2388
2389         * UIProcess/API/Cocoa/WKProcessPool.mm:
2390         (-[WKProcessPool _initWithConfiguration:]):
2391         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
2392
2393 2015-03-24  Chris Dumez  <cdumez@apple.com>
2394
2395         [WK2] Responses with 404 HTTP Status Code should be cacheable by default
2396         https://bugs.webkit.org/show_bug.cgi?id=143014
2397         <rdar://problem/20280310>
2398
2399         Reviewed by Antti Koivisto.
2400
2401         Make responses with 404 HTTP Status Code cacheable by default, as
2402         per RFC 7231:
2403         http://tools.ietf.org/html/rfc7231#section-6.5.4
2404
2405         Test: http/tests/cache/disk-cache/disk-cache-404-status-code.html
2406
2407         * NetworkProcess/cache/NetworkCache.cpp:
2408         (WebKit::NetworkCache::canStore):
2409
2410 2015-03-24  Chris Dumez  <cdumez@apple.com>
2411
2412         [WK2] Remove NetworkCache FIXME comment about caching responses to OPTIONS requests
2413         https://bugs.webkit.org/show_bug.cgi?id=143009
2414
2415         Reviewed by Andreas Kling.
2416
2417         Remove NetworkCache FIXME comment about caching responses to OPTIONS
2418         method as RFC 7234 says "Responses to the OPTIONS method are not
2419         cacheable" [1].
2420
2421         [1] http://tools.ietf.org/html/rfc7231#page-31
2422
2423         * NetworkProcess/cache/NetworkCache.cpp:
2424         (WebKit::NetworkCache::canRetrieve):
2425
2426 2015-03-24  Chris Dumez  <cdumez@apple.com>
2427
2428         [WK2] NetworkCache retrievals fail for entries with no body
2429         https://bugs.webkit.org/show_bug.cgi?id=142979
2430         <rdar://problem/20264100>
2431
2432         Reviewed by Antti Koivisto.
2433
2434         NetworkCache retrievals were failing for entries with no body because
2435         decodeEntry() doesn't correctly handle this case. In particular, the
2436         following check fails:
2437         "metaData.bodyOffset + metaData.bodySize == fileData.size()".
2438         This is because bodyOffset is pageSize-aligned.
2439
2440         As a result, the following resource on apple.com is stored in the cache
2441         but we fail to reuse it and reload it from the network every time:
2442         http://images.apple.com/home/styles/promos.css
2443
2444         This patch updates decodeEntry() to create a null Data object for the
2445         body if bodySize is 0.
2446
2447         * NetworkProcess/cache/NetworkCacheDataCocoa.mm:
2448         (WebKit::NetworkCache::Data::data):
2449         Do not attempt to initialize m_data if m_dispatchData is null as the
2450         call to dispatch_data_create_map() would then crash. We now return
2451         null in this case. This is needed as decodeStorageEntry() in
2452         NetworkCache.cpp constructs a SharedBuffer from
2453         storageEntry.body.data() and the body may be null.
2454
2455         * NetworkProcess/cache/NetworkCacheStorage.cpp:
2456         (WebKit::NetworkCache::decodeEntry):
2457
2458 2015-03-24  Chris Dumez  <cdumez@apple.com>
2459
2460         [WK2] The WebKit network cache does not cache responses with "Content-Disposition: attachment" header
2461         https://bugs.webkit.org/show_bug.cgi?id=142989
2462         <rdar://problem/20265992>
2463
2464         Reviewed by Antti Koivisto.
2465
2466         Update our WebKit network cache policy to cache responses with
2467         "Content-Disposition: attachment" header. There is no reason we cannot
2468         cache these and our memory cache already does.
2469
2470         This was causing a decent amount of cache misses in the wild. I have
2471         noticed for example that when loading disney.com, we fail to cache the
2472         following resources because of this policy:
2473         http://pagead2.googlesyndication.com/pagead/osd.js
2474         http://pagead2.googlesyndication.com/pagead/show_companion_ad.js
2475
2476         Those resources have Cache-Control headers that indicate they are meant
2477         to be cacheable.
2478
2479         Test: http/tests/cache/disk-cache-validation-attachment.html
2480
2481         * NetworkProcess/cache/NetworkCache.cpp:
2482         (WebKit::NetworkCache::canStore):
2483
2484 2015-03-23  Joseph Pecoraro  <pecoraro@apple.com>
2485
2486         Unreviewed, another attempt to fix 32-bit build after r181881.
2487
2488         * UIProcess/WebInspectorProxy.h:
2489
2490 2015-03-23  Joseph Pecoraro  <pecoraro@apple.com>
2491
2492         Unreviewed, attempt to fix 32-bit build after r181881.
2493
2494         * UIProcess/API/Cocoa/WKViewPrivate.h:
2495         * UIProcess/API/mac/WKView.mm:
2496
2497 2015-03-19  Timothy Hatcher  <timothy@apple.com>
2498
2499         Web Inspector: Support attaching to another view other than the WKView
2500         https://bugs.webkit.org/show_bug.cgi?id=142892
2501
2502         Reviewed by Tim Horton.
2503
2504         * UIProcess/API/C/WKInspector.cpp:
2505         (WKInspectorAttach): Drive by fix so it used the last attachment side.
2506
2507         * UIProcess/API/Cocoa/WKViewPrivate.h:
2508         * UIProcess/API/mac/WKView.mm:
2509         (-[WKView _inspectorAttachmentView]): Added.
2510         (-[WKView _setInspectorAttachmentView:]): Added.
2511
2512         * UIProcess/WebInspectorProxy.cpp:
2513         (WebKit::WebInspectorProxy::createInspectorPage):
2514         (WebKit::WebInspectorProxy::attachAvailabilityChanged):
2515         Use platformCanAttach as a final check incase there is a different
2516         attachment view that the platform knows about.
2517
2518         * UIProcess/WebInspectorProxy.h:
2519         (WebKit::WebInspectorProxy::attachmentSide): Added.
2520         (WebKit::WebInspectorProxy::platformCanAttach): Added.
2521
2522         * UIProcess/mac/WebInspectorProxyMac.mm:
2523         (WebKit::WebInspectorProxy::attachmentViewDidChange): Added.
2524         (WebKit::WebInspectorProxy::closeTimerFired):
2525         (WebKit::WebInspectorProxy::platformCreateInspectorPage):
2526         (WebKit::WebInspectorProxy::platformCanAttach):
2527         (WebKit::WebInspectorProxy::inspectedViewFrameDidChange):
2528         (WebKit::WebInspectorProxy::platformInspectedWindowHeight):
2529         (WebKit::WebInspectorProxy::platformInspectedWindowWidth):
2530         (WebKit::WebInspectorProxy::platformAttach):
2531         (WebKit::WebInspectorProxy::platformDetach):
2532         Use the _inspectorAttachmentView and change how the frame change notification
2533         is observed and follow the attachment view as it changes.
2534
2535 2015-03-23  Tim Horton  <timothy_horton@apple.com>
2536
2537         Images shared to photos via action menu are padded with zeroes at the end
2538         https://bugs.webkit.org/show_bug.cgi?id=142985
2539
2540         Reviewed by Anders Carlsson.
2541
2542         * Shared/mac/ActionMenuHitTestResult.h:
2543         * Shared/mac/ActionMenuHitTestResult.mm:
2544         (WebKit::ActionMenuHitTestResult::encode):
2545         (WebKit::ActionMenuHitTestResult::decode):
2546         * WebProcess/WebPage/mac/WebPageMac.mm:
2547         (WebKit::WebPage::performActionMenuHitTestAtLocation):
2548         Send the size of the image separately from the SharedMemory.
2549         The SharedMemory's size can be rounded up, so we need to keep the original
2550         size around in order to write the data to disk.
2551
2552         * UIProcess/mac/WKActionMenuController.mm:
2553         (-[WKActionMenuController _hitTestResultImage]):
2554         (-[WKActionMenuController _addImageToPhotos:]):
2555         Use the image size instead of the SharedMemory size.
2556
2557 2015-03-23  Enrica Casucci  <enrica@apple.com>
2558
2559         [iOS] WebContent crash attempting to select text with a gesture at RenderObject::absoluteBoundingBoxRect.
2560         https://bugs.webkit.org/show_bug.cgi?id=142913
2561         rdar://problem/16400033
2562
2563         Reviewed by Sam Weinig.
2564
2565         When looking for the best candidate range at the given position,
2566         we should skip nodes that don't have a renderer.
2567         This is a speculative fix.
2568
2569         * WebProcess/WebPage/ios/WebPageIOS.mm:
2570         (WebKit::WebPage::rangeForWebSelectionAtPosition):
2571
2572 2015-03-23  Alexey Proskuryakov  <ap@apple.com>
2573
2574         REGRESSION (Yosemite): WKView visibility notifications are messed up
2575         https://bugs.webkit.org/show_bug.cgi?id=142945
2576
2577         Reviewed by Tim Horton.
2578
2579         As these notifications cannot be used by NSView subclasses, create a separate
2580         object for observing them.
2581
2582         * UIProcess/API/mac/WKView.mm:
2583         (-[WKWindowVisibilityObserver initWithView:]):
2584         (-[WKWindowVisibilityObserver startObserving:]):
2585         (-[WKWindowVisibilityObserver stopObserving:]):
2586         (-[WKWindowVisibilityObserver _windowDidOrderOnScreen:]):
2587         (-[WKWindowVisibilityObserver _windowDidOrderOffScreen:]):
2588         (-[WKView addWindowObserversForWindow:]):
2589         (-[WKView removeWindowObservers]): Also, don't try to remove NSWindowWillOrderOffScreenNotification,
2590         which we never start to observe.
2591         (-[WKView initWithFrame:processPool:configuration:webView:]):
2592         * UIProcess/API/mac/WKViewInternal.h:
2593
2594 2015-03-23  Anders Carlsson  <andersca@apple.com>
2595
2596         Make platform/mac-wk2/plugins/destroy-during-async-npp-new.html work again.
2597         https://bugs.webkit.org/show_bug.cgi?id=133692
2598         rdar://problem/17255947
2599
2600         Reviewed by Alexey Proskuryakov.
2601
2602         Add plug-in destruction protectors around message receiver code that can call out to NPObjects or JavaScript
2603         where we need the plug-in to stay around after the call.
2604
2605         * Shared/Plugins/NPObjectMessageReceiver.cpp:
2606         (WebKit::NPObjectMessageReceiver::invoke):
2607         (WebKit::NPObjectMessageReceiver::invokeDefault):
2608         (WebKit::NPObjectMessageReceiver::getProperty):
2609         (WebKit::NPObjectMessageReceiver::setProperty):
2610         (WebKit::NPObjectMessageReceiver::construct):
2611
2612 2015-03-23  Anders Carlsson  <andersca@apple.com>
2613
2614         Put the WK_NULLABLE_SPECIFIER in the right place for block parameters
2615         https://bugs.webkit.org/show_bug.cgi?id=142975
2616         rdar://problem/19863930
2617
2618         Reviewed by Dan Bernstein.
2619
2620         * UIProcess/API/Cocoa/WKNavigationDelegate.h:
2621         * UIProcess/API/Cocoa/WKUIDelegate.h:
2622         * UIProcess/API/Cocoa/WKWebView.h:
2623
2624 2015-03-23  Tim Horton  <timothy_horton@apple.com>
2625
2626         Add a share item to the link action menu
2627         https://bugs.webkit.org/show_bug.cgi?id=142961
2628         <rdar://problem/19198374>
2629
2630         Reviewed by Beth Dakin.
2631
2632         * UIProcess/mac/WKActionMenuController.mm:
2633         (-[WKActionMenuController _hitLinkURL]):
2634         Factor out _hitLinkURL from various places.
2635
2636         (-[WKActionMenuController _openURLFromActionMenu:]):
2637         (-[WKActionMenuController _addToReadingListFromActionMenu:]):
2638         (-[WKActionMenuController _defaultMenuItemsForVideo]):
2639         (-[WKActionMenuController _defaultMenuItemsForImage]):
2640         (-[WKActionMenuController _createActionMenuItemForTag:]):
2641         (-[WKActionMenuController _createShareActionMenuItemForTag:withItems:]):
2642         Adopt -[NSMenuItem standardShareMenuItemWithItems].
2643         All of the null-checking is unnecessary as it's impossible to enter
2644         these functions with a null image/etc.
2645
2646         (-[WKActionMenuController _defaultMenuItemsForLink]):
2647         * Shared/API/c/WKActionMenuItemTypes.h:
2648         Add a 'Share' item to the link menu.
2649
2650 2015-03-23  Zan Dobersek  <zdobersek@igalia.com>
2651
2652         [GTK] Use std::abs() in ClickCounter::currentClickCountForGdkButtonEvent()
2653         https://bugs.webkit.org/show_bug.cgi?id=142964
2654
2655         Reviewed by Carlos Garcia Campos.
2656
2657         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
2658         (ClickCounter::currentClickCountForGdkButtonEvent): Use the STL's std::abs()
2659         instead of C's abs(). The templated nature of std::abs() ensures the proper
2660         computation that matches the types of the passed-in values, and shuts down
2661         a warning when compiling with Clang.
2662
2663 2015-03-23  Zan Dobersek  <zdobersek@igalia.com>
2664
2665         [GTK][WK2] webkitBackForwardListChanged() should operate on a Vector reference
2666         https://bugs.webkit.org/show_bug.cgi?id=142963
2667
2668         Reviewed by Carlos Garcia Campos.
2669
2670         * UIProcess/API/gtk/WebKitBackForwardList.cpp:
2671         (webkitBackForwardListChanged): This function only reads from the passed-in
2672         Vector of removed items, so only a const lvalue reference to the Vector
2673         is needed.
2674         * UIProcess/API/gtk/WebKitBackForwardListPrivate.h:
2675
2676 2015-03-23  Carlos Garcia Campos  <cgarcia@igalia.com>
2677
2678         [GTK] Add a configure option to build without Redirected XComposite Window
2679         https://bugs.webkit.org/show_bug.cgi?id=142865
2680
2681         Reviewed by Žan Doberšek.
2682
2683         Use USE(REDIRECTED_XCOMPOSITE_WINDOW) instead of
2684         USE(TEXTURE_MAPPER_GL) && PLATFORM(X11).
2685
2686         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
2687         (webkitWebViewBaseRealize): Use the XID of the WebKitWebView
2688         window as native surface handle when REDIRECTED_XCOMPOSITE_WINDOW
2689         is disabled.
2690         (webkitWebViewRenderAcceleratedCompositingResults):
2691         (resizeWebKitWebViewBaseFromAllocation):
2692         (webkitWebViewBaseEnterAcceleratedCompositingMode):
2693         (webkitWebViewBaseExitAcceleratedCompositingMode):
2694         * UIProcess/gtk/RedirectedXCompositeWindow.cpp:
2695         * UIProcess/gtk/RedirectedXCompositeWindow.h:
2696
2697 2015-03-22  Eric Carlson  <eric.carlson@apple.com>
2698
2699         [Mac] Enable WIRELESS_PLAYBACK_TARGET for WK1
2700         https://bugs.webkit.org/show_bug.cgi?id=142940
2701
2702         Reviewed by Sam Weinig.
2703
2704         * WebProcess/WebPage/mac/WebPageMac.mm:
2705         (WebKit::WebPage::playbackTargetSelected): Argument to didChoosePlaybackTarget is now const.
2706
2707 2015-03-22  Anders Carlsson  <andersca@apple.com>
2708
2709         _WKWebsiteDataStore should clear WebSQL databases
2710         https://bugs.webkit.org/show_bug.cgi?id=142947
2711         rdar://problem/20242174
2712
2713         Reviewed by Sam Weinig.
2714
2715         * Shared/WebsiteData/WebsiteDataTypes.h:
2716         Add WebsiteDataTypeWebSQLDatabases.
2717
2718         * UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm:
2719         (API::WebsiteDataStore::defaultDataStoreConfiguration):
2720         Initialize configuration.webSQLDatabaseDirectory.
2721
2722         * UIProcess/API/Cocoa/_WKWebsiteDataRecord.h:
2723         Add WKWebsiteDataTypeWebSQLDatabases.
2724
2725         * UIProcess/API/Cocoa/_WKWebsiteDataRecord.mm:
2726         (dataTypesToString):
2727         Handle WKWebsiteDataTypeWebSQLDatabases.
2728
2729         * UIProcess/API/Cocoa/_WKWebsiteDataRecordInternal.h:
2730         (WebKit::toWebsiteDataTypes):
2731         (WebKit::toWKWebsiteDataTypes):
2732         Handle WKWebsiteDataTypeWebSQLDatabases and WebsiteDataTypes::WebsiteDataTypeWebSQLDatabases.
2733
2734         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2735         (WebKit::WebsiteDataStore::WebsiteDataStore):
2736         Initialize m_webSQLDatabaseDirectory and add a queue member variable.
2737
2738         (WebKit::WebsiteDataStore::fetchData):
2739         Fetch database origins.
2740     
2741         (WebKit::WebsiteDataStore::removeData):
2742         Remove databases.
2743
2744         * UIProcess/WebsiteData/WebsiteDataStore.h:
2745         Add new members.
2746
2747 2015-03-22  Dan Bernstein  <mitz@apple.com>
2748
2749         [iOS] Expose WebPageProxy::setInitialFocus as SPI
2750         https://bugs.webkit.org/show_bug.cgi?id=142951
2751
2752         Reviewed by Anders Carlsson.
2753
2754         * UIProcess/API/Cocoa/WKWebView.mm:
2755         (-[WKWebView _becomeFirstResponderWithSelectionMovingForward:completionHandler:]): New SPI.
2756         Just calls through to WKWebContentView, but allows a nil completion handler.
2757         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2758
2759         * UIProcess/API/mac/WKView.mm:
2760         (-[WKView becomeFirstResponder]): Pass an empty lambda for the new callback parameter to
2761         WebPageProxy::setInitialFocus.
2762
2763         * UIProcess/WebPageProxy.cpp:
2764         (WebKit::WebPageProxy::setInitialFocus): Added a void callback parameter and made sure to
2765         call it.
2766         * UIProcess/WebPageProxy.h:
2767
2768         * UIProcess/ios/WKContentViewInteraction.h:
2769         * UIProcess/ios/WKContentViewInteraction.mm:
2770         (-[WKContentView _becomeFirstResponderWithSelectionMovingForward:completionHandler:]):
2771         Added. Calls WebPageProxy::setInitialFocus, and once that completes, checks if anything was
2772         focused and if so, becomes first responder, then calls the completion handler.
2773
2774         * WebProcess/WebPage/WebPage.cpp:
2775         (WebKit::WebPage::setInitialFocus): Added a callbackID parameter, and made sure to send the
2776         callback message. Added a temporary change of m_userIsInteracting to true, so that the UI
2777         process won’t ignore any StartAssistingNode message resulting from the focus change.
2778         * WebProcess/WebPage/WebPage.h:
2779
2780         * WebProcess/WebPage/WebPage.messages.in: Added a callbackID parameter to SetInitialFocus.
2781
2782 2015-03-21  Dean Jackson  <dino@apple.com>
2783
2784         Remove the prefix for CSS Transforms
2785         https://bugs.webkit.org/show_bug.cgi?id=142927
2786         <rdar://problem/11568151>
2787
2788         Reviewed by Simon Fraser.
2789
2790         Rename AnimatedPropertyWebkitTransform to AnimatedPropertyTransform.
2791
2792         * Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp:
2793         (IPC::ArgumentCoder<TextureMapperAnimation>::encode):
2794
2795 2015-03-21  Csaba Osztrogonác  <ossy@webkit.org>
2796
2797         [EFL][GTK] Make WebKit2's generate-forwarding-headers.pl less verbose
2798         https://bugs.webkit.org/show_bug.cgi?id=142908
2799
2800         Reviewed by Žan Doberšek.
2801
2802         * Scripts/generate-forwarding-headers.pl:
2803         (createForwardingHeadersForFramework):
2804
2805 2015-03-21  Commit Queue  <commit-queue@webkit.org>
2806
2807         Unreviewed, rolling out r181824.
2808         https://bugs.webkit.org/show_bug.cgi?id=142935
2809
2810         Broke Windows build (Requested by ap on #webkit).
2811
2812         Reverted changeset:
2813
2814         "Remove the prefix for CSS Transforms"
2815         https://bugs.webkit.org/show_bug.cgi?id=142927
2816         http://trac.webkit.org/changeset/181824
2817
2818 2015-03-20  Dean Jackson  <dino@apple.com>
2819
2820         Remove the prefix for CSS Transforms
2821         https://bugs.webkit.org/show_bug.cgi?id=142927
2822         <rdar://problem/11568151>
2823
2824         Reviewed by Simon Fraser.
2825
2826         Rename AnimatedPropertyWebkitTransform to AnimatedPropertyTransform.
2827
2828         * Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp:
2829         (IPC::ArgumentCoder<TextureMapperAnimation>::encode):
2830
2831 2015-03-20  Chris Dumez  <cdumez@apple.com>
2832
2833         [WK2] NetworkCache retrievals sometimes fail on browser startup
2834         https://bugs.webkit.org/show_bug.cgi?id=142925
2835         <rdar://problem/20245368>
2836
2837         Reviewed by Antti Koivisto.
2838
2839         NetworkCache retrievals sometimes fail on browser startup for resources
2840         that are actually cached. The reason is that we are using a bloom filter
2841         for performance reasons to avoid unnecessary disk I/O and this bloom
2842         filter is populated on start up in a background thread by traversing the
2843         cache files on disk. However, when restoring the tabs on start-up we
2844         sometimes query this bloom filter before it is completely populated and
2845         we thus fail to retrieve cached entries because we think they don't
2846         exist and don't check the disk.
2847
2848         This patch adds an "isPopulatingContentsFilter" flag that is turned ON
2849         on start up while we are populating the bloon filter. We then bypass
2850         the bloom filter and send queries directly to disk on start up if this
2851         flag is ON.
2852
2853         * NetworkProcess/cache/NetworkCacheStorage.cpp:
2854         (WebKit::NetworkCache::Storage::initialize):
2855         (WebKit::NetworkCache::Storage::retrieve):
2856         (WebKit::NetworkCache::Storage::dispatchPendingWriteOperations):
2857         (WebKit::NetworkCache::Storage::dispatchHeaderWriteOperation):
2858         * NetworkProcess/cache/NetworkCacheStorage.h:
2859         (WebKit::NetworkCache::Storage::cacheMayContain):
2860
2861 2015-03-20  Chris Dumez  <cdumez@apple.com>
2862
2863         [WK2] Allow stale content when restoring the browser's session state
2864         https://bugs.webkit.org/show_bug.cgi?id=142916
2865         <rdar://problem/20243493>
2866
2867         Reviewed by Darin Adler.
2868
2869         Allow stale content when restoring the browser's session state
2870         (restoring all tabs from previous session), e.g.
2871         - Via History > Reopen All windows from previous session on Safari
2872         - Happens on startup for MobileSafari
2873
2874         I have verified that using "Open in tabs" on a bookmarks folder
2875         still does fresh loads (rdar://problem/8131355) as it is not using
2876         the restoreFromSessionState() code path.
2877
2878         * UIProcess/WebPageProxy.cpp:
2879         (WebKit::WebPageProxy::reattachToWebProcessForReload):
2880         (WebKit::WebPageProxy::reattachToWebProcessWithItem):
2881         (WebKit::WebPageProxy::goForward):
2882         (WebKit::WebPageProxy::goBack):
2883         (WebKit::WebPageProxy::goToBackForwardItem):
2884         (WebKit::WebPageProxy::restoreFromSessionState):
2885         * UIProcess/WebPageProxy.h:
2886         * WebProcess/WebPage/WebPage.cpp:
2887         (WebKit::WebPage::goToBackForwardItem):
2888         * WebProcess/WebPage/WebPage.h:
2889         * WebProcess/WebPage/WebPage.messages.in:
2890
2891 2015-03-20  Beth Dakin  <bdakin@apple.com>
2892
2893         [Immediate Actions] Should re-enable immediate actions for iBooks
2894         https://bugs.webkit.org/show_bug.cgi?id=142915
2895         -and corresponding-
2896         rdar://problem/19585689
2897
2898         Reviewed by Tim Horton.
2899
2900         * UIProcess/API/mac/WKView.mm:
2901         (-[WKView initWithFrame:processPool:configuration:webView:]):
2902
2903 2015-03-20  Alex Christensen  <achristensen@webkit.org>
2904
2905         Progress towards CMake on Mac.
2906         https://bugs.webkit.org/show_bug.cgi?id=136003
2907
2908         Reviewed by Chris Dumez.
2909
2910         * PlatformMac.cmake:
2911         Add include directories and forwarding headers.
2912         * Shared/API/APIObject.h:
2913         (API::ObjectImpl::operator new):
2914         * UIProcess/DrawingAreaProxy.h:
2915         (WebKit::DrawingAreaProxy::intrinsicContentSizeDidChange):
2916         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
2917         Fix some unused parameter warnings.
2918
2919 2015-03-20  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
2920
2921         [CMake] Remove duplicated cmake function calls in WebKit2/CMakeLists.txt
2922         https://bugs.webkit.org/show_bug.cgi?id=142901
2923
2924         Reviewed by Csaba Osztrogonác.
2925
2926         add_depencencies(), install() can support multiple targets or location.
2927         We don't need to call it twice.
2928
2929         * CMakeLists.txt: Additionaly move -DBUILDING_WEBKIT to PlatformGTK.cmake,
2930         because it is only used by GTK port.
2931
2932 2015-03-20  Zan Dobersek  <zdobersek@igalia.com>
2933
2934         [GTK] Disable accelerated compositing on Wayland
2935         https://bugs.webkit.org/show_bug.cgi?id=142877
2936
2937         Reviewed by Carlos Garcia Campos.
2938
2939         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
2940         (webkitWebViewBaseCreateWebPage): As was done in the past, we should disable
2941         accelerated compositing on Wayland until the proper support for it lands.
2942
2943 2015-03-19  Andy Estes  <aestes@apple.com>
2944
2945         [Content Filtering] Add tests for unblock requests
2946         https://bugs.webkit.org/show_bug.cgi?id=142900
2947
2948         Reviewed by Andreas Kling.
2949
2950         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
2951         (WebKit::WebPageProxy::contentFilterDidBlockLoadForFrame): Called WebFrameProxy::contentFilterDidBlockLoad.
2952         * UIProcess/WebFrameProxy.cpp:
2953         (WebKit::WebFrameProxy::didStartProvisionalLoad): Assigned a default-constructed ContentFilterUnblockHandler instead of calling clear().
2954         (WebKit::WebFrameProxy::didHandleContentFilterUnblockNavigation): Renamed from contentFilterDidHandleNavigationAction.
2955         Updated to use ContentFilterUnblockHandler's new API.
2956         (WebKit::WebFrameProxy::contentFilterDidHandleNavigationAction): Deleted.
2957         * UIProcess/WebFrameProxy.h:
2958         (WebKit::WebFrameProxy::contentFilterDidBlockLoad): Renamed from setContentFilterUnblockHandler.
2959         (WebKit::WebFrameProxy::setContentFilterUnblockHandler): Deleted.
2960         * UIProcess/WebPageProxy.cpp:
2961         (WebKit::WebPageProxy::decidePolicyForNavigationAction): Called WebFrameProxy::didHandleContentFilterUnblockNavigation.
2962         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2963         (WebKit::WebFrameLoaderClient::contentFilterDidBlockLoad): If the unblock handler needs the UI process,
2964         send WebPageProxy::ContentFilterDidBlockLoadForFrame. Oterwise, call PolicyChecker::setContentFilterUnblockHandler.
2965
2966 2015-03-20  Zan Dobersek  <zdobersek@igalia.com>
2967
2968         [GTK] Properly guard X11-specific code in BackingStore::createBackend()
2969         https://bugs.webkit.org/show_bug.cgi?id=142875
2970
2971         Reviewed by Martin Robinson.
2972
2973         * UIProcess/cairo/BackingStoreCairo.cpp:
2974         (WebKit::BackingStore::createBackend): Guard the GTK- and X11-specific
2975         bit of code with PLATFORM(GTK) and PLATFORM(X11). Testing GDK_WINDOWING_X11
2976         ensures that the GTK+ dependency has X11 support, but does not ensure
2977         that WebKitGTK+ has been configured to build for X11 environments (which
2978         is what PLATFORM(X11) ensures).
2979
2980 2015-03-19  Chris Dumez  <cdumez@apple.com>
2981
2982         [WK2] We should allow stale content when restoring a killed / crashed WebProcess
2983         https://bugs.webkit.org/show_bug.cgi?id=142893
2984         <rdar://problem/19633737>
2985         <rdar://problem/19869257>
2986
2987         Reviewed by Antti Koivisto.
2988
2989         Allow stale content when restoring a killed / crashed WebProcess
2990         (similarly to a history navigation). This is actually what was intended
2991         as we call WebPage::goToBackForwardItem() in this case, which uses
2992         IndexedBackForward load type. However, this value was then ignored in
2993         FrameLoader::loadDifferentDocumentItem().
2994
2995         This patch gets rid of the special casing in
2996         FrameLoader::loadDifferentDocumentItem() and makes it clear at call
2997         sites when calling goToBackForwardItem() if we should allow stale
2998         content or not. If goToBackForwardItem() is called with the
2999         allowStaleContent flag off, we'll keep using the IndexedBackForward
3000         frame load type. However, if the flag is on, we'll use the Standard
3001         frame load type and do a fresh load.
3002
3003         * UIProcess/WebPageProxy.cpp:
3004         (WebKit::WebPageProxy::reattachToWebProcessForReload):
3005         Set allowStaleContent flag to true as we want to allow stale content
3006         when reloading a WebProcess after it crashed or was killed (behavior
3007         change).
3008
3009         (WebKit::WebPageProxy::reattachToWebProcessWithItem):
3010         Add allowStaleContent parameter so that call sites can decide which
3011         policy to use.
3012
3013         (WebKit::WebPageProxy::goForward):
3014         (WebKit::WebPageProxy::goBack):
3015         Set allowStaleContent flag to true as this is our policy for history
3016         navigations.
3017
3018         (WebKit::WebPageProxy::goToBackForwardItem):
3019         Add allowStaleContent parameter so that the call site can let us know
3020         what to do. This is useful as this is called not only for indexed
3021         back / forward navigations (allowing stale content) but also for
3022         restoring session state (forbidding state content:
3023         <rdar://problem/8131355>).
3024
3025         (WebKit::WebPageProxy::restoreFromSessionState):
3026         Call goToBackForwardItem() with allowStaleContent flag set to false
3027         as users expect fresh contents in this case. This method is called
3028         when:
3029         - Tabs are restored on Safari / MobileSafari startup
3030         - Tabs are restored via "History > Reopen All windows from last session"
3031
3032         * UIProcess/WebPageProxy.h:
3033         * WebProcess/WebPage/WebPage.cpp:
3034         (WebKit::WebPage::goToBackForwardItem):
3035         Add allowStaleContent parameter and use "Standard" frame load type
3036         instead of "IndexedBackForward" if it is false. This is needed as
3037         "IndexedBackForward" frame load type allows using stale content.
3038
3039         * WebProcess/WebPage/WebPage.h:
3040         * WebProcess/WebPage/WebPage.messages.in:
3041         Add allowStaleContent flag to GoToBackForwardItem message.
3042
3043 2015-03-19  Eric Carlson  <eric.carlson@apple.com>
3044
3045         [Mac] Move MediaPlaybackTargetPicker
3046         https://bugs.webkit.org/show_bug.cgi?id=142889
3047
3048         Move WebMediaPlaybackTargetPickerProxy to WebCore so it can be used by
3049         both WK2 and WK1.
3050
3051         Reviewed by Tim Horton.
3052
3053         * UIProcess/PageClient.h:
3054         * UIProcess/WebMediaPlaybackTargetPickerProxy.cpp: Removed.
3055         * UIProcess/WebMediaPlaybackTargetPickerProxy.h: Removed.
3056         * UIProcess/WebPageProxy.cpp:
3057         (WebKit::WebPageProxy::devicePickerProxy):
3058         * UIProcess/WebPageProxy.h:
3059         * UIProcess/mac/PageClientImpl.h:
3060         * UIProcess/mac/PageClientImpl.mm:
3061         (WebKit::PageClientImpl::createPlaybackTargetPicker):
3062         * UIProcess/mac/WebMediaPlaybackTargetPickerProxyMac.h: Removed.
3063         * UIProcess/mac/WebMediaPlaybackTargetPickerProxyMac.mm: Removed.
3064         * WebKit2.xcodeproj/project.pbxproj:
3065
3066 2015-03-19  Jessie Berlin  <jberlin@webkit.org>
3067
3068         32-bit build fix after r181770.
3069
3070         * UIProcess/mac/WKFullScreenWindowController.mm:
3071         (-[WKFullScreenWindowController initWithWindow:webView:]):
3072
3073 2015-03-19  Anders Carlsson  <andersca@apple.com>
3074
3075         Add support for deleting individual cache entries
3076         https://bugs.webkit.org/show_bug.cgi?id=142886
3077
3078         Reviewed by Antti Koivisto.
3079
3080         * NetworkProcess/NetworkProcess.cpp:
3081         (WebKit::fetchDiskCacheEntries):
3082         Remove an unnecessary call to cfURLCacheOrigins().
3083
3084         (WebKit::clearDiskCacheEntries):
3085         Helper function for clearing disk cache entries. This handles both the old and new cache implementations.
3086
3087         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
3088         Call clearDiskCacheEntries if needed.
3089
3090 2015-03-19  Jer Noble  <jer.noble@apple.com>
3091
3092         [WK2][Mac] Fullscreen animations with mismatched aspect ratios are "squished".
3093         https://bugs.webkit.org/show_bug.cgi?id=142132
3094
3095         Reviewed by Tim Horton.
3096
3097         Use CALayer animations for the transition into and out of fullscreen.
3098
3099         The fullscreen transition consists of three separate animations:
3100         1. An opacity animation for the black backdrop behind the fullscreen content
3101         2. A scale/translation animation from fullscreen element's initial screen to its final one.
3102         3. A clip animation from the fullscreen element's initial aspect ratio to its final one.
3103
3104         The opacity animation will apply to the fullscreen window's content view's layer's
3105         background color. To separately animate the transform and mask of the web view's content, a
3106         layer-backed subview is added to the content view, and the scale/translation & clip
3107         animations are applied to its transform property and mask layer respectively.
3108
3109         Utility methods to create each animation have been added, and each includes a parameter for
3110         the direction of the animation, so that the same methods can be used for entering and
3111         exiting fullscreen transitions.
3112
3113         The user-visible changes to this new transition are when the aspect ratios of the initial
3114         and final screen locations are different: previously the transition would use a scale
3115         transform to "squish" the fullscreen content into the initial aspect ratio. The new
3116         transition instead "clips" the fullscreen content to the initial aspect ratio. For common
3117         operations such a <video> element with a different aspect ratio than the screen, this makes
3118         the black letterbox "grow" during the transition, and makes the transition overall much
3119         smoother.
3120
3121         * UIProcess/mac/WKFullScreenWindowController.h:
3122         * UIProcess/mac/WKFullScreenWindowController.mm:
3123         (-[WKFullScreenWindowController initWithWindow:webView:]): Create and initialze the clipping view.
3124         (-[WKFullScreenWindowController applicationDidChangeScreenParameters:]): _backgroundWindow was removed.
3125         (-[WKFullScreenWindowController enterFullScreen:]): Add the webView to the _clipView, not the contentView.
3126         (-[WKFullScreenWindowController beganEnterFullScreenWithInitialFrame:finalFrame:]): _backgroundWindow,
3127                 _fadeAnimation, and _scaleAnimation are all removed.
3128         (-[WKFullScreenWindowController finishedEnterFullScreenAnimation:]): Ditto.
3129         (-[WKFullScreenWindowController finishedExitFullScreenAnimation:]): Ditto.  Hide the contentView's
3130                 layer. Pause visibility updates.
3131         (-[WKFullScreenWindowController completeFinishExitFullScreenAnimationAfterRepaint]): Resume visibility updates.
3132         (-[WKFullScreenWindowController close]): _fadeAnimation and _scaleAnimation are removed.
3133         (-[WKFullScreenWindowController customWindowsToEnterFullScreenForWindow:]): Return only the fullscreen
3134                 window.
3135         (-[WKFullScreenWindowController customWindowsToExitFullScreenForWindow:]): Ditto.
3136         (zoomAnimation): Added.
3137         (maskAnimation): Added.
3138         (fadeAnimation): Added.
3139         (-[WKFullScreenWindowController _startEnterFullScreenAnimationWithDuration:]): Use the utility
3140                 methods above to set up the animation.
3141         (-[WKFullScreenWindowController _startExitFullScreenAnimationWithDuration:]): Ditto.
3142         (createBackgroundFullscreenWindow): Deleted.
3143         (windowFrameFromApparentFrames): Deleted.
3144
3145 2015-03-19  Enrica Casucci  <enrica@apple.com>
3146
3147         <attachment> should put URLs on the pasteboard so that Finder can accept drops.
3148         https://bugs.webkit.org/show_bug.cgi?id=142801
3149         rdar://problem/19982527
3150
3151         Reviewed by Tim Horton.
3152
3153         This patch adds all the necessary support to write attachment elements into
3154         the pasteboard, including the promised type in WK2.
3155
3156         * UIProcess/API/mac/WKView.mm:
3157         (-[WKView _setPromisedDataForImage:withFileName:withExtension:withTitle:withURL:withVisibleURL:withArchive:forPasteboard:]):
3158         (-[WKView _setPromisedDataForAttachment:withExtension:withTitle:withURL:withVisibleURL:forPasteboard:]):
3159         (-[WKView namesOfPromisedFilesDroppedAtDestination:]):
3160         (-[WKView _setPromisedData:withFileName:withExtension:withTitle:withURL:withVisibleURL:withArchive:forPasteboard:]): Deleted.
3161         * UIProcess/API/mac/WKViewInternal.h:
3162         * UIProcess/PageClient.h:
3163         * UIProcess/WebPageProxy.h:
3164         * UIProcess/WebPageProxy.messages.in:
3165         * UIProcess/mac/PageClientImpl.h:
3166         * UIProcess/mac/PageClientImpl.mm:
3167         (WebKit::PageClientImpl::setPromisedDataForImage):
3168         (WebKit::PageClientImpl::setPromisedDataForAttachment):
3169         (WebKit::PageClientImpl::setPromisedData): Deleted.
3170         * UIProcess/mac/WebPageProxyMac.mm:
3171         (WebKit::WebPageProxy::setPromisedDataForImage):
3172         (WebKit::WebPageProxy::setPromisedDataForAttachment):
3173         (WebKit::WebPageProxy::setPromisedData): Deleted.
3174         * WebProcess/WebCoreSupport/WebDragClient.h:
3175         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
3176         (WebKit::WebDragClient::declareAndWriteAttachment):
3177         (WebKit::WebDragClient::declareAndWriteDragImage):
3178
3179 2015-03-19  Anders Carlsson  <andersca@apple.com>
3180
3181         Cache::remove should take a Key instead of an entry
3182         https://bugs.webkit.org/show_bug.cgi?id=142878
3183
3184         Reviewed by Antti Koivisto.
3185
3186         * NetworkProcess/cache/NetworkCache.cpp:
3187         (WebKit::NetworkCache::Cache::remove):
3188         * NetworkProcess/cache/NetworkCache.h:
3189
3190 2015-03-19  Chris Dumez  <cdumez@apple.com>
3191
3192         Clean up DOMTimer related settings
3193         https://bugs.webkit.org/show_bug.cgi?id=142837
3194
3195         Reviewed by Darin Adler.
3196
3197         Stop setting the DOMTimers' default minimum interval to 4ms as this
3198         is now the default.
3199
3200         * WebProcess/WebPage/WebPage.cpp:
3201         (WebKit::WebPage::WebPage):
3202
3203 2015-03-19  Chris Dumez  <cdumez@apple.com>
3204
3205         The network cache should ignore "cache-control: no-cache, must-revalidate" on history navigation
3206         https://bugs.webkit.org/show_bug.cgi?id=142831
3207         <rdar://problem/20209957>
3208
3209         Reviewed by Antti Koivisto.
3210
3211         The network cache should ignore "no-cache" and "must-revalidate" as
3212         Cache-Control policy for history navigations to avoid unnecessary
3213         revalidation in this case. Our memory cache already behaves this way.
3214
3215         On history navigation, our disk cache implementation currently
3216         revalidates unconditionally resources if "cache-control: no-cache" is
3217         used. It also revalidates expired resources if "cache-control:
3218         must-revalidate" is used. This is sub-optimal.
3219
3220         RFC 7234 does not require us to do so [1]:
3221         """
3222           User agents often have history mechanisms, such as "Back" buttons and
3223           history lists, that can be used to redisplay a representation
3224           retrieved earlier in a session.
3225
3226           The freshness model (Section 4.2) does not necessarily apply to
3227           history mechanisms.  That is, a history mechanism can display a
3228           previous representation even if it has expired.
3229         """
3230
3231         Chrome and IE9+ [2] already ignore "cache-control: must-revalidate" on history navigation.
3232
3233         [1] https://tools.ietf.org/html/rfc7234#page-32
3234         [2] http://blogs.msdn.com/b/ie/archive/2010/07/14/caching-improvements-in-internet-explorer-9.aspx
3235
3236         Test: http/tests/cache/disk-cache-validation-back-navigation-policy.html
3237
3238         * NetworkProcess/cache/NetworkCache.cpp:
3239         (WebKit::NetworkCache::decodeStorageEntry):
3240
3241 2015-03-18  Simon Fraser  <simon.fraser@apple.com>
3242
3243         Don't paint PDFs on every scroll
3244         https://bugs.webkit.org/show_bug.cgi?id=142857
3245         rdar://problem/20130207
3246
3247         Reviewed by Tim Horton.
3248         
3249         Don't push a scale factor onto the PDF layer controller if it hasn't
3250         changed, since doing so causes a repaint.
3251
3252         * WebProcess/Plugins/PDF/PDFPlugin.mm:
3253         (WebKit::PDFPlugin::updatePageAndDeviceScaleFactors):
3254
3255 2015-03-18  Anders Carlsson  <andersca@apple.com>
3256
3257         Use && instead of & when deciding if the network cache should be cleared
3258         https://bugs.webkit.org/show_bug.cgi?id=142845
3259
3260         Reviewed by Antti Koivisto.
3261
3262         * NetworkProcess/NetworkProcess.cpp:
3263         (WebKit::NetworkProcess::deleteWebsiteData):
3264
3265 2015-03-18  Anders Carlsson  <andersca@apple.com>
3266
3267         Add WKContextGetWebsiteDataStore API
3268         https://bugs.webkit.org/show_bug.cgi?id=142832
3269         rdar://problem/16544715
3270
3271         Reviewed by Sam Weinig.
3272
3273         Also add WKWebsiteDataStoreRef which is toll-free bridged to _WKWebsiteDataStore.
3274
3275         * Shared/API/c/WKBase.h:
3276         Add new declaration.
3277
3278         * UIProcess/API/APIWebsiteDataStore.cpp:
3279         (API::WebsiteDataStore::create):
3280         * UIProcess/API/APIWebsiteDataStore.h:
3281         Add a new function that takes a configuration.
3282
3283         * UIProcess/API/C/WKAPICast.h:
3284         Add cast.
3285
3286         * UIProcess/API/C/WKContext.cpp:
3287         (WKContextGetWebsiteDataStore):
3288         Return the context's website data store.
3289
3290         * UIProcess/API/C/WKContext.h:
3291         Add new declaration.
3292
3293         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: Added.
3294         * UIProcess/API/C/WKWebsiteDataStoreRef.h: Added.
3295         Add new files.
3296
3297         * UIProcess/WebKeyValueStorageManager.cpp:
3298         (WebKit::WebKeyValueStorageManager::getKeyValueStorageOrigins):
3299         (WebKit::WebKeyValueStorageManager::getStorageDetailsByOrigin):
3300         (WebKit::WebKeyValueStorageManager::deleteEntriesForOrigin):
3301         (WebKit::WebKeyValueStorageManager::deleteAllEntries):
3302         Update now that WebProcessPool holds on to an API::WebsiteDataStore.
3303
3304         * UIProcess/WebProcessPool.cpp:
3305         (WebKit::WebProcessPool::WebProcessPool):
3306         (WebKit::WebProcessPool::createWebPage):
3307         * UIProcess/WebProcessPool.h:
3308         WebProcessPool should hold on to an API::WebsiteDataStore instead of a WebKit::WebsiteDataStore.
3309
3310         * WebKit2.xcodeproj/project.pbxproj:
3311         Add new files.
3312
3313 2015-03-18  Tim Horton  <timothy_horton@apple.com>
3314
3315         Cannot invoke action menus anymore
3316         https://bugs.webkit.org/show_bug.cgi?id=142797
3317         <rdar://problem/20032670>
3318
3319         * UIProcess/API/mac/WKView.mm:
3320         Need one more respondsToSelector check.
3321
3322 2015-03-18  Chris Dumez  <cdumez@apple.com>
3323
3324         [WK2] Log the number of network cache requests that we have never seen before
3325         https://bugs.webkit.org/show_bug.cgi?id=142828
3326         <rdar://problem/19632130>
3327
3328         Reviewed by Antti Koivisto.
3329
3330         Log the number of network cache requests that we have never seen before
3331         using diagnostic logging.
3332
3333         * NetworkProcess/cache/NetworkCacheStatisticsCocoa.mm:
3334         (WebKit::NetworkCache::Statistics::recordNotUsingCacheForRequest):
3335         (WebKit::NetworkCache::Statistics::recordRetrievalFailure):
3336
3337 2015-03-17  Antti Koivisto  <antti@apple.com>
3338
3339         Prune least valuable cache entries first
3340         https://bugs.webkit.org/show_bug.cgi?id=142810
3341         rdar://problem/19632130
3342
3343         Reviewed by Darin Adler.
3344
3345         When pruning the cache estimate relative value of each entry using formula
3346
3347         age = current time - creation time
3348         accessAge = last access time - creation time
3349         value = accessAge / age
3350
3351         That is, we value entries that have been accessed recently and survived in the cache longest.
3352
3353         The most valuable entries don't get deleted at all while the deletion probablity ramps up for
3354         lower value entries.
3355
3356         * NetworkProcess/cache/NetworkCacheFileSystemPosix.h:
3357         (WebKit::NetworkCache::fileTimes):
3358
3359             Get the creation time and access time for a file.
3360
3361         (WebKit::NetworkCache::updateFileAccessTimeIfNeeded):
3362
3363             Update access time manually if the file system doesn't do it automatically.
3364
3365         * NetworkProcess/cache/NetworkCacheIOChannel.h:
3366         (WebKit::NetworkCache::IOChannel::path):
3367         (WebKit::NetworkCache::IOChannel::type):
3368         * NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm:
3369         (WebKit::NetworkCache::IOChannel::IOChannel):
3370         (WebKit::NetworkCache::IOChannel::open):
3371
3372             Remember the file path and move most of the work to constructor.
3373
3374         * NetworkProcess/cache/NetworkCacheStorage.cpp:
3375         (WebKit::NetworkCache::Storage::Storage):
3376         (WebKit::NetworkCache::Storage::remove):
3377         (WebKit::NetworkCache::Storage::updateFileAccessTime):
3378         (WebKit::NetworkCache::Storage::dispatchReadOperation):
3379         (WebKit::NetworkCache::deletionProbability):
3380
3381             Compute the probability based on entry age and access time.
3382
3383         (WebKit::NetworkCache::Storage::shrinkIfNeeded):
3384         * NetworkProcess/cache/NetworkCacheStorage.h:
3385         (WebKit::NetworkCache::Storage::serialBackgroundIOQueue):
3386         (WebKit::NetworkCache::Storage::deleteQueue): Deleted.
3387
3388             More generic name.
3389
3390 2015-03-18  Chris Dumez  <cdumez@apple.com>
3391
3392         [WK2] Log total number of network cache queries using diagnostic logging
3393         https://bugs.webkit.org/show_bug.cgi?id=142803
3394         <rdar://problem/19632130>
3395
3396         Reviewed by Antti Koivisto.
3397
3398         Log total number of network cache queries using diagnostic logging.
3399
3400         * NetworkProcess/cache/NetworkCache.cpp:
3401         (WebKit::NetworkCache::Cache::retrieve):
3402         * NetworkProcess/cache/NetworkCacheStatistics.h:
3403         * NetworkProcess/cache/NetworkCacheStatisticsCocoa.mm:
3404         (WebKit::NetworkCache::Statistics::recordCacheRetrievalRequest):
3405
3406 2015-03-18  Chris Dumez  <cdumez@apple.com>
3407
3408         [WK2] We should not even try the network cache for non-HTTP protocol requests
3409         https://bugs.webkit.org/show_bug.cgi?id=142802
3410         <rdar://problem/19632130>
3411
3412         Reviewed by Antti Koivisto.
3413
3414         We should not even try the network cache for non-HTTP protocol requests
3415         and the network cache cannot handle those.
3416
3417         * NetworkProcess/NetworkResourceLoader.cpp:
3418         (WebKit::NetworkResourceLoader::start):
3419         * NetworkProcess/cache/NetworkCache.cpp:
3420         (WebKit::NetworkCache::canRetrieve):
3421         (WebKit::NetworkCache::Cache::retrieve):
3422         * NetworkProcess/cache/NetworkCache.h:
3423         * NetworkProcess/cache/NetworkCacheStatisticsCocoa.mm:
3424         (WebKit::NetworkCache::retrieveDecisionToDiagnosticKey):
3425
3426 2015-03-17  Conrad Shultz  <conrad_shultz@apple.com>
3427
3428         Ignore some deprecation warnings
3429         https://bugs.webkit.org/show_bug.cgi?id=142813
3430
3431         Reviewed by Mark Rowe.
3432
3433         Fixing the deprecations is tracked by: <rdar://problem/20201450>
3434
3435         * UIProcess/mac/WebPopupMenuProxyMac.mm:
3436         (WebKit::WebPopupMenuProxyMac::populate):
3437
3438 2015-03-17  Ryuan Choi  <ryuan.choi@navercorp.com>
3439
3440         [EFL] Expose JavaScript binding interface through ewk_extension
3441         https://bugs.webkit.org/show_bug.cgi?id=142033
3442
3443         Reviewed by Gyuyoung Kim.
3444
3445         * PlatformEfl.cmake:
3446         * UIProcess/API/efl/tests/extensions/extension_sample.cpp: Registered test object for new test case.
3447         * UIProcess/API/efl/tests/test_ewk2_javascript_binding.cpp: Added simple binding API test case.
3448         (EWK2ContextTestWithExtension::messageReceivedCallback):
3449         (EWK2ContextTestWithExtension::EWK2ContextTestWithExtension):
3450         (TEST_F):
3451         * WebProcess/InjectedBundle/API/efl/EWebKit_Extension.h:
3452         * WebProcess/InjectedBundle/API/efl/ewk_extension.cpp:
3453         (EwkExtension::didCreatePage):
3454         (EwkExtension::willDestroyPage):
3455         * WebProcess/InjectedBundle/API/efl/ewk_extension.h:
3456         * WebProcess/InjectedBundle/API/efl/ewk_extension_private.h:
3457         * WebProcess/InjectedBundle/API/efl/ewk_page.cpp: Added.
3458         (toEwkPage):
3459         (EwkPage::EwkPage):
3460         (EwkPage::append):
3461         (EwkPage::remove):
3462         (EwkPage::didFinishDocumentLoadForFrame):
3463         (ewk_page_js_global_context_get):
3464         (ewk_page_client_register):
3465         (ewk_page_client_unregister):
3466         * WebProcess/InjectedBundle/API/efl/ewk_page.h: Added.
3467         * WebProcess/InjectedBundle/API/efl/ewk_page_private.h: Added.
3468         (EwkPage::page):
3469         * efl/ewebkit2-extension.pc.in:
3470
3471 2015-03-17  Tim Horton  <timothy_horton@apple.com>
3472
3473         Cannot invoke action menus anymore
3474         https://bugs.webkit.org/show_bug.cgi?id=142797
3475         <rdar://problem/20032670>
3476
3477         * UIProcess/API/mac/WKView.mm:
3478         Need a respondsToSelector check.
3479
3480 2015-03-17  Tim Horton  <timothy_horton@apple.com>
3481
3482         Cannot invoke action menus anymore
3483         https://bugs.webkit.org/show_bug.cgi?id=142797
3484         <rdar://problem/20032670>
3485
3486         Reviewed by Beth Dakin.
3487
3488         * UIProcess/API/mac/WKView.mm:
3489         Don't process mouse events that would make an action menu; call super
3490         and let AppKit take care of it. We have&n