WebKit-https.git
4 years agoExpose SPI to disable synchronously blocking on painting after parenting a WKWebView
timothy_horton@apple.com [Thu, 13 Oct 2016 17:44:27 +0000 (17:44 +0000)]
Expose SPI to disable synchronously blocking on painting after parenting a WKWebView
https://bugs.webkit.org/show_bug.cgi?id=163364
<rdar://problem/28012494>

Reviewed by Geoff Garen.

Some clients may not want the default WKWebView behavior where we synchronously
block on the Web process after the first time a WKWebView is re-added to the window,
because they are e.g. parenting re-used WKWebViews while scrolling.

* UIProcess/API/APIPageConfiguration.h:
(API::PageConfiguration::shouldSynchronizeInitialPaintAfterMovingToWindow):
(API::PageConfiguration::setShouldSynchronizeInitialPaintAfterMovingToWindow):
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _initializeWithConfiguration:]):
* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration init]):
(-[WKWebViewConfiguration copyWithZone:]):
(-[WKWebViewConfiguration _shouldSynchronizeInitialPaintAfterMovingToWindow]):
(-[WKWebViewConfiguration _setShouldSynchronizeInitialPaintAfterMovingToWindow:]):
* UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::WebPageProxy):
Add and plumb a new WKWebView configuration parameter.

(WebKit::WebPageProxy::dispatchViewStateChange):
If the new configuration parameter is set, don't block the main thread when
a view is reparented.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207292 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoUnreviewed, rolling out r207286.
ryanhaddad@apple.com [Thu, 13 Oct 2016 17:25:24 +0000 (17:25 +0000)]
Unreviewed, rolling out r207286.

Caused LayoutTest http/tests/misc/acid3.html to fail.

Reverted changeset:

"Share inline stylesheets between shadow trees"
https://bugs.webkit.org/show_bug.cgi?id=163353
http://trac.webkit.org/changeset/207286

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207291 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years ago[css-grid] Use min-size instead of min-content contribution for intrinsic maximums...
svillar@igalia.com [Thu, 13 Oct 2016 17:02:53 +0000 (17:02 +0000)]
[css-grid] Use min-size instead of min-content contribution for intrinsic maximums resolution
https://bugs.webkit.org/show_bug.cgi?id=163283

Reviewed by Manuel Rego Casasnovas.

Source/WebCore:

This was recently modified in the specs
https://hg.csswg.org/drafts/diff/575fb847e29d/css-grid/Overview.bs. Specifically this is
addressing the last one. It used to be "min-content contribution" but now it says "min-size
contribution".

* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::currentItemSizeForTrackSizeComputationPhase):

LayoutTests:

Uncommented a bunch of failing test cases that are working fine now.

* fast/css-grid-layout/grid-intrinsic-maximums-expected.html:
* fast/css-grid-layout/grid-intrinsic-maximums.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207290 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years ago[Win64] Compile fix.
pvollan@apple.com [Thu, 13 Oct 2016 15:36:00 +0000 (15:36 +0000)]
[Win64] Compile fix.
https://bugs.webkit.org/show_bug.cgi?id=163384

Reviewed by Brent Fulgham.

Fix use of potentially uninitialized variable.

* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::compile):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207289 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years ago[css-grid] Fix intrinsic maximums resolution with fit-content and auto
svillar@igalia.com [Thu, 13 Oct 2016 15:25:14 +0000 (15:25 +0000)]
[css-grid] Fix intrinsic maximums resolution with fit-content and auto
https://bugs.webkit.org/show_bug.cgi?id=163282

Reviewed by Manuel Rego Casasnovas.

Source/WebCore:

The step 2.5 in section 12.5 https://drafts.csswg.org/css-grid/#algo-content of the specs,
details how to sizes tracks with intrinsic max track sizing functions.

Not so long ago there were only two max track sizing functions min-content and max-content
(auto was always resolved to max-content). However there were some recent changes that force
us to consider 2 new values: auto (which is not internally translated to max-content
although it still works the same) and specially the newly added fit-content.

Some of the new test cases are commented due to bug http://wkb.ug/163283.

Test: fast/css-grid-layout/grid-intrinsic-maximums.html

* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::shouldProcessTrackForTrackSizeComputationPhase):
* rendering/style/GridTrackSize.h:
(WebCore::GridTrackSize::cacheMinMaxTrackBreadthTypes):
(WebCore::GridTrackSize::hasIntrinsicMinTrackBreadth):
(WebCore::GridTrackSize::hasIntrinsicMaxTrackBreadth):
(WebCore::GridTrackSize::hasAutoOrMinContentMinTrackBreadthAndIntrinsicMaxTrackBreadth):

LayoutTests:

New test cases to verify that all tracks with intrinsic max track sizing functions are used
in step 2.5 of the track sizing algorith. Some of the new test cases are commented due to
http://wkb.ug/163283.

* fast/css-grid-layout/grid-intrinsic-maximums-expected.html: Added.
* fast/css-grid-layout/grid-intrinsic-maximums.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207288 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years ago[GTK] Video playback doesn't work properly with accelerated compositing disabled
commit-queue@webkit.org [Thu, 13 Oct 2016 15:00:09 +0000 (15:00 +0000)]
[GTK] Video playback doesn't work properly with accelerated compositing disabled
https://bugs.webkit.org/show_bug.cgi?id=163386

Patch by Miguel Gomez <magomez@igalia.com> on 2016-10-13
Reviewed by Carlos Garcia Campos.

Trigger a repaint of the player when a new frame arrives and accelerated compositing is disabled.

Covered by existent tests.

* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
(WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207287 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoShare inline stylesheets between shadow trees
antti@apple.com [Thu, 13 Oct 2016 11:59:19 +0000 (11:59 +0000)]
Share inline stylesheets between shadow trees
https://bugs.webkit.org/show_bug.cgi?id=163353

Reviewed by Ryosuke Niwa and Andreas Kling.

If shadow trees have identical inline stylesheets the data structures can be shared.
In future this will also allow sharing style resolvers.

* css/parser/CSSParserMode.h:
(WebCore::CSSParserContextHash::hash):
(WebCore::CSSParserContextHash::equal):
(WTF::HashTraits<WebCore::CSSParserContext>::constructDeletedValue):
(WTF::HashTraits<WebCore::CSSParserContext>::isDeletedValue):
(WTF::HashTraits<WebCore::CSSParserContext>::emptyValue):

    Make CSSParserContext hashable.

* dom/InlineStyleSheetOwner.cpp:
(WebCore::makeInlineStyleSheetCacheKey):
(WebCore::inlineStyleSheetCache):

    Implement a simple cache for sharing stylesheets with identical text and context.

(WebCore::InlineStyleSheetOwner::createSheet):
(WebCore::InlineStyleSheetOwner::clearCache):
* dom/InlineStyleSheetOwner.h:
* platform/MemoryPressureHandler.cpp:
(WebCore::MemoryPressureHandler::releaseNoncriticalMemory):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207286 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoRevert patch landed with wrong commit message.
antti@apple.com [Thu, 13 Oct 2016 11:58:07 +0000 (11:58 +0000)]
Revert patch landed with wrong commit message.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207285 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years ago[Win] Encode function pointers.
antti@apple.com [Thu, 13 Oct 2016 11:47:41 +0000 (11:47 +0000)]
[Win] Encode function pointers.
https://bugs.webkit.org/show_bug.cgi?id=163331

Patch by Per Arne Vollan <pvollan@apple.com> on 2016-10-12
Reviewed by Brent Fulgham.

We should encode stored function pointers.

* platform/win/SoftLinking.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207284 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years ago[GTK] Rebaseline tests affected by r207280 and report 3 new failures on accesibility...
clopez@igalia.com [Thu, 13 Oct 2016 11:41:22 +0000 (11:41 +0000)]
[GTK] Rebaseline tests affected by r207280 and report 3 new failures on accesibility tests.
https://bugs.webkit.org/show_bug.cgi?id=163383

Unreviewed gardening.

* platform/gtk/TestExpectations:
* platform/gtk/fast/dom/HTMLMeterElement/meter-appearances-capacity-expected.txt:
* platform/gtk/fast/dom/HTMLMeterElement/meter-appearances-rating-relevancy-expected.txt:
* platform/gtk/fast/dom/HTMLMeterElement/meter-boundary-values-expected.txt:
* platform/gtk/fast/dom/HTMLMeterElement/meter-element-expected.txt: Added.
* platform/gtk/fast/dom/HTMLMeterElement/meter-element-repaint-on-update-value-expected.txt: Added.
* platform/gtk/fast/dom/HTMLMeterElement/meter-optimums-expected.txt:
* platform/gtk/fast/dom/HTMLMeterElement/meter-styles-changing-pseudo-expected.txt:
* platform/gtk/fast/dom/HTMLMeterElement/meter-styles-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207283 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years ago[Win] Encode function pointers.
pvollan@apple.com [Thu, 13 Oct 2016 11:30:25 +0000 (11:30 +0000)]
[Win] Encode function pointers.
https://bugs.webkit.org/show_bug.cgi?id=163331

Reviewed by Brent Fulgham.

We should encode stored function pointers.

* platform/win/SoftLinking.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207282 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoRemove CachedResourceRequest::mutableResourceRequest
commit-queue@webkit.org [Thu, 13 Oct 2016 10:34:15 +0000 (10:34 +0000)]
Remove CachedResourceRequest::mutableResourceRequest
https://bugs.webkit.org/show_bug.cgi?id=163277

Patch by Youenn Fablet <youenn@apple.com> on 2016-10-13
Reviewed by Sam Weinig.

No change of behavior.

Removing CachedResourceRequest::mutableResourceRequest requires call sites to either update the ResourceRequest
before creating the CachedResourceRequest or to add methods at CachedResourceRequest.

Adding CachedResourceRequest::releaseResourceRequest for CachedResource constructor.

Most new CachedResourceRequest methods are used by CachedResourceLoader which is passed a CachedResourceRequest.
This allows code in CachedResourceLoader to be easier to read.

* css/CSSImageSetValue.cpp:
(WebCore::CSSImageSetValue::loadBestFitImage):
* css/CSSImageValue.cpp:
(WebCore::CSSImageValue::loadImage):
* dom/ScriptElement.cpp:
(WebCore::ScriptElement::requestScriptWithCache):
* loader/CrossOriginAccessControl.cpp:
(WebCore::createAccessControlPreflightRequest):
* loader/CrossOriginAccessControl.h:
* loader/CrossOriginPreflightChecker.cpp:
(WebCore::CrossOriginPreflightChecker::startPreflight):
(WebCore::CrossOriginPreflightChecker::doPreflight):
* loader/DocumentThreadableLoader.cpp:
(WebCore::DocumentThreadableLoader::loadRequest):
* loader/MediaResourceLoader.cpp:
(WebCore::MediaResourceLoader::requestResource):
* loader/cache/CachedResource.cpp:
(WebCore::CachedResource::CachedResource):
* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::requestImage):
(WebCore::CachedResourceLoader::requestUserCSSStyleSheet):
(WebCore::CachedResourceLoader::prepareFetch):
(WebCore::CachedResourceLoader::updateHTTPRequestHeaders):
(WebCore::CachedResourceLoader::requestResource):
(WebCore::acceptHeaderValueFromType): Deleted.
(WebCore::updateRequestAccordingCacheMode): Deleted.
* loader/cache/CachedResourceRequest.cpp:
(WebCore::CachedResourceRequest::setAsPotentiallyCrossOrigin):
(WebCore::CachedResourceRequest::updateForAccessControl):
(WebCore::CachedResourceRequest::upgradeInsecureRequestIfNeeded):
(WebCore::CachedResourceRequest::setDomainForCachePartition):
(WebCore::acceptHeaderValueFromType):
(WebCore::CachedResourceRequest::setAcceptHeaderIfNone):
(WebCore::CachedResourceRequest::updateAccordingCacheMode):
(WebCore::CachedResourceRequest::removeFragmentIdentifierIfNeeded):
(WebCore::CachedResourceRequest::applyBlockedStatus):
* loader/cache/CachedResourceRequest.h:
(WebCore::CachedResourceRequest::releaseResourceRequest):
(WebCore::CachedResourceRequest::setCachingPolicy):
(WebCore::CachedResourceRequest::mutableResourceRequest): Deleted.
(WebCore::CachedResourceRequest::setCacheModeToNoStore): Deleted.
* loader/icon/IconLoader.cpp:
(WebCore::IconLoader::startLoading):
* platform/graphics/avfoundation/cf/WebCoreAVCFResourceLoader.cpp:
(WebCore::WebCoreAVCFResourceLoader::startLoading):
* platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
(WebCore::WebCoreAVFResourceLoader::startLoading):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207281 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoSupport scoped style for user agent shadow trees
antti@apple.com [Thu, 13 Oct 2016 09:22:38 +0000 (09:22 +0000)]
Support scoped style for user agent shadow trees
https://bugs.webkit.org/show_bug.cgi?id=163212
<rdar://problem/28715318>

Reviewed by Ryosuke Niwa and Andreas Kling.

Source/WebCore:

This patch adds support for user agent shadow trees that have scoped style. This means
that the shadows can be styled via <style> elements contained in the tree instead of
using pseudo elements on the global UA sheet. Since the style is scoped it can use
normal id and class selectors.

Elements in the shadow tree can still be exposed for author styling if needed by giving
them pseudo ids

The patch also uses the new mechanism for the <meter> element.

The mechanism is not optimized yet, each shadow tree gets its own copy of style-related data
structures. This can be improved later.

* CMakeLists.txt:
* DerivedSources.make:
* WebCore.xcodeproj/project.pbxproj:
* css/ElementRuleCollector.cpp:
(WebCore::MatchRequest::MatchRequest):
(WebCore::ElementRuleCollector::addMatchedRule):
(WebCore::ElementRuleCollector::matchAuthorShadowPseudoElementRules):

    Make treeContextOrdinal an int so we can use negative ordinals. This is used to allow author pseudo
    elements from earlier tree context to win over the shadow tree (matching CSS scoping spec language).

* css/ElementRuleCollector.h:
* css/StyleResolver.cpp:
(WebCore::StyleResolver::MatchResult::addMatchedProperties):
(WebCore::StyleResolver::CascadedProperties::addImportantMatches):
* css/StyleResolver.h:
* css/html.css:
(meter::-webkit-meter-inner-element): Deleted.
(meter::-webkit-meter-bar): Deleted.
(meter::-webkit-meter-optimum-value): Deleted.
(meter::-webkit-meter-suboptimum-value): Deleted.
(meter::-webkit-meter-even-less-good-value): Deleted.

    Remove meter pseudo elements from the UA sheet.

* html/HTMLMeterElement.cpp:
(WebCore::HTMLMeterElement::childShouldCreateRenderer):

    Don't create shadow renderers when we have appearance (are using RenderMeter).

(WebCore::setValueClass):

    Move this logic here from MeterShadowElement.cpp.
    Set both class and pseudo id. The latter is needed to keep author styling working.

(WebCore::HTMLMeterElement::didElementStateChange):
(WebCore::HTMLMeterElement::renderMeter):

    RenderMeter is now only instantiated when appearance is enabled.

(WebCore::HTMLMeterElement::didAddUserAgentShadowRoot):

    Build the shadow tree out of <div>s instead of special shadow elements.

* html/HTMLMeterElement.h:
* html/shadow/MeterShadowElement.cpp: Removed.
* html/shadow/MeterShadowElement.h: Removed.

    Not needed anymore.

* html/shadow/meterElementShadow.css: Added.
(div#inner):
(div#bar):
(div#value):
(div#value.optimum):
(div#value.suboptimum):
(div#value.even-less-good):

    Stylesheet for meter element shadow tree using normal id and class selectors.

* style/StyleScope.cpp:
(WebCore::Style::Scope::shouldUseSharedUserAgentShadowTreeStyleResolver):

    Switch to per-scope style resolver for UA shadow trees if there is stylesheets in the tree.

(WebCore::Style::Scope::resolver):
(WebCore::Style::Scope::resolverIfExists):
* style/StyleScope.h:

LayoutTests:

* fast/dom/HTMLMeterElement/meter-clone-expected.txt:
* fast/dom/HTMLMeterElement/meter-clone.html:
* fast/dom/HTMLMeterElement/meter-element-markup-expected.txt:
* platform/mac/fast/dom/HTMLMeterElement/meter-element-repaint-on-update-value-expected.txt:
* platform/mac/fast/dom/HTMLMeterElement/meter-styles-changing-pseudo-expected.txt:
* platform/mac/fast/dom/HTMLMeterElement/meter-styles-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207280 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years ago[Web IDL] Drop support for legacy [ConstructorConditional=*]
cdumez@apple.com [Thu, 13 Oct 2016 05:23:53 +0000 (05:23 +0000)]
[Web IDL] Drop support for legacy [ConstructorConditional=*]
https://bugs.webkit.org/show_bug.cgi?id=163368

Reviewed by Ryosuke Niwa.

.:

Drop ENABLE_DOM4_EVENTS_CONSTRUCTOR compiler flag.

* Source/cmake/OptionsEfl.cmake:
* Source/cmake/OptionsMac.cmake:
* Source/cmake/OptionsWin.cmake:
* Source/cmake/WebKitFeatures.cmake:
* Source/cmake/tools/vsprops/FeatureDefines.props:
* Source/cmake/tools/vsprops/FeatureDefinesCairo.props:

Source/JavaScriptCore:

Drop ENABLE_DOM4_EVENTS_CONSTRUCTOR compiler flag.

* Configurations/FeatureDefines.xcconfig:

Source/WebCore:

Drop support for legacy [ConstructorConditional=*] webkit-specific IDL
extended attribute. This was introduced to disable DOM4 event
constructors at compile time. However, nowadays, those constructors are
enabled everywhere.

* Configurations/FeatureDefines.xcconfig:
* bindings/scripts/CodeGenerator.pm:
(GenerateConstructorConditionalString): Deleted.
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateConstructorHelperMethods):
* bindings/scripts/IDLAttributes.txt:
* bindings/scripts/test/JS/JSTestInterface.cpp:
(WebCore::JSTestInterfaceConstructor::getConstructData): Deleted.
* bindings/scripts/test/TestInterface.idl:
* dom/UIEvent.idl:

Source/WebKit/mac:

Drop ENABLE_DOM4_EVENTS_CONSTRUCTOR compiler flag.

* Configurations/FeatureDefines.xcconfig:

Source/WebKit2:

Drop ENABLE_DOM4_EVENTS_CONSTRUCTOR compiler flag.

* Configurations/FeatureDefines.xcconfig:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207279 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoThe bindings generator should provide a better error message when it does not find...
cdumez@apple.com [Thu, 13 Oct 2016 05:21:14 +0000 (05:21 +0000)]
The bindings generator should provide a better error message when it does not find a dictionary definition
https://bugs.webkit.org/show_bug.cgi?id=163377

Reviewed by Ryosuke Niwa.

The bindings generator should provide a better error message when it does
not find a dictionary definition.

* bindings/scripts/CodeGenerator.pm:
(GetDictionaryByName):
* bindings/scripts/CodeGeneratorJS.pm:
(assert):
(GenerateDictionaryImplementationContent):
(GenerateHeader):
(GenerateDictionaryHeader):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207278 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoUpdate WebKitMediaKeyMessageEvent / WebKitMediaKeyNeededEvent to stop using legacy...
cdumez@apple.com [Thu, 13 Oct 2016 05:18:59 +0000 (05:18 +0000)]
Update WebKitMediaKeyMessageEvent / WebKitMediaKeyNeededEvent to stop using legacy [ConstructorTemplate=Event]
https://bugs.webkit.org/show_bug.cgi?id=163369

Reviewed by Ryosuke Niwa.

Source/WebCore:

Update WebKitMediaKeyMessageEvent / WebKitMediaKeyNeededEvent to stop
using legacy [ConstructorTemplate=Event] and use regular constructors
instead.

This also adds support for having dictionary members that are typed
arrays because this was needed.

Test: fast/events/webkit-media-key-events-constructor.html

* Modules/encryptedmedia/legacy/WebKitMediaKeyMessageEvent.cpp:
(WebCore::WebKitMediaKeyMessageEvent::WebKitMediaKeyMessageEvent):
* Modules/encryptedmedia/legacy/WebKitMediaKeyMessageEvent.h:
(WebCore::WebKitMediaKeyMessageEvent::create):
(WebCore::WebKitMediaKeyMessageEvent::createForBindings): Deleted.
* Modules/encryptedmedia/legacy/WebKitMediaKeyMessageEvent.idl:
* Modules/encryptedmedia/legacy/WebKitMediaKeyNeededEvent.cpp:
(WebCore::WebKitMediaKeyNeededEvent::WebKitMediaKeyNeededEvent):
* Modules/encryptedmedia/legacy/WebKitMediaKeyNeededEvent.h:
(WebCore::WebKitMediaKeyNeededEvent::create):
(WebCore::WebKitMediaKeyNeededEvent::createForBindings): Deleted.
* Modules/encryptedmedia/legacy/WebKitMediaKeyNeededEvent.idl:
* bindings/js/JSDOMConvert.h:
(WebCore::Converter<IDLInterface<JSC::GenericTypedArrayView<Adaptor>>>::convert):
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateDefaultValue):
* dom/InputEvent.cpp:
(WebCore::InputEvent::InputEvent):
* dom/InputEvent.h:
* dom/InputEvent.idl:

LayoutTests:

Add layout test coverage.

* fast/events/webkit-media-key-events-constructor-expected.txt: Added.
* fast/events/webkit-media-key-events-constructor.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207277 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoUpdate HTMLSelectElement::recalcListItems() to ignore nested optgroup elements
cdumez@apple.com [Thu, 13 Oct 2016 04:13:49 +0000 (04:13 +0000)]
Update HTMLSelectElement::recalcListItems() to ignore nested optgroup elements
https://bugs.webkit.org/show_bug.cgi?id=163358

Reviewed by Kent Tamura.

Source/WebCore:

Update HTMLSelectElement::recalcListItems() to ignore nested optgroup elements.
As per the specification, we only want optgroup elements that are direct
children of the select element. This also matches the behavior of Chrome.

Test: fast/dom/HTMLSelectElement/nested-optgroup.html

* html/HTMLSelectElement.cpp:
(WebCore::HTMLSelectElement::recalcListItems):

LayoutTests:

Add layout test coverage.

* fast/dom/HTMLSelectElement/nested-optgroup-expected.txt: Added.
* fast/dom/HTMLSelectElement/nested-optgroup.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207276 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoRenderRubyRun should not mark child renderers dirty at the end of layout.
zalan@apple.com [Thu, 13 Oct 2016 03:48:54 +0000 (03:48 +0000)]
RenderRubyRun should not mark child renderers dirty at the end of layout.
https://bugs.webkit.org/show_bug.cgi?id=163359
<rdar://problem/28711840>

Reviewed by David Hyatt.

Source/WebCore:

The current layout logic does not support marking renderers dirty for subsequent layouts.
Layout needs to exit with a clean tree.
Should relayoutChild be insufficient, we could also mark the base/text dirty for the justified content.

Test: fast/ruby/rubyrun-has-bad-child.html

* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::updateRubyForJustifiedText):
* rendering/RenderRubyRun.cpp:
(WebCore::RenderRubyRun::layout):
(WebCore::RenderRubyRun::layoutBlock):
* rendering/RenderRubyRun.h:

LayoutTests:

* fast/ruby/rubyrun-has-bad-child-expected.txt: Added.
* fast/ruby/rubyrun-has-bad-child.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207275 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoSource/WebCore:
simon.fraser@apple.com [Thu, 13 Oct 2016 03:16:15 +0000 (03:16 +0000)]
Source/WebCore:
Crash when using megaplan.ru
https://bugs.webkit.org/show_bug.cgi?id=163276
rdar://problem/28446672

Reviewed by Sam Weinig.

Make sure we allocate enough space in the vector of CGPoints that we use for path building.

Test: css3/masking/large-clip-path.html

* platform/graphics/cg/PathCG.cpp:
(WebCore::Path::polygonPathFromPoints):

LayoutTests:
polygonPathFromPoints calls uncheckedAppend, but assertion size() < capacity() fails
https://bugs.webkit.org/show_bug.cgi?id=163276

Reviewed by Sam Weinig.

* css3/masking/large-clip-path-expected.txt: Added.
* css3/masking/large-clip-path.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207274 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoFix out-of-bounds reading in URLParser when parsing improperly percent-encoded values
achristensen@apple.com [Thu, 13 Oct 2016 02:38:13 +0000 (02:38 +0000)]
Fix out-of-bounds reading in URLParser when parsing improperly percent-encoded values
https://bugs.webkit.org/show_bug.cgi?id=163376

Reviewed by Saam Barati.

Source/WebCore:

Covered by new API tests, which used to crash under asan.

* platform/URLParser.cpp:
(WebCore::percentDecode):
If you subtract 2 from size_t's smaller than 2, you're gonna have a bad time.

Tools:

* TestWebKitAPI/Tests/WebCore/URLParser.cpp:
(TestWebKitAPI::TEST_F):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207273 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoMail needs nonspecial URLs to keep case in host and not have slash after host
achristensen@apple.com [Thu, 13 Oct 2016 02:14:30 +0000 (02:14 +0000)]
Mail needs nonspecial URLs to keep case in host and not have slash after host
https://bugs.webkit.org/show_bug.cgi?id=163373

Reviewed by Saam Barati.

Mail uses urls like scheme://HoSt which were not changed when canonicalized
before enabling the URLParser but now are canonicalized to scheme://host/
I manually verified this fixes the issue.
This should be reverted once Mail will accept modern canonicalized URLs.

* platform/URLParser.cpp:
(WebCore::URLParser::parse):
(WebCore::URLParser::parseHostAndPort):
* platform/URLParser.h:
If the application is mail and the scheme is nonspecial, don't make the host lower case and don't add a slash after the host.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207268 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoWeb Inspector: step-into `console.log(o)` should not step through inspector javascript
commit-queue@webkit.org [Thu, 13 Oct 2016 02:05:44 +0000 (02:05 +0000)]
Web Inspector: step-into `console.log(o)` should not step through inspector javascript
https://bugs.webkit.org/show_bug.cgi?id=161656
<rdar://problem/28181123>

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2016-10-12
Reviewed by Timothy Hatcher.

Source/JavaScriptCore:

* debugger/Debugger.h:
* debugger/Debugger.cpp:
(JSC::Debugger::pauseIfNeeded):
If the Script is blacklisted skip checking if we need to pause.

(JSC::Debugger::isBlacklisted):
(JSC::Debugger::addToBlacklist):
(JSC::Debugger::clearBlacklist):
Add the ability to add a Script to a blacklist. Currently the blacklist
only prevents pausing in the Script.

* inspector/agents/InspectorDebuggerAgent.cpp:
(Inspector::isWebKitInjectedScript):
(Inspector::InspectorDebuggerAgent::didParseSource):
Always add Internal InjectedScripts to the Debugger's blacklist.

(Inspector::InspectorDebuggerAgent::clearDebuggerBreakpointState):
Clear blacklists when clearing debugger state.

LayoutTests:

* inspector/debugger/stepping/stepping-internal-scripts-expected.txt: Added.
* inspector/debugger/stepping/stepping-internal-scripts.html: Added.
Ensure step-into a console.log statement steps past it, and doesn't pause
inside the non-visible internal script.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207267 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoB3 needs a special WasmBoundsCheck Opcode
keith_miller@apple.com [Thu, 13 Oct 2016 01:42:53 +0000 (01:42 +0000)]
B3 needs a special WasmBoundsCheck Opcode
https://bugs.webkit.org/show_bug.cgi?id=163246

Reviewed by Filip Pizlo.

Source/JavaScriptCore:

This patch adds a new Opcode, WasmBoundsCheck, as well as a B3::Value subclass for it,
WasmBoundsCheckValue. WasmBoundsCheckValue takes three pieces of information. The first is
the Int32 pointer value used to be used by the Load.  Next is the pinned register. The
pinned register must be pinned by calling proc.setPinned() prior to compiling the
Procedure. Lastly, the WasmBoundsCheckValue takes an offset. The WasmBoundsCheckValue is
will then emit code that side-exits if the Int64 sum of the offset and pointer is greater
than or equal to the value in the pinnedRegister. Instead of taking a generator for each
value like Check/Patchpoint, WasmBoundsCheck gets its generator directly off Air::Code. In
Air this patch adds a new Custom opcode, WasmBoundsCheck.

In the future we should add WasmBoundsCheck to CSE so it can eliminate redundant bounds
checks. At the first cut, we can remove any WasmBoundsCheck dominated by another
WasmBoundsCheck with the same pointer and pinnedGPR, and a larger offset.

* CMakeLists.txt:
* JavaScriptCore.xcodeproj/project.pbxproj:
* b3/B3LowerToAir.cpp:
(JSC::B3::Air::LowerToAir::imm):
(JSC::B3::Air::LowerToAir::lower):
* b3/B3Opcode.cpp:
(WTF::printInternal):
* b3/B3Opcode.h:
* b3/B3Procedure.cpp:
(JSC::B3::Procedure::setWasmBoundsCheckGenerator):
* b3/B3Procedure.h:
(JSC::B3::Procedure::setWasmBoundsCheckGenerator):
* b3/B3Validate.cpp:
* b3/B3Value.cpp:
(JSC::B3::Value::effects):
(JSC::B3::Value::typeFor):
* b3/B3WasmBoundsCheckValue.cpp: Added.
(JSC::B3::WasmBoundsCheckValue::~WasmBoundsCheckValue):
(JSC::B3::WasmBoundsCheckValue::WasmBoundsCheckValue):
(JSC::B3::WasmBoundsCheckValue::dumpMeta):
* b3/B3WasmBoundsCheckValue.h: Added.
(JSC::B3::WasmBoundsCheckValue::accepts):
(JSC::B3::WasmBoundsCheckValue::pinnedGPR):
(JSC::B3::WasmBoundsCheckValue::offset):
* b3/air/AirCode.h:
(JSC::B3::Air::Code::setWasmBoundsCheckGenerator):
(JSC::B3::Air::Code::wasmBoundsCheckGenerator):
* b3/air/AirCustom.cpp:
(JSC::B3::Air::WasmBoundsCheckCustom::isValidForm):
* b3/air/AirCustom.h:
(JSC::B3::Air::WasmBoundsCheckCustom::forEachArg):
(JSC::B3::Air::WasmBoundsCheckCustom::isValidFormStatic):
(JSC::B3::Air::WasmBoundsCheckCustom::admitsStack):
(JSC::B3::Air::WasmBoundsCheckCustom::isTerminal):
(JSC::B3::Air::WasmBoundsCheckCustom::hasNonArgNonControlEffects):
(JSC::B3::Air::WasmBoundsCheckCustom::generate):
* b3/air/AirOpcode.opcodes:
* b3/testb3.cpp:
(JSC::B3::testWasmBoundsCheck):
(JSC::B3::run):

Websites/webkit.org:

Update the docs for the new WasmBoundsCheck opcode.

* docs/b3/intermediate-representation.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207266 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoAdd preliminary support for extended colors to WebCore::Color
dino@apple.com [Thu, 13 Oct 2016 01:14:15 +0000 (01:14 +0000)]
Add preliminary support for extended colors to WebCore::Color
https://bugs.webkit.org/show_bug.cgi?id=162878
<rdar://problem/28596413>

Reviewed by Darin Adler.

Source/WebCore:

Add an ExtendedColor class that will hold the data necessary
for wider-than-sRGB (and more precise) colors. In order to
avoid increasing the size of Color, implement a tagged
pointer that is either referencing an ExtendedColor, or
is a 64-bit number with the top 32-bits being the RGBA, and
the bottom 2 bits indicating an invalid RGBA or a valid RGBA,
plus the tag.

Add copy constructors and operator= so that the new Color objects
are correctly copied.

There isn't yet a way to create an ExtendedColor. That's coming
in a followup patch (and will require changes to the CSS parser).

Covered by existing tests, and new API tests in Color.

* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj: Add new files.

* platform/graphics/Color.cpp: Update everything to use m_rgbaAndFlags
instead of m_color + m_valid.
(WebCore::Color::Color):
(WebCore::Color::~Color):
(WebCore::Color::operator=):
(WebCore::Color::nameForRenderTreeAsText):
(WebCore::Color::setNamedColor):
(WebCore::Color::light):
(WebCore::Color::dark):
(WebCore::Color::setValid):
(WebCore::Color::setExtended):
(WebCore::Color::isExtended):
(WebCore::Color::asExtended):
* platform/graphics/Color.h: Implement the tagged union.
(WebCore::Color::Color):
(WebCore::Color::isValid):
(WebCore::Color::red):
(WebCore::Color::green):
(WebCore::Color::blue):
(WebCore::Color::alpha):
(WebCore::Color::rgb):
(WebCore::Color::setRGB):
(WebCore::operator==):

* platform/graphics/ExtendedColor.cpp: New file. Holds floating point
red, green, blue and alpha, plus a color space.
(WebCore::ExtendedColor::create):
(WebCore::ExtendedColor::~ExtendedColor):
(WebCore::ExtendedColor::ref):
(WebCore::ExtendedColor::deref):
* platform/graphics/ExtendedColor.h:
(WebCore::ExtendedColor::red):
(WebCore::ExtendedColor::green):
(WebCore::ExtendedColor::blue):
(WebCore::ExtendedColor::alpha):
(WebCore::ExtendedColor::colorSpace):
(WebCore::ExtendedColor::ExtendedColor):

* platform/graphics/cg/ColorCG.cpp: Update the constructors for
the platform specific color classes.
(WebCore::Color::Color):
* platform/graphics/gtk/ColorGtk.cpp:
(WebCore::Color::Color):
* platform/graphics/win/ColorDirect2D.cpp:
(WebCore::Color::Color):

* rendering/RenderEmbeddedObject.cpp: Use NeverDestroyed.
(WebCore::replacementTextRoundedRectPressedColor):
(WebCore::replacementTextRoundedRectColor):
(WebCore::replacementTextColor):
(WebCore::unavailablePluginBorderColor):

* rendering/RenderFrameSet.cpp: Ditto.
(WebCore::borderStartEdgeColor):
(WebCore::borderEndEdgeColor):
(WebCore::borderFillColor):

* rendering/RenderTableCell.cpp: This grows in size slightly
because it can no longer pack bits.

Tools:

A new API test for Colors.

* TestWebKitAPI/Tests/WebCore/Color.cpp:
(TestWebKitAPI::TEST):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207265 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoThe blackening of CellState is a bad way of tracking if the object is being marked...
fpizlo@apple.com [Wed, 12 Oct 2016 23:56:34 +0000 (23:56 +0000)]
The blackening of CellState is a bad way of tracking if the object is being marked for the first time
https://bugs.webkit.org/show_bug.cgi?id=163343

Reviewed by Mark Lam.

When I first added the concept of NewGrey/OldGrey, I had the SlotVisitor store the old cell
state in itself, so that it could use it to decide what to do for reportExtraMemoryVisited().

Then I changed it in a recent commit, because I wanted the freedom to have SlotVisitor visit
multiple objects in tandem. But I never ended up using this capability. Still, I liked the
new way better: instead of the SlotVisitor rembemering the state-before-blackening, we would
make the object's state reflect whether it was black for the first time or not. That seemed
convenient.

Unfortunately it's wrong. After we blacken the object, a concurrent barrier could instantly
grey it. Then we would forget that we are visiting this object for the first time.
Subsequent visits will think that they are not the first. So, we will fail to do the right
thing in reportExtraMemoryVisited().

So, this reverts that change. This is a little more than just a revert, though. I've changed
the terminology a bit. For example, I got tired of reading Black and having to remind myself
that it really means that the object has begun being visited, instead of the more strict
meaning that implies that it has already been visited. We want to say that it's Black or
currently being scanned. I'm going to adopt Siebert's term for this: Anthracite [1]. So, our
black CellState is now called AnthraciteOrBlack.

[1] https://pdfs.semanticscholar.org/7ae4/633265aead1f8835cf7966e179d02c2c8a4b.pdf

* heap/CellState.h:
(JSC::isBlack): Deleted.
(JSC::blacken): Deleted.
* heap/Heap.cpp:
(JSC::Heap::addToRememberedSet):
(JSC::Heap::writeBarrierSlowPath):
* heap/Heap.h:
* heap/HeapInlines.h:
(JSC::Heap::reportExtraMemoryVisited):
(JSC::Heap::reportExternalMemoryVisited):
* heap/SlotVisitor.cpp:
(JSC::SlotVisitor::appendToMarkStack):
(JSC::SlotVisitor::visitChildren):
* heap/SlotVisitor.h:
* heap/SlotVisitorInlines.h:
(JSC::SlotVisitor::reportExtraMemoryVisited):
(JSC::SlotVisitor::reportExternalMemoryVisited):
* llint/LLIntData.cpp:
(JSC::LLInt::Data::performAssertions):
* llint/LowLevelInterpreter.asm:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207263 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoUnreviewed, add expected file for new test after r207239
utatane.tea@gmail.com [Wed, 12 Oct 2016 23:12:52 +0000 (23:12 +0000)]
Unreviewed, add expected file for new test after r207239
https://bugs.webkit.org/show_bug.cgi?id=163245

Add an "expected.txt" file.

* js/dom/domjit-accessor-node-type-expected.txt: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207261 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoAdobe Contribute CS 6.5 Trial crashes on launch
bdakin@apple.com [Wed, 12 Oct 2016 22:37:42 +0000 (22:37 +0000)]
Adobe Contribute CS 6.5 Trial crashes on launch
https://bugs.webkit.org/show_bug.cgi?id=163365
-and corresponding-
<rdar://problem/28732731>

Reviewed by Tim Horton.

* Carbon/CarbonWindowFrame.m:
(-[CarbonWindowFrame contentFill]):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207246 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years ago[Modern Media Controls] Sliders: scrubber and volume
commit-queue@webkit.org [Wed, 12 Oct 2016 21:50:03 +0000 (21:50 +0000)]
[Modern Media Controls] Sliders: scrubber and volume
https://bugs.webkit.org/show_bug.cgi?id=163328
<rdar://problem/28733838>

Patch by Antoine Quint <graouts@apple.com> on 2016-10-12
Reviewed by Dean Jackson.

Source/WebCore:

We add a new Slider class that provides a custom slider backed by an
invisible <input type="range"> element and a fill underlay to provide
a custom color between the left edge of the slider and the slider thumb.
As the slider's value changes, a UI delegate receives messages to track
such changes.

Tests: media/modern-media-controls/scrubber/scrubber.html
       media/modern-media-controls/slider/slider-constructor.html
       media/modern-media-controls/slider/slider-fill.html
       media/modern-media-controls/slider/slider-styles.html
       media/modern-media-controls/volume-slider/volume-slider-value.html
       media/modern-media-controls/volume-slider/volume-slider.html

* Modules/modern-media-controls/controls/scrubber.css: Added.
(.scrubber.slider > input::-webkit-slider-thumb):
* Modules/modern-media-controls/controls/scrubber.js: Added.
(Scrubber):
* Modules/modern-media-controls/controls/slider.css: Added.
(.slider):
(.slider > input,):
(.slider > .fill):
(.slider > input):
(.slider > input::-webkit-slider-thumb):
* Modules/modern-media-controls/controls/slider.js: Added.
(Slider.prototype.get value):
(Slider.prototype.set value):
(Slider.prototype.get width):
(Slider.prototype.set width):
(Slider.prototype.handleEvent):
(Slider.prototype.commitProperty):
(Slider.prototype._handleInputEvent):
(Slider.prototype._handleChangeEvent):
(Slider.prototype._updateFill):
* Modules/modern-media-controls/controls/volume-slider.css: Added.
(.volume.slider > input::-webkit-slider-thumb):
* Modules/modern-media-controls/controls/volume-slider.js: Added.
(VolumeSlider):

LayoutTests:

Testing the properties of the new Slider class and its subclasses.

* media/modern-media-controls/resources/media-controls-utils.js: Added.
(rgba):
(shouldBeEqualToRGBAColor):
* media/modern-media-controls/scrubber/scrubber-expected.txt: Added.
* media/modern-media-controls/scrubber/scrubber.html: Added.
* media/modern-media-controls/slider/slider-constructor-expected.txt: Added.
* media/modern-media-controls/slider/slider-constructor.html: Added.
* media/modern-media-controls/slider/slider-fill-expected.txt: Added.
* media/modern-media-controls/slider/slider-fill.html: Added.
* media/modern-media-controls/slider/slider-styles-expected.txt: Added.
* media/modern-media-controls/slider/slider-styles.html: Added.
* media/modern-media-controls/volume-slider/volume-slider-expected.txt: Added.
* media/modern-media-controls/volume-slider/volume-slider-value-expected.txt: Added.
* media/modern-media-controls/volume-slider/volume-slider-value.html: Added.
* media/modern-media-controls/volume-slider/volume-slider.html: Added.
* platform/ios-simulator/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207245 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoAdd experimental support for the "formatForeColor" inputType
wenson_hsieh@apple.com [Wed, 12 Oct 2016 21:49:10 +0000 (21:49 +0000)]
Add experimental support for the "formatForeColor" inputType
https://bugs.webkit.org/show_bug.cgi?id=163348
<rdar://problem/28739334>

Reviewed by Ryosuke Niwa.

Source/WebCore:

Adds support for the "formatForeColor" attribute. This patch introduces a simple hook in Editor.cpp to extract
data for an input event from an EditingStyle when performing an editing action.

Test: fast/events/input-events-forecolor-data.html

* editing/EditCommand.cpp:
(WebCore::inputTypeNameForEditingAction):
* editing/Editor.cpp:
(WebCore::inputEventDataForEditingStyleAndAction):

Added a new static helper to compute the data attribute of an InputEvent when handling a style change.

(WebCore::Editor::computeAndSetTypingStyle):

LayoutTests:

Adds a new test verifying that input events with inputType "formatForeColor" are dispatched when changing
foreground color, and that their data attributes are as expected.

* fast/events/input-events-forecolor-data-expected.txt: Added.
* fast/events/input-events-forecolor-data.html: Added.
* platform/ios-simulator/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207244 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years ago[Web IDL] Generated bindings include the wrong header when ImplementedAs is used...
cdumez@apple.com [Wed, 12 Oct 2016 21:09:46 +0000 (21:09 +0000)]
[Web IDL] Generated bindings include the wrong header when ImplementedAs is used on a dictionary
https://bugs.webkit.org/show_bug.cgi?id=163352

Reviewed by Ryosuke Niwa.

Generated bindings include the wrong header when ImplementedAs is used
on a dictionary.

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateDictionaryHeader):
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::jsTestObjPrototypeFunctionOperationWithExternalDictionaryParameterCaller):
* bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp:
(WebCore::convertDictionary<DictionaryImplName>):
(WebCore::convertDictionary<TestStandaloneDictionary>): Deleted.
* bindings/scripts/test/JS/JSTestStandaloneDictionary.h:
* bindings/scripts/test/TestStandaloneDictionary.idl:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207243 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoRename variables in arrayProtoFuncSplice() to match names in the spec.
mark.lam@apple.com [Wed, 12 Oct 2016 21:01:00 +0000 (21:01 +0000)]
Rename variables in arrayProtoFuncSplice() to match names in the spec.
https://bugs.webkit.org/show_bug.cgi?id=163354

Reviewed by Saam Barati.

This will make it easier to see whether the code matches the spec or not.
Ref: https://tc39.github.io/ecma262/#sec-array.prototype.splice

* runtime/ArrayPrototype.cpp:
(JSC::arrayProtoFuncSplice):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207241 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years ago[DOMJIT][JSC] Explore the way to embed nodeType into JSC::JSType in WebCore
utatane.tea@gmail.com [Wed, 12 Oct 2016 20:47:51 +0000 (20:47 +0000)]
[DOMJIT][JSC] Explore the way to embed nodeType into JSC::JSType in WebCore
https://bugs.webkit.org/show_bug.cgi?id=163245

Reviewed by Filip Pizlo.

Source/JavaScriptCore:

We reserve the highest bit of JSC::JSType for extensions outside JSC.
JSC does not use JSType bits so many: only 52 types are defined.

And we extend CallDOM patchpoint to claim that it does not require a global object.
This global object is used to generate a DOM wrapper. However, nodeType does not require
it since it just returns integer. In the future, we will extend CallDOM to claim
its result type. And we can decide this `requireGlobalObject` condition automatically
according to the result type.

* JavaScriptCore.xcodeproj/project.pbxproj:
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::handleDOMJITGetter):
* dfg/DFGFixupPhase.cpp:
(JSC::DFG::FixupPhase::fixupNode):
* dfg/DFGGraph.h:
* dfg/DFGNode.h:
(JSC::DFG::Node::hasCheckDOMPatchpoint):
(JSC::DFG::Node::checkDOMPatchpoint):
(JSC::DFG::Node::hasCallDOMPatchpoint):
(JSC::DFG::Node::callDOMPatchpoint):
(JSC::DFG::Node::hasDOMJIT): Deleted.
(JSC::DFG::Node::domJIT): Deleted.
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compileCallDOM):
(JSC::DFG::SpeculativeJIT::compileCheckDOM):
* domjit/DOMJITCallDOMPatchpoint.h: Copied from Source/JavaScriptCore/domjit/DOMJITGetterSetter.h.
(JSC::DOMJIT::CallDOMPatchpoint::create):
* domjit/DOMJITGetterSetter.h:
* domjit/DOMJITPatchpoint.h:
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileCheckDOM):
(JSC::FTL::DFG::LowerDFGToB3::compileCallDOM):
* jsc.cpp:
* llint/LLIntData.cpp:
(JSC::LLInt::Data::performAssertions):
* llint/LowLevelInterpreter.asm:
* runtime/JSType.h:

Source/WebCore:

Node.nodeType accessor is so frequently called. For example, jQuery's $ function uses
this to distinguish DOM objects from the other JS objects. So every time you call `$(dom)`,
nodeType accessor is called. In addition to that, jQuery's prev, next, parent etc. also uses
this `nodeType`. And Ember.js also uses it. And ... So this function is super critical for DOM
performance.

The challenge is that there is no room for putting NodeType into C++ Node class. Node class
has a 32bit field to store some data. However, these bits are already exhausted. Extending
Node class is unacceptable since it significantly enlarges memory consumption of WebKit (Node
is everywhere!). Unfortunately, current Node::nodeType is implemented as a virtual function
even though this function is frequently called from JS world.

Interestingly, we already store some duplicate data in JSObject, JSC::JSType. WebCore already
extends it with JSElementType, JSNodeType, and JSDocumentWrapperType. And these types are
corresponding to specific NodeTypes. For example, JSElementType should have ELEMENT_NODE type.

This patch further extends this JSC::JSType in WebCore side safely. We embed NodeType bits into
JSC::JSType. This design offers significantly faster nodeType implementation. Furthermore, it
makes DOMJIT easy for nodeType accessor.

Even without the IC change[1], Dromaeo dom-query shows 8 - 10% improvement,
1452.96 runs/s vs 1578.56 runs/s. We can expect that this improvement will be applied to the
other benchmarks / real applications when the IC change is landed.

[1]: https://bugs.webkit.org/show_bug.cgi?id=163226

* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSDOMWrapper.h:
* bindings/js/JSNodeCustom.h:
(WebCore::JSNode::nodeType):
* bindings/scripts/CodeGeneratorJS.pm:
(GetJSTypeForNode):
(GenerateHeader):
* dom/Node.idl:
* dom/NodeConstants.h: Copied from Source/JavaScriptCore/domjit/DOMJITGetterSetter.h.
* domjit/JSNodeDOMJIT.cpp:
(WebCore::createCallDOMForOffsetAccess):
(WebCore::NodeFirstChildDOMJIT::callDOM):
(WebCore::NodeLastChildDOMJIT::callDOM):
(WebCore::NodeNextSiblingDOMJIT::callDOM):
(WebCore::NodePreviousSiblingDOMJIT::callDOM):
(WebCore::NodeParentNodeDOMJIT::callDOM):
(WebCore::NodeNodeTypeDOMJIT::checkDOM):
(WebCore::NodeNodeTypeDOMJIT::callDOM):

LayoutTests:

* js/dom/domjit-accessor-node-type.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207239 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoUpdate more events to stop using legacy [ConstructorTemplate=Event]
cdumez@apple.com [Wed, 12 Oct 2016 20:41:49 +0000 (20:41 +0000)]
Update more events to stop using legacy [ConstructorTemplate=Event]
https://bugs.webkit.org/show_bug.cgi?id=163339

Reviewed by Ryosuke Niwa.

Source/WebCore:

Update more events to stop using legacy [ConstructorTemplate=Event]
and use regular constructors instead.

No new tests, updated existing tests.

* bindings/scripts/test/JS/JSTestEventConstructor.cpp:
(WebCore::convertDictionary<TestEventConstructor::Init>):
(WebCore::JSTestEventConstructorConstructor::construct):
(WebCore::JSTestEventConstructorConstructor::prototypeForStructure):
(WebCore::JSTestEventConstructor::JSTestEventConstructor):
(WebCore::JSTestEventConstructor::createPrototype):
(WebCore::JSTestEventConstructorPrototype::create): Deleted.
(WebCore::JSTestEventConstructorPrototype::createStructure): Deleted.
(WebCore::JSTestEventConstructorPrototype::JSTestEventConstructorPrototype): Deleted.
(WebCore::setJSTestEventConstructorConstructor): Deleted.
(WebCore::JSTestEventConstructor::getConstructor): Deleted.
* bindings/scripts/test/JS/JSTestEventConstructor.h:
(WebCore::JSTestEventConstructor::wrapped):
(WebCore::JSTestEventConstructor::create): Deleted.
(WebCore::toJS): Deleted.
(WebCore::toJSNewlyCreated): Deleted.
* bindings/scripts/test/TestEventConstructor.idl:
* css/CSSFontFaceLoadEvent.cpp:
(WebCore::CSSFontFaceLoadEvent::CSSFontFaceLoadEvent):
* css/CSSFontFaceLoadEvent.h:
* css/CSSFontFaceLoadEvent.idl:
* html/canvas/WebGLContextEvent.cpp:
(WebCore::WebGLContextEvent::WebGLContextEvent):
* html/canvas/WebGLContextEvent.h:
* html/canvas/WebGLContextEvent.idl:
* storage/StorageEvent.cpp:
(WebCore::StorageEvent::create):
(WebCore::StorageEvent::StorageEvent):
* storage/StorageEvent.h:
* storage/StorageEvent.idl:

LayoutTests:

Update existing tests to reflect minor behavior changes.

* fast/events/constructors/storage-event-constructor-expected.txt:
* fast/events/constructors/storage-event-constructor.html:
* fast/events/constructors/webgl-context-event-constructor-expected.txt:
* fast/events/constructors/webgl-context-event-constructor.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207238 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoUnreviewed, rolling out r207225.
ryanhaddad@apple.com [Wed, 12 Oct 2016 20:38:37 +0000 (20:38 +0000)]
Unreviewed, rolling out r207225.

This change causes debug tests to exit early with crashes.

Reverted changeset:

"Optional's move-constructor and move-assignment operator
don't disengage the value being moved from"
https://bugs.webkit.org/show_bug.cgi?id=163309
http://trac.webkit.org/changeset/207225

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207237 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoFix assertion after switching to URLParser
achristensen@apple.com [Wed, 12 Oct 2016 20:23:03 +0000 (20:23 +0000)]
Fix assertion after switching to URLParser
https://bugs.webkit.org/show_bug.cgi?id=163350
rdar://problem/28739938

Reviewed by Brady Eidson.
Source/WebKit2:

Covered by a new API test.

* UIProcess/API/Cocoa/_WKUserStyleSheet.mm:
(-[_WKUserStyleSheet initWithSource:forMainFrameOnly:legacyWhitelist:legacyBlacklist:baseURL:userContentWorld:]):
The { } here is not understood by the compiler to mean WebCore::URL(), but rather the empty constructor for the enum ParsedURLStringTag.
We used to be unsafely trusting that the URL was valid and canonicalized, but with URLParser we are canonicalizing it,
and the assertion (url == m_string) in URL.cpp was failing.

Tools:

* TestWebKitAPI/Tests/WebKit2Cocoa/UserContentController.mm:
(TEST):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207236 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoHandle non-function, non-undefined comparator in Array.prototype.sort
keith_miller@apple.com [Wed, 12 Oct 2016 19:40:51 +0000 (19:40 +0000)]
Handle non-function, non-undefined comparator in Array.prototype.sort
https://bugs.webkit.org/show_bug.cgi?id=163085

Reviewed by Yusuke Suzuki.

JSTests:

* ChakraCore/test/Array/array_sort.baseline-jsc:
* stress/array-sort-bad-comparator.js: Added.
(test):

Source/JavaScriptCore:

* builtins/ArrayPrototype.js:
(sort.comparatorSort):
(sort.stringSort):
(sort):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207235 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoMake Document::existingAXObjectCache() fast with accessibility disabled.
akling@apple.com [Wed, 12 Oct 2016 19:35:55 +0000 (19:35 +0000)]
Make Document::existingAXObjectCache() fast with accessibility disabled.
<https://webkit.org/b/163347>

Reviewed by Antti Koivisto.

Instruments says we were spending 2.3% of Dromaeo/dom-modify.html in this function,
traversing ancestors. Track whether we've ever had a cache, and use that knowledge
to return early if possible.

* dom/Document.cpp:
(WebCore::Document::existingAXObjectCache):
(WebCore::Document::axObjectCache):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207234 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years ago[SOUP] trunk r207192 fails to compile due to missing std::function being unavailable...
commit-queue@webkit.org [Wed, 12 Oct 2016 19:18:59 +0000 (19:18 +0000)]
[SOUP] trunk r207192 fails to compile due to missing std::function being unavailable (missing #include <functional>)
https://bugs.webkit.org/show_bug.cgi?id=163340

Patch by Jeremy Huddleston Sequoia <jeremyhu@apple.com> on 2016-10-12
Reviewed by Michael Catanzaro.

* platform/network/soup/SoupNetworkSession.h: Add missing #include <functional>

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207232 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years ago[Win] Unreviewed build fix after r207218.
bfulgham@apple.com [Wed, 12 Oct 2016 19:03:26 +0000 (19:03 +0000)]
[Win] Unreviewed build fix after r207218.

The CQ-landed patch used the old USE(CFNETWORK) compiler guard.
It should be using USE(CFURLCONNECTION).

* WebCache.cpp: Missed one!

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207231 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoREGRESSION (r207179): ASSERTION FAILED: node.cell != previousCell
fpizlo@apple.com [Wed, 12 Oct 2016 19:01:21 +0000 (19:01 +0000)]
REGRESSION (r207179): ASSERTION FAILED: node.cell != previousCell
https://bugs.webkit.org/show_bug.cgi?id=163337

Reviewed by Mark Lam.

It turns out that HeapSnapshot was not down with revisiting. The concurrent GC is going to be
built around the idea that we can revisit objects many times. This means that any action that
should only take place once per object must check the object's state. This fixes the snapshot
code to do this.

While writing this code, I realized that we're actually doing this check incorrectly, so I
filed bug 163343. That bug requires a race, so we aren't going to see it yet.

* heap/HeapSnapshot.cpp:
(JSC::HeapSnapshot::finalize):
* heap/SlotVisitor.cpp:
(JSC::SlotVisitor::appendToMarkStack):
(JSC::SlotVisitor::visitChildren):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207230 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoWeb Inspector: Improve support for logging Proxy objects in console
joepeck@webkit.org [Wed, 12 Oct 2016 18:47:53 +0000 (18:47 +0000)]
Web Inspector: Improve support for logging Proxy objects in console
https://bugs.webkit.org/show_bug.cgi?id=163323
<rdar://problem/28432553>

Reviewed by Timothy Hatcher.

Source/JavaScriptCore:

This is based off of similiar patches in Blink for Proxy handling.

* bindings/ScriptValue.cpp:
(Deprecated::ScriptValue::isEqual):
Use strict equality. This is the intent, and it prevents the possibility of triggering
primitive conversion on objects in previous ConsoleMessage argument lists.

* inspector/InjectedScriptSource.js:
(InjectedScript.prototype._propertyDescriptors):
Bail if the object is a Proxy.

(InjectedScript.prototype._describe):
Provide a friendlier name, "Proxy" instead of "ProxyObject".

(InjectedScript.RemoteObject):
When generating a preview for a Proxy object, generate it from the final target
and mark it as lossy so that the object can always be expanded to get the internal
target/handler properties.

* inspector/JSInjectedScriptHost.h:
* inspector/JSInjectedScriptHost.cpp:
(Inspector::JSInjectedScriptHost::subtype):
New subtype for Proxy objects.

(Inspector::JSInjectedScriptHost::proxyTargetValue):
Resolve the final target value for a Proxy.

* inspector/JSInjectedScriptHostPrototype.cpp:
(Inspector::JSInjectedScriptHostPrototype::finishCreation):
(Inspector::jsInjectedScriptHostPrototypeFunctionProxyTargetValue):
Add the new method.

* inspector/ScriptArguments.cpp:
(Inspector::ScriptArguments::getFirstArgumentAsString):
Avoid triggering Proxy traps on a Proxy object when getting a quick
string description for ConsoleMessages.

* inspector/protocol/Runtime.json:
Add new "proxy" subtype.

Source/WebInspectorUI:

* UserInterface/Views/ConsoleMessageView.js:
(WebInspector.ConsoleMessageView.prototype._formatParameter):
Treat a Proxy like any other object.

LayoutTests:

* inspector/console/console-log-proxy-expected.txt: Added.
* inspector/console/console-log-proxy.html: Added.
Add a test specific to console logs of Proxy objects to ensure the get
trap is not used in different cases.

* inspector/model/remote-object-expected.txt:
* inspector/model/remote-object.html:
* platform/mac/inspector/model/remote-object-expected.txt:
Update results for Proxy objects and include a test for a multi-level
Proxy object, which should preview the target.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207229 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoEmit DebugHooks uniformly with pause locations instead of having separate pause locat...
joepeck@webkit.org [Wed, 12 Oct 2016 18:47:48 +0000 (18:47 +0000)]
Emit DebugHooks uniformly with pause locations instead of having separate pause locations and op_debug emits
https://bugs.webkit.org/show_bug.cgi?id=162809

Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

Change how BytecodeGeneration emits debug hooks to be more consistent.
Previously most nodes individually generated their own debug hook
and we asserted that it matched a breakpoint location identified
by the parser. This could get out of sync, or nodes could forget to
emit debug hooks expected by the parser.

With this change, we always check and emit a debug hook for any
node. The default behavior is for BytecodeGenerator::emitNode
to emit the debug hook when emitting the node itself. This covers
the majority of cases (statements).

There are a few exceptions where we continue to need to customize
emitting debug hooks:

    1. Nodes with emitBytecodeInConditionContext
        - non-Expression nodes customize how they emit their children
        - constants conditions may emit nothing, but we had recorded a breakpoint location so emit a debug hook
        - always emit one debug hook in case we recorded a breakpoint location, but avoid emitting multiple
          in nodes which may call up to the ExpressionNode::emitBytecodeInConditionContext base impl.
    2. Specialized Debug Hooks
        - such as hooks for Program start/end, debugger statements, etc.
    3. Debug Hooks in for..of / for..in that don't correspond to re-emitting nodes
        - such as pausing on the assignment expression inside these loops

The majority of nodes no longer have custom emits.

* bytecompiler/BytecodeGenerator.h:
(JSC::BytecodeGenerator::emitNodeInTailPosition):
(JSC::BytecodeGenerator::emitNodeInConditionContext):
* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::emitDebugHook):
(JSC::BytecodeGenerator::emitEnumeration):
By default, when emitting a node check if we should also emit an op_debug for it.
This default DebugHook is WillExecuteStatement, which is a normal pause point.

* bytecompiler/NodesCodegen.cpp:
(JSC::ConstantNode::emitBytecodeInConditionContext):
(JSC::LogicalNotNode::emitBytecodeInConditionContext):
(JSC::BinaryOpNode::emitBytecodeInConditionContext):
(JSC::LogicalOpNode::emitBytecodeInConditionContext):
The parser would have generated a pause location for these conditions
no matter what constant folding and re-writing these nodes may perform.
So, when emitting these nodes in condition context check if they need
emit their own debug hook.

(JSC::EmptyStatementNode::emitBytecode):
(JSC::ExprStatementNode::emitBytecode):
(JSC::DeclarationStatement::emitBytecode):
(JSC::IfElseNode::emitBytecode):
(JSC::DoWhileNode::emitBytecode):
(JSC::WhileNode::emitBytecode):
(JSC::ForNode::emitBytecode):
(JSC::ContinueNode::emitBytecode):
(JSC::BreakNode::emitBytecode):
(JSC::ReturnNode::emitBytecode):
(JSC::WithNode::emitBytecode):
(JSC::SwitchNode::emitBytecode):
(JSC::ThrowNode::emitBytecode):
No longer need to custom emit debug hooks. The default emitNode will handle these.

(JSC::ForInNode::emitBytecode):
Include extra debug hooks the user expects to return back to the assignment
expression in the loop header before starting the body again. The same is done
for for..of with emitEnumeration.

* parser/ASTBuilder.h:
(JSC::ASTBuilder::createExportDefaultDeclaration):
(JSC::ASTBuilder::createExportLocalDeclaration):
These are no longer needed to fake-satisfy assertions. We never wanted to
emit debug hooks for these inner statements because the export statement
will already have the debug hooks.

(JSC::ASTBuilder::createForInLoop):
(JSC::ASTBuilder::createForOfLoop):
Include the correct location where the declaration starts.

(JSC::ASTBuilder::breakpointLocation):
Simplify to a general implementation for Node.

* parser/SyntaxChecker.h:
(JSC::SyntaxChecker::createForInLoop):
(JSC::SyntaxChecker::createForOfLoop):
Ignore the new extra parameter.

* parser/Nodes.h:
(JSC::Node::needsDebugHook):
(JSC::Node::setNeedsDebugHook):
(JSC::ExpressionNode::needsDebugHook): Deleted.
(JSC::ExpressionNode::setNeedsDebugHook): Deleted.
(JSC::StatementNode::isEmptyStatement): Deleted.
(JSC::StatementNode::needsDebugHook): Deleted.
(JSC::StatementNode::setNeedsDebugHook): Deleted.
Move debug hook logic into the base Node class.

(JSC::StatementNode::isDebuggerStatement):
Provide a way to distinguish a debugger statement.

* parser/Parser.cpp:
(JSC::Parser<LexerType>::parseForStatement):
Provide the location before the declaration starts.

Source/WebInspectorUI:

* UserInterface/Views/SourceCodeTextEditor.js:
(WebInspector.SourceCodeTextEditor.prototype.textEditorExecutionHighlightRange):
When pausing on the variable assignment inside for..of and for..in don't just
highlight "var foo" but include the right hand side "var foo in ..." or
"var foo of ...".

LayoutTests:

* inspector/debugger/stepping/stepping-control-flow-expected.txt:
* inspector/debugger/stepping/stepping-control-flow.html:
Add new tests for stepping through conditional expressions with constants,
logical operations, binary operations, and unary negations.

* inspector/debugger/stepping/stepping-loops-expected.txt:
* inspector/debugger/stepping/stepping-loops.html:
Update tests for changes in stepping behavior in for loops.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207228 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoWeb Inspector: Whole program sometimes highlighted instead of just first statement
commit-queue@webkit.org [Wed, 12 Oct 2016 18:43:19 +0000 (18:43 +0000)]
Web Inspector: Whole program sometimes highlighted instead of just first statement
https://bugs.webkit.org/show_bug.cgi?id=163300
<rdar://problem/28723162>

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2016-10-12
Reviewed by Timothy Hatcher.

* UserInterface/Views/SourceCodeTextEditor.js:
(WebInspector.SourceCodeTextEditor.prototype.textEditorExecutionHighlightRange):
Avoid highlighting the entire program by skipping a Program type Node.

* UserInterface/Views/TextEditor.js:
(WebInspector.TextEditor.prototype.setExecutionLineAndColumn):
Avoid unnecessary work before content has loaded.

(WebInspector.TextEditor.prototype.currentPositionToOriginalOffset):
Avoid unnecessary indirection to get the CodeMirror editor.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207227 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoArray.prototype.slice should not modify frozen objects.
mark.lam@apple.com [Wed, 12 Oct 2016 18:27:50 +0000 (18:27 +0000)]
Array.prototype.slice should not modify frozen objects.
https://bugs.webkit.org/show_bug.cgi?id=163338

Reviewed by Filip Pizlo.

JSTests:

* stress/array-slice-on-frozen-object.js: Added.

Source/JavaScriptCore:

1. The ES6 spec for Array.prototype.slice
   (https://tc39.github.io/ecma262/#sec-array.prototype.slice) states that it uses
   the CreateDataPropertyOrThrow()
   (https://tc39.github.io/ecma262/#sec-createdatapropertyorthrow) to add items to
   the result array.  The spec for CreateDataPropertyOrThrow states:

   "This abstract operation creates a property whose attributes are set to the
   same defaults used for properties created by the ECMAScript language assignment
   operator. Normally, the property will not already exist. If it does exist and
   is not configurable or if O is not extensible, [[DefineOwnProperty]] will
   return false causing this operation to throw a TypeError exception."

2. Array.prototype.slice also uses a Set function
   (https://tc39.github.io/ecma262/#sec-set-o-p-v-throw) to set the "length"
   property and passes true for the Throw argument.  Ultimately, it ends up
   calling the OrdinarySet function
   (https://tc39.github.io/ecma262/#sec-ordinaryset) that will fail if the
   property is not writable.  This failure should result in a TypeError being
   thrown in Set.

   Since the properties of frozen objects are not extensible, not configurable,
   and not writeable, Array.prototype.slice should fail to write to the result
   array if it is frozen.

If the source array being sliced has 1 or more elements, (1) will take effect
when we try to set the element in the non-writeable result obj.
If the source array being sliced has 0 elements, we will not set any elements and
(1) will not trigger.  Subsequently, (2) will take effect when we will try to
set the length of the result obj.

* runtime/ArrayPrototype.cpp:
(JSC::putLength):
(JSC::setLength):
(JSC::arrayProtoFuncSlice):
(JSC::arrayProtoFuncSplice):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207226 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoOptional's move-constructor and move-assignment operator don't disengage the value...
weinig@apple.com [Wed, 12 Oct 2016 17:41:00 +0000 (17:41 +0000)]
Optional's move-constructor and move-assignment operator don't disengage the value being moved from
https://bugs.webkit.org/show_bug.cgi?id=163309

Reviewed by Anders Carlsson.

Source/WTF:

* wtf/Optional.h:
(WTF::Optional::Optional):
(WTF::Optional::operator=):
Disengage 'other' on move-construction and move-assignment.

Tools:

* TestWebKitAPI/Tests/WTF/Optional.cpp:
(TestWebKitAPI::TEST):
Add tests for Optional's move-constructor and move-assignment operator.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207225 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoRemove an unused function
andersca@apple.com [Wed, 12 Oct 2016 17:31:03 +0000 (17:31 +0000)]
Remove an unused function
https://bugs.webkit.org/show_bug.cgi?id=163341

Reviewed by Dan Bernstein.

* WebProcess/WebPage/WebBackForwardListProxy.cpp:
(WebKit::WebBackForwardListProxy::isActive): Deleted.
* WebProcess/WebPage/WebBackForwardListProxy.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207224 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years ago[Win] Unreviewed build fix after r207218.
bfulgham@apple.com [Wed, 12 Oct 2016 17:22:55 +0000 (17:22 +0000)]
[Win] Unreviewed build fix after r207218.

The CQ-landed patch used the old USE(CFNETWORK) compiler guard.
It should be using USE(CFURLCONNECTION).

* WebCache.cpp:
(WebCache::cacheFolder):
(WebCache::setCacheFolder):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207223 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoRemove JITWriteBarrier.h
fpizlo@apple.com [Wed, 12 Oct 2016 16:56:34 +0000 (16:56 +0000)]
Remove JITWriteBarrier.h
https://bugs.webkit.org/show_bug.cgi?id=163334

Reviewed by Mark Lam.

I guess that the idea of JITWriteBarrier was to make sure that if you slap some heap pointer
bits into machine code, then you better execute a barrier on the code block. But it's a
complicated piece of code, and I can never remember how it quite works. These days it looks
vestigial, particularly since only the CallLinkInfo patchable callee immediate uses it. It's
not really necessary to have something like this, since our convention is that any pointer
stored in machine code must always be shadowed in the GC heap. I think that convention has
won by overwhelming majority, so we should finally remove JITWriteBarrier.

A practical outcome of this change is that it makes it easier to implement DirectCall ICs,
which will have to store the callee in the CallLinkInfo but not in the machine code.

* JavaScriptCore.xcodeproj/project.pbxproj:
* assembler/AbstractMacroAssembler.h:
* bytecode/CallLinkInfo.cpp:
(JSC::CallLinkInfo::setCallee):
(JSC::CallLinkInfo::clearCallee):
* bytecode/CallLinkInfo.h:
(JSC::CallLinkInfo::setCallee): Deleted.
(JSC::CallLinkInfo::clearCallee): Deleted.
* heap/SlotVisitor.h:
* jit/JITWriteBarrier.h: Removed.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207222 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years ago[WebGL] Revise vertex array attribute checks to account for lazy memory allocation.
bfulgham@apple.com [Wed, 12 Oct 2016 16:50:24 +0000 (16:50 +0000)]
[WebGL] Revise vertex array attribute checks to account for lazy memory allocation.
https://bugs.webkit.org/show_bug.cgi?id=163149
<rdar://problem/28629774>

Reviewed by Dean Jackson.

Tested by fast/canvas/webgl/webgl-drawarrays-crash-2.html

* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::validateVertexAttributes):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207221 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoNow playing media sessions are always cleared for the active foreground tab
wenson_hsieh@apple.com [Wed, 12 Oct 2016 16:48:21 +0000 (16:48 +0000)]
Now playing media sessions are always cleared for the active foreground tab
https://bugs.webkit.org/show_bug.cgi?id=163310
<rdar://problem/28573301>

Reviewed by Jer Noble.

Source/WebCore:

Currently, we clear out Now Playing info whenever we set the visibility of Now Playing controls to Never. This
is incorrect, as the Now Playing session needs to still be active (just not visible) in this state. Instead, we
should not be taking the active/foregrounded-ness of a media session for Now Playing into account in
MediaElementSession::canShowControlsManager so that even if a media session is in the active/foreground tab, we
will update the Now Playing session with the latest info. However, when setting the visibility, we now check
and see if the session allows Now Playing visibility, and set the Now Playing visibility to Always or Never
depending on the answer.

Tweaked existing unit tests in NowPlayingControlsTests.

* html/MediaElementSession.cpp:
(WebCore::MediaElementSession::canShowControlsManager):
(WebCore::MediaElementSession::allowsNowPlayingControlsVisibility):
(WebCore::MediaElementSession::pageAllowsNowPlayingControls): Deleted.
* html/MediaElementSession.h:
* platform/audio/PlatformMediaSession.h:
(WebCore::PlatformMediaSession::allowsNowPlayingControlsVisibility):
* platform/audio/mac/MediaSessionManagerMac.mm:
(WebCore::MediaSessionManagerMac::updateNowPlayingInfo):

Tools:

Tweaks existing unit tests to verify that media session info persists when backgrounding and foregrounding, but
that media session info is correctly cleared out if the media session itself is no longer eligible for Now
Playing (not accounting for foreground/active state). Previously, these tests were verifying that we would
always clear out the information, but this is incorrect, and is the source of the problem.

* TestWebKitAPI/Tests/WebKit2Cocoa/NowPlayingControlsTests.mm:
(-[NowPlayingTestWebView waitForNowPlayingInfoToChange]):
(TestWebKitAPI::TEST):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207220 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoRefactor LineLayoutState's float box handling.
zalan@apple.com [Wed, 12 Oct 2016 16:45:55 +0000 (16:45 +0000)]
Refactor LineLayoutState's float box handling.
https://bugs.webkit.org/show_bug.cgi?id=163286

Reviewed by David Hyatt.

We keep track of float boxes both per line (RootInlineBox::m_floats) and
per flow block (LineLayoutState::m_floats) during layout.
As we lay out the lines and iterate through RootInlineBox::m_floats, we
increment LineLayoutState::m_floatIndex. This LineLayoutState::m_floatIndex is
later used to find the matching float box in the per-block-flow float list.
This logic works fine as long as the lists and the index manipulation are tightly coded.
However due to the complexity of the line/float layout code, this is no longer the case.

This patch makes float box handling more secure by changing this index based setup
to a list iterator. It helps to eliminate potential vector overflow issues.

LineLayoutState::FloatList (new class) keeps track of all the floats for the block flow.
It groups the float box related functions/members and provides an iterator interface to ensure safer
syncing between this and the line based floats.

No change in functionality.

* rendering/RenderBlockFlow.h:
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::appendFloatingObjectToLastLine):
(WebCore::repaintDirtyFloats):
(WebCore::RenderBlockFlow::layoutRunsAndFloats):
(WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
(WebCore::RenderBlockFlow::linkToEndLineIfNeeded):
(WebCore::RenderBlockFlow::layoutLineBoxes):
(WebCore::RenderBlockFlow::checkFloatInCleanLine):
(WebCore::RenderBlockFlow::determineStartPosition):
(WebCore::RenderBlockFlow::determineEndPosition):
(WebCore::RenderBlockFlow::repaintDirtyFloats): Deleted.
(WebCore::RenderBlockFlow::checkFloatsInCleanLine): Deleted.
* rendering/line/LineLayoutState.h:
(WebCore::FloatWithRect::create):
(WebCore::FloatWithRect::renderer):
(WebCore::FloatWithRect::rect):
(WebCore::FloatWithRect::everHadLayout):
(WebCore::FloatWithRect::adjustRect):
(WebCore::FloatWithRect::FloatWithRect):
(WebCore::LineLayoutState::FloatList::append):
(WebCore::LineLayoutState::FloatList::setLastFloat):
(WebCore::LineLayoutState::FloatList::lastFloat):
(WebCore::LineLayoutState::FloatList::setLastCleanFloat):
(WebCore::LineLayoutState::FloatList::lastCleanFloat):
(WebCore::LineLayoutState::FloatList::floatWithRect):
(WebCore::LineLayoutState::FloatList::begin):
(WebCore::LineLayoutState::FloatList::end):
(WebCore::LineLayoutState::FloatList::find):
(WebCore::LineLayoutState::FloatList::isEmpty):
(WebCore::LineLayoutState::LineLayoutState):
(WebCore::LineLayoutState::floatList):
(WebCore::LineLayoutState::lastFloat): Deleted.
(WebCore::LineLayoutState::setLastFloat): Deleted.
(WebCore::LineLayoutState::floats): Deleted.
(WebCore::LineLayoutState::floatIndex): Deleted.
(WebCore::LineLayoutState::setFloatIndex): Deleted.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207219 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years ago[Win] Parallel DRTs are sharing preferences and cache.
pvollan@apple.com [Wed, 12 Oct 2016 16:36:11 +0000 (16:36 +0000)]
[Win] Parallel DRTs are sharing preferences and cache.
https://bugs.webkit.org/show_bug.cgi?id=163013

Reviewed by Brent Fulgham.

Source/WebKit/win:

Make it possible for a WebKit client to use separate preferences and cache.

* Interfaces/IWebPreferencesPrivate.idl:
* WebApplicationCache.cpp:
(applicationCachePath):
* WebCache.cpp:
(WebCache::cacheFolder):
(WebCache::setCacheFolder):
* WebDatabaseManager.cpp:
(databasesDirectory):
* WebPreferences.cpp:
(WebPreferences::applicationId):
(WebPreferences::valueForKey):
(WebPreferences::setValueForKey):
(WebPreferences::save):
(WebPreferences::QueryInterface):
(WebPreferences::modernMediaControlsEnabled):
(WebPreferences::setApplicationId):
* WebPreferences.h:
* WebView.cpp:
(WebView::setCacheModel):

Tools:

Use separate cache and preferences for each DRT instance.

* DumpRenderTree/win/DumpRenderTree.cpp:
(applicationId):
(setApplicationId):
(setCacheFolder):
(setDefaultsToConsistentValuesForTesting):
* Scripts/webkitpy/port/win.py:
(WinPort.setup_test_run):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207218 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years ago[GTK] Tests that fail since the new URLParser has been enabled on r207162.
clopez@igalia.com [Wed, 12 Oct 2016 16:32:20 +0000 (16:32 +0000)]
[GTK] Tests that fail since the new URLParser has been enabled on r207162.
https://bugs.webkit.org/show_bug.cgi?id=163335

Unreviewed gardening.

Rebaseline 12 tests that don't look like real failures, and report the other 36 that look as such.

* platform/gtk/TestExpectations:
* platform/gtk/fast/css-generated-content/malformed-url-expected.txt: Added.
* platform/gtk/fast/loader/redirect-to-invalid-url-using-javascript-calls-policy-delegate-expected.txt: Added.
* platform/gtk/fast/loader/redirect-to-invalid-url-using-meta-refresh-calls-policy-delegate-expected.txt: Added.
* platform/gtk/fast/loader/url-parse-1-expected.txt: Added.
* platform/gtk/fast/loader/window-open-to-invalid-url-calls-policy-delegate-expected.txt: Added.
* platform/gtk/fast/url/invalid-idn-expected.txt: Added.
* platform/gtk/fast/url/segments-userinfo-vs-host-expected.txt: Added.
* platform/gtk/fast/url/tab-and-newline-stripping-expected.txt: Added.
* platform/gtk/fast/url/url-credentials-escaping-expected.txt: Added.
* platform/gtk/http/tests/eventsource/eventsource-cors-non-http-expected.txt: Added.
* platform/gtk/http/tests/websocket/tests/hybi/handshake-ok-with-http-version-beyond-1_1-expected.txt: Added.
* platform/gtk/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/fetch-src/failure-expected.txt: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207217 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoUnreviewed, fix Windows build break after r207182.
said@apple.com [Wed, 12 Oct 2016 16:24:55 +0000 (16:24 +0000)]
Unreviewed, fix Windows build break after r207182.

* platform/graphics/cg/ImageDecoderCG.cpp:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207216 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoUpdate remaining DOM events to stop using legacy [ConstructorTemplate=Event]
cdumez@apple.com [Wed, 12 Oct 2016 16:23:00 +0000 (16:23 +0000)]
Update remaining DOM events to stop using legacy [ConstructorTemplate=Event]
https://bugs.webkit.org/show_bug.cgi?id=163319

Reviewed by Darin Adler.

Source/WebCore:

Update remaining DOM events to stop using legacy [ConstructorTemplate=Event]
and use regular constructors instead.

No new tests, updated existing tests.

* dom/AutocompleteErrorEvent.h:
* dom/AutocompleteErrorEvent.idl:
* dom/BeforeLoadEvent.h:
* dom/BeforeLoadEvent.idl:
* dom/CompositionEvent.cpp:
(WebCore::CompositionEvent::CompositionEvent):
* dom/CompositionEvent.h:
* dom/CompositionEvent.idl:
* dom/ErrorEvent.cpp:
(WebCore::ErrorEvent::ErrorEvent):
* dom/ErrorEvent.h:
* dom/ErrorEvent.idl:
* dom/FocusEvent.cpp:
(WebCore::FocusEvent::FocusEvent):
* dom/FocusEvent.h:
* dom/FocusEvent.idl:
* dom/HashChangeEvent.h:
* dom/HashChangeEvent.idl:
* dom/OverflowEvent.cpp:
(WebCore::OverflowEvent::OverflowEvent):
* dom/OverflowEvent.h:
* dom/OverflowEvent.idl:
* dom/PageTransitionEvent.cpp:
(WebCore::PageTransitionEvent::PageTransitionEvent):
* dom/PageTransitionEvent.h:
* dom/PageTransitionEvent.idl:
* dom/PopStateEvent.cpp:
(WebCore::PopStateEvent::PopStateEvent):
(WebCore::PopStateEvent::create):
* dom/PopStateEvent.h:
* dom/PopStateEvent.idl:
* dom/SecurityPolicyViolationEvent.h:
* dom/SecurityPolicyViolationEvent.idl:
* dom/TouchEvent.cpp:
(WebCore::TouchEvent::TouchEvent):
* dom/TouchEvent.h:
* dom/TouchEvent.idl:
* dom/TransitionEvent.cpp:
(WebCore::TransitionEvent::TransitionEvent):
* dom/TransitionEvent.h:
* dom/TransitionEvent.idl:
* dom/WebKitAnimationEvent.cpp:
(WebCore::WebKitAnimationEvent::WebKitAnimationEvent):
* dom/WebKitAnimationEvent.h:
* dom/WebKitAnimationEvent.idl:
* dom/WebKitTransitionEvent.cpp:
(WebCore::WebKitTransitionEvent::WebKitTransitionEvent):
* dom/WebKitTransitionEvent.h:
* dom/WebKitTransitionEvent.idl:

LayoutTests:

Rebaseline several existing tests to reflect minor behavior changes:
- We now properly use the default member value when an explicit undefined
  is passed.
- We throw more exceptions when bad input is passed.
- Exception messages are sometimes slightly different.

* fast/events/constructors/before-load-event-constructor-expected.txt:
* fast/events/constructors/before-load-event-constructor.html:
* fast/events/constructors/composition-event-constructor-expected.txt:
* fast/events/constructors/composition-event-constructor.html:
* fast/events/constructors/error-event-constructor-expected.txt:
* fast/events/constructors/error-event-constructor.html:
* fast/events/constructors/focus-event-constructor-expected.txt:
* fast/events/constructors/focus-event-constructor.html:
* fast/events/constructors/hash-change-event-constructor-expected.txt:
* fast/events/constructors/hash-change-event-constructor.html:
* fast/events/constructors/pop-state-event-constructor-expected.txt:
* fast/events/constructors/pop-state-event-constructor.html:
* fast/events/constructors/transition-event-constructor-expected.txt:
* fast/events/constructors/transition-event-constructor.html:
* fast/events/constructors/webkit-animation-event-constructor-expected.txt:
* fast/events/constructors/webkit-animation-event-constructor.html:
* fast/events/constructors/webkit-transition-event-constructor-expected.txt:
* fast/events/constructors/webkit-transition-event-constructor.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207215 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoStop using PassRefPtr in platform/efl
cdumez@apple.com [Wed, 12 Oct 2016 14:41:59 +0000 (14:41 +0000)]
Stop using PassRefPtr in platform/efl
https://bugs.webkit.org/show_bug.cgi?id=163321

Reviewed by Laszlo Gombos.

Stop using PassRefPtr in platform/efl.

* platform/efl/BatteryProviderEfl.cpp:
(WebCore::batteryProperties):
(WebCore::BatteryProviderEfl::setBatteryStatus):
(WebCore::BatteryProviderEfl::dispatchEvent):
* platform/efl/BatteryProviderEfl.h:
* platform/efl/BatteryProviderEflClient.h:
* platform/efl/PlatformSpeechSynthesisProviderEfl.cpp:
(WebCore::PlatformSpeechSynthesisProviderEfl::voiceName):
(WebCore::PlatformSpeechSynthesisProviderEfl::speak):
* platform/efl/PlatformSpeechSynthesisProviderEfl.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207214 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoUnreviewed buildfix for GCC 4.9 after r207186.
ossy@webkit.org [Wed, 12 Oct 2016 09:54:14 +0000 (09:54 +0000)]
Unreviewed buildfix for GCC 4.9 after r207186.
https://bugs.webkit.org/show_bug.cgi?id=163255

* runtime/HasOwnPropertyCache.h:
(JSC::HasOwnPropertyCache::Entry::Entry):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207213 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoAttribute setter binding generated code should use more references
commit-queue@webkit.org [Wed, 12 Oct 2016 07:37:17 +0000 (07:37 +0000)]
Attribute setter binding generated code should use more references
https://bugs.webkit.org/show_bug.cgi?id=163275

Patch by Youenn Fablet <youenn@apple.com> on 2016-10-12
Reviewed by Alex Christensen.

No change of behavior.

* bindings/scripts/CodeGeneratorJS.pm:
(JSValueToNative):
* bindings/scripts/test/JS/JSTestGlobalObject.cpp:
* bindings/scripts/test/JS/JSTestInterface.cpp:
* bindings/scripts/test/JS/JSTestNode.cpp:
* bindings/scripts/test/JS/JSTestNondeterministic.cpp:
* bindings/scripts/test/JS/JSTestObj.cpp:
* bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
* bindings/scripts/test/JS/JSTestTypedefs.cpp:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207193 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoRefactor binding generated casted-this checks for methods
commit-queue@webkit.org [Wed, 12 Oct 2016 06:57:04 +0000 (06:57 +0000)]
Refactor binding generated casted-this checks for methods
https://bugs.webkit.org/show_bug.cgi?id=163198

Patch by Youenn Fablet <youenn@apple.com> on 2016-10-11
Reviewed by Darin Adler.

Covered by existing tests and binding rebased tests..

Introducing BindingCaller::callMethod and callPromiseMethod to encapsulate casted-this checks for methods.
This is supported for all methods except seralizer and iterators methods.

Introduced castForMethod similarly to castForAttribute.
Moved this from static methods of JSClass to static methods of BindingCaller<JSClass>
This allows removing the corresponding declarations from JSClass header file.

Note the difference of handling thisValue between the two in case of CustomProxyToJSObject.
This should be made more consistent.

In case of bad casted this check, CustomProxyToJSObject objects will throw a TypeError with an error message like other methods.
Before the patch, a TypeError without error message was thrown.

EventTarget being different, added a specialization of BindingCaller for it.
This allows also removing some binding generated code dedicated to EventTarget.
A similar approach might also be done for CustomProxyToJSObject objects to further simplify the binding generator.

* bindings/js/JSDOMBinding.cpp:
(WebCore::rejectPromiseWithThisTypeError):
* bindings/js/JSDOMBinding.h:
(WebCore::BindingCaller::callPromiseMethod):
(WebCore::BindingCaller::callMethod):
* bindings/js/JSEventTargetCustom.h:
(WebCore::BindingCaller<JSEventTarget>::callMethod):
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateHeader):
(GenerateImplementation):
(GenerateFunctionCastedThis): Deleted.
* bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
* bindings/scripts/test/JS/JSTestActiveDOMObject.h:
* bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
* bindings/scripts/test/JS/JSTestCustomNamedGetter.h:
* bindings/scripts/test/JS/JSTestEventTarget.cpp:
* bindings/scripts/test/JS/JSTestEventTarget.h:
* bindings/scripts/test/JS/JSTestGlobalObject.cpp:
* bindings/scripts/test/JS/JSTestGlobalObject.h:
* bindings/scripts/test/JS/JSTestInterface.cpp:
* bindings/scripts/test/JS/JSTestInterface.h:
* bindings/scripts/test/JS/JSTestIterable.cpp:
* bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
* bindings/scripts/test/JS/JSTestJSBuiltinConstructor.h:
* bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
* bindings/scripts/test/JS/JSTestMediaQueryListListener.h:
* bindings/scripts/test/JS/JSTestNode.cpp:
* bindings/scripts/test/JS/JSTestNode.h:
* bindings/scripts/test/JS/JSTestNondeterministic.cpp:
* bindings/scripts/test/JS/JSTestNondeterministic.h:
* bindings/scripts/test/JS/JSTestObj.cpp:
* bindings/scripts/test/JS/JSTestObj.h:
* bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
* bindings/scripts/test/JS/JSTestOverrideBuiltins.h:
* bindings/scripts/test/JS/JSTestTypedefs.cpp:
* bindings/scripts/test/JS/JSTestTypedefs.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207192 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years ago[EFL] Update API tests which are passed or failed
commit-queue@webkit.org [Wed, 12 Oct 2016 06:39:44 +0000 (06:39 +0000)]
[EFL] Update API tests which are passed or failed
https://bugs.webkit.org/show_bug.cgi?id=163322

Unreviewed, simple on/off API test.

*ewk_favicon_database_clear* has been crashed for a long time, however
*ewk_cookie_manager_permanent_storage* is fine now. So the passing test
is enabled again, and disable the failure tests.

Patch by Gyuyoung Kim <gyuyoung.kim@navercorp.com> on 2016-10-11

* UIProcess/API/efl/tests/test_ewk2_cookie_manager.cpp:
(TEST_F):
* UIProcess/API/efl/tests/test_ewk2_favicon_database.cpp:
(TEST_F):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207191 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoMediaResourceLoader::requestResource should take a ResourceRequest&& as input
commit-queue@webkit.org [Wed, 12 Oct 2016 06:26:35 +0000 (06:26 +0000)]
MediaResourceLoader::requestResource should take a ResourceRequest&& as input
https://bugs.webkit.org/show_bug.cgi?id=160397

Patch by Youenn Fablet <youenn@apple.com> on 2016-10-11
Reviewed by Alex Christensen.

No change in behavior.

* loader/MediaResourceLoader.cpp:
(WebCore::MediaResourceLoader::requestResource): Passing a ResourceRequest&& as input parameter.
* loader/MediaResourceLoader.h:
* platform/graphics/PlatformMediaResourceLoader.h: Ditto.
* platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
(webKitWebSrcStart): Creating an extra copy since MediaResourceLoader::requestResource expects a Resourcerequest&&.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207190 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years ago[EFL] Mark url tests to failure
gyuyoung.kim@webkit.org [Wed, 12 Oct 2016 05:34:26 +0000 (05:34 +0000)]
[EFL] Mark url tests to failure

Unreviewed EFL gardening on Oct. 12th.

URL tests have been failed since r207162.

* platform/efl/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207189 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoUpdate AnimationEvent to stop using legacy [ConstructorTemplate=Event]
cdumez@apple.com [Wed, 12 Oct 2016 04:48:13 +0000 (04:48 +0000)]
Update AnimationEvent to stop using legacy [ConstructorTemplate=Event]
https://bugs.webkit.org/show_bug.cgi?id=163312

Reviewed by Ryosuke Niwa.

Update AnimationEvent to stop using legacy [ConstructorTemplate=Event]
and use a regular constructor as in the specification:
- https://drafts.csswg.org/css-animations/#interface-animationevent

* dom/AnimationEvent.cpp:
(WebCore::AnimationEvent::AnimationEvent):
* dom/AnimationEvent.h:
* dom/AnimationEvent.idl:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207188 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoUpdate DeviceProximityEvent to stop using legacy [ConstructorTemplate=Event]
cdumez@apple.com [Wed, 12 Oct 2016 04:47:00 +0000 (04:47 +0000)]
Update DeviceProximityEvent to stop using legacy [ConstructorTemplate=Event]
https://bugs.webkit.org/show_bug.cgi?id=163311

Reviewed by Ryosuke Niwa.

Update DeviceProximityEvent to stop using legacy [ConstructorTemplate=Event]
and use a regular constructor instead, as in the specification:
- https://www.w3.org/TR/2015/WD-proximity-20150903/#deviceproximityevent-interface

* Modules/proximity/DeviceProximityEvent.cpp:
(WebCore::DeviceProximityEvent::DeviceProximityEvent):
* Modules/proximity/DeviceProximityEvent.h:
(WebCore::DeviceProximityEvent::create):
(WebCore::DeviceProximityEventInit::DeviceProximityEventInit): Deleted.
* Modules/proximity/DeviceProximityEvent.idl:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207187 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoHasOwnPropertyCache needs to ref the UniquedStringImpls it sees
sbarati@apple.com [Wed, 12 Oct 2016 03:14:56 +0000 (03:14 +0000)]
HasOwnPropertyCache needs to ref the UniquedStringImpls it sees
https://bugs.webkit.org/show_bug.cgi?id=163255

Reviewed by Geoffrey Garen.

The cache needs to be responsible for ensuring that things
in the cache stay alive. Before, it wasn't doing this, and
that was wrong.

* runtime/HasOwnPropertyCache.h:
(JSC::HasOwnPropertyCache::Entry::operator=):
(JSC::HasOwnPropertyCache::operator delete):
(JSC::HasOwnPropertyCache::create):
(JSC::HasOwnPropertyCache::get):
(JSC::HasOwnPropertyCache::tryAdd):
(JSC::HasOwnPropertyCache::clear):
(JSC::HasOwnPropertyCache::zeroBuffer):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207186 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoFix a typo in the test.
dino@apple.com [Wed, 12 Oct 2016 02:24:50 +0000 (02:24 +0000)]
Fix a typo in the test.

* fast/media/mq-color-gamut.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207185 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoUpdate API test expectation after r207162.
achristensen@apple.com [Wed, 12 Oct 2016 02:06:59 +0000 (02:06 +0000)]
Update API test expectation after r207162.
       â€‹https://bugs.webkit.org/show_bug.cgi?id=162660

* TestWebKitAPI/Tests/WebKit2Cocoa/LoadInvalidURLRequest.mm:
(-[LoadInvalidURLNavigationActionDelegate webView:didFailProvisionalNavigation:withError:]):
Like r207167 but with a WebKit2 test.
"https://www.example.com<>/" was an invalid URL with the old URL parser, is now valid with URLParser but not with NSURL's parser.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207184 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoUnreviewed, EFL build fix because of r207173.
gyuyoung.kim@webkit.org [Wed, 12 Oct 2016 01:52:27 +0000 (01:52 +0000)]
Unreviewed, EFL build fix because of r207173.

* testing/InternalSettings.cpp:
(WebCore::InternalSettings::forcedPrefersReducedMotionValue):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207183 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years ago[CG] Add the option to immediately decode an image frame and control its memory caching
commit-queue@webkit.org [Wed, 12 Oct 2016 01:40:14 +0000 (01:40 +0000)]
[CG] Add the option to immediately decode an image frame and control its memory caching
https://bugs.webkit.org/show_bug.cgi?id=163298

Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2016-10-11
Reviewed by Simon Fraser.

This patch fixes two things. (1) An option is added to immediately decode an
image frame. This can be done by adding kCGImageSourceShouldCacheImmediately
to the ImageSource options dictionary. (2) BitmapImage should also control
when the image frame is actually deleted from memory. This can be done by
calling CGImageSourceCreateThumbnailAtIndex(). CG does not keep a reference
to the returned CGImageRef.

* platform/graphics/ImageFrame.h: Adding the DecodingMode enum class.
Ideally this should be a member of ImageDecoder class. But since we
have three header files for ImageDecoder, this can be added here till
the three files combined in one header file.

* platform/graphics/ImageFrameCache.cpp:
(WebCore::ImageFrameCache::setRenderTarget): Deleted.
* platform/graphics/ImageFrameCache.h:
* platform/graphics/ImageSource.cpp:
(WebCore::ImageSource::setRenderTarget):
* platform/graphics/ImageSource.h:
(WebCore::ImageSource::setRenderTarget): Deleted.
Unrelated change. The native image decoder is available from the ImageSource.
ImageSource::setTarget() does not need not to get it through ImageFrameCache.

* platform/graphics/cg/ImageDecoderCG.cpp:
(WebCore::createImageSourceOptions): Clean this function by using CFMutableDictionary.
(WebCore::imageSourceOptions): Cache two default ImageSource options and create new
ones for the non default cases.

(WebCore::ImageDecoder::createFrameImageAtIndex): Use the appropriate ImageSource function

* platform/graphics/cg/ImageDecoderCG.h:
* platform/graphics/win/ImageDecoderDirect2D.cpp:
(WebCore::ImageDecoder::createFrameImageAtIndex):
* platform/graphics/win/ImageDecoderDirect2D.h:
* platform/image-decoders/ImageDecoder.cpp:
(WebCore::ImageDecoder::createFrameImageAtIndex):
* platform/image-decoders/ImageDecoder.h:
 Change functions' signature to include a DecodingMode argument.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207182 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoselect.options may return too many option elements
cdumez@apple.com [Wed, 12 Oct 2016 00:25:55 +0000 (00:25 +0000)]
select.options may return too many option elements
https://bugs.webkit.org/show_bug.cgi?id=163296

Reviewed by Ryosuke Niwa.

LayoutTests/imported/w3c:

Import html/infrastructure web-platform-tests from upstream.

* web-platform-tests/html/infrastructure/common-dom-interfaces/collections/contains.json: Added.
* web-platform-tests/html/infrastructure/common-dom-interfaces/collections/htmlallcollection-expected.txt: Added.
* web-platform-tests/html/infrastructure/common-dom-interfaces/collections/htmlallcollection.html: Added.
* web-platform-tests/html/infrastructure/common-dom-interfaces/collections/htmlformcontrolscollection-expected.txt: Added.
* web-platform-tests/html/infrastructure/common-dom-interfaces/collections/htmlformcontrolscollection.html: Added.
* web-platform-tests/html/infrastructure/common-dom-interfaces/collections/htmloptionscollection-expected.txt: Added.
* web-platform-tests/html/infrastructure/common-dom-interfaces/collections/htmloptionscollection.html: Added.
* web-platform-tests/html/infrastructure/common-dom-interfaces/collections/radionodelist-expected.txt: Added.
* web-platform-tests/html/infrastructure/common-dom-interfaces/collections/radionodelist.html: Added.
* web-platform-tests/html/infrastructure/common-dom-interfaces/collections/w3c-import.log: Added.
* web-platform-tests/html/infrastructure/common-microsyntaxes/dates-and-times/contains.json: Added.
* web-platform-tests/html/infrastructure/common-microsyntaxes/dates-and-times/w3c-import.log: Added.
* web-platform-tests/html/infrastructure/common-microsyntaxes/numbers/contains.json: Added.
* web-platform-tests/html/infrastructure/common-microsyntaxes/numbers/w3c-import.log: Added.
* web-platform-tests/html/infrastructure/conformance-requirements/extensibility/foreign-expected.txt: Added.
* web-platform-tests/html/infrastructure/conformance-requirements/extensibility/foreign.html: Added.
* web-platform-tests/html/infrastructure/conformance-requirements/extensibility/w3c-import.log: Added.
* web-platform-tests/html/infrastructure/terminology/plugins/sample.txt: Added.
* web-platform-tests/html/infrastructure/terminology/plugins/text-plain-expected.txt: Added.
* web-platform-tests/html/infrastructure/terminology/plugins/text-plain.html: Added.
* web-platform-tests/html/infrastructure/terminology/plugins/w3c-import.log: Added.

Source/WebCore:

select.options may return too many option elements. We're only supposed
to return the option element children of the select element, and the
option element children of all the optgroup element children of the
select element, in tree order:
- https://html.spec.whatwg.org/#dom-select-options
- https://html.spec.whatwg.org/#concept-select-option-list

Firefox and Chrome agrees with the specification. However, WebKit was
returning all the option elements that are descendants of the select
element.

Test: imported/w3c/web-platform-tests/html/infrastructure/common-dom-interfaces/collections/htmloptionscollection.html

* html/HTMLOptionsCollection.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207181 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoSkipping loader/stateobjects tests on mac and ios-simulator debug.
ryanhaddad@apple.com [Wed, 12 Oct 2016 00:17:17 +0000 (00:17 +0000)]
Skipping loader/stateobjects tests on mac and ios-simulator debug.
https://bugs.webkit.org/show_bug.cgi?id=163307

Unreviewed test gardening.

* platform/ios-simulator/TestExpectations:
* platform/mac/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207180 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoMarkedBlock should know what objects are live during marking
fpizlo@apple.com [Tue, 11 Oct 2016 23:52:02 +0000 (23:52 +0000)]
MarkedBlock should know what objects are live during marking
https://bugs.webkit.org/show_bug.cgi?id=162309

Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

It used to be that we would forget which objects are live the moment we started collection.
That's because the flip at the beginning clears all mark bits.

But we already have a facility for tracking objects that are live-but-not-marked. It's called
newlyAllocated. So, instead of clearing mark bits, we want to just transfer them to
newlyAllocated. Then we want to clear all newlyAllocated after GC.

This implements such an approach, along with a versioning optimization for newlyAllocated.
Instead of walking the whole heap to clear newlyAllocated bits at the end of the GC, we bump
the newlyAllocatedVersion, which causes MarkedBlock to treat newlyAllocated as if it was
clear.

We could have even avoided allocating newlyAllocated in most cases, since empirically most
blocks are either completely empty or completely full. An earlier version of this patch did
this, but it was not better than this patch. In fact, it seemed to actually be worse for PLT
and membuster.

To validate this change, we now run the conservative scan after the beginMarking flip. And it
totally works!

This is a huge step towards concurrent GC. It means that we ought to be able to run the
allocator while marking. Since we already separately made it possible to run the barrier
while marking, this means that we're pretty much ready for some serious concurrency action.

This appears to be perf-neutral and space-neutral.

* JavaScriptCore.xcodeproj/project.pbxproj:
* bytecode/CodeBlock.cpp:
* bytecode/CodeBlock.h:
(JSC::CodeBlockSet::mark): Deleted.
* heap/CodeBlockSet.cpp:
(JSC::CodeBlockSet::writeBarrierCurrentlyExecuting):
(JSC::CodeBlockSet::clearCurrentlyExecuting):
(JSC::CodeBlockSet::writeBarrierCurrentlyExecutingCodeBlocks): Deleted.
* heap/CodeBlockSet.h:
* heap/CodeBlockSetInlines.h: Added.
(JSC::CodeBlockSet::mark):
* heap/ConservativeRoots.cpp:
* heap/Heap.cpp:
(JSC::Heap::markRoots):
(JSC::Heap::beginMarking):
(JSC::Heap::collectImpl):
(JSC::Heap::writeBarrierCurrentlyExecutingCodeBlocks):
(JSC::Heap::clearCurrentlyExecutingCodeBlocks):
* heap/Heap.h:
* heap/HeapUtil.h:
(JSC::HeapUtil::findGCObjectPointersForMarking):
* heap/MarkedAllocator.cpp:
(JSC::MarkedAllocator::isPagedOut):
* heap/MarkedBlock.cpp:
(JSC::MarkedBlock::Handle::Handle):
(JSC::MarkedBlock::Handle::sweepHelperSelectHasNewlyAllocated):
(JSC::MarkedBlock::Handle::stopAllocating):
(JSC::MarkedBlock::Handle::lastChanceToFinalize):
(JSC::MarkedBlock::Handle::resumeAllocating):
(JSC::MarkedBlock::aboutToMarkSlow):
(JSC::MarkedBlock::Handle::resetAllocated):
(JSC::MarkedBlock::resetMarks):
(JSC::MarkedBlock::setNeedsDestruction):
(JSC::MarkedBlock::Handle::didAddToAllocator):
(JSC::MarkedBlock::Handle::isLive):
(JSC::MarkedBlock::Handle::isLiveCell):
(JSC::MarkedBlock::clearMarks): Deleted.
* heap/MarkedBlock.h:
(JSC::MarkedBlock::Handle::newlyAllocatedVersion):
(JSC::MarkedBlock::Handle::hasAnyNewlyAllocated): Deleted.
(JSC::MarkedBlock::Handle::clearNewlyAllocated): Deleted.
* heap/MarkedBlockInlines.h:
(JSC::MarkedBlock::Handle::cellsPerBlock):
(JSC::MarkedBlock::Handle::isLive):
(JSC::MarkedBlock::Handle::isLiveCell):
(JSC::MarkedBlock::Handle::isNewlyAllocatedStale):
(JSC::MarkedBlock::Handle::hasAnyNewlyAllocatedWithSweep):
(JSC::MarkedBlock::Handle::hasAnyNewlyAllocated):
(JSC::MarkedBlock::heap):
(JSC::MarkedBlock::space):
(JSC::MarkedBlock::Handle::space):
(JSC::MarkedBlock::resetMarkingVersion): Deleted.
* heap/MarkedSpace.cpp:
(JSC::MarkedSpace::beginMarking):
(JSC::MarkedSpace::endMarking):
(JSC::MarkedSpace::clearNewlyAllocated): Deleted.
* heap/MarkedSpace.h:
(JSC::MarkedSpace::nextVersion):
(JSC::MarkedSpace::newlyAllocatedVersion):
(JSC::MarkedSpace::markingVersion): Deleted.
* runtime/SamplingProfiler.cpp:

Source/WTF:

This removes the atomicity mode, because it's not really used: it only affects the
concurrentBlah methods, but their only users turn on atomicity. This was useful because
previously, some binary Bitmap methods (like merge(const Bitmap&)) couldn't be used
effectively in the GC because some of the GC's bitmaps set the atomic mode and some didn't.
Removing this useless mode is the best solution.

Also added some new binary Bitmap methods: mergeAndClear(Bitmap& other) and
setAndClear(Bitmap& other). They perform their action on 'this' (either merge or set,
respectively) while also clearing the contents of 'other'. This is great for one of the GC
hot paths.

* wtf/Bitmap.h:
(WTF::WordType>::Bitmap):
(WTF::WordType>::get):
(WTF::WordType>::set):
(WTF::WordType>::testAndSet):
(WTF::WordType>::testAndClear):
(WTF::WordType>::concurrentTestAndSet):
(WTF::WordType>::concurrentTestAndClear):
(WTF::WordType>::clear):
(WTF::WordType>::clearAll):
(WTF::WordType>::nextPossiblyUnset):
(WTF::WordType>::findRunOfZeros):
(WTF::WordType>::count):
(WTF::WordType>::isEmpty):
(WTF::WordType>::isFull):
(WTF::WordType>::merge):
(WTF::WordType>::filter):
(WTF::WordType>::exclude):
(WTF::WordType>::forEachSetBit):
(WTF::WordType>::mergeAndClear):
(WTF::WordType>::setAndClear):
(WTF::=):
(WTF::WordType>::hash):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207179 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoArray.prototype.concat should not modify frozen objects.
mark.lam@apple.com [Tue, 11 Oct 2016 23:25:38 +0000 (23:25 +0000)]
Array.prototype.concat should not modify frozen objects.
https://bugs.webkit.org/show_bug.cgi?id=163302

Reviewed by Filip Pizlo.

JSTests:

* stress/array-concat-on-frozen-object.js: Added.

Source/JavaScriptCore:

The ES6 spec for Array.prototype.concat states that it uses the
CreateDataPropertyOrThrow() to add items to the result array.  The spec for
CreateDataPropertyOrThrow states:

"This abstract operation creates a property whose attributes are set to the same
defaults used for properties created by the ECMAScript language assignment
operator. Normally, the property will not already exist. If it does exist and is
not configurable or if O is not extensible, [[DefineOwnProperty]] will return
false causing this operation to throw a TypeError exception."

Since the properties of frozen objects are not extensible, not configurable, and
not writable, Array.prototype.concat should fail to write to the result array if
it is frozen.

Ref: https://tc39.github.io/ecma262/#sec-array.prototype.concat,
https://tc39.github.io/ecma262/#sec-createdatapropertyorthrow, and
https://tc39.github.io/ecma262/#sec-createdataproperty.

The fix consists of 2 parts:
1. moveElement() should use the PutDirectIndexShouldThrow mode when invoking
   putDirectIndex(), and
2. SparseArrayValueMap::putDirect() should check for the case where the property
   is read only.

(2) ensures that we don't write into a non-writable property.
(1) ensures that we throw a TypeError for attempts to write to a non-writeable
property.

* runtime/ArrayPrototype.cpp:
(JSC::moveElements):
* runtime/SparseArrayValueMap.cpp:
(JSC::SparseArrayValueMap::putDirect):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207178 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoFix assertion when creating first WebCore::URL from non-main thread after r207162
achristensen@apple.com [Tue, 11 Oct 2016 23:24:46 +0000 (23:24 +0000)]
Fix assertion when creating first WebCore::URL from non-main thread after r207162
https://bugs.webkit.org/show_bug.cgi?id=163304

Reviewed by Filip Pizlo.

This fixes assertions when running UserContentWorld.NormalWorld API tests.

* platform/text/TextEncodingRegistry.cpp:
(WebCore::buildBaseTextCodecMaps):
(WebCore::atomicCanonicalTextEncodingName):
The new URLParser requires a TextEncoding& in its constructor, which defaults to UTF8Encoding.
When creating the first TextEncoding in a process, it calls buildBaseTextCodecMaps which asserts
it's on the main thread because it initializes static variables.  Since we are getting a lock right
after this call anyway, just put this function call inside the lock.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207177 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agocolor-gamut media query shouldn't ASSERT on invalid values
dino@apple.com [Tue, 11 Oct 2016 23:20:39 +0000 (23:20 +0000)]
color-gamut media query shouldn't ASSERT on invalid values
https://bugs.webkit.org/show_bug.cgi?id=163303
<rdar://problem/28724566>

Reviewed by Simon Fraser.

Source/WebCore:

Remove the ASSERT_NOT_REACHED in the evaluation, since it
can be hit when there is a valid CSS keyword that is not
expected in the query.

Updated fast/media/mq-color-gamut.html

* css/MediaQueryEvaluator.cpp:
(WebCore::colorGamutEvaluate):

LayoutTests:

Add a 'none' test.

* fast/media/mq-color-gamut-expected.html:
* fast/media/mq-color-gamut.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207176 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoUpdate MediaStream events to stop using legacy [ConstructorTemplate=Event]
cdumez@apple.com [Tue, 11 Oct 2016 23:11:49 +0000 (23:11 +0000)]
Update MediaStream events to stop using legacy [ConstructorTemplate=Event]
https://bugs.webkit.org/show_bug.cgi?id=163289

Reviewed by Sam Weinig.

Source/WebCore:

Update MediaStream events to stop using legacy [ConstructorTemplate=Event]
and use regular constructors instead.

* Modules/mediastream/MediaStreamEvent.cpp:
(WebCore::MediaStreamEvent::create):
(WebCore::MediaStreamEvent::MediaStreamEvent):
* Modules/mediastream/MediaStreamEvent.h:
* Modules/mediastream/MediaStreamEvent.idl:
* Modules/mediastream/MediaStreamTrackEvent.cpp:
(WebCore::MediaStreamTrackEvent::create):
(WebCore::MediaStreamTrackEvent::MediaStreamTrackEvent):
* Modules/mediastream/MediaStreamTrackEvent.h:
* Modules/mediastream/MediaStreamTrackEvent.idl:
* Modules/mediastream/OverconstrainedErrorEvent.h:
(WebCore::OverconstrainedErrorEvent::create):
(WebCore::OverconstrainedErrorEvent::OverconstrainedErrorEvent):
(WebCore::OverconstrainedErrorEvent::~OverconstrainedErrorEvent): Deleted.
* Modules/mediastream/OverconstrainedErrorEvent.idl:
* Modules/mediastream/RTCDTMFToneChangeEvent.cpp:
(WebCore::RTCDTMFToneChangeEvent::create):
(WebCore::RTCDTMFToneChangeEvent::RTCDTMFToneChangeEvent):
* Modules/mediastream/RTCDTMFToneChangeEvent.h:
* Modules/mediastream/RTCDTMFToneChangeEvent.idl:
* Modules/mediastream/RTCTrackEvent.cpp:
(WebCore::RTCTrackEvent::create):
(WebCore::RTCTrackEvent::RTCTrackEvent):
* Modules/mediastream/RTCTrackEvent.h:
* Modules/mediastream/RTCTrackEvent.idl:

LayoutTests:

Update existing test cases now that we throw more exceptions on bad input.

* fast/events/constructors/overconstrained-error-event-constructor-expected.txt:
* fast/events/constructors/overconstrained-error-event-constructor.html:
* fast/mediastream/MediaStreamTrackEvent-constructor-expected.txt:
* fast/mediastream/MediaStreamTrackEvent-constructor.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207175 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoUpdate UIRequestEvent to stop using legacy [ConstructorTemplate=Event]
cdumez@apple.com [Tue, 11 Oct 2016 23:07:35 +0000 (23:07 +0000)]
Update UIRequestEvent to stop using legacy [ConstructorTemplate=Event]
https://bugs.webkit.org/show_bug.cgi?id=163288

Reviewed by Darin Adler.

Update UIRequestEvent to stop using legacy [ConstructorTemplate=Event]
and use a constructor as in the specification:
- https://dvcs.w3.org/hg/IndieUI/raw-file/default/src/indie-ui-events.html#UIRequestEvent

* Modules/indieui/UIRequestEvent.cpp:
(WebCore::UIRequestEvent::create):
(WebCore::UIRequestEvent::UIRequestEvent):
(WebCore::UIRequestEvent::createForBindings): Deleted.
* Modules/indieui/UIRequestEvent.h:
* Modules/indieui/UIRequestEvent.idl:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207174 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoImplement prefers-reduced-motion media query
dino@apple.com [Tue, 11 Oct 2016 22:45:22 +0000 (22:45 +0000)]
Implement prefers-reduced-motion media query
https://bugs.webkit.org/show_bug.cgi?id=163250
<rdar://problem/28704129>

Reviewed by Simon Fraser.

Source/WebCore:

Implement the prefers-reduced-motion media query, as
described in https://github.com/w3c/csswg-drafts/issues/442.

Tests: fast/media/mq-prefers-reduced-motion-forced-value.html
       fast/media/mq-prefers-reduced-motion.html

* Configurations/WebCoreTestSupport.xcconfig: Link against AppKit and UIKit.

* css/CSSValueKeywords.in: New keyword for "reduce".

* css/MediaFeatureNames.h: Add prefers-reduced-motion.
* css/MediaQueryEvaluator.cpp:
(WebCore::prefersReducedMotionEvaluate):
* css/MediaQueryExp.cpp:
(WebCore::featureWithValidIdent):
(WebCore::isFeatureValidWithoutValue):

* platform/Theme.h: New API to detect the system accessibility settings.
(WebCore::Theme::userPrefersReducedMotion):
* platform/ios/ThemeIOS.h:
* platform/ios/ThemeIOS.mm:
(WebCore::ThemeIOS::userPrefersReducedMotion):
* platform/mac/ThemeMac.h:
* platform/mac/ThemeMac.mm:
(WebCore::ThemeMac::userPrefersReducedMotion):

* testing/Internals.cpp: Expose the same API to internals, so that
a test can examine the value too.
(WebCore::Internals::userPrefersReducedMotion):
* testing/Internals.h:
* testing/Internals.idl:
* testing/Internals.mm:
(WebCore::Internals::userPrefersReducedMotion):

* page/Settings.h: New setting to override the system value...
* page/Settings.in:

* testing/InternalSettings.cpp: ... plumbed through internals.
(WebCore::InternalSettings::Backup::Backup):
(WebCore::InternalSettings::Backup::restoreTo):
(WebCore::InternalSettings::forcedPrefersReducedMotionValue):
(WebCore::InternalSettings::setForcedPrefersReducedMotionValue):
* testing/InternalSettings.h:
* testing/InternalSettings.idl:
* testing/Internals.cpp:
(WebCore::Internals::userPrefersReducedMotion):
* testing/Internals.h:
* testing/Internals.idl:
* testing/Internals.mm:
(WebCore::Internals::userPrefersReducedMotion):

LayoutTests:

One test checks the system value. The other test overrides
the system values to make sure as much as possible is working.

* fast/media/mq-prefers-reduced-motion-expected.html: Added.
* fast/media/mq-prefers-reduced-motion-forced-value-expected.html: Added.
* fast/media/mq-prefers-reduced-motion-forced-value.html: Added.
* fast/media/mq-prefers-reduced-motion.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207173 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoSkip tests added with r207155 that rely on touch events.
ryanhaddad@apple.com [Tue, 11 Oct 2016 22:37:06 +0000 (22:37 +0000)]
Skip tests added with r207155 that rely on touch events.

Unreviewed test gardening.

* platform/ios-simulator/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207172 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoAttempt to fix the Apple Internal Mac build following r207159
dbates@webkit.org [Tue, 11 Oct 2016 22:19:02 +0000 (22:19 +0000)]
Attempt to fix the Apple Internal Mac build following r207159
(https://bugs.webkit.org/show_bug.cgi?id=163244)

Source/WebKit/mac:

* WebView/WebView.mm:
(shouldRequireUserGestureToLoadVideo):

Source/WebKit2:

* UIProcess/API/Cocoa/WKWebView.mm:
(shouldRequireUserGestureToLoadVideo):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207171 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoAnnotate DOM API with CEReactions
rniwa@webkit.org [Tue, 11 Oct 2016 22:07:50 +0000 (22:07 +0000)]
Annotate DOM API with CEReactions
https://bugs.webkit.org/show_bug.cgi?id=163268

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Rebaseline tests now that more test cases are passing.

* web-platform-tests/custom-elements/reactions/Attr-expected.txt:
* web-platform-tests/custom-elements/reactions/ChildNode-expected.txt:
* web-platform-tests/custom-elements/reactions/DOMTokenList-expected.txt:
* web-platform-tests/custom-elements/reactions/Document-expected.txt:
* web-platform-tests/custom-elements/reactions/Element-expected.txt:
* web-platform-tests/custom-elements/reactions/NamedNodeMap-expected.txt:
* web-platform-tests/custom-elements/reactions/Node-expected.txt:
* web-platform-tests/custom-elements/reactions/ParentNode-expected.txt:
* web-platform-tests/custom-elements/reactions/Range-expected.txt:

Source/WebCore:

Added CEReactions IDL attribute to APIs defined in https://dom.spec.whatwg.org.

No new tests since existing tests cover the code change.
Added a dedicated code generation test: JSTestCEReactions.idl and TestCEReactionsStringifier.idl.

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateImplementation): Generate CustomElementReactionStack in attribute setters. In the case of PutForwards,
check the extended attributes of the target attribute's stringifier.
* bindings/scripts/test/JS/JSTestCEReactions.cpp: Added.
* bindings/scripts/test/JS/JSTestCEReactions.h: Added.
* bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp: Added.
* bindings/scripts/test/JS/JSTestCEReactionsStringifier.h: Added.
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::jsTestObjPrototypeFunctionMethodWithNeedsCustomElementReactionStack): Deleted.
* bindings/scripts/test/TestCEReactions.idl: Added.
* bindings/scripts/test/TestCEReactionsStringifier.idl: Added.
* bindings/scripts/test/TestObj.idl:
* dom/Attr.idl:
* dom/ChildNode.idl:
* dom/Document.idl:
* dom/Element.idl:
* dom/NamedNodeMap.idl:
* dom/Node.idl:
* dom/ParentNode.idl:
* dom/Range.idl:
* html/DOMTokenList.idl:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207170 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoUpdate CloseEvent to stop using legacy [ConstructorTemplate=Event]
cdumez@apple.com [Tue, 11 Oct 2016 22:03:04 +0000 (22:03 +0000)]
Update CloseEvent to stop using legacy [ConstructorTemplate=Event]
https://bugs.webkit.org/show_bug.cgi?id=163293

Reviewed by Darin Adler.

Source/WebCore:

Update CloseEvent to stop using legacy [ConstructorTemplate=Event] and
use a regular constructor as in the specification:
- https://html.spec.whatwg.org/multipage/comms.html#the-closeevent-interfaces

No new tests, updated existing test.

* Modules/websockets/CloseEvent.h:
(WebCore::CloseEvent::create):
(WebCore::CloseEvent::CloseEvent):
* Modules/websockets/CloseEvent.idl:

LayoutTests:

Update existing test to reflect a small behavior change. Passing an explicit
undefined as 'reason' members now initializes the attribute to the empty
string (the member's default value) instead of the string "undefined". This
new behavior matches Chrome and Firefox.

* fast/events/constructors/close-event-constructor-expected.txt:
* fast/events/constructors/close-event-constructor.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207169 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoClean up WebPageGroup somewhat
andersca@apple.com [Tue, 11 Oct 2016 22:01:45 +0000 (22:01 +0000)]
Clean up WebPageGroup somewhat
https://bugs.webkit.org/show_bug.cgi?id=163299

Reviewed by Tim Horton.

* Shared/API/c/WKDeprecatedFunctions.cpp:
(WKPageGroupCopyIdentifier):
Move this here from WKPageGroup.

(WKPageGroupAddUserContentFilter):
(WKPageGroupRemoveUserContentFilter):
(WKPageGroupRemoveAllUserContentFilters):
Just call directly into the user content controller.

* UIProcess/API/C/WKPageGroup.cpp:
(WKPageGroupAddUserStyleSheet):
(WKPageGroupRemoveAllUserStyleSheets):
(WKPageGroupAddUserScript):
(WKPageGroupRemoveAllUserScripts):
Just call directly into the user content controller.

* UIProcess/API/C/WKPageGroup.h:
* UIProcess/WebPageGroup.cpp:
(WebKit::WebPageGroup::addUserStyleSheet): Deleted.
(WebKit::WebPageGroup::addUserScript): Deleted.
(WebKit::WebPageGroup::removeAllUserStyleSheets): Deleted.
(WebKit::WebPageGroup::removeAllUserScripts): Deleted.
(WebKit::WebPageGroup::removeAllUserContent): Deleted.
(WebKit::WebPageGroup::addUserContentExtension): Deleted.
(WebKit::WebPageGroup::removeUserContentExtension): Deleted.
(WebKit::WebPageGroup::removeAllUserContentExtensions): Deleted.
Get rid of these, all their callers just call into the user content controller now.

* UIProcess/WebPageGroup.h:
(WebKit::WebPageGroup::identifier): Deleted.
(WebKit::WebPageGroup::sendToAllProcessesInGroup): Deleted.
Remove unused code.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207168 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoUpdate API test expectation after r207162.
achristensen@apple.com [Tue, 11 Oct 2016 21:58:20 +0000 (21:58 +0000)]
Update API test expectation after r207162.
https://bugs.webkit.org/show_bug.cgi?id=162660

* TestWebKitAPI/Tests/mac/LoadInvalidURLRequest.mm:
(-[LoadInvalidURLWebFrameLoadDelegate webView:didFailProvisionalLoadWithError:forFrame:]):
"https://www.example.com<>/" was an invalid URL with the old URL parser.
It is now a valid URL, but NSURL still considers it invalid.
This will be looked into more with https://bugs.webkit.org/show_bug.cgi?id=163127

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207167 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years ago[DOMJIT] DOMJIT::Patchpoint should have a way to receive constant folded arguments
utatane.tea@gmail.com [Tue, 11 Oct 2016 21:33:11 +0000 (21:33 +0000)]
[DOMJIT] DOMJIT::Patchpoint should have a way to receive constant folded arguments
https://bugs.webkit.org/show_bug.cgi?id=163224

Reviewed by Filip Pizlo.

Source/JavaScriptCore:

We use the GetGlobalObject DFG node to retrieve a global object from a DOM node.
This global object is necessary to check whether the world is normal before entering
the fast path of looking up the DOM wrapper cache.
We can sometimes constant-fold this GetGlobalObject. For example, if we performed
CheckStructure, the structure can offer the information about the possible result
of GetGlobalObject. By using this constant-folded global object, we can drop some
checks.

This patch introduces the way to tell the constant-folded values to DOMJIT::Patchpoint.
We pass DOMJIT::Value instead of DOMJIT::Reg as a parameter of DOMJIT::PatchpointParams.
This DOMJIT::Value is a pair of DOMJIT::Reg and JSValue. If the given parameter has a
constant value, this JSValue is filled with it.

* JavaScriptCore.xcodeproj/project.pbxproj:
* dfg/DFGDOMJITPatchpointParams.h:
(JSC::DFG::DOMJITPatchpointParams::DOMJITPatchpointParams):
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compileCallDOM):
(JSC::DFG::SpeculativeJIT::compileCheckDOM):
* domjit/DOMJITPatchpointParams.h:
(JSC::DOMJIT::PatchpointParams::at):
(JSC::DOMJIT::PatchpointParams::operator[]):
(JSC::DOMJIT::PatchpointParams::PatchpointParams):
* domjit/DOMJITValue.h: Copied from Source/JavaScriptCore/dfg/DFGDOMJITPatchpointParams.h.
(JSC::DOMJIT::Value::Value):
(JSC::DOMJIT::Value::isGPR):
(JSC::DOMJIT::Value::isFPR):
(JSC::DOMJIT::Value::isJSValueRegs):
(JSC::DOMJIT::Value::gpr):
(JSC::DOMJIT::Value::fpr):
(JSC::DOMJIT::Value::jsValueRegs):
(JSC::DOMJIT::Value::reg):
(JSC::DOMJIT::Value::value):
* ftl/FTLDOMJITPatchpointParams.h:
(JSC::FTL::DOMJITPatchpointParams::DOMJITPatchpointParams):
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileCheckDOM):
(JSC::FTL::DFG::LowerDFGToB3::compileCallDOM):

Source/WebCore:

* domjit/DOMJITHelpers.h:
(WebCore::DOMJITHelpers::toWrapper):
* domjit/JSNodeDOMJIT.cpp:
(WebCore::createCallDOMForOffsetAccess):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207166 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoWeb Inspector: Remove line highlight on primary execution line while stepping because...
commit-queue@webkit.org [Tue, 11 Oct 2016 21:24:35 +0000 (21:24 +0000)]
Web Inspector: Remove line highlight on primary execution line while stepping because it is distracting
https://bugs.webkit.org/show_bug.cgi?id=163294
<rdar://problem/28721176>

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2016-10-11
Reviewed by Timothy Hatcher.

* UserInterface/Views/TextEditor.js:
(WebInspector.TextEditor.prototype._updateExecutionLine):
When setting the primary execution line, remove default line highlights.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207165 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoAir should be able to replace constant materializations with adds
fpizlo@apple.com [Tue, 11 Oct 2016 20:51:53 +0000 (20:51 +0000)]
Air should be able to replace constant materializations with adds
https://bugs.webkit.org/show_bug.cgi?id=162749

Reviewed by Yusuke Suzuki.

We have a lot of defenses against emitting code that materializes huge contants. But if we do
end up with such code in the backend, it's better to convert those materializations into add
instructions by checking if other registers are known to contain nearby constants. That's
what this patch does.

* b3/air/AirFixObviousSpills.cpp:
* b3/testb3.cpp:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207164 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoB3->Air lowering needs the same defenses in effectiveAddr() that it has in tryAppendLea()
fpizlo@apple.com [Tue, 11 Oct 2016 20:37:51 +0000 (20:37 +0000)]
B3->Air lowering needs the same defenses in effectiveAddr() that it has in tryAppendLea()
https://bugs.webkit.org/show_bug.cgi?id=163264

Reviewed by Mark Lam.

When writing the lea patch (r207039), I was very careful about how I convert a Shl into a
BaseIndex scale. But I forgot to check if the older code for creating BaseIndexes for
effectiveAddr() got this right. It turns out that the older code missed the <<32 corner
case.

It's sad that the two paths can't share all of their code, but it's somewhat inevitable due
to how matching an address and matching a lea have to do very different things. Matching a
lea means creating an instruction that is distinct from other instructions to do multiple
math operations at once. Matching an address means making some instruction do extra work
for free. Also, address matching can take advantage of the fact that the offset is already
associated with the memory operation by strength reduction - lea matching can't do this; it
has to figure out Add(@value, $const) on its own. This change makes the situation slightly
more sane by adding a scaleForShl() helper that handles this weird case. It's based on the
new Shl handling from r207039, and exposes it as an API for effectiveAddr() to use.

The testLoadBaseIndexShift32() used to crash. I don't think that this case affects JS
content, since <<32 is such a bizarre outlier. I don't think we even have a path along
which the FTL would emit a 64-bit <<32. It probably won't even affect WebAssembly since
that uses 32-bit pointers, so we won't see 64-bit <<32 in effectiveAddr() there.

* b3/B3LowerToAir.cpp:
(JSC::B3::Air::LowerToAir::scaleForShl):
(JSC::B3::Air::LowerToAir::effectiveAddr):
(JSC::B3::Air::LowerToAir::tryAppendLea):
(JSC::B3::Air::LowerToAir::crossesInterference): Deleted.
* b3/testb3.cpp:
(JSC::B3::testLoadBaseIndexShift2):
(JSC::B3::testLoadBaseIndexShift32):
(JSC::B3::run):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207163 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoEnable URLParser by default
achristensen@apple.com [Tue, 11 Oct 2016 20:27:39 +0000 (20:27 +0000)]
Enable URLParser by default
https://bugs.webkit.org/show_bug.cgi?id=162660
<rdar://28601706>

Reviewed by Sam Weinig.

LayoutTests/imported/w3c:

* web-platform-tests/XMLHttpRequest/send-network-error-sync-events.sub-expected.txt:
* web-platform-tests/html/semantics/embedded-content/media-elements/interfaces/HTMLElement/HTMLTrackElement/src-expected.txt:
* web-platform-tests/html/semantics/scripting-1/the-script-element/fetch-src/failure-expected.txt:
These tests need more investigation.  See https://bugs.webkit.org/show_bug.cgi?id=163127
* web-platform-tests/url/a-element-expected.txt:
* web-platform-tests/url/a-element-xhtml-expected.txt:
* web-platform-tests/url/url-constructor-expected.txt:
* web-platform-tests/url/url-setters-expected.txt:
Many more tests pass.  Hooray!

Source/WebCore:

Covered by updates to many LayoutTests.

* platform/URLParser.cpp:
Make the default value true for URLParser::enabled.
This is the most impactful and well-documented one-line change I've ever written.

LayoutTests:

Many failing tests are now passing.

The tests in fast/url look like they are an old test suite, some of which we were failing.
We now pass many more of the tests.  Those results are updated.
Some URLs in the suite are invalid, and we now "fail" those tests.  Rather than update the
tests, I just changed the expectation to FAIL, which seems to be tolerable in this directory
because there were many tests whose result was FAIL.  Each such case is explained below.

* fast/dom/DOMURL/parsing-expected.txt:
* fast/dom/DOMURL/parsing.html:
Percent-encoded values in the host are supposed to be decoded according to the spec.
%2f decodes to '/' which is an invalid domain character.

* fast/dom/DOMURL/set-href-attribute-hash-expected.txt:
* fast/dom/DOMURL/set-href-attribute-hash.html:
Added a space to the domain (which is an invalid domain character and the others in this
test are not according to the spec) in order to continue to test that setting the hash of
an invalid URL does not change its href.

* fast/dom/DOMURL/set-href-attribute-protocol-expected.txt:
* fast/dom/DOMURL/set-href-attribute-protocol.html:
* fast/dom/HTMLAnchorElement/set-href-attribute-protocol-expected.txt:
* fast/dom/HTMLAnchorElement/set-href-attribute-protocol.html:
"http:??bar" now canonicalizes to "http://??bar" instead of adding one slash.

* fast/url/file-expected.txt:
* fast/url/file-http-base-expected.txt:
Updated results.  Many tests that were failing are now passing.

* fast/url/anchor-expected.txt:
Percent-encoding of non-ASCII characters in fragments now matches Firefox.

* fast/url/host-expected.txt:
Wide characters in the host such as http://%ef%bc%85%ef%bc%90%ef%bc%90.com/ should fail to parse.
This matches Chrome and the spec.
URLs with an empty host with a port should fail to parse.
This matches Chrome, Firefox, and the spec.

* fast/url/host-lowercase-per-scheme-expected.txt:
According to spec, hosts of non-special URLs should be parsed the same as special URL hosts.
Different browsers seem to have the existing behavior for different reasons.
See https://github.com/whatwg/url/issues/148 and https://bugs.webkit.org/show_bug.cgi?id=162885

* fast/url/idna2003-expected.txt:
* fast/url/invalid-urls-utf8-expected.txt:
Host encoding is now done according to the spec.

* fast/url/invalid-idn-expected.txt:
Neither Chrome, Firefox, nor the spec change invalid hosts to about:blank.

* fast/url/ipv4-expected.txt:
* fast/url/ipv6-expected.txt:
"http://[0:0::0:0:8:]/" should indeed be compressed to "http://[::8]/"
This kind of deterministic compression makes it so that two IPv6 addresses that are equal will
parse to URLs that are also equal, even if they are written differently.

* fast/url/path-expected.txt:
* fast/url/relative-expected.txt:
* fast/url/relative-win-expected.txt:
* fast/url/safari-extension-expected.txt:
Proper canonicalization of non-special hosts should be scheme://host/ or scheme:/// if there is no host.
safari-extension is not special.
Hosts should always be canonicalized to lowercase.

* fast/url/segments-expected.txt:
* fast/url/segments-from-data-url-expected.txt:
The path of "foo://" should be "/" not "//".
Extra slashes immediately after scheme:// should be ignored.
URLs with no host but a port like "http:@:80/www.apple.com" are now invalid, matching Chrome, Firefox, and the spec.

* fast/url/segments-userinfo-vs-host-expected.txt:
'@' can be in the user.  If it is, it is percent encoded.  This matches Chrome and Firefox.
"foo://" has a path of "/" not "//"
Extra slashes after the scheme such as in "foo://///////" are now ignored according to spec.

* fast/url/standard-url-expected.txt:
* fast/url/tab-and-newline-stripping-expected.txt:
http://[2001:5::042:44::0370:7334]/ is an invalid IPv6 address, so parsing it should fail.
It passed with URL::parse because we used to only check that the characters inside the []
were valid ipv6 characters, not that they made any sense or were in any kind of bounds.

* fast/url/url-credentials-escaping-expected.txt:
Credential encoding is now according to spec.

* http/tests/appcache/resources/x-frame-options-prevents-framing-test.html:
http:/path1/path2 relative to http://host/path3 now canonicalizes to http://host/path1/path2
instead of http://path1/path2 so this test, which I believe was missing the second slash in error,
needs to be fixed.

* imported/w3c/web-platform-tests/XMLHttpRequest/send-network-error-sync-events.sub-expected.txt:
Having a '}' in the host of a URL used to be invalid and it is now percent-escaped, matching Chrome and the spec.
This test still passes on w3c-test.org.  We can look into why it is failing locally later.
See webkit.org/b/163127

* fast/loader/redirect-to-invalid-url-using-javascript-calls-policy-delegate-expected.txt:
* fast/loader/redirect-to-invalid-url-using-meta-refresh-calls-policy-delegate-expected.txt:
* fast/loader/window-open-to-invalid-url-calls-policy-delegate-expected.txt:
http://HoSt is now being correctly interpreted as the host, and it is being punycode encoded if it's
non-ASCII and lowercased if it is.

* fast/forms/ValidityState-typeMismatch-url.html:
* fast/forms/ValidityState-typeMismatch-url-expected.txt:
Spaces in the host are invalid.  This matches Firefox and the spec.

* http/tests/inspector/network/copy-as-curl.html:
'{' and '}' are now percent encoded in the URL path.  This matches Firefox, Chrome, and the spec.

* fast/loader/location-port.html:
* fast/loader/location-port-expected.txt:
parsing or setting ports in URLs with no host is no longer supported.  This matches Firefox and Chrome.

* security/block-test-expected.txt:
* platform/mac/security/block-test-expected.txt:
out-of-bounds ports now cause parsing failures.

* imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/fetch-src/failure-expected.txt:
"http://[]/" now fails to parse because it is an invalid IPv6 host.

* fast/url/ipv6-expected.txt:
IPv4 addresses at the end of IPv6 addresses are now serialized as the equivalent hex value in IPv6 form.
This matches Chrome and the spec, and makes it so that equal IPv6 addresses written in different forms are equal.

* fast/loader/url-parse-1-expected.txt:
Extra or missing slashes and spaces around scheme:// are now handled according to the spec.

* http/tests/websocket/tests/hybi/handshake-ok-with-http-version-beyond-1_1-expected.txt:
The non-standard apple logo character is represented here by its non-standard Latin1 representation, 0xF0.
It was encoded as 0xF0 UTF-8 then percent encoded, which is %EF%A3%BF.
It is now encoded as the UTF-8 then percent encoded representation of its unicode value, 0xF8FF which matches other browsers.
This test is still valid, because it still verifies that the URLs in r199590 are rejected, and they still are.
See webkit.org/b/163127

* http/tests/contentextensions/make-https-expected.txt:
* contentfiltering/block-after-add-data-then-allow-unblock-expected.txt:
* contentfiltering/block-after-add-data-then-deny-unblock-expected.txt:
* contentfiltering/block-after-finished-adding-data-then-allow-unblock-expected.txt:
* contentfiltering/block-after-finished-adding-data-then-deny-unblock-expected.txt:
* contentfiltering/block-after-response-then-allow-unblock-expected.txt:
* contentfiltering/block-after-response-then-deny-unblock-expected.txt:
* contentfiltering/block-after-will-send-request-then-allow-unblock-expected.txt:
* contentfiltering/block-after-will-send-request-then-deny-unblock-expected.txt:
* fast/backgrounds/background-shorthand-after-set-backgroundSize-expected.txt:
* fast/backgrounds/background-shorthand-after-set-backgroundSize.html:
* fast/backgrounds/background-shorthand-with-backgroundSize-style-expected.txt:
* fast/backgrounds/background-shorthand-with-backgroundSize-style.html:
* fast/css/getComputedStyle/computed-style-border-image-expected.txt:
* fast/css/getComputedStyle/computed-style-border-image.html:
* fast/css/getComputedStyle/computed-style-cross-fade-expected.txt:
* fast/css/getComputedStyle/computed-style-cross-fade.html:
* fast/css/getComputedStyle/getComputedStyle-background-shorthand-expected.txt:
* fast/css/getComputedStyle/getComputedStyle-background-shorthand.html:
* fast/css/getComputedStyle/getComputedStyle-list-style-shorthand-expected.txt:
* fast/css/getComputedStyle/getComputedStyle-list-style-shorthand.html:
URLs with non-special schemes and no slash after the host now do when canonicalized.

* fast/css-generated-content/malformed-url.html:
This tested what happens when you have an invalid host.  | is now a valid host character.
I changed it to have a % in the host to test the same behavior.

* fast/loader/window-open-to-invalid-url-disallowed.html:
* fast/loader/window-open-to-invalid-url-disallowed-expected.txt:
* fast/loader/redirect-to-invalid-url-using-meta-refresh-disallowed.html:
* fast/loader/redirect-to-invalid-url-using-meta-refresh-disallowed-expected.txt:
* fast/loader/redirect-to-invalid-url-using-javascript-disallowed.html:
* fast/loader/redirect-to-invalid-url-using-javascript-disallowed-expected.txt:
"http://a=a&b=b" is no longer an invalid URL.  We used to consider the '&' character to be an invalid domain character
and we don't any more.  This matches Chrome, Firefox, and the spec.
To keep this test testing what happens if you have an invalid URL, I changed the '&' to a '%' which is an invalid domain character.

* fast/loader/file-URL-with-port-number.html:
File URLs with a port but no host are now invalid, matching Chrome and Firefox.  File URLs with a port and a host are Ok, though.

* platform/ios-simulator-wk1/fast/loader: Added.
* platform/ios-simulator-wk1/fast/loader/redirect-to-invalid-url-using-javascript-disallowed-expected.txt: Added.
* platform/ios-simulator-wk1/fast/loader/redirect-to-invalid-url-using-meta-refresh-disallowed-expected.txt: Added.
* platform/ios-simulator-wk1/fast/loader/window-open-to-invalid-url-disallowed-expected.txt: Added.
* platform/ios-simulator-wk1/imported/w3c/web-platform-tests/XMLHttpRequest: Added.
* platform/ios-simulator-wk1/imported/w3c/web-platform-tests/XMLHttpRequest/send-network-error-sync-events.sub-expected.txt: Added.
* platform/mac-wk1/fast/loader: Added.
* platform/mac-wk1/fast/loader/redirect-to-invalid-url-using-javascript-disallowed-expected.txt: Added.
* platform/mac-wk1/fast/loader/redirect-to-invalid-url-using-meta-refresh-disallowed-expected.txt: Added.
* platform/mac-wk1/fast/loader/window-open-to-invalid-url-disallowed-expected.txt: Added.
* platform/mac-wk1/imported: Added.
* platform/mac-wk1/imported/w3c: Added.
* platform/mac-wk1/imported/w3c/web-platform-tests: Added.
* platform/mac-wk1/imported/w3c/web-platform-tests/XMLHttpRequest: Added.
* platform/mac-wk1/imported/w3c/web-platform-tests/XMLHttpRequest/send-network-error-sync-events.sub-expected.txt: Added.
* platform/mac/security/block-test-expected.txt:
Differences between the URLParser and NSURL's parser cause differences in output for WK1 where NSURLRequests are made without serializing WebCore::ResourceRequests.
In particular, '{' in the host is newly accepted as a valid URL by URLParser, but it is percent-encoded by NSURL's parser.
See rdar://problem/28701914

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207162 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoUpdate my name in contributors.json
commit-queue@webkit.org [Tue, 11 Oct 2016 20:23:47 +0000 (20:23 +0000)]
Update my name in contributors.json
https://bugs.webkit.org/show_bug.cgi?id=163251

Patch by Edward O'Connor <eoconnor@apple.com> on 2016-10-11
Reviewed by Simon Fraser.

* Scripts/webkitpy/common/config/contributors.json:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207161 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoREGRESSION (r198251): -[UIWebView mediaPlaybackRequiresUserAction] defaults to NO
dbates@webkit.org [Tue, 11 Oct 2016 20:18:27 +0000 (20:18 +0000)]
REGRESSION (r198251): -[UIWebView mediaPlaybackRequiresUserAction] defaults to NO
https://bugs.webkit.org/show_bug.cgi?id=163259
<rdar://problem/28680515>

Reviewed by Jer Noble.

In WebKit1 on iOS we want to require user action to load and play videos by default and
allow an embedding app to change this behavior via -[UIWebView setMediaPlaybackRequiresUserAction:].
Following r198251, -[UIWebView mediaPlaybackRequiresUserAction] defaults to NO and videos
can load and play without being initiated by a user action.

* WebView/WebPreferences.mm:
(+[WebPreferences initialize]): Initialize the default value of the deprecated preference
WebKitRequiresUserGestureForMediaPlaybackPreferenceKey to YES on iOS. The value of this
preference takes precedence over the values of its replacement preferences
WebKitRequiresUserGestureForVideoPlaybackPreferenceKey and WebKitRequiresUserGestureForAudioPlaybackPreferenceKey.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207160 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years ago[iOS] REGRESSION (r197953): User gesture required to load video in iOS 9-built apps
dbates@webkit.org [Tue, 11 Oct 2016 20:17:58 +0000 (20:17 +0000)]
[iOS] REGRESSION (r197953): User gesture required to load video in iOS 9-built apps
https://bugs.webkit.org/show_bug.cgi?id=163244
<rdar://problem/27250015>

Reviewed by Jer Noble.

Source/WebCore:

Adds a new setting to toggle requiring a user gesture to load a video (enabled by default).
Disable this setting for apps built against iOS 9 or earlier.

Tests: media/loadedmetadata-fires-without-user-gesture-when-setRequiresUserGestureToLoadVideo-false.html
       media/require-user-gesture-to-load-video.html

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::HTMLMediaElement): Only require a user gesture to load a video
when Settings::requiresUserGestureToLoadVideo() is true.
* page/Settings.cpp: Enable setting requiresUserGestureToLoadVideo by default.
* page/Settings.in: Add setting, requiresUserGestureToLoadVideo.

Source/WebKit/mac:

Enable or disable the Setting::requiresUserGestureToLoadVideo() in legacy WebKit depending
on the version of iOS SDK that the app was linked against. We require a user gesture to
begin loading a video as of iOS 10.

* WebView/WebView.mm:
(shouldRequireUserGestureToLoadVideo):
(-[WebView _preferencesChanged:]): Modified to pass the WebKit requiresUserGestureToLoadVideo
preference to WebCore.

Source/WebKit2:

Enable or disable the Setting::requiresUserGestureToLoadVideo() in WebKit depending on the
version of iOS SDK that the app was linked against. We require a user gesture to begin
loading a video as of iOS 10.

* Shared/WebPreferencesDefinitions.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(shouldRequireUserGestureToLoadVideo): Added.
(-[WKWebView _initializeWithConfiguration:]): Set the requiresUserGestureToLoadVideo preference.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences): Modified to pass the WebKit requiresUserGestureToLoadVideo
preference to WebCore.

LayoutTests:

Add tests to ensure that Settings::setRequiresUserGestureToLoadVideo() behaves as expected.

* media/loadedmetadata-fires-without-user-gesture-when-setRequiresUserGestureToLoadVideo-false-expected.txt: Added.
* media/loadedmetadata-fires-without-user-gesture-when-setRequiresUserGestureToLoadVideo-false.html: Added.
* media/media-controls.js:
(clickPlayButton): Added.
* media/require-user-gesture-to-load-video-expected.txt: Added.
* media/require-user-gesture-to-load-video.html: Added.
* media/video-controls-transformed.html: Write in terms of clickPlayButton().
* media/video-controls-visible-audio-only.html: Ditto.
* media/video-fullscreeen-only-playback.html: Ditto.
* media/video-play-audio-require-user-gesture.html: Ditto.
* media/video-play-require-user-gesture.html: Ditto.
* media/video-test.js:
(passTest): Added.
* platform/ios-simulator/TestExpectations: Skip test media/require-user-gesture-to-load-video.html as
we need to fix <https://bugs.webkit.org/show_bug.cgi?id=163291> to support tapping the play button on iOS.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207159 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoFix the iOS build.
weinig@apple.com [Tue, 11 Oct 2016 19:52:25 +0000 (19:52 +0000)]
Fix the iOS build.

* bindings/js/JSDOMConvert.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207158 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years ago[iOS] Sandbox QuickLook previews
dbates@webkit.org [Tue, 11 Oct 2016 19:40:43 +0000 (19:40 +0000)]
[iOS] Sandbox QuickLook previews
https://bugs.webkit.org/show_bug.cgi?id=163240
<rdar://problem/25961633>

Fix bad merge following r207151.

* platform/network/cf/ResourceResponse.h: Define m_isQuickLook.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207157 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoAdd SynchronizedFixedQueue class
commit-queue@webkit.org [Tue, 11 Oct 2016 19:35:36 +0000 (19:35 +0000)]
Add SynchronizedFixedQueue class
https://bugs.webkit.org/show_bug.cgi?id=162478

Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2016-10-11
Reviewed by Geoffrey Garen.

Source/WTF:

This class represents a simple producer/consumer worker. It facilitates
synchronizing enqueuing to and dequeuing from a fixed size-queue. It uses
a single lock and a single condition to synchronize all its members among
the working threads. This means a single thread is active at any time and
and the other threads are blocked waiting for the lock to be released. Or
they are sleeping waiting for the condition to be satisfied.

* WTF.xcodeproj/project.pbxproj:
* wtf/SynchronizedFixedQueue.h: Added.
(WTF::SynchronizedFixedQueue::SynchronizedFixedQueue):
(WTF::SynchronizedFixedQueue::open): Restore the queue to its original state.
(WTF::SynchronizedFixedQueue::close): Wake all the sleeping threads with a closing state.
(WTF::SynchronizedFixedQueue::isOpen): Does the queue accept new items?
(WTF::SynchronizedFixedQueue::enqueue): Enqueue an item into the queue.
(WTF::SynchronizedFixedQueue::dequeue): Dequeue an item form the queue.

Tools:

Add a new test for SynchronizedFixedQueue. The test defines a new class
called ToUpperConverter which converts strings from lower case to upper
case. It creates two threads : (1) produce thread and (2) consume thread.
Here is what each thread does:

1. Main threads: Enqueues lower case strings into m_lowerQueue.
2. Produce thread: Dequeues lower case strings from m_lowerQueue and
   enqueue their upper case strings in the m_upperQueue.
3. Consume thread: Dequeues upper case strings from m_upperQueue.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WTF/SynchronizedFixedQueue.cpp: Added.
(TestWebKitAPI::textItem): A helper function which returns a lower case string given an index.
(TestWebKitAPI::toUpper): A helper function which Returns the upper case of a string.
(TestWebKitAPI::ToUpperConverter::ToUpperConverter):
(TestWebKitAPI::ToUpperConverter::produceQueue): Returns a workQueue for the produce thread.
(TestWebKitAPI::ToUpperConverter::consumeQueue): Returns a workQueue for the consume thread.
(TestWebKitAPI::ToUpperConverter::startProducing): Creates a thread for the producer.
(TestWebKitAPI::ToUpperConverter::startConsuming): Creates a thread for the consumer.
(TestWebKitAPI::ToUpperConverter::start): Starts both the producer and the consumer threads.
(TestWebKitAPI::ToUpperConverter::stopProducing): Terminates the producer thread.
(TestWebKitAPI::ToUpperConverter::stopConsuming): Terminates the consumer thread.
(TestWebKitAPI::ToUpperConverter::stop): Terminates both the producer and the consumer threads.
(TestWebKitAPI::ToUpperConverter::enqueueLower): Adds a lower case string to the m_lowerQueue on the main thread.
(TestWebKitAPI::ToUpperConverter::isProducing): Returns whether the producing thread is active.
(TestWebKitAPI::ToUpperConverter::isConsuming): Returns whether the consuming thread is active.
(TestWebKitAPI::ToUpperConverter::produceCount): Returns the number of produced elements.
(TestWebKitAPI::ToUpperConverter::consumeCount): Returns the number of consumed elements.
(TestWebKitAPI::TEST):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207156 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years ago[iOS] Sandbox QuickLook previews
dbates@webkit.org [Tue, 11 Oct 2016 19:29:47 +0000 (19:29 +0000)]
[iOS] Sandbox QuickLook previews
https://bugs.webkit.org/show_bug.cgi?id=163240
<rdar://problem/25961633>

Reviewed by Brent Fulgham.

Source/WebCore:

Use a unique origin for- and limit the capabilities of- QuickLook previews.

Tests: http/tests/quicklook/at-import-stylesheet-blocked.html
       http/tests/quicklook/base-url-blocked.html
       http/tests/quicklook/cross-origin-iframe-blocked.html
       http/tests/quicklook/csp-header-ignored.html
       http/tests/quicklook/document-domain-is-empty-string.html
       http/tests/quicklook/external-stylesheet-blocked.html
       http/tests/quicklook/hide-referer-on-navigation.html
       http/tests/quicklook/submit-form-blocked.html
       http/tests/quicklook/top-navigation-blocked.html

* dom/Document.cpp:
(WebCore::Document::processHttpEquiv): Call ContentSecurityPolicy::didReceiveHeader().
(WebCore::Document::processReferrerPolicy): Do not process referrer policy for QuickLook previews.
(WebCore::Document::initSecurityContext): Apply sandbox for QuickLook previews.
(WebCore::Document::shouldEnforceQuickLookSandbox): Added.
(WebCore::Document::applyQuickLookSandbox): Added.
* dom/Document.h:
* page/csp/ContentSecurityPolicy.h: Change accessibility of didReceiveHeader() from private to public.
(WebCore::ContentSecurityPolicy::processHTTPEquiv): Deleted.
* platform/network/cf/ResourceResponse.h:
(WebCore::ResourceResponse::isQuickLook): Added.
(WebCore::ResourceResponse::setIsQuickLook): Added.
* platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp:
(WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didReceiveResponse): Modified to mark
resource response as a QuickLook preview, if appropriate. Also remove the name of the first argument
and the need to use UNUSED_PARAM(connection) as we no longer make use of the first argument
following r207151.
* platform/network/ios/QuickLook.mm:
(-[WebResourceLoaderQuickLookDelegate _sendDidReceiveResponseIfNecessary]): Ditto.
* platform/network/mac/WebCoreResourceHandleAsDelegate.mm:
(-[WebCoreResourceHandleAsDelegate connection:didReceiveResponse:]): Ditto. Fix style nits,
including renaming the function argument "r" to "resource" to better describe its purpose.

LayoutTests:

Add tests to ensure that we sandbox QuickLook previews.

* http/tests/quicklook/at-import-stylesheet-blocked-expected.txt: Added.
* http/tests/quicklook/at-import-stylesheet-blocked.html: Added.
* http/tests/quicklook/base-url-blocked-expected.txt: Added.
* http/tests/quicklook/base-url-blocked.html: Added.
* http/tests/quicklook/cross-origin-iframe-blocked-expected.txt: Added.
* http/tests/quicklook/cross-origin-iframe-blocked.html: Added.
* http/tests/quicklook/csp-header-ignored-expected.txt: Added.
* http/tests/quicklook/csp-header-ignored.html: Added.
* http/tests/quicklook/document-domain-is-empty-string-expected.txt: Added.
* http/tests/quicklook/document-domain-is-empty-string.html: Added.
* http/tests/quicklook/external-stylesheet-blocked-expected.txt: Added.
* http/tests/quicklook/external-stylesheet-blocked.html: Added.
* http/tests/quicklook/hide-referer-on-navigation-expected.txt: Added.
* http/tests/quicklook/hide-referer-on-navigation.html: Added.
* http/tests/quicklook/resources/at-import-stylesheet-blocked.docx: Added.
* http/tests/quicklook/resources/base-url-blocked.docx: Added.
* http/tests/quicklook/resources/cross-origin-iframe-blocked.docx: Added.
* http/tests/quicklook/resources/document-domain-is-empty-string.docx: Added.
* http/tests/quicklook/resources/external-stylesheet-blocked.docx: Added.
* http/tests/quicklook/resources/fail.html: Added.
* http/tests/quicklook/resources/hide-referer-on-navigation.docx: Added.
* http/tests/quicklook/resources/http-equiv-blocked.docx: Added.
* http/tests/quicklook/resources/pass.docx: Added.
* http/tests/quicklook/resources/submit-form-blocked.docx: Added.
* http/tests/quicklook/resources/tap-at-point-and-notify-done.js: Added.
(tapAtPointAndNotifyDone):
(uiScript):
(tapAtPoint):
* http/tests/quicklook/resources/top-navigation-blocked.docx: Added.
* http/tests/quicklook/resources/word-document-with-csp-block-frame-ancestors.php: Added.
* http/tests/quicklook/submit-form-blocked-expected.txt: Added.
* http/tests/quicklook/submit-form-blocked.html: Added.
* http/tests/quicklook/top-navigation-blocked-expected.txt: Added.
* http/tests/quicklook/top-navigation-blocked.html: Added.
* platform/ios-simulator-wk1/TestExpectations: Skip tests that cannot run in DumpRenderTree
because uiController.singleTapAtPoint() is not implemented.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207155 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoFix bindings tests after r207150.
achristensen@apple.com [Tue, 11 Oct 2016 19:14:07 +0000 (19:14 +0000)]
Fix bindings tests after r207150.

* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::convertDictionary<TestObj::Dictionary>):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207154 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoExtend event stream to include interpolated events and add a force press test that...
commit-queue@webkit.org [Tue, 11 Oct 2016 18:38:49 +0000 (18:38 +0000)]
Extend event stream to include interpolated events and add a force press test that uses that interpolation
https://bugs.webkit.org/show_bug.cgi?id=163161

Patch by Megan Gardner <megan_gardner@apple.com> on 2016-10-11
Reviewed by Simon Fraser.

Added functionality to the event stream to allow for interpolated events.
Can now do long press, as well as a better way to do drag and other time-based
events that require a large stream of descrete HID events.
Added a basic force touch test to demostrate this interpolation.
Also updated the script to allow for iPhone 7 specific tests, as force touch
needs to be on a device that had force touch.

* Scripts/webkitpy/port/ios.py:
(IOSSimulatorPort):
* TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
* WebKitTestRunner/ios/HIDEventGenerator.mm:
(linearInterpolation):
(simpleCurveInterpolation):
(calculateNextCurveLocation):
(phaseFromString):
(interpolationFromString):
(-[HIDEventGenerator eventMaskFromEventInfo:]):
(-[HIDEventGenerator _createIOHIDEventWithInfo:]):
(-[HIDEventGenerator moveToPoints:touchCount:duration:]):
(-[HIDEventGenerator interpolatedEvents:]):
(-[HIDEventGenerator processEventsArray:withStartTime:]):
(-[HIDEventGenerator eventDispatchThreadEntry:]):
(simpleDragCurve): Deleted.
(calculateNextLocation): Deleted.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207153 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoURLParser should percent-encode non-ASCII and non-printable characters in fragment
achristensen@apple.com [Tue, 11 Oct 2016 18:28:50 +0000 (18:28 +0000)]
URLParser should percent-encode non-ASCII and non-printable characters in fragment
https://bugs.webkit.org/show_bug.cgi?id=163287

Reviewed by Brady Eidson.

Source/WebCore:

Based on discussion in https://github.com/whatwg/url/issues/150
If that discussion decides to keep the spec as-is (which keeps non-ASCII characters in the fragment
to match IE and Edge's behavior, which Chrome has followed for special schemes) then we can revert
this change later after enabling the URL parser.  Making this change keeps behavior matching Safari
and Firefox, as well as Chrome's handling of non-special schemes, such as data URLs.

Covered by updated API tests.

* platform/URLParser.cpp:
(WebCore::URLParser::appendToASCIIBuffer):
(WebCore::URLParser::copyURLPartsUntil):
(WebCore::URLParser::syntaxViolation):
(WebCore::URLParser::currentPosition):
(WebCore::URLParser::parse):
(WebCore::URLParser::fragmentSyntaxViolation): Deleted.
* platform/URLParser.h:
No more non-ASCII characters in canonicalized URLs.

Tools:

* TestWebKitAPI/Tests/WebCore/URLParser.cpp:
(TestWebKitAPI::TEST_F):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207152 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoRemove dead networking code
achristensen@apple.com [Tue, 11 Oct 2016 18:20:23 +0000 (18:20 +0000)]
Remove dead networking code
https://bugs.webkit.org/show_bug.cgi?id=163263

Reviewed by Daniel Bates.

.:

* Source/cmake/OptionsAppleWin.cmake:

Source/WebCore:

There are no more Cocoa platforms using CFURLConnection.
USE(CFNETWORK) is being replaced by USE(CFURLCONNECTION) and it is only used on the AppleWin port.

No change in behavior.

* WebCore.xcodeproj/project.pbxproj:
* WebCorePrefix.h:
* loader/DocumentLoader.h:
* loader/EmptyClients.h:
* loader/FrameLoaderClient.h:
* loader/ResourceLoader.cpp:
(WebCore::ResourceLoader::didReceiveAuthenticationChallenge):
* loader/ResourceLoader.h:
* loader/SubresourceLoader.h:
* loader/cf/ResourceLoaderCFNet.cpp:
* loader/cocoa/SubresourceLoaderCocoa.mm:
(WebCore::SubresourceLoader::willCacheResponse): Deleted.
* loader/mac/DocumentLoaderMac.cpp:
* loader/mac/ResourceLoaderMac.mm:
(WebCore::ResourceLoader::willCacheResponse): Deleted.
* page/mac/PageMac.mm:
(WebCore::Page::platformInitialize):
(WebCore::Page::addSchedulePair):
(WebCore::Page::removeSchedulePair):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForResponseToAuthenticationChallenge):
(WebCore::WebCoreNSURLAuthenticationChallengeClient::create): Deleted.
(WebCore::WebCoreNSURLAuthenticationChallengeClient::WebCoreNSURLAuthenticationChallengeClient): Deleted.
* platform/mac/WebCoreSystemInterface.h:
* platform/network/NetworkStorageSession.h:
* platform/network/ProtectionSpace.h:
* platform/network/ProtectionSpaceBase.cpp:
* platform/network/ResourceHandle.cpp:
* platform/network/ResourceHandle.h:
* platform/network/ResourceHandleClient.cpp:
* platform/network/ResourceHandleClient.h:
(WebCore::ResourceHandleClient::willCacheResponse):
(WebCore::ResourceHandleClient::shouldCacheResponse):
* platform/network/ResourceHandleInternal.h:
(WebCore::ResourceHandleInternal::ResourceHandleInternal):
* platform/network/ResourceRequestBase.cpp:
* platform/network/cf/AuthenticationCF.cpp:
(WebCore::AuthenticationChallenge::AuthenticationChallenge):
(WebCore::createCF):
(WebCore::core):
* platform/network/cf/AuthenticationCF.h:
* platform/network/cf/AuthenticationChallenge.h:
* platform/network/cf/CookieJarCFNet.cpp:
* platform/network/cf/CredentialStorageCFNet.cpp:
(WebCore::CredentialStorage::getFromPersistentStorage):
(WebCore::CredentialStorage::saveToPersistentStorage): Deleted.
* platform/network/cf/LoaderRunLoopCF.cpp:
* platform/network/cf/LoaderRunLoopCF.h:
* platform/network/cf/NetworkStorageSessionCFNet.cpp:
(WebCore::NetworkStorageSession::cookieStorage):
* platform/network/cf/ProtectionSpaceCFNet.cpp:
* platform/network/cf/ProtectionSpaceCFNet.h:
* platform/network/cf/ResourceError.h:
* platform/network/cf/ResourceErrorCF.cpp:
* platform/network/cf/ResourceHandleCFNet.cpp:
(WebCore::shouldSniffConnectionProperty):
(WebCore::ResourceHandle::createCFURLConnection):
(WebCore::ResourceHandle::start):
(WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
(WebCore::ResourceHandle::tryHandlePasswordBasedAuthentication):
(WebCore::ResourceHandle::receivedCredential):
(WebCore::ResourceHandle::schedule): Deleted.
(WebCore::ResourceHandle::unschedule): Deleted.
* platform/network/cf/ResourceHandleCFURLConnectionDelegate.cpp:
* platform/network/cf/ResourceHandleCFURLConnectionDelegate.h:
* platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
(WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::setupRequest):
(WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse):
(WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::canRespondToProtectionSpace):
* platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.h:
* platform/network/cf/ResourceRequest.h:
(WebCore::ResourceRequest::encodingRequiresPlatformData):
* platform/network/cf/ResourceRequestCFNet.cpp:
(WebCore::findCFURLRequestCopyContentDispositionEncodingFallbackArrayFunction):
(WebCore::ResourceRequest::doUpdatePlatformRequest):
(WebCore::ResourceRequest::doUpdatePlatformHTTPBody):
(WebCore::ResourceRequest::doUpdateResourceRequest):
(WebCore::ResourceRequest::setStorageSession):
(WebCore::findCFURLRequestSetContentDispositionEncodingFallbackArrayFunction): Deleted.
* platform/network/cf/ResourceRequestCFNet.h:
* platform/network/cf/ResourceResponse.h:
(WebCore::ResourceResponse::ResourceResponse):
* platform/network/cf/ResourceResponseCFNet.cpp:
(WebCore::ResourceResponse::cfURLResponse):
(WebCore::ResourceResponse::platformCertificateInfo):
* platform/network/cf/SynchronousLoaderClientCFNet.cpp:
* platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp:
(WebCore::SynchronousResourceHandleCFURLConnectionDelegate::setupRequest):
(WebCore::SynchronousResourceHandleCFURLConnectionDelegate::setupConnectionScheduling):
(WebCore::adjustMIMETypeIfNecessary):
(WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didReceiveResponse):
(WebCore::SynchronousResourceHandleCFURLConnectionDelegate::willCacheResponse):
(WebCore::SynchronousResourceHandleCFURLConnectionDelegate::canRespondToProtectionSpace):
* platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.h:
* platform/network/cocoa/CredentialCocoa.h:
* platform/network/cocoa/CredentialCocoa.mm:
(WebCore::Credential::Credential): Deleted.
(WebCore::Credential::cfCredential): Deleted.
* platform/network/cocoa/ProtectionSpaceCocoa.h:
* platform/network/cocoa/ProtectionSpaceCocoa.mm:
(WebCore::ProtectionSpace::ProtectionSpace): Deleted.
(WebCore::ProtectionSpace::cfSpace): Deleted.
* platform/network/cocoa/ResourceRequestCocoa.mm:
(WebCore::ResourceRequest::nsURLRequest):
* platform/network/cocoa/ResourceResponseCocoa.mm:
(WebCore::ResourceResponse::platformCertificateInfo):
(WebCore::ResourceResponse::nsURLResponse): Deleted.
(WebCore::ResourceResponse::ResourceResponse): Deleted.
* platform/network/ios/QuickLook.h:
* platform/network/ios/QuickLook.mm:
(-[WebQuickLookHandleAsDelegate initWithConnectionDelegate:]): Deleted.
(-[WebQuickLookHandleAsDelegate connection:didReceiveDataArray:]): Deleted.
(-[WebQuickLookHandleAsDelegate connection:didReceiveData:lengthReceived:]): Deleted.
(-[WebQuickLookHandleAsDelegate connectionDidFinishLoading:]): Deleted.
(-[WebQuickLookHandleAsDelegate connection:didFailWithError:]): Deleted.
(-[WebQuickLookHandleAsDelegate detachHandle]): Deleted.
(WebCore::QuickLookHandle::create): Deleted.
(WebCore::QuickLookHandle::cfResponse): Deleted.
* platform/network/ios/ResourceHandleIOS.mm: Removed.
* platform/network/ios/ResourceRequestIOS.mm: Removed.
* platform/network/mac/AuthenticationMac.mm:
(-[WebCoreAuthenticationClientAsChallengeSender setCFChallenge:]): Deleted.
(-[WebCoreAuthenticationClientAsChallengeSender cfChallenge]): Deleted.
(WebCore::core): Deleted.
(WebCore::mac): Deleted.
* platform/network/mac/CookieJarMac.mm:
(WebCore::setCookiesFromDOM):
(WebCore::cookieStorage):
(WebCore::addCookie):
* platform/network/mac/CredentialStorageMac.mm:
* platform/network/mac/FormDataStreamMac.h:
* platform/network/mac/FormDataStreamMac.mm:
* platform/network/mac/ResourceErrorMac.mm:
(NSErrorFromCFError): Deleted.
(WebCore::ResourceError::ResourceError): Deleted.
(WebCore::ResourceError::nsError): Deleted.
(WebCore::ResourceError::operator NSError *): Deleted.
* platform/network/mac/ResourceHandleMac.mm:
(WebCore::ResourceHandle::continueWillCacheResponse):
(WebCore::ResourceHandle::getConnectionTimingData): Deleted.
* platform/network/mac/ResourceRequestMac.mm: Removed.
* platform/network/mac/SynchronousLoaderClient.mm:
(WebCore::SynchronousLoaderClient::platformBadResponseError):
* platform/network/mac/WebCoreResourceHandleAsDelegate.h:
* platform/network/mac/WebCoreResourceHandleAsDelegate.mm:
* platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h:
* platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
* platform/network/mac/WebCoreURLResponse.mm:
(WebCore::synthesizeRedirectResponseIfNecessary):
* platform/win/TemporaryLinkStubs.cpp:
* testing/js/WebCoreTestSupportPrefix.h:

Source/WebKit:

* WebCoreSupport/WebResourceLoadScheduler.cpp:
(WebResourceLoadScheduler::scheduleLoad):

Source/WebKit/cf:

* WebCoreSupport/WebInspectorClientCF.cpp:

Source/WebKit/mac:

* Misc/WebDownload.mm:
(-[WebDownload _initWithLoadingCFURLConnection:request:response:delegate:proxy:]): Deleted.
* Misc/WebDownloadInternal.h:
* WebCoreSupport/WebFrameLoaderClient.mm:
(WebFrameLoaderClient::convertMainResourceLoadToDownload):
* WebView/WebPreferences.mm:
(+[WebPreferences _setCurrentNetworkLoaderSessionCookieAcceptPolicy:]):
* WebView/WebView.mm:
(-[WebView scheduleInRunLoop:forMode:]):
(-[WebView unscheduleFromRunLoop:forMode:]):

Source/WebKit/win:

* DefaultDownloadDelegate.h:
* WebCoreSupport/WebFrameLoaderClient.cpp:
(WebFrameLoaderClient::savePlatformDataToCachedFrame):
* WebCoreSupport/WebFrameNetworkingContext.cpp:
(WebFrameNetworkingContext::ensurePrivateBrowsingSession):
* WebCoreSupport/WebFrameNetworkingContext.h:
* WebCoreSupport/WebPlatformStrategies.cpp:
* WebDownload.h:
* WebError.cpp:
(WebError::localizedDescription):
(WebError::sslPeerCertificate):
* WebError.h:
* WebMutableURLRequest.cpp:
(WebMutableURLRequest::mutableCopy):
* WebURLAuthenticationChallenge.cpp:
(WebURLAuthenticationChallenge::initWithProtectionSpace):
(WebURLAuthenticationChallenge::initWithAuthenticationChallenge):
* WebURLResponse.cpp:
(WebURLResponse::sslPeerCertificate):
* WebURLResponse.h:
* WebView.cpp:
(WebView::setCacheModel):
(WebView::canHandleRequest):
(WebView::notifyPreferencesChanged):
(updateSharedSettingsFromPreferencesIfNeeded):

Source/WebKit2:

* NetworkProcess/Downloads/Download.h:
* NetworkProcess/Downloads/ios/DownloadIOS.mm: Removed.
* NetworkProcess/Downloads/mac/DownloadMac.mm:
* NetworkProcess/NetworkLoad.h:
* NetworkProcess/mac/NetworkLoadMac.mm:
(WebKit::NetworkLoad::willCacheResponseAsync): Deleted.
* Shared/Authentication/cocoa/AuthenticationManagerCocoa.mm:
(WebKit::AuthenticationManager::receivedCredential):
(WebKit::AuthenticationManager::receivedRequestToContinueWithoutCredential):
(WebKit::AuthenticationManager::receivedCancellation):
(WebKit::AuthenticationManager::receivedRequestToPerformDefaultHandling):
(WebKit::AuthenticationManager::receivedChallengeRejection):
* Shared/WebProcessCreationParameters.cpp:
(WebKit::WebProcessCreationParameters::encode):
(WebKit::WebProcessCreationParameters::decode):
* Shared/WebProcessCreationParameters.h:
* Shared/mac/WebCoreArgumentCodersMac.mm:
(IPC::ArgumentCoder<ResourceRequest>::encodePlatformData):
(IPC::ArgumentCoder<ResourceRequest>::decodePlatformData):
* WebKit2.xcodeproj/project.pbxproj:

Source/WTF:

* wtf/Platform.h:
* wtf/SchedulePair.h:
* wtf/SchedulePairMac.mm:

Tools:

* DumpRenderTree/DumpRenderTree.h:
* DumpRenderTree/config.h:
* DumpRenderTree/win/DumpRenderTree.cpp:
(main):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207151 268f45cc-cd09-0410-ab3c-d52691b4dbfc