Implement FileSystemEntry.getParent()
[WebKit.git] / Source / WebCore / ChangeLog
1 2017-09-01  Chris Dumez  <cdumez@apple.com>
2
3         Implement FileSystemEntry.getParent()
4         https://bugs.webkit.org/show_bug.cgi?id=176165
5         <rdar://problem/34187743>
6
7         Reviewed by Andreas Kling.
8
9         Implement FileSystemEntry.getParent():
10         - https://wicg.github.io/entries-api/#dom-filesystementry-getparent
11
12         Tests: editing/pasteboard/datatransfer-items-drop-getParent-root.html
13                editing/pasteboard/datatransfer-items-drop-getParent.html
14                editing/pasteboard/datatransfer-items-drop-getParent2.html
15
16         * Modules/entriesapi/DOMFileSystem.cpp:
17         (WebCore::toFileSystemEntries):
18         Take a ScriptExecutionContext now that FileSystemEntry is an ActiveDOMObject.
19
20         (WebCore::isAbsoluteVirtualPath):
21         Add utility function to determine if a virtual path is absolute:
22         - https://wicg.github.io/entries-api/#absolute-path
23
24         (WebCore::DOMFileSystem::root):
25         Take a ScriptExecutionContext now that FileSystemEntry is an ActiveDOMObject.
26
27         (WebCore::DOMFileSystem::fileAsEntry):
28         Take a ScriptExecutionContext now that FileSystemEntry is an ActiveDOMObject.
29
30         (WebCore::resolveRelativePath):
31         Add implementation for:
32         - https://wicg.github.io/entries-api/#resolve-a-relative-path
33
34         (WebCore::DOMFileSystem::listDirectory):
35         Take a ScriptExecutionContext now that FileSystemEntry is an ActiveDOMObject.
36
37         (WebCore::DOMFileSystem::getParent):
38         Add implementation of getParent() as per:
39         - https://wicg.github.io/entries-api/#dom-filesystementry-getparent
40
41         * Modules/entriesapi/DOMFileSystem.h:
42         (WebCore::DOMFileSystem::createEntryForFile):
43         * Modules/entriesapi/DOMFileSystem.idl:
44         * Modules/entriesapi/FileSystemDirectoryEntry.cpp:
45         (WebCore::FileSystemDirectoryEntry::FileSystemDirectoryEntry):
46         * Modules/entriesapi/FileSystemDirectoryEntry.h:
47         * Modules/entriesapi/FileSystemDirectoryReader.cpp:
48         (WebCore::FileSystemDirectoryReader::readEntries):
49         Take a ScriptExecutionContext now that FileSystemEntry is an ActiveDOMObject.
50
51         * Modules/entriesapi/FileSystemEntry.cpp:
52         (WebCore::FileSystemEntry::FileSystemEntry):
53         (WebCore::FileSystemEntry::activeDOMObjectName const):
54         (WebCore::FileSystemEntry::canSuspendForDocumentSuspension const):
55         (WebCore::FileSystemEntry::getParent):
56         * Modules/entriesapi/FileSystemEntry.h:
57         * Modules/entriesapi/FileSystemEntry.idl:
58         - Add implementation of FileSystemEntry.getParent() which relies on
59           DOMFileSystem::getParent()
60         - Make FileSystemEntry an ActiveDOMObject as getParent() is an asynchronous
61           operation which causes delayed JS execution.
62
63         * Modules/entriesapi/FileSystemFileEntry.cpp:
64         (WebCore::FileSystemFileEntry::FileSystemFileEntry):
65         * Modules/entriesapi/FileSystemFileEntry.h:
66         * dom/DataTransferItem.cpp:
67         (WebCore::DataTransferItem::getAsEntry const):
68         * dom/DataTransferItem.h:
69         * dom/DataTransferItem.idl:
70         Take a ScriptExecutionContext now that FileSystemEntry is an ActiveDOMObject.
71
72 2017-09-01  Yoshiaki Jitsukawa  <Yoshiaki.Jitsukawa@sony.com>
73
74         Ensure RenderStyle and SameSizeAsRenderStyle have the same size
75         https://bugs.webkit.org/show_bug.cgi?id=176210
76
77         Reviewed by Daniel Bates.
78
79         SameSizeAsRenderStyle::m_nonInheritedFlags requires a 64 bit alignment,
80         which currently produces an extra 32 bit padding with 32 bit build.
81
82         * rendering/style/RenderStyle.cpp:
83         Make m_nonInheritedFlags 32 bit aligned and restore the size check.
84
85 2017-09-01  Per Arne Vollan  <pvollan@apple.com>
86
87         [Win] Compile error, 'Cache' is not declared.
88         https://bugs.webkit.org/show_bug.cgi?id=176062
89
90         Reviewed by Youenn Fablet.
91
92         Rename DOMCache to DOMCacheEngine.
93
94         No new tests, covered by existing tests. 
95
96         * Modules/cache/Cache.cpp:
97         (WebCore::Cache::addAll):
98         (WebCore::Cache::put):
99         (WebCore::queryCacheMatch):
100         (WebCore::Cache::batchDeleteOperation):
101         (WebCore::toConnectionRecord):
102         (WebCore::Cache::batchPutOperation):
103         * Modules/cache/Cache.h:
104         * Modules/cache/CacheStorage.cpp:
105         (WebCore::CacheStorage::open):
106         (WebCore::CacheStorage::remove):
107         * Modules/cache/CacheStorageConnection.cpp:
108         * Modules/cache/CacheStorageConnection.h:
109         (WebCore::CacheStorageConnection::clearMemoryRepresentation):
110         (WebCore::CacheStorageConnection::openCompleted):
111         (WebCore::CacheStorageConnection::removeCompleted):
112         (WebCore::CacheStorageConnection::doOpen):
113         (WebCore::CacheStorageConnection::doRemove):
114         (WebCore::CacheStorageConnection::doBatchDeleteOperation):
115         (WebCore::CacheStorageConnection::doBatchPutOperation):
116         * Modules/cache/DOMCache.cpp: Removed.
117         * Modules/cache/DOMCache.h: Removed.
118         * Modules/cache/DOMCacheEngine.cpp: Copied from Source/WebCore/Modules/cache/DOMCache.cpp.
119         (WebCore::DOMCacheEngine::isolatedResponseBody):
120         (WebCore::DOMCacheEngine::copyResponseBody):
121         (WebCore::DOMCache::errorToException): Deleted.
122         (WebCore::DOMCache::queryCacheMatch): Deleted.
123         (WebCore::DOMCache::isolatedResponseBody): Deleted.
124         (WebCore::DOMCache::copyResponseBody): Deleted.
125         (WebCore::DOMCache::Record::copy const): Deleted.
126         * Modules/cache/DOMCacheEngine.h: Copied from Source/WebCore/Modules/cache/DOMCache.h.
127         * Modules/cache/WorkerCacheStorageConnection.cpp:
128         * Modules/cache/WorkerCacheStorageConnection.h:
129         * WebCore.xcodeproj/project.pbxproj:
130         * testing/Internals.cpp:
131         (WebCore::Internals::clearCacheStorageMemoryRepresentation):
132
133 2017-08-31  Andy Estes  <aestes@apple.com>
134
135         [Mac] Upstream AppKit-related WebKitSystemInterface functions
136         https://bugs.webkit.org/show_bug.cgi?id=176175
137
138         Reviewed by Brady Eidson.
139
140         * Configurations/WebCore.xcconfig: Added -ObjC to OTHER_LDFLAGS so that Objective-C classes
141         in PAL are exported by WebCore even if WebCore doesn't use them.
142         * platform/mac/PlatformEventFactoryMac.h:
143         * platform/mac/PlatformEventFactoryMac.mm:
144         (WebCore::getWheelEventDeltas):
145         (WebCore::keyCharForEvent):
146         (WebCore::PlatformWheelEventBuilder::PlatformWheelEventBuilder):
147         * platform/mac/WebCoreSystemInterface.h:
148         * platform/mac/WebCoreSystemInterface.mm:
149
150 2017-08-31  Alex Christensen  <achristensen@webkit.org>
151
152         Fix Windows build after r221422
153         https://bugs.webkit.org/show_bug.cgi?id=174924
154
155         * platform/text/win/LocaleWin.cpp:
156         (WebCore::LocaleWin::getLocaleInfoString):
157         StringVector is now the type that can be adopted by String::adopt.
158
159 2017-08-31  Daniel Bates  <dabates@apple.com>
160
161         Another attempt to fix the Apple Windows build following <https://trac.webkit.org/changeset/221459>
162         (https://bugs.webkit.org/show_bug.cgi?id=176171)
163
164         Temporarily weaken the size check for RenderStyle from a strict equality to <=.
165
166         * rendering/style/RenderStyle.cpp:
167
168 2017-08-31  Daniel Bates  <dabates@apple.com>
169
170         Attempt to fix the Apple Windows and WinCairo build following <https://trac.webkit.org/changeset/221459>
171         (https://bugs.webkit.org/show_bug.cgi?id=176171)
172
173         Explicitly cast PseudoIds to unsigned before computing a difference between two PseudoIds.
174
175         * rendering/style/RenderStyle.h:
176
177 2017-08-31  Alex Christensen  <achristensen@webkit.org>
178
179         Add ObjC SPI corresponding to WKPageLoaderClient's webGLLoadPolicy and resolveWebGLLoadPolicy
180         https://bugs.webkit.org/show_bug.cgi?id=175779
181         <rdar://problem/22367975>
182
183         Reviewed by Tim Horton.
184
185         Covered by new API tests.
186
187         * loader/FrameLoaderClient.h:
188
189 2017-08-31  Andreas Kling  <akling@apple.com>
190
191         Element focus appearance update should be either immediate or a post-layout task
192         https://bugs.webkit.org/show_bug.cgi?id=176193
193
194         Reviewed by Antti Koivisto.
195
196         This change removes an old mechanism for avoiding element focus appearance updates
197         while we might be in the middle of attaching a renderer.
198
199         Focus appearance updates depend on a clean layout, since they want to be able to
200         scroll the element into the visible viewport if needed.
201         We now simply do the updates either immediately after layout in Element::focus(),
202         or as a post-layout callback when needed for HTMLInputElement::didAttachRenderers().
203
204         * dom/Document.cpp:
205         (WebCore::Document::Document):
206         (WebCore::Document::updateFocusAppearanceSoon): Deleted.
207         (WebCore::Document::cancelFocusAppearanceUpdate): Deleted.
208         (WebCore::Document::updateFocusAppearanceTimerFired): Deleted.
209         * dom/Document.h:
210         * dom/Element.cpp:
211         (WebCore::Element::focus):
212         (WebCore::Element::blur):
213         (WebCore::Element::clearStyleDerivedDataBeforeDetachingRenderer):
214         (WebCore::Element::updateFocusAppearanceAfterAttachIfNeeded): Deleted.
215         (WebCore::Element::cancelFocusAppearanceUpdate): Deleted.
216         * dom/Element.h:
217         * dom/ElementRareData.h:
218         (WebCore::ElementRareData::ElementRareData):
219         (WebCore::ElementRareData::needsFocusAppearanceUpdateSoonAfterAttach const): Deleted.
220         (WebCore::ElementRareData::setNeedsFocusAppearanceUpdateSoonAfterAttach): Deleted.
221         * html/HTMLInputElement.cpp:
222         (WebCore::HTMLInputElement::didAttachRenderers):
223
224 2017-08-31  Don Olmstead  <don.olmstead@sony.com>
225
226         [CMake] Make USE_CF conditional within Windows
227         https://bugs.webkit.org/show_bug.cgi?id=176173
228
229         Reviewed by Alex Christensen.
230
231         No new tests. No change in behavior.
232
233         * PlatformWin.cmake:
234         * WebCorePrefix.h:
235         * testing/js/WebCoreTestSupportPrefix.h:
236
237 2017-08-31  Sam Weinig  <sam@webkit.org>
238
239         Implement DOMMatrix2DInit for setTransform()/addPath()
240         https://bugs.webkit.org/show_bug.cgi?id=176048
241
242         Reviewed by Simon Fraser.
243
244         * DerivedSources.make:
245         * WebCore.xcodeproj/project.pbxproj:
246         * CMakeLists.txt:
247
248             Add new files.
249
250         * bindings/js/CallTracerTypes.h:
251         * inspector/InspectorCanvas.cpp:
252         
253             Swap out DOMMatrixInit for DOMMatrix2DInit in canvas tracing infrastructure.
254
255         * css/DOMMatrix2DInit.h: Added.
256         * css/DOMMatrix2DInit.idl: Added.
257         * css/DOMMatrixInit.h:
258         * css/DOMMatrixInit.idl:
259         Split DOMMatrixInit in two, with the 2D bits going into DOMMatrix2DInit.
260         
261         * css/DOMMatrixReadOnly.cpp:
262         * css/DOMMatrixReadOnly.h:
263         
264             Add a validateAndFixup overload for DOMMatrix2DInit.
265         
266         * html/canvas/CanvasRenderingContext2D.cpp:
267         * html/canvas/CanvasRenderingContext2D.h:
268
269             Swap out DOMMatrixInit for DOMMatrix2DInit in setTransform. This
270             should have no observable difference, since we ignored the 3D prior.
271
272         * html/canvas/DOMPath.cpp:
273         * html/canvas/DOMPath.h:
274         * html/canvas/DOMPath.idl:
275
276             Update DOMPath (actually called Path2D) to take an optional DOMMatrix2DInit
277             rather than an SVGMatrix. Passing an SVGMatrix is still valid, as it conforms
278             as a DOMMatrix2DInit dictionary (having the necessary properties), so the
279             risk of compatibility issues is minimal.
280
281 2017-08-31  Brady Eidson  <beidson@apple.com>
282
283         Add (entirely incorrect) fetching of ServiceWorker scripts.
284         https://bugs.webkit.org/show_bug.cgi?id=176179
285
286         Reviewed by Andy Estes.
287
288         No new tests (Covered by changes to existing tests).
289
290         When the Storage process is running the "Update" algorithm and a ServiceWorker script file needs to be fetched, this patch:
291           - Messages back to the WebContent process that started the register/update job
292           - Executes a FetchLoad in that script context for the script
293           - Sends the results back to the Storage process
294
295         We don't do anything with the results yet.
296
297         Soon.
298
299         * WebCore.xcodeproj/project.pbxproj:
300
301         * workers/service/ServiceWorkerContainer.cpp:
302         (WebCore::ServiceWorkerContainer::startScriptFetchForJob):
303         (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
304         (WebCore::ServiceWorkerContainer::jobFailedLoadingScript):
305         * workers/service/ServiceWorkerContainer.h:
306
307         * workers/service/ServiceWorkerFetchResult.h: Copied from Source/WebCore/workers/service/server/SWClientConnection.h.
308         (WebCore::ServiceWorkerFetchResult::encode const):
309         (WebCore::ServiceWorkerFetchResult::decode):
310
311         * workers/service/ServiceWorkerJob.cpp:
312         (WebCore::ServiceWorkerJob::startScriptFetch):
313         (WebCore::ServiceWorkerJob::fetchScriptWithContext):
314         (WebCore::ServiceWorkerJob::didReceiveResponse):
315         (WebCore::ServiceWorkerJob::didReceiveData):
316         (WebCore::ServiceWorkerJob::didSucceed):
317         (WebCore::ServiceWorkerJob::didFail):
318         * workers/service/ServiceWorkerJob.h:
319
320         * workers/service/ServiceWorkerJobClient.h:
321
322         * workers/service/server/SWClientConnection.cpp:
323         (WebCore::SWClientConnection::finishedFetchingScript):
324         (WebCore::SWClientConnection::failedFetchingScript):
325         (WebCore::SWClientConnection::startScriptFetchForServer):
326         * workers/service/server/SWClientConnection.h:
327
328         * workers/service/server/SWServer.cpp:
329         (WebCore::SWServer::Connection::finishFetchingScriptInServer):
330         (WebCore::SWServer::startScriptFetch):
331         (WebCore::SWServer::scriptFetchFinished):
332         * workers/service/server/SWServer.h:
333
334         * workers/service/server/SWServerRegistration.cpp:
335         (WebCore::SWServerRegistration::scriptFetchFinished):
336         (WebCore::SWServerRegistration::runUpdateJob):
337         (WebCore::SWServerRegistration::startScriptFetchFromMainThread):
338         (WebCore::SWServerRegistration::startScriptFetchForCurrentJob):
339         * workers/service/server/SWServerRegistration.h:
340
341 2017-08-31  Daniel Bates  <dabates@apple.com>
342
343         Make RenderStyle's non-inherited flags more human friendly
344         https://bugs.webkit.org/show_bug.cgi?id=176171
345
346         Reviewed by Antti Koivisto.
347
348         Revert r166465 as we never followed through and made the CSS JIT update
349         RenderStyle's non-inherited flags directly.
350
351         * rendering/style/RenderStyle.cpp:
352         (WebCore::RenderStyle::RenderStyle):
353         (WebCore::RenderStyle::hashForTextAutosizing const):
354         (WebCore::RenderStyle::equalForTextAutosizing const):
355         (WebCore::RenderStyle::changeRequiresLayout const):
356         * rendering/style/RenderStyle.h:
357         (WebCore::RenderStyle::styleType const):
358         (WebCore::RenderStyle::setStyleType):
359         (WebCore::RenderStyle::setHasViewportUnits):
360         (WebCore::RenderStyle::hasViewportUnits const):
361         (WebCore::RenderStyle::affectedByHover const):
362         (WebCore::RenderStyle::affectedByActive const):
363         (WebCore::RenderStyle::affectedByDrag const):
364         (WebCore::RenderStyle::setAffectedByHover):
365         (WebCore::RenderStyle::setAffectedByActive):
366         (WebCore::RenderStyle::setAffectedByDrag):
367         (WebCore::RenderStyle::isFloating const):
368         (WebCore::RenderStyle::display const):
369         (WebCore::RenderStyle::position const):
370         (WebCore::RenderStyle::floating const):
371         (WebCore::RenderStyle::overflowX const):
372         (WebCore::RenderStyle::overflowY const):
373         (WebCore::RenderStyle::verticalAlign const):
374         (WebCore::RenderStyle::unicodeBidi const):
375         (WebCore::RenderStyle::clear const):
376         (WebCore::RenderStyle::tableLayout const):
377         (WebCore::RenderStyle::hasExplicitlySetDirection const):
378         (WebCore::RenderStyle::isLink const):
379         (WebCore::RenderStyle::setDisplay):
380         (WebCore::RenderStyle::setOriginalDisplay):
381         (WebCore::RenderStyle::setPosition):
382         (WebCore::RenderStyle::setFloating):
383         (WebCore::RenderStyle::setOverflowX):
384         (WebCore::RenderStyle::setOverflowY):
385         (WebCore::RenderStyle::setVerticalAlign):
386         (WebCore::RenderStyle::setUnicodeBidi):
387         (WebCore::RenderStyle::setClear):
388         (WebCore::RenderStyle::setTableLayout):
389         (WebCore::RenderStyle::setHasExplicitlySetDirection):
390         (WebCore::RenderStyle::setIsLink):
391         (WebCore::RenderStyle::hasExplicitlySetWritingMode const):
392         (WebCore::RenderStyle::setHasExplicitlySetWritingMode):
393         (WebCore::RenderStyle::hasExplicitlySetTextAlign const):
394         (WebCore::RenderStyle::setHasExplicitlySetTextAlign):
395         (WebCore::RenderStyle::unique const):
396         (WebCore::RenderStyle::setUnique):
397         (WebCore::RenderStyle::emptyState const):
398         (WebCore::RenderStyle::setEmptyState):
399         (WebCore::RenderStyle::firstChildState const):
400         (WebCore::RenderStyle::setFirstChildState):
401         (WebCore::RenderStyle::lastChildState const):
402         (WebCore::RenderStyle::setLastChildState):
403         (WebCore::RenderStyle::setHasExplicitlyInheritedProperties):
404         (WebCore::RenderStyle::hasExplicitlyInheritedProperties const):
405         (WebCore::RenderStyle::inheritUnicodeBidiFrom):
406         (WebCore::RenderStyle::NonInheritedFlags::operator!= const):
407         (WebCore::RenderStyle::NonInheritedFlags::hasAnyPublicPseudoStyles const):
408         (WebCore::RenderStyle::originalDisplay const):
409         (WebCore::RenderStyle::NonInheritedFlags::operator== const):
410         (WebCore::RenderStyle::NonInheritedFlags::copyNonInheritedFrom):
411         (WebCore::RenderStyle::NonInheritedFlags::hasPseudoStyle const):
412         (WebCore::RenderStyle::NonInheritedFlags::setHasPseudoStyle):
413         (WebCore::RenderStyle::NonInheritedFlags::overflowX const): Deleted.
414         (WebCore::RenderStyle::NonInheritedFlags::setOverflowX): Deleted.
415         (WebCore::RenderStyle::NonInheritedFlags::overflowY const): Deleted.
416         (WebCore::RenderStyle::NonInheritedFlags::setOverflowY): Deleted.
417         (WebCore::RenderStyle::NonInheritedFlags::clear const): Deleted.
418         (WebCore::RenderStyle::NonInheritedFlags::setClear): Deleted.
419         (WebCore::RenderStyle::NonInheritedFlags::effectiveDisplay const): Deleted.
420         (WebCore::RenderStyle::NonInheritedFlags::setEffectiveDisplay): Deleted.
421         (WebCore::RenderStyle::NonInheritedFlags::position const): Deleted.
422         (WebCore::RenderStyle::NonInheritedFlags::setPosition): Deleted.
423         (WebCore::RenderStyle::NonInheritedFlags::originalDisplay const): Deleted.
424         (WebCore::RenderStyle::NonInheritedFlags::setOriginalDisplay): Deleted.
425         (WebCore::RenderStyle::NonInheritedFlags::unicodeBidi const): Deleted.
426         (WebCore::RenderStyle::NonInheritedFlags::setUnicodeBidi): Deleted.
427         (WebCore::RenderStyle::NonInheritedFlags::hasViewportUnits const): Deleted.
428         (WebCore::RenderStyle::NonInheritedFlags::setHasViewportUnits): Deleted.
429         (WebCore::RenderStyle::NonInheritedFlags::verticalAlign const): Deleted.
430         (WebCore::RenderStyle::NonInheritedFlags::setVerticalAlign): Deleted.
431         (WebCore::RenderStyle::NonInheritedFlags::hasExplicitlyInheritedProperties const): Deleted.
432         (WebCore::RenderStyle::NonInheritedFlags::setHasExplicitlyInheritedProperties): Deleted.
433         (WebCore::RenderStyle::NonInheritedFlags::isFloating const): Deleted.
434         (WebCore::RenderStyle::NonInheritedFlags::floating const): Deleted.
435         (WebCore::RenderStyle::NonInheritedFlags::setFloating): Deleted.
436         (WebCore::RenderStyle::NonInheritedFlags::tableLayout const): Deleted.
437         (WebCore::RenderStyle::NonInheritedFlags::setTableLayout): Deleted.
438         (WebCore::RenderStyle::NonInheritedFlags::styleType const): Deleted.
439         (WebCore::RenderStyle::NonInheritedFlags::setStyleType): Deleted.
440         (WebCore::RenderStyle::NonInheritedFlags::isUnique const): Deleted.
441         (WebCore::RenderStyle::NonInheritedFlags::setIsUnique): Deleted.
442         (WebCore::RenderStyle::NonInheritedFlags::emptyState const): Deleted.
443         (WebCore::RenderStyle::NonInheritedFlags::setEmptyState): Deleted.
444         (WebCore::RenderStyle::NonInheritedFlags::firstChildState const): Deleted.
445         (WebCore::RenderStyle::NonInheritedFlags::setFirstChildState): Deleted.
446         (WebCore::RenderStyle::NonInheritedFlags::lastChildState const): Deleted.
447         (WebCore::RenderStyle::NonInheritedFlags::setLastChildState): Deleted.
448         (WebCore::RenderStyle::NonInheritedFlags::affectedByHover const): Deleted.
449         (WebCore::RenderStyle::NonInheritedFlags::setAffectedByHover): Deleted.
450         (WebCore::RenderStyle::NonInheritedFlags::affectedByActive const): Deleted.
451         (WebCore::RenderStyle::NonInheritedFlags::setAffectedByActive): Deleted.
452         (WebCore::RenderStyle::NonInheritedFlags::affectedByDrag const): Deleted.
453         (WebCore::RenderStyle::NonInheritedFlags::setAffectedByDrag): Deleted.
454         (WebCore::RenderStyle::NonInheritedFlags::isLink const): Deleted.
455         (WebCore::RenderStyle::NonInheritedFlags::setIsLink): Deleted.
456         (WebCore::RenderStyle::NonInheritedFlags::hasExplicitlySetDirection const): Deleted.
457         (WebCore::RenderStyle::NonInheritedFlags::setHasExplicitlySetDirection): Deleted.
458         (WebCore::RenderStyle::NonInheritedFlags::hasExplicitlySetWritingMode const): Deleted.
459         (WebCore::RenderStyle::NonInheritedFlags::setHasExplicitlySetWritingMode): Deleted.
460         (WebCore::RenderStyle::NonInheritedFlags::hasExplicitlySetTextAlign const): Deleted.
461         (WebCore::RenderStyle::NonInheritedFlags::setHasExplicitlySetTextAlign): Deleted.
462         (WebCore::RenderStyle::NonInheritedFlags::flagsMemoryOffset): Deleted.
463         (WebCore::RenderStyle::NonInheritedFlags::flagIsaffectedByActive): Deleted.
464         (WebCore::RenderStyle::NonInheritedFlags::flagIsaffectedByHover): Deleted.
465         (WebCore::RenderStyle::NonInheritedFlags::flagPseudoStyle): Deleted.
466         (WebCore::RenderStyle::NonInheritedFlags::setFirstChildStateFlags): Deleted.
467         (WebCore::RenderStyle::NonInheritedFlags::setLastChildStateFlags): Deleted.
468         (WebCore::RenderStyle::NonInheritedFlags::flagIsUnique): Deleted.
469         (WebCore::RenderStyle::NonInheritedFlags::flagFirstChildState): Deleted.
470         (WebCore::RenderStyle::NonInheritedFlags::flagLastChildState): Deleted.
471         (WebCore::RenderStyle::NonInheritedFlags::NonInheritedFlags): Deleted.
472         (WebCore::RenderStyle::NonInheritedFlags::setHasPseudoStyles): Deleted.
473         (WebCore::RenderStyle::NonInheritedFlags::updateBoolean): Deleted.
474         (WebCore::RenderStyle::NonInheritedFlags::getBoolean const): Deleted.
475         (WebCore::RenderStyle::NonInheritedFlags::updateValue): Deleted.
476         (WebCore::RenderStyle::InheritedFlags::operator== const): Deleted.
477         (WebCore::RenderStyle::NonInheritedFlags::getValue const): Deleted.
478         (WebCore::adjustForAbsoluteZoom): Deleted.
479         (WebCore::adjustFloatForAbsoluteZoom): Deleted.
480         (WebCore::adjustLayoutUnitForAbsoluteZoom): Deleted.
481         (WebCore::collapsedBorderStyle): Deleted.
482         (WebCore::RenderStyle::hasBackground const): Deleted.
483         (WebCore::RenderStyle::autoWrap): Deleted.
484         (WebCore::RenderStyle::preserveNewline): Deleted.
485         (WebCore::RenderStyle::collapseWhiteSpace): Deleted.
486         (WebCore::RenderStyle::isCollapsibleWhiteSpace const): Deleted.
487         (WebCore::RenderStyle::breakOnlyAfterWhiteSpace const): Deleted.
488         (WebCore::RenderStyle::breakWords const): Deleted.
489         (WebCore::RenderStyle::hasInlineColumnAxis const): Deleted.
490         (WebCore::RenderStyle::imageOrientation const): Deleted.
491         (WebCore::RenderStyle::setLogicalWidth): Deleted.
492         (WebCore::RenderStyle::setLogicalHeight): Deleted.
493         (WebCore::RenderStyle::setBorderRadius): Deleted.
494         (WebCore::RenderStyle::setZoom): Deleted.
495         (WebCore::RenderStyle::setEffectiveZoom): Deleted.
496         (WebCore::RenderStyle::setTextOrientation): Deleted.
497         (WebCore::RenderStyle::adjustBackgroundLayers): Deleted.
498         (WebCore::RenderStyle::adjustMaskLayers): Deleted.
499         (WebCore::RenderStyle::clearAnimations): Deleted.
500         (WebCore::RenderStyle::clearTransitions): Deleted.
501         (WebCore::RenderStyle::setShapeOutside): Deleted.
502         (WebCore::RenderStyle::setShapeImageThreshold): Deleted.
503         (WebCore::RenderStyle::setClipPath): Deleted.
504         (WebCore::RenderStyle::willChangeCreatesStackingContext const): Deleted.
505         (WebCore::RenderStyle::isDisplayRegionType const): Deleted.
506         (WebCore::RenderStyle::setWritingMode): Deleted.
507         (WebCore::RenderStyle::getShadowInlineDirectionExtent const): Deleted.
508         (WebCore::RenderStyle::getShadowBlockDirectionExtent const): Deleted.
509         (WebCore::RenderStyle::isDisplayReplacedType): Deleted.
510         (WebCore::RenderStyle::isDisplayInlineType): Deleted.
511         (WebCore::RenderStyle::isDisplayFlexibleBox): Deleted.
512         (WebCore::RenderStyle::isDisplayGridBox): Deleted.
513         (WebCore::RenderStyle::isDisplayFlexibleOrGridBox): Deleted.
514         (WebCore::RenderStyle::hasAnyPublicPseudoStyles const): Deleted.
515         (WebCore::RenderStyle::hasPseudoStyle const): Deleted.
516         (WebCore::RenderStyle::setHasPseudoStyle): Deleted.
517         (WebCore::RenderStyle::setHasPseudoStyles): Deleted.
518         (WebCore::RenderStyle::setBoxReflect): Deleted.
519         (WebCore::pseudoElementRendererIsNeeded): Deleted.
520
521 2017-08-31  Antti Koivisto  <antti@apple.com>
522
523         Remove newBlockInsideInlineModel and anonymous inline block
524         https://bugs.webkit.org/show_bug.cgi?id=176181
525
526         Reviewed by Zalan Bujtas.
527
528         Anonymous inline block exists to support newBlockInsideInlineModel which was planned as the replacement for continuations.
529         It has never been enabled and it is time to remove it.
530
531         * page/Settings.in:
532         * rendering/InlineElementBox.cpp:
533         (WebCore::InlineElementBox::paint):
534         (WebCore::InlineElementBox::nodeAtPoint):
535         * rendering/InlineFlowBox.cpp:
536         (WebCore::InlineFlowBox::addToLine):
537         (WebCore::InlineFlowBox::placeBoxesInBlockDirection):
538         (WebCore::InlineFlowBox::nodeAtPoint):
539         (WebCore::InlineFlowBox::paint):
540         (WebCore::InlineFlowBox::anonymousInlineBlock const): Deleted.
541         * rendering/InlineFlowBox.h:
542         (WebCore::InlineFlowBox::InlineFlowBox):
543         (WebCore::InlineFlowBox::hasAnonymousInlineBlock const): Deleted.
544         (WebCore::InlineFlowBox::setHasAnonymousInlineBlock): Deleted.
545         * rendering/RenderBlock.cpp:
546         (WebCore::RenderBlock::lineHeight const):
547         (WebCore::RenderBlock::baselinePosition const):
548         (WebCore::RenderBlock::renderName const):
549         * rendering/RenderBlockFlow.cpp:
550         (WebCore::RenderBlockFlow::rebuildFloatingObjectSetFromIntrudingFloats):
551         (WebCore::RenderBlockFlow::childrenPreventSelfCollapsing const):
552         (WebCore::RenderBlockFlow::adjustLinePositionForPagination):
553         (WebCore::RenderBlockFlow::computeInlinePreferredLogicalWidths const):
554         * rendering/RenderBlockFlow.h:
555         * rendering/RenderBlockLineLayout.cpp:
556         (WebCore::updateLogicalInlinePositions):
557         (WebCore::RenderBlockFlow::computeInlineDirectionPositionsForLine):
558         (WebCore::RenderBlockFlow::layoutRunsAndFloats):
559         (WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
560         (WebCore::RenderBlockFlow::layoutLineBoxes):
561         (WebCore::RenderBlockFlow::determineStartPosition):
562         (WebCore::RenderBlockFlow::matchedEndLine):
563         (WebCore::RenderBlockFlow::marginCollapseLinesFromStart): Deleted.
564         * rendering/RenderBox.cpp:
565         (WebCore::RenderBox::sizesLogicalWidthToFitContent const):
566         (WebCore::RenderBox::createsNewFormattingContext const):
567         (WebCore::RenderBox::avoidsFloats const):
568         * rendering/RenderInline.cpp:
569         (WebCore::RenderInline::addChildIgnoringContinuation):
570         * rendering/RenderObject.cpp:
571         (WebCore::RenderObject::isAnonymousInlineBlock const): Deleted.
572         * rendering/RenderObject.h:
573         (WebCore::RenderObject::isAnonymousBlock const):
574         * rendering/RootInlineBox.cpp:
575         (WebCore::RootInlineBox::alignBoxesInBlockDirection):
576         (WebCore::RootInlineBox::ascentAndDescentForBox const):
577         * rendering/line/BreakingContext.h:
578         (WebCore::BreakingContext::BreakingContext):
579         (WebCore::BreakingContext::handleReplaced):
580         * rendering/line/LineBreaker.cpp:
581         (WebCore::LineBreaker::nextLineBreak):
582         * rendering/line/LineBreaker.h:
583         * rendering/line/LineLayoutState.h:
584         (WebCore::LineLayoutState::marginInfo):
585         (WebCore::LineLayoutState::prevFloatBottomFromAnonymousInlineBlock): Deleted.
586         (WebCore::LineLayoutState::maxFloatBottomFromAnonymousInlineBlock): Deleted.
587
588 2017-08-31  Ryan Haddad  <ryanhaddad@apple.com>
589
590         Unreviewed, rolling out r221445.
591
592         This change broke Sierra Release builds.
593
594         Reverted changeset:
595
596         "Switch HTMLMediaElement to release logging"
597         https://bugs.webkit.org/show_bug.cgi?id=176065
598         http://trac.webkit.org/changeset/221445
599
600 2017-08-31  Youenn Fablet  <youenn@apple.com>
601
602         Update CacheStorage caches only if it is updated
603         https://bugs.webkit.org/show_bug.cgi?id=176135
604
605         Reviewed by Alex Christensen.
606
607         Covered by existing tests.
608
609         When retrieving caches from the engine, CacheStorage gets an update counter.
610         When this counter is different from the previous received one, CacheStorage will update its cache list.
611         Otherwise it will skip this update step.
612
613         * Modules/cache/CacheStorage.cpp:
614         (WebCore::CacheStorage::retrieveCaches):
615         * Modules/cache/CacheStorage.h:
616         * Modules/cache/CacheStorageConnection.cpp:
617         (WebCore::CacheStorageConnection::retrieveCaches):
618         * Modules/cache/CacheStorageConnection.h:
619         (WebCore::CacheStorageConnection::doRetrieveCaches):
620         * Modules/cache/DOMCache.cpp:
621         (WebCore::DOMCache::CacheInfos::isolatedCopy):
622         * Modules/cache/DOMCache.h:
623         (WebCore::DOMCache::CacheInfos::encode const):
624         (WebCore::DOMCache::CacheInfos::decode):
625         * Modules/cache/WorkerCacheStorageConnection.cpp:
626         (WebCore::WorkerCacheStorageConnection::doRetrieveCaches):
627         * Modules/cache/WorkerCacheStorageConnection.h:
628
629 2017-08-31  Eric Carlson  <eric.carlson@apple.com>
630
631         Switch HTMLMediaElement to release logging
632         https://bugs.webkit.org/show_bug.cgi?id=176065
633
634         Reviewed by Jer Noble.
635
636         * dom/Document.cpp:
637         (WebCore::Document::privateBrowsingStateDidChange): Disable the logger when private browsing
638         mode is enabled.
639         (WebCore::Document::logger const):
640         * dom/Document.h:
641
642         Convert debug-only logging to configurable release logging.
643         * html/HTMLMediaElement.cpp:
644         (PAL::LogArgument<WebCore::URL>::toString): Logger template for URL that returns the url as a
645         String when only when the LOG_DISABLED build flag is not defined. Returns "[url]" when it is.
646         * html/HTMLMediaElement.h:
647
648 2017-08-31  David Quesada  <david_quesada@apple.com>
649
650         WKNavigationDelegatePrivate client redirect SPI needs to be able to detect redirects scheduled before the document finishes loading
651         https://bugs.webkit.org/show_bug.cgi?id=176128
652         rdar://problem/34068476
653
654         Reviewed by Brady Eidson.
655
656         Removed FrameLoaderClient::dispatchDidPerformClientRedirect() since no client cares about this event anymore.
657         Also removed FrameLoader::performClientRedirect() since it wouldn't do anything but call changeLocation().
658
659         No new tests - no change in functionality.
660
661         * loader/FrameLoader.cpp:
662         * loader/FrameLoader.h:
663         * loader/FrameLoaderClient.h:
664         * loader/NavigationScheduler.cpp:
665
666 2017-08-31  Chris Dumez  <cdumez@apple.com>
667
668         getFileMetadata() does not work as expected for symbolic links
669         https://bugs.webkit.org/show_bug.cgi?id=176143
670
671         Reviewed by Andreas Kling.
672
673         getFileMetadata() does not work as expected for symbolic links:
674         On POSIX, getFileMetadata() always followed symlinks, which meant that FileMetadata.type could
675         never be TypeSymbolicLink. On Windows, the function properly did not follow symlinks but failed to set
676         FileMetadata.type to TypeSymbolicLink when the file was a symbolic link.
677
678         This patch adds a new ShouldFollowSymbolicLinks parameter to getFileMetadata() so that
679         the call site can decide the behavior it wants. If getFileMetadata() is called on a
680         symbolic link with ShouldFollowSymbolicLinks::No as parameter, FileMetadata.type is now
681         properly set to TypeSymbolicLink.
682
683         No new tests, covered by new API test.
684
685         * Modules/entriesapi/DOMFileSystem.cpp:
686         (WebCore::listDirectoryWithMetadata):
687         It is important we do not follow symlinks here since the code wants to discard them
688         and does so by checking FileMetadata.type.
689
690         * WebCore.xcodeproj/project.pbxproj:
691         * fileapi/File.cpp:
692         (WebCore::File::isDirectory const):
693
694         * html/FileListCreator.cpp:
695         (WebCore::appendDirectoryFiles):
696         (WebCore::FileListCreator::createFileList):
697         It is important we do not follow symlinks here since the code wants to discard them
698         and does so by checking FileMetadata.type.
699
700         * platform/FileSystem.cpp:
701         (WebCore::fileIsDirectory):
702         * platform/FileSystem.h:
703         * platform/glib/FileSystemGlib.cpp:
704         (WebCore::getFileLStat):
705         (WebCore::getFileMetadata):
706         * platform/posix/FileSystemPOSIX.cpp:
707         (WebCore::getFileMetadata):
708         (WebCore::createSymbolicLink):
709         * platform/win/FileSystemWin.cpp:
710         (WebCore::getFinalPathName):
711         (WebCore::getFileMetadata):
712         (WebCore::createSymbolicLink):
713         - Add new createSymbolicLink() function for testing purposes.
714         - On Posix, call lstat() instead of stat if ShouldFollowSymbolicLinks::No.
715         - On Windows, since FindFirstFileW() does not follow symlinks, resolve
716           final path using GetFinalPathNameByHandleW() if ShouldFollowSymbolicLinks::Yes.
717         - On Windows, properly set FileMetadata.type to TypeSymbolicLink if the file
718           is a symbolic link.
719
720 2017-08-31  Michael Catanzaro  <mcatanzaro@igalia.com>
721
722         REGRESSION(r221226): [SOUP] libsoup-CRITICAL **: soup_cookies_to_cookie_header: assertion 'cookies != NULL' failed
723         https://bugs.webkit.org/show_bug.cgi?id=176140
724
725         Reviewed by Carlos Garcia Campos.
726
727         This should fix unexpected stderr output in several tests.
728
729         * platform/network/soup/CookieJarSoup.cpp:
730         (WebCore::cookiesForSession):
731
732 2017-08-31  Youenn Fablet  <youenn@apple.com>
733
734         Add support for Request body stream cloning
735         https://bugs.webkit.org/show_bug.cgi?id=176148
736
737         Reviewed by Alex Christensen.
738
739         Tests: http/wpt/fetch/request-clone.html
740                http/wpt/fetch/request-consume-stream.html
741                http/wpt/fetch/request-stream-disturbed-1.html
742                http/wpt/fetch/request-stream-disturbed-2.html
743                http/wpt/fetch/request-stream-disturbed-3.html
744
745         Adding support for ReadableStream teeing for cloning fetch bodies.
746         Adding support for pushing request body data to its ReadableStream.
747         Renamed FetchResponseSource to FetchBodySource for that purpose.
748
749         Tests extracting body from a ReadableStream through JS API pass.
750         Tests extracting data stored in a ReadableStream to resolve fetch body promises are failing.
751         There is no support yet, this will be added as a follow-up.
752
753         * CMakeLists.txt:
754         * Modules/fetch/FetchBody.cpp:
755         (WebCore::FetchBody::consume):
756         (WebCore::FetchBody::consumeAsStream):
757         (WebCore::FetchBody::clone):
758         * Modules/fetch/FetchBody.h:
759         * Modules/fetch/FetchBodyConsumer.h:
760         * Modules/fetch/FetchBodyOwner.cpp:
761         (WebCore::FetchBodyOwner::cloneBody):
762         (WebCore::FetchBodyOwner::loadBlob):
763         (WebCore::FetchBodyOwner::readableStream):
764         (WebCore::FetchBodyOwner::consumeBodyAsStream):
765         * Modules/fetch/FetchBodyOwner.h:
766         (WebCore::FetchBodyOwner::feedStream):
767         (WebCore::FetchBodyOwner::cancel):
768         * Modules/fetch/FetchBodySource.cpp: Renamed from Source/WebCore/Modules/fetch/FetchResponseSource.cpp.
769         * Modules/fetch/FetchBodySource.h: Renamed from Source/WebCore/Modules/fetch/FetchResponseSource.h.
770         * Modules/fetch/FetchResponse.cpp:
771         (WebCore::FetchResponse::consumeBodyAsStream):
772         (WebCore::FetchResponse::createReadableStream):
773         * Modules/fetch/FetchResponse.h:
774         * Modules/fetch/FetchResponse.idl:
775         * Modules/fetch/FetchResponse.js:
776         (getter.body):
777         (clone):
778         * WebCore.xcodeproj/project.pbxproj:
779         * bindings/js/ReadableStream.cpp:
780         (WebCore::ReadableStream::tee):
781         * bindings/js/ReadableStream.h:
782         * bindings/js/WebCoreBuiltinNames.h:
783
784 2017-08-31  Chris Dumez  <cdumez@apple.com>
785
786         Use WTF::crossThreadCopy() in more places
787         https://bugs.webkit.org/show_bug.cgi?id=176169
788
789         Reviewed by Andreas Kling.
790
791         Use WTF::crossThreadCopy() in more places to make code more concise.
792
793         * Modules/indexeddb/IDBValue.cpp:
794         (WebCore::IDBValue::setAsIsolatedCopy):
795
796 2017-08-31  Jer Noble  <jer.noble@apple.com>
797
798         MSE-to-Canvas painting can become "stuck" during heavy workloads
799         https://bugs.webkit.org/show_bug.cgi?id=176170
800
801         Reviewed by Eric Carlson.
802
803         During heavy workloads, the trigger from CMBufferQueue notifying us that we have dipped below
804         the "low-water mark" of decoded (and decoding) frames will not fire. Instead of using a trigger
805         (since it will not fire when the number of "frames being decoded" changes, just the number of
806         decoded frames), just call maybeBecomeReadyForMoreMediaData() whenever the number of frames in
807         the decoded queue decreases, or when the number of frames being decoded decreases.
808
809         * platform/graphics/cocoa/WebCoreDecompressionSession.h:
810         * platform/graphics/cocoa/WebCoreDecompressionSession.mm:
811         (WebCore::WebCoreDecompressionSession::maybeBecomeReadyForMoreMediaData):
812         (WebCore::WebCoreDecompressionSession::enqueueSample):
813         (WebCore::WebCoreDecompressionSession::decodeSample):
814         (WebCore::WebCoreDecompressionSession::handleDecompressionOutput):
815         (WebCore::WebCoreDecompressionSession::getFirstVideoFrame):
816         (WebCore::WebCoreDecompressionSession::automaticDequeue):
817         (WebCore::WebCoreDecompressionSession::imageForTime):
818         (WebCore::WebCoreDecompressionSession::maybeBecomeReadyForMoreMediaDataCallback): Deleted.
819
820 2017-08-31  Youenn Fablet  <youenn@apple.com>
821
822         Move consume promise from FetchBody to FetchBodyConsumer
823         https://bugs.webkit.org/show_bug.cgi?id=176121
824
825         Reviewed by Alex Christensen.
826
827         No change of behavior.
828
829         FetchBodyConsumer should be made responsible for data consumption through promise getters and ReadableStream.
830         This will allow making data consumption consistent for Request and Response.
831         This patch is doing the first step.
832
833         * Modules/fetch/FetchBody.cpp:
834         (WebCore::FetchBody::consumeOnceLoadingFinished):
835         (WebCore::FetchBody::consumeBlob):
836         (WebCore::FetchBody::loadingFailed):
837         (WebCore::FetchBody::loadingSucceeded):
838         (WebCore::FetchBody::clone const):
839         * Modules/fetch/FetchBody.h:
840         (WebCore::FetchBody::cleanConsumer):
841         (WebCore::FetchBody::cleanConsumePromise): Deleted.
842         * Modules/fetch/FetchBodyConsumer.cpp:
843         (WebCore::FetchBodyConsumer::setConsumePromise):
844         (WebCore::FetchBodyConsumer::loadingFailed):
845         (WebCore::FetchBodyConsumer::loadingSucceeded):
846         (WebCore::FetchBodyConsumer::clean):
847         * Modules/fetch/FetchBodyConsumer.h:
848         (WebCore::FetchBodyConsumer::clean): Deleted.
849         * Modules/fetch/FetchBodyOwner.cpp:
850         (WebCore::FetchBodyOwner::stop):
851
852 2017-08-22  Darin Adler  <darin@apple.com>
853
854         REGRESSION (r220052): ASSERTION FAILED: !frame().isMainFrame() || !needsStyleRecalcOrLayout()  in WebCore::FrameView::updateLayoutAndStyleIfNeededRecursive()
855         https://bugs.webkit.org/show_bug.cgi?id=175270
856
857         Reviewed by Simon Fraser and Antti Koivisto.
858
859         * dom/Document.cpp:
860         (WebCore::Document::Document): Initialize m_styleRecalcTimer with a lamdba so it can work
861         with a function that returns a bool and ignore the return value.
862         (WebCore::Document::updateStyleIfNeeded): Added a boolean return value indicating if the
863         function did any work or not.
864         * dom/Document.h: Updated for above change.
865
866         * page/FrameView.cpp:
867         (WebCore::appendRenderedChildren): Added helper that will later replace the
868         FrameView::renderedChildFrameViews function and is used below.
869         (WebCore::FrameView::updateLayoutAndStyleIfNeededRecursive): Instead of always doing two
870         passes of style and layout update do up to 25 passes, but stop as soon as a pass does
871         no work. This is slightly more efficient in cases where no layout and style update is
872         needed, and works correctly when a additional passes are needed, which is what happens
873         in the test that was failing. We can eventually improve this further, but this resolves
874         the immediate problem we are seeing in the test.
875
876 2017-08-22  Filip Pizlo  <fpizlo@apple.com>
877
878         Strings need to be in some kind of gigacage
879         https://bugs.webkit.org/show_bug.cgi?id=174924
880
881         Reviewed by Oliver Hunt.
882
883         No new tests because no new behavior.
884
885         * html/canvas/CanvasRenderingContext2D.cpp:
886         (WebCore::normalizeSpaces):
887
888 2017-08-31  Yusuke Suzuki  <utatane.tea@gmail.com>
889
890         [JSC] Use reifying system for "name" property of builtin JSFunction
891         https://bugs.webkit.org/show_bug.cgi?id=175260
892
893         Reviewed by Saam Barati.
894
895         Test: js/dom/builtin-getter-name.html
896
897         Use @getter for JSBuiltin getters.
898
899         * Modules/fetch/FetchResponse.js:
900         (bodyUsed): Deleted.
901         (body): Deleted.
902         * Modules/streams/ReadableByteStreamController.js:
903         (byobRequest): Deleted.
904         (desiredSize): Deleted.
905         * Modules/streams/ReadableStream.js:
906         (locked): Deleted.
907         * Modules/streams/ReadableStreamBYOBReader.js:
908         (closed): Deleted.
909         * Modules/streams/ReadableStreamBYOBRequest.js:
910         (view): Deleted.
911         * Modules/streams/ReadableStreamDefaultController.js:
912         (desiredSize): Deleted.
913         * Modules/streams/ReadableStreamDefaultReader.js:
914         (closed): Deleted.
915         * Modules/streams/WritableStream.js:
916         (closed): Deleted.
917         (ready): Deleted.
918         (state): Deleted.
919         * bindings/js/JSDOMBuiltinConstructor.h:
920         (WebCore::JSDOMBuiltinConstructor<JSClass>::finishCreation):
921
922 2017-08-30  Chris Dumez  <cdumez@apple.com>
923
924         Implement FileSystemDirectoryReader.readEntries()
925         https://bugs.webkit.org/show_bug.cgi?id=176091
926         <rdar://problem/34168015>
927
928         Reviewed by Andreas Kling.
929
930         Tests: editing/pasteboard/datatransfer-items-drop-directoryReader-error.html
931                editing/pasteboard/datatransfer-items-drop-directoryReader-root.html
932                editing/pasteboard/datatransfer-items-drop-directoryReader.html
933
934         * Modules/entriesapi/DOMFileSystem.cpp:
935         (WebCore::ListedChild::isolatedCopy const):
936         (WebCore::listDirectoryWithMetadata):
937         (WebCore::toFileSystemEntries):
938         (WebCore::DOMFileSystem::DOMFileSystem):
939         (WebCore::DOMFileSystem::root):
940         (WebCore::DOMFileSystem::fileAsEntry):
941         (WebCore::DOMFileSystem::evaluatePath):
942         (WebCore::DOMFileSystem::listDirectory):
943         * Modules/entriesapi/DOMFileSystem.h:
944         (WebCore::DOMFileSystem::createEntryForFile):
945         * Modules/entriesapi/DOMFileSystem.idl:
946         - Implement directory listing operation for supporting
947           FileSystemDirectoryReader::readEntries().
948         - Implement evaluatePath() operation as per:
949           - https://wicg.github.io/entries-api/#evaluate-a-path
950         - DOMFileSystem should no longer hold a strong reference to
951           the root entry and FileSystemEntry now holds a strong
952           reference to the DOMFileSystem and this would create a
953           cycle.
954
955         * Modules/entriesapi/FileSystemDirectoryEntry.cpp:
956         (WebCore::FileSystemDirectoryEntry::createReader):
957         * Modules/entriesapi/FileSystemDirectoryEntry.h:
958         * Modules/entriesapi/FileSystemDirectoryEntry.idl:
959         Have createReader() take a ScriptExecutionContext, which is needed
960         to construct a FileSystemDirectoryReader, now that FileSystemDirectoryReader
961         is an ActiveDOMObject.
962
963         * Modules/entriesapi/FileSystemDirectoryReader.cpp:
964         (WebCore::FileSystemDirectoryReader::FileSystemDirectoryReader):
965         (WebCore::FileSystemDirectoryReader::activeDOMObjectName const):
966         (WebCore::FileSystemDirectoryReader::canSuspendForDocumentSuspension const):
967         (WebCore::FileSystemDirectoryReader::readEntries):
968         * Modules/entriesapi/FileSystemDirectoryReader.h:
969         * Modules/entriesapi/FileSystemDirectoryReader.idl:
970         Provide implementation for FileSystemDirectoryReader.readEntries() as per:
971         - https://wicg.github.io/entries-api/#dom-filesystemdirectoryreader-readentries
972         For the actual directory listing operation, we ask the DOMFileSystem, which is
973         where all filesystem operations should live.
974         Also made the FileSystemDirectoryReader an ActiveDOMObject to keep it and its
975         wrapper alive while a file system operation is pending.
976
977         * Modules/entriesapi/FileSystemEntry.cpp:
978         (WebCore::FileSystemEntry::~FileSystemEntry):
979         (WebCore::FileSystemEntry::filesystem const):
980         * Modules/entriesapi/FileSystemEntry.h:
981         Make FileSystemEntry keep a strong reference to its DOMFileSystem object.
982         Previously, the DOMFileSystem was kept alive by the DataTransferItem but
983         this was unsafe because FileSystemEntry may outlive the DataTransferItem.
984
985         * dom/ActiveDOMObject.h:
986         (WebCore::ActiveDOMObject::PendingActivity::PendingActivity):
987         (WebCore::ActiveDOMObject::PendingActivity::~PendingActivity):
988         (WebCore::ActiveDOMObject::makePendingActivity):
989         Add PendingActivity / makePendingActivity() as a less error-prone
990         replacement for setPendingActivity() / unsetPendingActivity().
991
992         * dom/DOMException.cpp:
993         (WebCore::DOMException::create):
994         * dom/DOMException.h:
995         Add factory to construct a DOMException from an Exception.
996
997         * dom/DataTransferItem.cpp:
998         (WebCore::DataTransferItem::getAsEntry const):
999         * dom/DataTransferItem.h:
1000
1001         * dom/Exception.h:
1002         (WebCore::Exception::isolatedCopy const):
1003         * dom/ExceptionOr.h:
1004         Make ExceptionOr<> / Exception work with CrossThreadCopier for convenience.
1005
1006         * html/FileListCreator.cpp:
1007         (WebCore::FileListCreator::FileListCreator):
1008         Use crossThreadCopy() instead of longer form.
1009
1010         * platform/FileSystem.h:
1011         * platform/glib/FileSystemGlib.cpp:
1012         (WebCore::pathByAppendingComponents):
1013         * platform/posix/FileSystemPOSIX.cpp:
1014         (WebCore::pathByAppendingComponents):
1015         * platform/win/FileSystemWin.cpp:
1016         (WebCore::pathByAppendingComponents):
1017         Add pathByAppendingComponents() utility function, which is similar to
1018         pathByAppendingComponent() but supports appending multiple components
1019         in an efficient fashion.
1020
1021 2017-08-30  Antti Koivisto  <antti@apple.com>
1022
1023         Factor RenderMultiColumnFlowThread construction and destruction into RenderTreeUpdater helper
1024         https://bugs.webkit.org/show_bug.cgi?id=176130
1025
1026         Reviewed by Zalan Bujtas.
1027
1028         Move mutation code out of the render tree.
1029
1030         * WebCore.xcodeproj/project.pbxproj:
1031         * rendering/RenderBlockFlow.cpp:
1032         (WebCore::RenderBlockFlow::createMultiColumnFlowThread): Deleted.
1033         (WebCore::RenderBlockFlow::destroyMultiColumnFlowThread): Deleted.
1034         * rendering/RenderBlockFlow.h:
1035         * style/RenderTreeUpdater.cpp:
1036         (WebCore::RenderTreeUpdater::commit):
1037         (WebCore::RenderTreeUpdater::updateAfterDescendants):
1038         (WebCore::updateMultiColumnFlowThread): Deleted.
1039         * style/RenderTreeUpdater.h:
1040         * style/RenderTreeUpdaterMultiColumn.cpp: Added.
1041         (WebCore::RenderTreeUpdater::MultiColumn::update):
1042         (WebCore::RenderTreeUpdater::MultiColumn::createFlowThread):
1043         * style/RenderTreeUpdaterMultiColumn.h: Added.
1044
1045 2017-08-30  Myles C. Maxfield  <mmaxfield@apple.com>
1046
1047         Previous elements with lang= can affect fonts selected for subsequent elements
1048         https://bugs.webkit.org/show_bug.cgi?id=175959
1049         <rdar://problem/33785853>
1050
1051         Reviewed by Zalan Bujtas.
1052
1053         FontCascade::update() was erroneously getting a cache hit. Elements with different lang=
1054         should be distinct inside the FontCascadeCache. We should be keying off of the locale
1055         string instead of the script enum because the string is the thing we actually pass to the
1056         platform APIs when performing font selection. This is a regression because we only
1057         recently (within the past few years) started making font selection sensitive to lang= at
1058         all.
1059
1060         Test: fast/text/lang-font-selection-cache.html
1061
1062         * platform/graphics/FontCache.h:
1063         (WebCore::FontDescriptionKey::FontDescriptionKey):
1064         (WebCore::FontDescriptionKey::operator== const):
1065         (WebCore::FontDescriptionKey::computeHash const):
1066
1067 2017-08-30  Ryan Haddad  <ryanhaddad@apple.com>
1068
1069         Unreviewed, rolling out r221327.
1070
1071         This change caused test262 failures.
1072
1073         Reverted changeset:
1074
1075         "[JSC] Use reifying system for "name" property of builtin
1076         JSFunction"
1077         https://bugs.webkit.org/show_bug.cgi?id=175260
1078         http://trac.webkit.org/changeset/221327
1079
1080 2017-08-30  Youenn Fablet  <youenn@apple.com>
1081
1082         [Cache API] Support cache names persistency
1083         https://bugs.webkit.org/show_bug.cgi?id=175995
1084
1085         Reviewed by Alex Christensen.
1086
1087         Test: http/tests/cache-storage/cache-persistency.https.html
1088
1089         Adding method to clear the memory representation of the cache storage.
1090         Exposing it as internals so that layout tests can be used for testing persistency by combining clearing and private browsing mode.
1091
1092         Introducing ReadDisk and WriteDisk errors that are used by CacheStorage::Engine.
1093
1094         * Modules/cache/CacheStorageConnection.h:
1095         (WebCore::CacheStorageConnection::clearMemoryRepresentation):
1096         * Modules/cache/DOMCache.cpp:
1097         (WebCore::DOMCache::errorToException):
1098         * Modules/cache/DOMCache.h:
1099         * testing/Internals.cpp:
1100         (WebCore::Internals::clearCacheStorageMemoryRepresentation):
1101         * testing/Internals.h:
1102         * testing/Internals.idl:
1103
1104 2017-08-30  Matt Lewis  <jlewis3@apple.com>
1105
1106         Unreviewed, rolling out r221384.
1107
1108         This patch caused multiple 32-bit JSC test failures.
1109
1110         Reverted changeset:
1111
1112         "Strings need to be in some kind of gigacage"
1113         https://bugs.webkit.org/show_bug.cgi?id=174924
1114         http://trac.webkit.org/changeset/221384
1115
1116 2017-08-30  Brady Eidson  <beidson@apple.com>
1117
1118         Add "Identified" base class to replace a whole bunch of custom identifier generators.
1119         https://bugs.webkit.org/show_bug.cgi?id=176120
1120
1121         Reviewed by Alex Christensen.
1122
1123         No new tests (No behavior change).
1124
1125         Instead of repeating the common pattern of a class with an integer identifier keeping its
1126         own static counter of the next identifier and generating it for each instance, this
1127         uses a common template in WTF that does that automatically.
1128
1129         * Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp:
1130         (WebCore::IDBServer::UniqueIDBDatabaseConnection::UniqueIDBDatabaseConnection):
1131         (WebCore::IDBServer::UniqueIDBDatabaseConnection::connectionPendingCloseFromClient):
1132         (WebCore::IDBServer::UniqueIDBDatabaseConnection::connectionClosedFromClient):
1133         (WebCore::IDBServer::UniqueIDBDatabaseConnection::confirmDidCloseFromServer):
1134         (WebCore::IDBServer::UniqueIDBDatabaseConnection::didFireVersionChangeEvent):
1135         (WebCore::IDBServer::UniqueIDBDatabaseConnection::didFinishHandlingVersionChange):
1136         (WebCore::IDBServer::UniqueIDBDatabaseConnection::createVersionChangeTransaction):
1137         (WebCore::IDBServer::UniqueIDBDatabaseConnection::establishTransaction):
1138         (WebCore::IDBServer::UniqueIDBDatabaseConnection::didAbortTransaction):
1139         (WebCore::IDBServer::UniqueIDBDatabaseConnection::didCommitTransaction):
1140         (WebCore::IDBServer::nextDatabaseConnectionIdentifier): Deleted.
1141         * Modules/indexeddb/server/UniqueIDBDatabaseConnection.h:
1142         (WebCore::IDBServer::UniqueIDBDatabaseConnection::identifier const): Deleted.
1143
1144         * workers/service/ServiceWorkerJobData.cpp:
1145         (WebCore::ServiceWorkerJobData::ServiceWorkerJobData):
1146         (WebCore::ServiceWorkerJobData::isolatedCopy const):
1147         * workers/service/ServiceWorkerJobData.h:
1148         (WebCore::ServiceWorkerJobData::encode const):
1149         (WebCore::ServiceWorkerJobData::decode):
1150         (WebCore::ServiceWorkerJobData::identifier const): Deleted.
1151
1152         * workers/service/server/SWServer.cpp:
1153         (WebCore::SWServer::Connection::Connection):
1154         * workers/service/server/SWServer.h:
1155         (WebCore::SWServer::Connection::identifier const): Deleted.
1156
1157         * workers/service/server/SWServerRegistration.cpp:
1158         (WebCore::SWServerRegistration::SWServerRegistration):
1159         (WebCore::SWServerRegistration::data const):
1160         * workers/service/server/SWServerRegistration.h:
1161         (WebCore::SWServerRegistration::identifier const): Deleted.
1162
1163 2017-08-30  Youenn Fablet  <youenn@apple.com>
1164
1165         Remove FetchRequest::InternalRequest
1166         https://bugs.webkit.org/show_bug.cgi?id=176085
1167
1168         Reviewed by Alex Christensen.
1169
1170         No change of behavior.
1171
1172         Removing InternalRequest struct and passing/defining fields directly.
1173
1174         * Modules/cache/Cache.cpp:
1175         (WebCore::Cache::updateRecords):
1176         * Modules/fetch/FetchRequest.cpp:
1177         (WebCore::computeReferrer):
1178         (WebCore::buildOptions):
1179         (WebCore::methodCanHaveBody):
1180         (WebCore::FetchRequest::initializeOptions):
1181         (WebCore::FetchRequest::initializeWith):
1182         (WebCore::FetchRequest::setBody):
1183         (WebCore::FetchRequest::create):
1184         (WebCore::FetchRequest::referrer const):
1185         (WebCore::FetchRequest::urlString const):
1186         (WebCore::FetchRequest::resourceRequest const):
1187         (WebCore::FetchRequest::clone):
1188         (WebCore::setReferrer): Deleted.
1189         * Modules/fetch/FetchRequest.h:
1190         (WebCore::FetchRequest::FetchRequest):
1191         (WebCore::FetchRequest::cache const):
1192         (WebCore::FetchRequest::credentials const):
1193         (WebCore::FetchRequest::destination const):
1194         (WebCore::FetchRequest::mode const):
1195         (WebCore::FetchRequest::redirect const):
1196         (WebCore::FetchRequest::referrerPolicy const):
1197         (WebCore::FetchRequest::type const):
1198
1199 2017-08-30  Youenn Fablet  <youenn@apple.com>
1200
1201         Add support for FetchRequest.body
1202         https://bugs.webkit.org/show_bug.cgi?id=176066
1203         <rdar://problem/34148373>
1204
1205         Reviewed by Sam Weinig and Alex Christensen.
1206
1207         Follow-up to https://trac.webkit.org/r221329 as per post landing comments.
1208         Returning a RefPtr<ReadableStream> so as to to not specialize ReadableStream converter.
1209
1210         * Modules/fetch/FetchBodyOwner.cpp:
1211         (WebCore::FetchBodyOwner::readableStream):
1212         * Modules/fetch/FetchBodyOwner.h:
1213         * bindings/js/ReadableStream.h:
1214         (WebCore::toJS):
1215         (WebCore::JSConverter<IDLInterface<ReadableStream>>::convert): Deleted.
1216
1217 2017-08-30  Per Arne Vollan  <pvollan@apple.com>
1218
1219         [Win] Crash in MathML layout test.
1220         https://bugs.webkit.org/show_bug.cgi?id=176109
1221
1222         Reviewed by Brent Fulgham.
1223
1224         Return early if no font can be found for code point.
1225
1226         No new tests, covered by existing tests. 
1227
1228         * rendering/mathml/MathOperator.cpp:
1229         (WebCore::MathOperator::paintVerticalGlyphAssembly):
1230         (WebCore::MathOperator::paintHorizontalGlyphAssembly):
1231
1232 2017-08-30  Brady Eidson  <beidson@apple.com>
1233
1234         Implement all of "Register" right up until where the script is fetched.
1235         https://bugs.webkit.org/show_bug.cgi?id=176082
1236
1237         Reviewed by Andy Estes.
1238
1239         Test: http/tests/workers/service/basic-register-exceptions.html
1240
1241         This patch implements every detail of the "Register" and "Update" algorithms right up to
1242         where we would actually fetch the service worker script file.
1243
1244         It also includes miscellaneous refactoring and cleanup along the way.
1245
1246         * CMakeLists.txt:
1247         * WebCore.xcodeproj/project.pbxproj:
1248
1249         * page/SecurityOrigin.cpp:
1250         (WebCore::shouldTreatAsPotentiallyTrustworthy): Expose in the header for other files to use.
1251         * page/SecurityOrigin.h:
1252
1253         * workers/service/ServiceWorkerContainer.cpp:
1254         (WebCore::ServiceWorkerContainer::addRegistration): Add some more exception cases from the spec.
1255         (WebCore::ServiceWorkerContainer::scheduleJob): Use the correct job identifier.
1256         (WebCore::ServiceWorkerContainer::jobFailedWithException):
1257         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
1258         (WebCore::ServiceWorkerContainer::jobDidFinish):
1259         * workers/service/ServiceWorkerContainer.h:
1260
1261         * workers/service/ServiceWorkerJob.cpp:
1262         (WebCore::ServiceWorkerJob::ServiceWorkerJob):
1263         (WebCore::ServiceWorkerJob::failedWithException): Call through to the client to handle the failure.
1264         (WebCore::ServiceWorkerJob::resolvedWithRegistration): Call through to the client to handle success.
1265         * workers/service/ServiceWorkerJob.h:
1266         (WebCore::ServiceWorkerJob::promise):
1267         (WebCore::ServiceWorkerJob::identifier const): Deleted. Rely on the identifier from the JobData.
1268
1269         * workers/service/ServiceWorkerJobClient.h:
1270
1271         * workers/service/ServiceWorkerJobData.cpp:
1272         (WebCore::ServiceWorkerJobData::ServiceWorkerJobData):
1273         (WebCore::ServiceWorkerJobData::isolatedCopy const):
1274         * workers/service/ServiceWorkerJobData.h:
1275         (WebCore::ServiceWorkerJobData::identifier const):
1276         (WebCore::ServiceWorkerJobData::encode const):
1277         (WebCore::ServiceWorkerJobData::decode):
1278         (WebCore::ServiceWorkerJobData::jobIdentifier const): Deleted.
1279
1280         * workers/service/ServiceWorkerRegistration.cpp:
1281         (WebCore::ServiceWorkerRegistration::ServiceWorkerRegistration): Make this class an ActiveDOMObject
1282           both because it *is* an active DOM object and because we need to get at the ScriptExecutionContext.
1283         * workers/service/ServiceWorkerRegistration.h:
1284
1285         Add a class to encapsulate everything about a registration for encode/decode/crossthread:
1286         * workers/service/ServiceWorkerRegistrationData.cpp:
1287         (WebCore::ServiceWorkerRegistrationData::isolatedCopy const):
1288         * workers/service/ServiceWorkerRegistrationData.h: 
1289         (WebCore::ServiceWorkerRegistrationData::encode const):
1290         (WebCore::ServiceWorkerRegistrationData::decode):
1291
1292         * workers/service/ServiceWorkerRegistrationKey.cpp:
1293         (WebCore::ServiceWorkerRegistrationKey::isolatedCopy const):
1294         * workers/service/ServiceWorkerRegistrationKey.h:
1295         (WebCore::ServiceWorkerRegistrationKey::encode const):
1296         (WebCore::ServiceWorkerRegistrationKey::decode):
1297
1298         * workers/service/server/SWClientConnection.cpp:
1299         (WebCore::SWClientConnection::scheduleJob):
1300         (WebCore::SWClientConnection::jobResolvedInServer):
1301         * workers/service/server/SWClientConnection.h:
1302
1303         * workers/service/server/SWServer.cpp:
1304         (WebCore::SWServer::~SWServer):
1305         (WebCore::SWServer::Connection::scheduleJobInServer):
1306         (WebCore::SWServer::scheduleJob):
1307         (WebCore::SWServer::rejectJob):
1308         (WebCore::SWServer::resolveJob):
1309         * workers/service/server/SWServer.h:
1310
1311         * workers/service/server/SWServerRegistration.cpp:
1312         (WebCore::SWServerRegistration::SWServerRegistration):
1313         (WebCore::SWServerRegistration::startNextJob):
1314         (WebCore::SWServerRegistration::isEmpty):
1315         (WebCore::SWServerRegistration::getNewestWorker): Implement "Get Newest Worker" algorithm.
1316         (WebCore::SWServerRegistration::runRegisterJob): Implement the rest of the "Register" algorithm.
1317         (WebCore::SWServerRegistration::runUpdateJob): Implement every part of "Update" up to where we would fetch.
1318         (WebCore::SWServerRegistration::rejectWithExceptionOnMainThread):
1319         (WebCore::SWServerRegistration::resolveWithRegistrationOnMainThread):
1320         (WebCore::SWServerRegistration::resolveCurrentJob):
1321         (WebCore::SWServerRegistration::data const):
1322         (WebCore::SWServerRegistration::performCurrentJob): Deleted.
1323         * workers/service/server/SWServerRegistration.h:
1324         (WebCore::SWServerRegistration::identifier const):
1325
1326         Add a stub class to represent "active service workers" in the SWServer:
1327         * workers/service/server/SWServerWorker.cpp:
1328         (WebCore::SWServerWorker::SWServerWorker):
1329         (WebCore::SWServerWorker::~SWServerWorker):
1330         * workers/service/server/SWServerWorker.h: 
1331         (WebCore::SWServerWorker::scriptURL const):
1332
1333 2017-08-30  Don Olmstead  <don.olmstead@sony.com>
1334
1335         [CMake][WinCairo] Use find_package for libpng and libjpeg
1336         https://bugs.webkit.org/show_bug.cgi?id=176113
1337
1338         Reviewed by Alex Christensen.
1339
1340         No new tests. No change in behavior.
1341
1342         * PlatformWinCairo.cmake:
1343         * platform/ImageDecoders.cmake:
1344
1345 2017-08-22  Matt Rajca  <mrajca@apple.com>
1346
1347         Opt all Mac clients into document-level media user gesture quirks.
1348         https://bugs.webkit.org/show_bug.cgi?id=175831
1349
1350         This un-breaks many of the sites that take a long time to load video ad elements on-demand.
1351
1352         Reviewed by Eric Carlson.
1353
1354         Test: media/document-level-media-user-gesture-quirk.html
1355
1356         * html/MediaElementSession.cpp:
1357         (WebCore::MediaElementSession::playbackPermitted const):
1358         (WebCore::needsDocumentLevelMediaUserGestureQuirk): Deleted.
1359
1360 2017-08-22  Filip Pizlo  <fpizlo@apple.com>
1361
1362         Strings need to be in some kind of gigacage
1363         https://bugs.webkit.org/show_bug.cgi?id=174924
1364
1365         Reviewed by Oliver Hunt.
1366
1367         No new tests because no new behavior.
1368
1369         * html/canvas/CanvasRenderingContext2D.cpp:
1370         (WebCore::normalizeSpaces):
1371
1372 2017-08-30  Andy Estes  <aestes@apple.com>
1373
1374         [Mac] Upstream Accessibility-related WebKitSystemInterface functions
1375         https://bugs.webkit.org/show_bug.cgi?id=176093
1376
1377         Reviewed by Eric Carlson.
1378
1379         * accessibility/mac/AXObjectCacheMac.mm:
1380         (WebCore::AXObjectCache::platformHandleFocusedUIElementChanged):
1381         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1382         (-[WebAccessibilityObjectWrapper unregisterUniqueIdForUIElement]):
1383         (AXObjectIsTextMarker):
1384         (AXObjectIsTextMarkerRange):
1385         (AXTextMarkerRange):
1386         (AXTextMarkerRangeStart):
1387         (AXTextMarkerRangeEnd):
1388         (getBytesFromAXTextMarker):
1389         (isTextMarkerIgnored):
1390         (accessibilityObjectForTextMarker):
1391         (startOrEndTextmarkerForRange):
1392         (nextTextMarkerForCharacterOffset):
1393         (previousTextMarkerForCharacterOffset):
1394         (textMarkerForCharacterOffset):
1395         (characterOffsetForTextMarker):
1396         (textMarkerForVisiblePosition):
1397         (-[WebAccessibilityObjectWrapper textMarkerForFirstPositionInTextControl:]):
1398         (visiblePositionForTextMarker):
1399         (AXAttributeStringSetElement):
1400         * platform/mac/WebCoreSystemInterface.h:
1401         * platform/mac/WebCoreSystemInterface.mm:
1402
1403 2017-08-30  Antti Koivisto  <antti@apple.com>
1404
1405         RenderMultiColumnFlowThread - Avoid render tree mutation during layout
1406         https://bugs.webkit.org/show_bug.cgi?id=176026
1407         <rdar://problem/33402891>
1408
1409         Reviewed by Zalan Bujtas.
1410
1411         Mutations should be done in RenderTreeUpdater.
1412
1413         * rendering/RenderBlockFlow.cpp:
1414         (WebCore::RenderBlockFlow::willCreateColumns const):
1415
1416             Don't create columns for RenderSVGBlock. Before this patch this was avoided because it
1417             has custom layout() function that doesn't call to setComputedColumnCountAndWidth.
1418             Same for mathml and ruby.
1419
1420             Don't create columns for pseudo elements (first-letter mostly).
1421
1422         (WebCore::RenderBlockFlow::setComputedColumnCountAndWidth):
1423
1424             This now assumes that the multicolumn renderer has been initialized correctly already.
1425
1426         * rendering/RenderBlockFlow.h:
1427         * style/RenderTreeUpdater.cpp:
1428         (WebCore::updateMultiColumnFlowThread):
1429
1430             Create or delte multicolumn renderer after descendants are known.
1431
1432         (WebCore::RenderTreeUpdater::commit):
1433         (WebCore::RenderTreeUpdater::updateAfterDescendants):
1434
1435 2017-08-30  Said Abou-Hallawa  <sabouhallawa@apple.com>
1436
1437         The SVG fragment identifier is not respected if it is a part of an HTTP URL
1438         https://bugs.webkit.org/show_bug.cgi?id=163811
1439
1440         Reviewed by Darin Adler.
1441
1442         If an image is referenced more than once in a page and the URL to that
1443         image is an HTTP URL, one CachedImage is created for all the renderers
1444         even if the original URLs have different fragmentIdentifiers. In this
1445         case the fragment will be removed from the request which is associated
1446         with the shared CachedImage. This CachedImage creates an SVGImage with
1447         a URL but without a fragmentIdentifier. So SVGImage::draw() does not call
1448         FrameView::scrollToFragment() and therefore the viewport is not setup
1449         correctly for displaying the SVG in this case.
1450
1451         The fix is to move the url from the SVGImage to SVGImageForContainer.
1452         Because there is one SVGImageForContainer created for every renderer,
1453         we can move the full URL there. The drawing of an SVGImage has to start
1454         from the SVGImageForContainer::draw() because the SVGImage may not have
1455         an intrinsic size and the SVGImageForContainer is the one which knows
1456         the destination rectangle. So SVGImageForContainer can pass the full url
1457         to SVGImage::drawForContainer() which can be used to scrollToFragment()
1458         before calling SVGImage::draw().
1459         
1460         For clarity and consistency, all setContainerSizeForRenderer() will be 
1461         changed to setContainerContext() and the pair SizeAndZoom will be replaced
1462         by the struct ContainerContext.
1463
1464         Tests: http/tests/svg/svg-fragment-background.html
1465                http/tests/svg/svg-fragment-image.html
1466
1467         * css/CSSCursorImageValue.h:
1468         * css/CSSImageSetValue.cpp:
1469         (WebCore::CSSImageSetValue::fillImageSet):
1470         * css/CSSImageSetValue.h:
1471         * loader/cache/CachedImage.cpp:
1472         (WebCore::CachedImage::didRemoveClient):
1473         (WebCore::CachedImage::switchClientsToRevalidatedResource):
1474         (WebCore::CachedImage::allClientsRemoved):
1475         (WebCore::CachedImage::setContainerContextForClient):
1476         (WebCore::CachedImage::clear):
1477         (WebCore::CachedImage::createImage):
1478         (WebCore::CachedImage::setContainerSizeForRenderer): Deleted.
1479         * loader/cache/CachedImage.h:
1480         * rendering/RenderBoxModelObject.cpp:
1481         (WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry const):
1482         (WebCore::RenderBoxModelObject::paintNinePieceImage):
1483         * rendering/RenderImage.cpp:
1484         (WebCore::RenderImage::updateInnerContentRect):
1485         (WebCore::RenderImage::repaintOrMarkForLayout):
1486         * rendering/RenderImageResource.cpp:
1487         (WebCore::RenderImageResource::setContainerContext):
1488         (WebCore::RenderImageResource::setContainerSizeForRenderer): Deleted.
1489         * rendering/RenderImageResource.h:
1490         * rendering/RenderImageResourceStyleImage.cpp:
1491         (WebCore::RenderImageResourceStyleImage::setContainerContext):
1492         (WebCore::RenderImageResourceStyleImage::setContainerSizeForRenderer): Deleted.
1493         * rendering/RenderImageResourceStyleImage.h:
1494         * rendering/RenderListMarker.cpp:
1495         (WebCore::RenderListMarker::updateContent):
1496         * rendering/shapes/ShapeOutsideInfo.cpp:
1497         (WebCore::ShapeOutsideInfo::createShapeForImage const):
1498         * rendering/style/StyleCachedImage.cpp:
1499         (WebCore::StyleCachedImage::imageURL):
1500         (WebCore::StyleCachedImage::setContainerContextForRenderer):
1501         (WebCore::StyleCachedImage::setContainerSizeForRenderer): Deleted.
1502         * rendering/style/StyleCachedImage.h:
1503         * rendering/style/StyleGeneratedImage.h:
1504         * rendering/style/StyleImage.h:
1505         * rendering/svg/RenderSVGImage.cpp:
1506         (WebCore::RenderSVGImage::updateImageViewport):
1507         * svg/SVGImageElement.h:
1508         * svg/graphics/SVGImage.cpp:
1509         (WebCore::SVGImage::SVGImage):
1510         (WebCore::SVGImage::drawForContainer):
1511         (WebCore::SVGImage::drawPatternForContainer):
1512         (WebCore::SVGImage::draw):
1513         (WebCore::SVGImage::dump const): Deleted.
1514         * svg/graphics/SVGImage.h:
1515         * svg/graphics/SVGImageCache.cpp:
1516         (WebCore::SVGImageCache::setContainerContextForClient):
1517         (WebCore::SVGImageCache::setContainerSizeForRenderer): Deleted.
1518         * svg/graphics/SVGImageCache.h:
1519         * svg/graphics/SVGImageForContainer.cpp:
1520         (WebCore::SVGImageForContainer::size const):
1521         (WebCore::SVGImageForContainer::draw):
1522         (WebCore::SVGImageForContainer::drawPattern):
1523         * svg/graphics/SVGImageForContainer.h:
1524
1525 2017-08-29  Wenson Hsieh  <wenson_hsieh@apple.com>
1526
1527         REGRESSION(r210287) On drop, event.dataTransfer.getData("text") returns an empty string when dragging an image
1528         https://bugs.webkit.org/show_bug.cgi?id=170637
1529         <rdar://problem/31347248>
1530
1531         Reviewed by Ryosuke Niwa.
1532
1533         In r210287, the behavior of DragData::containsFiles was changed to return true if NSFilesPromisePboardType is
1534         present in the pasteboard. This means that we will consider images dragged from web content, for which we add
1535         the NSFilesPromisePboardType UTI, as containing files on the pasteboard; this, in turn, means we'll initialize
1536         the DataTransfer upon drop with m_forFileDrag set to true. Due to early returns in getData() and setData() to
1537         deny data access when dropping a dragged file, this means the page won't ever get access to the URL in the
1538         pasteboard due to the presence of the NSFilesPromisePboardType UTI.
1539
1540         To fix this, we replace the early m_forFileDrag returns in getData and setData, instead early returning the null
1541         string if there are any file URLs present on the pasteboard (determined via readFilenames() retrieving a non-
1542         empty result).
1543
1544         Test: editing/pasteboard/drag-drop-href-as-text-data.html
1545
1546         * dom/DataTransfer.cpp:
1547         (WebCore::DataTransfer::DataTransfer):
1548         (WebCore::DataTransfer::getData const):
1549         (WebCore::DataTransfer::setData):
1550
1551         Rather than bail upon forFileDrag() (formerly, m_forFileDrag) being true, bail if there are any file URLs
1552         present on the pasteboard. It seems like this was the intention of the early return in the first place, to
1553         prevent the page from being able to ask for a real file URL when dragging a file.
1554
1555         (WebCore::DataTransfer::files const):
1556         (WebCore::DataTransfer::setDragImage):
1557         (WebCore::DataTransfer::setDropEffect):
1558         (WebCore::DataTransfer::setEffectAllowed):
1559
1560         Swap m_forDrag and m_forFileDrag with forDrag() and forFileDrag(), respectively.
1561
1562         * dom/DataTransfer.h:
1563         (WebCore::DataTransfer::forDrag const):
1564         (WebCore::DataTransfer::forFileDrag const):
1565
1566         Instead of caching two bools to represent state (m_forDrag and m_forFileDrag), just remember the DataTransfer's
1567         m_type and turn the flags into const helpers that check for the value of m_type.
1568
1569 2017-08-29  Youenn Fablet  <youenn@apple.com>
1570
1571         [Fetch API] Request should throw when keep alive is true and body is a ReadableStream
1572         https://bugs.webkit.org/show_bug.cgi?id=176083
1573
1574         Reviewed by Alex Christensen.
1575
1576         Covered by rebased test.
1577
1578         * Modules/fetch/FetchRequest.cpp:
1579         (WebCore::FetchRequest::setBody):
1580
1581 2017-08-29  Don Olmstead  <don.olmstead@sony.com>
1582
1583         [CMake] Use find_package for zlib
1584         https://bugs.webkit.org/show_bug.cgi?id=176075
1585
1586         Reviewed by Alex Christensen.
1587
1588         No new tests. No change in behavior.
1589
1590         * CMakeLists.txt:
1591         * PlatformAppleWin.cmake:
1592         * PlatformMac.cmake:
1593         * PlatformWinCairo.cmake:
1594
1595 2017-08-29  Devin Rousso  <webkit@devinrousso.com>
1596
1597         CallTracingCallback should ignore `readonly attribute`
1598         https://bugs.webkit.org/show_bug.cgi?id=176070
1599
1600         Reviewed by Matt Baker.
1601
1602         Update existing tests to remove calls to existing readonly attributes.
1603
1604         * bindings/scripts/CodeGeneratorJS.pm:
1605         (GenerateAttributeGetterBodyDefinition):
1606         If the attribute is marked `readonly` do not add logic for the `CallTracingCallback`.
1607
1608         * bindings/scripts/test/TestCallTracer.idl:
1609         * bindings/scripts/test/JS/JSTestCallTracer.cpp:
1610         (WebCore::JSTestCallTracerConstructor::initializeProperties):
1611         (WebCore::jsTestCallTracerTestReadonlyAttributeGetter):
1612         (WebCore::jsTestCallTracerTestReadonlyAttribute):
1613
1614 2017-08-29  Said Abou-Hallawa  <sabouhallawa@apple.com>
1615
1616         Assertion failure when opening a file with a missing tag closing bracket
1617         https://bugs.webkit.org/show_bug.cgi?id=176061
1618
1619         Reviewed by Darin Adler.
1620
1621         If a tag is missing its closing bracket, the tokenizer just needs to advance()
1622         the character position without checking m_currentCharacter != '\n'. Newline
1623         character is a valid ending for partially closed tags.
1624
1625         Test: fast/tokenizer/missing-script-tag-closing-bracket.html
1626
1627         * html/parser/HTMLTokenizer.cpp:
1628         (WebCore::HTMLTokenizer::commitToPartialEndTag):
1629
1630 2017-08-29  Brady Eidson  <beidson@apple.com>
1631
1632         Rename "potentionally trustworthy" to "potentially trustworthy"
1633         https://bugs.webkit.org/show_bug.cgi?id=176081
1634
1635         Reviewed by Daniel Bates.
1636
1637         The Secure Context spec refers to this as "potentially trustworthy"
1638         
1639         It's possible that this was done potentionally, but we should follow the spec to alleviate confusion.
1640
1641         * dom/Document.cpp:
1642         (WebCore::Document::isSecureContext const):
1643         * page/SecurityOrigin.cpp:
1644         (WebCore::shouldTreatAsPotentiallyTrustworthy):
1645         (WebCore::shouldTreatAsPotentionallyTrustworthy): Deleted.
1646         * page/SecurityOrigin.h:
1647         (WebCore::SecurityOrigin::isPotentiallyTrustworthy const):
1648         (WebCore::SecurityOrigin::isPotentionallyTrustworthy const): Deleted.
1649         * workers/WorkerGlobalScope.cpp:
1650         (WebCore::WorkerGlobalScope::isSecureContext const):
1651
1652 2017-08-29  Youenn Fablet  <youenn@apple.com>
1653
1654         Add support for FetchRequest.body
1655         https://bugs.webkit.org/show_bug.cgi?id=176066
1656
1657         Reviewed by Alex Christensen.
1658
1659         Covered by existing tests.
1660
1661         Adding support for body attribute getter for FetchRequest.
1662         To do so, FetchRequest will need to create a ReadableStream.
1663         Adding support for DOM based creation of ReadableStream and conversion to JS values.
1664         Small refactoring to make names more consistent.
1665
1666         * CMakeLists.txt:
1667         * Modules/beacon/NavigatorBeacon.cpp:
1668         (WebCore::NavigatorBeacon::sendBeacon):
1669         * Modules/cache/Cache.cpp:
1670         (WebCore::Cache::put):
1671         * Modules/fetch/FetchBody.cpp:
1672         (WebCore::FetchBody::extract):
1673         * Modules/fetch/FetchBody.h:
1674         (WebCore::FetchBody::hasReadableStream const):
1675         (WebCore::FetchBody::readableStream):
1676         (WebCore::FetchBody::setReadableStream):
1677         (WebCore::FetchBody::FetchBody):
1678         (WebCore::FetchBody::isReadableStream const): Deleted.
1679         (WebCore::FetchBody::setAsReadableStream): Deleted.
1680         * Modules/fetch/FetchBody.idl:
1681         * Modules/fetch/FetchBodyOwner.cpp:
1682         (WebCore::FetchBodyOwner::readableStream):
1683         * Modules/fetch/FetchBodyOwner.h:
1684         (WebCore::FetchBodyOwner::hasReadableStreamBody const):
1685         (WebCore::FetchBodyOwner::isReadableStreamBody const): Deleted.
1686         * Modules/fetch/FetchRequest.cpp:
1687         (WebCore::FetchRequest::setBody):
1688         * Modules/fetch/FetchRequest.h:
1689         * Modules/fetch/FetchResponse.cpp:
1690         (WebCore::FetchResponse::setBodyAsReadableStream):
1691         (WebCore::FetchResponse::fetch):
1692         * Modules/fetch/FetchResponse.h:
1693         * WebCore.xcodeproj/project.pbxproj:
1694         * bindings/js/ReadableStream.h:
1695         (WebCore::JSConverter<IDLInterface<ReadableStream>>::convert):
1696
1697 2017-08-29  Yusuke Suzuki  <utatane.tea@gmail.com>
1698
1699         [JSC] Use reifying system for "name" property of builtin JSFunction
1700         https://bugs.webkit.org/show_bug.cgi?id=175260
1701
1702         Reviewed by Saam Barati.
1703
1704         Use @getter for JSBuiltin getters.
1705
1706         * Modules/fetch/FetchResponse.js:
1707         (bodyUsed): Deleted.
1708         (body): Deleted.
1709         * Modules/streams/ReadableByteStreamController.js:
1710         (byobRequest): Deleted.
1711         (desiredSize): Deleted.
1712         * Modules/streams/ReadableStream.js:
1713         (locked): Deleted.
1714         * Modules/streams/ReadableStreamBYOBReader.js:
1715         (closed): Deleted.
1716         * Modules/streams/ReadableStreamBYOBRequest.js:
1717         (view): Deleted.
1718         * Modules/streams/ReadableStreamDefaultController.js:
1719         (desiredSize): Deleted.
1720         * Modules/streams/ReadableStreamDefaultReader.js:
1721         (closed): Deleted.
1722         * Modules/streams/WritableStream.js:
1723         (closed): Deleted.
1724         (ready): Deleted.
1725         (state): Deleted.
1726         * bindings/js/JSDOMBuiltinConstructor.h:
1727         (WebCore::JSDOMBuiltinConstructor<JSClass>::finishCreation):
1728
1729 2017-08-29  Andy Estes  <aestes@apple.com>
1730
1731         REGRESSION (r215290): "Where From" metadata is empty when dragging an image out of Safari
1732         https://bugs.webkit.org/show_bug.cgi?id=176068
1733
1734         Reviewed by Wenson Hsieh.
1735
1736         If you drag an image out of Safari, drop it on the Desktop, and open "Get Info", there is a
1737         "Where from:" field under "More Info" that should list the image's URL. After r215290, this
1738         field is blank due to a mixup with the string passed to URLWithUserTypedString().
1739
1740         Fix this by passing metadataURLString to URLWithUserTypedString() instead of urlString.
1741
1742         Not possible to reliably test this since WebKit adds metadata on a global concurrent queue.
1743
1744         * platform/mac/FileSystemMac.mm:
1745         (WebCore::setMetadataURL):
1746
1747 2017-08-29  Youenn Fablet  <youenn@apple.com>
1748
1749         CacheStorage does not need to sort its caches
1750         https://bugs.webkit.org/show_bug.cgi?id=176059
1751
1752         Reviewed by Chris Dumez.
1753
1754         Covered by existing tests.
1755
1756         * Modules/cache/CacheStorage.cpp:
1757         (WebCore::CacheStorage::retrieveCaches):
1758
1759 2017-08-29  Youenn Fablet  <youenn@apple.com>
1760
1761         Setting the cache storage engine root path according the session WebsiteDataStore
1762         https://bugs.webkit.org/show_bug.cgi?id=176055
1763
1764         Reviewed by Alex Christensen.
1765
1766         No test right now as the engine is not making any read/write operations.
1767
1768         * platform/network/NetworkStorageSession.h:
1769         (WebCore::NetworkStorageSession::cacheStorageDirectory const):
1770         (WebCore::NetworkStorageSession::setCacheStorageDirectory):
1771
1772 2017-08-29  Don Olmstead  <don.olmstead@sony.com>
1773
1774         [CMake] Use find_package for libxml2 and libxstl
1775         https://bugs.webkit.org/show_bug.cgi?id=176042
1776
1777         Reviewed by Konstantin Tokarev.
1778
1779         No new tests. No change in behavior.
1780
1781         * CMakeLists.txt:
1782         * PlatformGTK.cmake:
1783         * PlatformWPE.cmake:
1784         * PlatformWinCairo.cmake:
1785
1786 2017-08-29  Daniel Bates  <dabates@apple.com>
1787
1788         CacheQueryOptions::isolatedCopy() copies the cache name twice
1789         https://bugs.webkit.org/show_bug.cgi?id=175974
1790
1791         Reviewed by Youenn Fablet.
1792
1793         Currently CacheQueryOptions has a user-defined constructor that calls String.isolatedCopy()
1794         on the passed cache name. CacheQueryOptions::isolatedCopy() also calls String.isolatedCopy()
1795         on the cache name before passing the result to the user-defined constructor; => we malloc
1796         and copy the cache name twice. Ideally we would remove the user-defined constructors and
1797         have callers use aggregate initializer syntax to instantiate a CacheQueryOptions. Unfortunately
1798         we cannot do this until we upgrade from Visual Studio 2015 to Visual Studio 2017 as the former
1799         does not support non-static data member initializers (NSDMI) for aggregates and CacheQueryOptions
1800         has some. Therefore we modify the user-defined, non-default, constructor to take a String&&
1801         and conditionally compile the the constructors when building with compilers that do not
1802         support NSDMI for aggregates.
1803
1804         * Modules/cache/CacheQueryOptions.h:
1805         (WebCore::CacheQueryOptions::CacheQueryOptions):
1806
1807 2017-08-29  Youenn Fablet  <youenn@apple.com>
1808
1809         CanvasCaptureMediaStreamTrack clone is not a CanvasCaptureMediaStreamTrack
1810         https://bugs.webkit.org/show_bug.cgi?id=176036
1811
1812         Reviewed by Eric Carlson.
1813
1814         Covered by existing tests.
1815
1816         Instead of creating a MediaStreamTrack clone when cloning a CanvasCaptureMediaStreamTrack,
1817         we are now creating a CanvasCaptureMediaStreamTrack.
1818         This allows exposing the expected methods and having the expected functionality.
1819
1820         * Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp:
1821         (WebCore::CanvasCaptureMediaStreamTrack::clone):
1822         * Modules/mediastream/CanvasCaptureMediaStreamTrack.h:
1823         * Modules/mediastream/MediaStreamTrack.cpp:
1824         (WebCore::MediaStreamTrack::clone):
1825         * Modules/mediastream/MediaStreamTrack.h:
1826
1827 2017-08-29  Chris Dumez  <cdumez@apple.com>
1828
1829         Add initial support for dataTransferItem.webkitGetAsEntry()
1830         https://bugs.webkit.org/show_bug.cgi?id=176038
1831         <rdar://problem/34121095>
1832
1833         Reviewed by Wenson Hsieh.
1834
1835         Add initial support for dataTransferItem.webkitGetAsEntry() as per:
1836         - https://wicg.github.io/entries-api/#html-data
1837
1838         The method works as expected and returns a FileSystemEntry. The entry
1839         can be either a file or a directory. All of the attributes exposed on
1840         the FileSystemEntry return correct values.
1841
1842         What remains to be implemented for this new API to actually be useful:
1843         - directory.getFile() / directory.getDirectory()
1844         - file.file()
1845         - entry.getParent()
1846         - directoryReader.readEntries()
1847
1848         Test: editing/pasteboard/datatransfer-items-drop-getAsEntry.html
1849
1850         * CMakeLists.txt:
1851         * DerivedSources.make:
1852         * WebCore.xcodeproj/project.pbxproj:
1853         * bindings/js/JSBindingsAllInOne.cpp:
1854         Add new files to projects.
1855
1856         * Modules/entriesapi/DOMFileSystem.cpp:
1857         (WebCore::DOMFileSystem::DOMFileSystem):
1858         * Modules/entriesapi/DOMFileSystem.h:
1859         (WebCore::DOMFileSystem::create):
1860         DOMFileSystem factory now takes a name parameter. This name is a UUID, as suggested in
1861         the specification and implemented by Firefox.
1862
1863         * Modules/entriesapi/ErrorCallback.cpp: Added.
1864         * Modules/entriesapi/ErrorCallback.h:
1865         Add scheduleCallback() convenience method as we often need to call this callback
1866         asynchronously.
1867
1868         * Modules/entriesapi/FileSystemDirectoryEntry.cpp:
1869         (WebCore::FileSystemDirectoryEntry::FileSystemDirectoryEntry):
1870         (WebCore::FileSystemDirectoryEntry::createReader):
1871         (WebCore::FileSystemDirectoryEntry::getFile):
1872         (WebCore::FileSystemDirectoryEntry::getDirectory):
1873         * Modules/entriesapi/FileSystemDirectoryEntry.h:
1874         - Add implementation for createReader().
1875         - Update getFile() / getDirectory() to call the error callback for now as they are
1876           unimplemented.
1877         - Have the factory take the virtual path of the entry so that it can be
1878           exposed via the fullPath attribute in IDL.
1879
1880         * Modules/entriesapi/FileSystemDirectoryEntry.idl:
1881         Expose createReader() now that we have stubs for FileSystemDirectoryReader.
1882
1883         * Modules/entriesapi/FileSystemDirectoryReader.cpp: Added.
1884         * Modules/entriesapi/FileSystemDirectoryReader.h: Added.
1885         * Modules/entriesapi/FileSystemDirectoryReader.idl: Added.
1886         * Modules/entriesapi/FileSystemEntriesCallback.cpp: Added.
1887         * Modules/entriesapi/FileSystemEntriesCallback.h: Added.
1888         * Modules/entriesapi/FileSystemEntriesCallback.idl: Added.
1889         Land stubs for FileSystemDirectoryReader and its FileSystemEntriesCallback.
1890
1891         * Modules/entriesapi/FileSystemEntry.cpp:
1892         (WebCore::FileSystemEntry::FileSystemEntry):
1893         * Modules/entriesapi/FileSystemEntry.h:
1894         (WebCore::FileSystemEntry::virtualPath const):
1895         * Modules/entriesapi/FileSystemEntry.idl:
1896         Update constructor to take a virtual path, which is exposed via fullPath
1897         attribute in IDL.
1898
1899         * Modules/entriesapi/FileSystemFileEntry.cpp:
1900         (WebCore::FileSystemFileEntry::FileSystemFileEntry):
1901         (WebCore::FileSystemFileEntry::file):
1902         * Modules/entriesapi/FileSystemFileEntry.h:
1903         (isType):
1904         * Modules/entriesapi/FileSystemFileEntry.idl:
1905         - Update file() to call the error callback for now as they are
1906           unimplemented.
1907         - Have the factory take the virtual path of the entry so that it can be
1908           exposed via the fullPath attribute in IDL.
1909
1910         * bindings/js/JSFileSystemEntryCustom.cpp: Added.
1911         (WebCore::toJSNewlyCreated):
1912         (WebCore::toJS):
1913         Add custom implementation of FileSystemEntry's toJS() function. This is
1914         needed because FileSystemEntry has 2 subclasses and we need to type check
1915         at runtime to construct the right wrapper.
1916
1917         * dom/DataTransferItem.cpp:
1918         (WebCore::DataTransferItem::getAsEntry const):
1919         * dom/DataTransferItem.h:
1920         * dom/DataTransferItem.idl:
1921         Add initial implementation for getAsEntry(), currently exposed as
1922         webkitGetAsEntry().
1923
1924         * dom/DataTransferItemList.cpp:
1925         (WebCore::DataTransferItemList::ensureItems const):
1926         Construct a DataTransferItem if the file is a directory now that we
1927         support getAsEntry().
1928
1929         * fileapi/File.cpp:
1930         (WebCore::File::isDirectory const):
1931         * fileapi/File.h:
1932         Add convenience method to query if a File is a directory.
1933
1934 2017-08-29  Zan Dobersek  <zdobersek@igalia.com>
1935
1936         [WebCrypto] Push WorkQueue dispatches for HKDF, HMAC, PBKDF2 algorithms into shared code
1937         https://bugs.webkit.org/show_bug.cgi?id=175620
1938
1939         Reviewed by Jiewen Tan.
1940
1941         Push the WorkQueue dispatch code and other code duplicated between the
1942         Mac and libgcrypt implementations of Web Crypto into the shared layer.
1943         This patch focuses on the HKDF, HMAC and PBKDF2 algorithms.
1944
1945         Functions with platform-specific implementations that are invoked from
1946         these asynchronous dispatches are made static and return an ExceptionOr
1947         value. CryptoAlgorithmParameters objects are passed through non-const
1948         references because data getters could lazily construct the underlying
1949         Vector objects. CryptoKey objects are passed through const references.
1950         Implementations can then manually retrieve and further validate any key
1951         or parameter data, as required for that specific implementation. Input
1952         data is passed through const references to the original Vector objects.
1953
1954         No new tests -- no changes in behavior that's covered by existing tests.
1955
1956         * crypto/algorithms/CryptoAlgorithmHKDF.cpp:
1957         (WebCore::CryptoAlgorithmHKDF::deriveBits):
1958         * crypto/algorithms/CryptoAlgorithmHKDF.h:
1959         * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
1960         (WebCore::CryptoAlgorithmHMAC::sign):
1961         (WebCore::CryptoAlgorithmHMAC::verify):
1962         * crypto/algorithms/CryptoAlgorithmHMAC.h:
1963         * crypto/algorithms/CryptoAlgorithmPBKDF2.cpp:
1964         (WebCore::CryptoAlgorithmPBKDF2::deriveBits):
1965         * crypto/algorithms/CryptoAlgorithmPBKDF2.h:
1966         * crypto/gcrypt/CryptoAlgorithmHKDFGCrypt.cpp:
1967         (WebCore::CryptoAlgorithmHKDF::platformDeriveBits):
1968         * crypto/gcrypt/CryptoAlgorithmHMACGCrypt.cpp:
1969         (WebCore::CryptoAlgorithmHMAC::platformSign):
1970         (WebCore::CryptoAlgorithmHMAC::platformVerify):
1971         * crypto/gcrypt/CryptoAlgorithmPBKDF2GCrypt.cpp:
1972         (WebCore::CryptoAlgorithmPBKDF2::platformDeriveBits):
1973         * crypto/mac/CryptoAlgorithmHKDFMac.cpp:
1974         (WebCore::CryptoAlgorithmHKDF::platformDeriveBits):
1975         * crypto/mac/CryptoAlgorithmHMACMac.cpp:
1976         (WebCore::CryptoAlgorithmHMAC::platformSign):
1977         (WebCore::CryptoAlgorithmHMAC::platformVerify):
1978         * crypto/mac/CryptoAlgorithmPBKDF2Mac.cpp:
1979         (WebCore::CryptoAlgorithmPBKDF2::platformDeriveBits):
1980
1981 2017-08-29  Zan Dobersek  <zdobersek@igalia.com>
1982
1983         [WebCrypto] Push WorkQueue dispatches for EC algorithms into shared code
1984         https://bugs.webkit.org/show_bug.cgi?id=175619
1985
1986         Reviewed by Jiewen Tan.
1987
1988         Push the WorkQueue dispatch code duplicated between the Mac and libgcrypt
1989         implementations of Web Crypto into the shared layer. This patch focuses on
1990         the EC-based algorithms.
1991
1992         Functions with platform-specific implementations that are invoked from
1993         these asynchronous dispatches are made static and return an ExceptionOr or
1994         std::optional value. CryptoKey and CryptoAlgorithmParameters objects are
1995         passed to those through const references. Input data is passed through
1996         const references to the original Vector objects.
1997
1998         No new tests -- no changes in behavior that's covered by existing tests.
1999
2000         * crypto/algorithms/CryptoAlgorithmECDH.cpp:
2001         (WebCore::CryptoAlgorithmECDH::deriveBits):
2002         * crypto/algorithms/CryptoAlgorithmECDH.h:
2003         * crypto/algorithms/CryptoAlgorithmECDSA.cpp:
2004         (WebCore::CryptoAlgorithmECDSA::sign):
2005         (WebCore::CryptoAlgorithmECDSA::verify):
2006         * crypto/algorithms/CryptoAlgorithmECDSA.h:
2007         * crypto/gcrypt/CryptoAlgorithmECDHGCrypt.cpp:
2008         (WebCore::CryptoAlgorithmECDH::platformDeriveBits):
2009         * crypto/gcrypt/CryptoAlgorithmECDSAGCrypt.cpp:
2010         (WebCore::CryptoAlgorithmECDSA::platformSign):
2011         (WebCore::CryptoAlgorithmECDSA::platformVerify):
2012         * crypto/keys/CryptoKeyEC.h:
2013         * crypto/mac/CryptoAlgorithmECDHMac.cpp:
2014         (WebCore::CryptoAlgorithmECDH::platformDeriveBits):
2015         * crypto/mac/CryptoAlgorithmECDSAMac.cpp:
2016         (WebCore::CryptoAlgorithmECDSA::platformSign):
2017         (WebCore::CryptoAlgorithmECDSA::platformVerify):
2018
2019 2017-08-19  Sergio Villar Senin  <svillar@igalia.com>
2020
2021         [SVG] Leak in SVGAnimatedListPropertyTearOff
2022         https://bugs.webkit.org/show_bug.cgi?id=172545
2023
2024         Reviewed by Darin Adler.
2025
2026         SVGAnimatedListPropertyTearOff maintains a vector m_wrappers with references to
2027         SVGPropertyTraits<PropertyType>::ListItemTearOff. Apart from that SVGPropertyTearOff has a
2028         reference to SVGAnimatedProperty.
2029
2030         When SVGListProperty::getItemValuesAndWrappers() is called, it creates a
2031         SVGPropertyTraits<PropertyType>::ListItemTearOff pointing to the same SVGAnimatedProperty (a
2032         SVGAnimatedListPropertyTearOff) which stores the m_wrappers vector where the ListItemTearOff
2033         is going to be added to. This effectively creates a reference cycle between the
2034         SVGAnimatedListPropertyTearOff and all the ListItemTearOff it stores in m_wrappers.
2035
2036         In order to effectively break the cycle without freeing too many wrappers we should take two
2037         measures:
2038         1) Break the reference cycle by storing raw pointers in the m_wrappers Vector
2039         2) Remove the ListItemTearOff which is being deleted (it notifies the animated property by
2040         calling propertyWillBeDeleted) from the m_wrappers Vector.
2041
2042         This is a re-land of r219334 which caused early releases of custom data attribute objects
2043         added to SVG elements (wkb.ug/175023).
2044
2045         Tests: svg/animations/animation-leak-list-property-instances.html
2046                svg/dom/SVGAnimatedListPropertyTearOff-crash-2.html
2047                svg/dom/SVGAnimatedListPropertyTearOff-crash.html
2048                svg/dom/SVGAnimatedListPropertyTearOff-leak.html
2049
2050         * svg/properties/SVGAnimatedListPropertyTearOff.h:
2051         * svg/properties/SVGListProperty.h:
2052         (WebCore::SVGListProperty::getItemValuesAndWrappers):
2053         * svg/properties/SVGListPropertyTearOff.h:
2054         (WebCore::SVGListPropertyTearOff::removeItemFromList):
2055
2056 2017-08-29  Andy Estes  <aestes@apple.com>
2057
2058         [Mac] Upstream WKSetMetadataURL() from WebKitSystemInterface
2059         https://bugs.webkit.org/show_bug.cgi?id=176046
2060
2061         Reviewed by Alex Christensen.
2062
2063         * platform/FileSystem.cpp:
2064         (WebCore::setMetadataURL):
2065         * platform/FileSystem.h:
2066         (WebCore::setMetadataURL):
2067         * platform/mac/FileSystemMac.mm:
2068         (WebCore::setMetadataURL):
2069         * platform/mac/WebCoreSystemInterface.h:
2070         * platform/mac/WebCoreSystemInterface.mm:
2071
2072 2017-08-29  Zan Dobersek  <zdobersek@igalia.com>
2073
2074         Unreviewed WPE debug build fix.
2075
2076         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
2077         (WebCore::AppendPipeline::dispatchPendingDecryptionStructure):
2078         AppendState is an enum class, enum values have to be accessed
2079         using scope resolution.
2080
2081 2017-08-28  Andy Estes  <aestes@apple.com>
2082
2083         [Cocoa] Upstream WKGetWebDefaultCFStringEncoding()
2084         https://bugs.webkit.org/show_bug.cgi?id=176039
2085
2086         Reviewed by Alex Christensen.
2087
2088         * PlatformMac.cmake:
2089         * WebCore.xcodeproj/project.pbxproj:
2090         * platform/ios/WebCoreSystemInterfaceIOS.mm:
2091         * platform/mac/WebCoreSystemInterface.h:
2092         * platform/mac/WebCoreSystemInterface.mm:
2093         * platform/text/TextEncodingRegistry.cpp:
2094         (WebCore::defaultTextEncodingNameForSystemLanguage):
2095         * platform/text/TextEncodingRegistry.h:
2096         * platform/text/ios/TextEncodingRegistryIOS.mm: Added.
2097         (WebCore::webDefaultCFStringEncoding):
2098         * platform/text/mac/TextEncodingRegistryMac.mm: Added.
2099         (WebCore::webDefaultCFStringEncoding):
2100
2101 2017-08-28  Joseph Pecoraro  <pecoraro@apple.com>
2102
2103         REGRESSION(r220278): Web Inspector: ContextMenu items are not getting triggered
2104         https://bugs.webkit.org/show_bug.cgi?id=176034
2105
2106         Reviewed by Devin Rousso.
2107
2108         * inspector/InspectorFrontendHost.cpp:
2109         (WebCore::InspectorFrontendHost::showContextMenu):
2110         Responses go through InspectorFrontendAPI not InspectorFrontendHost.
2111
2112 2017-08-28  Youenn Fablet  <youenn@apple.com>
2113
2114         WebRTC MediaStream created without tracks does not update active state after tracks are added
2115         https://bugs.webkit.org/show_bug.cgi?id=175434
2116
2117         Reviewed by Eric Carlson.
2118
2119         Covered by updated test.
2120
2121         Removing active/inactive events.
2122         active attribute is still kept and is updated synchronously on every track change.
2123
2124         * Modules/mediastream/MediaStream.cpp:
2125         (WebCore::MediaStream::MediaStream):
2126         (WebCore::MediaStream::activeStatusChanged):
2127         (WebCore::MediaStream::internalAddTrack):
2128         (WebCore::MediaStream::updateActiveState):
2129         (WebCore::MediaStream::hasPendingActivity const):
2130         (WebCore::MediaStream::scheduleActiveStateChange): Deleted.
2131         (WebCore::MediaStream::activityEventTimerFired): Deleted.
2132         * Modules/mediastream/MediaStream.h:
2133         * Modules/mediastream/MediaStream.idl:
2134
2135 2017-08-28  Andy Estes  <aestes@apple.com>
2136
2137         [Cocoa] Upstream CFNetwork-related WebKitSystemInterface functions
2138         https://bugs.webkit.org/show_bug.cgi?id=176032
2139
2140         Reviewed by Alex Christensen.
2141
2142         * platform/ios/WebCoreSystemInterfaceIOS.mm:
2143         * platform/mac/WebCoreSystemInterface.h:
2144         * platform/mac/WebCoreSystemInterface.mm:
2145         * platform/network/NetworkStorageSession.h:
2146         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
2147         (WebCore::NetworkStorageSession::switchToNewTestingSession):
2148         (WebCore::NetworkStorageSession::ensureSession):
2149         * platform/network/cf/ResourceRequest.h:
2150         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
2151         (WebCore::createPrivateStorageSession):
2152         * platform/network/cocoa/ResourceRequestCocoa.mm:
2153         (WebCore::ResourceRequest::setStorageSession):
2154         (WebCore::copyRequestWithStorageSession):
2155         (WebCore::cachedResponseForRequest):
2156         * platform/network/mac/CookieJarMac.mm:
2157         (WebCore::httpCookies):
2158         (WebCore::setHTTPCookiesForURL):
2159         (WebCore::deleteHTTPCookie):
2160         (WebCore::deleteAllHTTPCookies):
2161         (WebCore::setCookiesFromDOM):
2162         (WebCore::httpCookieAcceptPolicy):
2163         (WebCore::cookiesEnabled):
2164         (WebCore::deleteCookie):
2165         (WebCore::getHostnamesWithCookies):
2166         (WebCore::deleteAllCookies):
2167         (WebCore::deleteCookiesForHostnames):
2168         * platform/network/mac/ResourceHandleMac.mm:
2169         (WebCore::ResourceHandle::createNSURLConnection):
2170
2171 2017-08-28  Brent Fulgham  <bfulgham@apple.com>
2172
2173         Disable access to secure cookies if an HTTPS site loads mixed content (Part 2: Header Requests)
2174         https://bugs.webkit.org/show_bug.cgi?id=175992
2175         <rdar://problem/34086613>
2176
2177         Reviewed by Daniel Bates.
2178
2179         The original work in Bug 157053 did not properly handle the case of websockets. This patch completes
2180         the changes to secure cookie handling to make sure websockets are also protected.
2181
2182         Tests: http/tests/websocket/tests/hybi/secure-cookie-insecure-connection.pl
2183                http/tests/websocket/tests/hybi/secure-cookie-secure-connection.pl
2184
2185         * Modules/websockets/WebSocketChannel.cpp:
2186         (WebCore::WebSocketChannel::clientHandshakeRequest): Remove 'const' declaration so we can work with
2187         a mutable Document object. This allows us to mark the Document as having accessed secure cookies.
2188         (WebCore::WebSocketChannel::clientHandshakeRequest const): Deleted.
2189         * Modules/websockets/WebSocketChannel.h:
2190         * Modules/websockets/WebSocketHandshake.cpp:
2191         (WebCore::WebSocketHandshake::clientHandshakeMessage): Ditto.
2192         (WebCore::WebSocketHandshake::clientHandshakeRequest): Ditto.
2193         (WebCore::WebSocketHandshake::clientHandshakeMessage const): Deleted.
2194         (WebCore::WebSocketHandshake::clientHandshakeRequest const): Deleted.
2195         * Modules/websockets/WebSocketHandshake.h:
2196         * loader/CookieJar.cpp:
2197         (WebCore::cookies): Small naming cleanup.
2198         (WebCore::cookieRequestHeaderFieldValue): Pass a flag indicating whether secure cookies should be
2199         included in the result or not. Set the document flag indicating secure cookies were accessed (if
2200         they were), and return the resulting cookie string.
2201         * loader/CookieJar.h:
2202         * platform/CookiesStrategy.h:
2203         * platform/network/CacheValidation.cpp:
2204         (WebCore::headerValueForVary): Revise to pass a flag indicating whether secure cookies should be included
2205         or not.
2206         * platform/network/PlatformCookieJar.h:
2207         * platform/network/cf/CookieJarCFNet.cpp:
2208         (WebCore::doesContainSecureCookies): Added helper method.
2209         (WebCore::cookiesForDOM): Revise to use new helper function.
2210         (WebCore::cookieRequestHeaderFieldValue): Revise to accept a flag indicating if secure cookies should
2211         be included in the result. Return a pair consisting of the cookie string, and a flag indicating whether
2212         secure cookies were accessed or not.
2213         * platform/network/curl/CookieJarCurl.cpp:
2214         (WebCore::CookieJarCurlFileSystem::cookieRequestHeaderFieldValue): Ditto.
2215         (WebCore::cookieRequestHeaderFieldValue): Ditto.
2216         * platform/network/curl/CookieJarCurl.h:
2217         * platform/network/mac/CookieJarMac.mm:
2218         (WebCore::cookiesForSession): Ditto.
2219         (WebCore::cookiesForDOM): Update for new 'cookiesForSession' signature.
2220         (WebCore::cookieRequestHeaderFieldValue): Ditto.
2221         * platform/network/soup/CookieJarSoup.cpp:
2222         (WebCore::cookieRequestHeaderFieldValue): Revise to accept a flag indicating if secure cookies should
2223         be included in the result. Return a pair consisting of the cookie string, and a flag indicating whether
2224         secure cookies were accessed or not.
2225
2226 2017-08-28  Carlos Alberto Lopez Perez  <clopez@igalia.com>
2227
2228         [GTK] [WPE] Rename EventHandlerGlib to EventHandlerGLib
2229         https://bugs.webkit.org/show_bug.cgi?id=175864
2230
2231         Unreviewed cosmetic follow-up patch after r221075.
2232
2233         No new tests. No change in behavior.
2234
2235         * PlatformGTK.cmake:
2236         * PlatformWPE.cmake:
2237         * platform/glib/EventHandlerGLib.cpp: Renamed from Source/WebCore/platform/glib/EventHandlerGlib.cpp.
2238         (WebCore::EventHandler::tabsToAllFormControls const):
2239         (WebCore::EventHandler::focusDocumentView):
2240         (WebCore::EventHandler::passWidgetMouseDownEventToWidget):
2241         (WebCore::EventHandler::passMouseDownEventToWidget):
2242         (WebCore::EventHandler::eventActivatedView const):
2243         (WebCore::EventHandler::widgetDidHandleWheelEvent):
2244         (WebCore::EventHandler::createDraggingDataTransfer const):
2245         (WebCore::EventHandler::passMousePressEventToSubframe):
2246         (WebCore::EventHandler::passMouseMoveEventToSubframe):
2247         (WebCore::EventHandler::passMouseReleaseEventToSubframe):
2248         (WebCore::EventHandler::accessKeyModifiers):
2249         (WebCore::EventHandler::shouldTurnVerticalTicksIntoHorizontal const):
2250
2251 2017-08-28  Zan Dobersek  <zdobersek@igalia.com>
2252
2253         [WebCrypto] Push WorkQueue dispatches for AES algorithms into shared code
2254         https://bugs.webkit.org/show_bug.cgi?id=175539
2255
2256         Reviewed by Sam Weinig.
2257
2258         Push the WorkQueue dispatch code and other code duplicated between the
2259         Mac and libgcrypt implementations of Web Crypto into the shared layer.
2260         This patch focuses on the AES-based algorithms.
2261
2262         Functions with platform-specific implementations that are invoked from
2263         these asynchronous dispatches are made static and return an ExceptionOr
2264         value. CryptoAlgorithmParameters objects are passed through non-const
2265         references because data getters could lazily construct the underlying
2266         Vector objects. CryptoKey objects are passed through const references.
2267         Implementations can then manually retrieve and further validate any key
2268         or parameter data, as required for that specific implementation. Input
2269         data is passed through const references to the original Vector objects.
2270
2271         No new tests -- no changes in behavior that's covered by existing tests.
2272
2273         * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
2274         (WebCore::CryptoAlgorithmAES_CBC::encrypt):
2275         (WebCore::CryptoAlgorithmAES_CBC::decrypt):
2276         * crypto/algorithms/CryptoAlgorithmAES_CBC.h:
2277         * crypto/algorithms/CryptoAlgorithmAES_CFB.cpp:
2278         (WebCore::CryptoAlgorithmAES_CFB::encrypt):
2279         (WebCore::CryptoAlgorithmAES_CFB::decrypt):
2280         * crypto/algorithms/CryptoAlgorithmAES_CFB.h:
2281         * crypto/algorithms/CryptoAlgorithmAES_CTR.cpp:
2282         (WebCore::CryptoAlgorithmAES_CTR::encrypt):
2283         (WebCore::CryptoAlgorithmAES_CTR::decrypt):
2284         * crypto/algorithms/CryptoAlgorithmAES_CTR.h:
2285         * crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:
2286         (WebCore::CryptoAlgorithmAES_GCM::encrypt):
2287         (WebCore::CryptoAlgorithmAES_GCM::decrypt):
2288         * crypto/algorithms/CryptoAlgorithmAES_GCM.h:
2289         * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
2290         (WebCore::CryptoAlgorithmAES_KW::wrapKey):
2291         (WebCore::CryptoAlgorithmAES_KW::unwrapKey):
2292         * crypto/algorithms/CryptoAlgorithmAES_KW.h:
2293         * crypto/gcrypt/CryptoAlgorithmAES_CBCGCrypt.cpp:
2294         (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt):
2295         (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt):
2296         * crypto/gcrypt/CryptoAlgorithmAES_CFBGCrypt.cpp:
2297         (WebCore::CryptoAlgorithmAES_CFB::platformEncrypt):
2298         (WebCore::CryptoAlgorithmAES_CFB::platformDecrypt):
2299         * crypto/gcrypt/CryptoAlgorithmAES_CTRGCrypt.cpp:
2300         (WebCore::CryptoAlgorithmAES_CTR::platformEncrypt):
2301         (WebCore::CryptoAlgorithmAES_CTR::platformDecrypt):
2302         * crypto/gcrypt/CryptoAlgorithmAES_GCMGCrypt.cpp:
2303         (WebCore::gcryptEncrypt):
2304         (WebCore::gcryptDecrypt):
2305         (WebCore::CryptoAlgorithmAES_GCM::platformEncrypt):
2306         (WebCore::CryptoAlgorithmAES_GCM::platformDecrypt):
2307         * crypto/gcrypt/CryptoAlgorithmAES_KWGCrypt.cpp:
2308         (WebCore::CryptoAlgorithmAES_KW::platformWrapKey):
2309         (WebCore::CryptoAlgorithmAES_KW::platformUnwrapKey):
2310         * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp:
2311         (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt):
2312         (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt):
2313         * crypto/mac/CryptoAlgorithmAES_CFBMac.cpp:
2314         (WebCore::CryptoAlgorithmAES_CFB::platformEncrypt):
2315         (WebCore::CryptoAlgorithmAES_CFB::platformDecrypt):
2316         * crypto/mac/CryptoAlgorithmAES_CTRMac.cpp:
2317         (WebCore::CryptoAlgorithmAES_CTR::platformEncrypt):
2318         (WebCore::CryptoAlgorithmAES_CTR::platformDecrypt):
2319         * crypto/mac/CryptoAlgorithmAES_GCMMac.cpp:
2320         (WebCore::CryptoAlgorithmAES_GCM::platformEncrypt):
2321         (WebCore::CryptoAlgorithmAES_GCM::platformDecrypt):
2322         * crypto/mac/CryptoAlgorithmAES_KWMac.cpp:
2323         (WebCore::CryptoAlgorithmAES_KW::platformWrapKey):
2324         (WebCore::CryptoAlgorithmAES_KW::platformUnwrapKey):
2325
2326 2017-08-27  Wenson Hsieh  <wenson_hsieh@apple.com>
2327
2328         [iOS WK2] Web process crashes after changing selection to the end of the document when speaking a selection
2329         https://bugs.webkit.org/show_bug.cgi?id=176011
2330         <rdar://problem/32614095>
2331
2332         Reviewed by Ryosuke Niwa.
2333
2334         Adds a null check to visiblePositionForPositionWithOffset. This is a crash point for accessibility codepaths,
2335         since indexForVisiblePosition is not guaranteed to set the given `root` outparam to a non-null value, yet
2336         visiblePositionForIndex requires root to be non-null. This causes a crash when selecting some text, hitting
2337         'Speak', and then changing the selection to somewhere near the end of the document, since accessibility code
2338         will attempt to speak words at an offset past the end of the document. While this is a bug in and of itself, the
2339         web process should still handle this case gracefully and not crash. To fix this, we simply bail and return a
2340         null VisiblePosition if a root container node was not found.
2341
2342         Currently, visiblePositionForPositionWithOffset is implemented twice, in WebCore (AXObjectCache.cpp) and also in
2343         WebKit (WebPageIOS.mm), as identical static functions. This patch moves this helper into Editing.cpp and removes
2344         it from AXObjectCache and WebPageIOS.
2345
2346         Tests: AccessibilityTests.RectsForSpeakingSelectionBasic
2347                AccessibilityTests.RectsForSpeakingSelectionWithLineWrapping
2348                AccessibilityTests.RectsForSpeakingSelectionDoNotCrashWhenChangingSelection
2349
2350         * accessibility/AXObjectCache.cpp:
2351         (WebCore::visiblePositionForPositionWithOffset): Deleted.
2352         * editing/Editing.cpp:
2353         (WebCore::visiblePositionForPositionWithOffset):
2354         * editing/Editing.h:
2355
2356 2017-08-27  Devin Rousso  <webkit@devinrousso.com>
2357
2358         Web Inspector: Record actions performed on WebGLRenderingContext
2359         https://bugs.webkit.org/show_bug.cgi?id=174483
2360         <rdar://problem/34040722>
2361
2362         Reviewed by Matt Baker.
2363
2364         Tests: inspector/canvas/recording-webgl.html
2365                inspector/canvas/recording-webgl-snapshots.html
2366
2367         * bindings/js/CallTracerTypes.h:
2368         Add types for WebGL parameters.
2369
2370         * bindings/scripts/CodeGeneratorJS.pm:
2371         (GenerateAttributeSetterBodyDefinition):
2372         (GenerateImplementationFunctionCall):
2373         (GenerateCallTracerParameter):
2374         Modify the generated code for `CallTracingCallback` so that optional/nullable types are only
2375         dereferenced if they have a value.
2376
2377         * html/canvas/WebGLRenderingContext.idl:
2378         Add `CallTracingCallback` to interface to record all API calls.
2379
2380         * inspector/InspectorCanvas.h:
2381         * inspector/InspectorCanvas.cpp:
2382         (WebCore::InspectorCanvas::resetRecordingData):
2383         (WebCore::shouldSnapshotWebGLAction):
2384         (WebCore::InspectorCanvas::recordAction):
2385         (WebCore::InspectorCanvas::releaseInitialState):
2386         (WebCore::InspectorCanvas::releaseFrames):
2387         (WebCore::InspectorCanvas::appendActionSnapshotIfNeeded):
2388         (WebCore::InspectorCanvas::getCanvasContentAsDataURL):
2389         (WebCore::InspectorCanvas::buildInitialState):
2390         (WebCore::InspectorCanvas::buildAction):
2391         For all non-primitive WebGL objects, send a string corresponding to the object's name. The
2392         value isn't needed since the preview will be generated by the `toDataURL` snapshots taken
2393         after every visual action.
2394
2395         * inspector/InspectorCanvasAgent.cpp:
2396         (WebCore::InspectorCanvasAgent::didFinishRecordingCanvasFrame):
2397
2398         * bindings/scripts/test/TestCallTracer.idl:
2399         * bindings/scripts/test/JS/JSTestCallTracer.cpp:
2400         (WebCore::jsTestCallTracerPrototypeFunctionTestOperationWithNullableArgumentBody):
2401         (WebCore::jsTestCallTracerPrototypeFunctionTestOperationWithNullableVariantArgumentBody):
2402         (WebCore::jsTestCallTracerPrototypeFunctionTestOperationWithNullableVariantArgument):
2403         (WebCore::jsTestCallTracerPrototypeFunctionTestOperationWithOptionalVariantArgumentBody):
2404         (WebCore::jsTestCallTracerPrototypeFunctionTestOperationWithOptionalVariantArgument):
2405         (WebCore::jsTestCallTracerPrototypeFunctionTestOperationWithDefaultVariantArgumentBody):
2406         (WebCore::jsTestCallTracerPrototypeFunctionTestOperationWithDefaultVariantArgument):
2407
2408 2017-08-26  Dan Bernstein  <mitz@apple.com>
2409
2410         REGRESSION (r220105): Storage service appears in macOS Activity Monitor as “localized string not found”
2411         https://bugs.webkit.org/show_bug.cgi?id=176007
2412
2413         Reviewed by Tim Horton.
2414
2415         * English.lproj/Localizable.strings: Updated using update-webkit-localizable-strings.
2416
2417 2017-08-26  Alex Christensen  <achristensen@webkit.org>
2418
2419         Remove PolicyChecker::cancelCheck
2420         https://bugs.webkit.org/show_bug.cgi?id=176002
2421
2422         Reviewed by Darin Adler.
2423
2424         cancelCheck is conceptually equivalent to not calling a completion handler.
2425         stopCheck is conceptually equivalent to calling a completion handler with PolicyIgnore just before cleaning up everything,
2426         which is semantically cleaner and necessary when I replace the last use of PolicyCallback with a CompletionHandler.
2427         Before this change, we were probably causing some loading objects to hang right before deleting them, and this cleans them up better.
2428
2429         * loader/DocumentLoader.cpp:
2430         (WebCore::DocumentLoader::cancelPolicyCheckIfNeeded):
2431         * loader/PolicyChecker.cpp:
2432         (WebCore::PolicyChecker::cancelCheck): Deleted.
2433         * loader/PolicyChecker.h:
2434
2435 2017-08-26  Michael Catanzaro  <mcatanzaro@igalia.com>
2436
2437         Unreviewed, tighten up scope of variable in previous commit
2438
2439         * platform/network/soup/CookieJarSoup.cpp:
2440         (WebCore::cookiesForSession):
2441
2442 2017-08-26  Michael Catanzaro  <mcatanzaro@igalia.com>
2443
2444         [SOUP] Update cookie jar implementation to filter out secure cookies
2445         https://bugs.webkit.org/show_bug.cgi?id=175850
2446
2447         Reviewed by Brent Fulgham.
2448
2449         Filter out secure cookies when indicated.
2450
2451         * platform/network/soup/CookieJarSoup.cpp:
2452         (WebCore::cookiesForSession):
2453         (WebCore::cookiesForDOM):
2454         (WebCore::cookieRequestHeaderFieldValue):
2455         (WebCore::getRawCookies):
2456
2457 2017-08-26  Xabier Rodriguez Calvar  <calvaris@igalia.com>
2458
2459         [EME][GStreamer] Connect CDM to GStreamer
2460         https://bugs.webkit.org/show_bug.cgi?id=175983
2461
2462         Reviewed by Žan Doberšek.
2463
2464         This is still a version that will need some changes for some other
2465         use cases but it should be enough to begin with some passes in the
2466         tests and some basic use cases.
2467
2468         We use the attach CDMInstance interface in the private player to
2469         get the instance in time for the initializationDataEncountered
2470         event, which is handled when the demuxer reports synchronously the
2471         events even before configuring the decryptors. We wait there in
2472         case we don't have the CDMInstance attached (which contains info
2473         about the key system now) and when we get it we report it back to
2474         the demuxer and continue sending the event.
2475
2476         We also handled the events when handled by the decryptors but for
2477         now this will remain a FIXME. The events handled by the
2478         AppendPipeline will end up here too for now.
2479
2480         The CDM instance is created with the key system because some CDMs
2481         can handle more than one, not ClearKey yet but others in the
2482         (near) future.
2483
2484         MockCDMFactory is adapted to the changes as expected.
2485
2486         * Modules/encryptedmedia/CDM.cpp:
2487         (WebCore::CDM::CDM):
2488         * platform/encryptedmedia/CDMFactory.h:
2489         * platform/encryptedmedia/CDMInstance.h:
2490         * platform/encryptedmedia/clearkey/CDMClearKey.cpp:
2491         (WebCore::CDMFactoryClearKey::createCDM):
2492         (WebCore::CDMInstanceClearKey::keySystem const):
2493         * platform/encryptedmedia/clearkey/CDMClearKey.h:
2494         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2495         (WebCore::MediaPlayerPrivateGStreamer::handleMessage):
2496         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2497         (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):
2498         (WebCore::extractEventsAndSystemsFromMessage):
2499         (WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage):
2500         (WebCore::MediaPlayerPrivateGStreamerBase::cdmInstanceAttached):
2501         (WebCore::MediaPlayerPrivateGStreamerBase::cdmInstanceDetached):
2502         (WebCore::MediaPlayerPrivateGStreamerBase::attemptToDecryptWithInstance):
2503         (WebCore::MediaPlayerPrivateGStreamerBase::attemptToDecryptWithLocalInstance):
2504         (WebCore::MediaPlayerPrivateGStreamerBase::dispatchDecryptionKey):
2505         (WebCore::MediaPlayerPrivateGStreamerBase::handleProtectionEvent):
2506         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
2507         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
2508         (WebCore::appendPipelineElementMessageCallback):
2509         (WebCore::AppendPipeline::AppendPipeline):
2510         (WebCore::AppendPipeline::~AppendPipeline):
2511         (WebCore::AppendPipeline::handleNeedContextSyncMessage):
2512         (WebCore::AppendPipeline::handleElementMessage):
2513         (WebCore::AppendPipeline::handleAppsrcNeedDataReceived):
2514         (WebCore::AppendPipeline::appsinkNewSample):
2515         * platform/graphics/gstreamer/mse/AppendPipeline.h:
2516         * testing/MockCDMFactory.cpp:
2517         (WebCore::MockCDMFactory::createCDM):
2518         (WebCore::MockCDMInstance::keySystem const):
2519         * testing/MockCDMFactory.h:
2520
2521 2017-08-26  Zan Dobersek  <zdobersek@igalia.com>
2522
2523         [WebCrypto] Push WorkQueue dispatches for RSA algorithms into shared code
2524         https://bugs.webkit.org/show_bug.cgi?id=175621
2525
2526         Reviewed by Darin Adler.
2527
2528         Push the WorkQueue dispatch code and other code duplicated between the
2529         Mac and libgcrypt implementations of Web Crypto into the shared layer.
2530         This patch focuses on the RSA-based algorithms.
2531
2532         The WorkQueue dispatch code is condensed into two static functions on
2533         the CryptoAlgorithm class, the first variation handling VectorCallback
2534         as the callback type and the other handling BoolCallback. The operation
2535         is kept in a WTF::Function<> object that returns an ExceptionOr<> value
2536         embedding either a Vector<uint8_t> object or a boolean value, as
2537         appropriate for the callback type.
2538
2539         Functions with platform-specific implementations that are invoked from
2540         these asynchronous dispatches are made static and return an ExceptionOr
2541         value. CryptoAlgorithmParameters objects are passed through non-const
2542         references because data getters could lazily construct the underlying
2543         Vector objects. CryptoKey objects are passed through const references.
2544         Implementations can then manually retrieve and further validate any key
2545         or parameter data, as required for that specific implementation. Input
2546         data is passed through const references to the original Vector objects.
2547
2548         No new tests -- no changes in behavior that's covered by existing tests.
2549
2550         * crypto/CryptoAlgorithm.cpp:
2551         (WebCore::dispatchOperationImpl):
2552         (WebCore::CryptoAlgorithm::dispatchOperation):
2553         * crypto/CryptoAlgorithm.h:
2554         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
2555         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::encrypt):
2556         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::decrypt):
2557         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h:
2558         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
2559         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::sign):
2560         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::verify):
2561         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h:
2562         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
2563         (WebCore::CryptoAlgorithmRSA_OAEP::encrypt):
2564         (WebCore::CryptoAlgorithmRSA_OAEP::decrypt):
2565         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h:
2566         * crypto/algorithms/CryptoAlgorithmRSA_PSS.cpp:
2567         (WebCore::CryptoAlgorithmRSA_PSS::sign):
2568         (WebCore::CryptoAlgorithmRSA_PSS::verify):
2569         * crypto/algorithms/CryptoAlgorithmRSA_PSS.h:
2570         * crypto/gcrypt/CryptoAlgorithmRSAES_PKCS1_v1_5GCrypt.cpp:
2571         (WebCore::gcryptEncrypt):
2572         (WebCore::gcryptDecrypt):
2573         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformEncrypt):
2574         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformDecrypt):
2575         * crypto/gcrypt/CryptoAlgorithmRSASSA_PKCS1_v1_5GCrypt.cpp:
2576         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformSign):
2577         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformVerify):
2578         * crypto/gcrypt/CryptoAlgorithmRSA_OAEPGCrypt.cpp:
2579         (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt):
2580         (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt):
2581         * crypto/gcrypt/CryptoAlgorithmRSA_PSSGCrypt.cpp:
2582         (WebCore::CryptoAlgorithmRSA_PSS::platformSign):
2583         (WebCore::CryptoAlgorithmRSA_PSS::platformVerify):
2584         * crypto/mac/CryptoAlgorithmRSAES_PKCS1_v1_5Mac.cpp:
2585         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformEncrypt):
2586         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformDecrypt):
2587         * crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp:
2588         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformSign):
2589         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformVerify):
2590         * crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp:
2591         (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt):
2592         (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt):
2593         * crypto/mac/CryptoAlgorithmRSA_PSSMac.cpp:
2594         (WebCore::CryptoAlgorithmRSA_PSS::platformSign):
2595         (WebCore::CryptoAlgorithmRSA_PSS::platformVerify):
2596
2597 2017-08-25  Daniel Bates  <dabates@apple.com>
2598
2599         Demarcate code added due to lack of NSDMI for aggregates
2600         https://bugs.webkit.org/show_bug.cgi?id=175990
2601
2602         Reviewed by Andy Estes.
2603
2604         * html/canvas/CanvasStyle.h:
2605         * platform/mediastream/IceCandidate.h:
2606         (WebCore::IceCandidate::IceCandidate):
2607         * platform/text/StringWithDirection.h: Replace const String& and String&& constructor
2608         overloads with a single user-defined constructor that takes a String by value to handle
2609         both cases.
2610         (WebCore::StringWithDirection::StringWithDirection):
2611         (WebCore::truncateFromEnd):
2612         * style/StyleUpdate.h:
2613         (WebCore::Style::ElementUpdate::ElementUpdate):
2614         (WebCore::Style::TextUpdate::TextUpdate):
2615
2616 2017-08-25  Daniel Bates  <dabates@apple.com>
2617
2618         InlineTextBox::paintDocumentMarker() does not need to special case painting of grammar and
2619         dictation alternatives
2620         https://bugs.webkit.org/show_bug.cgi?id=175966
2621
2622         Reviewed by Tim Horton.
2623
2624         Remove code that forced computing the marker rect for grammar and dictation alternative
2625         regardless of whether the marker spans the entire width of the line box. InlineTextBox::paintDocumentMarker()
2626         has performance optimizations to avoid computing the marker rect if it spans the entire line box.
2627         Prior to r190363 we had to opt out of these optimizations for grammar and dictation alternative
2628         markers so that we could store their computed marker rect. In r190363 we removed the logic in
2629         InlineTextBox::paintDocumentMarker() to store the computed marker rect and hence no longer
2630         needed to opt out of the optimization for these marker types, but inadvertently left in the
2631         conditional code that opts them out.
2632
2633         No functionality changed. So no new tests.
2634
2635         * rendering/InlineTextBox.cpp:
2636         (WebCore::InlineTextBox::paintDocumentMarker): Remove unnecessary argument grammar and
2637         code that special cased handling of grammar an dictation alternative markers.
2638         (WebCore::InlineTextBox::paintDocumentMarkers): Update as necessary.
2639         * rendering/InlineTextBox.h:
2640
2641 2017-08-25  Chris Dumez  <cdumez@apple.com>
2642
2643         Land stubs for File and Directory Entries API interfaces
2644         https://bugs.webkit.org/show_bug.cgi?id=175993
2645         <rdar://problem/34087477>
2646
2647         Reviewed by Ryosuke Niwa.
2648
2649         Land stubs for File and Directory Entries API interfaces:
2650         - https://wicg.github.io/entries-api/#idl-index
2651
2652         Those will be needed to support drag and drop.
2653
2654         Test: http/wpt/entries-api/interfaces.html
2655
2656         * CMakeLists.txt:
2657         * DerivedSources.cpp:
2658         * DerivedSources.make:
2659         * Modules/entriesapi/DOMFileSystem.cpp: Added.
2660         (WebCore::DOMFileSystem::DOMFileSystem):
2661         (WebCore::DOMFileSystem::~DOMFileSystem):
2662         * Modules/entriesapi/DOMFileSystem.h: Added.
2663         (WebCore::DOMFileSystem::create):
2664         (WebCore::DOMFileSystem::name const):
2665         (WebCore::DOMFileSystem::root const):
2666         * Modules/entriesapi/DOMFileSystem.idl: Added.
2667         * Modules/entriesapi/ErrorCallback.h: Added.
2668         * Modules/entriesapi/ErrorCallback.idl: Added.
2669         * Modules/entriesapi/FileCallback.h: Added.
2670         * Modules/entriesapi/FileCallback.idl: Added.
2671         * Modules/entriesapi/FileSystemDirectoryEntry.cpp: Added.
2672         (WebCore::FileSystemDirectoryEntry::FileSystemDirectoryEntry):
2673         (WebCore::FileSystemDirectoryEntry::getFile):
2674         (WebCore::FileSystemDirectoryEntry::getDirectory):
2675         * Modules/entriesapi/FileSystemDirectoryEntry.h: Added.
2676         * Modules/entriesapi/FileSystemDirectoryEntry.idl: Added.
2677         * Modules/entriesapi/FileSystemEntry.cpp: Added.
2678         (WebCore::FileSystemEntry::FileSystemEntry):
2679         * Modules/entriesapi/FileSystemEntry.h: Added.
2680         (WebCore::FileSystemEntry::~FileSystemEntry):
2681         (WebCore::FileSystemEntry::isFile const):
2682         (WebCore::FileSystemEntry::isDirectory const):
2683         (WebCore::FileSystemEntry::name const):
2684         (WebCore::FileSystemEntry::fullPath const):
2685         (WebCore::FileSystemEntry::filesystem const):
2686         * Modules/entriesapi/FileSystemEntry.idl: Added.
2687         * Modules/entriesapi/FileSystemEntryCallback.h: Added.
2688         * Modules/entriesapi/FileSystemEntryCallback.idl: Added.
2689         * Modules/entriesapi/FileSystemFileEntry.cpp: Added.
2690         (WebCore::FileSystemFileEntry::FileSystemFileEntry):
2691         (WebCore::FileSystemFileEntry::file):
2692         * Modules/entriesapi/FileSystemFileEntry.h: Added.
2693         * Modules/entriesapi/FileSystemFileEntry.idl: Added.
2694         * WebCore.xcodeproj/project.pbxproj:
2695
2696 2017-08-25  Brent Fulgham  <bfulgham@apple.com>
2697
2698         REGRESSION(r221017): Quip stuck in a perpetual loading loop
2699         https://bugs.webkit.org/show_bug.cgi?id=175991
2700         <rdar://problem/34044445>
2701
2702         Reviewed by Daniel Bates.
2703
2704         This is a quick fix to return proper function to WebKit. I'll relate a follow-up fix that
2705         addresses WebSockets more completely.
2706
2707         * platform/network/mac/CookieJarMac.mm:
2708         (WebCore::cookieRequestHeaderFieldValue): Don't hard code a value of 'No' for returning secure
2709         cookies. HTTPS connection should get secure cookies.
2710
2711 2017-08-25  Youenn Fablet  <youenn@apple.com>
2712
2713         Add support for ReadableStream storage in FetchBody
2714         https://bugs.webkit.org/show_bug.cgi?id=175866
2715
2716         Reviewed by Sam Weinig.
2717
2718         Test: http/wpt/beacon/beacon-readablestream.html
2719
2720         Add support for IDLInterface<ReadableStream>, in particular to handle union conversions.
2721         Adding a ReadableStream that guards JSReadableStream from being collected.
2722         With this object, FetchBody will be able to store and manipulate ReadableStream.
2723
2724         Ensure conversion of BodyInit union with ReadableStream is working by adding support for beacon rejection in case of request body streams. 
2725
2726         * Modules/beacon/NavigatorBeacon.cpp:
2727         (WebCore::NavigatorBeacon::sendBeacon):
2728         * Modules/beacon/NavigatorBeacon.idl:
2729         * Modules/fetch/FetchBody.cpp:
2730         (WebCore::FetchBody::extract):
2731         * Modules/fetch/FetchBody.h:
2732         * Modules/fetch/FetchRequest.idl:
2733         * Modules/fetch/FetchRequestInit.idl:
2734         * Modules/fetch/FetchResponse.idl:
2735         * WebCore.xcodeproj/project.pbxproj:
2736         * bindings/js/JSDOMConvertInterface.h:
2737         (WebCore::JSToWrappedOverloader::toWrapped):
2738         (WebCore::Converter<IDLInterface<T>>::convert):
2739         * bindings/js/JSDOMConvertUnion.h:
2740         * bindings/js/ReadableStream.h: Added.
2741         (WebCore::JSReadableStreamWrapperConverter::toWrapped):
2742
2743 2017-08-25  Wenson Hsieh  <wenson_hsieh@apple.com>
2744
2745         Using the touchbar, both align left and align justify send a beforeinput event with the 'formatJustifyLeft' inputType.
2746         https://bugs.webkit.org/show_bug.cgi?id=168669
2747         <rdar://problem/30639155>
2748
2749         Reviewed by Beth Dakin.
2750
2751         Small tweak to add a "formatJustifyFull" inputType when justifying text using the touch bar's rich text
2752         formatting controls. Currently, the EditActionJustify edit command incorrectly maps to "formatJustifyLeft".
2753
2754         Test: fast/events/input-events-text-alignment.html
2755
2756         * editing/EditCommand.cpp:
2757         (WebCore::inputTypeNameForEditingAction):
2758
2759 2017-08-25  Brady Eidson  <beidson@apple.com>
2760
2761         Introduce ServerWorkerRegistration task queues.
2762         https://bugs.webkit.org/show_bug.cgi?id=175851
2763
2764         Reviewed by Andy Estes.
2765
2766         Test: http/tests/workers/service/registration-task-queue-scheduling-1.html
2767
2768         This change introduces:
2769         - A task thread/queue owned by each SWServer object.
2770         - The SWServerRegistration object, which is the in-server representation of a
2771           service worker registration scope.
2772         - A registration job queue per SWServerRegistration object which actually runs the
2773           jobs as tasks on the owning SWServer's thread.
2774
2775         With that infrastructure in place, it moves the "register" job to something that is
2776         scheduled and rejected asynchronously, as opposed to synchronously rejected.
2777
2778         The test verifies that two different registration scopes (localhost and 127.0.0.1) 
2779         can both spam the SWServer with registration requests, but neither of their queues
2780         starve the other.
2781
2782         The rest of this change is a lot of support and plumbing for making the above happen.
2783
2784         * CMakeLists.txt:
2785         * WebCore.xcodeproj/project.pbxproj:
2786         
2787         * dom/ExceptionData.cpp:
2788         (WebCore::ExceptionData::isolatedCopy const):
2789         * dom/ExceptionData.h:
2790         
2791         * workers/service/ServiceWorkerContainer.cpp:
2792         (WebCore::ServiceWorkerContainer::addRegistration):
2793         (WebCore::ServiceWorkerContainer::connectionIdentifier):
2794         * workers/service/ServiceWorkerContainer.h:
2795         
2796         * workers/service/ServiceWorkerJob.cpp:
2797         (WebCore::ServiceWorkerJob::ServiceWorkerJob):
2798         (WebCore::ServiceWorkerJob::data const): Deleted.
2799         * workers/service/ServiceWorkerJob.h:
2800         (WebCore::ServiceWorkerJob::create):
2801         (WebCore::ServiceWorkerJob::data const):
2802         (WebCore::ServiceWorkerJob::createRegisterJob): Deleted.
2803         
2804         * workers/service/ServiceWorkerJobClient.h:
2805         
2806         * workers/service/ServiceWorkerJobData.cpp:
2807         (WebCore::ServiceWorkerJobData::ServiceWorkerJobData):
2808         (WebCore::ServiceWorkerJobData::registrationKey const):
2809         (WebCore::ServiceWorkerJobData::isolatedCopy const):
2810         * workers/service/ServiceWorkerJobData.h:
2811         (WebCore::ServiceWorkerJobData::jobIdentifier const):
2812         (WebCore::ServiceWorkerJobData::connectionIdentifier const):
2813         (WebCore::ServiceWorkerJobData::encode const):
2814         (WebCore::ServiceWorkerJobData::decode):
2815
2816         * workers/service/ServiceWorkerRegistrationKey.cpp:
2817         (WebCore::ServiceWorkerRegistrationKey::emptyKey):
2818         (WebCore::ServiceWorkerRegistrationKey::hash const):
2819         (WebCore::ServiceWorkerRegistrationKey::operator== const):
2820         * workers/service/ServiceWorkerRegistrationKey.h:
2821         (WTF::ServiceWorkerRegistrationKeyHash::hash):
2822         (WTF::ServiceWorkerRegistrationKeyHash::equal):
2823         (WTF::HashTraits<WebCore::ServiceWorkerRegistrationKey>::emptyValue):
2824         (WTF::HashTraits<WebCore::ServiceWorkerRegistrationKey>::constructDeletedValue):
2825         (WTF::HashTraits<WebCore::ServiceWorkerRegistrationKey>::isDeletedValue):
2826
2827         * workers/service/ServiceWorkerRegistrationOptions.cpp:
2828         (WebCore::RegistrationOptions::isolatedCopy const):
2829         * workers/service/ServiceWorkerRegistrationOptions.h:
2830         (WebCore::RegistrationOptions::encode const):
2831         (WebCore::RegistrationOptions::decode):
2832
2833         * workers/service/server/SWClientConnection.h:
2834
2835         * workers/service/server/SWServer.cpp:
2836         (WebCore::SWServer::Connection::Connection):
2837         (WebCore::SWServer::~SWServer):
2838         (WebCore::SWServer::Connection::scheduleJobInServer):
2839         (WebCore::SWServer::SWServer):
2840         (WebCore::SWServer::scheduleJob):
2841         (WebCore::SWServer::rejectJob):
2842         (WebCore::SWServer::taskThreadEntryPoint):
2843         (WebCore::SWServer::postTask):
2844         (WebCore::SWServer::postTaskReply):
2845         (WebCore::SWServer::handleTaskRepliesOnMainThread):
2846         (WebCore::SWServer::registerConnection):
2847         (WebCore::SWServer::unregisterConnection):
2848         * workers/service/server/SWServer.h:
2849         (WebCore::SWServer::Connection::identifier const):
2850
2851         * workers/service/server/SWServerRegistration.cpp: Added.
2852         (WebCore::SWServerRegistration::SWServerRegistration):
2853         (WebCore::SWServerRegistration::~SWServerRegistration):
2854         (WebCore::SWServerRegistration::enqueueJob):
2855         (WebCore::SWServerRegistration::startNextJob):
2856         (WebCore::SWServerRegistration::performCurrentJob):
2857         (WebCore::SWServerRegistration::rejectCurrentJob):
2858         (WebCore::SWServerRegistration::finishCurrentJob):
2859         * workers/service/server/SWServerRegistration.h:
2860
2861 2017-08-25  Michael Catanzaro  <mcatanzaro@igalia.com>
2862
2863         Unreviewed, add comment warning that some flags have been copied into Epiphany
2864
2865         * platform/URLParser.cpp:
2866         (WebCore::URLParser::internationalDomainNameTranscoder):
2867
2868 2017-07-25  Frederic Wang  <fwang@igalia.com>
2869
2870         Add flag allow-modals to iframe sandbox
2871         https://bugs.webkit.org/show_bug.cgi?id=171321
2872
2873         This patch implements the "allow-modals" value for the iframe sandbox attribute. It changes
2874         the behavior for sandboxed document so that alert, confirm, prompt, print as well as dialogs
2875         generated from a beforeunload event are blocked when allow-modals is not set, as defined in
2876         the specification. For consistency, we do the same for document.execCommand('print', ...).
2877         Users should use the allow-modals flag in order to explictly allow modal dialogs.
2878
2879         See https://html.spec.whatwg.org/multipage/origin.html#sandboxed-modals-flag
2880
2881         Reviewed by Brent Fulgham.
2882
2883         Tests: http/tests/security/sandboxed-iframe-ALLOWED-modals.html
2884                http/tests/security/sandboxed-iframe-DENIED-modals.html
2885
2886         * dom/SecurityContext.cpp: Implement parsing for allow-modals
2887         (WebCore::SecurityContext::isSupportedSandboxPolicy):
2888         (WebCore::SecurityContext::parseSandboxPolicy):
2889         * dom/SecurityContext.h: Introduce flag for allow-modals
2890         * loader/FrameLoader.cpp:
2891         (WebCore::shouldAskForNavigationConfirmation): Prevent confirm dialog from beforeunload when
2892         allow-modals is not set.
2893         * page/Chrome.h: Change the signature of print, so it may return a failure when the
2894         allow-modals flag is not set.
2895         * page/Chrome.cpp:
2896         (WebCore::Chrome::print): Returns false and print a message error when the allow-modals flag
2897         on the frame's document is not set. Otherwise, execute the command and returns true.
2898         * editing/EditorCommand.cpp:
2899         (WebCore::executePrint): Ensure that document.execCommand for 'print' returns false when the
2900         allow-modals flag is not set.
2901         * page/DOMWindow.cpp: Add early exit when alert, confirm or prompt when the allow-modals flag
2902         for that document is not set. Note that print is handled in Chrome.cpp.
2903         (WebCore::DOMWindow::alert): Add early exit.
2904         (WebCore::DOMWindow::confirm): Add early exit with the return value indicated in the spec.
2905         (WebCore::DOMWindow::prompt): Ditto.
2906
2907 2017-08-25  Brady Eidson  <beidson@apple.com>
2908
2909         Unreviewed, rolling out r221181.
2910
2911         Broke builds that use CryptoAlgorithmRSA_PSSMac.cpp
2912
2913         Reverted changeset:
2914
2915         "[WebCrypto] Push WorkQueue dispatches for RSA algorithms into
2916         shared code"
2917         https://bugs.webkit.org/show_bug.cgi?id=175621
2918         http://trac.webkit.org/changeset/221181
2919
2920 2017-08-25  Xabier Rodriguez Calvar  <calvaris@igalia.com>
2921
2922         [EME][ClearKey] Fixed warning in CDM compilation
2923         https://bugs.webkit.org/show_bug.cgi?id=175979
2924
2925         Reviewed by Žan Doberšek.
2926
2927         * platform/encryptedmedia/clearkey/CDMClearKey.h: Added a final to
2928         avoid the compiler warning about the missing override keyword.
2929
2930 2017-08-25  Miguel Gomez  <magomez@igalia.com>
2931
2932         [GTK] Completely garbled display in Transifex in accelerated compositing mode
2933         https://bugs.webkit.org/show_bug.cgi?id=174632
2934
2935         Reviewed by Michael Catanzaro.
2936
2937         Remove the copy constructor from PlatformContextCairo::State. This is because it will be used by WTF::Vector
2938         to copy the instances around when allocating new memory, but it doesn't copy the m_imageMaskInformation
2939         attribute, so it will be lost when the Vector reallocates its contents. When this happens, renderings that use
2940         GraphicsContext::clipToImageBuffer() fail to render properly.
2941
2942         Covered by existent tests.
2943
2944         * platform/graphics/cairo/PlatformContextCairo.cpp:
2945         (WebCore::PlatformContextCairo::State::State):
2946         (WebCore::PlatformContextCairo::save):
2947
2948 2017-08-25  Xabier Rodriguez Calvar  <calvaris@igalia.com>
2949
2950         [EME][GStreamer] Move createDescryptor function to GStreamerEMEUtilities
2951         https://bugs.webkit.org/show_bug.cgi?id=175930
2952
2953         Reviewed by Žan Doberšek.
2954
2955         * platform/graphics/gstreamer/GStreamerUtilities.cpp:
2956         (WebCore::createGstDecryptor): Deleted.
2957         * platform/graphics/gstreamer/GStreamerUtilities.h:
2958         * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.cpp:
2959         (WebCore::GStreamerEMEUtilities::createDecryptor): Created.
2960         * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h:
2961         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
2962         (WebCore::AppendPipeline::parseDemuxerSrcPadCaps): Use
2963         GStreamerEMEUtilities::createDecryptor instead.
2964
2965 2017-08-25  Zan Dobersek  <zdobersek@igalia.com>
2966
2967         [WebCrypto] Push WorkQueue dispatches for RSA algorithms into shared code
2968         https://bugs.webkit.org/show_bug.cgi?id=175621
2969
2970         Reviewed by Darin Adler.
2971
2972         Push the WorkQueue dispatch code and other code duplicated between the
2973         Mac and libgcrypt implementations of Web Crypto into the shared layer.
2974         This patch focuses on the RSA-based algorithms.
2975
2976         The WorkQueue dispatch code is condensed into two static functions on
2977         the CryptoAlgorithm class, the first variation handling VectorCallback
2978         as the callback type and the other handling BoolCallback. The operation
2979         is kept in a WTF::Function<> object that returns an ExceptionOr<> value
2980         embedding either a Vector<uint8_t> object or a boolean value, as
2981         appropriate for the callback type.
2982
2983         Functions with platform-specific implementations that are invoked from
2984         these asynchronous dispatches are made static and return an ExceptionOr
2985         value. CryptoAlgorithmParameters objects are passed through non-const
2986         references because data getters could lazily construct the underlying
2987         Vector objects. CryptoKey objects are passed through const references.
2988         Implementations can then manually retrieve and further validate any key
2989         or parameter data, as required for that specific implementation. Input
2990         data is passed through const references to the original Vector objects.
2991
2992         No new tests -- no changes in behavior that's covered by existing tests.
2993
2994         * crypto/CryptoAlgorithm.cpp:
2995         (WebCore::dispatchOperationImpl):
2996         (WebCore::CryptoAlgorithm::dispatchOperation):
2997         * crypto/CryptoAlgorithm.h:
2998         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
2999         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::encrypt):
3000         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::decrypt):
3001         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h:
3002         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
3003         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::sign):
3004         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::verify):
3005         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h:
3006         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
3007         (WebCore::CryptoAlgorithmRSA_OAEP::encrypt):
3008         (WebCore::CryptoAlgorithmRSA_OAEP::decrypt):
3009         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h:
3010         * crypto/algorithms/CryptoAlgorithmRSA_PSS.cpp:
3011         (WebCore::CryptoAlgorithmRSA_PSS::sign):
3012         (WebCore::CryptoAlgorithmRSA_PSS::verify):
3013         * crypto/algorithms/CryptoAlgorithmRSA_PSS.h:
3014         * crypto/gcrypt/CryptoAlgorithmRSAES_PKCS1_v1_5GCrypt.cpp:
3015         (WebCore::gcryptEncrypt):
3016         (WebCore::gcryptDecrypt):
3017         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformEncrypt):
3018         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformDecrypt):
3019         * crypto/gcrypt/CryptoAlgorithmRSASSA_PKCS1_v1_5GCrypt.cpp:
3020         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformSign):
3021         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformVerify):
3022         * crypto/gcrypt/CryptoAlgorithmRSA_OAEPGCrypt.cpp:
3023         (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt):
3024         (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt):
3025         * crypto/gcrypt/CryptoAlgorithmRSA_PSSGCrypt.cpp:
3026         (WebCore::CryptoAlgorithmRSA_PSS::platformSign):
3027         (WebCore::CryptoAlgorithmRSA_PSS::platformVerify):
3028         * crypto/mac/CryptoAlgorithmRSAES_PKCS1_v1_5Mac.cpp:
3029         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformEncrypt):
3030         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformDecrypt):
3031         * crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp:
3032         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformSign):
3033         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformVerify):
3034         * crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp:
3035         (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt):
3036         (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt):
3037         * crypto/mac/CryptoAlgorithmRSA_PSSMac.cpp:
3038         (WebCore::CryptoAlgorithmRSA_PSS::platformSign):
3039         (WebCore::CryptoAlgorithmRSA_PSS::platformVerify):
3040
3041 2017-08-24  Chris Dumez  <cdumez@apple.com>
3042
3043         Unreviewed, add File and Directory Entries API to status page.
3044
3045         * features.json:
3046
3047 2017-08-24  Chris Dumez  <cdumez@apple.com>
3048
3049         Unreviewed, update status of Beacon API.
3050
3051         It is now supported in Safari Technology Preview.
3052
3053         * features.json:
3054
3055 2017-08-24  Chris Dumez  <cdumez@apple.com>
3056
3057         [Directory Upload] Add basic support for input.webkitdirectory
3058         https://bugs.webkit.org/show_bug.cgi?id=175950
3059         <rdar://problem/33951915>
3060
3061         Reviewed by Geoffrey Garen.
3062
3063         Add basic support for input.webkitdirectory attribute, as per:
3064         - https://wicg.github.io/entries-api/#html-forms
3065
3066         The following is supported:
3067         - input.webkitdirectory IDL and content attributes
3068         - The webkitdirectory content attribute is properly consulted
3069           to communicate to the client that the file picker should
3070           allow selecting directories.
3071         - When WebCore gets the list of selected files from the file picker,
3072           it properly resolves folders in a background thread to properly
3073           initialize input.files before firing the 'change' event at the
3074           input element.
3075         - When resolving files in a directory, we ignore both hidden files and
3076           symbolic links for security reasons. I did not check symlinks but Firefox
3077           and Chrome both seem to upload hidden files (such as .DS_Store files).
3078         - File.webkitRelativePath IDL attribute is properly populated for
3079           files coming from a selected directory.
3080         - Form submission just works because it relies on input.files being
3081           properly populated. No change needed in this area.
3082
3083         What is not supported:
3084         - input.webkitEntries IDL attribute.
3085         - FileSystemEntry / FileSystemDirectoryEntry / FileSystemDirectoryReader
3086           /  FileSystemFileEntry / FileSystem IDL interfaces.
3087         - dataTransferItem.webkitGetAsEntry() for proper drag and drop support.
3088
3089         Those will be taken care of in follow-up patches.
3090
3091         The feature is currently behind an experimental feature flag, disabled by
3092         default.
3093
3094         Tests: fast/forms/file/webkitdirectory-drag-folder.html
3095                fast/forms/file/webkitdirectory-open-panel.html
3096
3097         * CMakeLists.txt:
3098         * WebCore.xcodeproj/project.pbxproj:
3099         * fileapi/File.cpp:
3100         (WebCore::File::createWithRelativePath):
3101         * fileapi/File.h:
3102         * fileapi/File.idl:
3103         * html/FileInputType.cpp:
3104         (WebCore::FileInputType::~FileInputType):
3105         (WebCore::FileInputType::handleDOMActivateEvent):
3106         (WebCore::FileInputType::allowsDirectories const):
3107         (WebCore::FileInputType::filesChosen):
3108         * html/FileInputType.h:
3109         * html/FileListCreator.cpp: Added.
3110         (WebCore::appendDirectoryFiles):
3111         (WebCore::FileListCreator::FileListCreator):
3112         (WebCore::FileListCreator::createFileList):
3113         (WebCore::FileListCreator::cancel):
3114         * html/FileListCreator.h: Copied from Source/WebKit/UIProcess/API/APIOpenPanelParameters.h.
3115         (WebCore::FileListCreator::create):
3116         * html/HTMLAttributeNames.in:
3117         * html/HTMLInputElement.idl:
3118         * page/Settings.in:
3119         * platform/FileChooser.h:
3120         (WebCore::FileChooserFileInfo::isolatedCopy const):
3121         * platform/FileMetadata.h:
3122         * platform/FileSystem.cpp:
3123         (WebCore::fileIsDirectory):
3124         * platform/FileSystem.h:
3125         * platform/glib/FileSystemGlib.cpp:
3126         (WebCore::getFileMetadata):
3127         * platform/posix/FileSystemPOSIX.cpp:
3128         (WebCore::getFileMetadata):
3129         * platform/win/FileSystemWin.cpp:
3130         (WebCore::getFileMetadata):
3131
3132 2017-08-24  Ryan Haddad  <ryanhaddad@apple.com>
3133
3134         Unreviewed, rolling out r221139.
3135
3136         This change did not resolve the LayoutTest assertion failure.
3137
3138         Reverted changeset:
3139
3140         "REGRESSION (r220052): ASSERTION FAILED:
3141         !frame().isMainFrame() || !needsStyleRecalcOrLayout()  in
3142         WebCore::FrameView::updateLayoutAndStyleIfNeededRecursive()"
3143         https://bugs.webkit.org/show_bug.cgi?id=175270
3144         http://trac.webkit.org/changeset/221139
3145
3146 2017-08-24  Jon Lee  <jonlee@apple.com>
3147
3148         Unreviewed.
3149
3150         * Modules/mediastream/MediaStreamTrack.idl: Remove extraneous and confusing comment in IDL.
3151         The 'new' enum was removed via r215198, so we can remove this specific FIXME.
3152
3153 2017-08-24  Alex Christensen  <achristensen@webkit.org>
3154
3155         Stop using PolicyCallback for new window policies
3156         https://bugs.webkit.org/show_bug.cgi?id=175907
3157
3158         Reviewed by Andy Estes.
3159
3160         PolicyCallback is an artifact from the days before C++11.  Let's use lambdas instead!
3161         No change in behaviour.
3162
3163         * loader/PolicyCallback.cpp:
3164         (WebCore::PolicyCallback::set):
3165         (WebCore::PolicyCallback::call):
3166         (WebCore::PolicyCallback::cancel):
3167         * loader/PolicyCallback.h:
3168         * loader/PolicyChecker.cpp:
3169         (WebCore::PolicyChecker::checkNewWindowPolicy):
3170         (WebCore::PolicyChecker::continueAfterNewWindowPolicy): Deleted.
3171         * loader/PolicyChecker.h:
3172
3173 2017-08-24  Michael Saboff  <msaboff@apple.com>
3174
3175         Add support for RegExp "dotAll" flag
3176         https://bugs.webkit.org/show_bug.cgi?id=175924
3177
3178         Reviewed by Keith Miller.
3179
3180         Changed due to refactoring NewlineClassID to DotClassID.
3181
3182         No new tests. No change in behavior.
3183
3184         * contentextensions/URLFilterParser.cpp:
3185         (WebCore::ContentExtensions::PatternParser::atomBuiltInCharacterClass):
3186
3187 2017-08-24  Ryan Haddad  <ryanhaddad@apple.com>
3188
3189         Unreviewed, revert part of r221152 to fix internal builds.
3190
3191         * crypto/mac/CryptoKeyRSAMac.cpp:
3192         (WebCore::CryptoKeyRSA::create):
3193
3194 2017-08-24  Kirill Ovchinnikov  <kirill.ovchinn@gmail.com>
3195
3196         HTMLTrackElement behavior violates the standard
3197         https://bugs.webkit.org/show_bug.cgi?id=175888
3198
3199         Reviewed by Eric Carlson.
3200
3201         Test: media/track/text-track-src-change.html: added asserts
3202
3203         * html/HTMLTrackElement.cpp:
3204         (WebCore::HTMLTrackElement::parseAttribute):
3205         (WebCore::HTMLTrackElement::loadTimerFired):
3206         * html/track/LoadableTextTrack.cpp:
3207         (WebCore::LoadableTextTrack::scheduleLoad):
3208         * html/track/TextTrack.cpp:
3209         (WebCore::TextTrack::removeAllCues):
3210         * html/track/TextTrackCueList.cpp:
3211         (WebCore::TextTrackCueList::removeAll):
3212         * html/track/TextTrackCueList.h:
3213
3214 2017-08-24  David Kilzer  <ddkilzer@apple.com>
3215
3216         Fix -Wcast-qual and -Wunused-lambda-capture warnings in WebCore with new clang compiler
3217         <https://webkit.org/b/175910>
3218         <rdar://problem/33667497>
3219
3220         Reviewed by Alex Christensen.
3221
3222         Fix -Wunused-lambda-capture warnings:
3223
3224         * Modules/fetch/FetchResponse.cpp:
3225         (WebCore::FetchResponse::setBodyData): Remove unused lambda
3226         capture of 'this'.
3227         * style/RenderTreeUpdater.cpp:
3228         (WebCore::RenderTreeUpdater::createRenderer): Add
3229         UNUSED_PARAM(style) when ENABLE(CSS_REGIONS) is turned off.
3230
3231         Fix -Wcast-qual warnings:
3232
3233         * crypto/mac/CryptoKeyRSAMac.cpp:
3234         (WebCore::CryptoKeyRSA::create): Switch from C-style cast to
3235         reinterpret_cast with const keyword.  This better matches the
3236         argument types used in CCRSACryptorCreateFromData().
3237         * platform/audio/mac/FFTFrameMac.cpp:
3238         (WebCore::FFTFrame::doFFT): Switch from C-style cast to
3239         reinterpret_cast with const keyword.  This better matches the
3240         argument type used in vDSP_ctoz().
3241         * platform/graphics/FontPlatformData.h: Only define
3242         WebCore::toCTFont() and WebCore::toNSFont() when building for
3243         Objective-C++.
3244         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3245         (WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForLoadingOfResource):
3246         Switch from C-style cast to reinterpret_cast with const keyword.
3247         This better matches the argument type used in
3248         Uint8Array::setRange().
3249         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
3250         (WebCore::CMTimebaseEffectiveRateChangedCallback): Use
3251         const_cast to avoid warning.
3252         * platform/mac/SSLKeyGeneratorMac.mm:
3253         (WebCore::signedPublicKeyAndChallengeString): Use const_cast to
3254         avoid warning, and switch C-style cast to reinterpret_cast.
3255         * xml/XSLTProcessorLibxslt.cpp:
3256         (WebCore::XSLTProcessor::transformToString):
3257         - Use const_cast to avoid warning, and switch C-style cast to
3258           reinterpret_cast.
3259         - Switch C-style cast to reinterpret_cast and add const keyword.
3260         * xml/parser/XMLDocumentParserLibxml2.cpp:
3261         (WebCore::XMLParserContext::createMemoryParser): Use const_cast
3262         to avoid warning, and switch C-style cast to reinterpret_cast.
3263
3264 2017-08-22  Dave Hyatt  <hyatt@apple.com>
3265
3266         [Repaint Outside Layout] Add a pref for repainting outside of layout
3267         https://bugs.webkit.org/show_bug.cgi?id=175729
3268
3269         Reviewed by Daniel Bates.
3270
3271         * page/Settings.in:
3272         * rendering/RenderElement.cpp:
3273         (WebCore::RenderElement::checkForRepaintDuringLayout):
3274
3275 2017-08-22  Darin Adler  <darin@apple.com>
3276
3277         REGRESSION (r220052): ASSERTION FAILED: !frame().isMainFrame() || !needsStyleRecalcOrLayout()  in WebCore::FrameView::updateLayoutAndStyleIfNeededRecursive()
3278         https://bugs.webkit.org/show_bug.cgi?id=175270
3279
3280         Reviewed by Simon Fraser.
3281
3282         * dom/Document.cpp:
3283         (WebCore::Document::Document): Initialize m_styleRecalcTimer with a lamdba so it can work
3284         with a function that returns a bool and ignore the return value.
3285         (WebCore::Document::updateStyleIfNeeded): Added a boolean return value indicating if the
3286         function did any work or not.
3287         * dom/Document.h: Updated for above change.
3288
3289         * page/FrameView.cpp:
3290         (WebCore::appendRenderedChildren): Added helper that will later replace the
3291         FrameView::renderedChildFrameViews function and is used below.
3292         (WebCore::FrameView::updateLayoutAndStyleIfNeededRecursive): Instead of always doing two
3293         passes of style and layout update do up to four passes, but stop as soon as a pass does
3294         no work. This is slightly more efficient in cases where no layout and style update is
3295         needed, and works correctly when a third pass is needed, which is what happens in the
3296         test that was failing. We can eventually improve this further, but this resolves the
3297         immediate problem we are seeing in the test.
3298
3299 2017-08-24  Don Olmstead  <don.olmstead@sony.com>
3300
3301         [CMake] Use find_package for SQLite
3302         https://bugs.webkit.org/show_bug.cgi?id=175803
3303
3304         Reviewed by Konstantin Tokarev.
3305
3306         No new tests. No change in behavior.
3307
3308         * CMakeLists.txt:
3309         * PlatformGTK.cmake:
3310         * PlatformMac.cmake:
3311         * PlatformWPE.cmake:
3312         * PlatformWinCairo.cmake:
3313
3314 2017-08-23  Adrian Perez de Castro  <aperez@igalia.com>
3315
3316         Geoclue2 based backend should provide the right desktop ID
3317         https://bugs.webkit.org/show_bug.cgi?id=129879
3318
3319         Reviewed by Michael Catanzaro.
3320
3321         * platform/geoclue/GeolocationProviderGeoclue.cpp:
3322         (GeolocationProviderGeoclue::createGeoclueClientProxyCallback): Try first obtaining the application
3323         identifier using GApplication first, keeping a fallback to the value returned by g_get_prgname().
3324
3325 2017-08-24  Zan Dobersek  <zdobersek@igalia.com>
3326
3327         [EME] Implement HTMLMediaElement dispatch of the onencrypted event
3328         https://bugs.webkit.org/show_bug.cgi?id=175927
3329
3330         Reviewed by Xabier Rodriguez-Calvar.
3331
3332         Add the MediaPlayerClient::mediaPlayerInitializationDataEncountered()
3333         method that the platform-layer media pipeline can invoke when it hits
3334         encrypted content in the media data. The initialization data and its type
3335         are passed by the caller, allowing the HTMLMediaElement override to
3336         process it further.
3337
3338         This is done in the mediaPlayerInitializationDataEncountered() override
3339         in the HTMLMediaElement class. Partially implementing the 'Initialization
3340         Data Encountered' algorithm, the 'encrypted' event is dispatched, with the
3341         MediaEncryptedEvent interface being leveraged to embed init data and init
3342         data type information. CORS and mixed-content validation of the media data
3343         is skipped for now.
3344
3345         MediaPlayer::initializationDataEncountered() method should be used to
3346         dispatch the corresponding method on the client, passing on the given init
3347         data and init data type values.
3348
3349         * html/HTMLMediaElement.cpp:
3350         (WebCore::HTMLMediaElement::mediaPlayerInitializationDataEncountered):
3351         * html/HTMLMediaElement.h:
3352         * platform/graphics/MediaPlayer.cpp:
3353         (WebCore::MediaPlayer::initializationDataEncountered):
3354         * platform/graphics/MediaPlayer.h:
3355         (WebCore::MediaPlayerClient::mediaPlayerInitializationDataEncountered):
3356
3357 2017-08-23  Wenson Hsieh  <wenson_hsieh@apple.com>
3358
3359         DeleteSelectionCommand should be robust when starting and ending editable positions cannot be found
3360         https://bugs.webkit.org/show_bug.cgi?id=175914
3361         <rdar://problem/29792688>
3362
3363         Reviewed by Ryosuke Niwa.
3364
3365         DeleteSelectionCommand can cause a null dereference if editable start and end positions are not found. This can
3366         happen when attempting to delete after selecting the contents within a canvas or output element with `read-write`
3367         `-webkit-user-modify` style. To fix this, we make the initialization step of the DeleteSelectionCommand robust
3368         when editable start and end positions are missing.
3369
3370         Test: editing/execCommand/forward-delete-read-write-canvas.html
3371
3372         * editing/DeleteSelectionCommand.cpp:
3373         (WebCore::DeleteSelectionCommand::initializePositionData):
3374
3375         Make this initialization helper indicate failure via a bool return value. DeleteSelectionCommand::doApply bails
3376         early if initializePositionData returned false.
3377
3378         (WebCore::DeleteSelectionCommand::doApply):
3379         * editing/DeleteSelectionCommand.h:
3380
3381 2017-08-23  Youenn Fablet  <youenn@apple.com>
3382
3383         [Cache API] Unify WebCore and WebKit error handling
3384         https://bugs.webkit.org/show_bug.cgi?id=175902
3385         <rdar://problem/34045933>
3386
3387         Unreviewed.
3388
3389         * Modules/cache/DOMCache.h: Fixing Windows build.
3390
3391 2017-08-23  Ryan Haddad  <ryanhaddad@apple.com>
3392
3393         Unreviewed, rolling out r221109.
3394
3395         This change caused assertion failures on iOS and macOS debug
3396         bots.
3397
3398         Reverted changeset:
3399
3400         "Stop using PolicyCallback for new window policies"
3401         https://bugs.webkit.org/show_bug.cgi?id=175907
3402         http://trac.webkit.org/changeset/221109
3403
3404 2017-08-23  Jer Noble  <jer.noble@apple.com>
3405
3406         [EME] WebCoreDecompressionSession should only report having an available frame if it has one for the current time.
3407         https://bugs.webkit.org/show_bug.cgi?id=175901
3408
3409         Reviewed by Eric Carlson.
3410
3411         The WebCoreDecompressionSession will trigger the hasAvailableFrame callback whenever a frame is decoded,
3412         regardless of its presentation time. For formats which have out-of-order decoding, the newly decoded frame could
3413         have a presentation time far in the future. Instead, only fire the callback if the decoded frame's presentation
3414         times contains the timebase's current time.
3415
3416         * platform/graphics/cocoa/WebCoreDecompressionSession.mm:
3417         (WebCore::WebCoreDecompressionSession::enqueueDecodedSample):
3418
3419 2017-08-23  Youenn Fablet  <youenn@apple.com>
3420
3421         [Cache API] Unify WebCore and WebKit error handling
3422         https://bugs.webkit.org/show_bug.cgi?id=175902
3423
3424         Reviewed by Alex Christensen.
3425
3426         No change of behavior.
3427
3428         Introducing a DOMCache namespace enclosing structures, callbacks and function definitions
3429         previously found in either WebCore::CacheStorageConnection or WebKit::CacheStorage.
3430
3431         Some previously used callbacks had no way to pass errors in WebCore while they had in WebKit.
3432         Updated Cache, CacheStorage, CacheStorageConnection and WorkerCacheStorageConnection to deal with these potential errors.
3433
3434         * CMakeLists.txt:
3435         * Modules/cache/Cache.cpp:
3436         (WebCore::FetchTasksHandler::FetchTasksHandler):
3437         (WebCore::FetchTasksHandler::records const):
3438         (WebCore::FetchTasksHandler::addRecord):
3439         (WebCore::Cache::addAll):
3440         (WebCore::Cache::put):
3441         (WebCore::Cache::retrieveRecords):
3442         (WebCore::queryCacheMatch):
3443         (WebCore::Cache::batchDeleteOperation):
3444         (WebCore::toConnectionRecord):
3445         (WebCore::Cache::batchPutOperation):
3446         (WebCore::Cache::updateRecords):
3447         * Modules/cache/Cache.h:
3448         * Modules/cache/CacheStorage.cpp:
3449         (WebCore::CacheStorage::retrieveCaches):
3450         (WebCore::CacheStorage::open):
3451         (WebCore::CacheStorage::remove):
3452         * Modules/cache/CacheStorage.h:
3453         * Modules/cache/CacheStorageConnection.cpp:
3454         (WebCore::CacheStorageConnection::open):
3455         (WebCore::CacheStorageConnection::remove):
3456         (WebCore::CacheStorageConnection::retrieveCaches):
3457         (WebCore::CacheStorageConnection::batchDeleteOperation):
3458         (WebCore::CacheStorageConnection::batchPutOperation):
3459         (WebCore::CacheStorageConnection::openOrRemoveCompleted):
3460         (WebCore::CacheStorageConnection::updateCaches):
3461         (WebCore::CacheStorageConnection::updateRecords):
3462         (WebCore::CacheStorageConnection::deleteRecordsCompleted):
3463         (WebCore::CacheStorageConnection::putRecordsCompleted):
3464         * Modules/cache/CacheStorageConnection.h:
3465         (WebCore::CacheStorageConnection::openCompleted):
3466         (WebCore::CacheStorageConnection::removeCompleted):
3467         (WebCore::CacheStorageConnection::doOpen):
3468         (WebCore::CacheStorageConnection::doRemove):
3469         (WebCore::CacheStorageConnection::doBatchDeleteOperation):
3470         (WebCore::CacheStorageConnection::doBatchPutOperation):
3471         * Modules/cache/WorkerCacheStorageConnection.cpp:
3472         (WebCore::toCrossThreadRecordData):
3473         (WebCore::fromCrossThreadRecordData):
3474         (WebCore::WorkerCacheStorageConnection::doOpen):
3475         (WebCore::WorkerCacheStorageConnection::doRemove):
3476         (WebCore::WorkerCacheStorageConnection::doRetrieveCaches):
3477         (WebCore::recordsDataFromRecords):
3478         (WebCore::recordsDataOrErrorFromRecords):
3479         (WebCore::recordsFromRecordsData):
3480         (WebCore::recordsOrErrorFromRecordsData):
3481         (WebCore::WorkerCacheStorageConnection::doRetrieveRecords):
3482         (WebCore::WorkerCacheStorageConnection::doBatchDeleteOperation):
3483         (WebCore::WorkerCacheStorageConnection::doBatchPutOperation):
3484         * Modules/cache/DOMCache.cpp: Added.
3485         * Modules/cache/DOMCache.h: Added.
3486         * Modules/cache/WorkerCacheStorageConnection.h:
3487         * WebCore.xcodeproj/project.pbxproj:
3488
3489 2017-08-23  Yusuke Suzuki  <utatane.tea@gmail.com>
3490
3491         [JSC] Optimize Map iteration with intrinsic
3492         https://bugs.webkit.org/show_bug.cgi?id=174355
3493
3494         Reviewed by Saam Barati.