2c794554ab0e0757071bebb0d6cfa714c4c03d7b
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-12-11  Zalan Bujtas  <zalan@apple.com>
2
3         FloatingObjects/FloatingObject classes should hold weak references to renderers
4         https://bugs.webkit.org/show_bug.cgi?id=180627
5         <rdar://problem/35954069>
6
7         Reviewed by Antti Koivisto.
8
9         * rendering/FloatingObjects.cpp:
10         (WebCore::FloatingObject::FloatingObject):
11         (WebCore::ComputeFloatOffsetAdapter::ComputeFloatOffsetAdapter):
12         (WebCore::ComputeFloatOffsetForFloatLayoutAdapter::ComputeFloatOffsetForFloatLayoutAdapter):
13         (WebCore::ComputeFloatOffsetForLineLayoutAdapter::ComputeFloatOffsetForLineLayoutAdapter):
14         (WebCore::FindNextFloatLogicalBottomAdapter::FindNextFloatLogicalBottomAdapter):
15         (WebCore::FindNextFloatLogicalBottomAdapter::collectIfNeeded):
16         (WebCore::FloatingObjects::findNextFloatLogicalBottomBelow):
17         (WebCore::FloatingObjects::findNextFloatLogicalBottomBelowForBlock):
18         (WebCore::FloatingObjects::FloatingObjects):
19         (WebCore::FloatingObjects::clearLineBoxTreePointers):
20         (WebCore::FloatingObjects::logicalLeftOffsetForPositioningFloat):
21         (WebCore::FloatingObjects::logicalRightOffsetForPositioningFloat):
22         (WebCore::FloatingObjects::logicalLeftOffset):
23         (WebCore::FloatingObjects::logicalRightOffset):
24         (WebCore::ComputeFloatOffsetForFloatLayoutAdapter<FloatingObject::FloatLeft>::updateOffsetIfNeeded):
25         (WebCore::ComputeFloatOffsetForFloatLayoutAdapter<FloatingObject::FloatRight>::updateOffsetIfNeeded):
26         (WebCore::ComputeFloatOffsetForFloatLayoutAdapter<FloatTypeValue>::heightRemaining const):
27         (WebCore::ComputeFloatOffsetAdapter<FloatTypeValue>::collectIfNeeded):
28         (WebCore::ComputeFloatOffsetForLineLayoutAdapter<FloatingObject::FloatLeft>::updateOffsetIfNeeded):
29         (WebCore::ComputeFloatOffsetForLineLayoutAdapter<FloatingObject::FloatRight>::updateOffsetIfNeeded):
30         * rendering/FloatingObjects.h:
31         (WebCore::FloatingObject::renderer const):
32         (WebCore::FloatingObjects::renderer const):
33
34 2017-12-11  David Quesada  <david_quesada@apple.com>
35
36         Turn on ENABLE_APPLICATION_MANIFEST
37         https://bugs.webkit.org/show_bug.cgi?id=180562
38         rdar://problem/35924737
39
40         Reviewed by Geoffrey Garen.
41
42         * Configurations/FeatureDefines.xcconfig:
43         * loader/LinkLoader.cpp:
44         (WebCore::createLinkPreloadResourceClient):
45         * loader/cached/CachedResourceRequest.cpp:
46             Add a missing #include that was implicitly added in the unified source when
47             the feature is disabled.
48
49 2017-12-11  Dean Jackson  <dino@apple.com>
50
51         Add a runtime feature flag for ImageBitmap and OffscreenCanvas
52         https://bugs.webkit.org/show_bug.cgi?id=180652
53         <rdar://problem/35969611>
54
55         Reviewed by Antoine Quint.
56
57         Add a RuntimeEnabledFeature for these interfaces, and link the bindings
58         to the feature.
59
60         Test: fast/canvas/offscreen-enabled.html
61
62         * bindings/js/WebCoreBuiltinNames.h:
63         * html/ImageBitmap.idl:
64         * html/OffscreenCanvas.idl:
65         * page/RuntimeEnabledFeatures.h:
66         (WebCore::RuntimeEnabledFeatures::setImageBitmapOffscreenCanvasEnabled):
67         (WebCore::RuntimeEnabledFeatures::imageBitmapOffscreenCanvasEnabled const):
68         * page/WindowOrWorkerGlobalScope.idl:
69
70 2017-12-11  Antoine Quint  <graouts@apple.com>
71
72         [Web Animations] Implement AnimationPlaybackEvent and AnimationPlaybackEventInit
73         https://bugs.webkit.org/show_bug.cgi?id=180647
74         <rdar://problem/35966325>
75
76         Reviewed by Dean Jackson.
77
78         We implement the AnimationPlaybackEvent interface and AnimationPlaybackEventInit dictionary
79         as the first step towards dispatching animation "finish" and "cancel" events.
80
81         Animation playback events will be dispatched on Animation objects and expose the timeline time
82         and animation current time at the time they were constructed. Dispatch itself, which will be
83         the focus of the next patch, is not synchronous, so it's important to track those values
84         at creation time.
85
86         No new tests yet, followup patches will enable event dispatch and existing Web Platform Tests
87         will show progressions.
88
89         * CMakeLists.txt:
90         * DerivedSources.make:
91         * Sources.txt:
92         * WebCore.xcodeproj/project.pbxproj:
93         * animation/AnimationPlaybackEvent.cpp: Added.
94         (WebCore::AnimationPlaybackEvent::AnimationPlaybackEvent):
95         (WebCore::AnimationPlaybackEvent::bindingsCurrentTime const):
96         (WebCore::AnimationPlaybackEvent::bindingsTimelineTime const):
97         * animation/AnimationPlaybackEvent.h: Added.
98         * animation/AnimationPlaybackEvent.idl: Added.
99         * animation/AnimationPlaybackEventInit.h: Added.
100         * animation/AnimationPlaybackEventInit.idl: Added.
101         * bindings/js/WebCoreBuiltinNames.h:
102         * dom/EventNames.in:
103
104 2017-12-11  Basuke Suzuki  <Basuke.Suzuki@sony.com>
105
106         [WinCairo] DumpRenderTree times out for all non-http tests
107         https://bugs.webkit.org/show_bug.cgi?id=180571
108
109         Reviewed by Alex Christensen.
110
111         Bug fix on processing the curl event for file protocol.
112
113         No new tests. This fix is to run existing tests.
114
115         * platform/network/curl/CurlRequest.cpp:
116         (WebCore::CurlRequest::completeDidReceiveResponse):
117         * platform/network/curl/CurlRequest.h:
118         (WebCore::CurlRequest::isCompleted const):
119         (WebCore::CurlRequest::isCancelled const):
120         (WebCore::CurlRequest::isCompletedOrCancelled const):
121
122 2017-12-11  Manuel Rego Casasnovas  <rego@igalia.com>
123
124         REGRESSION(r221931): Row stretch doesn't work for grid container with min-height
125         https://bugs.webkit.org/show_bug.cgi?id=180287
126
127         Reviewed by Darin Adler.
128
129         In r221931 we moved the stretch phase as the last step of
130         the track sizing algorithm.
131         However this introduced a regression as we were no longer
132         taking into account the grid container min-width|height constraints
133         during this step.
134
135         The CSS WG modified the spec so it now defines what to do
136         in these situations (https://drafts.csswg.org/css-grid/#algo-stretch):
137           "If the free space is indefinite, but the grid container
138            has a definite min-width/height, use that size to calculate
139            the free space for this step instead."
140
141         This patch adds a new method
142         GridTrackSizingAlgorithmStrategy::freeSpaceForStretchAutoTracksStep().
143         When we're in the DefiniteSizeStrategy it just returns the current
144         free space.
145         For the IndefiniteSizeStrategy in the columns case we don't need
146         any special computation (the same that happens in
147         recomputeUsedFlexFractionIfNeeded()); for rows it uses the min size
148         of the grid container (respecting min-width|height properties)
149         to calculate the free space.
150
151         Test: imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/grid-stretch-respects-min-size-001.html
152
153         * rendering/GridTrackSizingAlgorithm.cpp:
154         (WebCore::IndefiniteSizeStrategy::freeSpaceForStretchAutoTracksStep const):
155         (WebCore::DefiniteSizeStrategy::freeSpaceForStretchAutoTracksStep const):
156         (WebCore::GridTrackSizingAlgorithm::stretchAutoTracks):
157         * rendering/GridTrackSizingAlgorithm.h:
158
159 2017-12-10  Minsheng Liu  <lambda@liu.ms>
160
161         Incorrect bounds inside <mover>/<munder> when a stretchy operator is present
162         https://bugs.webkit.org/show_bug.cgi?id=179682
163
164         Reviewed by Frédéric Wang.
165
166         Currently a stretchy operator inside <mover>/<munder>/<munderover> is stretched
167         during paint() rather than layout(), which leads to both end user confusion
168         and many unexpected behaviors. This patch rewrites
169         RenderMathMLUnderOver::stretchHorizontalOperatorsAndLayoutChildren()
170         to both eliminate the issue and make operator stretching more standard
171         conforming.
172
173         A test is added to check the stretch width of stretchy operators in various
174         scenarios:
175         mathml/opentype/munderover-stretch-width.html
176
177         A previous test is updated:
178         mathml/opentype/opentype-stretchy-horizontal.html
179
180         * rendering/mathml/RenderMathMLOperator.cpp:
181         (WebCore::RenderMathMLOperator::stretchTo):
182         (WebCore::RenderMathMLOperator::resetStretchSize):
183         (WebCore::RenderMathMLOperator::paint):
184         * rendering/mathml/RenderMathMLOperator.h:
185         (WebCore::RenderMathMLOperator::setStretchWidthLocked):
186         (WebCore::RenderMathMLOperator::isStretchWidthLocked const):
187         * rendering/mathml/RenderMathMLUnderOver.cpp:
188         (WebCore::toHorizontalStretchyOperator):
189         (WebCore::fixLayoutAfterStretch):
190         (WebCore::RenderMathMLUnderOver::stretchHorizontalOperatorsAndLayoutChildren):
191
192 2017-12-10  Yusuke Suzuki  <utatane.tea@gmail.com>
193
194         Unreviewed, follow-up patch after r225470
195         https://bugs.webkit.org/show_bug.cgi?id=180308
196
197         * Modules/webdatabase/SQLTransaction.cpp:
198         (WebCore::SQLTransaction::checkAndHandleClosedDatabase):
199         Use consistent operands.
200
201         * bindings/js/JSCallbackData.h:
202         (WebCore::JSCallbackData::JSCallbackData):
203         Use class field initializer.
204
205         * xml/parser/XMLDocumentParserLibxml2.cpp:
206         (WebCore::openFunc):
207         Use consistent operands.
208
209 2017-12-09  Ryosuke Niwa  <rniwa@webkit.org>
210
211         iOS: Crash in Document::updateLayout() via Document::processViewport
212         https://bugs.webkit.org/show_bug.cgi?id=180619
213         <rdar://problem/35717575>
214
215         Reviewed by Zalan Bujtas.
216
217         The crash is caused by modern media controls updating the layout in the middle of insertedIntoAncestor
218         via HTMLMediaElement::setControllerJSProperty inside Document::pageScaleFactorChangedAndStable.
219
220         Fixed the crash by delaying the work to update the viewport configuration until didFinishInsertingNode
221         since updating the viewport configuration results in a lot of related code running in response,
222         and making sure all that code never tries to execute an author script is not attainable in the short term,
223         and a maintenance nightmare in the long term.
224
225         Test: media/ios/viewport-change-with-video.html
226
227         * html/HTMLMetaElement.cpp:
228         (WebCore::HTMLMetaElement::insertedIntoAncestor):
229         (WebCore::HTMLMetaElement::didFinishInsertingNode): Added.
230         * html/HTMLMetaElement.h:
231
232 2017-12-08  Zalan Bujtas  <zalan@apple.com>
233
234         Document::updateLayout() could destroy current frame.
235         https://bugs.webkit.org/show_bug.cgi?id=180525
236         <rdar://problem/35906836>
237
238         Reviewed by Simon Fraser.
239
240         Early return when Document::updateLayout() triggers Frame destruction.
241
242         Test: fast/frames/crash-when-iframe-is-remove-in-eventhandler.html
243
244         * dom/TreeScope.cpp:
245         (WebCore::absolutePointIfNotClipped):
246
247 2017-12-08  Chris Dumez  <cdumez@apple.com>
248
249         ServiceWorkerGlobalScope is a global object and should be marked as [ImplicitThis] in the IDL
250         https://bugs.webkit.org/show_bug.cgi?id=180615
251
252         Reviewed by Brady Eidson.
253
254         ServiceWorkerGlobalScope is a global object and should be marked as [ImplicitThis] in the IDL, similarly to what we do for Window.
255         This allows a getter to be fallback to the global object as ThisValue when the cast of the ThisValue to the expected type fails.
256
257         No new tests, rebaselined existing test.
258
259         * workers/DedicatedWorkerGlobalScope.idl:
260         * workers/WorkerGlobalScope.idl:
261         * workers/service/ServiceWorkerGlobalScope.idl:
262
263 2017-12-08  Brady Eidson  <beidson@apple.com>
264
265         Delay some service worker operations until after the database import completes.
266         https://bugs.webkit.org/show_bug.cgi?id=180573
267
268         Reviewed by Chris Dumez.
269
270         No new tests (Not testable yet).
271
272         Right after the storage process launches it starts importing registration records.
273         During this time, a lot of the decisions we make regarding registrations, fetch, etc.
274         are invalid, as they rely on those in-memory records being in place.
275         
276         This patch delays certain things until after the initial origin table import is complete.
277         
278         * workers/service/server/RegistrationStore.cpp:
279         (WebCore::RegistrationStore::databaseOpenedAndRecordsImported):
280
281         * workers/service/server/SWOriginStore.h:
282
283         * workers/service/server/SWServer.cpp:
284         (WebCore::SWServer::registrationStoreImportComplete): Tell the origin store the initial
285           import was completed.
286         (WebCore::SWServer::addRegistrationFromStore):
287         * workers/service/server/SWServer.h:
288
289 2017-12-08  Youenn Fablet  <youenn@apple.com>
290
291         Service Worker should use a correct user agent
292         https://bugs.webkit.org/show_bug.cgi?id=180566
293         <rdar://problem/35926295>
294
295         Reviewed by Chris Dumez.
296
297         Test: http/wpt/service-workers/useragent.https.html
298
299         Make ServiceWorkerFrameLoaderClient return a valid UserAgent.
300         Pass user agent to ServiceWorkerThread so that navigation.userAgent is correctly initialized.
301         Allow ServiceWorkerFrameLoaderClient to clean itself when no longer needed.
302
303         * loader/EmptyFrameLoaderClient.h:
304         * workers/service/context/ServiceWorkerThread.cpp:
305         (WebCore::ServiceWorkerThread::ServiceWorkerThread):
306         * workers/service/context/ServiceWorkerThread.h:
307         * workers/service/context/ServiceWorkerThreadProxy.cpp:
308         (WebCore::ServiceWorkerThreadProxy::ServiceWorkerThreadProxy):
309         (WebCore::ServiceWorkerThreadProxy::frameLoaderClient):
310         * workers/service/context/ServiceWorkerThreadProxy.h:
311
312 2017-12-07  Simon Fraser  <simon.fraser@apple.com>
313
314         Wrong caret position for input field inside a fixed position parent on iOS 11
315         https://bugs.webkit.org/show_bug.cgi?id=176896
316         rdar://problem/33726145
317
318         Reviewed by Tim Horton.
319
320         In r219668 I added code to compute a layout viewport rect in the web process, so that
321         after programmatic scrolling, getBoundingClientRect() would return the correct values.
322         However, that computation sometimes used a different visual viewport than the UI process,
323         resulting in a different layout viewport being set. This would happen when the keyboard
324         was visible, and the combination of this and zooming when focusing an input would result
325         in a state where the scrolling tree contained notes computed with the bad layout viewport.
326         This could cause apparently offset fixed elements, and bad caret positioning if those fixed
327         elements contained the focused input.
328
329         Fix by passing to the web process the same visual viewport rect that the UI process is using,
330         namely "unobscuredContentRectRespectingInputViewBounds". This was already being set in
331         VisibleContentRectUpdateInfo but wasn't encoded/decoded, so fix that. Set it as an optional<>
332         on FrameView when different from the normal visual viewport, and return it from
333         visualViewportRect().
334
335         Some other minor logging changes.
336
337         Test: fast/visual-viewport/ios/caret-after-focus-in-fixed.html
338
339         * page/FrameView.cpp:
340         (WebCore::FrameView::setVisualViewportOverrideRect):
341         (WebCore::FrameView::updateLayoutViewport):
342         (WebCore::FrameView::visualViewportRect const):
343         * page/FrameView.h:
344         * page/scrolling/mac/ScrollingTreeFixedNode.mm:
345         (WebCore::ScrollingTreeFixedNode::updateLayersAfterAncestorChange):
346
347 2017-12-08  Zalan Bujtas  <zalan@apple.com>
348
349         Make inline box objects IsoHeap allocated.
350         https://bugs.webkit.org/show_bug.cgi?id=180556
351         <rdar://problem/35923629>
352
353         Reviewed by Filip Pizlo.
354
355         * rendering/EllipsisBox.cpp:
356         * rendering/EllipsisBox.h:
357         * rendering/InlineBox.cpp:
358         * rendering/InlineBox.h:
359         * rendering/InlineElementBox.cpp:
360         * rendering/InlineElementBox.h:
361         * rendering/InlineFlowBox.cpp:
362         * rendering/InlineFlowBox.h:
363         * rendering/InlineTextBox.cpp:
364         * rendering/InlineTextBox.h:
365         * rendering/RootInlineBox.cpp:
366         * rendering/RootInlineBox.h:
367         * rendering/TrailingFloatsRootInlineBox.h:
368         * rendering/svg/SVGInlineFlowBox.cpp:
369         * rendering/svg/SVGInlineFlowBox.h:
370         * rendering/svg/SVGInlineTextBox.cpp:
371         * rendering/svg/SVGInlineTextBox.h:
372         * rendering/svg/SVGRootInlineBox.cpp:
373         * rendering/svg/SVGRootInlineBox.h:
374
375 2017-12-08  Chris Dumez  <cdumez@apple.com>
376
377         Clearing all Website Data should remove service worker registrations on disk
378         https://bugs.webkit.org/show_bug.cgi?id=180558
379
380         Reviewed by Youenn Fablet.
381
382         Clear service worker registrations on disk in addition to the ones in memory.
383
384         * workers/service/server/RegistrationDatabase.cpp:
385         (WebCore::v1RecordsTableSchema):
386         (WebCore::v1RecordsTableSchemaAlternate):
387         (WebCore::databaseFilename):
388         Make sure these always get called from the background thread since they use
389         a static string.
390
391         (WebCore::RegistrationDatabase::RegistrationDatabase):
392         Call importRecordsIfNecessary() instead of openSQLiteDatabase(). importRecordsIfNecessary()
393         only calls openSQLiteDatabase() if the database file exists, to avoid creating a database
394         file unnecessarily.
395
396         (WebCore::RegistrationDatabase::databasePath const):
397         New method which returns the database file path.
398
399         (WebCore::RegistrationDatabase::openSQLiteDatabase):
400
401         (WebCore::RegistrationDatabase::importRecordsIfNecessary):
402         New methods which imports records if the database file exist. It the database file does
403         not exist, it does not create it.
404
405         (WebCore::RegistrationDatabase::pushChanges):
406         Call completion handler when changes are pushed.
407
408         (WebCore::RegistrationDatabase::clearAll):
409         Close the database if it is open, then remove the database files.
410
411         (WebCore::RegistrationDatabase::doPushChanges):
412         If the database is not already open, we now open it when trying to write changes for
413         the first time.
414
415         * workers/service/server/RegistrationDatabase.h:
416         * workers/service/server/RegistrationStore.cpp:
417         (WebCore::RegistrationStore::clearAll):
418         (WebCore::RegistrationStore::flushChanges):
419         * workers/service/server/RegistrationStore.h:
420
421         * workers/service/server/SWServer.cpp:
422         (WebCore::SWServer::clearAll):
423         (WebCore::SWServer::clear):
424         Also clear the database.
425
426         * workers/service/server/SWServer.h:
427
428         * workers/service/server/SWServerWorker.cpp:
429         (WebCore::SWServerWorker::terminate):
430         Only call SWServer::terminateWorker() if the worker is running. Otherwise, we hit
431         an assertion when clearing a registration would worker was already terminated.
432
433 2017-12-08  Joseph Pecoraro  <pecoraro@apple.com>
434
435         ServiceWorker Inspector: Various issues inspecting service worker on mobile.twitter.com
436         https://bugs.webkit.org/show_bug.cgi?id=180520
437         <rdar://problem/35900764>
438
439         Reviewed by Brian Burg.
440
441         * inspector/agents/worker/ServiceWorkerAgent.cpp:
442         (WebCore::ServiceWorkerAgent::getInitializationInfo):
443         * inspector/agents/worker/ServiceWorkerAgent.h:
444         Add initial script content to initialization so we always at least have main resource content.
445
446 2017-12-08  Joseph Pecoraro  <pecoraro@apple.com>
447
448         ServiceWorker Inspector: Should be able to see image content from CacheStorage.add(url) network request
449         https://bugs.webkit.org/show_bug.cgi?id=180506
450
451         Reviewed by Brian Burg.
452
453         No test as this only happens inside a ServiceWorker inspector which
454         we don't yet have a way to test. In a Page Inspector, the
455         CacheStorage.add network request already behaves as expected.
456
457         * inspector/NetworkResourcesData.cpp:
458         (WebCore::NetworkResourcesData::responseReceived):
459         (WebCore::shouldBufferResourceData):
460         * inspector/NetworkResourcesData.h:
461         (WebCore::NetworkResourcesData::ResourceData::forceBufferData const):
462         (WebCore::NetworkResourcesData::ResourceData::setForceBufferData):
463         Provide a way to force buffering in NetworkResourceData.
464
465         * inspector/agents/InspectorNetworkAgent.cpp:
466         (WebCore::InspectorNetworkAgent::didReceiveResponse):
467         * inspector/agents/InspectorNetworkAgent.h:
468         * inspector/agents/page/PageNetworkAgent.h:
469         * inspector/agents/worker/WorkerNetworkAgent.h:
470         Enable force buffering in a Worker Network Agent.
471
472 2017-12-08  Daniel Bates  <dabates@apple.com>
473
474         Remove unnecessary prefix from AutoFillButtonType enumerators
475         https://bugs.webkit.org/show_bug.cgi?id=180512
476
477         Reviewed by Tim Horton.
478
479         * testing/Internals.cpp:
480         (WebCore::toAutoFillButtonType):
481         * testing/Internals.h:
482         * testing/Internals.idl:
483
484 2017-12-08  Dean Jackson  <dino@apple.com>
485
486         Implement transferToImageBitmap for WebGL offscreen canvas objects
487         https://bugs.webkit.org/show_bug.cgi?id=180603
488         <rdar://problem/34147143>
489
490         Reviewed by Sam Weinig.
491
492         Implement the basic version of creating an ImageBitmap from an
493         OffscreenCanvas that is using a WebGL context.
494
495         Tests: http/wpt/offscreen-canvas/transferToImageBitmap-empty.html
496                http/wpt/offscreen-canvas/transferToImageBitmap-webgl.html
497
498         * html/ImageBitmap.cpp:
499         (WebCore::ImageBitmap::create): Add a new constructor to be used by OffscreenCanvas.
500         Creates a blank ImageBitmap.
501         * html/ImageBitmap.h:
502
503         * html/OffscreenCanvas.cpp:
504         (WebCore::OffscreenCanvas::transferToImageBitmap): Create a new ImageBitmap
505         and paint the current canvas into it.
506
507 2017-12-08  Youenn Fablet  <youenn@apple.com>
508
509         WebServiceWorkerProvider should use Cancellation error to notify DTL that it cannot handle a fetch
510         https://bugs.webkit.org/show_bug.cgi?id=180584
511
512         Reviewed by Alex Christensen.
513
514         Previously, for each cross origin fetch that is going through a service worker and service worker is not handling the fetch,
515         we return an AccessControl error so that DocumentThreadableLoader will do preflight and regular load through the network.
516         This error is wrongly logged in the Inspector.
517         Change error type to Cancellation so that the Inspector does not log it.
518
519         * loader/DocumentThreadableLoader.cpp:
520         (WebCore::DocumentThreadableLoader::didFail):
521
522 2017-12-08  Youenn Fablet  <youenn@apple.com>
523
524         Service Worker should use a correct SessionID
525         https://bugs.webkit.org/show_bug.cgi?id=180585
526
527         Reviewed by Alex Christensen.
528
529         Test: http/tests/workers/service/serviceworker-private-browsing.https.html
530
531         Store SessionID in SWServer and send it as part of service worker instantiation.
532
533         * workers/service/server/SWServer.cpp:
534         (WebCore::SWServer::SWServer):
535         (WebCore::SWServer::installContextData):
536         (WebCore::SWServer::runServiceWorker):
537         * workers/service/server/SWServer.h:
538         * workers/service/server/SWServerToContextConnection.h:
539
540 2017-12-08  Youenn Fablet  <youenn@apple.com>
541
542         FetchResponse should keep unfiltered ResourceResponse so that it can be used in Service Worker
543         https://bugs.webkit.org/show_bug.cgi?id=179641
544         <rdar://problem/35923570>
545
546         Reviewed by Alex Christensen.
547
548         Covered by existing rebased tests.
549
550         FetchResponse will now store an unfiltered response.
551         If it needs to expose it to JavaScript, it will create a filtered response lazily.
552         This allows service worker to send back to web pages, opaque responses containing every information.
553
554         Updating Document::initSecurityContext so that any document loaded with a response whose tainting is Opaque gets a unique origin.
555         This ensures cross-origin checks to work if service worker returns such a response on a same origin URL.
556
557         Updated SubresourceLoader to check cross origin service worker responses based on their tainting.
558
559         * Modules/fetch/FetchResponse.cpp:
560         (WebCore::FetchResponse::create):
561         (WebCore::FetchResponse::error):
562         (WebCore::FetchResponse::redirect):
563         (WebCore::FetchResponse::FetchResponse):
564         (WebCore::FetchResponse::clone):
565         (WebCore::FetchResponse::url const):
566         (WebCore::FetchResponse::filteredResponse const):
567         (WebCore::FetchResponse::BodyLoader::didReceiveResponse):
568         (WebCore::FetchResponse::resourceResponse const):
569         * Modules/fetch/FetchResponse.h:
570         (WebCore::FetchResponse::create): Deleted.
571         * dom/Document.cpp:
572         (WebCore::Document::initSecurityContext):
573         * loader/SubresourceLoader.cpp:
574         (WebCore::SubresourceLoader::willSendRequestInternal):
575         (WebCore::SubresourceLoader::checkResponseCrossOriginAccessControl):
576
577 2017-12-08  David Quesada  <david_quesada@apple.com>
578
579         ApplicationManifestParser should strip whitespace from the raw input
580         https://bugs.webkit.org/show_bug.cgi?id=180539
581         rdar://problem/35915075
582
583         Reviewed by Joseph Pecoraro.
584
585         * Modules/applicationmanifest/ApplicationManifestParser.cpp:
586         (WebCore::ApplicationManifestParser::parseManifest):
587
588 2017-12-08  Eric Carlson  <eric.carlson@apple.com>
589
590         Move Logger from PAL to WTF so it can be used outside of WebCore
591         https://bugs.webkit.org/show_bug.cgi?id=180561
592
593         Reviewed by Alex Christensen.
594
595         No new tests, existing API test updated.
596
597         * Modules/mediastream/PeerConnectionBackend.h:
598         * Modules/mediastream/RTCPeerConnection.h:
599         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
600         (PAL::LogArgument<webrtc::RTCStats>::toString): Deleted.
601         * dom/Document.cpp:
602         * dom/Document.h:
603         * html/HTMLMediaElement.cpp:
604         (PAL::LogArgument<WebCore::URL>::toString): Deleted.
605         * html/HTMLMediaElement.h:
606         * html/HTMLMediaElementEnums.h:
607         (PAL::LogArgument<WebCore::HTMLMediaElementEnums::ReadyState>::toString): Deleted.
608         (PAL::LogArgument<WebCore::HTMLMediaElementEnums::NetworkState>::toString): Deleted.
609         * html/MediaElementSession.cpp:
610         (WebCore::MediaElementSession::logger const):
611         * html/MediaElementSession.h:
612         * html/track/DataCue.h:
613         (PAL::LogArgument<WebCore::DataCue>::toString): Deleted.
614         * html/track/TextTrackCue.h:
615         (PAL::LogArgument<WebCore::TextTrackCue>::toString): Deleted.
616         * html/track/TextTrackCueGeneric.h:
617         (PAL::LogArgument<WebCore::TextTrackCueGeneric>::toString): Deleted.
618         * html/track/TrackBase.cpp:
619         (WebCore::nullLogger):
620         (WebCore::TrackBase::TrackBase):
621         * html/track/TrackBase.h:
622         * html/track/VTTCue.h:
623         (PAL::LogArgument<WebCore::VTTCue>::toString): Deleted.
624         * platform/graphics/InbandTextTrackPrivate.h:
625         * platform/graphics/InbandTextTrackPrivateClient.h:
626         (PAL::LogArgument<WebCore::GenericCueData>::toString): Deleted.
627         * platform/graphics/MediaPlayer.cpp:
628         (WebCore::nullLogger):
629         (WebCore::MediaPlayer::mediaPlayerLogger):
630         * platform/graphics/MediaPlayer.h:
631         (WTF::LogArgument<MediaTime>::toString):
632         (PAL::LogArgument<WTF::MediaTime>::toString): Deleted.
633         * platform/graphics/MediaPlayerEnums.h:
634         (PAL::LogArgument<WebCore::MediaPlayerEnums::ReadyState>::toString): Deleted.
635         (PAL::LogArgument<WebCore::MediaPlayerEnums::NetworkState>::toString): Deleted.
636         * platform/graphics/TrackPrivateBase.cpp:
637         (WebCore::TrackPrivateBase::setLogger):
638         * platform/graphics/TrackPrivateBase.h:
639         * platform/graphics/avfoundation/AVTrackPrivateAVFObjCImpl.mm:
640         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
641         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
642         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
643         (-[WebCoreAVFMovieObserver observeValueForKeyPath:ofObject:change:context:]):
644         * platform/mediastream/RTCIceConnectionState.h:
645         (PAL::LogArgument<WebCore::RTCIceConnectionState>::toString): Deleted.
646         * platform/mediastream/RTCIceGatheringState.h:
647         (PAL::LogArgument<WebCore::RTCIceGatheringState>::toString): Deleted.
648         * platform/mediastream/RTCPeerConnectionState.h:
649         (PAL::LogArgument<WebCore::RTCPeerConnectionState>::toString): Deleted.
650         * platform/mediastream/RTCSignalingState.h:
651         (PAL::LogArgument<WebCore::RTCSignalingState>::toString): Deleted.
652         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
653
654 2017-12-08  Yusuke Suzuki  <utatane.tea@gmail.com>
655
656         Remove pthread_once in favor of dispatch_once
657         https://bugs.webkit.org/show_bug.cgi?id=180591
658
659         Reviewed by Saam Barati.
660
661         No behavior change.
662
663         * platform/mac/WebCoreNSURLExtras.mm:
664         (WebCore::allCharactersInIDNScriptWhiteList):
665         (WebCore::readIDNScriptWhiteList): Deleted.
666
667 2017-12-08  Chris Dumez  <cdumez@apple.com>
668
669         Improve error handling in RegistrationDatabase
670         https://bugs.webkit.org/show_bug.cgi?id=180587
671
672         Reviewed by Brady Eidson.
673
674         * workers/service/server/RegistrationDatabase.cpp:
675         (WebCore::RegistrationDatabase::openSQLiteDatabase):
676         (WebCore::RegistrationDatabase::doPushChanges):
677
678 2017-12-07  Darin Adler  <darin@apple.com>
679
680         Simplify and streamline some Color-related code to prepare for some Color/ExtendedColor work
681         https://bugs.webkit.org/show_bug.cgi?id=180569
682
683         Reviewed by Sam Weinig.
684
685         * accessibility/AccessibilityNodeObject.cpp:
686         (WebCore::AccessibilityNodeObject::colorValue const): Use valueAsColor instead of
687         having custom code here to parse the color string.
688
689         * css/CSSGradientValue.cpp:
690         (WebCore::interpolate): Deleted.
691         (WebCore::CSSGradientValue::computeStops): Call blend instead of interpolate. The only
692         difference is that the interpolate function truncated when converting from floating point
693         to integer, and the blend function rounds instead.
694
695         * css/StyleResolver.cpp:
696         (WebCore::StyleResolver::colorFromPrimitiveValue const): Removed unneeded special case
697         for identifier of 0, since StyleColor::colorFromKeyword already handles that correctly.
698         Also got rid of unneded local variable "state".
699
700         * html/ColorInputType.cpp:
701         (WebCore::isValidSimpleColor): Rewrote to take a StringView instead of a String and
702         to stay with a single loop since this does not need the extra efficiency of a separate
703         8-bit and 16-bit character version. Renamed to more closely match what the specification
704         calls this algorithm.
705         (WebCore::parseSimpleColorValue): Added. To be used instead of relying on the behavior of
706         the Color constructor that takes a String, so we can remove that later.
707         (WebCore::ColorInputType::sanitizeValue const): Updated for name change.
708         (WebCore::ColorInputType::valueAsColor const): Use parseSimpleColorValue instead of the
709         Color constructor that takes a string.
710         (WebCore::ColorInputType::typeMismatchFor const): Updated for name change.
711         (WebCore::ColorInputType::selectColor): Updated to take a StringView instead of a Color.
712         Note that this function is used for testing only.
713
714         * html/ColorInputType.h: Marked everything final instead of override. Updated the
715         selectColor function to take a StringView instead of a Color.
716
717         * html/HTMLInputElement.cpp:
718         (WebCore::HTMLInputElement::selectColor): Take a StringView instead of a Color.
719         * html/HTMLInputElement.h: Ditto.
720
721         * html/InputType.cpp:
722         (WebCore::InputType::selectColor): Take a StringView instead of a Color.
723         * html/InputType.h: Ditto.
724
725         * testing/Internals.cpp:
726         (WebCore::Internals::selectColorInColorChooser): Pass the string directly instead of
727         constructing a Color with it.
728         (WebCore::Internals::setViewBaseBackgroundColor): Instead of pasring the passed in string
729         with the Color constructor, implemented the two names that are actually used with this
730         function in tests: "transparent" and "white".
731
732 2017-12-08  Konstantin Tokarev  <annulen@yandex.ru>
733
734         Unreviewed, fix wrong letter case in #import HTMLIframeElement.h
735
736         * editing/cocoa/WebContentReaderCocoa.mm:
737
738 2017-12-07  Yusuke Suzuki  <utatane.tea@gmail.com>
739
740         Use WTF::RecursiveLockAdapter instead of using pthread_mutex_t with recursive lock option
741         https://bugs.webkit.org/show_bug.cgi?id=180449
742
743         Reviewed by Mark Lam.
744
745         Use WTF::RecursiveLockAdapter<StaticLock> instead. We can remove pthread_mutex_xxx,
746         pthread_once and FontLocker wrapper.
747
748         * platform/graphics/FontCache.cpp:
749         (WebCore::FontCache::getCachedFontPlatformData):
750         (WebCore::FontCache::fontForPlatformData):
751         (WebCore::FontCache::purgeInactiveFontData):
752         (WebCore::FontCache::inactiveFontCount):
753         (initFontCacheLockOnce): Deleted.
754         (FontLocker::FontLocker): Deleted.
755         (FontLocker::~FontLocker): Deleted.
756
757 2017-12-07  Eric Carlson  <eric.carlson@apple.com>
758
759         Simplify log channel configuration UI
760         https://bugs.webkit.org/show_bug.cgi?id=180527
761         <rdar://problem/35908382>
762
763         Reviewed by Joseph Pecoraro.
764
765         No new tests, updated existing test.
766
767         * inspector/agents/WebConsoleAgent.cpp:
768         (WebCore::WebConsoleAgent::getLoggingChannels):
769         (WebCore::channelConfigurationForString):
770
771 2017-12-07  Yusuke Suzuki  <utatane.tea@gmail.com>
772
773         Use StaticLock instead of NeverDestroyed<Lock>
774         https://bugs.webkit.org/show_bug.cgi?id=180507
775
776         Reviewed by Saam Barati.
777
778         StaticLock can be used instead of using NeverDestroyed<Lock>.
779
780         No behavior change.
781
782         * Modules/webdatabase/Database.cpp:
783         (WebCore::Database::performOpenAndVerify):
784         * Modules/webdatabase/DatabaseTracker.cpp:
785         (WebCore::DatabaseTracker::openDatabaseMutex):
786         (WebCore::DatabaseTracker::emptyDatabaseFilesRemovalTaskWillBeScheduled):
787         (WebCore::DatabaseTracker::emptyDatabaseFilesRemovalTaskDidFinish):
788         (WebCore::DatabaseTracker::scheduleNotifyDatabaseChanged):
789         (WebCore::DatabaseTracker::scheduleForNotification):
790         (WebCore::DatabaseTracker::notifyDatabasesChanged):
791         (WebCore::notificationMutex): Deleted.
792         * Modules/webdatabase/DatabaseTracker.h:
793         * platform/URL.cpp:
794         (WebCore::registerDefaultPortForProtocolForTesting):
795         (WebCore::clearDefaultPortForProtocolMapForTesting):
796         (WebCore::defaultPortForProtocol):
797         (WebCore::defaultPortForProtocolMapForTestingLock): Deleted.
798         * platform/graphics/MediaPlayer.cpp:
799         (WebCore::buildMediaEnginesVector):
800         (WebCore::installedMediaEngines):
801         (WebCore::MediaPlayer::resetMediaEngines):
802         (WebCore::mediaEngineVectorLock): Deleted.
803         * platform/ios/QuickLook.mm:
804         (WebCore::removeQLPreviewConverterForURL):
805         (WebCore::addQLPreviewConverterWithFileForURL):
806         (WebCore::qlPreviewConverterDictionaryMutex): Deleted.
807         * platform/ios/WebSQLiteDatabaseTrackerClient.mm:
808         (+[WebDatabaseTransactionBackgroundTaskController startBackgroundTask]):
809         (+[WebDatabaseTransactionBackgroundTaskController endBackgroundTask]):
810         (transactionBackgroundTaskIdentifierLock): Deleted.
811         * platform/network/curl/CurlContext.cpp:
812         (WebCore::CurlShareHandle::lockCallback):
813         (WebCore::CurlShareHandle::unlockCallback):
814         (WebCore::CurlShareHandle::mutexFor):
815         * platform/network/curl/CurlContext.h:
816
817 2017-12-07  Brady Eidson  <beidson@apple.com>
818
819         Read registrations in from disk.
820         https://bugs.webkit.org/show_bug.cgi?id=180543
821
822         Reviewed by Andy Estes.
823
824         No new tests (Not testable quite yet)
825
826         On launch, read through the database.
827
828         Set up enough objects in the SWServer necessary to cause fetches and postMessages to
829         go to a worker that has never run before.
830
831         * workers/service/ServiceWorkerContextData.cpp:
832         (WebCore::ServiceWorkerContextData::isolatedCopy const):
833         * workers/service/ServiceWorkerContextData.h:
834         (WebCore::ServiceWorkerContextData::encode const):
835         (WebCore::ServiceWorkerContextData::decode):
836
837         * workers/service/ServiceWorkerRegistrationKey.cpp:
838         (WebCore::ServiceWorkerRegistrationKey::toDatabaseKey const):
839         (WebCore::ServiceWorkerRegistrationKey::fromDatabaseKey):
840         * workers/service/ServiceWorkerRegistrationKey.h:
841
842         * workers/service/server/RegistrationDatabase.cpp:
843         (WebCore::stringToUpdateViaCache):
844         (WebCore::stringToWorkerType):
845         (WebCore::RegistrationDatabase::doPushChanges):
846         (WebCore::RegistrationDatabase::importRecords):
847         (WebCore::RegistrationDatabase::addRegistrationToStore):
848         * workers/service/server/RegistrationDatabase.h:
849
850         * workers/service/server/RegistrationStore.cpp:
851         (WebCore::RegistrationStore::RegistrationStore):
852         (WebCore::RegistrationStore::addRegistrationFromDatabase):
853         * workers/service/server/RegistrationStore.h:
854
855         * workers/service/server/SWServer.cpp:
856         (WebCore::SWServer::addRegistrationFromStore):
857         (WebCore::SWServer::SWServer):
858         (WebCore::SWServer::updateWorker):
859         (WebCore::SWServer::tryInstallContextData):
860         (WebCore::SWServer::installContextData):
861         (WebCore::generateServiceWorkerIdentifier): Deleted.
862         * workers/service/server/SWServer.h:
863
864         * workers/service/server/SWServerRegistration.h:
865
866         * workers/service/server/SWServerWorker.cpp:
867         (WebCore::SWServerWorker::contextData const):
868
869 2017-12-07  Yusuke Suzuki  <utatane.tea@gmail.com>
870
871         Use WTF Locking primitives in WebThread and drop pthread_xxx use
872         https://bugs.webkit.org/show_bug.cgi?id=180445
873
874         Reviewed by Saam Barati.
875
876         We remove use of pthread locking primitives from WebThread implementation,
877         and use WTF Lock and Condition instead.
878
879         No behavior change.
880
881         * platform/ios/wak/WebCoreThread.mm:
882         (HandleDelegateSource):
883         (SendDelegateMessage):
884         (WebThreadRunOnMainThread):
885         (WebThreadAdoptAndRelease):
886         (WebCoreObjCDeallocOnWebThreadImpl):
887         (WebCoreObjCDeallocWithWebThreadLockImpl):
888         (HandleWebThreadReleaseSource):
889         (_WebThreadAutoLock):
890         (WebRunLoopLockInternal):
891         (CurrentThreadContext):
892         Use WTF::ThreadSpecific.
893
894         (StartWebThread):
895         (_WebThreadLock):
896         Remove `shouldTry` parameter since it is always `false`. We clean up code based on `shouldTry = false`,
897         and rename it from _WebTryThreadLock to _WebThreadLock since it does not try now.
898
899         (_WebThreadLockFromAnyThread):
900         (WebThreadUnlockFromAnyThread):
901         (_WebThreadUnlock):
902         (lockWebCoreReleaseLock): Deleted.
903         (unlockWebCoreReleaseLock): Deleted.
904         (WebTimedConditionLock): Deleted.
905         (_WebTryThreadLock): Deleted.
906
907 2017-12-07  Alex Christensen  <achristensen@webkit.org>
908
909         Fix API test after r225645.
910         https://bugs.webkit.org/show_bug.cgi?id=180544
911
912         * loader/FrameLoader.cpp:
913         (WebCore::FrameLoader::loadURL):
914         (WebCore::FrameLoader::loadWithDocumentLoader):
915         The API test WebKitLegacy.FragmentNavigation started failing after r225645.
916         It does call the completion handler with ignore to cancel fragment navigation.
917         To make this work and increase compatibility, only synchronously continue with
918         fragment navigations if we haven't received a synchronous answer to the
919         decidePolicyForNavigationAction callback.
920
921 2017-12-07  Oleksandr Skachkov  <gskachkov@gmail.com>
922
923         WebAssembly: sending module to iframe fails
924         https://bugs.webkit.org/show_bug.cgi?id=179263
925
926         Reviewed by JF Bastien.
927
928         Allow use WebAssembly.Module as input parameters for postMessage 
929         in window and iframe object.
930
931         Tests: wasm/iframe-postmessage.html
932                wasm/window-postmessage.html
933
934         * bindings/js/SerializedScriptValue.cpp:
935         (WebCore::CloneSerializer::dumpIfTerminal):
936         * bindings/js/SerializedScriptValue.h:
937         * page/DOMWindow.cpp:
938         (WebCore::DOMWindow::postMessage):
939
940 2017-12-07  Joseph Pecoraro  <pecoraro@apple.com>
941
942         Web Inspector: Fix style in remote inspector classes
943         https://bugs.webkit.org/show_bug.cgi?id=180545
944
945         Reviewed by Youenn Fablet.
946
947         * page/PageDebuggable.h:
948         * workers/service/context/ServiceWorkerDebuggable.h:
949
950 2017-12-07  Antti Koivisto  <antti@apple.com>
951
952         Move security origin filtering for getMatchedCSSRules out of StyleResolver
953         https://bugs.webkit.org/show_bug.cgi?id=180468
954
955         Reviewed by Zalan Bujtas.
956
957         The non-standard getMatchedCSSRules API should not return rules from stylesheets in different security origins.
958         To implement this we currently have lots of invasive code in StyleResolver, RuleSets and ElementRuleCollector
959         basically passing around a bit. This also makes RuleSets document specific blocking optimizations.
960
961         This patches replaces the mechanism with a bit in StyleRule which is much simpler.
962
963         * css/DocumentRuleSets.cpp:
964         (WebCore::makeRuleSet):
965         * css/ElementRuleCollector.cpp:
966         (WebCore::ElementRuleCollector::collectMatchingRulesForList):
967         * css/ElementRuleCollector.h:
968         (WebCore::ElementRuleCollector::setPseudoStyleRequest):
969         (WebCore::ElementRuleCollector::setSameOriginOnly): Deleted.
970         * css/RuleFeature.cpp:
971         (WebCore::RuleFeatureSet::collectFeatures):
972         * css/RuleFeature.h:
973         (WebCore::RuleFeature::RuleFeature):
974         * css/RuleSet.cpp:
975         (WebCore::RuleData::RuleData):
976         (WebCore::RuleSet::addRule):
977         (WebCore::RuleSet::addChildRules):
978         (WebCore::RuleSet::addRulesFromSheet):
979         (WebCore::RuleSet::addStyleRule):
980         * css/RuleSet.h:
981         (WebCore::RuleData::linkMatchType const):
982         (WebCore::RuleData::hasDocumentSecurityOrigin const): Deleted.
983         * css/StyleResolver.cpp:
984         (WebCore::StyleResolver::pseudoStyleRulesForElement):
985         * css/StyleResolver.h:
986         * css/StyleRule.cpp:
987         (WebCore::StyleRule::StyleRule):
988         (WebCore::StyleRule::createForSplitting):
989         (WebCore::StyleRule::splitIntoMultipleRulesWithMaximumSelectorComponentCount const):
990         (WebCore::StyleRule::create): Deleted.
991         * css/StyleRule.h:
992         (WebCore::StyleRuleBase::StyleRuleBase):
993         (WebCore::StyleRuleBase::hasDocumentSecurityOrigin const):
994
995             Add a bit.
996
997         * css/parser/CSSParser.cpp:
998         (WebCore::CSSParserContext::CSSParserContext):
999
1000             Include hasDocumentSecurityOrigin bit to parser context. This means that a stylesheet data structures
1001             can't be shared between a contexts where this differs. This likely very rare in practice.
1002
1003         (WebCore::operator==):
1004         * css/parser/CSSParserImpl.cpp:
1005         (WebCore::CSSParserImpl::consumeStyleRule):
1006         * css/parser/CSSParserMode.h:
1007         (WebCore::CSSParserContextHash::hash):
1008         * editing/EditingStyle.cpp:
1009         (WebCore::EditingStyle::mergeStyleFromRules):
1010         * page/DOMWindow.cpp:
1011         (WebCore::DOMWindow::getMatchedCSSRules const):
1012
1013             Filter out rules from different security origin after getting them from style resolver.
1014
1015 2017-12-07  Zalan Bujtas  <zalan@apple.com>
1016
1017         AX: Document::existingAXObjectCache() should always return the existing AXObjectCache.
1018         https://bugs.webkit.org/show_bug.cgi?id=180548
1019         <rdar://problem/35917755>
1020
1021         Reviewed by Chris Fleizach.
1022
1023         Currently the AX cache becomes unreachable through Document::existingAXObjectCache soon after the render tree is destroyed.
1024         From this point, the Node objects can't deregister themselves from the AX cache anymore. In some cases, it's
1025         redundant/not advised to notify the cache about certain changes when the document is being destroyed, but the
1026         callsites should make that decision.
1027
1028         Covered by existing tests.
1029
1030         * dom/Document.cpp:
1031         (WebCore::Document::existingAXObjectCacheSlow const):
1032         * rendering/RenderElement.cpp:
1033         (WebCore::RenderElement::takeChildInternal):
1034
1035 2017-12-07  Youenn Fablet  <youenn@apple.com>
1036
1037         Fix erroneous ASSERT in DocumentThreadableLoader::didFail
1038         https://bugs.webkit.org/show_bug.cgi?id=180549
1039
1040         Reviewed by Alex Christensen.
1041
1042         * loader/DocumentThreadableLoader.cpp:
1043         (WebCore::DocumentThreadableLoader::didFail): ASSERT was checking whether the optional was null.
1044         This could never be the case since we move the value of the optional, not the optional itself.
1045         Ensure that the optional value is null so that we are sure request is being loaded and make the optional null just after that.
1046
1047 2017-12-07  Ryosuke Niwa  <rniwa@webkit.org>
1048
1049         iOS: Many AMP pages crash inside Document::updateStyleIfNeeded
1050         https://bugs.webkit.org/show_bug.cgi?id=180550
1051         <rdar://problem/35410390>
1052
1053         Reviewed by Zalan Bujtas.
1054
1055         The crash was caused when updatign the layout of an non-flattened frame inside a flattened frame.
1056         In those cases, isInChildFrameWithFrameFlattening is false on the inner frame.
1057
1058         No new tests for now.
1059
1060         * dom/NoEventDispatchAssertion.h:
1061         * rendering/RenderFrameBase.cpp:
1062         (WebCore::RenderFrameBase::performLayoutWithFlattening): Disable the assertion temporarily here.
1063         In theory, we should be able to remove the check for isInChildFrameWithFrameFlattening but we err
1064         on the safer side for now.
1065
1066 2017-12-07  Alex Christensen  <achristensen@webkit.org>
1067
1068         Always synchronously continue with fragment navigations
1069         https://bugs.webkit.org/show_bug.cgi?id=180544
1070         <rdar://problem/34815986> and <rdar://problem/35126690>
1071
1072         Reviewed by Geoffrey Garen.
1073
1074         Test: http/tests/dom/document-fragment.html
1075
1076         When a decidePolicyForNavigationAction completionHandler is called asynchronously,
1077         the document's URL has not changed yet when JavaScript execution continues.  This causes
1078         significant web incompatibility because all browsers change the document's URL immediately
1079         during fragment navigations.  In order to make WebKit applications more web compatible,
1080         we now immediately continue to have the state consistent.  To keep compatibility with any
1081         WebView, UIWebView, or WKWebView applications that use these delegate callbacks to update
1082         state, we still call decidePolicyForNavigationAction.  This would break a theoretical app
1083         that would cancel fragment navigations, but it fixes apps that continue fragment navigations
1084         asynchronously.
1085
1086         * loader/FrameLoader.cpp:
1087         (WebCore::FrameLoader::loadURL):
1088         (WebCore::FrameLoader::loadWithDocumentLoader):
1089
1090 2017-12-07  Youenn Fablet  <youenn@apple.com>
1091
1092         Activate IDB and WebSockets in service workers
1093         https://bugs.webkit.org/show_bug.cgi?id=180534
1094
1095         Reviewed by Brady Eidson.
1096
1097         Tests: http/tests/workers/service/serviceworker-idb.https.html
1098                http/tests/workers/service/serviceworker-websocket.https.html
1099
1100         Using the dummy document used for loading to also fuel IDB and WebSocket.
1101
1102         * workers/service/context/ServiceWorkerThread.cpp:
1103         (WebCore::ServiceWorkerThread::ServiceWorkerThread):
1104         * workers/service/context/ServiceWorkerThread.h:
1105         * workers/service/context/ServiceWorkerThreadProxy.cpp:
1106         (WebCore::idbConnectionProxy):
1107         (WebCore::ServiceWorkerThreadProxy::ServiceWorkerThreadProxy):
1108
1109 2017-12-07  Matt Lewis  <jlewis3@apple.com>
1110
1111         Unreviewed, rolling out r225634.
1112
1113         This caused layout tests to time out.
1114
1115         Reverted changeset:
1116
1117         "Simplify log channel configuration UI"
1118         https://bugs.webkit.org/show_bug.cgi?id=180527
1119         https://trac.webkit.org/changeset/225634
1120
1121 2017-12-07  Jer Noble  <jer.noble@apple.com>
1122
1123         [EME] Support the 'encrypted' event for FPS encrypted streams
1124         https://bugs.webkit.org/show_bug.cgi?id=180480
1125
1126         Reviewed by Eric Carlson.
1127
1128         Test: platform/mac/media/encrypted-media/fps-encrypted-event.html
1129
1130         Pass initData and initDataType up to HTMLMediaElement from SourceBufferPrivateAVFObjC.
1131
1132         Drive-by fix: initialize the initData and initDataType values of MediaEncryptedEvent from
1133         values in its initializer struct.
1134
1135         * html/HTMLMediaElement.cpp:
1136         (WebCore::HTMLMediaElement::mediaPlayerKeyNeeded):
1137         (WebCore::HTMLMediaElement::mediaPlayerInitializationDataEncountered):
1138         * html/MediaEncryptedEvent.cpp:
1139         (WebCore::MediaEncryptedEvent::MediaEncryptedEvent):
1140         (WebCore::MediaEncryptedEvent::initDataType): Deleted.
1141         (WebCore::MediaEncryptedEvent::initData): Deleted.
1142         * html/MediaEncryptedEvent.h:
1143         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
1144         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
1145         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::cdmInstanceAttached):
1146         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
1147         (WebCore::SourceBufferPrivateAVFObjC::didProvideContentKeyRequestInitializationDataForTrackID):
1148
1149 2017-12-07  Myles C. Maxfield  <mmaxfield@apple.com>
1150
1151         [Cocoa] Add SPI to disallow user-installed fonts
1152         https://bugs.webkit.org/show_bug.cgi?id=180062
1153         <rdar://problem/35042408>
1154
1155         Reviewed by Simon Fraser.
1156
1157         This hooks up a WK2 preference, ShouldDisallowUserInstalledFonts, to our font selection
1158         code. This preference works by specifying an attribute to our font selection code which
1159         will prohibit user-installed fonts from ever being selected. This works both to disallow
1160         newly installed fonts, as well as disallowing user-installed fonts which "shadow" (or
1161         have the same name as) existing fonts, so that the existing font is selected instead.
1162
1163         The goal of this setting is to decrease the fingerprinting surface area which trackers
1164         can use to identify users on the open Web.
1165
1166         Tests: fast/text/user-installed-font.html
1167                fast/text/user-installed-fonts/disable.html
1168                fast/text/user-installed-fonts/shadow-disable.html
1169                fast/text/user-installed-fonts/shadow-family-disable.html
1170                fast/text/user-installed-fonts/shadow-family.html
1171                fast/text/user-installed-fonts/shadow-postscript-disable.html
1172                fast/text/user-installed-fonts/shadow-postscript-family-disable.html
1173                fast/text/user-installed-fonts/shadow-postscript-family.html
1174                fast/text/user-installed-fonts/shadow-postscript.html
1175                fast/text/user-installed-fonts/shadow.html
1176
1177         * css/CSSFontFaceSet.cpp:
1178         (WebCore::CSSFontFaceSet::ensureLocalFontFacesForFamilyRegistered):
1179         * css/StyleResolver.cpp:
1180         (WebCore::StyleResolver::initializeFontStyle):
1181         * page/Settings.yaml:
1182         * platform/graphics/FontCache.h:
1183         * platform/graphics/FontDescription.cpp:
1184         (WebCore::FontDescription::FontDescription):
1185         * platform/graphics/FontDescription.h:
1186         (WebCore::FontDescription::mayRepresentUserInstalledFont const):
1187         (WebCore::FontDescription::setMayRepresentUserInstalledFont):
1188         (WebCore::FontDescription::operator== const):
1189         * platform/graphics/cocoa/FontCacheCoreText.cpp:
1190         (WebCore::FontDatabase::singleton):
1191         (WebCore::FontDatabase::singletonAllowingUserInstalledFonts):
1192         (WebCore::FontDatabase::singletonDisallowingUserInstalledFonts):
1193         (WebCore::FontDatabase::collectionForFamily):
1194         (WebCore::FontDatabase::fontForPostScriptName):
1195         (WebCore::FontDatabase::FontDatabase):
1196         (WebCore::FontCache::getFontSelectionCapabilitiesInFamily):
1197         (WebCore::platformFontLookupWithFamily):
1198         (WebCore::invalidateFontCache):
1199         (WebCore::fontWithFamily):
1200         * style/StyleResolveForDocument.cpp:
1201         (WebCore::Style::resolveForDocument):
1202         * testing/InternalSettings.cpp:
1203         (WebCore::InternalSettings::setShouldDisallowUserInstalledFonts):
1204         * testing/InternalSettings.h:
1205         * testing/InternalSettings.idl:
1206
1207 2017-12-07  David Quesada  <david_quesada@apple.com>
1208
1209         [Web App Manifest] Support display-mode media feature
1210         https://bugs.webkit.org/show_bug.cgi?id=180376
1211         rdar://problem/35837993
1212
1213         Reviewed by Geoffrey Garen.
1214
1215         Tests: applicationmanifest/display-mode-subframe.html
1216                applicationmanifest/display-mode.html
1217
1218         * Modules/applicationmanifest/ApplicationManifest.h:
1219         (WebCore::ApplicationManifest::encode const):
1220         (WebCore::ApplicationManifest::decode):
1221         * Modules/applicationmanifest/ApplicationManifestParser.cpp:
1222         (WebCore::ApplicationManifestParser::parseManifest):
1223         (WebCore::ApplicationManifestParser::parseDisplay):
1224         * Modules/applicationmanifest/ApplicationManifestParser.h:
1225             Add a 'display' property to ApplicationManifest and have ApplicationManifestParser
1226             populate it by parsing the 'display' property from the raw manifest.
1227
1228         * css/CSSValueKeywords.in:
1229         * css/MediaFeatureNames.h:
1230         * css/MediaQueryEvaluator.cpp:
1231         (WebCore::displayModeEvaluate):
1232             To evaluate whether a display-mode query matches, compare the parameter to the
1233             display mode of the manifest applied to the main frame. If there is no manifest,
1234             use the fallback display mode 'browser' - the spec mandates that display-mode
1235             must be exposed even if there is no applied manifest.
1236         * css/MediaQueryExpression.cpp:
1237         (WebCore::featureWithValidIdent):
1238         (WebCore::isFeatureValidWithoutValue):
1239
1240 2017-12-07  Jer Noble  <jer.noble@apple.com>
1241
1242         Creating a second AVPlayerItemVideoOutput causes flakey failures
1243         https://bugs.webkit.org/show_bug.cgi?id=177119
1244         <rdar://problem/34507977>
1245
1246         Reviewed by Dean Jackson.
1247
1248         Rather than having two concurrent AVPlayerItemVideoOutputs when painting to OpenGL,
1249         use only one, but with the OpenGL compatibility flags enabled, for both 3D and 2D
1250         canvas painting.
1251
1252         Of course, once this is fixed, the test breaks again because VideoTextureCopierCV is
1253         stomping on top of some WebGL state set by the test. Rather than expand the
1254         VideoTextureCopierCV's GraphicsStateSaver, use a totally separate (but shared) GL context to
1255         implement the texture copy, so that its own state will not affect the state of the WebGL
1256         context.
1257
1258         This necessitates adding a new createShared() factory for GraphicsContext3D. Since this is only
1259         used on Cocoa platforms (for now), make it platform specific, and modify the other implementations
1260         only so far as to throw assertions if somehow a shared context pointer is passed into their
1261         constructors.
1262
1263         Drive-by fixes: 
1264
1265         - These changes exposed some test failures, which were off-by-1-or-2 errors in the color
1266         output of videos painted into WebGL contexts. The Y' parameter needs to be scaled by 16/255
1267         for video-range conversions and the CbCr vales by 128/255 (rather than just 0.5). Make the
1268         color transforms a full 4x4 matrix and do the scaling in the matrix rather than tracked by a
1269         separate uniform.
1270
1271         - There was a slight error in WebCoreDecompressionSession that could cause seeks to never
1272         complete because incoming frames would be skipped if their startTime was in the past
1273         (rather than their startTime + duration being in the past).
1274
1275         - The matrix name comparison should use CFEqual rather than pointer equality to test.
1276
1277         - iOS currently has a bug where the red and green color channels will be reversed when
1278         uploading BGRA pixel formatted data to a texture; work around this bug for now.
1279
1280         * platform/graphics/GraphicsContext3D.h:
1281         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
1282         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1283         (WebCore::MediaPlayerPrivateAVFoundationObjC::destroyContextVideoRenderer):
1284         (WebCore::MediaPlayerPrivateAVFoundationObjC::hasAvailableVideoFrame const):
1285         (WebCore::MediaPlayerPrivateAVFoundationObjC::updateLastPixelBuffer):
1286         (WebCore::MediaPlayerPrivateAVFoundationObjC::videoOutputHasAvailableFrame):
1287         (WebCore::MediaPlayerPrivateAVFoundationObjC::updateLastImage):
1288         (WebCore::MediaPlayerPrivateAVFoundationObjC::paintWithVideoOutput):
1289         (WebCore::MediaPlayerPrivateAVFoundationObjC::copyVideoTextureToPlatformTexture):
1290         (WebCore::MediaPlayerPrivateAVFoundationObjC::nativeImageForCurrentTime):
1291         (WebCore::MediaPlayerPrivateAVFoundationObjC::waitForVideoOutputMediaDataWillChange):
1292         * platform/graphics/cairo/GraphicsContext3DCairo.cpp:
1293         (WebCore::GraphicsContext3D::GraphicsContext3D):
1294         * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
1295         (WebCore::GraphicsContext3D::createShared):
1296         (WebCore::GraphicsContext3D::GraphicsContext3D):
1297         * platform/graphics/cv/VideoTextureCopierCV.cpp:
1298         (WebCore::VideoTextureCopierCV::VideoTextureCopierCV):
1299         (WebCore::VideoTextureCopierCV::~VideoTextureCopierCV):
1300         (WebCore::transferFunctionFromString):
1301         (WebCore::YCbCrToRGBMatrixForRangeAndTransferFunction):
1302         (WebCore::VideoTextureCopierCV::initializeUVContextObjects):
1303         (WebCore::VideoTextureCopierCV::copyImageToPlatformTexture):
1304         (WebCore::VideoTextureCopierCV::copyVideoTextureToPlatformTexture):
1305         * platform/graphics/cv/VideoTextureCopierCV.h:
1306         (WebCore::VideoTextureCopierCV::context):
1307         * platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp:
1308         (WebCore::GraphicsContext3D::GraphicsContext3D):
1309
1310 2017-12-07  Jer Noble  <jer.noble@apple.com>
1311
1312         [EME] Support generateRequest() in CDMFairPlayStreaming
1313         https://bugs.webkit.org/show_bug.cgi?id=179752
1314
1315         Reviewed by Eric Carlson.
1316
1317         Tests: platform/mac/media/encrypted-media/fps-createSession.html
1318                platform/mac/media/encrypted-media/fps-generateRequest.html
1319
1320         Add support for generating license requests from initialization data in
1321         CDMFairPlayStreaming. To do so, add explicit checks for FairPlay Steraming requirements:
1322         reqests will fail if no server certificate exists, and will fail if no content key id exists
1323         in the initialization data.
1324
1325         * platform/graphics/avfoundation/CDMFairPlayStreaming.cpp:
1326         (WebCore::CDMPrivateFairPlayStreaming::extractKeyIDsSinf):
1327         (WebCore::CDMPrivateFairPlayStreaming::sanitizeSinf):
1328         (WebCore::CDMFactory::platformRegisterFactories):
1329         * platform/graphics/avfoundation/CDMFairPlayStreaming.h:
1330         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
1331         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::requestLicense):
1332         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::didProvideRequest):
1333
1334 2017-12-07  Jer Noble  <jer.noble@apple.com>
1335
1336         [EME] Possible deadlock when aborting a SourceBufferPrivateAVFObjC append operation
1337         https://bugs.webkit.org/show_bug.cgi?id=180486
1338
1339         Reviewed by Eric Carlson.
1340
1341         It's possible that an abort() operation which is blocked on the ongoing appendBuffer()
1342         operation completing will deadlock forever, with either the willProvideContentKeyRequest
1343         or didProvideContentKeyRequest callbacks blocking waiting to be run on the main thread
1344         (which is itself blocked waiting for the append operation to complete).
1345
1346         To break this deadlock, add a new abortSemaphore which is signaled in the abort() method
1347         and have the willProvide... and didProvide... methods block both on their own semaphores
1348         as well as the abortSemaphore, allowing them to break out even if their main thread calls
1349         never get a chance to execute.
1350
1351         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
1352         (-[WebAVStreamDataParserListener streamDataParserWillProvideContentKeyRequestInitializationData:forTrackID:]):
1353         (-[WebAVStreamDataParserListener streamDataParser:didProvideContentKeyRequestInitializationData:forTrackID:]):
1354         (WebCore::SourceBufferPrivateAVFObjC::SourceBufferPrivateAVFObjC):
1355         (WebCore::SourceBufferPrivateAVFObjC::abort):
1356
1357 2017-12-07  Eric Carlson  <eric.carlson@apple.com>
1358
1359         Simplify log channel configuration UI
1360         https://bugs.webkit.org/show_bug.cgi?id=180527
1361         <rdar://problem/35908382>
1362
1363         Reviewed by Joseph Pecoraro.
1364
1365         No new tests -- no change in functionality.
1366
1367         * inspector/agents/WebConsoleAgent.cpp:
1368         (WebCore::WebConsoleAgent::getLoggingChannels):
1369         (WebCore::channelConfigurationForString):
1370
1371 2017-12-07  Joseph Pecoraro  <pecoraro@apple.com>
1372
1373         ServiceWorker Inspector: Use the SW's scope url for the remote inspection target metadata
1374         https://bugs.webkit.org/show_bug.cgi?id=180519
1375
1376         Reviewed by Youenn Fablet.
1377
1378         * workers/service/context/ServiceWorkerDebuggable.cpp:
1379         (WebCore::ServiceWorkerDebuggable::ServiceWorkerDebuggable):
1380         * workers/service/context/ServiceWorkerDebuggable.h:
1381         Switch to the scope URL for the remote inspector target info.
1382
1383 2017-12-07  Per Arne Vollan  <pvollan@apple.com>
1384
1385         Unreviewed Windows build fix.
1386
1387         * PlatformWin.cmake:
1388
1389 2017-12-07  Michael Catanzaro  <mcatanzaro@igalia.com>
1390
1391         [WPE][GTK] Freeze WebKit version in user agent
1392         https://bugs.webkit.org/show_bug.cgi?id=180475
1393
1394         Reviewed by Carlos Garcia Campos.
1395
1396         Apple has frozen the WebKit version in its user agent, so we should too, at the same point.
1397
1398         * platform/glib/UserAgentGLib.cpp:
1399         (WebCore::versionForUAString):
1400
1401 2017-12-07  Michael Catanzaro  <mcatanzaro@igalia.com>
1402
1403         [WPE][GTK] Update user agent quirk version strings
1404         https://bugs.webkit.org/show_bug.cgi?id=180474
1405
1406         Reviewed by Carlos Garcia Campos.
1407
1408         * platform/UserAgentQuirks.cpp:
1409         (WebCore::UserAgentQuirks::stringForQuirk):
1410         * platform/glib/UserAgentGLib.cpp:
1411         (WebCore::platformVersionForUAString):
1412
1413 2017-12-06  Chris Dumez  <cdumez@apple.com>
1414
1415         We should be able to recover after a Service Worker process crash
1416         https://bugs.webkit.org/show_bug.cgi?id=180477
1417
1418         Reviewed by Brady Eidson and Youenn Fablet.
1419
1420         Test: http/tests/workers/service/postmessage-after-sw-process-crash.https.html
1421
1422         * workers/service/server/SWServer.cpp:
1423         (WebCore::SWServer::serverToContextConnectionCreated):
1424         Once the connection with the context process is established, process "run service worker"
1425         requests that ocurred while establishing the connection.
1426
1427         (WebCore::SWServer::runServiceWorkerIfNecessary):
1428         Take in a lambda function that gets called after the "run service worker" request
1429         is processed. We used to assert that we had a connection to the context process.
1430         We now wait for the connection to be established to process the request, thus
1431         making the operation asynchronous.
1432
1433         (WebCore::SWServer::runServiceWorker):
1434         Split some logic out of runServiceWorkerIfNecessary() to reuse in serverToContextConnectionCreated().
1435
1436         (WebCore::SWServer::markAllWorkersAsTerminated):
1437         Add method to mark all service workers as terminated. This is called when the Service
1438         Worker process crashes.
1439
1440         * workers/service/server/SWServer.h:
1441
1442 2017-12-06  Saam Barati  <sbarati@apple.com>
1443
1444         Unreviewed. Fix iOS (and maybe other platform) build
1445
1446         * workers/service/server/RegistrationDatabase.cpp:
1447         (WebCore::RegistrationDatabase::openSQLiteDatabase):
1448
1449 2017-12-02  Darin Adler  <darin@apple.com>
1450
1451         Modernize some aspects of text codecs, eliminate WebKit use of strcasecmp
1452         https://bugs.webkit.org/show_bug.cgi?id=180009
1453
1454         Reviewed by Alex Christensen.
1455
1456         * Modules/fetch/FetchBody.cpp:
1457         (WebCore::FetchBody::consumeAsStream): Update to use size since the result of
1458         encode is now Vector rather than CString. And for the new UnencodableHandling.
1459         (WebCore::FetchBody::consumeText): Removed now-unneeded type cast. Ditto.
1460         (WebCore::FetchBody::bodyAsFormData const): Ditto.
1461         (WebCore::FetchBody::take): Pass result of encode directly to SharedBuffer::create.
1462
1463         * Modules/websockets/WebSocketDeflater.cpp: Removed include of StringExtras.h.
1464         * bridge/IdentifierRep.h: Ditto.
1465         * bridge/c/c_instance.cpp: Ditto.
1466
1467         * fileapi/BlobBuilder.cpp:
1468         (WebCore::BlobBuilder::append): Updated for CString to Vector change and
1469         for UnencodableHandling.
1470
1471         * html/parser/HTMLMetaCharsetParser.cpp:
1472         (WebCore::HTMLMetaCharsetParser::checkForMetaCharset): Call the decode function
1473         with all the arguments since there is only one decode function now.
1474
1475         * inspector/agents/InspectorDOMAgent.cpp:
1476         (WebCore::computeContentSecurityPolicySHA256Hash): Updated for CString to Vector
1477         change and for UnencodableHandling.
1478
1479         * loader/ResourceCryptographicDigest.cpp:
1480         (WebCore::cryptographicDigestForBytes): Changed argument type to const void*.
1481         * loader/ResourceCryptographicDigest.h: Ditto.
1482
1483         * loader/TextResourceDecoder.cpp:
1484         (WebCore::TextResourceDecoder::TextResourceDecoder): Moved initialization of data
1485         members to class definition.
1486         (WebCore::TextResourceDecoder::create): Moved function body here from the header.
1487         (WebCore::TextResourceDecoder::setEncoding): Use equalLettersIgnoringASCIICase.
1488         (WebCore::TextResourceDecoder::shouldAutoDetect const): Updated for name change
1489         to m_parentFrameAutoDetectedEncoding, which obviates a comment.
1490         (WebCore::TextResourceDecoder::flush): Ditto.
1491         * loader/TextResourceDecoder.h: Moved initialization here from constructor.
1492         Moved function bodies out of the class. Renamed m_hintEncoding to
1493         m_parentFrameAutoDetectedEncoding since that is a more accurate description.
1494
1495         * loader/appcache/ApplicationCacheStorage.cpp: Removed include of StringExtras.h.
1496         * page/FrameTree.cpp: Ditto.
1497         * page/PageSerializer.cpp: Ditto.
1498         (WebCore::PageSerializer::serializeFrame): Pass result of encode directly to
1499         StringBuffer::create and update for UnencodableHandling.
1500         (WebCore::PageSerializer::serializeCSSStyleSheet): Ditto.
1501         * page/csp/ContentSecurityPolicy.cpp:
1502         (WebCore::ContentSecurityPolicy::findHashOfContentInPolicies const): Ditto.
1503
1504         * platform/FileHandle.cpp: Removed include of StringExtras.h.
1505
1506         * platform/SharedBuffer.cpp:
1507         (WebCore::SharedBuffer::create): Added an overload that takes Vector<uint8_t>.
1508         * platform/SharedBuffer.h: Ditto.
1509
1510         * platform/URLParser.cpp:
1511         (WebCore::URLParser::encodeQuery): Updated since encode returns a Vector instead
1512         of a CString now and for UnencodableHandling.
1513         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1514         (WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForLoadingOfResource): Ditto.
1515
1516         * platform/graphics/ca/PlatformCALayer.cpp: Removed include of StringExtras.h.
1517
1518         * platform/network/curl/ResourceHandleCurlDelegate.cpp:
1519         (WebCore::ResourceHandleCurlDelegate::handleDataURL): Updated for Vector instead
1520         of CString.
1521
1522         * platform/network/FormData.cpp:
1523         (WebCore::FormData::create): Added new overload, and simplified some existing ones.
1524         (WebCore::normalizeStringData): Changed return type to Vector<uint8_t> and updated
1525         for UnencodableHandling.
1526         (WebCore::FormData::appendMultiPartStringValue): Updated for change in type of
1527         result of normalizeStringData.
1528         * platform/network/FormData.h: Updated for the above and updated comments.
1529
1530         * platform/network/FormDataBuilder.cpp: Made this a namespace instead of a class.
1531         (WebCore::FormDataBuilder::append): Added an overload for Vector<uint8_t>.
1532         (WebCore::FormDataBuilder::appendQuoted): Renamed from appendQuotedString and
1533         changed the argument type.
1534         (WebCore::FormDataBuilder::appendFormURLEncoded): Moved logic up from the
1535         encodeStringAsFormData function into a new separate helper.
1536         (WebCore::FormDataBuilder::addFilenameToMultiPartHeader): Updated for change to
1537         UnencodableHandling.
1538         (WebCore::FormDataBuilder::beginMultiPartHeader): Changed argument type.
1539         (WebCore::FormDataBuilder::addKeyValuePairAsFormData): Ditto.
1540         (WebCore::FormDataBuilder::encodeStringAsFormData): Updated to call helper.
1541         * platform/network/FormDataBuilder.h: Updated for the above.
1542
1543         * platform/text/DecodeEscapeSequences.h: Use Vector<uint8_t> instead of
1544         Vector<char>, also updated the code that calls encode for the new return type
1545         and updated for change to UnencodableHandler.
1546
1547         * platform/text/TextCodec.cpp:
1548         (WebCore::TextCodec::getUnencodableReplacement): Updated since we are using
1549         std::array now, so the out argument is easier to understand, also updated for
1550         change to UnencodablaHandler.
1551         * platform/text/TextCodec.h: Use std::array for the UnencodableReplacementArray
1552         type, removed the overload of decode so there is only one decode function.
1553
1554         * platform/text/TextCodecICU.cpp:
1555         (WebCore::ICUConverterWrapper::~ICUConverterWrapper): Deleted.
1556         Not needed any more since we use ICUConverterPtr instead now.
1557         (WebCore::cachedConverterICU): Deleted.
1558         (WebCore::TextCodecICU::create): Deleted. Callers just use make_unique
1559         directly now.
1560         (WebCore::TextCodecICU::registerCodecs): Rewrote to use lambdas instead
1561         of functions with void* pointers.
1562         (WebCore::TextCodecICU::TextCodecICU): Moved initializers into the header.
1563         (WebCore::TextCodecICU::~TextCodecICU): Moved the body of releaseICUConverter
1564         in here. Also greatly simplified it now that ICUConverterPtr handles closing
1565         it as needed.
1566         (WebCore::TextCodecICU::releaseICUConverter const): Deleted.
1567         (WebCore::TextCodecICU::createICUConverter const): Rewrote to simplfy now that
1568         we can use ICUConverterPtr.
1569         (WebCore::ErrorCallbackSetter::ErrorCallbackSetter): Take a reference instead
1570         of a pointer.
1571         (WebCore::ErrorCallbackSetter::~ErrorCallbackSetter): Ditto.
1572         (WebCore::TextCodecICU::decode): Use equalLettersIgnoringASCIICase instead of
1573         strcasecmp.
1574         (WebCore::TextCodecICU::encode): Return a Vector instead of a CString.
1575         Take a StringView instead of a pointer and length. Simplified
1576         the backslash-as-currency-symbol code by using String::replace.
1577         * platform/text/TextCodecICU.h: Updated for above. Fixed indentation.
1578         Added a new ICUConverterPtr typedef that uses std::unique_ptr to close the
1579         converter; combined with move semantics it simplifies things so we don't have
1580         to be so careful about calling ucnv_close.
1581
1582         * platform/text/TextCodecLatin1.cpp: Renamed the Latin-1 to Unicode table from
1583         "table" to latin1ConversionTable.
1584         (WebCore::TextCodecLatin1::registerCodecs): Use a lambda.
1585         (WebCore::encodeComplexWindowsLatin1): Return a Vector instad of CString.
1586         Also use StringView::codePoints instead of our own U16_NEXT.
1587         (WebCore::TextCodecLatin1::encode): More of the same.
1588         * platform/text/TextCodecLatin1.h: Updated for the above.
1589
1590         * platform/text/TextCodecReplacement.cpp:
1591         (WebCore::TextCodecReplacement::create): Deleted.
1592         (WebCore::TextCodecReplacement::TextCodecReplacement): Deleted.
1593         (WebCore::TextCodecReplacement::registerCodecs): Use a lambda.
1594         * platform/text/TextCodecReplacement.h: Updated for the above.
1595
1596         * platform/text/TextCodecUTF16.cpp:
1597         (WebCore::newStreamingTextDecoderUTF16LE): Deleted.
1598         (WebCore::newStreamingTextDecoderUTF16BE): Deleted.
1599         (WebCore::TextCodecUTF16::registerCodecs): Use lambdas.
1600         (WebCore::TextCodecUTF16::encode): Return a Vector.
1601         * platform/text/TextCodecUTF16.h: Updated for the above.
1602
1603         * platform/text/TextCodecUTF8.cpp:
1604         (WebCore::TextCodecUTF8::registerCodecs): Use a lambda.
1605         (WebCore::TextCodecUTF8::encode): Return a Vector.
1606         * platform/text/TextCodecUTF8.h: Updated for the above.
1607
1608         * platform/text/TextCodecUserDefined.cpp:
1609         (WebCore::newStreamingTextDecoderUserDefined): Deleted.
1610         (WebCore::TextCodecUserDefined::registerCodecs): Use a lambda.
1611         (WebCore::encodeComplexUserDefined): Return a Vector.
1612         (WebCore::TextCodecUserDefined::encode): Ditto.
1613         * platform/text/TextCodecUserDefined.h: Updated for the above.
1614
1615         * platform/text/TextEncoding.cpp: Changed TextCodecMap to just hold a
1616         WTF::Function instead of holding a function and an additional data pointer.
1617         (WebCore::TextEncoding::TextEncoding): Use equalLettersIgnoringASCIICase
1618         instead of a special isReplacementEncoding function.
1619         (WebCore::TextEncoding::encode const): Return a Vector instead of a CString.
1620         Pass StringView instead of a pointer and length.
1621         * platform/text/TextEncoding.h: Updated for the above.
1622
1623         * platform/text/TextEncodingRegistry.cpp:
1624         (WebCore::addToTextCodecMap): Removed the additionalData pointer and used
1625         WTFMove since NewTextCodecFunction is now a WTF::Function rather than a C
1626         function pointer.
1627         (WebCore::isReplacementEncoding): Deleted.
1628         (WebCore::newTextCodec): Use find instead of get now that the fucntions in
1629         the map are WTF::Function and can't be copied.
1630         (WebCore::dumpTextEncodingNameMap): Deleted.
1631         * platform/text/TextEncodingRegistry.h: Updated for the above.
1632
1633         * platform/text/win/TextCodecWin.cpp:
1634         (WebCore::TextCodecWin::encode): Updated comment.
1635
1636         * xml/XMLHttpRequest.cpp:
1637         (WebCore::XMLHttpRequest::send): Updated for change to UnencodableHandling.
1638
1639         * xml/XSLTUnicodeSort.cpp: Removed include of StringExtras.h.
1640         * xml/parser/XMLDocumentParser.cpp: Ditto.
1641         * xml/parser/XMLDocumentParserLibxml2.cpp: Ditto.
1642
1643 2017-12-06  Said Abou-Hallawa  <sabouhallawa@apple.com>
1644
1645         Support the decoding="sync/async" syntax for image async attribute
1646         https://bugs.webkit.org/show_bug.cgi?id=179432
1647
1648         Reviewed by Darin Adler.
1649
1650         Support the HTMLElementImage decoding attribute to allow controlling the
1651         decoding of an image as per:
1652                 https://github.com/whatwg/html/pull/3221
1653                 https://whatpr.org/html/3221/images.html#decoding-images
1654
1655         Tests: fast/images/decode-decoding-attribute-async-large-image.html
1656                fast/images/decoding-attribute-async-small-image.html
1657                fast/images/decoding-attribute-dynamic-async-small-image.html
1658                fast/images/decoding-attribute-sync-large-image.html
1659
1660         * html/HTMLAttributeNames.in:
1661         * html/HTMLImageElement.cpp:
1662         (WebCore::HTMLImageElement::decodingMode const):
1663         * html/HTMLImageElement.h:
1664         * html/HTMLImageElement.idl:
1665         * platform/graphics/BitmapImage.cpp:
1666         (WebCore::BitmapImage::draw):
1667         (WebCore::BitmapImage::internalStartAnimation):
1668         (WebCore::BitmapImage::advanceAnimation):
1669         (WebCore::BitmapImage::internalAdvanceAnimation):
1670         * platform/graphics/DecodingOptions.h:
1671         (WebCore::DecodingOptions::DecodingOptions):
1672         (WebCore::DecodingOptions::isAuto const):
1673         (WebCore::DecodingOptions::isAsynchronousCompatibleWith const):
1674         (WebCore::DecodingOptions::isNone const): Deleted.
1675         * platform/graphics/ImageDecoder.h:
1676         * platform/graphics/ImageFrame.cpp:
1677         (WebCore::ImageFrame::clearImage):
1678         * platform/graphics/ImageSource.cpp:
1679         (WebCore::ImageSource::frameAtIndexCacheIfNeeded):
1680         * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.h:
1681         * platform/graphics/cg/ImageDecoderCG.h:
1682         * platform/graphics/win/ImageDecoderDirect2D.h:
1683         * platform/image-decoders/ScalableImageDecoder.h:
1684         * rendering/RenderBoxModelObject.cpp:
1685         (WebCore::RenderBoxModelObject::decodingModeForImageDraw const):
1686         The element attributes and the document settings should be checked before
1687         checking our heuristics. And since the "decoding" attribute is per an image
1688         and isLargeImageAsyncDecodingEnabledForTesting() is a global setting, the
1689         decoding attribute should be checked first.
1690
1691 2017-12-06  David Quesada  <david_quesada@apple.com>
1692
1693         [Web App Manifest] Add SPI for applying a manifest to a top-level browsing context
1694         https://bugs.webkit.org/show_bug.cgi?id=180368
1695         rdar://problem/34748067
1696
1697         Reviewed by Geoffrey Garen.
1698
1699         Support applying a manifest to a top-level browsing context by adding a manifest
1700         property on PageConfiguration to be stored on MainFrame instances created from the
1701         configuration.
1702
1703         No new tests, no change in behavior.
1704
1705         * page/MainFrame.cpp:
1706         (WebCore::MainFrame::MainFrame):
1707         * page/MainFrame.h:
1708         * page/PageConfiguration.h:
1709
1710 2017-12-06  Zalan Bujtas  <zalan@apple.com>
1711
1712         Remove nodes from AXObjectCache when the associated subframe document is getting destroyed.
1713         https://bugs.webkit.org/show_bug.cgi?id=180503
1714         <rdar://problem/35891328
1715
1716         Reviewed by Chris Fleizach.
1717
1718         While AXObjectCache lives on the mainframe's document, it caches nodes from every subframe document.
1719         When a node is being destroyed, we deregister it from the AX cache through the Node's destructor.
1720         Soon after the document is detached from the frame/frame is detached from the frame tree, this codepath
1721         is no longer available (no access to the AXObjectCache object) and from this point we are unable to deregister
1722         nodes associated with the current document.
1723         In AXObjectCache::prepareForDocumentDestruction(), we preemptively remove all the cached nodes associated
1724         with the about-to-be-destroyed document.
1725
1726         Covered by existing tests.
1727
1728         * accessibility/AXObjectCache.cpp:
1729         (WebCore::AXObjectCache::remove):
1730         (WebCore::filterForRemoval):
1731         (WebCore::AXObjectCache::prepareForDocumentDestruction): Collecting the nodes and removing them later is
1732         not the most performant way but in order to have a single code path for the de-registration (AXObjectCache::remove)
1733         I think it's worth going down the slower path -which should not really be that slower anyway since those
1734         lists tend to stay small.
1735         (WebCore::AXObjectCache::clearTextMarkerNodesInUse): Deleted.
1736         * accessibility/AXObjectCache.h:
1737         (WebCore::AXObjectCache::removeNodeForUse):
1738         (WebCore::AXObjectCache::remove):
1739         * dom/Document.cpp:
1740         (WebCore::Document::prepareForDestruction):
1741         * dom/Node.cpp:
1742         (WebCore::Node::willBeDeletedFrom):
1743         (WebCore::Node::moveNodeToNewDocument):
1744
1745 2017-12-06  Brady Eidson  <beidson@apple.com>
1746
1747         Start writing ServiceWorker registrations to disk.
1748         https://bugs.webkit.org/show_bug.cgi?id=180488
1749
1750         Reviewed by Chris Dumez.
1751
1752         No new tests (No observable behavior change).
1753
1754         As registrations changes occurs, we now write them to disk.
1755         We don't re-read them in yet.
1756
1757         * Sources.txt:
1758         * WebCore.xcodeproj/project.pbxproj:
1759
1760         * workers/service/ServiceWorkerRegistrationData.cpp:
1761         (WebCore::ServiceWorkerRegistrationData::isolatedCopy const):
1762         * workers/service/ServiceWorkerRegistrationData.h:
1763         (WebCore::ServiceWorkerRegistrationData::encode const):
1764         (WebCore::ServiceWorkerRegistrationData::decode):
1765
1766         * workers/service/ServiceWorkerRegistrationKey.cpp:
1767         (WebCore::ServiceWorkerRegistrationKey::toDatabaseKey const):
1768         * workers/service/ServiceWorkerRegistrationKey.h:
1769
1770         * workers/service/server/RegistrationDatabase.cpp: Added.
1771         (WebCore::v1RecordsTableSchema):
1772         (WebCore::v1RecordsTableSchemaAlternate):
1773         (WebCore::databaseFilename):
1774         (WebCore::RegistrationDatabase::RegistrationDatabase):
1775         (WebCore::RegistrationDatabase::~RegistrationDatabase):
1776         (WebCore::RegistrationDatabase::openSQLiteDatabase):
1777         (WebCore::RegistrationDatabase::ensureValidRecordsTable):
1778         (WebCore::updateViaCacheToString):
1779         (WebCore::workerTypeToString):
1780         (WebCore::RegistrationDatabase::pushChanges):
1781         (WebCore::RegistrationDatabase::doPushChanges):
1782         (WebCore::RegistrationDatabase::importRecords):
1783         (WebCore::RegistrationDatabase::databaseFailedToOpen):
1784         (WebCore::RegistrationDatabase::databaseOpenedAndRecordsImported):
1785         * workers/service/server/RegistrationDatabase.h: Copied from Source/WebCore/workers/service/ServiceWorkerRegistrationData.cpp.
1786         (WebCore::RegistrationDatabase::isClosed const):
1787
1788         * workers/service/server/RegistrationStore.cpp: Added.
1789         (WebCore::RegistrationStore::RegistrationStore):
1790         (WebCore::RegistrationStore::~RegistrationStore):
1791         (WebCore::RegistrationStore::scheduleDatabasePushIfNecessary):
1792         (WebCore::RegistrationStore::pushChangesToDatabase):
1793         (WebCore::RegistrationStore::updateRegistration):
1794         (WebCore::RegistrationStore::removeRegistration):
1795         (WebCore::RegistrationStore::databaseFailedToOpen):
1796         (WebCore::RegistrationStore::databaseOpenedAndRecordsImported):
1797         * workers/service/server/RegistrationStore.h: Copied from Source/WebCore/workers/service/ServiceWorkerRegistrationData.cpp.
1798
1799         * workers/service/server/SWServer.cpp:
1800         (WebCore::SWServer::removeRegistration):
1801         (WebCore::SWServer::SWServer):
1802         (WebCore::SWServer::updateWorker):
1803         (WebCore::SWServer::installContextData):
1804         * workers/service/server/SWServer.h:
1805
1806         * workers/service/server/SWServerRegistration.cpp:
1807         (WebCore::SWServerRegistration::data const):
1808         * workers/service/server/SWServerRegistration.h:
1809         (WebCore::SWServerRegistration::setLastUpdateTime):
1810
1811 2017-12-06  Chris Dumez  <cdumez@apple.com>
1812
1813         Unreviewed, fix build after r225577.
1814
1815         * bindings/js/JSDOMGlobalObject.cpp:
1816
1817 2017-12-06  David Quesada  <david_quesada@apple.com>
1818
1819         [Web App Manifest] Add SPI for fetching the manifest
1820         https://bugs.webkit.org/show_bug.cgi?id=180294
1821         rdar://problem/34747968
1822
1823         Reviewed by Geoffrey Garen.
1824
1825         Test: applicationmanifest/developer-warnings.html
1826
1827         * Modules/applicationmanifest/ApplicationManifest.h:
1828         (WebCore::ApplicationManifest::encode const):
1829         (WebCore::ApplicationManifest::decode):
1830         * Modules/applicationmanifest/ApplicationManifestParser.cpp:
1831         (WebCore::ApplicationManifestParser::logManifestPropertyNotAString):
1832         (WebCore::ApplicationManifestParser::logManifestPropertyInvalidURL):
1833             Drive-by wording changes. Since the warning is prefixed with "parsing
1834             application manifest:", remove a redundant use of "application manifest".
1835
1836 2017-12-06  Per Arne Vollan  <pvollan@apple.com>
1837
1838         The WebProcess should use the NSRunLoop runloop type.
1839         https://bugs.webkit.org/show_bug.cgi?id=179804
1840         <rdar://problem/14012823>
1841
1842         Reviewed by Brent Fulgham.
1843
1844         No new tests.
1845
1846         * platform/mac/EventLoopMac.mm:
1847         (WebCore::EventLoop::cycle):
1848
1849 2017-12-06  Antti Koivisto  <antti@apple.com>
1850
1851         Prefer ids and classes over tag names in selector filter
1852         https://bugs.webkit.org/show_bug.cgi?id=180433
1853         <rdar://problem/35859103>
1854
1855         Reviewed by Zalan Bujtas.
1856
1857         There are only four slots in the filter and currently we just pick whatever identifiers we find traversing the selector
1858         from right to left. More specific selector types are on average more valuable (id > class > tag) so we should prefer them.
1859
1860         This appears to be 4-5% StyleBench progression.
1861
1862         * css/RuleSet.cpp:
1863         (WebCore::RuleData::RuleData):
1864         * css/SelectorFilter.cpp:
1865         (WebCore::collectSimpleSelectorHash):
1866         (WebCore::collectSelectorHashes):
1867
1868             This function collects all hashes from the selector.
1869
1870         (WebCore::chooseSelectorHashesForFilter):
1871
1872             This function chooses the most valuable hashes to use with the filter.
1873
1874         (WebCore::SelectorFilter::collectHashes):
1875
1876             Factor into two separate steps.
1877
1878         (WebCore::collectDescendantSelectorIdentifierHashes): Deleted.
1879         (WebCore::SelectorFilter::collectIdentifierHashes): Deleted.
1880         * css/SelectorFilter.h:
1881         (WebCore::SelectorFilter::fastRejectSelector const):
1882
1883 2017-12-06  Jer Noble  <jer.noble@apple.com>
1884
1885         [EME] Make CDMInstance& parameter passed through MediaPlayer non-const
1886         https://bugs.webkit.org/show_bug.cgi?id=180484
1887
1888         Reviewed by Jon Lee.
1889
1890         One can only call const methods on const references, and the obvious intent
1891         of these methods is for the callee to call non-const methods on the parameters.
1892
1893         * Modules/encryptedmedia/MediaKeys.h:
1894         (WebCore::MediaKeys::cdmInstance):
1895         * platform/graphics/MediaPlayer.cpp:
1896         (WebCore::MediaPlayer::cdmInstanceAttached):
1897         (WebCore::MediaPlayer::cdmInstanceDetached):
1898         (WebCore::MediaPlayer::attemptToDecryptWithInstance):
1899         * platform/graphics/MediaPlayer.h:
1900         * platform/graphics/MediaPlayerPrivate.h:
1901         (WebCore::MediaPlayerPrivateInterface::cdmInstanceAttached):
1902         (WebCore::MediaPlayerPrivateInterface::cdmInstanceDetached):
1903         (WebCore::MediaPlayerPrivateInterface::attemptToDecryptWithInstance):
1904         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1905         (WebCore::MediaPlayerPrivateGStreamerBase::cdmInstanceAttached):
1906         (WebCore::MediaPlayerPrivateGStreamerBase::cdmInstanceDetached):
1907         (WebCore::MediaPlayerPrivateGStreamerBase::attemptToDecryptWithInstance):
1908         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
1909         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
1910         (WebCore::MediaPlayerPrivateGStreamerMSE::attemptToDecryptWithInstance):
1911         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:
1912
1913 2017-12-06  Youenn Fablet  <youenn@apple.com>
1914
1915         Preflight should bypass service worker
1916         https://bugs.webkit.org/show_bug.cgi?id=180463
1917
1918         Reviewed by Alex Christensen.
1919
1920         Covered by updated test.
1921
1922         * loader/CrossOriginPreflightChecker.cpp:
1923         (WebCore::CrossOriginPreflightChecker::startPreflight): Ensure service worker is not used.
1924         * loader/DocumentThreadableLoader.cpp:
1925         (WebCore::DocumentThreadableLoader::didFail): Tighten check and clear resource proactively to not hit loadRequest ASSERT.
1926
1927 2017-12-06  John Wilander  <wilander@apple.com>
1928
1929         Storage Access API: Make document.hasStorageAccess a function and always allow access for same-origin iframes
1930         https://bugs.webkit.org/show_bug.cgi?id=176944
1931         <rdar://problem/34440658>
1932
1933         Reviewed by Brent Fulgham.
1934
1935         Test: http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-without-user-gesture.html
1936
1937         This change introduces document.hasStorageAccess() as a function which
1938         returns a promise instead of being a property. Since cookie access can
1939         be due to both a granted request and recent user interaction as first
1940         party, the WebKit::WebResourceLoadStatisticsStore needs to be consulted.
1941
1942         * dom/Document.cpp:
1943         (WebCore::Document::hasStorageAccess):
1944         (WebCore::Document::requestStorageAccess):
1945             Removed check of the previous m_hasStorageAccess member.
1946             Same-origin check done earlier. This was a request/suggestion
1947             from Mozilla.
1948         * dom/Document.h:
1949         (WebCore::Document::hasStorageAccess const): Deleted.
1950             Now uses a promise.
1951         * dom/Document.idl:
1952         * page/ChromeClient.h:
1953
1954 2017-12-06  Youenn Fablet  <youenn@apple.com>
1955
1956         REGRESSION (r225537): Crash in WebCore::SWServerWorker::setHasPendingEvents(bool) + 68
1957         https://bugs.webkit.org/show_bug.cgi?id=180481
1958
1959         Reviewed by Chris Dumez.
1960
1961         Replacing ASSERT by if null check since there is no strong guarantee right now that there is a registration
1962         in SWServer registration map associated to a SWServerWorker.
1963
1964         * workers/service/server/SWServerWorker.cpp:
1965         (WebCore::SWServerWorker::setHasPendingEvents):
1966
1967 2017-12-06  Chris Dumez  <cdumez@apple.com>
1968
1969         ServiceWorkers API should reject promises when calling objects inside detached frames
1970         https://bugs.webkit.org/show_bug.cgi?id=180444
1971
1972         Reviewed by Youenn Fablet.
1973
1974         ServiceWorkers API should reject promises when calling objects inside detached frames.
1975
1976         No new tests, rebaselined existing test.
1977
1978         * bindings/js/JSDOMPromiseDeferred.h:
1979         (WebCore::callPromiseFunction):
1980         Use the caller's globalObject instead of the lexicalGlobalObject when constructing the
1981         deferred promise. The bug became visible when working on this service worker bug since
1982         rejecting the promise when the frame is detached did not actually work. The issue is
1983         that since the promise was created with the detached frame's globalObject, then it was
1984         suspended and would not run script.
1985
1986         * bindings/js/JSDOMWindowBase.cpp:
1987         (WebCore::callerGlobalObject):
1988         (WebCore::incumbentDOMWindow):
1989         * bindings/js/JSDOMWindowBase.h:
1990         Add convenience function to get the caller's globalObject. It was carved out of
1991         incumbentDOMWindow().
1992
1993         * workers/service/ServiceWorker.cpp:
1994         (WebCore::ServiceWorker::postMessage):
1995         * workers/service/ServiceWorkerContainer.cpp:
1996         (WebCore::ServiceWorkerContainer::addRegistration):
1997         (WebCore::ServiceWorkerContainer::getRegistration):
1998         (WebCore::ServiceWorkerContainer::getRegistrations):
1999         * workers/service/ServiceWorkerRegistration.cpp:
2000         (WebCore::ServiceWorkerRegistration::update):
2001         (WebCore::ServiceWorkerRegistration::unregister):
2002         Reject the promise when m_isStopped flag is set (i.e. ActiveDOMObject::stop()
2003         has been called).
2004
2005 2017-12-06  Said Abou-Hallawa  <sabouhallawa@apple.com>
2006
2007         [Mac] REGRESSION (r224527): Drawing a path with box-shadow takes double the blur-radius on Retina display
2008         https://bugs.webkit.org/show_bug.cgi?id=180460
2009         <rdar://problem/35869866>
2010
2011         Reviewed by Daniel Bates.
2012
2013         Disable using CGContextDrawPathDirect() for macOS High Sierra or earlier.
2014         This API has a bug when drawing a path with a shadow on Retina display.
2015         This bug is tracked internally by <rdar://problem/35620690>.
2016
2017
2018         * platform/graphics/cg/GraphicsContextCG.cpp:
2019
2020 2017-12-06  Youenn Fablet  <youenn@apple.com>
2021
2022         Service Worker fetch should filter HTTP headers that are added by CachedResourceLoader/CachedResource
2023         https://bugs.webkit.org/show_bug.cgi?id=180462
2024
2025         Reviewed by Geoffrey Garen.
2026
2027         Coved by rebased test.
2028
2029         * loader/CrossOriginAccessControl.cpp:
2030         (WebCore::cleanRedirectedRequestForAccessControl): Accept header is a safe header so it is fine to keep it.
2031         * workers/service/context/ServiceWorkerFetch.cpp:
2032         (WebCore::ServiceWorkerFetch::dispatchFetchEvent): Cleaning headers added by CachedResourceLoader/CachedResource.
2033
2034 2017-12-06  Zan Dobersek  <zdobersek@igalia.com>
2035
2036         [CoordGraphics] Introduce Nicosia::PaintingContext, add Cairo implementation
2037         https://bugs.webkit.org/show_bug.cgi?id=180239
2038
2039         Reviewed by Michael Catanzaro.
2040
2041         As the next step in the Nicosia abstraction formation, we introduce
2042         Nicosia::PaintingContext. Implementations of this class will leverage a
2043         chosen 2D graphics library to paint (through GraphicsContext) into the
2044         memory area that's specified by a given Nicosia::Buffer object.
2045
2046         Nicosia::Buffer is slimmed down to only control the memory that's
2047         required for rasterization of an RGBA32 painting output. It mimics the
2048         Cairo ImageBuffer implementation by using FastMalloc to allocate the
2049         necessary memory. In the future this class might become an interface of
2050         which different implementations will be providing memory that's
2051         allocated through different ways. For instance, when GLES3 is available,
2052         it would be possible to map GPU memory into the process memory space and
2053         rasterize into that, effectively eliminating need for GPU uploads.
2054
2055         Since the ImageBuffer use in Nicosia::Buffer is dropped, the context()
2056         and uploadImage() methods are also removed. The functionality of
2057         ImageBuffer that was leveraged for CoordinatedGraphics rasterization
2058         still remains used through the PaintingContextCairo implementation. In
2059         the constructor of that class, with the target Nicosia::Buffer provided,
2060         we construct the cairo_surface_t and cairo_t objects that are necessary
2061         to create a combination of PlatformContextCairo and GraphicsContext
2062         objects that we can then use for rasterization.
2063
2064         Reference of the passed-in Nicosia::Buffer object is increased for the
2065         lifetime of the cairo_surface_t object that will be drawing into that
2066         buffer's memory area. This ensures the memory area doesn't disappear
2067         from a live cairo_surface_t. Still, the expectation is that the
2068         cairo_surface_t object won't outlive the PaintingContextCairo object's
2069         lifetime, since the cairo_t object is also managed here and deleted in
2070         the destructor. To test that, we use a cairo_surface_t user data key
2071         that in its destroy callback dereferences the Nicosia::Buffer object and
2072         also marks the deletion process for the related PaintingContextCairo
2073         object as complete. This m_deletionComplete value is tested in the
2074         destructor of the class, once all the Cairo references are nulled out.
2075
2076         The PaintingContext objects should be limited to a single scope,
2077         enabling the implementation resources to assume that the lifetime of the
2078         implementation object won't extend outside of the scope where it was
2079         created. To ensure that, the PaintingContext::paint() static function is
2080         added that creates the PaintingContext object and then executes the
2081         passed-in functor, passing it the GraphicsContext that should be used
2082         for drawing. Drawing is thus limited to that functor only, and the
2083         PaintingContext's create() function and the virtual graphicsContext()
2084         are not made public in the class.
2085
2086         No new tests -- no change in functionality.
2087
2088         * platform/TextureMapper.cmake:
2089         * platform/graphics/nicosia/NicosiaBuffer.cpp:
2090         (Nicosia::Buffer::Buffer):
2091         (Nicosia::Buffer::context): Deleted.
2092         (Nicosia::Buffer::uploadImage): Deleted.
2093         * platform/graphics/nicosia/NicosiaBuffer.h:
2094         (Nicosia::Buffer::stride const):
2095         (Nicosia::Buffer::data const):
2096         * platform/graphics/nicosia/NicosiaPaintingContext.cpp: Copied from Source/WebCore/platform/graphics/nicosia/NicosiaBuffer.cpp.
2097         (Nicosia::PaintingContext::create):
2098         * platform/graphics/nicosia/NicosiaPaintingContext.h: Copied from Source/WebCore/platform/graphics/nicosia/NicosiaBuffer.cpp.
2099         (Nicosia::PaintingContext::paint):
2100         * platform/graphics/nicosia/NicosiaPaintingContextCairo.cpp: Added.
2101         (Nicosia::PaintingContextCairo::PaintingContextCairo):
2102         (Nicosia::PaintingContextCairo::~PaintingContextCairo):
2103         (Nicosia::PaintingContextCairo::graphicsContext):
2104         * platform/graphics/nicosia/NicosiaPaintingContextCairo.h: Copied from Source/WebCore/platform/graphics/nicosia/NicosiaBuffer.h.
2105         * platform/graphics/nicosia/NicosiaPaintingEngineBasic.cpp:
2106         (Nicosia::PaintingEngineBasic::paint):
2107         * platform/graphics/texmap/coordinated/CoordinatedImageBacking.cpp:
2108         (WebCore::CoordinatedImageBacking::update):
2109
2110 2017-12-05  Fujii Hironori  <Hironori.Fujii@sony.com>
2111
2112         [GTK] Layout test media/track/track-in-band-duplicate-tracks-when-source-changes.html crashes and times out
2113         https://bugs.webkit.org/show_bug.cgi?id=160131
2114
2115         Reviewed by Eric Carlson.
2116
2117         Null dereference can be happen if VideoTrack and AudioTrack are
2118         disconnected from its media element.
2119
2120         No new tests, no behavior change.
2121
2122         * html/track/AudioTrack.cpp:
2123         (WebCore::AudioTrack::willRemove): Null-check mediaElement.
2124         * html/track/VideoTrack.cpp:
2125         (WebCore::VideoTrack::setLanguage): Ditto.
2126
2127 2017-12-05  Chris Dumez  <cdumez@apple.com>
2128
2129         ServiceWorkerGlobalScope prototype chain should be immutable
2130         https://bugs.webkit.org/show_bug.cgi?id=180450
2131
2132         Reviewed by Youenn Fablet.
2133
2134         ServiceWorkerGlobalScope prototype chain should be immutable, similarly
2135         to what we do for DOMWindow. This is covered by a web-platform-test
2136         which was timing out because it was successfuly overwriting the
2137         ServiceWorkerGlobalScope prototype.
2138
2139         No new tests, rebaselined existing test.
2140
2141         * workers/DedicatedWorkerGlobalScope.idl:
2142         * workers/WorkerGlobalScope.idl:
2143         * workers/service/ServiceWorkerGlobalScope.idl:
2144
2145 2017-12-05  Basuke Suzuki  <Basuke.Suzuki@sony.com>
2146
2147         Fast binding generation by batching several files at once
2148         https://bugs.webkit.org/show_bug.cgi?id=179958
2149
2150         Reviewed by Alex Christensen.
2151
2152         Passing several files to the sub process at once and reducing the total cost of
2153         process generation. Especially Windows port has great speed improvement because
2154         its implementation of fork/exec is terrible.
2155
2156         * bindings/scripts/generate-bindings-all.pl:
2157         (spawnGenerateBindingsIfNeeded):
2158         * bindings/scripts/generate-bindings.pl:
2159         (generateBindings):
2160
2161 2017-12-05  David Quesada  <david_quesada@apple.com>
2162
2163         [Web App Manifest] Support fetching the app manifest 
2164         https://bugs.webkit.org/show_bug.cgi?id=180292
2165
2166         Reviewed by Geoffrey Garen.
2167
2168         Add support in WebCore for loading and parsing application manifests. This functionality
2169         is currently exposed with two methods: DocumentLoader::loadApplicationManifest() to call
2170         to start loading the manifest, and FrameLoaderClient::finishedLoadingApplicationManifest()
2171         for clients to override in order to be notified of the loaded manifest.
2172
2173         No new tests, since no functionality is exposed to web content or embedders yet. The
2174         needed SPI will be added in an upcoming patch.
2175
2176         * Sources.txt:
2177         * WebCore.xcodeproj/project.pbxproj:
2178             Added CachedApplicationManifest and ApplicationManifestLoader.
2179         * html/HTMLLinkElement.h:
2180         * html/LinkRelAttribute.cpp:
2181         (WebCore::LinkRelAttribute::LinkRelAttribute):
2182         (WebCore::LinkRelAttribute::isSupported):
2183             Add "manifest" as a supported 'rel' type for links.
2184         * html/LinkRelAttribute.h:
2185         * inspector/agents/InspectorPageAgent.cpp:
2186         (WebCore::InspectorPageAgent::resourceTypeJSON):
2187         (WebCore::InspectorPageAgent::inspectorResourceType):
2188         * inspector/agents/InspectorPageAgent.h:
2189         * loader/ApplicationManifestLoader.cpp: Added.
2190             Added a class ApplicationManifestLoader which handles creating a ResourceRequest,
2191             loading the resource from the CachedResourceLoader, and parsing the resulting text.
2192             This class and its relation to DocumentLoader are roughly based on that of IconLoader,
2193             which serves a similar purpose - requesting a resource on the page and ultimately
2194             providing it to the embedder.
2195         (WebCore::ApplicationManifestLoader::ApplicationManifestLoader):
2196         (WebCore::ApplicationManifestLoader::~ApplicationManifestLoader):
2197         (WebCore::ApplicationManifestLoader::startLoading):
2198         (WebCore::ApplicationManifestLoader::stopLoading):
2199         (WebCore::ApplicationManifestLoader::processManifest):
2200         (WebCore::ApplicationManifestLoader::notifyFinished):
2201         * loader/ApplicationManifestLoader.h: Copied from Source/WebCore/page/csp/ContentSecurityPolicyDirectiveNames.h.
2202         * loader/DocumentLoader.cpp:
2203         (WebCore::DocumentLoader::stopLoading):
2204         (WebCore::DocumentLoader::loadApplicationManifest):
2205         (WebCore::DocumentLoader::finishedLoadingApplicationManifest):
2206         (WebCore::DocumentLoader::notifyFinishedLoadingApplicationManifest):
2207         * loader/DocumentLoader.h:
2208         * loader/FrameLoaderClient.h:
2209         * loader/LinkLoader.cpp:
2210         (WebCore::createLinkPreloadResourceClient):
2211         (WebCore::LinkLoader::isSupportedType):
2212         * loader/ResourceLoadInfo.cpp:
2213         (WebCore::toResourceType):
2214         * loader/SubresourceLoader.cpp:
2215         (WebCore::logResourceLoaded):
2216         * loader/cache/CachedApplicationManifest.cpp: Added.
2217         (WebCore::CachedApplicationManifest::CachedApplicationManifest):
2218         (WebCore::CachedApplicationManifest::finishLoading):
2219         (WebCore::CachedApplicationManifest::setEncoding):
2220         (WebCore::CachedApplicationManifest::encoding const):
2221         (WebCore::CachedApplicationManifest::process):
2222             Add a method to process the fetched text into an ApplicationManifest. CachedApplicationManifest
2223             does not store the resulting ApplicationManifest because the text of an application
2224             manifest can yield a different ApplicationManifest depending on the URL of the document
2225             processing it.
2226         * loader/cache/CachedApplicationManifest.h: Copied from Source/WebCore/page/csp/ContentSecurityPolicyDirectiveNames.h.
2227         * loader/cache/CachedResource.cpp:
2228         (WebCore::CachedResource::defaultPriorityForResourceType):
2229         * loader/cache/CachedResource.h:
2230         * loader/cache/CachedResourceLoader.cpp:
2231         (WebCore::createResource):
2232         (WebCore::CachedResourceLoader::requestApplicationManifest):
2233         (WebCore::contentTypeFromResourceType):
2234         (WebCore::CachedResourceLoader::checkInsecureContent const):
2235         (WebCore::CachedResourceLoader::allowedByContentSecurityPolicy const):
2236         * loader/cache/CachedResourceLoader.h:
2237         * page/DiagnosticLoggingKeys.cpp:
2238         (WebCore::DiagnosticLoggingKeys::applicationManifestKey):
2239         * page/DiagnosticLoggingKeys.h:
2240         * page/csp/ContentSecurityPolicy.cpp:
2241         (WebCore::ContentSecurityPolicy::allowManifestFromSource const):
2242         * page/csp/ContentSecurityPolicy.h:
2243         * page/csp/ContentSecurityPolicyDirectiveList.cpp:
2244         (WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForManifest const):
2245         (WebCore::ContentSecurityPolicyDirectiveList::addDirective):
2246         * page/csp/ContentSecurityPolicyDirectiveList.h:
2247         * page/csp/ContentSecurityPolicyDirectiveNames.cpp:
2248         * page/csp/ContentSecurityPolicyDirectiveNames.h:
2249
2250 2017-12-05  Stephan Szabo  <stephan.szabo@sony.com>
2251
2252         Switch windows build to Visual Studio 2017
2253         https://bugs.webkit.org/show_bug.cgi?id=172412
2254
2255         Reviewed by Per Arne Vollan.
2256
2257         Only changes proj file to update generator
2258
2259         * WebCore.vcxproj/WebCore.proj:
2260
2261 2017-12-05  Brent Fulgham  <bfulgham@apple.com>
2262
2263         Limit user agent versioning to an upper bound
2264         https://bugs.webkit.org/show_bug.cgi?id=180365
2265         <rdar://problem/34550617>
2266
2267         Reviewed by Joseph Pecoraro.
2268
2269         Freeze the version reported as User Agent to OS 10.13.4 (OS 11.3 on iOS) and WebKit 605.1.15
2270         for User Agent purposes.
2271
2272         Test: fast/dom/navigator-userAgent-frozen.html
2273
2274         * page/cocoa/UserAgent.h:
2275         * page/cocoa/UserAgent.mm:
2276         (WebCore::versionPredatesFreeze): Helper function. Returns true for Version 10.13.3 or older.
2277         (WebCore::systemMarketingVersionForUserAgentString):
2278         (WebCore::userAgentBundleVersion):
2279         (WebCore::userVisibleWebKitBundleVersionFromFullVersion): Deleted.
2280         (WebCore::userAgentBundleVersionFromFullVersionString): Deleted.
2281         * page/ios/UserAgentIOS.mm:
2282         (WebCore::standardUserAgentWithApplicationName): Don't take the WebKit bundle version
2283         as an argument, or pass it to the user agent string generator.
2284         * page/mac/UserAgentMac.mm:
2285         (WebCore::standardUserAgentWithApplicationName): Ditto. 
2286
2287 2017-12-05  Matt Lewis  <jlewis3@apple.com>
2288
2289         Unreviewed, rolling out r225430.
2290
2291         This caused an API failure on release.
2292
2293         Reverted changeset:
2294
2295         "Move DateComponents into WTF"
2296         https://bugs.webkit.org/show_bug.cgi?id=180211
2297         https://trac.webkit.org/changeset/225430
2298
2299 2017-12-05  Simon Fraser  <simon.fraser@apple.com>
2300
2301         Composited frames incorrectly get requestAnimationFrame throttled
2302         https://bugs.webkit.org/show_bug.cgi?id=178396
2303
2304         Reviewed by Zalan Bujtas.
2305
2306         If a composited iframe was inside overflow:scroll, and the overflow was scrolled to the left
2307         further than the window width, then RenderLayer::childrenClipRect() would return an empty rectangle
2308         and we'd incorrectly consider the iframe out of view, and thus throttle its requestAnimationFrame.
2309
2310         childrenClipRect() was taking unscaledDocumentRect(), applying the clip, and then mapping the result
2311         from local to absolute coordinates (which mapped it through the overflow scroll offset). This is incorrect
2312         because it considers the unscaledDocumentRect() to be in local coordinates, which it is not.
2313
2314         Instead, start with the infinite rect, which essentially tells us if we have any clipping, and then
2315         intersect that with the document rect at the end. Something similar is done in other places that call.
2316         calculateRects().
2317
2318         Test: fast/animation/request-animation-frame-throttle-inside-overflow-scroll.html
2319
2320         * rendering/RenderLayer.cpp:
2321         (WebCore::RenderLayer::calculateClipRects const):
2322
2323 2017-12-05  Michael Saboff  <msaboff@apple.com>
2324
2325         Make WebKit build for ARM64_32
2326         https://bugs.webkit.org/show_bug.cgi?id=180447
2327
2328         Reviewed by Mark Lam.
2329
2330         No new test as this isn't a change to functionality.
2331
2332         * platform/graphics/transforms/TransformationMatrix.cpp:
2333         (WebCore::TransformationMatrix::multiply): Fallback to the C++ version for
2334         ARM64_32.
2335
2336 2017-12-05  Chris Dumez  <cdumez@apple.com>
2337
2338         XMLHttpRequest should not be exposed to service workers
2339         https://bugs.webkit.org/show_bug.cgi?id=180446
2340
2341         Reviewed by Youenn Fablet.
2342
2343         Stop exposing XMLHttpRequest to service workers, as per:
2344         - https://xhr.spec.whatwg.org/#interface-xmlhttprequest
2345
2346         * xml/XMLHttpRequest.idl:
2347
2348 2017-12-05  Joseph Pecoraro  <pecoraro@apple.com>
2349
2350         Web Inspector: content views for resources loaded through XHR do not reflect declared mime-type
2351         https://bugs.webkit.org/show_bug.cgi?id=141389
2352         <rdar://problem/19767070>
2353
2354         Reviewed by Brian Burg.
2355
2356         Updated: http/tests/inspector/network/xhr-response-body.html:
2357                  http/tests/inspector/network/fetch-response-body.html:
2358
2359         * xml/XMLHttpRequest.cpp:
2360         (WebCore::XMLHttpRequest::didFinishLoading):
2361         * inspector/InspectorInstrumentation.cpp:
2362         (WebCore::InspectorInstrumentation::didFinishXHRLoadingImpl): Deleted.
2363         * inspector/InspectorInstrumentation.h:
2364         (WebCore::InspectorInstrumentation::didFinishXHRLoading): Deleted.
2365         Remove special handling of XHR content that decoded output as text.
2366
2367         * inspector/NetworkResourcesData.h:
2368         (WebCore::NetworkResourcesData::ResourceData::requestId const):
2369         (WebCore::NetworkResourcesData::ResourceData::loaderId const):
2370         (WebCore::NetworkResourcesData::ResourceData::frameId const):
2371         (WebCore::NetworkResourcesData::ResourceData::url const):
2372         (WebCore::NetworkResourcesData::ResourceData::content const):
2373         (WebCore::NetworkResourcesData::ResourceData::isContentEvicted const):
2374         (WebCore::NetworkResourcesData::ResourceData::textEncodingName const):
2375         * inspector/NetworkResourcesData.cpp:
2376         (WebCore::NetworkResourcesData::ResourceData::ResourceData):
2377         (WebCore::NetworkResourcesData::ResourceData::decodeDataToContent):
2378         (WebCore::NetworkResourcesData::responseReceived):
2379         (WebCore::NetworkResourcesData::setResourceContent):
2380         (WebCore::shouldBufferResourceData):
2381         (WebCore::NetworkResourcesData::maybeAddResourceData):
2382         (WebCore::NetworkResourcesData::maybeDecodeDataToContent):
2383
2384         Make NetworkResourcesData only create a text decoder for resources we
2385         really think are text, and buffer resource data if it is text data
2386         or if it is a resource that would otherwise not be buffered by WebCore
2387         (such as XHRs with a DoNotBufferData policy). This ensures that the
2388         Inspector will have data to show for resources that won't be cached.
2389
2390         * inspector/agents/InspectorPageAgent.cpp:
2391         (WebCore::InspectorPageAgent::resourceContent):
2392         (WebCore::InspectorPageAgent::sourceMapURLForResource):
2393         (WebCore::InspectorPageAgent::searchInResource):
2394         (WebCore::InspectorPageAgent::searchInResources):
2395         (WebCore::hasTextContent): Deleted.
2396         (WebCore::InspectorPageAgent::cachedResourceContent): Deleted.
2397         (WebCore::InspectorPageAgent::createTextDecoder): Deleted.
2398         (WebCore::textContentForCachedResource): Deleted.
2399         * inspector/agents/InspectorPageAgent.h:
2400         * inspector/agents/InspectorNetworkAgent.cpp:
2401         (WebCore::InspectorNetworkAgent::didReceiveData):
2402         (WebCore::InspectorNetworkAgent::willDestroyCachedResource):
2403         (WebCore::InspectorNetworkAgent::getResponseBody):
2404         (WebCore::InspectorNetworkAgent::shouldTreatAsText):
2405         (WebCore::InspectorNetworkAgent::createTextDecoder):
2406         (WebCore::InspectorNetworkAgent::textContentForCachedResource):
2407         (WebCore::InspectorNetworkAgent::cachedResourceContent):
2408         (WebCore::textContentForResourceData):
2409         (WebCore::InspectorNetworkAgent::searchOtherRequests):
2410         (WebCore::isErrorStatusCode): Deleted.
2411         (WebCore::InspectorNetworkAgent::didFinishXHRLoading): Deleted.
2412         * inspector/agents/InspectorNetworkAgent.h:
2413         Move static PageAgent functions related to the generic data tuple
2414         (content, base64Encoded) to NetworkAgent. Also generalize it to
2415         not rely on the CachedResourceType, but instead rely on the MIME type.
2416         This has a few changes in behavior:
2417
2418             - Images, may now be text if they have a text mime type (image/svg+xml).
2419             - XHR / Fetch / Other may be sent as text if they have a text mime type.
2420             - XHR / Fetch / Other are not assumed to be text, and may be sent as base64 encoded.
2421         
2422         For this to be useful the frontend should also check the mime type and
2423         display an appropriate ContentView.
2424
2425 2017-12-05  Youenn Fablet  <youenn@apple.com>
2426
2427         Implement https://w3c.github.io/ServiceWorker/#clients-claim
2428         https://bugs.webkit.org/show_bug.cgi?id=180261
2429
2430         Reviewed by Chris Dumez.
2431
2432         Test: http/tests/workers/service/serviceworkerclients-claim.https.html
2433
2434         Implement claim by going to the storage process and then iterate over clients to see whether active worker can be set.
2435         Update SWServerWorker to call registration tryClear/tryActivate whenever a service worker has no pending event.
2436
2437         * workers/service/ServiceWorkerClients.cpp:
2438         (WebCore::ServiceWorkerClients::claim):
2439         * workers/service/context/SWContextManager.h:
2440         * workers/service/server/SWServer.cpp:
2441         (WebCore::SWServer::claim):
2442         (WebCore::SWServer::doRegistrationMatching):
2443         (WebCore::SWServer::doRegistrationMatching const): Deleted.
2444         * workers/service/server/SWServer.h:
2445         (WebCore::SWServer::Connection::doRegistrationMatching):
2446         * workers/service/server/SWServerRegistration.cpp:
2447         (WebCore::SWServerRegistration::controlClient):
2448         * workers/service/server/SWServerRegistration.h:
2449         * workers/service/server/SWServerToContextConnection.cpp:
2450         (WebCore::SWServerToContextConnection::claim):
2451         * workers/service/server/SWServerToContextConnection.h:
2452         * workers/service/server/SWServerWorker.cpp:
2453         (WebCore::SWServerWorker::claim):
2454         * workers/service/server/SWServerWorker.h:
2455
2456 2017-12-05  Per Arne Vollan  <pvollan@apple.com>
2457
2458         [Win] Scrollbars are sometimes not rendered in accelerated compositing mode.
2459         https://bugs.webkit.org/show_bug.cgi?id=180431
2460         <rdar://problem/34531264>
2461
2462         Reviewed by Simon Fraser.
2463
2464         No new tests, covered by existing tests.
2465
2466         When a scroll layer is required, we will create an overflow control hosts layer.
2467         In this case the method RenderLayerCompositor::shouldCompositeOverflowControls()
2468         should return true, otherwise the scrollbars will not be rendered.
2469  
2470         * rendering/RenderLayerCompositor.cpp:
2471         (WebCore::RenderLayerCompositor::shouldCompositeOverflowControls const):
2472
2473 2017-12-05  Youenn Fablet  <youenn@apple.com>
2474
2475         Call "Terminate Service Worker" on all workers when all their clients are gone
2476         https://bugs.webkit.org/show_bug.cgi?id=179552
2477         <rdar://problem/35836323>
2478
2479         Unreviewed.
2480
2481         * workers/service/server/SWServer.cpp: Reducing from 60_s to 10_s based on bugzilla comment.
2482
2483 2017-12-05  Chris Dumez  <cdumez@apple.com>
2484
2485         Add support for ServiceWorkerContainer.prototype.ready
2486         https://bugs.webkit.org/show_bug.cgi?id=180383
2487
2488         Reviewed by Youenn Fablet.
2489
2490         Add support for ServiceWorkerContainer.prototype.ready:
2491         - https://w3c.github.io/ServiceWorker/#navigator-service-worker-ready
2492
2493         No new tests, rebaselined existing test.
2494
2495         * workers/service/SWClientConnection.h:
2496         * workers/service/ServiceWorkerContainer.cpp:
2497         (WebCore::ServiceWorkerContainer::ServiceWorkerContainer):
2498         (WebCore::ServiceWorkerContainer::ready):
2499         * workers/service/ServiceWorkerContainer.h:
2500         * workers/service/ServiceWorkerRegistrationKey.h:
2501         * workers/service/server/SWServer.cpp:
2502         (WebCore::SWServer::resolveRegistrationReadyRequests):
2503         * workers/service/server/SWServer.h:
2504         * workers/service/server/SWServerRegistration.cpp:
2505         (WebCore::SWServerRegistration::activate):
2506         (WebCore::SWServerRegistration::setIsUninstalling):
2507         * workers/service/server/SWServerRegistration.h:
2508
2509 2017-12-05  Yusuke Suzuki  <utatane.tea@gmail.com>
2510
2511         Modernize WebThread code for further refactoring
2512         https://bugs.webkit.org/show_bug.cgi?id=180344
2513
2514         Reviewed by Alex Christensen.
2515
2516         When touching Thread and its initialization component, we need to touch
2517         web thread initialization code too. However, since web thread code is old,
2518         it's style is not following to WebKit coding style guidelines.
2519
2520         This patch first modernizes WebThread code for further refactoring.
2521
2522         1. `Type*` instead of `Type *`.
2523         2. Use std::call_once instead of pthread_once.
2524         3. Use static_cast instead of C-cast.
2525         4. Use nullptr instead of NULL.
2526         5. Use `ret` or `!ret` instead of `ret != 0` or `ret == 0`.
2527         6. Do not use #pragma unused.
2528         7. if-else with one statement should not have braces.
2529
2530         In this patch, we do not change pthread_condition_t to WTF::Condition and
2531         pthread_mutex_t to WTF::Lock since web thread code requires extra care about
2532         threading.
2533
2534         No behavior change.
2535
2536         * platform/ios/wak/WebCoreThread.mm:
2537         (-[NSObject releaseOnMainThread]):
2538         (SendMessage):
2539         (HandleDelegateSource):
2540         (SendDelegateMessage):
2541         (WebThreadAdoptAndRelease):
2542         (lockWebCoreReleaseLock):
2543         (unlockWebCoreReleaseLock):
2544         (WebCoreObjCDeallocOnWebThreadImpl):
2545         (WebCoreObjCDeallocWithWebThreadLockImpl):
2546         (HandleWebThreadReleaseSource):
2547         (WebThreadCallDelegate):
2548         (WebThreadPostNotification):
2549         (WebThreadCallDelegateAsync):
2550         (WebThreadMakeNSInvocation):
2551         (MainRunLoopAutoUnlock):
2552         (_WebThreadAutoLock):
2553         (WebRunLoopLock):
2554         (WebRunLoopUnlock):
2555         (MainRunLoopUnlockGuard):
2556         (CurrentThreadContext):
2557         (RunWebThread):
2558         (StartWebThread):
2559         (WebTimedConditionLock):
2560         (_WebTryThreadLock):
2561         (WebThreadUnlockFromAnyThread):
2562         (WebThreadUnlockGuardForMail):
2563         (_WebThreadUnlock):
2564         (WebThreadIsLocked):
2565         (WebThreadLockPopModal):
2566         (WebThreadCurrentContext):
2567         (WebThreadEnable):
2568         (FreeThreadContext): Deleted.
2569         (InitThreadContextKey): Deleted.
2570
2571 2017-12-05  Alex Christensen  <achristensen@webkit.org>
2572
2573         Fix non-unified build after r225381
2574         https://bugs.webkit.org/show_bug.cgi?id=180434
2575
2576         Reviewed by Keith Miller.
2577
2578         * loader/ResourceTimingInformation.cpp:
2579         FrameLoader.h is included in other files that are combined with this file in unified builds,
2580         but we need to merge r225381 to a branch that doesn't use unified builds.  This build failure
2581         would've come up randomly in the future when we add files, too.
2582
2583 2017-12-05  Simon Fraser  <simon.fraser@apple.com>
2584
2585         Remove webkitGetImageDataHD and webkitPutImageDataHD from canvas API
2586         https://bugs.webkit.org/show_bug.cgi?id=180387
2587
2588         Reviewed by Dean Jackson.
2589
2590         CanvasRenderingContext2D.webkitGetImageDataHD and webkitPutImageDataHD were never standardized,
2591         and Blink removed support in 2014 (https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/FOPH5dloGG8).
2592
2593         Since our canvas backing store is always 1x, they have no use anyway, so remove them.
2594
2595         * html/canvas/CanvasRenderingContext2D.cpp:
2596         (WebCore::CanvasRenderingContext2D::putImageData):
2597         (WebCore::CanvasRenderingContext2D::webkitGetImageDataHD const): Deleted.
2598         (WebCore::CanvasRenderingContext2D::webkitPutImageDataHD): Deleted.
2599         * html/canvas/CanvasRenderingContext2D.h:
2600         * html/canvas/CanvasRenderingContext2D.idl:
2601
2602 2017-12-05  Youenn Fablet  <youenn@apple.com>
2603
2604         Implement setting of service worker to client in SWServer without going to WebProcess
2605         https://bugs.webkit.org/show_bug.cgi?id=180382
2606
2607         Reviewed by Chris Dumez.
2608
2609         No change of behavior.
2610
2611         This patch removes the notification of active worker setting from ScriptExecution/WebProcess up to SWServer/StorageProcess.
2612         Instead, active worker setting is fully done/controlled in SWServer.
2613         Whenever there is a change, SWServer notifies WebProcess and ScriptExecutionContext gets updated accordingly.
2614
2615         * dom/Document.cpp:
2616         (WebCore::Document::setServiceWorkerConnection):
2617         * dom/ScriptExecutionContext.cpp:
2618         (WebCore::ScriptExecutionContext::setActiveServiceWorker):
2619         * loader/DocumentLoader.cpp:
2620         (WebCore::DocumentLoader::commitData):
2621         * workers/service/SWClientConnection.h:
2622         * workers/service/server/SWServer.cpp:
2623         (WebCore::SWServer::setClientActiveWorker):
2624         (WebCore::SWServer::registerServiceWorkerClient):
2625         (WebCore::SWServer::registrationFromServiceWorkerIdentifier):
2626         (WebCore::SWServer::unregisterServiceWorkerClient):
2627         (WebCore::SWServer::Connection::serviceWorkerStartedControllingClient): Deleted.
2628         (WebCore::SWServer::Connection::serviceWorkerStoppedControllingClient): Deleted.
2629         (WebCore::SWServer::serviceWorkerStartedControllingClient): Deleted.
2630         (WebCore::SWServer::serviceWorkerStoppedControllingClient): Deleted.
2631         * workers/service/server/SWServer.h:
2632         * workers/service/server/SWServerRegistration.cpp:
2633         (WebCore::SWServerRegistration::activate):
2634
2635 2017-12-01  Filip Pizlo  <fpizlo@apple.com>
2636
2637         GC constraint solving should be parallel
2638         https://bugs.webkit.org/show_bug.cgi?id=179934
2639
2640         Reviewed by JF Bastien.
2641
2642         No new tests because no change in behavior. This change is best tested using DOM-GC-intensive
2643         benchmarks like Speedometer and Dromaeo.
2644         
2645         This parallelizes the DOM's output constraint, and makes some small changes to make this more
2646         scalable.
2647
2648         * ForwardingHeaders/heap/SimpleMarkingConstraint.h: Added.
2649         * ForwardingHeaders/heap/VisitingTimeout.h: Removed.
2650         * Sources.txt:
2651         * WebCore.xcodeproj/project.pbxproj:
2652         * bindings/js/DOMGCOutputConstraint.cpp: Added.
2653         (WebCore::DOMGCOutputConstraint::DOMGCOutputConstraint):
2654         (WebCore::DOMGCOutputConstraint::~DOMGCOutputConstraint):
2655         (WebCore::DOMGCOutputConstraint::executeImpl):
2656         (WebCore::DOMGCOutputConstraint::doParallelWorkImpl):
2657         (WebCore::DOMGCOutputConstraint::finishParallelWorkImpl):
2658         * bindings/js/DOMGCOutputConstraint.h: Added.
2659         * bindings/js/WebCoreJSClientData.cpp:
2660         (WebCore::JSVMClientData::initNormalWorld):
2661         * dom/Node.cpp:
2662         (WebCore::Node::eventTargetDataConcurrently):
2663         (WebCore::Node::ensureEventTargetData):
2664         (WebCore::Node::clearEventTargetData):
2665
2666 2017-12-05  Antoine Quint  <graouts@apple.com>
2667
2668         <video> and scale() transforms yield shrunk small or clipped controls
2669         https://bugs.webkit.org/show_bug.cgi?id=180358
2670         <rdar://problem/34436124>
2671
2672         Unreviewed.
2673
2674         Use DOMMatrix vs. WebKitCSSMatrix per Simon's post-commit review feedback.
2675
2676         * Modules/modern-media-controls/media/media-controller.js:
2677         (MediaController.prototype._updateControlsSize):
2678
2679 2017-12-04  Chris Dumez  <cdumez@apple.com>
2680
2681         Support container.getRegistration() / getRegistrations() inside service workers
2682         https://bugs.webkit.org/show_bug.cgi?id=180360
2683
2684         Reviewed by Youenn Fablet.
2685
2686         Support container.getRegistration() / getRegistrations() inside service workers
2687         by making sure we hop to the right thread when needed.
2688
2689         Test: http/tests/workers/service/ServiceWorkerGlobalScope_getRegistration.html
2690
2691         * dom/ScriptExecutionContext.cpp:
2692         (WebCore::ScriptExecutionContext::postTaskTo):
2693         * dom/ScriptExecutionContext.h:
2694         * workers/service/SWClientConnection.cpp:
2695         (WebCore::SWClientConnection::jobRejectedInServer):
2696         (WebCore::SWClientConnection::registrationJobResolvedInServer):
2697         (WebCore::SWClientConnection::unregistrationJobResolvedInServer):
2698         (WebCore::SWClientConnection::startScriptFetchForServer):
2699         (WebCore::SWClientConnection::clearPendingJobs):
2700         * workers/service/SWClientConnection.h:
2701         * workers/service/ServiceWorkerContainer.cpp:
2702         (WebCore::ServiceWorkerContainer::getRegistration):
2703         (WebCore::ServiceWorkerContainer::didFinishGetRegistrationRequest):
2704         (WebCore::ServiceWorkerContainer::getRegistrations):
2705         (WebCore::ServiceWorkerContainer::didFinishGetRegistrationsRequest):
2706         (WebCore::ServiceWorkerContainer::stop):
2707         * workers/service/ServiceWorkerContainer.h:
2708
2709 2017-12-04  Simon Fraser  <simon.fraser@apple.com>
2710
2711         Cleanup code that computes iframe content offsets in FrameView
2712         https://bugs.webkit.org/show_bug.cgi?id=180385
2713
2714         Reviewed by Zalan Bujtas.
2715
2716         The coordinate conversion functions in FrameView explicitly added borderLeft/paddingLeft
2717         and borderTop/paddingTop to compute the offset from the contents of a frame to its parent renderer.
2718         
2719         This is equivalent to the call to contextBoxRect() that RenderWidget::updateWidgetGeometry() does,
2720         which also takes left-side scrollbars into account.
2721         
2722         Coordinate offsets don't need height and width, so add RenderBox::contentBoxLocation() that just
2723         computes the top left, and use it in FrameView.
2724
2725         * page/FrameView.cpp:
2726         (WebCore::FrameView::invalidateRect):
2727         (WebCore::FrameView::convertToContainingView const):
2728         (WebCore::FrameView::convertFromContainingView const):
2729         * platform/graphics/FloatPoint.h:
2730         (WebCore::FloatPoint::scaled const):
2731         (WebCore::FloatPoint::scaled): Deleted.
2732         * rendering/RenderBox.cpp:
2733         (WebCore::RenderBox::contentBoxLocation const):
2734         * rendering/RenderBox.h:
2735
2736 2017-12-04  Nan Wang  <n_wang@apple.com>
2737
2738         AX: AOM: Implement relation type properties
2739         https://bugs.webkit.org/show_bug.cgi?id=179500
2740
2741         Reviewed by Ryosuke Niwa.
2742
2743         Accessibility Object Model
2744         Explainer: https://wicg.github.io/aom/explainer.html
2745         Spec: https://wicg.github.io/aom/spec/
2746
2747         Implemented the AOM support for activeDescendant, details and errorMessage.
2748         The corresponding ARIA attributes all take IDREFs, and the AOM properties
2749         take references to AccessibleNodes instead.
2750
2751         Test: accessibility/mac/AOM-relation-property.html
2752
2753         * accessibility/AccessibilityObject.cpp:
2754         (WebCore::AccessibilityObject::getAttribute const):
2755         (WebCore::AccessibilityObject::hasProperty const):
2756         (WebCore::AccessibilityObject::stringValueForProperty const):
2757         (WebCore::AccessibilityObject::boolValueForProperty const):
2758         (WebCore::AccessibilityObject::intValueForProperty const):
2759         (WebCore::AccessibilityObject::unsignedValueForProperty const):
2760         (WebCore::AccessibilityObject::doubleValueForProperty const):
2761         (WebCore::AccessibilityObject::elementValueForProperty const):
2762         (WebCore::AccessibilityObject::supportsARIAAttributes const):
2763         (WebCore::AccessibilityObject::elementsFromProperty const):
2764         (WebCore::AccessibilityObject::elementsReferencedByProperty const):
2765         (WebCore::AccessibilityObject::ariaActiveDescendantReferencingElements const):
2766         (WebCore::AccessibilityObject::ariaDetailsElements const):
2767         (WebCore::AccessibilityObject::ariaDetailsReferencingElements const):
2768         (WebCore::AccessibilityObject::ariaErrorMessageElements const):
2769         (WebCore::AccessibilityObject::ariaErrorMessageReferencingElements const):
2770         * accessibility/AccessibilityObject.h:
2771         * accessibility/AccessibilityRenderObject.cpp:
2772         (WebCore::AccessibilityRenderObject::activeDescendant const):
2773         * accessibility/AccessibleNode.cpp:
2774         (WebCore::ariaAttributeMap):
2775         (WebCore::isPropertyValueRelation):
2776         (WebCore::AccessibleNode::attributeFromAXPropertyName):
2777         (WebCore::AccessibleNode::setRelationProperty):
2778         (WebCore::AccessibleNode::singleRelationValueForProperty):
2779         (WebCore::AccessibleNode::activeDescendant const):
2780         (WebCore::AccessibleNode::setActiveDescendant):
2781         (WebCore::AccessibleNode::details const):
2782         (WebCore::AccessibleNode::setDetails):
2783         (WebCore::AccessibleNode::errorMessage const):
2784         (WebCore::AccessibleNode::setErrorMessage):
2785         * accessibility/AccessibleNode.h:
2786         * accessibility/AccessibleNode.idl:
2787         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2788         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
2789
2790 2017-12-04  Simon Fraser  <simon.fraser@apple.com>
2791
2792         Minor DisplayRefreshMonitor-related cleanup
2793         https://bugs.webkit.org/show_bug.cgi?id=179802
2794
2795         Reviewed by Sam Weinig.
2796
2797         New trace point for when the CVDisplayLink fires on its own thread.
2798
2799         Some #pragma once, and put all the WellKnownRunLoopOrders in one place.
2800
2801         * inspector/agents/InspectorTimelineAgent.cpp:
2802         (WebCore::InspectorTimelineAgent::internalStart):
2803         * platform/cf/RunLoopObserver.h:
2804         * platform/graphics/DisplayRefreshMonitor.cpp:
2805         (WebCore::DisplayRefreshMonitor::displayDidRefresh):
2806         * platform/graphics/ca/LayerFlushScheduler.h:
2807         * platform/graphics/ca/cocoa/LayerFlushSchedulerMac.cpp:
2808         (WebCore::LayerFlushScheduler::LayerFlushScheduler):
2809
2810 2017-12-04  David Quesada  <david_quesada@apple.com>
2811
2812         Add a class for parsing application manifests
2813         https://bugs.webkit.org/show_bug.cgi?id=177973
2814         rdar://problem/34747949
2815
2816         Reviewed by Geoffrey Garen.
2817
2818         Add a new struct ApplicationManifest, along with ApplicationManifestParser to initialize
2819         ApplicationManifests from JSON data, according to the App Manifest spec. Just a basic subset
2820         of the manifests's properties are implemented to start with.
2821
2822         ApplicationManifestParser is tested by new unit tests in TestWebKitAPI.
2823
2824         * Configurations/FeatureDefines.xcconfig: Add ENABLE_APPLICATION_MANIFEST feature flag.
2825         * Modules/applicationmanifest/ApplicationManifest.h: Added.
2826         * Modules/applicationmanifest/ApplicationManifestParser.cpp: Added.
2827         (WebCore::ApplicationManifestParser::parse):
2828         The main entry point for eventual clients (and currently the unit tests) to invoke
2829         ApplicationManifestParser. There is a variant that accepts a ScriptExecutionContext that
2830         uses the context exclusively for logging console warnings while parsing the manifest, and
2831         not for actually executing any scripts.
2832         (WebCore::ApplicationManifestParser::ApplicationManifestParser):
2833         (WebCore::ApplicationManifestParser::parseManifest):
2834         (WebCore::ApplicationManifestParser::logManifestPropertyNotAString):
2835         (WebCore::ApplicationManifestParser::logManifestPropertyInvalidURL):
2836         (WebCore::ApplicationManifestParser::logDeveloperWarning):
2837         (WebCore::ApplicationManifestParser::parseStartURL):
2838         (WebCore::ApplicationManifestParser::parseName):
2839         (WebCore::ApplicationManifestParser::parseDescription):
2840         (WebCore::ApplicationManifestParser::parseShortName):
2841         (WebCore::isInScope):
2842         (WebCore::ApplicationManifestParser::parseScope):
2843         (WebCore::ApplicationManifestParser::parseGenericString):
2844         * Modules/applicationmanifest/ApplicationManifestParser.h: Added.
2845         * Sources.txt:
2846         * WebCore.xcodeproj/project.pbxproj:
2847         * features.json: Change the Web App Manifest feature status to "In Development"
2848
2849 2017-12-04  Zalan Bujtas  <zalan@apple.com>
2850
2851         RenderMultiColumnFlow::fragmentedFlowDescendantInserted should not destroy incoming newDescendant
2852         https://bugs.webkit.org/show_bug.cgi?id=180181
2853
2854         Reviewed by Antti Koivisto.
2855
2856         This is in preparation for having all multicolumn related tree mutation in RenderTreeUpdaterMultiColumn.
2857
2858         Covered by fast/multicol/column-span-range-crash.html
2859
2860         * rendering/RenderMultiColumnFlow.cpp:
2861         (WebCore::RenderMultiColumnFlow::fragmentedFlowDescendantInserted):
2862         * rendering/RenderMultiColumnFlow.h:
2863         * style/RenderTreeUpdaterMultiColumn.cpp:
2864         (WebCore::RenderTreeUpdater::MultiColumn::destroyFragmentedFlow):
2865
2866 2017-12-04  JF Bastien  <jfbastien@apple.com>
2867
2868         Update std::expected to match libc++ coding style
2869         https://bugs.webkit.org/show_bug.cgi?id=180264
2870
2871         Reviewed by Alex Christensen.
2872
2873         Update various uses of Expected, mostly renaming valueOr and
2874         hasValue to the STL naming convention.
2875
2876         * Modules/cache/DOMCache.cpp:
2877         (WebCore::DOMCache::retrieveRecords):
2878         (WebCore::DOMCache::batchDeleteOperation):
2879         (WebCore::DOMCache::batchPutOperation):
2880         * Modules/cache/DOMCacheStorage.cpp:
2881         (WebCore::DOMCacheStorage::retrieveCaches):
2882         (WebCore::DOMCacheStorage::open):
2883         (WebCore::DOMCacheStorage::remove):
2884         * Modules/cache/WorkerCacheStorageConnection.cpp:
2885         (WebCore::WorkerCacheStorageConnection::doRemove):
2886         (WebCore::WorkerCacheStorageConnection::doRetrieveCaches):
2887         (WebCore::recordsDataOrErrorFromRecords):
2888         (WebCore::recordsOrErrorFromRecordsData):
2889         * bindings/js/CachedScriptFetcher.cpp:
2890         (WebCore::CachedScriptFetcher::requestScriptWithCache const):
2891         * contentextensions/ContentExtensionCompiler.cpp:
2892         (WebCore::ContentExtensions::compileRuleList):
2893         * contentextensions/ContentExtensionParser.cpp:
2894         (WebCore::ContentExtensions::getDomainList):
2895         (WebCore::ContentExtensions::loadTrigger):
2896         (WebCore::ContentExtensions::loadRule):
2897         (WebCore::ContentExtensions::loadEncodedRules):
2898         (WebCore::ContentExtensions::parseRuleList):
2899         * css/CSSFontFaceSrcValue.cpp:
2900         (WebCore::CSSFontFaceSrcValue::cachedFont):
2901         * css/CSSImageSetValue.cpp:
2902         (WebCore::CSSImageSetValue::loadBestFitImage):
2903         * css/CSSImageValue.cpp:
2904         (WebCore::CSSImageValue::loadImage):
2905         * css/StyleRuleImport.cpp:
2906         (WebCore::StyleRuleImport::requestStyleSheet):
2907         * dom/CallbackResult.h:
2908         (WebCore::CallbackResult<ReturnType>::type const):
2909         (WebCore::CallbackResult<ReturnType>::releaseReturnValue):
2910         * dom/Element.cpp:
2911         (WebCore::Element::getIntegralAttribute const):
2912         (WebCore::Element::getUnsignedIntegralAttribute const):
2913         * dom/ExceptionOr.h:
2914         (WebCore::ExceptionOr<ReturnType>::hasException const):
2915         (WebCore::ExceptionOr<void>::hasException const):
2916         * dom/ProcessingInstruction.cpp:
2917         (WebCore::ProcessingInstruction::checkStyleSheet):
2918         * html/HTMLInputElement.cpp:
2919         (WebCore::HTMLInputElement::maxLengthAttributeChanged):
2920         (WebCore::HTMLInputElement::minLengthAttributeChanged):
2921         * html/HTMLLinkElement.cpp:
2922         (WebCore::HTMLLinkElement::process):
2923         * html/HTMLTextAreaElement.cpp:
2924         (WebCore::HTMLTextAreaElement::maxLengthAttributeChanged):
2925         (WebCore::HTMLTextAreaElement::minLengthAttributeChanged):
2926         * html/parser/HTMLParserIdioms.cpp:
2927         (WebCore::parseHTMLNonNegativeInteger):
2928         * html/parser/HTMLParserIdioms.h:
2929         (WebCore::limitToOnlyHTMLNonNegative):
2930         * loader/CrossOriginPreflightChecker.cpp:
2931         (WebCore::CrossOriginPreflightChecker::startPreflight):
2932         * loader/DocumentLoader.cpp:
2933         (WebCore::DocumentLoader::loadMainResource):
2934         * loader/DocumentThreadableLoader.cpp:
2935         (WebCore::DocumentThreadableLoader::loadRequest):
2936         * loader/ImageLoader.cpp:
2937         (WebCore::ImageLoader::updateFromElement):
2938         * loader/LinkLoader.cpp:
2939         (WebCore::LinkLoader::preloadIfNeeded):
2940         (WebCore::LinkLoader::loadLink):
2941         * loader/MediaResourceLoader.cpp:
2942         (WebCore::MediaResourceLoader::requestResource):
2943         * loader/TextTrackLoader.cpp:
2944         (WebCore::TextTrackLoader::load):
2945         * loader/cache/CachedSVGDocumentReference.cpp:
2946         (WebCore::CachedSVGDocumentReference::load):
2947         * loader/icon/IconLoader.cpp:
2948         (WebCore::IconLoader::startLoading):
2949         * platform/URLParser.cpp:
2950         (WebCore::URLParser::parseIPv4Host):
2951         * platform/graphics/avfoundation/cf/WebCoreAVCFResourceLoader.cpp:
2952         (WebCore::WebCoreAVCFResourceLoader::startLoading):
2953         * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
2954         (WebCore::WebCoreAVFResourceLoader::startLoading):
2955         * svg/SVGFEImageElement.cpp:
2956         (WebCore::SVGFEImageElement::requestImageResource):
2957         * svg/SVGFontFaceUriElement.cpp:
2958         (WebCore::SVGFontFaceUriElement::loadFont):
2959         * svg/SVGUseElement.cpp:
2960         (WebCore::SVGUseElement::updateExternalDocument):
2961         * xml/XSLImportRule.cpp:
2962         (WebCore::XSLImportRule::loadSheet):
2963
2964 2017-12-04  Zalan Bujtas  <zalan@apple.com>
2965
2966         REGRESSION (r211531): Text flow changes and overlaps other text after double-click selecting paragraph
2967         https://bugs.webkit.org/show_bug.cgi?id=180377
2968         <rdar://problem/34337967>
2969
2970         Reviewed by Antti Koivisto.
2971
2972         Take floats into account when computing the available width for a certain vertical position.
2973
2974         Test: fast/block/float/simple-line-layout-float-shrink-line.html
2975
2976         * rendering/SimpleLineLayout.cpp:
2977         (WebCore::SimpleLineLayout::updateLineConstrains):
2978
2979 2017-12-04  Antoine Quint  <graouts@apple.com>
2980
2981         <video> and scale() transforms yield shrunk small or clipped controls
2982         https://bugs.webkit.org/show_bug.cgi?id=180358
2983         <rdar://problem/34436124>
2984
2985         Reviewed by Dean Jackson.
2986
2987         To compute the bounds of the media controls, we would call getBoundingClientRect()
2988         on the root-most element in the shadow root, which is styled to have width and height
2989         set to 100%, which allows to match the metrics of the host media element, without
2990         the borders.
2991
2992         However, if the host media element has CSS transforms applied, these would be factored
2993         into calls to getBoundingClientRect() and the controls would be too large and clipped,
2994         in case the scale was more than 1, or shrunk, in case the scale was less than 1.
2995
2996         To obtain correct metrics, we computed the complete transformation matrix applied to
2997         the host media element, and apply its inverted matrix to each corner point of the
2998         bounds returned for the root-most container element in the shadow root.
2999
3000         Then we compute the width and height of this transformed rectangle and set those to
3001         be our media controls' metrics.
3002
3003         Test: media/modern-media-controls/css/transformed-media.html
3004
3005         * Modules/modern-media-controls/media/media-controller.js:
3006         (MediaController.prototype._updateControlsSize):
3007         (MediaController.prototype._controlsWidth): Deleted.
3008
3009 2017-12-04  Antoine Quint  <graouts@apple.com>
3010
3011         Cursor is not visible after exiting full screen video
3012         https://bugs.webkit.org/show_bug.cgi?id=180247
3013         <rdar://problem/33885922>
3014
3015         Reviewed by Dean Jackson.
3016
3017         There is a dedicated NSCursor method to temporarily hide the mouse cursor while the mouse is idle,
3018         so we use this platform functionality, already exposed through the page chrome, instead which
3019         implements the expected behavior. Now, the mouse cursor is hidden while the mouse is stationary
3020         when a <video> is fullscreen, as before, but as soon as the user exits fullscreen, the mouse cursor
3021         reappears.
3022
3023         No test provided as I don't believe this platform behavior can be tested, there is no API to query
3024         whether the cursor is visible.
3025
3026         * page/EventHandler.cpp:
3027         (WebCore::EventHandler::cancelAutoHideCursorTimer):
3028         (WebCore::EventHandler::autoHideCursorTimerFired):
3029
3030 2017-12-04  Chris Dumez  <cdumez@apple.com>
3031
3032         ServiceWorkerGlobalScope::skipWaiting(Ref<DeferredPromise>&&) is unsafe
3033         https://bugs.webkit.org/show_bug.cgi?id=180372
3034
3035         Reviewed by Youenn Fablet.
3036
3037         Ref the WorkerThread and capture it in the lambda. Keep the pending promises in
3038         a HashMap on the ServiceWorkerGlobalScope so that they stay on the worker thread.
3039
3040         * workers/service/ServiceWorkerGlobalScope.cpp:
3041         (WebCore::ServiceWorkerGlobalScope::skipWaiting):
3042         * workers/service/ServiceWorkerGlobalScope.h:
3043
3044 2017-12-04  Brady Eidson  <beidson@apple.com>
3045
3046         Get a directory path to SWServers for storing ServiceWorker registrations.
3047         https://bugs.webkit.org/show_bug.cgi?id=180362
3048
3049         Reviewed by Chris Dumez.
3050
3051         No new tests (No observable behavior change yet).
3052
3053         * workers/service/server/SWServer.cpp:
3054         (WebCore::SWServer::SWServer):
3055         * workers/service/server/SWServer.h:
3056
3057 2017-12-04  Devin Rousso  <webkit@devinrousso.com>
3058
3059         Web Inspector: provide method for recording CanvasRenderingContext2D from JavaScript
3060         https://bugs.webkit.org/show_bug.cgi?id=175166
3061         <rdar://problem/34040740>
3062
3063         Reviewed by Joseph Pecoraro.
3064
3065         No new tests, updated existing tests.
3066
3067         * inspector/InspectorCanvas.h:
3068         * inspector/InspectorCanvas.cpp:
3069         (WebCore::InspectorCanvas::resetRecordingData):
3070
3071         * inspector/InspectorCanvasAgent.h:
3072         * inspector/InspectorCanvasAgent.cpp:
3073         (WebCore::InspectorCanvasAgent::didFinishRecordingCanvasFrame):
3074         (WebCore::InspectorCanvasAgent::consoleStartRecordingCanvas):
3075
3076         * inspector/InspectorInstrumentation.h:
3077         * inspector/InspectorInstrumentation.cpp:
3078         (WebCore::InspectorInstrumentation::consoleStartRecordingCanvas):
3079         (WebCore::InspectorInstrumentation::consoleStartRecordingCanvasImpl):
3080
3081         * page/PageConsoleClient.h:
3082         * page/PageConsoleClient.cpp:
3083         (WebCore::PageConsoleClient::record):
3084         (WebCore::PageConsoleClient::recordEnd):
3085
3086         * workers/WorkerConsoleClient.h:
3087         * workers/WorkerConsoleClient.cpp:
3088         (WebCore::WorkerConsoleClient::record):
3089         (WebCore::WorkerConsoleClient::recordEnd):
3090
3091 2017-12-04  Youenn Fablet  <youenn@apple.com>
3092
3093         Call "Terminate Service Worker" on all workers when all their clients are gone
3094         https://bugs.webkit.org/show_bug.cgi?id=179552
3095
3096         Reviewed by Chris Dumez.
3097
3098         Tested manually.
3099
3100         When SWServer detects that there is no longer any client for a given client origin,
3101         it iterates through the running workers to terminate them if they have the given client origin.
3102         A timer of 60 seconds is used in case a user closes a tab or a window, and reopens one with the same origin shortly after.
3103
3104         * workers/service/server/SWServer.cpp:
3105         (WebCore::SWServer::findClientByIdentifier):
3106         (WebCore::SWServer::matchAll):
3107         (WebCore::SWServer::registerServiceWorkerClient):
3108         (WebCore::SWServer::unregisterServiceWorkerClient):
3109         * workers/service/server/SWServer.h:
3110
3111 2017-12-04  Antti Koivisto  <antti@apple.com>
3112
3113         Enable selector filtering for ::before and ::after pseudo element resolution
3114         https://bugs.webkit.org/show_bug.cgi?id=180364
3115
3116         Reviewed by Ryosuke Niwa.
3117
3118         Since these pseudo elements are now resolved by TreeResolver we can use selector filter for them.
3119
3120         This is 10%+ progression in StyleBench pseudo element subtest.
3121
3122         * css/StyleResolver.cpp:
3123         (WebCore::StyleResolver::pseudoStyleForElement):
3124         * css/StyleResolver.h:
3125         * style/StyleTreeResolver.cpp:
3126         (WebCore::Style::TreeResolver::resolvePseudoStyle):
3127
3128 2017-12-04  Youenn Fablet  <youenn@apple.com>
3129
3130         Add support https://w3c.github.io/ServiceWorker/#on-client-unload-algorithm
3131         https://bugs.webkit.org/show_bug.cgi?id=180359
3132
3133         Reviewed by Chris Dumez.
3134
3135         This algorithm is needed for implementation of claim.
3136         As per specification, it is run for every client unload, hence why this is put in removeClientUsingRegistration.
3137
3138         * workers/service/server/SWServerRegistration.cpp:
3139         (WebCore::SWServerRegistration::removeClientUsingRegistration):
3140         (WebCore::SWServerRegistration::handleClientUnload):
3141         * workers/service/server/SWServerRegistration.h:
3142
3143 2017-12-04  Antti Koivisto  <antti@apple.com>
3144
3145         Remove duplicates from selector filter hashes
3146         https://bugs.webkit.org/show_bug.cgi?id=180354
3147
3148         Reviewed by Simon Fraser.
3149
3150         We have only four slots for hashes in RuleSet and adding more regresses performance. To use the limited slots
3151         better we should eliminate duplicates.
3152
3153         This patch also switches to using std::array instead of a C array for the hashes.
3154
3155         The patch reduces the number of selectors passing through the selector filter in StyleBench by ~0.4%.
3156
3157         * css/ElementRuleCollector.cpp:
3158         (WebCore::ElementRuleCollector::collectMatchingRulesForList):
3159         * css/RuleSet.cpp:
3160         (WebCore::RuleData::RuleData):
3161         * css/RuleSet.h:
3162         (WebCore::RuleData::descendantSelectorIdentifierHashes const):
3163         * css/SelectorFilter.cpp:
3164         (WebCore::collectDescendantSelectorIdentifierHashes):
3165         (WebCore::SelectorFilter::collectIdentifierHashes):
3166         * css/SelectorFilter.h:
3167         (WebCore::SelectorFilter::fastRejectSelector const):
3168
3169 2017-12-04  Youenn Fablet  <youenn@apple.com>
3170
3171         WorkerCacheStorageConnection should handle the case of terminated workers
3172         https://bugs.webkit.org/show_bug.cgi?id=180304
3173
3174         Reviewed by Chris Dumez.
3175
3176         No web page observable change of behavior.
3177
3178         Reworked WorkerCacheStorageConnection hopping.
3179         Instead of refing/unrefing itself, it refs the worker thread and the main thread connection.
3180         This worker thread is then used on the way back from the main thread.
3181
3182         * Modules/cache/WorkerCacheStorageConnection.cpp:
3183         (WebCore::WorkerCacheStorageConnection::create):
3184         (WebCore::WorkerCacheStorageConnection::WorkerCacheStorageConnection):
3185         (WebCore::WorkerCacheStorageConnection::doOpen):
3186         (WebCore::WorkerCacheStorageConnection::doRemove):
3187         (WebCore::WorkerCacheStorageConnection::doRetrieveCaches):
3188         (WebCore::WorkerCacheStorageConnection::reference):
3189         (WebCore::WorkerCacheStorageConnection::dereference):
3190         (WebCore::WorkerCacheStorageConnection::doRetrieveRecords):
3191         (WebCore::WorkerCacheStorageConnection::doBatchDeleteOperation):
3192         (WebCore::WorkerCacheStorageConnection::doBatchPutOperation):
3193         * Modules/cache/WorkerCacheStorageConnection.h:
3194         * workers/WorkerGlobalScope.cpp:
3195         (WebCore::WorkerGlobalScope::cacheStorageConnection):
3196         * workers/WorkerGlobalScope.h:
3197
3198 2017-12-04  Frederic Wang  <fwang@igalia.com>
3199
3200         Make ScrollingTreeNode::enclosingFrameNode return the node itself for frame nodes
3201         https://bugs.webkit.org/show_bug.cgi?id=180353
3202
3203         Reviewed by Antonio Gomes.
3204
3205         This function was introduced in bug 175135 to solve a rendering bug with fixed positioned
3206         nodes in overflow nodes. For a frame node, the reference frame to use for fixed nodes is
3207         actually the frame node itself or otherwise we will get the same rendering bug. This patch
3208         makes enclosingFrameNode return the node itself when it is a frame node and renames it to
3209         clarify this behavior. Currently, enclosingFrameNode is not used for frame nodes so the
3210         behavior is unchanged.
3211
3212         No new tests, behavior is unchanged.
3213
3214         * page/scrolling/ScrollingTreeNode.cpp:
3215         (WebCore::ScrollingTreeNode::enclosingFrameNodeIncludingSelf): Start the search from a frame
3216         scrolling node from the node itself. Renamed to make explicit that this function may include
3217         the node itself.
3218         * page/scrolling/ScrollingTreeNode.h: Renamed.
3219
3220 2017-12-04  Michael Catanzaro  <mcatanzaro@igalia.com>
3221
3222         [WPE][GTK] Implement PAL::SleepDisabler
3223         https://bugs.webkit.org/show_bug.cgi?id=178485
3224
3225         Reviewed by Carlos Garcia Campos.
3226
3227         Add a comment to warn about some odd use of SleepDisabler in HTMLMediaElement.
3228
3229         * html/HTMLMediaElement.cpp:
3230         (WebCore::HTMLMediaElement::shouldDisableSleep const):
3231
3232 2017-12-04  Frederic Wang  <fwang@igalia.com>
3233
3234         Bug 161300 - Move RenderMathMLRoot:RootType and RenderMathMLScripts:ScriptsType to element classes
3235         https://bugs.webkit.org/show_bug.cgi?id=161300
3236
3237         Reviewed by Darin Adler.
3238
3239         RenderMathMLRoot::m_kind and RenderMathMLScripts::m_scriptType are initialized in the
3240         constructors of the renderer classes from the tag name of the corresponding elements.
3241         This patch moves them into the corresponding element classes and makes them const members
3242         parsed in the constructors. It also introduces a MathMLRootElement class deriving from
3243         MathMLRowElement to store the new member. Finally, the types are redefined as enum classes.
3244
3245         No new tests, behavior unchanged and already covered by existing tests.
3246
3247         * Sources.txt: Add MathMLRootElement files.
3248         * WebCore.xcodeproj/project.pbxproj: Ditto.
3249         * mathml/MathMLAllInOne.cpp: Ditto.
3250         * mathml/MathMLRootElement.cpp:
3251         (WebCore::element): Override this function to downcast to MathMLRootElement.
3252         (WebCore::rootTypeOf): Helper function to parse the root type, moved from RenderMathMLRoot.
3253         (WebCore::MathMLRootElement::MathMLRootElement): Initialize the root type.
3254         (WebCore::MathMLRootElement::create):
3255         (WebCore::MathMLRootElement::createElementRenderer): Moved from MathMLRowElement.
3256         * mathml/MathMLRootElement.h: New class deriving from MathMLRowElement, with a RootType
3257         member exposed to the renderer class.
3258         * mathml/MathMLRowElement.cpp: Remove header for RenderMathMLRoot.h.
3259         (WebCore::MathMLRowElement::createElementRenderer): Moved to MathMLRootElement.
3260         * mathml/MathMLScriptsElement.cpp: Introduce a script type.
3261         (WebCore::scriptTypeOf): Helper function to parse the script type, moved from
3262         RenerMathMLScripts.
3263         (WebCore::MathMLScriptsElement::MathMLScriptsElement): Initialize the script type.
3264         * mathml/MathMLScriptsElement.h: Add new script type member.
3265         (WebCore::MathMLScriptsElement::scriptType const): Expose the script type to the renderer
3266         class.
3267         * mathml/mathtags.in: Map <msqrt> and <mroot> to MathMLRootElement.
3268         * rendering/mathml/RenderMathMLRoot.cpp:
3269         (WebCore::RenderMathMLRoot::RenderMathMLRoot): Use MathMLRootElement and remove parsing of
3270         the root type.
3271         (WebCore::RenderMathMLRoot::rootType const): Helper function to access the root type from
3272         the element class.
3273         (WebCore::RenderMathMLRoot::isValid const): Use rootType() and add prefix for enum class
3274         values.
3275         (WebCore::RenderMathMLRoot::getBase const): Ditto.
3276         (WebCore::RenderMathMLRoot::getIndex const): Ditto.
3277         (WebCore::RenderMathMLRoot::horizontalParameters): Ditto.
3278         (WebCore::RenderMathMLRoot::verticalParameters): Ditto.
3279         (WebCore::RenderMathMLRoot::computePreferredLogicalWidths): Ditto.
3280         (WebCore::RenderMathMLRoot::layoutBlock): Ditto.
3281         (WebCore::RenderMathMLRoot::paint): Ditto.
3282         * rendering/mathml/RenderMathMLRoot.h: Define root type as an enum class, replace
3283         MathMLRowElement with MathMLRootElement, declare and use new rootType() function and remove
3284         the m_kind member.
3285         * rendering/mathml/RenderMathMLScripts.cpp:
3286         (WebCore::RenderMathMLScripts::RenderMathMLScripts): Remove parsing of script type.
3287         (WebCore::RenderMathMLScripts::scriptType const): Helper function to access the script type
3288         from the element class.
3289         (WebCore::RenderMathMLScripts::validateAndGetReferenceChildren): Use scriptType() and add
3290         prefix for enum class values.
3291         (WebCore::RenderMathMLScripts::computePreferredLogicalWidths): Ditto.
3292         (WebCore::RenderMathMLScripts::verticalMetrics): Ditto.
3293         (WebCore::RenderMathMLScripts::layoutBlock): Ditto.
3294         * rendering/mathml/RenderMathMLScripts.h: Define root type as an enum class, declare the
3295         scriptType() function and remove the m_scriptType member.
3296         * rendering/mathml/RenderMathMLUnderOver.cpp:
3297         (WebCore::RenderMathMLUnderOver::isValid const): Use scriptType() and add prefix for enum
3298         class values.
3299         (WebCore::RenderMathMLUnderOver::under const): Ditto.
3300         (WebCore::RenderMathMLUnderOver::over const): Ditto.
3301         (WebCore::RenderMathMLUnderOver::computePreferredLogicalWidths): Ditto.
3302         (WebCore::RenderMathMLUnderOver::hasAccent const): Ditto.
3303         (WebCore::RenderMathMLUnderOver::layoutBlock): Ditto.
3304
3305 2017-12-04  Carlos Garcia Campos  <cgarcia@igalia.com>
3306
3307         [GStreamer] More leaks in TextCombinerGStreamer
3308         https://bugs.webkit.org/show_bug.cgi?id=180331
3309
3310         Reviewed by Michael Catanzaro.
3311
3312         I've noticed more leaks reading the code, but I couldn't check them with valgrind, because I don't know how to
3313         trigger that code path. This patch cleans up the file using smart pointer everywhere.
3314
3315         * platform/graphics/gstreamer/TextCombinerGStreamer.cpp:
3316         (webkit_text_combiner_pad_init):
3317         (webkitTextCombinerPadEvent):
3318         (webkitTextCombinerReleasePad):
3319
3320 2017-12-04  Jer Noble  <jer.noble@apple.com>
3321
3322         Include 'video/*' in image request Accept header if browser supports video media in image contexts.
3323         https://bugs.webkit.org/show_bug.cgi?id=179178
3324
3325         Reviewed by Alex Christensen.
3326
3327         Test: http/tests/images/image-supports-video.html
3328
3329         Ensure that 'video/*' is included in the Accept header by asking the ImageDecoder whether "Video"
3330         media is supported. The ImageDecoder will ask all it's constituent decoders, which aside from
3331         ImageDecoderAVFObjC will say only support the "Image" media type.
3332
3333         Drive-by fix: Make sure the MIMETypeRegistry includes all the types supported by AVFoundation when
3334         ImageDecoderAVFObjC is enabled. Also, now that Image reports it can support video mime types, check
3335         whether MediaDocument can support a given mime type before asking ImageDocument.
3336
3337         * html/HTMLImageElement.cpp:
3338         (WebCore::HTMLImageElement::bestFitSourceFromPictureElement):
3339         * loader/LinkLoader.cpp:
3340         (WebCore::LinkLoader::isSupportedType):
3341         * loader/cache/CachedResourceRequest.cpp:
3342         (WebCore::acceptHeaderValueFromType):
3343         * platform/MIMETypeRegistry.cpp:
3344         (WebCore::MIMETypeRegistry::isSupportedImageVideoOrSVGMIMEType):
3345         (WebCore::MIMETypeRegistry::isSupportedImageOrSVGMIMEType): Deleted.
3346         * platform/MIMETypeRegistry.h:
3347         * platform/graphics/ImageDecoder.cpp:
3348         (WebCore::ImageDecoder::supportsMediaType):
3349         * platform/graphics/ImageDecoder.h:
3350         * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.h:
3351         (WebCore::ImageDecoderAVFObjC::supportsMediaType):
3352         * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm:
3353         (WebCore::ImageDecoderAVFObjC::supportsContentType):
3354         * platform/graphics/cg/ImageDecoderCG.h:
3355         * platform/graphics/win/ImageDecoderDirect2D.h:
3356         * platform/image-decoders/ScalableImageDecoder.h:
3357         (WebCore::ScalableImageDecoder::supportsMediaType):
3358         * html/parser/HTMLPreloadScanner.cpp:
3359         (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute):
3360
3361 2017-12-03  Yusuke Suzuki  <utatane.tea@gmail.com>
3362
3363         WTF shouldn't have both Thread and ThreadIdentifier
3364         https://bugs.webkit.org/show_bug.cgi?id=180308
3365
3366         Reviewed by Darin Adler.
3367
3368         No behavior change.
3369
3370         * Modules/indexeddb/IDBActiveDOMObject.h:
3371         (WebCore::IDBActiveDOMObject::originThread const):
3372         (WebCore::IDBActiveDOMObject::performCallbackOnOriginThread):
3373         (WebCore::IDBActiveDOMObject::callFunctionOnOriginThread):
3374         (WebCore::IDBActiveDOMObject::originThreadID const): Deleted.
3375         * Modules/indexeddb/IDBCursor.cpp:
3376         (WebCore::IDBCursor::IDBCursor):
3377         (WebCore::IDBCursor::~IDBCursor):
3378         (WebCore::IDBCursor::sourcesDeleted const):
3379         (WebCore::IDBCursor::transaction const):
3380         (WebCore::IDBCursor::update):
3381         (WebCore::IDBCursor::advance):
3382         (WebCore::IDBCursor::continueFunction):
3383         (WebCore::IDBCursor::uncheckedIterateCursor):
3384         (WebCore::IDBCursor::deleteFunction):
3385         (WebCore::IDBCursor::setGetResult):
3386         * Modules/indexeddb/IDBDatabase.cpp:
3387         (WebCore::IDBDatabase::~IDBDatabase):
3388         (WebCore::IDBDatabase::hasPendingActivity const):
3389         (WebCore::IDBDatabase::name const):
3390         (WebCore::IDBDatabase::version const):
3391         (WebCore::IDBDatabase::objectStoreNames const):
3392         (WebCore::IDBDatabase::renameObjectStore):
3393         (WebCore::IDBDatabase::renameIndex):
3394         (WebCore::IDBDatabase::createObjectStore):
3395         (WebCore::IDBDatabase::transaction):
3396         (WebCore::IDBDatabase::deleteObjectStore):
3397         (WebCore::IDBDatabase::close):
3398         (WebCore::IDBDatabase::connectionToServerLost):
3399         (WebCore::IDBDatabase::maybeCloseInServer):
3400         (WebCore::IDBDatabase::activeDOMObjectName const):
3401         (WebCore::IDBDatabase::canSuspendForDocumentSuspension const):
3402         (WebCore::IDBDatabase::stop):
3403         (WebCore::IDBDatabase::startVersionChangeTransaction):
3404         (WebCore::IDBDatabase::didStartTransaction):
3405         (WebCore::IDBDatabase::willCommitTransaction):
3406         (WebCore::IDBDatabase::didCommitTransaction):
3407         (WebCore::IDBDatabase::willAbortTransaction):
3408         (WebCore::IDBDatabase::didAbortTransaction):
3409         (WebCore::IDBDatabase::didCommitOrAbortTransaction):
3410         (WebCore::IDBDatabase::fireVersionChangeEvent):
3411         (WebCore::IDBDatabase::dispatchEvent):
3412         (WebCore::IDBDatabase::didCreateIndexInfo):
3413         (WebCore::IDBDatabase::didDeleteIndexInfo):
3414         * Modules/indexeddb/IDBIndex.cpp:
3415         (WebCore::IDBIndex::IDBIndex):
3416         (WebCore::IDBIndex::~IDBIndex):
3417         (WebCore::IDBIndex::name const):
3418         (WebCore::IDBIndex::setName):
3419         (WebCore::IDBIndex::objectStore):
3420         (WebCore::IDBIndex::keyPath const):
3421         (WebCore::IDBIndex::unique const):
3422         (WebCore::IDBIndex::multiEntry const):
3423         (WebCore::IDBIndex::rollbackInfoForVersionChangeAbort):
3424         (WebCore::IDBIndex::openCursor):
3425         (WebCore::IDBIndex::openKeyCursor):
3426         (WebCore::IDBIndex::doCount):
3427         (WebCore::IDBIndex::doGet):
3428         (WebCore::IDBIndex::doGetKey):
3429         (WebCore::IDBIndex::getAll):
3430         (WebCore::IDBIndex::getAllKeys):
3431         (WebCore::IDBIndex::markAsDeleted):
3432         * Modules/indexeddb/IDBObjectStore.cpp:
3433         (WebCore::IDBObjectStore::IDBObjectStore):
3434         (WebCore::IDBObjectStore::~IDBObjectStore):
3435         (WebCore::IDBObjectStore::name const):
3436         (WebCore::IDBObjectStore::setName):
3437         (WebCore::IDBObjectStore::keyPath const):
3438         (WebCore::IDBObjectStore::indexNames const):
3439         (WebCore::IDBObjectStore::transaction):
3440         (WebCore::IDBObjectStore::autoIncrement const):
3441         (WebCore::IDBObjectStore::openCursor):
3442         (WebCore::IDBObjectStore::openKeyCursor):
3443         (WebCore::IDBObjectStore::get):
3444         (WebCore::IDBObjectStore::getKey):
3445         (WebCore::IDBObjectStore::putOrAdd):
3446         (WebCore::IDBObjectStore::doDelete):
3447         (WebCore::IDBObjectStore::clear):
3448         (WebCore::IDBObjectStore::createIndex):
3449         (WebCore::IDBObjectStore::index):
3450         (WebCore::IDBObjectStore::deleteIndex):
3451         (WebCore::IDBObjectStore::doCount):
3452         (WebCore::IDBObjectStore::getAll):
3453         (WebCore::IDBObjectStore::getAllKeys):
3454         (WebCore::IDBObjectStore::markAsDeleted):
3455         (WebCore::IDBObjectStore::rollbackForVersionChangeAbort):
3456         * Modules/indexeddb/IDBOpenDBRequest.cpp:
3457         (WebCore::IDBOpenDBRequest::~IDBOpenDBRequest):
3458         (WebCore::IDBOpenDBRequest::onError):
3459         (WebCore::IDBOpenDBRequest::versionChangeTransactionDidFinish):
3460         (WebCore::IDBOpenDBRequest::fireSuccessAfterVersionChangeCommit):
3461         (WebCore::IDBOpenDBRequest::fireErrorAfterVersionChangeCompletion):
3462         (WebCore::IDBOpenDBRequest::dispatchEvent):
3463         (WebCore::IDBOpenDBRequest::onSuccess):
3464         (WebCore::IDBOpenDBRequest::onUpgradeNeeded):
3465         (WebCore::IDBOpenDBRequest::onDeleteDatabaseSuccess):
3466         (WebCore::IDBOpenDBRequest::requestCompleted):
3467         (WebCore::IDBOpenDBRequest::requestBlocked):
3468         * Modules/indexeddb/IDBRequest.cpp:
3469         (WebCore::IDBRequest::~IDBRequest):
3470         (WebCore:: const):
3471         (WebCore::IDBRequest::setSource):
3472         (WebCore::IDBRequest::setVersionChangeTransaction):
3473         (WebCore::IDBRequest::transaction const):
3474         (WebCore::IDBRequest::sourceObjectStoreIdentifier const):
3475         (WebCore::IDBRequest::sourceIndexIdentifier const):
3476         (WebCore::IDBRequest::requestedObjectStoreRecordType const):
3477         (WebCore::IDBRequest::requestedIndexRecordType const):
3478         (WebCore::IDBRequest::eventTargetInterface const):
3479         (WebCore::IDBRequest::activeDOMObjectName const):
3480         (WebCore::IDBRequest::canSuspendForDocumentSuspension const):
3481         (WebCore::IDBRequest::hasPendingActivity const):
3482         (WebCore::IDBRequest::stop):
3483         (WebCore::IDBRequest::enqueueEvent):
3484         (WebCore::IDBRequest::dispatchEvent):
3485         (WebCore::IDBRequest::uncaughtExceptionInEventHandler):
3486         (WebCore::IDBRequest::setResult):
3487         (WebCore::IDBRequest::setResultToStructuredClone):
3488         (WebCore::IDBRequest::setResultToUndefined):
3489         (WebCore::IDBRequest::resultCursor):
3490         (WebCore::IDBRequest::willIterateCursor):
3491         (WebCore::IDBRequest::didOpenOrIterateCursor):
3492         (WebCore::IDBRequest::completeRequestAndDispatchEvent):
3493         (WebCore::IDBRequest::onError):
3494         (WebCore::IDBRequest::onSuccess):
3495         * Modules/indexeddb/IDBTransaction.cpp:
3496         (WebCore::IDBTransaction::IDBTransaction):
3497         (WebCore::IDBTransaction::~IDBTransaction):
3498         (WebCore::IDBTransaction::objectStoreNames const):
3499         (WebCore::IDBTransaction::db):
3500         (WebCore::IDBTransaction::error const):
3501         (WebCore::IDBTransaction::objectStore):
3502         (WebCore::IDBTransaction::abortDueToFailedRequest):
3503         (WebCore::IDBTransaction::transitionedToFinishing):
3504         (WebCore::IDBTransaction::abort):
3505         (WebCore::IDBTransaction::internalAbort):
3506         (WebCore::IDBTransaction::abortOnServerAndCancelRequests):
3507         (WebCore::IDBTransaction::activeDOMObjectName const):
3508         (WebCore::IDBTransaction::canSuspendForDocumentSuspension const):
3509         (WebCore::IDBTransaction::hasPendingActivity const):
3510         (WebCore::IDBTransaction::stop):
3511         (WebCore::IDBTransaction::isActive const):
3512         (WebCore::IDBTransaction::isFinishedOrFinishing const):
3513         (WebCore::IDBTransaction::addRequest):
3514         (WebCore::IDBTransaction::removeRequest):
3515         (WebCore::IDBTransaction::scheduleOperation):
3516         (WebCore::IDBTransaction::schedulePendingOperationTimer):
3517         (WebCore::IDBTransaction::pendingOperationTimerFired):
3518         (WebCore::IDBTransaction::operationCompletedOnServer):
3519         (WebCore::IDBTransaction::scheduleCompletedOperationTimer):
3520         (WebCore::IDBTransaction::completedOperationTimerFired):
3521         (WebCore::IDBTransaction::commit):
3522         (WebCore::IDBTransaction::commitOnServer):
3523         (WebCore::IDBTransaction::finishAbortOrCommit):
3524         (WebCore::IDBTransaction::didStart):
3525         (WebCore::IDBTransaction::notifyDidAbort):
3526         (WebCore::IDBTransaction::didAbort):
3527         (WebCore::IDBTransaction::didCommit):
3528         (WebCore::IDBTransaction::fireOnComplete):
3529         (WebCore::IDBTransaction::fireOnAbort):
3530         (WebCore::IDBTransaction::enqueueEvent):
3531         (WebCore::IDBTransaction::dispatchEvent):
3532         (WebCore::IDBTransaction::createObjectStore):
3533         (WebCore::IDBTransaction::createObjectStoreOnServer):
3534         (WebCore::IDBTransaction::didCreateObjectStoreOnServer):
3535         (WebCore::IDBTransaction::renameObjectStore):
3536         (WebCore::IDBTransaction::renameObjectStoreOnServer):
3537         (WebCore::IDBTransaction::didRenameObjectStoreOnServer):
3538         (WebCore::IDBTransaction::createIndex):
3539         (WebCore::IDBTransaction::createIndexOnServer):
3540         (WebCore::IDBTransaction::didCreateIndexOnServer):
3541         (WebCore::IDBTransaction::renameIndex):
3542         (WebCore::IDBTransaction::renameIndexOnServer):
3543         (WebCore::IDBTransaction::didRenameIndexOnServer):
3544         (WebCore::IDBTransaction::requestOpenCursor):
3545         (WebCore::IDBTransaction::doRequestOpenCursor):
3546         (WebCore::IDBTransaction::openCursorOnServer):
3547         (WebCore::IDBTransaction::didOpenCursorOnServer):
3548         (WebCore::IDBTransaction::iterateCursor):
3549         (WebCore::IDBTransaction::iterateCursorOnServer):
3550         (WebCore::IDBTransaction::didIterateCursorOnServer):
3551         (WebCore::IDBTransaction::requestGetAllObjectStoreRecords):
3552         (WebCore::IDBTransaction::requestGetAllIndexRecords):
3553         (WebCore::IDBTransaction::getAllRecordsOnServer):
3554         (WebCore::IDBTransaction::didGetAllRecordsOnServer):
3555         (WebCore::IDBTransaction::requestGetRecord):
3556         (WebCore::IDBTransaction::requestGetValue):
3557         (WebCore::IDBTransaction::requestGetKey):
3558         (WebCore::IDBTransaction::requestIndexRecord):
3559         (WebCore::IDBTransaction::getRecordOnServer):
3560         (WebCore::IDBTransaction::didGetRecordOnServer):
3561         (WebCore::IDBTransaction::requestCount):
3562         (WebCore::IDBTransaction::getCountOnServer):
3563         (WebCore::IDBTransaction::didGetCountOnServer):
3564         (WebCore::IDBTransaction::requestDeleteRecord):
3565         (WebCore::IDBTransaction::deleteRecordOnServer):
3566         (WebCore::IDBTransaction::didDeleteRecordOnServer):
3567         (WebCore::IDBTransaction::requestClearObjectStore):
3568         (WebCore::IDBTransaction::clearObjectStoreOnServer):
3569         (WebCore::IDBTransaction::didClearObjectStoreOnServer):
3570         (WebCore::IDBTransaction::requestPutOrAdd):
3571         (WebCore::IDBTransaction::putOrAddOnServer):
3572         (WebCore::IDBTransaction::didPutOrAddOnServer):
3573         (WebCore::IDBTransaction::deleteObjectStore):
3574         (WebCore::IDBTransaction::deleteObjectStoreOnServer):
3575         (WebCore::IDBTransaction::didDeleteObjectStoreOnServer):
3576         (WebCore::IDBTransaction::deleteIndex):
3577         (WebCore::IDBTransaction::deleteIndexOnServer):
3578         (WebCore::IDBTransaction::didDeleteIndexOnServer):
3579         (WebCore::IDBTransaction::operationCompletedOnClient):
3580         (WebCore::IDBTransaction::establishOnServer):
3581         (WebCore::IDBTransaction::activate):
3582         (WebCore::IDBTransaction::deactivate):
3583         * Modules/indexeddb/client/IDBConnectionProxy.cpp:
3584         (WebCore::IDBClient::removeItemsMatchingCurrentThread):
3585         * Modules/indexeddb/client/TransactionOperation.h:
3586         (WebCore::IDBClient::TransactionOperation::~TransactionOperation):
3587         (WebCore::IDBClient::TransactionOperation::perform):
3588         (WebCore::IDBClient::TransactionOperation::transitionToCompleteOnThisThread):
3589         (WebCore::IDBClient::TransactionOperation::transitionToComplete):
3590         (WebCore::IDBClient::TransactionOperation::doComplete):
3591         (WebCore::IDBClient::TransactionOperation::originThread const):
3592         (WebCore::IDBClient::TransactionOperation::originThreadID const): Deleted.
3593         * Modules/webaudio/AudioContext.cpp:
3594         (WebCore::AudioContext::AudioContext):
3595         (WebCore::AudioContext::lock):
3596         (WebCore::AudioContext::tryLock):
3597         (WebCore::AudioContext::unlock):
3598         (WebCore::AudioContext::isAudioThread const):
3599         (WebCore::AudioContext::isGraphOwner const):
3600         * Modules/webaudio/AudioContext.h:
3601         (WebCore::AudioContext::setAudioThread):
3602         (WebCore::AudioContext::audioThread const):
3603         * Modules/webaudio/AudioDestinationNode.cpp:
3604         (WebCore::AudioDestinationNode::render):
3605         * Modules/webdatabase/Database.cpp:
3606         (WebCore::Database::performClose):
3607         (WebCore::Database::securityOrigin):
3608         * Modules/webdatabase/DatabaseDetails.h:
3609         (WebCore::DatabaseDetails::DatabaseDetails):
3610         (WebCore::DatabaseDetails::operator=):
3611         (WebCore::DatabaseDetails::thread const):
3612         (WebCore::DatabaseDetails::threadID const): Deleted.
3613         * Modules/webdatabase/DatabaseManager.cpp:
3614         (WebCore::DatabaseManager::detailsForNameAndOrigin):
3615         * Modules/webdatabase/DatabaseThread.cpp:
3616         (WebCore::DatabaseThread::databaseThread):
3617         (WebCore::DatabaseThread::recordDatabaseOpen):
3618         (WebCore::DatabaseThread::recordDatabaseClosed):
3619         * Modules/webdatabase/DatabaseThread.h:
3620         (WebCore::DatabaseThread::getThread):
3621         (WebCore::DatabaseThread::getThreadID): Deleted.
3622         * Modules/webdatabase/SQLTransaction.cpp:
3623         (WebCore::SQLTransaction::checkAndHandleClosedDatabase):
3624         * Modules/webdatabase/SQLTransactionBackend.cpp:
3625         (WebCore::SQLTransactionBackend::doCleanup):
3626         (WebCore::SQLTransactionBackend::notifyDatabaseThreadIsShuttingDown):
3627         * bindings/js/JSCallbackData.h:
3628         (WebCore::JSCallbackData::JSCallbackData):
3629         (WebCore::JSCallbackData::~JSCallbackData):
3630         * bindings/js/ScheduledAction.cpp:
3631         (WebCore::ScheduledAction::execute):
3632         * dom/ScriptExecutionContext.cpp:
3633         (WebCore::ScriptExecutionContext::createdMessagePort):
3634         (WebCore::ScriptExecutionContext::destroyedMessagePort):
3635         * page/ResourceUsageOverlay.h:
3636         * page/scrolling/ScrollingThread.cpp:
3637         (WebCore::ScrollingThread::isCurrentThread):
3638         * platform/Supplementable.h:
3639         (WebCore::Supplementable::provideSupplement):
3640         (WebCore::Supplementable::removeSupplement):
3641         (WebCore::Supplementable::requireSupplement):
3642         (WebCore::Supplementable::Supplementable): Deleted.
3643         * platform/Timer.cpp:
3644         (WebCore::TimerBase::TimerBase):
3645         (WebCore::TimerBase::start):
3646         (WebCore::TimerBase::stop):
3647         (WebCore::TimerBase::setNextFireTime):
3648         * platform/Timer.h:
3649         (WebCore::TimerBase::isActive const):
3650         * platform/graphics/cocoa/FontCacheCoreText.cpp:
3651         (WebCore::shouldAutoActivateFontIfNeeded):
3652         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:
3653         (WebCore::TextureMapperPlatformLayerProxy::activateOnCompositingThread):
3654         (WebCore::TextureMapperPlatformLayerProxy::invalidate):
3655         (WebCore::TextureMapperPlatformLayerProxy::getAvailableBuffer):
3656         (WebCore::TextureMapperPlatformLayerProxy::appendToUnusedBuffers):
3657         (WebCore::TextureMapperPlatformLayerProxy::swapBuffer):
3658         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.h:
3659         (): Deleted.
3660         * platform/ios/wak/WebCoreThread.mm:
3661         (RunWebThread):
3662         (StartWebThread):
3663         * platform/sql/SQLiteDatabase.cpp:
3664         (WebCore::SQLiteDatabase::open):
3665         (WebCore::SQLiteDatabase::close):
3666         * platform/sql/SQLiteDatabase.h:
3667         (WebCore::SQLiteDatabase::sqlite3Handle const):
3668         * workers/WorkerGlobalScope.cpp:
3669         (WebCore::WorkerGlobalScope::~WorkerGlobalScope):
3670         (WebCore::WorkerGlobalScope::isContextThread const):
3671         * workers/WorkerMessagingProxy.cpp:
3672         (WebCore::WorkerMessagingProxy::WorkerMessagingProxy):
3673         (WebCore::WorkerMessagingProxy::~WorkerMessagingProxy):
3674         * workers/WorkerRunLoop.cpp:
3675         (WebCore::WorkerRunLoop::runInMode):
3676         (WebCore::WorkerRunLoop::runCleanupTasks):
3677         * workers/WorkerThread.h:
3678         (WebCore::WorkerThread::thread const):
3679         (WebCore::WorkerThread::threadID const): Deleted.
3680         * workers/service/ServiceWorkerContainer.cpp:
3681         (WebCore::ServiceWorkerContainer::~ServiceWorkerContainer):
3682         (WebCore::ServiceWorkerContainer::scheduleJob):
3683         (WebCore::ServiceWorkerContainer::jobFailedWithException):
3684         (WebCore::ServiceWorkerContainer::scheduleTaskToFireUpdateFoundEvent):
3685         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
3686         (WebCore::ServiceWorkerContainer::jobResolvedWithUnregistrationResult):
3687         (WebCore::ServiceWorkerContainer::startScriptFetchForJob):
3688         (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
3689         (WebCore::ServiceWorkerContainer::jobFailedLoadingScript):
3690         (WebCore::ServiceWorkerContainer::jobDidFinish):
3691         (WebCore::ServiceWorkerContainer::addRegistration):
3692         (WebCore::ServiceWorkerContainer::removeRegistration):
3693         (WebCore::ServiceWorkerContainer::scheduleTaskToFireControllerChangeEvent):
3694         (WebCore::ServiceWorkerContainer::contextIdentifier):
3695         * workers/service/ServiceWorkerContainer.h:
3696         * workers/service/ServiceWorkerJob.cpp:
3697         (WebCore::ServiceWorkerJob::~ServiceWorkerJob):
3698         (WebCore::ServiceWorkerJob::failedWithException):
3699         (WebCore::ServiceWorkerJob::resolvedWithRegistration):
3700         (WebCore::ServiceWorkerJob::resolvedWithUnregistrationResult):
3701         (WebCore::ServiceWorkerJob::startScriptFetch):
3702         (WebCore::ServiceWorkerJob::fetchScriptWithContext):
3703         (WebCore::ServiceWorkerJob::didReceiveResponse):
3704         (WebCore::ServiceWorkerJob::notifyFinished):
3705         * workers/service/ServiceWorkerJob.h:
3706         * xml/parser/XMLDocumentParserLibxml2.cpp:
3707         (WebCore::matchFunc):
3708         (WebCore::openFunc):
3709         (WebCore::initializeXMLParser):
3710         (WebCore::XMLParserContext::createStringParser):
3711         (WebCore::XMLParserContext::createMemoryParser):
3712
3713 2017-12-03  Youenn Fablet  <youenn@apple.com>
3714
3715         WebSocketChannel should ensure its client is live when calling it in error case
3716         https://bugs.webkit.org/show_bug.cgi?id=180285
3717
3718         Reviewed by Darin Adler.
3719
3720         No observable change of behavior.
3721         This makes it consistent with other calls of didReceiveMessageError.
3722
3723         * Modules/websockets/WebSocketChannel.cpp:
3724         (WebCore::WebSocketChannel::fail):
3725
3726 2017-12-03  Alexey Proskuryakov  <ap@apple.com>
3727
3728         WebArchiveResourceWebResourceHandler leaks when pasting
3729         https://bugs.webkit.org/show_bug.cgi?id=180339
3730
3731         Reviewed by Joseph Pecoraro.
3732
3733         * editing/cocoa/WebContentReaderCocoa.mm:
3734         (WebCore::attributesForAttributedStringConversion):
3735
3736 2017-12-03  Chris Dumez  <cdumez@apple.com>
3737
3738         Support serviceWorker.postMessage() inside service workers
3739         https://bugs.webkit.org/show_bug.cgi?id=180328
3740
3741         Reviewed by Darin Adler.
3742
3743         Support serviceWorker.postMessage() inside service workers.
3744
3745         No new tests, unskipped and rebaselined existing test that is
3746         now passing.
3747
3748         * workers/service/SWClientConnection.h:
3749         * workers/service/ServiceWorker.cpp:
3750         (WebCore::ServiceWorker::postMessage):
3751         * workers/service/context/SWContextManager.cpp:
3752         (WebCore::SWContextManager::postMessageToServiceWorker):
3753         * workers/service/context/SWContextManager.h:
3754         * workers/service/context/ServiceWorkerThread.cpp:
3755         (WebCore::fireMessageEvent):
3756         (WebCore::ServiceWorkerThread::postMessageToServiceWorker):
3757         * workers/service/context/ServiceWorkerThread.h:
3758
3759 2017-12-03  Chris Dumez  <cdumez@apple.com>
3760
3761         Implement self.skipWaiting() inside service workers
3762         https://bugs.webkit.org/show_bug.cgi?id=180329
3763
3764         Reviewed by Darin Adler.
3765
3766         Implement self.skipWaiting() inside service workers:
3767         - https://w3c.github.io/ServiceWorker/#service-worker-global-scope-skipwaiting
3768
3769         Also fixes a bug where tryActivate() was calling activate() even though the
3770         registration's active worker was "in use":
3771         - https://w3c.github.io/ServiceWorker/#try-activate-algorithm
3772
3773         No new tests, rebaselined existing tests.
3774
3775         * workers/service/ServiceWorkerGlobalScope.cpp:
3776         (WebCore::ServiceWorkerGlobalScope::skipWaiting):
3777         * workers/service/context/SWContextManager.h:
3778         * workers/service/server/SWServerRegistration.cpp:
3779         (WebCore::SWServerRegistration::tryActivate):
3780         * workers/service/server/SWServerToContextConnection.cpp:
3781         (WebCore::SWServerToContextConnection::skipWaiting):
3782         * workers/service/server/SWServerToContextConnection.h:
3783         * workers/service/server/SWServerWorker.cpp:
3784         (WebCore::SWServerWorker::skipWaiting):
3785         * workers/service/server/SWServerWorker.h:
3786         (WebCore::SWServerWorker::isSkipWaitingFlagSet const):
3787
3788 2017-12-03  Carlos Garcia Campos  <cgarcia@igalia.com>
3789
3790         [GStreamer] GstPad leaked in WebKitTextCombiner
3791         https://bugs.webkit.org/show_bug.cgi?id=180314
3792
3793         Reviewed by Michael Catanzaro.
3794
3795         gst_element_get_static_pad() returns a full reference that si never freed, because gst_ghost_pad_new doesn't
3796         take the ownership of the given pad.
3797
3798         * platform/graphics/gstreamer/TextCombinerGStreamer.cpp:
3799         (webkit_text_combiner_init):
3800
3801 2017-12-03  Carlos Garcia Campos  <cgarcia@igalia.com>
3802
3803         [GStreamer] GstCaps leaked in MediaPlayerPrivateGStreamer::createGSTPlayBin
3804         https://bugs.webkit.org/show_bug.cgi?id=180311
3805
3806         Reviewed by Michael Catanzaro.
3807
3808         gst_caps_new_empty_simple() is passed directly to g_object_set(). The returned caps should be freed with
3809         gst_caps_unref().
3810
3811         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
3812         (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
3813
3814 2017-12-02  Youenn Fablet  <youenn@apple.com>
3815
3816         Move registration activation and clearing from SWServerJobQueue to SWServerRegistration
3817         https://bugs.webkit.org/show_bug.cgi?id=180325
3818
3819         Reviewed by Chris Dumez.
3820
3821         No change of behavior.
3822
3823         These algorithms fit naturally in SWServerRegistration and will be used as part of clients.claim.
3824
3825         * workers/service/server/SWServer.cpp:
3826         (WebCore::SWServer::clearAll):
3827         (WebCore::SWServer::didFinishActivation):
3828         * workers/service/server/SWServerJobQueue.cpp:
3829         (WebCore::SWServerJobQueue::scriptFetchFinished):
3830         (WebCore::SWServerJobQueue::scriptContextFailedToStart):
3831         (WebCore::SWServerJobQueue::didFinishInstall):
3832         (WebCore::SWServerJobQueue::runUnregisterJob):
3833         (WebCore::SWServerJobQueue::tryActivate): Deleted.
3834         (WebCore::SWServerJobQueue::activate): Deleted.
3835         (WebCore::SWServerJobQueue::didFinishActivation): Deleted.
3836         (WebCore::SWServerJobQueue::tryClearRegistration): Deleted.
3837         (WebCore::clearRegistrationWorker): Deleted.
3838         (WebCore::SWServerJobQueue::clearRegistration): Deleted.
3839         * workers/service/server/SWServerJobQueue.h:
3840         * workers/service/server/SWServerRegistration.cpp:
3841         (WebCore::SWServerRegistration::tryClear):
3842         (WebCore::clearRegistrationWorker):
3843         (WebCore::SWServerRegistration::clear):
3844         (WebCore::SWServerRegistration::tryActivate):
3845         (WebCore::SWServerRegistration::activate):
3846         (WebCore::SWServerRegistration::didFinishActivation):
3847         * workers/service/server/SWServerRegistration.h:
3848
3849 2017-12-02  Chris Dumez  <cdumez@apple.com>
3850
3851         Support container.register() / registration.unregister() /  inside service workers
3852         https://bugs.webkit.org/show_bug.cgi?id=180326
3853
3854         Reviewed by Youenn Fablet.
3855
3856         Support container.register() / registration.unregister() /  inside service workers.
3857         This is mostly about removing the is<Document>() checks and adding testing given
3858         that most of the work was done in r225455.
3859
3860         Test: http/tests/workers/service/ServiceWorkerGlobalScope_register.html
3861
3862         * workers/service/ServiceWorkerContainer.cpp:
3863         (WebCore::ServiceWorkerContainer::addRegistration):
3864         * workers/service/ServiceWorkerRegistration.cpp:
3865         (WebCore::ServiceWorkerRegistration::update):
3866         (WebCore::ServiceWorkerRegistration::unregister):
3867
3868 2017-12-02  Chris Dumez  <cdumez@apple.com>
3869
3870         Support serviceWorkerRegistration.update() inside service workers
3871         https://bugs.webkit.org/show_bug.cgi?id=180215
3872
3873         Reviewed by Darin Adler.
3874
3875         Support serviceWorkerRegistration.update() inside service workers. The code paths
3876         for job scheduling and resolution have been made thread safe by hopping to the right
3877         thread when necessary. In particular, ServiceWorkerContainer always makes sure to to
3878         a callOnMainThread() before calling methods on the SWClientConnection. Also, the
3879         SWClientConnection relies on a new postTaskTo() method before calling methods on the
3880         job.
3881
3882         Test: http/tests/workers/service/self_registration_update.html
3883
3884         * workers/service/SWClientConnection.cpp:
3885         (WebCore::SWClientConnection::scheduleJob):
3886         (WebCore::SWClientConnection::finishedFetchingScript):
3887         (WebCore::SWClientConnection::failedFetchingScript):
3888         (WebCore::SWClientConnection::jobRejectedInServer):
3889         (WebCore::SWClientConnection::registrationJobResolvedInServer):
3890         (WebCore::SWClientConnection::unregistrationJobResolvedInServer):
3891         (WebCore::SWClientConnection::startScriptFetchForServer):
3892         (WebCore::SWClientConnection::postMessageToServiceWorkerClient):
3893         (WebCore::SWClientConnection::updateRegistrationState):
3894         (WebCore::SWClientConnection::updateWorkerState):
3895         (WebCore::SWClientConnection::fireUpdateFoundEvent):
3896         (WebCore::SWClientConnection::notifyClientsOfControllerChange):
3897         (WebCore::SWClientConnection::clearPendingJobs):
3898         (WebCore::SWClientConnection::postTaskTo):
3899         * workers/service/SWClientConnection.h:
3900         * workers/service/ServiceWorkerContainer.cpp:
3901         (WebCore::ServiceWorkerContainer::scheduleJob):
3902         (WebCore::ServiceWorkerContainer::jobFailedWithException):
3903         (WebCore::ServiceWorkerContainer::scheduleTaskToFireUpdateFoundEvent):
3904         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
3905         (WebCore::ServiceWorkerContainer::jobResolvedWithUnregistrationResult):
3906         (WebCore::ServiceWorkerContainer::startScriptFetchForJob):
3907         (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
3908         (WebCore::ServiceWorkerContainer::jobFailedLoadingScript):
3909         (WebCore::ServiceWorkerContainer::jobDidFinish):
3910         (WebCore::ServiceWorkerContainer::addRegistration):
3911         (WebCore::ServiceWorkerContainer::removeRegistration):
3912         (WebCore::ServiceWorkerContainer::scheduleTaskToFireControllerChangeEvent):
3913         (WebCore::ServiceWorkerContainer::contextIdentifier):
3914         * workers/service/ServiceWorkerContainer.h:
3915         * workers/service/ServiceWorkerJob.cpp:
3916         (WebCore::ServiceWorkerJob::ServiceWorkerJob):
3917         * workers/service/ServiceWorkerJob.h:
3918         (WebCore::ServiceWorkerJob::contextIdentifier):
3919         * workers/service/ServiceWorkerJobClient.h:
3920         * workers/service/ServiceWorkerRegistration.cpp:
3921         (WebCore::ServiceWorkerRegistration::update):
3922         * workers/service/ServiceWorkerTypes.h:
3923
3924 2017-12-02  Simon Fraser  <simon.fraser@apple.com>
3925
3926         Make IOSurface::Locker and use it in ImageBufferDataCG
3927         https://bugs.webkit.org/show_bug.cgi?id=180317
3928
3929         Reviewed by Zalan Bujtas.
3930
3931         Add an RAII IOSurface::Locker which can lock readonly or readwrite. Access
3932         to the IOSurface base address is through the locker.
3933         
3934         Add IOSurface::bytesPerRow() to wrap IOSurfaceGetBytesPerRow().
3935         
3936         After this, there is only one location where we access the IOSurfaceRef
3937         directly, in WebGL code.
3938
3939         * platform/graphics/cg/ImageBufferDataCG.cpp:
3940         (WebCore::ImageBufferData::toBGRAData const):
3941         (WebCore::ImageBufferData::getData const):
3942         (WebCore::ImageBufferData::putData):
3943         * platform/graphics/cocoa/IOSurface.h:
3944         * platform/graphics/cocoa/IOSurface.mm:
3945         (WebCore::IOSurface::bytesPerRow const):
3946
3947 2017-12-02  Simon Fraser  <simon.fraser@apple.com>
3948
3949         Add an AlphaPremultiplication enum and use it consistently
3950         https://bugs.webkit.org/show_bug.cgi?id=180316
3951
3952         Reviewed by Zalan Bujtas.
3953
3954         ImageBuffer-related code sometimes used the 'Multiply' enum, and sometimes
3955         a bool to represent alpha premultiplication. Make an enum class and use it
3956         everywhere. Re-order and rename some parameters to clarify the meaning of this
3957         argument.
3958
3959         * html/canvas/CanvasRenderingContext2D.cpp:
3960         (WebCore::CanvasRenderingContext2D::putImageData):
3961         * platform/graphics/GraphicsTypes.cpp:
3962         (WebCore::operator<<):
3963         * platform/graphics/GraphicsTypes.h:
3964         * platform/graphics/ImageBuffer.cpp:
3965         (WebCore::ImageBuffer::genericConvertToLuminanceMask):
3966         * platform/graphics/ImageBuffer.h:
3967         * platform/graphics/ShadowBlur.cpp:
3968         (WebCore::ShadowBlur::blurShadowBuffer):
3969         * platform/graphics/cairo/ImageBufferCairo.cpp:
3970         (WebCore::getImageData):
3971         (WebCore::ImageBuffer::getUnmultipliedImageData const):
3972         (WebCore::ImageBuffer::getPremultipliedImageData const):
3973         (WebCore::ImageBuffer::putByteArray):
3974         * platform/graphics/cg/ImageBufferCG.cpp:
3975         (WebCore::ImageBuffer::getUnmultipliedImageData const):
3976         (WebCore::ImageBuffer::getPremultipliedImageData const):
3977         (WebCore::ImageBuffer::putByteArray):
3978         * platform/graphics/cg/ImageBufferDataCG.cpp:
3979         (WebCore::ImageBufferData::getData const):
3980         (WebCore::ImageBufferData::putData):
3981         * platform/graphics/cg/ImageBufferDataCG.h:
3982         * platform/graphics/filters/FEColorMatrix.cpp:
3983         (WebCore::FEColorMatrix::platformApplySoftware):
3984         * platform/graphics/filters/FEDropShadow.cpp:
3985         (WebCore::FEDropShadow::platformApplySoftware):
3986         * platform/graphics/filters/FilterEffect.cpp:
3987         (WebCore::FilterEffect::imageBufferResult):
3988         * platform/graphics/win/ImageBufferDataDirect2D.cpp:
3989         (WebCore::ImageBufferData::getData const):
3990         (WebCore::ImageBufferData::putData):
3991         * platform/graphics/win/ImageBufferDataDirect2D.h:
3992         * platform/graphics/win/ImageBufferDirect2D.cpp:
3993         (WebCore::ImageBuffer::getUnmultipliedImageData const):
3994         (WebCore::ImageBuffer::getPremultipliedImageData const):
3995         (WebCore::ImageBuffer::putByteArray):
3996
3997 2017-12-02  Youenn Fablet  <youenn@apple.com>
3998
3999         Implement https://w3c.github.io/ServiceWorker/#clients-getall
4000         https://bugs.webkit.org/show_bug.cgi?id=180276