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