URLParser: Handle \ in path according to spec
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2016-09-09  Alex Christensen  <achristensen@webkit.org>
2
3         URLParser: Handle \ in path according to spec
4         https://bugs.webkit.org/show_bug.cgi?id=161805
5
6         Reviewed by Andy Estes.
7
8         Covered by new API tests.
9
10         * platform/URLParser.cpp:
11         (WebCore::URLParser::parse):
12
13 2016-09-09  Youenn Fablet  <youenn@apple.com>
14
15         TextTrackLoader should use FetchOptions::mode according its crossOrigin attribute
16         https://bugs.webkit.org/show_bug.cgi?id=161792
17
18         Reviewed by Eric Carlson.
19
20         Covered by existing and updated tests.
21
22         Updating text track loader to use fetch mode according crossOrigin value.
23
24         Removed the check done in the case the crossOrigin value is not set.
25         Previously cross-origin loads were forbidden, now this is authorized.
26         This change allows aligning with the spec.
27         Also, this check could be bypassed in the case of a same-origin URL redirecting to a cross-origin one.
28
29         * loader/TextTrackLoader.cpp:
30         (WebCore::TextTrackLoader::notifyFinished): Checking resource error in lieu of doing CORS checks on its own.
31         (WebCore::TextTrackLoader::load): Using CachedResourceRequest::setAsPotentiallyCrossOrigin
32         * loader/TextTrackLoader.h:
33         * loader/cache/CachedResource.cpp:
34         (WebCore::CachedResource::loadFrom): Setting loading and status values as would be done when load is finished.
35         (WebCore::CachedResource::setBodyDataFrom): Default implementation is to copy the shared buffer.
36         * loader/cache/CachedResource.h:
37         * loader/cache/CachedResourceLoader.cpp:
38         (WebCore::CachedResourceLoader::updateCachedResourceWithCurrentRequest): Enabling resource update when mode or origin is different for TextTrack resources.
39
40 2016-09-09  Alex Christensen  <achristensen@webkit.org>
41
42         URLParser should parse URLs with non-special schemes
43         https://bugs.webkit.org/show_bug.cgi?id=161786
44
45         Reviewed by Andy Estes.
46
47         Covered by new API tests.
48
49         * platform/URLParser.cpp:
50         (WebCore::URLParser::parse):
51         There's no reason for a SchemeEndCheckForSlashes state now that we can copy iterators.
52         It's not in the spec and not needed.
53         Also, move things around a little so parsing special or non-special schemes
54         followed by one or two slashes works correctly.
55
56 2016-09-09  Chris Dumez  <cdumez@apple.com>
57
58         Regression(r186020): Null dereference in getStartDate()
59         https://bugs.webkit.org/show_bug.cgi?id=161733
60
61         Reviewed by Eric Carlson.
62
63         Update HTMLMediaElement::getStartDate() to return NaN if m_player is null,
64         instead of crashing.
65
66         Test: fast/media/getStartDate-NaN.html
67
68         * bindings/js/IDBBindingUtilities.cpp:
69         (WebCore::toJS):
70         Add a FIXME comment as this code is using jsDateOrNull() but should
71         probably be using jsDate() as per:
72         - http://w3c.github.io/IndexedDB/#request-convert-a-key-to-a-value
73
74         * bindings/js/JSDOMBinding.cpp:
75         (WebCore::jsDate):
76         (WebCore::jsDateOrNull):
77         * bindings/js/JSDOMBinding.h:
78         - Rename jsDateOrNaN() to jsDate() as this is the default behavior. Also,
79           return new Date(NaN) instead of NaN if the implementation returns NaN.
80           The IDL says we should return a Date, not a number.
81         - Update jsDateOrNull() to only return jsNull() if the native value is
82           NaN, instead of doing so for every value that is not finite. Our
83           convention is to use NaN as special value to represent null in JS.
84
85         * bindings/scripts/CodeGeneratorJS.pm:
86         (NativeToJSValue):
87         When converting a native value (double) into a Date, rely on the fact
88         that the type is nullable when deciding if we should call jsDate() or
89         jsDateOrNull() to convert. This way, we no longe need a WebKit specific
90         [TreatReturnedDateAs=Null|NaN] IDL extended attribute.
91
92         * bindings/scripts/IDLAttributes.txt:
93         * html/HTMLInputElement.idl:
94         Mark valueAsDate attribute as nullable, as per the specification:
95         - https://html.spec.whatwg.org/#htmlinputelement
96
97         * html/HTMLMediaElement.cpp:
98         (WebCore::HTMLMediaElement::getStartDate):
99         Return NaN if m_player is null instead of crashing. The reason I decided
100         to return NaN is because the specification [1] says to return a new Date
101         object representing the current timeline offset. The spec of timeline
102         offset [2] says that the initial timeline offset value is NaN.
103         [1] https://html.spec.whatwg.org/#dom-media-getstartdate
104         [2] https://html.spec.whatwg.org/#timeline-offset
105
106         * bindings/scripts/IDLAttributes.txt:
107         * html/HTMLMediaElement.idl:
108         Drop [TreatReturnedDateAs] attribute as it is no longer supported.
109
110 2016-09-09  Youenn Fablet  <youenn@apple.com>
111
112         ASSERTION FAILED: promise.inherits(JSPromise::info())
113         https://bugs.webkit.org/show_bug.cgi?id=161632
114         <rdar://problem/28184743>
115
116         Reviewed by Mark Lam.
117
118         Test: fetch/fetch-worker-crash.html
119
120         * bindings/js/JSDOMPromise.h:
121         (WebCore::callPromiseFunction): Returning early if created promise is null.
122         Passing directly a DeferredWrapper to the generated code.
123         * bindings/scripts/CodeGeneratorJS.pm: Updated to take a DeferredWrapper.
124         (GenerateImplementation):
125         (GenerateReturnParameters):
126         * bindings/scripts/test/JS/JSTestObj.cpp: Rebasing expectations.
127         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionPromise):
128         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithFloatArgumentPromise):
129         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithExceptionPromise):
130         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithOptionalIntArgumentPromise):
131         (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction1Promise):
132         (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction2Promise):
133         (WebCore::jsTestObjConstructorFunctionTestStaticPromiseFunctionPromise):
134         (WebCore::jsTestObjConstructorFunctionTestStaticPromiseFunctionWithExceptionPromise):
135
136 2016-09-09  Myles C. Maxfield  <mmaxfield@apple.com>
137
138         [Cocoa] Improve performance of glyph advance metrics gathering
139         https://bugs.webkit.org/show_bug.cgi?id=161119
140
141         Reviewed by Simon Fraser.
142
143         Most of the glyphs in a GlyphPage are never read from. Therefore, we can get a performance boost
144         by not populating as many items in the GlyphPage. Because of the performance characteristics of
145         CTFontGetGlyphsForCharacters(), a better size for a GlyphPage is 16 items. This, coupled with
146         using CTFontGetUnsummedAdvancesForGlyphsAndStyle(), causes between a 0.01%-0.5% speedup on PLT.
147
148         No new tests because there is no behavior change.
149
150         * platform/graphics/Font.cpp:
151         (WebCore::Font::initCharWidths):
152         (WebCore::Font::platformGlyphInit):
153         (WebCore::createAndFillGlyphPage):
154         * platform/graphics/Font.h:
155         (WebCore::Font::widthForGlyph):
156         * platform/graphics/GlyphMetricsMap.h:
157         * platform/graphics/GlyphPage.h:
158         * platform/graphics/cocoa/FontCocoa.mm:
159         * platform/spi/cocoa/CoreTextSPI.h:
160         (WebCore::Font::platformWidthForGlyph):
161         (WebCore::canUseFastGlyphAdvanceGetter): Deleted.
162
163 2016-09-09  Antti Koivisto  <antti@apple.com>
164
165         v3: WebContent crash due to RELEASE_ASSERT in WebCore: WebCore::StyleResolver::styleForElement
166         https://bugs.webkit.org/show_bug.cgi?id=161689
167
168         Reviewed by Andreas Kling.
169
170         These crashes happen because synchronously triggered resource loads generate callbacks that may end up
171         deleting the resource loader.
172
173         Stop triggering resource loads from StyleResolver. Instead trigger them when applying style to render tree.
174
175         * css/StyleResolver.cpp:
176         (WebCore::StyleResolver::~StyleResolver):
177
178             Replace the RELEASE_ASSERT against deletion during resource loads by a general isDeleted assert.
179
180         (WebCore::StyleResolver::styleForElement):
181         (WebCore::StyleResolver::styleForKeyframe):
182         (WebCore::StyleResolver::pseudoStyleForElement):
183         (WebCore::StyleResolver::styleForPage):
184         (WebCore::StyleResolver::applyMatchedProperties):
185         (WebCore::StyleResolver::loadPendingResources): Deleted.
186         * css/StyleResolver.h:
187         * page/animation/KeyframeAnimation.cpp:
188         (WebCore::KeyframeAnimation::KeyframeAnimation):
189         (WebCore::KeyframeAnimation::resolveKeyframeStyles):
190
191             Ensure resource load for all animation frames.
192
193         * page/animation/KeyframeAnimation.h:
194         * rendering/RenderElement.cpp:
195         (WebCore::RenderElement::createFor):
196         (WebCore::RenderElement::initializeStyle):
197
198             Load resources when renderer initializes a style.
199
200         (WebCore::RenderElement::setStyle):
201         (WebCore::RenderElement::getUncachedPseudoStyle):
202
203             Load resources for pseudo styles.
204
205         * rendering/RenderImage.cpp:
206         (WebCore::RenderImage::RenderImage):
207         (WebCore::RenderImage::styleWillChange):
208
209             Shuffle image resource initialization out from constructor so initializeStyle gets called before.
210
211         * rendering/RenderImage.h:
212         * rendering/style/StyleCachedImage.cpp:
213         (WebCore::StyleCachedImage::StyleCachedImage):
214
215             Track pending status with a bit instead of implicitly by the existence of CachedResource.
216             This is useful for asserts.
217
218         (WebCore::StyleCachedImage::load):
219         (WebCore::StyleCachedImage::isPending):
220         (WebCore::StyleCachedImage::addClient):
221         (WebCore::StyleCachedImage::removeClient):
222         (WebCore::StyleCachedImage::image):
223         * rendering/style/StyleCachedImage.h:
224
225 2016-09-08  Yusuke Suzuki  <utatane.tea@gmail.com>
226
227         ScriptRunner should be driven by PendingScript rather than ScriptElement
228         https://bugs.webkit.org/show_bug.cgi?id=161726
229
230         Reviewed by Ryosuke Niwa.
231
232         Tests: js/dom/document-write-in-error-event.html
233                js/dom/document-write-in-load-event.html
234
235         ScriptRunner is driven by ScriptElement::notifyFinished. While ScriptRunner is driven by this,
236         HTMLScriptRunner does not use it. Instead, HTMLScriptRunner uses PendingScriptClient. As a result,
237         ScriptElement::notifyFinished is used only when the script is annotated with "defer" or "async"
238         while all the external script will load the LoadableScript. It is confusing.
239         This patch removes ScriptElement::notifyFinished and use PendingScript's observability
240         in ScriptRunner instead.
241
242         This patch also fixes the behavior about ignore-destructive-writes counter[1]. When dispatching
243         the load and error events, this ignore-destructive-writes counter should not be incremeneted by
244         this execution. The added tests ensure this behavior.
245
246         [1]: https://html.spec.whatwg.org/multipage/scripting.html#execute-the-script-block
247
248         * dom/ScriptElement.cpp: Drop LoadableScriptClient interface.
249         (WebCore::ScriptElement::prepareScript): Do not use addClient. ScriptRunner use PendingScript::{setClient,clearClient} instead.
250         (WebCore::ScriptElement::executeScriptForScriptRunner): IgnoreDestructiveWriteCountIncrementer will be done in ScriptElement::executeScript.
251         So no need to do it here, that's duplicated.
252         (WebCore::ScriptElement::~ScriptElement): Deleted. ScriptElement does not use addClient/removeClient.
253         (WebCore::ScriptElement::stopLoadRequest): Deleted.
254         (WebCore::ScriptElement::executeScriptForHTMLScriptRunner): Deleted. executeScriptForHTMLScriptRunner and executeScriptForScriptRunner are
255         merged into executeScriptForRunner.
256         (WebCore::ScriptElement::notifyFinished): Deleted.
257         * dom/ScriptElement.h:
258         (WebCore::ScriptElement::~ScriptElement):
259         (WebCore::ScriptElement::willExecuteInOrder): Used in ScriptRunner to determine whether the script is async or defer.
260         (WebCore::ScriptElement::willExecuteWhenDocumentFinishedParsing): Deleted.
261         * dom/ScriptRunner.cpp:
262         (WebCore::ScriptRunner::~ScriptRunner): HashSet's iterator will return `const PendingScript&`.
263         Another option is using HashSet<RefPtr<PendingScript>>. Here, we use a little bit weired const_cast.
264         (WebCore::ScriptRunner::queueScriptForExecution): Use PendingScript::setClient to wait loading.
265         (WebCore::ScriptRunner::notifyFinished): Notify the script ready here.
266         (WebCore::ScriptRunner::timerFired): Use executeScriptForScriptRunner.
267         (WebCore::ScriptRunner::notifyScriptReady): Deleted.
268         * dom/ScriptRunner.h:
269         * html/parser/HTMLScriptRunner.cpp:
270         (WebCore::HTMLScriptRunner::executePendingScriptAndDispatchEvent): Use executeScriptForScriptRunner.
271
272 2016-09-08  Yusuke Suzuki  <utatane.tea@gmail.com>
273
274         [WTF] HashTable's rehash is not compatible to Ref<T> and ASan
275         https://bugs.webkit.org/show_bug.cgi?id=161763
276
277         Reviewed by Mark Lam.
278
279         Include wtf/text/StringHash.h to avoid linking errors in EFL port.
280
281         * loader/ResourceLoadStatistics.h:
282
283 2016-09-08  Chris Dumez  <cdumez@apple.com>
284
285         HTMLObjectElement.hspace / vspace attributes should be unsigned
286         https://bugs.webkit.org/show_bug.cgi?id=161766
287
288         Reviewed by Ryosuke Niwa.
289
290         HTMLObjectElement.hspace / vspace attributes should be unsigned:
291         - https://html.spec.whatwg.org/#HTMLObjectElement-partial
292
293         Firefox agrees with the specification but those were signed in WebKit.
294
295         No new tests, rebaselined existing test.
296
297         * html/HTMLObjectElement.idl:
298
299 2016-09-08  Chris Dumez  <cdumez@apple.com>
300
301         HTMLObjectElement.codebase attribute should reflect as a URL
302         https://bugs.webkit.org/show_bug.cgi?id=161768
303
304         Reviewed by Alex Christensen.
305
306         HTMLObjectElement.codebase attribute should reflect as a URL:
307         - https://html.spec.whatwg.org/#dom-applet-codebase
308
309         Chrome and Firefox agree with the specification.
310
311         No new test, rebaselined existing test.
312
313         * html/HTMLObjectElement.idl:
314
315 2016-09-08  Chris Dumez  <cdumez@apple.com>
316
317         ol.start may return incorrect value for reversed lists when not explicitly set
318         https://bugs.webkit.org/show_bug.cgi?id=161713
319
320         Reviewed by Zalan Bujtas.
321
322         ol.start may return incorrect value for reversed lists when not explicitly set.
323         This is because we're supposed to return the number of rendered <li> child
324         elements, which relies on layout. However, we did not make sure the layout is
325         up-to-date before counting the number of li child elements. This patch fixes
326         the issue.
327
328         No new tests, rebaselined existing tests.
329
330         * html/HTMLOListElement.h:
331
332 2016-09-08  Chris Dumez  <cdumez@apple.com>
333
334         Add support for HTMLIframeElement.allowFullscreen attribute
335         https://bugs.webkit.org/show_bug.cgi?id=161757
336
337         Reviewed by Sam Weinig.
338
339         Add support for HTMLIframeElement.allowFullscreen attribute:
340         - https://html.spec.whatwg.org/#dom-iframe-allowfullscreen
341
342         Firefox and Chrome already support it, unprefixed.
343
344         Note that the HTMLIframeElement.allowFullscreen attribute reflects the
345         allowfullscreen content attribute which we already support.
346
347         Test: fullscreen/full-screen-iframe-allowFullscreen.html
348
349         * html/HTMLIFrameElement.idl:
350
351 2016-09-08  Chris Dumez  <cdumez@apple.com>
352
353         frame.longDesc / iframe.longDesc should reflect as a URL
354         https://bugs.webkit.org/show_bug.cgi?id=161764
355
356         Reviewed by Alex Christensen.
357
358         frame.longDesc / iframe.longDesc should reflect as a URL:
359         - https://html.spec.whatwg.org/#dom-iframe-longdesc
360         - https://html.spec.whatwg.org/#dom-frame-longdesc
361
362         They already do in Chrome and Firefox.
363
364         No new tests, rebaselined existing tests.
365
366         * html/HTMLFrameElement.idl:
367         * html/HTMLIFrameElement.idl:
368
369 2016-09-08  Alex Christensen  <achristensen@webkit.org>
370
371         URLParser: Handle \ in paths of special URLs according to spec
372         https://bugs.webkit.org/show_bug.cgi?id=161781
373
374         Reviewed by Tim Horton.
375
376         Covered by new API tests.
377
378         * platform/URLParser.cpp:
379         (WebCore::bufferView):
380         (WebCore::URLParser::copyURLPartsUntil):
381         (WebCore::URLParser::parse):
382         * platform/URLParser.h:
383
384 2016-09-08  Said Abou-Hallawa  <sabouhallawa@apple.com>
385
386         Move the BitmapImage platform dependent code to a new file named NativeImage[CG|Cairo].cpp
387         https://bugs.webkit.org/show_bug.cgi?id=158684
388
389         Reviewed by Simon Fraser.
390
391         This is a refactoring patch. It moves the BitmapImage platform dependent
392         code from BitmapImage to NativeImage[CG|Cairo].cpp. The new APIs are
393         responsible of drawing a NativeImagePtr and answering some metadata queries.
394
395         No new tests -- Code refactoring, no behavior change.
396
397         * PlatformAppleWin.cmake:
398         * PlatformEfl.cmake:
399         * PlatformGTK.cmake:
400         * PlatformMac.cmake:
401         * PlatformWinCairo.cmake:
402         * WebCore.xcodeproj/project.pbxproj:
403         * loader/cache/MemoryCache.h:
404         * loader/icon/IconDatabaseBase.h:
405         * page/mac/TextIndicatorWindow.mm:
406         (-[WebTextIndicatorView initWithFrame:textIndicator:margin:offset:]):
407         (createContentCrossfadeAnimation):
408         * platform/graphics/BitmapImage.cpp:
409         (WebCore::BitmapImage::BitmapImage):
410         (WebCore::BitmapImage::destroyDecodedData):
411         (WebCore::BitmapImage::destroyDecodedDataIfNecessary):
412         (WebCore::BitmapImage::dataChanged):
413         (WebCore::BitmapImage::ensureFrameAtIndexIsCached):
414         (WebCore::BitmapImage::frameImageAtIndex):
415         (WebCore::BitmapImage::nativeImage):
416         (WebCore::BitmapImage::nativeImageForCurrentFrame):
417         (WebCore::BitmapImage::nativeImageOfSize):
418         (WebCore::BitmapImage::framesNativeImages):
419         (WebCore::BitmapImage::frameIsCompleteAtIndex):
420         (WebCore::BitmapImage::frameDurationAtIndex):
421         (WebCore::BitmapImage::frameHasAlphaAtIndex):
422         (WebCore::BitmapImage::frameOrientationAtIndex):
423         (WebCore::BitmapImage::singlePixelSolidColor):
424         (WebCore::BitmapImage::draw):
425         (WebCore::BitmapImage::drawPattern):
426         (WebCore::BitmapImage::canAnimate):
427         (WebCore::BitmapImage::clearTimer):
428         (WebCore::BitmapImage::startTimer):
429         (WebCore::BitmapImage::stopAnimation):
430         (WebCore::BitmapImage::resetAnimation):
431         (WebCore::BitmapImage::hasSingleSecurityOrigin): Deleted.
432         (WebCore::BitmapImage::filenameExtension): Deleted.
433         (WebCore::BitmapImage::ensureFrameIsCached): Deleted.
434         * platform/graphics/BitmapImage.h:
435         (WebCore::FrameData::FrameData):
436         m_hasAlpha can be initialized with false because it is accessed only in
437         BitmapImage::frameHasAlphaAtIndex() and it is guarded by m_haveMetadata.
438         Both m_haveMetadata and m_hasAlpha are set in BitmapImage constructor
439         and in BitmapImage::cacheFrame().
440         
441         (WebCore::FrameData::~FrameData):
442         (WebCore::FrameData::clear):
443         * platform/graphics/Icon.h:
444         * platform/graphics/Image.h:
445         (WebCore::Image::nativeImage):
446         (WebCore::Image::nativeImageOfSize):
447         (WebCore::Image::framesNativeImages):
448         (WebCore::Image::orientationForCurrentFrame): Deleted.
449         (WebCore::Image::getCGImageRef): Deleted.
450         (WebCore::Image::getFirstCGImageRefOfSize): Deleted.
451         (WebCore::Image::getCGImageArray): Deleted.
452         * platform/graphics/ImageSource.cpp:
453         (WebCore::ImageSource::calculateMaximumSubsamplingLevel):
454         (WebCore::ImageSource::size):
455         (WebCore::ImageSource::sizeRespectingOrientation):
456         * platform/graphics/ImageSource.h:
457         * platform/graphics/MediaPlayer.h:
458         * platform/graphics/NativeImage.h: Added.
459         * platform/graphics/NativeImagePtr.h: Removed.
460         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
461         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updatePausedImage):
462         * platform/graphics/cairo/BitmapImageCairo.cpp: Removed.
463         * platform/graphics/cairo/NativeImageCairo.cpp: Added.
464         (WebCore::nativeImageSize):
465         (WebCore::nativeImageHasAlpha):
466         (WebCore::nativeImageSinglePixelSolidColor):
467         (WebCore::subsamplingScale):
468         (WebCore::drawNativeImage):
469         (WebCore::clearNativeImageSubImages):
470         * platform/graphics/cg/BitmapImageCG.cpp: Removed.
471         * platform/graphics/cg/ImageDecoderCG.cpp:
472         (WebCore::ImageDecoder::size):
473         * platform/graphics/cg/ImageDecoderCG.h:
474         * platform/graphics/cg/NativeImageCG.cpp: Added.
475         (WebCore::nativeImageSize):
476         (WebCore::nativeImageHasAlpha):
477         (WebCore::nativeImageSinglePixelSolidColor):
478         (WebCore::subsamplingScale):
479         (WebCore::drawNativeImage):
480         (WebCore::clearNativeImageSubImages):
481         * platform/graphics/cg/PatternCG.cpp:
482         (WebCore::Pattern::createPlatformPattern):
483         * platform/graphics/cocoa/TextTrackRepresentationCocoa.mm:
484         (TextTrackRepresentationCocoa::update):
485         * platform/graphics/mac/ImageMac.mm:
486         (WebCore::BitmapImage::getTIFFRepresentation):
487         * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
488         (WebCore::MockRealtimeVideoSourceMac::updatePlatformLayer):
489         (WebCore::MockRealtimeVideoSourceMac::updateSampleBuffer):
490         * platform/win/DragImageCGWin.cpp:
491         (WebCore::createDragImageFromImage):
492
493 2016-09-08  Alex Christensen  <achristensen@webkit.org>
494
495         URLParser: Parsing empty URLs with a base URL should return the base URL
496         https://bugs.webkit.org/show_bug.cgi?id=161777
497
498         Reviewed by Tim Horton.
499
500         Covered by an API test and progress towards passing all web platform tests when using URLParser.
501
502         * platform/URLParser.cpp:
503         (WebCore::URLParser::parse):
504
505 2016-09-08  Alex Christensen  <achristensen@webkit.org>
506
507         URLParser failures should preserve the original input string
508         https://bugs.webkit.org/show_bug.cgi?id=161769
509
510         Reviewed by Tim Horton.
511
512         No new tests, but covered by updates to API tests.
513         This also represents many newly passing web platform tests when using URLParser.
514
515         * platform/URLParser.cpp:
516         (WebCore::URLParser::failure):
517         (WebCore::URLParser::parse):
518         * platform/URLParser.h:
519
520 2016-09-08  Alex Christensen  <achristensen@webkit.org>
521
522         URLParser should parse URLs with a user but no password
523         https://bugs.webkit.org/show_bug.cgi?id=161773
524
525         Reviewed by Brady Eidson.
526
527         Covered by new API tests.
528
529         * platform/URLParser.cpp:
530         (WebCore::URLParser::parseAuthority):
531
532 2016-09-08  Alex Christensen  <achristensen@webkit.org>
533
534         Fix URLs after r205669.
535         https://bugs.webkit.org/show_bug.cgi?id=161731
536
537         * platform/URLParser.cpp:
538         (WebCore::URLParser::enabled):
539         I accidentally committed enabling the URLParser by default.  Not ready yet.
540
541 2016-09-08  Chris Dumez  <cdumez@apple.com>
542
543         Align proto getter / setter behavior with other browsers
544         https://bugs.webkit.org/show_bug.cgi?id=161455
545
546         Reviewed by Saam Barati.
547
548         Align cross-origin __proto__ getter / setter behavior with other
549         browsers and the specification:
550
551         [[SetPrototypeOf]] should throw a TypeError:
552         - https://html.spec.whatwg.org/#windowproxy-setprototypeof
553         - https://html.spec.whatwg.org/#location-setprototypeof
554         - https://tc39.github.io/ecma262/#sec-object.setprototypeof (step 5)
555
556         [[GetPrototypeOf]] should return null cross-origin:
557         - https://html.spec.whatwg.org/#windowproxy-getprototypeof
558         - https://html.spec.whatwg.org/#location-getprototypeof
559
560         Test: js/dom/setPrototypeOf-location-window.html
561
562         * bindings/js/JSDOMWindowBase.cpp:
563         (WebCore::JSDOMWindowBase::JSDOMWindowBase): Deleted.
564         * bindings/js/JSDOMWindowCustom.cpp:
565         (WebCore::JSDOMWindow::setPrototype):
566         (WebCore::JSDOMWindow::getPrototype):
567         (WebCore::JSDOMWindow::preventExtensions):
568         * bindings/js/JSLocationCustom.cpp:
569         (WebCore::JSLocation::setPrototype):
570         (WebCore::JSLocation::getPrototype):
571         * bindings/js/JSWorkerGlobalScopeBase.cpp:
572         (WebCore::JSWorkerGlobalScopeBase::supportsRichSourceInfo): Deleted.
573         * bindings/js/JSWorkerGlobalScopeBase.h:
574         * bindings/scripts/CodeGeneratorJS.pm:
575         (GenerateHeader):
576         * bindings/scripts/IDLAttributes.txt:
577         * page/DOMWindow.idl:
578         * page/Location.idl:
579
580 2016-09-08  Alex Christensen  <achristensen@webkit.org>
581
582         URLParser should parse ports after IPv4 and IPv6 hosts
583         https://bugs.webkit.org/show_bug.cgi?id=161731
584
585         Reviewed by Brady Eidson.
586
587         Covered by new API tests.
588
589         * platform/URLParser.cpp:
590         (WebCore::URLParser::parsePort):
591         (WebCore::URLParser::parseHost):
592
593 2016-09-08  Alex Christensen  <achristensen@webkit.org>
594
595         URLParser should correctly handle \ in path
596         https://bugs.webkit.org/show_bug.cgi?id=161762
597
598         Reviewed by Brady Eidson.
599
600         Covered by new API tests.
601
602         * platform/URLParser.cpp:
603         (WebCore::isSpecialScheme):
604         (WebCore::bufferView):
605         (WebCore::URLParser::parse):
606         Treat \ as / in the path of special URLs as described in the spec and tested in web platform tests.
607         Also a slight performance improvement using StringViews instead of copied Strings.
608
609 2016-09-08  Alex Christensen  <achristensen@webkit.org>
610
611         URLParser should handle URLs with empty authority
612         https://bugs.webkit.org/show_bug.cgi?id=161711
613
614         Reviewed by Brady Eidson.
615
616         Covered by new API tests.
617
618         * platform/URLParser.cpp:
619         (WebCore::URLParser::parse):
620         (WebCore::URLParser::parseAuthority):
621
622 2016-09-08  Chris Dumez  <cdumez@apple.com>
623
624         HTMLImageElement.hspace / vspace attributes should be unsigned
625         https://bugs.webkit.org/show_bug.cgi?id=161754
626
627         Reviewed by Alex Christensen.
628
629         HTMLImageElement.hspace / vspace attributes should be unsigned:
630         - https://html.spec.whatwg.org/#HTMLImageElement-partial
631
632         Firefox agrees with the specification, however, those were signed in
633         webKit.
634
635         No new tests, rebaselined existing test.
636
637         * html/HTMLImageElement.idl:
638
639 2016-09-08  Chris Dumez  <cdumez@apple.com>
640
641         Update parseHTMLNonNegativeInteger() to return an unsigned value
642         https://bugs.webkit.org/show_bug.cgi?id=161759
643
644         Reviewed by Alex Christensen.
645
646         Update parseHTMLNonNegativeInteger() to return an unsigned value instead
647         of a signed one as the value can never be negative.
648
649         * html/HTMLElement.cpp:
650         (WebCore::HTMLElement::parseBorderWidthAttribute):
651         * html/HTMLImageElement.cpp:
652         (WebCore::HTMLImageElement::width):
653         (WebCore::HTMLImageElement::height):
654         * html/HTMLInputElement.cpp:
655         (WebCore::HTMLInputElement::maxLengthAttributeChanged):
656         (WebCore::HTMLInputElement::minLengthAttributeChanged):
657         * html/HTMLTextAreaElement.cpp:
658         (WebCore::HTMLTextAreaElement::maxLengthAttributeChanged):
659         (WebCore::HTMLTextAreaElement::minLengthAttributeChanged):
660         * html/ImageInputType.cpp:
661         (WebCore::ImageInputType::height):
662         (WebCore::ImageInputType::width):
663         * html/parser/HTMLParserIdioms.cpp:
664         (WebCore::parseHTMLNonNegativeInteger):
665         (WebCore::parseHTTPRefreshInternal):
666         * html/parser/HTMLParserIdioms.h:
667
668 2016-09-08  Said Abou-Hallawa  <sabouhallawa@apple.com>
669
670         Get rid of the color profile from ImageFrame and ImageDecoder
671         https://bugs.webkit.org/show_bug.cgi?id=159699
672
673         Reviewed by Simon Fraser.
674
675         The color profile is set but it is never used.
676
677         * platform/image-decoders/ImageDecoder.cpp:
678         (WebCore::ImageFrame::setColorProfile): Deleted.
679         * platform/image-decoders/ImageDecoder.h:
680         * platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
681         (WebCore::JPEGImageReader::decode):
682         (WebCore::JPEGImageDecoder::outputScanlines):
683         (WebCore::readColorProfile): Deleted.
684         * platform/image-decoders/jpeg/JPEGImageDecoder.h:
685         * platform/image-decoders/png/PNGImageDecoder.cpp:
686         (WebCore::PNGImageDecoder::headerAvailable):
687         (WebCore::PNGImageDecoder::rowAvailable):
688         (WebCore::readColorProfile): Deleted.
689
690 2016-09-08  Dave Hyatt  <hyatt@apple.com>
691
692         [CSS Parser] Add support for new CSS selector parsing
693         https://bugs.webkit.org/show_bug.cgi?id=161749
694
695         Reviewed by Dean Jackson.
696
697         * CMakeLists.txt:
698         * WebCore.xcodeproj/project.pbxproj:
699         * contentextensions/ContentExtensionParser.cpp:
700         (WebCore::ContentExtensions::isValidSelector):
701         * css/CSSDefaultStyleSheets.cpp:
702         (WebCore::parseUASheet):
703         * css/CSSFontFaceSet.cpp:
704         (WebCore::CSSFontFaceSet::matchingFaces):
705         * css/CSSGrammar.y.in:
706         * css/CSSSelector.cpp:
707         (WebCore::CSSSelector::selectorText):
708         * css/CSSSelector.h:
709         * css/DOMCSSNamespace.cpp:
710         (WebCore::DOMCSSNamespace::supports):
711         * css/FontFace.cpp:
712         (WebCore::FontFace::parseString):
713         (WebCore::FontFace::setVariant):
714         * css/MediaList.cpp:
715         (WebCore::MediaQuerySet::internalParse):
716         (WebCore::MediaQuerySet::parse):
717         * css/SelectorChecker.cpp:
718         (WebCore::SelectorChecker::matchRecursively):
719         * css/SelectorFilter.cpp:
720         (WebCore::SelectorFilter::collectIdentifierHashes):
721         * css/SelectorPseudoClassAndCompatibilityElementMap.in:
722         * css/SelectorPseudoTypeMap.h:
723         * css/SourceSizeList.cpp:
724         (WebCore::parseSizesAttribute):
725         * css/StyleProperties.cpp:
726         (WebCore::MutableStyleProperties::MutableStyleProperties):
727         * css/StyleProperties.h:
728         * css/StyleRuleImport.cpp:
729         (WebCore::StyleRuleImport::setCSSStyleSheet):
730         * css/StyleSheetContents.cpp:
731         (WebCore::StyleSheetContents::StyleSheetContents):
732         (WebCore::StyleSheetContents::parserAddNamespace):
733         (WebCore::StyleSheetContents::namespaceURIFromPrefix):
734         (WebCore::StyleSheetContents::determineNamespace): Deleted.
735         * css/StyleSheetContents.h:
736         * css/WebKitCSSMatrix.cpp:
737         (WebCore::WebKitCSSMatrix::setMatrixValue):
738         * css/makeSelectorPseudoClassAndCompatibilityElementMap.py:
739         * css/parser/CSSParser.cpp:
740         (WebCore::strictCSSParserContext):
741         (WebCore::CSSParserContext::CSSParserContext):
742         (WebCore::CSSParser::parseColor):
743         (WebCore::CSSParser::shouldAcceptUnitLessValues):
744         (WebCore::CSSParser::parseValue):
745         (WebCore::CSSParser::parseColumnWidth):
746         (WebCore::CSSParser::parseColumnCount):
747         (WebCore::CSSParser::parseFontWeight):
748         (WebCore::CSSParser::parseColorParameters):
749         (WebCore::CSSParser::parseHSLParameters):
750         (WebCore::CSSParser::parseShadow):
751         (WebCore::CSSParser::parseBorderImageSlice):
752         (WebCore::CSSParser::parseBorderImageQuad):
753         (WebCore::CSSParser::parseDeprecatedLinearGradient):
754         (WebCore::CSSParser::parseLinearGradient):
755         (WebCore::CSSParser::parseTransformValue):
756         (WebCore::CSSParser::parseBuiltinFilterArguments):
757         (WebCore::CSSParser::determineNameInNamespace):
758         * css/parser/CSSParser.h:
759         (WebCore::CSSParser::inStrictMode):
760         (WebCore::CSSParser::inQuirksMode):
761         * css/parser/CSSParserMode.h:
762         (WebCore::isQuirksModeBehavior):
763         (WebCore::isUASheetBehavior):
764         (WebCore::isUnitLessLengthParsingEnabledForMode):
765         (WebCore::isCSSViewportParsingEnabledForMode):
766         (WebCore::strictToCSSParserMode):
767         (WebCore::isStrictParserMode):
768         * css/parser/CSSParserValues.cpp:
769         (WebCore::CSSParserSelector::parsePseudoElementSelectorFromStringView):
770         (WebCore::CSSParserSelector::parsePseudoClassSelectorFromStringView):
771         (WebCore::CSSParserSelector::setSelectorList):
772         (WebCore::CSSParserSelector::appendTagHistory):
773         (WebCore::CSSParserSelector::releaseTagHistory):
774         (WebCore::CSSParserSelector::isHostPseudoSelector):
775         * css/parser/CSSParserValues.h:
776         (WebCore::CSSParserSelector::match):
777         (WebCore::CSSParserSelector::pseudoElementType):
778         (WebCore::CSSParserSelector::selectorList):
779         (WebCore::CSSParserSelector::needsImplicitShadowCombinatorForMatching):
780         * css/parser/CSSPropertyParser.h:
781         (WebCore::CSSPropertyParser::inQuirksMode):
782         * css/parser/CSSSelectorParser.cpp: Added.
783         (WebCore::CSSSelectorParser::parseSelector):
784         (WebCore::CSSSelectorParser::CSSSelectorParser):
785         (WebCore::CSSSelectorParser::consumeComplexSelectorList):
786         (WebCore::CSSSelectorParser::consumeCompoundSelectorList):
787         (WebCore::CSSSelectorParser::consumeComplexSelector):
788         (WebCore::CSSSelectorParser::consumeCompoundSelector):
789         (WebCore::CSSSelectorParser::consumeSimpleSelector):
790         (WebCore::CSSSelectorParser::consumeName):
791         (WebCore::CSSSelectorParser::consumeId):
792         (WebCore::CSSSelectorParser::consumeClass):
793         (WebCore::CSSSelectorParser::consumeAttribute):
794         (WebCore::CSSSelectorParser::consumePseudo):
795         (WebCore::CSSSelectorParser::consumeCombinator):
796         (WebCore::CSSSelectorParser::consumeAttributeMatch):
797         (WebCore::CSSSelectorParser::consumeAttributeFlags):
798         (WebCore::CSSSelectorParser::consumeANPlusB):
799         (WebCore::CSSSelectorParser::defaultNamespace):
800         (WebCore::CSSSelectorParser::determineNamespace):
801         (WebCore::CSSSelectorParser::prependTypeSelectorIfNeeded):
802         (WebCore::CSSSelectorParser::addSimpleSelectorToCompound):
803         (WebCore::CSSSelectorParser::splitCompoundAtImplicitShadowCrossingCombinator):
804         * css/parser/CSSSelectorParser.h: Added.
805         (WebCore::CSSSelectorParser::DisallowPseudoElementsScope::DisallowPseudoElementsScope):
806         (WebCore::CSSSelectorParser::DisallowPseudoElementsScope::~DisallowPseudoElementsScope):
807         * cssjit/SelectorCompiler.cpp:
808         (WebCore::SelectorCompiler::fragmentRelationForSelectorRelation):
809         * dom/StyledElement.cpp:
810         (WebCore::StyledElement::rebuildPresentationAttributeStyle):
811         * svg/SVGFontFaceElement.cpp:
812         (WebCore::SVGFontFaceElement::SVGFontFaceElement):
813
814 2016-09-08  Simon Fraser  <simon.fraser@apple.com>
815
816         Don't run transitions to or from undefined Lengths
817         https://bugs.webkit.org/show_bug.cgi?id=161750
818         rdar://problem/28170460
819
820         Reviewed by Zalan Bujtas.
821
822         For properties like max-height whose default value is 'none', we would erroneously
823         attempt to run transitions/animations, and then assert when one of the endpoints
824         was undefined.
825
826         So don't attempt to blend such Length values, just as do when they are auto.
827
828         Fixes some transitions on apple.com and developer.apple.com.
829
830         Test: transitions/transition-to-from-undefined.html
831
832         * page/animation/CSSPropertyAnimation.cpp:
833         (WebCore::CSSPropertyAnimation::blendProperties):
834         * platform/Length.cpp:
835         (WebCore::blend):
836
837 2016-09-08  Myles C. Maxfield  <mmaxfield@apple.com>
838
839         Support new emoji group candidates
840         https://bugs.webkit.org/show_bug.cgi?id=161664
841         <rdar://problem/24802695>
842         <rdar://problem/27666433>
843
844         Reviewed by Simon Fraser.
845
846         Support more emoji group candidates. This includes joining groups into a single glyph, as
847         well as atomic deletions of the entire group when the backspace key is pressed.
848
849         Tests: editing/deleting/delete-emoji.html:
850                fast/text/emoji-num-glyphs.html:
851
852         * platform/text/CharacterProperties.h:
853         (WebCore::isEmojiGroupCandidate):
854
855 2016-09-08  Chris Dumez  <cdumez@apple.com>
856
857         HTMLImageElement.width / height attributes should be unsigned
858         https://bugs.webkit.org/show_bug.cgi?id=161730
859
860         Reviewed by Alex Christensen.
861
862         HTMLImageElement.width / height attributes should be unsigned as per
863         the HTML specification:
864         - https://html.spec.whatwg.org/#htmlimageelement
865
866         However, they are signed in WebKit. Firefox agrees with the
867         specification.
868
869         No new tests, rebaselined existing test.
870
871         * bindings/js/JSImageConstructor.cpp:
872         (WebCore::JSImageConstructor::construct):
873         (WebCore::createImageConstructor): Deleted.
874         * html/HTMLImageElement.cpp:
875         (WebCore::HTMLImageElement::createForJSConstructor):
876         (WebCore::HTMLImageElement::width):
877         (WebCore::HTMLImageElement::height):
878         (WebCore::HTMLImageElement::setHeight):
879         (WebCore::HTMLImageElement::setWidth):
880         * html/HTMLImageElement.h:
881         * html/HTMLImageElement.idl:
882         * html/ImageDocument.cpp:
883         (WebCore::ImageDocument::restoreImageSize):
884
885 2016-09-08  Filip Pizlo  <fpizlo@apple.com>
886
887         Move JSMap/JSSet over to Auxiliary MarkedSpace
888         https://bugs.webkit.org/show_bug.cgi?id=161744
889
890         Reviewed by Saam Barati.
891
892         No new tests because no change in behavior.
893
894         * bindings/js/SerializedScriptValue.cpp:
895
896 2016-09-08  Commit Queue  <commit-queue@webkit.org>
897
898         Unreviewed, rolling out r205652.
899         https://bugs.webkit.org/show_bug.cgi?id=161748
900
901         Crashing under ASan (Requested by yusukesuzuki on #webkit).
902
903         Reverted changeset:
904
905         "ScriptRunner should be driven by PendingScript rather than
906         ScriptElement"
907         https://bugs.webkit.org/show_bug.cgi?id=161726
908         http://trac.webkit.org/changeset/205652
909
910 2016-09-08  Yusuke Suzuki  <utatane.tea@gmail.com>
911
912         ScriptRunner should be driven by PendingScript rather than ScriptElement
913         https://bugs.webkit.org/show_bug.cgi?id=161726
914
915         Reviewed by Ryosuke Niwa.
916
917         ScriptRunner is driven by ScriptElement::notifyFinished. While ScriptRunner is driven by this,
918         HTMLScriptRunner does not use it. Instead, HTMLScriptRunner uses PendingScriptClient. As a result,
919         ScriptElement::notifyFinished is used only when the script is annotated with "defer" or "async"
920         while all the external script will load the LoadableScript. It is confusing.
921         This patch removes ScriptElement::notifyFinished and use PendingScript's observability
922         in ScriptRunner instead.
923
924         This patch also fixes the behavior about ignore-destructive-writes counter[1]. When dispatching
925         the load and error events, this ignore-destructive-writes counter should not be incremeneted by
926         this execution. The added tests ensure this behavior.
927
928         [1]: https://html.spec.whatwg.org/multipage/scripting.html#execute-the-script-block
929
930         * dom/ScriptElement.cpp: Drop LoadableScriptClient interface.
931         (WebCore::ScriptElement::prepareScript): Do not use addClient. ScriptRunner use PendingScript::{setClient,clearClient} instead.
932         (WebCore::ScriptElement::executeScriptForScriptRunner): IgnoreDestructiveWriteCountIncrementer will be done in ScriptElement::executeScript.
933         So no need to do it here, that's duplicated.
934         (WebCore::ScriptElement::~ScriptElement): Deleted. ScriptElement does not use addClient/removeClient.
935         (WebCore::ScriptElement::stopLoadRequest): Deleted.
936         (WebCore::ScriptElement::executeScriptForHTMLScriptRunner): Deleted. executeScriptForHTMLScriptRunner and executeScriptForScriptRunner are
937         merged into executeScriptForRunner.
938         (WebCore::ScriptElement::notifyFinished): Deleted.
939         * dom/ScriptElement.h:
940         (WebCore::ScriptElement::~ScriptElement):
941         (WebCore::ScriptElement::willExecuteInOrder): Used in ScriptRunner to determine whether the script is async or defer.
942         (WebCore::ScriptElement::willExecuteWhenDocumentFinishedParsing): Deleted.
943         * dom/ScriptRunner.cpp:
944         (WebCore::ScriptRunner::~ScriptRunner): HashSet's iterator will return `const PendingScript&`.
945         Another option is using HashSet<RefPtr<PendingScript>>. Here, we use a little bit weired const_cast.
946         (WebCore::ScriptRunner::queueScriptForExecution): Use PendingScript::setClient to wait loading.
947         (WebCore::ScriptRunner::notifyFinished): Notify the script ready here.
948         (WebCore::ScriptRunner::timerFired): Use executeScriptForScriptRunner.
949         (WebCore::ScriptRunner::notifyScriptReady): Deleted.
950         * dom/ScriptRunner.h:
951         * html/parser/HTMLScriptRunner.cpp:
952         (WebCore::HTMLScriptRunner::executePendingScriptAndDispatchEvent): Use executeScriptForScriptRunner.
953
954 2016-09-08  Alex Christensen  <achristensen@webkit.org>
955
956         Re-land r205580 after r205649 fixed the test failures
957         https://bugs.webkit.org/show_bug.cgi?id=161668
958
959         Re-landing changesets:
960
961         "Punycode encode non-ascii hosts in URLParser"
962         https://bugs.webkit.org/show_bug.cgi?id=161655
963         http://trac.webkit.org/changeset/205521
964
965         "Fix query-only and fragment-only relative URLs when using
966         URLParser"
967         https://bugs.webkit.org/show_bug.cgi?id=161657
968         http://trac.webkit.org/changeset/205526
969
970         "URLParser should parse / as a relative URL"
971         https://bugs.webkit.org/show_bug.cgi?id=161667
972         http://trac.webkit.org/changeset/205532
973
974 2016-09-08  Alex Christensen  <achristensen@webkit.org>
975
976         Add range check in URLParser's serializeIPv6
977         https://bugs.webkit.org/show_bug.cgi?id=161743
978
979         Reviewed by David Kilzer.
980
981         No new tests, but this fixes API tests in some release builds after
982         the patch from https://bugs.webkit.org/show_bug.cgi?id=161668 is recommitted.
983
984         * platform/URLParser.cpp:
985         (WebCore::serializeIPv6):
986         Don't go out of bounds.  Don't assume that the memory immediately after the end of the array will be empty.
987
988 2016-09-07  Alex Christensen  <achristensen@webkit.org>
989
990         Roll out r205580 and r205582.
991         https://bugs.webkit.org/show_bug.cgi?id=161668
992
993         I need to figure out why this is failing on the bots before landing any more URLParser progress.
994
995 2016-09-07  Yusuke Suzuki  <utatane.tea@gmail.com>
996
997         Unreviewed, EFL build fix after r205581
998         https://bugs.webkit.org/show_bug.cgi?id=161674
999
1000         * dom/LoadableClassicScript.cpp:
1001         (WebCore::LoadableClassicScript::notifyFinished):
1002
1003 2016-09-07  Alex Christensen  <achristensen@webkit.org>
1004
1005         Fix API tests after r205580
1006         https://bugs.webkit.org/show_bug.cgi?id=161668
1007
1008         No new tests, but this fixes API tests on bots.
1009
1010         * platform/URLParser.cpp:
1011         (WebCore::domainToASCII):
1012         This function seems to be appending characters to strings sometimes on some configurations.
1013         This definitely needs further investigation, but this will fix the bots, and nothing else
1014         will be affected because the URLParser is disabled by default.
1015
1016 2016-09-07  Yusuke Suzuki  <utatane.tea@gmail.com>
1017
1018         Introduce abstract class LoadableScript for classic script and module graph
1019         https://bugs.webkit.org/show_bug.cgi?id=161674
1020
1021         Reviewed by Ryosuke Niwa.
1022
1023         To prepare for ScriptModuleGraph, we introduce the abstract class over the classic script
1024         and the module script, LoadableScript.
1025
1026         No behavior change.
1027
1028         * CMakeLists.txt:
1029         * WebCore.xcodeproj/project.pbxproj:
1030         * dom/LoadableClassicScript.cpp: Added. LoadableClassicScript is the derived class from the
1031         LoadableScript. In the module patch, we will introduce LoadableScriptModuleGraph which is also
1032         the derived class from the LoadableScript. It is used for the external classic script.
1033         A CachedResourceHandle used here alone does not prevent the underlying CachedResource from purging its
1034         data buffer. This LoadableClassicScript holds a client until this class is destroyed in order to
1035         guarantee that the data buffer will not be purged.
1036         (WebCore::LoadableClassicScript::create):
1037         (WebCore::LoadableClassicScript::LoadableClassicScript):
1038         (WebCore::LoadableClassicScript::~LoadableClassicScript):
1039         (WebCore::LoadableClassicScript::isLoaded):
1040         (WebCore::LoadableClassicScript::wasErrored): Beyond the boolean value, this can return the detail
1041         of the error. This detailed information will be used to report it to the inspector in the ScriptElement.
1042         (WebCore::LoadableClassicScript::wasCanceled):
1043         (WebCore::LoadableClassicScript::notifyFinished): Nosniff and cross-origin loading errors are handled here,
1044         instead of exposing CachedScript*.
1045         (WebCore::LoadableClassicScript::execute): Execute the cached script by using the given ScriptElement.
1046         * dom/LoadableClassicScript.h: Copied from Source/WebCore/dom/PendingScript.h.
1047         (isType):
1048         * dom/LoadableScript.cpp: Copied from Source/WebCore/dom/ScriptRunner.h. New wrapper for CachedScript
1049         and ScriptModuleGraph. We introduce a new wrapper to handle the above 2 things in the same way.
1050         We take the way to introduce a new wrapper instead of introducing a new interface that is inherited by
1051         CachedScript and ScriptModuleGraph. This is because ScriptModuleGraph is ref-counted while CachedScript
1052         is managed by CachedResourceHandle. While this patch does not contain ScriptModuleGraph part, this
1053         should be added in the module patch and at that time, this should be managed by this LoadableScript's
1054         subclass. And we introduce TypeCasts traits for LoadableScript to allow `is<>` and `downcast<>`.
1055         (WebCore::LoadableScript::addClient):
1056         (WebCore::LoadableScript::removeClient):
1057         (WebCore::LoadableScript::notifyClientFinished):
1058         * dom/LoadableScript.h: Copied from Source/WebCore/dom/ScriptRunner.h.
1059         (WebCore::LoadableScript::~LoadableScript):
1060         (WebCore::LoadableScript::isClassicScript):
1061         (WebCore::LoadableScript::isModuleGraph):
1062         * dom/LoadableScriptClient.h: Copied from Source/WebCore/dom/ScriptRunner.h.
1063         (WebCore::LoadableScriptClient::~LoadableScriptClient):
1064         * dom/PendingScript.cpp: Use LoadableScript instead of CachedScript.
1065         (WebCore::PendingScript::create):
1066         (WebCore::PendingScript::PendingScript):
1067         (WebCore::PendingScript::~PendingScript):
1068         (WebCore::PendingScript::loadableScript):
1069         (WebCore::PendingScript::notifyFinished):
1070         (WebCore::PendingScript::isLoaded):
1071         (WebCore::PendingScript::wasErrored):
1072         (WebCore::PendingScript::cachedScript): Deleted.
1073         * dom/PendingScript.h:
1074         * dom/ScriptElement.cpp:
1075         (WebCore::ScriptElement::ScriptElement):
1076         (WebCore::ScriptElement::handleSourceAttribute): Change sourceUrl to sourceURL to be consistent.
1077         (WebCore::ScriptElement::prepareScript):
1078         (WebCore::ScriptElement::requestClassicScript): requestScript is renamed to requestClassicScript.
1079         (WebCore::ScriptElement::requestScriptWithCache): Extract the code requesting the
1080         CachedScript from requestScript. This will also be used by the module fetcher.
1081         (WebCore::ScriptElement::executeScript): Now inspector error reporting is also done in this function.
1082         When an error occurs, LoadableScript::wasErrored() returns the error which may include the information
1083         to report the error to the inspector. nosniff and cross-origin loading errors are now detected by the
1084         LoadableClassicScript and reported through this wasErrored().
1085         (WebCore::ScriptElement::stopLoadRequest):
1086         (WebCore::ScriptElement::executeScriptAndDispatchEvent):
1087         (WebCore::ScriptElement::executeScriptForScriptRunner): Move the code from ScriptRunner. This function
1088         calls removeClient(*this) because ScriptRunner is driven by the ScriptElement's notification. Only when using
1089         ScriptRunner, we call addClient(*this) for ScriptElement. This is tricky, we should refactor this in the separated
1090         bug (https://bugs.webkit.org/show_bug.cgi?id=161726).
1091         (WebCore::ScriptElement::executeScriptForHTMLScriptRunner): Move the code from HTMLScriptRunner.
1092         (WebCore::ScriptElement::notifyFinished):
1093         (WebCore::ScriptElement::requestScript): Deleted.
1094         (WebCore::ScriptElement::execute): Deleted.
1095         * dom/ScriptElement.h:
1096         (WebCore::ScriptElement::loadableScript):
1097         (WebCore::ScriptElement::cachedScript): Deleted.
1098         * dom/ScriptRunner.cpp:
1099         (WebCore::ScriptRunner::queueScriptForExecution):
1100         (WebCore::ScriptRunner::timerFired): Use ScriptElement::executeScriptForScriptRunner.
1101         * dom/ScriptRunner.h:
1102         * html/parser/HTMLScriptRunner.cpp:
1103         (WebCore::HTMLScriptRunner::executePendingScriptAndDispatchEvent):
1104         (WebCore::requestPendingScript):
1105         (WebCore::HTMLScriptRunner::requestParsingBlockingScript):
1106         (WebCore::HTMLScriptRunner::sourceFromPendingScript): Deleted.
1107         * html/parser/HTMLScriptRunner.h: Use ScriptElement::executeScriptForHTMLScriptRunner.
1108         * xml/parser/XMLDocumentParserLibxml2.cpp: Currently, we do nothing about XMLDocument in this patch.
1109         We should support the module script, but before that, we should refactor this pending script handling.
1110         (WebCore::XMLDocumentParser::endElementNs):
1111
1112 2016-09-07  Alex Christensen  <achristensen@webkit.org>
1113
1114         Unreviewed, revert r205533.
1115         https://bugs.webkit.org/show_bug.cgi?id=161668
1116
1117         Re-landing changesets:
1118
1119         "Punycode encode non-ascii hosts in URLParser"
1120         https://bugs.webkit.org/show_bug.cgi?id=161655
1121         http://trac.webkit.org/changeset/205521
1122
1123         "Fix query-only and fragment-only relative URLs when using
1124         URLParser"
1125         https://bugs.webkit.org/show_bug.cgi?id=161657
1126         http://trac.webkit.org/changeset/205526
1127
1128         "URLParser should parse / as a relative URL"
1129         https://bugs.webkit.org/show_bug.cgi?id=161667
1130         http://trac.webkit.org/changeset/205532
1131
1132 2016-09-07  Simon Fraser  <simon.fraser@apple.com>
1133
1134         Enable the <meter> element on iOS
1135         https://bugs.webkit.org/show_bug.cgi?id=161714
1136         rdar://problem/8978410
1137
1138         Reviewed by Tim Horton.
1139
1140         Define ENABLE_METER_ELEMENT unconditionally now.
1141         
1142         Rendering falls back to html.css rendering, which makes <meter> looks similar between
1143         macOS and iOS.
1144
1145         Tested by enabling existing tests.
1146
1147         * Configurations/FeatureDefines.xcconfig:
1148
1149 2016-09-07  Eric Carlson  <eric.carlson@apple.com>
1150
1151         [MediaStream] applyConstraints pt. 2 - advanced constraints
1152         https://bugs.webkit.org/show_bug.cgi?id=161715
1153         <rdar://problem/28195461>
1154
1155         Reviewed by Dean Jackson.
1156
1157         Test: fast/mediastream/apply-constraints-advanced.html
1158
1159         * platform/mediastream/MediaConstraints.cpp:
1160         (WebCore::MediaConstraint::create): Return Ref<>, not RefPtr<>.
1161         (WebCore::MediaConstraint::copy): New
1162         (WebCore::IntConstraint::copy): Ditto.
1163         (WebCore::DoubleConstraint::copy): Ditto.
1164         (WebCore::BooleanConstraint::copy): Ditto.
1165         (WebCore::StringConstraint::copy): Ditto.
1166         (WebCore::StringConstraint::fitnessDistance): New, compute the fitness distance between the
1167           constraint and the specified value.
1168         (WebCore::StringConstraint::merge): New, merge value into constraint.
1169         (WebCore::FlattenedConstraint::set): New, add or replace a constraint.
1170         (WebCore::FlattenedConstraint::merge): New, merge or add a constraint.
1171         * platform/mediastream/MediaConstraints.h:
1172         (WebCore::MediaConstraint::fitnessDistance):
1173         (WebCore::MediaConstraint::merge):
1174         (WebCore::NumericConstraint::nearlyEqual):
1175         (WebCore::FlattenedConstraint::isEmpty):
1176         (WebCore::FlattenedConstraint::begin):
1177         (WebCore::FlattenedConstraint::end):
1178         (WebCore::MediaConstraint::~MediaConstraint): Deleted.
1179         (WebCore::MediaConstraint::find): Deleted.
1180         (WebCore::MediaConstraint::getIdeal): Deleted.
1181
1182         * platform/mediastream/RealtimeMediaSource.cpp:
1183         (WebCore::RealtimeMediaSource::fitnessDistance): Return the fitness distance between the source
1184           capabilities and a constraint.
1185         (WebCore::applyNumericConstraint): New, apply a numeric constraint.
1186         (WebCore::RealtimeMediaSource::applyConstraint): Use applyNumericConstraint.
1187         (WebCore::RealtimeMediaSource::selectSettings): New, implement the SelectSettings algorithm
1188         (WebCore::RealtimeMediaSource::applyConstraints):
1189         (WebCore::RealtimeMediaSource::supportsConstraint): Deleted.
1190         (WebCore::value): Deleted.
1191         * platform/mediastream/RealtimeMediaSource.h:
1192
1193 2016-09-07  Mark Lam  <mark.lam@apple.com>
1194
1195         Add CatchScope and force all exception checks to be via ThrowScope or CatchScope.
1196         https://bugs.webkit.org/show_bug.cgi?id=161498
1197
1198         Reviewed by Geoffrey Garen.
1199
1200         No new test because there is no behavior change in general except for 1 bug fix.
1201         That bug is already caught by existing tests with the introduction of the CatchScope.
1202
1203         Fixes a bug in JSEventListener::handleEvent() where the exception thrown from
1204         a failed attempt to get the handleEvent callback is not handled.
1205
1206         * ForwardingHeaders/runtime/CatchScope.h: Added.
1207         * Modules/encryptedmedia/CDMSessionClearKey.cpp:
1208         (WebCore::CDMSessionClearKey::update):
1209         * Modules/indexeddb/IDBObjectStore.cpp:
1210         (WebCore::IDBObjectStore::putOrAdd):
1211         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
1212         (WebCore::IDBServer::UniqueIDBDatabase::performPutOrAdd):
1213         * Modules/mediastream/SDPProcessor.cpp:
1214         (WebCore::SDPProcessor::callScript):
1215         * Modules/plugins/QuickTimePluginReplacement.mm:
1216         (WebCore::QuickTimePluginReplacement::ensureReplacementScriptInjected):
1217         (WebCore::QuickTimePluginReplacement::installReplacement):
1218         * bindings/js/ArrayValue.cpp:
1219         (WebCore::ArrayValue::get):
1220         * bindings/js/Dictionary.cpp:
1221         (WebCore::Dictionary::getOwnPropertiesAsStringHashMap):
1222         * bindings/js/IDBBindingUtilities.cpp:
1223         (WebCore::toJS):
1224         * bindings/js/JSApplePaySessionCustom.cpp:
1225         (WebCore::JSApplePaySession::completeShippingMethodSelection):
1226         (WebCore::JSApplePaySession::completeShippingContactSelection):
1227         (WebCore::JSApplePaySession::completePaymentMethodSelection):
1228         * bindings/js/JSAudioTrackCustom.cpp:
1229         (WebCore::JSAudioTrack::setKind):
1230         (WebCore::JSAudioTrack::setLanguage):
1231         * bindings/js/JSBlobCustom.cpp:
1232         (WebCore::constructJSBlob):
1233         * bindings/js/JSCSSStyleDeclarationCustom.cpp:
1234         (WebCore::JSCSSStyleDeclaration::getPropertyCSSValue):
1235         * bindings/js/JSCommandLineAPIHostCustom.cpp:
1236         (WebCore::getJSListenerFunctions):
1237         * bindings/js/JSCryptoAlgorithmDictionary.cpp:
1238         (WebCore::JSCryptoAlgorithmDictionary::getAlgorithmIdentifier):
1239         (WebCore::getHashAlgorithm):
1240         (WebCore::createAesCbcParams):
1241         (WebCore::createAesKeyGenParams):
1242         (WebCore::createHmacParams):
1243         (WebCore::createHmacKeyParams):
1244         (WebCore::createRsaKeyGenParams):
1245         (WebCore::createRsaOaepParams):
1246         (WebCore::createRsaSsaParams):
1247         * bindings/js/JSCryptoKeySerializationJWK.cpp:
1248         (WebCore::getJSArrayFromJSON):
1249         (WebCore::getStringFromJSON):
1250         (WebCore::getBooleanFromJSON):
1251         (WebCore::JSCryptoKeySerializationJWK::JSCryptoKeySerializationJWK):
1252         (WebCore::JSCryptoKeySerializationJWK::reconcileUsages):
1253         (WebCore::JSCryptoKeySerializationJWK::keyDataOctetSequence):
1254         (WebCore::JSCryptoKeySerializationJWK::keyDataRSAComponents):
1255         (WebCore::JSCryptoKeySerializationJWK::keyData):
1256         (WebCore::buildJSONForRSAComponents):
1257         (WebCore::addUsagesToJSON):
1258         (WebCore::JSCryptoKeySerializationJWK::serialize):
1259         * bindings/js/JSCustomElementInterface.cpp:
1260         (WebCore::JSCustomElementInterface::constructElement):
1261         (WebCore::constructCustomElementSynchronously):
1262         (WebCore::JSCustomElementInterface::upgradeElement):
1263         * bindings/js/JSCustomElementRegistryCustom.cpp:
1264         (WebCore::getCustomElementCallback):
1265         (WebCore::JSCustomElementRegistry::define):
1266         (WebCore::whenDefinedPromise):
1267         (WebCore::JSCustomElementRegistry::whenDefined):
1268         * bindings/js/JSDOMBinding.cpp:
1269         (WebCore::valueToUSVString):
1270         (WebCore::reportException):
1271         (WebCore::reportCurrentException):
1272         (WebCore::setDOMException):
1273         (WebCore::hasIteratorMethod):
1274         (WebCore::toSmallerInt):
1275         (WebCore::toSmallerUInt):
1276         (WebCore::toInt32EnforceRange):
1277         (WebCore::toUInt32EnforceRange):
1278         (WebCore::toInt64EnforceRange):
1279         (WebCore::toUInt64EnforceRange):
1280         (WebCore::throwNotSupportedError):
1281         (WebCore::throwInvalidStateError):
1282         (WebCore::throwSecurityError):
1283         * bindings/js/JSDOMBinding.h:
1284         (WebCore::toJSSequence):
1285         (WebCore::toJS):
1286         (WebCore::jsFrozenArray):
1287         (WebCore::NativeValueTraits<String>::nativeValue):
1288         (WebCore::NativeValueTraits<unsigned>::nativeValue):
1289         (WebCore::NativeValueTraits<float>::nativeValue):
1290         (WebCore::NativeValueTraits<double>::nativeValue):
1291         (WebCore::toNativeArray):
1292         * bindings/js/JSDOMGlobalObject.cpp:
1293         (WebCore::makeThisTypeErrorForBuiltins):
1294         (WebCore::makeGetterTypeErrorForBuiltins):
1295         * bindings/js/JSDOMGlobalObjectTask.cpp:
1296         * bindings/js/JSDOMIterator.h:
1297         (WebCore::iteratorForEach):
1298         * bindings/js/JSDOMPromise.cpp:
1299         (WebCore::rejectPromiseWithExceptionIfAny):
1300         * bindings/js/JSDOMPromise.h:
1301         (WebCore::callPromiseFunction):
1302         * bindings/js/JSDOMStringMapCustom.cpp:
1303         (WebCore::JSDOMStringMap::putDelegate):
1304         * bindings/js/JSDOMWindowBase.cpp:
1305         (WebCore::JSDOMWindowMicrotaskCallback::call):
1306         * bindings/js/JSDOMWindowCustom.cpp:
1307         (WebCore::JSDOMWindow::setLocation):
1308         (WebCore::JSDOMWindow::open):
1309         (WebCore::JSDOMWindow::showModalDialog):
1310         (WebCore::handlePostMessage):
1311         (WebCore::JSDOMWindow::setTimeout):
1312         (WebCore::JSDOMWindow::setInterval):
1313         * bindings/js/JSDataCueCustom.cpp:
1314         (WebCore::constructJSDataCue):
1315         * bindings/js/JSDeviceMotionEventCustom.cpp:
1316         (WebCore::readAccelerationArgument):
1317         (WebCore::readRotationRateArgument):
1318         (WebCore::JSDeviceMotionEvent::initDeviceMotionEvent):
1319         * bindings/js/JSDictionary.cpp:
1320         (WebCore::JSDictionary::tryGetProperty):
1321         (WebCore::JSDictionary::convertValue):
1322         * bindings/js/JSDictionary.h:
1323         (WebCore::JSDictionary::tryGetPropertyAndResult):
1324         * bindings/js/JSDocumentCustom.cpp:
1325         (WebCore::JSDocument::getCSSCanvasContext):
1326         * bindings/js/JSEventListener.cpp:
1327         (WebCore::JSEventListener::handleEvent):
1328         * bindings/js/JSFileCustom.cpp:
1329         (WebCore::constructJSFile):
1330         * bindings/js/JSGeolocationCustom.cpp:
1331         (WebCore::createPositionOptions):
1332         (WebCore::JSGeolocation::getCurrentPosition):
1333         (WebCore::JSGeolocation::watchPosition):
1334         * bindings/js/JSHTMLAllCollectionCustom.cpp:
1335         (WebCore::callHTMLAllCollection):
1336         * bindings/js/JSHTMLCanvasElementCustom.cpp:
1337         (WebCore::get3DContextAttributes):
1338         (WebCore::JSHTMLCanvasElement::getContext):
1339         (WebCore::JSHTMLCanvasElement::probablySupportsContext):
1340         * bindings/js/JSHTMLElementCustom.cpp:
1341         (WebCore::constructJSHTMLElement):
1342         * bindings/js/JSHistoryCustom.cpp:
1343         (WebCore::JSHistory::pushState):
1344         (WebCore::JSHistory::replaceState):
1345         * bindings/js/JSIDBDatabaseCustom.cpp:
1346         (WebCore::JSIDBDatabase::createObjectStore):
1347         * bindings/js/JSLazyEventListener.cpp:
1348         (WebCore::JSLazyEventListener::initializeJSFunction):
1349         * bindings/js/JSMainThreadExecState.h:
1350         (WebCore::JSMainThreadExecState::linkAndEvaluateModule):
1351         (WebCore::JSMainThreadExecState::~JSMainThreadExecState):
1352         * bindings/js/JSMessageEventCustom.cpp:
1353         (WebCore::handleInitMessageEvent):
1354         * bindings/js/JSMessagePortCustom.cpp:
1355         (WebCore::fillMessagePortArray):
1356         * bindings/js/JSMessagePortCustom.h:
1357         (WebCore::handlePostMessage):
1358         * bindings/js/JSMockContentFilterSettingsCustom.cpp:
1359         (WebCore::JSMockContentFilterSettings::setDecisionPoint):
1360         (WebCore::toDecision):
1361         (WebCore::JSMockContentFilterSettings::setDecision):
1362         (WebCore::JSMockContentFilterSettings::setUnblockRequestDecision):
1363         * bindings/js/JSNodeFilterCustom.cpp:
1364         (WebCore::JSNodeFilter::acceptNode):
1365         * bindings/js/JSNodeOrString.cpp:
1366         (WebCore::toNodeOrStringVector):
1367         * bindings/js/JSSQLTransactionCustom.cpp:
1368         (WebCore::JSSQLTransaction::executeSql):
1369         * bindings/js/JSSVGLengthCustom.cpp:
1370         (WebCore::JSSVGLength::convertToSpecifiedUnits):
1371         * bindings/js/JSStorageCustom.cpp:
1372         (WebCore::JSStorage::getOwnPropertyNames):
1373         (WebCore::JSStorage::putDelegate):
1374         * bindings/js/JSTextTrackCustom.cpp:
1375         (WebCore::JSTextTrack::setLanguage):
1376         * bindings/js/JSVideoTrackCustom.cpp:
1377         (WebCore::JSVideoTrack::setKind):
1378         (WebCore::JSVideoTrack::setLanguage):
1379         * bindings/js/JSWebGL2RenderingContextCustom.cpp:
1380         (WebCore::JSWebGL2RenderingContext::getIndexedParameter):
1381         * bindings/js/JSWebGLRenderingContextBaseCustom.cpp:
1382         (WebCore::getObjectParameter):
1383         (WebCore::JSWebGLRenderingContextBase::getExtension):
1384         (WebCore::JSWebGLRenderingContextBase::getFramebufferAttachmentParameter):
1385         (WebCore::JSWebGLRenderingContextBase::getParameter):
1386         (WebCore::JSWebGLRenderingContextBase::getProgramParameter):
1387         (WebCore::JSWebGLRenderingContextBase::getShaderParameter):
1388         (WebCore::toVector):
1389         (WebCore::dataFunctionf):
1390         (WebCore::dataFunctionMatrix):
1391         * bindings/js/JSWebKitSubtleCryptoCustom.cpp:
1392         (WebCore::createAlgorithmFromJSValue):
1393         (WebCore::cryptoKeyFormatFromJSValue):
1394         (WebCore::cryptoKeyUsagesFromJSValue):
1395         (WebCore::JSWebKitSubtleCrypto::encrypt):
1396         (WebCore::JSWebKitSubtleCrypto::decrypt):
1397         (WebCore::JSWebKitSubtleCrypto::sign):
1398         (WebCore::JSWebKitSubtleCrypto::verify):
1399         (WebCore::JSWebKitSubtleCrypto::digest):
1400         (WebCore::JSWebKitSubtleCrypto::generateKey):
1401         (WebCore::importKey):
1402         (WebCore::JSWebKitSubtleCrypto::importKey):
1403         (WebCore::exportKey):
1404         (WebCore::JSWebKitSubtleCrypto::exportKey):
1405         (WebCore::JSWebKitSubtleCrypto::wrapKey):
1406         (WebCore::JSWebKitSubtleCrypto::unwrapKey):
1407         * bindings/js/JSWorkerCustom.cpp:
1408         (WebCore::constructJSWorker):
1409         * bindings/js/JSWorkerGlobalScopeCustom.cpp:
1410         (WebCore::JSWorkerGlobalScope::importScripts):
1411         (WebCore::JSWorkerGlobalScope::setTimeout):
1412         (WebCore::JSWorkerGlobalScope::setInterval):
1413         * bindings/js/ReadableStreamDefaultController.cpp:
1414         (WebCore::ReadableStreamDefaultController::invoke):
1415         (WebCore::ReadableStreamDefaultController::isControlledReadableStreamLocked):
1416         * bindings/js/ReadableStreamDefaultController.h:
1417         (WebCore::ReadableStreamDefaultController::enqueue):
1418         * bindings/js/ScheduledAction.cpp:
1419         (WebCore::ScheduledAction::create):
1420         * bindings/js/ScriptGlobalObject.cpp:
1421         (WebCore::ScriptGlobalObject::set):
1422         * bindings/js/SerializedScriptValue.cpp:
1423         (WebCore::CloneBase::shouldTerminate):
1424         (WebCore::CloneDeserializer::deserialize):
1425         (WebCore::SerializedScriptValue::create):
1426         (WebCore::SerializedScriptValue::deserialize):
1427         * bindings/js/WorkerScriptController.cpp:
1428         (WebCore::WorkerScriptController::evaluate):
1429         * bindings/scripts/CodeGeneratorJS.pm:
1430         (GenerateDictionaryImplementationContent):
1431         (GenerateImplementation):
1432         (GenerateParametersCheck):
1433         (GenerateImplementationFunctionCall):
1434         (GenerateConstructorDefinition):
1435         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
1436         (WebCore::jsTestActiveDOMObjectPrototypeFunctionPostMessage):
1437         * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
1438         (WebCore::jsTestCustomNamedGetterPrototypeFunctionAnotherFunction):
1439         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
1440         (WebCore::JSTestEventConstructorConstructor::construct):
1441         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
1442         (WebCore::jsTestEventTargetPrototypeFunctionItem):
1443         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
1444         (WebCore::setJSTestGlobalObjectRegularAttribute):
1445         (WebCore::setJSTestGlobalObjectPublicAndPrivateAttribute):
1446         (WebCore::setJSTestGlobalObjectPublicAndPrivateConditionalAttribute):
1447         (WebCore::setJSTestGlobalObjectEnabledAtRuntimeAttribute):
1448         (WebCore::jsTestGlobalObjectInstanceFunctionRegularOperation):
1449         (WebCore::jsTestGlobalObjectInstanceFunctionEnabledAtRuntimeOperation1):
1450         (WebCore::jsTestGlobalObjectInstanceFunctionEnabledAtRuntimeOperation2):
1451         * bindings/scripts/test/JS/JSTestInterface.cpp:
1452         (WebCore::JSTestInterfaceConstructor::construct):
1453         (WebCore::setJSTestInterfaceConstructorImplementsStaticAttr):
1454         (WebCore::setJSTestInterfaceImplementsStr2):
1455         (WebCore::setJSTestInterfaceImplementsStr3):
1456         (WebCore::setJSTestInterfaceImplementsNode):
1457         (WebCore::setJSTestInterfaceConstructorSupplementalStaticAttr):
1458         (WebCore::setJSTestInterfaceSupplementalStr2):
1459         (WebCore::setJSTestInterfaceSupplementalStr3):
1460         (WebCore::setJSTestInterfaceSupplementalNode):
1461         (WebCore::jsTestInterfacePrototypeFunctionImplementsMethod2):
1462         (WebCore::jsTestInterfacePrototypeFunctionSupplementalMethod2):
1463         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
1464         (WebCore::setJSTestJSBuiltinConstructorTestAttributeRWCustom):
1465         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
1466         (WebCore::JSTestNamedConstructorNamedConstructor::construct):
1467         * bindings/scripts/test/JS/JSTestNode.cpp:
1468         (WebCore::setJSTestNodeName):
1469         * bindings/scripts/test/JS/JSTestNondeterministic.cpp:
1470         (WebCore::setJSTestNondeterministicNondeterministicWriteableAttr):
1471         (WebCore::setJSTestNondeterministicNondeterministicExceptionAttr):
1472         (WebCore::setJSTestNondeterministicNondeterministicGetterExceptionAttr):
1473         (WebCore::setJSTestNondeterministicNondeterministicSetterExceptionAttr):
1474         * bindings/scripts/test/JS/JSTestObj.cpp:
1475         (WebCore::convertDictionary<TestObj::Dictionary>):
1476         (WebCore::convertDictionary<TestObj::DictionaryThatShouldNotTolerateNull>):
1477         (WebCore::convertDictionary<TestObj::DictionaryThatShouldTolerateNull>):
1478         (WebCore::convertDictionary<AlternateDictionaryName>):
1479         (WebCore::setJSTestObjConstructorStaticStringAttr):
1480         (WebCore::setJSTestObjTestSubObjEnabledBySettingConstructor):
1481         (WebCore::setJSTestObjEnumAttr):
1482         (WebCore::setJSTestObjByteAttr):
1483         (WebCore::setJSTestObjOctetAttr):
1484         (WebCore::setJSTestObjShortAttr):
1485         (WebCore::setJSTestObjClampedShortAttr):
1486         (WebCore::setJSTestObjEnforceRangeShortAttr):
1487         (WebCore::setJSTestObjUnsignedShortAttr):
1488         (WebCore::setJSTestObjLongAttr):
1489         (WebCore::setJSTestObjLongLongAttr):
1490         (WebCore::setJSTestObjUnsignedLongLongAttr):
1491         (WebCore::setJSTestObjStringAttr):
1492         (WebCore::setJSTestObjUsvstringAttr):
1493         (WebCore::setJSTestObjTestObjAttr):
1494         (WebCore::setJSTestObjTestNullableObjAttr):
1495         (WebCore::setJSTestObjLenientTestObjAttr):
1496         (WebCore::setJSTestObjStringAttrTreatingNullAsEmptyString):
1497         (WebCore::setJSTestObjUsvstringAttrTreatingNullAsEmptyString):
1498         (WebCore::setJSTestObjImplementationEnumAttr):
1499         (WebCore::setJSTestObjXMLObjAttr):
1500         (WebCore::setJSTestObjCreate):
1501         (WebCore::setJSTestObjReflectedStringAttr):
1502         (WebCore::setJSTestObjReflectedUSVStringAttr):
1503         (WebCore::setJSTestObjReflectedIntegralAttr):
1504         (WebCore::setJSTestObjReflectedUnsignedIntegralAttr):
1505         (WebCore::setJSTestObjReflectedBooleanAttr):
1506         (WebCore::setJSTestObjReflectedURLAttr):
1507         (WebCore::setJSTestObjReflectedUSVURLAttr):
1508         (WebCore::setJSTestObjReflectedCustomIntegralAttr):
1509         (WebCore::setJSTestObjReflectedCustomBooleanAttr):
1510         (WebCore::setJSTestObjReflectedCustomURLAttr):
1511         (WebCore::setJSTestObjEnabledAtRuntimeAttribute):
1512         (WebCore::setJSTestObjTypedArrayAttr):
1513         (WebCore::setJSTestObjAttrWithGetterException):
1514         (WebCore::setJSTestObjAttrWithGetterExceptionWithMessage):
1515         (WebCore::setJSTestObjAttrWithSetterException):
1516         (WebCore::setJSTestObjAttrWithSetterExceptionWithMessage):
1517         (WebCore::setJSTestObjStringAttrWithGetterException):
1518         (WebCore::setJSTestObjStringAttrWithSetterException):
1519         (WebCore::setJSTestObjCustomAttr):
1520         (WebCore::setJSTestObjOnfoo):
1521         (WebCore::setJSTestObjOnwebkitfoo):
1522         (WebCore::setJSTestObjWithScriptStateAttribute):
1523         (WebCore::setJSTestObjWithCallWithAndSetterCallWithAttribute):
1524         (WebCore::setJSTestObjWithScriptExecutionContextAttribute):
1525         (WebCore::setJSTestObjWithScriptStateAttributeRaises):
1526         (WebCore::setJSTestObjWithScriptExecutionContextAttributeRaises):
1527         (WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateAttribute):
1528         (WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateAttributeRaises):
1529         (WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateWithSpacesAttribute):
1530         (WebCore::setJSTestObjWithScriptArgumentsAndCallStackAttribute):
1531         (WebCore::setJSTestObjConditionalAttr1):
1532         (WebCore::setJSTestObjConditionalAttr2):
1533         (WebCore::setJSTestObjConditionalAttr3):
1534         (WebCore::setJSTestObjConditionalAttr4Constructor):
1535         (WebCore::setJSTestObjConditionalAttr5Constructor):
1536         (WebCore::setJSTestObjConditionalAttr6Constructor):
1537         (WebCore::setJSTestObjAnyAttribute):
1538         (WebCore::setJSTestObjMutablePoint):
1539         (WebCore::setJSTestObjImmutablePoint):
1540         (WebCore::setJSTestObjStrawberry):
1541         (WebCore::setJSTestObjId):
1542         (WebCore::setJSTestObjReplaceableAttribute):
1543         (WebCore::setJSTestObjNullableLongSettableAttribute):
1544         (WebCore::setJSTestObjNullableStringSettableAttribute):
1545         (WebCore::setJSTestObjNullableUSVStringSettableAttribute):
1546         (WebCore::setJSTestObjNullableStringValue):
1547         (WebCore::setJSTestObjAttributeWithReservedEnumType):
1548         (WebCore::setJSTestObjPutForwardsAttribute):
1549         (WebCore::setJSTestObjPutForwardsNullableAttribute):
1550         (WebCore::setJSTestObjStringifierAttribute):
1551         (WebCore::jsTestObjPrototypeFunctionEnabledAtRuntimeOperation1):
1552         (WebCore::jsTestObjPrototypeFunctionEnabledAtRuntimeOperation2):
1553         (WebCore::jsTestObjPrototypeFunctionVoidMethodWithArgs):
1554         (WebCore::jsTestObjPrototypeFunctionByteMethodWithArgs):
1555         (WebCore::jsTestObjPrototypeFunctionOctetMethodWithArgs):
1556         (WebCore::jsTestObjPrototypeFunctionLongMethodWithArgs):
1557         (WebCore::jsTestObjPrototypeFunctionObjMethodWithArgs):
1558         (WebCore::jsTestObjPrototypeFunctionMethodWithArgTreatingNullAsEmptyString):
1559         (WebCore::jsTestObjPrototypeFunctionMethodWithXPathNSResolverParameter):
1560         (WebCore::jsTestObjPrototypeFunctionNullableStringSpecialMethod):
1561         (WebCore::jsTestObjPrototypeFunctionMethodWithEnumArg):
1562         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalEnumArg):
1563         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalEnumArgAndDefaultValue):
1564         (WebCore::jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows):
1565         (WebCore::jsTestObjPrototypeFunctionMethodWithUSVStringArg):
1566         (WebCore::jsTestObjPrototypeFunctionMethodWithNullableUSVStringArg):
1567         (WebCore::jsTestObjPrototypeFunctionMethodWithUSVStringArgTreatingNullAsEmptyString):
1568         (WebCore::jsTestObjPrototypeFunctionSerializedValue):
1569         (WebCore::jsTestObjPrototypeFunctionPrivateMethod):
1570         (WebCore::jsTestObjPrototypeFunctionPublicAndPrivateMethod):
1571         (WebCore::jsTestObjPrototypeFunctionAddEventListener):
1572         (WebCore::jsTestObjPrototypeFunctionRemoveEventListener):
1573         (WebCore::jsTestObjPrototypeFunctionWithScriptStateObj):
1574         (WebCore::jsTestObjPrototypeFunctionWithScriptStateObjException):
1575         (WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContextAndScriptStateObjException):
1576         (WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContextAndScriptStateWithSpaces):
1577         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalArg):
1578         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalArgAndDefaultValue):
1579         (WebCore::jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg):
1580         (WebCore::jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs):
1581         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalString):
1582         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalUSVString):
1583         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalAtomicString):
1584         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalStringAndDefaultValue):
1585         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalAtomicStringAndDefaultValue):
1586         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalStringIsNull):
1587         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalStringIsUndefined):
1588         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalAtomicStringIsNull):
1589         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalStringIsEmptyString):
1590         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalUSVStringIsEmptyString):
1591         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalAtomicStringIsEmptyString):
1592         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalDoubleIsNaN):
1593         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalFloatIsNaN):
1594         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalLongLong):
1595         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalLongLongIsZero):
1596         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalUnsignedLongLong):
1597         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalUnsignedLongLongIsZero):
1598         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalSequence):
1599         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalSequenceIsEmpty):
1600         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalBoolean):
1601         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalBooleanIsFalse):
1602         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalXPathNSResolver):
1603         (WebCore::jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackArg):
1604         (WebCore::jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackFunctionArg):
1605         (WebCore::jsTestObjPrototypeFunctionOverloadedMethod1):
1606         (WebCore::jsTestObjPrototypeFunctionOverloadedMethod2):
1607         (WebCore::jsTestObjPrototypeFunctionOverloadedMethod3):
1608         (WebCore::jsTestObjPrototypeFunctionOverloadedMethod4):
1609         (WebCore::jsTestObjPrototypeFunctionOverloadedMethod7):
1610         (WebCore::jsTestObjPrototypeFunctionOverloadedMethod9):
1611         (WebCore::jsTestObjPrototypeFunctionOverloadedMethod10):
1612         (WebCore::jsTestObjPrototypeFunctionOverloadedMethod11):
1613         (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter1):
1614         (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter2):
1615         (WebCore::jsTestObjConstructorFunctionClassMethodWithOptional):
1616         (WebCore::jsTestObjConstructorFunctionOverloadedMethod11):
1617         (WebCore::jsTestObjConstructorFunctionOverloadedMethod12):
1618         (WebCore::jsTestObjPrototypeFunctionClassMethodWithClamp):
1619         (WebCore::jsTestObjPrototypeFunctionClassMethodWithEnforceRange):
1620         (WebCore::jsTestObjPrototypeFunctionMethodWithUnsignedLongSequence):
1621         (WebCore::jsTestObjPrototypeFunctionStringArrayFunction):
1622         (WebCore::jsTestObjPrototypeFunctionMethodWithAndWithoutNullableSequence):
1623         (WebCore::jsTestObjPrototypeFunctionGetElementById):
1624         (WebCore::jsTestObjPrototypeFunctionConvert3):
1625         (WebCore::jsTestObjPrototypeFunctionConvert4):
1626         (WebCore::jsTestObjPrototypeFunctionVariadicStringMethod):
1627         (WebCore::jsTestObjPrototypeFunctionVariadicDoubleMethod):
1628         (WebCore::jsTestObjPrototypeFunctionAny):
1629         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithFloatArgumentPromise):
1630         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithOptionalIntArgumentPromise):
1631         (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction1Promise):
1632         (WebCore::jsTestObjPrototypeFunctionConditionalOverload1):
1633         (WebCore::jsTestObjPrototypeFunctionConditionalOverload2):
1634         (WebCore::jsTestObjPrototypeFunctionSingleConditionalOverload1):
1635         (WebCore::jsTestObjPrototypeFunctionSingleConditionalOverload2):
1636         (WebCore::jsTestObjPrototypeFunctionAttachShadowRoot):
1637         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
1638         (WebCore::constructJSTestOverloadedConstructors1):
1639         (WebCore::constructJSTestOverloadedConstructors2):
1640         (WebCore::constructJSTestOverloadedConstructors4):
1641         (WebCore::constructJSTestOverloadedConstructors5):
1642         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
1643         (WebCore::constructJSTestOverloadedConstructorsWithSequence1):
1644         (WebCore::constructJSTestOverloadedConstructorsWithSequence2):
1645         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
1646         (WebCore::jsTestOverrideBuiltinsPrototypeFunctionNamedItem):
1647         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
1648         (WebCore::setJSTestSerializedScriptValueInterfaceValue):
1649         (WebCore::setJSTestSerializedScriptValueInterfaceCachedValue):
1650         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
1651         (WebCore::JSTestTypedefsConstructor::construct):
1652         (WebCore::setJSTestTypedefsUnsignedLongLongAttr):
1653         (WebCore::setJSTestTypedefsImmutableSerializedScriptValue):
1654         (WebCore::setJSTestTypedefsAttrWithGetterException):
1655         (WebCore::setJSTestTypedefsAttrWithSetterException):
1656         (WebCore::setJSTestTypedefsStringAttrWithGetterException):
1657         (WebCore::setJSTestTypedefsStringAttrWithSetterException):
1658         (WebCore::jsTestTypedefsPrototypeFunctionFunc):
1659         (WebCore::jsTestTypedefsPrototypeFunctionSetShadow):
1660         (WebCore::jsTestTypedefsPrototypeFunctionMethodWithSequenceArg):
1661         (WebCore::jsTestTypedefsPrototypeFunctionNullableSequenceArg):
1662         (WebCore::jsTestTypedefsPrototypeFunctionFuncWithClamp):
1663         (WebCore::jsTestTypedefsPrototypeFunctionStringSequenceFunction):
1664         (WebCore::jsTestTypedefsPrototypeFunctionStringSequenceFunction2):
1665         (WebCore::jsTestTypedefsPrototypeFunctionCallWithSequenceThatRequiresInclude):
1666         * bridge/NP_jsobject.cpp:
1667         (_NPN_InvokeDefault):
1668         (_NPN_Invoke):
1669         (_NPN_Evaluate):
1670         (_NPN_GetProperty):
1671         (_NPN_SetProperty):
1672         (_NPN_RemoveProperty):
1673         (_NPN_HasProperty):
1674         (_NPN_HasMethod):
1675         (_NPN_Enumerate):
1676         (_NPN_Construct):
1677         * bridge/c/c_instance.cpp:
1678         (JSC::Bindings::CInstance::moveGlobalExceptionToExecState):
1679         * bridge/objc/WebScriptObject.mm:
1680         (WebCore::addExceptionToConsole):
1681         (-[WebScriptObject callWebScriptMethod:withArguments:]):
1682         (-[WebScriptObject evaluateWebScript:]):
1683         (-[WebScriptObject setValue:forKey:]):
1684         (-[WebScriptObject valueForKey:]):
1685         (-[WebScriptObject removeWebScriptKey:]):
1686         (-[WebScriptObject hasWebScriptKey:]):
1687         (-[WebScriptObject webScriptValueAtIndex:]):
1688         (-[WebScriptObject setWebScriptValueAtIndex:value:]):
1689         * contentextensions/ContentExtensionParser.cpp:
1690         (WebCore::ContentExtensions::getDomainList):
1691         (WebCore::ContentExtensions::getTypeFlags):
1692         (WebCore::ContentExtensions::loadTrigger):
1693         (WebCore::ContentExtensions::loadAction):
1694         (WebCore::ContentExtensions::loadEncodedRules):
1695         * html/HTMLMediaElement.cpp:
1696         (WebCore::controllerJSValue):
1697         (WebCore::HTMLMediaElement::updateCaptionContainer):
1698         (WebCore::HTMLMediaElement::ensureMediaControlsInjectedScript):
1699         (WebCore::HTMLMediaElement::didAddUserAgentShadowRoot):
1700         (WebCore::HTMLMediaElement::updateMediaControlsAfterPresentationModeChange):
1701         (WebCore::HTMLMediaElement::getCurrentMediaControlsStatus):
1702         * html/HTMLPlugInImageElement.cpp:
1703         (WebCore::HTMLPlugInImageElement::didAddUserAgentShadowRoot):
1704
1705 2016-09-07  Chris Dumez  <cdumez@apple.com>
1706
1707         Fix handling of negative radius in HTMLAreaElement's coords when in circle state
1708         https://bugs.webkit.org/show_bug.cgi?id=161690
1709
1710         Reviewed by Daniel Bates.
1711
1712         Fix handling of negative radius in HTMLAreaElement's coords when in
1713         circle state:
1714         - https://html.spec.whatwg.org/#attr-area-shape-circle
1715
1716         The radius must be non-negative as per the specification. However, our
1717         code fails to check.
1718
1719         Firefox and Chrome both reject negative radius.
1720
1721         No new tests, rebaselined existing test.
1722
1723         * html/HTMLAreaElement.cpp:
1724         (WebCore::HTMLAreaElement::getRegion):
1725
1726 2016-09-07  Chris Dumez  <cdumez@apple.com>
1727
1728         Align HTMLAreaElement shape parsing with the specification
1729         https://bugs.webkit.org/show_bug.cgi?id=161698
1730
1731         Reviewed by Daniel Bates.
1732
1733         Align HTMLAreaElement shape parsing with the specification:
1734         - https://html.spec.whatwg.org/#attr-area-shape
1735
1736         In particular, add support for circ / polygon non conforming shapes
1737         and use rectangle as default state.
1738
1739         This also aligns our behavior with Chrome.
1740
1741         No new tests, rebaselined existing test.
1742
1743         * html/HTMLAreaElement.cpp:
1744         (WebCore::HTMLAreaElement::parseAttribute):
1745
1746 2016-09-07  Daniel Bates  <dabates@apple.com>
1747
1748         Fix WebCore build when building for device with iOS 10 beta SDK
1749
1750         Define SPI macro kIOReturnSuccess.
1751
1752         * platform/spi/cocoa/IOReturnSPI.h:
1753
1754 2016-09-07  Michael Catanzaro  <mcatanzaro@igalia.com>
1755
1756         [EFL] Switch to ENABLE_NETWORK_CACHE
1757         https://bugs.webkit.org/show_bug.cgi?id=152676
1758
1759         Reviewed by Alex Christensen.
1760
1761         * PlatformEfl.cmake: Add GRefPtrSoup to build.
1762         * platform/network/soup/SoupNetworkSession.cpp:
1763         (WebCore::SoupNetworkSession::clearOldSoupCache): Renamed from clearCache.
1764         (WebCore::SoupNetworkSession::setCache): Deleted.
1765         (WebCore::SoupNetworkSession::cache): Deleted.
1766         (WebCore::SoupNetworkSession::clearCache): Deleted.
1767         * platform/network/soup/SoupNetworkSession.h:
1768
1769 2016-09-07  Chris Dumez  <cdumez@apple.com>
1770
1771         Drop legacy canvas.probablySupportsContext()
1772         https://bugs.webkit.org/show_bug.cgi?id=161692
1773
1774         Reviewed by Alex Christensen.
1775
1776         Drop legacy canvas.probablySupportsContext() as it is no longer in the specification:
1777         - https://html.spec.whatwg.org/#htmlcanvaselement
1778
1779         Firefox and Chrome do not support canvas.probablySupportsContext().
1780
1781         No new tests, rebaselined existing test.
1782
1783         * bindings/js/JSHTMLCanvasElementCustom.cpp:
1784         (WebCore::JSHTMLCanvasElement::probablySupportsContext): Deleted.
1785         * html/HTMLCanvasElement.cpp:
1786         (WebCore::HTMLCanvasElement::getContext):
1787         (WebCore::HTMLCanvasElement::probablySupportsContext): Deleted.
1788         * html/HTMLCanvasElement.h:
1789         * html/HTMLCanvasElement.idl:
1790
1791 2016-09-07  Simon Fraser  <simon.fraser@apple.com>
1792
1793         Rename ScrollBehavior to ScrollAlignment::Behavior
1794         https://bugs.webkit.org/show_bug.cgi?id=161677
1795
1796         Reviewed by Tim Horton.
1797
1798         Free up ScrollBehavior for future use with CSS OM View scrolling by renaming the
1799         existing ScrollBehavior, which is about alignment when scrolling into view.
1800
1801         Renamed ScrollBehavior* to ScrollAlignment.*, and made ScrollBehavior an enum class
1802         in the struct.
1803
1804         No behavior change.
1805
1806         * CMakeLists.txt:
1807         * WebCore.xcodeproj/project.pbxproj:
1808         * editing/FrameSelection.h:
1809         * rendering/RenderLayer.cpp:
1810         (WebCore::RenderLayer::getRectToExpose):
1811         * rendering/RenderObject.h:
1812         * rendering/RenderingAllInOne.cpp:
1813         * rendering/ScrollAlignment.cpp: Renamed from Source/WebCore/rendering/ScrollBehavior.cpp.
1814         * rendering/ScrollAlignment.h: Renamed from Source/WebCore/rendering/ScrollBehavior.h.
1815         (WebCore::ScrollAlignment::getVisibleBehavior):
1816         (WebCore::ScrollAlignment::getPartialBehavior):
1817         (WebCore::ScrollAlignment::getHiddenBehavior):
1818         * rendering/ScrollBehavior.h:
1819         (WebCore::ScrollAlignment::getVisibleBehavior): Deleted.
1820         (WebCore::ScrollAlignment::getPartialBehavior): Deleted.
1821         (WebCore::ScrollAlignment::getHiddenBehavior): Deleted.
1822
1823 2016-09-07  Dave Hyatt  <hyatt@apple.com>
1824
1825         Add CSSAtRule id info for new parser
1826         https://bugs.webkit.org/show_bug.cgi?id=161695
1827
1828         Reviewed by Sam Weinig.
1829
1830         * WebCore.xcodeproj/project.pbxproj:
1831         * css/parser/CSSAtRuleID.cpp: Added.
1832         (WebCore::cssAtRuleID):
1833         * css/parser/CSSAtRuleID.h: Added.
1834
1835 2016-09-07  Youenn Fablet  <youenn@apple.com>
1836
1837         [Streams API] Separate compile flag for ReadableStream and WritableStream
1838         https://bugs.webkit.org/show_bug.cgi?id=161044
1839
1840         Reviewed by Alex Christensen.
1841
1842         Moving from STREAMS_API to READABLE_STREAM_API and WRITABLE_STREAM_API compilation flags.
1843         No change of behavior.
1844
1845         * CMakeLists.txt: Triggering regeneration of builtin wrapper files based on individual builtin header file content change to cope with @conditional changes.
1846         * Configurations/FeatureDefines.xcconfig:
1847         * DerivedSources.cpp:
1848         * DerivedSources.make: Triggering regeneration of builtin wrapper files based on file content change to cope with @conditional changes.
1849         * Modules/fetch/FetchBody.cpp:
1850         * Modules/fetch/FetchBody.h:
1851         * Modules/fetch/FetchBodyOwner.cpp:
1852         (WebCore::FetchBodyOwner::isDisturbed):
1853         (WebCore::FetchBodyOwner::blobLoadingSucceeded):
1854         (WebCore::FetchBodyOwner::blobLoadingFailed):
1855         (WebCore::FetchBodyOwner::blobChunk):
1856         * Modules/fetch/FetchBodyOwner.h:
1857         * Modules/fetch/FetchResponse.cpp:
1858         (WebCore::FetchResponse::BodyLoader::didSucceed):
1859         (WebCore::FetchResponse::BodyLoader::didFail):
1860         (WebCore::FetchResponse::BodyLoader::didReceiveData):
1861         * Modules/fetch/FetchResponse.h:
1862         * Modules/fetch/FetchResponse.idl:
1863         * Modules/fetch/FetchResponse.js:
1864         (initializeFetchResponse):
1865         * Modules/fetch/FetchResponseSource.cpp:
1866         * Modules/fetch/FetchResponseSource.h:
1867         * Modules/streams/ByteLengthQueuingStrategy.idl:
1868         * Modules/streams/ByteLengthQueuingStrategy.js:
1869         * Modules/streams/CountQueuingStrategy.idl:
1870         * Modules/streams/CountQueuingStrategy.js:
1871         * Modules/streams/ReadableStream.idl:
1872         * Modules/streams/ReadableStream.js:
1873         * Modules/streams/ReadableStreamDefaultController.idl:
1874         * Modules/streams/ReadableStreamDefaultController.js:
1875         * Modules/streams/ReadableStreamDefaultReader.idl:
1876         * Modules/streams/ReadableStreamDefaultReader.js:
1877         * Modules/streams/ReadableStreamInternals.js:
1878         * Modules/streams/ReadableStreamSource.h:
1879         * Modules/streams/ReadableStreamSource.idl:
1880         * Modules/streams/StreamInternals.js:
1881         * Modules/streams/WritableStream.idl:
1882         * Modules/streams/WritableStream.js:
1883         * Modules/streams/WritableStreamInternals.js:
1884         * bindings/js/JSDOMGlobalObject.cpp:
1885         (WebCore::JSDOMGlobalObject::addBuiltinGlobals):
1886         * bindings/js/JSReadableStreamPrivateConstructors.cpp:
1887         * bindings/js/JSReadableStreamPrivateConstructors.h:
1888         * bindings/js/JSReadableStreamSourceCustom.cpp:
1889         * bindings/js/ReadableStreamDefaultController.cpp:
1890         * bindings/js/ReadableStreamDefaultController.h:
1891         * testing/Internals.cpp:
1892         * testing/Internals.h:
1893         * testing/Internals.idl:
1894
1895 2016-09-07  Carlos Garcia Campos  <cgarcia@igalia.com>
1896
1897         [GTK] Crash of WebProcess on the last WebView disconnect
1898         https://bugs.webkit.org/show_bug.cgi?id=161605
1899
1900         Reviewed by Michael Catanzaro.
1901
1902         Stop tracking X11 GL contexts to be cleanered on an exit handler. This was added to work around bugs on drivers,
1903         and it's assuming that all GLContext not deleted when the exit handler is called are leaked, which is no longer
1904         true, because PlatformDisplay now owns a GLContext and is deleted after exit handlers.
1905
1906         * platform/graphics/GLContext.cpp:
1907         (WebCore::GLContext::GLContext):
1908         (WebCore::GLContext::~GLContext):
1909         (WebCore::activeContextList): Deleted.
1910         (WebCore::GLContext::addActiveContext): Deleted.
1911         (WebCore::GLContext::removeActiveContext): Deleted.
1912         (WebCore::GLContext::cleanupActiveContextsAtExit): Deleted.
1913
1914 2016-09-07  Nael Ouedraogo  <nael.ouedraogo@crf.canon.fr>
1915
1916         Templatize JS bindings code generator of functions with variadic parameters
1917         https://bugs.webkit.org/show_bug.cgi?id=158835
1918
1919         Reviewed by Darin Adler.
1920
1921         Add template functions to handle function with variadic parameter for DOM objects.
1922
1923         * Modules/mediastream/RTCPeerConnection.cpp:
1924         (WebCore::RTCPeerConnection::addTrack):
1925         * Modules/mediastream/RTCPeerConnection.h:
1926         * bindings/js/JSDOMBinding.h:
1927         (WebCore::VariadicHelperBase::convert):
1928         (WebCore::toArguments):
1929         (WebCore::jsFrozenArray):
1930         (WebCore::toRefPtrNativeArray):
1931         (WebCore::toNativeArray):
1932         * bindings/scripts/CodeGeneratorJS.pm:
1933         (GenerateParametersCheck):
1934         (GetVariadicType):
1935         * bindings/scripts/test/JS/JSTestObj.cpp:
1936         (WebCore::jsTestObjPrototypeFunctionOverloadedMethod12):
1937         (WebCore::jsTestObjPrototypeFunctionVariadicStringMethod):
1938         (WebCore::jsTestObjPrototypeFunctionVariadicDoubleMethod):
1939         (WebCore::jsTestObjPrototypeFunctionVariadicNodeMethod):
1940         (WebCore::jsTestObjPrototypeFunctionOverloadedMethod):
1941         (WebCore::jsTestObjPrototypeFunctionAny):
1942         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
1943         (WebCore::constructJSTestOverloadedConstructors5):
1944
1945 2016-09-06  Commit Queue  <commit-queue@webkit.org>
1946
1947         Unreviewed, rolling out r205521, r205526, and r205532.
1948         https://bugs.webkit.org/show_bug.cgi?id=161668
1949
1950         broke API tests (Requested by alexchristensen on #webkit).
1951
1952         Reverted changesets:
1953
1954         "Punycode encode non-ascii hosts in URLParser"
1955         https://bugs.webkit.org/show_bug.cgi?id=161655
1956         http://trac.webkit.org/changeset/205521
1957
1958         "Fix query-only and fragment-only relative URLs when using
1959         URLParser"
1960         https://bugs.webkit.org/show_bug.cgi?id=161657
1961         http://trac.webkit.org/changeset/205526
1962
1963         "URLParser should parse / as a relative URL"
1964         https://bugs.webkit.org/show_bug.cgi?id=161667
1965         http://trac.webkit.org/changeset/205532
1966
1967 2016-09-06  Alex Christensen  <achristensen@webkit.org>
1968
1969         URLParser should parse / as a relative URL
1970         https://bugs.webkit.org/show_bug.cgi?id=161667
1971
1972         Reviewed by Tim Horton.
1973
1974         Covered by a new API test.
1975
1976         * platform/URLParser.cpp:
1977         (WebCore::URLParser::parse):
1978
1979 2016-09-06  Joseph Pecoraro  <pecoraro@apple.com>
1980
1981         Web Inspector: Avoid linkifying some schemes in console logs
1982         https://bugs.webkit.org/show_bug.cgi?id=161648
1983         <rdar://problem/16413270>
1984
1985         Reviewed by Brian Burg.
1986
1987         * inspector/InspectorFrontendHost.cpp:
1988         (WebCore::InspectorFrontendHost::openInNewTab):
1989         If a javascript: link is passed just ignore it.
1990
1991 2016-09-06  Alex Christensen  <achristensen@webkit.org>
1992
1993         Fix query-only and fragment-only relative URLs when using URLParser
1994         https://bugs.webkit.org/show_bug.cgi?id=161657
1995
1996         Reviewed by Tim Horton.
1997
1998         Covered by new API tests and progress towards passing the web platform tests when using URLParser.
1999
2000         * platform/URLParser.cpp:
2001         (WebCore::URLParser::parse):
2002
2003 2016-09-06  Chris Dumez  <cdumez@apple.com>
2004
2005         Add support for input.minLength / textArea.minLength
2006         https://bugs.webkit.org/show_bug.cgi?id=161644
2007
2008         Reviewed by Darin Adler.
2009
2010         Add support for input.minLength / textArea.minLength:
2011         - https://html.spec.whatwg.org/#dom-input-minlength
2012         - https://html.spec.whatwg.org/#dom-textarea-minlength
2013
2014         Chrome implements this, Firefox does not yet.
2015
2016         No new tests, rebaselined existing tests.
2017
2018         * html/FormAssociatedElement.cpp:
2019         (WebCore::FormAssociatedElement::tooShort):
2020         (WebCore::FormAssociatedElement::valid):
2021         (WebCore::FormAssociatedElement::typeMismatch): Deleted.
2022         * html/FormAssociatedElement.h:
2023         * html/HTMLAttributeNames.in:
2024         * html/HTMLInputElement.cpp:
2025         (WebCore::HTMLInputElement::HTMLInputElement):
2026         (WebCore::HTMLInputElement::isValidValue):
2027         (WebCore::HTMLInputElement::tooShort):
2028         (WebCore::HTMLInputElement::tooLong):
2029         (WebCore::HTMLInputElement::parseAttribute):
2030         (WebCore::HTMLInputElement::effectiveMaxLength):
2031         (WebCore::HTMLInputElement::maxLengthAttributeChanged):
2032         (WebCore::HTMLInputElement::minLengthAttributeChanged):
2033         (WebCore::HTMLInputElement::patternMismatch): Deleted.
2034         (WebCore::parseAcceptAttribute): Deleted.
2035         (WebCore::HTMLInputElement::isEnumeratable): Deleted.
2036         (WebCore::HTMLInputElement::supportLabels): Deleted.
2037         * html/HTMLInputElement.h:
2038         (WebCore::HTMLInputElement::supportsMinLength):
2039         (WebCore::HTMLInputElement::supportsMaxLength): Deleted.
2040         * html/HTMLInputElement.idl:
2041         * html/HTMLTextAreaElement.cpp:
2042         (WebCore::HTMLTextAreaElement::parseAttribute):
2043         (WebCore::HTMLTextAreaElement::maxLengthAttributeChanged):
2044         (WebCore::HTMLTextAreaElement::minLengthAttributeChanged):
2045         (WebCore::HTMLTextAreaElement::validationMessage):
2046         (WebCore::HTMLTextAreaElement::tooShort):
2047         (WebCore::HTMLTextAreaElement::tooLong):
2048         (WebCore::HTMLTextAreaElement::isValidValue):
2049         * html/HTMLTextAreaElement.h:
2050         * html/HTMLTextAreaElement.idl:
2051         * html/HTMLTextFormControlElement.cpp:
2052         (WebCore::HTMLTextFormControlElement::setMaxLength):
2053         (WebCore::HTMLTextFormControlElement::setMinLength):
2054         * html/HTMLTextFormControlElement.h:
2055         (WebCore::HTMLTextFormControlElement::maxLength):
2056         (WebCore::HTMLTextFormControlElement::setMaxLength):
2057         (WebCore::HTMLTextFormControlElement::minLength):
2058         (WebCore::HTMLTextFormControlElement::setMinLength):
2059         * html/InputType.cpp:
2060         (WebCore::InputType::validationMessage):
2061         * html/ValidityState.idl:
2062         * platform/LocalizedStrings.cpp:
2063         (WebCore::validationMessageTooShortText):
2064         * platform/LocalizedStrings.h:
2065
2066 2016-09-06  Alex Christensen  <achristensen@webkit.org>
2067
2068         Punycode encode non-ascii hosts in URLParser
2069         https://bugs.webkit.org/show_bug.cgi?id=161655
2070
2071         Reviewed by Tim Horton.
2072
2073         Covered by new API tests based on the web platform tests.
2074
2075         * platform/URLParser.cpp:
2076         (WebCore::URLParser::parse):
2077         (WebCore::containsOnlyASCII):
2078         (WebCore::domainToASCII):
2079
2080 2016-09-06  Saam Barati  <sbarati@apple.com>
2081
2082         Make JSMap and JSSet faster
2083         https://bugs.webkit.org/show_bug.cgi?id=160989
2084
2085         Reviewed by Filip Pizlo.
2086
2087         * ForwardingHeaders/runtime/HashMapImpl.h: Added.
2088         * ForwardingHeaders/runtime/MapBase.h: Added.
2089         * bindings/js/SerializedScriptValue.cpp:
2090         (WebCore::CloneSerializer::serialize):
2091         (WebCore::CloneDeserializer::deserialize):
2092
2093 2016-09-06  Myles C. Maxfield  <mmaxfield@apple.com>
2094
2095         Strikethrough positions are erroneously snapped twice
2096         https://bugs.webkit.org/show_bug.cgi?id=161647
2097         <rdar://problem/11542470>
2098
2099         Reviewed by Zalan Bujtas.
2100
2101         Because we're using an int for the position of the baseline, the math to calculate the
2102         strikethrough position is snapped. Then, we snap it again inside GraphicsContext.
2103
2104         Test: fast/text/strikethrough-int.html
2105
2106         * rendering/InlineTextBox.cpp:
2107         (WebCore::InlineTextBox::paintDecoration):
2108         * rendering/TextDecorationPainter.h:
2109         (WebCore::TextDecorationPainter::setBaseline):
2110
2111 2016-09-06  David Kilzer  <ddkilzer@apple.com>
2112
2113         [iOS] Remove soft linking of MobileCoreServices.framework
2114         <https://webkit.org/b/161641>
2115         <rdar://problem/10420118>
2116
2117         Reviewed by Darin Adler.
2118
2119         * Configurations/WebCore.xcconfig: Add hard link to
2120         MobileCoreServices.framework.
2121
2122         * editing/ios/EditorIOS.mm: Change #include to #import.
2123         * platform/graphics/cg/ImageSourceCGMac.mm:
2124         * platform/graphics/mac/ImageMac.mm:
2125         * platform/ios/PasteboardIOS.mm:
2126         * platform/ios/PlatformPasteboardIOS.mm:
2127         * platform/network/ios/WebCoreURLResponseIOS.mm:
2128         * platform/network/mac/UTIUtilities.mm:
2129         - Rearrange import statements as needed.
2130         - Remove soft link to MobileCoreServices.framework.
2131         - Add import of <MobileCoreServices/MobileCoreServices.h> as
2132           needed.
2133
2134         * rendering/RenderThemeIOS.mm: Remove unused soft link to
2135         MobileCoreServices.framework.
2136
2137 2016-09-06  Chris Dumez  <cdumez@apple.com>
2138
2139         Align srcset attribute parsing with the HTML specification
2140         https://bugs.webkit.org/show_bug.cgi?id=161636
2141
2142         Reviewed by Darin Adler.
2143
2144         Align srcset attribute parsing with the HTML specification:
2145         - https://html.spec.whatwg.org/#parse-a-srcset-attribute
2146
2147         The new behavior is also consistent with Firefox and Chrome
2148         as all 3 browsers now pass 100% of the checks at:
2149         - http://w3c-test.org/html/semantics/embedded-content/the-img-element/srcset/parse-a-srcset-attribute.html
2150
2151         No new tests, rebaselined existing tests.
2152
2153         * html/parser/HTMLParserIdioms.cpp:
2154         (WebCore::parseValidHTMLNonNegativeIntegerInternal):
2155         (WebCore::parseValidHTMLNonNegativeInteger):
2156         (WebCore::parseValidHTMLFloatingPointNumberInternal):
2157         (WebCore::parseValidHTMLFloatingPointNumber):
2158         * html/parser/HTMLParserIdioms.h:
2159         Add convenience for parsing *valid* HTML non-negative integers and
2160         *valid* floating point number values.
2161
2162         * html/parser/HTMLSrcsetParser.cpp:
2163         (WebCore::parseDescriptors):
2164         - Use parseValidHTMLFloatingPointNumber() to parse density so that the value
2165           is parsed as a valid HTML floating point number value, as per the spec.
2166         - Use parseValidHTMLNonNegativeInteger() to parse width and height so that
2167           the value is parsed as a valid HTML non-negative integer value, as per the
2168           spec.
2169         - Return false if descriptor does not have a h, w and x at the end as per:
2170           https://html.spec.whatwg.org/#parse-a-srcset-attribute (step 13: Anything else)
2171         - Return false if height is set but not width, as per:
2172           https://html.spec.whatwg.org/#parse-a-srcset-attribute (step 14)
2173
2174         (WebCore::parseImageCandidatesFromSrcsetAttribute):
2175         - Skip whitespace if URL does not end with a comma instead of assuming there is
2176           a single space character, as per:
2177           https://html.spec.whatwg.org/#parse-a-srcset-attribute (step 8. Otherwise 1.)
2178
2179 2016-09-06  Fujii Hironori  <Hironori.Fujii@sony.com>
2180
2181         [CMake] Decouple generating bindings of WebCore and WebCoreTestSupport
2182         https://bugs.webkit.org/show_bug.cgi?id=161474
2183
2184         Generating bindings of WebCore and WebCoreTestSupport shares a
2185         single supplementalDependencyFile.  But, nothing supplements any
2186         IDL of WebCoreTestSupport.  This introduces unnecessary
2187         dependencies.
2188
2189         Reviewed by Alex Christensen.
2190
2191         * CMakeLists.txt: Do not input any IDL of WebCoreTestSupport to
2192         preprocess-idls.pl.  Do not use supplementalDependencyFile to
2193         generate bindings of WebCoreTestSupport.  Add SettingsMacros.h as
2194         a source file of WebCoreDerivedSources to ensure make_settings.pl
2195         is finished before compiling WebCoreDerivedSources.
2196
2197 2016-09-06  Zalan Bujtas  <zalan@apple.com>
2198
2199         ASSERTION FAILED: !paintInfo.overlapTestRequests->contains(this) in WebCore::RenderWidget::paintContents
2200         https://bugs.webkit.org/show_bug.cgi?id=135602
2201         <rdar://problem/27701733>
2202
2203         Reviewed by Simon Fraser.
2204
2205         ASSERT is updated to support multiple fragments painting. We just have to ensure that the FrameView's rect
2206         has not changed between the 2 paintContents calls.  
2207
2208         Test: fast/layers/assert-on-overlap-testing-with-frames-inside-columns.html
2209
2210         * rendering/RenderWidget.cpp:
2211         (WebCore::RenderWidget::paintContents):
2212
2213 2016-09-06  Commit Queue  <commit-queue@webkit.org>
2214
2215         Unreviewed, rolling out r205504.
2216         https://bugs.webkit.org/show_bug.cgi?id=161645
2217
2218         Broke the iOS device build (Requested by ryanhaddad on
2219         #webkit).
2220
2221         Reverted changeset:
2222
2223         "Make JSMap and JSSet faster"
2224         https://bugs.webkit.org/show_bug.cgi?id=160989
2225         http://trac.webkit.org/changeset/205504
2226
2227 2016-09-06  Zalan Bujtas  <zalan@apple.com>
2228
2229         Remove unused overlap checking functions from FrameView.
2230         https://bugs.webkit.org/show_bug.cgi?id=161635
2231
2232         Reviewed by Simon Fraser.
2233
2234         No change in functionality.
2235
2236         * page/FrameView.cpp:
2237         (WebCore::FrameView::isOverlappedIncludingAncestors): Deleted.
2238         * page/FrameView.h:
2239
2240 2016-09-06  Simon Fraser  <simon.fraser@apple.com>
2241
2242         Align element.scroll() / scrollTo() / scrollBy() with the CSSOM specification
2243         https://bugs.webkit.org/show_bug.cgi?id=161610
2244
2245         Reviewed by Darin Adler, Chris Dumez.
2246
2247         Implement Element.scroll(), scrollBy() and scrollTo() with x,y and ScrollToOptions
2248         on Element, according to <https://drafts.csswg.org/cssom-view/#element-scrolling-members>
2249
2250         WebKit's behavior of treating scrolls on the body element in both quirks and strict mode
2251         is preserved.
2252
2253         Tests: fast/dom/Element/scrolling-funtions-on-body-quirks.html
2254                fast/dom/Element/scrolling-funtions-on-body.html
2255                fast/dom/Element/scrolling-funtions-on-element.html
2256
2257         * dom/Element.cpp:
2258         (WebCore::Element::scrollBy):
2259         (WebCore::normalizeNonFiniteValue):
2260         (WebCore::Element::scrollTo):
2261         * dom/Element.h:
2262         * dom/Element.idl:
2263         * html/HTMLBodyElement.cpp:
2264         (WebCore::HTMLBodyElement::scrollTo):
2265         * html/HTMLBodyElement.h:
2266
2267 2016-09-06  Saam Barati  <sbarati@apple.com>
2268
2269         Make JSMap and JSSet faster
2270         https://bugs.webkit.org/show_bug.cgi?id=160989
2271
2272         Reviewed by Filip Pizlo.
2273
2274         * ForwardingHeaders/runtime/HashMapImpl.h: Added.
2275         * ForwardingHeaders/runtime/MapBase.h: Added.
2276         * bindings/js/SerializedScriptValue.cpp:
2277         (WebCore::CloneSerializer::serialize):
2278         (WebCore::CloneDeserializer::deserialize):
2279
2280 2016-09-05  Alex Christensen  <achristensen@webkit.org>
2281
2282         Implement relative file urls and begin implementing character encoding in URLParser
2283         https://bugs.webkit.org/show_bug.cgi?id=161618
2284
2285         Reviewed by Tim Horton.
2286
2287         Covered by new API tests.
2288         Also, this is a significant step towards passing the URL web platform tests when using the URLParser,
2289         which is still off by default.
2290
2291         * platform/URLParser.cpp:
2292         (WebCore::isInSimpleEncodeSet):
2293         (WebCore::isInDefaultEncodeSet):
2294         (WebCore::isInUserInfoEncodeSet):
2295         (WebCore::isInvalidDomainCharacter):
2296         (WebCore::shouldCopyFileURL):
2297         (WebCore::percentEncode):
2298         (WebCore::utf8PercentEncode):
2299         (WebCore::encodeQuery):
2300         (WebCore::isDefaultPort):
2301         (WebCore::isPercentEncodedDot):
2302         (WebCore::URLParser::parse):
2303         (WebCore::percentDecode):
2304         (WebCore::domainToASCII):
2305         (WebCore::hasInvalidDomainCharacter):
2306         (WebCore::URLParser::parsePort):
2307         (WebCore::URLParser::parseHost):
2308         (WebCore::isTabOrNewline): Deleted.
2309         * platform/URLParser.h:
2310
2311 2016-09-06  Daniel Bates  <dabates@apple.com>
2312
2313         Fix the Apple-internal build following <https://trac.webkit.org/changeset/205488>
2314         (https://bugs.webkit.org/show_bug.cgi?id=161090)
2315
2316         Use the default linkage for QuartzCore constants to match the linkage used for such constants
2317         in the Apple-internal SDK.
2318
2319         * platform/spi/cocoa/QuartzCoreSPI.h:
2320
2321 2016-09-06  Daniel Bates  <dabates@apple.com>
2322
2323         <table> inside <div align="right"> with large content inside = no scrollbar
2324         https://bugs.webkit.org/show_bug.cgi?id=3352
2325
2326         Reviewed by Brent Fulgham.
2327
2328         Respect "right" text-alignment only if the width of the child does not overflow the
2329         width of its containing block. This makes our margin computation more closely conform
2330         to section "Block-level, non-replaced elements in normal flow" of the CSS 2.1
2331         spec., <http://www.w3.org/TR/CSS21/>, and to the behavior observed in Firefox, Chrome,
2332         IE version 9 or later and Microsoft Edge.
2333
2334         Test: fast/block/align-overflow-child.html
2335
2336         * rendering/RenderBox.cpp:
2337         (WebCore::RenderBox::computeInlineDirectionMargins):
2338
2339 2016-09-06  Daniel Bates  <dabates@apple.com>
2340
2341         Remove EXTERN_C from WTF
2342         https://bugs.webkit.org/show_bug.cgi?id=161090
2343
2344         Reviewed by Brent Fulgham.
2345
2346         Guard external C declarations in WTF_EXTERN_C_BEGIN, WTF_EXTERN_C_END.
2347
2348         * platform/spi/cf/CFLocaleSPI.h:
2349         * platform/spi/cf/CFNetworkConnectionCacheSPI.h:
2350         * platform/spi/cf/CFNetworkSPI.h: Additionally, remove the workaround for <rdar://problem/18337182>
2351         as this bug was fixed in El Capitan.
2352         * platform/spi/cf/CFUtilitiesSPI.h:
2353         * platform/spi/cocoa/CoreTextSPI.h:
2354         * platform/spi/cocoa/DataDetectorsCoreSPI.h:
2355         * platform/spi/cocoa/IOPMLibSPI.h:
2356         * platform/spi/cocoa/MachVMSPI.h:
2357         * platform/spi/cocoa/QuartzCoreSPI.h:
2358         * platform/spi/ios/MobileGestaltSPI.h:
2359         * platform/spi/ios/QuickLookSPI.h:
2360         * platform/spi/win/CoreTextSPIWin.cpp:
2361         * platform/spi/win/CoreTextSPIWin.h:
2362
2363 2016-09-06  Ryan Haddad  <ryanhaddad@apple.com>
2364
2365         Unreviewed, rolling out r205407.
2366
2367         Not the correct way to implement this functionality
2368
2369         Reverted changeset:
2370
2371         "Consult with the FrameLoaderClient about whether or not
2372         content extensions should be enabled when loading this URL."
2373         https://bugs.webkit.org/show_bug.cgi?id=161441
2374         http://trac.webkit.org/changeset/205407
2375
2376 2016-09-06  Youenn Fablet  <youenn@apple.com>
2377
2378         http/tests/security/contentSecurityPolicy/worker-csp-blocks-xhr-redirect-cross-origin.html is flaky
2379         https://bugs.webkit.org/show_bug.cgi?id=161627
2380
2381         Reviewed by Darin Adler.
2382
2383         Covered by changed expectation.
2384
2385         * loader/DocumentThreadableLoader.cpp:
2386         (WebCore::DocumentThreadableLoader::redirectReceived): Clearing the resource in lieu of clearing the request. This will stop the resource load.
2387         * loader/SubresourceLoader.cpp:
2388         (WebCore::SubresourceLoader::didReceiveResponse): Adding an ASSERT to ensure that no valid redirect responses is mistakenly processed here.
2389
2390 2016-09-06  Zalan Bujtas  <zalan@apple.com>
2391
2392         ASSERTION FAILED: !currBox->needsLayout() in WebCore::RenderBlock::checkPositionedObjectsNeedLayout
2393         https://bugs.webkit.org/show_bug.cgi?id=120291
2394         <rdar://problem/27683456>
2395
2396         Reviewed by David Hyatt.
2397
2398         This patch ensures that we always set the 'positioned child needs layout' bit on the containing block
2399         when a new positioned descendant gets inserted. It fixes cases for simplified layout when
2400         we ended up not laying out the descendant element. 
2401
2402         Test: fast/block/positioning/assert-when-positioned-descendant-is-not-getting-laid-out.html
2403
2404         * rendering/RenderBlock.cpp:
2405         (WebCore::RenderBlock::insertPositionedObject):
2406
2407 2016-09-06  Youenn Fablet  <youenn@apple.com>
2408
2409         CachedResourceLoader is not taking into account fetch options to use or not cached resources
2410         https://bugs.webkit.org/show_bug.cgi?id=161389
2411
2412         Reviewed by Darin Adler.
2413
2414         Tests: http/tests/fetch/fetching-same-resource-with-diffferent-options.html
2415                http/tests/security/cross-origin-cached-resource-parallel.html
2416                http/tests/security/cross-origin-cached-resource.html
2417                http/tests/security/load-image-after-redirection-2.html
2418                http/tests/security/shape-outside-and-cached-resources.html
2419
2420         Adding CORS checks for the response in case of CORS fetch mode, in SubresourceLoader.
2421         Removing the CORS checks in Image and DocumentThreadableLoader.
2422
2423         The direction of this patch is to make CachedResource origin-specific/fetch mode specific.
2424
2425         This will remove the need for CachedResource clients to do CORS checks when receiving the notifyFinished call.
2426         This will also make the computation of whether a resource is clean or not much easier since the CachedResource knowd its origin and its response tainting.
2427
2428         Removing the CORS checks at ImageLoader creates the risk of using some cached resources loaded from previously no-cors mode without doing the actual CORS check.
2429         Note that the risk was already there in case of a resource loaded through redirections.
2430         Reusing a cached resource for a load with different options also leads to bad computation of the resource tainting.
2431
2432         As a first step, improvements are done but only for CachedImage resources.
2433
2434         This patch limits the direct reuse of cached resources as follow:
2435         - If the request and existing resources have different origins.
2436         - If the fetch mode is different between request and existing resource.
2437
2438         In those cases, a new CachedResource is created with the correct options and origin.
2439         The data and response of the CachedResource found in the cache are copied efficiently in the new CachedResource, if the matching CachedResource finished loading (CachedImage specific).
2440
2441         If the matching CachedResource is still loading, we trigger a reload (with caching=false to not disturb the being loaded resource).
2442         This should be made more efficient at some point, especially if the matching CachedResource already has its response set.
2443
2444         This triggers a change of behavior: previously, the CORS checks were done by the ImageLoader when the resource was finished loading.
2445         The CORS checks were controlled by the crossOrigin attribute, which may be set or unset between the load start and the load end.
2446
2447         Now the crossOrigin attribute is checked at load start. If it is set, the CORS checks will happen even if the attribute is unset before the end of the load.
2448         This is more consistent as the actual request was built with CORS enabled.
2449
2450         * loader/CrossOriginPreflightChecker.cpp:
2451         (WebCore::CrossOriginPreflightChecker::startPreflight): Setting correctly the preflight options as per fetch spec.
2452         * loader/DocumentThreadableLoader.cpp:
2453         (WebCore::DocumentThreadableLoader::didReceiveResponse): Removing CORS check.
2454         (WebCore::DocumentThreadableLoader::loadRequest): Adding CORS check in sync mode.
2455         * loader/ImageLoader.cpp:
2456         (WebCore::ImageLoader::updateFromElement):
2457         (WebCore::ImageLoader::notifyFinished):
2458         * loader/SubresourceLoader.cpp:
2459         (WebCore::SubresourceLoader::didReceiveResponse): Adding CORS checks to the response
2460         (WebCore::SubresourceLoader::checkResponseCrossOriginAccessControl): Helper routine to do CORS checks
2461         * loader/SubresourceLoader.h:
2462         * loader/cache/CachedImage.cpp:
2463         (WebCore::CachedImage::cloneData): Responsible to set image content from another CachedImage.
2464         * loader/cache/CachedImage.h:
2465         * loader/cache/CachedResource.cpp:
2466         (WebCore::CachedResource::computeOrigin): Helper routine to set the origin and whether the resource is cross-origin or not.
2467         (WebCore::CachedResource::load): Using computeOrigin.
2468         (WebCore::CachedResource::loadFrom): Loading from a CachedResource from the same type and which finished loading.
2469         * loader/cache/CachedResource.h:
2470         (WebCore::CachedResource::cloneData):
2471         * loader/cache/CachedResourceLoader.cpp:
2472         (WebCore::CachedResourceLoader::updateCachedResourceWithCurrentRequest): Helper routine responsible to adapt the CachedResource
2473         that can be reused to the origin and options of a new request.
2474         (WebCore::CachedResourceLoader::requestResource): Calling updateCachedResourceWithCurrentRequest before actually returning the resource.
2475         (WebCore::CachedResourceLoader::determineRevalidationPolicy): Space clean-up.
2476         * loader/cache/CachedResourceLoader.h:
2477         * loader/cache/CachedResourceRequest.h:
2478         (WebCore::CachedResourceRequest::setCachingPolicy):
2479         * style/StylePendingResources.cpp:
2480         (WebCore::Style::loadPendingImage): Allowing data URLs for ShapeOutside data.
2481
2482 2016-09-05  Darin Adler  <darin@apple.com>
2483
2484         More bindings improvements, particularly things not needed for JavaScript bindings
2485         https://bugs.webkit.org/show_bug.cgi?id=161572
2486
2487         Reviewed by Sam Weinig.
2488
2489         * WebCore.xcodeproj/project.pbxproj: Export a couple of files needed for legacy bindings.
2490
2491         * bindings/js/JSDOMWindowCustom.cpp:
2492         (WebCore::addCrossOriginWindowPropertyNames): Mark array const.
2493         * bindings/js/JSLocationCustom.cpp:
2494         (WebCore::addCrossOriginLocationPropertyNames): Ditto.
2495
2496         * dom/DOMImplementation.cpp:
2497         (WebCore::addString): Deleted.
2498         (WebCore::isSupportedSVG10Feature): Deleted.
2499         (WebCore::isSupportedSVG11Feature): Deleted.
2500         (WebCore::DOMImplementation::hasFeature): Deleted.
2501
2502         * dom/DOMImplementation.h: Changed hasFeature to take no arguments and to always
2503         return true, as specified in the DOM spec.
2504
2505         * dom/DOMImplementation.idl: Removed the arguments to hasFeature.
2506
2507         * dom/Document.cpp:
2508         (WebCore::Document::defaultCharsetForLegacyBindings): Renamed from
2509         defaultCharsetForBindings, because this function is used only by the
2510         non-JavaScript bindings.
2511         * dom/Document.h: Updated for the above.
2512
2513         * dom/DocumentType.h: Removed entitiesForBindings,
2514         notationsForBindings, and internalSubsetForBindings, all of which were
2515         empty functions. The empty implementations are now in the legacy bindings.
2516
2517         * dom/Element.cpp:
2518         (WebCore::Element::dispatchSimulatedClickForBindings): Deleted.
2519         This code is now at the single call site, in HTMLElement.
2520         * dom/Element.h: Updated for the above change.
2521
2522         * dom/Node.cpp:
2523         (WebCore::Node::isSupportedForBindings): Deleted. This is only used in the
2524         legacy bindings, and since it only returns a value other than "true" for
2525         SVG features, it is now in the SVGTests class.
2526         * dom/Node.h: Updated for the above change.
2527
2528         * html/HTMLElement.cpp:
2529         (WebCore::HTMLElement::click): Call simulateClick with the appropriate
2530         arguments rather than calling dispatchSimulatedClickForBindings.
2531
2532         * svg/SVGTests.cpp:
2533         (WebCore::supportedSVGFeatures): Added. Moved here from DOMImplementation,
2534         but also refactored.
2535         (WebCore::SVGTests::isValid): Changed to use the function above, rather than
2536         calling DOMImplementation::hasFeature. This change fixes a bug where feature names
2537         that do not look like valid SVG feature names, names such as "xxx", were returning
2538         true claiming that the feature was supported. This behavior was helpful in the
2539         general DOMImplementation function, but harmful here. This bug was causing test
2540         failures in some of our SVG tests.
2541         (WebCore::SVGTests::hasFeatureForLegacyBindings): Added. Uses the set above to
2542         implement the legacy behavior of hasFeature. It's better to have this in parallel
2543         with the SVGTests::isValid function rather than having either depend on the other.
2544
2545         * svg/SVGTests.h: Added exported SVGTests::isValid function.
2546
2547 2016-09-05  Commit Queue  <commit-queue@webkit.org>
2548
2549         Unreviewed, rolling out r205450.
2550         https://bugs.webkit.org/show_bug.cgi?id=161614
2551
2552         Made tests flaky, causing false positives on EWS (Requested by
2553         ap on #webkit).
2554
2555         Reverted changeset:
2556
2557         "CachedResourceLoader is not taking into account fetch options
2558         to use or not cached resources"
2559         https://bugs.webkit.org/show_bug.cgi?id=161389
2560         http://trac.webkit.org/changeset/205450
2561
2562 2016-08-31  Filip Pizlo  <fpizlo@apple.com>
2563
2564         Butterflies should be allocated in Auxiliary MarkedSpace instead of CopiedSpace and we should rewrite as much of the GC as needed to make this not a regression
2565         https://bugs.webkit.org/show_bug.cgi?id=160125
2566
2567         Reviewed by Geoffrey Garen and Keith Miller.
2568
2569         No new tests because no new WebCore behavior.
2570         
2571         Just rewiring #includes.
2572
2573         * ForwardingHeaders/heap/HeapInlines.h: Added.
2574         * ForwardingHeaders/interpreter/Interpreter.h: Removed.
2575         * ForwardingHeaders/runtime/AuxiliaryBarrierInlines.h: Added.
2576         * Modules/indexeddb/IDBCursorWithValue.cpp:
2577         * Modules/indexeddb/client/TransactionOperation.cpp:
2578         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
2579         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
2580         * bindings/js/JSApplePayPaymentAuthorizedEventCustom.cpp:
2581         * bindings/js/JSApplePayPaymentMethodSelectedEventCustom.cpp:
2582         * bindings/js/JSApplePayShippingContactSelectedEventCustom.cpp:
2583         * bindings/js/JSApplePayShippingMethodSelectedEventCustom.cpp:
2584         * bindings/js/JSClientRectCustom.cpp:
2585         * bindings/js/JSDOMBinding.cpp:
2586         * bindings/js/JSDOMBinding.h:
2587         * bindings/js/JSDeviceMotionEventCustom.cpp:
2588         * bindings/js/JSDeviceOrientationEventCustom.cpp:
2589         * bindings/js/JSErrorEventCustom.cpp:
2590         * bindings/js/JSIDBCursorWithValueCustom.cpp:
2591         * bindings/js/JSIDBIndexCustom.cpp:
2592         * bindings/js/JSPopStateEventCustom.cpp:
2593         * bindings/js/JSWebGL2RenderingContextCustom.cpp:
2594         * bindings/js/JSWorkerGlobalScopeCustom.cpp:
2595         * bindings/js/WorkerScriptController.cpp:
2596         * contentextensions/ContentExtensionParser.cpp:
2597         * dom/ErrorEvent.cpp:
2598         * html/HTMLCanvasElement.cpp:
2599         * html/MediaDocument.cpp:
2600         * inspector/CommandLineAPIModule.cpp:
2601         * loader/EmptyClients.cpp:
2602         * page/CaptionUserPreferences.cpp:
2603         * page/Frame.cpp:
2604         * page/PageGroup.cpp:
2605         * page/UserContentController.cpp:
2606         * platform/mock/mediasource/MockBox.cpp:
2607         * testing/GCObservation.cpp:
2608
2609 2016-09-05  Fujii Hironori  <Hironori.Fujii@sony.com>
2610
2611         run-bindings-tests fails since r205422
2612         https://bugs.webkit.org/show_bug.cgi?id=161595
2613
2614         Reviewed by Darin Adler.
2615
2616         Rebaseline binding tests after r205422.
2617
2618         * bindings/scripts/test/JS/JSInterfaceName.cpp:
2619         * bindings/scripts/test/JS/JSInterfaceName.h:
2620         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
2621         * bindings/scripts/test/JS/JSTestActiveDOMObject.h:
2622         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
2623         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.h:
2624         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp:
2625         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.h:
2626         * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
2627         * bindings/scripts/test/JS/JSTestCustomNamedGetter.h:
2628         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
2629         * bindings/scripts/test/JS/JSTestEventConstructor.h:
2630         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
2631         * bindings/scripts/test/JS/JSTestEventTarget.h:
2632         * bindings/scripts/test/JS/JSTestException.cpp:
2633         * bindings/scripts/test/JS/JSTestException.h:
2634         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
2635         * bindings/scripts/test/JS/JSTestGenerateIsReachable.h:
2636         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
2637         * bindings/scripts/test/JS/JSTestGlobalObject.h:
2638         * bindings/scripts/test/JS/JSTestInterface.cpp:
2639         * bindings/scripts/test/JS/JSTestInterface.h:
2640         * bindings/scripts/test/JS/JSTestIterable.cpp:
2641         * bindings/scripts/test/JS/JSTestIterable.h:
2642         * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
2643         * bindings/scripts/test/JS/JSTestMediaQueryListListener.h:
2644         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
2645         * bindings/scripts/test/JS/JSTestNamedConstructor.h:
2646         * bindings/scripts/test/JS/JSTestNode.cpp:
2647         * bindings/scripts/test/JS/JSTestNode.h:
2648         * bindings/scripts/test/JS/JSTestNondeterministic.cpp:
2649         * bindings/scripts/test/JS/JSTestNondeterministic.h:
2650         * bindings/scripts/test/JS/JSTestObj.cpp:
2651         * bindings/scripts/test/JS/JSTestObj.h:
2652         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
2653         * bindings/scripts/test/JS/JSTestOverloadedConstructors.h:
2654         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
2655         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.h:
2656         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
2657         * bindings/scripts/test/JS/JSTestOverrideBuiltins.h:
2658         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
2659         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.h:
2660         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
2661         * bindings/scripts/test/JS/JSTestTypedefs.h:
2662         * bindings/scripts/test/JS/JSattribute.cpp:
2663         * bindings/scripts/test/JS/JSattribute.h:
2664         * bindings/scripts/test/JS/JSreadonly.cpp:
2665         * bindings/scripts/test/JS/JSreadonly.h:
2666
2667 2016-09-05  Fujii Hironori  <Hironori.Fujii@sony.com>
2668
2669         [CMake] Duplicated IDL files in WebCore_IDL_FILES
2670         https://bugs.webkit.org/show_bug.cgi?id=161592
2671
2672         Reviewed by Darin Adler.
2673
2674         * CMakeLists.txt: Removed duplicated IDL files.
2675         * DerivedSources.cpp: Added #if ENABLE(USER_MESSAGE_HANDLERS)
2676
2677 2016-09-05  Joseph Pecoraro  <pecoraro@apple.com>
2678
2679         [Mac] Static Analyzer warnings about unused values in CDMSessionAVStreamSession.mm
2680         https://bugs.webkit.org/show_bug.cgi?id=161598
2681
2682         Reviewed by Darin Adler.
2683
2684         * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.h:
2685         * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm:
2686         (WebCore::CDMSessionAVStreamSession::generateKeyReleaseMessage):
2687         Make this parameter a reference again, accidentally lost in r195410.
2688         Now assignments to the parameter make sense.
2689
2690 2016-09-05  Youenn Fablet  <youenn@apple.com>
2691
2692         Clean CSS stylesheets should be accessible from JavaScript
2693         https://bugs.webkit.org/show_bug.cgi?id=158728
2694
2695         Reviewed by Darin Adler.
2696
2697         Covered by updated tests.
2698
2699         Making use of the resource response type to evaluate whether to make the CSS stylesheets visible
2700         for stylesheet link elements and for stylesheet processing instructions.
2701         Ideally, the origin flag should be a boolean.
2702
2703         To keep behavior consistent in cors-check-unaware cases, the flag might remain unset.
2704         In that case, the behavior remains the same (checking of the stylesheet URL).
2705         The origin flag is set to true or false only in case of fetch mode being set to cors using the crossorigin attribute.
2706
2707         Updated CSSStyleSheet::create to take a Node reference. Updated callers accordingly.
2708
2709         * contentextensions/ContentExtensionStyleSheet.cpp:
2710         (WebCore::ContentExtensions::ContentExtensionStyleSheet::ContentExtensionStyleSheet): Updated to pass a Node reference and not pointer.
2711         * css/CSSStyleSheet.cpp:
2712         (WebCore::CSSStyleSheet::create): Makes origin flag undefined if boolean parameter is not passed.
2713         Otherwise origin flag is set according given boolean value.
2714         (WebCore::CSSStyleSheet::createInline): Makes origin flag set to true.
2715         (WebCore::CSSStyleSheet::CSSStyleSheet): Adding origin flag initialization.
2716         (WebCore::CSSStyleSheet::canAccessRules): Returning according the origin flag if set.
2717         Returning as before in case the flag is not set.
2718         * css/CSSStyleSheet.h: Adding origin clean flag.
2719         * dom/ExtensionStyleSheets.cpp:
2720         (WebCore::ExtensionStyleSheets::addUserStyleSheet):
2721         (WebCore::ExtensionStyleSheets::addAuthorStyleSheetForTesting):
2722         (WebCore::ExtensionStyleSheets::maybeAddContentExtensionSheet):
2723         * html/HTMLLinkElement.cpp:
2724         (WebCore::HTMLLinkElement::initializeStyleSheet): Helper routine used in setCSSStyleSheet.
2725         Sets origin clean flag if the resource is clean.
2726         (WebCore::HTMLLinkElement::setCSSStyleSheet): Making use of initializeStyleSheet.
2727         * html/HTMLLinkElement.h:
2728
2729 2016-09-05  Youenn Fablet  <youenn@apple.com>
2730
2731         CachedResourceLoader is not taking into account fetch options to use or not cached resources
2732         https://bugs.webkit.org/show_bug.cgi?id=161389
2733
2734         Reviewed by Darin Adler.
2735
2736         Tests: http/tests/fetch/fetching-same-resource-with-diffferent-options.html
2737                http/tests/security/cross-origin-cached-resource-parallel.html
2738                http/tests/security/cross-origin-cached-resource.html
2739                http/tests/security/load-image-after-redirection-2.html
2740                http/tests/security/shape-outside-and-cached-resources.html
2741
2742         Adding CORS checks for the response in case of CORS fetch mode, in SubresourceLoader.
2743         Removing the CORS checks in Image and DocumentThreadableLoader.
2744
2745         The direction of this patch is to make CachedResource origin-specific/fetch mode specific.
2746
2747         This will remove the need for CachedResource clients to do CORS checks when receiving the notifyFinished call.
2748         This will also make the computation of whether a resource is clean or not much easier since the CachedResource knowd its origin and its response tainting.
2749
2750         Removing the CORS checks at ImageLoader creates the risk of using some cached resources loaded from previously no-cors mode without doing the actual CORS check.
2751         Note that the risk was already there in case of a resource loaded through redirections.
2752         Reusing a cached resource for a load with different options also leads to bad computation of the resource tainting.
2753
2754         As a first step, improvements are done but only for CachedImage resources.
2755
2756         This patch limits the direct reuse of cached resources as follow:
2757         - If the request and existing resources have different origins.
2758         - If the fetch mode is different between request and existing resource.
2759
2760         In those cases, a new CachedResource is created with the correct options and origin.
2761         The data and response of the CachedResource found in the cache are copied efficiently in the new CachedResource, if the matching CachedResource finished loading (CachedImage specific).
2762
2763         If the matching CachedResource is still loading, we trigger a reload (with caching=false to not disturb the being loaded resource).
2764         This should be made more efficient at some point, especially if the matching CachedResource already has its response set.
2765
2766         This triggers a change of behavior: previously, the CORS checks were done by the ImageLoader when the resource was finished loading.
2767         The CORS checks were controlled by the crossOrigin attribute, which may be set or unset between the load start and the load end.
2768
2769         Now the crossOrigin attribute is checked at load start. If it is set, the CORS checks will happen even if the attribute is unset before the end of the load.
2770         This is more consistent as the actual request was built with CORS enabled.
2771
2772         * loader/CrossOriginPreflightChecker.cpp:
2773         (WebCore::CrossOriginPreflightChecker::startPreflight): Setting correctly the preflight options as per fetch spec.
2774         * loader/DocumentThreadableLoader.cpp:
2775         (WebCore::DocumentThreadableLoader::didReceiveResponse): Removing CORS check.
2776         (WebCore::DocumentThreadableLoader::loadRequest): Adding CORS check in sync mode.
2777         * loader/ImageLoader.cpp:
2778         (WebCore::ImageLoader::updateFromElement):
2779         (WebCore::ImageLoader::notifyFinished):
2780         * loader/SubresourceLoader.cpp:
2781         (WebCore::SubresourceLoader::didReceiveResponse): Adding CORS checks to the response
2782         (WebCore::SubresourceLoader::checkResponseCrossOriginAccessControl): Helper routine to do CORS checks
2783         * loader/SubresourceLoader.h:
2784         * loader/cache/CachedImage.cpp:
2785         (WebCore::CachedImage::cloneData): Responsible to set image content from another CachedImage.
2786         * loader/cache/CachedImage.h:
2787         * loader/cache/CachedResource.cpp:
2788         (WebCore::CachedResource::computeOrigin): Helper routine to set the origin and whether the resource is cross-origin or not.
2789         (WebCore::CachedResource::load): Using computeOrigin.
2790         (WebCore::CachedResource::loadFrom): Loading from a CachedResource from the same type and which finished loading.
2791         * loader/cache/CachedResource.h:
2792         (WebCore::CachedResource::cloneData):
2793         * loader/cache/CachedResourceLoader.cpp:
2794         (WebCore::CachedResourceLoader::updateCachedResourceWithCurrentRequest): Helper routine responsible to adapt the CachedResource
2795         that can be reused to the origin and options of a new request.
2796         (WebCore::CachedResourceLoader::requestResource): Calling updateCachedResourceWithCurrentRequest before actually returning the resource.
2797         (WebCore::CachedResourceLoader::determineRevalidationPolicy): Space clean-up.
2798         * loader/cache/CachedResourceLoader.h:
2799         * loader/cache/CachedResourceRequest.h:
2800         (WebCore::CachedResourceRequest::setCachingPolicy):
2801         * style/StylePendingResources.cpp:
2802         (WebCore::Style::loadPendingImage): Allowing data URLs for ShapeOutside data.
2803
2804 2016-09-05  Frederic Wang  <fwang@igalia.com>
2805
2806         More refactoring of RenderMathMLScripts
2807         https://bugs.webkit.org/show_bug.cgi?id=161371
2808
2809         Reviewed by Darin Adler.
2810
2811         This is a follow-up of bug 161084. The function getScriptMetricsAndLayoutIfNeeded was quite
2812         complicated and it was not obvious that we have to call it twice with the same reference
2813         to a struture holding vertical metrics. We extract the part retrieving layout parameters
2814         into verticalParameters and move its layoutIfNeeded calls into layoutBlock. Then it can
2815         be reduced to a simple function that retrieve the vertical metrics in one call.
2816         We also improve getBaseAndScripts to make clear that it is performing validation. It returns
2817         a ReferenceChildren structure encapsulating pointers to important children so that we no
2818         longer pass these pointers as function parameters. We continue to need them to browse the
2819         list of prescripts & postscripts but we refactor a bit the loop to avoid explicit mention
2820         of RenderBox*.
2821
2822         No new tests, already covered by existing tests.
2823
2824         * rendering/mathml/RenderMathMLScripts.cpp:
2825         (WebCore::RenderMathMLScripts::validateAndGetReferenceChildren): We now store the pointers to
2826         the base, firstPostScript and firstPreScript children in the ReferenceChildren structure. We
2827         also add a pointer to the prescriptDelimiter for convenience.
2828         (WebCore::RenderMathMLScripts::italicCorrection): Use the ReferenceChildren structure so that
2829         we are sure the base has been validated before calling this function.
2830         (WebCore::RenderMathMLScripts::computePreferredLogicalWidths): Retrieve the reference
2831         children with validateAndGetReferenceChildren instead of calling getBaseAndScripts and use
2832         ReferenceChildren to handle these children and to call italicCorrection. The loops for
2833         SubSup, UnderOver, Multiscripts are also rewritten a bit to avoid declaring a null RenderBox*
2834         outside of them and hence allow to use auto.
2835         (WebCore::RenderMathMLScripts::verticalParameters): This part to extract the layout
2836         parameters is extracted from getScriptMetricsAndLayoutIfNeeded. The parameters are returned
2837         as a VerticalParameters struct.
2838         (WebCore::RenderMathMLScripts::verticalMetrics): This is the remaining part of
2839         getScriptMetricsAndLayoutIfNeeded It used to call layoutIfNeeded on children and to
2840         calculate maximum vertical metrics. For Multiscripts it was called twice: We did a first
2841         call to handle the prescripts and then pass the result again in the second call to handle
2842         the postscripts. We modify a bit the loop so that all the scripts are handled in one call and
2843         hence we can directly return a VerticalMetrics. Again, the reference children are now handled
2844         using the ReferenceChildren structure passed as a parameter.
2845         (WebCore::RenderMathMLScripts::layoutBlock): We retrieve the reference children with
2846         validateAndGetReferenceChildren instead of calling getBaseAndScripts and use
2847         ReferenceChildren to handle these children and to call italicCorrection. We layout all the
2848         children if needed in one loop at the beginning instead of doing that when their vertical
2849         metrics are needed. We can now also retrieve vertical metrics with a single call.
2850         (WebCore::RenderMathMLScripts::getBaseAndScripts): Renamed validateAndGetReferenceChildren.
2851         (WebCore::RenderMathMLScripts::getScriptMetricsAndLayoutIfNeeded): Deleted. Split into
2852         verticalParameters and verticalMetrics.
2853         * rendering/mathml/RenderMathMLScripts.h: New structure to handle the pointers to reference
2854         children. Update the signature of getBaseAndScripts to use this struture and give a clearer
2855         name. Update the signature of italicCorrection to use this structure too. Add a new structure
2856         VerticalParameters and declare the helper function to retrieve them. Rename ScriptMetrics
2857         to VerticalMetrics and update the signature of the function needed to retrieve it.
2858
2859 2016-09-05  Zan Dobersek  <zdobersek@igalia.com>
2860
2861         MediaPlayerPrivateGStreamerBase: improve build guards in nativeImageForCurrentTime()
2862         https://bugs.webkit.org/show_bug.cgi?id=161594
2863
2864         Reviewed by Philippe Normand.
2865
2866         Guard the uses of cairo-gl API in nativeImageForCurrentTime() with the
2867         USE(CAIRO) && ENABLE(ACCELERATED_2D_CANVAS) pair of build guards. This
2868         API is only made available when the ACCELERATED_2D_CANVAS option is
2869         enabled. Placing the guards this way thus avoids compilation errors
2870         when compiling USE_GSTREAMER_GL code without the accelerated 2D canvas
2871         support enabled.
2872
2873         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2874         (WebCore::MediaPlayerPrivateGStreamerBase::nativeImageForCurrentTime):
2875
2876 2016-09-04  Sam Weinig  <sam@webkit.org>
2877
2878         Remove the CREATE_DOM_WRAPPER macro
2879         https://bugs.webkit.org/show_bug.cgi?id=161580
2880
2881         Reviewed by Dan Bernstein.
2882
2883         The CREATE_DOM_WRAPPER has irritated me for too long! Replace it
2884         with direct calls to createWrapper<ImplementationType>, which has
2885         been upgraded to not require specifying both the implementation type
2886         and the wrapper type by way of the new JSDOMWrapperConverterTraits
2887         struct which provides mapping from ImplementationType -> JSWrapper.
2888         createWrapper<ImplementationType> has also been upgraded to have a
2889         specialization for when the object being passed in needs to be casted.
2890
2891         * bindings/js/JSAnimationTimelineCustom.cpp:
2892         (WebCore::toJSNewlyCreated):
2893         * bindings/js/JSBlobCustom.cpp:
2894         (WebCore::toJSNewlyCreated):
2895         (WebCore::constructJSBlob):
2896         * bindings/js/JSCSSRuleCustom.cpp:
2897         (WebCore::toJSNewlyCreated):
2898         * bindings/js/JSCSSValueCustom.cpp:
2899         (WebCore::toJSNewlyCreated):
2900         * bindings/js/JSDataCueCustom.cpp:
2901         (WebCore::constructJSDataCue):
2902         * bindings/js/JSDocumentCustom.cpp:
2903         (WebCore::createNewDocumentWrapper):
2904         * bindings/js/JSDocumentFragmentCustom.cpp:
2905         (WebCore::toJSNewlyCreated):
2906         * bindings/js/JSElementCustom.cpp:
2907         (WebCore::createNewElementWrapper):
2908         * bindings/js/JSEventCustom.cpp:
2909         (WebCore::toJSNewlyCreated):
2910         * bindings/js/JSFileCustom.cpp:
2911         (WebCore::constructJSFile):
2912         * bindings/js/JSHTMLCollectionCustom.cpp:
2913         (WebCore::toJSNewlyCreated):
2914         * bindings/js/JSHTMLDocumentCustom.cpp:
2915         (WebCore::toJSNewlyCreated):
2916         * bindings/js/JSIDBCursorCustom.cpp:
2917         (WebCore::toJSNewlyCreated):
2918         * bindings/js/JSImageDataCustom.cpp:
2919         (WebCore::toJSNewlyCreated):
2920         * bindings/js/JSNodeCustom.cpp:
2921         (WebCore::createWrapperInline):
2922         * bindings/js/JSNodeListCustom.cpp:
2923         (WebCore::createWrapper):
2924         * bindings/js/JSPerformanceEntryCustom.cpp:
2925         (WebCore::toJSNewlyCreated):
2926         * bindings/js/JSSVGPathSegCustom.cpp:
2927         (WebCore::toJSNewlyCreated):
2928         * bindings/js/JSStyleSheetCustom.cpp:
2929         (WebCore::toJSNewlyCreated):
2930         * bindings/js/JSTextCustom.cpp:
2931         (WebCore::toJSNewlyCreated):
2932         * bindings/js/JSTextTrackCueCustom.cpp:
2933         (WebCore::toJSNewlyCreated):
2934         * bindings/js/JSWebGLRenderingContextBaseCustom.cpp:
2935         (WebCore::toJSNewlyCreated):
2936         * bindings/js/JSXMLDocumentCustom.cpp:
2937         (WebCore::toJSNewlyCreated):
2938         * dom/make_names.pl:
2939         (printWrapperFunctions):
2940         (printWrapperFactoryCppFile):
2941         Replace CREATE_DOM_WRAPPER with direct calls to createWrapper.
2942
2943         * bindings/js/JSWorkerGlobalScopeBase.h:
2944         Add #include of JSDOMWrapper.h to allow generated subclasses to use 
2945         JSDOMWrapperConverterTraits.
2946
2947         * bindings/js/JSDOMBinding.h:
2948         (WebCore::castDOMObjectForWrapperCreation): Deleted.
2949         Remove CREATE_DOM_WRAPPER and castDOMObjectForWrapperCreation and 
2950         specialize createWrapper.
2951
2952         * bindings/js/JSDOMWrapper.h:
2953         Forward declare JSDOMWrapperConverterTraits.
2954
2955         * bindings/scripts/CodeGeneratorJS.pm:
2956         (GenerateHeader):
2957         Add specialization of JSDOMWrapperConverterTraits for each header.
2958
2959         (GenerateImplementation):
2960         (GenerateConstructorDefinition):
2961         Replace CREATE_DOM_WRAPPER with direct calls to createWrapper.
2962
2963 2016-09-04  Antti Koivisto  <antti@apple.com>
2964
2965         Remove Style::PendingResources
2966         https://bugs.webkit.org/show_bug.cgi?id=161574
2967
2968         Reviewed by Andreas Kling.
2969
2970         RenderStyle contains all the information needed to initialize resource loads. There is no need for this side structure.
2971
2972         * css/CSSFilterImageValue.cpp:
2973         (WebCore::CSSFilterImageValue::loadSubimages):
2974
2975             Load external SVG resources along with any image resources.
2976
2977         * css/CSSToStyleMap.cpp:
2978         (WebCore::CSSToStyleMap::styleImage):
2979         (WebCore::CSSToStyleMap::mapFillImage):
2980         (WebCore::CSSToStyleMap::mapNinePieceImage):
2981         * css/CSSToStyleMap.h:
2982         * css/StyleBuilderConverter.h:
2983         (WebCore::StyleBuilderConverter::convertStyleImage):
2984         (WebCore::StyleBuilderConverter::convertShapeValue):
2985         * css/StyleBuilderCustom.h:
2986         (WebCore::StyleBuilderCustom::applyValueCursor):
2987         (WebCore::StyleBuilderCustom::applyValueContent):
2988         * css/StyleResolver.cpp:
2989         (WebCore::StyleResolver::State::clear):
2990         (WebCore::StyleResolver::styleImage):
2991         (WebCore::StyleResolver::createFilterOperations):
2992         (WebCore::StyleResolver::loadPendingResources):
2993         (WebCore::StyleResolver::State::ensurePendingResources): Deleted.
2994         (WebCore::StyleResolver::styleCachedImageFromValue): Deleted.
2995         (WebCore::StyleResolver::styleGeneratedImageFromValue): Deleted.
2996         * css/StyleResolver.h:
2997         (WebCore::StyleResolver::State::takePendingResources): Deleted.
2998         * platform/graphics/filters/FilterOperation.cpp:
2999         (WebCore::ReferenceFilterOperation::loadExternalDocumentIfNeeded):
3000         (WebCore::ReferenceFilterOperation::getOrCreateCachedSVGDocumentReference): Deleted.
3001         * platform/graphics/filters/FilterOperation.h:
3002         (WebCore::ReferenceFilterOperation::cachedSVGDocumentReference):
3003         * rendering/style/StyleCachedImage.cpp:
3004         (WebCore::StyleCachedImage::StyleCachedImage):
3005         * style/StylePendingResources.cpp:
3006         (WebCore::Style::loadPendingResources):
3007
3008             Trigger resource loads by checking pending resources in RenderStyle unconditionally. Keeping track of them
3009             separately wasn't necessary or a meaningful optimization.
3010
3011         (WebCore::Style::loadPendingImages): Deleted.
3012         (WebCore::Style::loadPendingSVGFilters): Deleted.
3013         * style/StylePendingResources.h:
3014
3015 2016-09-04  Antti Koivisto  <antti@apple.com>
3016
3017         Reverse ownership relation of StyleCachedImage and CSSImageValue
3018         https://bugs.webkit.org/show_bug.cgi?id=161447
3019
3020         Reviewed by Andreas Kling.
3021
3022         Currently StyleCachedImage (which represents an image in RenderStyle) has a weak ref to the
3023         underlying CSSImageValue/CSSImageSetValue which actually owns it. This is awkwards especially since
3024         StyleGeneratedImage, the other StyleImage subclass has reversed relationship where it refs
3025         the underlying CSSImageGeneratorValue.
3026
3027         This patch makes StyleCachedImage similar to StyleGeneratedImage. StyleCachedImage now refs the
3028         underlying CSSImageValue/CSSImageSetValue. CSSImageValues no longer need to know about StyleCachedImage.
3029         Instead they reference CachedImages (memory cache objects) directly. StyleCachedImage instances are now
3030         conceptually unique to RenderStyle instances. Actual resources are shared as before by sharing CachedImages.
3031
3032         * css/CSSCursorImageValue.cpp:
3033         (WebCore::CSSCursorImageValue::loadImage):
3034         (WebCore::CSSCursorImageValue::cachedImage):
3035         (WebCore::CSSCursorImageValue::styleImage): Deleted.
3036         * css/CSSCursorImageValue.h:
3037         * css/CSSImageGeneratorValue.cpp:
3038         (WebCore::CSSImageGeneratorValue::cachedImageForCSSValue):
3039         * css/CSSImageSetValue.cpp:
3040         (WebCore::CSSImageSetValue::~CSSImageSetValue):
3041         (WebCore::CSSImageSetValue::loadBestFitImage):
3042         (WebCore::CSSImageSetValue::traverseSubresources):
3043         (WebCore::CSSImageSetValue::styleImage): Deleted.
3044         * css/CSSImageSetValue.h:
3045         * css/CSSImageValue.cpp:
3046         (WebCore::CSSImageValue::CSSImageValue):
3047         (WebCore::CSSImageValue::~CSSImageValue):
3048         (WebCore::CSSImageValue::isPending):
3049         (WebCore::CSSImageValue::loadImage):
3050         (WebCore::CSSImageValue::traverseSubresources):
3051         (WebCore::CSSImageValue::knownToBeOpaque):
3052         (WebCore::CSSImageValue::styleImage): Deleted.
3053         * css/CSSImageValue.h:
3054         * css/StyleBuilderCustom.h:
3055         (WebCore::StyleBuilderCustom::applyValueContent):
3056         * css/StyleResolver.cpp:
3057         (WebCore::StyleResolver::styleImage):
3058         (WebCore::StyleResolver::styleCachedImageFromValue):
3059         (WebCore::StyleResolver::styleGeneratedImageFromValue):
3060         (WebCore::StyleResolver::cachedOrPendingFromValue): Deleted.
3061         (WebCore::StyleResolver::generatedOrPendingFromValue): Deleted.
3062         (WebCore::StyleResolver::setOrPendingFromValue): Deleted.
3063         (WebCore::StyleResolver::cursorOrPendingFromValue): Deleted.
3064         * css/StyleResolver.h:
3065         * editing/TextIterator.cpp:
3066         (WebCore::fullyClipsContents):
3067         * page/PageSerializer.cpp:
3068         (WebCore::PageSerializer::retrieveResourcesForProperties):
3069         * rendering/style/FillLayer.cpp:
3070         (WebCore::FillLayer::imagesIdentical):
3071
3072             Compare data equality instead of pointer equality for StyleImages (since StyleImages are no longer shared).
3073
3074         (WebCore::layerImagesIdentical): Deleted.
3075         * rendering/style/StyleCachedImage.cpp:
3076         (WebCore::StyleCachedImage::StyleCachedImage):
3077         (WebCore::StyleCachedImage::~StyleCachedImage):
3078         (WebCore::StyleCachedImage::cachedImage):
3079         (WebCore::StyleCachedImage::cssValue):
3080         (WebCore::StyleCachedImage::canRender):
3081         (WebCore::StyleCachedImage::isPending):
3082         (WebCore::StyleCachedImage::isLoaded):
3083         (WebCore::StyleCachedImage::errorOccurred):
3084         (WebCore::StyleCachedImage::imageSize):
3085         (WebCore::StyleCachedImage::imageHasRelativeWidth):
3086         (WebCore::StyleCachedImage::imageHasRelativeHeight):
3087         (WebCore::StyleCachedImage::computeIntrinsicDimensions):
3088         (WebCore::StyleCachedImage::usesImageContainerSize):
3089         (WebCore::StyleCachedImage::setContainerSizeForRenderer):
3090         (WebCore::StyleCachedImage::addClient):
3091         (WebCore::StyleCachedImage::removeClient):
3092         (WebCore::StyleCachedImage::image):
3093         (WebCore::StyleCachedImage::knownToBeOpaque):
3094         (WebCore::StyleCachedImage::setCachedImage): Deleted.
3095         * rendering/style/StyleCachedImage.h:
3096
3097 2016-09-03  Wenson Hsieh  <wenson_hsieh@apple.com>
3098
3099         Media controls behave strangely when videos mute from within a playing handler
3100         https://bugs.webkit.org/show_bug.cgi?id=161559
3101         <rdar://problem/28018438>
3102
3103         Reviewed by Darin Adler.
3104
3105         Defer showing media controls until after the media element has fired its onplaying handler. This handles cases
3106         where videos that autoplay may initially meet the criteria for main content, but once the video begins to play,
3107         the page may change the media in some way (e.g. muting) that makes the video no longer main content. This causes
3108         media controls to flicker in and out.
3109
3110         These changes are covered by existing unit tests, which have been refactored to check media controller state
3111         after all autoplaying videos have begun playing. Also adds an additional unit test.
3112
3113         * html/HTMLMediaElement.cpp:
3114         (WebCore::HTMLMediaElement::notifyAboutPlaying):
3115         (WebCore::HTMLMediaElement::hasEverNotifiedAboutPlaying):
3116         * html/HTMLMediaElement.h:
3117         * html/MediaElementSession.cpp:
3118         (WebCore::MediaElementSession::canShowControlsManager):
3119
3120 2016-09-03  Ryosuke Niwa  <rniwa@webkit.org>
3121
3122         Update the semantics of defined-ness of custom elements per spec changes
3123         https://bugs.webkit.org/show_bug.cgi?id=161570
3124
3125         Reviewed by Darin Adler.
3126
3127         This patch adds the notion of a custom element that failed to construct or upgrade so that :defined
3128         doesn't apply to such an element. We also set the defined flag inside the HTMLElement constructor in
3129         the case of synchronous construction instead of waiting for the custom element constructor to finish.
3130         https://dom.spec.whatwg.org/#concept-create-element
3131
3132         Conceptually, there are four distinct states for an element:
3133         1. The element is a built-in element
3134         2. The element is a custom element yet to be defined (an upgrade candidate).
3135         3. The element is a well-defined custom element (constructed or upgraded).
3136         4. The element has failed to construct or upgrade as a custom element (because the custom element
3137         constructor threw an exception or returned an unexpected object).
3138
3139         In the latest DOM/HTML specifications, these states are called as 1. "uncustomized", 2. "undefined",
3140         3. "custom", and 4. "failed": https://dom.spec.whatwg.org/#concept-element-defined
3141
3142         This patch refactors Node flags to introduce these distinct states as the following:
3143         1. Neither IsCustomElement nor IsEditingTextOrUnresolvedCustomElementFlag is set.
3144         2. IsCustomElement and IsEditingTextOrUnresolvedCustomElementFlag are set.
3145         isCustomElementUpgradeCandidate() and isUndefinedCustomElement() return true.
3146         3. IsCustomElement is set and IsEditingTextOrUnresolvedCustomElementFlag is unset.
3147         isDefinedCustomElement() returns true.
3148         4. IsCustomElement is unset and IsEditingTextOrUnresolvedCustomElementFlag is set.
3149         isFailedCustomElement() and isUndefinedCustomElement() return true.
3150
3151         Per a spec change, this patch also makes :defined applied to a synchronously constructed custom element
3152         immediately after super() call in the constructor. When the constructor throws an exception or fails to
3153         return the right element, the HTML parser marks the fallback element with setIsUndefinedCustomElement.
3154
3155         Tests: fast/custom-elements/defined-pseudo-class.html
3156                fast/custom-elements/defined-rule.html
3157                fast/custom-elements/upgrading/Node-cloneNode.html
3158
3159         * bindings/js/JSCustomElementInterface.cpp:
3160         (WebCore::JSCustomElementInterface::constructElement): Don't set :defined flag here since that's done
3161         in the HTMLElement constructor now.
3162         (WebCore::JSCustomElementInterface::upgradeElement): Mark the element as failed-to-upgrade as needed.
3163         * bindings/js/JSElementCustom.cpp:
3164         (WebCore::toJSNewlyCreated):
3165         * bindings/js/JSHTMLElementCustom.cpp:
3166         (WebCore::constructJSHTMLElement):
3167         * css/SelectorCheckerTestFunctions.h:
3168         (WebCore::isDefinedElement):
3169         * dom/CustomElementReactionQueue.cpp:
3170         (WebCore::CustomElementReactionQueue::enqueueElementUpgradeIfDefined): Enqueue custom element reactions
3171         only if the element is well defined (successfully constructed or upgraded).
3172         (WebCore::CustomElementReactionQueue::enqueueConnectedCallbackIfNeeded): Ditto.
3173         (WebCore::CustomElementReactionQueue::enqueueDisconnectedCallbackIfNeeded): Ditto.
3174         (WebCore::CustomElementReactionQueue::enqueueAdoptedCallbackIfNeeded): Ditto.
3175         (WebCore::CustomElementReactionQueue::enqueueAttributeChangedCallbackIfNeeded): Ditto.
3176         * dom/CustomElementRegistry.cpp:
3177         (WebCore::enqueueUpgradeInShadowIncludingTreeOrder):
3178         * dom/Document.cpp:
3179         (WebCore::createUpgradeCandidateElement):
3180         (WebCore::createFallbackHTMLElement):
3181         * dom/Element.cpp:
3182         (WebCore::Element::attributeChanged):
3183         (WebCore::Element::didMoveToNewDocument):
3184         (WebCore::Element::insertedInto):
3185         (WebCore::Element::removedFrom):
3186         (WebCore::Element::setCustomElementIsResolved): Deleted.
3187         (WebCore::Element::setIsDefinedCustomElement): Renamed from setCustomElementIsResolved.
3188         (WebCore::Element::setIsFailedCustomElement): Added.
3189         (WebCore::Element::setIsCustomElementUpgradeCandidate): Added.
3190         (WebCore::Element::customElementInterface):
3191         * dom/Element.h:
3192         * dom/Node.h:
3193         (WebCore::Node::setIsCustomElement): Deleted.
3194         (WebCore::Node::isUndefinedCustomElement): Renamed from isUnresolvedCustomElement.
3195         (WebCore::Node::setIsUnresolvedCustomElement): Deleted.
3196         (WebCore::Node::isCustomElementUpgradeCandidate): Added.
3197         (WebCore::Node::isDefinedCustomElement): Renamed from isCustomElement.
3198         (WebCore::Node::isFailedCustomElement): Added.
3199         * dom/make_names.pl:
3200         (printWrapperFactoryCppFile): Use the HTMLElement wrapper on upgrade candidates. When a custom element
3201         failed to upgrade, the HTMLElement constructor would have created the wrapper so we never run this code.
3202         * html/parser/HTMLConstructionSite.cpp:
3203         (WebCore::HTMLConstructionSite::createHTMLElementOrFindCustomElementInterface): 
3204         * html/parser/HTMLDocumentParser.cpp:
3205         (WebCore::HTMLDocumentParser::runScriptsForPausedTreeBuilder): Mark the HTMLUnknownElement created when
3206         the custom element constructor failed to run successfully as a failed custom element so that :define
3207         wouldn't apply to this element.
3208
3209 2016-09-03  Wenson Hsieh  <wenson_hsieh@apple.com>
3210
3211         Refactor the heuristic for showing media controls to take all media sessions into account
3212         https://bugs.webkit.org/show_bug.cgi?id=161503
3213         <rdar://problem/28033783>
3214
3215         Reviewed by Darin Adler.
3216
3217         Currently, when selecting a media session to show playback controls for, we grab the first media session that
3218         passes our heuristic. Using this method, we are unable to take additional factors into account, such as whether
3219         another media session's element is scrolled in view, or if another media session has been interacted with more
3220         recently. To address this, we make the following changes:
3221
3222             1.  Consider the list of all MediaElementSessions.
3223
3224             2.  Select only the MediaElementSessions capable of showing media controls and sort the list by a special
3225                 heuristic that takes visibility and time of last user interaction into account. The first element on
3226                 this list is the strongest candidate for main content.
3227
3228             3.  If this strongest candidate is visible in the viewport, or it is playing with audio, we return this
3229                 as the chosen candidate. Otherwise, we return this session only if no other non-candidate video could be
3230                 confused as the main content (i.e. the non-candidate video is not only visible in the viewport, but also
3231                 large enough to be considered main content).
3232
3233         Using this new method of determining the video to show controls for, we retain previous behavior for pages with
3234         a single video. On pages with multiple videos, the above logic ensures that if the current controlled video is
3235         paused, scrolled out of view, and then a new video is scrolled into view, we will either hide media controls to
3236         avoid confusion if that video could be confused for main content (using the mechanism in step 3), or we
3237         hook up the media controls to the new video if it satisfies main content (using the mechanism in step 2).
3238
3239         This patch also adds 6 new TestWebKitAPI unit tests.
3240
3241         * html/HTMLMediaElement.cpp:
3242         (WebCore::mediaElementSessionInfoForSession):
3243         (WebCore::preferMediaControlsForCandidateSessionOverOtherCandidateSession):
3244         (WebCore::mediaSessionMayBeConfusedWithMainContent):
3245         (WebCore::bestMediaSessionForShowingPlaybackControlsManager):
3246         (WebCore::HTMLMediaElement::didAttachRenderers):
3247         (WebCore::HTMLMediaElement::layoutSizeChanged):
3248         (WebCore::HTMLMediaElement::isVisibleInViewportChanged):
3249         (WebCore::HTMLMediaElement::resetPlaybackSessionState):
3250         (WebCore::HTMLMediaElement::isVisibleInViewport):
3251         (WebCore::HTMLMediaElement::updatePlaybackControlsManager):
3252         * html/HTMLMediaElement.h:
3253         * html/MediaElementSession.cpp:
3254         (WebCore::MediaElementSession::removeBehaviorRestriction):
3255         (WebCore::MediaElementSession::canShowControlsManager):
3256         (WebCore::MediaElementSession::isLargeEnoughForMainContent):
3257         (WebCore::MediaElementSession::mostRecentUserInteractionTime):
3258         (WebCore::MediaElementSession::wantsToObserveViewportVisibilityForMediaControls):
3259         (WebCore::MediaElementSession::wantsToObserveViewportVisibilityForAutoplay):
3260         (WebCore::MediaElementSession::resetPlaybackSessionState):
3261         (WebCore::MediaElementSession::canControlControlsManager): Deleted.
3262         * html/MediaElementSession.h:
3263         * platform/audio/PlatformMediaSession.h:
3264         (WebCore::PlatformMediaSession::resetPlaybackSessionState):
3265         (WebCore::PlatformMediaSession::canControlControlsManager): Deleted.
3266         * platform/audio/PlatformMediaSessionManager.cpp:
3267         (WebCore::PlatformMediaSessionManager::currentSessionsMatching):
3268         (WebCore::PlatformMediaSessionManager::currentSessionMatching): Deleted.
3269         * platform/audio/PlatformMediaSessionManager.h:
3270         * platform/cocoa/WebPlaybackSessionModelMediaElement.mm:
3271         (WebPlaybackSessionModelMediaElement::setMediaElement):
3272
3273 2016-09-03  Darin Adler  <darin@apple.com>
3274
3275         Streamline DOMImplementation, and move it to our new DOM exception system
3276         https://bugs.webkit.org/show_bug.cgi?id=161295
3277
3278         Reviewed by Ryosuke Niwa.
3279
3280         * WebCore.xcodeproj/project.pbxproj: Added new headers to project.
3281
3282         * bindings/js/JSDOMBinding.h:
3283         (WebCore::toJS): Added an overload for ExceptionOr<>; this handles the
3284         exception case here so it doesn't need to be handled in generated code
3285         for the binding. Implemented here so that ExceptionOr.h does not know
3286         about bindings. But since this is a template, it will only compile when
3287         instantiated and there is no need to include ExceptionOr.h and indirectly
3288         the Variant.h header in this header.
3289         (WebCore::toJSNewlyCreated): Ditto.
3290
3291         * bindings/scripts/CodeGeneratorJS.pm:
3292         (GenerateCallbackImplementation): Refer to JSC::Exception with explicit
3293         namespace to avoid ambiguity with WebCore::Exception.
3294
3295         * dom/DOMImplementation.cpp:
3296         (WebCore::DOMImplementation::createDocumentType): Changed to return
3297         ExceptionOr.
3298         (WebCore::createXMLDocument): Added. Helper used in createDocument.
3299         (WebCore::DOMImplementation::getInterface): Deleted. This was unused.
3300         (WebCore::DOMImplementation::createDocument): Changed to return
3301         ExceptionOr.
3302         (WebCore::DOMImplementation::createCSSStyleSheet): Removed the unused
3303         ExceptionCode out argument.
3304         (WebCore::isValidXMLMIMETypeChar): Deleted. Moved to MIMETypeRegistry.
3305         (WebCore::DOMImplementation::isXMLMIMEType): Ditto.
3306         (WebCore::DOMImplementation::isTextMIMEType): Ditto.
3307
3308         * dom/DOMImplementation.h: Changed functions as described above to
3309         return ExceptionOr values. Also removed unused getInterface function,
3310         and isXMLMIMEType and isTextMIMEType, which both moved to the
3311         MIMETypeRegistry class alongside all the other similar MIME type
3312         functions.
3313
3314         * dom/DOMImplementation.idl: Reorganized this to match the IDL files
3315         in the specifications a little better. Also removed [RaisesException]
3316         since that is only needed for the old legacy ExceptionCode& style.
3317
3318         * dom/Document.cpp:
3319         (WebCore::Document::setXMLVersion): Removed call to the
3320         DOMImplementation::hasFeature function since the values passed in
3321         unconditionally result in the return value "true". This is left over
3322         either from specification language, or from an ancient version of this
3323         code that worked in a "no XML supported" mode.
3324         (WebCore::Document::setXMLStandalone): Ditto.
3325
3326         * dom/Document.h: Removed the ExceptionCode& out argument from setXMLStandalone.
3327         * dom/Document.idl: Removed [SetterRaisesException] from xmlStandalone.
3328
3329         * dom/Exception.h: Added.
3330         * dom/ExceptionOr.h: Added.
3331
3332         * html/HTMLTemplateElement.cpp: Removed unneeded include of DOMImplementation.h.
3333
3334         * inspector/InspectorPageAgent.cpp:
3335         (WebCore::createXHRTextDecoder): Use isXMLMIMEType in its new location in
3336         MIMETypeRegistry.
3337         * inspector/NetworkResourcesData.cpp:
3338         (WebCore::createOtherResourceTextDecoder): Ditto.
3339
3340         * loader/FrameLoader.cpp: Removed unneeded include of DOMImplementation.h.
3341
3342         * loader/TextResourceDecoder.cpp:
3343         (WebCore::TextResourceDecoder::determineContentType): Use isXMLMIMEType in its
3344         new location in MIMETypeRegistry.
3345
3346         * platform/MIMETypeRegistry.cpp:
3347         (WebCore::MIMETypeRegistry::isTextMIMEType): Added. Moved here from
3348         DOMImplementation.
3349         (WebCore::isValidXMLMIMETypeChar): Ditto.
3350         (WebCore::MIMETypeRegistry::isXMLMIMEType): Ditto.
3351
3352         * platform/MIMETypeRegistry.h: Added isXMLMIMEType and isTextMIMEType.
3353         Made isUnsupportedTextMIMEType private.
3354
3355         * svg/SVGElement.cpp:
3356         (WebCore::SVGElement::isSupported): Deleted. This function was never called.
3357         * svg/SVGElement.h: Updated for the above change.
3358
3359         * xml/XMLHttpRequest.cpp:
3360         (WebCore::XMLHttpRequest::responseIsXML): Use isXMLMIMEType in its new
3361         location in MIMETypeRegistry.
3362
3363         * xml/parser/XMLDocumentParserLibxml2.cpp:
3364         (WebCore::XMLDocumentParser::startDocument): Updated since setXMLStandalone
3365         no longer can raise an exception.
3366
3367 2016-09-03  Ryosuke Niwa  <rniwa@webkit.org>
3368
3369         Unbreak customElements.whenDefined after r205383 with a crash fix
3370         https://bugs.webkit.org/show_bug.cgi?id=161562
3371
3372         Reviewed by Darin Adler.
3373
3374         The crash was caused by DeferredWrapper::contextDestroyed not calling ContextDestructionObserver::contextDestroyed.
3375
3376         This caused m_scriptExecutionContext to not being set to nullptr when the Document was destroyed before DOMWindow
3377         during a single GC sweeping, and resulted in a use-after-free in ContextDestructionObserver's destructor.
3378
3379         Fixed the crash and reverted r205383.
3380
3381         Tests: fast/custom-elements/CustomElementRegistry.html
3382
3383         * bindings/js/JSCustomElementRegistryCustom.cpp:
3384         (WebCore::whenDefinedPromise):
3385         * bindings/js/JSDOMPromise.cpp:
3386         (WebCore::DeferredWrapper::contextDestroyed): Fixed the crash.
3387         * dom/CustomElementRegistry.cpp:
3388         (WebCore::CustomElementRegistry::addElementDefinition):
3389         * dom/CustomElementRegistry.h:
3390         (WebCore::CustomElementRegistry::promiseMap):
3391
3392 2016-09-03  Chris Dumez  <cdumez@apple.com>