c5aba775568b683ffc9ecea838e5af8de15c9686
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-08-30  Andy Estes  <aestes@apple.com>
2
3         [Mac] Upstream Accessibility-related WebKitSystemInterface functions
4         https://bugs.webkit.org/show_bug.cgi?id=176093
5
6         Reviewed by Eric Carlson.
7
8         * accessibility/mac/AXObjectCacheMac.mm:
9         (WebCore::AXObjectCache::platformHandleFocusedUIElementChanged):
10         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
11         (-[WebAccessibilityObjectWrapper unregisterUniqueIdForUIElement]):
12         (AXObjectIsTextMarker):
13         (AXObjectIsTextMarkerRange):
14         (AXTextMarkerRange):
15         (AXTextMarkerRangeStart):
16         (AXTextMarkerRangeEnd):
17         (getBytesFromAXTextMarker):
18         (isTextMarkerIgnored):
19         (accessibilityObjectForTextMarker):
20         (startOrEndTextmarkerForRange):
21         (nextTextMarkerForCharacterOffset):
22         (previousTextMarkerForCharacterOffset):
23         (textMarkerForCharacterOffset):
24         (characterOffsetForTextMarker):
25         (textMarkerForVisiblePosition):
26         (-[WebAccessibilityObjectWrapper textMarkerForFirstPositionInTextControl:]):
27         (visiblePositionForTextMarker):
28         (AXAttributeStringSetElement):
29         * platform/mac/WebCoreSystemInterface.h:
30         * platform/mac/WebCoreSystemInterface.mm:
31
32 2017-08-30  Antti Koivisto  <antti@apple.com>
33
34         RenderMultiColumnFlowThread - Avoid render tree mutation during layout
35         https://bugs.webkit.org/show_bug.cgi?id=176026
36         <rdar://problem/33402891>
37
38         Reviewed by Zalan Bujtas.
39
40         Mutations should be done in RenderTreeUpdater.
41
42         * rendering/RenderBlockFlow.cpp:
43         (WebCore::RenderBlockFlow::willCreateColumns const):
44
45             Don't create columns for RenderSVGBlock. Before this patch this was avoided because it
46             has custom layout() function that doesn't call to setComputedColumnCountAndWidth.
47             Same for mathml and ruby.
48
49             Don't create columns for pseudo elements (first-letter mostly).
50
51         (WebCore::RenderBlockFlow::setComputedColumnCountAndWidth):
52
53             This now assumes that the multicolumn renderer has been initialized correctly already.
54
55         * rendering/RenderBlockFlow.h:
56         * style/RenderTreeUpdater.cpp:
57         (WebCore::updateMultiColumnFlowThread):
58
59             Create or delte multicolumn renderer after descendants are known.
60
61         (WebCore::RenderTreeUpdater::commit):
62         (WebCore::RenderTreeUpdater::updateAfterDescendants):
63
64 2017-08-30  Said Abou-Hallawa  <sabouhallawa@apple.com>
65
66         The SVG fragment identifier is not respected if it is a part of an HTTP URL
67         https://bugs.webkit.org/show_bug.cgi?id=163811
68
69         Reviewed by Darin Adler.
70
71         If an image is referenced more than once in a page and the URL to that
72         image is an HTTP URL, one CachedImage is created for all the renderers
73         even if the original URLs have different fragmentIdentifiers. In this
74         case the fragment will be removed from the request which is associated
75         with the shared CachedImage. This CachedImage creates an SVGImage with
76         a URL but without a fragmentIdentifier. So SVGImage::draw() does not call
77         FrameView::scrollToFragment() and therefore the viewport is not setup
78         correctly for displaying the SVG in this case.
79
80         The fix is to move the url from the SVGImage to SVGImageForContainer.
81         Because there is one SVGImageForContainer created for every renderer,
82         we can move the full URL there. The drawing of an SVGImage has to start
83         from the SVGImageForContainer::draw() because the SVGImage may not have
84         an intrinsic size and the SVGImageForContainer is the one which knows
85         the destination rectangle. So SVGImageForContainer can pass the full url
86         to SVGImage::drawForContainer() which can be used to scrollToFragment()
87         before calling SVGImage::draw().
88         
89         For clarity and consistency, all setContainerSizeForRenderer() will be 
90         changed to setContainerContext() and the pair SizeAndZoom will be replaced
91         by the struct ContainerContext.
92
93         Tests: http/tests/svg/svg-fragment-background.html
94                http/tests/svg/svg-fragment-image.html
95
96         * css/CSSCursorImageValue.h:
97         * css/CSSImageSetValue.cpp:
98         (WebCore::CSSImageSetValue::fillImageSet):
99         * css/CSSImageSetValue.h:
100         * loader/cache/CachedImage.cpp:
101         (WebCore::CachedImage::didRemoveClient):
102         (WebCore::CachedImage::switchClientsToRevalidatedResource):
103         (WebCore::CachedImage::allClientsRemoved):
104         (WebCore::CachedImage::setContainerContextForClient):
105         (WebCore::CachedImage::clear):
106         (WebCore::CachedImage::createImage):
107         (WebCore::CachedImage::setContainerSizeForRenderer): Deleted.
108         * loader/cache/CachedImage.h:
109         * rendering/RenderBoxModelObject.cpp:
110         (WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry const):
111         (WebCore::RenderBoxModelObject::paintNinePieceImage):
112         * rendering/RenderImage.cpp:
113         (WebCore::RenderImage::updateInnerContentRect):
114         (WebCore::RenderImage::repaintOrMarkForLayout):
115         * rendering/RenderImageResource.cpp:
116         (WebCore::RenderImageResource::setContainerContext):
117         (WebCore::RenderImageResource::setContainerSizeForRenderer): Deleted.
118         * rendering/RenderImageResource.h:
119         * rendering/RenderImageResourceStyleImage.cpp:
120         (WebCore::RenderImageResourceStyleImage::setContainerContext):
121         (WebCore::RenderImageResourceStyleImage::setContainerSizeForRenderer): Deleted.
122         * rendering/RenderImageResourceStyleImage.h:
123         * rendering/RenderListMarker.cpp:
124         (WebCore::RenderListMarker::updateContent):
125         * rendering/shapes/ShapeOutsideInfo.cpp:
126         (WebCore::ShapeOutsideInfo::createShapeForImage const):
127         * rendering/style/StyleCachedImage.cpp:
128         (WebCore::StyleCachedImage::imageURL):
129         (WebCore::StyleCachedImage::setContainerContextForRenderer):
130         (WebCore::StyleCachedImage::setContainerSizeForRenderer): Deleted.
131         * rendering/style/StyleCachedImage.h:
132         * rendering/style/StyleGeneratedImage.h:
133         * rendering/style/StyleImage.h:
134         * rendering/svg/RenderSVGImage.cpp:
135         (WebCore::RenderSVGImage::updateImageViewport):
136         * svg/SVGImageElement.h:
137         * svg/graphics/SVGImage.cpp:
138         (WebCore::SVGImage::SVGImage):
139         (WebCore::SVGImage::drawForContainer):
140         (WebCore::SVGImage::drawPatternForContainer):
141         (WebCore::SVGImage::draw):
142         (WebCore::SVGImage::dump const): Deleted.
143         * svg/graphics/SVGImage.h:
144         * svg/graphics/SVGImageCache.cpp:
145         (WebCore::SVGImageCache::setContainerContextForClient):
146         (WebCore::SVGImageCache::setContainerSizeForRenderer): Deleted.
147         * svg/graphics/SVGImageCache.h:
148         * svg/graphics/SVGImageForContainer.cpp:
149         (WebCore::SVGImageForContainer::size const):
150         (WebCore::SVGImageForContainer::draw):
151         (WebCore::SVGImageForContainer::drawPattern):
152         * svg/graphics/SVGImageForContainer.h:
153
154 2017-08-29  Wenson Hsieh  <wenson_hsieh@apple.com>
155
156         REGRESSION(r210287) On drop, event.dataTransfer.getData("text") returns an empty string when dragging an image
157         https://bugs.webkit.org/show_bug.cgi?id=170637
158         <rdar://problem/31347248>
159
160         Reviewed by Ryosuke Niwa.
161
162         In r210287, the behavior of DragData::containsFiles was changed to return true if NSFilesPromisePboardType is
163         present in the pasteboard. This means that we will consider images dragged from web content, for which we add
164         the NSFilesPromisePboardType UTI, as containing files on the pasteboard; this, in turn, means we'll initialize
165         the DataTransfer upon drop with m_forFileDrag set to true. Due to early returns in getData() and setData() to
166         deny data access when dropping a dragged file, this means the page won't ever get access to the URL in the
167         pasteboard due to the presence of the NSFilesPromisePboardType UTI.
168
169         To fix this, we replace the early m_forFileDrag returns in getData and setData, instead early returning the null
170         string if there are any file URLs present on the pasteboard (determined via readFilenames() retrieving a non-
171         empty result).
172
173         Test: editing/pasteboard/drag-drop-href-as-text-data.html
174
175         * dom/DataTransfer.cpp:
176         (WebCore::DataTransfer::DataTransfer):
177         (WebCore::DataTransfer::getData const):
178         (WebCore::DataTransfer::setData):
179
180         Rather than bail upon forFileDrag() (formerly, m_forFileDrag) being true, bail if there are any file URLs
181         present on the pasteboard. It seems like this was the intention of the early return in the first place, to
182         prevent the page from being able to ask for a real file URL when dragging a file.
183
184         (WebCore::DataTransfer::files const):
185         (WebCore::DataTransfer::setDragImage):
186         (WebCore::DataTransfer::setDropEffect):
187         (WebCore::DataTransfer::setEffectAllowed):
188
189         Swap m_forDrag and m_forFileDrag with forDrag() and forFileDrag(), respectively.
190
191         * dom/DataTransfer.h:
192         (WebCore::DataTransfer::forDrag const):
193         (WebCore::DataTransfer::forFileDrag const):
194
195         Instead of caching two bools to represent state (m_forDrag and m_forFileDrag), just remember the DataTransfer's
196         m_type and turn the flags into const helpers that check for the value of m_type.
197
198 2017-08-29  Youenn Fablet  <youenn@apple.com>
199
200         [Fetch API] Request should throw when keep alive is true and body is a ReadableStream
201         https://bugs.webkit.org/show_bug.cgi?id=176083
202
203         Reviewed by Alex Christensen.
204
205         Covered by rebased test.
206
207         * Modules/fetch/FetchRequest.cpp:
208         (WebCore::FetchRequest::setBody):
209
210 2017-08-29  Don Olmstead  <don.olmstead@sony.com>
211
212         [CMake] Use find_package for zlib
213         https://bugs.webkit.org/show_bug.cgi?id=176075
214
215         Reviewed by Alex Christensen.
216
217         No new tests. No change in behavior.
218
219         * CMakeLists.txt:
220         * PlatformAppleWin.cmake:
221         * PlatformMac.cmake:
222         * PlatformWinCairo.cmake:
223
224 2017-08-29  Devin Rousso  <webkit@devinrousso.com>
225
226         CallTracingCallback should ignore `readonly attribute`
227         https://bugs.webkit.org/show_bug.cgi?id=176070
228
229         Reviewed by Matt Baker.
230
231         Update existing tests to remove calls to existing readonly attributes.
232
233         * bindings/scripts/CodeGeneratorJS.pm:
234         (GenerateAttributeGetterBodyDefinition):
235         If the attribute is marked `readonly` do not add logic for the `CallTracingCallback`.
236
237         * bindings/scripts/test/TestCallTracer.idl:
238         * bindings/scripts/test/JS/JSTestCallTracer.cpp:
239         (WebCore::JSTestCallTracerConstructor::initializeProperties):
240         (WebCore::jsTestCallTracerTestReadonlyAttributeGetter):
241         (WebCore::jsTestCallTracerTestReadonlyAttribute):
242
243 2017-08-29  Said Abou-Hallawa  <sabouhallawa@apple.com>
244
245         Assertion failure when opening a file with a missing tag closing bracket
246         https://bugs.webkit.org/show_bug.cgi?id=176061
247
248         Reviewed by Darin Adler.
249
250         If a tag is missing its closing bracket, the tokenizer just needs to advance()
251         the character position without checking m_currentCharacter != '\n'. Newline
252         character is a valid ending for partially closed tags.
253
254         Test: fast/tokenizer/missing-script-tag-closing-bracket.html
255
256         * html/parser/HTMLTokenizer.cpp:
257         (WebCore::HTMLTokenizer::commitToPartialEndTag):
258
259 2017-08-29  Brady Eidson  <beidson@apple.com>
260
261         Rename "potentionally trustworthy" to "potentially trustworthy"
262         https://bugs.webkit.org/show_bug.cgi?id=176081
263
264         Reviewed by Daniel Bates.
265
266         The Secure Context spec refers to this as "potentially trustworthy"
267         
268         It's possible that this was done potentionally, but we should follow the spec to alleviate confusion.
269
270         * dom/Document.cpp:
271         (WebCore::Document::isSecureContext const):
272         * page/SecurityOrigin.cpp:
273         (WebCore::shouldTreatAsPotentiallyTrustworthy):
274         (WebCore::shouldTreatAsPotentionallyTrustworthy): Deleted.
275         * page/SecurityOrigin.h:
276         (WebCore::SecurityOrigin::isPotentiallyTrustworthy const):
277         (WebCore::SecurityOrigin::isPotentionallyTrustworthy const): Deleted.
278         * workers/WorkerGlobalScope.cpp:
279         (WebCore::WorkerGlobalScope::isSecureContext const):
280
281 2017-08-29  Youenn Fablet  <youenn@apple.com>
282
283         Add support for FetchRequest.body
284         https://bugs.webkit.org/show_bug.cgi?id=176066
285
286         Reviewed by Alex Christensen.
287
288         Covered by existing tests.
289
290         Adding support for body attribute getter for FetchRequest.
291         To do so, FetchRequest will need to create a ReadableStream.
292         Adding support for DOM based creation of ReadableStream and conversion to JS values.
293         Small refactoring to make names more consistent.
294
295         * CMakeLists.txt:
296         * Modules/beacon/NavigatorBeacon.cpp:
297         (WebCore::NavigatorBeacon::sendBeacon):
298         * Modules/cache/Cache.cpp:
299         (WebCore::Cache::put):
300         * Modules/fetch/FetchBody.cpp:
301         (WebCore::FetchBody::extract):
302         * Modules/fetch/FetchBody.h:
303         (WebCore::FetchBody::hasReadableStream const):
304         (WebCore::FetchBody::readableStream):
305         (WebCore::FetchBody::setReadableStream):
306         (WebCore::FetchBody::FetchBody):
307         (WebCore::FetchBody::isReadableStream const): Deleted.
308         (WebCore::FetchBody::setAsReadableStream): Deleted.
309         * Modules/fetch/FetchBody.idl:
310         * Modules/fetch/FetchBodyOwner.cpp:
311         (WebCore::FetchBodyOwner::readableStream):
312         * Modules/fetch/FetchBodyOwner.h:
313         (WebCore::FetchBodyOwner::hasReadableStreamBody const):
314         (WebCore::FetchBodyOwner::isReadableStreamBody const): Deleted.
315         * Modules/fetch/FetchRequest.cpp:
316         (WebCore::FetchRequest::setBody):
317         * Modules/fetch/FetchRequest.h:
318         * Modules/fetch/FetchResponse.cpp:
319         (WebCore::FetchResponse::setBodyAsReadableStream):
320         (WebCore::FetchResponse::fetch):
321         * Modules/fetch/FetchResponse.h:
322         * WebCore.xcodeproj/project.pbxproj:
323         * bindings/js/ReadableStream.h:
324         (WebCore::JSConverter<IDLInterface<ReadableStream>>::convert):
325
326 2017-08-29  Yusuke Suzuki  <utatane.tea@gmail.com>
327
328         [JSC] Use reifying system for "name" property of builtin JSFunction
329         https://bugs.webkit.org/show_bug.cgi?id=175260
330
331         Reviewed by Saam Barati.
332
333         Use @getter for JSBuiltin getters.
334
335         * Modules/fetch/FetchResponse.js:
336         (bodyUsed): Deleted.
337         (body): Deleted.
338         * Modules/streams/ReadableByteStreamController.js:
339         (byobRequest): Deleted.
340         (desiredSize): Deleted.
341         * Modules/streams/ReadableStream.js:
342         (locked): Deleted.
343         * Modules/streams/ReadableStreamBYOBReader.js:
344         (closed): Deleted.
345         * Modules/streams/ReadableStreamBYOBRequest.js:
346         (view): Deleted.
347         * Modules/streams/ReadableStreamDefaultController.js:
348         (desiredSize): Deleted.
349         * Modules/streams/ReadableStreamDefaultReader.js:
350         (closed): Deleted.
351         * Modules/streams/WritableStream.js:
352         (closed): Deleted.
353         (ready): Deleted.
354         (state): Deleted.
355         * bindings/js/JSDOMBuiltinConstructor.h:
356         (WebCore::JSDOMBuiltinConstructor<JSClass>::finishCreation):
357
358 2017-08-29  Andy Estes  <aestes@apple.com>
359
360         REGRESSION (r215290): "Where From" metadata is empty when dragging an image out of Safari
361         https://bugs.webkit.org/show_bug.cgi?id=176068
362
363         Reviewed by Wenson Hsieh.
364
365         If you drag an image out of Safari, drop it on the Desktop, and open "Get Info", there is a
366         "Where from:" field under "More Info" that should list the image's URL. After r215290, this
367         field is blank due to a mixup with the string passed to URLWithUserTypedString().
368
369         Fix this by passing metadataURLString to URLWithUserTypedString() instead of urlString.
370
371         Not possible to reliably test this since WebKit adds metadata on a global concurrent queue.
372
373         * platform/mac/FileSystemMac.mm:
374         (WebCore::setMetadataURL):
375
376 2017-08-29  Youenn Fablet  <youenn@apple.com>
377
378         CacheStorage does not need to sort its caches
379         https://bugs.webkit.org/show_bug.cgi?id=176059
380
381         Reviewed by Chris Dumez.
382
383         Covered by existing tests.
384
385         * Modules/cache/CacheStorage.cpp:
386         (WebCore::CacheStorage::retrieveCaches):
387
388 2017-08-29  Youenn Fablet  <youenn@apple.com>
389
390         Setting the cache storage engine root path according the session WebsiteDataStore
391         https://bugs.webkit.org/show_bug.cgi?id=176055
392
393         Reviewed by Alex Christensen.
394
395         No test right now as the engine is not making any read/write operations.
396
397         * platform/network/NetworkStorageSession.h:
398         (WebCore::NetworkStorageSession::cacheStorageDirectory const):
399         (WebCore::NetworkStorageSession::setCacheStorageDirectory):
400
401 2017-08-29  Don Olmstead  <don.olmstead@sony.com>
402
403         [CMake] Use find_package for libxml2 and libxstl
404         https://bugs.webkit.org/show_bug.cgi?id=176042
405
406         Reviewed by Konstantin Tokarev.
407
408         No new tests. No change in behavior.
409
410         * CMakeLists.txt:
411         * PlatformGTK.cmake:
412         * PlatformWPE.cmake:
413         * PlatformWinCairo.cmake:
414
415 2017-08-29  Daniel Bates  <dabates@apple.com>
416
417         CacheQueryOptions::isolatedCopy() copies the cache name twice
418         https://bugs.webkit.org/show_bug.cgi?id=175974
419
420         Reviewed by Youenn Fablet.
421
422         Currently CacheQueryOptions has a user-defined constructor that calls String.isolatedCopy()
423         on the passed cache name. CacheQueryOptions::isolatedCopy() also calls String.isolatedCopy()
424         on the cache name before passing the result to the user-defined constructor; => we malloc
425         and copy the cache name twice. Ideally we would remove the user-defined constructors and
426         have callers use aggregate initializer syntax to instantiate a CacheQueryOptions. Unfortunately
427         we cannot do this until we upgrade from Visual Studio 2015 to Visual Studio 2017 as the former
428         does not support non-static data member initializers (NSDMI) for aggregates and CacheQueryOptions
429         has some. Therefore we modify the user-defined, non-default, constructor to take a String&&
430         and conditionally compile the the constructors when building with compilers that do not
431         support NSDMI for aggregates.
432
433         * Modules/cache/CacheQueryOptions.h:
434         (WebCore::CacheQueryOptions::CacheQueryOptions):
435
436 2017-08-29  Youenn Fablet  <youenn@apple.com>
437
438         CanvasCaptureMediaStreamTrack clone is not a CanvasCaptureMediaStreamTrack
439         https://bugs.webkit.org/show_bug.cgi?id=176036
440
441         Reviewed by Eric Carlson.
442
443         Covered by existing tests.
444
445         Instead of creating a MediaStreamTrack clone when cloning a CanvasCaptureMediaStreamTrack,
446         we are now creating a CanvasCaptureMediaStreamTrack.
447         This allows exposing the expected methods and having the expected functionality.
448
449         * Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp:
450         (WebCore::CanvasCaptureMediaStreamTrack::clone):
451         * Modules/mediastream/CanvasCaptureMediaStreamTrack.h:
452         * Modules/mediastream/MediaStreamTrack.cpp:
453         (WebCore::MediaStreamTrack::clone):
454         * Modules/mediastream/MediaStreamTrack.h:
455
456 2017-08-29  Chris Dumez  <cdumez@apple.com>
457
458         Add initial support for dataTransferItem.webkitGetAsEntry()
459         https://bugs.webkit.org/show_bug.cgi?id=176038
460         <rdar://problem/34121095>
461
462         Reviewed by Wenson Hsieh.
463
464         Add initial support for dataTransferItem.webkitGetAsEntry() as per:
465         - https://wicg.github.io/entries-api/#html-data
466
467         The method works as expected and returns a FileSystemEntry. The entry
468         can be either a file or a directory. All of the attributes exposed on
469         the FileSystemEntry return correct values.
470
471         What remains to be implemented for this new API to actually be useful:
472         - directory.getFile() / directory.getDirectory()
473         - file.file()
474         - entry.getParent()
475         - directoryReader.readEntries()
476
477         Test: editing/pasteboard/datatransfer-items-drop-getAsEntry.html
478
479         * CMakeLists.txt:
480         * DerivedSources.make:
481         * WebCore.xcodeproj/project.pbxproj:
482         * bindings/js/JSBindingsAllInOne.cpp:
483         Add new files to projects.
484
485         * Modules/entriesapi/DOMFileSystem.cpp:
486         (WebCore::DOMFileSystem::DOMFileSystem):
487         * Modules/entriesapi/DOMFileSystem.h:
488         (WebCore::DOMFileSystem::create):
489         DOMFileSystem factory now takes a name parameter. This name is a UUID, as suggested in
490         the specification and implemented by Firefox.
491
492         * Modules/entriesapi/ErrorCallback.cpp: Added.
493         * Modules/entriesapi/ErrorCallback.h:
494         Add scheduleCallback() convenience method as we often need to call this callback
495         asynchronously.
496
497         * Modules/entriesapi/FileSystemDirectoryEntry.cpp:
498         (WebCore::FileSystemDirectoryEntry::FileSystemDirectoryEntry):
499         (WebCore::FileSystemDirectoryEntry::createReader):
500         (WebCore::FileSystemDirectoryEntry::getFile):
501         (WebCore::FileSystemDirectoryEntry::getDirectory):
502         * Modules/entriesapi/FileSystemDirectoryEntry.h:
503         - Add implementation for createReader().
504         - Update getFile() / getDirectory() to call the error callback for now as they are
505           unimplemented.
506         - Have the factory take the virtual path of the entry so that it can be
507           exposed via the fullPath attribute in IDL.
508
509         * Modules/entriesapi/FileSystemDirectoryEntry.idl:
510         Expose createReader() now that we have stubs for FileSystemDirectoryReader.
511
512         * Modules/entriesapi/FileSystemDirectoryReader.cpp: Added.
513         * Modules/entriesapi/FileSystemDirectoryReader.h: Added.
514         * Modules/entriesapi/FileSystemDirectoryReader.idl: Added.
515         * Modules/entriesapi/FileSystemEntriesCallback.cpp: Added.
516         * Modules/entriesapi/FileSystemEntriesCallback.h: Added.
517         * Modules/entriesapi/FileSystemEntriesCallback.idl: Added.
518         Land stubs for FileSystemDirectoryReader and its FileSystemEntriesCallback.
519
520         * Modules/entriesapi/FileSystemEntry.cpp:
521         (WebCore::FileSystemEntry::FileSystemEntry):
522         * Modules/entriesapi/FileSystemEntry.h:
523         (WebCore::FileSystemEntry::virtualPath const):
524         * Modules/entriesapi/FileSystemEntry.idl:
525         Update constructor to take a virtual path, which is exposed via fullPath
526         attribute in IDL.
527
528         * Modules/entriesapi/FileSystemFileEntry.cpp:
529         (WebCore::FileSystemFileEntry::FileSystemFileEntry):
530         (WebCore::FileSystemFileEntry::file):
531         * Modules/entriesapi/FileSystemFileEntry.h:
532         (isType):
533         * Modules/entriesapi/FileSystemFileEntry.idl:
534         - Update file() to call the error callback for now as they are
535           unimplemented.
536         - Have the factory take the virtual path of the entry so that it can be
537           exposed via the fullPath attribute in IDL.
538
539         * bindings/js/JSFileSystemEntryCustom.cpp: Added.
540         (WebCore::toJSNewlyCreated):
541         (WebCore::toJS):
542         Add custom implementation of FileSystemEntry's toJS() function. This is
543         needed because FileSystemEntry has 2 subclasses and we need to type check
544         at runtime to construct the right wrapper.
545
546         * dom/DataTransferItem.cpp:
547         (WebCore::DataTransferItem::getAsEntry const):
548         * dom/DataTransferItem.h:
549         * dom/DataTransferItem.idl:
550         Add initial implementation for getAsEntry(), currently exposed as
551         webkitGetAsEntry().
552
553         * dom/DataTransferItemList.cpp:
554         (WebCore::DataTransferItemList::ensureItems const):
555         Construct a DataTransferItem if the file is a directory now that we
556         support getAsEntry().
557
558         * fileapi/File.cpp:
559         (WebCore::File::isDirectory const):
560         * fileapi/File.h:
561         Add convenience method to query if a File is a directory.
562
563 2017-08-29  Zan Dobersek  <zdobersek@igalia.com>
564
565         [WebCrypto] Push WorkQueue dispatches for HKDF, HMAC, PBKDF2 algorithms into shared code
566         https://bugs.webkit.org/show_bug.cgi?id=175620
567
568         Reviewed by Jiewen Tan.
569
570         Push the WorkQueue dispatch code and other code duplicated between the
571         Mac and libgcrypt implementations of Web Crypto into the shared layer.
572         This patch focuses on the HKDF, HMAC and PBKDF2 algorithms.
573
574         Functions with platform-specific implementations that are invoked from
575         these asynchronous dispatches are made static and return an ExceptionOr
576         value. CryptoAlgorithmParameters objects are passed through non-const
577         references because data getters could lazily construct the underlying
578         Vector objects. CryptoKey objects are passed through const references.
579         Implementations can then manually retrieve and further validate any key
580         or parameter data, as required for that specific implementation. Input
581         data is passed through const references to the original Vector objects.
582
583         No new tests -- no changes in behavior that's covered by existing tests.
584
585         * crypto/algorithms/CryptoAlgorithmHKDF.cpp:
586         (WebCore::CryptoAlgorithmHKDF::deriveBits):
587         * crypto/algorithms/CryptoAlgorithmHKDF.h:
588         * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
589         (WebCore::CryptoAlgorithmHMAC::sign):
590         (WebCore::CryptoAlgorithmHMAC::verify):
591         * crypto/algorithms/CryptoAlgorithmHMAC.h:
592         * crypto/algorithms/CryptoAlgorithmPBKDF2.cpp:
593         (WebCore::CryptoAlgorithmPBKDF2::deriveBits):
594         * crypto/algorithms/CryptoAlgorithmPBKDF2.h:
595         * crypto/gcrypt/CryptoAlgorithmHKDFGCrypt.cpp:
596         (WebCore::CryptoAlgorithmHKDF::platformDeriveBits):
597         * crypto/gcrypt/CryptoAlgorithmHMACGCrypt.cpp:
598         (WebCore::CryptoAlgorithmHMAC::platformSign):
599         (WebCore::CryptoAlgorithmHMAC::platformVerify):
600         * crypto/gcrypt/CryptoAlgorithmPBKDF2GCrypt.cpp:
601         (WebCore::CryptoAlgorithmPBKDF2::platformDeriveBits):
602         * crypto/mac/CryptoAlgorithmHKDFMac.cpp:
603         (WebCore::CryptoAlgorithmHKDF::platformDeriveBits):
604         * crypto/mac/CryptoAlgorithmHMACMac.cpp:
605         (WebCore::CryptoAlgorithmHMAC::platformSign):
606         (WebCore::CryptoAlgorithmHMAC::platformVerify):
607         * crypto/mac/CryptoAlgorithmPBKDF2Mac.cpp:
608         (WebCore::CryptoAlgorithmPBKDF2::platformDeriveBits):
609
610 2017-08-29  Zan Dobersek  <zdobersek@igalia.com>
611
612         [WebCrypto] Push WorkQueue dispatches for EC algorithms into shared code
613         https://bugs.webkit.org/show_bug.cgi?id=175619
614
615         Reviewed by Jiewen Tan.
616
617         Push the WorkQueue dispatch code duplicated between the Mac and libgcrypt
618         implementations of Web Crypto into the shared layer. This patch focuses on
619         the EC-based algorithms.
620
621         Functions with platform-specific implementations that are invoked from
622         these asynchronous dispatches are made static and return an ExceptionOr or
623         std::optional value. CryptoKey and CryptoAlgorithmParameters objects are
624         passed to those through const references. Input data is passed through
625         const references to the original Vector objects.
626
627         No new tests -- no changes in behavior that's covered by existing tests.
628
629         * crypto/algorithms/CryptoAlgorithmECDH.cpp:
630         (WebCore::CryptoAlgorithmECDH::deriveBits):
631         * crypto/algorithms/CryptoAlgorithmECDH.h:
632         * crypto/algorithms/CryptoAlgorithmECDSA.cpp:
633         (WebCore::CryptoAlgorithmECDSA::sign):
634         (WebCore::CryptoAlgorithmECDSA::verify):
635         * crypto/algorithms/CryptoAlgorithmECDSA.h:
636         * crypto/gcrypt/CryptoAlgorithmECDHGCrypt.cpp:
637         (WebCore::CryptoAlgorithmECDH::platformDeriveBits):
638         * crypto/gcrypt/CryptoAlgorithmECDSAGCrypt.cpp:
639         (WebCore::CryptoAlgorithmECDSA::platformSign):
640         (WebCore::CryptoAlgorithmECDSA::platformVerify):
641         * crypto/keys/CryptoKeyEC.h:
642         * crypto/mac/CryptoAlgorithmECDHMac.cpp:
643         (WebCore::CryptoAlgorithmECDH::platformDeriveBits):
644         * crypto/mac/CryptoAlgorithmECDSAMac.cpp:
645         (WebCore::CryptoAlgorithmECDSA::platformSign):
646         (WebCore::CryptoAlgorithmECDSA::platformVerify):
647
648 2017-08-19  Sergio Villar Senin  <svillar@igalia.com>
649
650         [SVG] Leak in SVGAnimatedListPropertyTearOff
651         https://bugs.webkit.org/show_bug.cgi?id=172545
652
653         Reviewed by Darin Adler.
654
655         SVGAnimatedListPropertyTearOff maintains a vector m_wrappers with references to
656         SVGPropertyTraits<PropertyType>::ListItemTearOff. Apart from that SVGPropertyTearOff has a
657         reference to SVGAnimatedProperty.
658
659         When SVGListProperty::getItemValuesAndWrappers() is called, it creates a
660         SVGPropertyTraits<PropertyType>::ListItemTearOff pointing to the same SVGAnimatedProperty (a
661         SVGAnimatedListPropertyTearOff) which stores the m_wrappers vector where the ListItemTearOff
662         is going to be added to. This effectively creates a reference cycle between the
663         SVGAnimatedListPropertyTearOff and all the ListItemTearOff it stores in m_wrappers.
664
665         In order to effectively break the cycle without freeing too many wrappers we should take two
666         measures:
667         1) Break the reference cycle by storing raw pointers in the m_wrappers Vector
668         2) Remove the ListItemTearOff which is being deleted (it notifies the animated property by
669         calling propertyWillBeDeleted) from the m_wrappers Vector.
670
671         This is a re-land of r219334 which caused early releases of custom data attribute objects
672         added to SVG elements (wkb.ug/175023).
673
674         Tests: svg/animations/animation-leak-list-property-instances.html
675                svg/dom/SVGAnimatedListPropertyTearOff-crash-2.html
676                svg/dom/SVGAnimatedListPropertyTearOff-crash.html
677                svg/dom/SVGAnimatedListPropertyTearOff-leak.html
678
679         * svg/properties/SVGAnimatedListPropertyTearOff.h:
680         * svg/properties/SVGListProperty.h:
681         (WebCore::SVGListProperty::getItemValuesAndWrappers):
682         * svg/properties/SVGListPropertyTearOff.h:
683         (WebCore::SVGListPropertyTearOff::removeItemFromList):
684
685 2017-08-29  Andy Estes  <aestes@apple.com>
686
687         [Mac] Upstream WKSetMetadataURL() from WebKitSystemInterface
688         https://bugs.webkit.org/show_bug.cgi?id=176046
689
690         Reviewed by Alex Christensen.
691
692         * platform/FileSystem.cpp:
693         (WebCore::setMetadataURL):
694         * platform/FileSystem.h:
695         (WebCore::setMetadataURL):
696         * platform/mac/FileSystemMac.mm:
697         (WebCore::setMetadataURL):
698         * platform/mac/WebCoreSystemInterface.h:
699         * platform/mac/WebCoreSystemInterface.mm:
700
701 2017-08-29  Zan Dobersek  <zdobersek@igalia.com>
702
703         Unreviewed WPE debug build fix.
704
705         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
706         (WebCore::AppendPipeline::dispatchPendingDecryptionStructure):
707         AppendState is an enum class, enum values have to be accessed
708         using scope resolution.
709
710 2017-08-28  Andy Estes  <aestes@apple.com>
711
712         [Cocoa] Upstream WKGetWebDefaultCFStringEncoding()
713         https://bugs.webkit.org/show_bug.cgi?id=176039
714
715         Reviewed by Alex Christensen.
716
717         * PlatformMac.cmake:
718         * WebCore.xcodeproj/project.pbxproj:
719         * platform/ios/WebCoreSystemInterfaceIOS.mm:
720         * platform/mac/WebCoreSystemInterface.h:
721         * platform/mac/WebCoreSystemInterface.mm:
722         * platform/text/TextEncodingRegistry.cpp:
723         (WebCore::defaultTextEncodingNameForSystemLanguage):
724         * platform/text/TextEncodingRegistry.h:
725         * platform/text/ios/TextEncodingRegistryIOS.mm: Added.
726         (WebCore::webDefaultCFStringEncoding):
727         * platform/text/mac/TextEncodingRegistryMac.mm: Added.
728         (WebCore::webDefaultCFStringEncoding):
729
730 2017-08-28  Joseph Pecoraro  <pecoraro@apple.com>
731
732         REGRESSION(r220278): Web Inspector: ContextMenu items are not getting triggered
733         https://bugs.webkit.org/show_bug.cgi?id=176034
734
735         Reviewed by Devin Rousso.
736
737         * inspector/InspectorFrontendHost.cpp:
738         (WebCore::InspectorFrontendHost::showContextMenu):
739         Responses go through InspectorFrontendAPI not InspectorFrontendHost.
740
741 2017-08-28  Youenn Fablet  <youenn@apple.com>
742
743         WebRTC MediaStream created without tracks does not update active state after tracks are added
744         https://bugs.webkit.org/show_bug.cgi?id=175434
745
746         Reviewed by Eric Carlson.
747
748         Covered by updated test.
749
750         Removing active/inactive events.
751         active attribute is still kept and is updated synchronously on every track change.
752
753         * Modules/mediastream/MediaStream.cpp:
754         (WebCore::MediaStream::MediaStream):
755         (WebCore::MediaStream::activeStatusChanged):
756         (WebCore::MediaStream::internalAddTrack):
757         (WebCore::MediaStream::updateActiveState):
758         (WebCore::MediaStream::hasPendingActivity const):
759         (WebCore::MediaStream::scheduleActiveStateChange): Deleted.
760         (WebCore::MediaStream::activityEventTimerFired): Deleted.
761         * Modules/mediastream/MediaStream.h:
762         * Modules/mediastream/MediaStream.idl:
763
764 2017-08-28  Andy Estes  <aestes@apple.com>
765
766         [Cocoa] Upstream CFNetwork-related WebKitSystemInterface functions
767         https://bugs.webkit.org/show_bug.cgi?id=176032
768
769         Reviewed by Alex Christensen.
770
771         * platform/ios/WebCoreSystemInterfaceIOS.mm:
772         * platform/mac/WebCoreSystemInterface.h:
773         * platform/mac/WebCoreSystemInterface.mm:
774         * platform/network/NetworkStorageSession.h:
775         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
776         (WebCore::NetworkStorageSession::switchToNewTestingSession):
777         (WebCore::NetworkStorageSession::ensureSession):
778         * platform/network/cf/ResourceRequest.h:
779         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
780         (WebCore::createPrivateStorageSession):
781         * platform/network/cocoa/ResourceRequestCocoa.mm:
782         (WebCore::ResourceRequest::setStorageSession):
783         (WebCore::copyRequestWithStorageSession):
784         (WebCore::cachedResponseForRequest):
785         * platform/network/mac/CookieJarMac.mm:
786         (WebCore::httpCookies):
787         (WebCore::setHTTPCookiesForURL):
788         (WebCore::deleteHTTPCookie):
789         (WebCore::deleteAllHTTPCookies):
790         (WebCore::setCookiesFromDOM):
791         (WebCore::httpCookieAcceptPolicy):
792         (WebCore::cookiesEnabled):
793         (WebCore::deleteCookie):
794         (WebCore::getHostnamesWithCookies):
795         (WebCore::deleteAllCookies):
796         (WebCore::deleteCookiesForHostnames):
797         * platform/network/mac/ResourceHandleMac.mm:
798         (WebCore::ResourceHandle::createNSURLConnection):
799
800 2017-08-28  Brent Fulgham  <bfulgham@apple.com>
801
802         Disable access to secure cookies if an HTTPS site loads mixed content (Part 2: Header Requests)
803         https://bugs.webkit.org/show_bug.cgi?id=175992
804         <rdar://problem/34086613>
805
806         Reviewed by Daniel Bates.
807
808         The original work in Bug 157053 did not properly handle the case of websockets. This patch completes
809         the changes to secure cookie handling to make sure websockets are also protected.
810
811         Tests: http/tests/websocket/tests/hybi/secure-cookie-insecure-connection.pl
812                http/tests/websocket/tests/hybi/secure-cookie-secure-connection.pl
813
814         * Modules/websockets/WebSocketChannel.cpp:
815         (WebCore::WebSocketChannel::clientHandshakeRequest): Remove 'const' declaration so we can work with
816         a mutable Document object. This allows us to mark the Document as having accessed secure cookies.
817         (WebCore::WebSocketChannel::clientHandshakeRequest const): Deleted.
818         * Modules/websockets/WebSocketChannel.h:
819         * Modules/websockets/WebSocketHandshake.cpp:
820         (WebCore::WebSocketHandshake::clientHandshakeMessage): Ditto.
821         (WebCore::WebSocketHandshake::clientHandshakeRequest): Ditto.
822         (WebCore::WebSocketHandshake::clientHandshakeMessage const): Deleted.
823         (WebCore::WebSocketHandshake::clientHandshakeRequest const): Deleted.
824         * Modules/websockets/WebSocketHandshake.h:
825         * loader/CookieJar.cpp:
826         (WebCore::cookies): Small naming cleanup.
827         (WebCore::cookieRequestHeaderFieldValue): Pass a flag indicating whether secure cookies should be
828         included in the result or not. Set the document flag indicating secure cookies were accessed (if
829         they were), and return the resulting cookie string.
830         * loader/CookieJar.h:
831         * platform/CookiesStrategy.h:
832         * platform/network/CacheValidation.cpp:
833         (WebCore::headerValueForVary): Revise to pass a flag indicating whether secure cookies should be included
834         or not.
835         * platform/network/PlatformCookieJar.h:
836         * platform/network/cf/CookieJarCFNet.cpp:
837         (WebCore::doesContainSecureCookies): Added helper method.
838         (WebCore::cookiesForDOM): Revise to use new helper function.
839         (WebCore::cookieRequestHeaderFieldValue): Revise to accept a flag indicating if secure cookies should
840         be included in the result. Return a pair consisting of the cookie string, and a flag indicating whether
841         secure cookies were accessed or not.
842         * platform/network/curl/CookieJarCurl.cpp:
843         (WebCore::CookieJarCurlFileSystem::cookieRequestHeaderFieldValue): Ditto.
844         (WebCore::cookieRequestHeaderFieldValue): Ditto.
845         * platform/network/curl/CookieJarCurl.h:
846         * platform/network/mac/CookieJarMac.mm:
847         (WebCore::cookiesForSession): Ditto.
848         (WebCore::cookiesForDOM): Update for new 'cookiesForSession' signature.
849         (WebCore::cookieRequestHeaderFieldValue): Ditto.
850         * platform/network/soup/CookieJarSoup.cpp:
851         (WebCore::cookieRequestHeaderFieldValue): Revise to accept a flag indicating if secure cookies should
852         be included in the result. Return a pair consisting of the cookie string, and a flag indicating whether
853         secure cookies were accessed or not.
854
855 2017-08-28  Carlos Alberto Lopez Perez  <clopez@igalia.com>
856
857         [GTK] [WPE] Rename EventHandlerGlib to EventHandlerGLib
858         https://bugs.webkit.org/show_bug.cgi?id=175864
859
860         Unreviewed cosmetic follow-up patch after r221075.
861
862         No new tests. No change in behavior.
863
864         * PlatformGTK.cmake:
865         * PlatformWPE.cmake:
866         * platform/glib/EventHandlerGLib.cpp: Renamed from Source/WebCore/platform/glib/EventHandlerGlib.cpp.
867         (WebCore::EventHandler::tabsToAllFormControls const):
868         (WebCore::EventHandler::focusDocumentView):
869         (WebCore::EventHandler::passWidgetMouseDownEventToWidget):
870         (WebCore::EventHandler::passMouseDownEventToWidget):
871         (WebCore::EventHandler::eventActivatedView const):
872         (WebCore::EventHandler::widgetDidHandleWheelEvent):
873         (WebCore::EventHandler::createDraggingDataTransfer const):
874         (WebCore::EventHandler::passMousePressEventToSubframe):
875         (WebCore::EventHandler::passMouseMoveEventToSubframe):
876         (WebCore::EventHandler::passMouseReleaseEventToSubframe):
877         (WebCore::EventHandler::accessKeyModifiers):
878         (WebCore::EventHandler::shouldTurnVerticalTicksIntoHorizontal const):
879
880 2017-08-28  Zan Dobersek  <zdobersek@igalia.com>
881
882         [WebCrypto] Push WorkQueue dispatches for AES algorithms into shared code
883         https://bugs.webkit.org/show_bug.cgi?id=175539
884
885         Reviewed by Sam Weinig.
886
887         Push the WorkQueue dispatch code and other code duplicated between the
888         Mac and libgcrypt implementations of Web Crypto into the shared layer.
889         This patch focuses on the AES-based algorithms.
890
891         Functions with platform-specific implementations that are invoked from
892         these asynchronous dispatches are made static and return an ExceptionOr
893         value. CryptoAlgorithmParameters objects are passed through non-const
894         references because data getters could lazily construct the underlying
895         Vector objects. CryptoKey objects are passed through const references.
896         Implementations can then manually retrieve and further validate any key
897         or parameter data, as required for that specific implementation. Input
898         data is passed through const references to the original Vector objects.
899
900         No new tests -- no changes in behavior that's covered by existing tests.
901
902         * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
903         (WebCore::CryptoAlgorithmAES_CBC::encrypt):
904         (WebCore::CryptoAlgorithmAES_CBC::decrypt):
905         * crypto/algorithms/CryptoAlgorithmAES_CBC.h:
906         * crypto/algorithms/CryptoAlgorithmAES_CFB.cpp:
907         (WebCore::CryptoAlgorithmAES_CFB::encrypt):
908         (WebCore::CryptoAlgorithmAES_CFB::decrypt):
909         * crypto/algorithms/CryptoAlgorithmAES_CFB.h:
910         * crypto/algorithms/CryptoAlgorithmAES_CTR.cpp:
911         (WebCore::CryptoAlgorithmAES_CTR::encrypt):
912         (WebCore::CryptoAlgorithmAES_CTR::decrypt):
913         * crypto/algorithms/CryptoAlgorithmAES_CTR.h:
914         * crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:
915         (WebCore::CryptoAlgorithmAES_GCM::encrypt):
916         (WebCore::CryptoAlgorithmAES_GCM::decrypt):
917         * crypto/algorithms/CryptoAlgorithmAES_GCM.h:
918         * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
919         (WebCore::CryptoAlgorithmAES_KW::wrapKey):
920         (WebCore::CryptoAlgorithmAES_KW::unwrapKey):
921         * crypto/algorithms/CryptoAlgorithmAES_KW.h:
922         * crypto/gcrypt/CryptoAlgorithmAES_CBCGCrypt.cpp:
923         (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt):
924         (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt):
925         * crypto/gcrypt/CryptoAlgorithmAES_CFBGCrypt.cpp:
926         (WebCore::CryptoAlgorithmAES_CFB::platformEncrypt):
927         (WebCore::CryptoAlgorithmAES_CFB::platformDecrypt):
928         * crypto/gcrypt/CryptoAlgorithmAES_CTRGCrypt.cpp:
929         (WebCore::CryptoAlgorithmAES_CTR::platformEncrypt):
930         (WebCore::CryptoAlgorithmAES_CTR::platformDecrypt):
931         * crypto/gcrypt/CryptoAlgorithmAES_GCMGCrypt.cpp:
932         (WebCore::gcryptEncrypt):
933         (WebCore::gcryptDecrypt):
934         (WebCore::CryptoAlgorithmAES_GCM::platformEncrypt):
935         (WebCore::CryptoAlgorithmAES_GCM::platformDecrypt):
936         * crypto/gcrypt/CryptoAlgorithmAES_KWGCrypt.cpp:
937         (WebCore::CryptoAlgorithmAES_KW::platformWrapKey):
938         (WebCore::CryptoAlgorithmAES_KW::platformUnwrapKey):
939         * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp:
940         (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt):
941         (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt):
942         * crypto/mac/CryptoAlgorithmAES_CFBMac.cpp:
943         (WebCore::CryptoAlgorithmAES_CFB::platformEncrypt):
944         (WebCore::CryptoAlgorithmAES_CFB::platformDecrypt):
945         * crypto/mac/CryptoAlgorithmAES_CTRMac.cpp:
946         (WebCore::CryptoAlgorithmAES_CTR::platformEncrypt):
947         (WebCore::CryptoAlgorithmAES_CTR::platformDecrypt):
948         * crypto/mac/CryptoAlgorithmAES_GCMMac.cpp:
949         (WebCore::CryptoAlgorithmAES_GCM::platformEncrypt):
950         (WebCore::CryptoAlgorithmAES_GCM::platformDecrypt):
951         * crypto/mac/CryptoAlgorithmAES_KWMac.cpp:
952         (WebCore::CryptoAlgorithmAES_KW::platformWrapKey):
953         (WebCore::CryptoAlgorithmAES_KW::platformUnwrapKey):
954
955 2017-08-27  Wenson Hsieh  <wenson_hsieh@apple.com>
956
957         [iOS WK2] Web process crashes after changing selection to the end of the document when speaking a selection
958         https://bugs.webkit.org/show_bug.cgi?id=176011
959         <rdar://problem/32614095>
960
961         Reviewed by Ryosuke Niwa.
962
963         Adds a null check to visiblePositionForPositionWithOffset. This is a crash point for accessibility codepaths,
964         since indexForVisiblePosition is not guaranteed to set the given `root` outparam to a non-null value, yet
965         visiblePositionForIndex requires root to be non-null. This causes a crash when selecting some text, hitting
966         'Speak', and then changing the selection to somewhere near the end of the document, since accessibility code
967         will attempt to speak words at an offset past the end of the document. While this is a bug in and of itself, the
968         web process should still handle this case gracefully and not crash. To fix this, we simply bail and return a
969         null VisiblePosition if a root container node was not found.
970
971         Currently, visiblePositionForPositionWithOffset is implemented twice, in WebCore (AXObjectCache.cpp) and also in
972         WebKit (WebPageIOS.mm), as identical static functions. This patch moves this helper into Editing.cpp and removes
973         it from AXObjectCache and WebPageIOS.
974
975         Tests: AccessibilityTests.RectsForSpeakingSelectionBasic
976                AccessibilityTests.RectsForSpeakingSelectionWithLineWrapping
977                AccessibilityTests.RectsForSpeakingSelectionDoNotCrashWhenChangingSelection
978
979         * accessibility/AXObjectCache.cpp:
980         (WebCore::visiblePositionForPositionWithOffset): Deleted.
981         * editing/Editing.cpp:
982         (WebCore::visiblePositionForPositionWithOffset):
983         * editing/Editing.h:
984
985 2017-08-27  Devin Rousso  <webkit@devinrousso.com>
986
987         Web Inspector: Record actions performed on WebGLRenderingContext
988         https://bugs.webkit.org/show_bug.cgi?id=174483
989         <rdar://problem/34040722>
990
991         Reviewed by Matt Baker.
992
993         Tests: inspector/canvas/recording-webgl.html
994                inspector/canvas/recording-webgl-snapshots.html
995
996         * bindings/js/CallTracerTypes.h:
997         Add types for WebGL parameters.
998
999         * bindings/scripts/CodeGeneratorJS.pm:
1000         (GenerateAttributeSetterBodyDefinition):
1001         (GenerateImplementationFunctionCall):
1002         (GenerateCallTracerParameter):
1003         Modify the generated code for `CallTracingCallback` so that optional/nullable types are only
1004         dereferenced if they have a value.
1005
1006         * html/canvas/WebGLRenderingContext.idl:
1007         Add `CallTracingCallback` to interface to record all API calls.
1008
1009         * inspector/InspectorCanvas.h:
1010         * inspector/InspectorCanvas.cpp:
1011         (WebCore::InspectorCanvas::resetRecordingData):
1012         (WebCore::shouldSnapshotWebGLAction):
1013         (WebCore::InspectorCanvas::recordAction):
1014         (WebCore::InspectorCanvas::releaseInitialState):
1015         (WebCore::InspectorCanvas::releaseFrames):
1016         (WebCore::InspectorCanvas::appendActionSnapshotIfNeeded):
1017         (WebCore::InspectorCanvas::getCanvasContentAsDataURL):
1018         (WebCore::InspectorCanvas::buildInitialState):
1019         (WebCore::InspectorCanvas::buildAction):
1020         For all non-primitive WebGL objects, send a string corresponding to the object's name. The
1021         value isn't needed since the preview will be generated by the `toDataURL` snapshots taken
1022         after every visual action.
1023
1024         * inspector/InspectorCanvasAgent.cpp:
1025         (WebCore::InspectorCanvasAgent::didFinishRecordingCanvasFrame):
1026
1027         * bindings/scripts/test/TestCallTracer.idl:
1028         * bindings/scripts/test/JS/JSTestCallTracer.cpp:
1029         (WebCore::jsTestCallTracerPrototypeFunctionTestOperationWithNullableArgumentBody):
1030         (WebCore::jsTestCallTracerPrototypeFunctionTestOperationWithNullableVariantArgumentBody):
1031         (WebCore::jsTestCallTracerPrototypeFunctionTestOperationWithNullableVariantArgument):
1032         (WebCore::jsTestCallTracerPrototypeFunctionTestOperationWithOptionalVariantArgumentBody):
1033         (WebCore::jsTestCallTracerPrototypeFunctionTestOperationWithOptionalVariantArgument):
1034         (WebCore::jsTestCallTracerPrototypeFunctionTestOperationWithDefaultVariantArgumentBody):
1035         (WebCore::jsTestCallTracerPrototypeFunctionTestOperationWithDefaultVariantArgument):
1036
1037 2017-08-26  Dan Bernstein  <mitz@apple.com>
1038
1039         REGRESSION (r220105): Storage service appears in macOS Activity Monitor as “localized string not found”
1040         https://bugs.webkit.org/show_bug.cgi?id=176007
1041
1042         Reviewed by Tim Horton.
1043
1044         * English.lproj/Localizable.strings: Updated using update-webkit-localizable-strings.
1045
1046 2017-08-26  Alex Christensen  <achristensen@webkit.org>
1047
1048         Remove PolicyChecker::cancelCheck
1049         https://bugs.webkit.org/show_bug.cgi?id=176002
1050
1051         Reviewed by Darin Adler.
1052
1053         cancelCheck is conceptually equivalent to not calling a completion handler.
1054         stopCheck is conceptually equivalent to calling a completion handler with PolicyIgnore just before cleaning up everything,
1055         which is semantically cleaner and necessary when I replace the last use of PolicyCallback with a CompletionHandler.
1056         Before this change, we were probably causing some loading objects to hang right before deleting them, and this cleans them up better.
1057
1058         * loader/DocumentLoader.cpp:
1059         (WebCore::DocumentLoader::cancelPolicyCheckIfNeeded):
1060         * loader/PolicyChecker.cpp:
1061         (WebCore::PolicyChecker::cancelCheck): Deleted.
1062         * loader/PolicyChecker.h:
1063
1064 2017-08-26  Michael Catanzaro  <mcatanzaro@igalia.com>
1065
1066         Unreviewed, tighten up scope of variable in previous commit
1067
1068         * platform/network/soup/CookieJarSoup.cpp:
1069         (WebCore::cookiesForSession):
1070
1071 2017-08-26  Michael Catanzaro  <mcatanzaro@igalia.com>
1072
1073         [SOUP] Update cookie jar implementation to filter out secure cookies
1074         https://bugs.webkit.org/show_bug.cgi?id=175850
1075
1076         Reviewed by Brent Fulgham.
1077
1078         Filter out secure cookies when indicated.
1079
1080         * platform/network/soup/CookieJarSoup.cpp:
1081         (WebCore::cookiesForSession):
1082         (WebCore::cookiesForDOM):
1083         (WebCore::cookieRequestHeaderFieldValue):
1084         (WebCore::getRawCookies):
1085
1086 2017-08-26  Xabier Rodriguez Calvar  <calvaris@igalia.com>
1087
1088         [EME][GStreamer] Connect CDM to GStreamer
1089         https://bugs.webkit.org/show_bug.cgi?id=175983
1090
1091         Reviewed by Žan Doberšek.
1092
1093         This is still a version that will need some changes for some other
1094         use cases but it should be enough to begin with some passes in the
1095         tests and some basic use cases.
1096
1097         We use the attach CDMInstance interface in the private player to
1098         get the instance in time for the initializationDataEncountered
1099         event, which is handled when the demuxer reports synchronously the
1100         events even before configuring the decryptors. We wait there in
1101         case we don't have the CDMInstance attached (which contains info
1102         about the key system now) and when we get it we report it back to
1103         the demuxer and continue sending the event.
1104
1105         We also handled the events when handled by the decryptors but for
1106         now this will remain a FIXME. The events handled by the
1107         AppendPipeline will end up here too for now.
1108
1109         The CDM instance is created with the key system because some CDMs
1110         can handle more than one, not ClearKey yet but others in the
1111         (near) future.
1112
1113         MockCDMFactory is adapted to the changes as expected.
1114
1115         * Modules/encryptedmedia/CDM.cpp:
1116         (WebCore::CDM::CDM):
1117         * platform/encryptedmedia/CDMFactory.h:
1118         * platform/encryptedmedia/CDMInstance.h:
1119         * platform/encryptedmedia/clearkey/CDMClearKey.cpp:
1120         (WebCore::CDMFactoryClearKey::createCDM):
1121         (WebCore::CDMInstanceClearKey::keySystem const):
1122         * platform/encryptedmedia/clearkey/CDMClearKey.h:
1123         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1124         (WebCore::MediaPlayerPrivateGStreamer::handleMessage):
1125         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1126         (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):
1127         (WebCore::extractEventsAndSystemsFromMessage):
1128         (WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage):
1129         (WebCore::MediaPlayerPrivateGStreamerBase::cdmInstanceAttached):
1130         (WebCore::MediaPlayerPrivateGStreamerBase::cdmInstanceDetached):
1131         (WebCore::MediaPlayerPrivateGStreamerBase::attemptToDecryptWithInstance):
1132         (WebCore::MediaPlayerPrivateGStreamerBase::attemptToDecryptWithLocalInstance):
1133         (WebCore::MediaPlayerPrivateGStreamerBase::dispatchDecryptionKey):
1134         (WebCore::MediaPlayerPrivateGStreamerBase::handleProtectionEvent):
1135         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
1136         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
1137         (WebCore::appendPipelineElementMessageCallback):
1138         (WebCore::AppendPipeline::AppendPipeline):
1139         (WebCore::AppendPipeline::~AppendPipeline):
1140         (WebCore::AppendPipeline::handleNeedContextSyncMessage):
1141         (WebCore::AppendPipeline::handleElementMessage):
1142         (WebCore::AppendPipeline::handleAppsrcNeedDataReceived):
1143         (WebCore::AppendPipeline::appsinkNewSample):
1144         * platform/graphics/gstreamer/mse/AppendPipeline.h:
1145         * testing/MockCDMFactory.cpp:
1146         (WebCore::MockCDMFactory::createCDM):
1147         (WebCore::MockCDMInstance::keySystem const):
1148         * testing/MockCDMFactory.h:
1149
1150 2017-08-26  Zan Dobersek  <zdobersek@igalia.com>
1151
1152         [WebCrypto] Push WorkQueue dispatches for RSA algorithms into shared code
1153         https://bugs.webkit.org/show_bug.cgi?id=175621
1154
1155         Reviewed by Darin Adler.
1156
1157         Push the WorkQueue dispatch code and other code duplicated between the
1158         Mac and libgcrypt implementations of Web Crypto into the shared layer.
1159         This patch focuses on the RSA-based algorithms.
1160
1161         The WorkQueue dispatch code is condensed into two static functions on
1162         the CryptoAlgorithm class, the first variation handling VectorCallback
1163         as the callback type and the other handling BoolCallback. The operation
1164         is kept in a WTF::Function<> object that returns an ExceptionOr<> value
1165         embedding either a Vector<uint8_t> object or a boolean value, as
1166         appropriate for the callback type.
1167
1168         Functions with platform-specific implementations that are invoked from
1169         these asynchronous dispatches are made static and return an ExceptionOr
1170         value. CryptoAlgorithmParameters objects are passed through non-const
1171         references because data getters could lazily construct the underlying
1172         Vector objects. CryptoKey objects are passed through const references.
1173         Implementations can then manually retrieve and further validate any key
1174         or parameter data, as required for that specific implementation. Input
1175         data is passed through const references to the original Vector objects.
1176
1177         No new tests -- no changes in behavior that's covered by existing tests.
1178
1179         * crypto/CryptoAlgorithm.cpp:
1180         (WebCore::dispatchOperationImpl):
1181         (WebCore::CryptoAlgorithm::dispatchOperation):
1182         * crypto/CryptoAlgorithm.h:
1183         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
1184         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::encrypt):
1185         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::decrypt):
1186         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h:
1187         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
1188         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::sign):
1189         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::verify):
1190         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h:
1191         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
1192         (WebCore::CryptoAlgorithmRSA_OAEP::encrypt):
1193         (WebCore::CryptoAlgorithmRSA_OAEP::decrypt):
1194         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h:
1195         * crypto/algorithms/CryptoAlgorithmRSA_PSS.cpp:
1196         (WebCore::CryptoAlgorithmRSA_PSS::sign):
1197         (WebCore::CryptoAlgorithmRSA_PSS::verify):
1198         * crypto/algorithms/CryptoAlgorithmRSA_PSS.h:
1199         * crypto/gcrypt/CryptoAlgorithmRSAES_PKCS1_v1_5GCrypt.cpp:
1200         (WebCore::gcryptEncrypt):
1201         (WebCore::gcryptDecrypt):
1202         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformEncrypt):
1203         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformDecrypt):
1204         * crypto/gcrypt/CryptoAlgorithmRSASSA_PKCS1_v1_5GCrypt.cpp:
1205         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformSign):
1206         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformVerify):
1207         * crypto/gcrypt/CryptoAlgorithmRSA_OAEPGCrypt.cpp:
1208         (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt):
1209         (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt):
1210         * crypto/gcrypt/CryptoAlgorithmRSA_PSSGCrypt.cpp:
1211         (WebCore::CryptoAlgorithmRSA_PSS::platformSign):
1212         (WebCore::CryptoAlgorithmRSA_PSS::platformVerify):
1213         * crypto/mac/CryptoAlgorithmRSAES_PKCS1_v1_5Mac.cpp:
1214         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformEncrypt):
1215         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformDecrypt):
1216         * crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp:
1217         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformSign):
1218         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformVerify):
1219         * crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp:
1220         (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt):
1221         (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt):
1222         * crypto/mac/CryptoAlgorithmRSA_PSSMac.cpp:
1223         (WebCore::CryptoAlgorithmRSA_PSS::platformSign):
1224         (WebCore::CryptoAlgorithmRSA_PSS::platformVerify):
1225
1226 2017-08-25  Daniel Bates  <dabates@apple.com>
1227
1228         Demarcate code added due to lack of NSDMI for aggregates
1229         https://bugs.webkit.org/show_bug.cgi?id=175990
1230
1231         Reviewed by Andy Estes.
1232
1233         * html/canvas/CanvasStyle.h:
1234         * platform/mediastream/IceCandidate.h:
1235         (WebCore::IceCandidate::IceCandidate):
1236         * platform/text/StringWithDirection.h: Replace const String& and String&& constructor
1237         overloads with a single user-defined constructor that takes a String by value to handle
1238         both cases.
1239         (WebCore::StringWithDirection::StringWithDirection):
1240         (WebCore::truncateFromEnd):
1241         * style/StyleUpdate.h:
1242         (WebCore::Style::ElementUpdate::ElementUpdate):
1243         (WebCore::Style::TextUpdate::TextUpdate):
1244
1245 2017-08-25  Daniel Bates  <dabates@apple.com>
1246
1247         InlineTextBox::paintDocumentMarker() does not need to special case painting of grammar and
1248         dictation alternatives
1249         https://bugs.webkit.org/show_bug.cgi?id=175966
1250
1251         Reviewed by Tim Horton.
1252
1253         Remove code that forced computing the marker rect for grammar and dictation alternative
1254         regardless of whether the marker spans the entire width of the line box. InlineTextBox::paintDocumentMarker()
1255         has performance optimizations to avoid computing the marker rect if it spans the entire line box.
1256         Prior to r190363 we had to opt out of these optimizations for grammar and dictation alternative
1257         markers so that we could store their computed marker rect. In r190363 we removed the logic in
1258         InlineTextBox::paintDocumentMarker() to store the computed marker rect and hence no longer
1259         needed to opt out of the optimization for these marker types, but inadvertently left in the
1260         conditional code that opts them out.
1261
1262         No functionality changed. So no new tests.
1263
1264         * rendering/InlineTextBox.cpp:
1265         (WebCore::InlineTextBox::paintDocumentMarker): Remove unnecessary argument grammar and
1266         code that special cased handling of grammar an dictation alternative markers.
1267         (WebCore::InlineTextBox::paintDocumentMarkers): Update as necessary.
1268         * rendering/InlineTextBox.h:
1269
1270 2017-08-25  Chris Dumez  <cdumez@apple.com>
1271
1272         Land stubs for File and Directory Entries API interfaces
1273         https://bugs.webkit.org/show_bug.cgi?id=175993
1274         <rdar://problem/34087477>
1275
1276         Reviewed by Ryosuke Niwa.
1277
1278         Land stubs for File and Directory Entries API interfaces:
1279         - https://wicg.github.io/entries-api/#idl-index
1280
1281         Those will be needed to support drag and drop.
1282
1283         Test: http/wpt/entries-api/interfaces.html
1284
1285         * CMakeLists.txt:
1286         * DerivedSources.cpp:
1287         * DerivedSources.make:
1288         * Modules/entriesapi/DOMFileSystem.cpp: Added.
1289         (WebCore::DOMFileSystem::DOMFileSystem):
1290         (WebCore::DOMFileSystem::~DOMFileSystem):
1291         * Modules/entriesapi/DOMFileSystem.h: Added.
1292         (WebCore::DOMFileSystem::create):
1293         (WebCore::DOMFileSystem::name const):
1294         (WebCore::DOMFileSystem::root const):
1295         * Modules/entriesapi/DOMFileSystem.idl: Added.
1296         * Modules/entriesapi/ErrorCallback.h: Added.
1297         * Modules/entriesapi/ErrorCallback.idl: Added.
1298         * Modules/entriesapi/FileCallback.h: Added.
1299         * Modules/entriesapi/FileCallback.idl: Added.
1300         * Modules/entriesapi/FileSystemDirectoryEntry.cpp: Added.
1301         (WebCore::FileSystemDirectoryEntry::FileSystemDirectoryEntry):
1302         (WebCore::FileSystemDirectoryEntry::getFile):
1303         (WebCore::FileSystemDirectoryEntry::getDirectory):
1304         * Modules/entriesapi/FileSystemDirectoryEntry.h: Added.
1305         * Modules/entriesapi/FileSystemDirectoryEntry.idl: Added.
1306         * Modules/entriesapi/FileSystemEntry.cpp: Added.
1307         (WebCore::FileSystemEntry::FileSystemEntry):
1308         * Modules/entriesapi/FileSystemEntry.h: Added.
1309         (WebCore::FileSystemEntry::~FileSystemEntry):
1310         (WebCore::FileSystemEntry::isFile const):
1311         (WebCore::FileSystemEntry::isDirectory const):
1312         (WebCore::FileSystemEntry::name const):
1313         (WebCore::FileSystemEntry::fullPath const):
1314         (WebCore::FileSystemEntry::filesystem const):
1315         * Modules/entriesapi/FileSystemEntry.idl: Added.
1316         * Modules/entriesapi/FileSystemEntryCallback.h: Added.
1317         * Modules/entriesapi/FileSystemEntryCallback.idl: Added.
1318         * Modules/entriesapi/FileSystemFileEntry.cpp: Added.
1319         (WebCore::FileSystemFileEntry::FileSystemFileEntry):
1320         (WebCore::FileSystemFileEntry::file):
1321         * Modules/entriesapi/FileSystemFileEntry.h: Added.
1322         * Modules/entriesapi/FileSystemFileEntry.idl: Added.
1323         * WebCore.xcodeproj/project.pbxproj:
1324
1325 2017-08-25  Brent Fulgham  <bfulgham@apple.com>
1326
1327         REGRESSION(r221017): Quip stuck in a perpetual loading loop
1328         https://bugs.webkit.org/show_bug.cgi?id=175991
1329         <rdar://problem/34044445>
1330
1331         Reviewed by Daniel Bates.
1332
1333         This is a quick fix to return proper function to WebKit. I'll relate a follow-up fix that
1334         addresses WebSockets more completely.
1335
1336         * platform/network/mac/CookieJarMac.mm:
1337         (WebCore::cookieRequestHeaderFieldValue): Don't hard code a value of 'No' for returning secure
1338         cookies. HTTPS connection should get secure cookies.
1339
1340 2017-08-25  Youenn Fablet  <youenn@apple.com>
1341
1342         Add support for ReadableStream storage in FetchBody
1343         https://bugs.webkit.org/show_bug.cgi?id=175866
1344
1345         Reviewed by Sam Weinig.
1346
1347         Test: http/wpt/beacon/beacon-readablestream.html
1348
1349         Add support for IDLInterface<ReadableStream>, in particular to handle union conversions.
1350         Adding a ReadableStream that guards JSReadableStream from being collected.
1351         With this object, FetchBody will be able to store and manipulate ReadableStream.
1352
1353         Ensure conversion of BodyInit union with ReadableStream is working by adding support for beacon rejection in case of request body streams. 
1354
1355         * Modules/beacon/NavigatorBeacon.cpp:
1356         (WebCore::NavigatorBeacon::sendBeacon):
1357         * Modules/beacon/NavigatorBeacon.idl:
1358         * Modules/fetch/FetchBody.cpp:
1359         (WebCore::FetchBody::extract):
1360         * Modules/fetch/FetchBody.h:
1361         * Modules/fetch/FetchRequest.idl:
1362         * Modules/fetch/FetchRequestInit.idl:
1363         * Modules/fetch/FetchResponse.idl:
1364         * WebCore.xcodeproj/project.pbxproj:
1365         * bindings/js/JSDOMConvertInterface.h:
1366         (WebCore::JSToWrappedOverloader::toWrapped):
1367         (WebCore::Converter<IDLInterface<T>>::convert):
1368         * bindings/js/JSDOMConvertUnion.h:
1369         * bindings/js/ReadableStream.h: Added.
1370         (WebCore::JSReadableStreamWrapperConverter::toWrapped):
1371
1372 2017-08-25  Wenson Hsieh  <wenson_hsieh@apple.com>
1373
1374         Using the touchbar, both align left and align justify send a beforeinput event with the 'formatJustifyLeft' inputType.
1375         https://bugs.webkit.org/show_bug.cgi?id=168669
1376         <rdar://problem/30639155>
1377
1378         Reviewed by Beth Dakin.
1379
1380         Small tweak to add a "formatJustifyFull" inputType when justifying text using the touch bar's rich text
1381         formatting controls. Currently, the EditActionJustify edit command incorrectly maps to "formatJustifyLeft".
1382
1383         Test: fast/events/input-events-text-alignment.html
1384
1385         * editing/EditCommand.cpp:
1386         (WebCore::inputTypeNameForEditingAction):
1387
1388 2017-08-25  Brady Eidson  <beidson@apple.com>
1389
1390         Introduce ServerWorkerRegistration task queues.
1391         https://bugs.webkit.org/show_bug.cgi?id=175851
1392
1393         Reviewed by Andy Estes.
1394
1395         Test: http/tests/workers/service/registration-task-queue-scheduling-1.html
1396
1397         This change introduces:
1398         - A task thread/queue owned by each SWServer object.
1399         - The SWServerRegistration object, which is the in-server representation of a
1400           service worker registration scope.
1401         - A registration job queue per SWServerRegistration object which actually runs the
1402           jobs as tasks on the owning SWServer's thread.
1403
1404         With that infrastructure in place, it moves the "register" job to something that is
1405         scheduled and rejected asynchronously, as opposed to synchronously rejected.
1406
1407         The test verifies that two different registration scopes (localhost and 127.0.0.1) 
1408         can both spam the SWServer with registration requests, but neither of their queues
1409         starve the other.
1410
1411         The rest of this change is a lot of support and plumbing for making the above happen.
1412
1413         * CMakeLists.txt:
1414         * WebCore.xcodeproj/project.pbxproj:
1415         
1416         * dom/ExceptionData.cpp:
1417         (WebCore::ExceptionData::isolatedCopy const):
1418         * dom/ExceptionData.h:
1419         
1420         * workers/service/ServiceWorkerContainer.cpp:
1421         (WebCore::ServiceWorkerContainer::addRegistration):
1422         (WebCore::ServiceWorkerContainer::connectionIdentifier):
1423         * workers/service/ServiceWorkerContainer.h:
1424         
1425         * workers/service/ServiceWorkerJob.cpp:
1426         (WebCore::ServiceWorkerJob::ServiceWorkerJob):
1427         (WebCore::ServiceWorkerJob::data const): Deleted.
1428         * workers/service/ServiceWorkerJob.h:
1429         (WebCore::ServiceWorkerJob::create):
1430         (WebCore::ServiceWorkerJob::data const):
1431         (WebCore::ServiceWorkerJob::createRegisterJob): Deleted.
1432         
1433         * workers/service/ServiceWorkerJobClient.h:
1434         
1435         * workers/service/ServiceWorkerJobData.cpp:
1436         (WebCore::ServiceWorkerJobData::ServiceWorkerJobData):
1437         (WebCore::ServiceWorkerJobData::registrationKey const):
1438         (WebCore::ServiceWorkerJobData::isolatedCopy const):
1439         * workers/service/ServiceWorkerJobData.h:
1440         (WebCore::ServiceWorkerJobData::jobIdentifier const):
1441         (WebCore::ServiceWorkerJobData::connectionIdentifier const):
1442         (WebCore::ServiceWorkerJobData::encode const):
1443         (WebCore::ServiceWorkerJobData::decode):
1444
1445         * workers/service/ServiceWorkerRegistrationKey.cpp:
1446         (WebCore::ServiceWorkerRegistrationKey::emptyKey):
1447         (WebCore::ServiceWorkerRegistrationKey::hash const):
1448         (WebCore::ServiceWorkerRegistrationKey::operator== const):
1449         * workers/service/ServiceWorkerRegistrationKey.h:
1450         (WTF::ServiceWorkerRegistrationKeyHash::hash):
1451         (WTF::ServiceWorkerRegistrationKeyHash::equal):
1452         (WTF::HashTraits<WebCore::ServiceWorkerRegistrationKey>::emptyValue):
1453         (WTF::HashTraits<WebCore::ServiceWorkerRegistrationKey>::constructDeletedValue):
1454         (WTF::HashTraits<WebCore::ServiceWorkerRegistrationKey>::isDeletedValue):
1455
1456         * workers/service/ServiceWorkerRegistrationOptions.cpp:
1457         (WebCore::RegistrationOptions::isolatedCopy const):
1458         * workers/service/ServiceWorkerRegistrationOptions.h:
1459         (WebCore::RegistrationOptions::encode const):
1460         (WebCore::RegistrationOptions::decode):
1461
1462         * workers/service/server/SWClientConnection.h:
1463
1464         * workers/service/server/SWServer.cpp:
1465         (WebCore::SWServer::Connection::Connection):
1466         (WebCore::SWServer::~SWServer):
1467         (WebCore::SWServer::Connection::scheduleJobInServer):
1468         (WebCore::SWServer::SWServer):
1469         (WebCore::SWServer::scheduleJob):
1470         (WebCore::SWServer::rejectJob):
1471         (WebCore::SWServer::taskThreadEntryPoint):
1472         (WebCore::SWServer::postTask):
1473         (WebCore::SWServer::postTaskReply):
1474         (WebCore::SWServer::handleTaskRepliesOnMainThread):
1475         (WebCore::SWServer::registerConnection):
1476         (WebCore::SWServer::unregisterConnection):
1477         * workers/service/server/SWServer.h:
1478         (WebCore::SWServer::Connection::identifier const):
1479
1480         * workers/service/server/SWServerRegistration.cpp: Added.
1481         (WebCore::SWServerRegistration::SWServerRegistration):
1482         (WebCore::SWServerRegistration::~SWServerRegistration):
1483         (WebCore::SWServerRegistration::enqueueJob):
1484         (WebCore::SWServerRegistration::startNextJob):
1485         (WebCore::SWServerRegistration::performCurrentJob):
1486         (WebCore::SWServerRegistration::rejectCurrentJob):
1487         (WebCore::SWServerRegistration::finishCurrentJob):
1488         * workers/service/server/SWServerRegistration.h:
1489
1490 2017-08-25  Michael Catanzaro  <mcatanzaro@igalia.com>
1491
1492         Unreviewed, add comment warning that some flags have been copied into Epiphany
1493
1494         * platform/URLParser.cpp:
1495         (WebCore::URLParser::internationalDomainNameTranscoder):
1496
1497 2017-07-25  Frederic Wang  <fwang@igalia.com>
1498
1499         Add flag allow-modals to iframe sandbox
1500         https://bugs.webkit.org/show_bug.cgi?id=171321
1501
1502         This patch implements the "allow-modals" value for the iframe sandbox attribute. It changes
1503         the behavior for sandboxed document so that alert, confirm, prompt, print as well as dialogs
1504         generated from a beforeunload event are blocked when allow-modals is not set, as defined in
1505         the specification. For consistency, we do the same for document.execCommand('print', ...).
1506         Users should use the allow-modals flag in order to explictly allow modal dialogs.
1507
1508         See https://html.spec.whatwg.org/multipage/origin.html#sandboxed-modals-flag
1509
1510         Reviewed by Brent Fulgham.
1511
1512         Tests: http/tests/security/sandboxed-iframe-ALLOWED-modals.html
1513                http/tests/security/sandboxed-iframe-DENIED-modals.html
1514
1515         * dom/SecurityContext.cpp: Implement parsing for allow-modals
1516         (WebCore::SecurityContext::isSupportedSandboxPolicy):
1517         (WebCore::SecurityContext::parseSandboxPolicy):
1518         * dom/SecurityContext.h: Introduce flag for allow-modals
1519         * loader/FrameLoader.cpp:
1520         (WebCore::shouldAskForNavigationConfirmation): Prevent confirm dialog from beforeunload when
1521         allow-modals is not set.
1522         * page/Chrome.h: Change the signature of print, so it may return a failure when the
1523         allow-modals flag is not set.
1524         * page/Chrome.cpp:
1525         (WebCore::Chrome::print): Returns false and print a message error when the allow-modals flag
1526         on the frame's document is not set. Otherwise, execute the command and returns true.
1527         * editing/EditorCommand.cpp:
1528         (WebCore::executePrint): Ensure that document.execCommand for 'print' returns false when the
1529         allow-modals flag is not set.
1530         * page/DOMWindow.cpp: Add early exit when alert, confirm or prompt when the allow-modals flag
1531         for that document is not set. Note that print is handled in Chrome.cpp.
1532         (WebCore::DOMWindow::alert): Add early exit.
1533         (WebCore::DOMWindow::confirm): Add early exit with the return value indicated in the spec.
1534         (WebCore::DOMWindow::prompt): Ditto.
1535
1536 2017-08-25  Brady Eidson  <beidson@apple.com>
1537
1538         Unreviewed, rolling out r221181.
1539
1540         Broke builds that use CryptoAlgorithmRSA_PSSMac.cpp
1541
1542         Reverted changeset:
1543
1544         "[WebCrypto] Push WorkQueue dispatches for RSA algorithms into
1545         shared code"
1546         https://bugs.webkit.org/show_bug.cgi?id=175621
1547         http://trac.webkit.org/changeset/221181
1548
1549 2017-08-25  Xabier Rodriguez Calvar  <calvaris@igalia.com>
1550
1551         [EME][ClearKey] Fixed warning in CDM compilation
1552         https://bugs.webkit.org/show_bug.cgi?id=175979
1553
1554         Reviewed by Žan Doberšek.
1555
1556         * platform/encryptedmedia/clearkey/CDMClearKey.h: Added a final to
1557         avoid the compiler warning about the missing override keyword.
1558
1559 2017-08-25  Miguel Gomez  <magomez@igalia.com>
1560
1561         [GTK] Completely garbled display in Transifex in accelerated compositing mode
1562         https://bugs.webkit.org/show_bug.cgi?id=174632
1563
1564         Reviewed by Michael Catanzaro.
1565
1566         Remove the copy constructor from PlatformContextCairo::State. This is because it will be used by WTF::Vector
1567         to copy the instances around when allocating new memory, but it doesn't copy the m_imageMaskInformation
1568         attribute, so it will be lost when the Vector reallocates its contents. When this happens, renderings that use
1569         GraphicsContext::clipToImageBuffer() fail to render properly.
1570
1571         Covered by existent tests.
1572
1573         * platform/graphics/cairo/PlatformContextCairo.cpp:
1574         (WebCore::PlatformContextCairo::State::State):
1575         (WebCore::PlatformContextCairo::save):
1576
1577 2017-08-25  Xabier Rodriguez Calvar  <calvaris@igalia.com>
1578
1579         [EME][GStreamer] Move createDescryptor function to GStreamerEMEUtilities
1580         https://bugs.webkit.org/show_bug.cgi?id=175930
1581
1582         Reviewed by Žan Doberšek.
1583
1584         * platform/graphics/gstreamer/GStreamerUtilities.cpp:
1585         (WebCore::createGstDecryptor): Deleted.
1586         * platform/graphics/gstreamer/GStreamerUtilities.h:
1587         * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.cpp:
1588         (WebCore::GStreamerEMEUtilities::createDecryptor): Created.
1589         * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h:
1590         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
1591         (WebCore::AppendPipeline::parseDemuxerSrcPadCaps): Use
1592         GStreamerEMEUtilities::createDecryptor instead.
1593
1594 2017-08-25  Zan Dobersek  <zdobersek@igalia.com>
1595
1596         [WebCrypto] Push WorkQueue dispatches for RSA algorithms into shared code
1597         https://bugs.webkit.org/show_bug.cgi?id=175621
1598
1599         Reviewed by Darin Adler.
1600
1601         Push the WorkQueue dispatch code and other code duplicated between the
1602         Mac and libgcrypt implementations of Web Crypto into the shared layer.
1603         This patch focuses on the RSA-based algorithms.
1604
1605         The WorkQueue dispatch code is condensed into two static functions on
1606         the CryptoAlgorithm class, the first variation handling VectorCallback
1607         as the callback type and the other handling BoolCallback. The operation
1608         is kept in a WTF::Function<> object that returns an ExceptionOr<> value
1609         embedding either a Vector<uint8_t> object or a boolean value, as
1610         appropriate for the callback type.
1611
1612         Functions with platform-specific implementations that are invoked from
1613         these asynchronous dispatches are made static and return an ExceptionOr
1614         value. CryptoAlgorithmParameters objects are passed through non-const
1615         references because data getters could lazily construct the underlying
1616         Vector objects. CryptoKey objects are passed through const references.
1617         Implementations can then manually retrieve and further validate any key
1618         or parameter data, as required for that specific implementation. Input
1619         data is passed through const references to the original Vector objects.
1620
1621         No new tests -- no changes in behavior that's covered by existing tests.
1622
1623         * crypto/CryptoAlgorithm.cpp:
1624         (WebCore::dispatchOperationImpl):
1625         (WebCore::CryptoAlgorithm::dispatchOperation):
1626         * crypto/CryptoAlgorithm.h:
1627         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
1628         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::encrypt):
1629         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::decrypt):
1630         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h:
1631         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
1632         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::sign):
1633         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::verify):
1634         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h:
1635         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
1636         (WebCore::CryptoAlgorithmRSA_OAEP::encrypt):
1637         (WebCore::CryptoAlgorithmRSA_OAEP::decrypt):
1638         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h:
1639         * crypto/algorithms/CryptoAlgorithmRSA_PSS.cpp:
1640         (WebCore::CryptoAlgorithmRSA_PSS::sign):
1641         (WebCore::CryptoAlgorithmRSA_PSS::verify):
1642         * crypto/algorithms/CryptoAlgorithmRSA_PSS.h:
1643         * crypto/gcrypt/CryptoAlgorithmRSAES_PKCS1_v1_5GCrypt.cpp:
1644         (WebCore::gcryptEncrypt):
1645         (WebCore::gcryptDecrypt):
1646         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformEncrypt):
1647         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformDecrypt):
1648         * crypto/gcrypt/CryptoAlgorithmRSASSA_PKCS1_v1_5GCrypt.cpp:
1649         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformSign):
1650         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformVerify):
1651         * crypto/gcrypt/CryptoAlgorithmRSA_OAEPGCrypt.cpp:
1652         (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt):
1653         (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt):
1654         * crypto/gcrypt/CryptoAlgorithmRSA_PSSGCrypt.cpp:
1655         (WebCore::CryptoAlgorithmRSA_PSS::platformSign):
1656         (WebCore::CryptoAlgorithmRSA_PSS::platformVerify):
1657         * crypto/mac/CryptoAlgorithmRSAES_PKCS1_v1_5Mac.cpp:
1658         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformEncrypt):
1659         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformDecrypt):
1660         * crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp:
1661         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformSign):
1662         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformVerify):
1663         * crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp:
1664         (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt):
1665         (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt):
1666         * crypto/mac/CryptoAlgorithmRSA_PSSMac.cpp:
1667         (WebCore::CryptoAlgorithmRSA_PSS::platformSign):
1668         (WebCore::CryptoAlgorithmRSA_PSS::platformVerify):
1669
1670 2017-08-24  Chris Dumez  <cdumez@apple.com>
1671
1672         Unreviewed, add File and Directory Entries API to status page.
1673
1674         * features.json:
1675
1676 2017-08-24  Chris Dumez  <cdumez@apple.com>
1677
1678         Unreviewed, update status of Beacon API.
1679
1680         It is now supported in Safari Technology Preview.
1681
1682         * features.json:
1683
1684 2017-08-24  Chris Dumez  <cdumez@apple.com>
1685
1686         [Directory Upload] Add basic support for input.webkitdirectory
1687         https://bugs.webkit.org/show_bug.cgi?id=175950
1688         <rdar://problem/33951915>
1689
1690         Reviewed by Geoffrey Garen.
1691
1692         Add basic support for input.webkitdirectory attribute, as per:
1693         - https://wicg.github.io/entries-api/#html-forms
1694
1695         The following is supported:
1696         - input.webkitdirectory IDL and content attributes
1697         - The webkitdirectory content attribute is properly consulted
1698           to communicate to the client that the file picker should
1699           allow selecting directories.
1700         - When WebCore gets the list of selected files from the file picker,
1701           it properly resolves folders in a background thread to properly
1702           initialize input.files before firing the 'change' event at the
1703           input element.
1704         - When resolving files in a directory, we ignore both hidden files and
1705           symbolic links for security reasons. I did not check symlinks but Firefox
1706           and Chrome both seem to upload hidden files (such as .DS_Store files).
1707         - File.webkitRelativePath IDL attribute is properly populated for
1708           files coming from a selected directory.
1709         - Form submission just works because it relies on input.files being
1710           properly populated. No change needed in this area.
1711
1712         What is not supported:
1713         - input.webkitEntries IDL attribute.
1714         - FileSystemEntry / FileSystemDirectoryEntry / FileSystemDirectoryReader
1715           /  FileSystemFileEntry / FileSystem IDL interfaces.
1716         - dataTransferItem.webkitGetAsEntry() for proper drag and drop support.
1717
1718         Those will be taken care of in follow-up patches.
1719
1720         The feature is currently behind an experimental feature flag, disabled by
1721         default.
1722
1723         Tests: fast/forms/file/webkitdirectory-drag-folder.html
1724                fast/forms/file/webkitdirectory-open-panel.html
1725
1726         * CMakeLists.txt:
1727         * WebCore.xcodeproj/project.pbxproj:
1728         * fileapi/File.cpp:
1729         (WebCore::File::createWithRelativePath):
1730         * fileapi/File.h:
1731         * fileapi/File.idl:
1732         * html/FileInputType.cpp:
1733         (WebCore::FileInputType::~FileInputType):
1734         (WebCore::FileInputType::handleDOMActivateEvent):
1735         (WebCore::FileInputType::allowsDirectories const):
1736         (WebCore::FileInputType::filesChosen):
1737         * html/FileInputType.h:
1738         * html/FileListCreator.cpp: Added.
1739         (WebCore::appendDirectoryFiles):
1740         (WebCore::FileListCreator::FileListCreator):
1741         (WebCore::FileListCreator::createFileList):
1742         (WebCore::FileListCreator::cancel):
1743         * html/FileListCreator.h: Copied from Source/WebKit/UIProcess/API/APIOpenPanelParameters.h.
1744         (WebCore::FileListCreator::create):
1745         * html/HTMLAttributeNames.in:
1746         * html/HTMLInputElement.idl:
1747         * page/Settings.in:
1748         * platform/FileChooser.h:
1749         (WebCore::FileChooserFileInfo::isolatedCopy const):
1750         * platform/FileMetadata.h:
1751         * platform/FileSystem.cpp:
1752         (WebCore::fileIsDirectory):
1753         * platform/FileSystem.h:
1754         * platform/glib/FileSystemGlib.cpp:
1755         (WebCore::getFileMetadata):
1756         * platform/posix/FileSystemPOSIX.cpp:
1757         (WebCore::getFileMetadata):
1758         * platform/win/FileSystemWin.cpp:
1759         (WebCore::getFileMetadata):
1760
1761 2017-08-24  Ryan Haddad  <ryanhaddad@apple.com>
1762
1763         Unreviewed, rolling out r221139.
1764
1765         This change did not resolve the LayoutTest assertion failure.
1766
1767         Reverted changeset:
1768
1769         "REGRESSION (r220052): ASSERTION FAILED:
1770         !frame().isMainFrame() || !needsStyleRecalcOrLayout()  in
1771         WebCore::FrameView::updateLayoutAndStyleIfNeededRecursive()"
1772         https://bugs.webkit.org/show_bug.cgi?id=175270
1773         http://trac.webkit.org/changeset/221139
1774
1775 2017-08-24  Jon Lee  <jonlee@apple.com>
1776
1777         Unreviewed.
1778
1779         * Modules/mediastream/MediaStreamTrack.idl: Remove extraneous and confusing comment in IDL.
1780         The 'new' enum was removed via r215198, so we can remove this specific FIXME.
1781
1782 2017-08-24  Alex Christensen  <achristensen@webkit.org>
1783
1784         Stop using PolicyCallback for new window policies
1785         https://bugs.webkit.org/show_bug.cgi?id=175907
1786
1787         Reviewed by Andy Estes.
1788
1789         PolicyCallback is an artifact from the days before C++11.  Let's use lambdas instead!
1790         No change in behaviour.
1791
1792         * loader/PolicyCallback.cpp:
1793         (WebCore::PolicyCallback::set):
1794         (WebCore::PolicyCallback::call):
1795         (WebCore::PolicyCallback::cancel):
1796         * loader/PolicyCallback.h:
1797         * loader/PolicyChecker.cpp:
1798         (WebCore::PolicyChecker::checkNewWindowPolicy):
1799         (WebCore::PolicyChecker::continueAfterNewWindowPolicy): Deleted.
1800         * loader/PolicyChecker.h:
1801
1802 2017-08-24  Michael Saboff  <msaboff@apple.com>
1803
1804         Add support for RegExp "dotAll" flag
1805         https://bugs.webkit.org/show_bug.cgi?id=175924
1806
1807         Reviewed by Keith Miller.
1808
1809         Changed due to refactoring NewlineClassID to DotClassID.
1810
1811         No new tests. No change in behavior.
1812
1813         * contentextensions/URLFilterParser.cpp:
1814         (WebCore::ContentExtensions::PatternParser::atomBuiltInCharacterClass):
1815
1816 2017-08-24  Ryan Haddad  <ryanhaddad@apple.com>
1817
1818         Unreviewed, revert part of r221152 to fix internal builds.
1819
1820         * crypto/mac/CryptoKeyRSAMac.cpp:
1821         (WebCore::CryptoKeyRSA::create):
1822
1823 2017-08-24  Kirill Ovchinnikov  <kirill.ovchinn@gmail.com>
1824
1825         HTMLTrackElement behavior violates the standard
1826         https://bugs.webkit.org/show_bug.cgi?id=175888
1827
1828         Reviewed by Eric Carlson.
1829
1830         Test: media/track/text-track-src-change.html: added asserts
1831
1832         * html/HTMLTrackElement.cpp:
1833         (WebCore::HTMLTrackElement::parseAttribute):
1834         (WebCore::HTMLTrackElement::loadTimerFired):
1835         * html/track/LoadableTextTrack.cpp:
1836         (WebCore::LoadableTextTrack::scheduleLoad):
1837         * html/track/TextTrack.cpp:
1838         (WebCore::TextTrack::removeAllCues):
1839         * html/track/TextTrackCueList.cpp:
1840         (WebCore::TextTrackCueList::removeAll):
1841         * html/track/TextTrackCueList.h:
1842
1843 2017-08-24  David Kilzer  <ddkilzer@apple.com>
1844
1845         Fix -Wcast-qual and -Wunused-lambda-capture warnings in WebCore with new clang compiler
1846         <https://webkit.org/b/175910>
1847         <rdar://problem/33667497>
1848
1849         Reviewed by Alex Christensen.
1850
1851         Fix -Wunused-lambda-capture warnings:
1852
1853         * Modules/fetch/FetchResponse.cpp:
1854         (WebCore::FetchResponse::setBodyData): Remove unused lambda
1855         capture of 'this'.
1856         * style/RenderTreeUpdater.cpp:
1857         (WebCore::RenderTreeUpdater::createRenderer): Add
1858         UNUSED_PARAM(style) when ENABLE(CSS_REGIONS) is turned off.
1859
1860         Fix -Wcast-qual warnings:
1861
1862         * crypto/mac/CryptoKeyRSAMac.cpp:
1863         (WebCore::CryptoKeyRSA::create): Switch from C-style cast to
1864         reinterpret_cast with const keyword.  This better matches the
1865         argument types used in CCRSACryptorCreateFromData().
1866         * platform/audio/mac/FFTFrameMac.cpp:
1867         (WebCore::FFTFrame::doFFT): Switch from C-style cast to
1868         reinterpret_cast with const keyword.  This better matches the
1869         argument type used in vDSP_ctoz().
1870         * platform/graphics/FontPlatformData.h: Only define
1871         WebCore::toCTFont() and WebCore::toNSFont() when building for
1872         Objective-C++.
1873         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1874         (WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForLoadingOfResource):
1875         Switch from C-style cast to reinterpret_cast with const keyword.
1876         This better matches the argument type used in
1877         Uint8Array::setRange().
1878         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
1879         (WebCore::CMTimebaseEffectiveRateChangedCallback): Use
1880         const_cast to avoid warning.
1881         * platform/mac/SSLKeyGeneratorMac.mm:
1882         (WebCore::signedPublicKeyAndChallengeString): Use const_cast to
1883         avoid warning, and switch C-style cast to reinterpret_cast.
1884         * xml/XSLTProcessorLibxslt.cpp:
1885         (WebCore::XSLTProcessor::transformToString):
1886         - Use const_cast to avoid warning, and switch C-style cast to
1887           reinterpret_cast.
1888         - Switch C-style cast to reinterpret_cast and add const keyword.
1889         * xml/parser/XMLDocumentParserLibxml2.cpp:
1890         (WebCore::XMLParserContext::createMemoryParser): Use const_cast
1891         to avoid warning, and switch C-style cast to reinterpret_cast.
1892
1893 2017-08-22  Dave Hyatt  <hyatt@apple.com>
1894
1895         [Repaint Outside Layout] Add a pref for repainting outside of layout
1896         https://bugs.webkit.org/show_bug.cgi?id=175729
1897
1898         Reviewed by Daniel Bates.
1899
1900         * page/Settings.in:
1901         * rendering/RenderElement.cpp:
1902         (WebCore::RenderElement::checkForRepaintDuringLayout):
1903
1904 2017-08-22  Darin Adler  <darin@apple.com>
1905
1906         REGRESSION (r220052): ASSERTION FAILED: !frame().isMainFrame() || !needsStyleRecalcOrLayout()  in WebCore::FrameView::updateLayoutAndStyleIfNeededRecursive()
1907         https://bugs.webkit.org/show_bug.cgi?id=175270
1908
1909         Reviewed by Simon Fraser.
1910
1911         * dom/Document.cpp:
1912         (WebCore::Document::Document): Initialize m_styleRecalcTimer with a lamdba so it can work
1913         with a function that returns a bool and ignore the return value.
1914         (WebCore::Document::updateStyleIfNeeded): Added a boolean return value indicating if the
1915         function did any work or not.
1916         * dom/Document.h: Updated for above change.
1917
1918         * page/FrameView.cpp:
1919         (WebCore::appendRenderedChildren): Added helper that will later replace the
1920         FrameView::renderedChildFrameViews function and is used below.
1921         (WebCore::FrameView::updateLayoutAndStyleIfNeededRecursive): Instead of always doing two
1922         passes of style and layout update do up to four passes, but stop as soon as a pass does
1923         no work. This is slightly more efficient in cases where no layout and style update is
1924         needed, and works correctly when a third pass is needed, which is what happens in the
1925         test that was failing. We can eventually improve this further, but this resolves the
1926         immediate problem we are seeing in the test.
1927
1928 2017-08-24  Don Olmstead  <don.olmstead@sony.com>
1929
1930         [CMake] Use find_package for SQLite
1931         https://bugs.webkit.org/show_bug.cgi?id=175803
1932
1933         Reviewed by Konstantin Tokarev.
1934
1935         No new tests. No change in behavior.
1936
1937         * CMakeLists.txt:
1938         * PlatformGTK.cmake:
1939         * PlatformMac.cmake:
1940         * PlatformWPE.cmake:
1941         * PlatformWinCairo.cmake:
1942
1943 2017-08-23  Adrian Perez de Castro  <aperez@igalia.com>
1944
1945         Geoclue2 based backend should provide the right desktop ID
1946         https://bugs.webkit.org/show_bug.cgi?id=129879
1947
1948         Reviewed by Michael Catanzaro.
1949
1950         * platform/geoclue/GeolocationProviderGeoclue.cpp:
1951         (GeolocationProviderGeoclue::createGeoclueClientProxyCallback): Try first obtaining the application
1952         identifier using GApplication first, keeping a fallback to the value returned by g_get_prgname().
1953
1954 2017-08-24  Zan Dobersek  <zdobersek@igalia.com>
1955
1956         [EME] Implement HTMLMediaElement dispatch of the onencrypted event
1957         https://bugs.webkit.org/show_bug.cgi?id=175927
1958
1959         Reviewed by Xabier Rodriguez-Calvar.
1960
1961         Add the MediaPlayerClient::mediaPlayerInitializationDataEncountered()
1962         method that the platform-layer media pipeline can invoke when it hits
1963         encrypted content in the media data. The initialization data and its type
1964         are passed by the caller, allowing the HTMLMediaElement override to
1965         process it further.
1966
1967         This is done in the mediaPlayerInitializationDataEncountered() override
1968         in the HTMLMediaElement class. Partially implementing the 'Initialization
1969         Data Encountered' algorithm, the 'encrypted' event is dispatched, with the
1970         MediaEncryptedEvent interface being leveraged to embed init data and init
1971         data type information. CORS and mixed-content validation of the media data
1972         is skipped for now.
1973
1974         MediaPlayer::initializationDataEncountered() method should be used to
1975         dispatch the corresponding method on the client, passing on the given init
1976         data and init data type values.
1977
1978         * html/HTMLMediaElement.cpp:
1979         (WebCore::HTMLMediaElement::mediaPlayerInitializationDataEncountered):
1980         * html/HTMLMediaElement.h:
1981         * platform/graphics/MediaPlayer.cpp:
1982         (WebCore::MediaPlayer::initializationDataEncountered):
1983         * platform/graphics/MediaPlayer.h:
1984         (WebCore::MediaPlayerClient::mediaPlayerInitializationDataEncountered):
1985
1986 2017-08-23  Wenson Hsieh  <wenson_hsieh@apple.com>
1987
1988         DeleteSelectionCommand should be robust when starting and ending editable positions cannot be found
1989         https://bugs.webkit.org/show_bug.cgi?id=175914
1990         <rdar://problem/29792688>
1991
1992         Reviewed by Ryosuke Niwa.
1993
1994         DeleteSelectionCommand can cause a null dereference if editable start and end positions are not found. This can
1995         happen when attempting to delete after selecting the contents within a canvas or output element with `read-write`
1996         `-webkit-user-modify` style. To fix this, we make the initialization step of the DeleteSelectionCommand robust
1997         when editable start and end positions are missing.
1998
1999         Test: editing/execCommand/forward-delete-read-write-canvas.html
2000
2001         * editing/DeleteSelectionCommand.cpp:
2002         (WebCore::DeleteSelectionCommand::initializePositionData):
2003
2004         Make this initialization helper indicate failure via a bool return value. DeleteSelectionCommand::doApply bails
2005         early if initializePositionData returned false.
2006
2007         (WebCore::DeleteSelectionCommand::doApply):
2008         * editing/DeleteSelectionCommand.h:
2009
2010 2017-08-23  Youenn Fablet  <youenn@apple.com>
2011
2012         [Cache API] Unify WebCore and WebKit error handling
2013         https://bugs.webkit.org/show_bug.cgi?id=175902
2014         <rdar://problem/34045933>
2015
2016         Unreviewed.
2017
2018         * Modules/cache/DOMCache.h: Fixing Windows build.
2019
2020 2017-08-23  Ryan Haddad  <ryanhaddad@apple.com>
2021
2022         Unreviewed, rolling out r221109.
2023
2024         This change caused assertion failures on iOS and macOS debug
2025         bots.
2026
2027         Reverted changeset:
2028
2029         "Stop using PolicyCallback for new window policies"
2030         https://bugs.webkit.org/show_bug.cgi?id=175907
2031         http://trac.webkit.org/changeset/221109
2032
2033 2017-08-23  Jer Noble  <jer.noble@apple.com>
2034
2035         [EME] WebCoreDecompressionSession should only report having an available frame if it has one for the current time.
2036         https://bugs.webkit.org/show_bug.cgi?id=175901
2037
2038         Reviewed by Eric Carlson.
2039
2040         The WebCoreDecompressionSession will trigger the hasAvailableFrame callback whenever a frame is decoded,
2041         regardless of its presentation time. For formats which have out-of-order decoding, the newly decoded frame could
2042         have a presentation time far in the future. Instead, only fire the callback if the decoded frame's presentation
2043         times contains the timebase's current time.
2044
2045         * platform/graphics/cocoa/WebCoreDecompressionSession.mm:
2046         (WebCore::WebCoreDecompressionSession::enqueueDecodedSample):
2047
2048 2017-08-23  Youenn Fablet  <youenn@apple.com>
2049
2050         [Cache API] Unify WebCore and WebKit error handling
2051         https://bugs.webkit.org/show_bug.cgi?id=175902
2052
2053         Reviewed by Alex Christensen.
2054
2055         No change of behavior.
2056
2057         Introducing a DOMCache namespace enclosing structures, callbacks and function definitions
2058         previously found in either WebCore::CacheStorageConnection or WebKit::CacheStorage.
2059
2060         Some previously used callbacks had no way to pass errors in WebCore while they had in WebKit.
2061         Updated Cache, CacheStorage, CacheStorageConnection and WorkerCacheStorageConnection to deal with these potential errors.
2062
2063         * CMakeLists.txt:
2064         * Modules/cache/Cache.cpp:
2065         (WebCore::FetchTasksHandler::FetchTasksHandler):
2066         (WebCore::FetchTasksHandler::records const):
2067         (WebCore::FetchTasksHandler::addRecord):
2068         (WebCore::Cache::addAll):
2069         (WebCore::Cache::put):
2070         (WebCore::Cache::retrieveRecords):
2071         (WebCore::queryCacheMatch):
2072         (WebCore::Cache::batchDeleteOperation):
2073         (WebCore::toConnectionRecord):
2074         (WebCore::Cache::batchPutOperation):
2075         (WebCore::Cache::updateRecords):
2076         * Modules/cache/Cache.h:
2077         * Modules/cache/CacheStorage.cpp:
2078         (WebCore::CacheStorage::retrieveCaches):
2079         (WebCore::CacheStorage::open):
2080         (WebCore::CacheStorage::remove):
2081         * Modules/cache/CacheStorage.h:
2082         * Modules/cache/CacheStorageConnection.cpp:
2083         (WebCore::CacheStorageConnection::open):
2084         (WebCore::CacheStorageConnection::remove):
2085         (WebCore::CacheStorageConnection::retrieveCaches):
2086         (WebCore::CacheStorageConnection::batchDeleteOperation):
2087         (WebCore::CacheStorageConnection::batchPutOperation):
2088         (WebCore::CacheStorageConnection::openOrRemoveCompleted):
2089         (WebCore::CacheStorageConnection::updateCaches):
2090         (WebCore::CacheStorageConnection::updateRecords):
2091         (WebCore::CacheStorageConnection::deleteRecordsCompleted):
2092         (WebCore::CacheStorageConnection::putRecordsCompleted):
2093         * Modules/cache/CacheStorageConnection.h:
2094         (WebCore::CacheStorageConnection::openCompleted):
2095         (WebCore::CacheStorageConnection::removeCompleted):
2096         (WebCore::CacheStorageConnection::doOpen):
2097         (WebCore::CacheStorageConnection::doRemove):
2098         (WebCore::CacheStorageConnection::doBatchDeleteOperation):
2099         (WebCore::CacheStorageConnection::doBatchPutOperation):
2100         * Modules/cache/WorkerCacheStorageConnection.cpp:
2101         (WebCore::toCrossThreadRecordData):
2102         (WebCore::fromCrossThreadRecordData):
2103         (WebCore::WorkerCacheStorageConnection::doOpen):
2104         (WebCore::WorkerCacheStorageConnection::doRemove):
2105         (WebCore::WorkerCacheStorageConnection::doRetrieveCaches):
2106         (WebCore::recordsDataFromRecords):
2107         (WebCore::recordsDataOrErrorFromRecords):
2108         (WebCore::recordsFromRecordsData):
2109         (WebCore::recordsOrErrorFromRecordsData):
2110         (WebCore::WorkerCacheStorageConnection::doRetrieveRecords):
2111         (WebCore::WorkerCacheStorageConnection::doBatchDeleteOperation):
2112         (WebCore::WorkerCacheStorageConnection::doBatchPutOperation):
2113         * Modules/cache/DOMCache.cpp: Added.
2114         * Modules/cache/DOMCache.h: Added.
2115         * Modules/cache/WorkerCacheStorageConnection.h:
2116         * WebCore.xcodeproj/project.pbxproj:
2117
2118 2017-08-23  Yusuke Suzuki  <utatane.tea@gmail.com>
2119
2120         [JSC] Optimize Map iteration with intrinsic
2121         https://bugs.webkit.org/show_bug.cgi?id=174355
2122
2123         Reviewed by Saam Barati.
2124
2125         * bindings/js/SerializedScriptValue.cpp:
2126         (WebCore::CloneSerializer::serialize):
2127
2128 2017-08-23  Alex Christensen  <achristensen@webkit.org>
2129
2130         Stop using PolicyCallback for new window policies
2131         https://bugs.webkit.org/show_bug.cgi?id=175907
2132
2133         Reviewed by Andy Estes.
2134
2135         PolicyCallback is an artifact from the days before C++11.  Let's use lambdas instead!
2136         No change in behaviour.
2137
2138         * loader/PolicyCallback.cpp:
2139         (WebCore::PolicyCallback::set):
2140         (WebCore::PolicyCallback::call):
2141         (WebCore::PolicyCallback::cancel):
2142         * loader/PolicyCallback.h:
2143         * loader/PolicyChecker.cpp:
2144         (WebCore::PolicyChecker::checkNewWindowPolicy):
2145         (WebCore::PolicyChecker::continueAfterNewWindowPolicy): Deleted.
2146         * loader/PolicyChecker.h:
2147
2148 2017-08-23  Alex Christensen  <achristensen@webkit.org>
2149
2150         Stop using PolicyChecker for ContentPolicy
2151         https://bugs.webkit.org/show_bug.cgi?id=175904
2152
2153         Reviewed by Tim Horton.
2154
2155         PolicyChecker is an artifact from the days before C++11.  Now we have lambdas which
2156         have a cleaner flow than one class that exists to be effectively one of three lambda types.
2157         Let's remove them one at a time, starting with ContentPolicy checks.
2158         
2159         No change in behaviour.
2160
2161         * loader/DocumentLoader.cpp:
2162         (WebCore::DocumentLoader::responseReceived):
2163         * loader/FrameLoader.cpp:
2164         (WebCore::FrameLoader::checkContentPolicy):
2165         * loader/FrameLoader.h:
2166         * loader/PolicyCallback.cpp:
2167         (WebCore::PolicyCallback::set):
2168         (WebCore::PolicyCallback::call):
2169         (WebCore::PolicyCallback::cancel):
2170         * loader/PolicyCallback.h:
2171         * loader/PolicyChecker.cpp:
2172         (WebCore::PolicyChecker::checkContentPolicy): Deleted.
2173         (WebCore::PolicyChecker::continueAfterContentPolicy): Deleted.
2174         * loader/PolicyChecker.h:
2175
2176 2017-08-23  Jer Noble  <jer.noble@apple.com>
2177
2178         Build fix for 32-bit Mac after r221098. Make sure constant used in WebCoreDecompressionSession is SoftLinked.
2179
2180         * platform/cf/CoreMediaSoftLink.cpp:
2181         * platform/cf/CoreMediaSoftLink.h:
2182
2183 2017-08-23  Jer Noble  <jer.noble@apple.com>
2184
2185         Track VideoPlaybackQuality metrics when using WebCoreDecompressionSession.
2186         https://bugs.webkit.org/show_bug.cgi?id=175835
2187         <rdar://problem/34022234>
2188
2189         Reviewed by Eric Carlson.
2190
2191         Test: platform/mac/media/media-source/videoplaybackquality-decompressionsession.html
2192
2193         Track the total number of frames decoded, dropped, & corrupted, as well as the total
2194         delay imposed by decoding in the WebCoreDecompressionSession.
2195
2196         Drive-by fix: implement frame dropping by skipping frames whose presentation times are
2197         before the video's current time and which aren't depended upon by other frames.
2198
2199         * platform/cf/CoreMediaSoftLink.cpp:
2200         * platform/cf/CoreMediaSoftLink.h:
2201         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
2202         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::videoPlaybackQualityMetrics):
2203         * platform/graphics/cocoa/WebCoreDecompressionSession.h:
2204         (WebCore::WebCoreDecompressionSession::totalVideoFrames):
2205         (WebCore::WebCoreDecompressionSession::droppedVideoFrames):
2206         (WebCore::WebCoreDecompressionSession::corruptedVideoFrames):
2207         (WebCore::WebCoreDecompressionSession::totalFrameDelay):
2208         * platform/graphics/cocoa/WebCoreDecompressionSession.mm:
2209         (WebCore::WebCoreDecompressionSession::shouldDecodeSample):
2210         (WebCore::WebCoreDecompressionSession::decodeSample):
2211         (WebCore::WebCoreDecompressionSession::handleDecompressionOutput):
2212
2213 2017-08-23  Andy Estes  <aestes@apple.com>
2214
2215         [Payment Request] Update to "In Development" in features.json
2216         https://bugs.webkit.org/show_bug.cgi?id=175897
2217
2218         Reviewed by Sam Weinig.
2219
2220         * features.json:
2221
2222 2017-08-22  Dean Jackson  <dino@apple.com>
2223
2224         Default passive touch event listeners on the root
2225         https://bugs.webkit.org/show_bug.cgi?id=175346
2226         <rdar://problem/33164597>
2227
2228         Reviewed by Sam Weinig.
2229
2230         Make any touchstart or touchmove event listeners passive by default
2231         if they are on the document, window, body or document element targets.
2232         This follows the "intervention" first implemented by Chrome/Blink:
2233
2234         https://github.com/WICG/interventions/issues/35
2235         https://docs.google.com/document/d/1II7oSIpd8pK91V5kEM3tDLKcIj398jOJn8Niqy6_loI/edit
2236         https://github.com/whatwg/dom/issues/365
2237
2238         If the event listener explicitly defines "passive" to false in their
2239         options dictionary, then they'll still get a non-passive listener.
2240
2241         NOTE: Any fallout from this bug should be collected in:
2242         https://bugs.webkit.org/show_bug.cgi?id=175869
2243         Please do not revert this change just because a site is broken. We'll
2244         gather the issues and see if we can evangelise or detect via code.
2245
2246         Tests: fast/events/touch/ios/passive-by-default-on-document-and-window.html
2247                fast/events/touch/ios/passive-by-default-overridden-on-document-and-window.html
2248
2249         * dom/EventNames.h:
2250         (WebCore::EventNames::isTouchScrollBlockingEventType const): Added this helper
2251         to identify the types of touches we want to check for.
2252         * dom/EventTarget.cpp:
2253         (WebCore::EventTarget::addEventListener): Check for the event being one of the touch-types
2254         that we care about, and the target being one of the Node/Window types we care about. If
2255         so, tell the event listener to be passive.
2256         * dom/EventTarget.h: Use an optional for the passive member.
2257         (WebCore::EventTarget::AddEventListenerOptions::AddEventListenerOptions):
2258         * dom/EventTarget.idl: Change "passive" to not have a default value, so we
2259         can detect if it was explicitly set to false.
2260
2261 2017-08-23  Tim Horton  <timothy_horton@apple.com>
2262
2263         Try to fix the WinCairo build after r221068
2264
2265         * platform/win/PlatformScreenWin.cpp:
2266
2267 2017-08-23  Youenn Fablet  <youenn@apple.com>
2268
2269         [Cache API] Enable persistent coder to encode FetchOptions
2270         https://bugs.webkit.org/show_bug.cgi?id=175883
2271
2272         Reviewed by Alex Christensen.
2273
2274         No change of behavior.
2275         Adding encode/decode routines for FetchOptions.
2276
2277         * loader/FetchOptions.h:
2278         (WebCore::FetchOptions::encode const):
2279         (WebCore::FetchOptions::decode):
2280         * platform/ReferrerPolicy.h:
2281
2282 2017-08-23  Yusuke Suzuki  <utatane.tea@gmail.com>
2283
2284         Race condition in StartWebThread causing crash
2285         https://bugs.webkit.org/show_bug.cgi?id=175852
2286
2287         Reviewed by Mark Lam.
2288
2289         When starting web thread, the main thread waits for completion of web thread initialization
2290         by using pthread_cond_t. However, the main thread may be woken up due to the existence of
2291         the spurious wake up of pthread_cond_t.
2292
2293         Instead, we should use WTF::Lock and WTF::Condition. Since our StartWebThread already calls
2294         WTF::initializeThreading, it is safe to use WTF::Lock and WTF::Condition. And our WTF::Condition
2295         does not have the spurious wake up problem as described in Condition.h.
2296
2297         * platform/ios/wak/WebCoreThread.mm:
2298         (RunWebThread):
2299         (StartWebThread):
2300
2301 2017-08-23  Brent Fulgham  <bfulgham@apple.com>
2302
2303         Ensure media controls host exists before using it
2304         https://bugs.webkit.org/show_bug.cgi?id=175833
2305         <rdar://problem/34001219>
2306
2307         Reviewed by Jer Noble.
2308
2309         Although we ensure that the media controls shadow root exists before updating the text track
2310         container, we don't check that the media controls host has been created yet. We do check
2311         and create in other places in HTMLMediaElement.
2312
2313         * html/HTMLMediaElement.cpp:
2314         (WebCore::HTMLMediaElement::updateTextTrackDisplay): 
2315
2316 2017-08-23  Carlos Alberto Lopez Perez  <clopez@igalia.com>
2317
2318         [WPE] Some event handlers not working.
2319         https://bugs.webkit.org/show_bug.cgi?id=175864
2320
2321         Reviewed by Michael Catanzaro.
2322
2323         Share the EventHandler implementation with the GTK port and add ifdefs where needed.
2324
2325         Covered by existing tests.
2326
2327         * PlatformGTK.cmake:
2328         * PlatformWPE.cmake:
2329         * page/wpe/EventHandlerWPE.cpp: Removed.
2330         * platform/glib/EventHandlerGlib.cpp: Renamed from Source/WebCore/page/gtk/EventHandlerGtk.cpp.
2331         (WebCore::EventHandler::shouldTurnVerticalTicksIntoHorizontal const):
2332
2333 2017-08-22  Tim Horton  <timothy_horton@apple.com>
2334
2335         _WKThumbnailView should use the screen color space instead of sRGB
2336         https://bugs.webkit.org/show_bug.cgi?id=175858
2337         <rdar://problem/33925559>
2338
2339         Reviewed by Dean Jackson.
2340
2341         * platform/PlatformScreen.h:
2342         * platform/ios/PlatformScreenIOS.mm:
2343         (WebCore::screenColorSpace):
2344         * platform/mac/PlatformScreenMac.mm:
2345         (WebCore::screenColorSpace):
2346         (WebCore::screenSupportsExtendedColor):
2347         * platform/win/PlatformScreenWin.cpp:
2348         (WebCore::screenColorSpace):
2349         Add screenColorSpace, which returns the active color space for the
2350         given Widget's screen. On Windows, just fall back to sRGB like we usually do.
2351
2352 2017-08-22  Ryosuke Niwa  <rniwa@webkit.org>
2353
2354         Consolidate the code to normalize MIME type in DataTransfer
2355         https://bugs.webkit.org/show_bug.cgi?id=175810
2356
2357         Rubber-stamped by Wenson Hsieh.
2358
2359         Address the forgotten review comment by Wenson.
2360
2361         Tests: editing/pasteboard/datatransfer-getdata-plaintext.html
2362
2363         * dom/DataTransfer.cpp:
2364         (WebCore::DataTransfer::clearData):
2365
2366 2017-08-20  Wenson Hsieh  <wenson_hsieh@apple.com>
2367
2368         [iOS WK2] WKWebView schedules nonstop layout after pressing cmb+b,i,u inside a contenteditable div
2369         https://bugs.webkit.org/show_bug.cgi?id=175116
2370         <rdar://problem/28279301>
2371
2372         Reviewed by Darin Adler and Ryosuke Niwa.
2373
2374         WebCore support for WebPage::editorState refactoring. See WebKit ChangeLogs for more detail.
2375
2376         Tests: EditorStateTests.TypingAttributesBold
2377                EditorStateTests.TypingAttributesItalic
2378                EditorStateTests.TypingAttributesUnderline
2379                EditorStateTests.TypingAttributesTextAlignmentAbsoluteAlignmentOptions
2380                EditorStateTests.TypingAttributesTextAlignmentStartEnd
2381                EditorStateTests.TypingAttributesTextAlignmentDirectionalText
2382                EditorStateTests.TypingAttributesTextColor
2383                EditorStateTests.TypingAttributesMixedStyles
2384                EditorStateTests.TypingAttributesLinkColor
2385
2386         * css/StyleProperties.cpp:
2387         (WebCore::StyleProperties::propertyAsColor const):
2388         (WebCore::StyleProperties::propertyAsValueID const):
2389
2390         Introduces some helper functions in StyleProperties to convert CSS property values to Color or a CSSValueID.
2391
2392         * css/StyleProperties.h:
2393         * editing/EditingStyle.cpp:
2394         (WebCore::EditingStyle::hasStyle):
2395
2396         Pull out logic in selectionStartHasStyle that asks for a style TriState into EditingStyle::hasStyle. This is
2397         because WebPage::editorState will now query for multiple styles at the selection start, but
2398         selectionStartHasStyle currently recomputes styleAtSelectionStart every time it is called. To prevent extra work
2399         from being done, we can just call selectionStartHasStyle once and use ask for EditingStyle::hasStyle on the
2400         computed EditingStyle at selection start.
2401
2402         * editing/EditingStyle.h:
2403         * editing/Editor.cpp:
2404         (WebCore::Editor::selectionStartHasStyle const):
2405
2406 2017-08-22  Wenson Hsieh  <wenson_hsieh@apple.com>
2407
2408         [WK2] EditorState updates should be rolled into the layer update lifecycle when possible
2409         https://bugs.webkit.org/show_bug.cgi?id=175370
2410         <rdar://problem/33799806>
2411
2412         Reviewed by Ryosuke Niwa.
2413
2414         Remove didChangeSelectionAndUpdateLayout -- EditorState updates that are scheduled due to missing post-layout
2415         data will now be scheduled for the next presentation update. Additionally, add editor client hooks to notify the
2416         WebKit layer when we've updated the current composition. See WebKit ChangeLog for more details. This patch
2417         adjusts and rebaselines existing layout tests.
2418
2419         * editing/Editor.cpp:
2420         (WebCore::SetCompositionScope::SetCompositionScope):
2421         (WebCore::SetCompositionScope::~SetCompositionScope):
2422
2423         Introduce a helper RAII class to ensure that we ignore selection changes during the scope of
2424         Editor::setComposition and call out to the client with WebEditorClient::didUpdateComposition afterwards. This
2425         also maintains a UserTypingGestureIndicator over its lifetime, so we don't additionally need to create a
2426         UserTypingGestureIndicator in Editor::setComposition.
2427
2428         (WebCore::Editor::setComposition):
2429         * editing/FrameSelection.cpp:
2430         (WebCore::FrameSelection::setSelection):
2431         (WebCore::FrameSelection::updateAndRevealSelection):
2432         (WebCore::FrameSelection::setSelectedRange):
2433         * editing/FrameSelection.h:
2434         (WebCore::FrameSelection::defaultSetSelectionOptions):
2435
2436         Plumb state about whether or not the selection change was triggered by the user to FrameSelection::setSelection,
2437         and if so, notify the editing client. A separate SetSelectionOptions flag is used here instead of
2438         RevealSelection to avoid calling out to the client in places where we want to reveal the selection regardless of
2439         whether or not the selection is user triggered.
2440
2441         * loader/EmptyClients.cpp:
2442         * page/EditorClient.h:
2443
2444 2017-08-21  Ryosuke Niwa  <rniwa@webkit.org>
2445
2446         Consolidate the code to normalize MIME type in DataTransfer
2447         https://bugs.webkit.org/show_bug.cgi?id=175810
2448
2449         Reviewed by Wenson Hsieh.
2450
2451         Factored out the code to convert MIME type to lowercase after stripping whitespace,
2452         and treat "text" as "text/plain" and "url" as "text/uri-list".
2453
2454         Specifications:
2455         https://html.spec.whatwg.org/multipage/dnd.html#dom-datatransfer-getdata-2
2456         https://html.spec.whatwg.org/multipage/dnd.html#dom-datatransfer-setdata-2
2457         https://html.spec.whatwg.org/multipage/dnd.html#dom-datatransfer-cleardata-2
2458
2459         Stripping of whitespace only happens in WebKit/Blink but it's probably required for compatbility.
2460         Spec bug: https://github.com/whatwg/html/issues/2946
2461
2462         Test: editing/pasteboard/datatransfer-getdata-plaintext.html
2463
2464         * dom/DataTransfer.cpp:
2465         (WebCore::normalizeType):
2466         (WebCore::DataTransfer::clearData):
2467         (WebCore::DataTransfer::getData const):
2468         (WebCore::DataTransfer::setData):
2469         * platform/gtk/PasteboardGtk.cpp:
2470         (WebCore::selectionDataTypeFromHTMLClipboardType):
2471         * platform/ios/PasteboardIOS.mm:
2472         (WebCore::cocoaTypeFromHTMLClipboardType):
2473         * platform/mac/PasteboardMac.mm:
2474         (WebCore::cocoaTypeFromHTMLClipboardType):
2475         * platform/win/PasteboardWin.cpp:
2476         (WebCore::clipboardTypeFromMIMEType):
2477
2478 2017-08-22  Matt Lewis  <jlewis3@apple.com>
2479
2480         Unreviewed, rolling out r221033.
2481
2482         This revision caused assertion failures on all Open Source
2483         Debug testers. See Radar for more information.
2484
2485         Reverted changeset:
2486
2487         "Ensure media controls host exists before using it"
2488         https://bugs.webkit.org/show_bug.cgi?id=175833
2489         http://trac.webkit.org/changeset/221033
2490
2491 2017-08-22  Per Arne Vollan  <pvollan@apple.com>
2492
2493         [Win] Fix compile errors.
2494         https://bugs.webkit.org/show_bug.cgi?id=175860
2495
2496         Reviewed by Brent Fulgham.
2497
2498         Add required header files. 
2499
2500         * platform/network/cf/CookieJarCFNet.cpp:
2501
2502 2017-08-22  Brent Fulgham  <bfulgham@apple.com>
2503
2504         Correct SOUP builds after r221017 and r221050.
2505         https://bugs.webkit.org/show_bug.cgi?id=175846
2506
2507         Reviewed by Michael Catanzaro.
2508
2509         * platform/network/soup/CookieJarSoup.cpp:
2510         (WebCore::cookiesForDOM): Revise return type.
2511
2512 2017-08-22  Brent Fulgham  <bfulgham@apple.com>
2513
2514         Correct SOUP and cURL builds after r221017.
2515         https://bugs.webkit.org/show_bug.cgi?id=175846
2516
2517         Reviewed by Michael Catanzaro.
2518
2519         Correct the method signatures for 'cookiesForDOM' on the SOUP and cURL backends.
2520         Note that these ports will need to add specific logic to find/filter secure cookies
2521         if requested by the caller.
2522
2523         * platform/network/curl/CookieJarCurl.cpp:
2524         (WebCore::CookieJarCurlFileSystem::cookiesForDOM):
2525         (WebCore::cookiesForDOM):
2526         * platform/network/curl/CookieJarCurl.h:
2527         * platform/network/soup/CookieJarSoup.cpp:
2528         (WebCore::cookiesForDOM):
2529
2530 2017-08-22  Chris Dumez  <cdumez@apple.com>
2531
2532         [EnabledBySetting] in WebIDL uses Document but does not include Document.h
2533         https://bugs.webkit.org/show_bug.cgi?id=175843
2534
2535         Reviewed by Sam Weinig.
2536
2537         * bindings/scripts/CodeGeneratorJS.pm:
2538         (GenerateImplementation):
2539
2540 2017-08-22  Jer Noble  <jer.noble@apple.com>
2541
2542         Refactor videoPerformanceQuality() MediaPlayer methods into single call.
2543         https://bugs.webkit.org/show_bug.cgi?id=175830
2544
2545         Reviewed by Eric Carlson.
2546
2547         Allow MediaPlayerPrivate subclasses to return all the metrics required for VideoPerformanceQuality in
2548         a single call. For clients which incur significant overhead to request this data, this reduces the cost
2549         of requesting data by the number of calls removed.
2550
2551         * html/HTMLMediaElement.cpp:
2552         (WebCore::HTMLMediaElement::getVideoPlaybackQuality):
2553         * platform/graphics/MediaPlayer.cpp:
2554         (WebCore::MediaPlayer::videoPlaybackQualityMetrics):
2555         (WebCore::MediaPlayer::totalVideoFrames): Deleted.
2556         (WebCore::MediaPlayer::droppedVideoFrames): Deleted.
2557         (WebCore::MediaPlayer::corruptedVideoFrames): Deleted.
2558         (WebCore::MediaPlayer::totalFrameDelay): Deleted.
2559         * platform/graphics/MediaPlayer.h:
2560         (WebCore::PlatformVideoPlaybackQualityMetrics::PlatformVideoPlaybackQualityMetrics):
2561         * platform/graphics/MediaPlayerPrivate.h:
2562         (WebCore::MediaPlayerPrivateInterface::videoPlaybackQualityMetrics):
2563         (WebCore::MediaPlayerPrivateInterface::totalVideoFrames): Deleted.
2564         (WebCore::MediaPlayerPrivateInterface::droppedVideoFrames): Deleted.
2565         (WebCore::MediaPlayerPrivateInterface::corruptedVideoFrames): Deleted.
2566         (WebCore::MediaPlayerPrivateInterface::totalFrameDelay): Deleted.
2567         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
2568         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
2569         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::videoPlaybackQualityMetrics):
2570         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::totalVideoFrames): Deleted.
2571         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::droppedVideoFrames): Deleted.
2572         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::corruptedVideoFrames): Deleted.
2573         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::totalFrameDelay): Deleted.
2574         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:
2575         * platform/mock/mediasource/MockMediaPlayerMediaSource.cpp:
2576         (WebCore::MockMediaPlayerMediaSource::videoPlaybackQualityMetrics):
2577         (WebCore::MockMediaPlayerMediaSource::totalVideoFrames): Deleted.
2578         (WebCore::MockMediaPlayerMediaSource::droppedVideoFrames): Deleted.
2579         (WebCore::MockMediaPlayerMediaSource::corruptedVideoFrames): Deleted.
2580         (WebCore::MockMediaPlayerMediaSource::totalFrameDelay): Deleted.
2581         * platform/mock/mediasource/MockMediaPlayerMediaSource.h:
2582         * platform/mock/mediasource/MockMediaSourcePrivate.cpp:
2583         (WebCore::MockMediaSourcePrivate::videoPlaybackQualityMetrics):
2584         * platform/mock/mediasource/MockMediaSourcePrivate.h:
2585
2586 2017-08-22  Brent Fulgham  <bfulgham@apple.com>
2587
2588         Ensure media controls host exists before using it
2589         https://bugs.webkit.org/show_bug.cgi?id=175833
2590         <rdar://problem/34001219>
2591
2592         Reviewed by Jer Noble.
2593
2594         Although we ensure that the media controls shadow root exists before updating the text track
2595         container, we don't check that the media controls host has been created yet. We do check
2596         and create in other places in HTMLMediaElement.
2597
2598         Tests: media/track/track-display-before-controls-crash.html
2599
2600         * html/HTMLMediaElement.cpp:
2601         (WebCore::HTMLMediaElement::updateTextTrackDisplay): 
2602
2603 2017-08-22  Youenn Fablet  <youenn@apple.com>
2604
2605         [Cache API] Optimize whitespace trimming in Vary header values
2606         https://bugs.webkit.org/show_bug.cgi?id=175837
2607
2608         Reviewed by Alex Christensen.
2609
2610         No change of behavior.
2611
2612         Introducing a StringView version of stripLeadingAndTrailingHTTPSpaces.
2613
2614         * Modules/cache/Cache.cpp:
2615         (WebCore::hasResponseVaryStarHeaderValue):
2616         * platform/network/HTTPParsers.h:
2617         (WebCore::stripLeadingAndTrailingHTTPSpaces):
2618
2619 2017-08-22  Alex Christensen  <achristensen@webkit.org>
2620
2621         Remove ChromeClient::scrollbarsModeDidChange
2622         https://bugs.webkit.org/show_bug.cgi?id=175805
2623
2624         Reviewed by Daniel Bates.
2625
2626         No change in behavior.  It was never called, and no implementations did anything.
2627
2628         * loader/EmptyClients.h:
2629         * page/Chrome.cpp:
2630         (WebCore::Chrome::scrollbarsModeDidChange const): Deleted.
2631         * page/Chrome.h:
2632         * page/ChromeClient.h:
2633         * platform/HostWindow.h:
2634
2635 2017-08-22  Devin Rousso  <webkit@devinrousso.com>
2636
2637         Web Inspector: provide way for ShaderPrograms to be enabled/disabled
2638         https://bugs.webkit.org/show_bug.cgi?id=175400
2639
2640         Reviewed by Matt Baker.
2641
2642         Test: inspector/canvas/setShaderProgramDisabled.html
2643
2644         * inspector/InspectorShaderProgram.h:
2645         (WebCore::InspectorShaderProgram::disabled):
2646         (WebCore::InspectorShaderProgram::setDisabled):
2647
2648         * html/canvas/WebGLRenderingContextBase.cpp:
2649         (WebCore::WebGLRenderingContextBase::drawArrays):
2650         (WebCore::WebGLRenderingContextBase::drawElements):
2651         If the current program is disabled, return early. This will prevent the current shader
2652         program from drawing anything to the canvas.
2653
2654         * inspector/InspectorCanvasAgent.h:
2655         * inspector/InspectorCanvasAgent.cpp:
2656         (WebCore::InspectorCanvasAgent::setShaderProgramDisabled):
2657         (WebCore::InspectorCanvasAgent::isShaderProgramDisabled):
2658         * inspector/InspectorInstrumentation.h:
2659         * inspector/InspectorInstrumentation.cpp:
2660         (WebCore::InspectorInstrumentation::isShaderProgramDisabled):
2661         (WebCore::InspectorInstrumentation::isShaderProgramDisabledImpl):
2662
2663 2017-08-22  Youenn Fablet  <youenn@apple.com>
2664
2665         [Cache API] Add support for overwriting responses with put on an existing record
2666         https://bugs.webkit.org/show_bug.cgi?id=175825
2667
2668         Reviewed by Geoffrey Garen.
2669
2670         Tests: http/wpt/cache-storage/cache-put-keys.https.any.html
2671                http/wpt/cache-storage/cache-put-keys.https.any.worker.html
2672
2673         Adding support for the new response update counter.
2674         Overwriting local cached response with new retrieved response when the counter is different.
2675         Adding support for passing this value from/to workers.
2676
2677         * Modules/cache/Cache.cpp:
2678         (WebCore::Cache::queryCacheWithTargetStorage):
2679         (WebCore::toConnectionRecord):
2680         (WebCore::Cache::updateRecords):
2681         * Modules/cache/CacheStorageConnection.cpp:
2682         (WebCore::CacheStorageConnection::Record::copy const):
2683         * Modules/cache/CacheStorageConnection.h:
2684         * Modules/cache/CacheStorageRecord.h:
2685         * Modules/cache/WorkerCacheStorageConnection.cpp:
2686         (WebCore::toCrossThreadRecordData):
2687         (WebCore::fromCrossThreadRecordData):
2688
2689 2017-08-22  Alex Christensen  <achristensen@webkit.org>
2690
2691         Remove ChromeClient::hasOpenedPopup
2692         https://bugs.webkit.org/show_bug.cgi?id=175804
2693
2694         Reviewed by Sam Weinig.
2695
2696         No change in behavior.  All implementations just returned false.
2697
2698         * loader/EmptyClients.h:
2699         * page/Chrome.cpp:
2700         (WebCore::Chrome::hasOpenedPopup const): Deleted.
2701         * page/Chrome.h:
2702         * page/ChromeClient.h:
2703         * rendering/RenderMenuList.cpp:
2704         (RenderMenuList::showPopup):
2705
2706 2017-08-22  Andy Estes  <aestes@apple.com>
2707
2708         [Payment Request] Implement error checking for show(), abort(), and canMakePayment()
2709         https://bugs.webkit.org/show_bug.cgi?id=175789
2710
2711         Reviewed by Brady Eidson.
2712
2713         Implement many of the exceptions and promise rejections specified for PaymentRequest's
2714         show(), abort(), and canMakePayment() methods. Also implement basic state tracking.
2715
2716         * Modules/paymentrequest/PaymentRequest.cpp:
2717         (WebCore::PaymentRequest::create): Changed serializedMethodData from a
2718         HashMap<String, String> to a Vector<PaymentRequest::Method>.
2719         (WebCore::PaymentRequest::PaymentRequest):
2720         (WebCore::PaymentRequest::show): Added promise rejection for invalid state, updated the
2721         state to Interactive, stored the promise in m_showPromise, and dispatched finishShowing().
2722         (WebCore::PaymentRequest::finishShowing): Added JSON parsing of payment method serialized
2723         data and exception propagation. If there are no exceptions, rejected m_showPromise with
2724         NotSupportedError since we don't yet support any payment methods.
2725         (WebCore::PaymentRequest::abort): Added promise rejection for invalid state and stored the
2726         promise in m_abortPromise. Dispatched a lambda to update the state to Closed, reject
2727         m_showPromise, and resolve m_abortPromise.
2728         (WebCore::PaymentRequest::canMakePayment): Added promise rejection for invalid state and
2729         stored the promise in m_canMakePaymentPromise. Dispatched a lambda to resolve
2730         m_canMakePaymentPromise with false since we don't yet support any payment methods.
2731         * Modules/paymentrequest/PaymentRequest.h:
2732         * Modules/paymentrequest/PaymentRequest.idl: Annotated abort() with MayThrowException.
2733
2734 2017-08-22  Brent Fulgham  <bfulgham@apple.com> and Pranjal Jumde  <pjumde@apple.com>
2735
2736         Disable access to secure cookies if an HTTPS site loads mixed content
2737         https://bugs.webkit.org/show_bug.cgi?id=157053
2738         <rdar://problem/11290808>
2739
2740         Reviewed by Dan Bates.
2741
2742         Tests: http/tests/security/mixedContent/insecure-css-with-secure-cookies.html
2743                http/tests/security/mixedContent/insecure-image-with-securecookie-block.html
2744                http/tests/security/mixedContent/insecure-image-with-securecookie.html
2745                http/tests/security/mixedContent/insecure-script-with-secure-cookies.html
2746                http/tests/security/mixedContent/redirect-https-to-http-image-secure-cookies-block.html
2747                http/tests/security/mixedContent/redirect-https-to-http-image-secure-cookies.html
2748
2749         * dom/SecurityContext.h: 
2750         (WebCore::SecurityContext::secureCookiesAccessed): Added.
2751         (WebCore::SecurityContext::setSecureCookiesAccessed): Added.
2752         * loader/CookieJar.cpp:
2753         (WebCore::cookies): Pass Document as non-const so we can call 'setSecureCookiesAccessed' if necessary.
2754         * loader/CookieJar.h:
2755         * loader/MixedContentChecker.cpp:
2756         (WebCore::MixedContentChecker::canRunInsecureContent): Updated checks to avoid running insecure content
2757         if secure cookies were accessed. 
2758         * platform/CookiesStrategy.h:
2759         (WebCore::CookiesStrategy::cookiesForDOM): Pass new argument indicating whether secure cookies should be included in the response.
2760         * platform/network/PlatformCookieJar.h:
2761         * platform/network/cf/CookieJarCFNet.cpp:
2762         (copyCookiesForURLWithFirstPartyURL): Revise to accept new 'IncludeSecureCookiesOrNot' argument.
2763         (WebCore::cookiesForSession): Updated to accept new 'IncludeSecureCookiesOrNot' argument. Also determine if secure cookies were
2764         included in the response, and return this to the caller.
2765         (WebCore::cookieRequestHeaderFieldValue): Revise for new 'copyCookiesForURLWithFirstPartyURL' signature.
2766         (WebCore::getRawCookies): Ditto.
2767         * platform/network/mac/CookieJarMac.mm:
2768         (WebCore::cookiesForSession): Updated checks to keep track of secure cookies and filter out secure cookies if insecure content
2769         was accessed.
2770         (WebCore::cookiesForDOM): Update for new arguments and to return a pair.
2771         (WebCore::cookieRequestHeaderFieldValue): Ditto.
2772
2773 2017-08-22  Jer Noble  <jer.noble@apple.com>
2774
2775         Autoplay Muted Videos Don't Play When Outside Viewport
2776         https://bugs.webkit.org/show_bug.cgi?id=175748
2777         <rdar://problem/33974383>
2778
2779         Reviewed by Eric Carlson.
2780
2781         Test: media/video-restricted-invisible-autoplay-not-allowed-source.html
2782
2783         The media session is notified that its client (the media element) will begin autoplaying inside
2784         prepareForLoad(), where the m_autoplaying flag is also set. But loading via <source> elements does not go
2785         through prepareForLoad(); the HTML standard states that the <source> element loading path does not trigger the
2786         "media element load algorithm" which is implemented in prepareForLoad(). Since the m_autoplaying flag is
2787         initially set to true, notify the media session that the element will begin autoplaying inside the element's
2788         constructor.
2789
2790         Drive-by fix: Doing the above causes other tests to crash, as purturbing play state during style change can cause
2791         re-entrancy in the native controls code, or fail, since we will transition from autoplay -> play even if there's
2792         not yet a src or source to the media element. Add a task queue for updating the autoplay state and check the ready
2793         state before allowing autoplay to transition to play.
2794
2795         * html/HTMLMediaElement.cpp:
2796         (WebCore::HTMLMediaElement::HTMLMediaElement):
2797         (WebCore::HTMLMediaElement::~HTMLMediaElement):
2798         (WebCore::HTMLMediaElement::canTransitionFromAutoplayToPlay const):
2799         (WebCore::HTMLMediaElement::isVisibleInViewportChanged):
2800
2801 2017-08-21  Matt Rajca  <mrajca@apple.com>
2802
2803         Call updateIsPlayingMedia whenever m_userHasInteractedWithMediaElement changes
2804         https://bugs.webkit.org/show_bug.cgi?id=175796
2805
2806         Reviewed by Eric Carlson.
2807
2808         Test: media/video-user-gesture-tracking.html
2809
2810         The page media state depends on m_userHasInteractedWithMediaElement, so force it to update
2811         as soon as m_userHasInteractedWithMediaElement changes. This fixes an issue where the media
2812         state would not reflect the user interaction flag until a call to updateIsPlayingMedia was made.
2813
2814         * dom/Document.cpp:
2815         (WebCore::Document::noteUserInteractionWithMediaElement):
2816         * dom/Document.h:
2817         (WebCore::Document::noteUserInteractionWithMediaElement): Deleted.
2818         * testing/Internals.cpp:
2819         (WebCore::Internals::pageMediaState):
2820
2821 2017-08-22  Zan Dobersek  <zdobersek@igalia.com>
2822
2823         GLContext: zero-initialize the GLContext pointer in ThreadGlobalGLContext
2824         https://bugs.webkit.org/show_bug.cgi?id=175819
2825
2826         Reviewed by Xabier Rodriguez-Calvar.
2827
2828         * platform/graphics/GLContext.cpp: The ThreadGlobalGLContext object is
2829         allocated on heap, so the embedded GLContext pointer can contain a
2830         non-null value that can cause problems when e.g. checking for a current
2831         GLContext on some specific thread on which a GLContext hasn't yet been
2832         made current. Zero-initializing this pointer will avoid false positives
2833         that can occur in these circumstances.
2834
2835 2017-08-21  Youenn Fablet  <youenn@apple.com>
2836
2837         [Cache API] Add support for Cache.add/addAll
2838         https://bugs.webkit.org/show_bug.cgi?id=175677
2839
2840         Reviewed by Alex Christensen.
2841
2842         Covered by rebased tests.
2843
2844         Cache.addAll implementation is then as follow:
2845         - Fetch the resources in parallel.
2846         - Wait for all them to complete using FetchTaskCounter.
2847         - If an error happens in any load or if the response is not as expected for Cache API, reject the promise.
2848         - Call the batch put operation with all received FetchResponse objects.
2849
2850         FetchTaskCounter is responsible to wait for each response to arrive.
2851         It then checks whether the response is fine,
2852         If not, the addAll promise is rejected.
2853         Otherwise, it waits for the body to be received.
2854
2855         Introducing a helper routine to create a FetchRequest from a given RequestInfo.
2856         Introducing a helper routine to check for Vary Header '*' value in response headers.
2857
2858         * Modules/cache/Cache.cpp:
2859         (WebCore::Cache::doMatch):
2860         (WebCore::Cache::add):
2861         (WebCore::queryCacheMatch):
2862         (WebCore::hasResponseVaryStarHeaderValue):
2863         (WebCore::FetchTaskCounter::FetchTaskCounter):
2864         (WebCore::FetchTaskCounter::~FetchTaskCounter):
2865         (WebCore::FetchTaskCounter::addRecord):
2866         (WebCore::FetchTaskCounter::isDone const):
2867         (WebCore::FetchTaskCounter::reject):
2868         (WebCore::Cache::requestFromInfo):
2869         (WebCore::Cache::addAll):
2870         (WebCore::Cache::put):
2871         (WebCore::Cache::remove):
2872         (WebCore::Cache::keys):
2873         (WebCore::toConnectionRecord):
2874         (WebCore::Cache::batchPutOperation):
2875         * Modules/cache/Cache.h:
2876
2877 2017-08-21  Myles C. Maxfield  <mmaxfield@apple.com>
2878
2879         DataInteractionTests.ExternalSourceAttributedStringToContentEditable hits a debug assertion
2880         https://bugs.webkit.org/show_bug.cgi?id=175787
2881         <rdar://problem/33996612>
2882
2883         Reviewed by Wenson Hsieh.
2884
2885         The variation axis values of San Francisco changed from the GX-style scale to the CSS-style
2886         scale. Previously, we were normalizing the values we got from Core Text to fit the CSS scale;
2887         however, this is no longer necessary since the font now does this itself.
2888
2889         The assertion was getting hit because the normalized values were huge and were overflowing
2890         a single FontSelectionValue (and going negative). This patch adds handling for this
2891         situation.
2892
2893         Test: DataInteractionTests.ExternalSourceBoldSystemAttributedStringToContentEditable
2894
2895         * platform/graphics/FontSelectionAlgorithm.h: Typedef the backing type for a FontSelectionValue.
2896         (WebCore::FontSelectionValue::rawValue const):
2897         (WebCore::FontSelectionValue::maximumValue):
2898         (WebCore::FontSelectionValue::minimumValue):
2899         (WebCore::FontSelectionValue::FontSelectionValue):
2900         * platform/graphics/cocoa/FontCacheCoreText.cpp: Opt-out of normalization for San Francisco.
2901         (WebCore::variationCapabilitiesForFontDescriptor):
2902         (WebCore::capabilitiesForFontDescriptor):
2903
2904 2017-08-21  Chris Dumez  <cdumez@apple.com>
2905
2906         [Beacon] Content extensions should be able to intercept Beacon / Ping redirects
2907         https://bugs.webkit.org/show_bug.cgi?id=175746
2908         <rdar://problem/33946050>
2909
2910         Reviewed by Alex Christensen.
2911
2912         Update PingLoad to process content extension rules upon redirect. This allows content
2913         extensions to block and upgrade to HTTPS beacon / ping loads.
2914
2915         Because ping loads can outlive the WebProcess, the content extensions rules are passed
2916         to the NetworkProcess when starting the Ping load. The PingLoad can then consult those
2917         rules upon redirect, on the NetworkProcess side.
2918
2919         Tests: http/wpt/beacon/contentextensions/beacon-blocked.html
2920                http/wpt/beacon/contentextensions/beacon-redirect-blocked.html
2921
2922         * contentextensions/ContentExtensionActions.h:
2923         * contentextensions/ContentExtensionsBackend.cpp:
2924         (WebCore::ContentExtensions::ContentExtensionsBackend::forEach):
2925         (WebCore::ContentExtensions::ContentExtensionsBackend::processContentExtensionRulesForPingLoad):
2926         * contentextensions/ContentExtensionsBackend.h:
2927         * page/Page.h:
2928         * page/UserContentProvider.cpp:
2929         (WebCore::UserContentProvider::forEachContentExtension):
2930         * page/UserContentProvider.h:
2931
2932 2017-08-21  Brady Eidson  <beidson@apple.com>
2933
2934         ASSERTION FAILED: !m_connections.contains(&connection) in WebCore::SWServer::unregisterConnection(WebCore::SWServer::Connection&).
2935         https://bugs.webkit.org/show_bug.cgi?id=175795
2936
2937         Rubber-stamped by Andy Estes.
2938
2939         * workers/service/server/SWServer.cpp:
2940         (WebCore::SWServer::unregisterConnection): Flip the ASSERT to be... correct.
2941
2942 2017-08-21  Daniel Bates  <dabates@apple.com>
2943
2944         Cleanup TextPainter
2945         https://bugs.webkit.org/show_bug.cgi?id=175782
2946
2947         Reviewed by Myles C. Maxfield.
2948
2949         Remove redundant mention of "text" in the name of TextPainter member functions, add separate
2950         setters for selection and non-selection shadows, and do some other minor cleanups.
2951
2952         * rendering/InlineTextBox.cpp:
2953         (WebCore::InlineTextBox::paint): Update code for renamed functions.
2954         * rendering/SimpleLineLayoutFunctions.cpp:
2955         (WebCore::SimpleLineLayout::paintFlow): Ditto.
2956         * rendering/TextPainter.cpp: Include ShadowData.h.
2957         (WebCore::ShadowApplier::ShadowApplier): Use C++11 brace-initialization syntax.
2958         (WebCore::ShadowApplier::isLastShadowIteration): Moved from TextPainter.h.
2959         (WebCore::ShadowApplier::shadowIsCompletelyCoveredByText): Ditto.
2960         (WebCore::TextPainter::paintTextOrEmphasisMarks): Renamed; formerly named drawTextOrEmphasisMarks.
2961         (WebCore::TextPainter::paintTextWithShadows): Update code for renamed functions.
2962         (WebCore::TextPainter::paintRange): Renamed; formerly named paintTextInRange.
2963         (WebCore::TextPainter::paint): Renamed; formerly named paintText.
2964         (WebCore::TextPainter::drawTextOrEmphasisMarks): Renamed to paintTextOrEmphasisMarks() to match
2965         the naming convention of all the other paint functions in this class.
2966         (WebCore::TextPainter::paintTextInRange): Renamed to paintRange.
2967         (WebCore::TextPainter::paintText): Renamed to paint.
2968         * rendering/TextPainter.h: Forward declare ShadowData.
2969         (WebCore::TextPainter::setStyle): Renamed; formerly named setTextPaintStyle.
2970         (WebCore::TextPainter::setSelectionStyle): Renamed; formerly named setSelectionPaintStyle.
2971         (WebCore::TextPainter::setShadow): Added.
2972         (WebCore::TextPainter::setSelectionShadow): Added.
2973         (WebCore::TextPainter::setEmphasisMark): Renamed; formerly named addEmphasis. 
2974         (WebCore::TextPainter::setTextPaintStyle): Renamed to setStyle.
2975         (WebCore::TextPainter::setSelectionPaintStyle): Renamed to setSelectionStyle.
2976         (WebCore::TextPainter::addEmphasis): Renamed to setEmphasisMark.
2977         (WebCore::TextPainter::addTextShadow): Split functionality into setShadow and setSelectionShadow.
2978         (WebCore::ShadowApplier::isLastShadowIteration): Moved to TextPainter.cpp.
2979         (WebCore::ShadowApplier::shadowIsCompletelyCoveredByText): Ditto.
2980
2981 2017-08-21  Myles C. Maxfield  <mmaxfield@apple.com>
2982
2983         Addressing post-review comments after r220725
2984         https://bugs.webkit.org/show_bug.cgi?id=175382
2985
2986         Reviewed by Darin Adler.
2987
2988         * css/CSSFontFace.cpp:
2989         (WebCore::CSSFontFace::setUnicodeRange):
2990
2991 2017-08-21  Youenn Fablet  <youenn@apple.com>
2992
2993         [Cache API] Add support for CacheStorage.match
2994         https://bugs.webkit.org/show_bug.cgi?id=175747
2995
2996         Reviewed by Chris Dumez.
2997
2998         Covered by rebased tests.
2999
3000         Introducing Cache::doMatch so that CacheStorage can use it.
3001         Make Cache::match use Cache::doMatch as well.
3002
3003         Implementing CacheStorage.match as per spec:
3004         - If name is provided, query only the cache with the given name.
3005         - Otherwise pick the first matching response in the caches.
3006         The sequential asynchronous search is done in doSequentialMatch.
3007
3008         Making sure that response with a status code are returning false to isNull.
3009         This allows passing more tests.
3010
3011         * Modules/cache/Cache.cpp:
3012         (WebCore::Cache::match):
3013         (WebCore::Cache::doMatch):
3014         (WebCore::Cache::matchAll):
3015         (WebCore::toConnectionRecord):
3016         * Modules/cache/Cache.h:
3017         * Modules/cache/CacheStorage.cpp:
3018         (WebCore::doSequentialMatch):
3019         (WebCore::copyCaches):
3020         (WebCore::CacheStorage::match):
3021         * platform/network/ResourceResponseBase.cpp:
3022         (WebCore::ResourceResponseBase::setHTTPStatusCode):
3023
3024 2017-08-21  Dean Jackson  <dino@apple.com>
3025
3026         Persistent WebGL Warning "vertex WARNING: 0:1: extension 'GL_ARB_gpu_shader5' is not supported" in Safari 10.1.2
3027         https://bugs.webkit.org/show_bug.cgi?id=175783
3028         <rdar://problem/33623867>
3029
3030         Reviewed by Alex Christensen.
3031
3032         The version of ANGLE we use inserts this line into each shader:
3033         #extension GL_ARB_gpu_shader5 : enable
3034         It causes our lower-level GLSL compiler to give a warning, which is
3035         confusing to developers because they didn't write this code.
3036
3037         Until we upgrade our OpenGL support to version 4.1, we should remove
3038         this error message from the log returned to the developer.
3039         See https://bugs.webkit.org/show_bug.cgi?id=175785
3040
3041         Test: fast/canvas/webgl/no-info-log-for-simple-shaders.html
3042
3043         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
3044         (WebCore::GraphicsContext3D::getUnmangledInfoLog): Search for and remove
3045         this warning.
3046
3047 2017-08-21  Andy Estes  <aestes@apple.com>
3048
3049         [Payment Request] Use ExistingExceptionError to propagate JS exceptions thrown during JSON stringification
3050         https://bugs.webkit.org/show_bug.cgi?id=175776
3051
3052         Reviewed by Darin Adler.
3053
3054         * Modules/paymentrequest/PaymentRequest.cpp:
3055         (WebCore::PaymentRequest::create):
3056         * Modules/paymentrequest/PaymentRequest.h:
3057
3058 2017-08-21  Yoshiaki Jitsukawa  <Yoshiaki.Jitsukawa@sony.com>
3059
3060         [PAL] Move spi/mac directory into PAL
3061         https://bugs.webkit.org/show_bug.cgi?id=175649
3062
3063         Reviewed by Myles C. Maxfield.
3064
3065         * WebCore.xcodeproj/project.pbxproj:
3066         * editing/cocoa/DataDetection.mm:
3067         * editing/mac/DictionaryLookup.h:
3068         * editing/mac/DictionaryLookup.mm:
3069         * page/mac/ServicesOverlayController.mm:
3070         * page/mac/WheelEventDeltaFilterMac.mm:
3071         * page/scrolling/mac/ScrollingMomentumCalculatorMac.mm:
3072         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
3073         * platform/graphics/avfoundation/MediaPlaybackTargetMac.mm:
3074         * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm:
3075         * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm:
3076         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3077         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
3078         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
3079         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
3080         * platform/graphics/mac/FontCacheMac.mm:
3081         * platform/graphics/mac/MediaPlayerPrivateQTKit.h:
3082         * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
3083         * platform/graphics/mac/MediaTimeQTKit.h:
3084         * platform/mac/MediaRemoteSoftLink.cpp:
3085         * platform/mac/MediaRemoteSoftLink.h:
3086         * platform/mac/PasteboardWriter.mm:
3087         * platform/mac/PlatformEventFactoryMac.mm:
3088         * platform/mac/ScrollAnimatorMac.mm:
3089         * platform/mac/ScrollbarThemeMac.mm:
3090         * platform/mac/VideoFullscreenInterfaceMac.mm:
3091         * platform/mac/WebVideoFullscreenController.mm:
3092         * rendering/RenderThemeMac.mm:
3093
3094 2017-08-21  Adrian Perez de Castro  <aperez@igalia.com>
3095
3096         [GTK][WPE][GSTREAMER_GL] Overriden virtual function not marked “override” in MediaPlayerPrivateGStreamerBase.h
3097         https://bugs.webkit.org/show_bug.cgi?id=175780
3098
3099         Reviewed by Konstantin Tokarev.
3100
3101         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h: Add missing "override" qualifier.
3102
3103 2017-08-21  Brady Eidson  <beidson@apple.com>
3104
3105         Split the one SWServer::Connection into SWClientConnection and SWServer::Connection.
3106         https://bugs.webkit.org/show_bug.cgi?id=175745
3107
3108         Reviewed by Andy Estes.
3109
3110         No new tests (No behavior change).
3111
3112         Each of these has a much different environment that it lives in, so being the same object
3113         hinders clean development.
3114         
3115         This split will also make it easier for the WebCore objects to directly handle WK2 messages.
3116         
3117         * CMakeLists.txt:
3118         * WebCore.xcodeproj/project.pbxproj:
3119         
3120         * platform/Logging.h:
3121
3122         * workers/service/ServiceWorkerContainer.cpp:
3123         (WebCore::ServiceWorkerContainer::addRegistration):
3124         (WebCore::ServiceWorkerContainer::scheduleJob):
3125         * workers/service/ServiceWorkerContainer.h:
3126
3127         * workers/service/ServiceWorkerProvider.h:
3128
3129         * workers/service/server/SWClientConnection.cpp: Copied from Source/WebCore/workers/service/server/SWServer.cpp.
3130         (WebCore::SWClientConnection::SWClientConnection):
3131         (WebCore::SWClientConnection::~SWClientConnection):
3132         (WebCore::SWClientConnection::scheduleJob):
3133         (WebCore::SWClientConnection::jobRejectedInServer):
3134         * workers/service/server/SWClientConnection.h: Copied from Source/WebCore/workers/service/server/SWServer.h.
3135
3136         * workers/service/server/SWServer.cpp:
3137         (WebCore::SWServer::Connection::Connection):
3138         (WebCore::SWServer::Connection::~Connection):
3139         (WebCore::SWServer::~SWServer):
3140         (WebCore::SWServer::Connection::scheduleJobInServer):
3141         (WebCore::SWServer::scheduleJob):
3142         (WebCore::SWServer::registerConnection):
3143         (WebCore::SWServer::unregisterConnection):
3144         (WebCore::SWServer::Connection::scheduleJob): Deleted.
3145         (WebCore::SWServer::Connection::jobRejected): Deleted.
3146         * workers/service/server/SWServer.h:
3147         (WebCore::SWServer::Connection::server):
3148         (WebCore::SWServer::Connection::~Connection): Deleted.
3149
3150 2017-08-21  Andy Estes  <aestes@apple.com>
3151
3152         [Payment Request] Implement the PaymentRequest constructor
3153         https://bugs.webkit.org/show_bug.cgi?id=175755
3154
3155         Reviewed by Darin Adler.
3156
3157         * Modules/paymentrequest/PaymentDetailsModifier.h: Changed total to an std::optional<PaymentItem>.
3158         * Modules/paymentrequest/PaymentRequest.cpp:
3159         (WebCore::isWellFormedCurrencyCode): Implements the IsWellFormedCurrencyCode abstract operation from ECMA 402.
3160         (WebCore::isValidDecimalMonetaryValue): Implements the "valid decimal monetary value" validity checker.
3161         (WebCore::checkAndCanonicalizeAmount): Implements the "check and canonicalize amount" validity checker.
3162         (WebCore::checkAndCanonicalizeTotal): Implements the "check and canonicalize total" validity checker.
3163         (WebCore::PaymentRequest::create): Implements the PaymentRequest Constructor
3164         (WebCore::PaymentRequest::PaymentRequest):
3165         (WebCore::PaymentRequest::id const): Implements the PaymentRequest id attribute.
3166         (WebCore::PaymentRequest::shippingType const): Implements the PaymentRequest shippingType attribute.
3167         * Modules/paymentrequest/PaymentRequest.h:
3168         * Modules/paymentrequest/PaymentRequest.idl: Annotated PaymentRequest with ConstructorMayThrowException.
3169         * WebCore.xcodeproj/project.pbxproj:
3170
3171 2017-08-21  Per Arne Vollan  <pvollan@apple.com>
3172
3173         [Win] DRT should only allow any https certificate for localhost.
3174         https://bugs.webkit.org/show_bug.cgi?id=175147
3175
3176         Reviewed by Brent Fulgham.
3177
3178         Disabling validation of certificate chains, breaks SSL on Windows. In order
3179         for SSL tests to succeed on Windows, we should avoid disabling it.
3180
3181         No new tests, covered by existing tests.
3182
3183         * platform/network/cf/ResourceHandleCFNet.cpp:
3184         (WebCore::ResourceHandle::createCFURLConnection):
3185
3186 2017-08-21  Zan Dobersek  <zdobersek@igalia.com>
3187
3188         [EME] HTMLMediaElement: basic implementations of 'Attempt to Decrypt', 'Attempt to Resume Playback If Necessary'
3189         https://bugs.webkit.org/show_bug.cgi?id=175761
3190
3191         Reviewed by Xabier Rodriguez-Calvar.
3192
3193         Add initial and incomplete implementations of the 'Attempt to Decrypt' and
3194         'Attempt to Resume Playback If Necessary' algorithms.  The implementations
3195         are interleaved with the specification text for clarity.
3196
3197         'Attempt to Decrypt' implementation doesn't yet address the encrypted block
3198         queue or the 'decryption blocked waiting for key' flag since it's not yet
3199         clear whether it would make more sense for this state to reside lower, in
3200         the platform layer. The gist of the algorithm is to invoke the decryption
3201         attempt through the MediaPlayer object, passing along the CDMInstance object
3202         retrieved from the MediaKeys object that is associated with this media
3203         element.
3204
3205         'Attempt to Resume Playback if Necessary' implementation similarly for now
3206         omits the various state flag operations. The main task at this point is to
3207         dispatch the 'Attempt to Decrypt' algorithm.
3208
3209         HTMLMediaElement::cdmClientAttemptToResumePlaybackIfNecessary() method now
3210         invokes the attemptToResumePlaybackIfNecessary() method.
3211
3212         MediaKeys::hasOpenSessions() is introduced, returning true if any session
3213         that was created through this MediaKeys instance is still open. This allows
3214         the 'Attempt to Decrypt' algorithm to proceed with the decryption attempt
3215         dispatch into the MediaPlayer hierarchy.
3216
3217         For that, the MediaPlayer::attemptToDecryptWithInstance() method is added,
3218         which simply dispatches the mirror method on MediaPlayerPrivate interface.
3219         This will enable the platform-layer implementations to use the passed-in
3220         CDMInstance object for decryption purposes.
3221
3222         * Modules/encryptedmedia/MediaKeySession.h:
3223         * Modules/encryptedmedia/MediaKeys.cpp:
3224         (WebCore::MediaKeys::hasOpenSessions const):
3225         * Modules/encryptedmedia/MediaKeys.h:
3226         * html/HTMLMediaElement.cpp:
3227         (WebCore::HTMLMediaElement::attemptToDecrypt):
3228         (WebCore::HTMLMediaElement::attemptToResumePlaybackIfNecessary):
3229         (WebCore::HTMLMediaElement::cdmClientAttemptToResumePlaybackIfNecessary):
3230         * html/HTMLMediaElement.h: Mark cdmClientAttemptToResumePlaybackIfNecessary() as final.
3231         * platform/graphics/MediaPlayer.cpp:
3232         (WebCore::MediaPlayer::attemptToDecryptWithInstance):
3233         * platform/graphics/MediaPlayer.h:
3234         * platform/graphics/MediaPlayerPrivate.h:
3235         (WebCore::MediaPlayerPrivateInterface::attemptToDecryptWithInstance):
3236
3237 2017-08-20  Zan Dobersek  <zdobersek@igalia.com>
3238
3239         [EME] Add basic implementation of HTMLMediaElement::setMediaKeys()
3240         https://bugs.webkit.org/show_bug.cgi?id=175717
3241
3242         Reviewed by Xabier Rodriguez-Calvar.
3243
3244         Add an initial and incomplete implementation of HTMLMediaElement::setMediaKeys(),
3245         interleaved with the specification wording of how this operation should behave.
3246         The implementation still doesn't cover cases of CDM instances being already
3247         associated with a different HTMLMediaElement, of CDM instances that can't be
3248         disassociated from the current HTMLMediaElement, and of failures during both
3249         association and disassociation of MediaKeys with the HTMLMediaElement.
3250
3251         The HTMLMediaElement (as a CDMClient inheritor) has to be attached or detached
3252         from the MediaKeys object as appropriate. This attachment allows MediaKeys to
3253         initiate an attempt to resume playback whenever the key statuses of the
3254         associated MediaKeys object are updated.
3255
3256         Upon association and disassociation with MediaKeys, the CDMInstance object of
3257         that specific MediaKeys instance is attached to or detached from the MediaPlayer
3258         instance. This allows the platform layer to gather information about the
3259         CDMInstance that will be used for decryption of media content for this specific
3260         media element.
3261
3262         Additionally, the detachment from both MediaKeys and MediaPlayer is done upon
3263         HTMLMediaElement destruction.
3264
3265         Upon setting the MediaKeys object, a task is queued that launches the 'Attempt to
3266         Resume Playback If Necessary' algorithm. A placeholder method is added that will
3267         implement the algorithm in the future.
3268
3269         The HTMLMediaElement::mediaKeys() getter is also implemented, returning pointer
3270         held in m_mediaKeys.
3271
3272         Covered to a degree by existing imported W3C tests, with a setMediaKeys()-oriented
3273         test having WPE-specific baseline update.
3274
3275         * Modules/encryptedmedia/MediaKeys.h:
3276         (WebCore::MediaKeys::cdmInstance const):
3277         * html/HTMLMediaElement.cpp:
3278         (WebCore::HTMLMediaElement::~HTMLMediaElement):
3279         (WebCore::HTMLMediaElement::mediaKeys const):
3280         (WebCore::HTMLMediaElement::setMediaKeys):
3281         (WebCore::HTMLMediaElement::attemptToResumePlaybackIfNecessary):
3282         (WebCore::HTMLMediaElement::contextDestroyed):
3283         * html/HTMLMediaElement.h:
3284         * platform/graphics/MediaPlayer.cpp:
3285         (WebCore::MediaPlayer::cdmInstanceAttached):
3286         (WebCore::MediaPlayer::cdmInstanceDetached):
3287         * platform/graphics/MediaPlayer.h:
3288         * platform/graphics/MediaPlayerPrivate.h:
3289         (WebCore::MediaPlayerPrivateInterface::cdmInstanceAttached):
3290         (WebCore::MediaPlayerPrivateInterface::cdmInstanceDetached):
3291
3292 2017-08-20  Chris Dumez  <cdumez@apple.com>
3293
3294         Simplify calls to LoaderStrategy::startPingLoad()
3295         https://bugs.webkit.org/show_bug.cgi?id=175756
3296
3297         Reviewed by Sam Weinig.
3298
3299         Simplify calls to LoaderStrategy::startPingLoad() by passing the Frame to it
3300         and let its implementation gets what it needs from the frame. This reduces
3301         the number of parameters to startPingLoad() and is more easily extensible.
3302
3303         * dom/Document.h:
3304         * loader/LoaderStrategy.h:
3305         * loader/PingLoader.cpp:
3306         (WebCore::PingLoader::loadImage):
3307         (WebCore::PingLoader::sendPing):
3308         (WebCore::PingLoader::sendViolationReport):
3309         (WebCore::PingLoader::startPingLoad):
3310         * loader/PingLoader.h:
3311         * loader/cache/CachedResource.cpp:
3312         (WebCore::CachedResource::load):
3313
3314 2017-08-20  Antti Koivisto  <antti@apple.com>
3315
3316         Factor :before/:after render tree mutations into a RenderTreeUpdater helper class
3317         https://bugs.webkit.org/show_bug.cgi?id=175752
3318
3319         Reviewed by Andreas Kling.
3320
3321         Move code that constructs generated content renderers out from PseudoElement.
3322         Also refactor the related code from RenderTreeUpdater main class into
3323         RenderTreeUpdater::GeneratedContent helper class.
3324
3325         * WebCore.xcodeproj/project.pbxproj:
3326         * dom/PseudoElement.cpp:
3327         (WebCore::PseudoElement::resolveCustomStyle): Deleted.
3328
3329             Not needed anymore.
3330
3331         (WebCore::PseudoElement::didAttachRenderers): Deleted.
3332
3333             Moves to createContentRenderers in GeneratedContent.
3334
3335         (WebCore::PseudoElement::didRecalcStyle): Deleted.
3336
3337             Moves to updateStyleForContentRenderers in GeneratedContent.
3338
3339         * dom/PseudoElement.h:
3340         * style/RenderTreeUpdater.cpp:
3341         (WebCore::RenderTreeUpdater::RenderTreeUpdater):
3342         (WebCore::RenderTreeUpdater::~RenderTreeUpdater):
3343         (WebCore::RenderTreeUpdater::commit):
3344         (WebCore::RenderTreeUpdater::updateBeforeDescendants):
3345         (WebCore::RenderTreeUpdater::updateAfterDescendants):
3346         (WebCore::needsPseudoElement): Deleted.
3347         (WebCore::RenderTreeUpdater::updateBeforeOrAfterPseudoElement): Deleted.
3348         (WebCore::RenderTreeUpdater::updateQuotesUpTo): Deleted.
3349
3350             Quotes and other :before/:after support moves to GeneratedContent helpwe.
3351
3352         * style/RenderTreeUpdater.h:
3353         (WebCore::RenderTreeUpdater::generatedContent):
3354         * style/RenderTreeUpdaterGeneratedContent.cpp: Added.
3355         (WebCore::RenderTreeUpdater::GeneratedContent::GeneratedContent):
3356         (WebCore::RenderTreeUpdater::GeneratedContent::updateBeforePseudoElement):
3357         (WebCore::RenderTreeUpdater::GeneratedContent::updateAfterPseudoElement):
3358         (WebCore::RenderTreeUpdater::GeneratedContent::updateRemainingQuotes):
3359         (WebCore::RenderTreeUpdater::GeneratedContent::updateQuotesUpTo):
3360         (WebCore::createContentRenderers):
3361         (WebCore::updateStyleForContentRenderers):
3362         (WebCore::RenderTreeUpdater::GeneratedContent::updatePseudoElement):
3363         (WebCore::RenderTreeUpdater::GeneratedContent::needsPseudoElement):
3364         * style/RenderTreeUpdaterGeneratedContent.h: Added.
3365
3366 2017-08-19  Andy Estes  <aestes@apple.com>
3367
3368         [Payment Request] Add interface stubs
3369         https://bugs.webkit.org/show_bug.cgi?id=175730
3370
3371         Reviewed by Youenn Fablet.
3372
3373         * DerivedSources.make:
3374         * Modules/paymentrequest/PaymentAddress.h: Added.
3375         * Modules/paymentrequest/PaymentAddress.idl: Added.
3376         * Modules/paymentrequest/PaymentComplete.h: Added.
3377         * Modules/paymentrequest/PaymentComplete.idl: Added.
3378         * Modules/paymentrequest/PaymentCurrencyAmount.h: Added.
3379         * Modules/paymentrequest/PaymentCurrencyAmount.idl: Added.
3380         * Modules/paymentrequest/PaymentDetailsBase.h: Added.
3381         * Modules/paymentrequest/PaymentDetailsBase.idl: Added.
3382         * Modules/paymentrequest/PaymentDetailsInit.h: Added.
3383         * Modules/paymentrequest/PaymentDetailsInit.idl: Added.
3384         * Modules/paymentrequest/PaymentDetailsModifier.h: Added.
3385         * Modules/paymentrequest/PaymentDetailsModifier.idl: Added.
3386         * Modules/paymentrequest/PaymentDetailsUpdate.h: Added.
3387         * Modules/paymentrequest/PaymentDetailsUpdate.idl: Added.
3388         * Modules/paymentrequest/PaymentItem.h: Added.
3389         * Modules/paymentrequest/PaymentItem.idl: Added.
3390         * Modules/paymentrequest/PaymentMethodData.h: Added.
3391         * Modules/paymentrequest/PaymentMethodData.idl: Added.
3392         * Modules/paymentrequest/PaymentOptions.h: Added.
3393         * Modules/paymentrequest/PaymentOptions.idl: Added.
3394         * Modules/paymentrequest/PaymentRequest.cpp: Added.
3395         (WebCore::PaymentRequest::create):
3396         (WebCore::PaymentRequest::PaymentRequest):
3397         (WebCore::PaymentRequest::~PaymentRequest):
3398         (WebCore::PaymentRequest::show):
3399         (WebCore::PaymentRequest::abort):
3400         (WebCore::PaymentRequest::canMakePayment):
3401         * Modules/paymentrequest/PaymentRequest.h: Added.
3402         * Modules/paymentrequest/PaymentRequest.idl: Added.
3403         * Modules/paymentrequest/PaymentRequestUpdateEvent.cpp: Added.
3404         (WebCore::PaymentRequestUpdateEvent::~PaymentRequestUpdateEvent):
3405         (WebCore::PaymentRequestUpdateEvent::updateWith):
3406         * Modules/paymentrequest/PaymentRequestUpdateEvent.h: Added.
3407         * Modules/paymentrequest/PaymentRequestUpdateEvent.idl: Added.
3408         * Modules/paymentrequest/PaymentRequestUpdateEventInit.h: Added.
3409         * Modules/paymentrequest/PaymentRequestUpdateEventInit.idl: Added.
3410         * Modules/paymentrequest/PaymentResponse.cpp: Added.
3411         (WebCore::PaymentResponse::complete):
3412         * Modules/paymentrequest/PaymentResponse.h: Added.
3413         * Modules/paymentrequest/PaymentResponse.idl: Added.
3414         * Modules/paymentrequest/PaymentShippingOption.h: Added.
3415         * Modules/paymentrequest/PaymentShippingOption.idl: Added.
3416         * Modules/paymentrequest/PaymentShippingType.h: Added.
3417         * Modules/paymentrequest/PaymentShippingType.idl: Added.
3418         * WebCore.xcodeproj/project.pbxproj:
3419         * dom/EventNames.h:
3420         * dom/EventNames.in:
3421         * dom/EventTargetFactory.in:
3422
3423 2017-08-19  Sam Weinig  <sam@webkit.org>
3424
3425         [WebCrypto] Remove the KeyAlgorithm type hierarchy
3426         https://bugs.webkit.org/show_bug.cgi?id=175750
3427
3428         Reviewed by Chris Dumez.
3429
3430         Removes the unnecessary indirection that existed to generate a
3431         KeyAlgorithm dictionary (or rather, one of its derived dictionaries)
3432         for a CryptoKey. We were calling the virtual buildAlgorithm(), which
3433         return a std::unique_ptr<KeyAlgorithm>, which we then casted to the 
3434         correct derived class and called dictionary() on. This can now be
3435         simplified by making each CryptoKey derived class override a function
3436         that returns the KeyAlgorithm variant.
3437
3438         * crypto/CryptoKey.cpp:
3439         (WebCore::CryptoKey::algorithm const): Deleted.
3440         * crypto/CryptoKey.h:
3441         (WebCore::CryptoKey::extractable const):
3442         (WebCore::KeyAlgorithm::~KeyAlgorithm): Deleted.
3443         (WebCore::KeyAlgorithm::name const): Deleted.
3444         (WebCore::KeyAlgorithm::KeyAlgorithm): Deleted.
3445         * crypto/gcrypt/CryptoKeyRSAGCrypt.cpp:
3446         (WebCore::CryptoKeyRSA::algorithm const):
3447         (WebCore::CryptoKeyRSA::buildAlgorithm const): Deleted.
3448         * crypto/keys/CryptoKeyAES.cpp:
3449         (WebCore::CryptoKeyAES::algorithm const):
3450         (WebCore::AesKeyAlgorithm::dictionary const): Deleted.
3451         (WebCore::CryptoKeyAES::buildAlgorithm const): Deleted.
3452         * crypto/keys/CryptoKeyAES.h:
3453         * crypto/keys/CryptoKeyEC.cpp:
3454         (WebCore::CryptoKeyEC::algorithm const):
3455         (WebCore::EcKeyAlgorithm::dictionary const): Deleted.
3456         (WebCore::CryptoKeyEC::buildAlgorithm const): Deleted.
3457         * crypto/keys/CryptoKeyEC.h:
3458         (WebCore::EcKeyAlgorithm::EcKeyAlgorithm): Deleted.
3459         (WebCore::EcKeyAlgorithm::namedCurve const): Deleted.
3460         * crypto/keys/CryptoKeyHMAC.cpp:
3461         (WebCore::CryptoKeyHMAC::algorithm const):
3462         (WebCore::HmacKeyAlgorithm::dictionary const): Deleted.
3463         (WebCore::CryptoKeyHMAC::buildAlgorithm const): Deleted.
3464         * crypto/keys/CryptoKeyHMAC.h:
3465         * crypto/keys/CryptoKeyRSA.cpp:
3466         (WebCore::RsaKeyAlgorithm::dictionary const): Deleted.
3467         (WebCore::RsaHashedKeyAlgorithm::dictionary const): Deleted.
3468         * crypto/keys/CryptoKeyRSA.h:
3469         (WebCore::RsaKeyAlgorithm::RsaKeyAlgorithm): Deleted.
3470         (WebCore::RsaKeyAlgorithm::modulusLength const): Deleted.
3471         (WebCore::RsaKeyAlgorithm::publicExponent const): Deleted.
3472         * crypto/keys/CryptoKeyRaw.cpp:
3473         (WebCore::CryptoKeyRaw::algorithm const):
3474         (WebCore::RawKeyAlgorithm::dictionary const): Deleted.
3475         (WebCore::CryptoKeyRaw::buildAlgorithm const): Deleted.
3476         * crypto/keys/CryptoKeyRaw.h:
3477         (WebCore::RawKeyAlgorithm::RawKeyAlgorithm): Deleted.
3478         * crypto/mac/CryptoKeyRSAMac.cpp:
3479         (WebCore::CryptoKeyRSA::algorithm const):
3480         (WebCore::CryptoKeyRSA::buildAlgorithm const): Deleted.
3481
3482 2017-08-19  Sam Weinig  <sam@webkit.org>
3483
3484         [Mac] Change uint8_t* to Vector<uint8_t> type in all crypto algorithm implementation
3485         https://bugs.webkit.org/show_bug.cgi?id=164939
3486
3487         Reviewed by Chris Dumez.
3488
3489         Address FIXMEs, replacing uint8_t*/size_t parameters with Vector<uint8_t>&.
3490
3491         * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp:
3492         (WebCore::transformAES_CBC):
3493         (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt):
3494         (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt):
3495         * crypto/mac/CryptoAlgorithmAES_KWMac.cpp:
3496         (WebCore::wrapKeyAES_KW):
3497         (WebCore::unwrapKeyAES_KW):
3498         (WebCore::CryptoAlgorithmAES_KW::platformWrapKey):
3499         (WebCore::CryptoAlgorithmAES_KW::platformUnwrapKey):
3500         * crypto/mac/CryptoAlgorithmHMACMac.cpp:
3501         (WebCore::calculateSignature):
3502         (WebCore::CryptoAlgorithmHMAC::platformSign):
3503         (WebCore::CryptoAlgorithmHMAC::platformVerify):
3504         * crypto/mac/CryptoAlgorithmRSAES_PKCS1_v1_5Mac.cpp:
3505         (WebCore::encryptRSAES_PKCS1_v1_5):
3506         (WebCore::decryptRSAES_PKCS1_v1_5):
3507         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformEncrypt):
3508         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformDecrypt):
3509         * crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp:
3510         (WebCore::signRSASSA_PKCS1_v1_5):
3511         (WebCore::verifyRSASSA_PKCS1_v1_5):
3512         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformSign):
3513         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformVerify):
3514         * crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp:
3515         (WebCore::encryptRSA_OAEP):
3516         (WebCore::decryptRSA_OAEP):
3517         (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt):
3518         (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt):
3519
3520 2017-08-18  Ryosuke Niwa  <rniwa@webkit.org>
3521
3522         Forbid setDragImage after dragstart
3523         https://bugs.webkit.org/show_bug.cgi?id=175751
3524
3525         Reviewed by Wenson Hsieh.
3526
3527         Removed the code to allow setting the drag mage after dragstart had happened.
3528
3529         The feature was apparently used in Mac WebKit1 port but using it today causes the drag image
3530         to disapepar while the user is moving the mouse cursor and being drawn once it's stopped
3531         and results in the contionus flickering of the drag image.
3532
3533         The feaure was never supported in WebKit2 and doesn't match the HTML5 specification:
3534         https://html.spec.whatwg.org/multipage/dnd.html#concept-dnd-rw
3535         https://html.spec.whatwg.org/multipage/dnd.html#dom-datatransfer-setdragimage
3536         or the behaviors of other browsers such as Chrome and Firefox.
3537
3538         No new tests. This patch simply removes code.
3539
3540         * dom/DataTransfer.cpp:
3541         (WebCore::DataTransfer::setDragImage):
3542         (WebCore::DataTransfer::canSetDragImage const): Deleted.
3543         * dom/DataTransfer.h:
3544         (WebCore::DataTransfer::makeDragImageWritable): Deleted.
3545         * page/EventHandler.cpp:
3546         (WebCore::EventHandler::handleDrag):
3547
3548 2017-08-18  Sam Weinig  <sam@webkit.org>
3549
3550         [WebCrypto] Get rid of CryptoKeyData class and all its subclasses
3551         https://bugs.webkit.org/show_bug.cgi?id=169806
3552
3553         Reviewed by Chris Dumez.
3554
3555         - Replaces the CryptoKeyData type hierarchy 
3556
3557             CryptoKeyData
3558               - CryptoKeyDataOctetSequence
3559               - CryptoKeyDataRSAComponents
3560
3561           with the renamed CryptoKeyRSAComponents.
3562
3563         - Removes pure virtual exportData function on CryptoKey, and all
3564           the implementations except the one on CryptoKeyRSA, which now is
3565           non-virtual, and returns a CryptoKeyRSAComponents. Update the one
3566           external caller, SerializedScriptValue, to handle this.
3567
3568         * CMakeLists.txt:
3569         * WebCore.xcodeproj/project.pbxproj:
3570         * bindings/js/SerializedScriptValue.cpp:
3571         * crypto/CryptoAlgorithm.h:
3572         * crypto/CryptoKey.h:
3573         * crypto/CryptoKeyData.h: Removed.
3574         * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
3575         * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
3576         * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
3577         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
3578         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
3579         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
3580         * crypto/gcrypt/CryptoKeyRSAGCrypt.cpp:
3581         (WebCore::CryptoKeyRSA::create):
3582         (WebCore::CryptoKeyRSA::exportData const):
3583         * crypto/keys/CryptoKeyAES.cpp:
3584         (WebCore::CryptoKeyAES::exportData const): Deleted.
3585         * crypto/keys/CryptoKeyAES.h:
3586         * crypto/keys/CryptoKeyDataOctetSequence.cpp: Removed.
3587         * crypto/keys/CryptoKeyDataOctetSequence.h: Removed.
3588         * crypto/keys/CryptoKeyDataRSAComponents.cpp: Removed.
3589         * crypto/keys/CryptoKeyDataRSAComponents.h: Removed.
3590         * crypto/keys/CryptoKeyEC.cpp:
3591         (WebCore::CryptoKeyEC::exportData const): Deleted.
3592         * crypto/keys/CryptoKeyEC.h:
3593         * crypto/keys/CryptoKeyHMAC.cpp:
3594         (WebCore::CryptoKeyHMAC::exportData const): Deleted.
3595         * crypto/keys/CryptoKeyHMAC.h:
3596         * crypto/keys/CryptoKeyRSA.cpp:
3597         (WebCore::CryptoKeyRSA::importJwk):
3598         (WebCore::CryptoKeyRSA::exportJwk const):
3599         * crypto/keys/CryptoKeyRSA.h:
3600         * crypto/keys/CryptoKeyRSAComponents.cpp: Copied from crypto/keys/CryptoKeyDataRSAComponents.cpp.
3601         (WebCore::CryptoKeyRSAComponents::CryptoKeyRSAComponents):
3602         (WebCore::CryptoKeyRSAComponents::~CryptoKeyRSAComponents):
3603         (WebCore::CryptoKeyDataRSAComponents::CryptoKeyDataRSAComponents): Deleted.
3604         (WebCore::CryptoKeyDataRSAComponents::~CryptoKeyDataRSAComponents): Deleted.
3605         * crypto/keys/CryptoKeyRSAComponents.h: Copied from crypto/keys/CryptoKeyDataRSAComponents.h.
3606         (WebCore::CryptoKeyRSAComponents::createPublic):
3607         (WebCore::CryptoKeyRSAComponents::createPrivate):
3608         (WebCore::CryptoKeyRSAComponents::createPrivateWithAdditionalData):
3609         * crypto/keys/CryptoKeyRaw.cpp:
3610         (WebCore::CryptoKeyRaw::exportData const): Deleted.
3611         * crypto/keys/CryptoKeyRaw.h:
3612         * crypto/mac/CryptoKeyRSAMac.cpp:
3613         (WebCore::getPrivateKeyComponents):
3614         (WebCore::CryptoKeyRSA::create):
3615         (WebCore::CryptoKeyRSA::exportData const):
3616
3617 2017-08-18  Youenn Fablet  <youenn@apple.com>
3618
3619         [Cache API] Add support for being loaded responses
3620         https://bugs.webkit.org/show_bug.cgi?id=175732
3621
3622         Reviewed by Chris Dumez.
3623
3624         Covered by existing and rebased tests.
3625
3626         Introducing a callback-based method to consume the body when the load is finished.
3627         Using that new method in Cache::put and calling batchPutOperation when the load is finished.
3628
3629         Fixing the case of a fetch response being cloned, in which case its body should be marked as ReadableStream.
3630
3631         * Modules/cache/Cache.cpp:
3632         (WebCore::Cache::put): Changing order of checks to reduce test flakiness risks as there is not yet support for putting responses with ReadableStream.
3633         (WebCore::toConnectionRecord):
3634         (WebCore::Cache::batchPutOperation):
3635         * Modules/cache/Cache.h:
3636         * Modules/fetch/FetchBody.cpp:
3637         (WebCore::FetchBody::readableStreamBody): Deleted.
3638         * Modules/fetch/FetchBody.h:
3639         (WebCore::FetchBody::loadingBody):
3640         (WebCore::FetchBody::setAsReadableStream):
3641         * Modules/fetch/FetchResponse.cpp:
3642         (WebCore::FetchResponse::BodyLoader::didSucceed):
3643         (WebCore::FetchResponse::BodyLoader::didFail):
3644         (WebCore::FetchResponse::consumeBody):
3645         (WebCore::FetchResponse::consumeBodyWhenLoaded):
3646         * Modules/fetch/FetchResponse.h:
3647
3648 2017-08-18  Chris Dumez  <cdumez@apple.com>
3649
3650         [Beacon] Improve error reporting
3651         https://bugs.webkit.org/show_bug.cgi?id=175723
3652
3653         Reviewed by Darin Adler.
3654
3655         Have Ping loads such as beacons report errors via their completion handler.
3656         The Beacon API is using this error to log a console message when beacon loads
3657         fail, provided that the page is still alive.
3658
3659         Test: http/wpt/beacon/beacon-async-error-logging.html
3660
3661         * Modules/beacon/NavigatorBeacon.cpp:
3662         (WebCore::NavigatorBeacon::NavigatorBeacon):
3663         (WebCore::NavigatorBeacon::~NavigatorBeacon):
3664         (WebCore::NavigatorBeacon::from):
3665         (WebCore::NavigatorBeacon::supplementName):
3666         (WebCore::NavigatorBeacon::notifyFinished):
3667         (WebCore::NavigatorBeacon::logError):
3668         (WebCore::NavigatorBeacon::sendBeacon):
3669         * Modules/beacon/NavigatorBeacon.h:
3670         * loader/LoaderStrategy.h:
3671         * loader/cache/CachedResource.cpp:
3672         (WebCore::CachedResource::load):
3673         * loader/cache/CachedResourceLoader.cpp:
3674         (WebCore::CachedResourceLoader::requestBeaconResource):
3675         * loader/cache/CachedResourceLoader.h:
3676         * platform/network/PingHandle.h:
3677
3678 2017-08-18  Sam Weinig  <sam@webkit.org>
3679
3680         Remove the deprecated WebKitSubtleCrypto interface
3681         https://bugs.webkit.org/show_bug.cgi?id=164938
3682         <rdar://problem/29894563>
3683
3684         Reviewed by Chris Dumez.
3685
3686         Remove WebKitSubtleCrypto and all of its helper classes / functionality.
3687
3688         * CMakeLists.txt:
3689         * DerivedSources.cpp:
3690         * DerivedSources.make:
3691         * WebCore.xcodeproj/project.pbxproj:
3692         * bindings/js/JSCryptoAlgorithmDictionary.cpp: Removed.
3693         * bindings/js/JSCryptoAlgorithmDictionary.h: Removed.
3694         * bindings/js/JSCryptoKeySerializationJWK.cpp: Removed.
3695         * bindings/js/JSCryptoKeySerializationJWK.h: Removed.
3696         * bindings/js/JSCryptoOperationData.cpp: Removed.
3697         * bindings/js/JSCryptoOperationData.h: Removed.
3698         * bindings/js/JSWebKitSubtleCryptoCustom.cpp: Removed.
3699         * crypto/CryptoAlgorithm.cpp:
3700         (WebCore::CryptoAlgorithm::deriveKey): Deleted.
3701         (WebCore::CryptoAlgorithm::encryptForWrapKey): Deleted.
3702         (WebCore::CryptoAlgorithm::decryptForUnwrapKey): Deleted.
3703         * crypto/CryptoAlgorithm.h:
3704         * crypto/CryptoAlgorithmParametersDeprecated.h: Removed.
3705         * crypto/CryptoKeySerialization.h: Removed.
3706         * crypto/WebKitSubtleCrypto.cpp: Removed.
3707         * crypto/WebKitSubtleCrypto.h: Removed.
3708         * crypto/WebKitSubtleCrypto.idl: Removed.
3709         * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
3710         (WebCore::CryptoAlgorithmAES_CBC::keyAlgorithmMatches const): Deleted.
3711         * crypto/algorithms/CryptoAlgorithmAES_CBC.h:
3712         * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
3713         (WebCore::CryptoAlgorithmAES_KW::encryptForWrapKey): Deleted.
3714         (WebCore::CryptoAlgorithmAES_KW::decryptForUnwrapKey): Deleted.
3715         * crypto/algorithms/CryptoAlgorithmAES_KW.h:
3716         * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
3717         (WebCore::CryptoAlgorithmHMAC::keyAlgorithmMatches const): Deleted.
3718         * crypto/algorithms/CryptoAlgorithmHMAC.h:
3719         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
3720         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h:
3721         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
3722         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::keyAlgorithmMatches const): Deleted.
3723         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h:
3724         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
3725         (WebCore::CryptoAlgorithmRSA_OAEP::keyAlgorithmMatches const): Deleted.
3726         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h:
3727         * crypto/algorithms/CryptoAlgorithmSHA1.cpp:
3728         * crypto/algorithms/CryptoAlgorithmSHA1.h:
3729         * crypto/algorithms/CryptoAlgorithmSHA224.cpp:
3730         * crypto/algorithms/CryptoAlgorithmSHA224.h:
3731         * crypto/algorithms/CryptoAlgorithmSHA256.cpp:
3732         * crypto/algorithms/CryptoAlgorithmSHA256.h:
3733         * crypto/algorithms/CryptoAlgorithmSHA384.cpp:
3734         * crypto/algorithms/CryptoAlgorithmSHA384.h:
3735         * crypto/algorithms/CryptoAlgorithmSHA512.cpp:
3736         * crypto/algorithms/CryptoAlgorithmSHA512.h:
3737         * crypto/gcrypt/CryptoAlgorithmAES_CBCGCrypt.cpp:
3738         * crypto/gcrypt/CryptoAlgorithmAES_KWGCrypt.cpp:
3739         (WebCore::CryptoAlgorithmAES_KW::platformEncrypt): Deleted.
3740         (WebCore::CryptoAlgorithmAES_KW::platformDecrypt): Deleted.
3741         * crypto/gcrypt/CryptoAlgorithmHMACGCrypt.cpp:
3742         * crypto/gcrypt/CryptoAlgorithmRSAES_PKCS1_v1_5GCrypt.cpp:
3743         * crypto/gcrypt/CryptoAlgorithmRSASSA_PKCS1_v1_5GCrypt.cpp:
3744         * crypto/gcrypt/CryptoAlgorithmRSA_OAEPGCrypt.cpp:
3745         * crypto/keys/CryptoKeySerializationRaw.cpp: Removed.
3746         * crypto/keys/CryptoKeySerializationRaw.h: Removed.
3747         * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp:
3748         * crypto/mac/CryptoAlgorithmAES_KWMac.cpp:
3749         (WebCore::CryptoAlgorithmAES_KW::platformEncrypt): Deleted.
3750         (WebCore::CryptoAlgorithmAES_KW::platformDecrypt): Deleted.
3751         * crypto/mac/CryptoAlgorithmHMACMac.cpp:
3752         * crypto/mac/CryptoAlgorithmRSAES_PKCS1_v1_5Mac.cpp:
3753         * crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp:
3754         * crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp:
3755         * crypto/parameters/CryptoAlgorithmAesCbcParamsDeprecated.h: Removed.
3756         * crypto/parameters/CryptoAlgorithmAesKeyGenParamsDeprecated.h: Removed.
3757         * crypto/parameters/CryptoAlgorithmHmacKeyParamsDeprecated.h: Removed.
3758         * crypto/parameters/CryptoAlgorithmHmacParamsDeprecated.h: Removed.
3759         * crypto/parameters/CryptoAlgorithmRsaKeyGenParamsDeprecated.h: Removed.
3760         * crypto/parameters/CryptoAlgorithmRsaKeyParamsWithHashDeprecated.h: Removed.
3761         * crypto/parameters/CryptoAlgorithmRsaOaepParamsDeprecated.h: Removed.
3762         * crypto/parameters/CryptoAlgorithmRsaSsaParamsDeprecated.h: Removed.
3763         * features.json:
3764         * page/Crypto.cpp:
3765         * page/Crypto.h:
3766         * page/Crypto.idl:
3767
3768 2017-08-18  Tim Horton  <timothy_horton@apple.com>
3769
3770         Remove classic mode screen scale clamping
3771         https://bugs.webkit.org/show_bug.cgi?id=175739
3772         <rdar://problem/33894531>
3773
3774         Reviewed by Andy Estes.
3775
3776         * platform/ios/PlatformScreenIOS.mm:
3777         (WebCore::screenScaleFactor):
3778         This code is no longer needed.
3779
3780 2017-08-18  Daewoong Jang  <daewoong.jang@navercorp.com>
3781
3782         [Curl] Improve multi-threaded networking
3783         https://bugs.webkit.org/show_bug.cgi?id=175713
3784
3785         Reviewed by Alex Christensen.
3786
3787         * platform/Curl.cmake:
3788         * platform/network/ResourceHandleInternal.h:
3789         (WebCore::ResourceHandleInternal::ResourceHandleInternal):
3790         (WebCore::ResourceHandleInternal::m_failureTimer): Deleted.
3791         * platform/network/curl/CurlCacheManager.cpp:
3792         (WebCore::CurlCacheManager::didReceiveResponse):
3793         * platform/network/curl/CurlDownload.cpp:
3794         (WebCore::CurlDownload::init):
3795         (WebCore::CurlDownload::start):
3796         (WebCore::CurlDownload::cancel):
3797         (WebCore::CurlDownload::retain):
3798         (WebCore::CurlDownload::release):
3799         (WebCore::CurlDownload::setupRequest):
3800         (WebCore::CurlDownload::notifyFinish):
3801         (WebCore::CurlDownload::notifyFail):
3802         * platform/network/curl/CurlDownload.h:
3803         * platform/network/curl/CurlJobManager.cpp:
3804         (WebCore::CurlJobList::isEmpty const):
3805         (WebCore::CurlJobList::startJobs):
3806         (WebCore::CurlJobList::finishJobs):
3807         (WebCore::CurlJobList::notifyResult):
3808         (WebCore::CurlJobManager::add):
3809         (WebCore::CurlJobManager::cancel):
3810         (WebCore::CurlJobManager::callOnJobThread):
3811         (WebCore::CurlJobManager::startThreadIfNeeded):
3812         (WebCore::CurlJobManager::updateJobList):
3813         (WebCore::CurlJobManager::workerThread):
3814         (WebCore::CurlJobList::append): Deleted.
3815         (WebCore::CurlJobList::cancel): Deleted.
3816         (WebCore::CurlJobList::complete): Deleted.
3817         (WebCore::CurlJobList::withJob): Deleted.
3818         (WebCore::CurlJobList::withCurlHandle): Deleted.
3819         (WebCore::CurlJob::invoke): Deleted.
3820         (WebCore::CurlJobManager::updateJobs): Deleted.
3821         * platform/network/curl/CurlJobManager.h:
3822         (WebCore::CurlJob::CurlJob): Deleted.
3823         (WebCore::CurlJob::~CurlJob): Deleted.
3824         (WebCore::CurlJob::operator=): Deleted.
3825         (WebCore::CurlJob::curlHandle const): Deleted.
3826         (WebCore::CurlJob::ticket const): Deleted.
3827         (WebCore::CurlJob::finished): Deleted.
3828         (WebCore::CurlJob::error): Deleted.
3829         (WebCore::CurlJob::cancel): Deleted.
3830         (WebCore::CurlJobManager::isActiveJob const): Deleted.
3831         * platform/network/curl/MultipartHandle.cpp:
3832         (WebCore::MultipartHandle::didReceiveData):
3833         * platform/network/curl/ResourceHandleCurl.cpp:
3834         (WebCore::ResourceHandleInternal::~ResourceHandleInternal):
3835         (WebCore::ResourceHandle::start):
3836         (WebCore::ResourceHandle::cancel):
3837         (WebCore::ResourceHandle::platformSetDefersLoading):
3838         (WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
3839         (WebCore::ResourceHandle::receivedCredential):
3840         (WebCore::ResourceHandle::receivedRequestToContinueWithoutCredential):
3841         (WebCore::ResourceHandle::platformLoadResourceSynchronously):
3842         (WebCore::ResourceHandleInternal::initialize): Deleted.
3843         (WebCore::ResourceHandleInternal::applyAuthentication): Deleted.
3844         (WebCore::getFormElementsCount): Deleted.
3845         (WebCore::ResourceHandleInternal::setupPUT): Deleted.
3846         (WebCore::ResourceHandleInternal::setupPOST): Deleted.
3847         (WebCore::ResourceHandleInternal::setupFormData): Deleted.
3848         (WebCore::ResourceHandleInternal::didFinish): Deleted.
3849         (WebCore::ResourceHandleInternal::didFail): Deleted.
3850         (WebCore::ResourceHandleInternal::calculateWebTimingInformations): Deleted.
3851         (WebCore::ResourceHandleInternal::handleLocalReceiveResponse): Deleted.
3852         (WebCore::isHttpInfo): Deleted.
3853         (WebCore::isHttpRedirect): Deleted.
3854         (WebCore::isHttpAuthentication): Deleted.
3855         (WebCore::isHttpNotModified): Deleted.
3856         (WebCore::isAppendableHeader): Deleted.
3857         (WebCore::removeLeadingAndTrailingQuotes): Deleted.
3858         (WebCore::getProtectionSpace): Deleted.
3859         (WebCore::ResourceHandleInternal::willPrepareSendData): Deleted.
3860         (WebCore::ResourceHandleInternal::didReceiveHeaderLine): Deleted.
3861         (WebCore::ResourceHandleInternal::didReceiveAllHeaders): Deleted.
3862         (WebCore::ResourceHandleInternal::didReceiveContentData): Deleted.
3863         (WebCore::ResourceHandleInternal::readCallback): Deleted.
3864         (WebCore::ResourceHandleInternal::headerCallback): Deleted.
3865         (WebCore::ResourceHandleInternal::writeCallback): Deleted.
3866         (WebCore::ResourceHandleInternal::dispatchSynchronousJob): Deleted.
3867         (WebCore::ResourceHandleInternal::handleDataURL): Deleted.
3868         * platform/network/curl/ResourceHandleCurlDelegate.cpp: Added.
3869         (WebCore::ResourceHandleCurlDelegate::ResourceHandleCurlDelegate):
3870         (WebCore::ResourceHandleCurlDelegate::~ResourceHandleCurlDelegate):
3871         (WebCore::ResourceHandleCurlDelegate::hasHandle const):
3872         (WebCore::ResourceHandleCurlDelegate::releaseHandle):
3873         (WebCore::ResourceHandleCurlDelegate::start):
3874         (WebCore::ResourceHandleCurlDelegate::cancel):
3875         (WebCore::ResourceHandleCurlDelegate::setDefersLoading):
3876         (WebCore::ResourceHandleCurlDelegate::setAuthentication):
3877         (WebCore::ResourceHandleCurlDelegate::dispatchSynchronousJob):
3878         (WebCore::ResourceHandleCurlDelegate::retain):
3879         (WebCore::ResourceHandleCurlDelegate::release):
3880         (WebCore::ResourceHandleCurlDelegate::setupRequest):
3881         (WebCore::ResourceHandleCurlDelegate::notifyFinish):
3882         (WebCore::ResourceHandleCurlDelegate::notifyFail):
3883         (WebCore::ResourceHandleCurlDelegate::response):
3884         (WebCore::ResourceHandleCurlDelegate::setupAuthentication):
3885         (WebCore::removeLeadingAndTrailingQuotes):
3886         (WebCore::ResourceHandleCurlDelegate::getProtectionSpace):
3887         (WebCore::isHttpInfo):
3888         (WebCore::isHttpRedirect):
3889         (WebCore::isHttpAuthentication):
3890         (WebCore::isHttpNotModified):
3891         (WebCore::isAppendableHeader):
3892         (WebCore::ResourceHandleCurlDelegate::didReceiveHeaderLine):
3893         (WebCore::ResourceHandleCurlDelegate::didReceiveAllHeaders):
3894         (WebCore::ResourceHandleCurlDelegate::didReceiveContentData):
3895         (WebCore::ResourceHandleCurlDelegate::handleLocalReceiveResponse):
3896         (WebCore::ResourceHandleCurlDelegate::prepareSendData):
3897         (WebCore::ResourceHandleCurlDelegate::didFinish):
3898         (WebCore::ResourceHandleCurlDelegate::didFail):
3899         (WebCore::ResourceHandleCurlDelegate::handleDataURL):
3900         (WebCore::ResourceHandleCurlDelegate::setupPOST):
3901         (WebCore::ResourceHandleCurlDelegate::setupPUT):
3902         (WebCore::ResourceHandleCurlDelegate::getFormElementsCount):
3903         (WebCore::ResourceHandleCurlDelegate::setupFormData):
3904         (WebCore::ResourceHandleCurlDelegate::applyAuthentication):
3905         (WebCore::ResourceHandleCurlDelegate::setWebTimings):
3906         (WebCore::ResourceHandleCurlDelegate::didReceiveHeader):
3907         (WebCore::ResourceHandleCurlDelegate::didReceiveData):
3908         (WebCore::ResourceHandleCurlDelegate::willSendData):
3909         (WebCore::ResourceHandleCurlDelegate::didReceiveHeaderCallback):
3910         (WebCore::ResourceHandleCurlDelegate::didReceiveDataCallback):
3911         (WebCore::ResourceHandleCurlDelegate::willSendDataCallback):
3912         * platform/network/curl/ResourceHandleCurlDelegate.h: Added.
3913
3914 2017-08-18  Ryosuke Niwa  <rniwa@webkit.org>
3915
3916         iOS 10 debug build fix.
3917
3918         * dom/DataTransfer.cpp:
3919         (WebCore::DataTransfer::DataTransfer):
3920
3921 2017-08-18  Ryosuke Niwa  <rniwa@webkit.org>
3922
3923         Rename DataTransferAccessPolicy to match spec and refactor related node
3924         https://bugs.webkit.org/show_bug.cgi?id=175704
3925
3926         Reviewed by Wenson Hsieh.
3927
3928         Renamed DataTransferAccessPolicy to DataTransfer::StoreMode to match the drag data store mode concept
3929         in the HTML5 specification:
3930         https://html.spec.whatwg.org/multipage/dnd.html#drag-data-store-mode
3931
3932         DataTransfer in addition to those states can be disassociated from the drag data store when it becomes
3933         no longer valid. We also support a special mode which allows only updating the drag image.
3934         These two states, Invalid and DragImageWritable, are added in addition to the three states in the spec.
3935
3936         Also split DragAndDrop type of DataTransfer into DragAndDropData and DragAndDropFiles, and refactored
3937         the related code.
3938
3939         No new tests since there should be no behavioral change.
3940
3941         * WebCore.xcodeproj/project.pbxproj:
3942         * dom/DataTransfer.cpp:
3943         (WebCore::DataTransfer::DataTransfer): No longer takes forFileDrag boolean since it's folded into type.
3944         (WebCore::DataTransfer::createForCopyAndPaste):
3945         (WebCore::DataTransfer::~DataTransfer):
3946         (WebCore::DataTransfer::setAccessPolicy): Deleted.
3947         (WebCore::DataTransfer::canReadTypes const):
3948         (WebCore::DataTransfer::canReadData const):
3949         (WebCore::DataTransfer::canWriteData const):
3950         (WebCore::DataTransfer::createForInputEvent):
3951         (WebCore::DataTransfer::createForDrag):
3952         (WebCore::DataTransfer::createForDrop):
3953         (WebCore::DataTransfer::canSetDragImage const):
3954         * dom/DataTransfer.h:
3955         (WebCore::DataTransfer::makeInvalidForSecurity): Added.
3956         (WebCore::DataTransfer::makeDragImageWritable): Added.
3957         * dom/DataTransferAccessPolicy.h: Removed.
3958         * editing/Editor.cpp:
3959         (WebCore::dispatchClipboardEvent): Moved and renamed from dispatchCPPEvent. Now computes the store mode
3960         inside the function to match the spec: https://w3c.github.io/clipboard-apis/#fire-a-clipboard-event
3961         (WebCore::Editor::canDHTMLCut):
3962         (WebCore::Editor::canDHTMLCopy):
3963         (WebCore::Editor::canDHTMLPaste):
3964         (WebCore::Editor::tryDHTMLCopy):
3965         (WebCore::Editor::tryDHTMLCut):
3966         (WebCore::Editor::tryDHTMLPaste):
3967         (WebCore::Editor::dispatchCPPEvent): Deleted.
3968         * editing/Editor.h:
3969         * page/DragController.cpp:
3970         (WebCore::createDataTransferToUpdateDrag): Extracted to share code.
3971         (WebCore::DragController::dragExited):
3972         (WebCore::DragController::performDragOperation):
3973         (WebCore::DragController::tryDHTMLDrag):
3974         * page/EventHandler.cpp:
3975         (WebCore::EventHandler::invalidateDataTransfer):
3976         (WebCore::EventHandler::handleDrag):
3977
3978 2017-08-18  Said Abou-Hallawa  <sabouhallawa@apple.com>
3979
3980         Followup (r220289): RenderImageResourceStyleImage code clean up
3981         https://bugs.webkit.org/show_bug.cgi?id=175444
3982
3983         Reviewed by Darin Adler.
3984
3985         RenderImageResourceStyleImage may be created with a StyleImage of type
3986         StyleGeneratedImage. It may also be associated with a CachedImage which 
3987         is loaded through a source URL. In this case, adding and removing m_renderer
3988         as a client of the CachedImage will be done through 
3989         RenderImageResource::setCachedImage().
3990
3991