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