5a13e7f5913b356672aa89f285076361d54468c1
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-02-04  Joseph Pecoraro  <pecoraro@apple.com>
2
3         Static Analyzer: WebCoreNSURLExtras.mm: Potential leak of memory pointed to by 'allBytesBuffer'
4         https://bugs.webkit.org/show_bug.cgi?id=167849
5
6         Reviewed by Sam Weinig.
7
8         Source/WebCore/platform/mac/WebCoreNSURLExtras.mm:883:20: warning: Potential leak of memory pointed to by 'allBytesBuffer'
9                     return nil;
10                            ^~~
11
12         * platform/mac/WebCoreNSURLExtras.mm:
13         (WebCore::dataForURLComponentType):
14         Free the potentially malloc'd buffer before the early return.
15
16 2017-02-04  Chris Dumez  <cdumez@apple.com>
17
18         Unreviewed, fix mistake in comment added in r211569.
19
20         * history/PageCache.cpp:
21         (WebCore::PageCache::removeAllItemsForPage):
22
23 2017-02-04  Yoav Weiss  <yoav@yoav.ws>
24
25         Fix memory issues related to preload eviction.
26         https://bugs.webkit.org/show_bug.cgi?id=167838
27
28         Reviewed by Andreas Kling.
29
30         This avoids removing resources from m_preloads during the iteration
31         by creating a second HashSetList containing the remaining link preloads.
32
33         No new tests but this will fix crashes on the leak bots.
34
35         * loader/cache/CachedResourceLoader.cpp:
36         (WebCore::CachedResourceLoader::clearPreloads):
37
38 2017-02-04  Zalan Bujtas  <zalan@apple.com>
39
40         Simple line layout: Skip 16bit specific checks on 8bit content.
41         https://bugs.webkit.org/show_bug.cgi?id=167831
42         <rdar://problem/30361948>
43
44         Reviewed by Antti Koivisto and Myles C. Maxfield.
45
46         Skip various checks on 8bit content.
47
48         Covered by existing tests.
49
50         * rendering/SimpleLineLayout.cpp:
51         (WebCore::SimpleLineLayout::canUseForCharacter):
52         (WebCore::SimpleLineLayout::canUseForText):
53         (WebCore::SimpleLineLayout::canUseForFontAndText):
54
55 2017-02-03  Zalan Bujtas  <zalan@apple.com>
56
57         Simple line layout: Remove redundant codepath check.
58         https://bugs.webkit.org/show_bug.cgi?id=167827
59         <rdar://problem/30361850>
60
61         Reviewed by Myles C. Maxfield.
62
63         FontCascade::codePath() iterates through the entire text. It's rather wasteful to do twice.
64
65         No change in functionality.
66
67         * rendering/SimpleLineLayout.cpp:
68         (WebCore::SimpleLineLayout::canUseForFontAndText):
69         (WebCore::SimpleLineLayout::printReason):
70
71 2017-02-03  Myles C. Maxfield  <mmaxfield@apple.com>
72
73         REGRESSION(r204858): Synthetic bold text in vertical writing mode is rotated away from original text
74         https://bugs.webkit.org/show_bug.cgi?id=167826
75         <rdar://problem/28193222>
76
77         Reviewed by Zalan Bujtas.
78
79         When drawing vertical text, the rotation is not reset between successive paint calls. We implement
80         synthetic bold by drawing text twice, which means that the second draw call was getting rotated
81         twice. This was an oversight in r204858.
82
83         Test: fast/text/synthetic-bold-vertical-text.html
84
85         * platform/graphics/cocoa/FontCascadeCocoa.mm:
86         (WebCore::showGlyphsWithAdvances):
87
88 2017-02-03  Joseph Pecoraro  <pecoraro@apple.com>
89
90         Performance Timing: Convert WTF::MonotonicTime and WTF::Seconds
91         https://bugs.webkit.org/show_bug.cgi?id=167768
92
93         Reviewed by Geoffrey Garen.
94
95         The public APIs still return double (DOMHighResTimeStamp), which
96         is milliseconds since a time origin:
97         https://w3c.github.io/hr-time/#dom-domhighrestimestamp
98
99         * loader/LoadTiming.cpp:
100         (WebCore::LoadTiming::secondsSinceStartTime):
101         (WebCore::LoadTiming::monotonicTimeToPseudoWallTime):
102         (WebCore::LoadTiming::markStartTime):
103         (WebCore::LoadTiming::addRedirect):
104         (WebCore::LoadTiming::monotonicTimeToZeroBasedDocumentTime): Deleted.
105         * loader/LoadTiming.h:
106         (WebCore::LoadTiming::markUnloadEventStart):
107         (WebCore::LoadTiming::markUnloadEventEnd):
108         (WebCore::LoadTiming::markRedirectStart):
109         (WebCore::LoadTiming::markRedirectEnd):
110         (WebCore::LoadTiming::markFetchStart):
111         (WebCore::LoadTiming::setResponseEnd):
112         (WebCore::LoadTiming::markLoadEventStart):
113         (WebCore::LoadTiming::markLoadEventEnd):
114         (WebCore::LoadTiming::startTime):
115         (WebCore::LoadTiming::unloadEventStart):
116         (WebCore::LoadTiming::unloadEventEnd):
117         (WebCore::LoadTiming::redirectStart):
118         (WebCore::LoadTiming::redirectEnd):
119         (WebCore::LoadTiming::fetchStart):
120         (WebCore::LoadTiming::responseEnd):
121         (WebCore::LoadTiming::loadEventStart):
122         (WebCore::LoadTiming::loadEventEnd):
123         (WebCore::LoadTiming::redirectCount):
124         (WebCore::LoadTiming::referenceMonotonicTime):
125         (WebCore::LoadTiming::referenceWallTime):
126         Use MonotonicTime and WallTime for timestamps and references.
127
128         * dom/Document.cpp:
129         (WebCore::Document::setReadyState):
130         (WebCore::Document::finishedParsing):
131         (WebCore::Document::monotonicTimestamp):
132         * dom/DocumentTiming.h:
133         (WebCore::DocumentTiming::DocumentTiming): Deleted.
134         * dom/ScriptedAnimationController.cpp:
135         (WebCore::ScriptedAnimationController::serviceScriptedAnimations):
136         * inspector/InspectorNetworkAgent.cpp:
137         (WebCore::InspectorNetworkAgent::buildObjectForTiming):
138         (WebCore::InspectorNetworkAgent::didFinishLoading):
139         * loader/DocumentLoader.cpp:
140         (WebCore::DocumentLoader::finishedLoading):
141         (WebCore::DocumentLoader::dataReceived):
142         * loader/DocumentLoader.h:
143         * loader/SubresourceLoader.cpp:
144         (WebCore::SubresourceLoader::didFinishLoading):
145         * loader/cache/CachedResourceLoader.cpp:
146         (WebCore::CachedResourceLoader::requestResource):
147         * page/DOMWindow.cpp:
148         (WebCore::DOMWindow::performance):
149         Use new types instead of raw doubles.
150
151         * page/Performance.cpp:
152         (WebCore::Performance::Performance):
153         (WebCore::Performance::now):
154         (WebCore::Performance::reduceTimeResolution):
155         (WebCore::Performance::addResourceTiming):
156         * page/Performance.h:
157         Do time arithmatic with WTF::Time classes.
158         This clarifies that we reduce our timestamps to 100us
159         resolution instead of the maximum 5us allowed by the spec.
160
161         * page/PerformanceResourceTiming.cpp:
162         (WebCore::monotonicTimeToDOMHighResTimeStamp):
163         (WebCore::PerformanceResourceTiming::PerformanceResourceTiming):
164         (WebCore::PerformanceResourceTiming::networkLoadTimeToDOMHighResTimeStamp):
165         * page/PerformanceResourceTiming.h:
166         * page/PerformanceTiming.cpp:
167         (WebCore::PerformanceTiming::resourceLoadTimeRelativeToFetchStart):
168         (WebCore::PerformanceTiming::monotonicTimeToIntegerMilliseconds):
169         (WebCore::toIntegerMilliseconds): Deleted.
170         * page/PerformanceTiming.h:
171         Do time arithmatic with WTF::Time classes.
172
173         * workers/DedicatedWorkerGlobalScope.cpp:
174         (WebCore::DedicatedWorkerGlobalScope::create):
175         (WebCore::DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope):
176         * workers/DedicatedWorkerGlobalScope.h:
177         * workers/DedicatedWorkerThread.cpp:
178         (WebCore::DedicatedWorkerThread::DedicatedWorkerThread):
179         (WebCore::DedicatedWorkerThread::createWorkerGlobalScope):
180         * workers/DedicatedWorkerThread.h:
181         * workers/WorkerGlobalScope.cpp:
182         (WebCore::WorkerGlobalScope::WorkerGlobalScope):
183         * workers/WorkerGlobalScope.h:
184         * workers/WorkerGlobalScopeProxy.h:
185         * workers/WorkerMessagingProxy.cpp:
186         (WebCore::WorkerMessagingProxy::startWorkerGlobalScope):
187         * workers/WorkerMessagingProxy.h:
188         * workers/WorkerThread.cpp:
189         (WebCore::WorkerThreadStartupData::WorkerThreadStartupData):
190         (WebCore::WorkerThread::WorkerThread):
191         * workers/WorkerThread.h:
192         Pass time origin as MonotonicTime.
193
194         * workers/Worker.cpp:
195         (WebCore::Worker::create):
196         (WebCore::Worker::notifyFinished):
197         * workers/Worker.h:
198         Rename creation timestamp member. This matches Document's m_documentCreationTime.
199
200 2017-02-03  Jeremy Jones  <jeremyj@apple.com>
201
202         WK1 mouse events are missing movementX and movementY for pointerlock.
203         https://bugs.webkit.org/show_bug.cgi?id=167775
204         rdar://problem/30343810
205
206         Reviewed by Alexey Proskuryakov.
207
208         pointer-lock/mouse-event-delivery.html
209
210         Improve mouse-event-delivery.html test to mouse move and check for valid movementX and movementY.
211         
212         * platform/mac/PlatformEventFactoryMac.mm:
213         (WebCore::PlatformMouseEventBuilder::PlatformMouseEventBuilder): WK1 plumb throuhg movementX and movementY
214
215 2017-02-03  Simon Fraser  <simon.fraser@apple.com>
216
217         Correctly set the "inWindow" flag for TileControllers that aren't the page tiles, and clarify "usingTiledBacking" logic
218         https://bugs.webkit.org/show_bug.cgi?id=167774
219
220         Reviewed by Tim Horton.
221
222         RenderLayerBacking had some very confusing "usingTiledCacheLayer" uses.
223
224         Its member variable, m_usingTiledCacheLayer, really meant "m_isMainFrameLayerWithTiledBacking" so make it so.
225         It had a usingTiledBacking(), which returned the same thing, which this patch replaces with isMainFrameLayerWithTiledBacking().
226
227         The fact that usingTiledBacking() was only true for the page tiled layer tripped up
228         RenderLayerCompositor::setIsInWindowForLayerIncludingDescendants(), which would only ever call setIsInWindow()
229         on the page tiled layer. These changes fix that.
230
231         Also make a way for tests to unparent the web view via UIScriptController, and dump out the "in window"
232         status of TileBackings when dumping tile caches.
233
234         Test: tiled-drawing/tiled-backing-in-window.html
235
236         * platform/graphics/TiledBacking.h:
237         * platform/graphics/ca/GraphicsLayerCA.cpp:
238         (WebCore::GraphicsLayerCA::dumpAdditionalProperties):
239         * platform/graphics/ca/TileController.h:
240         * rendering/RenderLayerBacking.cpp:
241         (WebCore::RenderLayerBacking::RenderLayerBacking):
242         (WebCore::computePageTiledBackingCoverage):
243         (WebCore::RenderLayerBacking::adjustTiledBackingCoverage):
244         (WebCore::RenderLayerBacking::setTiledBackingHasMargins):
245         (WebCore::RenderLayerBacking::createPrimaryGraphicsLayer):
246         (WebCore::RenderLayerBacking::shouldClipCompositedBounds):
247         (WebCore::RenderLayerBacking::updateDescendantClippingLayer):
248         (WebCore::RenderLayerBacking::updateRootLayerConfiguration):
249         (WebCore::RenderLayerBacking::paintsIntoWindow):
250         (WebCore::computeTileCoverage): Deleted.
251         * rendering/RenderLayerBacking.h:
252         * rendering/RenderLayerCompositor.cpp:
253         (WebCore::RenderLayerCompositor::flushPendingLayerChanges):
254         (WebCore::RenderLayerCompositor::rootFixedBackgroundsChanged):
255         (WebCore::RenderLayerCompositor::setIsInWindowForLayerIncludingDescendants):
256         (WebCore::RenderLayerCompositor::supportsFixedRootBackgroundCompositing):
257         (WebCore::RenderLayerCompositor::documentUsesTiledBacking):
258
259 2017-02-03  Zalan Bujtas  <zalan@apple.com>
260
261         Simple line layout: Bail out from Simple Line Layout when the primary font is insufficient.
262         https://bugs.webkit.org/show_bug.cgi?id=167820
263         <rdar://problem/30359685>
264
265         Reviewed by Myles C. Maxfield.
266
267         Currently simple line layout requires the primary font to have all the glyps for the content.
268
269         Test: fast/text/simple-line-layout-do-not-support-unicode-range.html
270
271         * rendering/SimpleLineLayout.cpp:
272         (WebCore::SimpleLineLayout::canUseForText):
273         (WebCore::SimpleLineLayout::canUseForFontAndText):
274         (WebCore::SimpleLineLayout::printReason):
275
276 2017-02-03  Jer Noble  <jer.noble@apple.com>
277
278         ASSERT in HTMLMediaElement::~HTMLMediaElement
279         https://bugs.webkit.org/show_bug.cgi?id=167818
280
281         Reviewed by Brent Fulgham.
282
283         Test: media/audio-dealloc-crash.html
284
285         HTMLMediaElement's MediaElementSession can nominate the HTMLMediaElement itself
286         to become the playback controls session from inside the HTMLMediaElement destructor. Protect
287         against this by clearing out the session before calling updatePlaybackControlsManager().
288
289         * html/HTMLMediaElement.cpp:
290         (WebCore::HTMLMediaElement::~HTMLMediaElement):
291
292 2017-02-03  Daniel Bates  <dabates@apple.com>
293
294         [Mac][WK2] Add SPI to override the Content Security Policy of a page
295         https://bugs.webkit.org/show_bug.cgi?id=167810
296         <rdar://problem/30102568>
297
298         Reviewed by Anders Carlsson.
299
300         * dom/Document.cpp:
301         (WebCore::Document::initSecurityContext): Apply the embedding client's override Content Security
302         Policy to the document if one exists.
303         * loader/FrameLoaderClient.h: Add function overrideContentSecurityPolicy() that a FrameLoaderClient
304         can override to provide a custom Content Security Policy for a document (defaults: null string - no policy).
305         As its name implies, the policy returned by overrideContentSecurityPolicy() will define the Content
306         Security Policy for the document, overriding any subsequently received Content Security Policy for
307         the document.
308         * page/csp/ContentSecurityPolicy.cpp:
309         (WebCore::ContentSecurityPolicy::copyStateFrom): Only copy policies from the specified ContentSecurityPolicy
310         object if our policy was not specified by the embedding client.
311         (WebCore::ContentSecurityPolicy::didReceiveHeader): Set ContentSecurityPolicy::m_hasAPIPolicy to true
312         when we receive an API policy from the embedding client (ContentSecurityPolicy::PolicyFrom::API). An
313         API policy must be defined before a policy received from a document. Do not process a received header
314         if we already have an API policy as the API policy overrides all other policies.
315         * page/csp/ContentSecurityPolicy.h:
316
317 2017-02-03  Chris Dumez  <cdumez@apple.com>
318
319         Drop Mac App Store workaround for window.getComputedStyle()
320         https://bugs.webkit.org/show_bug.cgi?id=166891
321         <rdar://problem/28282452>
322
323         Reviewed by Sam Weinig.
324
325         Drop Mac App Store workaround for window.getComputedStyle() now that
326         <rdar://problem/28020681> has been fixed.
327
328         * page/DOMWindow.cpp:
329         * page/DOMWindow.h:
330         * page/DOMWindow.idl:
331         * platform/RuntimeApplicationChecks.h:
332         * platform/RuntimeApplicationChecks.mm:
333         (WebCore::MacApplication::isAppStore): Deleted.
334
335 2017-02-03  Chris Dumez  <cdumez@apple.com>
336
337         Dismiss HTML form validation popover when pressing Escape key
338         https://bugs.webkit.org/show_bug.cgi?id=167716
339         <rdar://problem/29872943>
340
341         Reviewed by Simon Fraser.
342
343         Dismiss any visible HTML form validation popover when pressing
344         the Escape key.
345
346         Test: fast/forms/validation-bubble-escape-key-dismiss.html
347
348         * page/EventHandler.cpp:
349         (WebCore::EventHandler::keyEvent):
350         * page/ValidationMessageClient.h:
351
352 2017-02-03  Jeremy Jones  <jeremyj@apple.com>
353
354         Pointer lock events should be delivered directly to the target element
355         https://bugs.webkit.org/show_bug.cgi?id=167134
356         rdar://problem/30268004
357
358         Reviewed by Dean Jackson.
359
360         pointer-lock/mouse-event-delivery.html: Enabled for mac, added wheel event tests.
361
362         When pointer is locked on an element, route mouse events directly to the target element, instead of 
363         doing the normal event disptach.
364
365         * page/EventHandler.cpp:
366         (WebCore::EventHandler::handleMousePressEvent):
367         (WebCore::EventHandler::handleMouseDoubleClickEvent):
368         (WebCore::EventHandler::handleMouseMoveEvent):
369         (WebCore::EventHandler::handleMouseReleaseEvent):
370         (WebCore::EventHandler::handleMouseForceEvent):
371         (WebCore::EventHandler::handleWheelEvent):
372         * page/PointerLockController.cpp:
373         (WebCore::PointerLockController::isLocked): Added.
374         (WebCore::PointerLockController::dispatchLockedWheelEvent): Added.
375         * page/PointerLockController.h:
376
377 2017-02-03  Yoav Weiss  <yoav@yoav.ws>
378
379         Avoid evicting link preload resources when parsing is done.
380         https://bugs.webkit.org/show_bug.cgi?id=167415
381
382         Reviewed by Ryosuke Niwa.
383
384         Currently all preloads (speculative and link preload) are being cleared when the document has finished parsing.
385         When it comes to link preloads, it can result in resources being cleared before the page had a chance to use them. (e.g. resources
386         that are preloaded in order to be loaded through script after DOMContentLoaded)
387
388         This patch fixes that by marking link preload resources as such, so that they can be handled separately inside clearPreloads().
389         As this fix also exposed an issue with load cancelation with invalid hrefs (which tests were passing before due to the preloads
390         being cleared), said issue is also fixed by clearing previousely preloaded resources if an invalid link preload is later detected.
391
392         Test: http/tests/preload/not_evicting_preload_at_onload.html
393
394         * dom/Document.cpp:
395         (WebCore::Document::finishedParsing): Only clear speculative preloads when parsing is finished.
396         * loader/LinkLoader.cpp:
397         (WebCore::LinkLoader::preloadIfNeeded): Set request flag indicating link preload.
398         (WebCore::LinkLoader::loadLink): Clear previousely preloaded resource to cancel their load.
399         * loader/LinkPreloadResourceClients.h:
400         (WebCore::LinkPreloadResourceClient::clearResource): Call cancelLoad() when the client is cleared.
401         * loader/cache/CachedResource.h:
402         (WebCore::CachedResource::isLinkPreload):
403         (WebCore::CachedResource::setLinkPreload):
404         * loader/cache/CachedResource.cpp:
405         (WebCore::CachedResource::CachedResource): Initialize m_isLinkPreload with the request's value.
406         * loader/cache/CachedResourceLoader.cpp:
407         (WebCore::CachedResourceLoader::~CachedResourceLoader):
408         (WebCore::CachedResourceLoader::requestResource): Mirror the request link preload flag to the resource if it's fetched from cache.
409         (WebCore::CachedResourceLoader::clearPreloads): Add a "speculative only" mode, which doesn't clear link preloads.
410         * loader/cache/CachedResourceLoader.h:
411         * loader/cache/CachedResourceRequest.cpp:
412         (WebCore::CachedResourceRequest::CachedResourceRequest):
413         * loader/cache/CachedResourceRequest.h:
414         (WebCore::CachedResourceRequest::isLinkPreload):
415         (WebCore::CachedResourceRequest::setIsLinkPreload):
416
417 2017-02-03  Zalan Bujtas  <zalan@apple.com>
418
419         Simple line layout: Removing adjacent trailing whitespace runs should not crash.
420         https://bugs.webkit.org/show_bug.cgi?id=167803
421         <rdar://problem/30337368>
422
423         Reviewed by Antti Koivisto.
424
425         In case of adjacent collapsed whitespace fragments, the length of these fragments (TextFragmentIterator::TextFragment)
426         do not necessarily equal the length of the final runs (SimpleLineLayout::Run).
427         This patch removes the dependency on the length and switches over to using the position information instead.
428
429         Test: fast/text/simple-line-layout-multiple-trailingwhitespace-crash.html
430
431         * rendering/SimpleLineLayout.cpp:
432         (WebCore::SimpleLineLayout::LineState::appendFragmentAndCreateRunIfNeeded):
433         (WebCore::SimpleLineLayout::LineState::removeTrailingWhitespace):
434
435 2017-02-03  Brent Fulgham  <bfulgham@apple.com>
436
437         Correct memory leak in MediaConstraints
438         https://bugs.webkit.org/show_bug.cgi?id=167744
439         <rdar://problem/30331444>
440
441         Reviewed by Anders Carlsson.
442
443         ConstraintHolder returns a reference to an object created by operator new. When the
444         returned value is assigned or stored in Vector or other containers we leak memory.
445         Instead, this value should just be returned as a regular object so that the return
446         value optimization can make sure memory is properly (and efficiently) used.
447
448         Tested by existing mediastream tests.
449
450         * platform/mediastream/MediaConstraints.h:
451         (WebCore::FlattenedConstraint::ConstraintHolder::create): Return by value.
452         (WebCore::FlattenedConstraint::ConstraintHolder::~ConstraintHolder): Don't attempt to
453         delete memory that was moved away.
454         (WebCore::FlattenedConstraint::ConstraintHolder::ConstraintHolder): Add Move constructor.
455
456 2017-02-03  Chris Dumez  <cdumez@apple.com>
457
458         Fix bad assertion under HTMLTreeBuilder::processStartTagForInBody()
459         https://bugs.webkit.org/show_bug.cgi?id=167799
460         <rdar://problem/30237241>
461
462         Reviewed by Brent Fulgham.
463
464         Fix bad assertion under HTMLTreeBuilder::processStartTagForInBody() that was
465         expecting the root element to be an <html> element when parsing a <frameset>.
466         While this assertion is true in theory and as per the specification, it does
467         not hold in WebKit when parsing a DocumentFragment. This is because WebKit
468         has an optimization causing us to have a DocumentFragment as root element
469         when parsing a fragment. See the following constructor:
470         "HTMLTreeBuilder(HTMLDocumentParser&, DocumentFragment&, Element&, ParserContentPolicy, const HTMLParserOptions&)"
471
472         which has the following code:
473         """
474         // https://html.spec.whatwg.org/multipage/syntax.html#parsing-html-fragments
475         // For efficiency, we skip step 5 ("Let root be a new html element with no attributes") and instead use the DocumentFragment as a root node.
476         m_tree.openElements().pushRootNode(HTMLStackItem::create(fragment));
477         """
478
479         Update the assertion to expect a DocumentFragment as root element when parsing
480         a fragment, and keep expecting an <html> element otherwise.
481
482         Test: fast/parser/fragment-with-frameset-crash.html
483
484         * html/parser/HTMLTreeBuilder.cpp:
485         (WebCore::HTMLTreeBuilder::processStartTagForInBody):
486
487 2017-02-03  Antoine Quint  <graouts@apple.com>
488
489         [Modern Media Controls] Skip back button is visible with a live broadcast video
490         https://bugs.webkit.org/show_bug.cgi?id=167793
491
492         Reviewed by Eric Carlson.
493
494         We shouldn't be showing the skip back button when a live broadcast video is playing.
495         We now listen to the "durationchange" event to determine when we have an inifinite-duration
496         video and disable the skip button in that case.
497
498         Test: http/tests/media/modern-media-controls/skip-back-support/skip-back-support-live-broadcast.html
499
500         * Modules/modern-media-controls/media/skip-back-support.js:
501         (SkipBackSupport.prototype.get mediaEvents):
502         (SkipBackSupport.prototype.syncControl):
503         (SkipBackSupport):
504
505 2017-02-03  Alex Christensen  <achristensen@webkit.org>
506
507         URLParser: implement forbidden host code points for non-special URLs
508         https://bugs.webkit.org/show_bug.cgi?id=167779
509
510         Reviewed by Chris Dumez.
511
512         Covered by newly passing web platform tests.
513
514         * platform/URLParser.cpp:
515         (WebCore::isC0Control):
516         (WebCore::isForbiddenHostCodePoint):
517         (WebCore::URLParser::parseHostAndPort):
518         In non-special URL hosts such as customprotocol://strange%host
519         don't accept characters that are part of the URL grammar and would be forbidden
520         in a special URL host, like https://not[allowed
521         This was recently added to the spec in https://github.com/whatwg/url/issues/214
522
523 2017-02-03  Per Arne Vollan  <pvollan@apple.com>
524
525         The CSS property -webkit-text-stroke is not applied on captions.
526         https://bugs.webkit.org/show_bug.cgi?id=167687
527
528         Reviewed by Brent Fulgham.
529
530         Add style to list of valid properties for cue.
531
532         Test: media/track/track-css-stroke-cues.html
533
534         * css/StyleResolver.cpp:
535         (WebCore::StyleResolver::isValidCueStyleProperty):
536
537 2017-02-03  Alex Christensen  <achristensen@webkit.org>
538
539         Align URL setters with spec for URLs that cannot be a base URL
540         https://bugs.webkit.org/show_bug.cgi?id=167783
541
542         Reviewed by Chris Dumez.
543
544         Setting things like credentials on mailto URLs doesn't make sense.
545         It's forbidden by the spec.
546
547         Covered by newly passing web platform tests.
548
549         * html/URLUtils.h:
550         (WebCore::URLUtils<T>::setUsername):
551         (WebCore::URLUtils<T>::setPassword):
552         (WebCore::URLUtils<T>::setHost):
553         (WebCore::URLUtils<T>::setHostname):
554         (WebCore::URLUtils<T>::setPort):
555         (WebCore::URLUtils<T>::setPathname):
556         * platform/URL.cpp:
557         (WebCore::URL::serialize):
558         * platform/URL.h:
559         (WebCore::URL::cannotBeABaseURL):
560
561 2017-02-03  Eric Carlson  <eric.carlson@apple.com>
562
563         [Mac] Add classes to manage audio samples
564         https://bugs.webkit.org/show_bug.cgi?id=167739
565
566         Reviewed by Jer Noble.
567
568         No new tests, this code isn't used yet.
569
570         * WebCore.xcodeproj/project.pbxproj:
571         * platform/audio/mac/AudioSampleBufferList.cpp: Added.
572         (WebCore::AudioSampleBufferList::create):
573         (WebCore::AudioSampleBufferList::AudioSampleBufferList):
574         (WebCore::AudioSampleBufferList::~AudioSampleBufferList):
575         (WebCore::AudioSampleBufferList::setSampleCount):
576         (WebCore::AudioSampleBufferList::applyGain):
577         (WebCore::AudioSampleBufferList::mixFrom):
578         (WebCore::AudioSampleBufferList::copyFrom):
579         (WebCore::AudioSampleBufferList::copyTo):
580         (WebCore::AudioSampleBufferList::reset):
581         (WebCore::AudioSampleBufferList::zero):
582         (WebCore::AudioSampleBufferList::zeroABL):
583         (WebCore::AudioSampleBufferList::convertInput):
584         (WebCore::AudioSampleBufferList::audioConverterCallback):
585         (WebCore::AudioSampleBufferList::configureBufferListForStream):
586         * platform/audio/mac/AudioSampleBufferList.h: Added.
587         (WebCore::AudioSampleBufferList::streamDescription):
588         (WebCore::AudioSampleBufferList::bufferList):
589         (WebCore::AudioSampleBufferList::sampleCapacity):
590         (WebCore::AudioSampleBufferList::sampleCount):
591         (WebCore::AudioSampleBufferList::timestamp):
592         (WebCore::AudioSampleBufferList::hostTime):
593         (WebCore::AudioSampleBufferList::setTimes):
594         (WebCore::AudioSampleBufferList::audioBufferListSizeForStream):
595         * platform/audio/mac/AudioSampleDataSource.cpp: Added.
596         (WebCore::AudioSampleDataSource::create):
597         (WebCore::AudioSampleDataSource::AudioSampleDataSource):
598         (WebCore::AudioSampleDataSource::~AudioSampleDataSource):
599         (WebCore::AudioSampleDataSource::setPaused):
600         (WebCore::AudioSampleDataSource::setupConverter):
601         (WebCore::AudioSampleDataSource::setInputFormat):
602         (WebCore::AudioSampleDataSource::setOutputFormat):
603         (WebCore::AudioSampleDataSource::hostTime):
604         (WebCore::AudioSampleDataSource::pushSamplesInternal):
605         (WebCore::AudioSampleDataSource::pushSamples):
606         (WebCore::AudioSampleDataSource::pullSamplesInternal):
607         (WebCore::AudioSampleDataSource::pullSamples):
608         * platform/audio/mac/AudioSampleDataSource.h: Added.
609         (WebCore::AudioSampleDataSource::setVolume):
610         (WebCore::AudioSampleDataSource::volume):
611         (WebCore::AudioSampleDataSource::setMuted):
612         (WebCore::AudioSampleDataSource::muted):
613
614 2017-02-03  Carlos Garcia Campos  <cgarcia@igalia.com>
615
616         Unreviewed. Fix the buidl after r211631.
617
618         I added the OS(LINUX) ifdef to the wrong file by mistake.
619
620         * page/ResourceUsageThread.h:
621         * page/linux/ResourceUsageThreadLinux.cpp:
622
623 2017-02-03  Carlos Garcia Campos  <cgarcia@igalia.com>
624
625         [GTK] Add initial implementation of resource usage overlay
626         https://bugs.webkit.org/show_bug.cgi?id=167731
627
628         Reviewed by Michael Catanzaro.
629
630         Add an implementation of ResourceUsageOverlay and ResourceUsageThread for Linux systems.
631
632         * PlatformGTK.cmake: Add new new files to compilation.
633         * page/Page.cpp:
634         (WebCore::Page::setResourceUsageOverlayVisible): Do not create the page overlay if accelerated compositing is
635         not enabled.
636         * page/ResourceUsageOverlay.h:
637         * page/linux/ResourceUsageOverlayLinux.cpp: Added.
638         (WebCore::cpuUsageString):
639         (WebCore::formatByteNumber):
640         (WebCore::gcTimerString):
641         (WebCore::ResourceUsageOverlay::platformInitialize):
642         (WebCore::ResourceUsageOverlay::platformDestroy):
643         * page/linux/ResourceUsageThreadLinux.cpp: Added.
644         (WebCore::cpuPeriod):
645         (WebCore::cpuUsage):
646         (WebCore::ResourceUsageThread::platformThreadBody):
647
648 2017-02-03  Enrique Ocaña González  <eocanha@igalia.com>
649
650         [GStreamer] Store preloaded media in webkit's cache
651         https://bugs.webkit.org/show_bug.cgi?id=119477
652
653         Reviewed by Xabier Rodriguez-Calvar.
654
655         Files cached on disk by MediaPlayerPrivateGStreamer are deleted only when the player is closed. If the
656         WebProcess crashed, they're just left there in the cache directory. This patch changes the location
657         of those temporary files to a proper temporary directory (/var/tmp, as those files aren't actually
658         reusable, so they don't belong to a cache directory, and /tmp is a bad place because it's RAM-based on
659         some distros), unlinks (deletes) them right after creation and also deletes any other stalled temporary
660         file on the old legacy cache directory.
661
662         There's no API in GstPlaybin to control the temporary file location, so we do it manually by locating
663         the GstDownloadBuffer element in the pipeline as soon as it's created, reconfiguring it with the right
664         temporary file path and deleting the file as soon as it's created.
665
666         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
667         (WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer): Stop listening to element-added.
668         (WebCore::MediaPlayerPrivateGStreamer::uriDecodeBinElementAddedCallback): Look for GstDownloadBuffer.
669         (WebCore::MediaPlayerPrivateGStreamer::downloadBufferFileCreatedCallback): Remove the file after creation.
670         (WebCore::MediaPlayerPrivateGStreamer::purgeOldDownloadFiles): Delete legacy files.
671         (WebCore::MediaPlayerPrivateGStreamer::sourceChanged): Listen to element-added signals on GstUriDecodeBin.
672         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: New reference to GstDownloadBuffer.
673
674 2017-02-03  Antti Koivisto  <antti@apple.com>
675
676         WebContent crash when pasting into input fields at com.apple.WebCore: WebCore::ResourceRequestBase::url const + 9
677         https://bugs.webkit.org/show_bug.cgi?id=167787
678         rdar://problem/29168795
679
680         Reviewed by Andreas Kling.
681
682         No test, don't know how to get here.
683
684         * page/animation/CSSPropertyAnimation.cpp:
685         (WebCore::crossfadeBlend): Null check.
686
687 2017-02-03  Alberto Garcia  <berto@igalia.com>
688
689         JSDOMWindowBase.cpp doesn't build if the JIT is disabled
690         https://bugs.webkit.org/show_bug.cgi?id=167785
691
692         Reviewed by Carlos Garcia Campos.
693
694         r211403 moved GetCallerGlobalObjectFunctor from JSDOMBinding.cpp
695         to JSDOMWindowBase.cpp, but forgot to include bytecode/CodeBlock.h
696         in the latter file.
697
698         This breaks the build if the JIT is disabled because the headers
699         that would include ClodeBlock.h indirectly are guarded by
700         ENABLE(JIT).
701
702         * bindings/js/JSDOMWindowBase.cpp:
703
704 2017-02-02  Andreas Kling  <akling@apple.com>
705
706         [Mac] In-process memory pressure monitor for WebContent processes AKA websam
707         <https://webkit.org/b/167491>
708         <rdar://problem/30116072>
709
710         Reviewed by Antti Koivisto.
711
712         Add a new timer-based memory pressure monitor that checks the process memory
713         footprint every 30 seconds and reacts to changes by setting a MemoryUsagePolicy.
714
715         There are four MemoryUsagePolicy values:
716
717             - Unrestricted (below 1GB)
718             - Conservative (above 1GB)
719             - Strict (above 2GB)
720             - Panic (above 4GB, or 3GB if 32-bit)
721
722         For Strict and above, the old-style "isUnderMemoryPressure()" API will return true.
723
724         Transitioning to a higher policy will cause memory pressure handlers to run:
725
726         At Strict, we run the "non-critical" memory pressure handler, then carry on.
727
728         At Panic, we run the "critical" memory pressure handler. If that fails to recover
729         enough memory to bring us back below 4GB, we may kill the process:
730
731         A process is eligible to get killed for using too much memory if:
732
733             - It's not visible on screen (i.e it's a background tab.)
734             - It's not playing audio.
735             - It has not performed a main frame navigation in the last hour.
736
737         Before killing the process, an exit-time callback will run. This patch installs such
738         a callback that prints out some time-of-death statistics about C++ and JavaScript memory
739         usage to hopefully help understand what was soaking up all the memory.
740
741         * bindings/js/CommonVM.cpp:
742         (WebCore::commonVMSlow):
743         * loader/FrameLoader.cpp:
744         (WebCore::FrameLoader::setState):
745         * page/MainFrame.cpp:
746         (WebCore::MainFrame::didCompleteLoad):
747         * page/MainFrame.h:
748         * page/MemoryRelease.cpp:
749         (WebCore::pageCount):
750         (WebCore::logMemoryStatisticsAtTimeOfDeath):
751         (WebCore::didExceedMemoryLimitAndFailedToRecover):
752         (WebCore::processIsEligibleForMemoryKill):
753         * page/MemoryRelease.h:
754         * page/ResourceUsageThread.h:
755         * page/cocoa/ResourceUsageThreadCocoa.mm:
756         (WebCore::vmPageSize):
757         * platform/MemoryPressureHandler.cpp:
758         (WebCore::MemoryPressureHandler::MemoryPressureHandler):
759         (WebCore::MemoryPressureHandler::setShouldUsePeriodicMemoryMonitor):
760         (WebCore::toString):
761         (WebCore::thresholdForPolicy):
762         (WebCore::policyForFootprint):
763         (WebCore::MemoryPressureHandler::measurementTimerFired):
764         * platform/MemoryPressureHandler.h:
765         (WebCore::MemoryPressureHandler::setMemoryKillCallback):
766         (WebCore::MemoryPressureHandler::setProcessIsEligibleForMemoryKillCallback):
767         (WebCore::MemoryPressureHandler::isUnderMemoryPressure):
768
769 2017-02-02  Alex Christensen  <achristensen@webkit.org>
770
771         URLParser: Fix parsing invalid IPv4 addresses with non-ASCII characters
772         https://bugs.webkit.org/show_bug.cgi?id=167773
773         <rdar://problem/30221102>
774
775         Reviewed by Ryosuke Niwa.
776
777         If an invalid IPv4 address contains the first syntaxViolation (difference between input and canonicalized URL),
778         an iterator is used to calculate how far we have parsed in the input string to copy all the syntax-violation-free
779         characters into a Vector. If a URL contains only ASCII that doesn't contain anything percent-encoded in the host,
780         there is a fast path to parse ASCII hosts.  All my existing invalid IPv4 tests followed this path.
781         If there is a non-ASCII character, we need to use an iterator to the original string instead of an iterator
782         to the string after converting the input string's host to ASCII.
783
784         Covered by a new API test which used to RELEASE_ASSERT.
785
786         * platform/URLParser.cpp:
787         (WebCore::URLParser::parseIPv4Host):
788         (WebCore::URLParser::parseIPv6Host):
789         (WebCore::URLParser::parseHostAndPort):
790         * platform/URLParser.h:
791
792 2017-02-02  Wenson Hsieh  <wenson_hsieh@apple.com>
793
794         CrashTracer: [USER] com.apple.WebKit.WebContent at com.apple.WebCore: WebCore::URL::host const + 9
795         https://bugs.webkit.org/show_bug.cgi?id=167766
796         <rdar://problem/30132707>
797
798         Reviewed by Chris Dumez.
799
800         The mainframe's document pointer may be null when tearing down a page upon navigation to a page that is in the
801         page cache. If this triggers a GC sweep, we will attempt to reload touch bar media controls, which (as a part of
802         the media controller heuristic) checks the mainframe's document URL to see if quirks should be enabled. This
803         assumes that the mainframe's document exists, which is not a safe assumption if page navigation is occurring. As
804         such, we need a null check for the mainframe's document in needsPlaybackControlsManagerQuirk().
805
806         No test, as we were unable to reproduce this crash.
807
808         * html/HTMLMediaElement.cpp:
809         (WebCore::needsPlaybackControlsManagerQuirk):
810
811 2017-02-02  Chris Dumez  <cdumez@apple.com>
812
813         Suspend SVG animations in hidden pages
814         https://bugs.webkit.org/show_bug.cgi?id=167763
815         <rdar://problem/29986313>
816
817         Reviewed by Simon Fraser.
818
819         Suspend SVG animations in hidden pages to save power, similarly to what
820         we already do for another types of animations.
821
822         Test: svg/animations/animations-paused-page-non-visible.html
823
824         * page/Page.cpp:
825         (WebCore::setSVGAnimationSuspended):
826         (WebCore::Page::setIsVisibleInternal):
827         * svg/SVGDocumentExtensions.cpp:
828         (WebCore::SVGDocumentExtensions::pauseAnimations):
829         (WebCore::SVGDocumentExtensions::unpauseAnimations):
830         * svg/SVGDocumentExtensions.h:
831         (WebCore::SVGDocumentExtensions::areAnimationsPaused):
832         * testing/Internals.cpp:
833         (WebCore::Internals::areSVGAnimationsPaused):
834         * testing/Internals.h:
835         * testing/Internals.idl:
836
837 2017-02-02  Commit Queue  <commit-queue@webkit.org>
838
839         Unreviewed, rolling out r211596 and r211605.
840         https://bugs.webkit.org/show_bug.cgi?id=167767
841
842         This change broke certain build configurations (Requested by
843         ryanhaddad on #webkit).
844
845         Reverted changesets:
846
847         "[Mac] Add classes to manage audio samples"
848         https://bugs.webkit.org/show_bug.cgi?id=167739
849         http://trac.webkit.org/changeset/211596
850
851         "Unreviewed speculative build fix."
852         http://trac.webkit.org/changeset/211605
853
854 2017-02-02  Ryan Haddad  <ryanhaddad@apple.com>
855
856         Unreviewed speculative build fix.
857
858         * platform/audio/mac/AudioSampleDataSource.cpp:
859         (WebCore::AudioSampleDataSource::setupConverter):
860         (WebCore::AudioSampleDataSource::pushSamples):
861
862 2017-02-02  Alex Christensen  <achristensen@webkit.org>
863
864         Build libwebrtc and dependencies with Xcode
865         https://bugs.webkit.org/show_bug.cgi?id=167758
866
867         Reviewed by Dean Jackson.
868
869         * WebCore.xcodeproj/project.pbxproj:
870
871 2017-02-02  Chris Dumez  <cdumez@apple.com>
872
873         {}.toString.call(crossOriginWindow) should return "[object Object]"
874         https://bugs.webkit.org/show_bug.cgi?id=167701
875         <rdar://problem/30330797>
876
877         Reviewed by Keith Miller.
878
879         {}.toString.call() to should "[object Object] for cross origin
880         Window / Location objects. This new behavior is consistent with
881         Firefox and Chrome.
882
883         No new tests, rebaselined existing tests.
884
885         * bindings/js/JSDOMWindowCustom.cpp:
886         (WebCore::JSDOMWindow::toStringName):
887         * bindings/js/JSLocationCustom.cpp:
888         (WebCore::JSLocation::toStringName):
889         * bindings/scripts/CodeGeneratorJS.pm:
890         (GenerateHeader):
891         * bindings/scripts/IDLAttributes.txt:
892         * page/DOMWindow.idl:
893         * page/Location.idl:
894
895 2017-02-02  Wenson Hsieh  <wenson_hsieh@apple.com>
896
897         Drag images should be anchored to the mouse location
898         https://bugs.webkit.org/show_bug.cgi?id=167690
899         <rdar://problem/30295261>
900
901         Reviewed by Enrica Casucci.
902
903         Adds logic to compute the mouse anchor point. This is a point in the unit square indicating where the drag
904         origin is relative to the bounds of the drag image. There is no behavior change, since this anchor point is not
905         used by any client yet; this patch only computes and vends this information from WebCore.
906
907         * loader/EmptyClients.cpp:
908         * page/DragClient.h:
909         * page/DragController.cpp:
910         (WebCore::DragController::startDrag):
911         (WebCore::DragController::doImageDrag):
912         (WebCore::DragController::doSystemDrag):
913         * page/DragController.h:
914         * platform/DragImage.h:
915
916 2017-02-02  Eric Carlson  <eric.carlson@apple.com>
917
918         [Mac] Add classes to manage audio samples
919         https://bugs.webkit.org/show_bug.cgi?id=167739
920
921         Reviewed by Jer Noble.
922
923         No new tests, this code isn't used yet.
924
925         * WebCore.xcodeproj/project.pbxproj:
926         * platform/audio/mac/AudioSampleBufferList.cpp: Added.
927         (WebCore::AudioSampleBufferList::create):
928         (WebCore::AudioSampleBufferList::AudioSampleBufferList):
929         (WebCore::AudioSampleBufferList::~AudioSampleBufferList):
930         (WebCore::AudioSampleBufferList::setSampleCount):
931         (WebCore::AudioSampleBufferList::applyGain):
932         (WebCore::AudioSampleBufferList::mixFrom):
933         (WebCore::AudioSampleBufferList::copyFrom):
934         (WebCore::AudioSampleBufferList::copyTo):
935         (WebCore::AudioSampleBufferList::reset):
936         (WebCore::AudioSampleBufferList::zero):
937         (WebCore::AudioSampleBufferList::zeroABL):
938         (WebCore::AudioSampleBufferList::convertInput):
939         (WebCore::AudioSampleBufferList::audioConverterCallback):
940         (WebCore::AudioSampleBufferList::configureBufferListForStream):
941         * platform/audio/mac/AudioSampleBufferList.h: Added.
942         (WebCore::AudioSampleBufferList::streamDescription):
943         (WebCore::AudioSampleBufferList::bufferList):
944         (WebCore::AudioSampleBufferList::sampleCapacity):
945         (WebCore::AudioSampleBufferList::sampleCount):
946         (WebCore::AudioSampleBufferList::timestamp):
947         (WebCore::AudioSampleBufferList::hostTime):
948         (WebCore::AudioSampleBufferList::setTimes):
949         (WebCore::AudioSampleBufferList::audioBufferListSizeForStream):
950         * platform/audio/mac/AudioSampleDataSource.cpp: Added.
951         (WebCore::AudioSampleDataSource::create):
952         (WebCore::AudioSampleDataSource::AudioSampleDataSource):
953         (WebCore::AudioSampleDataSource::~AudioSampleDataSource):
954         (WebCore::AudioSampleDataSource::setPaused):
955         (WebCore::AudioSampleDataSource::setupConverter):
956         (WebCore::AudioSampleDataSource::setInputFormat):
957         (WebCore::AudioSampleDataSource::setOutputFormat):
958         (WebCore::AudioSampleDataSource::hostTime):
959         (WebCore::AudioSampleDataSource::pushSamplesInternal):
960         (WebCore::AudioSampleDataSource::pushSamples):
961         (WebCore::AudioSampleDataSource::pullSamplesInternal):
962         (WebCore::AudioSampleDataSource::pullSamples):
963         * platform/audio/mac/AudioSampleDataSource.h: Added.
964         (WebCore::AudioSampleDataSource::setVolume):
965         (WebCore::AudioSampleDataSource::volume):
966         (WebCore::AudioSampleDataSource::setMuted):
967         (WebCore::AudioSampleDataSource::muted):
968
969 2017-02-02  Joseph Pecoraro  <pecoraro@apple.com>
970
971         Support Performance API (performance.now(), UserTiming) in Workers
972         https://bugs.webkit.org/show_bug.cgi?id=167717
973
974         Reviewed by Ryosuke Niwa.
975
976         Tests: performance-api/performance-mark-name.html
977                performance-api/performance-now-api.html
978                performance-api/performance-now-time-origin-in-worker.html
979                performance-api/user-timing-apis.html
980
981         * CMakeLists.txt:
982         * DerivedSources.make:
983         New files.
984
985         * page/DOMWindow.idl:
986         * page/GlobalPerformance.idl:
987         * workers/WorkerGlobalScope.idl:
988         Add partial interface for performance attribute.
989
990         * page/Performance.idl:
991         * page/PerformanceEntry.idl:
992         * page/PerformanceMark.idl:
993         * page/PerformanceMeasure.idl:
994         * page/PerformanceObserver.idl:
995         * page/PerformanceObserverEntryList.idl:
996         Expose these to Workers.
997
998         * page/Performance.cpp:
999         (WebCore::Performance::Performance):
1000         (WebCore::Performance::contextDestroyed):
1001         * page/Performance.h:
1002         Use the EventQueue variant that works with any ScriptExectionContext.
1003
1004         * page/PerformanceObserver.cpp:
1005         (WebCore::PerformanceObserver::PerformanceObserver):
1006         Get the Performance base in a Worker context.
1007
1008         * page/PerformanceUserTiming.cpp:
1009         (WebCore::UserTiming::mark):
1010         Only reject legacy special mark names in a Window, not a Worker.
1011
1012         (WebCore::UserTiming::findExistingMarkStartTime):
1013         Simple implementation returns 0 as the start time in Workers. The spec
1014         is currently imprecise here, but it does not have the unusual
1015         PerformanceTiming behavior in a Window which is part of User Timing 1.
1016
1017         * workers/Worker.cpp:
1018         (WebCore::Worker::create):
1019         (WebCore::Worker::notifyFinished):
1020         * workers/Worker.h:
1021         Record the moment of Worker creation.
1022
1023         * workers/WorkerGlobalScope.cpp:
1024         (WebCore::WorkerGlobalScope::WorkerGlobalScope):
1025         (WebCore::WorkerGlobalScope::performance):
1026         * workers/WorkerGlobalScope.h:
1027         Construct the Performance object with the moment of creation (timeOrigin).
1028
1029         * workers/DedicatedWorkerGlobalScope.cpp:
1030         (WebCore::DedicatedWorkerGlobalScope::create):
1031         (WebCore::DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope):
1032         * workers/DedicatedWorkerGlobalScope.h:
1033         * workers/DedicatedWorkerThread.cpp:
1034         (WebCore::DedicatedWorkerThread::DedicatedWorkerThread):
1035         (WebCore::DedicatedWorkerThread::createWorkerGlobalScope):
1036         * workers/DedicatedWorkerThread.h:
1037         * workers/WorkerGlobalScopeProxy.h:
1038         * workers/WorkerMessagingProxy.cpp:
1039         (WebCore::WorkerMessagingProxy::startWorkerGlobalScope):
1040         * workers/WorkerMessagingProxy.h:
1041         * workers/WorkerThread.cpp:
1042         (WebCore::WorkerThreadStartupData::WorkerThreadStartupData):
1043         (WebCore::WorkerThread::WorkerThread):
1044         (WebCore::WorkerThread::workerThread):
1045         * workers/WorkerThread.h:
1046         Pass the moment of creation (timeOrigin) through to WorkerGlobalScope creation.
1047
1048 2017-02-02  Commit Queue  <commit-queue@webkit.org>
1049
1050         Unreviewed, rolling out r211579.
1051         https://bugs.webkit.org/show_bug.cgi?id=167753
1052
1053         Caused mediastream crashes. (Requested by bfulgham_ on
1054         #webkit).
1055
1056         Reverted changeset:
1057
1058         "Correct memory leak in MediaConstraints"
1059         https://bugs.webkit.org/show_bug.cgi?id=167744
1060         http://trac.webkit.org/changeset/211579
1061
1062 2017-02-02  Chris Dumez  <cdumez@apple.com>
1063
1064         Rename Node::inDocument() to isConnected()
1065         https://bugs.webkit.org/show_bug.cgi?id=167743
1066
1067         Reviewed by Sam Weinig.
1068
1069         Rename Node::inDocument() to isConnected() to match the DOM specification more closely:
1070         - https://dom.spec.whatwg.org/#connected
1071
1072 2017-02-02  Antoine Quint  <graouts@apple.com>
1073
1074         [Modern Media Controls] Provide a compact mode for when the controls are small
1075         https://bugs.webkit.org/show_bug.cgi?id=167746
1076         <rdar://problem/29565842>
1077
1078         Reviewed by Dean Jackson.
1079
1080         When the macOS inline media controls become too narrow to display both the volume and fullscreen
1081         buttons in their right container (width < 242), we switch to a compact mode where the controls bar
1082         is shorter and the buttons smaller.
1083
1084         To facilitate this, we provide a new subclass of MacOSInlineMediaControls called MacOSCompactInlineMediaControls
1085         which changes some of the layout properties of the buttons to have shorter margins around buttons.
1086
1087         We also added a new "Compact" LayoutTrait and improved IconService to provide specific icons
1088         for this mode for the buttons that can exist in compact mode. 
1089
1090         To correctly implement the design, we needed to add a way to provide different margins around the
1091         left and right edges of the container, so the "padding" property is now split between "leftMargin"
1092         and "rightMargin", and to make property naming cleaner, the "margin" property which specifies the
1093         space between each button in a container is now called "buttonMargin". We also set the default
1094         values for those properties to be 24 (instead of 0) which are the most widely used values, requiring
1095         less customization.
1096
1097         Tests: media/modern-media-controls/macos-compact-inline-media-controls/macos-compact-inline-media-controls-buttons-styles.html
1098                media/modern-media-controls/macos-compact-inline-media-controls/macos-compact-inline-media-controls-constructor.html
1099                media/modern-media-controls/macos-compact-inline-media-controls/macos-compact-inline-media-controls-controls-bar-styles.html
1100                media/modern-media-controls/macos-compact-inline-media-controls/macos-compact-inline-media-controls-layout.html
1101                media/modern-media-controls/macos-compact-inline-media-controls/macos-compact-inline-media-controls-volume-styles.html
1102                media/modern-media-controls/media-controller/media-controller-toggle-compact-mode.html
1103
1104         * Modules/modern-media-controls/controls/buttons-container.js:
1105         (ButtonsContainer.prototype.layout): Refactor the "margin" and "padding" properties into
1106         "leftMargin", "rightMargin" and "buttonMargin".
1107         * Modules/modern-media-controls/controls/icon-button.js:
1108         (IconButton.prototype._updateImage): Fix a small bug that would prevent the image source
1109         change to occur after changing the "iconName" property should the previous and new icons
1110         share the same metrics, which is the case for the "play" and "pause" icons in compact mode.
1111         * Modules/modern-media-controls/controls/icon-service.js: Add support for compact variants.
1112         (const.iconService.new.IconService.prototype._fileNameAndPlatformForIconNameAndLayoutTraits):
1113         (const.iconService.new.IconService):
1114         * Modules/modern-media-controls/controls/ios-inline-media-controls.js: Adopt new margin defaults.
1115         * Modules/modern-media-controls/controls/layout-item.js: Add the new "Compact" LayoutTrait.
1116         * Modules/modern-media-controls/controls/macos-compact-inline-media-controls.css: Added.
1117         (.media-controls.mac.inline.compact > .controls-bar):
1118         (.media-controls.mac.inline.compact button.play-pause):
1119         (.media-controls.mac.inline.compact button.skip-back):
1120         (.media-controls.mac.inline.compact .scrubber.slider):
1121         (.media-controls.mac.inline.compact button.mute):
1122         (.media-controls.mac.inline.compact button.fullscreen):
1123         (.media-controls.mac.inline.compact .time-label,):
1124         (.media-controls.mac.inline.compact .volume-slider-container):
1125         (.media-controls.mac.inline.compact .volume.slider):
1126         (.media-controls.mac.inline.compact .scrubber.slider > input::-webkit-slider-thumb):
1127         * Modules/modern-media-controls/controls/macos-compact-inline-media-controls.js: Added.
1128         (MacOSCompactInlineMediaControls):
1129         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js: Adopt new margin defaults.
1130         (MacOSFullscreenMediaControls.prototype.layout):
1131         * Modules/modern-media-controls/controls/macos-inline-media-controls.js: Adopt new margin defaults
1132         and make the _leftContainer and _rightContainer properties public such that the MacOSCompactInlineMediaControls
1133         subclass may customize them without accessing a private property.
1134         (MacOSInlineMediaControls.prototype.layout):
1135         (MacOSInlineMediaControls.prototype.showTracksPanel):
1136         * Modules/modern-media-controls/images/macOS/enter-fullscreen-compact@1x.png: Added.
1137         * Modules/modern-media-controls/images/macOS/enter-fullscreen-compact@2x.png: Added.
1138         * Modules/modern-media-controls/images/macOS/interval-skip-back-compact@1x.png: Added.
1139         * Modules/modern-media-controls/images/macOS/interval-skip-back-compact@2x.png: Added.
1140         * Modules/modern-media-controls/images/macOS/pause-compact@1x.png: Added.
1141         * Modules/modern-media-controls/images/macOS/pause-compact@2x.png: Added.
1142         * Modules/modern-media-controls/images/macOS/play-compact@1x.png: Added.
1143         * Modules/modern-media-controls/images/macOS/play-compact@2x.png: Added.
1144         * Modules/modern-media-controls/images/macOS/volume-compact@1x.png: Added.
1145         * Modules/modern-media-controls/images/macOS/volume-compact@2x.png: Added.
1146         * Modules/modern-media-controls/js-files: Add the new files so they are concatenated by the build script.
1147         * Modules/modern-media-controls/media/media-controller.js: Toggle compact mode if controls
1148         are below the 242px width threshold.
1149         (MediaController.prototype.get layoutTraits):
1150         (MediaController.prototype.handleEvent):
1151         (MediaController.prototype._updateControlsIfNeeded):
1152         (MediaController.prototype._shouldFadeBetweenControls):
1153         (MediaController.prototype._updateControlsSize):
1154         (MediaController.prototype._controlsWidth):
1155         (MediaController.prototype._controlsClass):
1156         (MediaController):
1157         * WebCore.xcodeproj/project.pbxproj: Add new files and perform some cleanup so that the
1158         project accurately lists all the existing project files and remove some older ones.
1159
1160 2017-02-02  Commit Queue  <commit-queue@webkit.org>
1161
1162         Unreviewed, rolling out r211571 and r211582.
1163         https://bugs.webkit.org/show_bug.cgi?id=167751
1164
1165         This change caused API test WebKit1.MemoryPressureHandler to
1166         fail with an assertion. (Requested by ryanhaddad on #webkit).
1167
1168         Reverted changesets:
1169
1170         "[Mac] In-process memory pressure monitor for WebContent
1171         processes."
1172         https://bugs.webkit.org/show_bug.cgi?id=167491
1173         http://trac.webkit.org/changeset/211571
1174
1175         "Unreviewed attempt to fix the Windows build after r211571."
1176         http://trac.webkit.org/changeset/211582
1177
1178 2017-02-02  Chris Dumez  <cdumez@apple.com>
1179
1180         Unreviewed attempt to fix the Windows build after r211571.
1181
1182         * platform/MemoryPressureHandler.cpp:
1183         (WebCore::thresholdForPolicy):
1184         (WebCore::policyForFootprint):
1185
1186 2017-02-02  Brent Fulgham  <bfulgham@apple.com>
1187
1188         Correct memory leak in MediaConstraints
1189         https://bugs.webkit.org/show_bug.cgi?id=167744
1190         <rdar://problem/30331444>
1191
1192         Reviewed by Anders Carlsson.
1193
1194         ConstraintHolder returns a reference to an object created by operator new. When the
1195         returned value is assigned or stored in Vector or other containers we leak memory.
1196         Instead, this value should just be returned as a regular object so that the return
1197         value optimization can make sure memory is properly (and efficiently) used.
1198
1199         * platform/mediastream/MediaConstraints.h:
1200         (WebCore::FlattenedConstraint::ConstraintHolder::create): Return by value.
1201
1202 2017-02-02  Andreas Kling  <akling@apple.com>
1203
1204         [Mac] In-process memory pressure monitor for WebContent processes AKA websam
1205         <https://webkit.org/b/167491>
1206         <rdar://problem/30116072>
1207
1208         Reviewed by Antti Koivisto.
1209
1210         Add a new timer-based memory pressure monitor that checks the process memory
1211         footprint every 30 seconds and reacts to changes by setting a MemoryUsagePolicy.
1212
1213         There are four MemoryUsagePolicy values:
1214
1215             - Unrestricted (below 1GB)
1216             - Conservative (above 1GB)
1217             - Strict (above 2GB)
1218             - Panic (above 4GB, or 3GB if 32-bit)
1219
1220         For Strict and above, the old-style "isUnderMemoryPressure()" API will return true.
1221
1222         Transitioning to a higher policy will cause memory pressure handlers to run:
1223
1224         At Strict, we run the "non-critical" memory pressure handler, then carry on.
1225
1226         At Panic, we run the "critical" memory pressure handler. If that fails to recover
1227         enough memory to bring us back below 4GB, we may kill the process:
1228
1229         A process is eligible to get killed for using too much memory if:
1230
1231             - It's not visible on screen (i.e it's a background tab.)
1232             - It's not playing audio.
1233             - It has not performed a main frame navigation in the last hour.
1234
1235         Before killing the process, an exit-time callback will run. This patch installs such
1236         a callback that prints out some time-of-death statistics about C++ and JavaScript memory
1237         usage to hopefully help understand what was soaking up all the memory.
1238
1239         * bindings/js/CommonVM.cpp:
1240         (WebCore::commonVMSlow):
1241         * loader/FrameLoader.cpp:
1242         (WebCore::FrameLoader::setState):
1243         * page/MainFrame.cpp:
1244         (WebCore::MainFrame::didCompleteLoad):
1245         * page/MainFrame.h:
1246         * page/MemoryRelease.cpp:
1247         (WebCore::pageCount):
1248         (WebCore::logMemoryStatisticsAtTimeOfDeath):
1249         (WebCore::didExceedMemoryLimitAndFailedToRecover):
1250         (WebCore::processIsEligibleForMemoryKill):
1251         * page/MemoryRelease.h:
1252         * page/ResourceUsageThread.h:
1253         * page/cocoa/ResourceUsageThreadCocoa.mm:
1254         (WebCore::vmPageSize):
1255         * platform/MemoryPressureHandler.cpp:
1256         (WebCore::MemoryPressureHandler::MemoryPressureHandler):
1257         (WebCore::MemoryPressureHandler::setShouldUsePeriodicMemoryMonitor):
1258         (WebCore::toString):
1259         (WebCore::thresholdForPolicy):
1260         (WebCore::policyForFootprint):
1261         (WebCore::MemoryPressureHandler::measurementTimerFired):
1262         * platform/MemoryPressureHandler.h:
1263         (WebCore::MemoryPressureHandler::setMemoryKillCallback):
1264         (WebCore::MemoryPressureHandler::setProcessIsEligibleForMemoryKillCallback):
1265         (WebCore::MemoryPressureHandler::isUnderMemoryPressure):
1266
1267 2017-02-02  Chris Dumez  <cdumez@apple.com>
1268
1269         [Crash] com.apple.WebKit.WebContent at WebKit: WebKit::WebPage::fromCorePage()
1270         https://bugs.webkit.org/show_bug.cgi?id=167738
1271         <rdar://problem/30229990>
1272
1273         Reviewed by Andreas Kling.
1274
1275         Upon destruction of a Page, we destroy the BackForwardClient, which is supposed
1276         to keep track of HistoryItems associated to this particular page and remove them
1277         from the PageCache. Given the crash trace, the issue seems to be that some
1278         HistoryItems associated with the Page sometimes linger in the PageCache *after*
1279         the Page has been destroyed, which leads to crashes later on when pruning the
1280         PageCache.
1281
1282         In order to make the process more robust, this patch refactors the code so that
1283         the Page is now in charge of removing all its associated HistoryItems from the
1284         PageCache instead of relying on the BackForwardClient. Also, instead of having
1285         the Page keep track of which HistoryItems are associated with it (which is
1286         error prone), we now scan all PageCache entries instead to find which ones are
1287         associated with the Page. While this is in theory slower, this is much safer
1288         and in practice not an issue because the PageCache usually has 3-5 entries.
1289
1290         No new tests, could not reproduce.
1291
1292         * history/CachedPage.cpp:
1293         (WebCore::CachedPage::CachedPage):
1294         * history/CachedPage.h:
1295         (WebCore::CachedPage::page):
1296         * history/PageCache.cpp:
1297         (WebCore::PageCache::removeAllItemsForPage):
1298         * history/PageCache.h:
1299         * page/Page.cpp:
1300         (WebCore::Page::~Page):
1301
1302 2017-02-02  Antti Koivisto  <antti@apple.com>
1303
1304         Column progression wrong after enabling pagination on RTL document
1305         https://bugs.webkit.org/show_bug.cgi?id=167733
1306         <rdar://problem/29012252>
1307
1308         Reviewed by Zalan Bujtas.
1309
1310         Column progression depends on document direction but was not updated when direction changed.
1311
1312         Test: fast/multicol/pagination/pagination-dynamic-rtl.html
1313
1314         * rendering/RenderBox.cpp:
1315         (WebCore::RenderBox::styleDidChange):
1316
1317             Update column styles if document direction changes.
1318
1319 2017-02-02  Xabier Rodriguez Calvar  <calvaris@igalia.com>
1320
1321         [EME][GStreamer] Fixed decryptor selection
1322         https://bugs.webkit.org/show_bug.cgi?id=167588
1323
1324         Reviewed by Žan Doberšek.
1325
1326         GStreamer selected a decryptor automatically but we need to be
1327         able to tell it which decryptor we want because one file can be
1328         encrypted with more than one system and the one we want to use can
1329         depend on what the user tells us.
1330
1331         Now when the demuxer is about to select the demuxer, it runs a
1332         GstContext query with the events, which are forwarded through the
1333         EME api to the application, which will answer the the
1334         generateKeyRequest and then we can instruct the demuxer to select
1335         the one we tell it, not the one that is selected automatically. If
1336         the demuxer has already a preferred decryptor, the codepath will
1337         be similar to the older one.
1338
1339         Something that is also fixed is the report of the keyneeded event,
1340         which will contain all pssh boxes as requested by the spec.
1341
1342         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1343         (WebCore::MediaPlayerPrivateGStreamer::handleMessage): Intercept
1344         the event and handle it.
1345         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1346         (WebCore::MediaPlayerPrivateGStreamerBase::MediaPlayerPrivateGStreamerBase):
1347         Initialize the CDM session.
1348         (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):
1349         Unlock the protection condition just in case and set CDM to null.
1350         (WebCore::extractEventsAndSystemsFromMessage): Access the events
1351         and accepted key systems coming at the message from the demuxer.
1352         (WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage):
1353         Handle the protection event not as an element event but as a
1354         context request. It also concatenates all the initdatas in case
1355         there is more than one. The event is sent in the main thread and
1356         the current one blocks until a timeout is hit or the
1357         generateKeyRequest is called.
1358         (WebCore::MediaPlayerPrivateGStreamerBase::handleProtectionEvent):
1359         Check if the event was already handled and if not, run the need
1360         key event.
1361         (WebCore::MediaPlayerPrivateGStreamerBase::receivedGenerateKeyRequest):
1362         Notify the that the query arrived so that we can unlock the
1363         demuxer thread.
1364         (WebCore::keySystemIdToUuid): Translates ids to uuids, meaning
1365         the ones coming from JS to the ones coming from the media engine.
1366         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
1367         Attributes and methods.
1368         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
1369         (webkit_media_clear_key_decrypt_class_init):
1370         (webKitMediaClearKeyDecryptorRequestDecryptionKey): Deleted.
1371         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.h:
1372         Added the ui and uuid.
1373         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
1374         (webkitMediaCommonEncryptionDecryptSinkEventHandler): Do not rely
1375         on the subclass, just forward the event to the pipeline inside a message.
1376         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.h:
1377         Remove unused function signature.
1378         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
1379         (WebCore::appendPipelineNeedContextMessageCallback): Renamed from
1380         appendPipelineElementMessageCallback.
1381         (WebCore::AppendPipeline::AppendPipeline): Connect to the
1382         need-context message instead of the element one.
1383         (WebCore::AppendPipeline::dispatchPendingDecryptionKey):
1384         Dispatches the drm-cypher message if there is one pending.
1385         (WebCore::AppendPipeline::dispatchDecryptionKey): Dispatches the
1386         drm-cypher.
1387         (WebCore::AppendPipeline::handleNeedContextSyncMessage): Handles
1388         the need-context event instead of the element one.
1389         (WebCore::AppendPipeline::connectDemuxerSrcPadToAppsinkFromAnyThread):
1390         Dispatches the key to the pipeline if there's any pending.
1391         (WebCore::appendPipelineElementMessageCallback): Deleted.
1392         (WebCore::AppendPipeline::handleElementMessage): Deleted.
1393         * platform/graphics/gstreamer/mse/AppendPipeline.h: New methods
1394         and attributes.
1395         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
1396         (WebCore::MediaPlayerPrivateGStreamerMSE::dispatchDecryptionKey):
1397         Use the dispatchDecryptionKey method of the AppendPipeline.
1398
1399 2017-02-02  Joseph Pecoraro  <pecoraro@apple.com>
1400
1401         Removed unused EventHandler members
1402         https://bugs.webkit.org/show_bug.cgi?id=167723
1403
1404         Reviewed by Yusuke Suzuki.
1405
1406         * page/EventHandler.cpp:
1407         (WebCore::EventHandler::clear):
1408         (WebCore::EventHandler::handleWheelEvent):
1409         * page/EventHandler.h:
1410         Remove unused members.
1411
1412         * editing/FrameSelection.cpp:
1413         * html/HTMLTextAreaElement.cpp:
1414         * rendering/RenderObject.cpp:
1415         * rendering/RenderSlider.cpp:
1416         Remove unnecessary includes.
1417
1418 2017-02-02  Joseph Pecoraro  <pecoraro@apple.com>
1419
1420         Removed unused m_navigationStart from NavigatorGamepad
1421         https://bugs.webkit.org/show_bug.cgi?id=167722
1422
1423         Reviewed by Yusuke Suzuki.
1424
1425         * Modules/gamepad/NavigatorGamepad.cpp:
1426         (WebCore::NavigatorGamepad::NavigatorGamepad):
1427         (WebCore::NavigatorGamepad::from):
1428         * Modules/gamepad/NavigatorGamepad.h:
1429         (WebCore::NavigatorGamepad::navigationStart): Deleted.
1430
1431 2017-02-02  Yongjun Zhang  <yongjun_zhang@apple.com>
1432
1433         In iOS, we should take background assertion when accessing localstorage databases.
1434         https://bugs.webkit.org/show_bug.cgi?id=165478
1435
1436         Move WebSQLiteDatabaseTrackerClient from WebKitLegacy to WebCore so that it can be accessible from
1437         WebKit1 and WebKit2. Previously, to avoid dependencies on UIKit, WebKitLegacy introduced several
1438         global methods for UIKit to setup the start/end background task blocks on runtime (WebKitSetStartBackgroundTaskBlock,
1439         WebKitSetInvalidWebBackgroundTaskIdentifier and WebKitSetEndBackgroundTaskBlock). Since we have to
1440         move the background task handling to WebCore, to avoid adding WebCore dependencies on UIKit, this
1441         patch introdues a new WebCore class WebBackgroundTaskController which holds the start/end background
1442         task blocks. The existing WebKitSetStartBackgroundTaskBlock and WebKitSetEndBackgroundTaskBlock methods
1443         in WebKit1 will use WebBackgroundTaskController to store the blocks set by UIKit. 
1444
1445         Reviewed by Brady Eidson.
1446
1447         No new test since this is code refactoring.
1448
1449         * WebCore.xcodeproj/project.pbxproj: Add a new class WebBackgroundTaskController to the project. Also move
1450             WebSQLiteDatabaseTrackerClient from WebKitLegacy to WebCore.
1451         * platform/ios/WebBackgroundTaskController.h: Use properties to hold the blocks for starting or ending background tasks.
1452         * platform/ios/WebBackgroundTaskController.mm:
1453         (+[WebBackgroundTaskController sharedController]):
1454         (-[WebBackgroundTaskController dealloc]):
1455         (-[WebBackgroundTaskController startBackgroundTaskWithExpirationHandler:]): Start a background task with a expiration handler;
1456             to start the background task, we will use backgroundTaskStartBlock set up by UIKit.
1457         (-[WebBackgroundTaskController endBackgroundTaskWithIdentifier:]): Call backgroundTaskEndBlack to end a background task.
1458         * platform/ios/WebSQLiteDatabaseTrackerClient.h: Copied from Source/WebKit/ios/Storage/WebSQLiteDatabaseTrackerClient.h.
1459         * platform/ios/WebSQLiteDatabaseTrackerClient.mm: Copied from Source/WebKit/ios/Storage/WebSQLiteDatabaseTrackerClient.mm.
1460         (WebCore::WebSQLiteDatabaseTrackerClient::sharedWebSQLiteDatabaseTrackerClient): Make WebSQLiteDatabaseTrackerClient a singleton.
1461         (WebCore::WebSQLiteDatabaseTrackerClient::WebSQLiteDatabaseTrackerClient): 
1462         (WebCore::WebSQLiteDatabaseTrackerClient::~WebSQLiteDatabaseTrackerClient):
1463         (WebCore::WebSQLiteDatabaseTrackerClient::willBeginFirstTransaction): Use a utility class WebDatabaseTransactionBackgroundTaskController
1464             to schedule database transaction background task.
1465         (WebCore::WebSQLiteDatabaseTrackerClient::didFinishLastTransaction): Use WebDatabaseTransactionBackgroundTaskController to stop
1466             databas transaction background task.
1467         (transactionBackgroundTaskIdentifierLock: Moved from Source/WebKit/mac/Storage/WebDatabaseManager.mm.
1468         (setTransactionBackgroundTaskIdentifier): Ditto.
1469         (getTransactionBackgroundTaskIdentifier): Ditto.
1470         (+[WebDatabaseTransactionBackgroundTaskController startBackgroundTask]): Ditto.
1471         (+[WebDatabaseTransactionBackgroundTaskController endBackgroundTask]): Ditto.
1472
1473 2017-02-01  Zan Dobersek  <zdobersek@igalia.com>
1474
1475         [EME] Implement MediaKeySession::update()
1476         https://bugs.webkit.org/show_bug.cgi?id=167636
1477
1478         Reviewed by Xabier Rodriguez-Calvar.
1479
1480         Implement the MediaKeySession::update() method by following the steps as
1481         they are described in the specification.
1482
1483         In order to sanitize the passed-in response data, CDM::sanitizeResponse()
1484         is added. It passes the SharedBuffer object by reference to the CDMPrivate
1485         interface implementor, which returns a SharedBuffer object containing
1486         sanitized response data.
1487
1488         CDMInstance::updateLicense() virtual method is added to perform the license
1489         update for some specific CDMInstance object. After the update the CDMInstance
1490         invokes the callback that's passed to updateLicense(), providing information
1491         about session being closed, changed keys or expiration value, any message
1492         that has to be enqueued, and whether the update was successful.
1493
1494         After that callback is invoked, MediaKeySession::update() goes on to handle
1495         all the provided information in a future task, finally resolving the promise
1496         (or rejecting it beforehand in case of any failure during response handling
1497         or license update).
1498
1499         Three algorithms that can be invoked from MediaKeySession::update() (key
1500         status update, expiration update and session closure) will be implemented
1501         separately. Placeholder methods are provided until then.
1502
1503         MockCDM::sanitizeResponse() and MockCDMInstance::updateLicense() are
1504         implemented for testing purposes. For now only the response sanitization
1505         and sanitized response format are checked there. Key status update,
1506         expiration update and session closure should be tested once the
1507         implementations for those algorithms are added.
1508
1509         Test: media/encrypted-media/mock-MediaKeySession-update.html
1510
1511         * Modules/encryptedmedia/CDM.cpp:
1512         (WebCore::CDM::sanitizeResponse):
1513         * Modules/encryptedmedia/CDM.h:
1514         * Modules/encryptedmedia/CDMInstance.h:
1515         * Modules/encryptedmedia/CDMPrivate.h:
1516         * Modules/encryptedmedia/MediaKeySession.cpp:
1517         (WebCore::MediaKeySession::update):
1518         (WebCore::MediaKeySession::updateKeyStatuses):
1519         (WebCore::MediaKeySession::updateExpiration):
1520         (WebCore::MediaKeySession::sessionClosed):
1521         * Modules/encryptedmedia/MediaKeySession.h:
1522         * testing/MockCDMFactory.cpp:
1523         (WebCore::MockCDM::sanitizeResponse):
1524         (WebCore::MockCDMInstance::updateLicense):
1525         * testing/MockCDMFactory.h:
1526
1527 2017-02-01  Eric Carlson  <eric.carlson@apple.com>
1528
1529         [Mac] Update CARingBuffer class
1530         https://bugs.webkit.org/show_bug.cgi?id=167656
1531         <rdar://problem/30318329>
1532
1533         Unreviewed fix the 32-bit build after r211539.
1534
1535         * platform/audio/mac/CAAudioStreamDescription.cpp:
1536         (WebCore::CAAudioStreamDescription::CAAudioStreamDescription):
1537
1538 2017-02-01  Simon Fraser  <simon.fraser@apple.com>
1539
1540         [iOS WK2] With visual viewports, a fixed bottom bar can be clipped out when the keyboard is visible
1541         https://bugs.webkit.org/show_bug.cgi?id=167710
1542         rdar://problem/30100286
1543
1544         Reviewed by Wenson Hsieh.
1545         
1546         Add a bit of logging to show when RLC decides to not composite a fixed element which
1547         is out of bounds.
1548
1549         Test: fast/visual-viewport/ios/bottom-bar-with-keyboard.html
1550
1551         * rendering/RenderLayerCompositor.cpp:
1552         (WebCore::RenderLayerCompositor::requiresCompositingForPosition):
1553
1554 2017-02-01  Eric Carlson  <eric.carlson@apple.com>
1555
1556         [Mac] Update CARingBuffer class
1557         https://bugs.webkit.org/show_bug.cgi?id=167656
1558
1559         Unreviewed build fix after r211539.
1560
1561         * platform/audio/mac/CAAudioStreamDescription.cpp:
1562         (WebCore::CAAudioStreamDescription::CAAudioStreamDescription): Initialize a variable to fix
1563         release builds.
1564
1565 2017-02-01  Eric Carlson  <eric.carlson@apple.com>
1566
1567         [Mac] Update CARingBuffer class
1568         https://bugs.webkit.org/show_bug.cgi?id=167656
1569
1570         Reviewed by Jer Noble.
1571
1572         API test CARingBufferTest added.
1573
1574         * WebCore.xcodeproj/project.pbxproj: Add headers to framework so they can be used from the API test.
1575
1576         * platform/audio/AudioStreamDescription.h: Add Int32.
1577
1578         * platform/audio/mac/CAAudioStreamDescription.cpp:
1579         (WebCore::CAAudioStreamDescription::CAAudioStreamDescription):
1580         (WebCore::CAAudioStreamDescription::~CAAudioStreamDescription):
1581         (WebCore::CAAudioStreamDescription::format): Support Int32.
1582         (WebCore::CAAudioStreamDescription::operator==): Make inline.
1583         * platform/audio/mac/CAAudioStreamDescription.h:
1584
1585         * platform/audio/mac/CARingBuffer.cpp:
1586         (WebCore::CARingBuffer::CARingBuffer): Move initializers into class declaration.
1587         (WebCore::CARingBuffer::allocate): Use flush method, get allocation info from a CAAudioStreamDescription.
1588         (WebCore::FetchABL): Add a mode parameter to allow samples to replace or mix into destination.
1589         (WebCore::CARingBuffer::flush): New.
1590         (WebCore::CARingBuffer::fetch): Add mode parameter.
1591         (WebCore::CARingBuffer::~CARingBuffer): Deleted.
1592         * platform/audio/mac/CARingBuffer.h:
1593         (WebCore::CARingBuffer::~CARingBuffer):
1594
1595         * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm:
1596         (WebCore::AudioSourceProviderAVFObjC::prepare): Use new CARingBuffer constructor.
1597         (WebCore::operator==): Deleted.
1598         (WebCore::operator!=): Deleted.
1599
1600         * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm:
1601         (WebCore::WebAudioSourceProviderAVFObjC::prepare): Use new CARingBuffer constructor
1602         (WebCore::operator==): Deleted.
1603         (WebCore::operator!=): Deleted.
1604
1605 2017-02-01  Zalan Bujtas  <zalan@apple.com>
1606
1607         Simple line layout: Move TextFragmentIterator::runWidth to ::textWidth.
1608         https://bugs.webkit.org/show_bug.cgi?id=167705
1609         <rdar://problem/30314393>
1610
1611         Reviewed by Antti Koivisto.
1612
1613         We also don't need to compute logicalHeight for logicalLeft/right since the
1614         cases where it matters (floating boxes) are not supported by simple line layout. 
1615
1616         Covered by existing test.
1617
1618         * rendering/SimpleLineLayout.cpp:
1619         (WebCore::SimpleLineLayout::updateLineConstrains):
1620         * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
1621         (WebCore::SimpleLineLayout::nextBreakablePositionInSegment):
1622         (WebCore::SimpleLineLayout::TextFragmentIterator::textWidth):
1623         (WebCore::SimpleLineLayout::TextFragmentIterator::runWidth): Deleted.
1624         * rendering/SimpleLineLayoutTextFragmentIterator.h:
1625
1626 2017-02-01  Jer Noble  <jer.noble@apple.com>
1627
1628         Fix compilation error under recent clang update
1629         https://bugs.webkit.org/show_bug.cgi?id=167707
1630
1631         Reviewed by Eric Carlson.
1632
1633         Include TypedArrayInlines.h to fix a "missing symbol" link error when compiling under a recent clang update.
1634
1635         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
1636
1637 2017-02-01  Joseph Pecoraro  <pecoraro@apple.com>
1638
1639         Performance Timeline: Prepare for Worker support
1640         https://bugs.webkit.org/show_bug.cgi?id=167633
1641
1642         Reviewed by Ryosuke Niwa.
1643
1644         Remove references to Document/Frame in Performance. Instead use
1645         ScriptExecutionContext and pass in the time origin / SecurityOrigin
1646         where it is relevant. No tests should change this is just refactoring.
1647
1648         * loader/ResourceTimingInformation.cpp:
1649         (WebCore::ResourceTimingInformation::addResourceTiming):
1650         * page/DOMWindow.cpp:
1651         (WebCore::DOMWindow::performance):
1652         * page/Performance.cpp:
1653         (WebCore::Performance::Performance):
1654         (WebCore::Performance::now):
1655         (WebCore::Performance::reduceTimeResolution):
1656         (WebCore::Performance::navigation):
1657         (WebCore::Performance::timing):
1658         (WebCore::Performance::addResourceTiming):
1659         (WebCore::Performance::scriptExecutionContext): Deleted.
1660         * page/Performance.h:
1661         * page/Performance.idl:
1662         * page/PerformanceResourceTiming.cpp:
1663         (WebCore::monotonicTimeToDOMHighResTimeStamp):
1664         (WebCore::passesTimingAllowCheck):
1665         (WebCore::PerformanceResourceTiming::PerformanceResourceTiming):
1666         (WebCore::PerformanceResourceTiming::redirectStart):
1667         (WebCore::PerformanceResourceTiming::redirectEnd):
1668         (WebCore::PerformanceResourceTiming::fetchStart):
1669         (WebCore::PerformanceResourceTiming::domainLookupStart):
1670         (WebCore::PerformanceResourceTiming::domainLookupEnd):
1671         (WebCore::PerformanceResourceTiming::connectStart):
1672         (WebCore::PerformanceResourceTiming::connectEnd):
1673         (WebCore::PerformanceResourceTiming::secureConnectionStart):
1674         (WebCore::PerformanceResourceTiming::requestStart):
1675         (WebCore::PerformanceResourceTiming::responseStart):
1676         (WebCore::PerformanceResourceTiming::responseEnd):
1677         (WebCore::PerformanceResourceTiming::networkLoadTimeToDOMHighResTimeStamp):
1678         (WebCore::monotonicTimeToDocumentMilliseconds): Deleted.
1679         (WebCore::PerformanceResourceTiming::initiatorType): Deleted.
1680         (WebCore::PerformanceResourceTiming::resourceTimeToDocumentMilliseconds): Deleted.
1681         * page/PerformanceResourceTiming.h:
1682         * page/PerformanceUserTiming.cpp:
1683         (WebCore::UserTiming::findExistingMarkStartTime):
1684
1685 2017-02-01  Chris Dumez  <cdumez@apple.com>
1686
1687         REGRESSION(r205136): {}.toString.call(crossOriginWindow) should not throw
1688         https://bugs.webkit.org/show_bug.cgi?id=167681
1689         <rdar://problem/30301117>
1690
1691         Reviewed by Mark Lam.
1692
1693         As per https://html.spec.whatwg.org/#crossorigingetownpropertyhelper-(-o,-p-):
1694         """
1695         If P is @@toStringTag, @@hasInstance, or @@isConcatSpreadable, then return
1696         PropertyDescriptor{ [[Value]]: undefined, [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
1697         """
1698
1699         We now implement this behavior instead of throwing.
1700
1701         Test: http/tests/security/symbols-cross-origin.html
1702
1703         * bindings/js/JSDOMWindowCustom.cpp:
1704         (WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess):
1705         * bindings/js/JSLocationCustom.cpp:
1706         (WebCore::JSLocation::getOwnPropertySlotDelegate):
1707
1708 2017-02-01  Brent Fulgham  <bfulgham@apple.com>
1709
1710         Correct "filesHaveSameVolume" predicate
1711         https://bugs.webkit.org/show_bug.cgi?id=167696
1712         <rdar://problem/30298722>
1713
1714         Reviewed by David Kilzer.
1715
1716         We are passing %-encoded strings to the underlying operating system's file system APIs.
1717         This doesn't work. Instead, we need to present a decoded version of the file path
1718         that matches what the system APIs expect.
1719
1720         Tested by new TestWebKitAPI Test.
1721
1722         * platform/FileSystem.cpp:
1723         (WebCore::filesHaveSameVolume): Make sure the file paths we give to the underlying
1724         operating system are not percent encoded.
1725         * platform/FileSystem.h: Export 'filesHaveSameVolume' for use by testing system.
1726
1727 2017-02-01  Antoine Quint  <graouts@apple.com>
1728
1729         [mac-wk1] LayoutTest media/modern-media-controls/tracks-support/tracks-support-click-track-in-panel.html is a flaky timeout
1730         https://bugs.webkit.org/show_bug.cgi?id=165319
1731         <rdar://problem/30284104>
1732
1733         Reviewed by Dean Jackson.
1734
1735         Running media/controls/track-menu.html before media/modern-media-controls/tracks-support/tracks-
1736         support-click-track-in-panel.html makes that test time out in all test runs. The root of the issue
1737         is that animations are suspended by media/controls/track-menu.html with a call to
1738         internals.suspendAnimations(), and that state isn't reset with a call to internals.resumeAnimations().
1739         Then, media/modern-media-controls/tracks-support/tracks-support-click-track-in-panel.html fails because
1740         the selection animation for the tracks panel menu item that is clicked never completes and the delegate
1741         to notify that an item in the tracks panel was selected is never fired, which leads to the test failure.
1742
1743         We change Internals::suspendAnimations() and Internals::resumeAnimations() to only affect the current
1744         document, rather than calling into AnimationController::suspendAnimations() which would do just that,
1745         but also set a Frame-wide flag that would prevent further animations from running, even in a subsequent
1746         document load.
1747
1748         * dom/Document.cpp:
1749         (WebCore::Document::prepareForDestruction): Ensure the document that is about to be destroyed is no longer
1750         associated with an AnimationController.
1751         * page/animation/AnimationController.cpp:
1752         (WebCore::AnimationControllerPrivate::ensureCompositeAnimation): Update the animation's suspend state in case
1753         the document its renderer is associated with is suspended. This is required since previously CompositeAnimations
1754         would set their suspend state in their constructor, based on the Frame-wide suspended state, but there is no
1755         document to use as a basis to query its suspended state in that constructor.
1756         (WebCore::AnimationControllerPrivate::animationsAreSuspendedForDocument):
1757         (WebCore::AnimationControllerPrivate::detachFromDocument):
1758         (WebCore::AnimationControllerPrivate::suspendAnimationsForDocument):
1759         (WebCore::AnimationControllerPrivate::resumeAnimationsForDocument):
1760         (WebCore::AnimationControllerPrivate::startAnimationsIfNotSuspended):
1761         (WebCore::AnimationController::animationsAreSuspendedForDocument):
1762         (WebCore::AnimationController::detachFromDocument):
1763         * page/animation/AnimationController.h:
1764         * page/animation/AnimationControllerPrivate.h:
1765         * testing/Internals.cpp:
1766         (WebCore::Internals::animationsAreSuspended):
1767         (WebCore::Internals::suspendAnimations):
1768         (WebCore::Internals::resumeAnimations):
1769
1770 2017-02-01  Ryan Haddad  <ryanhaddad@apple.com>
1771
1772         Unreviewed build fix after r211488.
1773
1774         * accessibility/AXObjectCache.h: Removed property svn:executable.
1775
1776 2017-02-01  Brent Fulgham  <bfulgham@apple.com>
1777
1778         Unreviewed build fix.
1779
1780         * html/HTMLMediaElement.h: Removed property svn:executable.
1781
1782 2017-02-01  Jer Noble  <jer.noble@apple.com>
1783
1784         NULL-deref crash in TextTrack::removeCue()
1785         https://bugs.webkit.org/show_bug.cgi?id=167615
1786
1787         Reviewed by Eric Carlson.
1788
1789         Test: http/tests/media/track-in-band-hls-metadata-crash.html
1790
1791         Follow-up to r211401. When passing around a reference to an object, the assumption is that
1792         the caller is retaining the underlying object. This breaks down for
1793         InbandDataTextTrack::removeDataCue(), which releases its own ownership of the cue object,
1794         then passes the reference to that object to its superclass to do further remove steps. The
1795         retain count of the cue can thus drop to zero within the scope of
1796         InbandTextTrack::removeCue(). Use "take" semantics to remove the cue from the
1797         m_incompleteCueMap without releasing ownership, and pass a reference to that retained object
1798         on to removeCue(), guaranteeing that the cue will not be destroyed until after the
1799         romeveDataCue() method returns.
1800
1801         * html/track/InbandDataTextTrack.cpp:
1802         (WebCore::InbandDataTextTrack::removeDataCue):
1803
1804 2017-02-01  Nan Wang  <n_wang@apple.com>
1805
1806         AX: Incorrect range from index and length in text controls when there are newlines
1807         https://bugs.webkit.org/show_bug.cgi?id=167677
1808         <rdar://problem/30300099>
1809
1810         Reviewed by Chris Fleizach.
1811
1812         When there are newlines in text controls, the VisiblePosition that is created
1813         from the index could be wrong. Because the index doesn't include the information 
1814         regarding a position's affinity. Fixed it by using CharacterOffset instead, since
1815         it doesn't require that information.
1816
1817         Test: accessibility/mac/range-for-contenteditable-newline.html
1818
1819         * accessibility/AXObjectCache.cpp:
1820         (WebCore::AXObjectCache::traverseToOffsetInRange):
1821         (WebCore::AXObjectCache::nextCharacterOffset):
1822         (WebCore::AXObjectCache::characterOffsetForIndex):
1823
1824 2017-02-01  Timothy Hatcher  <timothy@hatcher.name>
1825
1826         AXObjectCache is missing two functions at link time when !HAVE(ACCESSIBILITY)
1827         https://bugs.webkit.org/show_bug.cgi?id=167691
1828
1829         Reviewed by Chris Fleizach.
1830
1831         * accessibility/AXObjectCache.h:
1832         (WebCore::AXObjectCache::recomputeDeferredIsIgnored): Added empty stub.
1833         (WebCore::AXObjectCache::performDeferredIsIgnoredChange): Added empty stub.
1834
1835 2017-02-01  Timothy Hatcher  <timothy@hatcher.name>
1836
1837         HTMLMediaElement.h fails to build when ENABLE(MEDIA_CONTROLS_SCRIPT) is false
1838         https://bugs.webkit.org/show_bug.cgi?id=167689
1839
1840         Reviewed by Joseph Pecoraro.
1841
1842         * html/HTMLMediaElement.h: Move mediaControlsHost() into the ENABLE(MEDIA_CONTROLS_SCRIPT)
1843         block that is just above it to match m_mediaControlsHost.
1844
1845 2017-02-01  Romain Bellessort  <romain.bellessort@crf.canon.fr>
1846
1847         [Readable Streams API] Implement ReadableByteStreamController pull()
1848         https://bugs.webkit.org/show_bug.cgi?id=167593
1849
1850         Reviewed by Youenn Fablet.
1851
1852         Implemented pull() method for ReadableByteStreamController. Also updated
1853         pendingPullIntos attribute, which was a more complex object than necessary
1854         (an array is enough).
1855
1856         Added 2 tests that allow covering most of new code. Code not yet tested will
1857         become reachable as the rest of the spec is implemented (new tests will then
1858         be added).
1859
1860         * Modules/streams/ReadableByteStreamInternals.js:
1861         (privateInitializeReadableByteStreamController): Updated pendingPullIntos.
1862         (readableByteStreamControllerCancel): Updated pendingPullIntos.
1863         (readableByteStreamControllerClose): Updated pendingPullIntos.
1864         (readableByteStreamControllerHandleQueueDrain): Added.
1865         (readableByteStreamControllerPull): Added.
1866
1867 2017-02-01  Enrique Ocaña González  <eocanha@igalia.com>
1868
1869         [GStreamer][MSE] qtdemux: Update the tfdt patch to the version finally accepted upstream
1870         https://bugs.webkit.org/show_bug.cgi?id=166529
1871
1872         Reviewed by Xabier Rodriguez-Calvar.
1873
1874         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
1875         (WebCore::AppendPipeline::AppendPipeline): Don't use the "always-honor-tfdt" property
1876         in qtdemux anymore.
1877
1878 2017-02-01  Yusuke Suzuki  <utatane.tea@gmail.com>
1879
1880         Unreviewed, build fix for macOS and iOS ports, part 2
1881
1882         Annotate the function with static.
1883
1884         * bindings/js/ScriptModuleLoader.cpp:
1885         (WebCore::rejectToPropagateNetworkError):
1886
1887 2017-02-01  Yusuke Suzuki  <utatane.tea@gmail.com>
1888
1889         Unreviewed, build fix for macOS and iOS ports
1890
1891         * bindings/js/ModuleFetchFailureKind.h: Renamed from Source/ModuleFetchFailureKind.h.
1892
1893 2017-02-01  Yusuke Suzuki  <utatane.tea@gmail.com>
1894
1895         Propagate networking errors correctly for import() operator
1896         https://bugs.webkit.org/show_bug.cgi?id=167501
1897
1898         Reviewed by Ryosuke Niwa.
1899
1900         We use the promise chain inside the module loader pipeline.
1901         The problem is that,
1902
1903         1. The errors of loading module scripts are propagated through the promise's rejection.
1904         2. Some module related errors like syntax error (when scanning module dependencies) are
1905            reported at loading time (evaluating time). These errors are propagated through the
1906            promise rejections and dumped to the console. LoadableModuleScript set catch handler
1907            for that and print these errors to the console for ScriptElement.
1908         3. Some of errors are already reported to the console. For example, networking errors
1909            are reported by the CachedModuleLoader.
1910         4. But there is no way to distinguish between (2) and (3) at the catch handler.
1911
1912         Previously, we propagate the special symbol for the already reported errors to distinguish
1913         that. This was OK because these errors cannot be catched by the user code. However,
1914         recent `import()` call needs to expose these errors to the user code. So now, accidentally,
1915         the special purpose symbol is exposed.
1916
1917         Instead of propagating the special symbol, this patch just propagates the errors. But these
1918         error objects are annotated with the private symbol. So these errors can be distinguished
1919         from the other ones.
1920
1921         Currently, we do not have the way to expose the error details to the client of the
1922         CachedScript. So we just report the error with the failed / canceled. This should be
1923         more descriptive error messages in the separate patch[1].
1924
1925         [1]: https://bugs.webkit.org/show_bug.cgi?id=167553
1926
1927         Tests: http/tests/security/mixedContent/import-insecure-script-in-iframe.html
1928                js/dom/modules/import-not-found-error.html
1929
1930         * WebCore.xcodeproj/project.pbxproj:
1931         * bindings/js/JSDOMPromise.h:
1932         (WebCore::DeferredPromise::resolveWithCallback):
1933         (WebCore::DeferredPromise::rejectWithCallback):
1934         * bindings/js/ScriptController.cpp:
1935         (WebCore::ScriptController::setupModuleScriptHandlers):
1936         * bindings/js/ScriptController.h:
1937         (WebCore::ScriptController::moduleLoaderAlreadyReportedErrorSymbol): Deleted.
1938         (WebCore::ScriptController::moduleLoaderFetchingIsCanceledSymbol): Deleted.
1939         * bindings/js/ScriptModuleLoader.cpp:
1940         (WebCore::rejectToPropagateNetworkError):
1941         (WebCore::ScriptModuleLoader::fetch):
1942         (WebCore::ScriptModuleLoader::notifyFinished):
1943         * bindings/js/WebCoreBuiltinNames.h:
1944
1945 2017-01-31  Wenson Hsieh  <wenson_hsieh@apple.com>
1946
1947         Regression (Safari 10.1): Pressing Return in a contenteditable no longer inserts a line break under certain conditions
1948         https://bugs.webkit.org/show_bug.cgi?id=167525
1949         <rdar://problem/30270210>
1950
1951         Reviewed by Ryosuke Niwa.
1952
1953         Test: fast/events/input-events-insert-newlines-after-mutation.html
1954
1955         Reverts an unintended change made while refactoring code for input events that caused input events to be
1956         dispatched immediately rather than on the scoped queue. Normally, input events are dispatched in
1957         CompositeEditCommand::apply after the end of the scope, but TypingCommands may fire input events *from within*
1958         the scope by calling typingAddedToOpenCommand.
1959
1960         Instead, TypingCommands should always dispatch events
1961         synchronously after the end of the scoped queue in CompositeEditCommand::apply, but this is a riskier change
1962         than we should currently allow, so we should revert to our old behavior for the time being.
1963
1964         * editing/Editor.cpp:
1965
1966 2017-01-31  Zalan Bujtas  <zalan@apple.com>
1967
1968         Simple line layout: Do not assert on zero length/width trailing whitespace.
1969         https://bugs.webkit.org/show_bug.cgi?id=167679
1970
1971         Reviewed by Simon Fraser.
1972
1973         It's valid to have an zero length/width trailing whitespace.
1974
1975         Covered by existing tests.
1976
1977         * rendering/SimpleLineLayout.cpp:
1978         (WebCore::SimpleLineLayout::LineState::removeTrailingWhitespace): Zero length -> nothing to do.
1979         Zero width with length > 0 (font-size: 0) -> remove trailing run.
1980
1981 2017-01-31  Alex Christensen  <achristensen@webkit.org>
1982
1983         Fix debug libwebrtc build after r211439
1984         https://bugs.webkit.org/show_bug.cgi?id=167572
1985
1986         * platform/mediastream/libwebrtc/LibWebRTCAudioModule.cpp:
1987         (WebCore::LibWebRTCAudioModule::OnMessage):
1988
1989 2017-01-31  Zalan Bujtas  <zalan@apple.com>
1990
1991         Simple line layout: Collect fragments in LineState only when needed for post-processing.
1992         https://bugs.webkit.org/show_bug.cgi?id=167655
1993         <rdar://problem/30290592>
1994
1995         Reviewed by Antti Koivisto.
1996
1997         The fragments we need to keep around for basic line breaking are the last and last non-whitespace fragments.
1998         However in certain cases such as text-align: justify, we have to traverse the entire line
1999         at post-processing which requires all the fragments on the current line.
2000         This patch speeds up the basic line handling by using m_fragment list only for the special cases.
2001         It improves PerformanceTests/Layout/simple-line-layout-non-repeating-text.html by ~7% (local measurement)
2002         median: 114.25 runs/s -> median: 122.16 runs
2003
2004         Covered by existing tests.
2005
2006         * rendering/SimpleLineLayout.cpp:
2007         (WebCore::SimpleLineLayout::LineState::setNeedsAllFragments):
2008         (WebCore::SimpleLineLayout::LineState::hasTrailingWhitespace):
2009         (WebCore::SimpleLineLayout::LineState::lastFragment):
2010         (WebCore::SimpleLineLayout::LineState::expansionOpportunityCount):
2011         (WebCore::SimpleLineLayout::LineState::isEmpty):
2012         (WebCore::SimpleLineLayout::LineState::endPositionForCollapsedFragment):
2013         (WebCore::SimpleLineLayout::LineState::appendFragmentAndCreateRunIfNeeded): Track uncompleted width.
2014         (WebCore::SimpleLineLayout::LineState::revertToLastCompleteFragment):
2015         (WebCore::SimpleLineLayout::LineState::removeTrailingWhitespace):
2016         (WebCore::SimpleLineLayout::removeTrailingWhitespace):
2017         (WebCore::SimpleLineLayout::updateLineConstrains): Set the slow path for text-align: justify.
2018         (WebCore::SimpleLineLayout::createLineRuns):
2019         (WebCore::SimpleLineLayout::closeLineEndingAndAdjustRuns):
2020         (WebCore::SimpleLineLayout::createTextRuns):
2021         * rendering/SimpleLineLayoutTextFragmentIterator.h:
2022         (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::isValid):
2023         (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::length):
2024
2025 2017-01-31  Chris Dumez  <cdumez@apple.com>
2026
2027         com.apple.WebKit.WebContent.Development crashed in com.apple.WebCore: WebCore::FrameView::didDestroyRenderTree
2028         https://bugs.webkit.org/show_bug.cgi?id=167665
2029         <rdar://problem/30241193>
2030
2031         Reviewed by Andreas Kling.
2032
2033         When destroying a PageCache entry, we would call Document::prepareFromDestruction()
2034         which would destroy the render tree and then call FrameView::didDestroyRenderTree().
2035         We would sometimes hit the ASSERT(m_widgetsInRenderTree.isEmpty()) assertion in
2036         didDestroyRenderTree(). This indicates that there are still RenderWidgets associated
2037         with the FrameView even though we claim we already destroyed the render tree.
2038
2039         The reason for this is that, in the PageCache context, the top document's frame is
2040         reused on navigation and may not be associated with a new document that is currently
2041         displayed, has a render tree (and possible RenderWidgets). The solution proposed is
2042         to stop calling FrameView::didDestroyRenderTree() in Document::prepareFromDestruction()
2043         if the frame's document is not |this|. This happens when the document is destroyed
2044         while in PageCache. We do not want to mess with the frame / frameview in this case
2045         since they are no longer associated to the present document anymore.
2046
2047         No new tests, already covered by existing tests which currently crash flakily.
2048
2049         * dom/Document.cpp:
2050         (WebCore::Document::destroyRenderTree):
2051
2052 2017-01-31  Sam Weinig  <sam@webkit.org>
2053
2054         Remove unused/rarely used bindings helpers
2055         https://bugs.webkit.org/show_bug.cgi?id=167648
2056
2057         Reviewed by Anders Carlsson.
2058
2059         * bindings/js/JSDOMBinding.cpp:
2060         * bindings/js/JSDOMBinding.h:
2061         (WebCore::jsString): Deleted.
2062         (WebCore::jsStringOrUndefined): Deleted.
2063         (WebCore::finiteInt32Value): Deleted.
2064         (WebCore::toJS): Deleted.
2065         Remove unused functions. The toJS overrides can be replaced with their
2066         modern JSDOMConvert counterparts.
2067         
2068         * bindings/js/JSDOMExceptionHandling.h:
2069         (WebCore::toJS): Deleted.
2070         (WebCore::toJSNewlyCreated): Deleted.
2071         Remove unused functions.
2072
2073         * bindings/js/JSDOMIterator.h:
2074         Add more specific include of JSDOMConvert.h to fix compile.
2075
2076         * bindings/js/JSDOMPromise.cpp:
2077         (WebCore::DeferredPromise::reject):
2078         Create the Symbol directly, instead of using the toJS override.
2079
2080         * bindings/js/JSWorkerCustom.cpp:
2081         (WebCore::constructJSWorker):
2082         Use JSDOMConvert toJS function.
2083
2084         * bindings/js/JSXMLHttpRequestCustom.cpp:
2085         (WebCore::JSXMLHttpRequest::retrieveResponse):
2086         Use JSDOMConvert toJS functions.
2087
2088         * bindings/js/ScriptController.h:
2089         Add missing forward declaration of URL.
2090
2091         * bindings/js/ScriptModuleLoader.cpp:
2092         (WebCore::ScriptModuleLoader::resolve):
2093         Create the Symbol directly, instead of using the toJS override.
2094
2095         * html/HTMLPlugInImageElement.cpp:
2096         (WebCore::HTMLPlugInImageElement::didAddUserAgentShadowRoot):
2097         Use JSDOMConvert toJS functions.
2098
2099 2017-01-31  Wenson Hsieh  <wenson_hsieh@apple.com>
2100
2101         WebItemProviderPasteboard should be robust when UIItemProvider fails to initialize an object
2102         https://bugs.webkit.org/show_bug.cgi?id=167663
2103         <rdar://problem/30294240>
2104
2105         Reviewed by Tim Horton.
2106
2107         Adds a nil check for the result of -createObjectOfClass:error:.
2108
2109         * platform/ios/WebItemProviderPasteboard.mm:
2110         (-[WebItemProviderPasteboard valuesForPasteboardType:inItemSet:]):
2111         (-[WebItemProviderPasteboard _tryToCreateAndAppendObjectOfClass:toArray:usingProvider:]):
2112
2113 2017-01-31  Keith Rollin  <krollin@apple.com>
2114
2115         Variable used after it's been WTFMove'd
2116         https://bugs.webkit.org/show_bug.cgi?id=167658
2117
2118         Reviewed by Chris Dumez.
2119
2120         Rather than WTFMoving the variable as part of passing it to a function
2121         that takes an RValue-ref, call copyRef to provide the RValue-ref. This
2122         preserves the original variable for later use in the function.
2123
2124         No new tests -- this issue was found by inspection. It's not apparent
2125         what the side-effect of this bug is or how a test would verify it.
2126
2127         * loader/SubresourceLoader.cpp:
2128         (WebCore::SubresourceLoader::didReceiveDataOrBuffer):
2129
2130 2017-01-31  Anders Carlsson  <andersca@apple.com>
2131
2132         Apple Pay button does nothing on nytimes.com
2133         https://bugs.webkit.org/show_bug.cgi?id=167664
2134         rdar://problem/30273885
2135
2136         Reviewed by Sam Weinig.
2137
2138         Separate line item validation into convertAndValidateTotal and convertAndValidate. The former
2139         works on totals (which require an amount), and the latter works on regular line items that do not require an amount
2140         if the item type is "pending".
2141
2142         * Modules/applepay/ApplePaySession.cpp:
2143         (WebCore::convertAndValidateTotal):
2144         (WebCore::convertAndValidate):
2145         Only check the amount if the type is not pending.
2146
2147         (WebCore::ApplePaySession::completeShippingMethodSelection):
2148         (WebCore::ApplePaySession::completeShippingContactSelection):
2149         (WebCore::ApplePaySession::completePaymentMethodSelection):
2150         Call convertAndValidateTotal for totals.
2151
2152 2017-01-31  Youenn Fablet  <youenn@apple.com>
2153
2154         [WebRTC] Add a libwebrtc AudioModule specific to WebKit
2155         https://bugs.webkit.org/show_bug.cgi?id=167572
2156
2157         Reviewed by Alex Christensen.
2158
2159         To be covered by webrtc audio tests.
2160         Adding an AudioModule to circumvent the default LibWebRTC Audio Module which does the audio directly.
2161         The implementation of the AudioModule is restricted to enable fueling the incoming audio tracks with incoming data.
2162         Code inspired from https://chromium.googlesource.com/chromium/src/+/master/remoting/protocol/webrtc_audio_module.h
2163
2164         * WebCore.xcodeproj/project.pbxproj:
2165         * platform/mediastream/libwebrtc/LibWebRTCAudioModule.cpp: Added.
2166         (WebCore::LibWebRTCAudioModule::LibWebRTCAudioModule):
2167         (WebCore::LibWebRTCAudioModule::RegisterAudioCallback):
2168         (WebCore::LibWebRTCAudioModule::OnMessage):
2169         (WebCore::LibWebRTCAudioModule::StartPlayout):
2170         (WebCore::LibWebRTCAudioModule::StopPlayout):
2171         (WebCore::LibWebRTCAudioModule::StartPlayoutOnAudioThread):
2172         (WebCore::LibWebRTCAudioModule::PollFromSource):
2173         * platform/mediastream/libwebrtc/LibWebRTCAudioModule.h: Added.
2174         * platform/mediastream/libwebrtc/LibWebRTCUtils.cpp:
2175         (WebCore::ThreadMessageData::ThreadMessageData):
2176         (WebCore::initializePeerConnectionFactoryAndThreads):
2177
2178 2017-01-31  Jessie Berlin  <jberlin@webkit.org>
2179
2180         Build fix.
2181
2182         * editing/mac/EditorMac.mm:
2183         (WebCore::Editor::pasteWithPasteboard):
2184         (WebCore::Editor::takeFindStringFromSelection):
2185         (WebCore::Editor::replaceNodeFromPasteboard):
2186         * page/mac/EventHandlerMac.mm:
2187         (WebCore::EventHandler::createDraggingDataTransfer):
2188         * platform/mac/PasteboardMac.mm:
2189         (WebCore::Pasteboard::createForCopyAndPaste):
2190         (WebCore::Pasteboard::createForDragAndDrop):
2191
2192 2017-01-31  Eric Carlson  <eric.carlson@apple.com>
2193
2194         [Mac] Add an audio stream description class
2195         https://bugs.webkit.org/show_bug.cgi?id=167639
2196
2197         Reviewed by Youenn Fablet.
2198
2199         No new tests, the new class is not used yet.
2200
2201         * WebCore.xcodeproj/project.pbxproj:
2202         * platform/audio/AudioStreamDescription.h: Added.
2203         (WebCore::AudioStreamDescription::isPCM):
2204         * platform/audio/mac/CAAudioStreamDescription.cpp: Added.
2205         (WebCore::CAAudioStreamDescription::CAAudioStreamDescription):
2206         (WebCore::CAAudioStreamDescription::platformDescription):
2207         (WebCore::CAAudioStreamDescription::format):
2208         (WebCore::toCAAudioStreamDescription):
2209         (WebCore::CAAudioStreamDescription::operator==):
2210         (WebCore::operator==):
2211         * platform/audio/mac/CAAudioStreamDescription.h: Added.
2212         (WebCore::operator!=):
2213         (WebCore::CAAudioStreamDescription::bytesPerFrame):
2214         (WebCore::CAAudioStreamDescription::bytesPerPacket):
2215         (WebCore::CAAudioStreamDescription::formatFlags):
2216         (WebCore::CAAudioStreamDescription::operator==):
2217         (WebCore::CAAudioStreamDescription::operator!=):
2218         (WebCore::CAAudioStreamDescription::streamDescription):
2219
2220 2017-01-31  Youenn Fablet  <youenn@apple.com>
2221
2222         RTCPeerConnection methods can take dictionaries as input
2223         https://bugs.webkit.org/show_bug.cgi?id=167590
2224
2225         Reviewed by Alex Christensen.
2226
2227         Test: webrtc/rtcpeerconnection-error-messages.html
2228
2229         Made addIceCandidate/setRemoteDescription/setLocalDescription take either dictionaries or objects as parameter.
2230         Spec only mandates this for addIceCandidate, but sites may be using the old version for setRemoteDescription and setLocalDescription.
2231
2232         Updated RTCPeerConnection methods error messages.
2233
2234         * Modules/mediastream/RTCPeerConnection.js:
2235         (getLocalStreams):
2236         (getStreamById):
2237         (addStream):
2238         (createOffer):
2239         (createAnswer):
2240         (setLocalDescription):
2241         (setRemoteDescription):
2242         (addIceCandidate):
2243         (getStats):
2244         * Modules/mediastream/RTCPeerConnectionInternals.js:
2245
2246 2017-01-31  Simon Fraser  <simon.fraser@apple.com>
2247
2248         REGRESSION (r209411): Scrolling to a fragment identifier in overflow:scroll inside position:fixed no longer works
2249         https://bugs.webkit.org/show_bug.cgi?id=167630
2250         rdar://problem/30091558
2251
2252         Reviewed by Zalan Bujtas.
2253         
2254         r209411 added special handling for scrolling inside position:fixed, but cut off all scrolling, breaking
2255         overflow:scroll inside position:fixed. Fix by only handling the position:fixed case when we get to 
2256         the root layer, which is where we scroll the document.
2257
2258         Test: fast/overflow/scroll-anchor-in-overflow-in-position-fixed.html
2259
2260         * rendering/RenderLayer.cpp:
2261         (WebCore::RenderLayer::getRectToExpose):
2262
2263 2017-01-31  Zan Dobersek  <zdobersek@igalia.com>
2264
2265         [EME] InitDataRegistry should use base64url encoding and decoding for keyids
2266         https://bugs.webkit.org/show_bug.cgi?id=167592
2267
2268         Reviewed by Jer Noble.
2269
2270         In InitDataRegistry, WTF::base64URLEncode() and WTF::base64URLDecode() should
2271         be used to encode and decode the 'keyids' initialization data format, as
2272         required by the relevant specification.
2273         https://w3c.github.io/encrypted-media/format-registry/initdata/keyids.html#format
2274
2275         Relevant test case was added to media/encrypted-media/mock-MediaKeySession-generateRequest.html.
2276
2277         * Modules/encryptedmedia/InitDataRegistry.cpp:
2278         (WebCore::extractKeyIDsKeyids):
2279         (WebCore::sanitizeKeyids):
2280
2281 2017-01-31  Joseph Pecoraro  <pecoraro@apple.com>
2282
2283         Performance Timeline: Add serializer to PerformanceEntry
2284         https://bugs.webkit.org/show_bug.cgi?id=167632
2285
2286         Reviewed by Ryosuke Niwa.
2287
2288         Test: performance-api/performance-timeline-serializers.html
2289
2290         * page/PerformanceEntry.idl:
2291
2292 2017-01-31  Chris Fleizach  <cfleizach@apple.com>
2293
2294         AX: enable search predication for iOS
2295         https://bugs.webkit.org/show_bug.cgi?id=167558
2296         <rdar://problem/30251367>
2297
2298         Reviewed by Joanmarie Diggs.
2299
2300         Move the code to support accessibility searching into a shared place so it can be used by iOS.
2301
2302         Test: accessibility/ios-simulator/ios-search-predicate.html
2303
2304         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
2305         (-[WebAccessibilityObjectWrapper accessibilityFindMatchingObjects:]):
2306         * accessibility/mac/WebAccessibilityObjectWrapperBase.h:
2307         * accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
2308         (convertToNSArray):
2309         (createAccessibilitySearchKeyMap):
2310         (accessibilitySearchKeyForString):
2311         (accessibilitySearchCriteriaForSearchPredicateParameterizedAttribute):
2312         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2313         (createAccessibilitySearchKeyMap): Deleted.
2314         (accessibilitySearchKeyForString): Deleted.
2315         (accessibilitySearchCriteriaForSearchPredicateParameterizedAttribute): Deleted.
2316         (convertToNSArray): Deleted.
2317
2318 2017-01-30  Joseph Pecoraro  <pecoraro@apple.com>
2319
2320         [WebIDL] Add support for inherit serializer attribute
2321         https://bugs.webkit.org/show_bug.cgi?id=167274
2322
2323         Reviewed by Darin Adler.
2324
2325         Support for serializer { inherit }, which will be used by Resource Timing.
2326         https://heycam.github.io/webidl/#idl-serializers
2327
2328         * bindings/scripts/CodeGenerator.pm:
2329         (GetInterfaceForAttribute):
2330         (IsSerializableAttribute):
2331         Determine if an attribute is serializable at generation time so we can
2332         verify types. This allows us to support typedefs. We don't yet support
2333         serializing an attribute that is itself a serializable interface.
2334
2335         * bindings/scripts/CodeGeneratorJS.pm:
2336         (GenerateSerializerFunction):
2337         (GenerateSerializerAttributesForInterface):
2338         Generate inherited attributes first, then generate our own list.
2339         Explicitly provided attribute names are expected to be serializable,
2340         so produce an error if they are not.
2341
2342         * bindings/scripts/IDLParser.pm:
2343         (parseSerializationAttributes):
2344         Update parsing of serializer attributes to allow for multiple
2345         special strings. The spec does not precisely define where the
2346         special "attribute" keyword is allowed.
2347
2348         (applyMemberList):
2349         (isSerializableAttribute): Deleted.
2350         Move serializable attribute checking to generation.
2351
2352         * bindings/scripts/test/JS/JSTestSerialization.cpp:
2353         * bindings/scripts/test/JS/JSTestSerializationInherit.cpp: Added.
2354         * bindings/scripts/test/JS/JSTestSerializationInherit.h: Added.
2355         * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp: Added.
2356         * bindings/scripts/test/JS/JSTestSerializationInheritFinal.h: Added.
2357         The toJSON implementations are the most interesting.
2358
2359         * bindings/scripts/test/TestSerialization.idl:
2360         Extend this test for typedefed attributes that are serializable.
2361         Change TestNode (a serializable Interface) to TestException (an
2362         unserializable Interface) for expected behavior of an
2363         unserializable attribute.
2364
2365         * bindings/scripts/test/TestSerializationInherit.idl:
2366         Test for { inherit, attribute }.
2367
2368         * bindings/scripts/test/TestSerializationInheritFinal.idl:
2369         Test for { inherit, attribute_names... }, and multi-level inherit.
2370
2371 2017-01-30  Joseph Pecoraro  <pecoraro@apple.com>
2372
2373         Implement PerformanceObserver
2374         https://bugs.webkit.org/show_bug.cgi?id=167546
2375         <rdar://problem/30247959>
2376
2377         Reviewed by Ryosuke Niwa.
2378
2379         This implements PerformanceObserver from Performance Timeline Level 2:
2380         https://w3c.github.io/performance-timeline/
2381
2382         Tests: performance-api/performance-observer-api.html
2383                performance-api/performance-observer-basic.html
2384                performance-api/performance-observer-callback-mutate.html
2385                performance-api/performance-observer-callback-task.html
2386                performance-api/performance-observer-entry-sort.html
2387                performance-api/performance-observer-exception.html
2388                performance-api/performance-observer-nested.html
2389                performance-api/performance-observer-order.html
2390                performance-api/performance-observer-periodic.html
2391                performance-api/performance-timeline-api.html
2392
2393         * CMakeLists.txt:
2394         * DerivedSources.make:
2395         * WebCore.xcodeproj/project.pbxproj:
2396         New files.
2397
2398         * page/Performance.h:
2399         * page/Performance.cpp:
2400         (WebCore::Performance::mark):
2401         (WebCore::Performance::measure):
2402         (WebCore::Performance::registerPerformanceObserver):
2403         (WebCore::Performance::unregisterPerformanceObserver):
2404         (WebCore::Performance::queueEntry):
2405         Register PerformanceObservers with the Performance object.
2406         When new PerformanceEntries are created (Mark and Measure
2407         right now) check them against observers.
2408
2409         * page/PerformanceEntry.cpp:
2410         (WebCore::PerformanceEntry::PerformanceEntry):
2411         (WebCore::PerformanceEntry::typeForEntryTypeString):
2412         * page/PerformanceEntry.h:
2413         (WebCore::PerformanceEntry::type):
2414         Give PerformanceEntry a convenience enum for easy comparison
2415         and to know if it is one of the built-in known types (which the
2416         PerformanceObserver API takes into account).
2417
2418         * page/PerformanceObserver.cpp: Added.
2419         (WebCore::PerformanceObserver::PerformanceObserver):
2420         (WebCore::PerformanceObserver::observe):
2421         (WebCore::PerformanceObserver::disconnect):
2422         (WebCore::PerformanceObserver::queueEntry):
2423         (WebCore::PerformanceObserver::deliver):
2424         * page/PerformanceObserver.h:
2425         (WebCore::PerformanceObserver::create):
2426         (WebCore::PerformanceObserver::typeFilter):
2427         - TypeErrors on observe bad behavior
2428         - Completely replace types filter on observe
2429         - Handle register and unregister
2430         - Handle calling the callback
2431
2432         * page/PerformanceObserverCallback.idl: Added.
2433         * page/PerformanceObserverEntryList.cpp: Added.
2434         (WebCore::PerformanceObserverEntryList::PerformanceObserverEntryList):
2435         (WebCore::PerformanceObserverEntryList::getEntries):
2436         (WebCore::PerformanceObserverEntryList::getEntriesByType):
2437         (WebCore::PerformanceObserverEntryList::getEntriesByName):
2438         * page/PerformanceObserverEntryList.h:
2439         (WebCore::PerformanceObserverEntryList::create):
2440         * page/PerformanceObserverEntryList.idl: Added.
2441         Implement sorting and filtering of entries.
2442
2443         * page/PerformanceObserver.idl: Added.
2444         * page/PerformanceObserverCallback.h:
2445         (WebCore::PerformanceObserverCallback::~PerformanceObserverCallback):
2446         Mostly autogenerated.
2447
2448         * page/PerformanceUserTiming.cpp:
2449         (WebCore::UserTiming::mark):
2450         (WebCore::UserTiming::measure):
2451         * page/PerformanceUserTiming.h:
2452         Update these to return the entry so it can be passed on to
2453         any interested PerformanceObservers.
2454
2455 2017-01-30  Youenn Fablet  <youenn@apple.com>
2456
2457         [WebRTC] getStats does not support legacy callback
2458         https://bugs.webkit.org/show_bug.cgi?id=167617
2459
2460         Reviewed by Alex Christensen.
2461
2462         Covered by updated tests.
2463
2464         * Modules/mediastream/RTCPeerConnection.cpp:
2465         (WebCore::RTCPeerConnection::getStats):
2466         (WebCore::RTCPeerConnection::privateGetStats): Deleted.
2467         * Modules/mediastream/RTCPeerConnection.h:
2468         * Modules/mediastream/RTCPeerConnection.idl:
2469         * Modules/mediastream/RTCPeerConnection.js:
2470         (addIceCandidate):
2471         (getStats): Deleted.
2472
2473 2017-01-30  Sam Weinig  <sam@webkit.org>
2474
2475         JSDOMBinding is too big. Split it up!
2476         https://bugs.webkit.org/show_bug.cgi?id=167601
2477
2478         Reviewed by Darin Adler.
2479
2480         Splits JSDOMBinding.h/cpp up a bit by splitting out:
2481         - JSDOMBindingCaller.h
2482         - JSDOMBindingSecurity.h/cpp
2483         - JSDOMExceptionHandling.h/cpp
2484         - JSDOMWrapperCache.h/cpp
2485
2486         Also:
2487         - Moves all constructor objects to JSDOMConstructor.h/cpp,  
2488         - Moves special DOMWindow accessors to JSDOMWindowBase.
2489         - Deletes unused CallbackFunction.h/cpp
2490
2491         * CMakeLists.txt:
2492         * Modules/webdatabase/Database.cpp:
2493         * WebCore.xcodeproj/project.pbxproj:
2494         * bindings/js/CallbackFunction.cpp: Removed.
2495         * bindings/js/CallbackFunction.h: Removed.
2496         * bindings/js/DOMConstructorWithDocument.h: Removed.
2497         * bindings/js/JSCryptoCustom.cpp:
2498         * bindings/js/JSCustomXPathNSResolver.cpp:
2499         * bindings/js/JSDOMBinding.cpp:
2500         * bindings/js/JSDOMBinding.h:
2501         * bindings/js/JSDOMBindingCaller.h: Copied from Source/WebCore/bindings/js/JSDOMBinding.h.
2502         * bindings/js/JSDOMBindingSecurity.cpp: Copied from Source/WebCore/bindings/js/JSDOMBinding.cpp.
2503         * bindings/js/JSDOMBindingSecurity.h: Copied from Source/WebCore/bindings/js/JSDOMBinding.h.
2504         * bindings/js/JSDOMConstructor.cpp: Copied from Source/WebCore/bindings/js/JSDOMBinding.cpp.
2505         * bindings/js/JSDOMConstructor.h:
2506         * bindings/js/JSDOMConvert.h:
2507         * bindings/js/JSDOMExceptionHandling.cpp: Copied from Source/WebCore/bindings/js/JSDOMBinding.cpp.
2508         * bindings/js/JSDOMExceptionHandling.h: Copied from Source/WebCore/bindings/js/JSDOMBinding.h.
2509         * bindings/js/JSDOMWindowBase.cpp:
2510         (WebCore::callerDOMWindow): Moved from JSDOMBinding.h
2511         (WebCore::activeDOMWindow): Moved from JSDOMBinding.h
2512         (WebCore::firstDOMWindow): Moved from JSDOMBinding.h
2513         * bindings/js/JSDOMWindowBase.h:
2514         * bindings/js/JSDOMWindowCustom.cpp:
2515         * bindings/js/JSDOMWindowProperties.cpp:
2516         * bindings/js/JSDOMWrapperCache.cpp: Copied from Source/WebCore/bindings/js/JSDOMBinding.cpp.
2517         * bindings/js/JSDOMWrapperCache.h: Copied from Source/WebCore/bindings/js/JSDOMBinding.h.
2518         * bindings/js/JSEventTargetCustom.h:
2519         * bindings/js/JSHTMLElementCustom.cpp:
2520         * bindings/js/JSLocationCustom.cpp:
2521         * bindings/js/JSMutationObserverCustom.cpp:
2522         * bindings/js/JSSQLStatementErrorCallbackCustom.cpp:
2523         * bindings/js/JSStorageCustom.cpp:
2524         * bindings/js/JSWorkerCustom.cpp:
2525         * bindings/js/JSXPathNSResolverCustom.cpp:
2526         * bindings/js/ScheduledAction.cpp:
2527         * bindings/js/ScriptController.cpp:
2528         * bindings/js/ScriptController.h:
2529         * bindings/js/ScriptGlobalObject.cpp:
2530         (WebCore::ScriptGlobalObject::set):
2531         * bindings/js/StructuredClone.cpp:
2532         * bindings/scripts/CodeGeneratorJS.pm:
2533         (GenerateImplementation):
2534         (GenerateCallWith):
2535         (GenerateParametersCheck):
2536         (GenerateCallbackImplementationContent):
2537         (NativeToJSValue):
2538         * bridge/objc/WebScriptObject.mm:
2539         * html/HTMLFrameElementBase.cpp:
2540         * html/HTMLVideoElement.cpp:
2541         * inspector/InspectorController.cpp:
2542         * inspector/InspectorDOMAgent.cpp:
2543         * inspector/PageScriptDebugServer.cpp:
2544         * inspector/WorkerScriptDebugServer.cpp:
2545
2546 2017-01-30  Andy Estes  <aestes@apple.com>
2547
2548         [QuickLook] FrameLoaderClient should return the new QuickLookHandleClient it creates
2549         https://bugs.webkit.org/show_bug.cgi?id=167625
2550
2551         Reviewed by Andreas Kling.
2552
2553         QuickLookHandleClients were being created by QuickLookHandle calling
2554         FrameLoaderClient::didCreateQuickLookHandle() then having the FrameLoaderClient create a new
2555         QuickLookHandleClient and set it using QuickLookHandle::setClient().
2556
2557         Since all FrameLoaderClient::didCreateQuickLookHandle() does is create a new
2558         QuickLookHandleClient, this patch changes the FrameLoaderClient function to return the new
2559         QuickLookHandleClient directly and removes the API from QuickLookHandle to set a client.
2560         This also removes previewFileName() and previewUTI() from QuickLookHandle and instead passes
2561         these as arguments to the FrameLoaderClient.
2562
2563         No change in behavior. Covered by existing tests.
2564
2565         * loader/EmptyClients.cpp: Added an implementation of createQuickLookHandleClient() that
2566         returns nullptr.
2567         * loader/FrameLoaderClient.h: Declared createQuickLookHandleClient() and removed
2568         didCreateQuickLookHandle().
2569         * loader/ios/QuickLook.h: Removed setClient(), previewFileName(), and previewUTI().
2570         * loader/ios/QuickLook.mm: Removed testingOrEmptyClient().
2571         (-[WebPreviewLoader initWithResourceLoader:resourceResponse:quickLookHandle:]): Set _client
2572         to testingClient() if it exists, otherwise set it to the client returned by
2573         FrameLoaderClient::createQuickLookHandleClient() it non-null, otherwise set it to
2574         emptyClient().
2575         (testingOrEmptyClient): Deleted.
2576         (-[WebPreviewLoader setClient:]): Deleted.
2577         (-[WebPreviewLoader converter]): Deleted.
2578         (WebCore::QuickLookHandle::setClient): Deleted.
2579         (WebCore::QuickLookHandle::previewFileName): Deleted.
2580         (WebCore::QuickLookHandle::previewUTI): Deleted.
2581
2582 2017-01-30  Jer Noble  <jer.noble@apple.com>
2583
2584         NULL-deref crash in TextTrack::removeCue()
2585         https://bugs.webkit.org/show_bug.cgi?id=167615
2586
2587         Reviewed by Eric Carlson.
2588
2589         It's possible for a track to be removed which was never actually added to the cue list.
2590         Specifically, if an in-band track with a negative start or end time was parsed, it would
2591         have been rejected by TextTrack::addCue(). When it comes time to flush those in-band cues,
2592         TextTrack::m_cues will still be NULL. Rather than ASSERT in this case, we should revert the
2593         behavior added in r210319 and throw an exception.
2594
2595         * html/track/TextTrack.cpp:
2596         (WebCore::TextTrack::removeCue):
2597
2598 2017-01-30  Andreas Kling  <akling@apple.com>
2599
2600         Fix CMSampleBuffer leak in MediaSampleAVFObjC::createNonDisplayingCopy().
2601         <https://webkit.org/b/167621>
2602
2603         Reviewed by Andy Estes.
2604
2605         We were failing to adopt the CMSampleBuffer after copying it. Seen on leaks bot.
2606
2607         * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm:
2608         (WebCore::MediaSampleAVFObjC::createNonDisplayingCopy):
2609
2610 2017-01-30  Andy Estes  <aestes@apple.com>
2611
2612         [QuickLook] QLPreviewConverter and QuickLookHandle have different lifetime requirements
2613         https://bugs.webkit.org/show_bug.cgi?id=167609
2614
2615         Reviewed by Andreas Kling.
2616         
2617         Currently, QuickLookHandles are owned by DocumentLoader so that the underlying
2618         QLPreviewConverter stays alive to service subresource requests. However, the QuickLookHandle
2619         itself only needs to live long enough to handle the main resource load. And in a follow-on
2620         patch we will need to create QLPreviewConverters independent of QuickLookHandle.
2621
2622         This patch moves ownership of QuickLookHandle from DocumentLoader to ResourceLoader. It also
2623         creates a C++ wrapper around QLPreviewConverter and teaches QuickLookHandle to transfer
2624         ownership of the wrapper to DocumentLoader once the main resource conversion is complete.
2625
2626         No change in behavior. Covered by existing tests.
2627
2628         * WebCore.xcodeproj/project.pbxproj: Added PreviewConverter.{h,mm}.
2629         * loader/DocumentLoader.cpp:
2630         (WebCore::DocumentLoader::setPreviewConverter): Renamed from setQuickLookHandle().
2631         (WebCore::DocumentLoader::previewConverter): Renamed from quickLookHandle().
2632         (WebCore::DocumentLoader::setQuickLookHandle): Renamed to setPreviewConverter().
2633         * loader/DocumentLoader.h:
2634         (WebCore::DocumentLoader::quickLookHandle): Renamed to quickLookHandle().
2635         * loader/ResourceLoader.cpp:
2636         (WebCore::ResourceLoader::willSendRequestInternal): Changed to call PreviewConverter::safeRequest().
2637         (WebCore::ResourceLoader::isQuickLookResource): Changed to check if m_quickLookHandle is null.
2638         (WebCore::ResourceLoader::didCreateQuickLookHandle): Deleted.
2639         * loader/ResourceLoader.h:
2640         * loader/SubresourceLoader.cpp:
2641         (WebCore::SubresourceLoader::shouldCreateQuickLookHandleForResponse): Changed to access m_quickLookHandle.
2642         (WebCore::SubresourceLoader::didReceiveResponse): Ditto.
2643         (WebCore::SubresourceLoader::didReceiveData): Ditto.
2644         (WebCore::SubresourceLoader::didReceiveBuffer): Ditto.
2645         (WebCore::SubresourceLoader::didFinishLoading): Ditto.
2646         (WebCore::SubresourceLoader::didFail): Ditto.
2647         * loader/cache/CachedRawResource.cpp:
2648         (WebCore::CachedRawResource::finishLoading): Wrapped the call to ResourceLoader::isQuickLookResource() in USE(QUICK_LOOK).
2649         * loader/ios/QuickLook.h: Renamed m_converter to m_previewLoader.
2650         * loader/ios/QuickLook.mm: Renamed WebPreviewConverter to WebPreviewLoader.
2651         (WebCore::registerQLPreviewConverterIfNeeded): Created a PreviewConverter instead of a QLPreviewConverter.
2652         (-[WebPreviewLoader initWithResourceLoader:resourceResponse:quickLookHandle:]): Ditto.
2653         (-[WebPreviewLoader appendDataArray:]): Accessed the QLPreviewConverter from the PreviewConverter.
2654         (-[WebPreviewLoader finishedAppending]): Ditto.
2655         (-[WebPreviewLoader failed]): Ditto.
2656         (-[WebPreviewLoader converter]): Renamed from platformConverter. Returns a pointer to the PreviewConverter.
2657         (-[WebPreviewLoader _sendDidReceiveResponseIfNecessary]): Moved _converter to DocumentLoader.
2658         (-[WebPreviewLoader connection:didFailWithError:]): Created a PreviewConverter instead of a QLPreviewConverter.
2659         (WebCore::QuickLookHandle::QuickLookHandle): Called FrameLoaderClient::didCreateQuickLookHandle() instead of going through FrameLoader.
2660         (WebCore::QuickLookHandle::didReceiveData): Renamed m_converter to m_previewLoader.
2661         (WebCore::QuickLookHandle::didReceiveBuffer): Ditto.
2662         (WebCore::QuickLookHandle::didFinishLoading): Ditto.
2663         (WebCore::QuickLookHandle::didFail): Ditto.
2664         (WebCore::QuickLookHandle::setClient): Ditto.
2665         (WebCore::QuickLookHandle::previewFileName): Ditto.
2666         (WebCore::QuickLookHandle::previewUTI): Ditto.
2667         (WebCore::QuickLookHandle::willSendRequest): Deleted.
2668         * platform/ios/QuickLookSoftLink.h: Removed soft-linking of QLPreviewConverter and kQLPreviewOptionPasswordKey.
2669         * platform/ios/QuickLookSoftLink.mm: Ditto.
2670         * platform/network/ios/PreviewConverter.h: Added.
2671         (WebCore::PreviewConverter::platformConverter): Added. Returns the underlying QLPreviewConverter.
2672         * platform/network/ios/PreviewConverter.mm: Added.
2673         (WebCore::optionsWithPassword): Creates a dictionary with the kQLPreviewOptionPasswordKey option set if password is non-null.
2674         (WebCore::PreviewConverter::PreviewConverter): Added constructors for the delegate/response and data/uti cases.
2675         (WebCore::PreviewConverter::safeRequest): Wraps -[QLPreviewConverter safeRequestForRequest:].
2676         (WebCore::PreviewConverter::previewRequest): Wraps -[QLPreviewConverter previewRequest].
2677         (WebCore::PreviewConverter::previewResponse): Wraps -[QLPreviewConverter previewResponse].
2678         (WebCore::PreviewConverter::previewFileName): Wraps -[QLPreviewConverter previewFileName].
2679         (WebCore::PreviewConverter::previewUTI): Wraps -[QLPreviewConverter previewUTI].
2680
2681 2017-01-30  Chris Dumez  <cdumez@apple.com>
2682
2683         Drop legacy Attributes.isId attribute
2684         https://bugs.webkit.org/show_bug.cgi?id=167603
2685
2686         Reviewed by Ryosuke Niwa.
2687
2688         Drop legacy Attributes.isId attribute.
2689
2690         This attribute is not in the specification:
2691         - https://dom.spec.whatwg.org/#interface-attr
2692
2693         Both Firefox and Chrome currently do not expose this attribute.
2694
2695         No new tests, rebaselined existing test.
2696
2697         * dom/Attr.cpp:
2698         * dom/Attr.h:
2699         * dom/Attr.idl:
2700
2701 2017-01-30  Zalan Bujtas  <zalan@apple.com>
2702
2703         Simple line layout: Small tweaks to improve performance.
2704         https://bugs.webkit.org/show_bug.cgi?id=167611
2705         <rdar://problem/30274294>
2706
2707         Reviewed by Simon Fraser.
2708
2709         This is ~10% progression on the attached test case (paragraphs with non-redundant content).
2710         median: 102.08 runs/s -> median: 114.25 runs/s
2711
2712         * rendering/SimpleLineLayout.cpp:
2713         (WebCore::SimpleLineLayout::LineState::appendFragmentAndCreateRunIfNeeded):
2714         * rendering/SimpleLineLayoutFlowContents.cpp:
2715         (WebCore::SimpleLineLayout::initializeSegments):
2716         (WebCore::SimpleLineLayout::FlowContents::FlowContents):
2717         * rendering/SimpleLineLayoutFlowContents.h:
2718         * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
2719         (WebCore::SimpleLineLayout::TextFragmentIterator::nextNonWhitespacePosition):
2720         (WebCore::SimpleLineLayout::TextFragmentIterator::skipToNextPosition):
2721         * rendering/SimpleLineLayoutTextFragmentIterator.h:
2722
2723 2017-01-30  Chris Dumez  <cdumez@apple.com>
2724
2725         Drop legacy constants on Event interface
2726         https://bugs.webkit.org/show_bug.cgi?id=167602
2727
2728         Reviewed by Sam Weinig.
2729
2730         Drop legacy constants on Event interface:
2731         MOUSEDOWN, MOUSEUP, MOUSEOVER, MOUSEOUT, MOUSEMOVE, MOUSEDRAG,
2732         CLICK, DBLCLICK, KEYDOWN, KEYUP, KEYPRESS, DRAGDROP, FOCUS,
2733         BLUR, SELECT, and CHANGE.
2734
2735         Those constants are not used for anything, they are not in the
2736         specification and Chrome / Firefox do not have them.
2737
2738         No new tests, rebaselined existing test.
2739
2740         * dom/Event.idl:
2741
2742 2017-01-30  Simon Fraser  <simon.fraser@apple.com>
2743
2744         [iOS] position:fixed inside touch-scrollable overflow is mispositioned
2745         https://bugs.webkit.org/show_bug.cgi?id=167604
2746         rdar://problem/29500273
2747
2748         Reviewed by Zalan Bujtas.
2749         
2750         For layers inside touch-scrollable overflow, RenderLayerBacking::computeParentGraphicsLayerRect() needs
2751         to account for the offset from the ancestor compositing layer's origin, to handle scrollable elements with
2752         box-shadow, for example.
2753         
2754         Also make the compositing log output a little easier to read.
2755
2756         Test: compositing/scrolling/fixed-inside-scroll.html
2757
2758         * rendering/RenderLayerBacking.cpp:
2759         (WebCore::RenderLayerBacking::computeParentGraphicsLayerRect):
2760         * rendering/RenderLayerCompositor.cpp:
2761         (WebCore::RenderLayerCompositor::logLayerInfo):
2762
2763 2017-01-30  Jer Noble  <jer.noble@apple.com>
2764
2765         NULL-deref crash at PlatformMediaSession::endInterruption
2766         https://bugs.webkit.org/show_bug.cgi?id=167595
2767
2768         Reviewed by Eric Carlson.
2769
2770         Use the same, NULL-aware forEachSession() iterator rather than iterating over m_sessions directly.
2771
2772         * platform/audio/PlatformMediaSessionManager.cpp:
2773         (WebCore::PlatformMediaSessionManager::beginInterruption):
2774         (WebCore::PlatformMediaSessionManager::endInterruption):
2775
2776 2017-01-30  Myles C. Maxfield  <mmaxfield@apple.com>
2777
2778         Correct spacing regression on inter-element complex path shaping on some fonts
2779         https://bugs.webkit.org/show_bug.cgi?id=166013
2780
2781         Reviewed by Simon Fraser.
2782
2783         This patch brings the implementation of ComplexTextController in-line with the
2784         design at https://trac.webkit.org/wiki/ComplexTextController. Previously,
2785         ComplexTextController had a few problems:
2786         - The total width computed by ComplexTextController didn't match the width if
2787         you iterated over the entire string and added up the advances
2788         - FontCascade::getGlyphsAndAdvancesForComplexText() tried to compensate for
2789         the above by construing the concepts of paint advances as distinct from layout
2790         advances
2791         - Initial advances were considered part of layout sometimes and part of painting
2792         other times, depending on which function reports the information
2793         - For RTL runs, the wrong origin was added to the initial advance, and the origin
2794         should have been subtracted instead of added
2795
2796         This patch exhaustively updates every function in ComplexTextController to be
2797         consistent with the design linked to above. This design solves all of these
2798         problems.
2799
2800         Tests: ComplexTextControllerTest.InitialAdvanceWithLeftRunInRTL
2801                ComplexTextControllerTest.InitialAdvanceInRTL
2802                ComplexTextControllerTest.InitialAdvanceWithLeftRunInLTR
2803                ComplexTextControllerTest.InitialAdvanceInLTR
2804                ComplexTextControllerTest.InitialAdvanceInRTLNoOrigins
2805                ComplexTextControllerTest.LeadingExpansion
2806                ComplexTextControllerTest.VerticalAdvances
2807
2808         * platform/graphics/GlyphBuffer.h:
2809         (WebCore::GlyphBuffer::setLeadingExpansion): Deleted. No longer necessary.
2810         (WebCore::GlyphBuffer::leadingExpansion): Deleted. Ditto.
2811         * platform/graphics/cocoa/FontCascadeCocoa.mm:
2812         (WebCore::FontCascade::adjustSelectionRectForComplexText): Removed use of
2813         unnecessary leadingExpansion().
2814         (WebCore::FontCascade::getGlyphsAndAdvancesForComplexText): This function needs
2815         to compute paint advances, which means that it can't base this information off
2816         of layout advances. This function uses the trick mentioned at the end of the
2817         above link to compute the paint offset of an arbitrary glyph in the middle of
2818         an RTL run.
2819         * platform/graphics/mac/ComplexTextController.cpp:
2820         (WebCore::ComplexTextController::computeExpansionOpportunity): Refactored for
2821         testing.
2822         (WebCore::ComplexTextController::ComplexTextController): Ditto.
2823         (WebCore::ComplexTextController::finishConstruction): Ditto.
2824         (WebCore::ComplexTextController::offsetForPosition): This function operates on
2825         layout advances, and the initial layout advance is already added into the
2826         m_adjustedBaseAdvances vector by adjustGlyphsAndAdvances(). Therefore, there is
2827         no need to add it again here.
2828         (WebCore::ComplexTextController::advance): This function had completely busted
2829         logic about the relationship between initial advances and the first origin in
2830         each run. Because of the fortunate choice of only representing layout advances 
2831         in m_adjustedBaseAdvances, this entire block can be removed and the raw paint
2832         initial advance can be reported to the GlyphBuffer. Later in the function, we
2833         have to update the logic about how to compute a paint advance given a layout
2834         advance and some origins. In particular, there are two tricky pieces here: 1.
2835         The layout advance for the first glyph is equal to (initial advance - first
2836         origin + first Core Text advance, so computing the paint offset must cancel out
2837         the initial layout offset, and 2. the last paint advance in a run must actually
2838         end up at the position of the first glyph in the next run, so the next run's
2839         initial advance must be queried.
2840         (WebCore::ComplexTextController::adjustGlyphsAndAdvances): Previously, we
2841         represented an initial advance of a successive run by just adding it to the
2842         previous run's last advance. However, this is incompatible with the new model
2843         presented in the link above, so we remove this section. We also have to add in
2844         the logic that the layout advance for the first glyph is equal to the formula
2845         presented above.
2846         * platform/graphics/mac/ComplexTextController.h:
2847         (WebCore::ComplexTextController::ComplexTextRun::initialAdvance): Adjust comment
2848         to reflect reality.
2849         (WebCore::ComplexTextController::leadingExpansion): Deleted.
2850
2851 2017-01-30  Simon Fraser  <simon.fraser@apple.com>
2852
2853         Fixed elements should not rubber-band in WK2, nor remain at negative offsets
2854         https://bugs.webkit.org/show_bug.cgi?id=167484
2855         rdar://problem/29453068
2856
2857         Reviewed by Dean Jackson.
2858
2859         There were various problems with the layout rect computation:
2860         1. It ignored the scrollBehaviorForFixedElements() which we use to avoid rubber-banding fixed
2861            elements in WK2, but allow in WK1, so make use of that.
2862         2. Sometimes layouts/paints of fixed elements would be triggered when coalesced calls to
2863            AsyncScrollingCoordinator::scheduleUpdateScrollPositionAfterAsyncScroll() failed to
2864            copy the layoutViewportOrigin to the scheduled update.
2865         3. The layout viewport could be left with a negative top/left after rubber-banding.
2866         
2867         Also add a way to do unconstrained scrollTo(), so that a test can call window.scrollTo(-10, -10) to
2868         simulate rubberbanding.
2869
2870         Tests: fast/visual-viewport/rubberbanding-viewport-rects-header-footer.html
2871                fast/visual-viewport/rubberbanding-viewport-rects.html
2872
2873         * page/FrameView.cpp:
2874         (WebCore::FrameView::computeLayoutViewportOrigin): Handle ScrollBehaviorForFixedElements, incorporating it
2875         into logic that clamps layoutViewportOrigin between min/max when rubberbanding is not allowed, or not in progress.
2876         (WebCore::FrameView::updateLayoutViewport): Pass in scrollBehaviorForFixedElements().
2877         (WebCore::FrameView::visibleDocumentRect): The clamping here was preventing the visible rect from
2878         escaping the document bounds, which caused fixed elements to bounce with rubber-banding, so remove the clamping,
2879         and fix the logic to allow rubber-banding while taking headers and footers into account.
2880         * page/FrameView.h:
2881         * page/scrolling/AsyncScrollingCoordinator.cpp:
2882         (WebCore::AsyncScrollingCoordinator::scheduleUpdateScrollPositionAfterAsyncScroll): layoutViewportOrigin has to
2883         be pushed onto the scheduled update, just like scroll position.
2884         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
2885         (WebCore::ScrollingTreeFrameScrollingNode::layoutViewportForScrollPosition): Pass in m_behaviorForFixed.
2886         * platform/ScrollView.cpp:
2887         (WebCore::ScrollView::ScrollView):
2888         (WebCore::ScrollView::adjustScrollPositionWithinRange):
2889         (WebCore::ScrollView::setScrollOffset):
2890         * platform/ScrollView.h:
2891         (WebCore::ScrollView::setAllowsUnclampedScrollPositionForTesting):
2892         (WebCore::ScrollView::allowsUnclampedScrollPosition):
2893         * testing/InternalSettings.cpp:
2894         (WebCore::InternalSettings::setAllowUnclampedScrollPosition):
2895         * testing/InternalSettings.h:
2896         * testing/InternalSettings.idl:
2897
2898 2017-01-30  Wenson Hsieh  <wenson_hsieh@apple.com>
2899
2900         Web content process crashes when initiating a drag on a very large image
2901         https://bugs.webkit.org/show_bug.cgi?id=167564
2902
2903         Reviewed by Beth Dakin.
2904
2905         If we begin dragging an image element that is too large to show the cached image for, we will show an image file
2906         icon instead of the cached image. This may return null if createDragImageIconForCachedImageFilename is
2907         unimplemented, so in the meantime, we should not assume that dragImage will always exist before calling into
2908         doSystemDrag in doImageDrag and bail from the drag operation if that is the case.
2909
2910         * page/DragController.cpp:
2911         (WebCore::DragController::doImageDrag):
2912
2913 2017-01-30  Chris Dumez  <cdumez@apple.com>
2914
2915         Update DiagnosticLoggingClient::logDiagnosticMessageWithValue() to take in the value as a double
2916         https://bugs.webkit.org/show_bug.cgi?id=167536
2917
2918         Reviewed by Darin Adler.
2919
2920         Update DiagnosticLoggingClient::logDiagnosticMessageWithValue() to take in the value as a double
2921         instead of a string. The value needs to be numeric and the current API is error-prone.
2922
2923         * html/HTMLMediaElement.cpp:
2924         (WebCore::HTMLMediaElement::mediaPlayerEngineFailedToLoad):
2925         * loader/EmptyClients.cpp:
2926         * page/DiagnosticLoggingClient.h:
2927
2928 2017-01-30  Ryan Haddad  <ryanhaddad@apple.com>
2929
2930         Unreviewed, rollout r211235 Pointer lock events should be delivered directly to the target element.
2931
2932         The LayoutTest for this change is frequently failing.
2933
2934         * page/EventHandler.cpp:
2935         (WebCore::EventHandler::handleMousePressEvent):
2936         (WebCore::EventHandler::handleMouseDoubleClickEvent):
2937         (WebCore::EventHandler::handleMouseMoveEvent):
2938         (WebCore::EventHandler::handleMouseReleaseEvent):
2939         (WebCore::EventHandler::handleMouseForceEvent):
2940         (WebCore::EventHandler::handleWheelEvent):
2941         * page/PointerLockController.cpp:
2942         (WebCore::PointerLockController::isLocked): Deleted.
2943         (WebCore::PointerLockController::dispatchLockedWheelEvent): Deleted.
2944         * page/PointerLockController.h:
2945
2946 2017-01-30  Antoine Quint  <graouts@apple.com>
2947
2948         LayoutTest media/modern-media-controls/media-controller/media-controller-auto-hide-mouse-leave-after-play.html is flaky
2949         https://bugs.webkit.org/show_bug.cgi?id=167254
2950         <rdar://problem/30259293>
2951
2952         Reviewed by Dean Jackson.
2953
2954         When we would identify that we need to prolong an existing auto-hide timer, when the previous
2955         auto-hide timer was marked as non-cancelable, calling _cancelAutoHideTimer() would not actually
2956         cancel the previous timer, which would let it fire and hide the controls bar. We now have two
2957         methods, _cancelAutoHideTimer() which always cancels the current auto-hide timer, and
2958         _cancelNonEnforcedAutoHideTimer() which is used from all other existing call sites, which only
2959         cancels the current auto-hide timer if it was marked as cancelable. This, and revised timing in
2960         the test itself, make media/modern-media-controls/media-controller/media-controller-auto-hide-
2961         mouse-leave-after-play.html a lot more reliable.
2962
2963         We also make a small drive-by fix where we ensure the "autoHideDelay" property is set first so
2964         that setting other members which may set a timer do not used an undefined value for the auto-hide
2965         timer delay.
2966
2967         * Modules/modern-media-controls/controls/controls-bar.js:
2968         (ControlsBar.prototype.set visible):
2969         (ControlsBar.prototype.handleEvent):
2970         (ControlsBar.prototype._cancelNonEnforcedAutoHideTimer):
2971         (ControlsBar.prototype._cancelAutoHideTimer):
2972
2973 2017-01-30  Carlos Garcia Campos  <cgarcia@igalia.com>
2974
2975         REGRESSION(r202615?): [GStreamer] ASSERTION FAILED: isMainThread() in WebCore::BuiltinResourceHandleConstructorMap& WebCore::builtinResourceHandleConstructorMap()
2976         https://bugs.webkit.org/show_bug.cgi?id=167003
2977
2978         Reviewed by Michael Catanzaro.
2979
2980         Add a way to create a ResourceHandle for a given SoupNetworkSession and use it in the GStreamer streaming client
2981         to ensure both the session and the handle are created and destroyed in the secondary thread. This way we also
2982         avoid using the default session for downloading HLS fragments.
2983
2984         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
2985         (ResourceHandleStreamingClient::ResourceHandleStreamingClient): Create a SoupNetworkSession and pass it to ResourceHandle::create().
2986         * platform/network/ResourceHandle.h: Add create and constructor to receive a SoupNetworkSession.
2987         * platform/network/ResourceHandleInternal.h: Add SoupNetworkSession member.
2988         * platform/network/soup/ResourceHandleSoup.cpp:
2989         (WebCore::ResourceHandleInternal::soupSession): Return the SoupNetworkSession if not nullptr.
2990         (WebCore::ResourceHandle::create): Create a ResourceHandle without trying to use any builtin constructor and
2991         using the given SoupNetworkSession.
2992         (WebCore::ResourceHandle::ResourceHandle): Set the SoupNetworkSession if early request validations didn't fail.
2993
2994 2017-01-30  Youenn Fablet  <youennf@gmail.com>
2995
2996         [WebRTC] Add support for libwebrtc data channel
2997         https://bugs.webkit.org/show_bug.cgi?id=167489
2998
2999         Reviewed by Alex Christensen.
3000
3001         Partially covered by webrtc/datachannel/basic.html but not yet enabled on bots.
3002
3003         Introducing LibWebRTCDataChannelHandler as the integration layer between WebCore (RTCDataChannel)
3004         and libwebrtc (DataChannelObserver).
3005
3006         * Modules/mediastream/RTCDataChannel.cpp:
3007         (WebCore::RTCDataChannel::create):
3008         (WebCore::RTCDataChannel::RTCDataChannel):
3009         (WebCore::RTCDataChannel::bufferedAmount):
3010         (WebCore::RTCDataChannel::bufferedAmountIsDecreasing):
3011         * Modules/mediastream/RTCDataChannel.h:
3012         * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp: Added.
3013         (WebCore::LibWebRTCDataChannelHandler::~LibWebRTCDataChannelHandler):
3014         (WebCore::LibWebRTCDataChannelHandler::setClient):
3015         (WebCore::LibWebRTCDataChannelHandler::sendStringData):
3016         (WebCore::LibWebRTCDataChannelHandler::sendRawData):
3017         (WebCore::LibWebRTCDataChannelHandler::close):
3018         (WebCore::LibWebRTCDataChannelHandler::OnStateChange):
3019         (WebCore::LibWebRTCDataChannelHandler::OnMessage):
3020         * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.h:
3021         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
3022         (WebCore::LibWebRTCMediaEndpoint::OnRemoveStream):
3023         (WebCore::LibWebRTCMediaEndpoint::addDataChannel):
3024         (): Deleted.
3025         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
3026         (WebCore::LibWebRTCPeerConnectionBackend::createDataChannelHandler):
3027         * dom/EventNames.h:
3028         * platform/mediastream/RTCDataChannelHandler.h:
3029         * platform/mediastream/RTCDataChannelHandlerClient.h:
3030         * platform/mock/RTCDataChannelHandlerMock.h:
3031
3032 2017-01-30  Carlos Garcia Campos  <cgarcia@igalia.com>
3033
3034         Several web timing tests crash in GTK+ and AppleWin bots
3035         https://bugs.webkit.org/show_bug.cgi?id=167577
3036
3037         Reviewed by Ryosuke Niwa.
3038
3039         The problem is that entry is used in both the key, to get name, and in the value with WTFMove. So, the name is
3040         invalidated by the move. It could be fixed by simply copying the name, instead of using entry->name, but I think
3041         that code could be simplified using HashMap::ensure and then we don't need any string copy, nor even the static
3042         insertPerformanceEntry().
3043
3044         Fix crashes in several imported/w3c/web-platform-tests/user-timing/ tests.
3045
3046         * page/PerformanceUserTiming.cpp:
3047         (WebCore::UserTiming::mark):
3048         (WebCore::UserTiming::measure):
3049         (WebCore::insertPerformanceEntry): Deleted.
3050
3051 2017-01-30  Carlos Garcia Campos  <cgarcia@igalia.com>
3052
3053         [Threaded Compositor] Crash in GraphicsContext3D::deleteTexture when destroying TextureMapperPlatformLayerProxy
3054         https://bugs.webkit.org/show_bug.cgi?id=167575
3055
3056         Reviewed by Žan Doberšek.
3057
3058         We should clear all the buffers on invalidate to ensure we don't have textures alive after CoordinatedGraphicsScene::purgeGLResources().
3059
3060         Fix crash in media/video-poster-background.html.
3061
3062         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:
3063         (WebCore::TextureMapperPlatformLayerProxy::invalidate): Clear current, pending and all used buffers.
3064
3065 2017-01-29  Carlos Garcia Campos  <cgarcia@igalia.com>
3066
3067         [Threaded Compositor] Crash on WebCore::GLContext::version()
3068         https://bugs.webkit.org/show_bug.cgi?id=167559
3069
3070         Reviewed by Michael Catanzaro.
3071
3072         Fixes crashes in several media tests.
3073
3074         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:
3075         (WebCore::TextureMapperPlatformLayerProxy::invalidate): Clear m_compositorThreadUpdateTimer and call the update function.
3076
3077 2017-01-29  Nan Wang  <n_wang@apple.com>
3078
3079         AX: WKContentView needs to implement UITextInput methods to make speak selection highlighting work
3080         https://bugs.webkit.org/show_bug.cgi?id=166955
3081
3082         Reviewed by Ryosuke Niwa.
3083
3084         Created a new version of Range::collectSelectionRect() that returns rects for each
3085         line, so that Speak Selection doesn't need to handle searching for soft line breaks.
3086         Also added a variant of findPlainText to search for the closest matched range to the given position.
3087
3088         Test: editing/text-iterator/range-of-string-closest-to-position.html
3089
3090         * dom/Range.cpp:
3091         (WebCore::Range::collectSelectionRectsWithoutUnionInteriorLines):
3092         (WebCore::Range::collectSelectionRects):
3093         * dom/Range.h:
3094         * editing/TextIterator.cpp:
3095         (WebCore::findPlainTextMatches):
3096         (WebCore::updateSearchBuffer):
3097         (WebCore::findIteratorOptions):
3098         (WebCore::rangeMatches):
3099         (WebCore::findClosestPlainText):
3100         (WebCore::findPlainText):
3101         (WebCore::findPlainTextOffset): Deleted.
3102         * editing/TextIterator.h:
3103         * editing/htmlediting.h:
3104         * testing/Internals.cpp:
3105         (WebCore::Internals::rangeOfStringNearLocation):
3106         * testing/Internals.h:
3107         * testing/Internals.idl:
3108
3109 2017-01-29  Andy Estes  <aestes@apple.com>
3110
3111         [QuickLook] Add a WebPreference to enable saving QuickLook documents in WebKitLegacy
3112         https://bugs.webkit.org/show_bug.cgi?id=167563
3113         <rdar://problem/30253207>
3114
3115         Reviewed by Andreas Kling.
3116
3117         * loader/ios/QuickLook.h: Removed unused declarations.
3118         (WebCore::QuickLookHandle::firstRequestURL): Deleted.
3119         * loader/ios/QuickLook.mm:
3120         (WebCore::removeQLPreviewConverterForURL): Stopped deleting the temporary file here; that's
3121         now done in QuickLookDocumentWriter.
3122         (addQLPreviewConverterWithFileForURL): Changed from an exported function to a static
3123         function since it's now only called inside QuickLook.mm.
3124         (WebCore::QuickLookHandle::QuickLookHandle): Stopped initializing m_firstRequestURL.
3125         (WebCore::addQLPreviewConverterWithFileForURL): Deleted.
3126         (WebCore::qlPreviewConverterFileNameForURL): Deleted.
3127         (WebCore::qlPreviewConverterUTIForURL): Deleted.
3128         (WebCore::QuickLookHandle::previewRequestURL): Deleted.
3129         (WebCore::QuickLookHandle::converter): Deleted.
3130
3131 2017-01-29  Zalan Bujtas  <zalan@apple.com>
3132
3133         Simple line layout: PerformanceTests/Layout/simple-line-layout-innertext.html regressed at r211108
3134         https://bugs.webkit.org/show_bug.cgi?id=167562
3135
3136         Reviewed by Antti Koivisto.
3137
3138         Apparently RunResolver::Run::constructStringForHyphenIfNeeded() is in a superhot codepath.
3139         The Run should not have any additional members anyway, so let's construct the hyphenated
3140         string on demand.
3141         Progression on simple-line-layout-innertext.html is from ~34runs/sec back to ~50runs/sec.
3142
3143         Covered by existing text.
3144
3145         * rendering/RenderTreeAsText.cpp:
3146         (WebCore::writeSimpleLine):
3147         * rendering/SimpleLineLayoutFunctions.cpp:
3148         (WebCore::SimpleLineLayout::paintFlow):
3149         * rendering/SimpleLineLayoutResolver.cpp:
3150         (WebCore::SimpleLineLayout::RunResolver::Run::Run):
3151         (WebCore::SimpleLineLayout::RunResolver::Run::textWithHyphen):
3152         (WebCore::SimpleLineLayout::RunResolver::Run::text):
3153         (WebCore::SimpleLineLayout::RunResolver::Run::constructStringForHyphenIfNeeded): Deleted.
3154         * rendering/SimpleLineLayoutResolver.h:
3155
3156 2017-01-28  Tim Horton  <timothy_horton@apple.com>
3157
3158         Don't flash a tap highlight for the entirety of an editable WKWebView
3159         https://bugs.webkit.org/show_bug.cgi?id=167486
3160         <rdar://problem/30193996>
3161
3162         Reviewed by Dan Bernstein.
3163
3164         * dom/Document.h:
3165         Export.
3166
3167 2017-01-28  Wenson Hsieh  <wenson_hsieh@apple.com>
3168
3169         Check USE(APPLE_INTERNAL_SDK) instead of specific headers when importing from WebKitAdditions
3170         https://bugs.webkit.org/show_bug.cgi?id=167555
3171
3172         Reviewed by Dan Bernstein.
3173
3174         Instead of guarding #import <WebKitAdditions/*> on the existence of the imported file, consult
3175         USE(APPLE_INTERNAL_SDK) instead.
3176
3177         * page/ios/EventHandlerIOS.mm:
3178         * platform/ios/DragImageIOS.mm:
3179         * platform/ios/PasteboardIOS.mm:
3180         * platform/mac/DragDataMac.mm:
3181
3182 2017-01-28  Yoav Weiss  <yoav@yoav.ws>
3183
3184         Add Link Preload as an off-by-default experimental feature menu item.
3185         https://bugs.webkit.org/show_bug.cgi?id=167201
3186
3187         Reviewed by Ryosuke Niwa.
3188
3189         Removed the explicit setting of the Link Preload experimental feature,
3190         as it is now on by default for testing.
3191
3192         No new tests as this just removes methods from settings.
3193
3194         * testing/InternalSettings.cpp:
3195         (WebCore::InternalSettings::Backup::Backup):
3196         (WebCore::InternalSettings::Backup::restoreTo):
3197         * testing/InternalSettings.h:
3198         * testing/InternalSettings.idl:
3199
3200 2017-01-28  Joseph Pecoraro  <pecoraro@apple.com>
3201
3202         Fix typo in error message
3203         https://bugs.webkit.org/show_bug.cgi?id=167554
3204
3205         Reviewed by Sam Weinig.
3206
3207         * bindings/scripts/CodeGenerator.pm:
3208         (GetEnumByType):
3209
3210 2017-01-28  Antoine Quint  <graouts@apple.com>
3211
3212         [Modern Media Controls] REGRESSION: Video stops playing after going into Full Screen in media documents
3213         https://bugs.webkit.org/show_bug.cgi?id=167552
3214         <rdar://problem/29601646>
3215
3216         Reviewed by Eric Carlson.
3217
3218         In the case of media documents, there is a built-in behavior, implemented in MediaDocument::defaultEventHandler(),
3219         that toggles playback when clicking or double-clicking the video. We disable this behavior by adding a "click" event
3220         handler on the entire media shadow root and calling "preventDefault()".
3221
3222         Test: media/modern-media-controls/media-documents/click-on-video-should-not-pause.html
3223
3224         * Modules/modern-media-controls/media/media-controller.js:
3225         (MediaController):
3226         (MediaController.prototype.handleEvent):
3227         (MediaController.prototype._containerWasClicked):
3228
3229 2017-01-28  Dan Bernstein  <mitz@apple.com>
3230
3231         [Xcode] Clean up PAL and WebCore’s build settings a little
3232         https://bugs.webkit.org/show_bug.cgi?id=167292
3233
3234         Reviewed by Sam Weinig.
3235
3236         * Configurations/Base.xcconfig: Simplified the definition of
3237           GCC_WARN_64_TO_32_BIT_CONVERSION, removed the unused build setting PREBINDING, removed
3238           a duplicate definition of GCC_GENERATE_DEBUGGING_SYMBOLS, and removed definitions specific
3239           to OS X versions that are no longer supported.
3240
3241         * Configurations/DebugRelease.xcconfig: Removed definitions specific to OS X versions
3242           that are no longer supported.
3243
3244 2017-01-28  Zalan Bujtas  <zalan@apple.com>
3245
3246         Resolve beforeChild's render tree position before calling addChildIgnoringContinuation.
3247         https://bugs.webkit.org/show_bug.cgi?id=167540
3248         <rdar://problem/30126535>
3249
3250         Reviewed by Simon Fraser.
3251
3252         Use the actual render tree position for the beforeChild when inside a flow thread.
3253
3254         Test: fast/multicol/assert-on-continuation-with-spanner.html
3255
3256         * rendering/RenderBlockFlow.cpp:
3257         (WebCore::RenderBlockFlow::addChild):
3258         * rendering/RenderInline.cpp:
3259         (WebCore::RenderInline::addChild):
3260         * rendering/RenderMultiColumnFlowThread.cpp:
3261         (WebCore::RenderMultiColumnFlowThread::resolveMovedChild):
3262
3263 2017-01-28  Andreas Kling  <akling@apple.com>
3264
3265         Avoid synchronous style recalc in dispatchUnloadEvents().
3266         <https://webkit.org/b/167551>
3267
3268         Reviewed by Antti Koivisto.
3269
3270         It shouldn't be necessary to force a synchronous style resolution in an unloading document.
3271         This call has been here since the import of KHTMLPart.
3272
3273         * loader/FrameLoader.cpp:
3274         (WebCore::FrameLoader::dispatchUnloadEvents):
3275
3276 2017-01-28  Andreas Kling  <akling@apple.com>
3277
3278         REGRESSION(r196383): Automatic shrink-to-fit of RuleSet no longer works.
3279         <https://webkit.org/b/167543>
3280
3281         Reviewed by Antti Koivisto.
3282
3283         Re-enable the automatic shrink-to-fit optimization in RuleSet.
3284         This was disabled accidentally, which I discovered while investigating
3285         the memory footprint of extension stylesheets.
3286
3287         * css/RuleSet.h:
3288
3289 2017-01-28  Antti Koivisto  <antti@apple.com>
3290
3291         Give scripts 'high' load priority
3292         https://bugs.webkit.org/show_bug.cgi?id=167550
3293
3294         Reviewed by Andreas Kling.
3295
3296         For historical reasons it is currently 'medium', same as web fonts and some other non-parsing blocking things.
3297
3298         * loader/cache/CachedResource.cpp:
3299         (WebCore::CachedResource::defaultPriorityForResourceType):
3300
3301 2017-01-28  Joseph Pecoraro  <pecoraro@apple.com>
3302
3303         Add User Timing Experimental Feature
3304         https://bugs.webkit.org/show_bug.cgi?id=167542
3305         <rdar://problem/22746307>
3306
3307         Reviewed by Ryosuke Niwa.
3308
3309         * page/RuntimeEnabledFeatures.h:
3310         (WebCore::RuntimeEnabledFeatures::performanceTimelineEnabled):
3311         * page/Performance.idl:
3312         * page/PerformanceEntry.idl:
3313         Make a better RuntimeEnabledFeature named "PerformanceTiming" which
3314         is enabled if either UserTiming or ResourceTiming is enabled. This
3315         will then expose the APIs that are only useful when at least one of
3316         the APIs are available.
3317
3318         * page/PerformanceEntry.cpp:
3319         (WebCore::PerformanceEntry::name): Deleted.
3320         (WebCore::PerformanceEntry::entryType): Deleted.
3321         (WebCore::PerformanceEntry::startTime): Deleted.
3322         (WebCore::PerformanceEntry::duration): Deleted.
3323         * page/PerformanceEntry.h:
3324         (WebCore::PerformanceEntry::name):
3325         (WebCore::PerformanceEntry::entryType):
3326         (WebCore::PerformanceEntry::startTime):
3327         (WebCore::PerformanceEntry::duration):
3328         Inline simple accessors.
3329
3330         * page/PerformanceUserTiming.cpp:
3331         (WebCore::UserTiming::measure):
3332         Fix a bug introduced by ExceptionOr refactoring.
3333
3334         (WebCore::UserTiming::clearMarks):
3335         (WebCore::UserTiming::clearMeasures):
3336         (WebCore::clearPerformanceEntries):
3337         (WebCore::clearPeformanceEntries): Deleted.
3338         Fix method name typo.
3339
3340 2017-01-27  Dan Bernstein  <mitz@apple.com>
3341
3342         Ignore Xcode’s project.xcworkspace and userdata directories in this new project like we do
3343         in other projects.
3344
3345         * PAL/PAL.xcodeproj: Added property svn:ignore.
3346
3347 2017-01-27  Andy Estes  <aestes@apple.com>
3348
3349         Fix the iOS build when USE(QUICK_LOOK) is disabled.
3350
3351         * testing/Internals.cpp:
3352         (WebCore::Internals::setQuickLookPassword):
3353         * testing/Internals.h:
3354
3355 2017-01-27  Yusuke Suzuki  <utatane.tea@gmail.com>
3356
3357         setTimeout / setInterval's string execution should inherit SourceOrigin correctly
3358         https://bugs.webkit.org/show_bug.cgi?id=167097
3359
3360         Reviewed by Darin Adler.
3361
3362         Tests: js/dom/modules/import-from-set-interval.html
3363                js/dom/modules/import-from-set-timeout.html
3364
3365         * bindings/js/ScriptController.cpp:
3366         (WebCore::ScriptController::executeScriptInWorld):
3367
3368 2017-01-27  Yusuke Suzuki  <utatane.tea@gmail.com>
3369
3370         Merge CachedModuleScript and LoadableModuleScript
3371         https://bugs.webkit.org/show_bug.cgi?id=167500
3372
3373         Reviewed by Darin Adler.
3374
3375         CachedModuleScript becomes duplicate with LoadableModuleScript.
3376         And CachedModuleScript does not offer any meaningful functionality
3377         to LoadableModuleScript.
3378         This patch merges CachedModuleScript to LoadableModuleScript.
3379
3380         No behavior change.
3381
3382         * CMakeLists.txt:
3383         * WebCore.xcodeproj/project.pbxproj:
3384         * bindings/js/CachedModuleScript.cpp: Removed.
3385         * bindings/js/CachedModuleScript.h: Removed.
3386         * bindings/js/CachedModuleScriptClient.h: Removed.
3387         * bindings/js/JSBindingsAllInOne.cpp:
3388         * bindings/js/ScriptController.cpp:
3389         (WebCore::ScriptController::loadModuleScriptInWorld):
3390         (WebCore::ScriptController::loadModuleScript):
3391         (WebCore::ScriptController::linkAndEvaluateModuleScriptInWorld):
3392         (WebCore::ScriptController::linkAndEvaluateModuleScript):
3393         (WebCore::ScriptController::setupModuleScriptHandlers):
3394         * bindings/js/ScriptController.h:
3395         * dom/LoadableModuleScript.cpp:
3396         (WebCore::LoadableModuleScript::create):
3397         (WebCore::LoadableModuleScript::LoadableModuleScript):
3398         (WebCore::LoadableModuleScript::~LoadableModuleScript):
3399         (WebCore::LoadableModuleScript::isLoaded):
3400         (WebCore::LoadableModuleScript::error):
3401         (WebCore::LoadableModuleScript::wasCanceled):
3402         (WebCore::LoadableModuleScript::notifyLoadCompleted):
3403         (WebCore::LoadableModuleScript::notifyLoadFailed):
3404         (WebCore::LoadableModuleScript::notifyLoadWasCanceled):
3405         (WebCore::LoadableModuleScript::execute):
3406         (WebCore::LoadableModuleScript::load):
3407         (WebCore::LoadableModuleScript::notifyFinished): Deleted.
3408         * dom/LoadableModuleScript.h:
3409         * dom/ScriptElement.cpp:
3410         (WebCore::ScriptElement::executeModuleScript):