One esc to exit fullscreen and pointer lock
[WebKit-https.git] / Source / WebKit2 / ChangeLog
1 2016-12-07  Jeremy Jones  <jeremyj@apple.com>
2
3         One esc to exit fullscreen and pointer lock
4         https://bugs.webkit.org/show_bug.cgi?id=165416
5         rdar://problem/29430711
6
7         Reviewed by Jer Noble.
8
9         Fix a crash when didLosePointerLock is not specified.
10
11         * UIProcess/API/C/WKPage.cpp:
12         (WKPageSetPageUIClient):
13
14 2016-12-07  Keith Rollin  <krollin@apple.com>
15
16         Network event record/replay
17         https://bugs.webkit.org/show_bug.cgi?id=164527
18         <rdar://problem/29168157>
19
20         Reviewed by Alex Christensen.
21
22         Add WebKit2/NetworkProcess/capture/* for recording the network events
23         that occur when loading a page and for replaying them later. Update
24         NetworkLoad to invoke capture facilities. Add preferences for enabling
25         record or replay.
26
27         * CMakeLists.txt:
28         * NetworkProcess/NetworkLoad.cpp:
29         (WebKit::NetworkLoad::NetworkLoad):
30         (WebKit::NetworkLoad::initializeForRecord):
31         (WebKit::NetworkLoad::initializeForReplay):
32         (WebKit::NetworkLoad::initialize):
33         (WebKit::NetworkLoad::setDefersLoading):
34         (WebKit::NetworkLoad::continueWillSendRequest):
35         (WebKit::NetworkLoad::sharedWillSendRedirectedRequest):
36         (WebKit::NetworkLoad::notifyDidReceiveResponse):
37         (WebKit::NetworkLoad::didReceiveData):
38         (WebKit::NetworkLoad::didCompleteWithError):
39         * NetworkProcess/NetworkLoad.h:
40         * NetworkProcess/NetworkProcess.cpp:
41         (WebKit::NetworkProcess::initializeNetworkProcess):
42         (WebKit::NetworkProcess::terminate):
43         * NetworkProcess/NetworkProcessCreationParameters.cpp:
44         (WebKit::NetworkProcessCreationParameters::encode):
45         (WebKit::NetworkProcessCreationParameters::decode):
46         * NetworkProcess/NetworkProcessCreationParameters.h:
47         * NetworkProcess/capture/NetworkCaptureEvent.cpp: Added.
48         (WebKit::NetworkCapture::copyHeaders):
49         (WebKit::NetworkCapture::KeyValuePair::KeyValuePair):
50         (WebKit::NetworkCapture::ResourceRequest::ResourceRequest):
51         (WebKit::NetworkCapture::ResourceRequest::operator WebCore::ResourceRequest):
52         (WebKit::NetworkCapture::ResourceResponse::ResourceResponse):
53         (WebKit::NetworkCapture::ResourceResponse::operator WebCore::ResourceResponse):
54         (WebKit::NetworkCapture::ResourceError::ResourceError):
55         (WebKit::NetworkCapture::ResourceError::operator WebCore::ResourceError):
56         (WebKit::NetworkCapture::JSONCoder::encode):
57         (WebKit::NetworkCapture::JSONCoder::decode):
58         (WebKit::NetworkCapture::JSONCoder<String>::encode):
59         (WebKit::NetworkCapture::JSONCoder<String>::decode):
60         (WebKit::NetworkCapture::JSONCoder<CaptureTimeType>::encode):
61         (WebKit::NetworkCapture::JSONCoder<CaptureTimeType>::decode):
62         (WebKit::NetworkCapture::JSONCoder<KeyValuePair>::encode):
63         (WebKit::NetworkCapture::JSONCoder<KeyValuePair>::decode):
64         (WebKit::NetworkCapture::JSONCoder<Vector<T>>::encode):
65         (WebKit::NetworkCapture::JSONCoder<Vector<T>>::decode):
66         (WebKit::NetworkCapture::JSONCoder<ResourceRequest>::encode):
67         (WebKit::NetworkCapture::JSONCoder<ResourceRequest>::decode):
68         (WebKit::NetworkCapture::JSONCoder<ResourceResponse>::encode):
69         (WebKit::NetworkCapture::JSONCoder<ResourceResponse>::decode):
70         (WebKit::NetworkCapture::JSONCoder<ResourceError>::encode):
71         (WebKit::NetworkCapture::JSONCoder<ResourceError>::decode):
72         (WebKit::NetworkCapture::JSONCoder<WebCore::SharedBuffer>::encode):
73         (WebKit::NetworkCapture::JSONCoder<WebCore::SharedBuffer>::decode):
74         (WebKit::NetworkCapture::JSONCoder<RequestSentEvent>::encode):
75         (WebKit::NetworkCapture::JSONCoder<RequestSentEvent>::decode):
76         (WebKit::NetworkCapture::JSONCoder<ResponseReceivedEvent>::encode):
77         (WebKit::NetworkCapture::JSONCoder<ResponseReceivedEvent>::decode):
78         (WebKit::NetworkCapture::JSONCoder<RedirectReceivedEvent>::encode):
79         (WebKit::NetworkCapture::JSONCoder<RedirectReceivedEvent>::decode):
80         (WebKit::NetworkCapture::JSONCoder<RedirectSentEvent>::encode):
81         (WebKit::NetworkCapture::JSONCoder<RedirectSentEvent>::decode):
82         (WebKit::NetworkCapture::JSONCoder<DataReceivedEvent>::encode):
83         (WebKit::NetworkCapture::JSONCoder<DataReceivedEvent>::decode):
84         (WebKit::NetworkCapture::JSONCoder<FinishedEvent>::encode):
85         (WebKit::NetworkCapture::JSONCoder<FinishedEvent>::decode):
86         (WebKit::NetworkCapture::eventToString):
87         (WebKit::NetworkCapture::stringToEvent):
88         * NetworkProcess/capture/NetworkCaptureEvent.h: Added.
89         (WebKit::NetworkCapture::TimedEvent::TimedEvent):
90         * NetworkProcess/capture/NetworkCaptureLogging.h: Added.
91         * NetworkProcess/capture/NetworkCaptureManager.cpp: Added.
92         (WebKit::NetworkCapture::Manager::singleton):
93         (WebKit::NetworkCapture::Manager::initialize):
94         (WebKit::NetworkCapture::Manager::terminate):
95         (WebKit::NetworkCapture::Manager::findMatch):
96         (WebKit::NetworkCapture::Manager::findExactMatch):
97         (WebKit::NetworkCapture::Manager::findBestFuzzyMatch):
98         (WebKit::NetworkCapture::Manager::fuzzyMatchURLs):
99         (WebKit::NetworkCapture::Manager::loadResources):
100         (WebKit::NetworkCapture::Manager::reportLoadPath):
101         (WebKit::NetworkCapture::Manager::reportRecordPath):
102         (WebKit::NetworkCapture::Manager::reportReplayPath):
103         (WebKit::NetworkCapture::Manager::requestToPath):
104         (WebKit::NetworkCapture::Manager::stringToHash):
105         (WebKit::NetworkCapture::Manager::hashToPath):
106         (WebKit::NetworkCapture::Manager::logRecordedResource):
107         (WebKit::NetworkCapture::Manager::logLoadedResource):
108         (WebKit::NetworkCapture::Manager::logPlayedBackResource):
109         (WebKit::NetworkCapture::Manager::ensureFileHandle):
110         (WebKit::NetworkCapture::Manager::openCacheFile):
111         (WebKit::NetworkCapture::Manager::readFile):
112         (WebKit::NetworkCapture::Manager::getLine):
113         (WebKit::NetworkCapture::Manager::getWord):
114         (WebKit::NetworkCapture::Manager::printToFile):
115         * NetworkProcess/capture/NetworkCaptureManager.h: Added.
116         (WebKit::NetworkCapture::Manager::isRecording):
117         (WebKit::NetworkCapture::Manager::isReplaying):
118         (WebKit::NetworkCapture::Manager::mode):
119         * NetworkProcess/capture/NetworkCaptureRecorder.cpp: Added.
120         (WebKit::NetworkCapture::Recorder::recordRequestSent):
121         (WebKit::NetworkCapture::Recorder::recordResponseReceived):
122         (WebKit::NetworkCapture::Recorder::recordRedirectReceived):
123         (WebKit::NetworkCapture::Recorder::recordRedirectSent):
124         (WebKit::NetworkCapture::Recorder::recordDataReceived):
125         (WebKit::NetworkCapture::Recorder::recordFinish):
126         (WebKit::NetworkCapture::Recorder::writeEvents):
127         * NetworkProcess/capture/NetworkCaptureRecorder.h: Added.
128         (WebKit::NetworkCapture::Recorder::recordEvent):
129         * NetworkProcess/capture/NetworkCaptureReplayer.cpp: Added.
130         (WebKit::NetworkCapture::Replayer::replayResource):
131         * NetworkProcess/capture/NetworkCaptureReplayer.h: Added.
132         * NetworkProcess/capture/NetworkCaptureResource.cpp: Added.
133         (WebKit::NetworkCapture::Resource::Resource):
134         (WebKit::NetworkCapture::Resource::url):
135         (WebKit::NetworkCapture::Resource::baseURL):
136         (WebKit::NetworkCapture::Resource::queryParameters):
137         (WebKit::NetworkCapture::Resource::eventStream):
138         (WebKit::NetworkCapture::Resource::EventStream::EventStream):
139         (WebKit::NetworkCapture::Resource::EventStream::nextEvent):
140         * NetworkProcess/capture/NetworkCaptureResource.h: Added.
141         * NetworkProcess/capture/NetworkCaptureTypes.h: Added.
142         (WebKit::NetworkCapture::TypeHolder::forEachTypeImpl):
143         (WebKit::NetworkCapture::TypeHolder::forEachType):
144         * NetworkProcess/capture/NetworkDataTaskReplay.cpp: Added.
145         (WebKit::NetworkCapture::NetworkDataTaskReplay::NetworkDataTaskReplay):
146         (WebKit::NetworkCapture::NetworkDataTaskReplay::~NetworkDataTaskReplay):
147         (WebKit::NetworkCapture::NetworkDataTaskReplay::resume):
148         (WebKit::NetworkCapture::NetworkDataTaskReplay::suspend):
149         (WebKit::NetworkCapture::NetworkDataTaskReplay::cancel):
150         (WebKit::NetworkCapture::NetworkDataTaskReplay::complete):
151         (WebKit::NetworkCapture::NetworkDataTaskReplay::invalidateAndCancel):
152         (WebKit::NetworkCapture::NetworkDataTaskReplay::enqueueEventHandler):
153         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayRequestSent):
154         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayResponseReceived):
155         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayRedirectReceived):
156         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayRedirectSent):
157         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayDataReceived):
158         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayFinished):
159         (WebKit::NetworkCapture::NetworkDataTaskReplay::didReceiveResponse):
160         (WebKit::NetworkCapture::NetworkDataTaskReplay::didFinish):
161         * NetworkProcess/capture/NetworkDataTaskReplay.h: Added.
162         (WebKit::NetworkCapture::NetworkDataTaskReplay::create):
163         * NetworkProcess/capture/json.hpp: Added.
164         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
165         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
166         * WebKit2.xcodeproj/project.pbxproj:
167         * config.h:
168
169 2016-12-07  Anders Carlsson  <andersca@apple.com>
170
171         Fix build.
172
173         * Platform/IPC/mac/ConnectionMac.mm:
174         (IPC::Connection::open):
175
176 2016-12-07  Anders Carlsson  <andersca@apple.com>
177
178         Rename the connection sources to better indicate what data direction they are used for
179         https://bugs.webkit.org/show_bug.cgi?id=165548
180
181         Reviewed by Tim Horton.
182
183         * Platform/IPC/Connection.h:
184         * Platform/IPC/mac/ConnectionMac.mm:
185         (IPC::Connection::platformInvalidate):
186         (IPC::Connection::platformInitialize):
187         (IPC::createReceiveSource):
188         (IPC::Connection::initializeSendSource):
189         (IPC::Connection::receiveSourceEventHandler):
190         (IPC::createDataAvailableSource): Deleted.
191         (IPC::Connection::initializeDeadNameSource): Deleted.
192         Rename m_deadNameSource to m_sendSource, and m_receivePortDataAvailableSource to m_receiveSource.
193
194         (IPC::Connection::open):
195         Initialize the send source before we attempt to send a first message.
196
197 2016-12-07  Simon Fraser  <simon.fraser@apple.com>
198
199         Fix use of enum in a WK2 C SPI header.
200         rdar://problem/28725583
201
202         Followup to correctly prefix the enum values.
203
204         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
205         (WKBundlePageSetEventThrottlingBehaviorOverride):
206         * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
207
208 2016-12-07  Simon Fraser  <simon.fraser@apple.com>
209
210         Fix use of enum in a WK2 C SPI header.
211         rdar://problem/28725583
212
213         Reviewed by Dan Bernstein.
214
215         Use correct enum style for a C SPI header and fix the callers.
216
217         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
218         (WKBundlePageSetEventThrottlingBehaviorOverride):
219         * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
220
221 2016-12-07  Beth Dakin  <bdakin@apple.com>
222
223         Remove iCloud Pages and Keynote site-specific hacks
224         https://bugs.webkit.org/show_bug.cgi?id=165544
225         -and corresponding-
226         rdar://problem/29082536
227
228         Reviewed by Wenson Hsieh.
229
230         * WebProcess/WebPage/WebPage.cpp:
231         (WebKit::needsHiddenContentEditableQuirk):
232         (WebKit::needsPlainTextQuirk):
233
234 2016-12-05  Ada Chan  <adachan@apple.com>
235
236         Add a getter for serverTrust in _WKObservablePageState
237         https://bugs.webkit.org/show_bug.cgi?id=165433
238
239         Reviewed by Anders Carlsson.
240
241         * UIProcess/API/C/mac/WKPagePrivateMac.h:
242         * UIProcess/API/C/mac/WKPagePrivateMac.mm:
243         (-[WKObservablePageState serverTrust]):
244
245 2016-12-07  Jer Noble  <jer.noble@apple.com>
246
247         Exiting Element Fullscreen mode loses focus on WKWebView.
248         https://bugs.webkit.org/show_bug.cgi?id=165512
249
250         Reviewed by Eric Carlson.
251
252         Setting 'window.contentView.hidden = YES' will reset the first-responder (whereas
253         previously setting 'window.contentView.layer.hidden = YES' did not). Grab the first-
254         responder before doing so, so that it can be reset correctly when moving the WKWebView
255         back to it's original window.
256
257         * UIProcess/mac/WKFullScreenWindowController.mm:
258         (-[WKFullScreenWindowController finishedExitFullScreenAnimation:]):
259
260 2016-12-07  Alex Christensen  <achristensen@webkit.org>
261
262         Fix CMake build after r209418.
263         https://bugs.webkit.org/show_bug.cgi?id=165484
264
265         * PlatformMac.cmake:
266
267 2016-12-07  Philippe Normand  <pnormand@igalia.com>
268
269         Unreviewed, GTK build fix after r209407.
270
271         * Platform/IPC/unix/ConnectionUnix.cpp:
272         (IPC::Connection::processMessage):
273         * UIProcess/LegacySessionStateCodingNone.cpp:
274         (WebKit::decodeLegacySessionState):
275
276 2016-12-06  Ryan Haddad  <ryanhaddad@apple.com>
277
278         Unreviewed, rolling out r209422.
279
280         This change caused assertion failures during API tests.
281
282         Reverted changeset:
283
284         "[MediaStream][Mac] Revoke sandbox extensions when capture
285         ends"
286         https://bugs.webkit.org/show_bug.cgi?id=165476
287         http://trac.webkit.org/changeset/209422
288
289 2016-12-06  Dean Jackson  <dino@apple.com>
290
291         Include default value in Experimental Feature information
292         https://bugs.webkit.org/show_bug.cgi?id=165509
293         <rdar://problems/29547177>
294
295         Reviewed by Tim Horton.
296
297         Add a defaultValue member variable to experimental
298         features, both the C++ and ObjC interfaces.
299
300         * UIProcess/API/APIExperimentalFeature.cpp:
301         (API::ExperimentalFeature::create):
302         (API::ExperimentalFeature::ExperimentalFeature):
303         * UIProcess/API/APIExperimentalFeature.h:
304         * UIProcess/API/Cocoa/_WKExperimentalFeature.h:
305         * UIProcess/API/Cocoa/_WKExperimentalFeature.mm:
306         (-[_WKExperimentalFeature description]):
307         (-[_WKExperimentalFeature defaultValue]):
308         * UIProcess/WebPreferences.cpp:
309         (WebKit::createExperimentalFeaturesVector):
310
311 2016-12-06  Commit Queue  <commit-queue@webkit.org>
312
313         Unreviewed, rolling out r209391.
314         https://bugs.webkit.org/show_bug.cgi?id=165501
315
316         requires explicit nullptr checks so missing env vars don't
317         flip AC mode (Requested by mcatanzaro on #webkit).
318
319         Reverted changeset:
320
321         "[GTK] Process accelerated compositing env variables only if
322         they are really enabled"
323         https://bugs.webkit.org/show_bug.cgi?id=165300
324         http://trac.webkit.org/changeset/209391
325
326 2016-12-06  Alexey Proskuryakov  <ap@apple.com>
327
328         Correct SDKROOT values in xcconfig files
329         https://bugs.webkit.org/show_bug.cgi?id=165487
330         rdar://problem/29539209
331
332         Reviewed by Dan Bernstein.
333
334         Fix suggested by Dan Bernstein.
335
336         * Configurations/DebugRelease.xcconfig:
337
338 2016-12-06  Andreas Kling  <akling@apple.com>
339
340         [Cocoa] Add some memory usage related information to sysdiagnose state dumps
341         <https://webkit.org/b/165375>
342         <rdar://problem/29057243>
343
344         Reviewed by Darin Adler.
345
346         Follow-up to address two more review comments.
347
348         * WebProcess/cocoa/WebProcessCocoa.mm:
349         (WebKit::WebProcess::registerWithStateDumper): Use adoptNS() instead of autorelease for NSStrings.
350
351 2016-12-06  Eric Carlson  <eric.carlson@apple.com>
352
353         [MediaStream][Mac] Revoke sandbox extensions when capture ends
354         https://bugs.webkit.org/show_bug.cgi?id=165476
355
356         Reviewed by Brady Eidson.
357         
358         Track media capture by process so it is possible to revoke the sandbox extensions issued to
359         a web process when capture stops.
360
361         * CMakeLists.txt: Add new files.
362
363         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
364         (WebKit::UserMediaPermissionRequestManagerProxy::UserMediaPermissionRequestManagerProxy): Register
365           with process manager.
366         (WebKit::UserMediaPermissionRequestManagerProxy::~UserMediaPermissionRequestManagerProxy):
367         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasGranted): Move sandbox 
368           extension code to the process manager.
369         (WebKit::UserMediaPermissionRequestManagerProxy::stopCapture): New.
370         (WebKit::UserMediaPermissionRequestManagerProxy::startedCaptureSession): New, report state
371           change to the process manager.
372         (WebKit::UserMediaPermissionRequestManagerProxy::endedCaptureSession): Ditto.
373         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
374
375         * UIProcess/UserMediaProcessManager.cpp: Added.
376         (WebKit::ProcessState::ProcessState):
377         (WebKit::ProcessState::managers):
378         (WebKit::ProcessState::sandboxExtensionsGranted):
379         (WebKit::ProcessState::setSandboxExtensionsGranted):
380         (WebKit::stateMap):
381         (WebKit::processState):
382         (WebKit::ProcessState::addRequestManager):
383         (WebKit::ProcessState::removeRequestManager):
384         (WebKit::UserMediaProcessManager::singleton):
385         (WebKit::UserMediaProcessManager::addUserMediaPermissionRequestManagerProxy):
386         (WebKit::UserMediaProcessManager::removeUserMediaPermissionRequestManagerProxy):
387         (WebKit::UserMediaProcessManager::willCreateMediaStream):
388         (WebKit::UserMediaProcessManager::startedCaptureSession):
389         (WebKit::UserMediaProcessManager::endedCaptureSession):
390         * UIProcess/UserMediaProcessManager.h: Added.
391
392         * UIProcess/WebPageProxy.cpp:
393         (WebKit::WebPageProxy::isPlayingMediaDidChange): Report capture state changes to the request
394           manager proxy.
395         * UIProcess/WebPageProxy.h:
396
397         * WebKit2.xcodeproj/project.pbxproj: Add new files.
398
399         * WebProcess/MediaStream/MediaDeviceSandboxExtensions.cpp: Added.
400         (WebKit::MediaDeviceSandboxExtensions::MediaDeviceSandboxExtensions):
401         (WebKit::MediaDeviceSandboxExtensions::encode):
402         (WebKit::MediaDeviceSandboxExtensions::decode):
403         (WebKit::MediaDeviceSandboxExtensions::operator[]):
404         (WebKit::MediaDeviceSandboxExtensions::size):
405         * WebProcess/MediaStream/MediaDeviceSandboxExtensions.h: Added.
406
407         * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
408         (WebKit::UserMediaPermissionRequestManager::~UserMediaPermissionRequestManager): Sandbox extension
409           is now in a HashMap, not a Vector.
410         (WebKit::UserMediaPermissionRequestManager::grantUserMediaDeviceSandboxExtensions): Record
411           IDs with extensions so they can be revoked later.
412         (WebKit::UserMediaPermissionRequestManager::revokeUserMediaDeviceSandboxExtensions): New.
413         (WebKit::UserMediaPermissionRequestManager::grantUserMediaDevicesSandboxExtension): Deleted.
414         * WebProcess/MediaStream/UserMediaPermissionRequestManager.h:
415
416         * WebProcess/WebPage/WebPage.cpp:
417         (WebKit::WebPage::grantUserMediaDeviceSandboxExtensions):
418         (WebKit::WebPage::revokeUserMediaDeviceSandboxExtensions):
419         (WebKit::WebPage::grantUserMediaDevicesSandboxExtension): Deleted.
420         * WebProcess/WebPage/WebPage.h:
421         * WebProcess/WebPage/WebPage.messages.in:
422
423 2016-12-06  Anders Carlsson  <andersca@apple.com>
424
425         Add a new MachMessage class and use it for sending outgoing messages
426         https://bugs.webkit.org/show_bug.cgi?id=165484
427
428         Reviewed by Sam Weinig.
429
430         * Platform/IPC/mac/ConnectionMac.mm:
431         (IPC::Connection::sendOutgoingMessage):
432         Instead of trying to randomly use memory from the stack as well as using mmap for the message data for out of line messages
433         (which makes no sense at all, since the body data is already mmapped), just always create a MachMessage object and use it.
434         
435         (IPC::machMessageSize): Deleted.
436         This has been moved to MachMessage::messageSize().
437         
438         * Platform/IPC/mac/MachMessage.cpp: Added.
439         (IPC::MachMessage::create):
440         Allocate extra memory to store the actual buffer.
441
442         (IPC::MachMessage::MachMessage):
443         Initialize variables. m_size isn't really used right now, but will be in a subsequent patch.
444
445         (IPC::MachMessage::header):
446         Return the header.
447         
448         * Platform/IPC/mac/MachMessage.h: Added.
449         (IPC::MachMessage::length):
450
451         * WebKit2.xcodeproj/project.pbxproj:
452         Add new files.
453
454 2016-12-06  Simon Fraser  <simon.fraser@apple.com>
455
456         Enable visual viewports by default on Mac, and iOS Wk2
457         https://bugs.webkit.org/show_bug.cgi?id=165452
458
459         Reviewed by Zalan Bujtas.
460
461         Turn visual viewports on by default for WK2.
462
463         * Shared/WebPreferencesDefinitions.h:
464
465 2016-12-06  Daniel Bates  <dabates@apple.com>
466
467         WebKitTestRunner: Plugins are disabled in new windows
468         https://bugs.webkit.org/show_bug.cgi?id=165410
469
470         Reviewed by Alex Christensen.
471
472         Remove SPI exposed to explicitly toggle plugins from WebKitTestRunner.
473         Instead we will update WebKitTestRunner to make use of the SPI
474         WKBundleOverrideBoolPreferenceForTestRunner() to toggle plugins in
475         all windows.
476
477         * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
478         (WKBundleSetPluginsEnabled): Deleted.
479         * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h:
480         * WebProcess/InjectedBundle/InjectedBundle.cpp:
481         (WebKit::InjectedBundle::setPluginsEnabled): Deleted.
482
483 2016-12-05  Anders Carlsson  <andersca@apple.com>
484
485         Don't memcpy out of line data
486         https://bugs.webkit.org/show_bug.cgi?id=165434
487
488         Reviewed by Sam Weinig.
489
490         Change the Decoder constructor to take a buffer deallocator parameter. If the buffer deallocator is null, the
491         data will be copied as before. Otherwise, the memory will be adopted by the Decoder object, and will be deallocated
492         by invoking the data deallocator.
493
494         * Platform/IPC/Decoder.cpp:
495         (IPC::copyBuffer):
496         Add a new helper.
497
498         (IPC::Decoder::Decoder):
499         Copy the buffer if the deallocator is null.
500
501         (IPC::Decoder::~Decoder):
502         Invoke the deallocator or call fastFree if it is null.
503
504         (IPC::Decoder::unwrapForTesting):
505         Update constructor.
506         
507         (IPC::roundUpToAlignment):
508         (IPC::Decoder::alignBufferPosition):
509         (IPC::Decoder::decodeVariableLengthByteArray):
510         (IPC::decodeValueFromBuffer):
511         Change all these to deal with const pointers.
512
513         * Platform/IPC/Decoder.h:
514         Add new members.
515
516         * Platform/IPC/mac/ConnectionMac.mm:
517         (IPC::createMessageDecoder):
518         When we have out of line data, pass a deallocator that calls vm_deallocate, instead of copying the data
519         and then immediately throwing the original away.
520
521 2016-12-06  Tim Horton  <timothy_horton@apple.com>
522
523         Almost half-second stall scrolling apple.com because of synchronous getPositionInformation
524         https://bugs.webkit.org/show_bug.cgi?id=165403
525         <rdar://problem/29493285>
526
527         Reviewed by Enrica Casucci.
528
529         When retrieving interaction information, we don't always need to do
530         snapshots for 3D Touch or the action sheet, especially if we're
531         synchronously blocking the UI process main thread waiting for the reply.
532
533         Add a new InteractionInformationRequest, which allows callers of
534         getPositionInformation and requestPositionInformation to specify which
535         optional pieces of information they would like to compute.
536
537         * Shared/AssistedNodeInformation.h:
538         Fix a incorrect comment.
539
540         * Shared/ios/InteractionInformationRequest.cpp: Added.
541         (WebKit::InteractionInformationRequest::encode):
542         (WebKit::InteractionInformationRequest::decode):
543         (WebKit::InteractionInformationRequest::isValidForRequest):
544         * Shared/ios/InteractionInformationRequest.h: Added.
545         (WebKit::InteractionInformationRequest::InteractionInformationRequest):
546         * WebKit2.xcodeproj/project.pbxproj:
547         Add InteractionInformationRequest, which encapsulates all of the
548         parameters required to generate an InteractionInformationAtPosition.
549         Previously, that was just a point, but now we have two new parameters:
550         whether we should generate a snapshot of the element, and whether
551         we should generate a TextIndicator if the element is a link.
552
553         * Shared/ios/InteractionInformationAtPosition.h:
554         * Shared/ios/InteractionInformationAtPosition.mm:
555         (WebKit::InteractionInformationAtPosition::encode):
556         (WebKit::InteractionInformationAtPosition::decode):
557         (WebKit::InteractionInformationAtPosition::mergeCompatibleOptionalInformation):
558         Adopt InteractionInformationRequest.
559
560         * UIProcess/WebPageProxy.h:
561         * UIProcess/ios/WebPageProxyIOS.mm:
562         (WebKit::WebPageProxy::getPositionInformation):
563         (WebKit::WebPageProxy::requestPositionInformation):
564         * UIProcess/ios/WKActionSheetAssistant.mm:
565         (-[WKActionSheetAssistant initialPresentationRectInHostViewForSheet]):
566         (-[WKActionSheetAssistant presentationRectInHostViewForSheet]):
567         (-[WKActionSheetAssistant showImageSheet]):
568         (-[WKActionSheetAssistant showLinkSheet]):
569         * UIProcess/ios/WKPDFView.mm:
570         (-[WKPDFView annotation:isBeingPressedAtPoint:controller:]):
571         * WebProcess/WebPage/WebPage.h:
572         * WebProcess/WebPage/WebPage.messages.in:
573         Adopt InteractionInformationRequest.
574         
575         * UIProcess/ios/WKContentViewInteraction.h:
576         * UIProcess/ios/WKContentViewInteraction.mm:
577         (-[WKContentView _showAttachmentSheet]):
578         (-[WKContentView ensurePositionInformationIsUpToDate:]):
579         If we have a outstanding asynchronous position information request
580         for the current point, instead of sending a second separate request,
581         just wait for the async one to come in.
582
583         (-[WKContentView requestAsynchronousPositionInformationUpdate:]):
584         If asked to do an asynchronous request with more optional bits than
585         the current otherwise-valid response's request, update the position information.
586
587         (-[WKContentView gestureRecognizerShouldBegin:]):
588         The design of this mechanism is that during the highlight long press,
589         we do an async position information update, and then when we actually
590         begin a 3D Touch gesture, we hope to already have the requisite snapshots
591         ready (so that we can avoid synchronously blocking for them, there).
592         So, in the highlight long-press async request, ask for all the goodies.
593
594         (-[WKContentView hasSelectablePositionAtPoint:]):
595         (-[WKContentView pointIsNearMarkedText:]):
596         (-[WKContentView pointIsInAssistedNode:]):
597         (-[WKContentView _didNotHandleTapAsClick:]):
598         (-[WKContentView _positionInformationDidChange:]):
599         If we get a position information update for the same point, but with less
600         goodies attached (the snapshot/link indicator), copy them over from the old
601         position information, so that we never accidentally "downgrade" our info.
602
603         (-[WKContentView updatePositionInformationForActionSheetAssistant:]):
604         (-[WKContentView actionSheetAssistant:willStartInteractionWithElement:]):
605         (-[WKContentView _interactionShouldBeginFromPreviewItemController:forPosition:]):
606         (-[WKContentView _dataForPreviewItemController:atPosition:type:]):
607         (-[WKContentView _presentedViewControllerForPreviewItemController:]):        
608         More adoption.
609         
610         * WebProcess/WebPage/ios/WebPageIOS.mm:
611         (WebKit::WebPage::handleTap):
612         (WebKit::WebPage::handleTwoFingerTapAtPoint):
613         (WebKit::WebPage::commitPotentialTap):
614         Adopt InteractionInformationRequest.
615
616         (WebKit::WebPage::getPositionInformation):
617         (WebKit::WebPage::requestPositionInformation):
618         Copy the request into the response.
619         Only snapshot if the request wants a snapshot.
620         Only make a link indicator if the request wants one.
621
622 2016-12-06  Daniel Bates  <dabates@apple.com>
623
624         Cleanup: Rename some HTTP 0.9-specific functions to conform to WebKit Code Style Guidelines
625         https://bugs.webkit.org/show_bug.cgi?id=165451
626
627         Reviewed by Alex Christensen.
628
629         * NetworkProcess/NetworkDataTask.cpp:
630         (WebKit::NetworkDataTask::didReceiveResponse):
631
632 2016-12-06  Daniel Bates  <dabates@apple.com>
633
634         Remove unused InjectedBundle::overrideXSSAuditorEnabledForTestRunner()
635         https://bugs.webkit.org/show_bug.cgi?id=165408
636
637         Reviewed by Alex Christensen.
638
639         InjectedBundle::overrideXSSAuditorEnabledForTestRunner() is unused. This function was only
640         called by WKBundleOverrideXSSAuditorEnabledForTestRunner(), which was removed in r106005.
641
642         * WebProcess/InjectedBundle/InjectedBundle.cpp:
643         (WebKit::InjectedBundle::overrideXSSAuditorEnabledForTestRunner): Deleted.
644         * WebProcess/InjectedBundle/InjectedBundle.h:
645
646 2016-12-04  Darin Adler  <darin@apple.com>
647
648         Use ASCIICType more, and improve it a little bit
649         https://bugs.webkit.org/show_bug.cgi?id=165360
650
651         Reviewed by Sam Weinig.
652
653         * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
654         (WebKit::capitalizeRFC822HeaderFieldName): Removed unneeded checks to simplify code.
655
656 2016-12-06  Dave Hyatt  <hyatt@apple.com>
657
658         [CSS Parser] Turn on the new CSS parser
659         https://bugs.webkit.org/show_bug.cgi?id=165213
660
661         Reviewed by Zalan Bujtas.
662
663         * Shared/WebPreferencesDefinitions.h:
664
665 2016-12-06  Tomas Popela  <tpopela@redhat.com>
666
667         [GTK] Process accelerated compositing env variables only if they are really enabled
668         https://bugs.webkit.org/show_bug.cgi?id=165300
669
670         Don't process the WEBKIT_FORCE_COMPOSITING_MODE and
671         WEBKIT_DISABLE_COMPOSITING_MODE env variables if they are disabled
672         (eg. WEBKIT_DISABLE_COMPOSITING_MODE=0).
673
674         Reviewed by Michael Catanzaro.
675
676         * UIProcess/gtk/WebPreferencesGtk.cpp:
677         (WebKit::WebPreferences::platformInitializeStore):
678
679 2016-12-06  Sam Weinig  <sam@webkit.org>
680
681         [WebIDL] Add support for converting dictionaries to JS
682         https://bugs.webkit.org/show_bug.cgi?id=165367
683
684         Reviewed by Darin Adler and Alex Christensen.
685
686         * CMakeLists.txt:
687         Add missing directories to look in for headers.
688
689 2016-12-05  Tim Horton  <timothy_horton@apple.com>
690
691         Try to fix the iOS Simulator build.
692
693         * UIProcess/mac/RemoteLayerTreeHost.mm:
694         (WebKit::RemoteLayerTreeHost::mapAllIOSurfaceBackingStore):
695
696 2016-12-03  Simon Fraser  <simon.fraser@apple.com>
697
698         Minor reformat and renames in -didUpdateVisibleRect:
699         https://bugs.webkit.org/show_bug.cgi?id=165365
700
701         Reviewed by Dave Hyatt.
702         
703         didUpdateVisibleRect:... has lots of parameters. Put one on each line.
704
705         Rename the rects to make it clear they are "content" rects (i.e. in document coordinates).
706
707         * UIProcess/ios/WKContentView.h:
708         * UIProcess/ios/WKContentView.mm:
709         (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInset:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]):
710
711 2016-12-05  Tim Horton  <timothy_horton@apple.com>
712
713         Adopt CAMachPort-as-layer-contents
714         https://bugs.webkit.org/show_bug.cgi?id=141687
715         <rdar://problem/19393233>
716
717         Reviewed by Darin Adler.
718
719         * Shared/mac/RemoteLayerBackingStore.h:
720         * Shared/mac/RemoteLayerBackingStore.mm:
721         (WebKit::RemoteLayerBackingStore::decode):
722         On the UI process side, instead of actually looking up the surface,
723         just keep the MachSendRight around, to later be turned into a CAMachPort.
724
725         (WebKit::RemoteLayerBackingStore::applyBackingStoreToLayer):
726         Make a CAMachPort and leak our send right into it. CAMachPort
727         will adopt the port and destroy it when needed.
728
729         (WebKit::RemoteLayerBackingStore::setBufferVolatility):
730         Tiny style fix.
731
732         * Shared/mac/RemoteLayerTreePropertyApplier.h:
733         * Shared/mac/RemoteLayerTreePropertyApplier.mm:
734         (WebKit::applyPropertiesToLayer):
735         (WebKit::RemoteLayerTreePropertyApplier::applyProperties):
736         * UIProcess/DrawingAreaProxy.h:
737         (WebKit::DrawingAreaProxy::prepareForAppSuspension):
738         * UIProcess/ios/WebPageProxyIOS.mm:
739         (WebKit::WebPageProxy::applicationDidFinishSnapshottingAfterEnteringBackground):
740         * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h:
741         * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
742         (WebKit::RemoteLayerTreeDrawingAreaProxy::prepareForAppSuspension):
743         * UIProcess/mac/RemoteLayerTreeHost.h:
744         * UIProcess/mac/RemoteLayerTreeHost.mm:
745         (WebKit::RemoteLayerTreeHost::updateLayerTree):
746         (WebKit::RemoteLayerTreeHost::mapAllIOSurfaceBackingStore):
747         * WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
748         (WebKit::PlatformCALayerRemote::recursiveBuildTransaction):
749         Two supporting changes in order to fix the two regressions that this
750         caused when we tried to land it two years ago:
751
752         When an app is being suspended, resolve all CAMachPort backing store
753         into actual IOSurfaces. Otherwise, any live CAMachPorts will keep a
754         +1 on their respective IOSurface's use count, causing us to fail to
755         mark them volatile, keeping the app alive for more time (re-trying the
756         volatility change), and increasing the likelihood of background jetsam.
757
758         If the debugging tile map is enabled, do not use CAMachPort, because
759         we don't have a great way to plumb the same CAMachPort to two layers
760         (and it doesn't seem to work even if you do). Instead, just map the
761         IOSurface into the UI process like we used to.
762
763 2016-12-05  Dean Jackson  <dino@apple.com>
764
765         pointer lock needs to be feature detectable
766         https://bugs.webkit.org/show_bug.cgi?id=165426
767         <rdar://problem/29486715>
768
769         Reviewed by Antoine Quint.
770
771         Set the RuntimeEnabledFeature as preferences
772         change.
773
774         * UIProcess/API/C/WKPreferences.cpp:
775         (WKPreferencesSetPointerLockEnabled):
776         (WKPreferencesGetPointerLockEnabled):
777         * UIProcess/API/C/WKPreferencesRefPrivate.h:
778         * WebProcess/WebPage/WebPage.cpp:
779         (WebKit::WebPage::updatePreferences):
780
781 2016-12-05  Andreas Kling  <akling@apple.com>
782
783         [Cocoa] Add some memory usage related information to sysdiagnose state dumps
784         <https://webkit.org/b/165375>
785         <rdar://problem/29057243>
786
787         Reviewed by Darin Adler.
788
789         Add two new entries to the sysdiagnose state dumps for WebContent processes:
790         "Memory Usage Stats" and "JavaScript Object Counts".
791
792         The first category contains all the interesting stuff from task_info()
793         along with some WebCore and JavaScriptCore object/memory counters.
794
795         The second category contains a list of all the JS object types currently live
796         on the heap, along with a count.
797
798         * WebProcess/cocoa/WebProcessCocoa.mm:
799         (WebKit::WebProcess::registerWithStateDumper): Add two new entries to the
800         state dictionary: "Memory Usage Stats" and "JavaScript Object Counts".
801
802 2016-12-05  Csaba Osztrogonác  <ossy@webkit.org>
803
804         Unreviewed cmake buildfix after r209307.
805
806         * PlatformMac.cmake:
807
808 2016-12-03  Dan Bernstein  <mitz@apple.com>
809
810         [Cocoa] Expose InjectedBundlePageEditorClient via the Objective-C bundle SPI
811         https://bugs.webkit.org/show_bug.cgi?id=165276
812         <rdar://problem/29467040>
813
814         Reviewed by Darin Adler.
815
816         Test: TestWebKitAPI/Tests/WebKit2Cocoa/BundleEditingDelegate.mm
817
818         * Shared/Cocoa/APIObject.mm:
819         (API::Object::newObject): Wrap InjectedBundleRangeHandle in WKWebProcessPlugInRangeHandle.
820
821         * WebKit2.xcodeproj/project.pbxproj: Added references to new files, making
822           WKWebProcessPlugInEditingDelegate.h and WKWebProcessPlugInRangeHandle.h private headers.
823
824         * WebProcess/InjectedBundle/API/APIInjectedBundleEditorClient.h: Added. An base class
825           based on InjectedBundlePageEditorClient.
826         (API::InjectedBundle::EditorClient::~EditorClient):
827         (API::InjectedBundle::EditorClient::shouldBeginEditing):
828         (API::InjectedBundle::EditorClient::shouldEndEditing):
829         (API::InjectedBundle::EditorClient::shouldInsertNode):
830         (API::InjectedBundle::EditorClient::shouldInsertText):
831         (API::InjectedBundle::EditorClient::shouldDeleteRange):
832         (API::InjectedBundle::EditorClient::shouldChangeSelectedRange):
833         (API::InjectedBundle::EditorClient::shouldApplyStyle):
834         (API::InjectedBundle::EditorClient::didBeginEditing):
835         (API::InjectedBundle::EditorClient::didEndEditing):
836         (API::InjectedBundle::EditorClient::didChange):
837         (API::InjectedBundle::EditorClient::didChangeSelection):
838         (API::InjectedBundle::EditorClient::willWriteToPasteboard):
839         (API::InjectedBundle::EditorClient::getPasteboardDataForRange):
840         (API::InjectedBundle::EditorClient::didWriteToPasteboard):
841
842         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInEditingDelegate.h: Added. Declares
843           the new delegate protocol, currently comprising three methods corresponding to
844           willWriteToPasteboard, getPasteboardDataForRange, and didWriteToPasteboard.
845
846         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.h:
847         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.mm:
848         (-[WKWebProcessPlugInFrame jsRangeForRangeHandle:inWorld:]): Added. Gets the JS wrapper for
849           the specified range handle.
850
851         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.h: Added.
852         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.mm: Added.
853         (-[WKWebProcessPlugInRangeHandle dealloc]): Call the InjectedBundleRangeHandle destructor.
854         (+[WKWebProcessPlugInRangeHandle rangeHandleWithJSValue:inContext:]): Get or create an
855           InjectedBundleRangeHandle for the specified object.
856         (-[WKWebProcessPlugInRangeHandle frame]): Return the range’s owner document’s frame.
857         (-[WKWebProcessPlugInRangeHandle _rangeHandle]): Return the InjectedBundleRangeHandle.
858         (-[WKWebProcessPlugInRangeHandle _apiObject]): Ditto.
859
860         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandleInternal.h: Added.
861         (WebKit::wrapper):
862
863         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
864         (WKBundlePageSetEditorClient): Updated for WebPage change.
865
866         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
867         (-[WKWebProcessPlugInBrowserContextController _editingDelegate]): Added. Returns the
868           delegate.
869         (-[WKWebProcessPlugInBrowserContextController _setEditingDelegate:]): Added. Defines a
870           Client class, which derives from API::InjectedBundle::EditorClient, and invokes the
871           delegate methods. Instantiates a Client and sets it on the WebPage.
872
873         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextControllerPrivate.h:
874           Declared new _editingDelegate property.
875
876         * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
877         (WebKit::InjectedBundleRangeHandle::document): Added. Returns an InjectedBundleNodeHandle
878           for the range’s owner document.
879         * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.h:
880
881         * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp:
882         (WebKit::InjectedBundlePageEditorClient::InjectedBundlePageEditorClient): Added. Calls
883           initialize().
884         (WebKit::InjectedBundlePageEditorClient::shouldBeginEditing): Updated for type change.
885         (WebKit::InjectedBundlePageEditorClient::shouldEndEditing): Ditto.
886         (WebKit::InjectedBundlePageEditorClient::shouldInsertNode): Ditto.
887         (WebKit::InjectedBundlePageEditorClient::shouldInsertText): Ditto.
888         (WebKit::InjectedBundlePageEditorClient::shouldDeleteRange): Ditto.
889         (WebKit::InjectedBundlePageEditorClient::shouldChangeSelectedRange): Ditto.
890         (WebKit::InjectedBundlePageEditorClient::shouldApplyStyle): Ditto.
891         (WebKit::InjectedBundlePageEditorClient::didBeginEditing): Ditto.
892         (WebKit::InjectedBundlePageEditorClient::didEndEditing): Ditto.
893         (WebKit::InjectedBundlePageEditorClient::didChange): Ditto.
894         (WebKit::InjectedBundlePageEditorClient::didChangeSelection): Ditto.
895         (WebKit::InjectedBundlePageEditorClient::willWriteToPasteboard): Ditto.
896         (WebKit::InjectedBundlePageEditorClient::getPasteboardDataForRange): Ditto.
897         (WebKit::InjectedBundlePageEditorClient::didWriteToPasteboard): Ditto.
898         * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h: Now derives from
899           API::InjectedBundle::EditorClient.
900
901         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
902         (WebKit::WebEditorClient::shouldDeleteRange): Ditto.
903         (WebKit::WebEditorClient::shouldBeginEditing): Ditto.
904         (WebKit::WebEditorClient::shouldEndEditing): Ditto.
905         (WebKit::WebEditorClient::shouldInsertNode): Ditto.
906         (WebKit::WebEditorClient::shouldInsertText): Ditto.
907         (WebKit::WebEditorClient::shouldChangeSelectedRange): Ditto.
908         (WebKit::WebEditorClient::shouldApplyStyle): Ditto.
909         (WebKit::WebEditorClient::didBeginEditing): Ditto.
910         (WebKit::WebEditorClient::respondToChangedContents): Ditto.
911         (WebKit::WebEditorClient::respondToChangedSelection): Ditto.
912         (WebKit::WebEditorClient::didEndEditing): Ditto.
913         (WebKit::WebEditorClient::didWriteSelectionToPasteboard): Ditto.
914         (WebKit::WebEditorClient::willWriteSelectionToPasteboard): Ditto.
915         (WebKit::WebEditorClient::getClientPasteboardDataForRange): Ditto.
916
917         * WebProcess/WebPage/WebPage.cpp:
918         (WebKit::WebPage::WebPage): Initialize m_editorClient.
919         (WebKit::WebPage::setInjectedBundleEditorClient): Replaces
920           initializeInjectedBundleEditorClient and just sets m_editorClient.
921         (WebKit::WebPage::close): Resets m_editorClient.
922
923         * WebProcess/WebPage/WebPage.h: Changed m_editorClient to a unique_ptr.
924
925 2016-12-02  Said Abou-Hallawa  <sabouhallawa@apple.com>
926
927         [iOS] Add a WebView private configuration for changing the WebContent update frequency
928         https://bugs.webkit.org/show_bug.cgi?id=165289
929         <rdar://problem/29472577>
930
931         Reviewed by Tim Horton.
932         
933         Expose a preference which allows us to control the fps of web content updates.
934
935         * UIProcess/API/APIPageConfiguration.h:
936         (API::PageConfiguration::contentUpdateFrequency):
937         (API::PageConfiguration::setContentUpdateFrequency):
938         * UIProcess/API/Cocoa/WKWebView.mm:
939         (-[WKWebView _initializeWithConfiguration:]):
940         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
941         (-[WKWebViewConfiguration copyWithZone:]):
942         (-[WKWebViewConfiguration _contentUpdateFrequency]):
943         (-[WKWebViewConfiguration _setContentUpdateFrequency:]):
944         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
945         * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h:
946         * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
947         (-[WKOneShotDisplayLinkHandler initWithDrawingAreaProxy:]):
948         (WebKit::RemoteLayerTreeDrawingAreaProxy::contentUpdateFrequency):
949
950 2016-12-02  Andy Estes  <aestes@apple.com>
951
952         [Cocoa] Adopt the PRODUCT_BUNDLE_IDENTIFIER build setting
953         https://bugs.webkit.org/show_bug.cgi?id=164492
954
955         Reviewed by Dan Bernstein.
956
957         * Configurations/DatabaseService.xcconfig: Set PRODUCT_BUNDLE_IDENTIFIER to
958         $(PRODUCT_NAME).
959         * Configurations/NetworkService.xcconfig: Ditto.
960         * Configurations/PluginService.32.xcconfig: Ditto.
961         * Configurations/PluginService.64.xcconfig: Ditto.
962         * Configurations/WebContentService.xcconfig: Ditto.
963         * Configurations/WebKit.xcconfig: Set PRODUCT_BUNDLE_IDENTIFIER to
964         com.apple.$(PRODUCT_NAME:rfc1034identifier).
965         * DatabaseProcess/EntryPoint/mac/XPCService/DatabaseService/Info.plist: Changed
966         CFBundleIdentifier's value from ${PRODUCT_NAME} to ${PRODUCT_BUNDLE_IDENTIFIER}.
967         * Info.plist: Changed CFBundleIdentifier's value from com.apple.${PRODUCT_NAME} to
968         ${PRODUCT_BUNDLE_IDENTIFIER}.
969         * NetworkProcess/EntryPoint/mac/XPCService/NetworkService/Info-OSX-10.9-10.10.plist: Changed
970         CFBundleIdentifier's value from ${PRODUCT_NAME} to ${PRODUCT_BUNDLE_IDENTIFIER}.
971         * NetworkProcess/EntryPoint/mac/XPCService/NetworkService/Info-OSX.plist: Ditto.
972         * NetworkProcess/EntryPoint/mac/XPCService/NetworkService/Info-iOS.plist: Ditto.
973         * PluginProcess/EntryPoint/mac/XPCService/PluginService.32-64-10.9-10.10.Info.plist: Ditto.
974         * PluginProcess/EntryPoint/mac/XPCService/PluginService.32-64.Info.plist: Ditto.
975         * WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-OSX-10.9-10.10.plist: Ditto.
976         * WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-OSX.plist: Ditto.
977         * WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-iOS.plist: Ditto.
978
979 2016-12-02  Brent Fulgham  <bfulgham@apple.com>
980
981         [Mac] Update sandbox profiles to use modern syntax and avoid duplication
982         https://bugs.webkit.org/show_bug.cgi?id=165332
983         <rdar://problem/26898991>
984
985         Reviewed by Anders Carlsson.
986
987         Update the Mac sandbox profiles to reflect that modern Cocoa applications
988         communicate with cfprefsd, rather than plists on disk (and have done so
989         for the past several releases).
990
991         Get rid of some duplicated rules, as well as old compatibility rules that
992         are never triggered under supported operating systems.
993
994         * DatabaseProcess/mac/com.apple.WebKit.Databases.sb.in:
995         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
996         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
997         * WebProcess/com.apple.WebProcess.sb.in:
998
999 2016-12-02  Gustavo Sverzut Barbieri  <barbieri@profusion.mobi>
1000
1001         Fix build break when disabling some features.
1002         https://bugs.webkit.org/show_bug.cgi?id=165254
1003
1004         The EFL port was broken if SPELLCHECK was disabled or
1005         PLUGIN_ARCHITECTURE is not x11.
1006
1007         Reviewed by Michael Catanzaro.
1008
1009         * UIProcess/efl/TextCheckerEfl.cpp:
1010         (WebKit::TextChecker::checkTextOfParagraph):
1011         (WebKit::TextChecker::checkSpellingOfString):
1012         Fix UNUSED_PARAM() usage if SPELLCHECK is disabled.
1013         * UIProcess/efl/WebPageProxyEfl.cpp:
1014         Isolate methods within #if PLUGIN_ARCHITECTURE(X11).
1015
1016 2016-12-01  Jiewen Tan  <jiewen_tan@apple.com>
1017
1018         Add a runtime flag for SubtleCrypto
1019         https://bugs.webkit.org/show_bug.cgi?id=164982
1020
1021         Reviewed by Brent Fulgham.
1022
1023         * Shared/WebPreferencesDefinitions.h:
1024         * UIProcess/API/C/WKPreferences.cpp:
1025         (WKPreferencesSetSubtleCryptoEnabled):
1026         (WKPreferencesGetSubtleCryptoEnabled):
1027         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1028         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1029         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
1030         * WebProcess/WebPage/WebPage.cpp:
1031         (WebKit::WebPage::updatePreferences):
1032
1033 2016-12-01  Saam Barati  <sbarati@apple.com>
1034
1035         Rename CallFrame::callee() to CallFrame::jsCallee()
1036         https://bugs.webkit.org/show_bug.cgi?id=165293
1037
1038         Reviewed by Keith Miller.
1039
1040         * WebProcess/Plugins/Netscape/JSNPMethod.cpp:
1041         (WebKit::callMethod):
1042         * WebProcess/Plugins/Netscape/JSNPObject.cpp:
1043         (WebKit::callNPJSObject):
1044         (WebKit::constructWithConstructor):
1045
1046 2016-12-01  Chris Dumez  <cdumez@apple.com>
1047
1048         [iOS][WK2] Tapping an element generates a 'click' event that has 0 as timeStamp
1049         https://bugs.webkit.org/show_bug.cgi?id=165270
1050         <rdar://problem/29224355>
1051
1052         Reviewed by Simon Fraser.
1053
1054         Tapping an element generates a 'click' event that has 0 as timeStamp
1055         instead of having a proper timeStamp value. This is breaking some
1056         sites.
1057
1058         * WebProcess/WebPage/ios/WebPageIOS.mm:
1059         (WebKit::WebPage::handleSyntheticClick):
1060         (WebKit::WebPage::completeSyntheticClick):
1061
1062 2016-12-01  Tim Horton  <timothy_horton@apple.com>
1063
1064         Try to fix the EFL/Gtk build
1065
1066         * UIProcess/efl/WebProcessPoolEfl.cpp:
1067         (WebKit::WebProcessPool::platformResolvePathsForSandboxExtensions):
1068         * UIProcess/gtk/WebProcessPoolGtk.cpp:
1069         (WebKit::WebProcessPool::platformResolvePathsForSandboxExtensions):
1070
1071 2016-12-01  Tim Horton  <timothy_horton@apple.com>
1072
1073         Every WKWebView initialization spends a few milliseconds hitting the disk
1074         https://bugs.webkit.org/show_bug.cgi?id=165268
1075         <rdar://problem/29010113>
1076
1077         Reviewed by Brady Eidson.
1078
1079         Every WKWebView init currently involves doing directory creation and
1080         symlink resolution for a number of paths (to create sandbox extensions
1081         for all of our storage directories), which means touching the disk a
1082         lot during init. All of these paths are immutable per-WebProcessPool,
1083         so, instead, cache them on WebProcessPool and create sandbox extensions
1084         from the already-resolved paths. This is a sizable (~4x) speedup when
1085         initializing subsequent web views.
1086
1087         * Shared/SandboxExtension.h:
1088         (WebKit::SandboxExtension::createHandleWithoutResolvingPath):
1089         Add createHandleWithoutResolvingPath, which makes a sandbox extension
1090         handle without doing symlink resolution.
1091
1092         (WebKit::resolvePathForSandboxExtension):
1093         (WebKit::resolveAndCreateReadWriteDirectoryForSandboxExtension):
1094         Add two functions that do the same resolution that SandboxExtension::createHandle
1095         and ::createHandleForReadWriteDirectory do, but just return the paths,
1096         for later use with createHandleWithoutResolvingPath.
1097
1098         * Shared/mac/SandboxExtensionMac.mm:
1099         (WebKit::resolveAndCreateReadWriteDirectoryForSandboxExtension):
1100         (WebKit::resolvePathForSandboxExtension):
1101         (WebKit::SandboxExtension::createHandleWithoutResolvingPath):
1102         (WebKit::SandboxExtension::createHandle):
1103         (WebKit::SandboxExtension::createHandleForReadWriteDirectory):
1104         Implement the aforementioned functions, and reimplement the existing
1105         createHandle{ForReadWriteDirectory} functions in terms of them.
1106
1107         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1108         (WebKit::WebProcessPool::platformDefaultIconDatabasePath):
1109         Stop wasting time generating and resolving a platform default icon
1110         database path, since we don't actually use it for anything anymore except
1111         to determine whether the icon database is enabled, and we only want to
1112         enable it if the client has provided a path.
1113
1114         (WebKit::WebProcessPool::platformResolvePathsForSandboxExtensions):
1115         (WebKit::WebProcessPool::platformInitializeWebProcess):
1116         * UIProcess/WebProcessPool.cpp:
1117         (WebKit::m_hiddenPageThrottlingTimer):
1118         (WebKit::WebProcessPool::resolvePathsForSandboxExtensions):
1119         (WebKit::WebProcessPool::createNewWebProcess):
1120         * UIProcess/WebProcessPool.h:
1121         Resolve paths in resolvePathsForSandboxExtensions, and use the resolved
1122         paths along with createHandleWithoutResolvingPath in order to effectively
1123         cache the resolution operation.
1124
1125 2016-12-01  Antti Koivisto  <antti@apple.com>
1126
1127         Revert r208931
1128         https://bugs.webkit.org/show_bug.cgi?id=164924
1129
1130         PLT regression.
1131
1132         * NetworkProcess/cache/NetworkCache.cpp:
1133         (WebKit::NetworkCache::makeCacheKey):
1134         (WebKit::NetworkCache::Cache::makeCacheKey): Deleted.
1135         * NetworkProcess/cache/NetworkCache.h:
1136         * NetworkProcess/cache/NetworkCacheBlobStorage.cpp:
1137         (WebKit::NetworkCache::BlobStorage::BlobStorage):
1138         (WebKit::NetworkCache::BlobStorage::add):
1139         (WebKit::NetworkCache::BlobStorage::get):
1140         * NetworkProcess/cache/NetworkCacheBlobStorage.h:
1141         * NetworkProcess/cache/NetworkCacheData.cpp:
1142         (WebKit::NetworkCache::computeSHA1):
1143         (WebKit::NetworkCache::makeSalt): Deleted.
1144         (WebKit::NetworkCache::readOrMakeSalt): Deleted.
1145         * NetworkProcess/cache/NetworkCacheData.h:
1146         * NetworkProcess/cache/NetworkCacheKey.cpp:
1147         (WebKit::NetworkCache::noPartitionString):
1148         (WebKit::NetworkCache::Key::Key):
1149         (WebKit::NetworkCache::Key::hasPartition):
1150         (WebKit::NetworkCache::Key::computeHash):
1151         (WebKit::NetworkCache::Key::hashAsString):
1152         (WebKit::NetworkCache::Key::computePartitionHash): Deleted.
1153         * NetworkProcess/cache/NetworkCacheKey.h:
1154         (WebKit::NetworkCache::Key::hash):
1155         (WebKit::NetworkCache::Key::partitionHash): Deleted.
1156         (WebKit::NetworkCache::Key::hashAsString): Deleted.
1157         (WebKit::NetworkCache::Key::partitionHashAsString): Deleted.
1158         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
1159         (WebKit::NetworkCache::makeSubresourcesKey):
1160         (WebKit::NetworkCache::constructRevalidationRequest):
1161         (WebKit::NetworkCache::SpeculativeLoadManager::PendingFrameLoad::saveToDiskIfReady):
1162         (WebKit::NetworkCache::SpeculativeLoadManager::retrieveSubresourcesEntry):
1163         * NetworkProcess/cache/NetworkCacheStorage.cpp:
1164         (WebKit::NetworkCache::Storage::open):
1165         (WebKit::NetworkCache::traverseRecordsFiles):
1166         (WebKit::NetworkCache::Storage::Storage):
1167         (WebKit::NetworkCache::Storage::recordDirectoryPathForKey):
1168         (WebKit::NetworkCache::decodeRecordHeader):
1169         (WebKit::NetworkCache::Storage::readRecord):
1170         (WebKit::NetworkCache::Storage::encodeRecord):
1171         (WebKit::NetworkCache::Storage::traverse):
1172         (WebKit::NetworkCache::makeSaltFilePath): Deleted.
1173         * NetworkProcess/cache/NetworkCacheStorage.h:
1174         (WebKit::NetworkCache::Storage::salt): Deleted.
1175
1176 2016-11-30  Sam Weinig  <sam@webkit.org>
1177
1178         [WebIDL] Remove custom bindings for File and Blob constructors
1179         https://bugs.webkit.org/show_bug.cgi?id=165218
1180
1181         Reviewed by Darin Adler.
1182
1183         * NetworkProcess/FileAPI/NetworkBlobRegistry.cpp:
1184         (WebKit::NetworkBlobRegistry::registerBlobURL):
1185         * NetworkProcess/FileAPI/NetworkBlobRegistry.h:
1186         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1187         (WebKit::NetworkConnectionToWebProcess::registerBlobURL):
1188         * NetworkProcess/NetworkConnectionToWebProcess.h:
1189         * WebProcess/FileAPI/BlobRegistryProxy.cpp:
1190         (WebKit::BlobRegistryProxy::registerBlobURL):
1191         * WebProcess/FileAPI/BlobRegistryProxy.h:
1192         Avoid copies of the BlobPart Vector.
1193
1194 2016-11-30  Carlos Garcia Campos  <cgarcia@igalia.com>
1195
1196         [GTK] UI process crash in WebKit::WaylandCompositor::Surface::prepareTextureForPainting
1197         https://bugs.webkit.org/show_bug.cgi?id=164911
1198
1199         Reviewed by Michael Catanzaro.
1200
1201         The problem is that m_buffer is nullptr in Surface::prepareTextureForPainting() even though we have already an
1202         image. We only use the buffer to get the image size, so we could save the image size when the image is created,
1203         and then we don't need to care about the buffer anymore.
1204
1205         * UIProcess/gtk/WaylandCompositor.cpp:
1206         (WebKit::WaylandCompositor::Surface::prepareTextureForPainting):
1207         (WebKit::WaylandCompositor::Surface::commit):
1208         * UIProcess/gtk/WaylandCompositor.h:
1209
1210 2016-11-30  Antoine Quint  <graouts@apple.com>
1211
1212         [Modern Media Controls] Add an HTML comment flag to turn the feature on
1213         https://bugs.webkit.org/show_bug.cgi?id=165226
1214
1215         Reviewed by Dean Jackson.
1216
1217         Add new methods to set the Modern Media Controls preference.
1218
1219         * UIProcess/API/C/WKPreferences.cpp:
1220         (WKPreferencesSetModernMediaControlsEnabled):
1221         (WKPreferencesGetModernMediaControlsEnabled):
1222         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1223
1224 2016-11-30  Said Abou-Hallawa  <sabouhallawa@apple.com>
1225
1226         Add separate settings and preferences to enable/disable async decoding for large images and animated images
1227         https://bugs.webkit.org/show_bug.cgi?id=165177
1228
1229         Reviewed by Simon Fraser.
1230         
1231         Hook up the async image decoding settings for WebKit2.
1232
1233         * Shared/WebPreferencesDefinitions.h:
1234         * UIProcess/API/Cocoa/WKPreferences.mm:
1235         (-[WKPreferences _largeImageAsyncDecodingEnabled]):
1236         (-[WKPreferences _setLargeImageAsyncDecodingEnabled:]):
1237         (-[WKPreferences _animatedImageAsyncDecodingEnabled]):
1238         (-[WKPreferences _setAnimatedImageAsyncDecodingEnabled:]):
1239         (-[WKPreferences _asyncImageDecodingEnabled]): Deleted.
1240         (-[WKPreferences _setAsyncImageDecodingEnabled:]): Deleted.
1241         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
1242         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1243         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
1244         * WebProcess/WebPage/WebPage.cpp:
1245         (WebKit::WebPage::updatePreferences):
1246
1247 2016-11-30  Chris Dumez  <cdumez@apple.com>
1248
1249         [iOS][WK2] Turn on HTML interactive form validation feature
1250         https://bugs.webkit.org/show_bug.cgi?id=165212
1251         <rdar://problem/29444356>
1252
1253         Reviewed by Simon Fraser.
1254
1255         Turn on HTML interactive form validation feature on iOS WK2
1256         now that we have a native UI.
1257
1258         * Shared/WebPreferencesDefinitions.h:
1259
1260 2016-11-30  Brent Fulgham  <bfulgham@apple.com>
1261
1262         Correct plugin sandbox after r208611
1263         https://bugs.webkit.org/show_bug.cgi?id=165187
1264         <rdar://problem/29431165>
1265
1266         Reviewed by Alex Christensen.
1267
1268         In r208611 I removed the 'else' clause of a Scheme conditional
1269         that was needed to properly run plugins (such as Flash Player).
1270
1271         This change retains the relevant current sandbox content, while
1272         still stripping out the old code that is no longer needed.
1273
1274         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
1275
1276 2016-11-29  Carlos Garcia Campos  <cgarcia@igalia.com>
1277
1278         [GTK] Database process should not initialize gtk
1279         https://bugs.webkit.org/show_bug.cgi?id=165138
1280
1281         Reviewed by Sergio Villar Senin.
1282
1283         It doesn't use GTK+ at all.
1284
1285         * DatabaseProcess/gtk/DatabaseProcessMainGtk.cpp:
1286         (WebKit::DatabaseProcessMainUnix):
1287         (): Deleted.
1288
1289 2016-11-29  Gavin Barraclough  <barraclough@apple.com>
1290
1291         Remove WebPage::SetPageSuppressed
1292         https://bugs.webkit.org/show_bug.cgi?id=165158
1293
1294         Unreviewed revert accidental change.
1295
1296         * WebProcess/WebPage/WebPage.cpp:
1297         (WebKit::WebPage::setActivityState):
1298
1299 2016-11-29  Gavin Barraclough  <barraclough@apple.com>
1300
1301         Remove WebPage::SetPageSuppressed
1302         https://bugs.webkit.org/show_bug.cgi?id=165158
1303
1304         Reviewed by Tim Horton.
1305
1306         This was scaffolding. We've now refactored to the point that the information driving throttling originates
1307         from the UI process (so UI and web processes can have a consistent view of what should throttle), but we
1308         don't need a separate message to handle this - necessary state to determine is provided in ActivityState.
1309
1310         * UIProcess/WebPageProxy.cpp:
1311         (WebKit::WebPageProxy::updateThrottleState):
1312             - used to send SetPageSuppressed; no longer does.
1313         * UIProcess/WebPageProxy.h:
1314             - removed m_pageSuppressed (was used to avoid duplicated messages).
1315         * WebProcess/WebPage/WebPage.cpp:
1316         (WebKit::WebPage::updateThrottleState):
1317             - compute throttle state based on m_activityState.
1318         (WebKit::WebPage::setActivityState):
1319             - update throttle state whenever activity state changes.
1320         (WebKit::WebPage::updatePreferences):
1321             - update throttle state whenever preferences change (throttling can be disabled via preference).
1322         (WebKit::WebPage::setPageSuppressed): Deleted.
1323             - Removed WebPage::SetPageSuppressed.
1324         * WebProcess/WebPage/WebPage.h:
1325             - Removed WebPage::SetPageSuppressed.
1326             - Added m_processSuppressionEnabled, to cache preference state.
1327         * WebProcess/WebPage/WebPage.messages.in:
1328             - Removed WebPage::SetPageSuppressed.
1329
1330 2016-11-29  Andy Estes  <aestes@apple.com>
1331
1332         [Cocoa] Enable two clang warnings recommended by Xcode
1333         https://bugs.webkit.org/show_bug.cgi?id=164498
1334
1335         Reviewed by Mark Lam.
1336
1337         * Configurations/Base.xcconfig: Enabled CLANG_WARN_INFINITE_RECURSION and CLANG_WARN_SUSPICIOUS_MOVE.
1338
1339 2016-11-29  Eric Carlson  <eric.carlson@apple.com>
1340
1341         [MediaStream] Don't request user permission for a device if it has already been granted in the current browsing context
1342         https://bugs.webkit.org/show_bug.cgi?id=164760
1343         <rdar://problem/29261266>
1344
1345         Reviewed by Youenn Fablet.
1346
1347         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
1348         (WebKit::FrameAuthorizationState::FrameAuthorizationState):
1349         (WebKit::FrameAuthorizationState::hasPermissionToUseCaptureDevice):
1350         (WebKit::FrameAuthorizationState::setHasPermissionToUseCaptureDevice):
1351         (WebKit::FrameAuthorizationState::reset):
1352         (WebKit::FrameAuthorizationState::securityOriginsAreEqual):
1353         (WebKit::UserMediaPermissionRequestManagerProxy::stateForRequest):
1354         (WebKit::UserMediaPermissionRequestManagerProxy::invalidateRequests):
1355         (WebKit::UserMediaPermissionRequestManagerProxy::createRequest):
1356         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasDenied):
1357         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasGranted):
1358         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
1359         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
1360         (WebKit::FrameAuthorizationState::~FrameAuthorizationState):
1361         (WebKit::FrameAuthorizationState::frameID):
1362         * UIProcess/UserMediaPermissionRequestProxy.cpp:
1363         (WebKit::UserMediaPermissionRequestProxy::UserMediaPermissionRequestProxy):
1364         * UIProcess/UserMediaPermissionRequestProxy.h:
1365         (WebKit::UserMediaPermissionRequestProxy::create):
1366         (WebKit::UserMediaPermissionRequestProxy::frameID):
1367         (WebKit::UserMediaPermissionRequestProxy::userMediaDocumentSecurityOrigin):
1368         (WebKit::UserMediaPermissionRequestProxy::topLevelDocumentSecurityOrigin):
1369         * UIProcess/WebPageProxy.cpp:
1370         (WebKit::WebPageProxy::didCommitLoadForFrame):
1371         * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
1372         (WebKit::UserMediaPermissionRequestManager::removeMediaRequestFromMaps):
1373
1374 2016-11-29  Wenson Hsieh  <wenson_hsieh@apple.com>
1375
1376         Scroll snapping on Mac should use AppKit animations
1377         https://bugs.webkit.org/show_bug.cgi?id=147261
1378         <rdar://problem/29395293>
1379
1380         Reviewed by Brent Fulgham.
1381
1382         Add some logic to plumb filtered wheel velocity over to WebCore in the case of mainframe scrolling. See
1383         WebCore/ChangeLog for more details.
1384
1385         * WebProcess/WebPage/EventDispatcher.cpp:
1386         (WebKit::EventDispatcher::wheelEvent):
1387
1388 2016-11-21  Brian Burg  <bburg@apple.com>
1389
1390         Web Automation: add ObjC SPI to set whether a page is controlled by automation
1391         https://bugs.webkit.org/show_bug.cgi?id=165001
1392         <rdar://problem/29350432>
1393
1394         Reviewed by Dan Bernstein.
1395
1396         Add SPI property to WKWebViewConfiguration and plumb it through to
1397         initialize WebPageProxy::m_controlledByAutomation. This is propagated
1398         to the WebProcess on creation via WebPageCreationParameters.
1399
1400         * UIProcess/API/APIPageConfiguration.cpp:
1401         (API::PageConfiguration::copy):
1402         * UIProcess/API/APIPageConfiguration.h:
1403         (API::PageConfiguration::isControlledByAutomation):
1404         (API::PageConfiguration::setControlledByAutomation):
1405         * UIProcess/API/Cocoa/WKWebView.mm:
1406         (-[WKWebView _initializeWithConfiguration:]):
1407         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
1408         (-[WKWebViewConfiguration init]):
1409         (-[WKWebViewConfiguration copyWithZone:]):
1410         (-[WKWebViewConfiguration _isControlledByAutomation]):
1411         (-[WKWebViewConfiguration _setControlledByAutomation:]):
1412         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
1413         * UIProcess/WebPageProxy.cpp:
1414         (WebKit::WebPageProxy::WebPageProxy):
1415
1416 2016-11-28  Carlos Garcia Campos  <cgarcia@igalia.com>
1417
1418         [GTK] BadDamage X Window System error in WebKit::AcceleratedBackingStoreX11::update when called from WebPageProxy::exitAcceleratedCompositingMode
1419         https://bugs.webkit.org/show_bug.cgi?id=164303
1420
1421         Reviewed by Michael Catanzaro.
1422
1423         Trap also BadDrawable and BadDamage X errors when creating the surface and damage.
1424
1425         * UIProcess/gtk/AcceleratedBackingStoreX11.cpp:
1426         (WebKit::AcceleratedBackingStoreX11::update):
1427
1428 2016-11-28  Chris Dumez  <cdumez@apple.com>
1429
1430         [Mac][WK2] Enable HTML interactive form validation
1431         https://bugs.webkit.org/show_bug.cgi?id=165123
1432         <rdar://problem/28944652>
1433
1434         Reviewed by Simon Fraser.
1435
1436         Enable HTML interactive form validation now that we have a native UI
1437         for it.
1438
1439         * Shared/WebPreferencesDefinitions.h:
1440
1441 2016-11-28  Brent Fulgham  <bfulgham@apple.com>
1442
1443         Generated sandbox profile is not being put in the correct Resources directory
1444         https://bugs.webkit.org/show_bug.cgi?id=165126
1445
1446         Reviewed by Tim Horton.
1447
1448         * WebKit2.xcodeproj/project.pbxproj: Copy the generated file to the 'PlugInSandboxProfiles'
1449         sub-directory.
1450
1451 2016-11-28  Ryan Haddad  <ryanhaddad@apple.com>
1452
1453         Unreviewed, rolling out r209008.
1454
1455         This change appears to have caused two fast/mediastrem
1456         LayoutTests to fail.
1457
1458         Reverted changeset:
1459
1460         "[MediaStream] Don't request user permission for a device if
1461         it has already been granted in the current browsing context"
1462         https://bugs.webkit.org/show_bug.cgi?id=164760
1463         http://trac.webkit.org/changeset/209008
1464
1465 2016-11-28  Andrew Gold  <agold@apple.com>
1466
1467         Support for HTML Media Capture API
1468         https://bugs.webkit.org/show_bug.cgi?id=43239
1469
1470         Reviewed by Tim Horton.
1471
1472         In order to enable media capture on iOS, we must first use the AVFoundation API to 
1473         check/request capture permission from the user for Safari. Then, Safari must request
1474         permission on behalf of the webpage to use the capture devices. Additionally, Safari
1475         must present UI when the capture is taking place, so WebKit needs to notify the client
1476         of a capture session beginning and ending. To do this, we added four methods to 
1477         WKUIDelegatePrivate to request permission from the user, check for permissions, notify
1478         that a capture session has begun, and notify that a capture session has ended. Additionally,
1479         we added a private method to WKWebView that allows the client to stop a capture session.
1480
1481         * UIProcess/API/APIUIClient.h:
1482         (API::UIClient::didBeginCaptureSession): Notifies the client of a capture session beginning.
1483         (API::UIClient::didEndCaptureSession): Notifies the client of a capture session ending.
1484
1485         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: Added new delegate methods to request permission,
1486         check for permission, notify of a capture session beginning, and notify of a capture session
1487         ending.
1488
1489         * UIProcess/API/Cocoa/WKWebView.mm:
1490         (-[WKWebView _stopMediaCapture]): Cancels a media capture session.
1491         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1492
1493         * UIProcess/Cocoa/UIDelegate.h:
1494         * UIProcess/Cocoa/UIDelegate.mm:
1495         (WebKit::UIDelegate::setDelegate): Added the new delegate methods.
1496         (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest):
1497         First checks if the user has authorized the client application access capture devices,
1498         then uses the WKUIDelegate to request permission for a site from the user.
1499         (WebKit::UIDelegate::UIClient::checkUserMediaPermissionForOrigin): Checks the client
1500         for permission to access capture devices.
1501         (WebKit::UIDelegate::UIClient::didBeginCaptureSession): Notifies the client of a capture
1502         session beginning.
1503         (WebKit::UIDelegate::UIClient::didEndCaptureSession): Notifies the client of a capture
1504         session ending.
1505
1506         * UIProcess/WebPageProxy.cpp:
1507         (WebKit::WebPageProxy::isPlayingMediaDidChange): Calls UIDelegate method to notify the
1508         client of a capture session beginning/ending.
1509
1510 2016-11-28  Eric Carlson  <eric.carlson@apple.com>
1511
1512         [MediaStream] Don't request user permission for a device if it has already been granted in the current browsing context
1513         https://bugs.webkit.org/show_bug.cgi?id=164760
1514         <rdar://problem/29261266>
1515
1516         Reviewed by Youenn Fablet.
1517
1518         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
1519         (WebKit::FrameAuthorizationState::FrameAuthorizationState):
1520         (WebKit::FrameAuthorizationState::hasPermissionToUseCaptureDevice):
1521         (WebKit::FrameAuthorizationState::setHasPermissionToUseCaptureDevice):
1522         (WebKit::FrameAuthorizationState::reset):
1523         (WebKit::FrameAuthorizationState::securityOriginsAreEqual):
1524         (WebKit::UserMediaPermissionRequestManagerProxy::stateForRequest):
1525         (WebKit::UserMediaPermissionRequestManagerProxy::invalidateRequests):
1526         (WebKit::UserMediaPermissionRequestManagerProxy::createRequest):
1527         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasDenied):
1528         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasGranted):
1529         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
1530         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
1531         (WebKit::FrameAuthorizationState::~FrameAuthorizationState):
1532         (WebKit::FrameAuthorizationState::frameID):
1533         * UIProcess/UserMediaPermissionRequestProxy.cpp:
1534         (WebKit::UserMediaPermissionRequestProxy::UserMediaPermissionRequestProxy):
1535         * UIProcess/UserMediaPermissionRequestProxy.h:
1536         (WebKit::UserMediaPermissionRequestProxy::create):
1537         (WebKit::UserMediaPermissionRequestProxy::frameID):
1538         (WebKit::UserMediaPermissionRequestProxy::userMediaDocumentSecurityOrigin):
1539         (WebKit::UserMediaPermissionRequestProxy::topLevelDocumentSecurityOrigin):
1540         * UIProcess/WebPageProxy.cpp:
1541         (WebKit::WebPageProxy::didCommitLoadForFrame):
1542         * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
1543         (WebKit::UserMediaPermissionRequestManager::removeMediaRequestFromMaps):
1544
1545 2016-11-27  Dean Jackson  <dino@apple.com>
1546
1547         Removed a WTFLogAlways I left in with a recent commit.
1548
1549         * UIProcess/Cocoa/WebViewImpl.mm:
1550         (-[WKAccessibilitySettingsObserver _settingsDidChange:]):
1551
1552 2016-11-27  Csaba Osztrogonác  <ossy@webkit.org>
1553
1554         Fix unused-private-field build warning in WebKit2/Platform/SharedMemory.h
1555         https://bugs.webkit.org/show_bug.cgi?id=165069
1556
1557         Reviewed by Darin Adler.
1558
1559         * Platform/SharedMemory.h:
1560
1561 2016-11-26  Simon Fraser  <simon.fraser@apple.com>
1562
1563         Fix the iOS build.
1564
1565         * WebProcess/WebPage/ios/WebPageIOS.mm:
1566         (WebKit::WebPage::eventThrottlingDelay):
1567
1568 2016-11-26  Yusuke Suzuki  <utatane.tea@gmail.com>
1569
1570         [WTF] Import std::optional reference implementation as WTF::Optional
1571         https://bugs.webkit.org/show_bug.cgi?id=164199
1572
1573         Reviewed by Saam Barati and Sam Weinig.
1574
1575         * NetworkProcess/NetworkDataTask.cpp:
1576         (WebKit::NetworkDataTask::didReceiveResponse):
1577         * NetworkProcess/NetworkLoad.h:
1578         * NetworkProcess/cache/NetworkCache.cpp:
1579         (WebKit::NetworkCache::responseHasExpired):
1580         * NetworkProcess/cache/NetworkCacheCoders.h:
1581         (WebKit::NetworkCache::Coder<std::optional<T>>::encode):
1582         (WebKit::NetworkCache::Coder<std::optional<T>>::decode):
1583         (WebKit::NetworkCache::Coder<Optional<T>>::encode): Deleted.
1584         (WebKit::NetworkCache::Coder<Optional<T>>::decode): Deleted.
1585         * NetworkProcess/cache/NetworkCacheData.cpp:
1586         (WebKit::NetworkCache::readOrMakeSalt):
1587         * NetworkProcess/cache/NetworkCacheData.h:
1588         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
1589         (WebKit::NetworkCache::SpeculativeLoadManager::PreloadedEntry::PreloadedEntry):
1590         (WebKit::NetworkCache::SpeculativeLoadManager::PreloadedEntry::revalidationRequest):
1591         (WebKit::NetworkCache::SpeculativeLoadManager::addPreloadedEntry):
1592         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.h:
1593         * NetworkProcess/cache/NetworkCacheStatistics.cpp:
1594         (WebKit::NetworkCache::Statistics::recordNotUsingCacheForRequest):
1595         (WebKit::NetworkCache::Statistics::recordRetrievalFailure):
1596         (WebKit::NetworkCache::Statistics::queryWasEverRequested):
1597         * NetworkProcess/cache/NetworkCacheStatistics.h:
1598         * NetworkProcess/cache/NetworkCacheStorage.cpp:
1599         (WebKit::NetworkCache::Storage::storeBodyAsBlob):
1600         (WebKit::NetworkCache::Storage::encodeRecord):
1601         (WebKit::NetworkCache::Storage::dispatchWriteOperation):
1602         * NetworkProcess/cache/NetworkCacheStorage.h:
1603         * Platform/IPC/ArgumentCoders.h:
1604         (IPC::ArgumentCoder<std::optional<T>>::encode):
1605         (IPC::ArgumentCoder<std::optional<T>>::decode):
1606         (IPC::ArgumentCoder<WTF::Optional<T>>::encode): Deleted.
1607         (IPC::ArgumentCoder<WTF::Optional<T>>::decode): Deleted.
1608         * Platform/IPC/Connection.h:
1609         (IPC::Connection::sendWithReply):
1610         * Platform/SharedMemory.h:
1611         * Platform/unix/SharedMemoryUnix.cpp:
1612         (WebKit::SharedMemory::map):
1613         * Scripts/webkit/messages.py:
1614         (class_template_headers):
1615         * Shared/API/APISecurityOrigin.h:
1616         (API::SecurityOrigin::create):
1617         * Shared/API/Cocoa/_WKRemoteObjectInterface.mm:
1618         * Shared/API/c/WKSecurityOriginRef.cpp:
1619         (WKSecurityOriginGetPort):
1620         * Shared/SessionState.h:
1621         * Shared/WebPageCreationParameters.h:
1622         * Shared/mac/ObjCObjectGraph.mm:
1623         (WebKit::typeFromObject):
1624         * Shared/mac/SecItemShim.cpp:
1625         (WebKit::sendSecItemRequest):
1626         * UIProcess/API/C/WKKeyValueStorageManager.cpp:
1627         (WKKeyValueStorageManagerGetStorageDetailsByOrigin):
1628         * UIProcess/API/Cocoa/WKSecurityOrigin.mm:
1629         (-[WKSecurityOrigin port]):
1630         * UIProcess/API/Cocoa/WKWebView.mm:
1631         (-[WKWebView _didCommitLayerTree:]):
1632         (-[WKWebView _navigationGestureDidEnd]):
1633         * UIProcess/API/Cocoa/WKWebsiteDataRecordInternal.h:
1634         (WebKit::toWebsiteDataType):
1635         * UIProcess/API/efl/EwkView.cpp:
1636         (EwkView::setCursor):
1637         * UIProcess/API/mac/WKView.mm:
1638         (toCoreScrollbarStyle):
1639         (toAPIScrollbarStyle):
1640         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp:
1641         (WebKit::WebPaymentCoordinatorProxy::completeShippingMethodSelection):
1642         (WebKit::WebPaymentCoordinatorProxy::completeShippingContactSelection):
1643         (WebKit::WebPaymentCoordinatorProxy::completePaymentMethodSelection):
1644         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.h:
1645         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.messages.in:
1646         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
1647         (WebKit::toPKPaymentSummaryItem):
1648         (WebKit::WebPaymentCoordinatorProxy::platformCompleteShippingMethodSelection):
1649         (WebKit::WebPaymentCoordinatorProxy::platformCompleteShippingContactSelection):
1650         (WebKit::WebPaymentCoordinatorProxy::platformCompletePaymentMethodSelection):
1651         * UIProcess/Automation/WebAutomationSession.cpp:
1652         (WebKit::WebAutomationSession::webFrameIDForHandle):
1653         (WebKit::WebAutomationSession::switchToBrowsingContext):
1654         (WebKit::WebAutomationSession::evaluateJavaScriptFunction):
1655         (WebKit::WebAutomationSession::resolveChildFrameHandle):
1656         (WebKit::WebAutomationSession::resolveParentFrameHandle):
1657         (WebKit::WebAutomationSession::computeElementLayout):
1658         * UIProcess/Automation/WebAutomationSession.h:
1659         * UIProcess/Cocoa/WebViewImpl.h:
1660         * UIProcess/Cocoa/WebViewImpl.mm:
1661         (WebKit::WebViewImpl::updateViewExposedRect):
1662         (WebKit::WebViewImpl::setOverlayScrollbarStyle):
1663         (WebKit::WebViewImpl::overlayScrollbarStyle):
1664         * UIProcess/DrawingAreaProxy.cpp:
1665         (WebKit::DrawingAreaProxy::setViewExposedRect):
1666         * UIProcess/DrawingAreaProxy.h:
1667         (WebKit::DrawingAreaProxy::viewExposedRect):
1668         * UIProcess/InspectorServer/WebSocketServerConnection.cpp:
1669         (WebKit::WebSocketServerConnection::didReceiveSocketStreamData):
1670         * UIProcess/InspectorServer/WebSocketServerConnection.h:
1671         * UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp:
1672         (WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidScroll):
1673         * UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h:
1674         * UIProcess/Scrolling/RemoteScrollingTree.cpp:
1675         (WebKit::RemoteScrollingTree::scrollingTreeNodeDidScroll):
1676         * UIProcess/Scrolling/RemoteScrollingTree.h:
1677         * UIProcess/Storage/LocalStorageDatabaseTracker.cpp:
1678         (WebKit::fileCreationTime):
1679         (WebKit::fileModificationTime):
1680         * UIProcess/Storage/LocalStorageDatabaseTracker.h:
1681         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
1682         (WebKit::UserMediaPermissionRequestManagerProxy::enumerateMediaDevicesForFrame):
1683         * UIProcess/WebBackForwardList.cpp:
1684         (WebKit::WebBackForwardList::backForwardListState):
1685         (WebKit::WebBackForwardList::restoreFromState):
1686         * UIProcess/WebPageProxy.cpp:
1687         (WebKit::WebPageProxy::didCommitLoadForFrame):
1688         (WebKit::WebPageProxy::creationParameters):
1689         (WebKit::WebPageProxy::setOverlayScrollbarStyle):
1690         * UIProcess/WebPageProxy.h:
1691         (WebKit::WebPageProxy::overlayScrollbarStyle):
1692         * UIProcess/WebPageProxy.messages.in:
1693         * UIProcess/WebsiteData/WebsiteDataRecord.h:
1694         * UIProcess/efl/WebView.cpp:
1695         (WebKit::WebView::transformFromScene):
1696         * UIProcess/gtk/AcceleratedBackingStoreX11.cpp:
1697         * UIProcess/gtk/WebPreferencesGtk.cpp:
1698         (WebKit::WebPreferences::platformInitializeStore):
1699         * UIProcess/ios/WKContentViewInteraction.mm:
1700         (-[WKContentView _scrollOffsetForEvent:]):
1701         (-[WKContentView _interpretKeyEvent:isCharEvent:]):
1702         * UIProcess/mac/LegacySessionStateCoding.cpp:
1703         (WebKit::encodeFormDataElement):
1704         (WebKit::decodeFormDataElement):
1705         (WebKit::decodeV1SessionHistory):
1706         * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h:
1707         * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
1708         (WebKit::RemoteLayerTreeDrawingAreaProxy::setViewExposedRect):
1709         * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
1710         (WebKit::WebPaymentCoordinator::completeShippingMethodSelection):
1711         (WebKit::WebPaymentCoordinator::completeShippingContactSelection):
1712         (WebKit::WebPaymentCoordinator::completePaymentMethodSelection):
1713         * WebProcess/ApplePay/WebPaymentCoordinator.h:
1714         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
1715         (WKBundlePageSetEventThrottlingBehaviorOverride):
1716         * WebProcess/Plugins/PDF/DeprecatedPDFPlugin.mm:
1717         (WebKit::PDFPlugin::convertFromPDFViewToRootView):
1718         (WebKit::PDFPlugin::convertFromPDFViewToScreen):
1719         (WebKit::PDFPlugin::boundsOnScreen):
1720         (WebKit::PDFPlugin::geometryDidChange):
1721         * WebProcess/Plugins/PDF/PDFPlugin.mm:
1722         (WebKit::PDFPlugin::geometryDidChange):
1723         * WebProcess/Plugins/PluginView.cpp:
1724         (WebKit::PluginView::performFrameLoadURLRequest):
1725         (WebKit::PluginView::evaluate):
1726         * WebProcess/Plugins/WebPluginInfoProvider.cpp:
1727         (WebKit::WebPluginInfoProvider::pluginLoadClientPolicyForHost):
1728         * WebProcess/Plugins/WebPluginInfoProvider.h:
1729         * WebProcess/Scrolling/RemoteScrollingCoordinator.mm:
1730         (WebKit::RemoteScrollingCoordinator::scrollPositionChangedForNode):
1731         * WebProcess/WebCoreSupport/SessionStateConversion.cpp:
1732         (WebKit::toFormData):
1733         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1734         (WebKit::WebChromeClient::preferredScrollbarOverlayStyle):
1735         * WebProcess/WebCoreSupport/WebChromeClient.h:
1736         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1737         (WebKit::WebFrameLoaderClient::dispatchDidCommitLoad):
1738         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
1739         * WebProcess/WebPage/DrawingArea.h:
1740         * WebProcess/WebPage/DrawingArea.messages.in:
1741         * WebProcess/WebPage/WebFrame.cpp:
1742         (WebKit::WebFrame::certificateInfo):
1743         * WebProcess/WebPage/WebPage.cpp:
1744         (WebKit::m_userInterfaceLayoutDirection):
1745         (WebKit::WebPage::setScrollbarOverlayStyle):
1746         * WebProcess/WebPage/WebPage.h:
1747         (WebKit::WebPage::scrollbarOverlayStyle):
1748         * WebProcess/WebPage/WebPage.messages.in:
1749         * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h:
1750         * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
1751         (WebKit::RemoteLayerTreeDrawingArea::setViewExposedRect):
1752         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
1753         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
1754         (WebKit::TiledCoreAnimationDrawingArea::setViewExposedRect):
1755
1756 2016-11-26  Sam Weinig  <sam@webkit.org>
1757
1758         Convert IntersectionObserver over to using RuntimeEnabledFeatures so it can be properly excluded from script
1759         https://bugs.webkit.org/show_bug.cgi?id=164965
1760
1761         Reviewed by Simon Fraser.
1762
1763         * Shared/WebPreferencesDefinitions.h:
1764         * UIProcess/API/C/WKPreferences.cpp:
1765         (WKPreferencesSetIntersectionObserverEnabled):
1766         (WKPreferencesGetIntersectionObserverEnabled):
1767         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1768         * WebProcess/WebPage/WebPage.cpp:
1769         (WebKit::WebPage::updatePreferences):
1770         Add a preference, defaulting to off, for enabling IntersectionObserver.
1771
1772 2016-11-26  Simon Fraser  <simon.fraser@apple.com>
1773
1774         Migrate some layout timer-related code from std::chrono to Seconds and MonotonicTime
1775         https://bugs.webkit.org/show_bug.cgi?id=164992
1776
1777         Reviewed by Darin Adler.
1778         
1779         No more ugly conversion from seconds to milliseconds.
1780
1781         * WebProcess/WebPage/WebPage.cpp:
1782         (WebKit::WebPage::updatePreferences):
1783         * WebProcess/WebPage/ios/WebPageIOS.mm:
1784         (WebKit::WebPage::eventThrottlingDelay):
1785
1786 2016-11-25  Michael Catanzaro  <mcatanzaro@igalia.com>
1787
1788         [GTK] Follow-up fixes to r208974
1789         https://bugs.webkit.org/show_bug.cgi?id=164771
1790
1791         Unreviewed, implement Carlos's review feedback.
1792
1793         * UIProcess/API/gtk/WebKitNotification.cpp:
1794         (webkit_notification_get_tag):
1795         * UIProcess/API/gtk/WebKitNotificationProvider.cpp:
1796         (WebKitNotificationProvider::withdrawAnyPreviousNotificationMatchingTag):
1797         (WebKitNotificationProvider::show):
1798         * UIProcess/API/gtk/WebKitNotificationProvider.h:
1799
1800 2016-11-24  Michael Catanzaro  <mcatanzaro@igalia.com>
1801
1802         [GTK] Notifications API does not expose or respect the "tag" attribute
1803         https://bugs.webkit.org/show_bug.cgi?id=164771
1804
1805         Reviewed by Gustavo Noronha Silva.
1806
1807         Expose a tag property on WebKitNotification. Ensure that any previous notification with the
1808         same tag is closed when showing a new notification with that tag.
1809
1810         * UIProcess/API/gtk/WebKitNotification.cpp:
1811         (webkit_notification_class_init):
1812         (webkitNotificationCreate):
1813         (webkit_notification_get_tag):
1814         * UIProcess/API/gtk/WebKitNotification.h:
1815         * UIProcess/API/gtk/WebKitNotificationProvider.cpp:
1816         (WebKitNotificationProvider::withdrawAnyPreviousNotificationMatchingTag):
1817         (WebKitNotificationProvider::show):
1818         * UIProcess/API/gtk/WebKitNotificationProvider.h:
1819         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
1820
1821 2016-11-22  Sergio Villar Senin  <svillar@igalia.com>
1822
1823         [GTK] Fix introspection warning
1824         https://bugs.webkit.org/show_bug.cgi?id=165026
1825
1826         Reviewed by Michael Catanzaro.
1827
1828         This fixes an introspection annotation for a new API added in r208532.
1829
1830         * WebProcess/InjectedBundle/API/gtk/WebKitWebPage.cpp:
1831         (webkit_web_page_class_init):
1832
1833 2016-11-21  Carlos Garcia Campos  <cgarcia@igalia.com>
1834
1835         [SOUP] Simplify custom protocols handler implementation
1836         https://bugs.webkit.org/show_bug.cgi?id=164922
1837
1838         Reviewed by Michael Catanzaro.
1839
1840         We are using too many classes for this and also the C API that is not needed, because both GTK+ and EFL have
1841         their own APIs and this is not used by WTR at all.
1842
1843         * PlatformEfl.cmake: Remove files from compilation.
1844         * PlatformGTK.cmake: Ditto.
1845         * Shared/API/c/WKBase.h:
1846         * Shared/API/c/soup/WKBaseSoup.h: Removed.
1847         * UIProcess/API/APICustomProtocolManagerClient.h: Added.
1848         (API::CustomProtocolManagerClient::~CustomProtocolManagerClient):
1849         (API::CustomProtocolManagerClient::startLoading):
1850         (API::CustomProtocolManagerClient::stopLoading):
1851         (API::CustomProtocolManagerClient::invalidate):
1852         * UIProcess/API/C/WKAPICast.h:
1853         * UIProcess/API/C/soup/WKAPICastSoup.h: Removed.
1854         * UIProcess/API/C/soup/WKContextSoup.h: Removed.
1855         * UIProcess/API/C/soup/WKSoupCustomProtocolRequestManager.cpp: Removed.
1856         * UIProcess/API/C/soup/WKSoupCustomProtocolRequestManager.h: Removed.
1857         * UIProcess/API/C/soup/WKSoupRequestManager.h: Removed.
1858         * UIProcess/API/efl/ewk_context.cpp: Remove unneeded include.
1859         * UIProcess/API/efl/ewk_url_scheme_request.cpp: Use CustomProtocolManagerProxy instead of WKSoupCustomProtocolRequestManagerRef.
1860         (EwkUrlSchemeRequest::EwkUrlSchemeRequest):
1861         (EwkUrlSchemeRequest::finish):
1862         (EwkUrlSchemeRequest::invalidate):
1863         * UIProcess/API/efl/ewk_url_scheme_request_private.h:
1864         (EwkUrlSchemeRequest::create):
1865         (EwkUrlSchemeRequest::manager):
1866         * UIProcess/API/gtk/WebKitCustomProtocolManagerClient.cpp: Added.
1867         (attachCustomProtocolManagerClientToContext):
1868         * UIProcess/API/gtk/WebKitCustomProtocolManagerClient.h: Renamed from Source/WebKit2/UIProcess/API/gtk/WebKitRequestManagerClient.h.
1869         * UIProcess/API/gtk/WebKitPrivate.h:
1870         * UIProcess/API/gtk/WebKitRequestManagerClient.cpp: Removed.
1871         * UIProcess/API/gtk/WebKitRequestManagerClient.h: Removed.
1872         * UIProcess/API/gtk/WebKitURISchemeRequest.cpp: Use CustomProtocolManagerProxy instead of WebSoupCustomProtocolRequestManager.
1873         (webkitURISchemeRequestCreate):
1874         (webkitURISchemeRequestCancel):
1875         (webkitURISchemeRequestGetManager):
1876         (webkitURISchemeRequestInvalidate):
1877         (webkitURISchemeRequestReadCallback):
1878         (webkit_uri_scheme_request_finish_error):
1879         * UIProcess/API/gtk/WebKitURISchemeRequestPrivate.h:
1880         * UIProcess/API/gtk/WebKitWebContext.cpp:
1881         (webkitWebContextConstructed):
1882         (webkitWebContextDispose):
1883         (webkit_web_context_register_uri_scheme):
1884         (webkitWebContextStartLoadingCustomProtocol):
1885         (webkitWebContextInvalidateCustomProtocolRequests):
1886         * UIProcess/API/gtk/WebKitWebContextPrivate.h:
1887         * UIProcess/Network/CustomProtocols/CustomProtocolManagerProxy.h:
1888         * UIProcess/Network/CustomProtocols/mac/CustomProtocolManagerProxyMac.mm:
1889         (WebKit::CustomProtocolManagerProxy::processDidClose):
1890         * UIProcess/Network/CustomProtocols/soup/CustomProtocolManagerProxySoup.cpp:
1891         (WebKit::CustomProtocolManagerProxy::processDidClose): Invalidate the client.
1892         (WebKit::CustomProtocolManagerProxy::startLoading): Notify the client.
1893         (WebKit::CustomProtocolManagerProxy::stopLoading): Ditto.
1894         (WebKit::CustomProtocolManagerProxy::didReceiveResponse): Notify the network process.
1895         (WebKit::CustomProtocolManagerProxy::didLoadData): Ditto.
1896         (WebKit::CustomProtocolManagerProxy::didFailWithError): Ditto.
1897         (WebKit::CustomProtocolManagerProxy::didFinishLoading): Ditto.
1898         * UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManager.cpp: Removed.
1899         * UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManager.h: Removed.
1900         * UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManagerClient.cpp: Removed.
1901         * UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManagerClient.h: Removed.
1902         * UIProcess/Network/NetworkProcessProxy.cpp:
1903         (WebKit::NetworkProcessProxy::didClose): Notify the CustomProtocolManagerProxy.
1904         * UIProcess/WebProcessPool.cpp:
1905         (WebKit::WebProcessPool::WebProcessPool): Initialize the CustomProtocolManagerClient and remove the all supplement.
1906         (WebKit::WebProcessPool::setCustomProtocolManagerClient):
1907         (WebKit::WebProcessPool::registerSchemeForCustomProtocol): In case of soup cache the given protocol.
1908         (WebKit::WebProcessPool::unregisterSchemeForCustomProtocol): In case of soup delete the given protocol from the cache.
1909         * UIProcess/WebProcessPool.h:
1910         * UIProcess/efl/RequestManagerClientEfl.cpp: Do not use the C API, but API::CustomProtocolManagerClient.
1911         (WebKit::RequestManagerClientEfl::RequestManagerClientEfl):
1912         (WebKit::RequestManagerClientEfl::registerURLSchemeHandler):
1913         * UIProcess/efl/RequestManagerClientEfl.h:
1914         * UIProcess/efl/WebProcessPoolEfl.cpp:
1915         * UIProcess/gtk/WebProcessPoolGtk.cpp:
1916         * UIProcess/soup/WebProcessPoolSoup.cpp:
1917         (WebKit::WebProcessPool::platformInitializeNetworkProcess): Use m_urlSchemesRegisteredForCustomProtocols to
1918         build the list of custom protocols to send to the network process.
1919
1920 2016-11-21  Alex Christensen  <achristensen@webkit.org>
1921
1922         Fix Sierra CMake build after r208452
1923         https://bugs.webkit.org/show_bug.cgi?id=164437
1924
1925         * UIProcess/Cocoa/WebViewImpl.mm:
1926         (WebKit::WebViewImpl::updateMediaTouchBar):
1927         I haven't enabled VIDEO_PRESENTATION_MODE in the CMake build yet.
1928         It's needed for WebPlaybackSessionInterfaceMac to exist.
1929
1930 2016-11-21  Carlos Garcia Campos  <cgarcia@igalia.com>
1931
1932         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.15.2 release.
1933
1934         * gtk/NEWS: Add release notes for 2.15.2.
1935
1936 2016-11-21  Carlos Garcia Campos  <cgarcia@igalia.com>
1937
1938         Remove m_customProtocolManagerProxy from WebProcessProxy
1939         https://bugs.webkit.org/show_bug.cgi?id=164908
1940
1941         Reviewed by Andreas Kling.
1942
1943         Since the network process is mandatory, the custom protocol manager proxy of WebProcessProxy is unused and can
1944         be removed.
1945
1946         * UIProcess/WebProcessProxy.cpp:
1947         (WebKit::WebProcessProxy::WebProcessProxy):
1948         * UIProcess/WebProcessProxy.h:
1949
1950 2016-11-20  Zan Dobersek  <zdobersek@igalia.com>
1951
1952         [EncryptedMedia] Make EME API runtime-enabled
1953         https://bugs.webkit.org/show_bug.cgi?id=164927
1954
1955         Reviewed by Jer Noble.
1956
1957         Add the new EncryptedMediaAPI preference. Set the same feature
1958         flag on the shared RuntimeEnabledFeatures object to the
1959         corresponding value that's stored in the WebPreferencesStore.
1960
1961         InjectedBundle::overrideBoolPreferenceForTestRunner() does the
1962         same when the 'WebKitEncryptedMediaAPIEnabled' preference is
1963         overridden in WKTR for testing purposes.
1964
1965         * Shared/WebPreferencesDefinitions.h:
1966         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1967         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
1968         * WebProcess/WebPage/WebPage.cpp:
1969         (WebKit::WebPage::updatePreferences):
1970
1971 2016-11-19  Antti Koivisto  <antti@apple.com>
1972
1973         Salt network cache hashes
1974         https://bugs.webkit.org/show_bug.cgi?id=164924
1975
1976         Reviewed by Alex Christensen.
1977
1978         To enhance privacy make cache content unidentifiable from file names alone.
1979         This is done by generating a unique persistent salt for each cache instance.
1980         It is used when computing hashes used in file names.
1981
1982         The patch also replaces plain text partition directory names with salted hashes.
1983
1984         * NetworkProcess/cache/NetworkCache.cpp:
1985         (WebKit::NetworkCache::Cache::makeCacheKey):
1986         (WebKit::NetworkCache::makeCacheKey): Deleted.
1987         * NetworkProcess/cache/NetworkCache.h:
1988
1989             Increment cache version.
1990
1991         * NetworkProcess/cache/NetworkCacheBlobStorage.cpp:
1992         (WebKit::NetworkCache::BlobStorage::BlobStorage):
1993         (WebKit::NetworkCache::BlobStorage::add):
1994         (WebKit::NetworkCache::BlobStorage::get):
1995
1996             Use salt for blob content hash.
1997
1998         * NetworkProcess/cache/NetworkCacheBlobStorage.h:
1999         * NetworkProcess/cache/NetworkCacheData.cpp:
2000         (WebKit::NetworkCache::computeSHA1):
2001
2002             For simplicity all SHA1s are now salted.
2003
2004         (WebKit::NetworkCache::makeSalt):
2005         (WebKit::NetworkCache::readOrMakeSalt):
2006
2007             Read salt if it exists, generate and persist it otherwise.
2008
2009         * NetworkProcess/cache/NetworkCacheData.h:
2010         * NetworkProcess/cache/NetworkCacheKey.cpp:
2011         (WebKit::NetworkCache::Key::Key):
2012
2013             Remove the "No partition" string and just empty.
2014             That was only needed to have a directory name of some sort.
2015
2016         (WebKit::NetworkCache::Key::computeHash):
2017
2018             Use salt for key hash.
2019
2020         (WebKit::NetworkCache::Key::computePartitionHash):
2021
2022             Separate hash for partition.
2023
2024         * NetworkProcess/cache/NetworkCacheKey.h:
2025         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
2026         (WebKit::NetworkCache::makeSubresourcesKey):
2027         (WebKit::NetworkCache::SpeculativeLoadManager::PendingFrameLoad::saveToDiskIfReady):
2028         (WebKit::NetworkCache::SpeculativeLoadManager::retrieveSubresourcesEntry):
2029         * NetworkProcess/cache/NetworkCacheStorage.cpp:
2030         (WebKit::NetworkCache::makeSaltFilePath):
2031         (WebKit::NetworkCache::Storage::open):
2032
2033             Cache can't be opened if we can't read or persist a salt.
2034
2035         (WebKit::NetworkCache::traverseRecordsFiles):
2036         (WebKit::NetworkCache::Storage::Storage):
2037         (WebKit::NetworkCache::Storage::synchronize):
2038         (WebKit::NetworkCache::Storage::recordDirectoryPathForKey):
2039
2040             Use the partition hash in the directory name instead of a plain text name.
2041
2042         (WebKit::NetworkCache::decodeRecordHeader):
2043         (WebKit::NetworkCache::Storage::readRecord):
2044         (WebKit::NetworkCache::Storage::encodeRecord):
2045         (WebKit::NetworkCache::Storage::traverse):
2046         (WebKit::NetworkCache::Storage::clear):
2047         * NetworkProcess/cache/NetworkCacheStorage.h:
2048         (WebKit::NetworkCache::Storage::salt):
2049
2050 2016-11-19  Simon Fraser  <simon.fraser@apple.com>
2051
2052         [iOS WK2] When zoomed in and panning on pages with fixed bars, parts of the bars are sometimes missing
2053         https://bugs.webkit.org/show_bug.cgi?id=164855
2054
2055         Reviewed by Sam Weinig.
2056
2057         During UI-process panning and zooming, we send visible rect updates to the web process
2058         with inStableState=false, and don't update GraphicsLayers until we get into a stable state.
2059
2060         This causes a problem where the web process has a stale notion of where the GraphicsLayers
2061         for position:fixed elements are, but is then told to update tiling coverage with an up-to-date
2062         visible rect. The existing "sync layer positions" path isn't useful to fix this, because it
2063         breaks the relationship between the GraphicsLayer positions and their FixedPositionViewportConstraints
2064         in the scrolling tree.
2065
2066         To address this, add the notion of an Optional<> approximatePosition on GraphicsLayers. This is used
2067         only by the coverageRect computation code path, and is cleared by a setPosition(). ApproximatePositions
2068         are pushed onto GraphicsLayers via the syncViewportConstrainedLayerPositions() code path (renamed to
2069         reconcileViewportConstrainedLayerPositions).
2070
2071         Tested by scrollingcoordinator/ios/non-stable-viewport-scroll.html
2072
2073         * UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp:
2074         (WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidScroll):
2075         * UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h:
2076         * UIProcess/Scrolling/RemoteScrollingTree.cpp:
2077         (WebKit::RemoteScrollingTree::scrollingTreeNodeDidScroll):
2078         * UIProcess/Scrolling/RemoteScrollingTree.h:
2079         * WebProcess/Scrolling/RemoteScrollingCoordinator.mm:
2080         (WebKit::RemoteScrollingCoordinator::scrollPositionChangedForNode):
2081         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
2082         (WebKit::CompositingCoordinator::flushPendingLayerChanges):
2083         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
2084         (WebKit::CoordinatedLayerTreeHost::didFlushRootLayer):
2085         * WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp:
2086         (WebKit::LayerTreeHostGtk::flushPendingLayerChanges):
2087         * WebProcess/WebPage/ios/WebPageIOS.mm:
2088         (WebKit::WebPage::updateVisibleContentRects): Always push the custom fixed position rect down, but send
2089         ScrollingLayerPositionAction::SetApproximate if the state is not stable.
2090         * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
2091         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
2092         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
2093         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
2094
2095 2016-11-18  Simon Fraser  <simon.fraser@apple.com>
2096
2097         Make it possible to test non-stable-state scrolling on iOS
2098         https://bugs.webkit.org/show_bug.cgi?id=164905
2099
2100         Reviewed by Dan Bernstein.
2101
2102         Make it possible for an iOS layout test to force every visible rect update
2103         from the UI process to the web process to be in a non-stable state. This emulates
2104         what happens during panning and zooming interactions, and allows us to test the
2105         scrolling and layer trees in these transient states.
2106
2107         This is done by adding a testing property on WKWebView, _stableStateOverride, whose
2108         getters and setters are overridden in TestRunnerWKWebView. When non-nil, we _updateVisibleContentRectAfterScrollInView
2109         consults the NSNumber's boolValue and uses it to override the stable state.
2110
2111         To facilitate this kind of testing, also add immediateScrollToOffset() and
2112         immediateZoomToScale() to UIScriptController. Finally, add doAfterPresentationUpdate()
2113         which provides a callback that fires after one trip to the web process and back.
2114
2115         * UIProcess/API/Cocoa/WKWebView.mm:
2116         (-[WKWebView _updateVisibleContentRectAfterScrollInView:]):
2117         (-[WKWebView _stableStateOverride]):
2118         (-[WKWebView _setStableStateOverride:]):
2119         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2120
2121 2016-11-18  Simon Fraser  <simon.fraser@apple.com>
2122
2123         [iOS WK2] Eliminate a source of flakiness in layout tests by forcing WebPage into "responsive" mode for all tests, with an internals override
2124         https://bugs.webkit.org/show_bug.cgi?id=164980
2125
2126         Reviewed by Chris Dumez.
2127
2128         WebPage::eventThrottlingDelay() uses a latency estimate based on the round-trip time from the UI process
2129         to affect behavior, including whether scroll events are fired. This also affects the FrameView "scrolledByUser"
2130         flag that impacts tile coverage.
2131
2132         During testing, latency falling above or below the 16ms threshold could affect behavior. Fix by forcing
2133         WebPage into "responsive" mode while running tests, via InjectedBundlePage::prepare().
2134
2135         Add a nullable internals property so that a test can specify responsive, unresponsive or default behavior.
2136
2137         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
2138         (WKBundlePageSetEventThrottlingBehaviorOverride):
2139         * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
2140         * WebProcess/WebPage/ios/WebPageIOS.mm:
2141         (WebKit::WebPage::eventThrottlingDelay):
2142
2143 2016-11-18  Simon Fraser  <simon.fraser@apple.com>
2144
2145         Remove use of std::chrono in WebPage and entrained code
2146         https://bugs.webkit.org/show_bug.cgi?id=164967
2147
2148         Reviewed by Tim Horton.
2149
2150         Replace std::chrono with Seconds and Monotonic Time.
2151
2152         Use more C++11 initialization for WebPage data members.
2153
2154         * Shared/VisibleContentRectUpdateInfo.cpp:
2155         (WebKit::operator<<):
2156         * Shared/VisibleContentRectUpdateInfo.h:
2157         (WebKit::VisibleContentRectUpdateInfo::VisibleContentRectUpdateInfo):
2158         (WebKit::VisibleContentRectUpdateInfo::timestamp):
2159         * Shared/WebCoreArgumentCoders.cpp:
2160         (IPC::ArgumentCoder<MonotonicTime>::encode):
2161         (IPC::ArgumentCoder<MonotonicTime>::decode):
2162         (IPC::ArgumentCoder<Seconds>::encode):
2163         (IPC::ArgumentCoder<Seconds>::decode):
2164         * Shared/WebCoreArgumentCoders.h:
2165         * UIProcess/ios/WKContentView.mm:
2166         (WebKit::HistoricalVelocityData::HistoricalVelocityData):
2167         (WebKit::HistoricalVelocityData::velocityForNewData):
2168         (WebKit::HistoricalVelocityData::append):
2169         (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInset:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]):
2170         * WebProcess/WebCoreSupport/WebChromeClient.h:
2171         * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
2172         (WebKit::WebChromeClient::eventThrottlingDelay):
2173         * WebProcess/WebPage/ViewUpdateDispatcher.h:
2174         * WebProcess/WebPage/WebPage.cpp:
2175         (WebKit::WebPage::WebPage):
2176         (WebKit::m_userActivityHysteresis):
2177         (WebKit::WebPage::didFlushLayerTreeAtTime):
2178         (WebKit::WebPage::didCommitLoad):
2179         * WebProcess/WebPage/WebPage.h:
2180         * WebProcess/WebPage/ios/WebPageIOS.mm:
2181         (WebKit::WebPage::eventThrottlingDelay):
2182         (WebKit::WebPage::updateVisibleContentRects):
2183         * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
2184         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
2185
2186 2016-11-18  Dean Jackson  <dino@apple.com>
2187
2188         AX: "(inverted-colors)" media query only matches on page reload; should match on change
2189         https://bugs.webkit.org/show_bug.cgi?id=163564
2190         <rdar://problem/28807350>
2191
2192         Reviewed by Simon Fraser.
2193
2194         Listen for the appropriate notifications that accessibility settings
2195         have changed. This is a single notification on macOS, which uses WebViewImpl,
2196         and more fine-grained notifications on iOS, using WKWebView.
2197
2198         When we see the notification, send a message to the WebProcess which will
2199         then tell the WebCore::Page.
2200
2201         * UIProcess/API/Cocoa/WKWebView.mm:
2202         (-[WKWebView _initializeWithConfiguration:]):
2203         (-[WKWebView _accessibilitySettingsDidChange:]):
2204         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2205         * UIProcess/Cocoa/WebViewImpl.h:
2206         * UIProcess/Cocoa/WebViewImpl.mm:
2207         (-[WKAccessibilitySettingsObserver initWithImpl:]):
2208         (-[WKAccessibilitySettingsObserver dealloc]):
2209         (-[WKAccessibilitySettingsObserver _settingsDidChange:]):
2210         (WebKit::WebViewImpl::WebViewImpl):
2211         (WebKit::WebViewImpl::accessibilitySettingsDidChange):
2212         * UIProcess/WebPageProxy.cpp:
2213         (WebKit::WebPageProxy::accessibilitySettingsDidChange):
2214         * UIProcess/WebPageProxy.h:
2215         * WebProcess/WebPage/WebPage.cpp:
2216         (WebKit::WebPage::accessibilitySettingsDidChange):
2217         * WebProcess/WebPage/WebPage.h:
2218         * WebProcess/WebPage/WebPage.messages.in:
2219
2220 2016-11-18  Jeremy Jones  <jeremyj@apple.com>
2221
2222         USE WK_MAC_TBA for version number in _webViewRequestPointerLock:(WKWebView *)webView WK_API_AVAILABLE(macosx(10.12))
2223         https://bugs.webkit.org/show_bug.cgi?id=164962
2224
2225         Reviewed by Dean Jackson.
2226
2227         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
2228
2229 2016-11-18  Enrica Casucci  <enrica@apple.com>
2230
2231         Refactor drag and drop for WebKit2 to encode DragData message exchange.
2232         https://bugs.webkit.org/show_bug.cgi?id=164945
2233
2234         Reviewed by Tim Horton.
2235
2236         * Shared/WebCoreArgumentCoders.cpp:
2237         (IPC::ArgumentCoder<DragData>::encode):
2238         (IPC::ArgumentCoder<DragData>::decode):
2239         * Shared/WebCoreArgumentCoders.h:
2240         * UIProcess/WebPageProxy.cpp:
2241         (WebKit::WebPageProxy::performDragControllerAction):
2242         * WebProcess/WebCoreSupport/WebDragClient.cpp:
2243         (WebKit::WebDragClient::willPerformDragDestinationAction):
2244         (WebKit::WebDragClient::actionMaskForDrag):
2245         * WebProcess/WebCoreSupport/WebDragClient.h:
2246         * WebProcess/WebPage/WebPage.cpp:
2247         (WebKit::WebPage::performDragControllerAction):
2248         * WebProcess/WebPage/WebPage.h:
2249         * WebProcess/WebPage/WebPage.messages.in:
2250
2251 2016-11-18  Jeremy Jones  <jeremyj@apple.com>
2252
2253         Add runtime flag to enable pointer lock. Enable pointer lock feature for mac.
2254         https://bugs.webkit.org/show_bug.cgi?id=163801
2255
2256         Reviewed by Simon Fraser.
2257
2258         Add SPI to notify client of pointer lock and for client to allow or deny.
2259         Unlock pointer when view is not longer active.
2260
2261         * Configurations/FeatureDefines.xcconfig:
2262         * Shared/WebPreferencesDefinitions.h:
2263         * UIProcess/API/APIUIClient.h:
2264         (API::UIClient::requestPointerLock):
2265         (API::UIClient::didLosePointerLock):
2266         * UIProcess/API/C/WKPage.cpp:
2267         (WKPageSetPageUIClient):
2268         (WKPageDidAllowPointerLock):
2269         (WKPageDidDenyPointerLock):
2270         * UIProcess/API/C/WKPagePrivate.h:
2271         * UIProcess/API/C/WKPageUIClient.h:
2272         * UIProcess/API/C/WKPreferences.cpp:
2273         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
2274         * UIProcess/Cocoa/UIDelegate.h:
2275         * UIProcess/Cocoa/UIDelegate.mm:
2276         (WebKit::UIDelegate::setDelegate):
2277         (WebKit::UIDelegate::UIClient::requestPointerLock):
2278         (WebKit::UIDelegate::UIClient::didLosePointerLock):
2279         * UIProcess/WebPageProxy.cpp:
2280         (WebKit::WebPageProxy::dispatchActivityStateChange):
2281         (WebKit::WebPageProxy::resetStateAfterProcessExited):
2282         (WebKit::WebPageProxy::requestPointerLock):
2283         (WebKit::WebPageProxy::didAllowPointerLock):
2284         (WebKit::WebPageProxy::didDenyPointerLock):
2285         (WebKit::WebPageProxy::requestPointerUnlock):
2286         * UIProcess/WebPageProxy.h:
2287         * WebProcess/WebPage/WebPage.cpp:
2288         (WebKit::WebPage::updatePreferences):
2289
2290 2016-11-17  Carlos Garcia Campos  <cgarcia@igalia.com>
2291
2292         Downloads started by context menu actions should also have a web view associated
2293         https://bugs.webkit.org/show_bug.cgi?id=164364
2294
2295         Reviewed by Michael Catanzaro.
2296
2297         When a request is converted to a download WebPageProxy calls handleDownloadRequest() and clients handle that to
2298         associate the web view to the download. When a download is started by a context menu action, WebPageProxy calls
2299         WebProcessPool::download() with this as initiatingPage parameter, but clients are not notified in this case.
2300
2301         * UIProcess/API/gtk/WebKitDownload.cpp:
2302         (webkitDownloadCreateForRequest): Deleted.
2303         * UIProcess/API/gtk/WebKitDownloadPrivate.h:
2304         * UIProcess/API/gtk/WebKitWebContext.cpp:
2305         (webkitWebContextStartDownload): Use webkitWebContextGetOrCreateDownload() after WebProcessPool::download()
2306         because the WebKitDownload could have already been created by the web view download handler at this point.
2307         * UIProcess/API/gtk/WebKitWebView.cpp:
2308         (webkit_web_view_download_uri): We no longer need to associate the web view to the download here.
2309         * UIProcess/WebProcessPool.cpp:
2310         (WebKit::WebProcessPool::download): If an initiatingPage has been passed, call handleDownloadRequest() to notify
2311         the page client.
2312
2313 2016-11-17  Alex Christensen  <achristensen@webkit.org>
2314
2315         REGRESSION: API test _WKDownload.ConvertResponseToDownload is a flaky timeout
2316         https://bugs.webkit.org/show_bug.cgi?id=164631
2317
2318         Reviewed by Carlos Garcia Campos.
2319
2320         * NetworkProcess/NetworkResourceLoader.cpp:
2321         (WebKit::NetworkResourceLoader::convertToDownload):
2322         I could reproduce the flaky failure 100% of the time when not using NETWORK_SESSION
2323         by adding a usleep(1000000) in NetworkResourceLoader::convertToDownload.  m_networkLoad
2324         was not being set to nullptr before it was being checked in NetworkResourceLoader::abort
2325
2326 2016-11-17  Alex Christensen  <achristensen@webkit.org>
2327
2328         Fix CMake build after r208865
2329         https://bugs.webkit.org/show_bug.cgi?id=164894
2330
2331         * PlatformMac.cmake:
2332         Add new files.
2333
2334 2016-11-17  Ryosuke Niwa  <rniwa@webkit.org>
2335
2336         WKBundleNodeHandleSetHTMLInputElementSpellcheckEnabled should keep text replacement enabled
2337         https://bugs.webkit.org/show_bug.cgi?id=164857
2338         <rdar://problem/27721742>
2339
2340         Reviewed by Wenson Hsieh.
2341
2342         * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:
2343         (WebKit::InjectedBundleNodeHandle::setHTMLInputElementSpellcheckEnabled):
2344
2345 2016-11-17  John Wilander  <wilander@apple.com>
2346
2347         Resource load statistics: Cover further data records, count removed data records, and only fire handler when needed
2348         https://bugs.webkit.org/show_bug.cgi?id=164659
2349
2350         Reviewed by Andy Estes.
2351
2352         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2353         (WebKit::WebResourceLoadStatisticsStore::removeDataRecords):
2354             Consistent naming with 'remove' rather than 'delete'.
2355             Now removes localStorage, IndexDB, disk cache, and memory cache too.
2356             Updates statistics with number of times it has removed data records.
2357         (WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated):
2358             No longer checks whether it has enough data since the classification rules
2359             are absolute, not relative.
2360         (WebKit::WebResourceLoadStatisticsStore::clearDataRecords): Deleted.
2361         * UIProcess/WebResourceLoadStatisticsStore.h:
2362             Consistent naming with 'remove' rather than 'delete'.
2363
2364 2016-11-17  Brady Eidson  <beidson@apple.com>
2365
2366         Add _WKIconLoadingDelegate SPI.
2367         https://bugs.webkit.org/show_bug.cgi?id=164894
2368
2369         Reviewed by Alex Christensen.
2370
2371         With this client, WebCore will ask the FrameLoaderClient about each icon found in the <head>.
2372
2373         WebKit2 will then ask the embedding app - for each icon - if it wants that icon to load.
2374
2375         For icons the app decides to load, WebKit will pass the data to the app without storing locally.
2376
2377         * UIProcess/API/APIIconLoadingClient.h: Copied from Source/WebCore/html/LinkIconCollector.h.
2378         (API::IconLoadingClient::~IconLoadingClient):
2379         (API::IconLoadingClient::getLoadDecisionForIcon):
2380
2381         * UIProcess/API/Cocoa/WKWebView.mm:
2382         (-[WKWebView _initializeWithConfiguration:]):
2383         (-[WKWebView _iconLoadingDelegate]):
2384         (-[WKWebView _setIconLoadingDelegate:]):
2385         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2386
2387         * UIProcess/API/Cocoa/_WKIconLoadingDelegate.h: Copied from Source/WebCore/html/LinkIconCollector.h.
2388
2389         * UIProcess/API/Cocoa/_WKLinkIconParameters.h: Copied from Source/WebCore/html/LinkIconCollector.h.
2390         * UIProcess/API/Cocoa/_WKLinkIconParameters.mm: Copied from Source/WebCore/html/LinkIconCollector.h.
2391         (-[_WKLinkIconParameters _initWithLinkIcon:]):
2392         (-[_WKLinkIconParameters url]):
2393         (-[_WKLinkIconParameters mimeType]):
2394         (-[_WKLinkIconParameters size]):
2395         (-[_WKLinkIconParameters iconType]):
2396         * UIProcess/API/Cocoa/_WKLinkIconParametersInternal.h: Copied from Source/WebCore/html/LinkIconCollector.h.
2397
2398         * UIProcess/Cocoa/IconLoadingDelegate.h: Copied from Source/WebCore/html/LinkIconCollector.h.
2399         * UIProcess/Cocoa/IconLoadingDelegate.mm: Added.
2400         (WebKit::IconLoadingDelegate::IconLoadingDelegate):
2401         (WebKit::IconLoadingDelegate::~IconLoadingDelegate):
2402         (WebKit::IconLoadingDelegate::createIconLoadingClient):
2403         (WebKit::IconLoadingDelegate::delegate):
2404         (WebKit::IconLoadingDelegate::setDelegate):
2405         (WebKit::IconLoadingDelegate::IconLoadingClient::IconLoadingClient):
2406         (WebKit::IconLoadingDelegate::IconLoadingClient::~IconLoadingClient):
2407         (WebKit::IconLoadingDelegate::IconLoadingClient::getLoadDecisionForIcon):
2408
2409         * UIProcess/WebPageProxy.cpp:
2410         (WebKit::WebPageProxy::setIconLoadingClient):
2411         (WebKit::WebPageProxy::getLoadDecisionForIcon):
2412         (WebKit::WebPageProxy::finishedLoadingIcon):
2413         * UIProcess/WebPageProxy.h:
2414         (WebKit::WebPageProxy::iconLoadingClient):
2415         * UIProcess/WebPageProxy.messages.in:
2416
2417         * WebKit2.xcodeproj/project.pbxproj:
2418
2419         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2420         (WebKit::WebFrameLoaderClient::useIconLoadingClient):
2421         (WebKit::WebFrameLoaderClient::getLoadDecisionForIcon):
2422         (WebKit::WebFrameLoaderClient::finishedLoadingIcon):
2423         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
2424         (WebKit::WebFrameLoaderClient::setUseIconLoadingClient):
2425
2426         * WebProcess/WebPage/WebPage.cpp:
2427         (WebKit::WebPage::didGetLoadDecisionForIcon):
2428         (WebKit::WebPage::setUseIconLoadingClient):
2429         * WebProcess/WebPage/WebPage.h:
2430         * WebProcess/WebPage/WebPage.messages.in:
2431
2432 2016-11-17  Saam Barati  <sbarati@apple.com>
2433
2434         Remove async/await compile time flag and enable tests
2435         https://bugs.webkit.org/show_bug.cgi?id=164828
2436         <rdar://problem/28639334>
2437
2438         Reviewed by Yusuke Suzuki.
2439
2440         * Configurations/FeatureDefines.xcconfig:
2441
2442 2016-11-17  Yusuke Suzuki  <utatane.tea@gmail.com>
2443
2444         [JSC] WTF::TemporaryChange with WTF::SetForScope
2445         https://bugs.webkit.org/show_bug.cgi?id=164761
2446
2447         Reviewed by Saam Barati.
2448
2449         * PluginProcess/PluginControllerProxy.cpp:
2450         (WebKit::PluginControllerProxy::initialize):
2451         * PluginProcess/WebProcessConnection.cpp:
2452         (WebKit::WebProcessConnection::didReceiveMessage):
2453         (WebKit::WebProcessConnection::didReceiveSyncMessage):
2454         * Shared/API/Cocoa/WKRemoteObjectCoder.mm:
2455         (createEncodedObject):
2456         (decodeObject):
2457         * UIProcess/API/Cocoa/WKWebView.mm:
2458         (-[WKWebView _keyboardChangedWithInfo:adjustScrollView:]):
2459         * UIProcess/Cocoa/WebViewImpl.mm:
2460         (WebKit::WebViewImpl::updateTextTouchBar):
2461         * UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
2462         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::commitStateAfterChildren):
2463         * UIProcess/gtk/WebPasteboardProxyGtk.cpp:
2464         (WebKit::WebPasteboardProxy::writeToClipboard):
2465         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
2466         (WebKit::CompositingCoordinator::flushPendingLayerChanges):
2467         (WebKit::CompositingCoordinator::purgeBackingStores):
2468         * WebProcess/WebPage/WebPage.cpp:
2469         (WebKit::WebPage::mouseEvent):
2470         (WebKit::WebPage::keyEvent):
2471         (WebKit::WebPage::dispatchTouchEvent):
2472         (WebKit::WebPage::setInitialFocus):
2473         (WebKit::WebPage::insertTextAsync):
2474         * WebProcess/WebPage/ios/WebPageIOS.mm:
2475         (WebKit::WebPage::dynamicViewportSizeUpdate):
2476         * WebProcess/WebPage/mac/RemoteLayerTreeContext.mm:
2477         * WebProcess/WebPage/mac/WebPageMac.mm:
2478
2479 2016-11-16  Brent Fulgham  <bfulgham@apple.com>
2480
2481         Unreviewed build fix after r208589
2482
2483         The generated com.apple.WebKit.plugin-common.sb file was not getting copied into
2484         the Resources folder, so was not deployed with WebKit. We need to treat it like
2485         com.apple.WebProcess.sb and the other generated files.
2486
2487         * WebKit2.xcodeproj/project.pbxproj: Tell Xcode to include the generated file in
2488         the framework Resources.
2489
2490 2016-11-16  Yusuke Suzuki  <utatane.tea@gmail.com>
2491
2492         [ES6][WebCore] Change ES6_MODULES compile time flag to runtime flag
2493         https://bugs.webkit.org/show_bug.cgi?id=164827
2494
2495         Reviewed by Ryosuke Niwa.
2496
2497         * Configurations/FeatureDefines.xcconfig:
2498         * Shared/WebPreferencesDefinitions.h:
2499         Annotated ES6 Modules option with DEFAULT_EXPERIMENTAL_FEATURES_ENABLED.
2500         * UIProcess/API/C/WKPreferences.cpp:
2501         (WKPreferencesSetES6ModulesEnabled):
2502         (WKPreferencesGetES6ModulesEnabled):
2503         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2504         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2505         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
2506         * WebProcess/WebPage/WebPage.cpp:
2507         (WebKit::WebPage::updatePreferences):
2508
2509 2016-11-16  Simon Fraser  <simon.fraser@apple.com>
2510
2511         Add logging support to VisibleContentRectUpdateInfo
2512         https://bugs.webkit.org/show_bug.cgi?id=164825
2513
2514         Reviewed by Zalan Bujtas.
2515
2516         Add TextStream output to VisibleContentRectUpdateInfo. Just piping it into a logging
2517         stream does single-line output, so also make a convenience dump() function that will
2518         product multiline output. Result look like:
2519
2520             (VisibleContentRectUpdateInfo
2521               (lastLayerTreeTransactionID 54)
2522               (exposedContentRect (523.44,1258.63) width=676.20 height=901.60)
2523               (unobscuredContentRect (523.44,1293.41) width=676.20 height=866.82)
2524               (unobscuredRectInScrollViewCoordinates (0,39.50) width=768 height=984.50)
2525               (customFixedPositionRect (219.64,935) width=980 height=1225)
2526               (obscuredInset width=0 height=39.50)
2527               (scale 1.14)
2528               (inStableState 0)
2529               (timestamp 736446.61)
2530               (verticalVelocity -11.36))
2531
2532         * Shared/VisibleContentRectUpdateInfo.cpp:
2533         (WebKit::VisibleContentRectUpdateInfo::dump):
2534         (WebKit::operator<<):
2535         * Shared/VisibleContentRectUpdateInfo.h:
2536         * UIProcess/ios/WKContentView.mm:
2537         (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInset:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]):
2538
2539 2016-11-15  Simon Fraser  <simon.fraser@apple.com>
2540
2541         [iOS WK2] Scroll view scrolling and zooming animations can keep running across page loads
2542         https://bugs.webkit.org/show_bug.cgi?id=164810
2543
2544         Reviewed by Tim Horton.
2545         
2546         Scrolling and zooming animations can leak across page loads, which makes tests flakey,
2547         and is unexpected by users.
2548
2549         Tested by scrollingcoordinator/ios/sync-layer-positions-after-scroll.html followed by
2550         scrollingcoordinator/ios/ui-scrolling-tree.html
2551
2552         * UIProcess/API/Cocoa/WKWebView.mm:
2553         (-[WKWebView _didCommitLoadForMainFrame]):
2554
2555 2016-11-15  Jon Lee  <jonlee@apple.com>
2556
2557         Report active video and audio capture devices separately
2558         https://bugs.webkit.org/show_bug.cgi?id=164769
2559
2560         Reviewed by Eric Carlson.
2561
2562         Replace kWKMediaHasActiveCaptureDevice with kWKMediaHasActiveAudioCaptureDevice and
2563         kWKMediaHasActiveVideoCaptureDevice
2564
2565         * UIProcess/API/C/WKPage.cpp:
2566         (WKPageGetMediaState):
2567         * UIProcess/API/C/WKPagePrivate.h:
2568         * UIProcess/WebPageProxy.cpp:
2569         (WebKit::WebPageProxy::isPlayingMediaDidChange): Update the mask to include the two
2570         bits.
2571
2572 2016-11-14  Simon Fraser  <simon.fraser@apple.com>
2573
2574         [iOS WK2] Implement support for visual viewports
2575         https://bugs.webkit.org/show_bug.cgi?id=164765
2576
2577         Reviewed by Tim Horton.
2578
2579         Adopt the visual viewport scrolling model in iOS WK2.
2580
2581         Pass the parameters used for computing the layout viewport up to WK2 via RemoteLayerTreeTransaction.
2582         These are stored on WebPageProxy. When they change, _didCommitLayerTree triggers a -_updateVisibleContentRects.
2583         
2584         WebPageProxy::computeCustomFixedPositionRect() is the function that computes the "override" layout viewport.
2585         It starts with the baseLayoutViewportSize from the web process (which is based on the initial containing block
2586         size), then ensures that it's no smaller than the unobscured content rect, since it makes no sense for the
2587         layout viewport to be smaller than the visual viewport. The static FrameView::computeLayoutViewportOrigin()
2588         is then use to "push" the layout viewport around as the visual viewport changes.
2589
2590         * Shared/VisibleContentRectUpdateInfo.h:
2591         * Shared/WebCoreArgumentCoders.cpp: Encode LayoutSize and LayoutPoint.
2592         (IPC::ArgumentCoder<LayoutSize>::encode):
2593         (IPC::ArgumentCoder<LayoutSize>::decode):
2594         (IPC::ArgumentCoder<LayoutPoint>::encode):
2595         (IPC::ArgumentCoder<LayoutPoint>::decode):
2596         * Shared/WebCoreArgumentCoders.h:
2597         * Shared/mac/RemoteLayerTreeTransaction.h:
2598         (WebKit::RemoteLayerTreeTransaction::baseLayoutViewportSize):
2599         (WebKit::RemoteLayerTreeTransaction::setBaseLayoutViewportSize):
2600         (WebKit::RemoteLayerTreeTransaction::minStableLayoutViewportOrigin):
2601         (WebKit::RemoteLayerTreeTransaction::setMinStableLayoutViewportOrigin):
2602         (WebKit::RemoteLayerTreeTransaction::maxStableLayoutViewportOrigin):
2603         (WebKit::RemoteLayerTreeTransaction::setMaxStableLayoutViewportOrigin):
2604         * Shared/mac/RemoteLayerTreeTransaction.mm:
2605         (WebKit::RemoteLayerTreeTransaction::encode):
2606         (WebKit::RemoteLayerTreeTransaction::decode):
2607         (WebKit::RemoteLayerTreeTransaction::description):
2608         * UIProcess/API/Cocoa/WKWebView.mm:
2609         (-[WKWebView _didCommitLayerTree:]):
2610         * UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h:
2611         (WebKit::RemoteScrollingCoordinatorProxy::visualViewportEnabled): Accessor.
2612         * UIProcess/WebPageProxy.h:
2613         (WebKit::WebPageProxy::customFixedPositionRect):
2614         * UIProcess/ios/RemoteScrollingCoordinatorProxyIOS.mm:
2615         (WebKit::RemoteScrollingCoordinatorProxy::customFixedPositionRect):
2616         * UIProcess/ios/WKContentView.mm:
2617         (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInset:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]):
2618         (-[WKContentView _didCommitLayerTree:]):
2619         * UIProcess/ios/WebPageProxyIOS.mm:
2620         (WebKit::WebPageProxy::computeCustomFixedPositionRect): When visual viewports are enabled, compute
2621         the layout viewport rect, taking the baseLayoutViewportSize and the current unobscured rect into account.
2622         (WebKit::WebPageProxy::updateLayoutViewportParameters):
2623         * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
2624         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
2625         * WebProcess/WebPage/WebPage.cpp: Encode in the transaction the layout viewport parameters (with minor refactor).
2626         (WebKit::WebPage::willCommitLayerTree):
2627         * WebProcess/WebPage/ios/WebPageIOS.mm:
2628         (WebKit::WebPage::updateVisibleContentRects): This is where the web process receives the new override layout viewport
2629         from the web process (with some logging).
2630
2631 2016-11-15  Jon Lee  <jonlee@apple.com>
2632
2633         Remove HasMediaCaptureDevice
2634         https://bugs.webkit.org/show_bug.cgi?id=164767
2635         <rdar://problem/29263696>
2636
2637         Reviewed by Eric Carlson.
2638
2639         * UIProcess/API/C/WKPage.cpp: Remove kWKMediaHasCaptureDevice.
2640         (WKPageGetMediaState):
2641         * UIProcess/API/C/WKPagePrivate.h:
2642
2643 2016-11-15  Daniel Bates  <dabates@apple.com>
2644
2645         Disallow loads using HTTP 0.9 at the ResourceHandle/NetworkDataTask level
2646         https://bugs.webkit.org/show_bug.cgi?id=164662
2647         <rdar://problem/29268514>
2648
2649         Reviewed by Alex Christensen and Brady Eidson.
2650
2651         Make changes to NetworkDataTask similar to the changes made to ResourceHandle so as to
2652         disallow non-default port HTTP 0.9 loads when using the ENABLE(NETWORK_SESSION) networking
2653         code path in WebKit2.
2654
2655         * NetworkProcess/NetworkDataTask.cpp:
2656         (WebKit::NetworkDataTask::didReceiveResponse): Added. Fail the load if it is using HTTP 0.9.
2657         Otherwise notify the client that we received a response.
2658         * NetworkProcess/NetworkDataTask.h:
2659         * NetworkProcess/NetworkDataTaskBlob.cpp:
2660         (WebKit::NetworkDataTaskBlob::resume): Substitute dispatchDidReceiveResponse() for didReceiveResponse()
2661         as the latter has been renamed to the former.
2662         (WebKit::NetworkDataTaskBlob::getSizeForNext): Ditto.
2663         (WebKit::NetworkDataTaskBlob::dispatchDidReceiveResponse): Renamed from didReceiveResponse().
2664         * NetworkProcess/NetworkDataTaskBlob.h:
2665         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
2666         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
2667         (WebKit::NetworkDataTaskCocoa::didReceiveResponse): Deleted.
2668         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
2669         (WebKit::NetworkDataTaskSoup::didSendRequest): Substitute dispatchDidReceiveResponse() for didReceiveResponse()
2670         as the latter has been renamed to the former.
2671         (WebKit::NetworkDataTaskSoup::dispatchDidReceiveResponse): Renamed from didReceiveResponse(). Also
2672         remove the local variable response and inline its value into the call to ResourceHandle::didReceiveResponse()
2673         as this variable is used exactly once in this function and its name does not describe its purpose any more
2674         than its value.
2675         (WebKit::NetworkDataTaskSoup::didRequestNextPart): Substitute dispatchDidReceiveResponse() for didReceiveResponse()
2676         as the latter has been renamed to the former.
2677         * NetworkProcess/soup/NetworkDataTaskSoup.h:
2678
2679 2016-11-14  Alex Christensen  <achristensen@webkit.org>
2680
2681         Move SecurityOrigin::createFromDatabaseIdentifier to SecurityOriginData
2682         https://bugs.webkit.org/show_bug.cgi?id=164720
2683
2684         Reviewed by Brady Eidson.
2685
2686         * DatabaseProcess/DatabaseProcess.cpp:
2687         (WebKit::DatabaseProcess::indexedDatabaseOrigins):
2688         * DatabaseProcess/DatabaseProcess.h:
2689         * NetworkProcess/NetworkProcess.cpp:
2690         (WebKit::fetchDiskCacheEntries):
2691         * Shared/API/c/WKSecurityOriginRef.cpp:
2692         (WKSecurityOriginCreateFromDatabaseIdentifier):
2693         * Shared/WebsiteData/WebsiteData.cpp:
2694         (WebKit::WebsiteData::Entry::encode):
2695         (WebKit::WebsiteData::Entry::decode):
2696         * Shared/WebsiteData/WebsiteData.h:
2697         * UIProcess/API/C/WKKeyValueStorageManager.cpp:
2698         (WKKeyValueStorageManagerGetStorageDetailsByOrigin):
2699         * UIProcess/Storage/LocalStorageDatabaseTracker.cpp:
2700         (WebKit::LocalStorageDatabaseTracker::deleteDatabasesModifiedSince):
2701         (WebKit::LocalStorageDatabaseTracker::origins):
2702         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
2703         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
2704         (WebKit::UserMediaPermissionRequestManagerProxy::enumerateMediaDevicesForFrame):
2705         * UIProcess/WebPageProxy.cpp:
2706         (WebKit::WebPageProxy::exceededDatabaseQuota):
2707         (WebKit::WebPageProxy::reachedApplicationCacheOriginQuota):
2708         (WebKit::WebPageProxy::requestGeolocationPermissionForFrame):
2709         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2710         (WebKit::WebsiteDataStore::fetchData):
2711         (WebKit::WebsiteDataStore::removeData):
2712         (WebKit::WebsiteDataStore::mediaKeyOrigins):
2713         * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
2714         (WKBundleSetDatabaseQuota):
2715         * WebProcess/MediaCache/WebMediaKeyStorageManager.cpp:
2716         (WebKit::WebMediaKeyStorageManager::getMediaKeyOrigins):
2717         * WebProcess/Storage/StorageAreaImpl.cpp:
2718         (WebKit::StorageAreaImpl::create):
2719         (WebKit::StorageAreaImpl::StorageAreaImpl):
2720         (WebKit::StorageAreaImpl::securityOrigin):
2721         * WebProcess/Storage/StorageAreaImpl.h:
2722         * WebProcess/Storage/StorageAreaMap.cpp:
2723         (WebKit::StorageAreaMap::dispatchSessionStorageEvent):
2724         (WebKit::StorageAreaMap::dispatchLocalStorageEvent):
2725         * WebProcess/Storage/StorageAreaMap.h:
2726         (WebKit::StorageAreaMap::securityOrigin):
2727         * WebProcess/Storage/StorageNamespaceImpl.cpp:
2728         (WebKit::StorageNamespaceImpl::didDestroyStorageAreaMap):
2729         (WebKit::StorageNamespaceImpl::storageArea):
2730         * WebProcess/Storage/StorageNamespaceImpl.h:
2731         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2732         (WebKit::WebChromeClient::exceededDatabaseQuota):
2733         * WebProcess/WebProcess.cpp:
2734         (WebKit::WebProcess::fetchWebsiteData):
2735
2736 2016-11-14  Brent Fulgham  <bfulgham@apple.com>
2737
2738         [Mac][iOS][WK2] Tighten permissions to change CapsLock delay
2739         https://bugs.webkit.org/show_bug.cgi?id=164725
2740         <rdar://problem/28970910>
2741
2742         Reviewed by Alexey Proskuryakov.
2743
2744         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in: Limit access
2745         to the IOKit connection that actually needs it.
2746
2747 2016-11-14  Brent Fulgham  <bfulgham@apple.com>
2748
2749         Unreviewed sandbox fix after r208702
2750
2751         Correct version check to avoid breaking users in Safari Technology Preview
2752         or WebKit nightlies.
2753
2754         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
2755         * WebProcess/com.apple.WebProcess.sb.in:
2756
2757 2016-11-14  Pranjal Jumde  <pjumde@apple.com>
2758
2759         Keychain access in WebKit should be limited to a single process. Earlier this was blocked on the networking framework requiring direct access to keychain, this will be resolved in the upcoming version of macOS.
2760         https://bugs.webkit.org/show_bug.cgi?id=163710
2761         <rdar://problem/24357468>
2762
2763         Reviewed by Darin Adler.
2764
2765         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
2766         * WebProcess/com.apple.WebProcess.sb.in:
2767
2768 2016-11-13  Darin Adler  <darin@apple.com>
2769
2770         Remove many includes of ExceptionCode.h
2771         https://bugs.webkit.org/show_bug.cgi?id=164706
2772
2773         Reviewed by Alex Christensen.
2774
2775         * WebProcess/Storage/StorageAreaImpl.cpp: Removed include of ExceptionCode.h.
2776
2777 2016-11-13  Darin Adler  <darin@apple.com>
2778
2779         Fix exception handling in SQL database code, streamline and update code
2780         https://bugs.webkit.org/show_bug.cgi?id=164685
2781
2782         Reviewed by Sam Weinig.
2783
2784         * UIProcess/API/efl/ewk_database_manager.cpp:
2785         (EwkDatabaseManager::getDatabaseOrigins): Update for change to the
2786         DatabaseTracker::origins function.
2787         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2788         (WebKit::WebsiteDataStore::fetchData): Use DatabaseTracker.
2789         (WebKit::WebsiteDataStore::removeData): Ditto.
2790         * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
2791         (WKBundleSetDatabaseQuota): Ditto.
2792         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2793         (WebKit::WebChromeClient::exceededDatabaseQuota): Ditto.
2794         * WebProcess/WebProcess.cpp:
2795         (WebKit::WebProcess::processWillSuspendImminently): Ditto.
2796
2797 2016-11-12  Simon Fraser  <simon.fraser@apple.com>
2798
2799         Add a way to get the UI-side scrolling tree as text via UIScriptController
2800         https://bugs.webkit.org/show_bug.cgi?id=164697
2801
2802         Reviewed by Zalan Bujtas.
2803
2804         Add a property to WKWebView to retrieve the scrolling tree as text, for testing.
2805         Expose it via the RemoteScrollingCoordinatorProxy.
2806
2807         * UIProcess/API/Cocoa/WKWebView.mm:
2808         (-[WKWebView _scrollingTreeAsText]):
2809         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2810         * UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp:
2811         (WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeAsText):
2812         * UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h:
2813
2814 2016-11-12  Daniel Bates  <dabates@apple.com>
2815
2816         Incorrect release log message emitted when waiting/not waiting for the WebProcess continue a load
2817         https://bugs.webkit.org/show_bug.cgi?id=164605
2818
2819         Reviewed by Darin Adler.
2820
2821         Currently we emit a release log message of the form "didReceiveResponse: Should wait for
2822         message from WebContent process ..." when we are not waiting for the WebProcess and emit
2823         a message of the form "didReceiveResponse: Should not wait for message from WebContent
2824         process" when we are waiting on the WebProcess. Invert these messages to reflect whether
2825         we are waiting for the WebProcess to send message NetworkResourceLoader::ContinueDidReceiveResponsewhether.
2826
2827         For the main resource NetworkResourceLoader::didReceiveResponse() returns ShouldContinueDidReceiveResponse::No
2828         because we are waiting for the WebProcess to send message NetworkResourceLoader::ContinueDidReceiveResponse
2829         to continue the load. For a subresource we do not need to wait for the WebProcess to allow the load to continue
2830         and hence NetworkResourceLoader::didReceiveResponse() returns ShouldContinueDidReceiveResponse::Yes.
2831
2832         * NetworkProcess/NetworkResourceLoader.cpp:
2833
2834 2016-11-12  Simon Fraser  <simon.fraser@apple.com>
2835
2836         [iOS WK2] Share some code with Mac for post-async-scroll state reconciliation
2837         https://bugs.webkit.org/show_bug.cgi?id=164694
2838
2839         Reviewed by Zalan Bujtas.
2840
2841         Rather than calling FrameView directly, call reconcileScrollingState() on the scrolling
2842         coordinator.
2843
2844         * WebProcess/WebPage/ios/WebPageIOS.mm:
2845         (WebKit::WebPage::updateVisibleContentRects):
2846
2847 2016-11-12  Brian Burg  <bburg@apple.com>
2848
2849         Web Automation: terminate the automation session if the web process crashes
2850         https://bugs.webkit.org/show_bug.cgi?id=164671
2851         <rdar://problem/29028964>
2852
2853         Reviewed by Joseph Pecoraro.
2854
2855         * UIProcess/Automation/WebAutomationSession.h:
2856         * UIProcess/Automation/WebAutomationSession.cpp:
2857         (WebKit::WebAutomationSession::disconnect):
2858         (WebKit::WebAutomationSession::terminate):
2859         Factor out code that disconnects the remote, unpairs, and notifies the client.
2860         Then, expose terminate() which can be called without a FrontendChannel.
2861         Calling this causes the _WKAutomationDelegate to clear the local-side session in the
2862         browser, and disconnecting from the remote will hang up the remote-side session.
2863
2864         * UIProcess/WebPageProxy.cpp:
2865         (WebKit::WebPageProxy::processDidCrash):
2866         Terminate the session.
2867
2868 2016-11-11  Alex Christensen  <achristensen@webkit.org>
2869
2870         Use SecurityOriginData as keys in StorageManager
2871         https://bugs.webkit.org/show_bug.cgi?id=159834
2872         <rdar://problem/27346948>
2873
2874         Reviewed by Brady Eidson.
2875
2876         * Platform/IPC/HandleMessage.h:
2877         (IPC::callMemberFunctionImpl):
2878         Add a missing std::forward so we can use this callMemberFunctionImpl with rvalues.
2879         * UIProcess/API/C/WKApplicationCacheManager.cpp:
2880         (WKApplicationCacheManagerGetApplicationCacheOrigins):
2881         (WKApplicationCacheManagerDeleteEntriesForOrigin):
2882         * UIProcess/API/C/WKKeyValueStorageManager.cpp:
2883         (WKKeyValueStorageManagerGetKeyValueStorageOrigins):
2884         (WKKeyValueStorageManagerDeleteEntriesForOrigin):
2885         * UIProcess/API/C/WKResourceCacheManager.cpp:
2886         (WKResourceCacheManagerGetCacheOrigins):
2887         (WKResourceCacheManagerClearCacheForOrigin):
2888         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
2889         (-[WKWebsiteDataStore _fetchDataRecordsOfTypes:withOptions:completionHandler:]):
2890         * UIProcess/Databases/DatabaseProcessProxy.cpp:
2891         (WebKit::DatabaseProcessProxy::deleteWebsiteDataForOrigins):
2892         * UIProcess/Databases/DatabaseProcessProxy.h:
2893         * UIProcess/Network/NetworkProcessProxy.cpp:
2894         (WebKit::NetworkProcessProxy::getNetworkProcessConnection):
2895         (WebKit::NetworkProcessProxy::deleteWebsiteDataForOrigins):
2896         * UIProcess/Network/NetworkProcessProxy.h:
2897         * UIProcess/Storage/LocalStorageDatabase.cpp:
2898         (WebKit::LocalStorageDatabase::create):
2899         (WebKit::LocalStorageDatabase::LocalStorageDatabase):
2900         (WebKit::LocalStorageDatabase::openDatabase):
2901         (WebKit::LocalStorageDatabase::close):
2902         * UIProcess/Storage/LocalStorageDatabase.h:
2903         * UIProcess/Storage/LocalStorageDatabaseTracker.cpp:
2904         (WebKit::LocalStorageDatabaseTracker::databasePath):
2905         (WebKit::LocalStorageDatabaseTracker::didOpenDatabaseWithOrigin):
2906         (WebKit::LocalStorageDatabaseTracker::deleteDatabaseWithOrigin):
2907         (WebKit::LocalStorageDatabaseTracker::deleteDatabasesModifiedSince):
2908         (WebKit::LocalStorageDatabaseTracker::origins):
2909         * UIProcess/Storage/LocalStorageDatabaseTracker.h:
2910         * UIProcess/Storage/StorageManager.cpp:
2911         (WebKit::StorageManager::StorageArea::securityOrigin):
2912         (WebKit::StorageManager::TransientLocalStorageNamespace::getOrCreateStorageArea):
2913         (WebKit::StorageManager::TransientLocalStorageNamespace::origins):
2914         (WebKit::StorageManager::TransientLocalStorageNamespace::clearStorageAreasMatchingOrigin):
2915         (WebKit::StorageManager::StorageArea::StorageArea):
2916         (WebKit::StorageManager::StorageArea::clone):
2917         (WebKit::StorageManager::StorageArea::items):
2918         (WebKit::StorageManager::StorageArea::openDatabaseAndImportItemsIfNeeded):
2919         (WebKit::StorageManager::LocalStorageNamespace::didDestroyStorageArea):
2920         (WebKit::StorageManager::LocalStorageNamespace::clearStorageAreasMatchingOrigin):
2921         (WebKit::StorageManager::LocalStorageNamespace::clearAllStorageAreas):
2922         (WebKit::StorageManager::SessionStorageNamespace::origins):
2923         (WebKit::StorageManager::SessionStorageNamespace::clearStorageAreasMatchingOrigin):
2924         (WebKit::StorageManager::SessionStorageNamespace::cloneTo):
2925         (WebKit::StorageManager::getSessionStorageOrigins):
2926         (WebKit::StorageManager::deleteSessionStorageOrigins):
2927         (WebKit::StorageManager::deleteSessionStorageEntriesForOrigins):
2928         (WebKit::StorageManager::getLocalStorageOrigins):
2929         (WebKit::StorageManager::deleteLocalStorageEntriesForOrigin):
2930         (WebKit::StorageManager::deleteLocalStorageOriginsModifiedSince):
2931         (WebKit::StorageManager::deleteLocalStorageEntriesForOrigins):
2932         (WebKit::StorageManager::createLocalStorageMap):
2933         (WebKit::StorageManager::createTransientLocalStorageMap):
2934         (WebKit::StorageManager::createSessionStorageMap):
2935         (WebKit::StorageManager::getOrCreateLocalStorageNamespace):
2936         (WebKit::StorageManager::getOrCreateTransientLocalStorageNamespace):
2937         (WebKit::StorageManager::StorageArea::create): Deleted.
2938         (WebKit::StorageManager::LocalStorageNamespace::getOrCreateStorageArea): Deleted.
2939         (WebKit::StorageManager::SessionStorageNamespace::getOrCreateStorageArea): Deleted.
2940         * UIProcess/Storage/StorageManager.h:
2941         * UIProcess/WebProcessProxy.cpp:
2942         (WebKit::WebProcessProxy::deleteWebsiteDataForOrigins):
2943         * UIProcess/WebProcessProxy.h:
2944         * UIProcess/WebsiteData/WebsiteDataRecord.cpp:
2945         (WebKit::WebsiteDataRecord::displayNameForOrigin):
2946         (WebKit::WebsiteDataRecord::add):
2947         * UIProcess/WebsiteData/WebsiteDataRecord.h:
2948         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2949         (WebKit::WebsiteDataStore::fetchData):
2950         (WebKit::WebsiteDataStore::removeData):
2951         (WebKit::WebsiteDataStore::mediaKeyOrigins):
2952         (WebKit::WebsiteDataStore::removeMediaKeys):
2953         * UIProcess/WebsiteData/WebsiteDataStore.h:
2954         Fewer SecurityOrigin uses in the UIProcess!  Hooray!
2955
2956 2016-11-11  Ryosuke Niwa  <rniwa@webkit.org>
2957
2958         Hovering over a slotted Text node clears hover state
2959         https://bugs.webkit.org/show_bug.cgi?id=164002
2960         <rdar://problem/29040471>
2961
2962         Reviewed by Simon Fraser.
2963
2964         * WebProcess/WebPage/WebPage.cpp:
2965         (WebKit::WebPage::determinePrimarySnapshottedPlugIn):
2966         * WebProcess/WebPage/mac/WebPageMac.mm:
2967         (WebKit::WebPage::performImmediateActionHitTestAtLocation):
2968
2969 2016-11-11  Wenson Hsieh  <wenson_hsieh@apple.com>
2970
2971         [WK2] autocorrect and autocapitalize attributes do not work in contenteditable elements
2972         https://bugs.webkit.org/show_bug.cgi?id=164538
2973         <rdar://problem/8418711>
2974
2975         Reviewed by Ryosuke Niwa.
2976
2977         Consult HTMLElement::autocorrect() and HTMLElement::autocapitalizeType() when assembling the assisted node
2978         information for the currently assisted node.
2979
2980         * Shared/AssistedNodeInformation.h:
2981         * UIProcess/ios/WKContentViewInteraction.mm:
2982         (toUITextAutocapitalize):
2983         * WebProcess/WebPage/ios/WebPageIOS.mm:
2984         (WebKit::WebPage::getAssistedNodeInformation):
2985
2986 2016-11-11  Beth Dakin  <bdakin@apple.com>
2987
2988         Move to modern TouchBar methods
2989         https://bugs.webkit.org/show_bug.cgi?id=164655
2990         -and corresponding-
2991         rdar://problem/29226911
2992
2993         Reviewed by Wenson Hsieh.
2994
2995         customizationDefaultItemIdentifiers -> defaultItemIdentifiers
2996         itemIdentifiers -> defaultItemIdentifiers
2997         defaultItems -> templateItems
2998
2999         * UIProcess/Cocoa/WebViewImpl.mm:
3000         (WebKit::plainTextTouchBarDefaultItemIdentifiers):
3001         (WebKit::richTextTouchBarDefaultItemIdentifiers):
3002         (WebKit::WebViewImpl::setUpTextTouchBar):
3003         (WebKit::WebViewImpl::updateTextTouchBar):
3004         (WebKit::plainTextTouchBarCustomizationDefaultItemIdentifiers): Deleted.
3005         (WebKit::richTextTouchBarCustomizationDefaultItemIdentifiers): Deleted.
3006
3007 2016-11-11  Brent Fulgham  <bfulgham@apple.com>
3008
3009         Get rid of old sandbox rules for OS's we no longer support
3010         https://bugs.webkit.org/show_bug.cgi?id=164638
3011
3012         Reviewed by Simon Fraser.
3013
3014         Clean up the various sandbox profiles to get rid of rules that applied to operating system
3015         versions we no longer support, or were added in support of bugs that have long since been
3016         fixed.
3017
3018         This should introduce no change in behavior.
3019
3020         * DatabaseProcess/mac/com.apple.WebKit.Databases.sb.in:
3021         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
3022         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
3023         * Resources/PlugInSandboxProfiles/com.oracle.java.JavaAppletPlugin.sb:
3024         * WebProcess/com.apple.WebProcess.sb.in:
3025
3026 2016-11-11  Brady Eidson  <beidson@apple.com>
3027
3028         IndexedDB 2.0: "close pending flag" and firing blocked events all need fixing.
3029         https://bugs.webkit.org/show_bug.cgi?id=164641
3030
3031         Reviewed by Alex Christensen.
3032
3033         * DatabaseProcess/IndexedDB/WebIDBConnectionToClient.cpp:
3034         (WebKit::WebIDBConnectionToClient::databaseConnectionPendingClose):
3035         * DatabaseProcess/IndexedDB/WebIDBConnectionToClient.h:
3036         * DatabaseProcess/IndexedDB/WebIDBConnectionToClient.messages.in:
3037
3038         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
3039         (WebKit::WebIDBConnectionToServer::databaseConnectionPendingClose):
3040         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h:
3041
3042 2016-11-11  Eric Carlson  <eric.carlson@apple.com>
3043
3044         [MediaStream] defer resolution of getUserMedia promise made in a background tab
3045         https://bugs.webkit.org/show_bug.cgi?id=164643
3046         <rdar://problem/29048317>
3047
3048         Reviewed by Brady Eidson.
3049
3050         Do not ask for user for access to capture devices when the document does not
3051         allow media to play, wait until playback is allowed.
3052
3053         * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
3054         (WebKit::UserMediaPermissionRequestManager::startUserMediaRequest):
3055         (WebKit::UserMediaPermissionRequestManager::sendUserMediaRequest):
3056         (WebKit::UserMediaPermissionRequestManager::mediaCanStart):
3057         (WebKit::UserMediaPermissionRequestManager::grantUserMediaDevicesSandboxExtension):
3058         * WebProcess/MediaStream/UserMediaPermissionRequestManager.h:
3059         * WebProcess/Plugins/PluginView.cpp:
3060         (WebKit::PluginView::mediaCanStart):
3061         * WebProcess/Plugins/PluginView.h:
3062
3063 2016-11-11  Darin Adler  <darin@apple.com>
3064
3065         Move Node from ExceptionCode to ExceptionOr
3066         https://bugs.webkit.org/show_bug.cgi?id=164515
3067
3068         Reviewed by Sam Weinig.
3069
3070         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLSelectElement.cpp:
3071         (webkit_dom_html_select_element_remove): Updated exception handling.
3072         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMNode.cpp:
3073         (webkit_dom_node_insert_before): Ditto.
3074         (webkit_dom_node_replace_child): Ditto.
3075         (webkit_dom_node_remove_child): Ditto.
3076         (webkit_dom_node_append_child): Ditto.
3077         (webkit_dom_node_clone_node_with_error): Ditto.
3078         (webkit_dom_node_set_node_value): Ditto.
3079         (webkit_dom_node_set_text_content): Ditto.
3080         * WebProcess/InjectedBundle/API/mac/WKDOMNode.mm:
3081         (-[WKDOMNode insertNode:before:]): Ditto.
3082         (-[WKDOMNode appendChild:]): Ditto.
3083         (-[WKDOMNode removeChild:]): Ditto.
3084
3085         * WebProcess/Plugins/PDF/DeprecatedPDFPlugin.mm:
3086         (WebKit::PDFPlugin::PDFPlugin): Removed unneeded ASSERT_NO_EXCEPTION.
3087         * WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.mm:
3088         (WebKit::PDFPluginChoiceAnnotation::createAnnotationElement): Ditto.
3089
3090 2016-11-11  Megan Gardner  <megan_gardner@apple.com>
3091
3092         [Cocoa] Support wide gamut for Drag Image UI
3093         https://bugs.webkit.org/show_bug.cgi?id=164490
3094
3095         Reviewed by Tim Horton.
3096
3097         Fixed an error in the gating for the new wide gamut support in ShareableBitmap.
3098         We should always respect the flags straight out, and not make decisions later, it can lead to mismatched data and data storage.
3099         Added support for wide gamut in createCGImage.
3100
3101         * Shared/cg/ShareableBitmapCG.cpp:
3102         (WebKit::bitmapInfo):
3103         (WebKit::colorSpace):
3104         (WebKit::ShareableBitmap::createGraphicsContext):
3105         (WebKit::ShareableBitmap::createCGImage):
3106         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
3107         (WebKit::convertImageToBitmap):
3108         (WebKit::WebDragClient::startDrag):
3109
3110 2016-11-11  Beth Dakin  <bdakin@apple.com>
3111
3112         Get touch bar code building for open source builds
3113         https://bugs.webkit.org/show_bug.cgi?id=164610
3114
3115         Reviewed by Wenson Hsieh.
3116
3117         * config.h:
3118
3119 2016-11-10  Brent Fulgham  <bfulgham@apple.com>
3120
3121         Remove unused FontService from sandbox profile
3122         https://bugs.webkit.org/show_bug.cgi?id=164625
3123         <rdar://problem/26899976>
3124
3125         Reviewed by Alex Christensen.
3126
3127         Part of some general sandbox profile gardening.
3128
3129         Convert the Plugin process sandbox into 
3130
3131         * Configurations/WebKit.xcconfig: Add exclude for com.apple.WebKit.plugin-common.sb.in.
3132         * DerivedSources.make: Update to generate com.apple.WebKit.plugin-common.sb from .in file
3133         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in: Copied from Resources/PlugInSandboxProfiles/com.apple.WebKit.plugin-common.sb.
3134         * Resources/PlugInSandboxProfiles/com.apple.WebKit.plugin-common.sb: Removed.
3135         * WebKit2.xcodeproj/project.pbxproj: Update for new .in file.
3136         * WebProcess/com.apple.WebProcess.sb.in: Remove com.apple.FontServer
3137         from macOS Sierra and newer.
3138
3139 2016-11-10  Eric Carlson  <eric.carlson@apple.com>
3140
3141         [MediaStream] apply constraints passed to getUserMedia()
3142         https://bugs.webkit.org/show_bug.cgi?id=164561
3143
3144         Reviewed by Youenn Fablet.
3145         <rdar://problem/29191384>
3146
3147         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
3148         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
3149
3150 2016-11-10  Alex Christensen  <achristensen@webkit.org>
3151
3152         Move SecurityOrigin::databaseIdentifier() to SecurityOriginData
3153         https://bugs.webkit.org/show_bug.cgi?id=164573
3154
3155         Reviewed by Brady Eidson.
3156
3157         * Shared/API/c/WKSecurityOriginRef.cpp:
3158         (WKSecurityOriginCopyDatabaseIdentifier):
3159         * UIProcess/Storage/LocalStorageDatabaseTracker.cpp:
3160         (WebKit::LocalStorageDatabaseTracker::databasePath):
3161         (WebKit::LocalStorageDatabaseTracker::didOpenDatabaseWithOrigin):
3162         (WebKit::LocalStorageDatabaseTracker::deleteDatabaseWithOrigin):
3163         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3164         (WebKit::WebsiteDataStore::removeMediaKeys):
3165         * WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp:
3166         (WebKit::GeolocationPermissionRequestManager::startRequestForGeolocation):
3167         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
3168         (WKBundlePageCopyOriginsWithApplicationCache):
3169         * WebProcess/MediaCache/WebMediaKeyStorageManager.cpp:
3170         (WebKit::WebMediaKeyStorageManager::mediaKeyStorageDirectoryForOrigin):
3171         * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
3172         (WebKit::UserMediaPermissionRequestManager::startUserMediaRequest):
3173         (WebKit::UserMediaPermissionRequestManager::enumerateMediaDevices):
3174         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
3175         (WebKit::WebChromeClient::exceededDatabaseQuota):
3176         (WebKit::WebChromeClient::reachedApplicationCacheOriginQuota):
3177
3178 2016-11-10  Alex Christensen  <achristensen@webkit.org>
3179
3180         Remove unused CFURLCACHE code
3181         https://bugs.webkit.org/show_bug.cgi?id=164551
3182
3183         Reviewed by Antti Koivisto.
3184
3185         WebKit2 doesn't use CFURLCache, but we still have some unused code that seems to use it.
3186
3187         * NetworkProcess/NetworkProcess.cpp:
3188         (WebKit::fetchDiskCacheEntries):
3189         (WebKit::clearDiskCacheEntries):
3190         * NetworkProcess/NetworkProcess.h:
3191         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
3192         (WebKit::partitionName): Deleted.
3193         (WebKit::NetworkProcess::cfURLCacheOrigins): Deleted.
3194         (WebKit::NetworkProcess::clearCFURLCacheForOrigins): Deleted.
3195
3196 2016-11-10  Carlos Garcia Campos  <cgarcia@igalia.com>
3197
3198         [Linux] Memory process values shown by the WebMemorySampler in linux are wrong
3199         https://bugs.webkit.org/show_bug.cgi?id=164591
3200
3201         Reviewed by Michael Catanzaro.
3202
3203         It's parsing /proc/self/statm, and returning the values as if they were bytes, but they are number of pages, so
3204         to get the bytes we need to take the page size into account. In r208534 I added a method to get /proc/self/statm
3205         values in bytes to Platform layer, so we can simply use that instead.
3206
3207         * Shared/linux/WebMemorySamplerLinux.cpp:
3208         (WebKit::WebMemorySampler::sampleWebKit): Use currentProcessMemoryStatus() and update the descriptions to
3209         clarify that values are in bytes.
3210
3211 2016-10-14  Carlos Garcia Campos  <cgarcia@igalia.com>
3212
3213         MemoryPressureHandler shouldn't know how to release WebCore memory
3214         https://bugs.webkit.org/show_bug.cgi?id=160497
3215
3216         Reviewed by Michael Catanzaro.
3217
3218         Set the low memory handler before installing the memory pressure handler.
3219
3220         * WebProcess/WebProcess.cpp:
3221         (WebKit::WebProcess::initializeWebProcess):
3222         * WebProcess/cocoa/WebProcessCocoa.mm:
3223         (WebKit::WebProcess::platformInitializeWebProcess):
3224
3225 2016-10-27  Sergio Villar Senin  <svillar@igalia.com>
3226
3227         [GTK] New API to notify about dynamically added forms
3228         https://bugs.webkit.org/show_bug.cgi?id=164050
3229
3230         Reviewed by Carlos Garcia Campos.
3231
3232         This new API exports the WebCore event didAssociateFormControls through the web extension
3233         mechanism. This will help clients (mainly web browsers) to implement robust auto filling
3234         mechanisms. It deals nicely with dynamically created forms (and form controls) as many JS
3235         frameworks do nowadays.
3236
3237         * WebProcess/InjectedBundle/API/gtk/WebKitWebPage.cpp: Added a FormClient implementation of
3238         API::InjectedBundle::FormClient.
3239         (webkitWebPageFormControlsAssociated): Emit the new signal.
3240         (webkit_web_page_class_init): Added the new signal "forms-controls-associated".
3241         (webkitWebPageCreate): Set the WebPage as a FormClient.
3242
3243 2016-11-10  Carlos Alberto Lopez Perez  <clopez@igalia.com>
3244
3245         [GTK] Allow to use WebMemorySampler feature.
3246         https://bugs.webkit.org/show_bug.cgi?id=164517
3247
3248         Reviewed by Carlos Garcia Campos.
3249
3250         Enable the WebMemorySampler with the environment variable WEBKIT_SAMPLE_MEMORY.
3251
3252         When enabled, it will dump the stats to /tmp each second.
3253
3254         * UIProcess/API/gtk/WebKitWebContext.cpp:
3255         (webkitWebContextConstructed):
3256
3257 2016-11-10  Philippe Normand  <pnormand@igalia.com>
3258
3259         [WK2][GTK][GStreamer] Build fails when -plugins-base and -core headers are not installed in the same directory
3260         https://bugs.webkit.org/show_bug.cgi?id=148894
3261
3262         Reviewed by Carlos Garcia Campos.
3263
3264         The pbutils (gst-plugins-base-utils) headers are needed in
3265         WebKit2/GTK for the permission request API related with the
3266         GStreamer codec installer. It builds fine in most cases without
3267         explicitely requiring the pbutils include directory path because
3268         usually all the GStreamer headers are installed in the same path,
3269         excepted for some distributions, like NixOS.
3270
3271         * PlatformGTK.cmake: The GStreamer pbutils include directory was
3272         missing in the header search path.
3273
3274 2016-11-09  Chris Dumez  <cdumez@apple.com>
3275
3276         [WK2][!NETWORK_SESSION] Add support for downloading file backed blobs
3277         https://bugs.webkit.org/show_bug.cgi?id=164522
3278
3279         Reviewed by Alex Christensen.
3280
3281         Add support for downloading file backed blobs for the non-NETWORK_SESSION
3282         code path of WebKit2, which is still use on pre-Sierra macOS.
3283
3284         * NetworkProcess/Downloads/Download.cpp:
3285         (WebKit::Download::~Download):
3286         * NetworkProcess/Downloads/Download.h:
3287         (WebKit::Download::setBlobFileReferences):
3288         * NetworkProcess/Downloads/DownloadManager.cpp:
3289         (WebKit::DownloadManager::startDownload):
3290         (WebKit::DownloadManager::convertNetworkLoadToDownload):
3291         * NetworkProcess/Downloads/DownloadManager.h:
3292         * NetworkProcess/NetworkResourceLoader.cpp:
3293         (WebKit::NetworkResourceLoader::convertToDownload):
3294
3295 2016-11-09  Chris Dumez  <cdumez@apple.com>
3296
3297         [WK2][NETWORK_SESSION] Add support for downloading file backed blobs
3298         https://bugs.webkit.org/show_bug.cgi?id=164458
3299         <rdar://problem/28905514>
3300
3301         Reviewed by Darin Adler.
3302
3303         Add support for downloading file backed blobs on WebKit2.
3304         It previously wasn't working because we weren't calling
3305         BlobDataFileReference::prepareForFileAccess() for each blob file before
3306         starting the download, similarly to what is done in NetworkResourceLoader's
3307         consumeSandboxExtensions().
3308
3309         * NetworkProcess/Downloads/DownloadManager.cpp:
3310         (WebKit::DownloadManager::startDownload):
3311         * NetworkProcess/Downloads/DownloadManager.h:
3312         (WebKit::DownloadManager::startDownload):
3313         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3314         (WebKit::NetworkConnectionToWebProcess::startDownload):
3315         (WebKit::NetworkConnectionToWebProcess::convertMainResourceLoadToDownload):
3316         * NetworkProcess/NetworkDataTask.cpp:
3317         (WebKit::NetworkDataTask::create):
3318         * NetworkProcess/NetworkDataTask.h:
3319         * NetworkProcess/NetworkDataTaskBlob.cpp:
3320         (WebKit::NetworkDataTaskBlob::NetworkDataTaskBlob):
3321         (WebKit::NetworkDataTaskBlob::~NetworkDataTaskBlob):
3322         (WebKit::NetworkDataTaskBlob::download):
3323         * NetworkProcess/NetworkDataTaskBlob.h:
3324         * NetworkProcess/NetworkLoad.cpp:
3325         (WebKit::NetworkLoad::NetworkLoad):
3326         * NetworkProcess/NetworkLoadParameters.h:
3327         * NetworkProcess/NetworkProcess.cpp:
3328         (WebKit::NetworkProcess::downloadRequest):
3329         * NetworkProcess/NetworkResourceLoader.cpp:
3330         (WebKit::NetworkResourceLoader::NetworkResourceLoader):
3331         (WebKit::NetworkResourceLoader::startNetworkLoad):
3332         * NetworkProcess/PingLoad.h:
3333
3334 2016-11-09  Carlos Garcia Campos  <cgarcia@igalia.com>
3335
3336         NetworkSession: Network process crash when converting main resource to download
3337         https://bugs.webkit.org/show_bug.cgi?id=164220
3338
3339         Reviewed by Alex Christensen.
3340
3341         Right after the main resource load is converted to a download, the web process deletes the ResourceLoader which
3342         sends the RemoveLoadIdentifier to the network process and the load is aborted. Sometimes it happens that
3343         NetworkResourceLoader::abort() is called while the NetworkLoad is still deciding the destination of the
3344         download. In such case, NetworkResourceLoader::didConvertToDownload() has already been called, but not
3345         NetworkResourceLoader::didBecomeDownload(). In NetworkResourceLoader::abort() we already handle the case of
3346         having a NetworkLoad after NetworkResourceLoader::didConvertToDownload() has been called, to avoid canceling the
3347         load in such case, however cleanup() is always called unconditionally and the NetworkLoad is deleted before
3348         NetworkResourceLoader::didBecomeDownload() is called. When the NetworkLoad is destroyed the NetworkDataTask
3349         client becomes nullptr, leaving it in a state where both the client is nullptr and the download hasn't been
3350         created yet. That's not expected to happen and when the response completion handler is called in the
3351         NetworkDataTask it tries to use either the client or the download and it crashes.
3352         We need to cleanup and destroy the ResourceLoader as soon as it becomes a download, because that's the expected
3353         behavior, but at the same time we need to keep the NetworkLoad alive until the NetworkDataTask finishes to become
3354         a download. This patch creates a PendingDownload to take the ownership of the NetworkLoad, so that
3355         ResourceLoader can be cleaned up and destroyed. The DownloadManager now will handle the PendingDownload as if it
3356         was created by startDownload(), but ensuring it's deleted right before the final Download object is added to the
3357         downloads map. That way NetworkDataTask will always have a valid client until the final Download is created,
3358         first the ResourceLoader and then the PendingDownload. Since the DownloadManager is the owner of the
3359         PendingDownload we no longer need the didBecomeDownload() callback to delete the NetworkLoad, because the
3360         NetworkLoad will always be owned by the PendingDownload now that will be deleted by the DownloadManager.
3361
3362         * NetworkProcess/Downloads/DownloadManager.cpp:
3363         (WebKit::DownloadManager::dataTaskBecameDownloadTask): Change the ASSERT because at this point we should always
3364         have a PendingDownload, and then remove it from the map here before adding the final Download to the map.
3365         (WebKit::DownloadManager::convertNetworkLoadToDownload): This replaces convertHandleToDownload, but it also now
3366         used for the NetworkSession. It creates a PendingDownload for the given NetworkLoad.
3367         (WebKit::DownloadManager::continueDecidePendingDownloadDestination): Do not take the PendingDownload from the
3368         map here, just check it's present, because it will be removed from dataTaskBecameDownloadTask().
3369         (WebKit::DownloadManager::convertHandleToDownload): Deleted.
3370         * NetworkProcess/Downloads/DownloadManager.h:
3371         * NetworkProcess/Downloads/PendingDownload.cpp:
3372         (WebKit::PendingDownload::PendingDownload): Add a constructor that receives a NetworkLoad.
3373         * NetworkProcess/Downloads/PendingDownload.h:
3374         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3375         (WebKit::NetworkConnectionToWebProcess::convertMainResourceLoadToDownload): Just ask the ResourceLoader to be
3376         converted to a download.
3377         * NetworkProcess/NetworkDataTask.h:
3378         * NetworkProcess/NetworkDataTaskBlob.cpp:
3379         (WebKit::NetworkDataTaskBlob::download): Do not call didBecomeDownload() and add an assert to ensure the client
3380         has already been removed right after the final Download object is created.
3381         * NetworkProcess/NetworkLoad.cpp:
3382         (WebKit::NetworkLoad::NetworkLoad): Use a pointer for the client instead of a reference because now we need to
3383         change the client when the load is converted to a download. We don't need to null check the client in any case
3384         because the member is only updated internally and always from a passed reference.
3385         (WebKit::NetworkLoad::sharedDidReceiveResponse):
3386         (WebKit::NetworkLoad::sharedWillSendRedirectedRequest):
3387         (WebKit::NetworkLoad::convertTaskToDownload): This now receives a PendingDownload. It updates the client and no
3388         longer sends DidStart, because the PendingDownload sends it now.
3389         (WebKit::NetworkLoad::didReceiveChallenge):
3390         (WebKit::NetworkLoad::didReceiveData):
3391         (WebKit::NetworkLoad::didCompleteWithError):
3392         (WebKit::NetworkLoad::didSendData):
3393         (WebKit::NetworkLoad::wasBlocked):
3394         (WebKit::NetworkLoad::cannotShowURL):
3395         (WebKit::NetworkLoad::didReceiveBuffer):
3396         (WebKit::NetworkLoad::didFinishLoading):
3397         (WebKit::NetworkLoad::didFail):
3398         (WebKit::NetworkLoad::canAuthenticateAgainstProtectionSpaceAsync):
3399         (WebKit::NetworkLoad::didBecomeDownload): Deleted.
3400         * NetworkProcess/NetworkLoad.h:
3401         * NetworkProcess/NetworkLoadClient.h: Remove didBecomeDownload().
3402         * NetworkProcess/NetworkResourceLoader.cpp:
3403         (WebKit::NetworkResourceLoader::convertToDownload): This replaces didBecomeDownload() and
3404         didConvertToDownload(). It transfers the NetworkLoad to the DownloadManager.
3405         (WebKit::NetworkResourceLoader::abort): We don't need to check if the load was converted to a download here,
3406         because m_networkLoad will always be null here in such case.
3407         (WebKit::NetworkResourceLoader::didBecomeDownload): Deleted
3408         (WebKit::NetworkResourceLoader::didConvertToDownload): Deleted
3409         * NetworkProcess/NetworkResourceLoader.h:
3410         * NetworkProcess/PingLoad.h: Remove didBecomeDownload().
3411         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.h: Ditto.
3412         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h: Ditto.
3413         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: Ditto.
3414         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3415         (-[WKNetworkSessionDelegate URLSession:dataTask:didBecomeDownloadTask:]): Do not call didBecomeDownload().
3416         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
3417         (WebKit::NetworkDataTaskSoup::download): Do not call didBecomeDownload() and add an assert to ensure the client
3418         has already been removed right after the final Download object is created.
3419
3420 2016-11-09  Alex Christensen  <achristensen@webkit.org>
3421