[Beacon] Improve error reporting
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-08-18  Chris Dumez  <cdumez@apple.com>
2
3         [Beacon] Improve error reporting
4         https://bugs.webkit.org/show_bug.cgi?id=175723
5
6         Reviewed by Darin Adler.
7
8         Have Ping loads such as beacons report errors via their completion handler.
9         The Beacon API is using this error to log a console message when beacon loads
10         fail, provided that the page is still alive.
11
12         Test: http/wpt/beacon/beacon-async-error-logging.html
13
14         * Modules/beacon/NavigatorBeacon.cpp:
15         (WebCore::NavigatorBeacon::NavigatorBeacon):
16         (WebCore::NavigatorBeacon::~NavigatorBeacon):
17         (WebCore::NavigatorBeacon::from):
18         (WebCore::NavigatorBeacon::supplementName):
19         (WebCore::NavigatorBeacon::notifyFinished):
20         (WebCore::NavigatorBeacon::logError):
21         (WebCore::NavigatorBeacon::sendBeacon):
22         * Modules/beacon/NavigatorBeacon.h:
23         * loader/LoaderStrategy.h:
24         * loader/cache/CachedResource.cpp:
25         (WebCore::CachedResource::load):
26         * loader/cache/CachedResourceLoader.cpp:
27         (WebCore::CachedResourceLoader::requestBeaconResource):
28         * loader/cache/CachedResourceLoader.h:
29         * platform/network/PingHandle.h:
30
31 2017-08-18  Sam Weinig  <sam@webkit.org>
32
33         Remove the deprecated WebKitSubtleCrypto interface
34         https://bugs.webkit.org/show_bug.cgi?id=164938
35         <rdar://problem/29894563>
36
37         Reviewed by Chris Dumez.
38
39         Remove WebKitSubtleCrypto and all of its helper classes / functionality.
40
41         * CMakeLists.txt:
42         * DerivedSources.cpp:
43         * DerivedSources.make:
44         * WebCore.xcodeproj/project.pbxproj:
45         * bindings/js/JSCryptoAlgorithmDictionary.cpp: Removed.
46         * bindings/js/JSCryptoAlgorithmDictionary.h: Removed.
47         * bindings/js/JSCryptoKeySerializationJWK.cpp: Removed.
48         * bindings/js/JSCryptoKeySerializationJWK.h: Removed.
49         * bindings/js/JSCryptoOperationData.cpp: Removed.
50         * bindings/js/JSCryptoOperationData.h: Removed.
51         * bindings/js/JSWebKitSubtleCryptoCustom.cpp: Removed.
52         * crypto/CryptoAlgorithm.cpp:
53         (WebCore::CryptoAlgorithm::deriveKey): Deleted.
54         (WebCore::CryptoAlgorithm::encryptForWrapKey): Deleted.
55         (WebCore::CryptoAlgorithm::decryptForUnwrapKey): Deleted.
56         * crypto/CryptoAlgorithm.h:
57         * crypto/CryptoAlgorithmParametersDeprecated.h: Removed.
58         * crypto/CryptoKeySerialization.h: Removed.
59         * crypto/WebKitSubtleCrypto.cpp: Removed.
60         * crypto/WebKitSubtleCrypto.h: Removed.
61         * crypto/WebKitSubtleCrypto.idl: Removed.
62         * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
63         (WebCore::CryptoAlgorithmAES_CBC::keyAlgorithmMatches const): Deleted.
64         * crypto/algorithms/CryptoAlgorithmAES_CBC.h:
65         * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
66         (WebCore::CryptoAlgorithmAES_KW::encryptForWrapKey): Deleted.
67         (WebCore::CryptoAlgorithmAES_KW::decryptForUnwrapKey): Deleted.
68         * crypto/algorithms/CryptoAlgorithmAES_KW.h:
69         * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
70         (WebCore::CryptoAlgorithmHMAC::keyAlgorithmMatches const): Deleted.
71         * crypto/algorithms/CryptoAlgorithmHMAC.h:
72         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
73         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h:
74         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
75         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::keyAlgorithmMatches const): Deleted.
76         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h:
77         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
78         (WebCore::CryptoAlgorithmRSA_OAEP::keyAlgorithmMatches const): Deleted.
79         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h:
80         * crypto/algorithms/CryptoAlgorithmSHA1.cpp:
81         * crypto/algorithms/CryptoAlgorithmSHA1.h:
82         * crypto/algorithms/CryptoAlgorithmSHA224.cpp:
83         * crypto/algorithms/CryptoAlgorithmSHA224.h:
84         * crypto/algorithms/CryptoAlgorithmSHA256.cpp:
85         * crypto/algorithms/CryptoAlgorithmSHA256.h:
86         * crypto/algorithms/CryptoAlgorithmSHA384.cpp:
87         * crypto/algorithms/CryptoAlgorithmSHA384.h:
88         * crypto/algorithms/CryptoAlgorithmSHA512.cpp:
89         * crypto/algorithms/CryptoAlgorithmSHA512.h:
90         * crypto/gcrypt/CryptoAlgorithmAES_CBCGCrypt.cpp:
91         * crypto/gcrypt/CryptoAlgorithmAES_KWGCrypt.cpp:
92         (WebCore::CryptoAlgorithmAES_KW::platformEncrypt): Deleted.
93         (WebCore::CryptoAlgorithmAES_KW::platformDecrypt): Deleted.
94         * crypto/gcrypt/CryptoAlgorithmHMACGCrypt.cpp:
95         * crypto/gcrypt/CryptoAlgorithmRSAES_PKCS1_v1_5GCrypt.cpp:
96         * crypto/gcrypt/CryptoAlgorithmRSASSA_PKCS1_v1_5GCrypt.cpp:
97         * crypto/gcrypt/CryptoAlgorithmRSA_OAEPGCrypt.cpp:
98         * crypto/keys/CryptoKeySerializationRaw.cpp: Removed.
99         * crypto/keys/CryptoKeySerializationRaw.h: Removed.
100         * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp:
101         * crypto/mac/CryptoAlgorithmAES_KWMac.cpp:
102         (WebCore::CryptoAlgorithmAES_KW::platformEncrypt): Deleted.
103         (WebCore::CryptoAlgorithmAES_KW::platformDecrypt): Deleted.
104         * crypto/mac/CryptoAlgorithmHMACMac.cpp:
105         * crypto/mac/CryptoAlgorithmRSAES_PKCS1_v1_5Mac.cpp:
106         * crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp:
107         * crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp:
108         * crypto/parameters/CryptoAlgorithmAesCbcParamsDeprecated.h: Removed.
109         * crypto/parameters/CryptoAlgorithmAesKeyGenParamsDeprecated.h: Removed.
110         * crypto/parameters/CryptoAlgorithmHmacKeyParamsDeprecated.h: Removed.
111         * crypto/parameters/CryptoAlgorithmHmacParamsDeprecated.h: Removed.
112         * crypto/parameters/CryptoAlgorithmRsaKeyGenParamsDeprecated.h: Removed.
113         * crypto/parameters/CryptoAlgorithmRsaKeyParamsWithHashDeprecated.h: Removed.
114         * crypto/parameters/CryptoAlgorithmRsaOaepParamsDeprecated.h: Removed.
115         * crypto/parameters/CryptoAlgorithmRsaSsaParamsDeprecated.h: Removed.
116         * features.json:
117         * page/Crypto.cpp:
118         * page/Crypto.h:
119         * page/Crypto.idl:
120
121 2017-08-18  Tim Horton  <timothy_horton@apple.com>
122
123         Remove classic mode screen scale clamping
124         https://bugs.webkit.org/show_bug.cgi?id=175739
125         <rdar://problem/33894531>
126
127         Reviewed by Andy Estes.
128
129         * platform/ios/PlatformScreenIOS.mm:
130         (WebCore::screenScaleFactor):
131         This code is no longer needed.
132
133 2017-08-18  Daewoong Jang  <daewoong.jang@navercorp.com>
134
135         [Curl] Improve multi-threaded networking
136         https://bugs.webkit.org/show_bug.cgi?id=175713
137
138         Reviewed by Alex Christensen.
139
140         * platform/Curl.cmake:
141         * platform/network/ResourceHandleInternal.h:
142         (WebCore::ResourceHandleInternal::ResourceHandleInternal):
143         (WebCore::ResourceHandleInternal::m_failureTimer): Deleted.
144         * platform/network/curl/CurlCacheManager.cpp:
145         (WebCore::CurlCacheManager::didReceiveResponse):
146         * platform/network/curl/CurlDownload.cpp:
147         (WebCore::CurlDownload::init):
148         (WebCore::CurlDownload::start):
149         (WebCore::CurlDownload::cancel):
150         (WebCore::CurlDownload::retain):
151         (WebCore::CurlDownload::release):
152         (WebCore::CurlDownload::setupRequest):
153         (WebCore::CurlDownload::notifyFinish):
154         (WebCore::CurlDownload::notifyFail):
155         * platform/network/curl/CurlDownload.h:
156         * platform/network/curl/CurlJobManager.cpp:
157         (WebCore::CurlJobList::isEmpty const):
158         (WebCore::CurlJobList::startJobs):
159         (WebCore::CurlJobList::finishJobs):
160         (WebCore::CurlJobList::notifyResult):
161         (WebCore::CurlJobManager::add):
162         (WebCore::CurlJobManager::cancel):
163         (WebCore::CurlJobManager::callOnJobThread):
164         (WebCore::CurlJobManager::startThreadIfNeeded):
165         (WebCore::CurlJobManager::updateJobList):
166         (WebCore::CurlJobManager::workerThread):
167         (WebCore::CurlJobList::append): Deleted.
168         (WebCore::CurlJobList::cancel): Deleted.
169         (WebCore::CurlJobList::complete): Deleted.
170         (WebCore::CurlJobList::withJob): Deleted.
171         (WebCore::CurlJobList::withCurlHandle): Deleted.
172         (WebCore::CurlJob::invoke): Deleted.
173         (WebCore::CurlJobManager::updateJobs): Deleted.
174         * platform/network/curl/CurlJobManager.h:
175         (WebCore::CurlJob::CurlJob): Deleted.
176         (WebCore::CurlJob::~CurlJob): Deleted.
177         (WebCore::CurlJob::operator=): Deleted.
178         (WebCore::CurlJob::curlHandle const): Deleted.
179         (WebCore::CurlJob::ticket const): Deleted.
180         (WebCore::CurlJob::finished): Deleted.
181         (WebCore::CurlJob::error): Deleted.
182         (WebCore::CurlJob::cancel): Deleted.
183         (WebCore::CurlJobManager::isActiveJob const): Deleted.
184         * platform/network/curl/MultipartHandle.cpp:
185         (WebCore::MultipartHandle::didReceiveData):
186         * platform/network/curl/ResourceHandleCurl.cpp:
187         (WebCore::ResourceHandleInternal::~ResourceHandleInternal):
188         (WebCore::ResourceHandle::start):
189         (WebCore::ResourceHandle::cancel):
190         (WebCore::ResourceHandle::platformSetDefersLoading):
191         (WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
192         (WebCore::ResourceHandle::receivedCredential):
193         (WebCore::ResourceHandle::receivedRequestToContinueWithoutCredential):
194         (WebCore::ResourceHandle::platformLoadResourceSynchronously):
195         (WebCore::ResourceHandleInternal::initialize): Deleted.
196         (WebCore::ResourceHandleInternal::applyAuthentication): Deleted.
197         (WebCore::getFormElementsCount): Deleted.
198         (WebCore::ResourceHandleInternal::setupPUT): Deleted.
199         (WebCore::ResourceHandleInternal::setupPOST): Deleted.
200         (WebCore::ResourceHandleInternal::setupFormData): Deleted.
201         (WebCore::ResourceHandleInternal::didFinish): Deleted.
202         (WebCore::ResourceHandleInternal::didFail): Deleted.
203         (WebCore::ResourceHandleInternal::calculateWebTimingInformations): Deleted.
204         (WebCore::ResourceHandleInternal::handleLocalReceiveResponse): Deleted.
205         (WebCore::isHttpInfo): Deleted.
206         (WebCore::isHttpRedirect): Deleted.
207         (WebCore::isHttpAuthentication): Deleted.
208         (WebCore::isHttpNotModified): Deleted.
209         (WebCore::isAppendableHeader): Deleted.
210         (WebCore::removeLeadingAndTrailingQuotes): Deleted.
211         (WebCore::getProtectionSpace): Deleted.
212         (WebCore::ResourceHandleInternal::willPrepareSendData): Deleted.
213         (WebCore::ResourceHandleInternal::didReceiveHeaderLine): Deleted.
214         (WebCore::ResourceHandleInternal::didReceiveAllHeaders): Deleted.
215         (WebCore::ResourceHandleInternal::didReceiveContentData): Deleted.
216         (WebCore::ResourceHandleInternal::readCallback): Deleted.
217         (WebCore::ResourceHandleInternal::headerCallback): Deleted.
218         (WebCore::ResourceHandleInternal::writeCallback): Deleted.
219         (WebCore::ResourceHandleInternal::dispatchSynchronousJob): Deleted.
220         (WebCore::ResourceHandleInternal::handleDataURL): Deleted.
221         * platform/network/curl/ResourceHandleCurlDelegate.cpp: Added.
222         (WebCore::ResourceHandleCurlDelegate::ResourceHandleCurlDelegate):
223         (WebCore::ResourceHandleCurlDelegate::~ResourceHandleCurlDelegate):
224         (WebCore::ResourceHandleCurlDelegate::hasHandle const):
225         (WebCore::ResourceHandleCurlDelegate::releaseHandle):
226         (WebCore::ResourceHandleCurlDelegate::start):
227         (WebCore::ResourceHandleCurlDelegate::cancel):
228         (WebCore::ResourceHandleCurlDelegate::setDefersLoading):
229         (WebCore::ResourceHandleCurlDelegate::setAuthentication):
230         (WebCore::ResourceHandleCurlDelegate::dispatchSynchronousJob):
231         (WebCore::ResourceHandleCurlDelegate::retain):
232         (WebCore::ResourceHandleCurlDelegate::release):
233         (WebCore::ResourceHandleCurlDelegate::setupRequest):
234         (WebCore::ResourceHandleCurlDelegate::notifyFinish):
235         (WebCore::ResourceHandleCurlDelegate::notifyFail):
236         (WebCore::ResourceHandleCurlDelegate::response):
237         (WebCore::ResourceHandleCurlDelegate::setupAuthentication):
238         (WebCore::removeLeadingAndTrailingQuotes):
239         (WebCore::ResourceHandleCurlDelegate::getProtectionSpace):
240         (WebCore::isHttpInfo):
241         (WebCore::isHttpRedirect):
242         (WebCore::isHttpAuthentication):
243         (WebCore::isHttpNotModified):
244         (WebCore::isAppendableHeader):
245         (WebCore::ResourceHandleCurlDelegate::didReceiveHeaderLine):
246         (WebCore::ResourceHandleCurlDelegate::didReceiveAllHeaders):
247         (WebCore::ResourceHandleCurlDelegate::didReceiveContentData):
248         (WebCore::ResourceHandleCurlDelegate::handleLocalReceiveResponse):
249         (WebCore::ResourceHandleCurlDelegate::prepareSendData):
250         (WebCore::ResourceHandleCurlDelegate::didFinish):
251         (WebCore::ResourceHandleCurlDelegate::didFail):
252         (WebCore::ResourceHandleCurlDelegate::handleDataURL):
253         (WebCore::ResourceHandleCurlDelegate::setupPOST):
254         (WebCore::ResourceHandleCurlDelegate::setupPUT):
255         (WebCore::ResourceHandleCurlDelegate::getFormElementsCount):
256         (WebCore::ResourceHandleCurlDelegate::setupFormData):
257         (WebCore::ResourceHandleCurlDelegate::applyAuthentication):
258         (WebCore::ResourceHandleCurlDelegate::setWebTimings):
259         (WebCore::ResourceHandleCurlDelegate::didReceiveHeader):
260         (WebCore::ResourceHandleCurlDelegate::didReceiveData):
261         (WebCore::ResourceHandleCurlDelegate::willSendData):
262         (WebCore::ResourceHandleCurlDelegate::didReceiveHeaderCallback):
263         (WebCore::ResourceHandleCurlDelegate::didReceiveDataCallback):
264         (WebCore::ResourceHandleCurlDelegate::willSendDataCallback):
265         * platform/network/curl/ResourceHandleCurlDelegate.h: Added.
266
267 2017-08-18  Ryosuke Niwa  <rniwa@webkit.org>
268
269         iOS 10 debug build fix.
270
271         * dom/DataTransfer.cpp:
272         (WebCore::DataTransfer::DataTransfer):
273
274 2017-08-18  Ryosuke Niwa  <rniwa@webkit.org>
275
276         Rename DataTransferAccessPolicy to match spec and refactor related node
277         https://bugs.webkit.org/show_bug.cgi?id=175704
278
279         Reviewed by Wenson Hsieh.
280
281         Renamed DataTransferAccessPolicy to DataTransfer::StoreMode to match the drag data store mode concept
282         in the HTML5 specification:
283         https://html.spec.whatwg.org/multipage/dnd.html#drag-data-store-mode
284
285         DataTransfer in addition to those states can be disassociated from the drag data store when it becomes
286         no longer valid. We also support a special mode which allows only updating the drag image.
287         These two states, Invalid and DragImageWritable, are added in addition to the three states in the spec.
288
289         Also split DragAndDrop type of DataTransfer into DragAndDropData and DragAndDropFiles, and refactored
290         the related code.
291
292         No new tests since there should be no behavioral change.
293
294         * WebCore.xcodeproj/project.pbxproj:
295         * dom/DataTransfer.cpp:
296         (WebCore::DataTransfer::DataTransfer): No longer takes forFileDrag boolean since it's folded into type.
297         (WebCore::DataTransfer::createForCopyAndPaste):
298         (WebCore::DataTransfer::~DataTransfer):
299         (WebCore::DataTransfer::setAccessPolicy): Deleted.
300         (WebCore::DataTransfer::canReadTypes const):
301         (WebCore::DataTransfer::canReadData const):
302         (WebCore::DataTransfer::canWriteData const):
303         (WebCore::DataTransfer::createForInputEvent):
304         (WebCore::DataTransfer::createForDrag):
305         (WebCore::DataTransfer::createForDrop):
306         (WebCore::DataTransfer::canSetDragImage const):
307         * dom/DataTransfer.h:
308         (WebCore::DataTransfer::makeInvalidForSecurity): Added.
309         (WebCore::DataTransfer::makeDragImageWritable): Added.
310         * dom/DataTransferAccessPolicy.h: Removed.
311         * editing/Editor.cpp:
312         (WebCore::dispatchClipboardEvent): Moved and renamed from dispatchCPPEvent. Now computes the store mode
313         inside the function to match the spec: https://w3c.github.io/clipboard-apis/#fire-a-clipboard-event
314         (WebCore::Editor::canDHTMLCut):
315         (WebCore::Editor::canDHTMLCopy):
316         (WebCore::Editor::canDHTMLPaste):
317         (WebCore::Editor::tryDHTMLCopy):
318         (WebCore::Editor::tryDHTMLCut):
319         (WebCore::Editor::tryDHTMLPaste):
320         (WebCore::Editor::dispatchCPPEvent): Deleted.
321         * editing/Editor.h:
322         * page/DragController.cpp:
323         (WebCore::createDataTransferToUpdateDrag): Extracted to share code.
324         (WebCore::DragController::dragExited):
325         (WebCore::DragController::performDragOperation):
326         (WebCore::DragController::tryDHTMLDrag):
327         * page/EventHandler.cpp:
328         (WebCore::EventHandler::invalidateDataTransfer):
329         (WebCore::EventHandler::handleDrag):
330
331 2017-08-18  Said Abou-Hallawa  <sabouhallawa@apple.com>
332
333         Followup (r220289): RenderImageResourceStyleImage code clean up
334         https://bugs.webkit.org/show_bug.cgi?id=175444
335
336         Reviewed by Darin Adler.
337
338         RenderImageResourceStyleImage may be created with a StyleImage of type
339         StyleGeneratedImage. It may also be associated with a CachedImage which 
340         is loaded through a source URL. In this case, adding and removing m_renderer
341         as a client of the CachedImage will be done through 
342         RenderImageResource::setCachedImage().
343
344         RenderImageResource::setCachedImage() is already called from 
345         ImageLoader::updateRenderer() when the CachedImage finishes loading. This
346         call adds m_renderer to the clients of the CachedImage. 
347         RenderImageResource::setCachedImage() will also be called from 
348         RenderImageResourceStyleImage::shutdown() via RenderImageResource::shutdown()
349         to remove m_renderer from the clients of CachedImage by passing a null pointer.
350
351         * rendering/RenderImage.cpp:
352         (WebCore::RenderImage::styleWillChange):
353         * rendering/RenderImageResource.cpp:
354         (WebCore::RenderImageResource::initialize):
355         (WebCore::RenderImageResource::shutdown):
356         (WebCore::RenderImageResource::setCachedImage):
357         (WebCore::RenderImageResource::resetAnimation):
358         (WebCore::RenderImageResource::image const):
359         (WebCore::RenderImageResource::setContainerSizeForRenderer):
360         (WebCore::RenderImageResource::imageSize const):
361         (WebCore::RenderImageResource::~RenderImageResource): Deleted.
362         (WebCore::RenderImageResource::errorOccurred const): Deleted.
363         (WebCore::RenderImageResource::imageHasRelativeWidth const): Deleted.
364         (WebCore::RenderImageResource::imageHasRelativeHeight const): Deleted.
365         (WebCore::RenderImageResource::intrinsicSize const): Deleted.
366         (WebCore::RenderImageResource::getImageSize const): Deleted.
367         * rendering/RenderImageResource.h:
368         (WebCore::RenderImageResource::initialize):
369         (WebCore::RenderImageResource::renderer const):
370         (WebCore::RenderImageResource::errorOccurred const):
371         (WebCore::RenderImageResource::imageHasRelativeWidth const):
372         (WebCore::RenderImageResource::imageHasRelativeHeight const):
373         (WebCore::RenderImageResource::imageSize const):
374         (WebCore::RenderImageResource::intrinsicSize const):
375         (WebCore::RenderImageResource::imagePtr const):
376         * rendering/RenderImageResourceStyleImage.cpp:
377         (WebCore::RenderImageResourceStyleImage::initialize):
378         (WebCore::RenderImageResourceStyleImage::shutdown):
379         (WebCore::RenderImageResourceStyleImage::image const):
380         (WebCore::RenderImageResourceStyleImage::setContainerSizeForRenderer):
381         (WebCore::RenderImageResourceStyleImage::~RenderImageResourceStyleImage): Deleted.
382         * rendering/RenderImageResourceStyleImage.h:
383         * rendering/RenderSnapshottedPlugIn.cpp:
384         (WebCore::RenderSnapshottedPlugIn::RenderSnapshottedPlugIn):
385         * rendering/svg/RenderSVGImage.cpp:
386         (WebCore::RenderSVGImage::RenderSVGImage):
387
388 2017-08-18  Jiewen Tan  <jiewen_tan@apple.com>
389
390         [WebCrypto][Mac] Replace CCECCryptorGetKeyComponents with CCECCryptorExportKey for exporting ECC JWKs
391         https://bugs.webkit.org/show_bug.cgi?id=175657
392         <rdar://problem/33797150>
393
394         Reviewed by Brent Fulgham.
395
396         CCECCryptorGetKeyComponents returns components in unpadded formats. In some minor cases, the ECC components
397         do need padding. Therefore, we occasionally see some corrupted outputs in JWKs. To overcome that, this patch
398         replaces CCECCryptorGetKeyComponents with CCECCryptorExportKey which does padding all the time.
399
400         In the meantime, this patch also makes export* methods return OperationError if any error occur in the
401         underlying operations though very unlikely.
402
403         Test: crypto/subtle/ecdsa-generate-export-import-jwk-sign-verify.html
404
405         * crypto/algorithms/CryptoAlgorithmECDH.cpp:
406         (WebCore::CryptoAlgorithmECDH::exportKey):
407         * crypto/algorithms/CryptoAlgorithmECDSA.cpp:
408         (WebCore::CryptoAlgorithmECDSA::exportKey):
409         * crypto/gcrypt/CryptoKeyECGCrypt.cpp:
410         (WebCore::CryptoKeyEC::platformAddFieldElements const):
411         * crypto/keys/CryptoKeyEC.cpp:
412         (WebCore::CryptoKeyEC::exportRaw const):
413         (WebCore::CryptoKeyEC::exportJwk const):
414         (WebCore::CryptoKeyEC::exportSpki const):
415         (WebCore::CryptoKeyEC::exportPkcs8 const):
416         * crypto/keys/CryptoKeyEC.h:
417         * crypto/mac/CryptoKeyECMac.cpp:
418         (WebCore::CryptoKeyEC::platformExportRaw const):
419         (WebCore::CryptoKeyEC::platformAddFieldElements const):
420         (WebCore::CryptoKeyEC::platformExportSpki const):
421         (WebCore::CryptoKeyEC::platformExportPkcs8 const):
422
423 2017-08-18  Per Arne Vollan  <pvollan@apple.com>
424
425         [Win] accessibility/heading-crash-after-hidden.html is a flaky crash.
426         https://bugs.webkit.org/show_bug.cgi?id=173536
427
428         Reviewed by Brent Fulgham.
429
430         If the tree state is dirty, accessible objects are deleted while iterating over children
431         under AccessibilityNodeObject::textUnderElement when the style is updated. Make sure the
432         style is updated before this method is called.
433
434         No new tests, covered by existing tests.
435
436         * accessibility/win/AccessibilityObjectWrapperWin.cpp:
437         (WebCore::AccessibilityObjectWrapper::accessibilityAttributeValue):
438
439 2017-08-18  Youenn Fablet  <youenn@apple.com>
440
441         [Cache API] Add response body storage
442         https://bugs.webkit.org/show_bug.cgi?id=175658
443
444         Reviewed by Alex Christensen.
445
446         Covered by rebased tests.
447         Tests are still flaky until waiting for end of fetch load is implemented.
448
449         Adding a response body within CacheStorageConnection::Record.
450         Adding ability to pass this body from/to the main thread.
451
452         Adding response body consumption into a CacheStorageConnection::Record.
453         Adding response body setting from a CacheStorageConnection::Record.
454
455         * Modules/beacon/NavigatorBeacon.cpp:
456         (WebCore::NavigatorBeacon::sendBeacon):
457         * Modules/cache/Cache.cpp:
458         (WebCore::Cache::put):
459         (WebCore::toConnectionRecord):
460         (WebCore::Cache::updateRecords):
461         * Modules/cache/CacheStorageConnection.cpp:
462         (WebCore::CacheStorageConnection::copyResponseBody):
463         (WebCore::CacheStorageConnection::isolatedResponseBody):
464         (WebCore::CacheStorageConnection::Record::copy const):
465         * Modules/cache/CacheStorageConnection.h:
466         * Modules/cache/WorkerCacheStorageConnection.cpp:
467         (WebCore::toCrossThreadRecordData):
468         (WebCore::fromCrossThreadRecordData):
469         * Modules/fetch/FetchBody.cpp:
470         (WebCore::FetchBody::bodyAsFormData const):
471         (WebCore::FetchBody::take):
472         (WebCore::FetchBody::bodyForInternalRequest const): Deleted.
473         * Modules/fetch/FetchBody.h:
474         (WebCore::FetchBody::setAsFormData):
475         * Modules/fetch/FetchBodyConsumer.h:
476         (WebCore::FetchBodyConsumer::setData):
477         * Modules/fetch/FetchRequest.cpp:
478         (WebCore::FetchRequest::resourceRequest const):
479         * Modules/fetch/FetchResponse.cpp:
480         (WebCore::FetchResponse::consumeBody):
481         (WebCore::FetchResponse::setBodyData):
482         * Modules/fetch/FetchResponse.h:
483
484 2017-08-18  Youenn Fablet  <youenn@apple.com>
485
486         [Fetch API] Add support for a callback-based fetch
487         https://bugs.webkit.org/show_bug.cgi?id=175710
488
489         Reviewed by Alex Christensen.
490
491         No change of behavior.
492
493         Moving from a DOMPromise to a Callback taking an ExceptionOr<FetchResponse&>.
494         Updating window and worker call sites.
495
496         * Modules/fetch/DOMWindowFetch.cpp:
497         (WebCore::DOMWindowFetch::fetch):
498         * Modules/fetch/FetchResponse.cpp:
499         (WebCore::FetchResponse::fetch):
500         (WebCore::FetchResponse::BodyLoader::didFail):
501         (WebCore::FetchResponse::BodyLoader::BodyLoader):
502         (WebCore::FetchResponse::BodyLoader::didReceiveResponse):
503         (WebCore::FetchResponse::BodyLoader::stop):
504         * Modules/fetch/FetchResponse.h:
505         * Modules/fetch/WorkerGlobalScopeFetch.cpp:
506         (WebCore::WorkerGlobalScopeFetch::fetch):
507
508 2017-08-18  Brady Eidson  <beidson@apple.com>
509
510         Bounce ServiceWorker jobs to the Storage Process.
511         https://bugs.webkit.org/show_bug.cgi?id=175650
512
513         Reviewed by Andy Estes.
514
515         No new tests (Covered by both changes and consistencies in existing tests)
516
517         This lays the groundwork for the SW job queue being in the StorageProcess by actually
518         setting up some objects for IPC communication and actually sending things over the wire.
519
520         The main point of IPC is the WebCore abstract base class "SWServer::Connection"
521
522         A collection of them will soon be managed by the SWServer itself in the StorageProcess.
523
524         That object will be the stand-in for IPC on both the WebProcess and StorageProcess side.
525
526         Currently, any job that we try to schedule still immediately rejects (though now it does
527         so asynchronously instead of synchronously).
528
529         * CMakeLists.txt:
530         * WebCore.xcodeproj/project.pbxproj:
531
532         * dom/ExceptionData.h: Copied from Source/WebCore/workers/service/ServiceWorkerProvider.h.
533         (WebCore::ExceptionData::toException const):
534         (WebCore::ExceptionData::encode const):
535         (WebCore::ExceptionData::decode):
536
537         * workers/service/ServiceWorkerContainer.cpp:
538         (WebCore::ServiceWorkerContainer::addRegistration):
539         (WebCore::ServiceWorkerContainer::scheduleJob):
540         * workers/service/ServiceWorkerContainer.h:
541
542         * workers/service/ServiceWorkerJob.cpp:
543         (WebCore::ServiceWorkerJob::failedWithException):
544         (WebCore::ServiceWorkerJob::data const):
545         * workers/service/ServiceWorkerJob.h:
546
547         * workers/service/ServiceWorkerJobData.h: Copied from Source/WebCore/workers/service/ServiceWorkerProvider.h.
548         (WebCore::ServiceWorkerJobData::encode const):
549         (WebCore::ServiceWorkerJobData::decode):
550
551         * workers/service/ServiceWorkerJobType.h: Copied from Source/WebCore/workers/service/ServiceWorkerProvider.h.
552
553         * workers/service/ServiceWorkerProvider.h:
554
555         * workers/service/ServiceWorkerRegistrationParameters.h:
556
557         * workers/service/server/SWServer.cpp: Copied from Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.cpp.
558         (WebCore::SWServer::Connection::scheduleJob):
559         (WebCore::SWServer::Connection::jobRejected):
560         * workers/service/server/SWServer.h: Copied from Source/WebCore/workers/service/ServiceWorkerProvider.h.
561         (WebCore::SWServer::Connection::~Connection):
562
563 2017-08-18  Chris Dumez  <cdumez@apple.com>
564
565         [Beacon] Add support for quota limitation
566         https://bugs.webkit.org/show_bug.cgi?id=175443
567         <rdar://problem/33729002>
568
569         Reviewed by Youenn Fablet.
570
571         LoaderStrategy::startPingLoad() now takes a completion handler parameter, allowing CachedResource::load()
572         to know when a Beacon load is complete. This was needed in order for the fetch in-flight keepalive request
573         quota limit to work properly for beacon loads as well. We need to know when the beacon load completes in
574         order to know if the beacon is in-flight or not and only free up its allocated quota once it is no longer
575         in-flight.
576
577         No new tests, updated existing test.
578
579         * loader/LoaderStrategy.h:
580         * loader/PingLoader.cpp:
581         (WebCore::PingLoader::startPingLoad):
582         * loader/cache/CachedResource.cpp:
583         (WebCore::CachedResource::load):
584         * platform/network/PingHandle.h:
585
586 2017-08-18  Youenn Fablet  <youenn@apple.com>
587
588         [Cache API] Add a WK2 implementation of CacheStorageConnection
589         https://bugs.webkit.org/show_bug.cgi?id=175640
590
591         Reviewed by Alex Christensen & Chris Dumez.
592
593         * Modules/cache/CacheStorageConnection.cpp: Adding Internal error.
594         * Modules/cache/CacheStorageConnection.h: Ditto.
595         * WebCore.xcodeproj/project.pbxproj: Exporting CacheQueryOptions.h header.
596
597 2017-08-18  Antti Koivisto  <antti@apple.com>
598
599         Factor render tree mutation code from RenderListItem to RenderTreeUpdater
600         https://bugs.webkit.org/show_bug.cgi?id=175718
601
602         Reviewed by Andreas Kling.
603
604         We already stopped doing layout time mutations. We can now move the code out too.
605
606         * WebCore.xcodeproj/project.pbxproj:
607         * rendering/RenderListItem.cpp:
608         (WebCore::isHTMLListElement):
609         (WebCore::getParentOfFirstLineBox): Deleted.
610         (WebCore::firstNonMarkerChild): Deleted.
611         (WebCore::RenderListItem::updateMarkerRenderer): Deleted.
612
613             Moved to RenderTreeUpdater::ListItem.
614
615         * rendering/RenderListItem.h:
616         * rendering/RenderListMarker.cpp:
617         (WebCore::RenderListMarker::willBeDestroyed):
618         * rendering/TextAutoSizing.cpp:
619         (WebCore::TextAutoSizingValue::adjustTextNodeSizes):
620         * style/RenderTreeUpdater.cpp:
621         (WebCore::RenderTreeUpdater::pushParent):
622         (WebCore::RenderTreeUpdater::popParent):
623         (WebCore::RenderTreeUpdater::updateBeforeDescendants):
624         (WebCore::RenderTreeUpdater::updateAfterDescendants):
625
626             Factor pre/post update into functions.
627
628         (WebCore::RenderTreeUpdater::updateBeforeOrAfterPseudoElement):
629         * style/RenderTreeUpdater.h:
630         * style/RenderTreeUpdaterListItem.cpp: Added.
631
632             Mutation functions move here.
633
634         (WebCore::getParentOfFirstLineBox):
635         (WebCore::firstNonMarkerChild):
636         (WebCore::RenderTreeUpdater::ListItem::updateMarker):
637         * style/RenderTreeUpdaterListItem.h: Added.
638
639 2017-08-18  Ms2ger  <Ms2ger@gmail.com>
640
641         [GTK] Show controls if a video element isn't allowed to play inline.
642         https://bugs.webkit.org/show_bug.cgi?id=141705
643
644         Reviewed by Xabier Rodriguez-Calvar.
645
646         Test: covered by media/video-fullscreeen-only-controls.html [sic].
647
648         * Modules/mediacontrols/mediaControlsGtk.js:
649         (ControllerGtk.prototype.shouldHaveControls):
650
651 2017-08-18  Zan Dobersek  <zdobersek@igalia.com>
652
653         [EME] MediaKeySession has to initiate playback resume on HTMLMediaElement
654         https://bugs.webkit.org/show_bug.cgi?id=175671
655
656         Reviewed by Xabier Rodriguez-Calvar.
657
658         In MediaKeySession::updateKeyStatuses(), HTMLMediaElement objects that are
659         associated with the MediaKeys instance that created this session have to
660         be notified in order to run the 'Attempt to Resume Playback If Necessary'
661         algorithm.
662
663         MediaKeys object now tracks the sessions that were created through it.
664         MediaKeySession object is passed a MediaKeys reference, and has that
665         reference invalidated if/when the MediaKeys object is destroyed.
666
667         In MediaKeySession::updateKeyStatuses(), a task is now queued, notifying
668         the MediaKeys object, if any, that the associated HTMLMediaElement
669         instances have to run the mentioned algorithm. The associated media
670         elements are stored through CDMClient pointers, with HTMLMediaElement
671         class inheriting from the newly-introduced CDMClient interface.
672
673         HTMLMediaElement::cdmClientAttemptToResumePlaybackIfNecessary() is left
674         unimplemented for now. The object will attach itself to and detach from
675         the associated MediaKeys object in setMediaKeys() and the destructor,
676         enabling the MediaKeys object to properly dispatch the playback resume
677         requests for the attached clients.
678
679         * Modules/encryptedmedia/CDMClient.h: Copied from Source/WebCore/Modules/encryptedmedia/MediaKeys.h.
680         (WebCore::CDMClient::~CDMClient):
681         * Modules/encryptedmedia/MediaKeySession.cpp:
682         (WebCore::MediaKeySession::create):
683         (WebCore::MediaKeySession::MediaKeySession):
684         (WebCore::MediaKeySession::detachKeys):
685         (WebCore::MediaKeySession::updateKeyStatuses):
686         * Modules/encryptedmedia/MediaKeySession.h:
687         * Modules/encryptedmedia/MediaKeys.cpp:
688         (WebCore::MediaKeys::~MediaKeys):
689         (WebCore::MediaKeys::createSession):
690         (WebCore::MediaKeys::attachCDMClient):
691         (WebCore::MediaKeys::detachCDMClient):
692         (WebCore::MediaKeys::attemptToResumePlaybackOnClients):
693         * Modules/encryptedmedia/MediaKeys.h:
694         * html/HTMLMediaElement.cpp:
695         (WebCore::HTMLMediaElement::cdmClientAttemptToResumePlaybackIfNecessary):
696         * html/HTMLMediaElement.h:
697
698 2017-08-18  Commit Queue  <commit-queue@webkit.org>
699
700         Unreviewed, rolling out r220854.
701         https://bugs.webkit.org/show_bug.cgi?id=175716
702
703         I'm not sure we really need this (Requested by KaL on
704         #webkit).
705
706         Reverted changeset:
707
708         "[GTK][WPE] Add NTLM authentication enabled API"
709         https://bugs.webkit.org/show_bug.cgi?id=122952
710         http://trac.webkit.org/changeset/220854
711
712 2017-08-17  Wenson Hsieh  <wenson_hsieh@apple.com>
713
714         [Input Events] Rename inputType "formatForeColor" to "formatFontColor"
715         https://bugs.webkit.org/show_bug.cgi?id=175703
716
717         Reviewed by Ryosuke Niwa.
718
719         Renames an inputType value to match the spec. There is no other change in behavior.
720         Rebaselines fast/events/input-events-selection-forecolor-data.html and fast/events/input-events-forecolor-data.html.
721
722         * editing/EditCommand.cpp:
723         (WebCore::inputTypeNameForEditingAction):
724
725 2017-08-17  Daewoong Jang  <daewoong.jang@navercorp.com>
726
727         [Curl] Improve multi-threaded networking
728         https://bugs.webkit.org/show_bug.cgi?id=175253
729
730         Reviewed by Alex Christensen.
731
732         * platform/network/curl/CurlContext.cpp:
733         (WebCore::CurlMultiHandle::CurlMultiHandle):
734         (WebCore::CurlHandle::CurlHandle):
735         (WebCore::CurlHandle::initialize):
736         (WebCore::CurlHandle::setSslKeyPassword):
737         (WebCore::CurlHandle::setSslErrors):
738         (WebCore::CurlHandle::getSslErrors):
739         * platform/network/curl/CurlContext.h:
740         * platform/network/curl/CurlDownload.cpp:
741         (WebCore::CurlDownload::init):
742         (WebCore::CurlDownload::getResponse const):
743         (WebCore::CurlDownload::setupRequest):
744         (WebCore::CurlDownload::didReceiveHeader):
745         (WebCore::CurlDownload::didReceiveData):
746         (WebCore::CurlDownload::headerCallback):
747         (WebCore::CurlDownload::getTempPath const): Deleted.
748         (WebCore::CurlDownload::getUrl const): Deleted.
749         (WebCore::CurlDownload::downloadFinishedCallback): Deleted.
750         (WebCore::CurlDownload::downloadFailedCallback): Deleted.
751         (WebCore::CurlDownload::receivedDataCallback): Deleted.
752         (WebCore::CurlDownload::receivedResponseCallback): Deleted.
753         * platform/network/curl/CurlDownload.h:
754         * platform/network/curl/ResourceError.h:
755         (WebCore::ResourceError::ResourceError):
756         (WebCore::ResourceError::sslErrors const):
757         (WebCore::ResourceError::setSSLErrors): Deleted.
758         * platform/network/curl/ResourceHandleCurl.cpp:
759         (WebCore::ResourceHandleInternal::initialize):
760         (WebCore::ResourceHandleInternal::didFail):
761         (WebCore::ResourceHandleInternal::dispatchSynchronousJob):
762         * platform/network/curl/SSLHandle.cpp:
763         (WebCore::allowedClientHosts):
764         (WebCore::addAllowedClientCertificate):
765         (WebCore::getSSLClientCertificate):
766         (WebCore::certVerifyCallback):
767         (WebCore::setSSLVerifyOptions):
768         (WebCore::setSSLClientCertificate): Deleted.
769         * platform/network/curl/SSLHandle.h:
770
771 2017-08-17  Chris Dumez  <cdumez@apple.com>
772
773         Regression(r220817): We should only copy the original request headers for Ping loads
774         https://bugs.webkit.org/show_bug.cgi?id=175679
775
776         Reviewed by Youenn Fablet.
777
778         For performance reason, we should only copy the original request headers for Ping loads
779         (Beacon at the moment), not for all CachedResourceRequests.
780
781         * loader/LoaderStrategy.h:
782         * loader/cache/CachedResource.cpp:
783         (WebCore::CachedResource::CachedResource):
784         (WebCore::CachedResource::load):
785         * loader/cache/CachedResource.h:
786         (WebCore::CachedResource::shouldUsePingLoad):
787         (WebCore::CachedResource::setOriginalRequestHeaders):
788         * loader/cache/CachedResourceLoader.cpp:
789         (WebCore::CachedResourceLoader::requestResource):
790         * loader/cache/CachedResourceRequest.cpp:
791         (WebCore::CachedResourceRequest::CachedResourceRequest):
792         * loader/cache/CachedResourceRequest.h:
793         (WebCore::CachedResourceRequest::releaseResourceRequest):
794         (WebCore::CachedResourceRequest::releaseOriginalRequestHeaders): Deleted.
795
796 2017-08-17  Don Olmstead  <don.olmstead@sony.com>
797
798         [PAL] Relocate SessionID to root
799         https://bugs.webkit.org/show_bug.cgi?id=175684
800
801         Reviewed by Alex Christensen.
802
803         No new tests. No change in functionality.
804
805         * dom/Document.h:
806         * html/HTMLMediaElement.cpp:
807         * loader/cache/CachedResource.h:
808         * loader/cache/CachedResourceLoader.cpp:
809         * loader/cache/MemoryCache.h:
810         * loader/cocoa/DiskCacheMonitorCocoa.h:
811         * page/CacheStorageProvider.h:
812         * page/Page.h:
813         * page/PlugInClient.h:
814         * page/SocketProvider.h:
815         * platform/CookiesStrategy.h:
816         * platform/WebCoreCrossThreadCopier.cpp:
817         * platform/network/CacheValidation.h:
818         * platform/network/NetworkStorageSession.cpp:
819         * platform/network/NetworkStorageSession.h:
820         * platform/network/cf/SocketStreamHandleImpl.h:
821         * platform/network/curl/SocketStreamHandleImpl.h:
822         * platform/network/soup/SocketStreamHandleImpl.h:
823         * workers/WorkerGlobalScope.h:
824         * workers/service/ServiceWorkerContainer.h:
825         * workers/service/ServiceWorkerRegistrationParameters.h:
826
827 2017-08-17  Wenson Hsieh  <wenson_hsieh@apple.com>
828
829         Fix the build on other platforms after r220865
830         https://bugs.webkit.org/show_bug.cgi?id=175683
831
832         Reviewed by Tim Horton.
833
834         Instead of special casing iOS 10 behavior with __IPHONE_OS_VERSION_MAX_ALLOWED < 110000, revert to special
835         casing iOS 11 behavior with __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000. This is because other targets that are
836         neither iOS 10 nor 11 will fail the "before iOS 11" compile-time check, and subsequently assume that item
837         providers exist. To fix this, flip the compiler-time checks and the order of codeblocks in the
838         PlatformPasteboard::write methods.
839
840         There is no change in behavior.
841
842         * platform/ios/PlatformPasteboardIOS.mm:
843         (WebCore::registerItemToPasteboard):
844         (WebCore::PlatformPasteboard::write):
845
846 2017-08-17  Michael Catanzaro  <mcatanzaro@igalia.com>
847
848         -Wreturn-type warnings in CryptoKey.cpp and SubtleCrypto.cpp
849         https://bugs.webkit.org/show_bug.cgi?id=175675
850
851         Reviewed by Jiewen Tan.
852
853         * crypto/CryptoKey.cpp:
854         (WebCore::CryptoKey::algorithm const):
855         * crypto/SubtleCrypto.cpp:
856         (WebCore::toCryptoKeyUsageBitmap):
857         (WebCore::toKeyData):
858
859 2017-08-17  Andreas Kling  <akling@apple.com>
860
861         Disable CSS regions at compile time
862         https://bugs.webkit.org/show_bug.cgi?id=175630
863
864         Reviewed by Antti Koivisto.
865
866         * Configurations/FeatureDefines.xcconfig:
867
868 2017-08-17  Wenson Hsieh  <wenson_hsieh@apple.com>
869
870         [iOS] Respect type fidelities when copying image elements to the pasteboard
871         https://bugs.webkit.org/show_bug.cgi?id=175638
872         <rdar://problem/26556043>
873
874         Reviewed by Ryosuke Niwa.
875
876         Ensures that we respect type fidelities when copying on iOS, by unifying pasteboard writing codepaths across
877         dragging and copying. When dragging and copying, we now generate and set UIItemProviders on the UIPasteboard.
878
879         Tests: ActionSheetTests.CopyImageElementWithHREF
880                ActionSheetTests.CopyImageElementWithoutHREF
881
882         * platform/PlatformPasteboard.h:
883
884         Remove all variants of the writeObjectRepresentations helper method. Now that both paths for writing to the
885         pasteboard are unified, it's no longer useful to separate out item-provider-based pasteboard logic.
886
887         * platform/ios/AbstractPasteboard.h:
888         * platform/ios/PlatformPasteboardIOS.mm:
889
890         Replaces -setItemsUsingRegistrationInfoLists: with -setRegistrationInfoLists:. Rather than have a helper that
891         both sets up item providers and item registration lists, split this functionality out into two setters. This is
892         because UIPasteboard does not need to know about the registration info lists used to set up the item providers
893         in the first place, but internal drag-and-drop clients require this information immediately when starting a drag
894         in order to construct custom drag previews.
895
896         (WebCore::richTextRepresentationsForPasteboardWebContent):
897         (WebCore::registerItemToPasteboard):
898
899         Add a new helper to register item providers to the pasteboard, given an WebItemProviderRegistrationInfoList.
900
901         (WebCore::PlatformPasteboard::write):
902         (WebCore::PlatformPasteboard::writeObjectRepresentations): Deleted.
903
904         Refactors PlatformPasteboard::write to always generate and set item providers, unless we're building for an SDK
905         prior to iOS 11. For images, strings and URLs, we can simply transition to using the new item-provider-based
906         codepaths used for drag and drop. For web content, we add two additional UTIs that were present when copying,
907         but not when dragging: flat RTFD and a string constant used to indicate to UIKit that the pasteboard contains
908         rich text.
909
910         * platform/ios/WebItemProviderPasteboard.h:
911         * platform/ios/WebItemProviderPasteboard.mm:
912         (-[WebItemProviderRegistrationInfoList init]):
913         (-[WebItemProviderRegistrationInfoList addData:forType:]):
914         (-[WebItemProviderRegistrationInfoList addRepresentingObject:]):
915         (-[WebItemProviderRegistrationInfoList numberOfItems]):
916         (-[WebItemProviderRegistrationInfoList itemAtIndex:]):
917         (-[WebItemProviderRegistrationInfoList itemProvider]):
918         (-[WebItemProviderRegistrationInfoList description]):
919
920         Make some small tweaks in WebItemProviderPasteboard (and related classes):
921         1. Transition to preferredPresentationSize from estimatedDisplayedSize, which is now deprecated.
922         2. Remove calls to -initWithItemProviderData:typeIdentifier:error:, which is deprecated.
923         3. Rename _items to _representations to better reflect the role of WebItemProviderRegistrationInfo.
924         4. Implement -description for WebItemProviderRegistrationInfoList for debugging purposes.
925
926         (-[WebItemProviderPasteboard valuesForPasteboardType:inItemSet:]):
927         (-[WebItemProviderPasteboard setRegistrationInfoLists:]):
928         (-[WebItemProviderPasteboard setItemsUsingRegistrationInfoLists:]): Deleted.
929
930 2017-08-17  Youenn Fablet  <youenn@apple.com>
931
932         Add a DOMPromiseDeferred method to handle ExceptionOr<> results
933         https://bugs.webkit.org/show_bug.cgi?id=175603
934
935         Reviewed by Darin Adler.
936
937         No change of behavior.
938
939         Introduce DOMPromiseDeferred::settle to reject/resolve a promise with an ExceptionOr<>.
940         Making batchPutOperation/batchDeleteOperation take a Function with an ExceptionOr<>.
941         Using DOMPromiseDeferred::settle in Cache put/remove.
942         Updated CacheStorageConnection to create ExceptionOr<> from CacheStorageConnection::Error.
943
944         * Modules/cache/Cache.cpp:
945         (WebCore::Cache::put):
946         (WebCore::Cache::remove):
947         (WebCore::Cache::batchDeleteOperation):
948         (WebCore::Cache::batchPutOperation):
949         * Modules/cache/Cache.h:
950         * Modules/cache/CacheStorage.cpp:
951         (WebCore::CacheStorage::open):
952         (WebCore::CacheStorage::remove):
953         * Modules/cache/CacheStorageConnection.cpp:
954         (WebCore::CacheStorageConnection::errorToException):
955         * Modules/cache/CacheStorageConnection.h:
956         (WebCore::CacheStorageConnection::errorToException):
957         (WebCore::CacheStorageConnection::exceptionOrResult):
958         * bindings/js/JSDOMPromiseDeferred.h:
959         (WebCore::DOMPromiseDeferred::settle):
960         (WebCore::DOMPromiseDeferred<void>::settle):
961
962 2017-08-17  Zan Dobersek  <zdobersek@igalia.com>
963
964         [GStreamer] AppendPipeline: support dispatch of decryption-specific GstStructure into the pipeline
965         https://bugs.webkit.org/show_bug.cgi?id=175668
966
967         Reviewed by Xabier Rodriguez-Calvar.
968
969         Add the AppendPipeline::dispatchDecryptionStructure() method. Callers can
970         pass in a GstStructure object that contains all the information the
971         decryption elements in the pipeline will require to properly decrypt the
972         content. In case the decryptor element isn't available yet, the
973         GstStructure is stored and dispatched when that element becomes available.
974
975         The dispatch itself simply creates a new custom GstEvent that adopts the
976         given GstStructure object, sends that into the pipeline element, and
977         shifts the state to 'ongoing'.
978
979         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
980         (WebCore::AppendPipeline::connectDemuxerSrcPadToAppsinkFromAnyThread):
981         (WebCore::AppendPipeline::dispatchPendingDecryptionStructure):
982         (WebCore::AppendPipeline::dispatchDecryptionStructure):
983         * platform/graphics/gstreamer/mse/AppendPipeline.h: Remove a redundant private: label.
984
985 2017-08-17  Zan Dobersek  <zdobersek@igalia.com>
986
987         [GStreamer] GstStructure shouldn't be handled through GRefPtr
988         https://bugs.webkit.org/show_bug.cgi?id=175673
989
990         Reviewed by Xabier Rodriguez-Calvar.
991
992         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
993         (webkitMediaCommonEncryptionDecryptTransformCaps): GstStructure isn't
994         ref-counted, so it should be handled through the GUniquePtr<GstStructure>
995         smart pointer.
996
997 2017-08-17  Youenn Fablet  <youenn@apple.com>
998
999         [Mac/iOS] Increase the audio buffer size when audio capture is on but web audio is not used
1000         https://bugs.webkit.org/show_bug.cgi?id=175631
1001
1002         Reviewed by Eric Carlson.
1003
1004         * platform/audio/cocoa/MediaSessionManagerCocoa.cpp:
1005         (PlatformMediaSessionManager::updateSessionState): Change value from 128 to the equivalent of 20ms when audio capture happens but not web audio.
1006
1007 2017-08-17  Antti Koivisto  <antti@apple.com>
1008
1009         RenderListItem - Avoid render tree mutation during layout
1010         https://bugs.webkit.org/show_bug.cgi?id=175666
1011
1012         Reviewed by Andreas Kling.
1013
1014         Mutations should be done by RenderTreeUpdater only.
1015
1016         * rendering/RenderListItem.cpp:
1017         (WebCore::RenderListItem::updateMarkerRenderer):
1018
1019             This is now called by RenderTreeUpdater only.
1020             Remove code dealing with this being called at layout time.
1021             Merged marker construction code from styleDidChange here and renamed for clarity.
1022
1023         (WebCore::RenderListItem::layout):
1024         (WebCore::RenderListItem::computePreferredLogicalWidths):
1025
1026             Remove mutating calls.
1027
1028         (WebCore::RenderListItem::styleDidChange): Deleted.
1029         (WebCore::RenderListItem::insertOrMoveMarkerRendererIfNeeded): Deleted.
1030         * rendering/RenderListItem.h:
1031         * rendering/TextAutoSizing.cpp:
1032         (WebCore::TextAutoSizingValue::adjustTextNodeSizes):
1033
1034             Call updateMarkerRenderer.
1035
1036         * style/RenderTreeUpdater.cpp:
1037         (WebCore::RenderTreeUpdater::popParent):
1038         (WebCore::RenderTreeUpdater::updateBeforeOrAfterPseudoElement):
1039
1040             Call updateMarkerRenderer.
1041
1042 2017-08-17  Don Olmstead  <don.olmstead@sony.com>
1043
1044         [PAL] Move SessionID into PAL
1045         https://bugs.webkit.org/show_bug.cgi?id=174192
1046
1047         Reviewed by Antti Koivisto.
1048
1049         No new tests. No change in behavior.
1050
1051         * CMakeLists.txt:
1052         * Modules/websockets/WebSocketChannel.cpp:
1053         (WebCore::WebSocketChannel::connect):
1054         * WebCore.xcodeproj/project.pbxproj:
1055         * dom/Document.cpp:
1056         (WebCore::Document::sessionID const):
1057         * dom/Document.h:
1058         * dom/ScriptExecutionContext.h:
1059         * html/HTMLMediaElement.cpp:
1060         (WebCore::HTMLMediaElement::elementWithID):
1061         (WebCore::HTMLMediaElement::finishParsingChildren):
1062         (WebCore::HTMLMediaElement::scheduleEvent):
1063         (WebCore::HTMLMediaElement::canPlayType const):
1064         (WebCore::HTMLMediaElement::load):
1065         (WebCore::HTMLMediaElement::loadResource):
1066         (WebCore::HTMLMediaElement::textTracksAreReady const):
1067         (WebCore::HTMLMediaElement::textTrackModeChanged):
1068         (WebCore::HTMLMediaElement::noneSupported):
1069         (WebCore::HTMLMediaElement::mediaLoadingFailedFatally):
1070         (WebCore::HTMLMediaElement::mediaLoadingFailed):
1071         (WebCore::HTMLMediaElement::setReadyState):
1072         (WebCore::HTMLMediaElement::addPlayedRange):
1073         (WebCore::HTMLMediaElement::seekTask):
1074         (WebCore::HTMLMediaElement::refreshCachedTime const):
1075         (WebCore::HTMLMediaElement::currentMediaTime const):
1076         (WebCore::HTMLMediaElement::setWebkitPreservesPitch):
1077         (WebCore::HTMLMediaElement::ended const):
1078         (WebCore::HTMLMediaElement::playInternal):
1079         (WebCore::HTMLMediaElement::pause):
1080         (WebCore::HTMLMediaElement::togglePlayState):
1081         (WebCore::HTMLMediaElement::beginScrubbing):
1082         (WebCore::HTMLMediaElement::playbackProgressTimerFired):
1083         (WebCore::HTMLMediaElement::mediaPlayerDidAddTextTrack):
1084         (WebCore::HTMLMediaElement::didAddTextTrack):
1085         (WebCore::HTMLMediaElement::didRemoveTextTrack):
1086         (WebCore::controllerJSValue):
1087         (WebCore::HTMLMediaElement::configureTextTracks):
1088         (WebCore::HTMLMediaElement::selectNextSourceChild):
1089         (WebCore::HTMLMediaElement::sourceWasAdded):
1090         (WebCore::HTMLMediaElement::sourceWasRemoved):
1091         (WebCore::HTMLMediaElement::mediaPlayerTimeChanged):
1092         (WebCore::HTMLMediaElement::mediaPlayerCharacteristicChanged):
1093         (WebCore::HTMLMediaElement::potentiallyPlaying const):
1094         (WebCore::HTMLMediaElement::endedPlayback const):
1095         (WebCore::HTMLMediaElement::stoppedDueToErrors const):
1096         (WebCore::HTMLMediaElement::updatePlayState):
1097         (WebCore::HTMLMediaElement::userCancelledLoad):
1098         (WebCore::HTMLMediaElement::canSuspendForDocumentSuspension const):
1099         (WebCore::HTMLMediaElement::addEventListener):
1100         (WebCore::HTMLMediaElement::isFullscreen const):
1101         (WebCore::HTMLMediaElement::toggleStandardFullscreenState):
1102         (WebCore::HTMLMediaElement::waitForPreparedForInlineThen):
1103         (WebCore::HTMLMediaElement::setVideoFullscreenLayer):
1104         (WebCore::HTMLMediaElement::updateTextTrackDisplay):
1105         (WebCore::HTMLMediaElement::mediaControls const):
1106         (WebCore::HTMLMediaElement::configureTextTrackDisplay):
1107         (WebCore::HTMLMediaElement::setMediaGroup):
1108         (WebCore::HTMLMediaElement::setControllerForBindings):
1109         (WebCore::HTMLMediaElement::isBlockedOnMediaController const):
1110         (WebCore::HTMLMediaElement::prepareMediaFragmentURI):
1111         (WebCore::HTMLMediaElement::didAddUserAgentShadowRoot):
1112         (WebCore::HTMLMediaElement::fileSize const):
1113         (WebCore::HTMLMediaElement::mediaSessionTitle const):
1114         (WebCore::needsSeekingSupportQuirk):
1115         (WebCore::HTMLMediaElement::supportsSeeking const):
1116         (WebCore::HTMLMediaElement::doesHaveAttribute const):
1117         (WebCore::HTMLMediaElement::isVideoTooSmallForInlinePlayback):
1118         * loader/DocumentLoader.cpp:
1119         (WebCore::DocumentLoader::continueAfterContentPolicy):
1120         * loader/EmptyClients.cpp:
1121         * loader/FrameLoaderClient.h:
1122         * loader/cache/CachedCSSStyleSheet.cpp:
1123         (WebCore::CachedCSSStyleSheet::CachedCSSStyleSheet):
1124         * loader/cache/CachedCSSStyleSheet.h:
1125         * loader/cache/CachedFont.cpp:
1126         (WebCore::CachedFont::CachedFont):
1127         * loader/cache/CachedFont.h:
1128         * loader/cache/CachedImage.cpp:
1129         (WebCore::CachedImage::CachedImage):
1130         * loader/cache/CachedImage.h:
1131         * loader/cache/CachedRawResource.cpp:
1132         (WebCore::CachedRawResource::CachedRawResource):
1133         * loader/cache/CachedRawResource.h:
1134         * loader/cache/CachedResource.cpp:
1135         (WebCore::CachedResource::CachedResource):
1136         * loader/cache/CachedResource.h:
1137         (WebCore::CachedResource::sessionID const):
1138         * loader/cache/CachedResourceLoader.cpp:
1139         (WebCore::createResource):
1140         (WebCore::CachedResourceLoader::sessionID const):
1141         * loader/cache/CachedResourceLoader.h:
1142         * loader/cache/CachedSVGDocument.cpp:
1143         (WebCore::CachedSVGDocument::CachedSVGDocument):
1144         * loader/cache/CachedSVGDocument.h:
1145         * loader/cache/CachedSVGFont.cpp:
1146         (WebCore::CachedSVGFont::CachedSVGFont):
1147         * loader/cache/CachedSVGFont.h:
1148         * loader/cache/CachedScript.cpp:
1149         (WebCore::CachedScript::CachedScript):
1150         * loader/cache/CachedScript.h:
1151         * loader/cache/CachedTextTrack.cpp:
1152         (WebCore::CachedTextTrack::CachedTextTrack):
1153         * loader/cache/CachedTextTrack.h:
1154         * loader/cache/CachedXSLStyleSheet.cpp:
1155         (WebCore::CachedXSLStyleSheet::CachedXSLStyleSheet):
1156         * loader/cache/CachedXSLStyleSheet.h:
1157         * loader/cache/MemoryCache.cpp:
1158         (WebCore::MemoryCache::sessionResourceMap const):
1159         (WebCore::MemoryCache::ensureSessionResourceMap):
1160         (WebCore::MemoryCache::resourceForRequest):
1161         (WebCore::MemoryCache::addImageToCache):
1162         (WebCore::MemoryCache::removeImageFromCache):
1163         (WebCore::MemoryCache::forEachSessionResource):
1164         (WebCore::MemoryCache::removeResourcesWithOrigins):
1165         (WebCore::MemoryCache::originsWithCache const):
1166         (WebCore::MemoryCache::evictResources):
1167         * loader/cache/MemoryCache.h:
1168         * loader/cocoa/DiskCacheMonitorCocoa.h:
1169         (WebCore::DiskCacheMonitor::sessionID const):
1170         * loader/cocoa/DiskCacheMonitorCocoa.mm:
1171         (WebCore::DiskCacheMonitor::monitorFileBackingStoreCreation):
1172         (WebCore::DiskCacheMonitor::DiskCacheMonitor):
1173         * page/CacheStorageProvider.h:
1174         * page/DatabaseProvider.h:
1175         * page/Page.cpp:
1176         (WebCore::Page::Page):
1177         (WebCore::Page::enableLegacyPrivateBrowsing):
1178         (WebCore::Page::sessionID const):
1179         (WebCore::Page::setSessionID):
1180         * page/Page.h:
1181         * page/PlugInClient.h:
1182         * page/SocketProvider.cpp:
1183         (WebCore::SocketProvider::createSocketStreamHandle):
1184         * page/SocketProvider.h:
1185         * platform/CookiesStrategy.h:
1186         * platform/WebCoreCrossThreadCopier.cpp:
1187         (WTF::PAL::SessionID>::copy):
1188         (WTF::WebCore::SessionID>::copy): Deleted.
1189         * platform/WebCoreCrossThreadCopier.h:
1190         * platform/network/CacheValidation.cpp:
1191         (WebCore::headerValueForVary):
1192         (WebCore::collectVaryingRequestHeaders):
1193         (WebCore::verifyVaryingRequestHeaders):
1194         * platform/network/CacheValidation.h:
1195         * platform/network/NetworkStorageSession.cpp:
1196         (WebCore::NetworkStorageSession::globalSessionMap):
1197         (WebCore::NetworkStorageSession::storageSession):
1198         (WebCore::NetworkStorageSession::destroySession):
1199         * platform/network/NetworkStorageSession.h:
1200         (WebCore::NetworkStorageSession::sessionID const):
1201         * platform/network/NetworkStorageSessionStub.cpp:
1202         (WebCore::NetworkStorageSession::NetworkStorageSession):
1203         (WebCore::NetworkStorageSession::ensurePrivateBrowsingSession):
1204         (WebCore::NetworkStorageSession::ensureSession):
1205         (WebCore::NetworkStorageSession::defaultStorageSession):
1206         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
1207         (WebCore::NetworkStorageSession::NetworkStorageSession):
1208         (WebCore::NetworkStorageSession::switchToNewTestingSession):
1209         (WebCore::NetworkStorageSession::defaultStorageSession):
1210         (WebCore::NetworkStorageSession::ensurePrivateBrowsingSession):
1211         (WebCore::NetworkStorageSession::ensureSession):
1212         * platform/network/cf/SocketStreamHandleImpl.h:
1213         (WebCore::SocketStreamHandleImpl::create):
1214         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
1215         (WebCore::SocketStreamHandleImpl::SocketStreamHandleImpl):
1216         * platform/network/curl/SocketStreamHandleImpl.h:
1217         (WebCore::SocketStreamHandleImpl::create):
1218         * platform/network/soup/NetworkStorageSessionSoup.cpp:
1219         (WebCore::NetworkStorageSession::NetworkStorageSession):
1220         (WebCore::NetworkStorageSession::defaultStorageSession):
1221         (WebCore::NetworkStorageSession::ensurePrivateBrowsingSession):
1222         (WebCore::NetworkStorageSession::ensureSession):
1223         (WebCore::NetworkStorageSession::switchToNewTestingSession):
1224         * platform/network/soup/SocketStreamHandleImpl.h:
1225         * platform/network/soup/SocketStreamHandleImplSoup.cpp:
1226         (WebCore::SocketStreamHandleImpl::create):
1227         * workers/DedicatedWorkerGlobalScope.cpp:
1228         (WebCore::DedicatedWorkerGlobalScope::create):
1229         (WebCore::DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope):
1230         * workers/DedicatedWorkerGlobalScope.h:
1231         * workers/DedicatedWorkerThread.cpp:
1232         (WebCore::DedicatedWorkerThread::DedicatedWorkerThread):
1233         (WebCore::DedicatedWorkerThread::createWorkerGlobalScope):
1234         * workers/DedicatedWorkerThread.h:
1235         * workers/Worker.cpp:
1236         (WebCore::Worker::notifyFinished):
1237         * workers/WorkerGlobalScope.cpp:
1238         (WebCore::WorkerGlobalScope::WorkerGlobalScope):
1239         * workers/WorkerGlobalScope.h:
1240         * workers/WorkerGlobalScopeProxy.h:
1241         * workers/WorkerMessagingProxy.cpp:
1242         (WebCore::WorkerMessagingProxy::startWorkerGlobalScope):
1243         * workers/WorkerMessagingProxy.h:
1244         * workers/WorkerThread.cpp:
1245         (WebCore::WorkerThreadStartupData::WorkerThreadStartupData):
1246         (WebCore::WorkerThread::WorkerThread):
1247         * workers/WorkerThread.h:
1248         * workers/service/ServiceWorkerContainer.h:
1249         * workers/service/ServiceWorkerRegistrationParameters.h:
1250
1251 2017-08-17  Carlos Garcia Campos  <cgarcia@igalia.com>
1252
1253         [GTK][WPE] Add NTLM authentication enabled API
1254         https://bugs.webkit.org/show_bug.cgi?id=122952
1255
1256         Reviewed by Michael Catanzaro.
1257
1258         Add/remove NTLM feature to/from soup session depending on whether the feature is enabled or disabled.
1259
1260         * platform/network/soup/SoupNetworkSession.cpp:
1261         (WebCore::SoupNetworkSession::SoupNetworkSession):
1262         (WebCore::SoupNetworkSession::setInitialNTLMAuthenticationEnabled):
1263         (WebCore::SoupNetworkSession::setNTLMAuthenticationEnabled):
1264         * platform/network/soup/SoupNetworkSession.h:
1265
1266 2017-08-16  Ryosuke Niwa  <rniwa@webkit.org>
1267
1268         Add the support for mutating clipboard data via DataTransferItemList
1269         https://bugs.webkit.org/show_bug.cgi?id=175639
1270
1271         Reviewed by Wenson Hsieh.
1272
1273         Added the support for adding plaintext data via dataTransfer.items.add, clearing data via clear,
1274         and removing an entry via remove. When DataTransferItem is removed from DataTransferItemList,
1275         we must put into the disabled mode.
1276
1277         To support the removal of DataTransferItem, this patch replaces a reference to DataTransfer by
1278         a WeakPtr to DataTransferItemList, and stops forwarding ref from DataTransferItem to DataTransfer.
1279         This means that DataTransfer can now be GC'ed before DataTransferItem is GC'ed.
1280
1281         Because the identify and the order of DataTransferItems need to be preserved, we can't simply
1282         re-popluate m_itemList in DataTransferItemList. Instead, whenever the clipboard content is mutated,
1283         we make the parallel modifications to m_itemList. This includes changes made via DataTransfer
1284         methods such as setData and clearData.
1285
1286         Test: editing/pasteboard/datatransfer-items-copy-plaintext.html
1287
1288         * dom/DataTransfer.cpp:
1289         (WebCore::DataTransfer::clearData): Invoke didClearStringData when m_itemList exists.
1290         (WebCore::DataTransfer::setData): Ditto.
1291         (WebCore::DataTransfer::createForInputEvent):
1292         (WebCore::DataTransfer::createForDrag):
1293         (WebCore::DataTransfer::createForDrop):
1294         * dom/DataTransferItem.cpp:
1295         (WebCore::DataTransferItem::create):
1296         (WebCore::DataTransferItem::DataTransferItem):
1297         (WebCore::DataTransferItem::clearListAndPutIntoDisabledMode): Added.
1298         (WebCore::DataTransferItem::type const): Moved from the header.
1299         (WebCore::DataTransferItem::getAsString const):
1300         (WebCore::DataTransferItem::getAsFile const):
1301         * dom/DataTransferItem.h:
1302         (WebCore::DataTransferItem::ref): Deleted.
1303         (WebCore::DataTransferItem::deref): Deleted.
1304         (WebCore::DataTransferItem::isFile const): Added.
1305         (WebCore::DataTransferItem::type const): Move to the cpp file.
1306         * dom/DataTransferItemList.cpp:
1307         (WebCore::isSupportedType): Moved.
1308         (WebCore::DataTransferItemList::DataTransferItemList): Moved from the header.
1309         (WebCore::DataTransferItemList::~DataTransferItemList): Added.
1310         (WebCore::DataTransferItemList::item):
1311         (WebCore::DataTransferItemList::add): Implemented the variant to add string data.
1312         (WebCore::DataTransferItemList::remove): Implemented. For now, we don't have to deal with removing
1313         a file since a writable dataTransfer never contains a File object.
1314         (WebCore::DataTransferItemList::clear): Implemented.
1315         (WebCore::DataTransferItemList::ensureItems const):
1316         (WebCore::removeStringItemOfLowercasedType): Added.
1317         (WebCore::DataTransferItemList::didClearStringData): Called when dataTransfer.clear is called.
1318         (WebCore::DataTransferItemList::didSetStringData): Ditto for 
1319         * dom/DataTransferItemList.h:
1320         (WebCore::DataTransferItemList): Added a WeakPtrFactory. Also use a vector of Ref<DataTransferItem>
1321         instead of unique_ptr<DataTransferItem> since DataTransferItem can outlive DataTransferItemList.
1322         (WebCore::DataTransferItemList::dataTransfer): Added.
1323         * dom/DataTransferItemList.idl:
1324
1325 2017-08-16  Andy Estes  <aestes@apple.com>
1326
1327         [Apple Pay] Rename PaymentRequest to ApplePaySessionPaymentRequest
1328         https://bugs.webkit.org/show_bug.cgi?id=175648
1329
1330         Reviewed by Tim Horton.
1331
1332         The W3C Payment Request API defines an interface called PaymentRequest, which conflicts with
1333         an existing Apple Pay class. This patch renames PaymentRequest to
1334         ApplePaySessionPaymentRequest so that a follow-on patch can introduce PaymentRequest for the
1335         W3C API.
1336
1337         * Modules/applepay/ApplePayError.h:
1338         * Modules/applepay/ApplePayLineItem.h:
1339         * Modules/applepay/ApplePayPaymentRequest.h:
1340         * Modules/applepay/ApplePaySession.cpp:
1341         (WebCore::convertAndValidateTotal):
1342         (WebCore::convertAndValidate):
1343         (WebCore::ApplePaySession::ApplePaySession):
1344         (WebCore::ApplePaySession::didSelectShippingMethod):
1345         * Modules/applepay/ApplePaySession.h:
1346         * Modules/applepay/ApplePaySessionPaymentRequest.cpp: Renamed from Source/WebCore/Modules/applepay/PaymentRequest.cpp.
1347         (WebCore::ApplePaySessionPaymentRequest::ApplePaySessionPaymentRequest):
1348         (WebCore::ApplePaySessionPaymentRequest::~ApplePaySessionPaymentRequest):
1349         (WebCore::ApplePaySessionPaymentRequest::isValidSupportedNetwork):
1350         * Modules/applepay/ApplePaySessionPaymentRequest.h: Renamed from Source/WebCore/Modules/applepay/PaymentRequest.h.
1351         * Modules/applepay/ApplePayShippingMethodSelectedEvent.cpp:
1352         (WebCore::convert):
1353         (WebCore::ApplePayShippingMethodSelectedEvent::ApplePayShippingMethodSelectedEvent):
1354         * Modules/applepay/ApplePayShippingMethodSelectedEvent.h:
1355         * Modules/applepay/PaymentCoordinator.cpp:
1356         (WebCore::PaymentCoordinator::beginPaymentSession):
1357         (WebCore::PaymentCoordinator::didSelectShippingMethod):
1358         * Modules/applepay/PaymentCoordinator.h:
1359         * Modules/applepay/PaymentCoordinatorClient.h:
1360         * Modules/applepay/PaymentHeaders.h:
1361         * Modules/applepay/PaymentRequestValidator.cpp:
1362         (WebCore::PaymentRequestValidator::validate):
1363         (WebCore::PaymentRequestValidator::validateTotal):
1364         (WebCore::validateMerchantCapabilities):
1365         (WebCore::validateShippingMethod):
1366         (WebCore::validateShippingMethods):
1367         * Modules/applepay/PaymentRequestValidator.h:
1368         * WebCore.xcodeproj/project.pbxproj:
1369         * loader/EmptyClients.cpp:
1370
1371 2017-08-16  Chris Dumez  <cdumez@apple.com>
1372
1373         Cross origin Beacon requests with a ArrayBuffer / ArrayBufferView payload should not do a CORS preflight
1374         https://bugs.webkit.org/show_bug.cgi?id=175628
1375         <rdar://problem/33919278>
1376
1377         Reviewed by Geoffrey Garen.
1378
1379         Cross origin Beacon requests with a ArrayBuffer / ArrayBufferView payload should not do a CORS preflight.
1380         To achieve this, the following changes were made:
1381         1. Revert r220779 which caused us to use a non CORS-safelisted Content-Type header for such payload
1382         2. Teach PingLoad how to deal with "simple" cross origin requests (i.e. Don't assume we need a CORS
1383            preflight merely because the fetch mode is set to "cors").
1384
1385         Test: http/wpt/beacon/cors/crossorigin-arraybufferview-no-preflight.html
1386
1387         * Modules/fetch/FetchBody.cpp:
1388         (WebCore::FetchBody::extract):
1389         * loader/CrossOriginAccessControl.h:
1390         * loader/LoaderStrategy.h:
1391         * loader/PingLoader.cpp:
1392         (WebCore::PingLoader::loadImage):
1393         (WebCore::PingLoader::sendPing):
1394         (WebCore::PingLoader::sendViolationReport):
1395         (WebCore::PingLoader::startPingLoad):
1396         * loader/PingLoader.h:
1397         * loader/cache/CachedResource.cpp:
1398         (WebCore::CachedResource::CachedResource):
1399         (WebCore::CachedResource::load):
1400         * loader/cache/CachedResource.h:
1401         * loader/cache/CachedResourceRequest.cpp:
1402         (WebCore::CachedResourceRequest::CachedResourceRequest):
1403         * loader/cache/CachedResourceRequest.h:
1404         (WebCore::CachedResourceRequest::releaseOriginalRequestHeaders):
1405         * platform/network/HTTPHeaderValues.cpp:
1406         * platform/network/HTTPHeaderValues.h:
1407
1408 2017-08-16  Matt Baker  <mattbaker@apple.com>
1409
1410         Web Inspector: capture async stack trace when workers/main context posts a message
1411         https://bugs.webkit.org/show_bug.cgi?id=167084
1412         <rdar://problem/30033673>
1413
1414         Reviewed by Brian Burg.
1415
1416         Add instrumentation to DOMWindow to support showing asynchronous
1417         stack traces when the debugger pauses in a MessageEvent handler.
1418
1419         Test: inspector/debugger/async-stack-trace.html
1420
1421         * inspector/InspectorInstrumentation.cpp:
1422         (WebCore::InspectorInstrumentation::didPostMessageImpl):
1423         (WebCore::InspectorInstrumentation::didFailPostMessageImpl):
1424         (WebCore::InspectorInstrumentation::willDispatchPostMessageImpl):
1425         (WebCore::InspectorInstrumentation::didDispatchPostMessageImpl):
1426
1427         * inspector/InspectorInstrumentation.h:
1428         (WebCore::InspectorInstrumentation::didPostMessage):
1429         (WebCore::InspectorInstrumentation::didFailPostMessage):
1430         (WebCore::InspectorInstrumentation::willDispatchPostMessage):
1431         (WebCore::InspectorInstrumentation::didDispatchPostMessage):
1432
1433         * inspector/PageDebuggerAgent.cpp:
1434         (WebCore::PageDebuggerAgent::didClearAsyncStackTraceData):
1435         (WebCore::PageDebuggerAgent::didPostMessage):
1436         (WebCore::PageDebuggerAgent::didFailPostMessage):
1437         (WebCore::PageDebuggerAgent::willDispatchPostMessage):
1438         (WebCore::PageDebuggerAgent::didDispatchPostMessage):
1439         * inspector/PageDebuggerAgent.h:
1440
1441         * page/DOMWindow.cpp:
1442         (WebCore::DOMWindow::postMessage):
1443         (WebCore::DOMWindow::postMessageTimerFired):
1444
1445 2017-08-16  Timothy Horton  <timothy_horton@apple.com>
1446
1447         Try to fix the build
1448
1449         * platform/ios/PlatformPasteboardIOS.mm:
1450
1451 2017-08-16  Simon Fraser  <simon.fraser@apple.com>
1452
1453         Build fix after r220812
1454
1455         Fix builds where LOG_DISABLED is defined.
1456
1457         * css/MediaQueryEvaluator.cpp:
1458
1459 2017-08-16  Simon Fraser  <simon.fraser@apple.com>
1460
1461         Add a log channel for media queries
1462         https://bugs.webkit.org/show_bug.cgi?id=175591
1463
1464         Reviewed by Zalan Bujtas.
1465
1466         Add a "MediaQueries" log channel which logs data about media query evaluation.
1467
1468         * css/MediaList.cpp:
1469         (WebCore::MediaQuerySet::MediaQuerySet):
1470         (WebCore::operator<<):
1471         * css/MediaList.h:
1472         * css/MediaQuery.cpp:
1473         (WebCore::operator<<):
1474         * css/MediaQuery.h:
1475         * css/MediaQueryEvaluator.cpp:
1476         (WebCore::operator<<):
1477         (WebCore::MediaQueryEvaluator::evaluate const):
1478         (WebCore::aspectRatioValueAsString):
1479         (WebCore::orientationEvaluate):
1480         (WebCore::aspectRatioEvaluate):
1481         (WebCore::deviceAspectRatioEvaluate):
1482         (WebCore::evaluateResolution):
1483         (WebCore::deviceHeightEvaluate):
1484         (WebCore::deviceWidthEvaluate):
1485         (WebCore::heightEvaluate):
1486         (WebCore::widthEvaluate):
1487         * css/MediaQueryExpression.cpp:
1488         (WebCore::operator<<):
1489         * css/MediaQueryExpression.h:
1490         * css/MediaQueryMatcher.cpp:
1491         (WebCore::MediaQueryMatcher::styleResolverChanged):
1492         * css/StyleResolver.cpp:
1493         (WebCore::StyleResolver::hasMediaQueriesAffectedByViewportChange const):
1494         (WebCore::StyleResolver::hasMediaQueriesAffectedByAccessibilitySettingsChange const):
1495         * dom/InlineStyleSheetOwner.cpp:
1496         (WebCore::InlineStyleSheetOwner::createSheet):
1497         * html/HTMLImageElement.cpp:
1498         (WebCore::HTMLImageElement::bestFitSourceFromPictureElement):
1499         * html/HTMLLinkElement.cpp:
1500         (WebCore::HTMLLinkElement::process):
1501         * html/HTMLMediaElement.cpp:
1502         (WebCore::HTMLMediaElement::selectNextSourceChild):
1503         * html/HTMLPictureElement.cpp:
1504         (WebCore::HTMLPictureElement::viewportChangeAffectedPicture const):
1505         * html/parser/HTMLPreloadScanner.cpp:
1506         (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute):
1507         * page/FrameView.cpp:
1508         (WebCore::FrameView::layout):
1509         * platform/Logging.cpp:
1510         (WebCore::initializeLogChannelsIfNecessary):
1511         * platform/Logging.h:
1512         * platform/URL.cpp:
1513         (WebCore::isSchemeFirstChar):
1514         (WebCore::operator<<):
1515         * platform/URL.h:
1516
1517 2017-08-16  Sam Weinig  <sam@webkit.org>
1518
1519         [WebIDL] Remove the need for JSSubtleCryptoCustom.cpp
1520         https://bugs.webkit.org/show_bug.cgi?id=175526
1521
1522         Reviewed by Chris Dumez.
1523
1524         - Generates bindings for all of SubtleCrypto except AlgorithmIdentifier normalization, 
1525           which is defined in the WebCrypto spec to happen after normal IDL operations.
1526         - Adds initial support for IDL object types in unions (some, unneeded at the moment,
1527           edge cases remain).
1528
1529         * CMakeLists.txt:
1530         * WebCore.xcodeproj/project.pbxproj:
1531         * bindings/js/JSSubtleCryptoCustom.cpp: Removed.
1532
1533             Remove JSSubtleCryptoCustom.cpp, added CryptoKeyFormat.h
1534
1535         * bindings/js/JSDOMConvertObject.h:
1536
1537             Add needed, when included in generated code, #include of StrongInlines.h
1538
1539         * bindings/js/JSDOMConvertUnion.h:
1540         
1541             Add initial support for object (needed for AlgorithmIdentifier which is 
1542             (object or DOMString)). Remaining support will be handled by https://webkit.org/b/175616
1543
1544             Also add remaining spec comments while in the area.
1545
1546         * bindings/js/JSDOMPromiseDeferred.cpp:
1547         (WebCore::DeferredPromise::reject):
1548
1549             Add support for the special ExistingExceptionError error code. Capturing
1550             the current exception and using it as the rejection value.
1551
1552         * crypto/SubtleCrypto.cpp:
1553         (WebCore::SubtleCrypto::~SubtleCrypto):
1554         (WebCore::toHashIdentifier):
1555         (WebCore::normalizeCryptoAlgorithmParameters):
1556         (WebCore::toCryptoKeyUsageBitmap):
1557         (WebCore::rejectWithException):
1558         (WebCore::normalizeJsonWebKey):
1559         (WebCore::toKeyData):
1560         (WebCore::copyToVector):
1561         (WebCore::isSupportedExportKey):
1562         (WebCore::SubtleCrypto::encrypt):
1563         (WebCore::SubtleCrypto::decrypt):
1564         (WebCore::SubtleCrypto::sign):
1565         (WebCore::SubtleCrypto::verify):
1566         (WebCore::SubtleCrypto::digest):
1567         (WebCore::SubtleCrypto::generateKey):
1568         (WebCore::SubtleCrypto::deriveKey):
1569         (WebCore::SubtleCrypto::deriveBits):
1570         (WebCore::SubtleCrypto::importKey):
1571         (WebCore::SubtleCrypto::exportKey):
1572         (WebCore::SubtleCrypto::wrapKey):
1573         (WebCore::SubtleCrypto::unwrapKey):
1574         * crypto/SubtleCrypto.h:
1575         * crypto/SubtleCrypto.idl:
1576
1577             Moves implementation from JSSubtleCryptoCustom.cpp -> here. Important changes that come
1578             with that are:
1579             - All parameters are now converted / type checked for us.
1580             - Rather than throwing exceptions and expecting the bindings layer to convert
1581               them to promise rejections, all rejections are now explicitly made.
1582             - Algorithms are no longer checked for being supported twice, once in normalizeCryptoAlgorithmParameters
1583               and then again in the operation. We instead rely on normalizeCryptoAlgorithmParameters to return
1584               an Exception if its not supported.
1585             - Shaves 251 lines off the file.
1586
1587         * crypto/CryptoKeyFormat.h: Added.
1588
1589             Add new header for unified key format enum. (For bindings purposes, SubtleCrypto
1590             re aliases it to SubtleCrypto::KeyFormat).
1591
1592         * bindings/js/JSWebKitSubtleCryptoCustom.cpp:
1593         * crypto/CryptoAlgorithm.cpp:
1594         * crypto/CryptoAlgorithm.h:
1595         * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
1596         * crypto/algorithms/CryptoAlgorithmAES_CBC.h:
1597         * crypto/algorithms/CryptoAlgorithmAES_CFB.cpp:
1598         * crypto/algorithms/CryptoAlgorithmAES_CFB.h:
1599         * crypto/algorithms/CryptoAlgorithmAES_CTR.cpp:
1600         * crypto/algorithms/CryptoAlgorithmAES_CTR.h:
1601         * crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:
1602         * crypto/algorithms/CryptoAlgorithmAES_GCM.h:
1603         * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
1604         * crypto/algorithms/CryptoAlgorithmAES_KW.h:
1605         * crypto/algorithms/CryptoAlgorithmECDH.cpp:
1606         * crypto/algorithms/CryptoAlgorithmECDH.h:
1607         * crypto/algorithms/CryptoAlgorithmECDSA.cpp:
1608         * crypto/algorithms/CryptoAlgorithmECDSA.h:
1609         * crypto/algorithms/CryptoAlgorithmHKDF.cpp:
1610         * crypto/algorithms/CryptoAlgorithmHKDF.h:
1611         * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
1612         * crypto/algorithms/CryptoAlgorithmHMAC.h:
1613         * crypto/algorithms/CryptoAlgorithmPBKDF2.cpp:
1614         * crypto/algorithms/CryptoAlgorithmPBKDF2.h:
1615         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
1616         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h:
1617         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
1618         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h:
1619         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
1620         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h:
1621         * crypto/algorithms/CryptoAlgorithmRSA_PSS.cpp:
1622         * crypto/algorithms/CryptoAlgorithmRSA_PSS.h:
1623
1624             Use CryptoKeyFormat enum directly, rather than SubtleCrypto::KeyFormat,
1625             to allow not including SubtleCrypto.h.
1626
1627         * crypto/parameters/CryptoAlgorithmEcdsaParams.h:
1628         * crypto/parameters/CryptoAlgorithmHkdfParams.h:
1629         * crypto/parameters/CryptoAlgorithmHmacKeyParams.h:
1630         * crypto/parameters/CryptoAlgorithmPbkdf2Params.h:
1631         * crypto/parameters/CryptoAlgorithmRsaHashedImportParams.h:
1632         * crypto/parameters/CryptoAlgorithmRsaHashedKeyGenParams.h:
1633         * crypto/parameters/EcdsaParams.idl:
1634         * crypto/parameters/HkdfParams.idl:
1635         * crypto/parameters/HmacKeyParams.idl:
1636         * crypto/parameters/Pbkdf2Params.idl:
1637         * crypto/parameters/RsaHashedImportParams.idl:
1638         * crypto/parameters/RsaHashedKeyGenParams.idl:
1639
1640             Update IDLs and implementations to use the correct definition of HashAlgorithmIdentifier,
1641             which is (object or DOMString), now that it is supported.
1642
1643 2017-08-16  Youenn Fablet  <youenn@apple.com>
1644
1645         [Cache API] Implement Worker connection to the Cache storage engine
1646         https://bugs.webkit.org/show_bug.cgi?id=175599
1647
1648         Reviewed by Chris Dumez.
1649
1650         Covered by existing tests.
1651
1652         Adding a WorkerCacheStorageConnection to connect workers Cache/CacheStorage
1653         to the cache storage engine.
1654         WorkerCacheStorageConnection does this by hopping to the main thread to call the document cache storage connection to do the actual job.
1655         Doing some CacheStorageConnection refactoring to share code with WK2 implementation of the cache storage connection. 
1656
1657         * Modules/cache/CacheQueryOptions.h:
1658         (WebCore::CacheQueryOptions::isolatedCopy const):
1659         * Modules/cache/CacheStorageConnection.cpp:
1660         (WebCore::CacheStorageConnection::open):
1661         (WebCore::CacheStorageConnection::remove):
1662         (WebCore::CacheStorageConnection::retrieveCaches):
1663         (WebCore::CacheStorageConnection::retrieveRecords):
1664         (WebCore::CacheStorageConnection::batchDeleteOperation):
1665         (WebCore::CacheStorageConnection::batchPutOperation):
1666         (WebCore::CacheStorageConnection::openOrRemoveCompleted):
1667         (WebCore::CacheStorageConnection::updateCaches):
1668         (WebCore::CacheStorageConnection::updateRecords):
1669         (WebCore::CacheStorageConnection::removeRecordsCompleted):
1670         (WebCore::CacheStorageConnection::putRecordsCompleted):
1671         * Modules/cache/CacheStorageConnection.h:
1672         (WebCore::CacheStorageConnection::openCompleted):
1673         (WebCore::CacheStorageConnection::removeCompleted):
1674         (WebCore::CacheStorageConnection::doOpen):
1675         (WebCore::CacheStorageConnection::doRemove):
1676         (WebCore::CacheStorageConnection::doRetrieveCaches):
1677         (WebCore::CacheStorageConnection::doRetrieveRecords):
1678         (WebCore::CacheStorageConnection::doBatchDeleteOperation):
1679         (WebCore::CacheStorageConnection::doBatchPutOperation):
1680         * Modules/cache/WorkerCacheStorageConnection.cpp: Added.
1681         (WebCore::toCrossThreadRecordData):
1682         (WebCore::fromCrossThreadRecordData):
1683         (WebCore::WorkerCacheStorageConnection::create):
1684         (WebCore::WorkerCacheStorageConnection::WorkerCacheStorageConnection):
1685         (WebCore::WorkerCacheStorageConnection::doOpen):
1686         (WebCore::WorkerCacheStorageConnection::doRemove):
1687         (WebCore::WorkerCacheStorageConnection::doRetrieveCaches):
1688         (WebCore::WorkerCacheStorageConnection::doRetrieveRecords):
1689         (WebCore::WorkerCacheStorageConnection::doBatchDeleteOperation):
1690         (WebCore::WorkerCacheStorageConnection::doBatchPutOperation):
1691         * Modules/cache/WorkerCacheStorageConnection.h: Added.
1692         * Modules/cache/WorkerGlobalScopeCaches.cpp:
1693         (WebCore::WorkerGlobalScopeCaches::caches const):
1694         * WebCore.xcodeproj/project.pbxproj:
1695         * loader/FetchOptions.h:
1696         (WebCore::FetchOptions::isolatedCopy const):
1697         * workers/WorkerGlobalScope.cpp:
1698         (WebCore::WorkerGlobalScope::cacheStorageConnection):
1699         * workers/WorkerGlobalScope.h:
1700
1701 2017-08-16  Yoshiaki Jitsukawa  <Yoshiaki.Jitsukawa@sony.com>
1702
1703         [PAL] Move spi/ios and spi/win directories into PAL
1704         https://bugs.webkit.org/show_bug.cgi?id=175171
1705
1706         Reviewed by Antti Koivisto.
1707
1708         * PlatformWin.cmake:
1709         * WebCore.xcodeproj/project.pbxproj:
1710         * editing/cocoa/DataDetection.mm:
1711         * loader/ios/PreviewLoader.mm:
1712         * page/CaptionUserPreferencesMediaAF.cpp:
1713         * page/cocoa/MemoryReleaseCocoa.mm:
1714         * page/cocoa/SettingsCocoa.mm:
1715         * page/ios/UserAgentIOS.mm:
1716         * platform/audio/ios/MediaSessionManagerIOS.mm:
1717         * platform/graphics/ca/PlatformCALayer.cpp:
1718         * platform/graphics/cocoa/FontCascadeCocoa.mm:
1719         * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
1720         * platform/graphics/opentype/OpenTypeCG.h:
1721         * platform/graphics/win/SimpleFontDataCGWin.cpp:
1722         * platform/graphics/win/SimpleFontDataDirect2D.cpp:
1723         * platform/ios/Device.h:
1724         * platform/ios/PlatformPasteboardIOS.mm:
1725         * platform/ios/PlatformScreenIOS.mm:
1726         * platform/ios/QuickLookSoftLink.h:
1727         * platform/ios/QuickLookSoftLink.mm:
1728         * platform/ios/ValidationBubbleIOS.mm:
1729         * platform/ios/WebItemProviderPasteboard.mm:
1730         * platform/network/ios/PreviewConverter.mm:
1731         * platform/sql/SQLiteFileSystem.cpp:
1732         * rendering/RenderThemeIOS.mm:
1733
1734 2017-08-16  Tim Horton  <timothy_horton@apple.com>
1735
1736         2-3% of main thread time under UTTypeCreatePreferredIdentifierForTag on wunderground map
1737         https://bugs.webkit.org/show_bug.cgi?id=175618
1738
1739         Reviewed by Simon Fraser.
1740
1741         No new tests, just a perf win.
1742
1743         UTTypeCreatePreferredIdentifierForTag is fairly expensive, and is called
1744         under every toDataURL, which the Wunderground wundermap does a /lot/.
1745
1746         Keep a 16-item LRU cache of MIMEType->UTI mappings.
1747
1748         Also, make other callers of UTTypeCreatePreferredIdentifierForTag use
1749         the UTIUtilities version so they can share in the caching.
1750
1751         Also, as a drive-by, add and make other callers use mimeTypeFromUTI too,
1752         and make the UTIUtilities operate on Strings for a slightly more WebCore-y feel.
1753
1754         * editing/ios/EditorIOS.mm:
1755         (WebCore::Editor::WebContentReader::readImage):
1756         * platform/MIMETypeRegistry.cpp:
1757         (WebCore::initializeSupportedImageMIMETypes):
1758         (WebCore::initializeSupportedImageMIMETypesForEncoding):
1759         * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
1760         (WebCore::createFileTypesSet):
1761         * platform/graphics/cg/ImageSourceCGMac.mm:
1762         (WebCore::MIMETypeForImageSourceType):
1763         Adopt newly-added MIMETypeFromUTI().
1764
1765         * platform/graphics/cg/ImageBufferCG.cpp:
1766         (WebCore::utiFromImageBufferMIMEType):
1767         (WebCore::ImageBuffer::toCFData const):
1768         (WebCore::cfData):
1769         (WebCore::utiFromMIMEType): Deleted.
1770         Adopt UTIFromMIMEType, and rename the local helper that does something
1771         different (a small static map) on iOS and Windows to not have an overlapping name.
1772
1773         * platform/ios/PasteboardIOS.mm:
1774         (WebCore::Pasteboard::resourceMIMEType):
1775         (WebCore::utiTypeFromCocoaType):
1776         Adopt UTIFromMIMEType().
1777
1778         * platform/ios/PlatformPasteboardIOS.mm:
1779         (WebCore::PlatformPasteboard::writeObjectRepresentations):
1780         * platform/mac/PasteboardMac.mm:
1781         (WebCore::cocoaTypeFromHTMLClipboardType):
1782         Adopt isDeclaredUTI and UTIFromMIMEType().
1783
1784         * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
1785         (WebCore::WebCoreAVFResourceLoader::responseReceived):
1786         * platform/network/ios/WebCoreURLResponseIOS.mm:
1787         (WebCore::adjustMIMETypeIfNecessary):
1788         * platform/network/mac/WebCoreURLResponse.mm:
1789         (WebCore::adjustMIMETypeIfNecessary):
1790         * rendering/RenderThemeIOS.mm:
1791         (WebCore::iconForAttachment):
1792         * rendering/RenderThemeMac.mm:
1793         (WebCore::iconForAttachment):
1794         Deal with the fact that UTI utilities deal in Strings now.
1795
1796         * platform/network/mac/UTIUtilities.h:
1797         * platform/network/mac/UTIUtilities.mm:
1798         (WebCore::MIMETypeFromUTI):
1799         Added. This doesn't crawl up the UTI tree if the first conversion fails,
1800         which is what most of the existing code does. It's possible we want to
1801         use MIMETypeFromUTITree's logic everywhere, but I didn't want to change
1802         that in this patch.
1803
1804         (WebCore::MIMETypeFromUTITree):
1805         (WebCore::isDeclaredUTI):
1806         Take and return strings.
1807
1808         (WebCore::UTIFromMIMETypeCachePolicy::createValueForKey):
1809         (WebCore::UTIFromMIMEType):
1810         Add the aforementioned cache.
1811
1812 2017-08-16  Simon Fraser  <simon.fraser@apple.com>
1813
1814         Make RenderLayer and RenderLayerBacking TextStream-loggable, and clean up compositing logging
1815         https://bugs.webkit.org/show_bug.cgi?id=175634
1816
1817         Reviewed by Zalan Bujtas.
1818
1819         Add operator<<(TextStream&) for RenderLayer and RenderLayer backing, and use them for compositing logging.
1820
1821         Convert CompositingUpdateType to an enum class.
1822
1823         * page/FrameView.cpp:
1824         (WebCore::FrameView::updateCompositingLayersAfterLayout):
1825         (WebCore::FrameView::updateCompositingLayersAfterScrolling):
1826         * page/ios/FrameIOS.mm:
1827         (WebCore::Frame::viewportOffsetChanged):
1828         * rendering/RenderLayer.cpp:
1829         (WebCore::RenderLayer::updateLayerPositionsAfterLayout):
1830         (WebCore::RenderLayer::updateCompositingLayersAfterScroll):
1831         (WebCore::RenderLayer::calculateClipRects const):
1832         * rendering/RenderLayer.h:
1833         * rendering/RenderLayerBacking.cpp:
1834         (WebCore::RenderLayerBacking::updateAfterLayout):
1835         (WebCore::RenderLayerBacking::updateGeometry):
1836         (WebCore::operator<<):
1837         * rendering/RenderLayerBacking.h:
1838         * rendering/RenderLayerCompositor.cpp:
1839         (WebCore::RenderLayerCompositor::didRecalcStyleWithNoPendingLayout):
1840         (WebCore::RenderLayerCompositor::flushPendingLayerChanges):
1841         (WebCore::RenderLayerCompositor::updateCompositingLayersTimerFired):
1842         (WebCore::RenderLayerCompositor::updateCompositingLayers):
1843         (WebCore::RenderLayerCompositor::layerTreeAsText):
1844         (WebCore::operator<<):
1845         * rendering/RenderLayerCompositor.h:
1846
1847 2017-08-16  Eric Carlson  <eric.carlson@apple.com>
1848
1849         Consider allow gUM to be called from localhost without https
1850         https://bugs.webkit.org/show_bug.cgi?id=173457
1851         <rdar://problem/33900527>
1852
1853         Reviewed by Youenn Fablet.
1854
1855         Tests: http/tests/media/media-stream/get-user-media-localhost.html
1856                http/tests/media/media-stream/get-user-media-loopback-ip.html
1857
1858         * Modules/mediastream/UserMediaRequest.cpp:
1859         (WebCore::isSecure): Call SchemeRegistry::shouldTreatURLSchemeAsSecure instead of looking for
1860         the string 'https'.
1861         (WebCore::canCallGetUserMedia): Allow localhost or loopback address.
1862
1863         * page/SecurityOrigin.cpp:
1864         (WebCore::isLoopbackIPAddress): Add a comment.
1865         (WebCore::shouldTreatAsPotentionallyTrustworthy): Move tests for localhost and loopback address
1866         to isLocalHostOrLoopbackIPAddress, call it.
1867         (WebCore::SecurityOrigin::isLocalHostOrLoopbackIPAddress): 
1868         * page/SecurityOrigin.h:
1869
1870 2017-08-16  Chris Dumez  <cdumez@apple.com>
1871
1872         EventSource: ignore IDs with U+0000
1873         https://bugs.webkit.org/show_bug.cgi?id=175178
1874
1875         Reviewed by Darin Adler.
1876
1877         EventSource: ignore IDs with U+0000 as per:
1878         https://github.com/whatwg/html/pull/2849
1879
1880         Test: imported/w3c/web-platform-tests/eventsource/format-field-id-null.htm
1881
1882         * page/EventSource.cpp:
1883         (WebCore::EventSource::parseEventStreamLine):
1884
1885 2017-08-16  Fujii Hironori  <Hironori.Fujii@sony.com>
1886
1887         [HarfBuzz] Decomposed Vietnamese characters are rendered incorrectly
1888         https://bugs.webkit.org/show_bug.cgi?id=174418
1889
1890         Reviewed by Michael Catanzaro.
1891
1892         HarfBuzzShaper should normalize the input text before collecting
1893         HarfBuzzRuns. Actually, HarfBuzzShaper::setNormalizedBuffer does
1894         the task. But, this function hasn't been called from anywhere
1895         since Bug 90951.
1896
1897         Test: fast/text/international/vietnamese-nfd.html
1898               imported/blink/fast/text/international/text-shaping-arabic-diffs.html
1899
1900         * platform/graphics/harfbuzz/HarfBuzzShaper.cpp:
1901         (WebCore::HarfBuzzShaper::HarfBuzzShaper):
1902         Call setNormalizedBuffer instead of normalizeCharacters.
1903         (WebCore::normalizeCharacters): Deleted.
1904         (WebCore::normalizeSpacesAndMirrorChars) Use
1905         FontCascade::treatAsZeroWidthSpaceInComplexScript instead of
1906         FontCascade::treatAsZeroWidthSpace to preserve ZWJ and ZWNJ.
1907
1908 2017-08-16  Antti Koivisto  <antti@apple.com>
1909
1910         Move first-letter renderer mutation code out of RenderBlock and into RenderTreeUpdater
1911         https://bugs.webkit.org/show_bug.cgi?id=175627
1912
1913         Reviewed by Andreas Kling.
1914
1915         Render tree should not mutate itself. We already fixed this for first-letter, supporting code
1916         can now move to RenderTreeUpdater too.
1917
1918         * CMakeLists.txt:
1919         * WebCore.xcodeproj/project.pbxproj:
1920         * rendering/RenderBlock.cpp:
1921         (WebCore::styleForFirstLetter): Deleted.
1922         (WebCore::isPunctuationForFirstLetter): Deleted.
1923         (WebCore::shouldSkipForFirstLetter): Deleted.
1924         (WebCore::RenderBlock::updateFirstLetterStyle): Deleted.
1925         (WebCore::RenderBlock::createFirstLetterRenderer): Deleted.
1926         (WebCore::RenderBlock::updateFirstLetter): Deleted.
1927         * rendering/RenderBlock.h:
1928         * rendering/RenderRubyRun.cpp:
1929         (WebCore::RenderRubyRun::updateFirstLetter): Deleted.
1930         * rendering/RenderRubyRun.h:
1931         * rendering/RenderTable.cpp:
1932         (WebCore::RenderTable::updateFirstLetter): Deleted.
1933         * rendering/RenderTable.h:
1934
1935             Virtual overrides just disabled first letter for some RenderBlock subclasses. This is now achieved via
1936             supportsFirstLetter test in the first letter updater.
1937
1938         * rendering/TextAutoSizing.cpp:
1939         (WebCore::TextAutoSizingValue::adjustTextNodeSizes):
1940         * rendering/svg/RenderSVGText.cpp:
1941         (WebCore::RenderSVGText::updateFirstLetter): Deleted.
1942         * rendering/svg/RenderSVGText.h:
1943         * style/RenderTreeUpdater.cpp:
1944         (WebCore::RenderTreeUpdater::popParent):
1945         * style/RenderTreeUpdater.h:
1946         * style/RenderTreeUpdaterFirstLetter.cpp: Added.
1947         (WebCore::styleForFirstLetter):
1948         (WebCore::isPunctuationForFirstLetter):
1949         (WebCore::shouldSkipForFirstLetter):
1950         (WebCore::updateFirstLetterStyle):
1951         (WebCore::createFirstLetterRenderer):
1952         (WebCore::supportsFirstLetter):
1953         (WebCore::RenderTreeUpdater::FirstLetter::update):
1954         * style/RenderTreeUpdaterFirstLetter.h: Added.
1955
1956 2017-08-16  Xabier Rodriguez Calvar  <calvaris@igalia.com>
1957
1958         [GStreamer][EME] Rework handling key systems and UUIDs
1959         https://bugs.webkit.org/show_bug.cgi?id=175567
1960
1961         Reviewed by Žan Doberšek.
1962
1963         The UUIDs and key system strings were moved to the
1964         GStreamerEMEUtilities class because so far they were managed by
1965         the decryptors and that was ugly.
1966
1967         * platform/GStreamer.cmake:
1968         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1969         (WebCore::MediaPlayerPrivateGStreamerBase::supportsKeySystem):
1970         * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.cpp: Added.
1971         * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h: Added.
1972         (WebCore::GStreamerEMEUtilities::isClearKeyKeySystem):
1973         (WebCore::GStreamerEMEUtilities::keySystemToUuid):
1974         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
1975         (webkit_media_clear_key_decrypt_class_init):
1976         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.h:
1977
1978 2017-08-16  Andy Estes  <aestes@apple.com>
1979
1980         [Payment Request] Add an ENABLE flag and an experimental feature preference
1981         https://bugs.webkit.org/show_bug.cgi?id=175622
1982
1983         Reviewed by Tim Horton.
1984
1985         * Configurations/FeatureDefines.xcconfig:
1986         * page/Settings.in:
1987
1988 2017-08-15  Ryosuke Niwa  <rniwa@webkit.org>
1989
1990         Make DataTransferItemList work with plain text entries
1991         https://bugs.webkit.org/show_bug.cgi?id=175596
1992
1993         Reviewed by Wenson Hsieh.
1994
1995         Added the basic machinery to get the list of plain text items to DataTransferItemList and DataTransferItem.
1996
1997         Each DataTransferItem now depends on DataTransfer so it does ref-forwarding like DataTransferItemList to make
1998         DataTransfer alive as long as any DataTransferItem is alive.
1999
2000         Specifications: https://html.spec.whatwg.org/multipage/dnd.html#the-datatransferitem-interface
2001                         https://html.spec.whatwg.org/multipage/dnd.html#the-datatransferitemlist-interface
2002
2003         Tests: editing/pasteboard/datatransfer-items-drop-plaintext-file.html
2004                editing/pasteboard/datatransfer-items-paste-plaintext.html
2005
2006         * dom/DataTransferItem.cpp:
2007         (WebCore::DataTransferItem::DataTransferItem): Added two variants one for plain text and another one for a file.
2008         (WebCore::DataTransferItem::kind const): Rewritten.
2009         (WebCore::DataTransferItem::getAsString const): Implemented.
2010         (WebCore::DataTransferItem::getAsFile const): Implemented.
2011         * dom/DataTransferItem.h:
2012         (WebCore::DataTransferItem::ref): Added.
2013         (WebCore::DataTransferItem::deref): Added.
2014         (WebCore::DataTransferItem::type const): Returns String instead of AtomicString.
2015         (WebCore::DataTransferItem::kind const): Moved to cpp.
2016         * dom/DataTransferItem.idl: Removed NoInterfaceObject since the interface object should exist on DOMWindow.
2017         * dom/DataTransferItemList.cpp:
2018         (WebCore::DataTransferItemList::length): Implemented.
2019         (WebCore::DataTransferItemList::item): Ditto.
2020         (WebCore::isSupportedType): Added. For now, we only support text/plain.
2021         (WebCore::DataTransferItemList::ensureItems): Added. Constructs the list of DataTransferItems.
2022         * dom/DataTransferItemList.h:
2023         (DataTransferItemList): Added m_items. The list is filled lazily by ensureItems.
2024         * dom/DataTransferItemList.idl: Removed NoInterfaceObject since the interface object should exist on DOMWindow.
2025
2026 2017-08-15  Simon Fraser  <simon.fraser@apple.com>
2027
2028         Remove ScrollView::clipsRepaints() which was only used by Chromium
2029         https://bugs.webkit.org/show_bug.cgi?id=175594
2030
2031         Reviewed by Tim Horton.
2032
2033         clipsRepaints() was added in r74568 but was only used by Chromium. It's always
2034         true for other platforms, so remove conditionals that test for it and assume true.
2035
2036         * page/FrameView.cpp:
2037         (WebCore::FrameView::scrollContentsFastPath):
2038         * platform/ScrollView.cpp:
2039         (WebCore::ScrollView::repaintContentRectangle):
2040         (WebCore::ScrollView::setClipsRepaints): Deleted.
2041         * platform/ScrollView.h:
2042         (WebCore::ScrollView::clipsRepaints const): Deleted.
2043
2044 2017-08-15  Simon Fraser  <simon.fraser@apple.com>
2045
2046         Allow WebCore logging channels to be set from the UI process
2047         https://bugs.webkit.org/show_bug.cgi?id=175608
2048
2049         Reviewed by Tim Horton.
2050
2051         Change initializeLogChannelsIfNecessary() to take an optional String, which can
2052         be a list of log channels passed from the UI process.
2053
2054         * platform/LogInitialization.h:
2055         * platform/Logging.cpp:
2056         (WebCore::initializeLogChannelsIfNecessary):
2057
2058 2017-08-15  Chris Dumez  <cdumez@apple.com>
2059
2060         Fetch / Beacon: Use "application/octet-stream" Content-Type for payloads of type ArrayBuffer / ArrayBufferView
2061         https://bugs.webkit.org/show_bug.cgi?id=175600
2062
2063         Reviewed by Youenn Fablet.
2064
2065         Use "application/octet-stream" Content-Type for payloads of type ArrayBuffer / ArrayBufferView in Fetch & Beacon.
2066         If we don't set a Content-Type header, our underlying network stack is going to add a "application/x-www-form-urlencoded"
2067         Content-Type header, which is worse.
2068
2069         Chrome is already using "application/octet-stream" Content-Type in Beacon, but use no Content-Type in Fetch.
2070         The Fetch/Beacon specification says we should have no Content-Type header in this case but this is unfortunately
2071         not something we can support at the moment. Using "application/octet-stream" Content-Type for now seems like the
2072         lesser evil.
2073
2074         Test: http/wpt/fetch/fetch-request-arraybuffer-content-type.html
2075
2076         * Modules/fetch/FetchBody.cpp:
2077         (WebCore::FetchBody::extract):
2078         * platform/network/HTTPHeaderValues.cpp:
2079         (WebCore::HTTPHeaderValues::octetStreamContentType):
2080         * platform/network/HTTPHeaderValues.h:
2081
2082 2017-08-15  Robin Morisset  <rmorisset@apple.com>
2083
2084         Change the order of arguments of JSWithScope::create() for consistency
2085         https://bugs.webkit.org/show_bug.cgi?id=175585
2086
2087         Reviewed by Saam Barati.
2088
2089         No change of behavior.
2090
2091         * bindings/js/JSHTMLElementCustom.cpp:
2092         (WebCore::JSHTMLElement::pushEventHandlerScope const):
2093
2094 2017-08-15  Youenn Fablet  <youenn@apple.com>
2095
2096         [Cache API] Ensure ResourceResponse is not null when redirected/tainting/type fields are set
2097         https://bugs.webkit.org/show_bug.cgi?id=175538
2098
2099         Reviewed by Chris Dumez.
2100
2101         No change of behavior.
2102         This change ensures that response type is preserved when encoding/decoding ResourceResponse, in particular the error type.
2103         This will allow Cache API to preserve responses when reading them from a different process.
2104
2105         * platform/network/ResourceResponseBase.cpp:
2106         (WebCore::ResourceResponseBase::setType):
2107         * platform/network/ResourceResponseBase.h:
2108         (WebCore::ResourceResponseBase::setType):
2109
2110 2017-08-15  Chris Dumez  <cdumez@apple.com>
2111
2112         Update CachedResourceLoader::requestResource() to return a WTF::Expected
2113         https://bugs.webkit.org/show_bug.cgi?id=175505
2114
2115         Reviewed by Youenn Fablet.
2116
2117         Update CachedResourceLoader::requestResource() to return a WTF::Expected
2118         type instead of using an out parameter for the ResourceError in case of
2119         synchronous failure.
2120
2121         * Modules/beacon/NavigatorBeacon.cpp:
2122         (WebCore::NavigatorBeacon::sendBeacon):
2123         * bindings/js/CachedScriptFetcher.cpp:
2124         (WebCore::CachedScriptFetcher::requestScriptWithCache const):
2125         * css/CSSFontFaceSrcValue.cpp:
2126         (WebCore::CSSFontFaceSrcValue::cachedFont):
2127         * css/CSSImageSetValue.cpp:
2128         (WebCore::CSSImageSetValue::loadBestFitImage):
2129         * css/CSSImageValue.cpp:
2130         (WebCore::CSSImageValue::loadImage):
2131         * css/StyleRuleImport.cpp:
2132         (WebCore::StyleRuleImport::requestStyleSheet):
2133         * dom/ProcessingInstruction.cpp:
2134         (WebCore::ProcessingInstruction::checkStyleSheet):
2135         * html/HTMLLinkElement.cpp:
2136         (WebCore::HTMLLinkElement::process):
2137         * loader/CrossOriginPreflightChecker.cpp:
2138         (WebCore::CrossOriginPreflightChecker::startPreflight):
2139         * loader/DocumentLoader.cpp:
2140         (WebCore::DocumentLoader::startLoadingMainResource):
2141         * loader/DocumentThreadableLoader.cpp:
2142         (WebCore::DocumentThreadableLoader::loadRequest):
2143         * loader/FrameLoader.cpp:
2144         (WebCore::FrameLoader::loadedResourceFromMemoryCache):
2145         * loader/FrameLoader.h:
2146         * loader/ImageLoader.cpp:
2147         (WebCore::ImageLoader::updateFromElement):
2148         * loader/LinkLoader.cpp:
2149         (WebCore::LinkLoader::preloadIfNeeded):
2150         * loader/MediaResourceLoader.cpp:
2151         (WebCore::MediaResourceLoader::requestResource):
2152         * loader/TextTrackLoader.cpp:
2153         (WebCore::TextTrackLoader::load):
2154         * loader/cache/CachedResourceLoader.cpp:
2155         (WebCore::castCachedResourceTo):
2156         (WebCore::CachedResourceLoader::requestImage):
2157         (WebCore::CachedResourceLoader::requestFont):
2158         (WebCore::CachedResourceLoader::requestTextTrack):
2159         (WebCore::CachedResourceLoader::requestCSSStyleSheet):
2160         (WebCore::CachedResourceLoader::requestUserCSSStyleSheet):
2161         (WebCore::CachedResourceLoader::requestScript):
2162         (WebCore::CachedResourceLoader::requestXSLStyleSheet):
2163         (WebCore::CachedResourceLoader::requestSVGDocument):
2164         (WebCore::CachedResourceLoader::requestLinkResource):
2165         (WebCore::CachedResourceLoader::requestMedia):
2166         (WebCore::CachedResourceLoader::requestIcon):
2167         (WebCore::CachedResourceLoader::requestRawResource):
2168         (WebCore::CachedResourceLoader::requestBeaconResource):
2169         (WebCore::CachedResourceLoader::requestMainResource):
2170         (WebCore::CachedResourceLoader::shouldContinueAfterNotifyingLoadedFromMemoryCache):
2171         (WebCore::CachedResourceLoader::requestResource):
2172         (WebCore::CachedResourceLoader::preload):
2173         * loader/cache/CachedResourceLoader.h:
2174         * loader/cache/CachedSVGDocumentReference.cpp:
2175         (WebCore::CachedSVGDocumentReference::load):
2176         * loader/icon/IconLoader.cpp:
2177         (WebCore::IconLoader::startLoading):
2178         * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
2179         (WebCore::WebCoreAVFResourceLoader::startLoading):
2180         * svg/SVGFEImageElement.cpp:
2181         (WebCore::SVGFEImageElement::requestImageResource):
2182         * svg/SVGFontFaceUriElement.cpp:
2183         (WebCore::SVGFontFaceUriElement::loadFont):
2184         * svg/SVGUseElement.cpp:
2185         (WebCore::SVGUseElement::updateExternalDocument):
2186         * xml/XSLImportRule.cpp:
2187         (WebCore::XSLImportRule::loadSheet):
2188
2189 2017-08-15  Don Olmstead  <don.olmstead@sony.com>
2190
2191         [PAL] Move Sleep classes into PAL
2192         https://bugs.webkit.org/show_bug.cgi?id=175456
2193
2194         Reviewed by Ryosuke Niwa.
2195
2196         No new tests. No change in behavior.
2197
2198         * CMakeLists.txt:
2199         * PlatformMac.cmake:
2200         * WebCore.xcodeproj/project.pbxproj:
2201         * html/HTMLMediaElement.cpp:
2202         * html/HTMLMediaElement.h:
2203         * platform/audio/PlatformMediaSessionManager.cpp:
2204         * platform/audio/PlatformMediaSessionManager.h:
2205         * platform/mac/WebVideoFullscreenController.h:
2206         * platform/mac/WebVideoFullscreenController.mm:
2207
2208 2017-08-15  Youenn Fablet  <youenn@apple.com>
2209
2210         [Cache API] Adding generic support for CacheStorage and Cache methods
2211         https://bugs.webkit.org/show_bug.cgi?id=175455
2212
2213         Reviewed by Chris Dumez.
2214
2215         Covered by existing tests.
2216
2217         Adding a CacheStorageProvider abstraction that creates a CacheStorageConnection.
2218         The CacheStorageProvider is accessed from the page for Document calls.
2219         The CacheStorageConnection is responsible to implement the read/write operations on the cache database.
2220         At the moment, it does nothing but return not implemented errors.
2221
2222         Implementing CacheStorage APIs and Cache APIs based on the CacheStorageConnection except for Cache add and addAll which will be implemented later on.
2223         CacheStoragConnection is responsible to read/write CacheStorage list of caches and each individual cache.
2224         The CacheStorageConnection is a generic connection and not tied to any document/context.
2225         CacheStorage objects are manipulated by providing to the connection the origin of the context.
2226         CacheStorage are global to all contexts with the same origin.
2227         Cache objects are manipulated by an ID that is given initially by the CacheStorageEngine when opening the Cache object.
2228
2229         Adding various accessors and constructors for Fetch constructs as needed by the Cache API implementation.
2230
2231         * Modules/cache/Cache.cpp:
2232         (WebCore::Cache::Cache):
2233         (WebCore::Cache::~Cache):
2234         The CacheStorageConnection is a generic connection and not tied to any document/context.
2235         (WebCore::Cache::match): Implementation of https://www.w3.org/TR/service-workers-1/#cache-match.
2236         Redirect to matchAll as per spec.
2237         (WebCore::Cache::matchAll): Implementation of https://www.w3.org/TR/service-workers-1/#cache-matchAll.
2238         Checks for request as per spec. Then either refresh the request to response map and return all responses.
2239         Or call the query cache algorithm and return copies of the responses (using clone).
2240         (WebCore::Cache::put):
2241         Check the request and response as per spec.
2242         Add temporary rejection cases (being loaded responses, responses with ReadableStream) as there is no support for them right now.
2243         Call the batch put operation.
2244         (WebCore::Cache::remove):
2245         Check the request and response as per spec.
2246         Call the batch delete operation.
2247         (WebCore::Cache::keys):
2248         Refresh the request to response map and return corresponding requests.
2249         Making sure to reuse the same request objects as per spec.
2250         As per spec, the request to response map is ordered. We implement it as a Vector.
2251         (WebCore::Cache::refreshRequestToResponseMap):
2252         Use the cache storage connection to get an up-to-date list of cached records.
2253         (WebCore::Cache::queryCacheMatch):
2254         Implements the match algorithm defined in https://www.w3.org/TR/service-workers-1/#query-cache-algorithm.
2255         This is split for queryCache as cache storage engine will need to use it when implementing the delete operation.
2256         (WebCore::Cache::queryCache):
2257         Full implementation of https://www.w3.org/TR/service-workers-1/#query-cache-algorithm with no targetStorage argument.
2258         (WebCore::Cache::queryCacheWithTargetStorage):
2259         Full implementation of https://www.w3.org/TR/service-workers-1/#query-cache-algorithm with a provided targetStorage argument.
2260         (WebCore::Cache::batchDeleteOperation):
2261         Implementation of https://www.w3.org/TR/service-workers-1/#batch-cache-operations-algorithm but dedicated to a delete operation.
2262         Delete operation are always done one at a time.
2263         (WebCore::Cache::batchPutOperation):
2264         Implementation of https://www.w3.org/TR/service-workers-1/#batch-cache-operations-algorithm dedicated to a put operation.
2265         Put operation takes one record for put but can take several records in the case of addAll, hence the current design.
2266         (WebCore::Cache::updateRequestToResponseMap):
2267         Update the cache request to response map based on the records retrieved from the cache storage connection.
2268         * Modules/cache/Cache.h:
2269         (WebCore::Cache::create):
2270         (WebCore::Cache::name const):
2271         * Modules/cache/Cache.idl:
2272         * Modules/cache/CacheStorage.cpp:
2273         (WebCore::CacheStorage::origin const):
2274         Computing the cache origin that is passed to the CacheStorageConnection.
2275         (WebCore::CacheStorage::has):
2276         Implementation of https://www.w3.org/TR/service-workers-1/#cache-storage-has.
2277         Call the cache storage connection to refresh its cache map.
2278         Then use it to check whether a cache exists.
2279         (WebCore::CacheStorage::refreshCacheMap):
2280         Use the cache storage connection to get the list of existing caches.
2281         (WebCore::CacheStorage::open):
2282         Implementation of https://www.w3.org/TR/service-workers-1/#cache-storage-open.
2283         Refreshing the cache map so as to return a pre-existing cache if any.
2284         (WebCore::CacheStorage::remove):
2285         Implementation of https://www.w3.org/TR/service-workers-1/#cache-storage-delete-method.
2286         Refreshing the cache map so as to do nothing if there is no cache to remove.
2287         (WebCore::CacheStorage::keys):
2288         Implementation of https://www.w3.org/TR/service-workers-1/#cache-storage-keys-method.
2289         Refreshing the cache map and returnin its keys.
2290         As per spec, the cache map is ordered. We implement it as a Vector.
2291         (WebCore::CacheStorage::cacheMap):
2292         Get the list of cache objects, used as a private accessor for JS built-ins.
2293         * Modules/cache/CacheStorage.h:
2294         (WebCore::CacheStorage::create):
2295         (WebCore::CacheStorage::CacheStorage):
2296         * Modules/cache/CacheStorageConnection.cpp: Added.
2297         (WebCore::CacheStorageConnection::exceptionFromError):
2298         * Modules/cache/CacheStorageConnection.h: Added.
2299         Makes the link between Web facing Cache API and the cache storage engine.
2300         Envisioned implementation are:
2301         - One main thread connection used by all documents in the given process.
2302         - One connection per worker that forwards the calls to the main thread and use the main thread connection afterwards.
2303         (WebCore::CacheStorageConnection::create):
2304         (WebCore::CacheStorageConnection::open):
2305         (WebCore::CacheStorageConnection::remove):
2306         (WebCore::CacheStorageConnection::refreshCacheMap):
2307         (WebCore::CacheStorageConnection::refreshRequestToResponseMap):
2308         (WebCore::CacheStorageConnection::batchDeleteOperation):
2309         (WebCore::CacheStorageConnection::batchPutOperation):
2310         * Modules/cache/CacheStorageRecord.h: Added. A fetch record from the Web facing cache API perspective.
2311         * Modules/cache/DOMWindowCaches.cpp:
2312         (WebCore::DOMWindowCaches::caches const):
2313         * Modules/cache/WorkerGlobalScopeCaches.cpp:
2314         (WebCore::WorkerGlobalScopeCaches::from):
2315         (WebCore::WorkerGlobalScopeCaches::caches const):
2316         * Modules/cache/WorkerGlobalScopeCaches.h:
2317         (WebCore::WorkerGlobalScopeCaches::WorkerGlobalScopeCaches):
2318         * Modules/fetch/FetchBodyOwner.h:
2319         (WebCore::FetchBodyOwner::isReadableStreamBody const): Added getter as it is used by cache API.
2320         * Modules/fetch/FetchHeaders.h:
2321         (WebCore::FetchHeaders::create): Add another create as used by the cache API.
2322         (WebCore::FetchHeaders::guard const): Added getter and IPC serializer as this is something that will be stored by the cache engine.
2323         * Modules/fetch/FetchLoader.cpp:
2324         (WebCore::FetchLoader::start):
2325         * Modules/fetch/FetchRequest.cpp:
2326         (WebCore::buildOptions): In case FetchRequest::create is called from C++, there is no need to set init.window to a null value.
2327         Add a check so that no value at all is the same as a null/undefined value.
2328         (WebCore::FetchRequest::resourceRequest const):
2329         * Modules/fetch/FetchRequest.h:
2330         * Modules/fetch/FetchResponse.h:
2331         * WebCore.xcodeproj/project.pbxproj:
2332         * inspector/InspectorOverlay.cpp:
2333         (WebCore::InspectorOverlay::overlayPage):
2334         * page/CacheStorageProvider.h: Added.
2335         Interface to create main thread cache storage connection for the given page.
2336         There will be one provider for each process.
2337         Passing a sessionID so that we will create a connection per session.
2338         * page/Page.cpp:
2339         (WebCore::Page::Page):
2340         * page/Page.h:
2341         (WebCore::Page::cacheStorageProvider):
2342         * page/PageConfiguration.cpp:
2343         (WebCore::PageConfiguration::PageConfiguration):
2344         * page/PageConfiguration.h:
2345         * svg/graphics/SVGImage.cpp:
2346         (WebCore::SVGImage::dataChanged):
2347
2348 2017-08-15  Chris Dumez  <cdumez@apple.com>
2349
2350         Implement quota limitation for keepalive Fetch requests
2351         https://bugs.webkit.org/show_bug.cgi?id=175482
2352
2353         Reviewed by Sam Weinig and Youenn Fablet.
2354
2355         Implement quota limitation for keepalive Fetch requests as per:
2356         - https://fetch.spec.whatwg.org/#http-network-or-cache-fetch (Step 9)
2357
2358         This partly works for Beacon as well, meaning that no Beacon with a body
2359         over 64Kb can be sent. However, we don't keep track about wether or not
2360         beacon loads are inflight or not.
2361
2362         Also update CachedResourceLoader::requestResource() so that the caller
2363         can get a ResourceError when it returns null. This is useful for both
2364         Fetch and Beacon to return better error messages.
2365
2366         Test: http/wpt/beacon/beacon-quota.html
2367
2368         * CMakeLists.txt:
2369         * Modules/beacon/NavigatorBeacon.cpp:
2370         (WebCore::NavigatorBeacon::sendBeacon):
2371         * Modules/fetch/FetchBodyOwner.cpp:
2372         (WebCore::FetchBodyOwner::BlobLoader::didReceiveResponse):
2373         (WebCore::FetchBodyOwner::BlobLoader::didFail):
2374         * Modules/fetch/FetchBodyOwner.h:
2375         * Modules/fetch/FetchLoader.cpp:
2376         (WebCore::FetchLoader::start):
2377         (WebCore::FetchLoader::didFail):
2378         * Modules/fetch/FetchLoaderClient.h:
2379         * Modules/fetch/FetchResponse.cpp:
2380         (WebCore::FetchResponse::BodyLoader::didFail):
2381         * Modules/fetch/FetchResponse.h:
2382         * WebCore.xcodeproj/project.pbxproj:
2383         * loader/DocumentThreadableLoader.cpp:
2384         (WebCore::DocumentThreadableLoader::loadRequest):
2385         * loader/cache/CachedResource.cpp:
2386         (WebCore::CachedResource::load):
2387         * loader/cache/CachedResource.h:
2388         (WebCore::CachedResource::isMainOrMediaOrIconOrRawResource const):
2389         * loader/cache/CachedResourceLoader.cpp:
2390         (WebCore::createResource):
2391         (WebCore::CachedResourceLoader::requestImage):
2392         (WebCore::CachedResourceLoader::requestFont):
2393         (WebCore::CachedResourceLoader::requestTextTrack):
2394         (WebCore::CachedResourceLoader::requestCSSStyleSheet):
2395         (WebCore::CachedResourceLoader::requestUserCSSStyleSheet):
2396         (WebCore::CachedResourceLoader::requestScript):
2397         (WebCore::CachedResourceLoader::requestXSLStyleSheet):
2398         (WebCore::CachedResourceLoader::requestSVGDocument):
2399         (WebCore::CachedResourceLoader::requestLinkResource):
2400         (WebCore::CachedResourceLoader::requestMedia):
2401         (WebCore::CachedResourceLoader::requestIcon):
2402         (WebCore::CachedResourceLoader::requestRawResource):
2403         (WebCore::CachedResourceLoader::requestBeaconResource):
2404         (WebCore::CachedResourceLoader::requestMainResource):
2405         (WebCore::CachedResourceLoader::requestResource):
2406         (WebCore::CachedResourceLoader::preload):
2407         * loader/cache/CachedResourceLoader.h:
2408         * loader/cache/KeepaliveRequestTracker.cpp: Added.
2409         (WebCore::KeepaliveRequestTracker::~KeepaliveRequestTracker):
2410         (WebCore::KeepaliveRequestTracker::canLoadRequest):
2411         (WebCore::KeepaliveRequestTracker::registerRequest):
2412         (WebCore::KeepaliveRequestTracker::responseReceived):
2413         (WebCore::KeepaliveRequestTracker::notifyFinished):
2414         (WebCore::KeepaliveRequestTracker::unregisterRequest):
2415         * loader/cache/KeepaliveRequestTracker.h: Added.
2416         * platform/network/FormData.cpp:
2417         (WebCore::FormDataElement::lengthInBytes const):
2418         (WebCore::FormData::lengthInBytes const):
2419         * platform/network/FormData.h:
2420
2421 2017-08-15  Darin Adler  <darin@apple.com>
2422
2423         REGRESSION(r220052): http/tests/appcache/deferred-events-delete-while-raising-timer.html is crashing.
2424         https://bugs.webkit.org/show_bug.cgi?id=175107
2425
2426         Reviewed by Alexey Proskuryakov.
2427
2428         * loader/FrameLoader.cpp:
2429         (WebCore::FrameLoader::checkLoadComplete): Moved the assertion to after the null page check.
2430
2431 2017-08-15  Commit Queue  <commit-queue@webkit.org>
2432
2433         Unreviewed, rolling out r219504.
2434         https://bugs.webkit.org/show_bug.cgi?id=175580
2435
2436         Broke Arabic text shaping (Requested by mcatanzaro on
2437         #webkit).
2438
2439         Reverted changeset:
2440
2441         "[HarfBuzz] Decomposed Vietnamese characters are rendered
2442         incorrectly"
2443         https://bugs.webkit.org/show_bug.cgi?id=174418
2444         http://trac.webkit.org/changeset/219504
2445
2446 2017-08-14  Carlos Garcia Campos  <cgarcia@igalia.com>
2447
2448         WebDriver: handle click events on option elements
2449         https://bugs.webkit.org/show_bug.cgi?id=174710
2450         <rdar://problem/33459305>
2451
2452         Reviewed by Brian Burg.
2453
2454         Export WebCore symbols required by WebKit layer.
2455
2456         * html/HTMLOptGroupElement.h:
2457         * html/HTMLOptionElement.h:
2458
2459 2017-08-14  Simon Fraser  <simon.fraser@apple.com>
2460
2461         Remove Proximity Events and related code
2462         https://bugs.webkit.org/show_bug.cgi?id=175545
2463
2464         Reviewed by Daniel Bates.
2465
2466         No platform enables Proximity Events, so remove code inside ENABLE(PROXIMITY_EVENTS)
2467         and other related code.
2468
2469         * CMakeLists.txt:
2470         * Configurations/FeatureDefines.xcconfig:
2471         * DerivedSources.cpp:
2472         * Modules/proximity/DeviceProximityClient.h: Removed.
2473         * Modules/proximity/DeviceProximityController.cpp: Removed.
2474         * Modules/proximity/DeviceProximityController.h: Removed.
2475         * Modules/proximity/DeviceProximityEvent.cpp: Removed.
2476         * Modules/proximity/DeviceProximityEvent.h: Removed.
2477         * Modules/proximity/DeviceProximityEvent.idl: Removed.
2478         * dom/EventNames.h:
2479         * dom/EventNames.in:
2480         * history/PageCache.cpp:
2481         (WebCore::canCachePage):
2482         * page/DOMWindow.cpp:
2483         (WebCore::DOMWindow::addEventListener):
2484         (WebCore::DOMWindow::removeEventListener):
2485         (WebCore::DOMWindow::removeAllEventListeners):
2486         * page/DOMWindow.idl:
2487         * page/DiagnosticLoggingKeys.cpp:
2488         (WebCore::DiagnosticLoggingKeys::deviceProximityKey): Deleted.
2489         * page/DiagnosticLoggingKeys.h:
2490         * testing/Internals.cpp:
2491         (WebCore::Internals::setDeviceProximity): Deleted.
2492         * testing/Internals.h:
2493         * testing/Internals.idl:
2494
2495 2017-08-14  Simon Fraser  <simon.fraser@apple.com>
2496
2497         Remove ENABLE(REQUEST_AUTOCOMPLETE) code, which was disabled everywhere
2498         https://bugs.webkit.org/show_bug.cgi?id=175504
2499
2500         Reviewed by Sam Weinig.
2501         
2502         REQUEST_AUTOCOMPLETE was added in r133396 then removed in r148731, but brought back in r173596,
2503         however no further work was done, and it was left disabled. So remove the code.
2504
2505         * Configurations/FeatureDefines.xcconfig:
2506         * DerivedSources.make:
2507         * WebCore.xcodeproj/project.pbxproj:
2508         * dom/AutocompleteErrorEvent.h: Removed.
2509         * dom/AutocompleteErrorEvent.idl: Removed.
2510         * dom/EventNames.in:
2511         * dom/GlobalEventHandlers.idl:
2512         * html/HTMLFormElement.cpp:
2513         (WebCore::HTMLFormElement::HTMLFormElement):
2514         (WebCore::HTMLFormElement::requestAutocomplete): Deleted.
2515         (WebCore::HTMLFormElement::finishRequestAutocomplete): Deleted.
2516         (WebCore::HTMLFormElement::requestAutocompleteTimerFired): Deleted.
2517         * html/HTMLFormElement.h:
2518         * html/HTMLFormElement.idl:
2519         * loader/EmptyClients.cpp:
2520         * loader/FrameLoaderClient.h:
2521
2522 2017-08-14  Chris Dumez  <cdumez@apple.com>
2523
2524         XHR should only fire an abort event if the cancellation was requested by the client
2525         https://bugs.webkit.org/show_bug.cgi?id=175546
2526
2527         Reviewed by Youenn Fablet.
2528
2529         XHR should only fire an abort event if the cancellation was requested by the client, otherwise it should fire an error event.
2530         Blink and Gecko already match the specification.
2531
2532         Specification:
2533         - https://xhr.spec.whatwg.org/#handle-errors
2534         - https://xhr.spec.whatwg.org/#the-abort()-method
2535
2536         Test: http/tests/navigation/page-cache-xhr-in-pagehide.html
2537
2538         * xml/XMLHttpRequest.cpp:
2539         (WebCore::XMLHttpRequest::open):
2540         (WebCore::XMLHttpRequest::abort):
2541         (WebCore::XMLHttpRequest::abortError):
2542         (WebCore::XMLHttpRequest::didFail):
2543         * xml/XMLHttpRequest.h:
2544
2545 2017-08-14  Simon Fraser  <simon.fraser@apple.com>
2546
2547         Remove ENABLE_VIEW_MODE_CSS_MEDIA and related code
2548         https://bugs.webkit.org/show_bug.cgi?id=175557
2549
2550         Reviewed by Jon Lee.
2551
2552         No port cares about the ENABLE(VIEW_MODE_CSS_MEDIA) feature, so remove it.
2553
2554         * Configurations/FeatureDefines.xcconfig:
2555         * css/CSSValueKeywords.in:
2556         * css/MediaFeatureNames.h:
2557         * css/MediaQueryEvaluator.cpp:
2558         (WebCore::viewModeEvaluate): Deleted.
2559         * css/MediaQueryExpression.cpp:
2560         (WebCore::featureWithValidIdent):
2561         (WebCore::isFeatureValidWithoutValue):
2562         * page/Page.cpp:
2563         (WebCore::Page::stringToViewMode): Deleted.
2564         (WebCore::Page::setViewMode): Deleted.
2565         * page/Page.h:
2566         (WebCore::Page::viewMode const): Deleted.
2567
2568 2017-08-14  Myles C. Maxfield  <mmaxfield@apple.com>
2569
2570         Parse font-display
2571         https://bugs.webkit.org/show_bug.cgi?id=175382
2572
2573         Reviewed by Simon Fraser.
2574
2575         The syntax is very simple: font-display: auto | block | swap | fallback | optional.
2576         So, parsing support is quite straightfoward.
2577
2578         Test: fast/text/font-display/parse.html
2579
2580         * css/CSSComputedStyleDeclaration.cpp:
2581         (WebCore::ComputedStyleExtractor::propertyValue):
2582         * css/CSSFontFace.cpp:
2583         (WebCore::CSSFontFace::setLoadingBehavior):
2584         * css/CSSFontFace.h:
2585         * css/CSSFontSelector.cpp:
2586         (WebCore::CSSFontSelector::addFontFaceRule):
2587         * css/CSSPrimitiveValueMappings.h:
2588         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
2589         (WebCore::CSSPrimitiveValue::operator FontLoadingBehavior const):
2590         * css/CSSProperties.json:
2591         * css/CSSProperty.cpp:
2592         (WebCore::CSSProperty::isDescriptorOnly):
2593         * css/CSSValueKeywords.in:
2594         * css/parser/CSSPropertyParser.cpp:
2595         (WebCore::consumeFontFaceFontDisplay):
2596         (WebCore::CSSPropertyParser::parseFontFaceDescriptor):
2597         * rendering/style/RenderStyleConstants.h:
2598
2599 2017-08-14  Jer Noble  <jer.noble@apple.com>
2600
2601         Obj-C exception crash in AVStreamSession when using EME in Private Browsing mode
2602         https://bugs.webkit.org/show_bug.cgi?id=175547
2603
2604         Reviewed by Eric Carlson.
2605
2606         When the storagePath() is empty, do not use those AVStreamSession APIs which require a valid file path to stored
2607         proof-of-key-release data.
2608
2609         Drive-by fix: return emptyString() from HTMLMediaElement::mediaPlayerMediaKeysStorageDirectory() when in Private
2610         Browsing mode, to match the behavior of WebKitMediaKeySession.
2611
2612         * html/HTMLMediaElement.cpp:
2613         (WebCore::HTMLMediaElement::mediaPlayerMediaKeysStorageDirectory const):
2614         * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm:
2615         (WebCore::CDMSessionAVStreamSession::releaseKeys):
2616         (WebCore::CDMSessionAVStreamSession::update):
2617         (WebCore::CDMSessionAVStreamSession::generateKeyReleaseMessage):
2618
2619 2017-08-14  Andy Estes  <aestes@apple.com>
2620
2621         REGRESSION (r220456): Crash in PreviewLoader::shouldCreateForMIMEType() when a ResourceResponse has a null MIME type
2622         https://bugs.webkit.org/show_bug.cgi?id=175548
2623         <rdar://problem/33866206>
2624
2625         Reviewed by Brady Eidson.
2626
2627         New API test: QuickLook.ShouldCreateForMIMEType
2628
2629         * WebCore.xcodeproj/project.pbxproj:
2630         * loader/ios/PreviewLoader.h:
2631         * loader/ios/PreviewLoader.mm:
2632         (WebCore::PreviewLoader::shouldCreateForMIMEType): Check if mimeType is a null String before
2633         calling HashSet::contains().
2634
2635 2017-08-14  Andy Estes  <aestes@apple.com>
2636
2637         [Apple Pay] Add support for phonetic contact names
2638         https://bugs.webkit.org/show_bug.cgi?id=175537
2639         <rdar://problem/32002644>
2640
2641         Reviewed by Tim Horton.
2642
2643         * Modules/applepay/ApplePayError.idl: Defined "phoneticName" in ApplePayErrorContactField.
2644         * Modules/applepay/ApplePayPaymentContact.h: Defined phoneticGivenName and phoneticFamilyName
2645         in ApplePayPaymentContact.
2646         * Modules/applepay/ApplePayPaymentContact.idl: Ditto.
2647         * Modules/applepay/ApplePayPaymentRequest.h: Defined PhoneticName in
2648         ApplePayPaymentRequest::ContactField.
2649         * Modules/applepay/ApplePayPaymentRequest.idl: Defined "phoneticName" in ApplePayContactField.
2650         * Modules/applepay/ApplePaySession.cpp:
2651         (WebCore::convertAndValidate): Added a version parameter. Added code to convert
2652         ContactField::PhoneticName, throwing an exception if version is less than 3.
2653         * Modules/applepay/PaymentContact.h: Added a version parameter to fromApplePayPaymentContact().
2654         * Modules/applepay/PaymentRequest.h: Defined phoneticName in PaymentRequest::ContactFields
2655         and defined PhoneticName in PaymentError::ContactField.
2656         * Modules/applepay/cocoa/PaymentContactCocoa.mm:
2657         (WebCore::convert): Added a version parameter. Set a phoneticRepresentation on the
2658         PKContact's name if there are non-empty phonetic names and version is 3 or greater.
2659         (WebCore::PaymentContact::fromApplePayPaymentContact): Passed version to convert().
2660
2661 2017-08-14  Said Abou-Hallawa  <sabouhallawa@apple.com>
2662
2663         The none smooth stroke applied to an SVG shape breaks its hit testing
2664         https://bugs.webkit.org/show_bug.cgi?id=175506
2665
2666         Reviewed by Simon Fraser.
2667
2668         Clear RenderSVGShape::m_path when calling RenderSVGRect::updateShapeFromElement().
2669         The m_path will be recalculated when RenderSVGShape::updateShapeFromElement()
2670         is called from RenderSVGRect::shapeDependentStrokeContains().
2671
2672         Test: svg/stroke/stroke-linejoin-click.html
2673
2674         * rendering/svg/RenderSVGRect.cpp:
2675         (WebCore::RenderSVGRect::updateShapeFromElement):
2676         * rendering/svg/RenderSVGShape.h:
2677         (WebCore::RenderSVGShape::clearPath):
2678
2679 2017-08-14  Adrian Perez de Castro  <aperez@igalia.com>
2680
2681         [WPE] Implement WebCore::standardUserAgent()
2682         https://bugs.webkit.org/show_bug.cgi?id=175507
2683
2684         Reviewed by Michael Catanzaro.
2685
2686         Remove "_GLIB" from user-agent version macros.
2687
2688         * platform/glib/UserAgentGLib.cpp:
2689         (WebCore::versionForUAString):
2690
2691 2017-08-14  Chris Dumez  <cdumez@apple.com>
2692
2693         Unreviewed, rollout r220622 & r220696
2694         https://bugs.webkit.org/show_bug.cgi?id=175482
2695         <rdar://problem/33860695>
2696
2697         Seems to have caused failures on iOS.
2698
2699         * CMakeLists.txt:
2700         * Modules/beacon/NavigatorBeacon.cpp:
2701         (WebCore::NavigatorBeacon::sendBeacon):
2702         * Modules/fetch/FetchBodyOwner.cpp:
2703         (WebCore::FetchBodyOwner::BlobLoader::didReceiveResponse):
2704         (WebCore::FetchBodyOwner::BlobLoader::didFail):
2705         * Modules/fetch/FetchBodyOwner.h:
2706         * Modules/fetch/FetchLoader.cpp:
2707         (WebCore::FetchLoader::start):
2708         (WebCore::FetchLoader::didFail):
2709         * Modules/fetch/FetchLoaderClient.h:
2710         * Modules/fetch/FetchResponse.cpp:
2711         (WebCore::FetchResponse::BodyLoader::didFail):
2712         * Modules/fetch/FetchResponse.h:
2713         * WebCore.xcodeproj/project.pbxproj:
2714         * loader/DocumentThreadableLoader.cpp:
2715         (WebCore::DocumentThreadableLoader::loadRequest):
2716         * loader/cache/CachedRawResource.cpp:
2717         (WebCore::CachedRawResource::finishLoading):
2718         * loader/cache/CachedResource.cpp:
2719         (WebCore::CachedResource::load):
2720         * loader/cache/CachedResource.h:
2721         (WebCore::CachedResource::isMainOrMediaOrIconOrRawResource const):
2722         * loader/cache/CachedResourceLoader.cpp:
2723         (WebCore::createResource):
2724         (WebCore::CachedResourceLoader::requestImage):
2725         (WebCore::CachedResourceLoader::requestFont):
2726         (WebCore::CachedResourceLoader::requestTextTrack):
2727         (WebCore::CachedResourceLoader::requestCSSStyleSheet):
2728         (WebCore::CachedResourceLoader::requestUserCSSStyleSheet):
2729         (WebCore::CachedResourceLoader::requestScript):
2730         (WebCore::CachedResourceLoader::requestXSLStyleSheet):
2731         (WebCore::CachedResourceLoader::requestSVGDocument):
2732         (WebCore::CachedResourceLoader::requestLinkResource):
2733         (WebCore::CachedResourceLoader::requestMedia):
2734         (WebCore::CachedResourceLoader::requestIcon):
2735         (WebCore::CachedResourceLoader::requestRawResource):
2736         (WebCore::CachedResourceLoader::requestBeaconResource):
2737         (WebCore::CachedResourceLoader::requestMainResource):
2738         (WebCore::CachedResourceLoader::requestResource):
2739         (WebCore::CachedResourceLoader::preload):
2740         * loader/cache/CachedResourceLoader.h:
2741         * loader/cache/KeepaliveRequestTracker.cpp: Removed.
2742         * loader/cache/KeepaliveRequestTracker.h: Removed.
2743         * platform/network/FormData.cpp:
2744         (WebCore::FormData::appendFile):
2745         (WebCore::FormData::appendFileRange):
2746         (WebCore::FormData::appendBlob):
2747         (WebCore::FormData::expandDataStore):
2748         * platform/network/FormData.h:
2749
2750 2017-08-14  Daniel Bates  <dabates@apple.com>
2751
2752         [css-ui] Implement caret-color support
2753         https://bugs.webkit.org/show_bug.cgi?id=166572
2754         <rdar://problem/33852589>
2755
2756         Reviewed by David Hyatt.
2757
2758         Add support for the CSS property caret-color as per <https://www.w3.org/TR/css-ui-3/#caret-color> (02 March 2017).
2759         The property caret-color specifies the color of the text insertion caret in an editable element,
2760         say an HTML textarea element.
2761
2762         Unlike other CSS color properties caret-color can have value "auto" and this is its initial
2763         value. Internally we treat value "auto" as an invalid caret color to simplify the code.
2764
2765         Tests: editing/pasteboard/preserve-caret-color.html
2766                fast/css/caret-color-auto.html
2767                fast/css/caret-color-fallback-to-color.html
2768                fast/css/caret-color-inherit.html
2769                fast/css/caret-color-span-inside-editable-parent.html
2770                fast/css/caret-color.html
2771                fast/history/visited-link-caret-color.html
2772
2773         * css/CSSComputedStyleDeclaration.cpp:
2774         (WebCore::ComputedStyleExtractor::propertyValue):
2775         * css/CSSProperties.json: Add property caret-color. We represent the initial  "auto" Also, fix up
2776         wording in a comment while I am here.
2777         * css/StyleResolver.cpp:
2778         (WebCore::isValidVisitedLinkProperty): Add caret-color to the list of properties that can be
2779         applied to visited hyperlinks.
2780         * css/parser/CSSParserFastPaths.cpp:
2781         (WebCore::parseCaretColor): Added.
2782         (WebCore::CSSParserFastPaths::maybeParseValue): Unlike other CSS color properties caret-color
2783         can be defined to be "auto". We explicitly check if the property is caret-color and use
2784         parseCaretColor() to parse its value.
2785         * css/parser/CSSPropertyParser.cpp:
2786         (WebCore::consumeCaretColor): Added.
2787         (WebCore::CSSPropertyParser::parseSingleValue): Similar to the change to CSSParserFastPaths::maybeParseValue()
2788         use a dedicated code path to parse caret-color.
2789         * editing/EditingStyle.cpp: Preserve caret-color during editing operations.
2790         * editing/FrameSelection.cpp:
2791         (WebCore::CaretBase::paintCaret const): Modified code to query property caret-color instead of
2792         color for the color of the text insertion caret. Always honor the caret-color of the editable
2793         element if it is valid color. Note that "caret-color: auto" is treated as an invalid color
2794         internally. A caret-color can have an invalid color if its inherits from the CSS color property
2795         with an invalid color. If caret-color is a valid color then we take it to be the color of the
2796         text insertion caret. Otherwise, we do what we do today and use a heuristic to determine the
2797         color of the text-insertion caret.
2798         (WebCore::disappearsIntoBackground): Deleted; moved logic into CaretBase::paintCaret().
2799         * page/animation/CSSPropertyAnimation.cpp:
2800         (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap): Add property wrapper
2801         to support animating caret-color.
2802         * rendering/style/RenderStyle.cpp:
2803         (WebCore::RenderStyle::changeRequiresRepaintIfTextOrBorderOrOutline const): Modified to consider
2804         changes to caret color.
2805         (WebCore::RenderStyle::colorIncludingFallback const): Modified to compute the appropriate
2806         color for property caret-color with respect to an unvisited or visited link.
2807         * rendering/style/RenderStyle.h:
2808         (WebCore::RenderStyle::setCaretColor): Added.
2809         (WebCore::RenderStyle::setVisitedLinkCaretColor): Added.
2810         (WebCore::RenderStyle::caretColor const): Added.
2811         (WebCore::RenderStyle::visitedLinkCaretColor const): Added.
2812         * rendering/style/StyleRareInheritedData.cpp:
2813         (WebCore::StyleRareInheritedData::StyleRareInheritedData): Modified to consider caret color.
2814         (WebCore::StyleRareInheritedData::operator== const): Ditto.
2815         * rendering/style/StyleRareInheritedData.h:
2816
2817 2017-08-14  Zan Dobersek  <zdobersek@igalia.com>
2818
2819         REGRESSION(r220517-r220521) [GTK] Various compositing tests fail
2820         https://bugs.webkit.org/show_bug.cgi?id=175478
2821
2822         Reviewed by Sergio Villar Senin.
2823
2824         Fix a regression introduced in r220519. Move a framebuffer binding in TextureMapperGL
2825         away from GraphicsContext3D and onto the OpenGL API to work around the framebuffer
2826         binding state that's kept in the GraphicsContext3D class. This mismatch in how the
2827         framebuffer was bound was causing a couple of test failures in compositing tests.
2828
2829         No new tests -- regressed tests have their failure expectations removed.
2830
2831         * platform/graphics/texmap/TextureMapperGL.cpp:
2832         (WebCore::TextureMapperGL::bindDefaultSurface): Don't use GraphicsContext3D for the
2833         glBindFramebuffer() call. This would be done in subsequent patches that would move
2834         TextureMapperGL off the GraphicsContext3D usage, but this specific use case clashes
2835         with the framebuffer binding that's done in BitmapTextureGL and was causing test
2836         failures.
2837
2838 2017-08-14  Chris Dumez  <cdumez@apple.com>
2839
2840         Unreviewed fix after r220622 to address crashes on iOS.
2841
2842         * loader/cache/CachedRawResource.cpp:
2843         (WebCore::CachedRawResource::finishLoading):
2844
2845 2017-08-14  Antti Koivisto  <antti@apple.com>
2846
2847         Factor text autosizing into a class
2848         https://bugs.webkit.org/show_bug.cgi?id=175530
2849
2850         Reviewed by Andreas Kling.
2851
2852         Move the remaining parts out of Document.
2853
2854         * css/StyleBuilderCustom.h:
2855         (WebCore::computeLineHeightMultiplierDueToFontSize):
2856         * dom/Document.cpp:
2857         (WebCore::Document::destroyRenderTree):
2858         (WebCore::Document::textAutoSizing):
2859         (WebCore::TextAutoSizingTraits::constructDeletedValue): Deleted.
2860         (WebCore::TextAutoSizingTraits::isDeletedValue): Deleted.
2861         (WebCore::Document::addAutoSizedNode): Deleted.
2862         (WebCore::Document::updateAutoSizedNodes): Deleted.
2863         (WebCore::Document::clearAutoSizedNodes): Deleted.
2864         * dom/Document.h:
2865         * rendering/RenderBlockFlow.cpp:
2866         (WebCore::RenderBlockFlow::adjustComputedFontSizes):
2867         * rendering/RenderElement.cpp:
2868         (WebCore::RenderElement::adjustComputedFontSizesOnBlocks):
2869         (WebCore::RenderElement::resetTextAutosizing):
2870         * rendering/TextAutoSizing.cpp:
2871         (WebCore::TextAutoSizingTraits::constructDeletedValue):
2872         (WebCore::TextAutoSizingTraits::isDeletedValue):
2873         (WebCore::TextAutoSizing::addTextNode):
2874         (WebCore::TextAutoSizing::updateRenderTree):
2875         (WebCore::TextAutoSizing::reset):
2876         * rendering/TextAutoSizing.h:
2877
2878 2017-08-14  Antti Koivisto  <antti@apple.com>
2879
2880         [Render Tree Mutation] First letter should not mutate the render tree while in layout.
2881         https://bugs.webkit.org/show_bug.cgi?id=163848
2882
2883         Reviewed by Zalan Bujtas.
2884
2885         RenderBlock::updateFirstLetter shouldn't be called during layout. Instead it should
2886         be invoked by the RenderTreeUpdater.
2887
2888         With this future patches can move updateFirstLetter() and the related functions
2889         completely out of the render tree.
2890
2891         * rendering/RenderBlock.cpp:
2892         (WebCore::RenderBlock::layout):
2893
2894             No more updateFirstLetter calls during layout...
2895
2896         (WebCore::RenderBlock::computePreferredLogicalWidths):
2897
2898             ...or preferred width computation.
2899
2900         (WebCore::RenderBlock::updateFirstLetter):
2901         * rendering/RenderBlock.h:
2902         * rendering/RenderRubyRun.cpp:
2903         (WebCore::RenderRubyRun::updateFirstLetter):
2904         * rendering/RenderRubyRun.h:
2905         * rendering/RenderTable.cpp:
2906         (WebCore::RenderTable::updateFirstLetter):
2907         * rendering/RenderTable.h:
2908         * rendering/svg/RenderSVGText.cpp:
2909         (WebCore::RenderSVGText::updateFirstLetter):
2910         * rendering/svg/RenderSVGText.h:
2911         * style/RenderTreeUpdater.cpp:
2912         (WebCore::RenderTreeUpdater::popParent):
2913
2914             Call updateFirstLetter when closing the element. All of of descedant renderers are known here
2915             so this can be resolved correctly.
2916
2917 2017-08-13  Manuel Rego Casasnovas  <rego@igalia.com>
2918
2919         Composition underline color is always black
2920         https://bugs.webkit.org/show_bug.cgi?id=174675
2921
2922         Reviewed by Ryosuke Niwa.
2923
2924         This patch uses the current color of the text instead of black
2925         for the composition underline marker.
2926         This makes it visible in the case we have a black/dark background.
2927
2928         Test: editing/composition-underline-color.html
2929
2930         * editing/CompositionUnderline.h:
2931         (WebCore::CompositionUnderline::CompositionUnderline):
2932         Added new attribute compositionUnderlineColor.
2933         * rendering/InlineTextBox.cpp:
2934         (WebCore::InlineTextBox::paintCompositionUnderline):
2935         Use the text color if compositionUnderlineColor is TextColor.
2936
2937 2017-08-13  Carlos Garcia Campos  <cgarcia@igalia.com>
2938
2939         [GTK] stop kinetic scrolling when a zero movement is reached
2940         https://bugs.webkit.org/show_bug.cgi?id=175468
2941
2942         Reviewed by Michael Catanzaro.
2943
2944         This is GTK+ change by Christian Hergert.
2945         https://git.gnome.org/browse/gtk+/commit/?h=gtk-3-22&id=4f63d839550f7a9038b391e7d3e1e6fc8bdfafa6
2946
2947         When the kinetic scrolling reduces its speed, there can be multiple frames where the movement is zero pixels,
2948         followed by a 1 pixel movement later on. This causes a "jitter" right at the end of the scroll which makes it
2949         feel less quality than other platforms. Instead, we should just clamp it as soon as we get a zero movement.
2950
2951         * platform/ScrollAnimationKinetic.cpp:
2952         (WebCore::ScrollAnimationKinetic::PerAxisData::animateScroll):
2953
2954 2017-08-13  Chris Dumez  <cdumez@apple.com>
2955
2956         Drop non-const getter for CachedResource::resourceRequest()
2957         https://bugs.webkit.org/show_bug.cgi?id=175524
2958
2959         Reviewed by Youenn Fablet.
2960
2961         Drop non-const getter for CachedResource::resourceRequest(). It would be unsafe to modify the request of a CachedResource
2962         after it has been cached. Exposing such a getter is therefore a footgun.
2963
2964         * loader/LinkLoader.cpp:
2965         (WebCore::LinkLoader::preloadIfNeeded):
2966         * loader/cache/CachedImage.cpp:
2967         (WebCore::CachedImage::CachedImage):
2968         * loader/cache/CachedImage.h:
2969         * loader/cache/CachedResource.cpp:
2970         (WebCore::CachedResource::CachedResource):
2971         * loader/cache/CachedResource.h:
2972         (WebCore::CachedResource::resourceRequest const):
2973         (WebCore::CachedResource::ignoreForRequestCount const):
2974         (WebCore::CachedResource::setIgnoreForRequestCount):
2975         * loader/cache/CachedResourceLoader.cpp:
2976         (WebCore::CachedResourceLoader::requestResource):
2977         * loader/cache/CachedResourceRequest.h:
2978         (WebCore::CachedResourceRequest::ignoreForRequestCount const):
2979         (WebCore::CachedResourceRequest::setIgnoreForRequestCount):
2980         * loader/cache/MemoryCache.cpp:
2981         (WebCore::MemoryCache::addImageToCache):
2982         * platform/network/ResourceRequestBase.h:
2983
2984 2017-08-13  Adrian Perez de Castro  <aperez@igalia.com>
2985
2986         [WPE] Implement WebCore::standardUserAgent()
2987         https://bugs.webkit.org/show_bug.cgi?id=175507
2988
2989         Reviewed by Carlos Alberto Lopez Perez.
2990
2991         Implement missing User-Agent handling for the WPE port by sharing the code with the GTK+ port.
2992
2993         * PlatformGTK.cmake: Handlde renaming of UserAgentGtk.cpp to UserAgentGLib.cpp.
2994         * PlatformWPE.cmake: Add UserAgentGLib.cpp and UserAgentQuirks.cpp to the list of built WebCore sources.
2995         * platform/glib/UserAgentGLib.cpp: Renamed from Source/WebCore/platform/gtk/UserAgentGtk.cpp.
2996         (WebCore::versionForUAString): Change "GTK" in UA version macros to "GLIB".
2997
2998 2017-08-11  Ryosuke Niwa  <rniwa@webkit.org>
2999
3000         Replace DATA_TRANSFER_ITEMS by a runtime flag and add a stub implementation
3001         https://bugs.webkit.org/show_bug.cgi?id=175474
3002         <rdar://problem/33844628>
3003
3004         Reviewed by Wenson Hsieh.
3005
3006         Replaced the build flag by a runtime flag and added a stub implementation for DataTransferItemList
3007         and DataTransferItem to make it compile. DataTransferItemList is created lazily by DataTransfer.items,
3008         and its lifetime is tied to DataTransfer by forwarding ref and deref.
3009
3010         See https://html.spec.whatwg.org/multipage/dnd.html#the-datatransferitemlist-interface
3011
3012         Tests: editing/pasteboard/datatransfer-idl.html
3013
3014         * CMakeLists.txt:
3015         * Configurations/FeatureDefines.xcconfig:
3016         * WebCore.xcodeproj/project.pbxproj:
3017         * dom/DataTransfer.cpp:
3018         (WebCore::DataTransfer::items): Added. Create DataTransferItemList lazily
3019         * dom/DataTransfer.h:
3020         * dom/DataTransfer.idl:
3021         * dom/DataTransferItem.cpp:
3022         (WebCore::DataTransferItem::DataTransferItem): Added a stub implementation.
3023         (WebCore::DataTransferItem::~DataTransferItem): Ditto.
3024         (WebCore::DataTransferItem::getAsString const): Ditto.
3025         (WebCore::DataTransferItem::getAsFile const): Ditto.
3026         * dom/DataTransferItem.h:
3027         (WebCore::DataTransferItemList): Devirtualized functions.
3028         (WebCore::DataTransferItemList::kind const):
3029         (WebCore::DataTransferItemList::type const):
3030         * dom/DataTransferItem.idl:
3031         * dom/DataTransferItemList.cpp: Added.
3032         (WebCore::DataTransferItemList::length const): Added a stub implementation.
3033         (WebCore::DataTransferItemList::item): Ditto.
3034         (WebCore::DataTransferItemList::add): Ditto.
3035         (WebCore::DataTransferItemList::remove): Ditto.
3036         (WebCore::DataTransferItemList::clear): Ditto.
3037         * dom/DataTransferItemList.h:
3038         (WebCore::DataTransferItemList::DataTransferItemList):
3039         (WebCore::DataTransferItemList::~DataTransferItemList): Deleted.
3040         (WebCore::DataTransferItemList::ref): Forwards to DataTransfer's ref.
3041         (WebCore::DataTransferItemList::deref): Ditto.
3042         * dom/DataTransferItemList.idl: Updated to match the latest specification.
3043         * page/RuntimeEnabledFeatures.h:
3044         (WebCore::RuntimeEnabledFeatures::setDataTransferItemsEnabled): Added.
3045         (WebCore::RuntimeEnabledFeatures::dataTransferItemsEnabled const): Added.
3046
3047 2017-08-11  Brady Eidson  <beidson@apple.com>
3048
3049         Move files inside WebCore/workers to WebCore/workers/service.
3050         https://bugs.webkit.org/show_bug.cgi?id=175495
3051
3052         Rubberstamped by Tim Horton.
3053
3054         * CMakeLists.txt:
3055         * DerivedSources.make:
3056         * WebCore.xcodeproj/project.pbxproj:
3057
3058         * workers/service/ServiceWorker.cpp: Renamed from Source/WebCore/workers/ServiceWorker.cpp.
3059         * workers/service/ServiceWorker.h: Renamed from Source/WebCore/workers/ServiceWorker.h.
3060         * workers/service/ServiceWorker.idl: Renamed from Source/WebCore/workers/ServiceWorker.idl.
3061         * workers/service/ServiceWorkerContainer.cpp: Renamed from Source/WebCore/workers/ServiceWorkerContainer.cpp.
3062         * workers/service/ServiceWorkerContainer.h: Renamed from Source/WebCore/workers/ServiceWorkerContainer.h.
3063         * workers/service/ServiceWorkerContainer.idl: Renamed from Source/WebCore/workers/ServiceWorkerContainer.idl.
3064         * workers/service/ServiceWorkerGlobalScope.cpp: Renamed from Source/WebCore/workers/ServiceWorkerGlobalScope.cpp.
3065         * workers/service/ServiceWorkerGlobalScope.h: Renamed from Source/WebCore/workers/ServiceWorkerGlobalScope.h.
3066         * workers/service/ServiceWorkerGlobalScope.idl: Renamed from Source/WebCore/workers/ServiceWorkerGlobalScope.idl.
3067         * workers/service/ServiceWorkerJob.cpp: Renamed from Source/WebCore/workers/ServiceWorkerJob.cpp.
3068         * workers/service/ServiceWorkerJob.h: Renamed from Source/WebCore/workers/ServiceWorkerJob.h.
3069         * workers/service/ServiceWorkerJobClient.h: Renamed from Source/WebCore/workers/ServiceWorkerJobClient.h.
3070         * workers/service/ServiceWorkerProvider.cpp: Renamed from Source/WebCore/workers/ServiceWorkerProvider.cpp.
3071         * workers/service/ServiceWorkerProvider.h: Renamed from Source/WebCore/workers/ServiceWorkerProvider.h.
3072         * workers/service/ServiceWorkerRegistration.cpp: Renamed from Source/WebCore/workers/ServiceWorkerRegistration.cpp.
3073         * workers/service/ServiceWorkerRegistration.h: Renamed from Source/WebCore/workers/ServiceWorkerRegistration.h.
3074         * workers/service/ServiceWorkerRegistration.idl: Renamed from Source/WebCore/workers/ServiceWorkerRegistration.idl.
3075         * workers/service/ServiceWorkerRegistrationOptions.h: Renamed from Source/WebCore/workers/ServiceWorkerRegistrationOptions.h.
3076         * workers/service/ServiceWorkerRegistrationParameters.cpp: Renamed from Source/WebCore/workers/ServiceWorkerRegistrationParameters.cpp.
3077         * workers/service/ServiceWorkerRegistrationParameters.h: Renamed from Source/WebCore/workers/ServiceWorkerRegistrationParameters.h.
3078         * workers/service/ServiceWorkerUpdateViaCache.h: Renamed from Source/WebCore/workers/ServiceWorkerUpdateViaCache.h.
3079         * workers/service/ServiceWorkerUpdateViaCache.idl: Renamed from Source/WebCore/workers/ServiceWorkerUpdateViaCache.idl.
3080
3081 2017-08-11  Chris Dumez  <cdumez@apple.com>
3082
3083         Implement quota limitation for keepalive Fetch requests
3084         https://bugs.webkit.org/show_bug.cgi?id=175482
3085
3086         Reviewed by Sam Weinig and Youenn Fablet.
3087
3088         Implement quota limitation for keepalive Fetch requests as per:
3089         - https://fetch.spec.whatwg.org/#http-network-or-cache-fetch (Step 9)
3090
3091         This partly works for Beacon as well, meaning that no Beacon with a body
3092         over 64Kb can be sent. However, we don't keep track about wether or not
3093         beacon loads are inflight or not.
3094
3095         Also update CachedResourceLoader::requestResource() so that the caller
3096         can get a ResourceError when it returns null. This is useful for both
3097         Fetch and Beacon to return better error messages.
3098
3099         Test: http/wpt/beacon/beacon-quota.html
3100
3101         * CMakeLists.txt:
3102         * Modules/beacon/NavigatorBeacon.cpp:
3103         (WebCore::NavigatorBeacon::sendBeacon):
3104         * Modules/fetch/FetchBodyOwner.cpp:
3105         (WebCore::FetchBodyOwner::BlobLoader::didReceiveResponse):
3106         (WebCore::FetchBodyOwner::BlobLoader::didFail):
3107         * Modules/fetch/FetchBodyOwner.h:
3108         * Modules/fetch/FetchLoader.cpp:
3109         (WebCore::FetchLoader::start):
3110         (WebCore::FetchLoader::didFail):
3111         * Modules/fetch/FetchLoaderClient.h:
3112         * Modules/fetch/FetchResponse.cpp:
3113         (WebCore::FetchResponse::BodyLoader::didFail):
3114         * Modules/fetch/FetchResponse.h:
3115         * WebCore.xcodeproj/project.pbxproj:
3116         * loader/DocumentThreadableLoader.cpp:
3117         (WebCore::DocumentThreadableLoader::loadRequest):
3118         * loader/cache/CachedResource.cpp:
3119         (WebCore::CachedResource::load):
3120         * loader/cache/CachedResource.h:
3121         (WebCore::CachedResource::isMainOrMediaOrIconOrRawResource const):
3122         * loader/cache/CachedResourceLoader.cpp:
3123         (WebCore::createResource):
3124         (WebCore::CachedResourceLoader::requestImage):
3125         (WebCore::CachedResourceLoader::requestFont):
3126         (WebCore::CachedResourceLoader::requestTextTrack):
3127         (WebCore::CachedResourceLoader::requestCSSStyleSheet):
3128         (WebCore::CachedResourceLoader::requestUserCSSStyleSheet):
3129         (WebCore::CachedResourceLoader::requestScript):
3130         (WebCore::CachedResourceLoader::requestXSLStyleSheet):
3131         (WebCore::CachedResourceLoader::requestSVGDocument):
3132         (WebCore::CachedResourceLoader::requestLinkResource):
3133         (WebCore::CachedResourceLoader::requestMedia):
3134         (WebCore::CachedResourceLoader::requestIcon):
3135         (WebCore::CachedResourceLoader::requestRawResource):
3136         (WebCore::CachedResourceLoader::requestBeaconResource):
3137         (WebCore::CachedResourceLoader::requestMainResource):
3138         (WebCore::CachedResourceLoader::requestResource):
3139         (WebCore::CachedResourceLoader::preload):
3140         * loader/cache/CachedResourceLoader.h:
3141         * loader/cache/KeepaliveRequestTracker.cpp: Added.
3142         (WebCore::KeepaliveRequestTracker::~KeepaliveRequestTracker):
3143         (WebCore::KeepaliveRequestTracker::canLoadRequest):
3144         (WebCore::KeepaliveRequestTracker::registerRequest):
3145         (WebCore::KeepaliveRequestTracker::responseReceived):
3146         (WebCore::KeepaliveRequestTracker::notifyFinished):
3147         (WebCore::KeepaliveRequestTracker::unregisterRequest):
3148         * loader/cache/KeepaliveRequestTracker.h: Added.
3149         * platform/network/FormData.cpp:
3150         (WebCore::FormDataElement::lengthInBytes const):
3151         (WebCore::FormData::lengthInBytes const):
3152         * platform/network/FormData.h:
3153
3154 2017-08-11  Don Olmstead  <don.olmstead@sony.com>
3155
3156         [WTF] Move ValueToString into WTF
3157         https://bugs.webkit.org/show_bug.cgi?id=175469
3158
3159         Reviewed by Sam Weinig.
3160
3161         No new tests. No change in behavior.
3162
3163         * WebCore.xcodeproj/project.pbxproj:
3164         * html/HTMLMediaElement.h:
3165         (WTF::ValueToString<WebCore::TextTrackCue::string):
3166         (WebCore::ValueToString<TextTrackCue::string): Deleted.
3167         (WebCore::ValueToString<MediaTime>::string): Deleted.
3168         * platform/LayoutUnit.h:
3169         (WTF::ValueToString<WebCore::LayoutUnit>::string):
3170         (WebCore::ValueToString<LayoutUnit>::string): Deleted.
3171         * platform/PODInterval.h:
3172         * platform/PODIntervalTree.h:
3173         * platform/PODRedBlackTree.h:
3174         * platform/graphics/FloatPolygon.h:
3175         (WTF::ValueToString<WebCore::FloatPolygonEdge::string):
3176         (WebCore::ValueToString<FloatPolygonEdge::string): Deleted.
3177         * rendering/FloatingObjects.h:
3178         (WTF::ValueToString<WebCore::FloatingObject::string):
3179         (WebCore::ValueToString<FloatingObject::string): Deleted.
3180         * rendering/RenderFlowThread.h:
3181         (WTF::ValueToString<WebCore::RenderRegion::string):
3182         (WebCore::ValueToString<RenderRegion::string): Deleted.
3183
3184 2017-08-11  Sam Weinig  <sam@webkit.org>
3185
3186         [Bindings] Simplify DOMPromiseProxy now that WTF::Function can return references
3187         https://bugs.webkit.org/show_bug.cgi?id=175394
3188
3189         Reviewed by Chris Dumez.
3190
3191         * bindings/IDLTypes.h:
3192         (WebCore::IDLWrapper::convertToParameterType): Deleted.
3193
3194             Remove no longer used convertToParameterType.
3195
3196         * bindings/js/DOMPromiseProxy.h:
3197
3198             - Replace Variant<Value, Exception> with ExceptionOr<Value> / ExceptionOr<void>.
3199             - Update ResolveCallback to have a return type of IDLType::ParameterType, rather than
3200               IDLType::ImplementationType, now that WTF::Function supports references as the 
3201               return type. This is needed, since the IDLType::ParameterType for an interface T
3202               is T&.
3203
3204         * css/FontFace.cpp:
3205         * css/FontFace.h:
3206         * css/FontFaceSet.cpp:
3207         * css/FontFaceSet.h:
3208
3209             Update resolve callbacks to return a reference rather than a RefPtr, matching
3210             the new signature requirement.
3211
3212 2017-08-11  Sam Weinig  <sam@webkit.org>
3213
3214         [WebIDL] Replace JSCryptoKeyCustom and JSCryptoAlgorithmBuilder with generated code
3215         https://bugs.webkit.org/show_bug.cgi?id=175457
3216
3217         Reviewed by Chris Dumez.
3218
3219         * CMakeLists.txt:
3220         * DerivedSources.make:
3221         * WebCore.xcodeproj/project.pbxproj:
3222         * bindings/js/JSCryptoAlgorithmBuilder.cpp: Removed.
3223         * bindings/js/JSCryptoAlgorithmBuilder.h: Removed.
3224         * bindings/js/JSCryptoKeyCustom.cpp: Removed.
3225
3226             Remove JSCryptoAlgorithmBuilder and JSCryptoKeyCustom, add KeyAlgorithm
3227             IDLs and headers.
3228
3229         * crypto/CryptoKey.cpp:
3230         * crypto/CryptoKey.h:
3231         * crypto/CryptoKey.idl:
3232         
3233             Replace custom algorithm attribute with a union of the supported key algorithms.
3234         
3235         * crypto/keys/CryptoAesKeyAlgorithm.h: Added.
3236         * crypto/keys/CryptoAesKeyAlgorithm.idl: Added.
3237         * crypto/keys/CryptoEcKeyAlgorithm.h: Added.
3238         * crypto/keys/CryptoEcKeyAlgorithm.idl: Added.
3239         * crypto/keys/CryptoHmacKeyAlgorithm.h: Added.
3240         * crypto/keys/CryptoHmacKeyAlgorithm.idl: Added.
3241         * crypto/keys/CryptoKeyAlgorithm.h: Added.
3242         * crypto/keys/CryptoKeyAlgorithm.idl: Added.
3243         * crypto/keys/CryptoRsaHashedKeyAlgorithm.h: Added.
3244         * crypto/keys/CryptoRsaHashedKeyAlgorithm.idl: Added.
3245         * crypto/keys/CryptoRsaKeyAlgorithm.h: Added.
3246         * crypto/keys/CryptoRsaKeyAlgorithm.idl: Added.
3247
3248             Add IDLs and headers fo the supported key algorithms.
3249
3250         * crypto/keys/CryptoKeyAES.h:
3251         * crypto/keys/CryptoKeyEC.h:
3252         * crypto/keys/CryptoKeyHMAC.h:
3253         * crypto/keys/CryptoKeyRSA.h:
3254         * crypto/keys/CryptoKeyRaw.h:
3255
3256             Give each of the existing KeyAlgorithm subclasses a dictionary() function
3257             that returns the populated corresponding spec'd dictionary.
3258
3259 2017-08-11  Simon Fraser  <simon.fraser@apple.com>
3260
3261         Some RenderSVGResource cleanup
3262         https://bugs.webkit.org/show_bug.cgi?id=175494
3263
3264         Reviewed by Zalan Bujtas.
3265
3266         Use more initializers. Remove spurious use of bitfields that didn't save any space at all.
3267         0 -> nullptr.
3268
3269         No behavior change.
3270
3271         * rendering/svg/RenderSVGResourceContainer.cpp:
3272         (WebCore::RenderSVGResourceContainer::RenderSVGResourceContainer):
3273         * rendering/svg/RenderSVGResourceContainer.h:
3274         * rendering/svg/RenderSVGResourceGradient.cpp:
3275         (WebCore::RenderSVGResourceGradient::RenderSVGResourceGradient):
3276         (WebCore::RenderSVGResourceGradient::applyResource):
3277         * rendering/svg/RenderSVGResourceGradient.h:
3278         * rendering/svg/RenderSVGResourcePattern.cpp:
3279         (WebCore::RenderSVGResourcePattern::RenderSVGResourcePattern):
3280         * rendering/svg/RenderSVGResourcePattern.h:
3281         * rendering/svg/RenderSVGShape.cpp:
3282         (WebCore::RenderSVGShape::fillShape):
3283         (WebCore::RenderSVGShape::strokeShape):
3284         * rendering/svg/SVGRenderingContext.cpp:
3285         (WebCore::SVGRenderingContext::~SVGRenderingContext):
3286         (WebCore::SVGRenderingContext::prepareToRenderSVGContent):
3287         * rendering/svg/SVGRenderingContext.h:
3288         (WebCore::SVGRenderingContext::SVGRenderingContext):
3289
3290 2017-08-11  Tim Horton  <timothy_horton@apple.com>
3291
3292         Fix the build with modern Clang's -Wexpansion-to-defined
3293         https://bugs.webkit.org/show_bug.cgi?id=175467
3294         <rdar://problem/33667497>
3295
3296         Reviewed by Simon Fraser.
3297
3298         * crypto/mac/SerializedCryptoKeyWrapMac.mm:
3299
3300 2017-08-11  Brady Eidson  <beidson@apple.com>
3301
3302         Crash under ServiceWorkerJob::failedWithException.
3303         https://bugs.webkit.org/show_bug.cgi?id=175488
3304
3305         Reviewed by Tim Horton.
3306
3307         Covered by existing tests.
3308
3309         * workers/ServiceWorkerJob.cpp:
3310         (WebCore::ServiceWorkerJob::failedWithException): jobDidFinish might cause the Job to be deleted, so make it last.
3311
3312 2017-08-10  Sam Weinig  <sam@webkit.org>
3313
3314         WTF::Function does not allow for reference / non-default constructible return types
3315         https://bugs.webkit.org/show_bug.cgi?id=175244
3316
3317         Reviewed by Chris Dumez.
3318
3319         * bindings/js/JSCustomElementInterface.h:
3320         (WebCore::JSCustomElementInterface::invokeCallback):
3321         Update the default value for the addArguments parameter to be an empty lambda, rather than
3322         default initialization, which leads to a null WTF::Function. This allows us to remove support
3323         for calling null WTF::Function. No change in behavior.
3324
3325 2017-08-11  Antti Koivisto  <antti@apple.com>
3326
3327         Remove RenderQuote collection from RenderView
3328         https://bugs.webkit.org/show_bug.cgi?id=175479
3329
3330         Reviewed by Andreas Kling.
3331
3332         We can do it well enough without maintaining this pointer structure.
3333
3334         Global updating doesn't work well with future direction for first-letter and similar anyway.
3335         We need to update quote immediately when updating its style.
3336
3337         * rendering/RenderQuote.cpp:
3338         (WebCore::RenderQuote::insertedIntoTree):
3339         (WebCore::RenderQuote::willBeRemovedFromTree):
3340
3341             Just tell the view that there are renderers to update.
3342
3343         (WebCore::RenderQuote::styleDidChange):
3344         (WebCore::RenderQuote::isOpen const):
3345         (WebCore::RenderQuote::updateRenderer):
3346         (WebCore::RenderQuote::updateRenderers): Deleted.
3347
3348             Update single renderer only. RenderTreeUpdater provides the previous renderer to compute the depth.
3349
3350         * rendering/RenderQuote.h:
3351         * rendering/RenderView.cpp:
3352         (WebCore::RenderView::registerQuote): Deleted.
3353         (WebCore::RenderView::unregisterQuote): Deleted.
3354         (WebCore::RenderView::updateSpecialRenderers): Deleted.
3355
3356             Remove the quote list.
3357
3358         * rendering/RenderView.h:
3359         * style/RenderTreeUpdater.cpp:
3360         (WebCore::RenderTreeUpdater::commit):
3361
3362             Ensure that all quotes are updated.
3363
3364         (WebCore::RenderTreeUpdater::updateBeforeOrAfterPseudoElement):
3365         (WebCore::RenderTreeUpdater::updateQuotesUpTo):
3366
3367             Traverse render tree to find quotes to update starting from the previous updated quote.
3368
3369         * style/RenderTreeUpdater.h:
3370
3371 2017-08-11  Adrian Perez de Castro  <aperez@igalia.com>
3372
3373         [CMake] Many warning about missing “override” keywords in ANGLE with Clang
3374         https://bugs.webkit.org/show_bug.cgi?id=175475
3375
3376         Reviewed by Michael Catanzaro.
3377
3378         * CMakeLists.txt: Add "-Wno-inconsistent-missing-override" to the
3379         compiler flags using for building the ANGLE sources.
3380
3381 2017-08-11  Adrian Perez de Castro  <aperez@igalia.com>
3382
3383         [GTK][WPE] Overriden virtual function not marked “override” in ImageBufferDataCairo.h
3384         https://bugs.webkit.org/show_bug.cgi?id=175476
3385
3386         Reviewed by Carlos Garcia Campos.
3387
3388         * platform/graphics/cairo/ImageBufferDataCairo.h: Add missing "override" qualifier.
3389
3390 2017-08-11  Carlos Garcia Campos  <cgarcia@igalia.com>
3391
3392         [Soup] Cannot access HTTPS sites using a HTTP proxy that requires authentication
3393         https://bugs.webkit.org/show_bug.cgi?id=175378
3394
3395         Reviewed by Sergio Villar Senin.
3396
3397         Bring back part of the code removed in r206732, to keep a reference to the SoupMessage in the
3398         AuthenticationChallenge since it can be different to the resource message.
3399
3400         * platform/network/soup/AuthenticationChallenge.h:
3401         (WebCore::AuthenticationChallenge::AuthenticationChallenge): Deleted.
3402         (WebCore::AuthenticationChallenge::authenticationClient const): Deleted.
3403         (WebCore::AuthenticationChallenge::soupAuth const): Deleted.
3404         (WebCore::AuthenticationChallenge::setProposedCredential): Deleted.
3405         * platform/network/soup/AuthenticationChallengeSoup.cpp:
3406         (WebCore::AuthenticationChallenge::AuthenticationChallenge):
3407         (WebCore::AuthenticationChallenge::platformCompare):
3408
3409 2017-08-10  Dan Bernstein  <mitz@apple.com>
3410
3411         Fixed building for macOS 10.12 with the macOS 10.13 SDK.
3412
3413         Suppressed the unguarded-availability-new warning around uses of AVSampleBufferAudioRenderer
3414         and AVSampleBufferRenderSynchronizer. Even though the 10.13 SDK declares them as available
3415         starting in that release, they have been available as SPI earlier.
3416
3417         * platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.h:
3418         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
3419         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
3420         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setHasAvailableAudioSample):
3421         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::addAudioRenderer):
3422         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::removeAudioRenderer):
3423         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
3424         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
3425         (-[WebAVSampleBufferErrorListener beginObservingRenderer:]):
3426         (-[WebAVSampleBufferErrorListener stopObservingRenderer:]):
3427         (-[WebAVSampleBufferErrorListener observeValueForKeyPath:ofObject:change:context:]):
3428         (WebCore::SourceBufferPrivateAVFObjC::trackDidChangeEnabled):
3429         (WebCore::SourceBufferPrivateAVFObjC::rendererDidReceiveError):
3430         (WebCore::SourceBufferPrivateAVFObjC::flush):
3431
3432 2017-08-10  Brady Eidson  <beidson@apple.com>
3433
3434         Rename the source files for the WTF persistent coders.
3435         https://bugs.webkit.org/show_bug.cgi?id=175441
3436
3437         Reviewed by Tim Horton.
3438
3439         * platform/network/NetworkLoadMetrics.h:
3440
3441 2017-08-10  Yusuke Suzuki  <utatane.tea@gmail.com>
3442
3443         Make ThreadGlobalData RefCounted for web thread
3444         https://bugs.webkit.org/show_bug.cgi?id=175439
3445
3446         Reviewed by Mark Lam.
3447
3448         When the web thread is enabled, we share ThreadGlobalData between the web thread and the main thread.
3449         The problem happens when the main thread is dying. It could start deallocating TLS and the web
3450         thread may see the destructed ThreadGlobalData.
3451
3452         Even though, the current implementation is safe because the main thread do not perform TLS deallocation
3453         in the Darwin environment. But this is not true in Windows. And we should not rely on this condition
3454         that depends on the platforms.
3455
3456         In this patch, we make ThreadGlobalData ThreadSafeRefCounted. This type verbosely describes that
3457         ThreadGlobalData could be shared between threads when the web thread enabled. And make the life time
3458         management simple instead of relying on the platform dependent TLS implementation.
3459
3460         * platform/ThreadGlobalData.cpp:
3461         (WebCore::ThreadGlobalData::setWebCoreThreadData):
3462         (WebCore::threadGlobalData):
3463         * platform/ThreadGlobalData.h:
3464         (WebCore::ThreadGlobalData::cachedResourceRequestInitiators): Deleted.
3465         (WebCore::ThreadGlobalData::eventNames): Deleted.
3466         (WebCore::ThreadGlobalData::threadTimers): Deleted.
3467         (WebCore::ThreadGlobalData::qualifiedNameCache): Deleted.
3468         (WebCore::ThreadGlobalData::cachedConverterICU): Deleted.
3469         (WebCore::ThreadGlobalData::cachedConverterTEC): Deleted.
3470
3471 2017-08-10  Yusuke Suzuki  <utatane.tea@gmail.com>
3472
3473         [JSC] Use @toNumber in builtins
3474         https://bugs.webkit.org/show_bug.cgi?id=172692
3475
3476         Reviewed by Sam Weinig.
3477
3478         Use @toNumber bytecode intrinsic. It emits op_to_number, which efficiently converts
3479         a given argument to a number.
3480
3481         * Modules/streams/ReadableByteStreamInternals.js:
3482         (privateInitializeReadableByteStreamController):
3483         (readableByteStreamControllerRespond):
3484         * Modules/streams/StreamInternals.js:
3485         (validateAndNormalizeQueuingStrategy):
3486         (enqueueValueWithSize):
3487
3488 2017-08-10  Nan Wang  <n_wang@apple.com>
3489
3490         AX: crash at WebCore::AccessibilityObject::supportsARIALiveRegion() const + 24
3491         https://bugs.webkit.org/show_bug.cgi?id=175340
3492         <rdar://problem/33782159>
3493
3494         Reviewed by Chris Fleizach.
3495
3496         The issue here is that we manualy set the parent object of the AccessibilitySVGRoot object
3497         and there are chances that the parent doesn't detach it properly during the parent's destroying
3498         process. Accessing the stale parent object will lead to a crash.
3499         Fixed this by making the parent object a weak pointer so we don't access an invalid memory. 
3500
3501         Test: accessibility/add-children-pseudo-element.html
3502
3503         * accessibility/AccessibilityRenderObject.cpp:
3504         (WebCore::AccessibilityRenderObject::AccessibilityRenderObject):
3505         * accessibility/AccessibilityRenderObject.h:
3506         (WebCore::AccessibilityRenderObject::createWeakPtr):
3507         * accessibility/AccessibilitySVGRoot.cpp:
3508         (WebCore::AccessibilitySVGRoot::AccessibilitySVGRoot):
3509         (WebCore::AccessibilitySVGRoot::setParent):
3510         (WebCore::AccessibilitySVGRoot::parentObject const):
3511         * accessibility/AccessibilitySVGRoot.h:
3512
3513 2017-08-10  Chris Dumez  <cdumez@apple.com>
3514
3515         [Beacon] Do connect-src CSP check on redirects as well
3516         https://bugs.webkit.org/show_bug.cgi?id=175410
3517         <rdar://problem/33815470>
3518
3519         Reviewed by Youenn Fablet.
3520
3521         Pass ContentSecurityPolicy object to createPingHandle so that we can send
3522         enough data to the NetworkProcess so do CSP checks for Ping loads such
3523         as Beacon. For the IPC, we serialize the ContentSecurityPolicy's response
3524         headers. Those headers are now cached in ContentSecurityPolicy for
3525         performance reasons. CSP headers are rarely updated in practice but
3526         sendBeacon() may get called repeatedly for a given document.
3527
3528         Tests: http/wpt/beacon/connect-src-beacon-redirect-allowed.sub.html
3529                http/wpt/beacon/connect-src-beacon-redirect-blocked.sub.html
3530
3531         * loader/LoaderStrategy.h:
3532         * loader/PingLoader.cpp:
3533         (WebCore::PingLoader::loadImage):
3534         (WebCore::PingLoader::sendPing):
3535         (WebCore::PingLoader::sendViolationReport):
3536         (WebCore::PingLoader::startPingLoad):
3537         * loader/PingLoader.h:
3538         * loader/cache/CachedResource.cpp:
3539         (WebCore::CachedResource::load):
3540         * page/csp/ContentSecurityPolicy.cpp:
3541         (WebCore::ContentSecurityPolicy::responseHeaders const):
3542         (WebCore::ContentSecurityPolicy::didReceiveHeader):
3543         * page/csp/ContentSecurityPolicy.h:
3544         * page/csp/ContentSecurityPolicyResponseHeaders.h:
3545         (WebCore::ContentSecurityPolicyResponseHeaders::encode const):
3546         (WebCore::ContentSecurityPolicyResponseHeaders::decode):
3547
3548 2017-08-09  Yusuke Suzuki  <utatane.tea@gmail.com>
3549
3550         [WTF] ThreadSpecific should not introduce additional indirection
3551         https://bugs.webkit.org/show_bug.cgi?id=175187
3552
3553         Reviewed by Mark Lam.
3554
3555         We drop ThreadSpecific::replace feature which is only used by
3556         Web thread. Instead, we use ThreadSpecific<std::unique_ptr<T>> here.
3557
3558         While this std::unique_ptr<T> shares one instance between main thread
3559         and web thread, this is the same to the current implementation. It is
3560         safe because the web thread never finishes.
3561
3562         And for non-web thread implementation, we just use ThreadSpecific<T>,
3563         since it is the most efficient.
3564
3565         * platform/ThreadGlobalData.cpp:
3566         (WebCore::ThreadGlobalData::ThreadGlobalData):
3567         (WebCore::ThreadGlobalData::setWebCoreThreadData):
3568         (WebCore::threadGlobalData):
3569         We also drop StringImpl::empty() call since it is not necessary now:
3570         StringImpl::empty data is statically initialized by using constexpr.
3571
3572         * platform/ThreadGlobalData.h:
3573         We make it FAST_ALLOCATED since it is previously allocated by fast malloc
3574         in ThreadSpecific.
3575
3576 2017-08-10  Michael Catanzaro  <mcatanzaro@igalia.com>
3577
3578         REGRESSION(r220515) [GTK][CMake] Build with ENABLE_GEOLOCATION fails on Debian Jessie
3579         https://bugs.webkit.org/show_bug.cgi?id=175426
3580
3581         Reviewed by Carlos Alberto Lopez Perez.
3582
3583         Also stop using GEOCLUE_LIBRARIES and GEOCLUE_INCLUDE_DIRS, since they are empty. Apparently
3584         we have not actually been using the client library at all this whole time, only the D-Bus
3585         interface.
3586
3587         * PlatformGTK.cmake:
3588
3589 2017-08-10  Brady Eidson  <beidson@apple.com>
3590
3591         Add ServiceWorkerJob.
3592         https://bugs.webkit.org/show_bug.cgi?id=175241
3593
3594         Reviewed by Tim Horton.
3595
3596         Test: http/tests/workers/service/basic-register.html
3597
3598         This patch does a few things:
3599         - Adds the spec concept of a ServiceWorkerJob (in the WebProcess, at least)
3600         - Adds a ServiceWorkerProvider interface for WebKit to implement
3601         - Actually creates a job for service worker registration and "schedules" it,
3602           though it always immediately errors out the promise.
3603
3604         Actually queuing jobs and executing asynchronously is coming up soon.
3605
3606         * CMakeLists.txt:
3607         * WebCore.xcodeproj/project.pbxproj:
3608
3609         * dom/Document.cpp:
3610         (WebCore::Document::sessionID const):
3611         * dom/Document.h:
3612
3613         * workers/ServiceWorkerContainer.cpp:
3614         (WebCore::ServiceWorkerContainer::~ServiceWorkerContainer):
3615         (WebCore::ServiceWorkerContainer::addRegistration):
3616         (WebCore::ServiceWorkerContainer::scheduleJob):
3617         (WebCore::ServiceWorkerContainer::jobDidFinish):
3618         * workers/ServiceWorkerContainer.h:
3619
3620         * workers/ServiceWorkerJob.cpp: Added.
3621         (WebCore::ServiceWorkerJob::ServiceWorkerJob):
3622         (WebCore::ServiceWorkerJob::~ServiceWorkerJob):
3623         (WebCore::ServiceWorkerJob::failedWithException):
3624         * workers/ServiceWorkerJob.h: Copied from Source/WebCore/workers/ServiceWorkerContainer.h.
3625         (WebCore::ServiceWorkerJob::createRegisterJob):
3626         (WebCore::ServiceWorkerJob::identifier const):
3627
3628         * workers/ServiceWorkerJobClient.h: Added.
3629         (WebCore::ServiceWorkerJobClient::~ServiceWorkerJobClient):
3630
3631         * workers/ServiceWorkerProvider.cpp: Added.
3632         (WebCore::ServiceWorkerProvider::singleton):
3633         (WebCore::ServiceWorkerProvider::setSharedProvider):
3634         * workers/ServiceWorkerProvider.h: Added.
3635         * workers/ServiceWorkerRegistrationOptions.h: Copied from Source/WebCore/workers/ServiceWorkerContainer.h.
3636         * workers/ServiceWorkerRegistrationParameters.cpp: Added.
3637         * workers/ServiceWorkerRegistrationParameters.h: Added.
3638
3639 2017-08-10  Tim Horton  <timothy_horton@apple.com>
3640
3641         Remove some unused lambda captures so that WebKit builds with -Wunused-lambda-capture
3642         https://bugs.webkit.org/show_bug.cgi?id=175436
3643         <rdar://problem/33667497>
3644
3645         Reviewed by Simon Fraser.
3646
3647         * platform/audio/cocoa/MediaSessionManagerCocoa.cpp:
3648         (PlatformMediaSessionManager::updateSessionState):
3649         * platform/graphics/cocoa/WebCoreDecompressionSession.mm:
3650         (WebCore::WebCoreDecompressionSession::handleDecompressionOutput):
3651
3652 2017-08-10  Commit Queue  <commit-queue@webkit.org>
3653
3654         Unreviewed, rolling out r220463.
3655         https://bugs.webkit.org/show_bug.cgi?id=175435
3656
3657         unaccepted fix (Requested by n_wang on #webkit).
3658
3659         Reverted changeset:
3660
3661         "AX: crash at
3662         WebCore::AccessibilityObject::supportsARIALiveRegion() const +
3663         24"
3664         https://bugs.webkit.org/show_bug.cgi?id=175340
3665         http://trac.webkit.org/changeset/220463
3666
3667 2017-08-10  Michael Catanzaro  <mcatanzaro@igalia.com>
3668
3669         Remove ENABLE_GAMEPAD_DEPRECATED
3670         https://bugs.webkit.org/show_bug.cgi?id=175361
3671
3672         Reviewed by Carlos Garcia Campos.
3673
3674         * CMakeLists.txt:
3675         * Configurations/FeatureDefines.xcconfig:
3676         * PlatformGTK.cmake:
3677         * PlatformWPE.cmake:
3678         * platform/Linux.cmake: Removed.
3679         * platform/gamepad/deprecated/Gamepads.h: Removed.
3680         * platform/gamepad/glib/GamepadsGlib.cpp: Removed.
3681         * platform/gamepad/linux/GamepadDeviceLinux.cpp: Removed.
3682         * platform/gamepad/linux/GamepadDeviceLinux.h: Removed.
3683
3684 2017-08-10  Myles C. Maxfield  <mmaxfield@apple.com>
3685
3686         Addressing post-review comments after r219173.
3687         https://bugs.webkit.org/show_bug.cgi?id=174149
3688
3689         Unreviewed.
3690
3691         * css/CSSFontStyleValue.h:
3692         * editing/EditingStyle.cpp:
3693         (WebCore::identifierForStyleProperty):
3694
3695 2017-08-10  Antti Koivisto  <antti@apple.com>
3696
3697         Try to fix windows build.
3698
3699         * style/StyleUpdate.h:
3700         (WebCore::Style::TextUpdate::TextUpdate):
3701
3702 2017-08-10  Carlos Garcia Campos  <cgarcia@igalia.com>
3703
3704         [GTK] Crashes in WebCore::PasteboardHelper::fillSelectionData when source file of drag is unavailable
3705         https://bugs.webkit.org/show_bug.cgi?id=174161
3706
3707         Reviewed by Xabier Rodriguez-Calvar.
3708
3709         In r219385 we changed the early return in fillSelectionData() to check the selection data length instead of the
3710         data pointer. However, the gtk_selection_data_get_length() can return -1, so we need to check also if the value
3711         less than 0. The case of setting an empty string could be valid depending on the target type, so it's better to
3712         return early only when data lenght is less than 0 and handle the 0 length case in each target.
3713
3714         * platform/gtk/PasteboardHelper.cpp:
3715         (WebCore::PasteboardHelper::fillSelectionData):
3716
3717 2017-08-10  Antti Koivisto  <antti@apple.com>
3718
3719         Text renderer updates should be done by RenderTreeUpdater
3720         https://bugs.webkit.org/show_bug.cgi?id=175417
3721
3722         Reviewed by Andreas Kling.
3723
3724         All render tree mutations should be done by RenderTreeUpdater. Currently
3725         Text::updateRendererAfterContentChange calls RenderText::setTextWithOffset directly.
3726
3727         * dom/Document.cpp:
3728         (WebCore::Document::updateTextRenderer):
3729
3730             Add range argument.
3731
3732         * dom/Document.h:
3733         * dom/Text.cpp:
3734         (WebCore::Text::updateRendererAfterContentChange):
3735
3736             Remove call to setTextWithOffset and pass the range to updateTextRenderer
3737
3738         * style/RenderTreeUpdater.cpp:
3739         (WebCore::RenderTreeUpdater::updateRenderTree):
3740         (WebCore::RenderTreeUpdater::updateTextRenderer):
3741
3742             Call setTextWithOffset here.
3743
3744         * style/RenderTreeUpdater.h:
3745         * style/StyleTreeResolver.cpp:
3746         (WebCore::Style::TreeResolver::resolveComposedTree):
3747         * style/StyleUpdate.cpp:
3748         (WebCore::Style::Update::textUpdate const):
3749         (WebCore::Style::Update::addText):
3750
3751             Add TextUpdate struct similar to ElementUpdate to pass the range to the RenderTreeUpdater.
3752
3753         * style/StyleUpdate.h:
3754
3755 2017-08-10  Zan Dobersek  <zdobersek@igalia.com>
3756
3757         Unreviewed GTK+ build fix for ENABLE_GLES2=ON.
3758
3759         * platform/graphics/texmap/TextureMapperGLHeaders.h:
3760         Define various GL constants that are not provided in GLES2 headers
3761         but are only leveraged in OpenGL calls if at runtime the underlying
3762         OpenGL is GLES2-capable.
3763
3764 2017-08-10  Zan Dobersek  <zdobersek@igalia.com>
3765
3766         [TexMap] Remove GraphicsContext3D usage from BitmapTexturePool
3767         https://bugs.webkit.org/show_bug.cgi?id=175319
3768
3769         Reviewed by Carlos Garcia Campos.
3770
3771         Drop the GraphicsContext3D reference in BitmapTexturePool now
3772         that the BitmapTextureGL doesn't require it anymore.
3773
3774         No new tests -- no change in behavior.
3775
3776         * platform/graphics/texmap/BitmapTexturePool.cpp:
3777         (WebCore::BitmapTexturePool::BitmapTexturePool):
3778         * platform/graphics/texmap/BitmapTexturePool.h:
3779         * platform/graphics/texmap/TextureMapperGL.cpp:
3780         (WebCore::TextureMapperGL::TextureMapperGL):
3781
3782 2017-08-10  Zan Dobersek  <zdobersek@igalia.com>
3783
3784         [TexMap] Drop GraphicsContext3D usage from BitmapTextureGL
3785         https://bugs.webkit.org/show_bug.cgi?id=175317
3786
3787         Reviewed by Carlos Garcia Campos.
3788
3789         Have BitmapTextureGL use direct OpenGL API entrypoints and constants
3790         instead of leveraging the GraphicsContext3D class. Any GraphicsContext3D
3791         object passed to BitmapTextureGL would assume rendering to the GL context
3792         that's current on that thread, translating method invocations to the
3793         OpenGL API. We can do this by ourselves and benefit by avoiding allocating
3794         GraphicsContext3D resources like the ANGLE compiler that are by most useful
3795         for WebGL.
3796
3797         BitmapTextureGL::create() call sites are adjusted to stop passing a
3798         GraphicsContext3D reference. BitmapTextureGL::bindAsSurface() doesn't need
3799         a replacement for the passed-in GraphicsContext3D object since that object
3800         originated from the TextureMapperGL instance, whose GraphicsContext3D is by
3801         default of the render-to-current-context nature. Other changes are direct
3802         translations of GraphicsContext3D methods to OpenGL API calls, or of
3803         GraphicsContext3D values to OpenGL API constants.
3804
3805         No new tests -- no change in behavior.
3806
3807         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
3808         (WebCore::MediaPlayerPrivateGStreamerBase::pushTextureToCompositor):
3809         * platform/graphics/texmap/BitmapTextureGL.cpp:
3810         Also remove an unnecessary GraphicsContext.h header inclusion.
3811         (WebCore::BitmapTextureGL::BitmapTextureGL):
3812         (WebCore::BitmapTextureGL::didReset):
3813         (WebCore::BitmapTextureGL::updateContentsNoSwizzle):
3814         (WebCore::BitmapTextureGL::updateContents):
3815         (WebCore::BitmapTextureGL::initializeStencil):
3816         (WebCore::BitmapTextureGL::initializeDepthBuffer):
3817         (WebCore::BitmapTextureGL::clearIfNeeded):
3818         (WebCore::BitmapTextureGL::createFboIfNeeded):
3819         (WebCore::BitmapTextureGL::bindAsSurface):
3820         (WebCore::BitmapTextureGL::~BitmapTextureGL):
3821         (WebCore::BitmapTextureGL::copyFromExternalTexture):
3822         * platform/graphics/texmap/BitmapTextureGL.h:
3823         (WebCore::BitmapTextureGL::create):
3824         (WebCore::BitmapTextureGL::textureTarget const):
3825         (WebCore::BitmapTextureGL::internalFormat const):
3826         * platform/graphics/texmap/BitmapTexturePool.cpp:
3827         (WebCore::BitmapTexturePool::createTexture):
3828         * platform/graphics/texmap/TextureMapperGL.cpp:
3829         (WebCore::TextureMapperGL::bindSurface):
3830         (WebCore::TextureMapperGL::createTexture):
3831
3832 2017-08-09  Michael Catanzaro  <mcatanzaro@igalia.com>
3833
3834         [GTK] Remove support for geoclue1
3835         https://bugs.webkit.org/show_bug.cgi?id=164205
3836
3837         Reviewed by Carlos Garcia Campos.
3838
3839         * PlatformGTK.cmake:
3840         * platform/geoclue/GeolocationProviderGeoclue.h:
3841         * platform/geoclue/GeolocationProviderGeoclue1.cpp: Removed.
3842         * platform/geoclue/GeolocationProviderGeoclue2.cpp: Removed.
3843
3844 2017-08-09  Yoshiaki Jitsukawa  <Yoshiaki.Jitsukawa@sony.com>
3845
3846         [PAL] Move spi/cocoa and spi/cg directories into PAL
3847         https://bugs.webkit.org/show_bug.cgi?id=175175
3848
3849         Reviewed by Myles C. Maxfield.
3850
3851         * Modules/applepay/cocoa/PaymentCocoa.mm:
3852         * Modules/applepay/cocoa/PaymentContactCocoa.mm:
3853         * Modules/applepay/cocoa/PaymentMerchantSessionCocoa.mm:
3854         * Modules/applepay/cocoa/PaymentMethodCocoa.mm:
3855         * PlatformAppleWin.cmake:
3856         * WebCore.xcodeproj/project.pbxproj:
3857         * editing/cocoa/EditorCocoa.mm:
3858         * editing/cocoa/HTMLConverter.mm:
3859         * editing/ios/EditorIOS.mm:
3860         * page/cocoa/ResourceUsageThreadCocoa.mm:
3861         * page/mac/TextIndicatorWindow.mm:
3862         * platform/cocoa/ContentFilterUnblockHandlerCocoa.mm:
3863         * platform/cocoa/DataDetectorsCoreSoftLink.h:
3864         * platform/cocoa/MIMETypeRegistryCocoa.mm:
3865         * platform/cocoa/NetworkExtensionContentFilter.mm:
3866         * platform/cocoa/ParentalControlsContentFilter.mm:
3867         * platform/cocoa/SleepDisablerCocoa.cpp:
3868         * platform/graphics/Font.cpp:
3869         * platform/graphics/Font.h:
3870         * platform/graphics/avfoundation/objc/AVAssetTrackUtilities.mm:
3871         * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm:
3872         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3873         * platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.mm:
3874         * platform/graphics/ca/cocoa/PlatformCAAnimationCocoa.mm:
3875         * platform/graphics/ca/cocoa/PlatformCAFiltersCocoa.mm:
3876         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
3877         * platform/graphics/cg/ColorCG.cpp:
3878         * platform/graphics/cg/GraphicsContextCG.cpp:
3879         * platform/graphics/cg/ImageBufferCG.cpp:
3880         * platform/graphics/cg/ImageBufferDataCG.cpp:
3881         * platform/graphics/cg/ImageDecoderCG.cpp:
3882         * platform/graphics/cg/NativeImageCG.cpp:
3883         * platform/graphics/cocoa/FontCacheCoreText.cpp:
3884         * platform/graphics/cocoa/FontCascadeCocoa.mm:
3885         * platform/graphics/cocoa/FontCocoa.mm:
3886         * platform/graphics/cocoa/FontDescriptionCocoa.cpp:
3887         * platform/graphics/cocoa/FontPlatformDataCocoa.mm:
3888         * platform/graphics/cocoa/IOSurface.mm:
3889         * platform/graphics/cocoa/TextTrackRepresentationCocoa.mm:
3890         * platform/graphics/cocoa/WebActionDisablingCALayerDelegate.h:
3891         * platform/graphics/ios/FontAntialiasingStateSaver.h:
3892         * platform/graphics/ios/FontCacheIOS.mm:
3893         * platform/graphics/mac/ComplexTextControllerCoreText.mm:
3894         * platform/graphics/mac/FontCacheMac.mm:
3895         * platform/graphics/mac/GlyphPageMac.cpp:
3896         * platform/graphics/win/FontCacheWin.cpp:
3897         * platform/ios/LegacyTileCache.mm:
3898         * platform/ios/LegacyTileGrid.mm:
3899         * platform/ios/LegacyTileGridTile.mm:
3900         * platform/ios/PlaybackSessionInterfaceAVKit.mm:
3901         * platform/ios/QuickLook.mm:
3902         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
3903         * platform/ios/WebAVPlayerController.h:
3904         * platform/ios/WebAVPlayerController.mm:
3905         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
3906         * platform/ios/wak/WKGraphics.mm:
3907         * platform/mac/DragImageMac.mm:
3908         * platform/mac/PlatformScreenMac.mm:
3909         * platform/mac/PlaybackSessionInterfaceMac.mm:
3910         * platform/mac/ThemeMac.mm:
3911         * platform/mac/VideoFullscreenInterfaceMac.mm:
3912         * platform/mac/WebPlaybackControlsManager.h:
3913         * platform/mac/WebVideoFullscreenHUDWindowController.mm:
3914         * platform/network/cocoa/CookieStorageObserver.mm:
3915         * platform/network/cocoa/NetworkLoadMetrics.mm:
3916         * platform/network/mac/AuthenticationMac.mm:
3917         * platform/network/mac/ResourceHandleMac.mm:
3918         * platform/spi/ios/DataDetectorsUISPI.h:
3919         * platform/spi/mac/DataDetectorsSPI.h:
3920         * platform/spi/mac/NSViewSPI.h:
3921         * rendering/RenderThemeCocoa.mm:
3922         * rendering/RenderThemeIOS.mm:
3923         * rendering/RenderThemeMac.mm:
3924
3925 2017-08-09  Don Olmstead  <don.olmstead@sony.com>
3926
3927         [WTF] Move TextStream into WTF
3928         https://bugs.webkit.org/show_bug.cgi?id=175211
3929
3930         Reviewed by Myles C. Maxfield.
3931
3932         No new tests. No change in behavior.
3933
3934         * CMakeLists.txt:
3935         * WebCore.xcodeproj/project.pbxproj:
3936         * dom/ComposedTreeIterator.cpp:
3937         * dom/Position.cpp:
3938         * dom/Position.h:
3939         * dom/Range.cpp:
3940         (WebCore::operator<<):
3941         * dom/Range.h:
3942         * dom/ViewportArguments.cpp:
3943         * dom/ViewportArguments.h:
3944         * editing/VisiblePosition.cpp:
3945         * editing/VisiblePosition.h:
3946         * editing/VisibleSelection.cpp:
3947         * editing/VisibleSelection.h:
3948         * html/HTMLVideoElement.cpp:
3949         * html/canvas/CanvasRenderingContext2D.cpp:
3950         * page/FrameView.cpp:
3951         * page/ViewportConfiguration.cpp:
3952         * page/ViewportConfiguration.h:
3953         * page/WheelEventDeltaFilter.cpp:
3954         * page/animation/CSSPropertyAnimation.cpp:
3955         * page/scrolling/AsyncScrollingCoordinator.cpp:
3956         * page/scrolling/ScrollingConstraints.cpp:
3957         * page/scrolling/ScrollingConstraints.h:
3958         * page/scrolling/ScrollingCoordinator.cpp:
3959         * page/scrolling/ScrollingCoordinator.h:
3960         * page/scrolling/ScrollingStateFixedNode.cpp:
3961         * page/scrolling/ScrollingStateFixedNode.h:
3962         * page/scrolling/ScrollingStateFrameScrollingNode.cpp:
3963         * page/scrolling/ScrollingStateFrameScrollingNode.h:
3964         * page/scrolling/ScrollingStateNode.cpp:
3965         * page/scrolling/ScrollingStateNode.h:
3966         * page/scrolling/ScrollingStateOverflowScrollingNode.cpp:
3967         * page/scrolling/ScrollingStateOverflowScrollingNode.h:
3968         * page/scrolling/ScrollingStateScrollingNode.cpp:
3969         * page/scrolling/ScrollingStateScrollingNode.h:
3970         * page/scrolling/ScrollingStateStickyNode.cpp:
3971         * page/scrolling/ScrollingStateStickyNode.h:
3972         * page/scrolling/ScrollingTree.cpp:
3973         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
3974         * page/scrolling/ScrollingTreeFrameScrollingNode.h:
3975         * page/scrolling/ScrollingTreeNode.cpp:
3976         * page/scrolling/ScrollingTreeNode.h:
3977         * page/scrolling/ScrollingTreeScrollingNode.cpp:
3978         * page/scrolling/ScrollingTreeScrollingNode.h:
3979         * page/scrolling/mac/ScrollingTreeFixedNode.h:
3980         * page/scrolling/mac/ScrollingTreeFixedNode.mm:
3981         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
3982         * page/scrolling/mac/ScrollingTreeStickyNode.h:
3983         * page/scrolling/mac/ScrollingTreeStickyNode.mm:
3984         * platform/CalculationValue.cpp:
3985         * platform/CalculationValue.h:
3986         *