WebKit-https.git
2 years ago[JSTests] fix test262 expectations following r206333
caitp@igalia.com [Sat, 24 Sep 2016 21:53:48 +0000 (21:53 +0000)]
[JSTests] fix test262 expectations following r206333
https://bugs.webkit.org/show_bug.cgi?id=162533

Reviewed by Yusuke Suzuki.

* test262.yaml:

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

2 years agoMove stylesheet change logic from Document to AuthorStyleSheets
antti@apple.com [Sat, 24 Sep 2016 13:10:39 +0000 (13:10 +0000)]
Move stylesheet change logic from Document to AuthorStyleSheets
https://bugs.webkit.org/show_bug.cgi?id=162488

Reviewed by Andreas Kling.

* WebView/WebHTMLView.mm:
(-[WebHTMLView reapplyStyles]):
(-[WebHTMLView _setPrinting:minimumPageLogicalWidth:logicalHeight:originalPageWidth:originalPageHeight:maximumShrinkRatio:adjustViewSize:paginateScreenContent:]):

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

2 years agoMove stylesheet change logic from Document to AuthorStyleSheets
antti@apple.com [Sat, 24 Sep 2016 12:28:48 +0000 (12:28 +0000)]
Move stylesheet change logic from Document to AuthorStyleSheets
https://bugs.webkit.org/show_bug.cgi?id=162488

Reviewed by Andreas Kling.

That's where it belongs.

* WebCore.xcodeproj/project.pbxproj:
* css/CSSStyleSheet.cpp:
(WebCore::CSSStyleSheet::didMutateRules):
(WebCore::CSSStyleSheet::didMutate):
(WebCore::CSSStyleSheet::clearOwnerNode):
* dom/AuthorStyleSheets.cpp:
(WebCore::AuthorStyleSheets::AuthorStyleSheets):
(WebCore::AuthorStyleSheets::flushPendingUpdates):
(WebCore::AuthorStyleSheets::scheduleOptimizedUpdate):
(WebCore::AuthorStyleSheets::didChange):
(WebCore::AuthorStyleSheets::optimizedUpdateTimerFired):
* dom/AuthorStyleSheets.h:
(WebCore::AuthorStyleSheets::hasPendingUpdate):
(WebCore::AuthorStyleSheets::pendingUpdateType): Deleted.
(WebCore::AuthorStyleSheets::setPendingUpdateType): Deleted.
(WebCore::AuthorStyleSheets::flushPendingUpdates): Deleted.
* dom/Document.cpp:
(WebCore::Document::Document):
(WebCore::Document::setContentLanguage):
(WebCore::Document::needsStyleRecalc):
(WebCore::Document::updateStyleIfNeeded):
(WebCore::Document::updateLayoutIgnorePendingStylesheets):
(WebCore::Document::didRemoveAllPendingStylesheet):
(WebCore::Document::processHttpEquiv):
(WebCore::Document::setSelectedStylesheetSet):
(WebCore::Document::updateHoverActiveState):

    Remove StyleResolverUpdateFlag argument that was misused to indicate sync style recalc.
    Clients can call updateStyleIfNeeded() directly though none of them appears to need it.

(WebCore::Document::optimizedStyleSheetUpdateTimerFired): Deleted.
(WebCore::Document::scheduleOptimizedStyleSheetUpdate): Deleted.
(WebCore::Document::styleResolverChanged): Deleted.
* dom/Document.h:
(WebCore::Document::needsStyleRecalc): Deleted.
* dom/ExtensionStyleSheets.cpp:
(WebCore::ExtensionStyleSheets::clearPageUserSheet):
(WebCore::ExtensionStyleSheets::updatePageUserSheet):
(WebCore::ExtensionStyleSheets::invalidateInjectedStyleSheetCache):
(WebCore::ExtensionStyleSheets::addUserStyleSheet):
(WebCore::ExtensionStyleSheets::addAuthorStyleSheetForTesting):
(WebCore::ExtensionStyleSheets::styleResolverChangedTimerFired):
* dom/InlineStyleSheetOwner.cpp:
(WebCore::InlineStyleSheetOwner::removedFromDocument):
* dom/ProcessingInstruction.cpp:
(WebCore::ProcessingInstruction::removedFrom):

    Also fix a bug that prevented document from rendering if a loading processing instruction was removed from the tree.
    This is tested by fast/dom/StyleSheet/detached-style-pi-2.xhtml (after other changes in this patch).

* dom/ShadowRoot.cpp:
(WebCore::ShadowRoot::updateStyle):
* html/HTMLLinkElement.cpp:
(WebCore::HTMLLinkElement::setDisabledState):
(WebCore::HTMLLinkElement::parseAttribute):
(WebCore::HTMLLinkElement::process):
(WebCore::HTMLLinkElement::removedFrom):
(WebCore::HTMLLinkElement::removePendingSheet):
* html/HTMLStyleElement.cpp:
(WebCore::HTMLStyleElement::parseAttribute):
* inspector/InspectorCSSAgent.cpp:
(WebCore::InspectorCSSAgent::forcePseudoState):
(WebCore::InspectorCSSAgent::resetPseudoStates):
* inspector/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::setEmulatedMedia):
* page/Frame.cpp:
(WebCore::Frame::setPrinting):
* page/FrameView.cpp:
(WebCore::FrameView::layout):
(WebCore::FrameView::setPagination):
(WebCore::FrameView::setViewportSizeForCSSViewportUnits):
* page/Page.cpp:
(WebCore::Page::setViewMode):
(WebCore::Page::setNeedsRecalcStyleInAllFrames):
(WebCore::Page::invalidateInjectedStyleSheetCacheInAllFrames):
* svg/SVGFontFaceElement.cpp:
(WebCore::SVGFontFaceElement::rebuildFontFace):
(WebCore::SVGFontFaceElement::removedFrom):
* xml/XMLTreeViewer.cpp:
(WebCore::XMLTreeViewer::transformDocumentToTreeView):
* xml/parser/XMLDocumentParser.cpp:
(WebCore::XMLDocumentParser::end):
* xml/parser/XMLDocumentParserLibxml2.cpp:
(WebCore::XMLDocumentParser::doEnd):

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

2 years agoMedia controls playhead does not animate smoothly while playing
wenson_hsieh@apple.com [Sat, 24 Sep 2016 01:38:52 +0000 (01:38 +0000)]
Media controls playhead does not animate smoothly while playing
https://bugs.webkit.org/show_bug.cgi?id=162399
<rdar://problem/28115680>

Reviewed by Beth Dakin.

Source/WebCore:

The media controls playhead currently does not animate smoothly during playback because we don't specify a
playback rate when updating the WebPlaybackControlsManager's timing value. However, simply setting this timing
value to the current playback rate (as known to the UI process) results in the UI process receiving multiple
updates from the web process where the current time is equal (or even less than) the time at which media began
to play, which results in the playhead seeking backwards to the start time multiple times when playing or
resuming media.

To address this, in WebCore, we inform the playback session model of the media time when playback begins (i.e.
a `playing` or `play` event is fired). This message precedes both the "rate changed" and "current time changed"
messages.

Unit tests to be added in a future patch.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::notifyAboutPlaying):
(WebCore::HTMLMediaElement::setReadyState):
(WebCore::HTMLMediaElement::playInternal):
* html/HTMLMediaElement.h:
(WebCore::HTMLMediaElement::playbackStartedTime):
* platform/cocoa/WebPlaybackSessionModel.h:
(WebCore::WebPlaybackSessionModelClient::playbackStartedTimeChanged):
(WebCore::WebPlaybackSessionModelClient::bufferedTimeChanged): Deleted.
* platform/cocoa/WebPlaybackSessionModelMediaElement.h:
* platform/cocoa/WebPlaybackSessionModelMediaElement.mm:
(WebPlaybackSessionModelMediaElement::updateForEventName):
(WebPlaybackSessionModelMediaElement::playbackStartedTime):
* platform/ios/WebVideoFullscreenControllerAVKit.mm:
* platform/mac/WebPlaybackSessionInterfaceMac.h:
* platform/mac/WebPlaybackSessionInterfaceMac.mm:
(WebCore::WebPlaybackSessionInterfaceMac::currentTimeChanged):
(WebCore::WebPlaybackSessionInterfaceMac::rateChanged):
(WebCore::WebPlaybackSessionInterfaceMac::beginScrubbing):
(WebCore::WebPlaybackSessionInterfaceMac::endScrubbing):
(WebCore::WebPlaybackSessionInterfaceMac::updatePlaybackControlsManagerTiming):

Source/WebKit2:

See WebCore ChangeLog for more details.

In the UI process, we update the WebPlaybackSessionManager's timing value when the rate or current time changes.
Each AVValueTiming is generated from the current time, system anchor time, and playback rate. The behavior of
the first two properties is unaffected. However, the rate used to update the timing value is the effective
playback rate, which is equal to the playback rate unless we are (1) not playing, (2) interacting with the media
controls in such a way that the media is essentially not playing, or (3) the current time precedes the playback
start time, accounting for playback direction. In these cases, our effective playback rate is 0, which means
that we do not animate the playhead.

* UIProcess/Cocoa/WebPlaybackSessionManagerProxy.h:
* UIProcess/Cocoa/WebPlaybackSessionManagerProxy.messages.in:
* UIProcess/Cocoa/WebPlaybackSessionManagerProxy.mm:
(WebKit::WebPlaybackSessionModelContext::beginScrubbing):
(WebKit::WebPlaybackSessionModelContext::endScrubbing):
(WebKit::WebPlaybackSessionModelContext::setPlaybackStartedTime):
(WebKit::WebPlaybackSessionModelContext::setCurrentTime):
(WebKit::WebPlaybackSessionManagerProxy::setPlaybackStartedTime):
* WebProcess/cocoa/WebPlaybackSessionManager.h:
* WebProcess/cocoa/WebPlaybackSessionManager.mm:
(WebKit::WebPlaybackSessionInterfaceContext::playbackStartedTimeChanged):
(WebKit::WebPlaybackSessionManager::playbackStartedTimeChanged):

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

2 years agoNeed a store-load fence between setting cell state and visiting the object in SlotVisitor
fpizlo@apple.com [Sat, 24 Sep 2016 00:47:30 +0000 (00:47 +0000)]
Need a store-load fence between setting cell state and visiting the object in SlotVisitor
https://bugs.webkit.org/show_bug.cgi?id=162354

Reviewed by Mark Lam.

Source/JavaScriptCore:

This was meant to be a small change, but then it became bigger as I found small
opportunities for improving this code. This adds a store-load fence and is performance-
neutral. That's probably partly due to other optimizations that I did to visitChildren().

Initially, I found that adding an mfence as a store-load fence was terribly expensive. So,
I thought that I needed to buffer up a bunch of objects, set their states, do one mfence,
and then visit all of them. This seemed like a win, so I went with it. Unfortunately, this
made no sense for two reasons:

- I shouldn't use mfence. I should use ortop (lock orl $0, (%rsp)) instead. Ortop is
  basically free, and it's what WTF now uses for storeLoadFence().

- My data saying that buffering up objects was not a slow-down was wrong. That was actually
  almost as expensive as the mfence.

But in order to implement that, I made some other improvements that I think we should stick
with:

- SlotVisitor::visitChildren() now uses a switch on type. This replaces what used to be
  some nasty ClassInfo look-ups.

- We no longer save the object's old CellState. We would do that so that we would know what
  state the object had been before we blackened it. But I believe that the more logical
  solution is to have two kinds of black - one for black-for-the-first-time objects and one
  for repeat offenders. This is a lot easier to reason about, since you can now just figure
  this out by looking at the cell directly.

The latter change meant rewiring a bunch of barriers. It didn't make them any more
expensive.

Relanding after fixing a nasty build failure in cloop and elsewhere.

* JavaScriptCore.xcodeproj/project.pbxproj:
* assembler/AbstractMacroAssembler.h:
(JSC::isARMv7IDIVSupported): Deleted.
(JSC::isARM64): Deleted.
(JSC::isX86): Deleted.
(JSC::isX86_64): Deleted.
(JSC::optimizeForARMv7IDIVSupported): Deleted.
(JSC::optimizeForARM64): Deleted.
(JSC::optimizeForX86): Deleted.
(JSC::optimizeForX86_64): Deleted.
* assembler/CPU.h: Added.
(JSC::isARMv7IDIVSupported):
(JSC::isARM64):
(JSC::isX86):
(JSC::isX86_64):
(JSC::optimizeForARMv7IDIVSupported):
(JSC::optimizeForARM64):
(JSC::optimizeForX86):
(JSC::optimizeForX86_64):
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::emitStoreBarrier):
* heap/CellState.h:
(JSC::isBlack):
(JSC::blacken):
* heap/Heap.cpp:
(JSC::Heap::addToRememberedSet):
* heap/Heap.h:
* heap/HeapInlines.h:
(JSC::Heap::writeBarrier):
(JSC::Heap::reportExtraMemoryVisited):
(JSC::Heap::reportExternalMemoryVisited):
* heap/MarkStack.cpp:
* heap/MarkStack.h:
* heap/SlotVisitor.cpp:
(JSC::SlotVisitor::visitChildren):
* heap/SlotVisitor.h:
* heap/SlotVisitorInlines.h:
(JSC::SlotVisitor::reportExtraMemoryVisited):
(JSC::SlotVisitor::reportExternalMemoryVisited):
* jit/AssemblyHelpers.h:
(JSC::AssemblyHelpers::jumpIfIsRememberedOrInEden):
* llint/LLIntData.cpp:
(JSC::LLInt::Data::performAssertions):
* llint/LowLevelInterpreter.asm:
* llint/LowLevelInterpreter32_64.asm:
* llint/LowLevelInterpreter64.asm:
* runtime/JSObject.h:
(JSC::isJSFinalObject):

Source/WTF:

Fix this on x86-32.

* wtf/Atomics.h:
(WTF::x86_ortop):

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

2 years agoASSERTION FAILED: !newRelayoutRoot.container() || is<RenderView>(newRelayoutRoot...
zalan@apple.com [Sat, 24 Sep 2016 00:45:48 +0000 (00:45 +0000)]
ASSERTION FAILED: !newRelayoutRoot.container() || is<RenderView>(newRelayoutRoot.container()) || !newRelayoutRoot.container()->needsLayout() while loading sohu.com
https://bugs.webkit.org/show_bug.cgi?id=162466

Reviewed by Simon Fraser.

Source/WebCore:

When we come across a out-of-flow positioned renderer during layout, we add it to a tracker map with
its containing block (calling RenderBlock::insertPositionedObject).
It ensures that a containing block can easily access to the out-of-flow positioned descendants during layout/painting/hittesting.
We do it even when the containing block - positioned renderer pair is already in this tracker map.
RenderBlock::insertPositionedObject() eagerly sets the positioned-child-needs-layout flag on the containing block
assuming it needs to layout this descendant later in the layout phase.
This patch ensure that we only flag the containing block dirty when the descendant needs layout.

Test: fast/block/positioning/subtree-assert-when-positioned-element-dirties-containing-block.html

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::insertPositionedObject):

LayoutTests:

* fast/block/positioning/subtree-assert-when-positioned-element-dirties-containing-block-expected.txt: Added.
* fast/block/positioning/subtree-assert-when-positioned-element-dirties-containing-block.html: Added.

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

2 years agoRemove debug flag for flaky test js/regress-139548.html.
ryanhaddad@apple.com [Sat, 24 Sep 2016 00:26:28 +0000 (00:26 +0000)]
Remove debug flag for flaky test js/regress-139548.html.
https://bugs.webkit.org/show_bug.cgi?id=160017

Unreviewed test gardening.

* platform/mac-wk2/TestExpectations:

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

2 years agoUpdate TestExpectations to mark media/controls/inline-elements-dropoff-order.html...
ryanhaddad@apple.com [Sat, 24 Sep 2016 00:21:00 +0000 (00:21 +0000)]
Update TestExpectations to mark media/controls/inline-elements-dropoff-order.html as failing on Sierra.
https://bugs.webkit.org/show_bug.cgi?id=162494

Unreviewed test gardening.
* platform/mac/TestExpectations:

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

2 years agoMarking imported/w3c/web-platform-tests/media-source/mediasource-preload.html as...
ryanhaddad@apple.com [Sat, 24 Sep 2016 00:17:26 +0000 (00:17 +0000)]
Marking imported/w3c/web-platform-tests/media-source/mediasource-preload.html as flaky on Sierra.
https://bugs.webkit.org/show_bug.cgi?id=162523

Unreviewed test gardening.

* platform/mac/TestExpectations:

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

2 years agoWeb Inspector: Fix typo in event name
commit-queue@webkit.org [Sat, 24 Sep 2016 00:07:03 +0000 (00:07 +0000)]
Web Inspector: Fix typo in event name
https://bugs.webkit.org/show_bug.cgi?id=162519

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2016-09-23
Reviewed by Matt Baker.

* UserInterface/Views/CSSStyleDeclarationTextEditor.js:

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

2 years ago[Binding] Use unchekcedArgument if argumentCount is already checked
utatane.tea@gmail.com [Fri, 23 Sep 2016 23:57:26 +0000 (23:57 +0000)]
[Binding] Use unchekcedArgument if argumentCount is already checked
https://bugs.webkit.org/show_bug.cgi?id=162502

Reviewed by Geoffrey Garen.

It is not necessary to use `exec->argument(n)` after checking the argument exists.
This patch changes `argument(n)` to `uncheckedArgument(n)` if we already proved that
the argument exists. This change drops branches generated by `exec->argument(n)`.
And it is good for small DOM operations in which DOM binding code occupies large
part of entire processing. This patch and another small patch[1] offer roughly 5%
improvement in Dromaeo dom-attr's getAttribute and setAttribute tests.

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

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateParametersCheck): GenerateParameterCheck requires GenerateArgumentsCountCheck.
As a result, existence of mandatory arguments are already checked. We can use `uncheckedArgument(n)`
for mandatory arguments.
* bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
(WebCore::jsTestActiveDOMObjectPrototypeFunctionExcitingFunction):
(WebCore::jsTestActiveDOMObjectPrototypeFunctionPostMessage):
* bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
(WebCore::jsTestCustomNamedGetterPrototypeFunctionAnotherFunction):
* bindings/scripts/test/JS/JSTestEventTarget.cpp:
(WebCore::jsTestEventTargetPrototypeFunctionItem):
* bindings/scripts/test/JS/JSTestGlobalObject.cpp:
(WebCore::jsTestGlobalObjectInstanceFunctionRegularOperation):
(WebCore::jsTestGlobalObjectInstanceFunctionEnabledAtRuntimeOperation1):
(WebCore::jsTestGlobalObjectInstanceFunctionEnabledAtRuntimeOperation2):
* bindings/scripts/test/JS/JSTestInterface.cpp:
(WebCore::JSTestInterfaceConstructor::construct):
(WebCore::jsTestInterfacePrototypeFunctionImplementsMethod2):
(WebCore::jsTestInterfacePrototypeFunctionSupplementalMethod2):
* bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
(WebCore::jsTestMediaQueryListListenerPrototypeFunctionMethod):
* bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
(WebCore::JSTestNamedConstructorNamedConstructor::construct):
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::JSTestObjConstructor::construct):
(WebCore::jsTestObjPrototypeFunctionEnabledAtRuntimeOperation1):
(WebCore::jsTestObjPrototypeFunctionEnabledAtRuntimeOperation2):
(WebCore::jsTestObjPrototypeFunctionVoidMethodWithArgs):
(WebCore::jsTestObjPrototypeFunctionByteMethodWithArgs):
(WebCore::jsTestObjPrototypeFunctionOctetMethodWithArgs):
(WebCore::jsTestObjPrototypeFunctionLongMethodWithArgs):
(WebCore::jsTestObjPrototypeFunctionObjMethodWithArgs):
(WebCore::jsTestObjPrototypeFunctionMethodWithArgTreatingNullAsEmptyString):
(WebCore::jsTestObjPrototypeFunctionMethodWithXPathNSResolverParameter):
(WebCore::jsTestObjPrototypeFunctionNullableStringSpecialMethod):
(WebCore::jsTestObjPrototypeFunctionMethodWithEnumArg):
(WebCore::jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows):
(WebCore::jsTestObjPrototypeFunctionMethodWithUSVStringArg):
(WebCore::jsTestObjPrototypeFunctionMethodWithNullableUSVStringArg):
(WebCore::jsTestObjPrototypeFunctionMethodWithUSVStringArgTreatingNullAsEmptyString):
(WebCore::jsTestObjPrototypeFunctionSerializedValue):
(WebCore::jsTestObjPrototypeFunctionOptionsObject):
(WebCore::jsTestObjPrototypeFunctionPrivateMethod):
(WebCore::jsTestObjPrototypeFunctionPublicAndPrivateMethod):
(WebCore::jsTestObjPrototypeFunctionAddEventListener):
(WebCore::jsTestObjPrototypeFunctionRemoveEventListener):
(WebCore::jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg):
(WebCore::jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs):
(WebCore::jsTestObjPrototypeFunctionMethodWithCallbackArg):
(WebCore::jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackArg):
(WebCore::jsTestObjPrototypeFunctionMethodWithCallbackFunctionArg):
(WebCore::jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackFunctionArg):
(WebCore::jsTestObjConstructorFunctionStaticMethodWithCallbackArg):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod1):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod2):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod3):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod4):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod5):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod6):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod7):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod8):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod9):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod10):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod11):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter1):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter2):
(WebCore::jsTestObjConstructorFunctionOverloadedMethod11):
(WebCore::jsTestObjConstructorFunctionOverloadedMethod12):
(WebCore::jsTestObjPrototypeFunctionClassMethodWithClamp):
(WebCore::jsTestObjPrototypeFunctionClassMethodWithEnforceRange):
(WebCore::jsTestObjPrototypeFunctionMethodWithUnsignedLongSequence):
(WebCore::jsTestObjPrototypeFunctionStringArrayFunction):
(WebCore::jsTestObjPrototypeFunctionDomStringListFunction):
(WebCore::jsTestObjPrototypeFunctionMethodWithAndWithoutNullableSequence):
(WebCore::jsTestObjPrototypeFunctionGetElementById):
(WebCore::jsTestObjPrototypeFunctionConvert1):
(WebCore::jsTestObjPrototypeFunctionConvert2):
(WebCore::jsTestObjPrototypeFunctionConvert3):
(WebCore::jsTestObjPrototypeFunctionConvert4):
(WebCore::jsTestObjPrototypeFunctionVariadicStringMethod):
(WebCore::jsTestObjPrototypeFunctionVariadicDoubleMethod):
(WebCore::jsTestObjPrototypeFunctionVariadicNodeMethod):
(WebCore::jsTestObjPrototypeFunctionAny):
(WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithFloatArgumentPromise):
(WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction1Promise):
(WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction2Promise):
(WebCore::jsTestObjPrototypeFunctionConditionalOverload1):
(WebCore::jsTestObjPrototypeFunctionConditionalOverload2):
(WebCore::jsTestObjPrototypeFunctionSingleConditionalOverload1):
(WebCore::jsTestObjPrototypeFunctionSingleConditionalOverload2):
(WebCore::jsTestObjPrototypeFunctionAttachShadowRoot):
* bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
(WebCore::constructJSTestOverloadedConstructors1):
(WebCore::constructJSTestOverloadedConstructors2):
(WebCore::constructJSTestOverloadedConstructors3):
(WebCore::constructJSTestOverloadedConstructors4):
* bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
(WebCore::constructJSTestOverloadedConstructorsWithSequence2):
* bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
(WebCore::jsTestOverrideBuiltinsPrototypeFunctionNamedItem):
* bindings/scripts/test/JS/JSTestTypedefs.cpp:
(WebCore::JSTestTypedefsConstructor::construct):
(WebCore::jsTestTypedefsPrototypeFunctionSetShadow):
(WebCore::jsTestTypedefsPrototypeFunctionMethodWithSequenceArg):
(WebCore::jsTestTypedefsPrototypeFunctionNullableSequenceArg):
(WebCore::jsTestTypedefsPrototypeFunctionFuncWithClamp):
(WebCore::jsTestTypedefsPrototypeFunctionStringSequenceFunction):
(WebCore::jsTestTypedefsPrototypeFunctionStringSequenceFunction2):
(WebCore::jsTestTypedefsPrototypeFunctionCallWithSequenceThatRequiresInclude):

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

2 years agoRefactor URLParser
achristensen@apple.com [Fri, 23 Sep 2016 23:40:46 +0000 (23:40 +0000)]
Refactor URLParser
https://bugs.webkit.org/show_bug.cgi?id=162518

Reviewed by Brady Eidson.

Use a helper function to determine the currentPosition instead of always determining position based on the
size of the buffer.  Soon there will be nothing in the buffer in the common case where there are no syntax errors.
Also make more static functions into methods.  Give IPv6Addresses and IPv4Addresses names.  Start adding syntaxError stubs.

No change in behavior.  Covered by API tests.

* platform/URLParser.cpp:
(WebCore::URLParser::incrementIteratorSkippingTabAndNewLine):
(WebCore::URLParser::isWindowsDriveLetter):
(WebCore::URLParser::appendToASCIIBuffer):
(WebCore::URLParser::syntaxError):
(WebCore::URLParser::currentPosition):
(WebCore::URLParser::URLParser):
(WebCore::URLParser::parse):
(WebCore::URLParser::parseAuthority):
(WebCore::URLParser::appendNumberToASCIIBuffer):
(WebCore::URLParser::serializeIPv4):
(WebCore::URLParser::serializeIPv6Piece):
(WebCore::URLParser::serializeIPv6):
(WebCore::URLParser::parseIPv4Host):
(WebCore::URLParser::parseIPv6Host):
(WebCore::URLParser::parsePort):
(WebCore::URLParser::parseHostAndPort):
(WebCore::append): Deleted.
(WebCore::serializeIPv4): Deleted.
(WebCore::serializeIPv6Piece): Deleted.
(WebCore::serializeIPv6): Deleted.
(WebCore::parseIPv4Host): Deleted.
(WebCore::parseIPv6Host): Deleted.
* platform/URLParser.h:

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

2 years ago[JSC] add //@ skip line for JSTests/stress/async-await-syntax.js
caitp@igalia.com [Fri, 23 Sep 2016 23:26:01 +0000 (23:26 +0000)]
[JSC] add //@ skip line for JSTests/stress/async-await-syntax.js
http://bugs.webkit.org/show_bug.cgi?id=161409

* stress/async-await-syntax.js:

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

2 years ago[mac-sierra] 2 WKWebViewCandidateTests API test failures
wenson_hsieh@apple.com [Fri, 23 Sep 2016 22:54:39 +0000 (22:54 +0000)]
[mac-sierra] 2 WKWebViewCandidateTests API test failures
https://bugs.webkit.org/show_bug.cgi?id=162470

Reviewed by Tim Horton.

VideoControlsManager, WKWebViewCandidateTests and CandidateTests should not be running on 10.12.0. Guard these
tests with an SDK check to prevent 10.12.0 bots from building them.

* TestWebKitAPI/Tests/WebKit2Cocoa/VideoControlsManager.mm:
* TestWebKitAPI/Tests/WebKit2Cocoa/WKWebViewCandidateTests.mm:
* TestWebKitAPI/Tests/mac/CandidateTests.mm:

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

2 years agoRefactor URLParser
achristensen@apple.com [Fri, 23 Sep 2016 22:32:28 +0000 (22:32 +0000)]
Refactor URLParser
https://bugs.webkit.org/show_bug.cgi?id=162516

Reviewed by Brady Eidson.

Source/WebCore:

Turn more static functions into methods, use a helper function to append characters to a buffer.

No change in behavior, but I added a new API test to cover an interesting
ipv6 address parsing case that had no coverage.

* platform/URLParser.cpp:
(WebCore::CodePointIterator::codeUnitsSince):
(WebCore::URLParser::isWindowsDriveLetter):
(WebCore::URLParser::appendToASCIIBuffer):
(WebCore::URLParser::checkWindowsDriveLetter):
(WebCore::URLParser::percentEncodeByte):
(WebCore::URLParser::utf8PercentEncode):
(WebCore::URLParser::utf8QueryEncode):
(WebCore::URLParser::encodeQuery):
(WebCore::URLParser::copyASCIIStringUntil):
(WebCore::URLParser::copyURLPartsUntil):
(WebCore::URLParser::URLParser):
(WebCore::URLParser::parse):
(WebCore::URLParser::parseAuthority):
(WebCore::URLParser::parsePort):
(WebCore::URLParser::parseHostAndPort):
(WebCore::utf8PercentEncode): Deleted.
(WebCore::utf8QueryEncode): Deleted.
(WebCore::encodeQuery): Deleted.
(WebCore::copyASCIIStringUntil): Deleted.
* platform/URLParser.h:
(WebCore::URLParser::appendToASCIIBuffer):

Tools:

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

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

2 years ago[JSC] Implement parsing of Async Functions
caitp@igalia.com [Fri, 23 Sep 2016 22:24:27 +0000 (22:24 +0000)]
[JSC] Implement parsing of Async Functions
https://bugs.webkit.org/show_bug.cgi?id=161409

Reviewed by Yusuke Suzuki.

.:

* Source/cmake/WebKitFeatures.cmake:

JSTests:

* stress/async-await-syntax.js: Added.
(testSyntax):
(testSyntaxError):
(testTopLevelAsyncAwaitSyntaxSloppyMode.testSyntax):
(testTopLevelAsyncAwaitSyntaxSloppyMode):
(testTopLevelAsyncAwaitSyntaxStrictMode):
(testTopLevelAsyncAwaitSyntaxStrictMode.testSyntax):
(testNestedAsyncAwaitSyntax.async):
(testNestedAsyncAwaitSyntax.foo):
(testTopLevelAsyncAwaitSyntaxSloppyMode.testSyntaxError):

Source/JavaScriptCore:

Introduces frontend parsing for the async function proposal soon to be
ratified in ECMA262 (https://tc39.github.io/ecmascript-asyncawait/).

* API/JSScriptRef.cpp:
(parseScript):
* Configurations/FeatureDefines.xcconfig:
* builtins/BuiltinExecutables.cpp:
(JSC::BuiltinExecutables::createExecutable):
* bytecode/EvalCodeCache.h:
(JSC::EvalCodeCache::CacheKey::CacheKey):
* bytecode/ExecutableInfo.h:
(JSC::ExecutableInfo::ExecutableInfo):
(JSC::ExecutableInfo::scriptMode):
(JSC::ExecutableInfo::commentMode): Deleted.
* bytecode/UnlinkedCodeBlock.cpp:
(JSC::UnlinkedCodeBlock::UnlinkedCodeBlock):
* bytecode/UnlinkedCodeBlock.h:
(JSC::UnlinkedCodeBlock::scriptMode):
(JSC::UnlinkedCodeBlock::commentMode): Deleted.
* bytecode/UnlinkedFunctionExecutable.cpp:
(JSC::generateUnlinkedFunctionCodeBlock):
(JSC::UnlinkedFunctionExecutable::UnlinkedFunctionExecutable):
* bytecode/UnlinkedFunctionExecutable.h:
* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::emitNewArrowFunctionExpression):
(JSC::BytecodeGenerator::emitNewMethodDefinition):
* bytecompiler/BytecodeGenerator.h:
(JSC::BytecodeGenerator::scriptMode):
(JSC::BytecodeGenerator::makeFunction):
(JSC::BytecodeGenerator::commentMode): Deleted.
* bytecompiler/NodesCodegen.cpp:
(JSC::AwaitExprNode::emitBytecode):
* parser/ASTBuilder.h:
(JSC::ASTBuilder::createAwait):
(JSC::ASTBuilder::createAsyncFunctionBody):
* parser/Keywords.table:
* parser/Lexer.cpp:
(JSC::Lexer<T>::Lexer):
(JSC::Lexer<T>::lex):
* parser/Lexer.h:
* parser/NodeConstructors.h:
(JSC::AwaitExprNode::AwaitExprNode):
* parser/Nodes.h:
* parser/Parser.cpp:
(JSC::Parser<LexerType>::Parser):
(JSC::Parser<LexerType>::parseInner):
(JSC::Parser<LexerType>::isArrowFunctionParameters):
(JSC::Parser<LexerType>::parseAsyncFunctionSourceElements):
(JSC::Parser<LexerType>::parseStatementListItem):
(JSC::Parser<LexerType>::parseVariableDeclarationList):
(JSC::Parser<LexerType>::parseDestructuringPattern):
(JSC::Parser<LexerType>::parseStatement):
(JSC::Parser<LexerType>::parseFunctionDeclarationStatement):
(JSC::Parser<LexerType>::maybeParseAsyncFunctionDeclarationStatement):
(JSC::Parser<LexerType>::parseFormalParameters):
(JSC::stringForFunctionMode):
(JSC::Parser<LexerType>::parseFunctionParameters):
(JSC::Parser<LexerType>::parseFunctionInfo):
(JSC::Parser<LexerType>::parseAsyncFunctionDeclaration):
(JSC::Parser<LexerType>::parseClass):
(JSC::Parser<LexerType>::parseExpressionOrLabelStatement):
(JSC::Parser<LexerType>::parseImportClauseItem):
(JSC::Parser<LexerType>::parseImportDeclaration):
(JSC::Parser<LexerType>::parseExportDeclaration):
(JSC::Parser<LexerType>::parseAssignmentExpression):
(JSC::Parser<LexerType>::parseProperty): Deleted.
(JSC::Parser<LexerType>::parsePropertyMethod): Deleted.
(JSC::Parser<LexerType>::parsePrimaryExpression): Deleted.
(JSC::Parser<LexerType>::parseMemberExpression): Deleted.
(JSC::Parser<LexerType>::parseArrowFunctionExpression): Deleted.
(JSC::Parser<LexerType>::parseUnaryExpression): Deleted.
(JSC::Parser<LexerType>::printUnexpectedTokenText): Deleted.
* parser/Parser.h:
(JSC::Scope::Scope):
(JSC::Scope::setSourceParseMode):
(JSC::Scope::isAsyncFunction):
(JSC::Scope::isAsyncFunctionBoundary):
(JSC::Scope::setIsAsyncArrowFunction):
(JSC::Scope::setIsAsyncFunction):
(JSC::Scope::setIsAsyncFunctionBody):
(JSC::Scope::setIsAsyncArrowFunctionBody):
(JSC::Parser::ExpressionErrorClassifier::forceClassifyExpressionError):
(JSC::Parser::ExpressionErrorClassifier::propagateExpressionErrorClass):
(JSC::Parser::ExpressionErrorClassifier::indicatesPossibleAsyncArrowFunction):
(JSC::Parser::forceClassifyExpressionError):
(JSC::Parser::declarationTypeToVariableKind):
(JSC::Parser::upperScope):
(JSC::Parser::pushScope):
(JSC::Parser::matchSpecIdentifier):
(JSC::Parser::isDisallowedIdentifierAwait):
(JSC::Parser::disallowedIdentifierAwaitReason):
(JSC::parse):
(JSC::Scope::isGeneratorBoundary): Deleted.
(JSC::Parser::ExpressionErrorClassifier::indicatesPossiblePattern): Deleted.
* parser/ParserModes.h:
(JSC::SourceParseModeSet::SourceParseModeSet):
(JSC::SourceParseModeSet::contains):
(JSC::SourceParseModeSet::mergeSourceParseModes):
(JSC::isFunctionParseMode):
(JSC::isAsyncFunctionParseMode):
(JSC::isAsyncArrowFunctionParseMode):
(JSC::isAsyncFunctionWrapperParseMode):
(JSC::isAsyncFunctionBodyParseMode):
(JSC::isMethodParseMode):
(JSC::isModuleParseMode):
(JSC::isProgramParseMode):
(JSC::constructAbilityForParseMode):
* parser/ParserTokens.h:
* parser/SourceCodeKey.h:
(JSC::SourceCodeFlags::SourceCodeFlags):
(JSC::SourceCodeKey::SourceCodeKey):
* parser/SyntaxChecker.h:
(JSC::SyntaxChecker::createAwait):
(JSC::SyntaxChecker::createAsyncFunctionBody):
(JSC::SyntaxChecker::createYield): Deleted.
(JSC::SyntaxChecker::createFunctionExpr): Deleted.
* runtime/CodeCache.cpp:
(JSC::CodeCache::getGlobalCodeBlock):
(JSC::CodeCache::getProgramCodeBlock):
(JSC::CodeCache::getEvalCodeBlock):
(JSC::CodeCache::getModuleProgramCodeBlock):
(JSC::CodeCache::getFunctionExecutableFromGlobalCode):
* runtime/CodeCache.h:
* runtime/CommonIdentifiers.h:
* runtime/Completion.cpp:
(JSC::checkSyntax):
(JSC::checkModuleSyntax):
* runtime/Executable.cpp:
(JSC::ProgramExecutable::checkSyntax):
* runtime/Executable.h:
* runtime/ModuleLoaderPrototype.cpp:
(JSC::moduleLoaderPrototypeParseModule):

Source/WebCore:

* Configurations/FeatureDefines.xcconfig:

Source/WebKit/mac:

* Configurations/FeatureDefines.xcconfig:

Source/WebKit2:

* Configurations/FeatureDefines.xcconfig:

Source/WTF:

* wtf/FeatureDefines.h:

Tools:

* Scripts/build-jsc:
(cMakeArgsFromFeatures):
* Scripts/webkitperl/FeatureList.pm:
* TestWebKitAPI/Configurations/FeatureDefines.xcconfig:

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

2 years agoAlign HTMLLabelElement.prototype.form with the HTML specification
cdumez@apple.com [Fri, 23 Sep 2016 21:46:27 +0000 (21:46 +0000)]
Align HTMLLabelElement.prototype.form with the HTML specification
https://bugs.webkit.org/show_bug.cgi?id=162369

Reviewed by Ryosuke Niwa.

LayoutTests/imported/w3c:

Rebaseline several W3C tests now that more checks are passing.

* web-platform-tests/html/semantics/forms/form-control-infrastructure/form-expected.txt:
* web-platform-tests/html/semantics/forms/the-label-element/label-attributes-expected.txt:

Source/WebCore:

Align HTMLLabelElement.prototype.form with the HTML specification:
- https://html.spec.whatwg.org/#dom-label-form

In particular, the following behavior changes:
- We now return null if the label element has no labeled control.
- We now return the form element instead of returning null if
  the label element is outside the form but its labeled control
  is inside the form.

Firefox and Chrome match the specification.

No new tests, rebaselined existing tests.

* html/HTMLLabelElement.cpp:
(WebCore::HTMLLabelElement::form):
* html/HTMLLabelElement.h:

LayoutTests:

Update existing tests to reflect behavior change. I have verified
that Firefox and Chrome were failing those tests.

* fast/dom/HTMLLabelElement/form/test1.html:
* fast/forms/form-attribute-expected.txt:
* fast/forms/form-attribute-nonexistence-form-id-expected.txt:
* fast/forms/form-attribute-nonexistence-form-id.html:
* fast/forms/form-attribute.html:

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

2 years agoFix Mac CMake build after r206261
jbedard@apple.com [Fri, 23 Sep 2016 21:20:19 +0000 (21:20 +0000)]
Fix Mac CMake build after r206261
https://bugs.webkit.org/show_bug.cgi?id=162493

Reviewed by Alex Christensen.

* CMakeLists.txt: Exclude WebTextChecker from Mac CMake builds.
* PlatformEfl.cmake: Ditto.
* PlatformGTK.cmake: Ditto.

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

2 years agoUnreviewed, rolling out r206317.
ryanhaddad@apple.com [Fri, 23 Sep 2016 21:01:40 +0000 (21:01 +0000)]
Unreviewed, rolling out r206317.

This change caused timeouts on El Capitan Release JSC tests

Reverted changeset:

"Skip stress/string-joining-long-strings-should-not-crash.js
on memory limited devices"
https://bugs.webkit.org/show_bug.cgi?id=162386
http://trac.webkit.org/changeset/206317

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

2 years agoRefactor URLParser
achristensen@apple.com [Fri, 23 Sep 2016 20:58:03 +0000 (20:58 +0000)]
Refactor URLParser
https://bugs.webkit.org/show_bug.cgi?id=162511

Reviewed by Brady Eidson.

Source/WebCore:

Make the constructor take the parameters instead of URL::parse.
Now we don't need to copy the input string on failure.
Also, turn some static functions into methods so they will be able to access member variables.

Covered by existing and new API tests.

* platform/URL.cpp:
(WebCore::URL::URL):
(WebCore::URL::setProtocol):
(WebCore::URL::setHost):
(WebCore::URL::removePort):
(WebCore::URL::setPort):
(WebCore::URL::setHostAndPort):
(WebCore::URL::setUser):
(WebCore::URL::setPass):
(WebCore::URL::setFragmentIdentifier):
(WebCore::URL::removeFragmentIdentifier):
(WebCore::URL::setQuery):
(WebCore::URL::setPath):
* platform/URLParser.cpp:
(WebCore::URLParser::incrementIteratorSkippingTabAndNewLine):
(WebCore::URLParser::isWindowsDriveLetter):
(WebCore::URLParser::checkWindowsDriveLetter):
(WebCore::URLParser::shouldCopyFileURL):
(WebCore::URLParser::failure):
(WebCore::URLParser::URLParser):
(WebCore::URLParser::parse):
(WebCore::incrementIteratorSkippingTabAndNewLine): Deleted.
(WebCore::isWindowsDriveLetter): Deleted.
(WebCore::checkWindowsDriveLetter): Deleted.
(WebCore::shouldCopyFileURL): Deleted.
* platform/URLParser.h:
(WebCore::URLParser::URLParser):
(WebCore::URLParser::result):
(WebCore::URLParser::parse): Deleted.
* platform/cf/URLCF.cpp:
(WebCore::URL::URL):
Drive-by fix: Actually assign the URL to be the result of parsing.
* platform/mac/URLMac.mm:
(WebCore::URL::URL):

Tools:

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

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

2 years agoiOS playback user action tests fail on some machines
ap@apple.com [Fri, 23 Sep 2016 20:23:58 +0000 (20:23 +0000)]
iOS playback user action tests fail on some machines
https://bugs.webkit.org/show_bug.cgi?id=162504
rdar://problem/28013994

Reviewed by Jer Noble.

Avoid the need to have a timeout.

* TestWebKitAPI/Tests/WebKit/ios/audio-only.html:
* TestWebKitAPI/Tests/WebKit/ios/video-with-audio.html:
* TestWebKitAPI/Tests/WebKit/ios/video-without-audio.html:
* TestWebKitAPI/Tests/WebKit2Cocoa/large-video-without-audio.html:

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

2 years agoUnreviewed, rolling out r206314, r206316, and r206319.
ryanhaddad@apple.com [Fri, 23 Sep 2016 20:16:43 +0000 (20:16 +0000)]
Unreviewed, rolling out r206314, r206316, and r206319.
https://bugs.webkit.org/show_bug.cgi?id=162506

These changes broke various builds (Requested by ryanhaddad on
#webkit).

Reverted changesets:

"Need a store-load fence between setting cell state and
visiting the object in SlotVisitor"
https://bugs.webkit.org/show_bug.cgi?id=162354
http://trac.webkit.org/changeset/206314

"Unreviewed, fix cloop."
http://trac.webkit.org/changeset/206316

"Unreviewed, fix all other builds."
http://trac.webkit.org/changeset/206319

Patch by Commit Queue <commit-queue@webkit.org> on 2016-09-23

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

2 years agoRemove URLParser serialized template
achristensen@apple.com [Fri, 23 Sep 2016 19:57:57 +0000 (19:57 +0000)]
Remove URLParser serialized template
https://bugs.webkit.org/show_bug.cgi?id=162501

Reviewed by Brady Eidson.

No change in behavior.
This optimization conflicts with another optimization I'm doing.
We currently have the ParsedURLString tag, where we tell the parser to assume this URL is valid and canonicalized.
I'm going to instead make URLParser assume all URLs are valid and canonicalized until it finds that it is not,
in which case it will canonicalize it if possible.

* platform/URL.cpp:
(WebCore::URL::URL):
* platform/URLParser.cpp:
(WebCore::incrementIteratorSkippingTabAndNewLine):
(WebCore::isWindowsDriveLetter):
(WebCore::checkWindowsDriveLetter):
(WebCore::shouldCopyFileURL):
(WebCore::utf8PercentEncode):
(WebCore::utf8QueryEncode):
(WebCore::URLParser::parse):
(WebCore::URLParser::parseAuthority):
(WebCore::URLParser::parsePort):
(WebCore::URLParser::parseHostAndPort):
(WebCore::URLParser::parseSerializedURL): Deleted.
* platform/URLParser.h:
(WebCore::URLParser::parse):

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

2 years agoAllow Seeking from the now playing controls
jer.noble@apple.com [Fri, 23 Sep 2016 19:40:53 +0000 (19:40 +0000)]
Allow Seeking from the now playing controls
https://bugs.webkit.org/show_bug.cgi?id=162498

Reviewed by Beth Dakin.

We already have a handler for seek commands, we just need to register that handler
with MediaRemote.

* platform/mac/RemoteCommandListenerMac.mm:
(WebCore::RemoteCommandListenerMac::updateSupportedCommands):

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

2 years agoUnreviewed, fix all other builds.
fpizlo@apple.com [Fri, 23 Sep 2016 19:31:11 +0000 (19:31 +0000)]
Unreviewed, fix all other builds.

* assembler/AbstractMacroAssembler.h:

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

2 years agoSkip mozilla-tests.yaml/js1_5/Array/regress-157652 on memory limited devices
ossy@webkit.org [Fri, 23 Sep 2016 19:02:46 +0000 (19:02 +0000)]
Skip mozilla-tests.yaml/js1_5/Array/regress-157652 on memory limited devices
https://bugs.webkit.org/show_bug.cgi?id=162381

Reviewed by Mark Lam.

* mozilla/mozilla-tests.yaml:

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

2 years agoSkip stress/string-joining-long-strings-should-not-crash.js on memory limited devices
ossy@webkit.org [Fri, 23 Sep 2016 19:00:17 +0000 (19:00 +0000)]
Skip stress/string-joining-long-strings-should-not-crash.js on memory limited devices
https://bugs.webkit.org/show_bug.cgi?id=162386

Reviewed by Mark Lam.

* stress/string-joining-long-strings-should-not-crash.js:

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

2 years agoUnreviewed, fix cloop.
fpizlo@apple.com [Fri, 23 Sep 2016 18:47:41 +0000 (18:47 +0000)]
Unreviewed, fix cloop.

* assembler/AbstractMacroAssembler.h:
* heap/SlotVisitor.cpp:

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

2 years agoMediaSessionManagerMac::nowPlayingEligibleSession() needs to honor the main content...
wenson_hsieh@apple.com [Fri, 23 Sep 2016 18:45:53 +0000 (18:45 +0000)]
MediaSessionManagerMac::nowPlayingEligibleSession() needs to honor the main content heuristic
https://bugs.webkit.org/show_bug.cgi?id=162480
<rdar://problem/28430615>

Reviewed by Jer Noble.

Changes the implementation of nowPlayingEligibleSession to use bestMediaElementForShowingPlaybackControlsManager
and also early return nullptr if the current tab the web process is hosted in is the active tab, and the window
it is hosted in is the main window. This information is derived from the viewState flags in the Page of each
tab -- whenever the (visible && active) state changes, the Page tells the global media session manager to update
its Now Playing info. Then, when each MediaElementSession tries to determine whether it can show playback
controls for the purposes of Now Playing, each session consults its page's visible and active state. If a page
is both visible and active, no Now Playing controls are allowed for that media session.

Also adds some slight adjustments to MediaSessionManagerMac::updateNowPlayingInfo, so we reset the title, rate
and duration of the current active session when clearing out the now playing info. Likewise, when vending an
active video, if the video information matches that of the current session, we mark m_nowPlayingActive anyways.
These tweaks prevent us from getting in a bad state when switching between a tab with media and one without.

Unit tests to come in a future patch.

* html/HTMLMediaElement.cpp:
(WebCore::mediaElementSessionInfoForSession):
(WebCore::mediaSessionMayBeConfusedWithMainContent):
(WebCore::HTMLMediaElement::bestMediaElementForShowingPlaybackControlsManager):
(WebCore::HTMLMediaElement::updatePlaybackControlsManager):
(WebCore::bestMediaSessionForShowingPlaybackControlsManager): Deleted.
* html/HTMLMediaElement.h:
* html/MediaElementSession.cpp:
(WebCore::MediaElementSession::canShowControlsManager):
(WebCore::MediaElementSession::pageAllowsNowPlayingControls):
* html/MediaElementSession.h:
* page/Page.cpp:
(WebCore::Page::setViewState):
(WebCore::Page::isVisibleAndActive):
* page/Page.h:
* platform/audio/PlatformMediaSessionManager.cpp:
(WebCore::PlatformMediaSessionManager::updateNowPlayingInfoIfNecessary):
* platform/audio/PlatformMediaSessionManager.h:
* platform/audio/mac/MediaSessionManagerMac.mm:
(WebCore::PlatformMediaSessionManager::updateNowPlayingInfoIfNecessary):
(WebCore::MediaSessionManagerMac::nowPlayingEligibleSession):
(WebCore::MediaSessionManagerMac::updateNowPlayingInfo):

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

2 years agoSource/JavaScriptCore:
fpizlo@apple.com [Fri, 23 Sep 2016 18:09:44 +0000 (18:09 +0000)]
Source/JavaScriptCore:
Need a store-load fence between setting cell state and visiting the object in SlotVisitor
https://bugs.webkit.org/show_bug.cgi?id=162354

Reviewed by Mark Lam.

This was meant to be a small change, but then it became bigger as I found small
opportunities for improving this code. This adds a store-load fence and is performance-
neutral. That's probably partly due to other optimizations that I did to visitChildren().

Initially, I found that adding an mfence as a store-load fence was terribly expensive. So,
I thought that I needed to buffer up a bunch of objects, set their states, do one mfence,
and then visit all of them. This seemed like a win, so I went with it. Unfortunately, this
made no sense for two reasons:

- I shouldn't use mfence. I should use ortop (lock orl $0, (%rsp)) instead. Ortop is
  basically free, and it's what WTF now uses for storeLoadFence().

- My data saying that buffering up objects was not a slow-down was wrong. That was actually
  almost as expensive as the mfence.

But in order to implement that, I made some other improvements that I think we should stick
with:

- SlotVisitor::visitChildren() now uses a switch on type. This replaces what used to be
  some nasty ClassInfo look-ups.

- We no longer save the object's old CellState. We would do that so that we would know what
  state the object had been before we blackened it. But I believe that the more logical
  solution is to have two kinds of black - one for black-for-the-first-time objects and one
  for repeat offenders. This is a lot easier to reason about, since you can now just figure
  this out by looking at the cell directly.

The latter change meant rewiring a bunch of barriers. It didn't make them any more
expensive.

* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::emitStoreBarrier):
* heap/CellState.h:
(JSC::blacken):
* heap/Heap.cpp:
(JSC::Heap::addToRememberedSet):
* heap/Heap.h:
* heap/HeapInlines.h:
(JSC::Heap::writeBarrier):
(JSC::Heap::reportExtraMemoryVisited):
(JSC::Heap::reportExternalMemoryVisited):
* heap/MarkStack.cpp:
* heap/MarkStack.h:
* heap/SlotVisitor.cpp:
(JSC::SlotVisitor::visitChildren):
* heap/SlotVisitor.h:
* heap/SlotVisitorInlines.h:
(JSC::SlotVisitor::reportExtraMemoryVisited):
(JSC::SlotVisitor::reportExternalMemoryVisited):
* jit/AssemblyHelpers.h:
(JSC::AssemblyHelpers::jumpIfIsRememberedOrInEden):
* llint/LLIntData.cpp:
(JSC::LLInt::Data::performAssertions):
* llint/LowLevelInterpreter.asm:
* llint/LowLevelInterpreter32_64.asm:
* llint/LowLevelInterpreter64.asm:
* runtime/JSObject.h:
(JSC::isJSFinalObject):

Source/WTF:
REGRESSION(r194387): Crash on github.com in IntlDateTimeFormat::resolvedOptions in C locale
https://bugs.webkit.org/show_bug.cgi?id=162139

Patch by Carlos Garcia Campos <cgarcia@igalia.com> on 2016-09-23
Reviewed by Michael Catanzaro.

Handle the case of "C" or "POSIX" locale and use "en-US" as default. That matches what ICU and other ports do,
as well as what layout tests expect (some tests like js/intl-collator.html pass in the bots only because we use
en-US as system locale in those bots).

* wtf/PlatformUserPreferredLanguagesUnix.cpp:
(WTF::platformLanguage):

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

2 years agoTemporarily skipping media/media-source/media-source-duplicate-seeked.html on mac.
ryanhaddad@apple.com [Fri, 23 Sep 2016 17:49:15 +0000 (17:49 +0000)]
Temporarily skipping media/media-source/media-source-duplicate-seeked.html on mac.
https://bugs.webkit.org/show_bug.cgi?id=162496

Unreviewed test gardening.

* platform/mac/TestExpectations:

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

2 years agoUnreviewed, rolling out r206311.
commit-queue@webkit.org [Fri, 23 Sep 2016 17:15:03 +0000 (17:15 +0000)]
Unreviewed, rolling out r206311.
https://bugs.webkit.org/show_bug.cgi?id=162495

Broke internal iOS build (Requested by anttik on #webkit).

Reverted changeset:

"Move stylesheet change logic from Document to
AuthorStyleSheets"
https://bugs.webkit.org/show_bug.cgi?id=162488
http://trac.webkit.org/changeset/206311

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

2 years agoMove stylesheet change logic from Document to AuthorStyleSheets
antti@apple.com [Fri, 23 Sep 2016 16:35:04 +0000 (16:35 +0000)]
Move stylesheet change logic from Document to AuthorStyleSheets
https://bugs.webkit.org/show_bug.cgi?id=162488

Reviewed by Andreas Kling.

That's where it belongs.

* WebCore.xcodeproj/project.pbxproj:
* css/CSSStyleSheet.cpp:
(WebCore::CSSStyleSheet::didMutateRules):
(WebCore::CSSStyleSheet::didMutate):
(WebCore::CSSStyleSheet::clearOwnerNode):
* dom/AuthorStyleSheets.cpp:
(WebCore::AuthorStyleSheets::AuthorStyleSheets):
(WebCore::AuthorStyleSheets::flushPendingUpdates):
(WebCore::AuthorStyleSheets::scheduleOptimizedUpdate):
(WebCore::AuthorStyleSheets::didChange):
(WebCore::AuthorStyleSheets::optimizedUpdateTimerFired):
* dom/AuthorStyleSheets.h:
(WebCore::AuthorStyleSheets::hasPendingUpdate):
(WebCore::AuthorStyleSheets::pendingUpdateType): Deleted.
(WebCore::AuthorStyleSheets::setPendingUpdateType): Deleted.
(WebCore::AuthorStyleSheets::flushPendingUpdates): Deleted.
* dom/Document.cpp:
(WebCore::Document::Document):
(WebCore::Document::setContentLanguage):
(WebCore::Document::needsStyleRecalc):
(WebCore::Document::updateStyleIfNeeded):
(WebCore::Document::updateLayoutIgnorePendingStylesheets):
(WebCore::Document::didRemoveAllPendingStylesheet):
(WebCore::Document::processHttpEquiv):
(WebCore::Document::setSelectedStylesheetSet):
(WebCore::Document::updateHoverActiveState):
(WebCore::Document::optimizedStyleSheetUpdateTimerFired): Deleted.
(WebCore::Document::scheduleOptimizedStyleSheetUpdate): Deleted.
(WebCore::Document::styleResolverChanged): Deleted.
* dom/Document.h:
(WebCore::Document::needsStyleRecalc): Deleted.
* dom/ExtensionStyleSheets.cpp:
(WebCore::ExtensionStyleSheets::clearPageUserSheet):
(WebCore::ExtensionStyleSheets::updatePageUserSheet):
(WebCore::ExtensionStyleSheets::invalidateInjectedStyleSheetCache):
(WebCore::ExtensionStyleSheets::addUserStyleSheet):
(WebCore::ExtensionStyleSheets::addAuthorStyleSheetForTesting):
(WebCore::ExtensionStyleSheets::styleResolverChangedTimerFired):
* dom/InlineStyleSheetOwner.cpp:
(WebCore::InlineStyleSheetOwner::removedFromDocument):
* dom/ProcessingInstruction.cpp:
(WebCore::ProcessingInstruction::removedFrom):

    Also fix a bug that prevented document from rendering if a loading processing instruction was removed from the tree.
    This is tested by fast/dom/StyleSheet/detached-style-pi-2.xhtml (after other changes in this patch).

* dom/ShadowRoot.cpp:
(WebCore::ShadowRoot::updateStyle):
* html/HTMLLinkElement.cpp:
(WebCore::HTMLLinkElement::setDisabledState):
(WebCore::HTMLLinkElement::parseAttribute):
(WebCore::HTMLLinkElement::process):
(WebCore::HTMLLinkElement::removedFrom):
(WebCore::HTMLLinkElement::removePendingSheet):
* html/HTMLStyleElement.cpp:
(WebCore::HTMLStyleElement::parseAttribute):
* inspector/InspectorCSSAgent.cpp:
(WebCore::InspectorCSSAgent::forcePseudoState):
(WebCore::InspectorCSSAgent::resetPseudoStates):
* inspector/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::setEmulatedMedia):
* page/Frame.cpp:
(WebCore::Frame::setPrinting):
* page/FrameView.cpp:
(WebCore::FrameView::layout):
(WebCore::FrameView::setPagination):
(WebCore::FrameView::setViewportSizeForCSSViewportUnits):
* page/Page.cpp:
(WebCore::Page::setViewMode):
(WebCore::Page::setNeedsRecalcStyleInAllFrames):
(WebCore::Page::invalidateInjectedStyleSheetCacheInAllFrames):
* svg/SVGFontFaceElement.cpp:
(WebCore::SVGFontFaceElement::rebuildFontFace):
(WebCore::SVGFontFaceElement::removedFrom):
* xml/XMLTreeViewer.cpp:
(WebCore::XMLTreeViewer::transformDocumentToTreeView):
* xml/parser/XMLDocumentParser.cpp:
(WebCore::XMLDocumentParser::end):
* xml/parser/XMLDocumentParserLibxml2.cpp:
(WebCore::XMLDocumentParser::doEnd):

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

2 years ago[css-grid] ASSERT when sizing tracks with percentages inside calc
svillar@igalia.com [Fri, 23 Sep 2016 16:29:43 +0000 (16:29 +0000)]
[css-grid] ASSERT when sizing tracks with percentages inside calc
https://bugs.webkit.org/show_bug.cgi?id=162383

Reviewed by Darin Adler.

Source/WebCore:

There is an ASSERT to check that tracks are at least as wide as the initial base size. This
was added to verify that we never shrink tracks bellow that value. In order to compute the
value used for initialization we need a max size which is the value used to resolve
percentages to. The remaining free space was used to compute that value, that's totally
wrong because the free space decreases as the track sizing algorithm is run. The available
space should be used instead.

An extra ASSERT was removed too because it was redundant, we do always check the sizes of
the tracks after running the track sizing algorithm and that's precisely the unique point
were they could be modified.

Test: fast/css-grid-layout/tracks-wider-min-track-breadth-crash.html

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

LayoutTests:

* fast/css-grid-layout/tracks-wider-min-track-breadth-crash-expected.txt: Added.
* fast/css-grid-layout/tracks-wider-min-track-breadth-crash.html: Added.

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

2 years agodocument.title getter does not strip / collapse the right whitespace characters
cdumez@apple.com [Fri, 23 Sep 2016 16:25:42 +0000 (16:25 +0000)]
document.title getter does not strip / collapse the right whitespace characters
https://bugs.webkit.org/show_bug.cgi?id=162468

Reviewed by Ryosuke Niwa.

LayoutTests/imported/w3c:

Rebaseline W3C test now that more checks are passing.

* web-platform-tests/html/dom/documents/dom-tree-accessors/document.title-05-expected.txt:

Source/WebCore:

The document.title getter does not strip / collapse whitespace characters
as per:
- https://html.spec.whatwg.org/#document.title

This part of the specification provides more information about which
whitespace characters:
- https://html.spec.whatwg.org/#strip-and-collapse-whitespace
- https://html.spec.whatwg.org/#space-character

Firefox matches the specification. However, WebKit was stripping / collapsing
some characters it should not.

No new tests, rebaselined existing tests.

* dom/Document.cpp:
(WebCore::canonicalizedTitle):

LayoutTests:

Update existing test to reflect behavior change.

* fast/dom/Document/script-tests/document-title-get.js:

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

2 years agoAlign Element.insertAdjacentHTML() with the specification
cdumez@apple.com [Fri, 23 Sep 2016 16:24:35 +0000 (16:24 +0000)]
Align Element.insertAdjacentHTML() with the specification
https://bugs.webkit.org/show_bug.cgi?id=162479

Reviewed by Sam Weinig.

LayoutTests/imported/w3c:

Rebaseline W3C test now that one more check is passing.

* web-platform-tests/domparsing/insert_adjacent_html-expected.txt:

Source/WebCore:

Align Element.insertAdjacentHTML() with the specification:
- https://w3c.github.io/DOM-Parsing/#dom-element-insertadjacenthtml (steps 1 & 2)

In particular, the following changes issues are now fixed:
- Calling insertAdjacentHTML() on an element whose parent is a
  DocumentFragment now works insteas of throwing a
  NO_MODIFICATION_ALLOWED_ERR.
- Calling insertAdjacentHTML() on child of the <html> element
  no longer creates duplicate body / head elements.

Firefox agrees with the specification.

Test: fast/dom/insertAdjacentHTML-DocumentFragment-parent.html

* dom/Element.cpp:
(WebCore::contextNodeForInsertion):
(WebCore::Element::insertAdjacentHTML):

LayoutTests:

Add layout test coverage for calling insertAdjacentHTML on an element
whose parent is a DocumentFragment. I have verified that this test is
passing in Firefox.

* fast/dom/insertAdjacentHTML-DocumentFragment-crash-expected.txt:
* fast/dom/insertAdjacentHTML-DocumentFragment-parent-expected.txt: Added.
* fast/dom/insertAdjacentHTML-DocumentFragment-parent.html: Added.

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

2 years agoUnreviewed, rolling out r206165.
achristensen@apple.com [Fri, 23 Sep 2016 16:21:19 +0000 (16:21 +0000)]
Unreviewed, rolling out r206165.
https://bugs.webkit.org/show_bug.cgi?id=162492

needs corresponding API change in bug 162475 (Requested by
alexchristensen on #webkit).

Reverted changeset:

"Non-special URLs should have an opaque origin"
https://bugs.webkit.org/show_bug.cgi?id=162254
http://trac.webkit.org/changeset/206165

Patch by Commit Queue <commit-queue@webkit.org> on 2016-09-23

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

2 years agoUnreviewed. Fix the build after r206300.
carlosgc@webkit.org [Fri, 23 Sep 2016 16:09:23 +0000 (16:09 +0000)]
Unreviewed. Fix the build after r206300.

* platform/mock/mediasource/MockSourceBufferPrivate.cpp: Add missing header include.

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

2 years ago[GTK] BadDamage X error in /webkit2/WebKitWebView/preferred-size
carlosgc@webkit.org [Fri, 23 Sep 2016 15:49:56 +0000 (15:49 +0000)]
[GTK] BadDamage X error in /webkit2/WebKitWebView/preferred-size
https://bugs.webkit.org/show_bug.cgi?id=162489

Reviewed by Michael Catanzaro.

Do a XSync right after creating/destroying the XDamage used by the redirected window in X11.

* UIProcess/gtk/AcceleratedBackingStoreX11.cpp:
(WebKit::AcceleratedBackingStoreX11::~AcceleratedBackingStoreX11):
(WebKit::AcceleratedBackingStoreX11::update):

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

2 years agoREGRESSION(r204163): [GTK] API test /webkit2/WebKitSecurityManager/file-xhr is failing
carlosgc@webkit.org [Fri, 23 Sep 2016 15:48:22 +0000 (15:48 +0000)]
REGRESSION(r204163): [GTK] API test /webkit2/WebKitSecurityManager/file-xhr is failing
https://bugs.webkit.org/show_bug.cgi?id=161607

Reviewed by Michael Catanzaro.

Since r204163, in case of cross origin error when loading the XHR, the load fails and an error message is shown
in the console, but there isn't any js expcetion, which is what we were checking. Now, we check that there
aren't exceptions, and that the error message is sent to the console.

* Scripts/run-gtk-tests:
(TestRunner):
* TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebContext.cpp:
(consoleMessageReceivedCallback):
(testWebContextSecurityFileXHR):

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

2 years agoUse correct hardware for Sierra Debug WK2 testers.
ryanhaddad@apple.com [Fri, 23 Sep 2016 15:46:34 +0000 (15:46 +0000)]
Use correct hardware for Sierra Debug WK2 testers.
https://bugs.webkit.org/show_bug.cgi?id=162474

Reviewed by Alexey Proskuryakov.

* BuildSlaveSupport/build.webkit.org-config/config.json:

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

2 years ago[GTK] Make all WebView tests have a WebKitUserContentManager
carlosgc@webkit.org [Fri, 23 Sep 2016 15:45:54 +0000 (15:45 +0000)]
[GTK] Make all WebView tests have a WebKitUserContentManager
https://bugs.webkit.org/show_bug.cgi?id=162487

Reviewed by Michael Catanzaro.

It simplifies tests using the user content manager, and allows to use it without having to subclass WebViewTest.

* TestWebKitAPI/Tests/WebKit2Gtk/TestConsoleMessage.cpp:
(ConsoleMessageTest::ConsoleMessageTest):
(ConsoleMessageTest::~ConsoleMessageTest):
* TestWebKitAPI/Tests/WebKit2Gtk/TestUIClient.cpp:
* TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitUserContentManager.cpp:
(testUserContentManagerInjectedStyleSheet):
(testUserContentManagerInjectedScript):
(UserScriptMessageTest::UserScriptMessageTest):
(beforeAll):
* TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebView.cpp:
(testWebViewIsPlayingAudio):
* TestWebKitAPI/gtk/WebKit2Gtk/WebViewTest.cpp:
(WebViewTest::WebViewTest):
* TestWebKitAPI/gtk/WebKit2Gtk/WebViewTest.h:

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

2 years agoUnreviewed build fix; Missed a file in the last checkin.
jer.noble@apple.com [Fri, 23 Sep 2016 15:43:08 +0000 (15:43 +0000)]
Unreviewed build fix; Missed a file in the last checkin.

* platform/graphics/SourceBufferPrivate.h:
(WebCore::SourceBufferPrivate::enqueuedSamplesForTrackID):

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

2 years agoREGRESSION (206001): Scrubbed video on Youtube stops playing
jer.noble@apple.com [Fri, 23 Sep 2016 15:28:42 +0000 (15:28 +0000)]
REGRESSION (206001): Scrubbed video on Youtube stops playing
https://bugs.webkit.org/show_bug.cgi?id=162481
<rdar://problem/28436707>

Reviewed by Eric Carlson.

Source/WebCore:

Test: media/media-source/media-source-seek-back.html

When re-enqueing samples after a seek, modified the algorithm for finding the first sample
to re-enqueue. Instead of finding a sample which contained the requested presentation time,
we searched for the first sample on-or-after the presentation time. This meant that if the
last buffered sample in that range started before the seek time, and ended after, it would
get skipped during re-enquing, and a far, far future sample would be enqueued instead. Now
revert to the old behavior (find the sample containing the requested time), and only adopt
the new behavior (find the next sample on-or-after the requested time) if the first failed.
In addition, bail out if the second check resulted in a sample whose presentation time was
greater than a "fudge factor" away from the requested time.

To test this behavior, add a new method onto Internals that returns a list of the enqueued
samples from a SourceBuffer.

* Modules/mediasource/SourceBuffer.cpp:
(WebCore::SourceBuffer::reenqueueMediaForTime):
(WebCore::SourceBuffer::enqueuedSamplesForTrackID):
* Modules/mediasource/SourceBuffer.h:
* platform/mock/mediasource/MockMediaSourcePrivate.cpp:
(WebCore::MockMediaSourcePrivate::seekToTime):
* platform/mock/mediasource/MockSourceBufferPrivate.cpp:
(WebCore::MockSourceBufferPrivate::enqueuedSamplesForTrackID):
(WebCore::MockSourceBufferPrivate::enqueueSample):
* platform/mock/mediasource/MockSourceBufferPrivate.h:
* testing/Internals.cpp:
(WebCore::Internals::enqueuedSamplesForTrackID):
* testing/Internals.h:
* testing/Internals.idl:

LayoutTests:

* media/media-source/media-source-seek-back-expected.txt: Added.
* media/media-source/media-source-seek-back.html: Added.

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

2 years agoReplace redundant prepareForDestruction() call with RELEASE_ASSERT in Document::remov...
zalan@apple.com [Fri, 23 Sep 2016 14:16:57 +0000 (14:16 +0000)]
Replace redundant prepareForDestruction() call with RELEASE_ASSERT in Document::removedLastRef.
https://bugs.webkit.org/show_bug.cgi?id=162467

Reviewed by Chris Dumez.

Since r205786 fixed the root cause of webkit.org/b/159372, we no longer need the workaround.
Replace it with a RELEASE_ASSERT to ensure clean state.

No new tests, covered by existing test.

* dom/Document.cpp:
(WebCore::Document::removedLastRef):

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

2 years agoSkip failing html/syntax web platform test on Windows.
pvollan@apple.com [Fri, 23 Sep 2016 12:05:27 +0000 (12:05 +0000)]
Skip failing html/syntax web platform test on Windows.
https://bugs.webkit.org/show_bug.cgi?id=162415

Unreviewed test gardening.

* platform/win/TestExpectations:

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

2 years agoARM EABI buildfix after r206289
ossy@webkit.org [Fri, 23 Sep 2016 09:56:36 +0000 (09:56 +0000)]
ARM EABI buildfix after r206289
https://bugs.webkit.org/show_bug.cgi?id=162486

Unreviewed buildfix.

* jit/CCallHelpers.h:
(JSC::CCallHelpers::setupArgumentsWithExecState):

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

2 years agoAdding a new runtime flag for modern media controls.
graouts@webkit.org [Fri, 23 Sep 2016 09:32:09 +0000 (09:32 +0000)]
Adding a new runtime flag for modern media controls.

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

2 years agoREGRESSION(r194387): Crash on github.com in IntlDateTimeFormat::resolvedOptions in...
carlosgc@webkit.org [Fri, 23 Sep 2016 08:20:06 +0000 (08:20 +0000)]
REGRESSION(r194387): Crash on github.com in IntlDateTimeFormat::resolvedOptions in C locale
https://bugs.webkit.org/show_bug.cgi?id=162139

Reviewed by Michael Catanzaro.

Source/JavaScriptCore:

The crash happens in unix ports because the resolved locale is empty when system locale is "C". IntlObject
considers any language tag with a size < 2 to be an invalid language, so "C" is not a valid language to resolve
the locale. We should ensure that WTF::platformUserPreferredLanguages() never returns invalid languages, but
that's not enough, because languages can be overriden from the public API, so we need to handle those cases and
throw exceptions instead of crashing.

* runtime/IntlCollator.cpp:
(JSC::IntlCollator::initializeCollator): Throw a exception when we fail to resolve the locale.
* runtime/IntlDateTimeFormat.cpp:
(JSC::IntlDateTimeFormat::initializeDateTimeFormat): Ditto.
* runtime/IntlNumberFormat.cpp:
(JSC::IntlNumberFormat::initializeNumberFormat): Ditto.

Source/WebKit2:

Handle the case of "C" locale passed by the user using "en-US" as default to match what
WTF::platformUserPreferredLanguages() does.

* UIProcess/API/gtk/WebKitWebContext.cpp:
(webkit_web_context_set_preferred_languages): Remove the call to languageDidChange() because
overrideUserPreferredLanguages() already calls it, so we were actually notifying the observers twice.

Source/WTF:

Handle the case of "C" or "POSIX" locale and use "en-US" as default. That matches what ICU and other ports do,
as well as what layout tests expect (some tests like js/intl-collator.html pass in the bots only because we use
en-US as system locale in those bots).

* wtf/PlatformUserPreferredLanguagesUnix.cpp:
(WTF::platformLanguage):

Tools:

Add test cases to check the behavior when using the C locale and an invalid locale.

* TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebContext.cpp:
(testWebContextLanguages):

LayoutTests:

* js/intl-invalid-locale-crash-expected.txt: Added.
* js/intl-invalid-locale-crash.html: Added.

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

2 years ago[GTK] Improve performance when resizing a window with multiple web views in X11
carlosgc@webkit.org [Fri, 23 Sep 2016 08:02:59 +0000 (08:02 +0000)]
[GTK] Improve performance when resizing a window with multiple web views in X11
https://bugs.webkit.org/show_bug.cgi?id=162413

Reviewed by Michael Catanzaro.

Resizing a window with a single way view performs good enough, but when adding more tabs, the performance
decreases a lot. This is because resize is a sync operation, and the UI process waits for the web process to
have a new update for the new size, while still draws the previous frame. This is needed for the visible web
view, to avoid flickering and artifacts while resizing, but for all other hidden web views, we don't really need
to block the UI process. This doesn't happen in Wayland, because in Wayland we never block the UI process while
waiting for web process update after a resize.

* UIProcess/AcceleratedDrawingAreaProxy.cpp:
(WebKit::AcceleratedDrawingAreaProxy::waitForAndDispatchDidUpdateBackingStoreState): Return early if the web
view is not visible.
* UIProcess/gtk/AcceleratedBackingStoreX11.cpp:
(WebKit::AcceleratedBackingStoreX11::update): Only schedule a redraw on a damage event when the view is visible.
* WebProcess/WebPage/gtk/AcceleratedSurfaceX11.cpp:
(WebKit::AcceleratedSurfaceX11::AcceleratedSurfaceX11): Do a XSync right after creating the new pixmap.
(WebKit::AcceleratedSurfaceX11::resize): Ditto.

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

2 years ago[EFL] alert box is not displayed
hs85.jeong@samsung.com [Fri, 23 Sep 2016 04:16:02 +0000 (04:16 +0000)]
[EFL] alert box is not displayed
https://bugs.webkit.org/show_bug.cgi?id=156395

Reviewed by Gyuyoung Kim.

Some popup objects(alert, confirm, prompt, file entry dialog) used the ecore_main_loop_begin() to make
the modal popup but ecore_main_loop_begin() was not executed inside an exisiting main loop. So we have
to use the ecore_main_loop_iterate() instead of the ecore_main_loop_begin().

* MiniBrowser/efl/main.c:
(_ok_clicked_cb):
(_file_entry_dialog_show):
(_javascript_alert_cb):
(_javascript_confirm_cb):
(_javascript_prompt_cb):
(quit_event_loop): Deleted.

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

2 years ago[JSC] Use an inline cache to generate op_negate
commit-queue@webkit.org [Fri, 23 Sep 2016 03:50:22 +0000 (03:50 +0000)]
[JSC] Use an inline cache to generate op_negate
https://bugs.webkit.org/show_bug.cgi?id=162371

Patch by Benjamin Poulain <bpoulain@apple.com> on 2016-09-22
Reviewed by Saam Barati.

JSTests:

* stress/op-negate-inline-cache.js: Added.

Source/JavaScriptCore:

Use an inline cache to reduce the amount of code
required to implement op_negate.

For pure integer negate, the generated asm shrinks
from 147 bytes to 125 bytes (14%).
For double negate, the generated asm shrinks
to 130 bytes (11%).
The average size on Sunspider is 100bytes, this is due
to the op_negates that are never executed and do not
generate much.

* bytecode/ArithProfile.h:
(JSC::ArithProfile::ArithProfile):
(JSC::ArithProfile::observeLHS):
(JSC::ArithProfile::observeLHSAndRHS):
* bytecode/BytecodeList.json:
* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::addJITNegIC):
* bytecode/CodeBlock.h:
* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::emitUnaryOp):
* bytecompiler/BytecodeGenerator.h:
* bytecompiler/NodesCodegen.cpp:
(JSC::UnaryOpNode::emitBytecode):
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compileMathIC):
* dfg/DFGSpeculativeJIT.h:
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileMathIC):
* jit/CCallHelpers.h:
(JSC::CCallHelpers::setupArgumentsWithExecState):
* jit/JIT.h:
* jit/JITArithmetic.cpp:
(JSC::JIT::emit_op_negate):
(JSC::JIT::emitSlow_op_negate):
(JSC::JIT::emitMathICFast):
(JSC::JIT::emitMathICSlow):
* jit/JITInlines.h:
(JSC::JIT::callOperation):
* jit/JITMathIC.h:
(JSC::JITMathIC::generateInline):
(JSC::canGenerateWithBinaryProfile):
(JSC::canGenerateWithUnaryProfile):
* jit/JITMathICForwards.h:
* jit/JITNegGenerator.cpp:
(JSC::JITNegGenerator::generateInline):
(JSC::JITNegGenerator::generateFastPath):
* jit/JITNegGenerator.h:
(JSC::JITNegGenerator::JITNegGenerator):
(JSC::JITNegGenerator::arithProfile):
(JSC::JITNegGenerator::didEmitFastPath): Deleted.
(JSC::JITNegGenerator::endJumpList): Deleted.
(JSC::JITNegGenerator::slowPathJumpList): Deleted.
* jit/JITOperations.cpp:
* jit/JITOperations.h:
* llint/LowLevelInterpreter.asm:
* llint/LowLevelInterpreter32_64.asm:
* llint/LowLevelInterpreter64.asm:
* runtime/CommonSlowPaths.cpp:
(JSC::updateArithProfileForUnaryArithOp):
(JSC::SLOW_PATH_DECL):

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

2 years ago[ShadowDOM] Add support for Node.getRootNode(options)
cdumez@apple.com [Fri, 23 Sep 2016 01:54:05 +0000 (01:54 +0000)]
[ShadowDOM] Add support for Node.getRootNode(options)
https://bugs.webkit.org/show_bug.cgi?id=162457

Reviewed by Ryosuke Niwa.

LayoutTests/imported/w3c:

Rebaseline existing W3C DOM tests now that more checks are passing.

* web-platform-tests/dom/interfaces-expected.txt:
* web-platform-tests/dom/nodes/rootNode-expected.txt:

Source/WebCore:

Add support for Node.getRootNode(options):
- https://dom.spec.whatwg.org/#dom-node-getrootnode

No new tests, rebaselined existing tests.

* dom/EventPath.cpp:
(WebCore::RelatedNodeRetargeter::RelatedNodeRetargeter):
(WebCore::RelatedNodeRetargeter::checkConsistency):
* dom/Node.cpp:
(WebCore::Node::rootNode):
(WebCore::Node::shadowIncludingRoot):
(WebCore::Node::getRootNode):
* dom/Node.h:
* dom/Node.idl:
* editing/Editor.cpp:
(WebCore::correctSpellcheckingPreservingTextCheckingParagraph):
* xml/XPathPath.cpp:
(WebCore::XPath::LocationPath::evaluate):

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

2 years agoRemoved unused hasErrorInfo().
mark.lam@apple.com [Fri, 23 Sep 2016 01:15:53 +0000 (01:15 +0000)]
Removed unused hasErrorInfo().
https://bugs.webkit.org/show_bug.cgi?id=162473

Reviewed by Saam Barati.

* JavaScriptCore.order:
* runtime/Error.cpp:
(JSC::hasErrorInfo): Deleted.
* runtime/Error.h:

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

2 years agoAdd an API for getting the branch identifier from a Git or SVN checkout.
matthew_hanson@apple.com [Fri, 23 Sep 2016 01:14:59 +0000 (01:14 +0000)]
Add an API for getting the branch identifier from a Git or SVN checkout.
https://bugs.webkit.org/show_bug.cgi?id=151570
rdar://problem/17959831

Reviewed by David Kilzer.

This patch adds a function called svnIdentifierForPath. This function returns either "trunk",
the name of the tag, or the name of the branch, as appropriate. This function is necessary for
a VCSUtils client that is not checked in to the WebKit project.

This patch also breaks up pathRelativeToSVNRepositoryRootForPath into four functions:
- pathRelativeToSVNRepositoryRootForPath
- svnInfoForPath
- svnURLForPath
- svnRepositoryRootForPath

This allows us to reuse logic from pathRelativeToSVNRepositoryRootForPath in svnIdentifierForPath and
allows clients of VCSUtils to extract what arbitrary information from the `svn info` command regardless
of SCM.

* Scripts/VCSUtils.pm:
(svnInfoForPath):
Copied logic that previously lived in pathRelativeToSVNRepositoryRootForPath.
Make code safe to use for a path, and not just for the CWD.

(svnURLForPath):
Calls svnInfoForPath and extracts the URL.

(svnRepositoryRootForPath):
Calls svnInfoForPath and extracts the Repository Root.

(svnIdentifierForPath):
Calls pathRelativeToSVNRepositoryRootForPath and extracts the repository identifier.

(pathRelativeToSVNRepositoryRootForPath):
Now uses svnURLForPath and svnRepositoryRootForPath instead of being responsible for
determining both values.

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

2 years agoAdd long press selection test
commit-queue@webkit.org [Thu, 22 Sep 2016 23:53:33 +0000 (23:53 +0000)]
Add long press selection test
https://bugs.webkit.org/show_bug.cgi?id=162367

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

Tools:

Add support to UIScriptController to synthesize long press events on iOS.
This required adding long-press functionality to HIDEventGenerator.

HIDEventGenerator sends the touchDown, but must then send the touchUp with
a dispatch_after (rather than sleeping, as we do for other events) in order
for the gesture recognizers to correctly detect a long press.

Use the long press synthesis in a test that detects whether a long press
gesture triggers text selection.

Fixed incorrect constants. NSTimeInterval is in seconds, original numbers
were nanoseconds and typedefed to long without regard to the type
differences. Redid constants to be the right value, and converted upon use.

Cleaned up unused enum types.

* DumpRenderTree/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptController::longPressAtPoint):
(WTR::UIScriptController::forcePressAtPoint):
(WTR::UIScriptController::dragFromPointToPoint): Deleted.
* Scripts/webkitpy/common/config/contributors.json:
* TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
* TestRunnerShared/UIScriptContext/UIScriptController.cpp:
(WTR::UIScriptController::longPressAtPoint):
(WTR::UIScriptController::forcePressAtPoint):
(WTR::UIScriptController::dragFromPointToPoint): Deleted.
* TestRunnerShared/UIScriptContext/UIScriptController.h:
* WebKitTestRunner/ios/HIDEventGenerator.h:
* WebKitTestRunner/ios/HIDEventGenerator.mm:
(-[HIDEventGenerator _createIOHIDEventType:]):
(-[HIDEventGenerator sendTaps:location:withNumberOfTouches:completionBlock:]):
(-[HIDEventGenerator clearTap:]):
(-[HIDEventGenerator longPressTimerCall:]):
(-[HIDEventGenerator longPressFinish:completionBlock:]):
(-[HIDEventGenerator longPress:completionBlock:]):
(-[HIDEventGenerator forcePress:completionBlock:]):
* WebKitTestRunner/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptController::longPressAtPoint):
(WTR::UIScriptController::forcePressAtPoint):
(WTR::UIScriptController::dragFromPointToPoint): Deleted.

LayoutTests:

Added test for long press selection.

* fast/events/touch/ios/long-press-to-select-text-expected.txt: Added.
* fast/events/touch/ios/long-press-to-select-text.html: Added.

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

2 years agoArray.prototype.join should do overflow checks on string joins.
mark.lam@apple.com [Thu, 22 Sep 2016 23:41:56 +0000 (23:41 +0000)]
Array.prototype.join should do overflow checks on string joins.
https://bugs.webkit.org/show_bug.cgi?id=162459

Reviewed by Saam Barati.

JSTests:

* stress/array-join-on-strings-need-overflow-checks.js: Added.
(assert):
(catch):

Source/JavaScriptCore:

Change the 2 JSRopeString::create() functions that do joins to be private, and
force all clients of it to go through the jsString() utility functions that do
overflow checks before creating the ropes.

* dfg/DFGOperations.cpp:
* runtime/ArrayPrototype.cpp:
(JSC::slowJoin):
* runtime/JSString.h:
* runtime/Operations.h:
(JSC::jsString):

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

2 years agoIDBIndex.openCursor() matches indices on multiple object stores.
beidson@apple.com [Thu, 22 Sep 2016 22:34:02 +0000 (22:34 +0000)]
IDBIndex.openCursor() matches indices on multiple object stores.
<rdar://problem/28434463> and https://bugs.webkit.org/show_bug.cgi?id=158833

Reviewed by Alex Christensen.

Source/WebCore:

Tests: storage/indexeddb/modern/multiple-objectstore-index-cursor-collision-private.html
       storage/indexeddb/modern/multiple-objectstore-index-cursor-collision.html

* Modules/indexeddb/server/SQLiteIDBCursor.cpp:
(WebCore::IDBServer::buildIndexStatement): Need to include the object store id in the statement for
  index cursors, otherwise there will be collisions amongst multiple object stores that happen to
  share primary keys.
(WebCore::IDBServer::SQLiteIDBCursor::bindArguments):

LayoutTests:

* storage/indexeddb/modern/multiple-objectstore-index-cursor-collision-expected.txt: Added.
* storage/indexeddb/modern/multiple-objectstore-index-cursor-collision-private-expected.txt: Added.
* storage/indexeddb/modern/multiple-objectstore-index-cursor-collision-private.html: Added.
* storage/indexeddb/modern/multiple-objectstore-index-cursor-collision.html: Added.
* storage/indexeddb/modern/resources/multiple-objectstore-index-cursor-collision.js: Added.

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

2 years agoShowRenderTree: Shuffle letters to have better readability.
zalan@apple.com [Thu, 22 Sep 2016 21:56:02 +0000 (21:56 +0000)]
ShowRenderTree: Shuffle letters to have better readability.
https://bugs.webkit.org/show_bug.cgi?id=162460

Reviewed by Simon Fraser.
old: (B)lock/(I)nline/I(N)line-block, (R)elative/A(B)solute/Fi(X)ed/Stick(Y) positioned, (O)verflow clipping, (A)nonymous, (G)enerated, (F)loating, has(L)ayer, (C)omposited, (D)irty layout, Dirty (S)tyle.
new: (B)lock/(I)nline/I(N)line-block, (A)bsolute/Fi(X)ed/(R)elative/Stic(K)y, (F)loating, (O)verflow clip, Anon(Y)mous, (G)enerated, has(L)ayer, (C)omposited, (+)Dirty style, (+)Dirty layout.

Not testable.

* rendering/RenderObject.cpp:
(WebCore::showRenderTreeLegend):
(WebCore::RenderObject::showRenderObject):

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

2 years ago[CSP] Violation report may be sent to wrong domain on frame-ancestors violation
dbates@webkit.org [Thu, 22 Sep 2016 21:39:29 +0000 (21:39 +0000)]
[CSP] Violation report may be sent to wrong domain on frame-ancestors violation
https://bugs.webkit.org/show_bug.cgi?id=162079
<rdar://problem/28321575>

Reviewed by Andy Estes.

Source/WebCore:

Fixes an issue where a CSP violation report may be sent to the wrong domain when the
frame-ancestors directive is violated. In particular, when the frame-ancestors directive
is violated for a page that specifies a report URI that is a relative URL then the
report URI would be resolved with respect to the parent frame's document URL and hence
be sent to the domain of the parent frame's document.

* page/csp/ContentSecurityPolicy.cpp:
(WebCore::ContentSecurityPolicy::reportViolation): Adjust the report URL with respect
to the blocked URL when we do not have a script execution context.

LayoutTests:

Modified http/tests/security/contentSecurityPolicy/resources/save-report.php to print the HTTP Host header as a means
to validate that the CSP violation report was sent to the appropriate host. Update test expectations.

Note that the presence of "localhost" in the HTTP Host header in the test results for tests
security/contentSecurityPolicy/1.1/frame-ancestors/report-frame-ancestors-cross-origin.html and
security/contentSecurityPolicy/1.1/frame-ancestors/report-frame-ancestors-cross-origin-https.html
verify that we resolve a relative URL CSP report URI with respect to the blocked URL.

* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/report-frame-ancestors-cross-origin-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/report-frame-ancestors-cross-origin-https-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/report-frame-ancestors-cross-origin-https.html:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/report-frame-ancestors-cross-origin.html:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/report-frame-ancestors-same-origin-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/report-frame-ancestors-same-origin-https-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/report-frame-ancestors-same-origin-https.html:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/report-frame-ancestors-same-origin.html:
* http/tests/security/contentSecurityPolicy/1.1/report-uri-effective-directive-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/script-blocked-sends-multiple-reports-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/scripthash-allowed-by-enforced-policy-and-blocked-by-report-policy-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/scripthash-allowed-by-enforced-policy-and-blocked-by-report-policy2-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/scripthash-allowed-by-legacy-enforced-policy-and-blocked-by-report-policy-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/scripthash-allowed-by-legacy-enforced-policy-and-blocked-by-report-policy2-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/scripthash-blocked-by-enforced-policy-and-allowed-by-report-policy-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/scripthash-blocked-by-legacy-enforced-policy-and-allowed-by-report-policy-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/scripthash-blocked-by-legacy-enforced-policy-and-blocked-by-report-policy-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/scripthash-blocked-by-legacy-enforced-policy-and-blocked-by-report-policy2-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/scriptnonce-blocked-by-enforced-policy-and-allowed-by-report-policy-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/scriptnonce-blocked-by-legacy-enforced-policy-and-allowed-by-report-policy-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/scriptnonce-blocked-by-legacy-enforced-policy-and-blocked-by-report-policy-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/scriptnonce-blocked-by-legacy-enforced-policy-and-blocked-by-report-policy2-expected.txt:
* http/tests/security/contentSecurityPolicy/report-and-enforce-expected.txt:
* http/tests/security/contentSecurityPolicy/report-blocked-data-uri-expected.txt:
* http/tests/security/contentSecurityPolicy/report-blocked-file-uri-expected.txt:
* http/tests/security/contentSecurityPolicy/report-blocked-uri-cross-origin-expected.txt:
* http/tests/security/contentSecurityPolicy/report-blocked-uri-expected.txt:
* http/tests/security/contentSecurityPolicy/report-cross-origin-no-cookies-expected.txt:
* http/tests/security/contentSecurityPolicy/report-cross-origin-no-cookies-when-private-browsing-enabled-expected.txt:
* http/tests/security/contentSecurityPolicy/report-cross-origin-no-cookies-when-private-browsing-toggled-expected.txt:
* http/tests/security/contentSecurityPolicy/report-only-expected.txt:
* http/tests/security/contentSecurityPolicy/report-only-from-header-expected.txt:
* http/tests/security/contentSecurityPolicy/report-only-upgrade-insecure-expected.txt:
* http/tests/security/contentSecurityPolicy/report-same-origin-no-cookies-when-private-browsing-toggled-expected.txt:
* http/tests/security/contentSecurityPolicy/report-same-origin-with-cookies-expected.txt:
* http/tests/security/contentSecurityPolicy/report-same-origin-with-cookies-when-private-browsing-enabled-expected.txt:
* http/tests/security/contentSecurityPolicy/report-status-code-zero-when-using-https-expected.txt:
* http/tests/security/contentSecurityPolicy/report-uri-expected.txt:
* http/tests/security/contentSecurityPolicy/report-uri-from-child-frame-expected.txt:
* http/tests/security/contentSecurityPolicy/report-uri-from-inline-javascript-expected.txt:
* http/tests/security/contentSecurityPolicy/report-uri-from-javascript-expected.txt:
* http/tests/security/contentSecurityPolicy/report-uri-scheme-relative-expected.txt:
* http/tests/security/contentSecurityPolicy/resources/save-report.php:
* http/tests/security/xssAuditor/report-script-tag-expected.txt:
* http/tests/security/xssAuditor/report-script-tag-full-block-expected.txt:
* http/tests/security/xssAuditor/report-script-tag-replace-state-expected.txt:

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

2 years ago[XSS Auditor] HTML5 entities can bypass XSS Auditor
dbates@webkit.org [Thu, 22 Sep 2016 21:34:12 +0000 (21:34 +0000)]
[XSS Auditor] HTML5 entities can bypass XSS Auditor
https://bugs.webkit.org/show_bug.cgi?id=161939
<rdar://problem/25819815>

Reviewed by David Kilzer.

Source/WebCore:

Merged from Blink:
<https://chromium.googlesource.com/chromium/src/+/04e44060dccee711842d08652bf1c622a0f43179>

Truncate a src-like URL at the first & character as it may mark the start of an HTML entity.
We will evaluate the effectiveness of this approach and adjust it if necessary if we see an
increase in false positives.

HTML5 defines more named character references, including named character references for common
punctuation characters. Characters following some punctuation characters may come from the page
itself. We truncate src-like strings at punctuation characters to avoid considering such page
content when performing a match.

Test: http/tests/security/xssAuditor/script-tag-with-source-data-url5.html

* html/parser/XSSAuditor.cpp:
(WebCore::truncateForSrcLikeAttribute):

LayoutTests:

* http/tests/security/xssAuditor/script-tag-with-source-data-url5-expected.txt: Added.
* http/tests/security/xssAuditor/script-tag-with-source-data-url5.html: Added.

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

2 years ago[XSS Auditor] Truncate data URLs at quotes
dbates@webkit.org [Thu, 22 Sep 2016 21:33:20 +0000 (21:33 +0000)]
[XSS Auditor] Truncate data URLs at quotes
https://bugs.webkit.org/show_bug.cgi?id=161937

Reviewed by David Kilzer.

Source/WebCore:

Merged from Blink:
<https://chromium.googlesource.com/chromium/src/+/c6d6331190dd43f09459e2341c3111e796f9de12/>

Truncate a data URL at the first single or double quote character to avoid considering
characters that may come from the page content following an injected data URL.

Test: http/tests/security/xssAuditor/script-tag-with-source-data-url4.html

* html/parser/XSSAuditor.cpp:
(WebCore::truncateForSrcLikeAttribute):

LayoutTests:

* http/tests/security/xssAuditor/resources/echo-property.pl:
* http/tests/security/xssAuditor/script-tag-with-source-data-url4-expected.txt: Added.
* http/tests/security/xssAuditor/script-tag-with-source-data-url4.html: Added.

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

2 years agoRemove more ENABLE(TEXT_AUTOSIZING) code
dbates@webkit.org [Thu, 22 Sep 2016 21:22:32 +0000 (21:22 +0000)]
Remove more ENABLE(TEXT_AUTOSIZING) code
https://bugs.webkit.org/show_bug.cgi?id=162456

Reviewed by Simon Fraser.

.:

* Source/cmake/tools/vsprops/FeatureDefines.props:
* Source/cmake/tools/vsprops/FeatureDefinesCairo.props:

Source/WebCore:

* page/Settings.in:
* rendering/style/StyleVisualData.h:
(WebCore::StyleVisualData::operator==):

Source/WebKit2:

* UIProcess/API/efl/ewk_settings.cpp:
(ewk_settings_text_autosizing_enabled_set):
(ewk_settings_text_autosizing_enabled_get):
* UIProcess/API/efl/tests/test_ewk2_settings.cpp:
(TEST_F):

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

2 years agoFences on x86 should be a lot cheaper
fpizlo@apple.com [Thu, 22 Sep 2016 21:11:42 +0000 (21:11 +0000)]
Fences on x86 should be a lot cheaper
https://bugs.webkit.org/show_bug.cgi?id=162417

Reviewed by Mark Lam and Geoffrey Garen.
Source/JavaScriptCore:

It turns out that:

    lock; orl $0, (%rsp)

does everything that we wanted from:

    mfence

And it's a lot faster. When I tried mfence for making object visiting concurrent-GC-TSO-
friendly, it was a 9% regression on Octane/splay. But when I tried ortop, it was neutral.
So, we should use ortop from now on.

This part of the change is for the JITs. MacroAssembler::memoryFence() appears to always
mean something like an acqrel fence, so it's safe to make this use ortop. Since B3's Fence
compiles to Air MemoryFence, which is just MacroAssembler::memoryFence(), this also changes
B3 codegen.

* assembler/MacroAssemblerX86Common.h:
(JSC::MacroAssemblerX86Common::memoryFence):
* assembler/X86Assembler.h:
(JSC::X86Assembler::lock):
* b3/testb3.cpp:
(JSC::B3::testX86MFence):
(JSC::B3::testX86CompilerFence):

Source/WTF:

It turns out that:

    lock; orl $0, (%rsp)

does everything that we wanted from:

    mfence

And it's a lot faster. When I tried mfence for making object visiting concurrent-GC-TSO-
friendly, it was a 9% regression on Octane/splay. But when I tried ortop, it was neutral.
So, we should use ortop from now on.

This part of the change just affects our Atomics. I also changed this in the JITs.

* wtf/Atomics.h:
(WTF::x86_ortop):
(WTF::storeLoadFence):
(WTF::x86_mfence): Deleted.

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

2 years agoFullscreen controls inoperative in WebKitLegacy web views
jer.noble@apple.com [Thu, 22 Sep 2016 20:54:56 +0000 (20:54 +0000)]
Fullscreen controls inoperative in WebKitLegacy web views
https://bugs.webkit.org/show_bug.cgi?id=162374

Reviewed by Eric Carlson.

After r205365, the WebPlaybackSessionInterfaceAVKit was now created after the
WebPlaybackSessionModel which fed it data, so it no longer received the burst of data upon
creation. Instead, it should have always asked the model for its cached data as soon as it
was connected to set up its inital state.

* platform/ios/WebPlaybackSessionInterfaceAVKit.mm:
(WebCore::WebPlaybackSessionInterfaceAVKit::WebPlaybackSessionInterfaceAVKit):

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

2 years agotest262: Function length should be number of parameters before parameters with defaul...
commit-queue@webkit.org [Thu, 22 Sep 2016 19:11:23 +0000 (19:11 +0000)]
test262: Function length should be number of parameters before parameters with default values
https://bugs.webkit.org/show_bug.cgi?id=162377

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2016-09-22
Reviewed by Saam Barati.

JSTests:

* stress/es6-default-parameters.js:
Add our own tests for function lengths with default parameters.

* test262.yaml:
We now pass all dflt-length tests.

Source/JavaScriptCore:

https://tc39.github.io/ecma262/#sec-function-definitions-static-semantics-expectedargumentcount

> NOTE: The ExpectedArgumentCount of a FormalParameterList is the number of
> FormalParameters to the left of either the rest parameter or the first
> FormalParameter with an Initializer. A FormalParameter without an
> initializer is allowed after the first parameter with an initializer
> but such parameters are considered to be optional with undefined as
> their default value.

Alongside the parameterCount value, maintain a separate count,
functionLength, which will be the count before seeing a rest parameter
or parameter with a default value. This will be the function's length.

* bytecode/UnlinkedCodeBlock.h:
* bytecode/UnlinkedFunctionExecutable.cpp:
(JSC::UnlinkedFunctionExecutable::UnlinkedFunctionExecutable):
* bytecode/UnlinkedFunctionExecutable.h:
* parser/ASTBuilder.h:
(JSC::ASTBuilder::createFunctionMetadata):
* parser/Nodes.cpp:
(JSC::FunctionMetadataNode::FunctionMetadataNode):
* parser/Nodes.h:
* parser/Parser.cpp:
(JSC::Parser<LexerType>::isArrowFunctionParameters):
(JSC::Parser<LexerType>::parseGeneratorFunctionSourceElements):
(JSC::Parser<LexerType>::parseFormalParameters):
(JSC::Parser<LexerType>::parseFunctionBody):
(JSC::Parser<LexerType>::parseFunctionParameters):
(JSC::Parser<LexerType>::parseFunctionInfo):
* parser/Parser.h:
* parser/ParserFunctionInfo.h:
* parser/SourceProviderCacheItem.h:
(JSC::SourceProviderCacheItem::SourceProviderCacheItem):
* parser/SyntaxChecker.h:
(JSC::SyntaxChecker::createFunctionMetadata):
* runtime/Executable.h:
* runtime/JSFunction.cpp:
(JSC::JSFunction::createBuiltinFunction):
(JSC::JSFunction::reifyLength):

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

2 years agoRemove a bunch of unnecessary includes
joepeck@webkit.org [Thu, 22 Sep 2016 18:59:47 +0000 (18:59 +0000)]
Remove a bunch of unnecessary includes
https://bugs.webkit.org/show_bug.cgi?id=162376

Reviewed by Mark Lam.

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

2 years agoFix serialization of HTML void elements when they have children
cdumez@apple.com [Thu, 22 Sep 2016 18:47:34 +0000 (18:47 +0000)]
Fix serialization of HTML void elements when they have children
https://bugs.webkit.org/show_bug.cgi?id=162418

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Rebaseline W3C test now that more checks are passing.

* web-platform-tests/html/syntax/serializing-html-fragments/serializing-expected.txt:

Source/WebCore:

Fix serialization of HTML void elements when they have children.

Void elements (such as <hr>) cannot have a closing tag. When
encountering them, we would properly not serialize the void
element's children (if it had any). However, we would incorrectly
append an end tag (because the element technically has children).

Relevant specification:
- https://html.spec.whatwg.org/#html-fragment-serialisation-algorithm

In particular, this part:
""
If current node is an area, base, basefont, bgsound, br, col, embed,
frame, hr, img, input, keygen, link, meta, param, source, track or wbr
element, then continue on to the next child node at this point.
""

Firefox matches the specification.

No new tests, rebaselined existing test.

* editing/MarkupAccumulator.cpp:
(WebCore::MarkupAccumulator::serializeNodesWithNamespaces):

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

2 years ago[WinCairo] Fix build after r206196
commit-queue@webkit.org [Thu, 22 Sep 2016 18:43:40 +0000 (18:43 +0000)]
[WinCairo] Fix build after r206196

Patch by Don Olmstead <don.olmstead@am.sony.com> on 2016-09-22
Reviewed by Alex Christensen.

* platform/text/win/LocaleWin.cpp:
(WebCore::LocaleWin::getLocaleInfoString):

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

2 years agoMarking imported/w3c/web-platform-tests/media-source/mediasource-duration.html as...
ryanhaddad@apple.com [Thu, 22 Sep 2016 18:30:33 +0000 (18:30 +0000)]
Marking imported/w3c/web-platform-tests/media-source/mediasource-duration.html as flaky on mac.
https://bugs.webkit.org/show_bug.cgi?id=162308

Unreviewed test gardening.

* platform/mac/TestExpectations:

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

2 years agoUnreviewed, rolling out r206112.
ryanhaddad@apple.com [Thu, 22 Sep 2016 18:19:49 +0000 (18:19 +0000)]
Unreviewed, rolling out r206112.

This change made inspector/network/xhr-json-blob-has-
content.html very flaky.

Reverted changeset:

"Web Inspector: adopt Object.awaitEvent in
LayoutTests/inspector/network"
https://bugs.webkit.org/show_bug.cgi?id=162099
http://trac.webkit.org/changeset/206112

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

2 years agoimported/w3c/web-platform-tests/resource-timing/idlharness.html is flaky
commit-queue@webkit.org [Thu, 22 Sep 2016 17:59:34 +0000 (17:59 +0000)]
imported/w3c/web-platform-tests/resource-timing/idlharness.html is flaky
https://bugs.webkit.org/show_bug.cgi?id=162414

Unreviewed.

Patch by Youenn Fablet <youenn@apple.com> on 2016-09-22

* TestExpectations:

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

2 years agoAutomatic Text Replacement Testing in WebKit2
jbedard@apple.com [Thu, 22 Sep 2016 17:39:51 +0000 (17:39 +0000)]
Automatic Text Replacement Testing in WebKit2
https://bugs.webkit.org/show_bug.cgi?id=161919

Reviewed by Ryosuke Niwa.

Source/WebCore:

Fixing existing tests:
    editing/inserting/smart-link-when-caret-is-moved-before-URL.html
    editing/inserting/typing-space-to-trigger-smart-link.html

Implemented test hooks for text replacement for WebKit2.
Note that spell checking has not been implemented, so most tests which use text replacement still fail.

* testing/Internals.cpp:
(WebCore::Internals::Internals): Reset TextChecker.
(WebCore::Internals::setContinuousSpellCheckingEnabled): Converted exception to an assert.
(WebCore::Internals::setAutomaticQuoteSubstitutionEnabled): Converted exception to an assert.
(WebCore::Internals::setAutomaticLinkDetectionEnabled): Converted exception to an assert.
(WebCore::Internals::setAutomaticDashSubstitutionEnabled): Converted exception to an assert.
(WebCore::Internals::setAutomaticTextReplacementEnabled): Converted exception to an assert.
(WebCore::Internals::setAutomaticSpellingCorrectionEnabled): Converted exception to an assert.
* testing/Internals.h: Removed exception argument for TextChecker setters.
* testing/Internals.idl: Ditto.

Source/WebKit2:

Implemented test hooks for text replacement for WebKit2.
Note that spell checking has not been implemented, so most tests which use text replacement still fail.

* UIProcess/API/C/WKTextChecker.cpp: Added #ifdefs to include file for iOS and Mac.
(WKTextCheckerSetTestingMode): Added.
* UIProcess/API/C/WKTextChecker.h: Added #ifdefs to include file for iOS and Mac.
* UIProcess/TextChecker.h: Added hooks to bypass writing to NSUserDefaults.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::toggleSmartInsertDelete):  New message to toggle TextChecker flag.
(WebKit::WebPageProxy::toggleAutomaticQuoteSubstitution): Ditto.
(WebKit::WebPageProxy::toggleAutomaticLinkDetection): Ditto.
(WebKit::WebPageProxy::toggleAutomaticDashSubstitution): Ditto.
(WebKit::WebPageProxy::toggleAutomaticTextReplacement): Ditto.
* UIProcess/WebPageProxy.h: Added messages to toggle TextChecker flags.
* UIProcess/WebPageProxy.messages.in: Ditto.
* UIProcess/efl/TextCheckerEfl.cpp: Implemented new TextChecker hooks for non-Cocoa platforms.
* UIProcess/gtk/TextCheckerGtk.cpp: Ditto.
(WebKit::TextChecker::mutableState): Ditto.
* UIProcess/ios/TextCheckerIOS.mm: Implemented new TextChecker hooks.
(WebKit::TextChecker::mutableState): Allow modification of text checker without writing to NSUserDefaults.
(WebKit::TextChecker::state): Call mutableState.
(WebKit::TextChecker::accessSmartInsertDeleteEnabled): Dummy function.
* UIProcess/mac/TextCheckerMac.mm:
(WebKit::refresh): Reload TextChecker configuration from NSUserDefaults.
(WebKit::TextChecker::mutableState): Allow modification of text checker without writing to NSUserDefaults.
(WebKit::TextChecker::state): Call mutableState().
(WebKit::TextChecker::accessSmartInsertDeleteEnabled): Allow toggling of smartInsertDeleteEnabled without writing to NSUserDefaults.
(WebKit::initializeState): Deleted.
* WebProcess/InjectedBundle/API/c/WKBundle.cpp:
(WKBundleSetAutomaticLinkDetectionEnabled): Deleted.
* WebProcess/InjectedBundle/API/c/WKBundlePrivate.h: Removed WKBundleSetAutomaticLinkDetectionEnabled.
* WebProcess/InjectedBundle/InjectedBundle.cpp:
(WebKit::InjectedBundle::setAutomaticLinkDetectionEnabled): Deleted.
* WebKit2.xcodeproj/project.pbxproj: Added WKTextChecker to Mac and iOS.
* WebProcess/InjectedBundle/InjectedBundle.h: Remove setAutomaticLinkDetectionEnabled.
* WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm:
(WebKit::WebEditorClient::toggleSmartInsertDelete): Send message to UI process to toggle TextChecker.
(WebKit::WebEditorClient::toggleAutomaticQuoteSubstitution): Ditto.
(WebKit::WebEditorClient::toggleAutomaticLinkDetection): Ditto.
(WebKit::WebEditorClient::toggleAutomaticDashSubstitution): Ditto.
(WebKit::WebEditorClient::toggleAutomaticTextReplacement): Ditto.

Tools:

Implemented test hooks for text replacement for WebKit2.
Note that spell checking has not been implemented, so most tests which use text replacement still fail.

* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl: Removed setAutomaticLinkDetectionEnabled from TestRunner, moved to Internals.
* WebKitTestRunner/InjectedBundle/InjectedBundle.cpp: Ditto.
(WTR::InjectedBundle::beginTesting): Ditto.
* WebKitTestRunner/InjectedBundle/TestRunner.cpp: Ditto.
* WebKitTestRunner/InjectedBundle/TestRunner.h: Ditto.
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::runTest): Place TextChecker into testing mode.

LayoutTests:

Implemented test hooks for text replacement for WebKit2.
Note that spell checking has not been implemented, so most tests which use text replacement still fail.

* editing/inserting/smart-link-when-caret-is-moved-before-URL.html: Use internals instead of TestRunner.
* editing/inserting/typing-space-to-trigger-smart-link.html: Ditto.
* platform/efl/TestExpectations: Added port specific tests.
* platform/gtk/TestExpectations: Added port specific tests.
* platform/ios-simulator/TestExpectations: Added port specific tests.
* platform/ios-simulator-wk1/TestExpectations: Moved skipped tests to ios-simulator.
* platform/ios-simulator-wk2/TestExpectations: Moved skipped tests to ios-simulator.
* platform/mac-wk2/TestExpectations: Removed passing test.
* platform/win/TestExpectations: Added port specific tests.
* platform/wk2/TestExpectations: Added better explanation for failing test.

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

2 years agoSync web-platform-tests up to revision 3801ab5
commit-queue@webkit.org [Thu, 22 Sep 2016 16:20:59 +0000 (16:20 +0000)]
Sync web-platform-tests up to revision 3801ab5
https://bugs.webkit.org/show_bug.cgi?id=162375

Patch by Youenn Fablet <youenn@apple.com> on 2016-09-22
Reviewed by Chris Dumez.

LayoutTests/imported/w3c:

* resources/ImportExpectations:
* resources/TestRepositories:
* resources/resource-files.json:
* resources/web-platform-tests-modules.json:
* web-platform-tests/IndexedDB/idbindex-multientry-big-expected.txt:
* web-platform-tests/XMLHttpRequest/responsexml-document-properties-expected.txt:
* web-platform-tests/XMLHttpRequest/send-entity-body-document-expected.txt:
* web-platform-tests/XMLHttpRequest/setrequestheader-header-allowed.htm:
* web-platform-tests/dom/interfaces-expected.txt:
* web-platform-tests/dom/interfaces.html:
* web-platform-tests/dom/nodes/Document-createEvent-expected.txt:
* web-platform-tests/dom/nodes/Document-createEvent.html:
* web-platform-tests/dom/nodes/NodeList-Iterable.html: Added.
* web-platform-tests/dom/nodes/rootNode.html: Added.
* web-platform-tests/dom/nodes/w3c-import.log:
* web-platform-tests/fetch/api/cors/cors-multiple-origins-expected.txt:
* web-platform-tests/fetch/api/cors/cors-multiple-origins-worker-expected.txt:
* web-platform-tests/fetch/api/cors/cors-preflight-referrer-expected.txt:
* web-platform-tests/fetch/api/cors/cors-preflight-referrer-worker-expected.txt:
* web-platform-tests/fetch/api/cors/cors-preflight-referrer.js:
(corsPreflightReferrer):
* web-platform-tests/fetch/api/redirect/redirect-to-dataurl-expected.txt:
* web-platform-tests/fetch/api/redirect/redirect-to-dataurl-worker-expected.txt:
* web-platform-tests/fetch/api/redirect/redirect-to-dataurl.js:
(redirectDataURL):
* web-platform-tests/fetch/api/response/response-static-redirect.html:
* web-platform-tests/html/browsers/origin/cross-origin-objects/cross-origin-objects-expected.txt:
* web-platform-tests/html/browsers/origin/cross-origin-objects/cross-origin-objects.html:
* web-platform-tests/html/browsers/origin/origin-of-data-document.html: Added.
* web-platform-tests/html/browsers/origin/w3c-import.log: Copied from LayoutTests/imported/w3c/web-platform-tests/html/semantics/tabular-data/w3c-import.log.
* web-platform-tests/html/browsers/windows/nested-browsing-contexts/frameElement.sub-expected.txt:
* web-platform-tests/html/browsers/windows/targeting-cross-origin-nested-browsing-contexts.sub-expected.txt:
* web-platform-tests/html/dom/documents/dom-tree-accessors/document.forms-expected.txt:
* web-platform-tests/html/dom/documents/dom-tree-accessors/document.forms.html:
* web-platform-tests/html/dom/elements-embedded.js:
* web-platform-tests/html/dom/elements-metadata.js:
* web-platform-tests/html/dom/elements-tabular.js:
* web-platform-tests/html/dom/elements-text.js:
* web-platform-tests/html/dom/interfaces-expected.txt:
* web-platform-tests/html/dom/reflection-embedded-expected.txt:
* web-platform-tests/html/dom/reflection-metadata-expected.txt:
* web-platform-tests/html/dom/reflection-tabular-expected.txt:
* web-platform-tests/html/dom/reflection-text-expected.txt:
* web-platform-tests/html/dom/reflection.js:
(ReflectionTests.resolveUrl):
(ReflectionTests.parseNonneg): Deleted.
(ReflectionTests.parseInt): Deleted.
* web-platform-tests/html/semantics/document-metadata/the-link-element/document-without-browsing-context-expected.txt:
* web-platform-tests/html/semantics/document-metadata/the-style-element/historical.html: Added.
* web-platform-tests/html/semantics/document-metadata/the-style-element/style_scoped-expected.txt: Removed.
* web-platform-tests/html/semantics/document-metadata/the-style-element/style_scoped.html: Removed.
* web-platform-tests/html/semantics/document-metadata/the-style-element/w3c-import.log:
* web-platform-tests/html/semantics/embedded-content/media-elements/historical-expected.txt:
* web-platform-tests/html/semantics/embedded-content/media-elements/historical.html:
* web-platform-tests/html/semantics/embedded-content/media-elements/interfaces/HTMLElement/HTMLTrackElement/src-expected.txt:
* web-platform-tests/html/semantics/embedded-content/media-elements/interfaces/HTMLElement/HTMLTrackElement/src.html:
* web-platform-tests/html/semantics/embedded-content/the-area-element/area-shape-expected.txt:
* web-platform-tests/html/semantics/embedded-content/the-area-element/area-shape.html:
* web-platform-tests/html/semantics/embedded-content/the-canvas-element/historical-expected.txt:
* web-platform-tests/html/semantics/embedded-content/the-canvas-element/historical.html:
* web-platform-tests/html/semantics/embedded-content/the-iframe-element/historical.html: Added.
* web-platform-tests/html/semantics/embedded-content/the-iframe-element/w3c-import.log:
* web-platform-tests/html/semantics/embedded-content/the-img-element/environment-changes/viewport-change-expected.txt:
* web-platform-tests/html/semantics/embedded-content/the-img-element/nonexistent-image.html: Added.
* web-platform-tests/html/semantics/embedded-content/the-img-element/w3c-import.log:
* web-platform-tests/html/semantics/forms/constraints/form-validation-checkValidity-expected.txt:
* web-platform-tests/html/semantics/forms/constraints/form-validation-checkValidity.html:
* web-platform-tests/html/semantics/forms/constraints/form-validation-reportValidity-expected.txt:
* web-platform-tests/html/semantics/forms/constraints/form-validation-reportValidity.html:
* web-platform-tests/html/semantics/forms/constraints/form-validation-validity-rangeOverflow-expected.txt:
* web-platform-tests/html/semantics/forms/constraints/form-validation-validity-rangeOverflow.html:
* web-platform-tests/html/semantics/forms/constraints/form-validation-validity-rangeUnderflow-expected.txt:
* web-platform-tests/html/semantics/forms/constraints/form-validation-validity-rangeUnderflow.html:
* web-platform-tests/html/semantics/forms/constraints/form-validation-validity-stepMismatch-expected.txt:
* web-platform-tests/html/semantics/forms/constraints/form-validation-validity-stepMismatch.html:
* web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valid-expected.txt:
* web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valid.html:
* web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valueMissing-expected.txt:
* web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valueMissing.html:
* web-platform-tests/html/semantics/forms/constraints/form-validation-willValidate-expected.txt:
* web-platform-tests/html/semantics/forms/constraints/form-validation-willValidate.html:
* web-platform-tests/html/semantics/forms/textfieldselection/selection-not-application-expected.txt:
* web-platform-tests/html/semantics/forms/textfieldselection/selection-not-application.html:
* web-platform-tests/html/semantics/forms/the-input-element/cloning-steps.html: Added.
* web-platform-tests/html/semantics/forms/the-input-element/datetime-2-expected.txt: Removed.
* web-platform-tests/html/semantics/forms/the-input-element/datetime-2.html: Removed.
* web-platform-tests/html/semantics/forms/the-input-element/files-expected.txt:
* web-platform-tests/html/semantics/forms/the-input-element/files.html:
* web-platform-tests/html/semantics/forms/the-input-element/month-expected.txt:
* web-platform-tests/html/semantics/forms/the-input-element/month.html:
* web-platform-tests/html/semantics/forms/the-input-element/type-change-state-expected.txt:
* web-platform-tests/html/semantics/forms/the-input-element/type-change-state.html:
* web-platform-tests/html/semantics/forms/the-input-element/valueMode-expected.txt:
* web-platform-tests/html/semantics/forms/the-input-element/valueMode.html:
* web-platform-tests/html/semantics/forms/the-input-element/w3c-import.log:
* web-platform-tests/html/semantics/forms/the-option-element/option-form.html: Added.
* web-platform-tests/html/semantics/forms/the-option-element/w3c-import.log:
* web-platform-tests/html/semantics/forms/the-textarea-element/cloning-steps.html:
* web-platform-tests/html/semantics/forms/the-textarea-element/w3c-import.log:
* web-platform-tests/html/semantics/forms/the-textarea-element/wrap-reflect-1a-expected.html: Added.
* web-platform-tests/html/semantics/forms/the-textarea-element/wrap-reflect-1a.html: Added.
* web-platform-tests/html/semantics/forms/the-textarea-element/wrap-reflect-1b-expected.html: Added.
* web-platform-tests/html/semantics/forms/the-textarea-element/wrap-reflect-1b.html: Added.
* web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-close-expected.txt:
* web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-close.html:
* web-platform-tests/html/semantics/scripting-1/the-script-element/historical.html: Added.
* web-platform-tests/html/semantics/scripting-1/the-script-element/script-before-after-events-expected.txt: Removed.
* web-platform-tests/html/semantics/scripting-1/the-script-element/script-before-after-events.html: Removed.
* web-platform-tests/html/semantics/scripting-1/the-script-element/w3c-import.log:
* web-platform-tests/html/semantics/tabular-data/historical.html: Added.
* web-platform-tests/html/semantics/tabular-data/w3c-import.log:
* web-platform-tests/html/semantics/text-level-semantics/historical.html: Added.
* web-platform-tests/html/semantics/text-level-semantics/w3c-import.log: Renamed from LayoutTests/imported/w3c/web-platform-tests/html/the-xhtml-syntax/parsing-xhtml-documents/w3c-import.log.
* web-platform-tests/html/syntax/parsing/foreign_content_001.html: Added.
* web-platform-tests/html/syntax/parsing/foreign_content_003.html: Added.
* web-platform-tests/html/syntax/parsing/foreign_content_004.html: Added.
* web-platform-tests/html/syntax/parsing/foreign_content_005.html: Added.
* web-platform-tests/html/syntax/parsing/foreign_content_006.html: Added.
* web-platform-tests/html/syntax/parsing/foreign_content_008.html: Added.
* web-platform-tests/html/syntax/parsing/foreign_content_009.html: Added.
* web-platform-tests/html/syntax/parsing/foreign_content_010.html: Added.
* web-platform-tests/html/syntax/parsing/foreign_content_013.html: Added.
* web-platform-tests/media-source/import_tests.sh:
* web-platform-tests/media-source/mediasource-append-buffer-expected.txt:
* web-platform-tests/media-source/mediasource-is-type-supported-expected.txt:
* web-platform-tests/media-source/mediasource-sourcebuffer-mode-expected.txt:
* web-platform-tests/media-source/mp4/w3c-import.log: Added.
* web-platform-tests/media-source/w3c-import.log: Added.
* web-platform-tests/media-source/webm/w3c-import.log: Added.
* web-platform-tests/resource-timing/idlharness-expected.txt: Added.
* web-platform-tests/resource-timing/idlharness.html: Added.
* web-platform-tests/resource-timing/resource-timing-expected.txt:
* web-platform-tests/resource-timing/resource-timing.js:
(window.onload):
* web-platform-tests/resource-timing/w3c-import.log:

LayoutTests:

* platform/ios-simulator-wk2/imported/w3c/web-platform-tests/html/dom/reflection-embedded-expected.txt: Added.
* platform/ios-simulator-wk2/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-checkValidity-expected.txt: Added.
* platform/ios-simulator-wk2/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-reportValidity-expected.txt: Added.
* platform/ios-simulator-wk2/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-rangeOverflow-expected.txt: Added.
* platform/ios-simulator-wk2/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-rangeUnderflow-expected.txt: Added.
* platform/ios-simulator-wk2/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-stepMismatch-expected.txt: Added.
* platform/ios-simulator-wk2/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valid-expected.txt: Added.
* platform/ios-simulator-wk2/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valueMissing-expected.txt: Added.
* platform/ios-simulator-wk2/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-willValidate-expected.txt: Added.
* platform/ios-simulator-wk2/imported/w3c/web-platform-tests/html/semantics/forms/textfieldselection/selection-not-application-expected.txt: Added.
* platform/ios-simulator-wk2/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/month-expected.txt: Added.
* platform/ios-simulator-wk2/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/type-change-state-expected.txt: Added.
* platform/ios-simulator-wk2/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/valueMode-expected.txt: Added.
* platform/ios-simulator-wk2/imported/w3c/web-platform-tests/resource-timing/idlharness-expected.txt: Added.
* platform/wk2/imported/w3c/web-platform-tests/html/semantics/document-metadata/styling/LinkStyle-expected.txt:
* tests-options.json:

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

2 years agoAX: aria-pressed state not correctly conveyed to VoiceOver iOS on <button> unless...
n_wang@apple.com [Thu, 22 Sep 2016 15:14:27 +0000 (15:14 +0000)]
AX: aria-pressed state not correctly conveyed to VoiceOver iOS on <button> unless role=button added
https://bugs.webkit.org/show_bug.cgi?id=162269

Reviewed by Chris Fleizach.

Source/WebCore:

<button> with aria-pressed attribute has a toggle button role, however, we were looking for explicit
roles in order to convey the aria-press state. Since there's no spec requiring authors explicitly defining
default ARIA semantics in such case, I'm exposing the aria-pressed state for all valid toggle buttons.

Changes are covered in modified test.

* accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::isPressed):

LayoutTests:

Added test cases and also fixed a wrong expected output.

* accessibility/ios-simulator/aria-pressed-state-expected.txt:
* accessibility/ios-simulator/aria-pressed-state.html:

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

2 years agoAttempt to fix the open source iOS build.
andersca@apple.com [Thu, 22 Sep 2016 14:15:08 +0000 (14:15 +0000)]
Attempt to fix the open source iOS build.

* platform/spi/cocoa/PassKitSPI.h:

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

2 years ago[GStreamer] Support a direct GPU-to-GPU copy of video textures to WebGL
commit-queue@webkit.org [Thu, 22 Sep 2016 12:43:55 +0000 (12:43 +0000)]
[GStreamer] Support a direct GPU-to-GPU copy of video textures to WebGL
https://bugs.webkit.org/show_bug.cgi?id=159928

Patch by Olivier Blin <olivier.blin@softathome.com> on 2016-09-22
Reviewed by Carlos Garcia Campos.

Copy of GStreamer video frames to WebGL textures was not accelerated.

WebGLRenderingContextBase::texImage2D(HTMLVideoElement) went
through a slow software paint() wrapping the video frame into
cairo surface (ImageGStreamer), downloading it to draw to the
image cache context, copying it again in software, and uploading
it back to an OpenGL texture.

This patch implements copyVideoTextureToPlatformTexture() for
the GStreamer media player backend, to do GPU-to-GPU copy, by
extracting code from nativeImageForCurrentTime().

Doing this also fixes bug #159621: red and blue colors were
swapped in video rendered through WebGL with GSTREAMER_GL enabled.

* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
(WebCore::MediaPlayerPrivateGStreamerBase::prepareContextForCairoPaint):
(WebCore::MediaPlayerPrivateGStreamerBase::paintToCairoSurface):
(WebCore::MediaPlayerPrivateGStreamerBase::copyVideoTextureToPlatformTexture):
(WebCore::MediaPlayerPrivateGStreamerBase::nativeImageForCurrentTime):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:

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

2 years ago[GTK] Rename DataObjectGtk as SelectionData
carlosgc@webkit.org [Thu, 22 Sep 2016 12:14:39 +0000 (12:14 +0000)]
[GTK] Rename DataObjectGtk as SelectionData
https://bugs.webkit.org/show_bug.cgi?id=162380

Reviewed by Žan Doberšek.

Source/WebCore:

DataObjectGtk represents the data of a selection, like GtkSelectionData, used for clipboard and drag adn drop
operations. Data object is a very generic name, and the Gtk suffix sounds like if this is the GTK implementation
of a generic DataObject class.

* PlatformGTK.cmake:
* editing/gtk/EditorGtk.cpp:
(WebCore::createFragmentFromPasteboardData):
* page/gtk/DragControllerGtk.cpp:
* platform/DragData.h:
* platform/Pasteboard.h:
* platform/PasteboardStrategy.h:
(WebCore::PasteboardStrategy::~PasteboardStrategy): Deleted.
* platform/PlatformPasteboard.h:
* platform/gtk/DragDataGtk.cpp:
* platform/gtk/PasteboardGtk.cpp:
(WebCore::Pasteboard::createPrivate):
(WebCore::Pasteboard::createForDragAndDrop):
(WebCore::Pasteboard::Pasteboard):
(WebCore::Pasteboard::selectionData):
(WebCore::selectionDataTypeFromHTMLClipboardType):
(WebCore::Pasteboard::writeToClipboard):
(WebCore::Pasteboard::readFromClipboard):
(WebCore::Pasteboard::writeString):
(WebCore::Pasteboard::writePlainText):
(WebCore::Pasteboard::write):
(WebCore::Pasteboard::writePasteboard):
(WebCore::Pasteboard::clear):
(WebCore::Pasteboard::canSmartReplace):
(WebCore::Pasteboard::read):
(WebCore::Pasteboard::hasData):
(WebCore::Pasteboard::types):
(WebCore::Pasteboard::readString):
(WebCore::Pasteboard::readFilenames):
* platform/gtk/PasteboardHelper.cpp:
(WebCore::PasteboardHelper::getClipboardContents):
(WebCore::PasteboardHelper::targetListForSelectionData):
(WebCore::PasteboardHelper::fillSelectionData):
(WebCore::ClipboardSetData::ClipboardSetData):
(WebCore::getClipboardContentsCallback):
(WebCore::PasteboardHelper::writeClipboardContents):
(WebCore::clearClipboardContentsCallback): Deleted.
* platform/gtk/PasteboardHelper.h:
* platform/gtk/PlatformPasteboardGtk.cpp:
(WebCore::PlatformPasteboard::writeToClipboard):
(WebCore::PlatformPasteboard::readFromClipboard):
* platform/gtk/SelectionData.cpp: Renamed from Source/WebCore/platform/gtk/DataObjectGtk.cpp.
(WebCore::SelectionData::setText):
(WebCore::SelectionData::setURIList):
(WebCore::SelectionData::setURL):
(WebCore::SelectionData::urlLabel):
(WebCore::SelectionData::clearAllExceptFilenames):
(WebCore::SelectionData::clearAll):
* platform/gtk/SelectionData.h: Renamed from Source/WebCore/platform/gtk/DataObjectGtk.h.
(WebCore::SelectionData::create):
(WebCore::SelectionData::text):
(WebCore::SelectionData::hasText):
(WebCore::SelectionData::clearText):
(WebCore::SelectionData::setMarkup):
(WebCore::SelectionData::markup):
(WebCore::SelectionData::hasMarkup):
(WebCore::SelectionData::clearMarkup):
(WebCore::SelectionData::hasURL):
(WebCore::SelectionData::clearURL):
(WebCore::SelectionData::filenames):
(WebCore::SelectionData::hasURIList):
(WebCore::SelectionData::hasFilenames):
(WebCore::SelectionData::setImage):
(WebCore::SelectionData::image):
(WebCore::SelectionData::hasImage):
(WebCore::SelectionData::unknownTypeData):
(WebCore::SelectionData::unknownTypes):
(WebCore::SelectionData::hasUnknownTypeData):
(WebCore::SelectionData::canSmartReplace):
(WebCore::SelectionData::url): Deleted.
(WebCore::SelectionData::uriList): Deleted.
(WebCore::SelectionData::clearURIList): Deleted.
(WebCore::SelectionData::clearImage): Deleted.
(WebCore::SelectionData::setUnknownTypeData): Deleted.

Source/WebKit2:

* PlatformGTK.cmake:
* Shared/gtk/ArgumentCodersGtk.cpp:
(IPC::ArgumentCoder<SelectionData>::encode):
(IPC::ArgumentCoder<SelectionData>::decode):
* Shared/gtk/ArgumentCodersGtk.h:
* Shared/gtk/WebSelectionData.cpp: Renamed from Source/WebKit2/Shared/gtk/PasteboardContent.cpp.
(WebKit::WebSelectionData::WebSelectionData):
(WebKit::WebSelectionData::encode):
(WebKit::WebSelectionData::decode):
* Shared/gtk/WebSelectionData.h: Renamed from Source/WebKit2/Shared/gtk/PasteboardContent.h.
* UIProcess/API/gtk/PageClientImpl.cpp:
(WebKit::PageClientImpl::startDrag):
* UIProcess/API/gtk/PageClientImpl.h:
* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::performDragControllerAction):
(WebKit::WebPageProxy::startDrag):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/WebPasteboardProxy.h:
* UIProcess/WebPasteboardProxy.messages.in:
* UIProcess/gtk/DragAndDropHandler.cpp:
(WebKit::DragAndDropHandler::DroppingContext::DroppingContext):
(WebKit::DragAndDropHandler::startDrag):
(WebKit::DragAndDropHandler::fillDragData):
(WebKit::DragAndDropHandler::finishDrag):
(WebKit::DragAndDropHandler::dropDataSelection):
(WebKit::DragAndDropHandler::dragEntered):
(WebKit::DragAndDropHandler::dragDataSelection):
(WebKit::DragAndDropHandler::dragMotion):
(WebKit::DragAndDropHandler::dragLeave):
(WebKit::DragAndDropHandler::drop):
* UIProcess/gtk/DragAndDropHandler.h:
* UIProcess/gtk/WebPasteboardProxyGtk.cpp:
(WebKit::WebPasteboardProxy::writeToClipboard):
(WebKit::WebPasteboardProxy::readFromClipboard):
(WebKit::WebPasteboardProxy::setPrimarySelectionOwner): Deleted.
* WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
(WebKit::WebPlatformStrategies::writeToClipboard):
(WebKit::WebPlatformStrategies::readFromClipboard):
* WebProcess/WebCoreSupport/WebPlatformStrategies.h:
* WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp:
(WebKit::WebDragClient::startDrag):
* WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::performDragControllerAction):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:

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

2 years agoCachedResourceRequest should store a SecurityOrigin
commit-queue@webkit.org [Thu, 22 Sep 2016 08:57:12 +0000 (08:57 +0000)]
CachedResourceRequest should store a SecurityOrigin
https://bugs.webkit.org/show_bug.cgi?id=162258

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

Source/WebCore:

Test: http/tests/local/script-crossorigin-loads-file-scheme.html

Passing SecurityOrigin from loader clients to CachedResource through CachedResourceRequest.
This ensures that specific origin properties like universal access are well preserved.

* loader/DocumentThreadableLoader.cpp:
(WebCore::DocumentThreadableLoader::loadRequest): Set origin to the request.
* loader/cache/CachedResource.cpp:
(WebCore::CachedResource::CachedResource): Setting origin from the request.
Computing CORS state based on that origin.
(WebCore::CachedResource::load): Removing origin computation.
(WebCore::CachedResource::loadFrom): Ditto.
(WebCore::CachedResource::computeOrigin): Deleted.
* loader/cache/CachedResource.h:
* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::updateCachedResourceWithCurrentRequest):
(WebCore::CachedResourceLoader::prepareFetch): Introduced to implement step 1 to 7 of https://fetch.spec.whatwg.org/#fetching.
(WebCore::CachedResourceLoader::requestResource):
* loader/cache/CachedResourceLoader.h:
* loader/cache/CachedResourceRequest.cpp:
(WebCore::CachedResourceRequest::setAsPotentiallyCrossOrigin): Storing origin.
* loader/cache/CachedResourceRequest.h:
(WebCore::CachedResourceRequest::setOrigin):
(WebCore::CachedResourceRequest::releaseOrigin):
(WebCore::CachedResourceRequest::origin):

LayoutTests:

Updated test to expect load even though CORS checks should fail as the document origin has universal access.

* http/tests/local/script-crossorigin-loads-fail-origin-expected.txt: Removed.
* http/tests/local/script-crossorigin-loads-file-scheme-expected.txt: Added.
* http/tests/local/script-crossorigin-loads-file-scheme.html: Renamed from LayoutTests/http/tests/local/script-crossorigin-loads-fail-origin.html.

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

2 years agoRefactor ContentSecurityPolicy::allow* methods
commit-queue@webkit.org [Thu, 22 Sep 2016 08:28:37 +0000 (08:28 +0000)]
Refactor ContentSecurityPolicy::allow* methods
https://bugs.webkit.org/show_bug.cgi?id=162335

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

No change of behavior.

Removing the second parameter of ContentSecurityPolicy::allow* methods.
When true, this parameter makes the methods return true.
This patch updates the callers of allow* methods to check for the parameter before making the call.

Made some refactoring to share more code between the various allow* methods.

* Modules/fetch/FetchLoader.cpp:
(WebCore::FetchLoader::start):
* Modules/websockets/WebSocket.cpp:
(WebCore::WebSocket::connect):
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::isSafeToLoadURL):
(WebCore::HTMLMediaElement::outOfBandTrackSources):
* html/HTMLPlugInImageElement.cpp:
(WebCore::HTMLPlugInImageElement::allowedToLoadPluginContent):
* html/HTMLTrackElement.cpp:
(WebCore::HTMLTrackElement::canLoadURL):
* loader/DocumentThreadableLoader.cpp:
(WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
(WebCore::DocumentThreadableLoader::redirectReceived):
(WebCore::DocumentThreadableLoader::loadRequest):
(WebCore::DocumentThreadableLoader::isAllowedByContentSecurityPolicy):
* loader/DocumentThreadableLoader.h:
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::checkIfFormActionAllowedByCSP):
* loader/PolicyChecker.cpp:
(WebCore::isAllowedByContentSecurityPolicy):
* loader/SubframeLoader.cpp:
(WebCore::SubframeLoader::createJavaAppletWidget):
* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::allowedByContentSecurityPolicy):
* page/EventSource.cpp:
(WebCore::EventSource::create):
* page/csp/ContentSecurityPolicy.cpp:
(WebCore::ContentSecurityPolicy::allowObjectFromSource):
(WebCore::ContentSecurityPolicy::allowChildFrameFromSource):
(WebCore::ContentSecurityPolicy::allowResourceFromSource):
(WebCore::ContentSecurityPolicy::allowChildContextFromSource):
(WebCore::ContentSecurityPolicy::allowScriptFromSource):
(WebCore::ContentSecurityPolicy::allowImageFromSource):
(WebCore::ContentSecurityPolicy::allowStyleFromSource):
(WebCore::ContentSecurityPolicy::allowFontFromSource):
(WebCore::ContentSecurityPolicy::allowMediaFromSource):
(WebCore::ContentSecurityPolicy::allowConnectToSource):
(WebCore::ContentSecurityPolicy::allowFormAction):
* page/csp/ContentSecurityPolicy.h:
* workers/AbstractWorker.cpp:
(WebCore::AbstractWorker::resolveURL):
* workers/WorkerGlobalScope.cpp:
(WebCore::WorkerGlobalScope::importScripts):
* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::initSend):

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

2 years ago[css-grid] Remove the x2 computation of row sizes with indefinite heights
svillar@igalia.com [Thu, 22 Sep 2016 07:57:32 +0000 (07:57 +0000)]
[css-grid] Remove the x2 computation of row sizes with indefinite heights
https://bugs.webkit.org/show_bug.cgi?id=162150

Reviewed by Darin Adler.

PerformanceTests:

Added a new test case which checks the layout performance of grids inside other grids, i.e,
grids acting both as grid container and grid item.

* Layout/nested-grid.html: Added.

Source/WebCore:

On r192154, among other things, we added a second pass of the track sizing algorithm for
rows in order to properly compute row sizes when the height was indefinite. We did that in
order to have a symmetrical implementation for columns and rows, but unfortunatelly that was
not correct.

Apart from issuing incorrect results in some cases it created a huge performance issue in
the case of having nested grids because we were exponentially increasing the amount of
executions of the track sizing algorithm. The attached performance test shows a 200%
improvement with the patch (26 vs 80 runs/s).

Test: fast/css-grid-layout/nested-grid.html

* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::layoutBlock):
(WebCore::RenderGrid::computeIntrinsicLogicalHeight):
(WebCore::RenderGrid::layoutGridItems):

LayoutTests:

Added a new reftest to check the behavior of grids acting also as grid items and how the
track sizing of rows depend on that. It includes tests for grids which stretch their
children and grids which do not.

Apart from that some expected results were updated so that they no longer fail.

* fast/css-grid-layout/maximize-tracks-definite-indefinite-height.html: Updated expectations.
* fast/css-grid-layout/nested-grid-expected.html: Added.
* fast/css-grid-layout/nested-grid.html: Added.
* fast/css-grid-layout/percent-track-breadths-regarding-container-size.html: Removed FIXME.
* fast/css-grid-layout/percent-track-breadths-regarding-container-size-expected.txt: Fixed 2
failing tests.

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

2 years agoImprove DeferredWrapper code
commit-queue@webkit.org [Thu, 22 Sep 2016 07:35:46 +0000 (07:35 +0000)]
Improve DeferredWrapper code
https://bugs.webkit.org/show_bug.cgi?id=161787

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

No change of behavior.

Renaming DeferredWrapper to DeferredPromise.
Adding create method that creates the underlying JSC::JSPromiseDeferred in non-worker environments.
Updated create method to take references.
Introducing domWindow helper accessor into JSDOMObject to ease creation of promise in non-worker environments.
Doing some minor clean up (renaming of m_wrapper to m_promiseDeferred, accessor change).

* Modules/applepay/ApplePaySession.cpp:
(WebCore::ApplePaySession::canMakePaymentsWithActiveCard):
* Modules/applepay/ApplePaySession.h:
* Modules/fetch/DOMWindowFetch.cpp:
(WebCore::DOMWindowFetch::fetch):
* Modules/fetch/DOMWindowFetch.h: Updated to take a DeferredPromise to make it consistent with WorkerGlobalScopeFetch.
* Modules/fetch/FetchBody.cpp:
(WebCore::FetchBody::arrayBuffer):
(WebCore::FetchBody::blob):
(WebCore::FetchBody::json):
(WebCore::FetchBody::text):
(WebCore::FetchBody::consume):
(WebCore::FetchBody::consumeArrayBuffer):
(WebCore::FetchBody::consumeArrayBufferView):
(WebCore::FetchBody::consumeText):
(WebCore::FetchBody::consumeBlob):
* Modules/fetch/FetchBody.h:
(WebCore::FetchBody::formData):
* Modules/fetch/FetchBodyConsumer.cpp:
(WebCore::FetchBodyConsumer::resolveWithData):
(WebCore::FetchBodyConsumer::resolve):
* Modules/fetch/FetchBodyConsumer.h:
* Modules/fetch/FetchBodyOwner.cpp:
(WebCore::FetchBodyOwner::arrayBuffer):
(WebCore::FetchBodyOwner::blob):
(WebCore::FetchBodyOwner::formData):
(WebCore::FetchBodyOwner::json):
(WebCore::FetchBodyOwner::text):
* Modules/fetch/FetchBodyOwner.h:
* Modules/fetch/FetchResponse.cpp:
(WebCore::FetchResponse::consume):
(WebCore::FetchResponse::finishConsumingStream):
* Modules/fetch/FetchResponse.h:
* Modules/fetch/WorkerGlobalScopeFetch.cpp:
(WebCore::WorkerGlobalScopeFetch::fetch):
* Modules/fetch/WorkerGlobalScopeFetch.h:
* bindings/js/JSCustomElementRegistryCustom.cpp:
(WebCore::whenDefinedPromise):
(WebCore::JSCustomElementRegistry::whenDefined):
* bindings/js/JSDOMGlobalObject.cpp:
(WebCore::JSDOMGlobalObject::visitChildren):
* bindings/js/JSDOMGlobalObject.h:
* bindings/js/JSDOMPromise.cpp:
(WebCore::DOMDeferredPromise::DOMDeferredPromise):
(WebCore::DOMDeferredPromise::~DOMDeferredPromise):
(WebCore::DOMDeferredPromise::clear):
(WebCore::DOMDeferredPromise::contextDestroyed):
(WebCore::DOMDeferredPromise::promise):
(WebCore::DOMDeferredPromise::callFunction):
(WebCore::DOMDeferredPromise::reject):
(WebCore::rejectPromiseWithExceptionIfAny):
(WebCore::fulfillPromiseWithJSON):
(WebCore::fulfillPromiseWithArrayBuffer):
(WebCore::DeferredWrapper::DeferredWrapper): Deleted.
(WebCore::DeferredWrapper::~DeferredWrapper): Deleted.
(WebCore::DeferredWrapper::clear): Deleted.
(WebCore::DeferredWrapper::contextDestroyed): Deleted.
(WebCore::DeferredWrapper::promise): Deleted.
(WebCore::DeferredWrapper::callFunction): Deleted.
(WebCore::DeferredWrapper::reject): Deleted.
* bindings/js/JSDOMPromise.h:
(WebCore::DOMDeferredPromise::create):
(WebCore::callPromiseFunction):
(WebCore::DOMPromise::DOMPromise):
(WebCore::DOMPromise::deferredPromise):
(WebCore::DOMDeferredPromise::resolveWithValue):
(WebCore::DOMDeferredPromise::resolveWithNewlyCreated):
(WebCore::DOMDeferredPromise::rejectWithValue):
(WebCore::DOMDeferredPromise::resolve):
(WebCore::DOMDeferredPromise::reject):
(WebCore::DeferredWrapper::create): Deleted.
(WebCore::DOMPromise::deferredWrapper): Deleted.
(WebCore::DeferredWrapper::resolveWithValue): Deleted.
(WebCore::DeferredWrapper::resolveWithNewlyCreated): Deleted.
(WebCore::DeferredWrapper::rejectWithValue): Deleted.
(WebCore::DeferredWrapper::resolve): Deleted.
(WebCore::DeferredWrapper::reject): Deleted.
* bindings/js/JSDOMWrapper.cpp: Introducing domWindow() accessor.
* bindings/js/JSDOMWrapper.h:
* bindings/js/JSFontFaceCustom.cpp:
(WebCore::JSFontFace::loaded):
* bindings/js/JSFontFaceSetCustom.cpp:
(WebCore::JSFontFaceSet::ready):
* bindings/js/JSMediaDevicesCustom.cpp:
(WebCore::JSMediaDevices::getUserMedia):
* bindings/js/JSMediaStreamTrackCustom.cpp:
(WebCore::JSMediaStreamTrack::applyConstraints):
* bindings/js/JSReadableStreamSourceCustom.cpp:
(WebCore::JSReadableStreamSource::start):
* bindings/js/JSWebKitSubtleCryptoCustom.cpp:
(WebCore::JSWebKitSubtleCrypto::encrypt):
(WebCore::JSWebKitSubtleCrypto::decrypt):
(WebCore::JSWebKitSubtleCrypto::sign):
(WebCore::JSWebKitSubtleCrypto::verify):
(WebCore::JSWebKitSubtleCrypto::digest):
(WebCore::JSWebKitSubtleCrypto::generateKey):
(WebCore::JSWebKitSubtleCrypto::importKey):
(WebCore::JSWebKitSubtleCrypto::exportKey):
(WebCore::JSWebKitSubtleCrypto::wrapKey):
(WebCore::JSWebKitSubtleCrypto::unwrapKey):
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateImplementation):
(GenerateReturnParameters):
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionPromise):
(WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithFloatArgumentPromise):
(WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithExceptionPromise):
(WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithOptionalIntArgumentPromise):
(WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction1Promise):
(WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction2Promise):
(WebCore::jsTestObjConstructorFunctionTestStaticPromiseFunctionPromise):
(WebCore::jsTestObjConstructorFunctionTestStaticPromiseFunctionWithExceptionPromise):
* dom/CustomElementRegistry.h:
(WebCore::CustomElementRegistry::promiseMap):

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

2 years agoRolling out r206244, as it caused flaky crashes on tests.
ap@apple.com [Thu, 22 Sep 2016 06:01:33 +0000 (06:01 +0000)]
Rolling out r206244, as it caused flaky crashes on tests.
Was: Correct uses of 'safeCast'

Source/WebCore:

* loader/cache/MemoryCache.cpp:
(WebCore::MemoryCache::adjustSize):
* platform/graphics/BitmapImage.cpp:
(WebCore::BitmapImage::destroyMetadataAndNotify):
(WebCore::BitmapImage::cacheFrame):
(WebCore::BitmapImage::didDecodeProperties):
(WebCore::BitmapImage::dataChanged):
(WebCore::BitmapImage::frameImageAtIndex):
* platform/graphics/cg/PDFDocumentImage.cpp:
(WebCore::PDFDocumentImage::decodedSizeChanged):
(WebCore::PDFDocumentImage::updateCachedImageIfNeeded):

Source/WTF:

* wtf/StdLibExtras.h:
(WTF::safeCast):

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

2 years agoUnreviewed, update ios-simulator-wk1 test expectations
jiewen_tan@apple.com [Thu, 22 Sep 2016 05:19:14 +0000 (05:19 +0000)]
Unreviewed, update ios-simulator-wk1 test expectations

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

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

2 years ago[macOS] Upon layout, _webView:renderingProgressDidChange: fires before the intrinsic...
mitz@apple.com [Thu, 22 Sep 2016 05:03:01 +0000 (05:03 +0000)]
[macOS] Upon layout, _webView:renderingProgressDidChange: fires before the intrinsic content size is updated
https://bugs.webkit.org/show_bug.cgi?id=162359
<rdar://problem/27776454>

Reviewed by Tim Horton.

Source/WebKit2:

Test: added to TestWebKitAPI/Tests/WebKit2Cocoa/AutoLayoutIntegration.mm

* WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h: Fixed a bug where
  m_pendingNewlyReachedLayoutMilestones was never initialized.

* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: Added
  m_pendingNewlyReachedLayoutMilestones member variable to this derived class as well.
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::flushLayers): If we have pending milestones, notify
  the WebPageProxy now, after any content size changes have been sent.
(WebKit::TiledCoreAnimationDrawingArea::dispatchDidReachLayoutMilestone): New override that
  accumulates the milestones into m_pendingNewlyReachedLayoutMilestones and returns true,
  so that the caller won’t notify the WebPageProxy immediately.

Tools:

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

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

2 years agoFix serialization of bgsound, keygen and track elements
cdumez@apple.com [Thu, 22 Sep 2016 04:36:22 +0000 (04:36 +0000)]
Fix serialization of bgsound, keygen and track elements
https://bugs.webkit.org/show_bug.cgi?id=162353

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Rebaseline W3C tests now that more checks are passing.

* web-platform-tests/html/syntax/serializing-html-fragments/outerHTML-expected.txt:
* web-platform-tests/html/syntax/serializing-html-fragments/serializing-expected.txt:
* web-platform-tests/html/syntax/serializing-xml-fragments/outerHTML-expected.txt:

Source/WebCore:

Fix serialization of keygen and track elements to match the specification:
- https://html.spec.whatwg.org/#serialising-html-fragments

They are not supposed to have an end tag. Firefox and Chrome agree with
the specification.

No new tests, rebaselined existing tests.

* editing/MarkupAccumulator.cpp:
(WebCore::MarkupAccumulator::elementCannotHaveEndTag):

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

2 years agoFix build for future versions of Clang.
keith_miller@apple.com [Thu, 22 Sep 2016 04:32:12 +0000 (04:32 +0000)]
Fix build for future versions of Clang.
https://bugs.webkit.org/show_bug.cgi?id=162346

Reviewed by Filip Pizlo.

Source/JavaScriptCore:

This fixes issues with the WebCore build where inline
template-class function definitions are marked as exported. This
genereates a weak external symobl that our build does not like.

* runtime/VM.h:
(JSC::VM::setGlobalConstRedeclarationShouldThrow):

Source/WebCore:

This fixes issues with the WebCore build where inline
template-class function definitions are marked as exported. This
genereates a weak external symobl that our build does not like.

* Configurations/WebCore.unexp:
* dom/Exception.h:
* page/Frame.h:
* platform/cocoa/WebPlaybackSessionModelMediaElement.h:
* platform/cocoa/WebVideoFullscreenModelVideoElement.h:
(WebCore::WebVideoFullscreenModelVideoElement::videoElement):
* platform/graphics/Color.h:
* platform/graphics/transforms/TransformationMatrix.h:
(WebCore::TransformationMatrix::rotate):
* platform/mac/WebVideoFullscreenInterfaceMac.h:
* platform/network/ParsedContentRange.h:
(WebCore::ParsedContentRange::ParsedContentRange):
(WebCore::ParsedContentRange::isValid):
* platform/network/ResourceResponseBase.h:
(WebCore::ResourceResponseBase::certificateInfo):
* platform/text/TextStream.h:
(WebCore::TextStream::increaseIndent):
(WebCore::TextStream::decreaseIndent):

Source/WTF:

This fixes issues with the WebCore build where inline
template-class function definitions are marked as exported. This
genereates a weak external symobl that our build does not like.

* wtf/text/StringImpl.h:

Tools:

* TestWebKitAPI/Counters.cpp:
* TestWebKitAPI/Counters.h:
(DeleterCounter::deleterCount):
(DeleterCounter::TestingScope::TestingScope):
(DeleterCounter::operator()):
* TestWebKitAPI/Tests/WTF/HashCountedSet.cpp:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WTF/HashMap.cpp:
(TestWebKitAPI::TEST):

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

2 years agoCorrect uses of 'safeCast'
bfulgham@apple.com [Thu, 22 Sep 2016 01:23:26 +0000 (01:23 +0000)]
Correct uses of 'safeCast'
https://bugs.webkit.org/show_bug.cgi?id=162301
<rdar://problem/28343658>

Reviewed by Antti Koivisto.

Source/WebCore:

A number of integer calculations in BitmapImage and PDFDocumentImage
are not properly checked for overflow. Correct this.

Tested by fast/images/large-size-image-crash.html

* loader/cache/MemoryCache.cpp:
(WebCore::MemoryCache::adjustSize): RELEASE_ASSERT on overflow.
* platform/graphics/BitmapImage.cpp:
(WebCore::BitmapImage::destroyMetadataAndNotify):
(WebCore::BitmapImage::cacheFrame):
(WebCore::BitmapImage::didDecodeProperties):
(WebCore::BitmapImage::dataChanged):
(WebCore::BitmapImage::ensureFrameAtIndexIsCached):
(WebCore::BitmapImage::frameImageAtIndex):
* platform/graphics/BitmapImage.h:
* platform/graphics/cg/PDFDocumentImage.cpp:
(WebCore::PDFDocumentImage::decodedSizeChanged):
(WebCore::PDFDocumentImage::updateCachedImageIfNeeded):

Source/WTF:

* wtf/StdLibExtras.h:
(WTF::safeCast): RELEASE_ASSERT on overflow.

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

2 years agoSetting HTMLMeterElement's attributes to non-finite values throws wrong exception...
cdumez@apple.com [Wed, 21 Sep 2016 23:50:24 +0000 (23:50 +0000)]
Setting HTMLMeterElement's attributes to non-finite values throws wrong exception type
https://bugs.webkit.org/show_bug.cgi?id=162364

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Merge meter test changes from https://github.com/w3c/web-platform-tests/pull/3791.

* web-platform-tests/html/semantics/forms/the-meter-element/meter-expected.txt:
* web-platform-tests/html/semantics/forms/the-meter-element/meter.html:

Source/WebCore:

Setting HTMLMeterElement's attributes to non-finite values throws wrong exception type.
It should throw a TypeError because their type is 'double' but we throw a
NOT_SUPPORTED_ERR.

Specification:
- https://html.spec.whatwg.org/#htmlmeterelement

Firefox and Chrome agree with the specification.

No new tests, updated existing test.

* html/HTMLMeterElement.cpp:
(WebCore::HTMLMeterElement::setMin):
(WebCore::HTMLMeterElement::setMax):
(WebCore::HTMLMeterElement::setValue):
(WebCore::HTMLMeterElement::setLow):
(WebCore::HTMLMeterElement::setHigh):
(WebCore::HTMLMeterElement::setOptimum):
* html/HTMLMeterElement.h:
* html/HTMLMeterElement.idl:

LayoutTests:

Update existing test to reflect behavior change.

* fast/dom/HTMLMeterElement/script-tests/set-meter-properties.js:
* fast/dom/HTMLMeterElement/set-meter-properties-expected.txt:

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

2 years agoFix open source build.
andersca@apple.com [Wed, 21 Sep 2016 23:20:01 +0000 (23:20 +0000)]
Fix open source build.

* platform/spi/cocoa/PassKitSPI.h:

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

2 years agoFix spelling errors (that were supposed to be part of my previous commit).
andersca@apple.com [Wed, 21 Sep 2016 23:08:52 +0000 (23:08 +0000)]
Fix spelling errors (that were supposed to be part of my previous commit).

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

2 years agoFix serialization of HTML Element attributes
cdumez@apple.com [Wed, 21 Sep 2016 22:52:42 +0000 (22:52 +0000)]
Fix serialization of HTML Element attributes
https://bugs.webkit.org/show_bug.cgi?id=162356

Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

Rebaseline W3C test now that more checks are passing.

* web-platform-tests/html/semantics/embedded-content/the-img-element/current-pixel-density/basic-expected.txt:
* web-platform-tests/html/syntax/serializing-html-fragments/serializing-expected.txt:

Source/WebCore:

Fix serialization of HTML Element attributes to align with:
- https://html.spec.whatwg.org/#html-fragment-serialisation-algorithm
- https://html.spec.whatwg.org/#escapingString

In particular, we should not escape '<' and '>'.

Firefox and Chrome both match the specification.

Note that we keep escaping '<' and '>' for Element attributes in the
context of XML serialization, as per:
- https://w3c.github.io/DOM-Parsing/#dfn-serializing-an-attribute-value

No new tests, rebaselined existing test.

* editing/MarkupAccumulator.h:

LayoutTests:

Rebaseline test to reflect behavior change.

* editing/pasteboard/paste-noscript-expected.txt:

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

2 years agoInline function only used in one place
commit-queue@webkit.org [Wed, 21 Sep 2016 22:52:37 +0000 (22:52 +0000)]
Inline function only used in one place
https://bugs.webkit.org/show_bug.cgi?id=162363

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2016-09-21
Reviewed by Saam Barati.

* bytecompiler/NodesCodegen.cpp:
(JSC::ForInNode::emitBytecode):
(JSC::ForInNode::emitMultiLoopBytecode):
* parser/Nodes.h:
No need for the extra function, it adds no clarification.

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

2 years agoSource/WebCore:
andersca@apple.com [Wed, 21 Sep 2016 22:51:52 +0000 (22:51 +0000)]
Source/WebCore:
support openPaymentSetup API on ApplePaySession object
https://bugs.webkit.org/show_bug.cgi?id=162357
rdar://problem/26776939

Reviewed by Tim Horton.

* Modules/applepay/ApplePaySession.cpp:
(WebCore::ApplePaySession::openPaymentSetup):
Perform security checks and then call into the PaymentCoordiantor. In its completion handler, we resolve the promise.

* Modules/applepay/ApplePaySession.h:
Add new members.

* Modules/applepay/ApplePaySession.idl:
Add openPaymentSetup declaration.

* Modules/applepay/PaymentCoordinator.cpp:
(WebCore::PaymentCoordinator::openPaymentSetup):
Call through to the clients.

* Modules/applepay/PaymentCoordinator.h:
* Modules/applepay/PaymentCoordinatorClient.h:
Add new members.

* loader/EmptyClients.cpp:
Add new stub.

* platform/spi/cocoa/PassKitSPI.h:
Add SPI declaration.

Source/WebKit/mac:
Support openPaymentSetup API on ApplePaySession object
https://bugs.webkit.org/show_bug.cgi?id=162357
rdar://problem/26776939

Reviewed by Tim Horton.

Add openPaymentSetup stub.

* WebCoreSupport/WebPaymentCoordinatorClient.h:
* WebCoreSupport/WebPaymentCoordinatorClient.mm:
(WebPaymentCoordinatorClient::openPaymentSetup):

Source/WebKit2:
support openPaymentSetup API on ApplePaySession object
https://bugs.webkit.org/show_bug.cgi?id=162357
rdar://problem/26776939

Reviewed by Tim Horton.

* UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp:
(WebKit::WebPaymentCoordinatorProxy::openPaymentSetup):
Call through to platformOpenPaymentSetup, and in the completion handler, send back a OpenPaymentSetupReply message.

* UIProcess/ApplePay/WebPaymentCoordinatorProxy.h:
Add new members.

* UIProcess/ApplePay/WebPaymentCoordinatorProxy.messages.in:
Add OpenPaymentSetup message.

* UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
(WebKit::WebPaymentCoordinatorProxy::platformOpenPaymentSetup):
Allocate a PKPassLibrary and call openPaymentSetupForMerchantIdentifier:domain:completion: on it.

* WebProcess/ApplePay/WebPaymentCoordinator.cpp:
(WebKit::generateOpenPaymentSetupReplyID):
New helper function to generate a reply ID.

(WebKit::WebPaymentCoordinator::openPaymentSetup):
Add the completion handler to m_pendingOpenPaymentSetupCallbacks and send a OpenPaymentSetup message to the UI process.

(WebKit::WebPaymentCoordinator::openPaymentSetupReply):
Grab the callback given its ID and invoke it.

* WebProcess/ApplePay/WebPaymentCoordinator.h:
Add new members.

* WebProcess/ApplePay/WebPaymentCoordinator.messages.in:
Add OpenPaymentSetupReply message.

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

2 years agoWeb Inspector: Improve output of TestHarness.expect* failures
mattbaker@apple.com [Wed, 21 Sep 2016 21:40:22 +0000 (21:40 +0000)]
Web Inspector: Improve output of TestHarness.expect* failures
https://bugs.webkit.org/show_bug.cgi?id=162177
<rdar://problem/28367186>

Reviewed by Joseph Pecoraro.

Source/WebInspectorUI:

This patch adds specific expectation functions to TestHarness, to better
express intent when writing tests, and to allow more details to be logged
in the event of a failure.

For functions taking both `actual` and `expected` parameters, the `actual`
parameter comes first. This convention simplifies the implementation of
TestHarness, improves the readability of tests involving inequalities,
and is consistent with XCTest assertions.

* UserInterface/Test/TestHarness.js:
(TestHarness):
(TestHarness.prototype.expectThat):
(TestHarness.prototype.expectFalse):
(TestHarness.prototype.expectNull):
(TestHarness.prototype.expectNotNull):
(TestHarness.prototype.expectEqual):
(TestHarness.prototype.expectNotEqual):
(TestHarness.prototype.expectShallowEqual):
(TestHarness.prototype.expectNotShallowEqual):
(TestHarness.prototype.expectEqualWithAccuracy):
(TestHarness.prototype.expectLessThan):
(TestHarness.prototype.expectLessThanOrEqual):
(TestHarness.prototype.expectGreaterThan):
(TestHarness.prototype.expectGreaterThanOrEqual):
New expectation functions, all of which call _expect under the hood.

(TestHarness.prototype._expect):
Helper method which calls pass or fail. Creates a message when no user
message is provided, and logs expected and actual values in the event
of a failure.

(TestHarness.prototype._expectationValueAsString):
(TestHarness.prototype._expectationMessageFormat):
Get a message format string for the expectation type. Used to create
pass/fail message when no user message is provided.

(TestHarness.prototype._expectedValueFormat):
Get a format string for displaying the expected value. Used to create
the "Expected: " failure message line.

LayoutTests:

Extend coverage to more TestHarness messages by omitting the optional
`message` parameter when calling expect* functions.

Other improvements:
- expectEqual/expectNotEqual should test WebInspector object instances,
  to cover more TestHarness message formatting cases.
- expectEqual/expectNotEqual should test shallow equal arrays, since the
  test is for strict equality.

* inspector/indexeddb/requestData-expected.txt:
* inspector/unit-tests/number-utilities-expected.txt:
Updated expectations for new TestHarness output.

* inspector/unit-tests/test-harness-expect-functions-expected.txt:
* inspector/unit-tests/test-harness-expect-functions.html:

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

2 years agoUnreviewed, rolling out r206222 and r206227.
commit-queue@webkit.org [Wed, 21 Sep 2016 21:22:00 +0000 (21:22 +0000)]
Unreviewed, rolling out r206222 and r206227.
https://bugs.webkit.org/show_bug.cgi?id=162361

"broke the windows build" (Requested by keith_mi_ on #webkit).

Reverted changesets:

"Fix build for future versions of Clang."
https://bugs.webkit.org/show_bug.cgi?id=162346
http://trac.webkit.org/changeset/206222

"Attempt to fix windows build after r206222."
http://trac.webkit.org/changeset/206227

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

2 years agoURLParser should match URL::parse when parsing data urls with slashes in them
achristensen@apple.com [Wed, 21 Sep 2016 21:16:15 +0000 (21:16 +0000)]
URLParser should match URL::parse when parsing data urls with slashes in them
https://bugs.webkit.org/show_bug.cgi?id=162352

Reviewed by Darin Adler.

Source/WebCore:

Covered by new API tests.

* platform/URLParser.cpp:
(WebCore::URLParser::parse):

Tools:

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

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

2 years ago[Win] Null pointer crash under WebCore::CACFLayerTreeHost::create().
pvollan@apple.com [Wed, 21 Sep 2016 20:53:49 +0000 (20:53 +0000)]
[Win] Null pointer crash under WebCore::CACFLayerTreeHost::create().
https://bugs.webkit.org/show_bug.cgi?id=162266
<rdar://problem/28345073>

Reviewed by Brent Fulgham.

Add null pointer check.

* platform/graphics/ca/win/CACFLayerTreeHost.cpp:
(WebCore::CACFLayerTreeHost::create):

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

2 years agoFix enumeration of properties cross origin
cdumez@apple.com [Wed, 21 Sep 2016 20:47:00 +0000 (20:47 +0000)]
Fix enumeration of properties cross origin
https://bugs.webkit.org/show_bug.cgi?id=162328

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Rebaseline W3C test now that one more check is passing.

* web-platform-tests/html/browsers/origin/cross-origin-objects/cross-origin-objects-expected.txt:

Source/WebCore:

All cross origin properties for Window / Location are supposed to be not enumerable:
- https://html.spec.whatwg.org/#crossorigingetownpropertyhelper-(-o,-p-)

Therefore, there should be no properties to iterate on for cross origin Window /
Location objects.

No new tests, rebaselined existing test.

* bindings/js/JSDOMWindowCustom.cpp:
(WebCore::JSDOMWindow::getOwnPropertyNames):
* bindings/js/JSLocationCustom.cpp:
(WebCore::JSLocation::getOwnPropertyNames):

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

2 years agoMarking inspector/css/manager-preferredInspectorStyleSheetForFrame.html as flaky...
ryanhaddad@apple.com [Wed, 21 Sep 2016 20:40:59 +0000 (20:40 +0000)]
Marking inspector/css/manager-preferredInspectorStyleSheetForFrame.html as flaky on mac.
https://bugs.webkit.org/show_bug.cgi?id=162305

Unreviewed test gardening.

* platform/mac/TestExpectations:

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