WebKit-https.git
3 years agoRenderFlowThread's containing block cache should be invalidated before calling styleD...
zalan@apple.com [Fri, 11 Nov 2016 21:20:01 +0000 (21:20 +0000)]
RenderFlowThread's containing block cache should be invalidated before calling styleDidChange.
https://bugs.webkit.org/show_bug.cgi?id=164646

Reviewed by Simon Fraser.

We have to invalidate the containing block cache for RenderFlowThreads soon after the containing block context
changes. Invalidating it in RenderBlock::styleDidChange is too late since we might run some code in some
of the subclasses that use this stale containing block cache.

No known behaviour change.

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::styleDidChange): This change could trigger double invalidation.
However running this code twice shouldn't impact performance greatly.
(WebCore::RenderBlock::resetFlowThreadContainingBlockAndChildInfoIncludingDescendants):
(WebCore::RenderBlock::invalidateFlowThreadContainingBlockIncludingDescendants): Deleted.
* rendering/RenderBlock.h:
* rendering/RenderElement.cpp:
(WebCore::RenderElement::setStyle): We don't need to call the invalidation from initializeStyle(), since
we don't yet have cache at that point.
* rendering/RenderInline.cpp:
(WebCore::RenderInline::splitInlines):

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

3 years agoWeb Inspector: Call RuntimeAgent.disableControlFlowProfiler when Code Coverage Profil...
nvasilyev@apple.com [Fri, 11 Nov 2016 20:38:57 +0000 (20:38 +0000)]
Web Inspector: Call RuntimeAgent.disableControlFlowProfiler when Code Coverage Profiler is turned off
https://bugs.webkit.org/show_bug.cgi?id=163407
<rdar://problem/28764230>

Reviewed by Timothy Hatcher.

Turning Type Profiler off by clicking [T] icon now disables its backend by calling RuntimeAgent.disableTypeProfiler().

* UserInterface/Views/SourceCodeTextEditor.js:
(WebInspector.SourceCodeTextEditor.prototype._setTypeTokenAnnotatorEnabledState):

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

3 years agoMove Node from ExceptionCode to ExceptionOr
darin@apple.com [Fri, 11 Nov 2016 20:16:03 +0000 (20:16 +0000)]
Move Node from ExceptionCode to ExceptionOr
https://bugs.webkit.org/show_bug.cgi?id=164515

Reviewed by Sam Weinig.

Source/WebCore:

* bindings/js/JSHTMLSelectElementCustom.cpp:
(WebCore::selectElementIndexSetter): Call remove instead of removeByIndex.
Was renamed now that there is no conflict.

* bindings/js/JSNodeCustom.cpp:
(WebCore::JSNode::insertBefore): Use ExceptionOr.
(WebCore::JSNode::replaceChild): Ditto.
(WebCore::JSNode::removeChild): Ditto.
(WebCore::JSNode::appendChild): Ditto.

* dom/Attr.cpp:
(WebCore::Attr::Attr): Take a reference.
(WebCore::Attr::create): Ditto.
(WebCore::Attr::createTextChild): Use a Ref.
(WebCore::Attr::setPrefix): Use ExceptionOr.
(WebCore::Attr::setNodeValue): Ditto.
(WebCore::Attr::attachToElement): Take a reference.
* dom/Attr.h: Updated for above. Also made setPrefix private.

* dom/CharacterData.cpp:
(WebCore::CharacterData::setNodeValue): Use ExceptionOr.
* dom/CharacterData.h: Updated for the above.

* dom/ContainerNode.cpp:
(WebCore::collectChildrenAndRemoveFromOldParent): Use ExceptionOr.
(WebCore::checkAcceptChild): Ditto.
(WebCore::checkAcceptChildGuaranteedNodeTypes): Ditto.
(WebCore::ContainerNode::ensurePreInsertionValidity): Ditto.
(WebCore::checkPreReplacementValidity): Ditto.
(WebCore::ContainerNode::insertBefore): Ditto.
(WebCore::ContainerNode::replaceChild): Ditto.
(WebCore::ContainerNode::removeChild): Ditto.
(WebCore::ContainerNode::appendChild): Ditto.
(WebCore::ContainerNode::appendChildWithoutPreInsertionValidityCheck): Ditto.
(WebCore::ContainerNode::cloneChildNodes): Ditto.
(WebCore::ContainerNode::append): Ditto.
(WebCore::ContainerNode::prepend): Ditto.
* dom/ContainerNode.h: Updated for above changes.

* dom/Document.cpp:
(WebCore::Document::setTitle): Removed unneeded ASSERT_NO_EXCEPTION.
(WebCore::Document::setBodyOrFrameset): Removed unneeded ignored
exception code.

* dom/Element.cpp:
(WebCore::Element::setPrefix): Use ExceptionOr.
(WebCore::Element::setAttributeNode): Updated for changes to Attr.
(WebCore::Element::setAttributeNodeNS): Ditto.
(WebCore::Element::setOuterHTML): Use ExceptionOr.
(WebCore::Element::ensureAttr): Updated for changes to Attr.
(WebCore::Element::insertAdjacent): Use ExceptionOr.
* dom/Element.h: Updated for above.

* dom/Node.cpp:
(WebCore::Node::setNodeValue): Use ExceptionOr.
(WebCore::Node::insertBefore): Ditto.
(WebCore::Node::replaceChild): Ditto.
(WebCore::Node::removeChild): Ditto.
(WebCore::Node::appendChild): Ditto.
(WebCore::Node::convertNodesOrStringsIntoNode): Ditto.
(WebCore::Node::before): Ditto.
(WebCore::Node::after): Ditto.
(WebCore::Node::replaceWith): Ditto.
(WebCore::Node::remove): Ditto.
(WebCore::Node::cloneNodeForBindings): Ditto.
(WebCore::Node::setPrefix): Ditto.
(WebCore::Node::checkSetPrefix): Ditto.
(WebCore::Node::setTextContent): Ditto.
* dom/Node.h: Updated for above.
* dom/Node.idl: Use non-legacy exceptions.

* dom/Range.cpp:
(WebCore::Range::processContents): Use ExceptionOr.
(WebCore::processContentsBetweenOffsets): Ditto.
(WebCore::processNodes): Ditto.
(WebCore::processAncestorsAndTheirSiblings): Ditto.
(WebCore::Range::insertNode): Ditto.
(WebCore::Range::surroundContents): Ditto.

* dom/Text.cpp:
(WebCore::Text::splitText): Use ExceptionOr.
(WebCore::Text::replaceWholeText): Removed unneeded IGNORE_EXCEPTION.

* editing/AppendNodeCommand.cpp:
(WebCore::AppendNodeCommand::doApply): Removed unneeded IGNORE_EXCEPTION.
* editing/CompositeEditCommand.cpp:
(WebCore::CompositeEditCommand::insertNewDefaultParagraphElementAt): Ditto.

* editing/EditorCommand.cpp:
(WebCore::executeInsertNode): Use ExceptionOr.

* editing/InsertNodeBeforeCommand.cpp:
(WebCore::InsertNodeBeforeCommand::doApply): Removed unneeded IGNORE_EXCEPTION.
* editing/MergeIdenticalElementsCommand.cpp:
(WebCore::MergeIdenticalElementsCommand::doApply): Ditto.
(WebCore::MergeIdenticalElementsCommand::doUnapply): Use ExceptionOr.

* editing/RemoveNodeCommand.cpp:
(WebCore::RemoveNodeCommand::doUnapply): Removed unneeded IGNORE_EXCEPTION.
* editing/ReplaceNodeWithSpanCommand.cpp:
(WebCore::swapInNodePreservingAttributesAndChildren): Removed unneeded
ASSERT_NO_EXCEPTION.
* editing/ReplaceSelectionCommand.cpp:
(WebCore::ReplacementFragment::removeNode): Ditto.
(WebCore::ReplacementFragment::insertNodeBefore): Ditto.
(WebCore::ReplacementFragment::insertFragmentForTestRendering): Ditto.
(WebCore::ReplacementFragment::restoreAndRemoveTestRenderingNodesToFragment): Ditto.
(WebCore::ReplaceSelectionCommand::insertAsListItems): Ditto.

* editing/SplitElementCommand.cpp:
(WebCore::SplitElementCommand::executeApply): Use ExceptionOr.
(WebCore::SplitElementCommand::doUnapply): Removed unneeded IGNORE_EXCEPTION.

* editing/SplitTextNodeCommand.cpp:
(WebCore::SplitTextNodeCommand::insertText1AndTrimText2): Use ExceptionOr.

* editing/WrapContentsInDummySpanCommand.cpp:
(WebCore::WrapContentsInDummySpanCommand::executeApply): Removed unneeded
IGNORE_EXCEPTION.
(WebCore::WrapContentsInDummySpanCommand::doUnapply): Ditto.

* editing/cocoa/EditorCocoa.mm:
(WebCore::Editor::styleForSelectionStart): Removed unneeded ASSERT_NO_EXCEPTION
and IGNORE_EXCEPTION.
* editing/htmlediting.cpp:
(WebCore::createTabSpanElement): Ditto.
* editing/markup.cpp:
(WebCore::fillContainerFromString): Ditto.
(WebCore::createFragmentFromText): Ditto.
(WebCore::removeElementFromFragmentPreservingChildren): Ditto.
(WebCore::replaceChildrenWithFragment): Use ExceptionOr.
(WebCore::replaceChildrenWithText): Ditto.

* editing/ios/EditorIOS.mm:
(WebCore::Editor::WebContentReader::addFragment): Removed unneeded exception
ignoring code.
(WebCore::Editor::setDictationPhrasesAsChildOfElement): Ditto.
(WebCore::Editor::setTextAsChildOfElement): Ditto.

* html/ColorInputType.cpp:
(WebCore::ColorInputType::createShadowSubtree): Removed unneeded
ASSERT_NO_EXCEPTION.

* html/FTPDirectoryDocument.cpp:
(WebCore::FTPDirectoryDocumentParser::appendEntry): Removed unneeded
IGNORE_EXCEPTION.
(WebCore::FTPDirectoryDocumentParser::createTDForFilename): Ditto.
(WebCore::FTPDirectoryDocumentParser::loadDocumentTemplate): Ditto.
(WebCore::FTPDirectoryDocumentParser::createBasicDocument): Ditto.
* html/FileInputType.cpp:
(WebCore::FileInputType::createShadowSubtree): Ditto.

* html/HTMLAnchorElement.cpp:
(WebCore::HTMLAnchorElement::setText): Removed unneeded ASSERT_NO_EXCEPTION.
* html/HTMLDetailsElement.cpp:
(WebCore::HTMLDetailsElement::didAddUserAgentShadowRoot): Ditto.

* html/HTMLElement.cpp:
(WebCore::HTMLElement::textToFragment): Use ExceptionOr.
(WebCore::HTMLElement::setOuterText): Ditto.

* html/HTMLKeygenElement.cpp:
(WebCore::HTMLKeygenElement::HTMLKeygenElement): Removed unneeded
ASSERT_NO_EXCEPTION and IGNORE_EXCEPTION.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::createMediaControls): Ditto.
* html/HTMLMeterElement.cpp:
(WebCore::HTMLMeterElement::didAddUserAgentShadowRoot): Ditto.
* html/HTMLOptionElement.cpp:
(WebCore::HTMLOptionElement::createForJSConstructor): Use ExceptionOr.
(WebCore::HTMLOptionElement::setText): Removed unneeded
ASSERT_NO_EXCEPTION and IGNORE_EXCEPTION.

* html/HTMLOptionsCollection.cpp:
(WebCore::HTMLOptionsCollection::remove): Call remove, not removeByIndex,
since we were able to change the name.

* html/HTMLOutputElement.cpp:
(WebCore::HTMLOutputElement::setTextContentInternal): Removed unneeded
ASSERT_NO_EXCEPTION and IGNORE_EXCEPTION.
* html/HTMLProgressElement.cpp:
(WebCore::HTMLProgressElement::didAddUserAgentShadowRoot): Ditto.
* html/HTMLScriptElement.cpp:
(WebCore::HTMLScriptElement::setText): Ditto.

* html/HTMLSelectElement.cpp:
(WebCore::HTMLSelectElement::add): Use ExceptionOr.
(WebCore::HTMLSelectElement::remove): Renamed from removeByIndex since
there is no conflict with remove any more.
(WebCore::HTMLSelectElement::setOption): Call remove.
* html/HTMLSelectElement.h: Updated for above.
* html/HTMLSelectElement.idl: Got rid of ImplementedAs=removeByIndex.

* html/HTMLSummaryElement.cpp:
(WebCore::HTMLSummaryElement::didAddUserAgentShadowRoot): Removed unneeded
ASSERT_NO_EXCEPTION and IGNORE_EXCEPTION.
* html/HTMLTableElement.cpp:
(WebCore::HTMLTableElement::HTMLTableElement): Initialize data members in
class definition instead of here.
(WebCore::HTMLTableElement::caption): Simplified using childrenOfType.
(WebCore::HTMLTableElement::setCaption): Use ExceptionOr.
(WebCore::HTMLTableElement::setTHead): Ditto.
(WebCore::HTMLTableElement::setTFoot): Ditto.
(WebCore::HTMLTableElement::deleteTFoot): Removed unneeded ASSERT_NO_EXCEPTION
and IGNORE_EXCEPTION.
(WebCore::HTMLTableElement::createTBody): Ditto.
(WebCore::HTMLTableElement::deleteCaption): Ditto.
(WebCore::HTMLTableElement::insertRow): Use ExceptionOr.
* html/HTMLTableElement.h: Updated for above.

* html/HTMLTableRowElement.cpp:
(WebCore::HTMLTableRowElement::insertCell): Use ExceptionOr.
(WebCore::HTMLTableRowElement::deleteCell): Ditto.
* html/HTMLTableSectionElement.cpp:
(WebCore::HTMLTableSectionElement::insertRow): Ditto.
(WebCore::HTMLTableSectionElement::deleteRow): Ditto.

* html/HTMLTextAreaElement.cpp:
(WebCore::HTMLTextAreaElement::didAddUserAgentShadowRoot): Removed unneeded
ASSERT_NO_EXCEPTION and IGNORE_EXCEPTION.
(WebCore::HTMLTextAreaElement::setDefaultValue): Ditto.
(WebCore::HTMLTextAreaElement::updatePlaceholderText): Ditto.
* html/HTMLTextFormControlElement.cpp:
(WebCore::HTMLTextFormControlElement::setInnerTextValue): Ditto.
* html/HTMLTitleElement.cpp:
(WebCore::HTMLTitleElement::setText): Ditto.
* html/MediaDocument.cpp:
(WebCore::MediaDocumentParser::createDocumentStructure): Ditto.
(WebCore::MediaDocument::replaceMediaElementTimerFired): Ditto.
* html/PluginDocument.cpp:
(WebCore::PluginDocumentParser::createDocumentStructure): Ditto.
* html/RangeInputType.cpp:
(WebCore::RangeInputType::createShadowSubtree): Ditto.
* html/SearchInputType.cpp:
(WebCore::SearchInputType::createShadowSubtree): Ditto.
* html/TextFieldInputType.cpp:
(WebCore::TextFieldInputType::createShadowSubtree): Ditto.
(WebCore::TextFieldInputType::updatePlaceholderText): Ditto.
(WebCore::TextFieldInputType::createContainer): Ditto.
(WebCore::TextFieldInputType::createAutoFillButton): Ditto.
* html/ValidationMessage.cpp:
(WebCore::ValidationMessage::setMessageDOMAndStartTimer): Ditto.
(WebCore::ValidationMessage::buildBubbleTree): Ditto.
(WebCore::ValidationMessage::deleteBubbleTree): Ditto.
* html/shadow/MediaControlElements.cpp:
(WebCore::MediaControlTextTrackContainerElement::updateDisplay): Ditto.
* html/shadow/MediaControls.cpp:
(WebCore::MediaControls::createTextTrackDisplay): Ditto.

* html/shadow/MediaControlsApple.cpp:
(WebCore::MediaControlsApple::MediaControlsApple): Initialize data members
in class definition instead of here.
(WebCore::MediaControlsApple::tryCreateControls): Use ExceptionOr.
* html/shadow/MediaControlsApple.h: Updated for above.

* html/track/VTTCue.cpp:
(WebCore::VTTCue::copyWebVTTNodeToDOMTree): Removed unneeded ASSERT_NO_EXCEPTION
and IGNORE_EXCEPTION.
(WebCore::VTTCue::getDisplayTree): Ditto.
* html/track/VTTRegion.cpp:
(WebCore::VTTRegion::appendTextTrackCueBox): Ditto.

* inspector/DOMEditor.cpp: Use ExceptionOr in action classes.
(WebCore::DOMEditor::DOMEditor): Take a reference.
(WebCore::DOMEditor::insertBefore): Use ExceptionOr.
(WebCore::DOMEditor::removeChild): Ditto.
(WebCore::DOMEditor::setAttribute): Ditto.
(WebCore::DOMEditor::removeAttribute): Ditto.
(WebCore::DOMEditor::setOuterHTML): Ditto.
(WebCore::DOMEditor::replaceWholeText): Ditto.
(WebCore::DOMEditor::replaceChild): Ditto.
(WebCore::DOMEditor::setNodeValue): Ditto.
(WebCore::populateErrorString): Ditto.
* inspector/DOMEditor.h: Updated for above changes.

* inspector/DOMPatchSupport.cpp:
(WebCore::DOMPatchSupport::patchDocument): Updated to use references,
to use ExceptionOr, and to use a struct without a constructor for Digest.
(WebCore::DOMPatchSupport::DOMPatchSupport): Ditto.
(WebCore::DOMPatchSupport::patchNode): Ditto.
(WebCore::DOMPatchSupport::innerPatchNode): Ditto.
(WebCore::DOMPatchSupport::diff): Ditto.
(WebCore::DOMPatchSupport::innerPatchChildren): Ditto.
(WebCore::DOMPatchSupport::createDigest): Ditto.
(WebCore::DOMPatchSupport::insertBeforeAndMarkAsUsed): Ditto.
(WebCore::DOMPatchSupport::removeChildAndMoveToNew): Ditto.
(WebCore::DOMPatchSupport::markNodeAsUsed): Ditto.
* inspector/DOMPatchSupport.h: Updated for above.

* inspector/InspectorCSSAgent.cpp: Use ExceptionOr in the action classes.
(WebCore::InspectorCSSAgent::getStyleSheetText): Use ExceptionOr.
(WebCore::InspectorCSSAgent::setStyleSheetText): Ditto.
(WebCore::InspectorCSSAgent::setStyleText): Ditto.
(WebCore::InspectorCSSAgent::setRuleSelector): Ditto.
(WebCore::InspectorCSSAgent::createInspectorStyleSheetForDocument): Ditto.
(WebCore::InspectorCSSAgent::addRule): Ditto.
* inspector/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::didCreateFrontendAndBackend): Ditto.
(WebCore::InspectorDOMAgent::setAttributeValue): Ditto.
(WebCore::InspectorDOMAgent::setAttributesAsText): Ditto.
(WebCore::InspectorDOMAgent::removeAttribute): Ditto.
(WebCore::InspectorDOMAgent::setOuterHTML): Ditto.
(WebCore::InspectorDOMAgent::setNodeValue): Ditto.
(WebCore::InspectorDOMAgent::undo): Ditto.
(WebCore::InspectorDOMAgent::redo): Ditto.

* inspector/InspectorHistory.cpp:
(WebCore::InspectorHistory::Action::Action): Moved to header.
(WebCore::InspectorHistory::Action::~Action): Ditto.
(WebCore::InspectorHistory::Action::toString): Ditto.
(WebCore::InspectorHistory::Action::isUndoableStateMark): Ditto.
(WebCore::InspectorHistory::Action::mergeId): Ditto.
(WebCore::InspectorHistory::Action::merge): Ditto.
(WebCore::InspectorHistory::InspectorHistory): Deleted.
(WebCore::InspectorHistory::~InspectorHistory): Deleted.
(WebCore::InspectorHistory::perform): Updated exception handling.
(WebCore::InspectorHistory::markUndoableState): Ditto.
(WebCore::InspectorHistory::undo): Ditto.
(WebCore::InspectorHistory::redo): Ditto.
* inspector/InspectorHistory.h: Updated for above.

* inspector/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::setDocumentContent): Use reference.

* inspector/InspectorStyleSheet.cpp:
(WebCore::InspectorStyle::text): Use ExceptionOr and renamed from
getText since this now has a return value.
(WebCore::InspectorStyle::populateAllProperties): Updated for above.
(WebCore::InspectorStyle::setText): Use ExceptionOr.
(WebCore::InspectorStyleSheet::setText): Ditto.
(WebCore::InspectorStyleSheet::ruleSelector): Ditto.
(WebCore::InspectorStyleSheet::setRuleSelector): Ditto.
(WebCore::InspectorStyleSheet::addRule): Ditto.
(WebCore::InspectorStyleSheet::deleteRule): Ditto.
(WebCore::InspectorStyleSheet::buildObjectForStyleSheet): Ditto.
(WebCore::InspectorStyleSheet::buildObjectForStyle): Ditto.
(WebCore::InspectorStyleSheet::setStyleText): Ditto.
(WebCore::InspectorStyleSheet::text): Use ExceptionOr and renamed.
(WebCore::InspectorStyleSheet::checkPageStyleSheet): Deleted.
Just wrote this code inline in each place this was called since it's
just a single null check.
(WebCore::InspectorStyleSheetForInlineStyle::text): Use ExceptionOr
and renamed.
(WebCore::InspectorStyleSheetForInlineStyle::setStyleText): Ditto.
(WebCore::InspectorStyle::getText): Deleted.
* inspector/InspectorStyleSheet.h: Updated for above changes.

* page/DragController.cpp:
(WebCore::documentFragmentFromDragData): Removed unneeded
ASSERT_NO_EXCEPTION and IGNORE_EXCEPTION.
* page/ios/FrameIOS.mm:
(WebCore::Frame::initWithSimpleHTMLDocument): Ditto.
* svg/SVGTRefElement.cpp:
(WebCore::SVGTRefElement::updateReferencedText): Ditto.
(WebCore::SVGTRefElement::detachTarget): Ditto.
* xml/XMLTreeViewer.cpp:
(WebCore::XMLTreeViewer::transformDocumentToTreeView): Ditto.

Source/WebKit/mac:

* DOM/DOMHTMLSelectElement.mm:
(-[DOMHTMLSelectElement remove:]): Call remove instead of removeByIndex
now that it was renamed.
* DOM/DOMNode.mm:
(-[DOMNode setNodeValue:]): Updated exception handling.
(-[DOMNode setPrefix:]): Ditto.
(-[DOMNode setTextContent:]): Ditto.
(-[DOMNode insertBefore:refChild:]): Ditto.
(-[DOMNode replaceChild:oldChild:]): Ditto.
(-[DOMNode removeChild:]): Ditto.
(-[DOMNode appendChild:]): Ditto.
(-[DOMNode cloneNode:]): Ditto.

Source/WebKit/win:

* DOMCoreClasses.cpp:
(DOMNode::insertBefore): Update exception handling.
(DOMNode::removeChild): Ditto.

Source/WebKit2:

* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLSelectElement.cpp:
(webkit_dom_html_select_element_remove): Updated exception handling.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMNode.cpp:
(webkit_dom_node_insert_before): Ditto.
(webkit_dom_node_replace_child): Ditto.
(webkit_dom_node_remove_child): Ditto.
(webkit_dom_node_append_child): Ditto.
(webkit_dom_node_clone_node_with_error): Ditto.
(webkit_dom_node_set_node_value): Ditto.
(webkit_dom_node_set_text_content): Ditto.
* WebProcess/InjectedBundle/API/mac/WKDOMNode.mm:
(-[WKDOMNode insertNode:before:]): Ditto.
(-[WKDOMNode appendChild:]): Ditto.
(-[WKDOMNode removeChild:]): Ditto.

* WebProcess/Plugins/PDF/DeprecatedPDFPlugin.mm:
(WebKit::PDFPlugin::PDFPlugin): Removed unneeded ASSERT_NO_EXCEPTION.
* WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.mm:
(WebKit::PDFPluginChoiceAnnotation::createAnnotationElement): Ditto.

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

3 years agoRename CryptoKeyUsage to CryptoKeyUsageBitmap and CryptoKey::Usage to CryptoKeyUsage
jiewen_tan@apple.com [Fri, 11 Nov 2016 20:12:00 +0000 (20:12 +0000)]
Rename CryptoKeyUsage to CryptoKeyUsageBitmap and CryptoKey::Usage to CryptoKeyUsage
https://bugs.webkit.org/show_bug.cgi?id=164624
<rdar://problem/29210140>

Reviewed by Brent Fulgham.

Source/WebCore:

This patch allows IDLType CryptoKeyUsage to be shared among different IDLs, i.e. CryptoKey.idl,
SubtleCrypto.idl and JsonWebKey.idl such that it can simplify the customized binding codes.

Covered by existing tests.

* CMakeLists.txt:
* DerivedSources.make:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSCryptoKeySerializationJWK.cpp:
* bindings/js/JSCryptoKeySerializationJWK.h:
* bindings/js/JSSubtleCryptoCustom.cpp:
(WebCore::toCryptoKeyUsageBitmap):
(WebCore::cryptoKeyUsageBitmapFromJSValue):
(WebCore::toKeyData):
(WebCore::jsSubtleCryptoFunctionGenerateKeyPromise):
(WebCore::jsSubtleCryptoFunctionImportKeyPromise):
(WebCore::cryptoKeyUsageFromString): Deleted.
(WebCore::cryptoKeyUsagesFromJSValue): Deleted.
* bindings/js/JSWebKitSubtleCryptoCustom.cpp:
* bindings/js/SerializedScriptValue.cpp:
* crypto/CryptoAlgorithm.cpp:
* crypto/CryptoAlgorithm.h:
* crypto/CryptoKey.cpp:
* crypto/CryptoKey.h:
* crypto/CryptoKey.idl:
* crypto/CryptoKeySerialization.h:
* crypto/CryptoKeyUsage.h:
* crypto/CryptoKeyUsage.idl: Added.
* crypto/gnutls/CryptoKeyRSAGnuTLS.cpp:
* crypto/JsonWebKey.h:
* crypto/JsonWebKey.idl:
* crypto/SubtleCrypto.idl:
* crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
* crypto/algorithms/CryptoAlgorithmAES_CBC.h:
* crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
* crypto/algorithms/CryptoAlgorithmAES_KW.h:
* crypto/algorithms/CryptoAlgorithmHMAC.cpp:
* crypto/algorithms/CryptoAlgorithmHMAC.h:
* crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
* crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h:
* crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
* crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h:
* crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
* crypto/algorithms/CryptoAlgorithmRSA_OAEP.h:
* crypto/keys/CryptoKeyAES.cpp:
* crypto/keys/CryptoKeyAES.h:
* crypto/keys/CryptoKeyHMAC.cpp:
* crypto/keys/CryptoKeyHMAC.h:
* crypto/keys/CryptoKeyRSA.cpp:
* crypto/keys/CryptoKeyRSA.h:
* crypto/keys/CryptoKeySerializationRaw.cpp:
* crypto/keys/CryptoKeySerializationRaw.h:
* crypto/mac/CryptoKeyRSAMac.cpp:

LayoutTests:

* crypto/subtle/generate-key-malformed-parameters-expected.txt:
* crypto/subtle/import-key-malformed-parameters-expected.txt:

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

3 years agoBuild all Mac API tests
commit-queue@webkit.org [Fri, 11 Nov 2016 19:46:04 +0000 (19:46 +0000)]
Build all Mac API tests
https://bugs.webkit.org/show_bug.cgi?id=164633

Patch by Alex Christensen <achristensen@webkit.org> on 2016-11-11
Reviewed by Gyuyoung Kim.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/mac/NavigatorLanguage.mm:

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

3 years agoAllow mutable lambdas in HashMap::ensure
achristensen@apple.com [Fri, 11 Nov 2016 19:11:28 +0000 (19:11 +0000)]
Allow mutable lambdas in HashMap::ensure
https://bugs.webkit.org/show_bug.cgi?id=164642

Reviewed by Sam Weinig.

Source/WTF:

* wtf/HashMap.h:
(WTF::HashMapEnsureTranslator::translate):
(WTF::X>::removeIf):

Tools:

* TestWebKitAPI/Tests/WTF/HashMap.cpp:
(TestWebKitAPI::TEST):

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

3 years ago[CSS Parser] Fix basic shape parsing
hyatt@apple.com [Fri, 11 Nov 2016 19:09:01 +0000 (19:09 +0000)]
[CSS Parser] Fix basic shape parsing
https://bugs.webkit.org/show_bug.cgi?id=164645

Reviewed by Dean Jackson.

* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeBasicShape):

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

3 years agoAdd ios-simulator baseline for compositing/tiling/visiblerect-accumulated-offset...
ryanhaddad@apple.com [Fri, 11 Nov 2016 19:02:10 +0000 (19:02 +0000)]
Add ios-simulator baseline for compositing/tiling/visiblerect-accumulated-offset.html.

Unreviewed test gardening.

* platform/ios-simulator/compositing/tiling/visiblerect-accumulated-offset-expected.txt: Added.

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

3 years agoRenderFlowThread::removeLineRegionInfo shouldn't call HashMap::contains before HashMa...
zalan@apple.com [Fri, 11 Nov 2016 18:56:54 +0000 (18:56 +0000)]
RenderFlowThread::removeLineRegionInfo shouldn't call HashMap::contains before HashMap::remove
https://bugs.webkit.org/show_bug.cgi?id=164639

Reviewed by Simon Fraser.

Also instead of asserting that the incoming renderer is not nullptr, we could just pass a reference in.

No change in functionality.

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::invalidateFlowThreadContainingBlockIncludingDescendants):
(WebCore::canComputeRegionRangeForBox):
(WebCore::RenderBlock::computeRegionRangeForBoxChild):
(WebCore::RenderBlock::estimateRegionRangeForBoxChild):
(WebCore::RenderBlock::updateRegionRangeForBoxChild):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::hasRegionRangeInFlowThread):
* rendering/RenderElement.cpp:
(WebCore::RenderElement::removeFromRenderFlowThreadIncludingDescendants):
* rendering/RenderFlowThread.cpp:
(WebCore::RenderFlowThread::removeFlowChildInfo):
(WebCore::RenderFlowThread::validateRegions):
(WebCore::RenderFlowThread::removeRenderBoxRegionInfo):
(WebCore::RenderFlowThread::removeLineRegionInfo):
(WebCore::RenderFlowThread::clearRenderBoxRegionInfoAndCustomStyle):
(WebCore::RenderFlowThread::setRegionRangeForBox):
(WebCore::RenderFlowThread::hasCachedRegionRangeForBox):
(WebCore::RenderFlowThread::computedRegionRangeForBox):
(WebCore::RenderFlowThread::checkLinesConsistency):
* rendering/RenderFlowThread.h:
* rendering/RenderMultiColumnFlowThread.cpp:
(WebCore::RenderMultiColumnFlowThread::setRegionRangeForBox):
* rendering/RenderMultiColumnFlowThread.h:
* rendering/RenderNamedFlowFragment.cpp:
(WebCore::RenderNamedFlowFragment::clearObjectStyleInRegion):
* rendering/RenderNamedFlowFragment.h:
* rendering/RenderNamedFlowThread.cpp:
(WebCore::RenderNamedFlowThread::clearRenderObjectCustomStyle):
(WebCore::RenderNamedFlowThread::removeFlowChildInfo):
* rendering/RenderNamedFlowThread.h:
* rendering/RenderRegion.cpp:
(WebCore::RenderRegion::removeRenderBoxRegionInfo):
* rendering/RenderRegion.h:

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

3 years ago[Cocoa] Support wide gamut for Drag Image UI
commit-queue@webkit.org [Fri, 11 Nov 2016 18:54:21 +0000 (18:54 +0000)]
[Cocoa] Support wide gamut for Drag Image UI
https://bugs.webkit.org/show_bug.cgi?id=164490

Patch by Megan Gardner <megan_gardner@apple.com> on 2016-11-11
Reviewed by Tim Horton.

Source/WebCore:

Fixed an error in the support define for wide gamut on Mac.

The testing infrastructure to test this does not exist, and will be landing in another patch.

* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::extendedSRGBColorSpaceRef):

Source/WebKit2:

Fixed an error in the gating for the new wide gamut support in ShareableBitmap.
We should always respect the flags straight out, and not make decisions later, it can lead to mismatched data and data storage.
Added support for wide gamut in createCGImage.

* Shared/cg/ShareableBitmapCG.cpp:
(WebKit::bitmapInfo):
(WebKit::colorSpace):
(WebKit::ShareableBitmap::createGraphicsContext):
(WebKit::ShareableBitmap::createCGImage):
* WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
(WebKit::convertImageToBitmap):
(WebKit::WebDragClient::startDrag):

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

3 years agoGet touch bar code building for open source builds
bdakin@apple.com [Fri, 11 Nov 2016 18:54:08 +0000 (18:54 +0000)]
Get touch bar code building for open source builds
https://bugs.webkit.org/show_bug.cgi?id=164610

Reviewed by Wenson Hsieh.

Source/WebCore:

* config.h:

Source/WebKit/mac:

* WebKitPrefix.h:

Source/WebKit2:

* config.h:

Source/WTF:

* wtf/Platform.h:

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

3 years ago[CSS Parser] Fix SVG markers and colors
hyatt@apple.com [Fri, 11 Nov 2016 18:52:34 +0000 (18:52 +0000)]
[CSS Parser] Fix SVG markers and colors
https://bugs.webkit.org/show_bug.cgi?id=164640

Reviewed by Dean Jackson.

* css/StyleBuilderConverter.h:
(WebCore::StyleBuilderConverter::convertSVGColor):
* css/parser/CSSPropertyParser.cpp:
(WebCore::CSSPropertyParser::parseShorthand):

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

3 years agoComposition state should be cleared when changing focus to a non-editable element
wenson_hsieh@apple.com [Fri, 11 Nov 2016 18:38:01 +0000 (18:38 +0000)]
Composition state should be cleared when changing focus to a non-editable element
https://bugs.webkit.org/show_bug.cgi?id=164595
<rdar://problem/26412551>

Reviewed by Enrica Casucci.

Source/WebCore:

When canceling or confirming a composition, always ensure that the composition node and composition underlines
being tracked are reset, even when there is no current selection. This prevents us from getting into a bad state
where focus has already changed from an element with a pending composition to a different element and the
composition is canceled, but the Editor still maintains its composition node.

Test: editing/input/focus-change-with-marked-text.html

* editing/Editor.cpp:
(WebCore::Editor::setComposition):

Tools:

Adds support for window.textInputController in DumpRenderTree on iOS. So far, only the methods needed for the
new layout test (editing/focus-change-with-marked-text.html) are supported. These are insertText, setMarkedText,
and markedRange.

* DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
* DumpRenderTree/TextInputController.h: Renamed from Tools/DumpRenderTree/mac/TextInputController.h.

Remove the PLATFORM(MAC) guard for defining the TextInputController. Also, move the TextInputController header
out of the /mac platform directory.

* DumpRenderTree/ios/TextInputControllerIOS.m: Added.
(+[TextInputController isSelectorExcludedFromWebScript:]):
(+[TextInputController webScriptNameForSelector:]):
(-[TextInputController initWithWebView:]):
(-[TextInputController markedRange]):
(-[TextInputController insertText:]):
(-[TextInputController setMarkedText:selectedFrom:length:]):

Introduces TextInputControllerIOS.m, which contains an iOS implementation of TextInputController. Only a subset
of the methods available on the Mac version will be available on iOS for now (see above).

* DumpRenderTree/mac/FrameLoadDelegate.mm:

Remove the PLATFORM(MAC) guard for initializing the TextInputController and binding it to the window object.

(-[FrameLoadDelegate didClearWindowObjectInStandardWorldForFrame:]):
* DumpRenderTree/mac/TextInputControllerMac.m: Renamed from Tools/DumpRenderTree/mac/TextInputController.m.
(-[WebHTMLView interpretKeyEvents:]):
(-[WebNSRange initWithNSRange:]):
(-[WebNSRange location]):
(-[WebNSRange length]):
(+[WebNSRange isSelectorExcludedFromWebScript:]):
(+[NSMutableAttributedString isSelectorExcludedFromWebScript:]):
(+[NSMutableAttributedString webScriptNameForSelector:]):
(-[NSMutableAttributedString getLength]):
(-[NSMutableAttributedString ranges]):
(-[NSMutableAttributedString attributeNamesAtIndex:]):
(-[NSMutableAttributedString valueOfAttribute:atIndex:]):
(-[NSMutableAttributedString addAttribute:value:]):
(-[NSMutableAttributedString addAttribute:value:from:length:]):
(-[NSMutableAttributedString addColorAttribute:red:green:blue:alpha:]):
(-[NSMutableAttributedString addColorAttribute:red:green:blue:alpha:from:length:]):
(-[NSMutableAttributedString addFontAttribute:fontName:size:]):
(-[NSMutableAttributedString addFontAttribute:fontName:size:from:length:]):
(+[TextInputController isSelectorExcludedFromWebScript:]):
(+[TextInputController webScriptNameForSelector:]):
(-[TextInputController initWithWebView:]):
(-[TextInputController dealloc]):
(-[TextInputController textInput]):
(-[TextInputController insertText:]):
(-[TextInputController doCommand:]):
(-[TextInputController setMarkedText:selectedFrom:length:]):
(-[TextInputController unmarkText]):
(-[TextInputController hasMarkedText]):
(-[TextInputController conversationIdentifier]):
(-[TextInputController substringFrom:length:]):
(-[TextInputController attributedSubstringFrom:length:]):
(-[TextInputController legacyAttributedString:]):
(-[TextInputController markedRange]):
(-[TextInputController selectedRange]):
(-[TextInputController firstRectForCharactersFrom:length:]):
(-[TextInputController characterIndexForPointX:Y:]):
(-[TextInputController validAttributesForMarkedText]):
(-[TextInputController attributedStringWithString:]):
(-[TextInputController stringWithUndoGroupingInsertion:]):
(-[TextInputController dictatedStringWithPrimaryString:alternative:alternativeOffset:alternativeLength:]):
(-[TextInputController setInputMethodHandler:]):
(-[TextInputController interpretKeyEvents:withSender:]):

Fixes miscellaneous style issues.

LayoutTests:

Adds a new layout test to ensure that when changing focus from an element with pending composition text to
another element, the composition is committed and there should not still be a pending composition.

* editing/input/focus-change-with-marked-text-expected.txt: Added.
* editing/input/focus-change-with-marked-text.html: Added.
* platform/ios-simulator-wk2/TestExpectations:
* platform/mac/TestExpectations:

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

3 years agoUnreviewed, rolling out r208584.
cdumez@apple.com [Fri, 11 Nov 2016 18:21:20 +0000 (18:21 +0000)]
Unreviewed, rolling out r208584.

Seems to have regressed Speedometer by 1% on Mac

Reverted changeset:

"We should have a more concise way of determining when we're
varargs calling a function using rest parameters"
https://bugs.webkit.org/show_bug.cgi?id=164258
http://trac.webkit.org/changeset/208584

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

3 years agoWeb Inspector: Settings tab: make the header smaller to fit more content
nvasilyev@apple.com [Fri, 11 Nov 2016 18:20:02 +0000 (18:20 +0000)]
Web Inspector: Settings tab: make the header smaller to fit more content
https://bugs.webkit.org/show_bug.cgi?id=164613
<rdar://problem/29206007>

Reviewed by Timothy Hatcher.

* UserInterface/Views/SettingsTabContentView.css:
(.content-view.settings > .header):
Use hv units for margin. 1vh = 1% of viewport height. When Web Inspector window is taller, the margin is larger.

(.content-view.settings > .setting-container):
Convert padding to margin to make spacing between the header and the first section better.

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

3 years ago[CSS Parser] Support -webkit-svg-shadow
hyatt@apple.com [Fri, 11 Nov 2016 17:31:07 +0000 (17:31 +0000)]
[CSS Parser] Support -webkit-svg-shadow
https://bugs.webkit.org/show_bug.cgi?id=164637

Reviewed by Zalan Bujtas.

* css/parser/CSSPropertyParser.cpp:
(WebCore::CSSPropertyParser::parseSingleValue):

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

3 years agoRemove unused FontService from sandbox profile
bfulgham@apple.com [Fri, 11 Nov 2016 17:18:53 +0000 (17:18 +0000)]
Remove unused FontService from sandbox profile
https://bugs.webkit.org/show_bug.cgi?id=164625
<rdar://problem/26899976>

Reviewed by Alex Christensen.

Part of some general sandbox profile gardening.

Convert the Plugin process sandbox into

* Configurations/WebKit.xcconfig: Add exclude for com.apple.WebKit.plugin-common.sb.in.
* DerivedSources.make: Update to generate com.apple.WebKit.plugin-common.sb from .in file
* PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in: Copied from Resources/PlugInSandboxProfiles/com.apple.WebKit.plugin-common.sb.
* Resources/PlugInSandboxProfiles/com.apple.WebKit.plugin-common.sb: Removed.
* WebKit2.xcodeproj/project.pbxproj: Update for new .in file.
* WebProcess/com.apple.WebProcess.sb.in: Remove com.apple.FontServer
from macOS Sierra and newer.

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

3 years agoUnreviewed, rolling out r208117 and r208160.
cdumez@apple.com [Fri, 11 Nov 2016 16:50:57 +0000 (16:50 +0000)]
Unreviewed, rolling out r208117 and r208160.

Regressed Speedometer by >1.5%

Reverted changesets:

"We should have a way of profiling when a get_by_id is pure
and to emit a PureGetById in the DFG/FTL"
https://bugs.webkit.org/show_bug.cgi?id=163305
http://trac.webkit.org/changeset/208117

"Debug JSC test microbenchmarks/pure-get-by-id-cse-2.js timing
out"
https://bugs.webkit.org/show_bug.cgi?id=164227
http://trac.webkit.org/changeset/208160

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

3 years ago[WebRTC][OpenWebRTC] Implement device permissions handling solution for owr backend...
commit-queue@webkit.org [Fri, 11 Nov 2016 13:09:33 +0000 (13:09 +0000)]
[WebRTC][OpenWebRTC] Implement device permissions handling solution for owr backend in the UI process
https://bugs.webkit.org/show_bug.cgi?id=164010

Patch by Alejandro G. Castro <alex@igalia.com> on 2016-11-11
Reviewed by Philippe Normand.

Move the capture of the sources for the OWR backend to the
WebProcess. In the UI we continue checking if the user allows
access to the audio and video capture. When device handling is
added in the future we will need some persistent ID and API to
pass from the UI process to the Web process.

* platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp:
(WebCore::RealtimeMediaSourceCenterOwr::validateRequestConstraints):
Add the proper audio and video sources to allow the UI message to
be properly rendered. We are adding the specific devices, even
though the dialog just asks for general audio and video. There was
already a FIXME about improving this.
(WebCore::RealtimeMediaSourceCenterOwr::createMediaStream): We are
capturing the devices here when the allowed message arrived from
the UI process. We store the completion handler to use it later
when the aync owr API finishes capture devices process.
(WebCore::RealtimeMediaSourceCenterOwr::mediaSourcesAvailable): We
now call the completion handler in this callback called when the
owr library finishes the capture of the devices. Now this happens
in the WebProcess for OWR port.
* platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.h:
Add an attribute to store the completion handler.

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

3 years ago[css-grid] ASSERTION FAILED: !m_gridIsDirty in WebCore::RenderGrid::gridRowCount
rego@igalia.com [Fri, 11 Nov 2016 11:08:39 +0000 (11:08 +0000)]
[css-grid] ASSERTION FAILED: !m_gridIsDirty in WebCore::RenderGrid::gridRowCount
https://bugs.webkit.org/show_bug.cgi?id=163450

Reviewed by Darin Adler.

Source/WebCore:

The issue is that in the test case a simplifiedLayout() is performed.
So in RenderGrid::layoutBlock() we early return and the grid is not populated,
so the m_gridIsDirty flag is not cleared when we try to check the size of the grid
in RenderGrid::layoutPositionedObject().

We should avoid to do a simplified layout if we have to layout
some positioned grid items and the grid is dirty.

The problem was not only the ASSERT, but the current behavior was wrong too.
As we didn't do a proper layout of the grid container, the positioned item
won't be placed on the expected position. Added tests verifying this.

Tests: fast/css-grid-layout/grid-positioned-item-dynamic-change.html
       fast/css-grid-layout/grid-simplified-layout-positioned.html

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::canPerformSimplifiedLayout): Check if we can perform or not
a simplified layout.
(WebCore::RenderBlock::simplifiedLayout): Extract initial check
into canPerformSimplifiedLayout().
* rendering/RenderBlock.h: Add new header for canPerformSimplifiedLayout().
* rendering/RenderGrid.cpp: Implement our own version of canPerformSimplifiedLayout()
to verify that the grid is not dirty if we have to layout some positioned items.
(WebCore::RenderGrid::canPerformSimplifiedLayout):
* rendering/RenderGrid.h: Add canPerformSimplifiedLayout() header.

LayoutTests:

The tests shouldn't crash in debug to verify that the bug is fixed.
On top of that the positioned grid items should appear in the right position too.

* fast/css-grid-layout/grid-positioned-item-dynamic-change-expected.html: Added.
* fast/css-grid-layout/grid-positioned-item-dynamic-change.html: Added.
* fast/css-grid-layout/grid-simplified-layout-positioned-expected.html: Added.
* fast/css-grid-layout/grid-simplified-layout-positioned.html: Added.

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

3 years ago[Modern Media Controls] Media Controller: media tracks control support
graouts@webkit.org [Fri, 11 Nov 2016 09:48:37 +0000 (09:48 +0000)]
[Modern Media Controls] Media Controller: media tracks control support
https://bugs.webkit.org/show_bug.cgi?id=164618
<rdar://problem/27989483>

Reviewed by Dean Jackson.

We introduce the TracksSupport class to only enable the media tracks button
in the media controls when text tracks and/or multiple audio tracks are available.

Tests: media/modern-media-controls/tracks-support/tracks-support-audio-tracks.html
       media/modern-media-controls/tracks-support/tracks-support-no-tracks.html
       media/modern-media-controls/tracks-support/tracks-support-text-tracks.html

* Modules/modern-media-controls/js-files:
* Modules/modern-media-controls/media/media-controller.js:
(MediaController.prototype._updateControlsIfNeeded):
* Modules/modern-media-controls/media/tracks-support.js: Added.
(TracksSupport):
(TracksSupport.prototype.destroy):
(TracksSupport.prototype.get control):
(TracksSupport.prototype.get mediaEvents):
(TracksSupport.prototype.buttonWasClicked):
(TracksSupport.prototype.syncControl):
* WebCore.xcodeproj/project.pbxproj:

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

3 years agoWe should have a more concise way of determining when we're varargs calling a functio...
sbarati@apple.com [Fri, 11 Nov 2016 08:33:34 +0000 (08:33 +0000)]
We should have a more concise way of determining when we're varargs calling a function using rest parameters
https://bugs.webkit.org/show_bug.cgi?id=164258

Reviewed by Yusuke Suzuki.

JSTests:

* microbenchmarks/call-using-spread.js: Added.
(bar):
(foo):
* microbenchmarks/spread-large-array.js: Added.
(foo):
(arrays.push):
* microbenchmarks/spread-small-array.js: Added.
(foo):
* stress/spread-array-iterator-watchpoint-2.js: Added.
(foo):
(arrayIterator.next):
* stress/spread-array-iterator-watchpoint.js: Added.
(foo):
(Array.prototype.Symbol.iterator):
* stress/spread-non-array.js: Added.
(assert):
(foo):
(let.customIterator.Symbol.iterator):
(bar):

Source/JavaScriptCore:

This patch adds two new bytecodes and DFG nodes for the following code patterns:

```
foo(a, b, ...c)
let x = [a, b, ...c];
```

To do this, I've introduced two new bytecode operations (and their
corresponding DFG nodes):

op_spread and op_new_array_with_spread.

op_spread takes a single input and performs the ES6 iteration protocol on it.
It returns the result of doing the spread inside a new class I've
made called JSFixedArray. JSFixedArray is a cell with a single 'size'
field and a buffer of values allocated inline in the cell. Abstracting
the protocol into a single node is good because it will make IR analysis
in the future much simpler. For now, it's also good because it allows
us to create fast paths for array iteration (which is quite common).
This fast path allows us to emit really good code for array iteration
inside the DFG/FTL.

op_new_array_with_spread is a variable argument bytecode that also
has a bit vector associated with it. The bit vector indicates if
any particular argument is to be spread or not. Arguments that
are spread are known to be JSFixedArray because we must emit an
op_spread before op_new_array_with_spread consumes the value.
For example, for this array:
[a, b, ...c, d, ...e]
we will have this bit vector:
[0, 0, 1, 0, 1]

The reason I've chosen this IR is that it will make eliminating
a rest allocation for this type of code much easier:

```
function foo(...args) {
    return bar(a, b, ...args);
}
```

It will be easier to analyze the IR now that the operations
will be described at a high level.

This patch is an ~8% speedup on ES6SampleBench on my MBP.

* CMakeLists.txt:
* DerivedSources.make:
* JavaScriptCore.xcodeproj/project.pbxproj:
* builtins/IteratorHelpers.js: Added.
(performIteration):
* bytecode/BytecodeList.json:
* bytecode/BytecodeUseDef.h:
(JSC::computeUsesForBytecodeOffset):
(JSC::computeDefsForBytecodeOffset):
* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::dumpBytecode):
* bytecode/ObjectPropertyConditionSet.cpp:
(JSC::generateConditionForSelfEquivalence):
* bytecode/ObjectPropertyConditionSet.h:
* bytecode/TrackedReferences.cpp:
(JSC::TrackedReferences::check):
* bytecode/UnlinkedCodeBlock.h:
(JSC::UnlinkedCodeBlock::bitVectors):
(JSC::UnlinkedCodeBlock::bitVector):
(JSC::UnlinkedCodeBlock::addBitVector):
(JSC::UnlinkedCodeBlock::shrinkToFit):
* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::emitNewArrayWithSpread):
* bytecompiler/BytecodeGenerator.h:
* bytecompiler/NodesCodegen.cpp:
(JSC::ArrayNode::emitBytecode):
* dfg/DFGAbstractInterpreterInlines.h:
(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::addToGraph):
(JSC::DFG::ByteCodeParser::parseBlock):
* dfg/DFGCapabilities.cpp:
(JSC::DFG::capabilityLevel):
* dfg/DFGClobberize.h:
(JSC::DFG::clobberize):
* dfg/DFGDoesGC.cpp:
(JSC::DFG::doesGC):
* dfg/DFGFixupPhase.cpp:
(JSC::DFG::FixupPhase::fixupNode):
(JSC::DFG::FixupPhase::watchHavingABadTime):
* dfg/DFGGraph.h:
(JSC::DFG::Graph::isWatchingArrayIteratorProtocolWatchpoint):
* dfg/DFGNode.h:
(JSC::DFG::Node::bitVector):
* dfg/DFGNodeType.h:
* dfg/DFGOperations.cpp:
* dfg/DFGOperations.h:
* dfg/DFGPredictionPropagationPhase.cpp:
* dfg/DFGSafeToExecute.h:
(JSC::DFG::safeToExecute):
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compileSpread):
(JSC::DFG::SpeculativeJIT::compileNewArrayWithSpread):
* dfg/DFGSpeculativeJIT.h:
(JSC::DFG::SpeculativeJIT::callOperation):
* dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGStructureRegistrationPhase.cpp:
(JSC::DFG::StructureRegistrationPhase::run):
* ftl/FTLAbstractHeapRepository.h:
* ftl/FTLCapabilities.cpp:
(JSC::FTL::canCompile):
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileNode):
(JSC::FTL::DFG::LowerDFGToB3::compileNewArrayWithSpread):
(JSC::FTL::DFG::LowerDFGToB3::compileSpread):
(JSC::FTL::DFG::LowerDFGToB3::allocateVariableSizedCell):
* jit/AssemblyHelpers.h:
(JSC::AssemblyHelpers::emitAllocateVariableSizedCell):
(JSC::AssemblyHelpers::emitAllocateVariableSizedJSObject):
* jit/JIT.cpp:
(JSC::JIT::privateCompileMainPass):
* jit/JIT.h:
* jit/JITOpcodes.cpp:
(JSC::JIT::emit_op_new_array_with_spread):
(JSC::JIT::emit_op_spread):
* jit/JITOperations.h:
* llint/LLIntData.cpp:
(JSC::LLInt::Data::performAssertions):
* llint/LLIntSlowPaths.cpp:
* llint/LowLevelInterpreter.asm:
* runtime/ArrayIteratorAdaptiveWatchpoint.cpp: Added.
(JSC::ArrayIteratorAdaptiveWatchpoint::ArrayIteratorAdaptiveWatchpoint):
(JSC::ArrayIteratorAdaptiveWatchpoint::handleFire):
* runtime/ArrayIteratorAdaptiveWatchpoint.h: Added.
* runtime/CommonSlowPaths.cpp:
(JSC::SLOW_PATH_DECL):
* runtime/CommonSlowPaths.h:
* runtime/IteratorOperations.h:
(JSC::forEachInIterable):
* runtime/JSCInlines.h:
* runtime/JSFixedArray.cpp: Added.
(JSC::JSFixedArray::visitChildren):
* runtime/JSFixedArray.h: Added.
(JSC::JSFixedArray::createStructure):
(JSC::JSFixedArray::createFromArray):
(JSC::JSFixedArray::get):
(JSC::JSFixedArray::buffer):
(JSC::JSFixedArray::size):
(JSC::JSFixedArray::offsetOfSize):
(JSC::JSFixedArray::offsetOfData):
(JSC::JSFixedArray::create):
(JSC::JSFixedArray::JSFixedArray):
(JSC::JSFixedArray::allocationSize):
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::JSGlobalObject):
(JSC::JSGlobalObject::init):
(JSC::JSGlobalObject::visitChildren):
(JSC::JSGlobalObject::objectPrototypeIsSane): Deleted.
(JSC::JSGlobalObject::arrayPrototypeChainIsSane): Deleted.
(JSC::JSGlobalObject::stringPrototypeChainIsSane): Deleted.
* runtime/JSGlobalObject.h:
(JSC::JSGlobalObject::arrayIteratorProtocolWatchpoint):
(JSC::JSGlobalObject::iteratorProtocolFunction):
* runtime/JSGlobalObjectInlines.h: Added.
(JSC::JSGlobalObject::objectPrototypeIsSane):
(JSC::JSGlobalObject::arrayPrototypeChainIsSane):
(JSC::JSGlobalObject::stringPrototypeChainIsSane):
(JSC::JSGlobalObject::isArrayIteratorProtocolFastAndNonObservable):
* runtime/JSType.h:
* runtime/VM.cpp:
(JSC::VM::VM):
* runtime/VM.h:

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

3 years ago[GTK][JHbuild] bump libnice version in openwebrtc.modules
philn@webkit.org [Fri, 11 Nov 2016 08:08:15 +0000 (08:08 +0000)]
[GTK][JHbuild] bump libnice version in openwebrtc.modules
https://bugs.webkit.org/show_bug.cgi?id=164586

Reviewed by Michael Catanzaro.

Update to a recent libnice git snapshot and remove patches already
upstream or not applying anymore. The patches not upstream yet
will be reported in Phabricator.

* gtk/openwebrtc.modules:
* gtk/patches/libnice-0001-agent-Remove-unnecessary-NULL-check.patch: Removed.
* gtk/patches/libnice-0002-Do-not-update-a-remote-candidate-s-type.patch: Removed.
* gtk/patches/libnice-0002-TURN-handle-437-Allocation-Mismatch-responses.patch: Removed.
* gtk/patches/libnice-0003-Do-not-compare-scope-for-IPv6-address-when-scope-is-.patch: Removed.
* gtk/patches/libnice-0004-Removing-no-op-assignment.patch: Removed.

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

3 years ago[DOMJIT] DOMJIT accessor attribute in IDL should say like DOMJIT=Getter
utatane.tea@gmail.com [Fri, 11 Nov 2016 07:42:05 +0000 (07:42 +0000)]
[DOMJIT] DOMJIT accessor attribute in IDL should say like DOMJIT=Getter
https://bugs.webkit.org/show_bug.cgi?id=164632

Reviewed by Sam Weinig.

Currently, DOMJIT patchpoint is only allowed for getter in attributes.
To make it explicit, we use IDL attribute DOMJIT=Getter instead of
DOMJIT.

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateHeader):
(GenerateImplementation):
* bindings/scripts/IDLAttributes.txt:
* bindings/scripts/test/TestDOMJIT.idl:
* dom/Document.idl:
* dom/Node.idl:

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

3 years ago[SVG] Start moving special casing of SVG out of the bindings - SVGPreserveAspectRatio
commit-queue@webkit.org [Fri, 11 Nov 2016 06:29:44 +0000 (06:29 +0000)]
[SVG] Start moving special casing of SVG out of the bindings - SVGPreserveAspectRatio
https://bugs.webkit.org/show_bug.cgi?id=164622

Patch by Sam Weinig <sam@webkit.org> on 2016-11-10
Reviewed by Darin Adler.

Part 2 of moving special casing of SVG out of the bindings.

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

* bindings/scripts/CodeGenerator.pm:
(GenerateCompileTimeCheckForEnumsIfNeeded):
* bindings/scripts/IDLAttributes.txt:
Allow specifying a different scope for the constants to be declared in.
This allows us to have only one copy of the constants in the implementation
of SVGAngle/SVGAngleValue and SVGPreserveAspectRatio/SVGPreserveAspectRatioValue.

* loader/FrameLoader.cpp:
* rendering/svg/RenderSVGImage.h:
Remove unnecessary #include.

* svg/SVGAngle.h:
Remove redundant enum declaration.

* svg/SVGAngle.idl:
Specify a ConstantsScope of SVGAngleValue.

* rendering/svg/RenderSVGImage.cpp:
(WebCore::RenderSVGImage::updateImageViewport):
* svg/PatternAttributes.h:
(WebCore::PatternAttributes::preserveAspectRatio):
(WebCore::PatternAttributes::setPreserveAspectRatio):
* svg/SVGAnimatedPreserveAspectRatio.cpp:
(WebCore::SVGAnimatedPreserveAspectRatioAnimator::constructFromString):
(WebCore::SVGAnimatedPreserveAspectRatioAnimator::calculateAnimatedValue):
* svg/SVGAnimatedPreserveAspectRatio.h:
* svg/SVGAnimatedType.cpp:
(WebCore::SVGAnimatedType::createPreserveAspectRatio):
* svg/SVGAnimatedType.h:
(WebCore::SVGAnimatedType::preserveAspectRatio):
* svg/SVGFEImageElement.cpp:
(WebCore::SVGFEImageElement::parseAttribute):
* svg/SVGFitToViewBox.cpp:
(WebCore::SVGFitToViewBox::viewBoxToViewTransform):
* svg/SVGFitToViewBox.h:
(WebCore::SVGFitToViewBox::parseAttribute):
* svg/SVGImageElement.cpp:
(WebCore::SVGImageElement::parseAttribute):
* svg/SVGViewSpec.cpp:
(WebCore::SVGViewSpec::preserveAspectRatioString):
(WebCore::SVGViewSpec::lookupOrCreatePreserveAspectRatioWrapper):
(WebCore::SVGViewSpec::reset):
(WebCore::SVGViewSpec::parseViewSpec):
* svg/SVGViewSpec.h:
* svg/graphics/SVGImage.cpp:
(WebCore::SVGImage::computeIntrinsicDimensions):
* svg/graphics/filters/SVGFEImage.cpp:
(WebCore::FEImage::FEImage):
(WebCore::FEImage::createWithImage):
(WebCore::FEImage::createWithIRIReference):
* svg/graphics/filters/SVGFEImage.h:
Replace SVGPreserveAspectRatio usage with SVGPreserveAspectRatioValue.

* svg/SVGPreserveAspectRatio.cpp: Removed.
* svg/SVGPreserveAspectRatio.h: Replaced.
* svg/SVGPreserveAspectRatio.idl:
* svg/SVGPreserveAspectRatioValue.cpp: Copied from Source/WebCore/svg/SVGPreserveAspectRatio.cpp.
* svg/SVGPreserveAspectRatioValue.h: Copied from Source/WebCore/svg/SVGPreserveAspectRatio.h.
Rename SVGPreserveAspectRatio to SVGPreserveAspectRatioValue and add a new SVGPreserveAspectRatio
that acts as the binding object.

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

3 years agoFix assertion after r208534.
achristensen@apple.com [Fri, 11 Nov 2016 06:16:08 +0000 (06:16 +0000)]
Fix assertion after r208534.
https://bugs.webkit.org/show_bug.cgi?id=160497

Source/WebKit/mac:

* WebView/WebView.mm:
(-[WebView _commonInitializationWithFrameName:groupName:]):
(WebInstallMemoryPressureHandler):
WebInstallMemoryPressureHandler can be called before [WebView initWithFrame:frameName:groupName:]
When this happens, we should use the same std::once_flag to make sure we install the MemoryPressureHandler::singleton
only once, otherwise we get an assertion !m_installed in MemoryPressureHandler::setLowMemoryHandler.

Tools:

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/mac/MemoryPressureHandler.mm: Added.
(TestWebKitAPI::TEST):
Add a regression test.

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

3 years ago[DOMJIT] Document#body should have DOMJIT patchpoint
utatane.tea@gmail.com [Fri, 11 Nov 2016 06:08:18 +0000 (06:08 +0000)]
[DOMJIT] Document#body should have DOMJIT patchpoint
https://bugs.webkit.org/show_bug.cgi?id=164627

Reviewed by Darin Adler.

Source/WebCore:

This patch implements document.body accessor. To implement it, we need,

1. DOM traversing ability from ASM.
2. Checking HTMLElement.
3. Checking HTMLElement's localName.

The above features are already implemented in CSSJIT.
We extract some of utilities from CSSJIT to share them with DOMJIT.

Test: js/dom/domjit-accessor-document-body.html

* cssjit/SelectorCompiler.cpp:
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateWalkToParentElement):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateWalkToNextAdjacentElement):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateWalkToPreviousAdjacentElement):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementAttributeMatching):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementAttributeValueExactMatching):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementAttributeFunctionCallValueMatching):
(WebCore::SelectorCompiler::jumpIfElementIsNotEmpty):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementHasTagName):
(WebCore::SelectorCompiler::testIsElementFlagOnNode): Deleted.
(WebCore::SelectorCompiler::testIsHTMLFlagOnNode): Deleted.
* dom/Document.idl:
* dom/Element.h:
* dom/QualifiedName.h:
* domjit/DOMJITAbstractHeapRepository.yaml:
* domjit/DOMJITHelpers.h:
(WebCore::DOMJIT::branchTestIsElementFlagOnNode):
(WebCore::DOMJIT::branchTestIsHTMLFlagOnNode):
* domjit/JSDocumentDOMJIT.cpp:
(WebCore::DocumentBodyDOMJIT::checkDOM):
(WebCore::loadLocalName):
(WebCore::DocumentBodyDOMJIT::callDOMGetter):

LayoutTests:

* js/dom/domjit-accessor-document-body-expected.txt: Added.
* js/dom/domjit-accessor-document-body.html: Added.

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

3 years agoRemove unused parameter name to fix build error on iOS
wilander@apple.com [Fri, 11 Nov 2016 04:37:06 +0000 (04:37 +0000)]
Remove unused parameter name to fix build error on iOS
https://bugs.webkit.org/show_bug.cgi?id=163468

No review.

No new tests.

* platform/ios/PasteboardIOS.mm:
(WebCore::Pasteboard::writeTrustworthyWebURLsPboardType):
    Removed parameter name 'pasteboardURL' in unimplemented function.

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

3 years agoSpeed up HTMLInputElement validation
cdumez@apple.com [Fri, 11 Nov 2016 04:32:41 +0000 (04:32 +0000)]
Speed up HTMLInputElement validation
https://bugs.webkit.org/show_bug.cgi?id=164603

Reviewed by Ryosuke Niwa.

Speed up HTMLInputElement validation by doing 1 virtual function call
instead of 9 and calling HTMLInputElement::value() only once per
validation instead of 9 times. Calling value() is expensive because
of sanitization.

No new tests, no Web-exposed behavior change.

* html/BaseCheckableInputType.cpp:
(WebCore::BaseCheckableInputType::fallbackValue):
* html/FormAssociatedElement.cpp:
(WebCore::FormAssociatedElement::isValid):
* html/FormAssociatedElement.h:
* html/HTMLFormControlElement.cpp:
(WebCore::HTMLFormControlElement::isValidFormControlElement):
(WebCore::HTMLFormControlElement::updateValidity):
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::isValid):
(WebCore::HTMLInputElement::value):
* html/HTMLInputElement.h:
* html/TextFieldInputType.cpp:
(WebCore::limitLength):
* html/ValidityState.idl:

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

3 years agoAdd link information to data transfer pasteboard for drag and drop links
wilander@apple.com [Fri, 11 Nov 2016 04:15:41 +0000 (04:15 +0000)]
Add link information to data transfer pasteboard for drag and drop links
https://bugs.webkit.org/show_bug.cgi?id=163468
<rdar://problem/20634630>

Reviewed by Brent Fulgham.

Source/WebCore:

Test: editing/pasteboard/drag-link-with-data-transfer-adds-trusted-link-to-pasteboard.html
This test ensures data transfers still work for types 'text' and 'url', i.e. that we don't
regress in-page use of the drag pasteboard.

* page/DragController.cpp:
(WebCore::DragController::startDrag):
    Now adds trustworthy link information to the drag pasteboard.
* platform/Pasteboard.h:
    New function declaration Pasteboard::writeTrustworthyWebURLsPboardType.
* platform/efl/PasteboardEfl.cpp:
(WebCore::Pasteboard::writeTrustworthyWebURLsPboardType):
    Empty, i.e. not implemented.
* platform/gtk/PasteboardGtk.cpp:
(WebCore::Pasteboard::writeTrustworthyWebURLsPboardType):
    Empty, i.e. not implemented.
* platform/ios/PasteboardIOS.mm:
(WebCore::Pasteboard::writeTrustworthyWebURLsPboardType):
    Calls ASSERT_NOT_REACHED() to make sure we don't use this function before we have
    decided on a trustrworthy URL pasteboard type on iOS. Currently not used since we
    don't support drag & drop on iOS.
* platform/mac/PasteboardMac.mm:
(WebCore::Pasteboard::writeTrustworthyWebURLsPboardType):
    Writes the given URL to the WebURLsWithTitlesPboardType. This pasteboard type
    serves as a trusted drop source.
* platform/win/PasteboardWin.cpp:
(WebCore::Pasteboard::writeTrustworthyWebURLsPboardType):
    Empty, i.e. not implemented.

LayoutTests:

* editing/pasteboard/drag-link-with-data-transfer-adds-trusted-link-to-pasteboard-expected.txt: Added.
* editing/pasteboard/drag-link-with-data-transfer-adds-trusted-link-to-pasteboard.html: Added.
    This test ensures data transfer is not deleted or overwritten for the types 'text' and 'url'.
* platform/ios-simulator/TestExpectations:
    Drag & drop is not supported on iOS.

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

3 years agoREGRESSION(r207182): [iOS] Crash because of passing freed CFDictionaryRef to CG when...
commit-queue@webkit.org [Fri, 11 Nov 2016 02:20:48 +0000 (02:20 +0000)]
REGRESSION(r207182): [iOS] Crash because of passing freed CFDictionaryRef to CG when decoding a sub-sampled large image
https://bugs.webkit.org/show_bug.cgi?id=164617

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

This covered by the test fast/images/image-subsampling.html but it should
run with --guard-malloc --repeat-each=10 to show the bug or to verify the
fix.

imageSourceOptions() returns a non static RetainPtr<CFDictionaryRef> if
the subsamplingLevel is not zero. Because we are assigning the raw pointer
to a local variable in ImageDecoder::createFrameImageAtIndex(), CFRelease()
is called for the CFDictionaryRef immediately after this assignment. This
causes its memory to be freed in this case even before calling CG.

This bug does not happen if the subsamplingLevel is zero because we cache
the returned value in a static NeverDestroyed<RetainPtr<CFDictionaryRef> in
imageSourceOptions(). This cache prevents the CFDictionaryRef from being
freed in ImageDecoder::createFrameImageAtIndex() no matter where CFRelease()
is called.

The fix is hold the returned value in a RetainPtr<CFDictionaryRef>. This
will ensure the CFDictionaryRef raw pointer is valid till the end of
ImageDecoder::createFrameImageAtIndex().

* platform/graphics/cg/ImageDecoderCG.cpp:
(WebCore::ImageDecoder::createFrameImageAtIndex): Ensure the pointer is retained.

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

3 years agoFix broken have-a-bad-time-with-arguments.js test.
mark.lam@apple.com [Fri, 11 Nov 2016 01:27:02 +0000 (01:27 +0000)]
Fix broken have-a-bad-time-with-arguments.js test.
https://bugs.webkit.org/show_bug.cgi?id=164626

Reviewed by Filip Pizlo.

But also saved a copy of the broken one as broken-have-a-bad-time-with-arguments-for-gc-testing.js
because coincidentally, it stresses the GC in ways that help reveal bugs.

* stress/broken-have-a-bad-time-with-arguments-for-gc-testing.js: Added.
(testFunction):
(warmupFunction):
(let.argsDeclIndex.in.argumentsDecls.let.indexToReturnIndex.in.indicesToReturn.let.insertElementActionIndex.in.insertElementActions.let.tierWarmupCountIndex.in.tierWarmupCounts.let.testArgsIndex.in.testArgsList.catch):
* stress/have-a-bad-time-with-arguments.js:

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

3 years ago[Win][Direct2D] Add transparency layer support
bfulgham@apple.com [Fri, 11 Nov 2016 00:59:53 +0000 (00:59 +0000)]
[Win][Direct2D] Add transparency layer support
https://bugs.webkit.org/show_bug.cgi?id=164614

Reviewed by Dean Jackson.

Provide a stackable implementation of transparency layers so that
multiple layers with opacity draw propery.

Tested by fast/layers/opacity-stacking.html and others.

* platform/graphics/win/GraphicsContextDirect2D.cpp:
(WebCore::GraphicsContext::platformContext): Remove unneeded assertion.
(WebCore::GraphicsContextPlatformPrivate::renderTarget): Return current context taking
into account the presence of transparency layers.
(WebCore::GraphicsContextPlatformPrivate::setAlpha): Added.
(WebCore::GraphicsContextPlatformPrivate::currentGlobalAlpha): Get current global
alpha for current layer.
(WebCore::GraphicsContext::colorWithGlobalAlpha): Compute proper color taking into
account the current layer.
(WebCore::drawWithShadowHelper): Helper function to share code.
(WebCore::GraphicsContext::drawWithShadow): Use new helper function.
(WebCore::GraphicsContextPlatformPrivate::beginTransparencyLayer): Added.
(WebCore::GraphicsContext::beginPlatformTransparencyLayer): Call new implementation.
(WebCore::GraphicsContextPlatformPrivate::endTransparencyLayer): Added.
(WebCore::GraphicsContext::endPlatformTransparencyLayer): Call new implementation.
(WebCore::GraphicsContext::clearRect): Clear to transparent color.
(WebCore::GraphicsContext::setPlatformAlpha): Pass new alpha on to any active
transparency layer.
* platform/graphics/win/GraphicsContextPlatformPrivateDirect2D.h:
(WebCore::GraphicsContextPlatformPrivate::renderTarget): Deleted.

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

3 years agoAdd CSS Color Level 4 to features.
dino@apple.com [Fri, 11 Nov 2016 00:49:06 +0000 (00:49 +0000)]
Add CSS Color Level 4 to features.

* features.json:

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

3 years agoMove update image calls to RenderElement::styleDidChange.
zalan@apple.com [Fri, 11 Nov 2016 00:26:53 +0000 (00:26 +0000)]
Move update image calls to RenderElement::styleDidChange.
https://bugs.webkit.org/show_bug.cgi?id=164623

Reviewed by Simon Fraser.

There should be no dependency on the image update between ::styleWillChange and ::styleDidChange.

Covered by existing tests.

* rendering/RenderElement.cpp:
(WebCore::RenderElement::initializeStyle):
(WebCore::RenderElement::setStyle):
(WebCore::RenderElement::styleDidChange):

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

3 years agoAfter r207459 ASSERT in CachedResourceLoader under InspectorPageAgent::cachedResource
commit-queue@webkit.org [Fri, 11 Nov 2016 00:01:14 +0000 (00:01 +0000)]
After r207459 ASSERT in CachedResourceLoader under InspectorPageAgent::cachedResource
https://bugs.webkit.org/show_bug.cgi?id=164621

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

* inspector/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::cachedResource):
CachedResourceLoader expects a sanitized URL.

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

3 years agoREGRESSION (r208522): LayoutTest fast/loader/reload-zero-byte-plugin.html is a flaky...
cdumez@apple.com [Thu, 10 Nov 2016 23:59:42 +0000 (23:59 +0000)]
REGRESSION (r208522): LayoutTest fast/loader/reload-zero-byte-plugin.html is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=164570

Reviewed by Simon Fraser.

Tools:

Properly reset TestController::m_shouldDownloadUndisplayableMIMETypes between tests to
avoid flakiness.

* WebKitTestRunner/TestController.cpp:
(WTR::TestController::resetStateToConsistentValues):

LayoutTests:

Unskip test which should no longer be flaky.

* platform/mac/TestExpectations:

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

3 years agoIndexedDB 2.0 Support the IDBDatabase.onclose event.
beidson@apple.com [Thu, 10 Nov 2016 23:27:37 +0000 (23:27 +0000)]
IndexedDB 2.0 Support the IDBDatabase.onclose event.
https://bugs.webkit.org/show_bug.cgi?id=164602

Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

* web-platform-tests/IndexedDB/interfaces-expected.txt:

Source/WebCore:

No new tests (Covered by existing tests).

* Modules/indexeddb/IDBDatabase.cpp:
(WebCore::IDBDatabase::connectionToServerLost): Fire "onclose" after "onerror"
* Modules/indexeddb/IDBDatabase.idl:

LayoutTests:

* TestExpectations:
* storage/indexeddb/modern/handle-user-delete-expected.txt:
* storage/indexeddb/modern/resources/handle-user-delete.js:

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

3 years agoASSERTION FAILED: length > offset encountered with wasm.yaml/wasm/js-api/test_Module...
jfbastien@apple.com [Thu, 10 Nov 2016 23:07:15 +0000 (23:07 +0000)]
ASSERTION FAILED: length > offset encountered with wasm.yaml/wasm/js-api/test_Module.js.default-wasm
https://bugs.webkit.org/show_bug.cgi?id=164597

Reviewed by Keith Miller.

JSTests:

Trim the array buffer before returning it: it's optimistically
over-allocated to avoid growing all the time, but when parsed it
can't have extra content.

* wasm/Builder_WebAssemblyBinary.js:
(export.const.Binary):
* wasm/LowLevelBinary.js:
(export.default.LowLevelBinary.prototype.get return):

Source/JavaScriptCore:

* wasm/WasmParser.h:
(JSC::Wasm::Parser::parseVarUInt32): move closer to other parsers
(JSC::Wasm::Parser::parseVarUInt64): move closer to other parsers

Source/WTF:

Decoding at end of file should fail, not assert.

* wtf/LEBDecoder.h:
(WTF::LEBDecoder::decodeUInt):
(WTF::LEBDecoder::decodeInt32):

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

3 years agoMarking swipe/pushState-cached-back-swipe.html and swipe/main-frame-pinning-requireme...
ryanhaddad@apple.com [Thu, 10 Nov 2016 23:03:28 +0000 (23:03 +0000)]
Marking swipe/pushState-cached-back-swipe.html and swipe/main-frame-pinning-requirement.html as failing.
https://bugs.webkit.org/show_bug.cgi?id=164572

Unreviewed test gardening.

* platform/mac-wk2/TestExpectations:

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

3 years agoCopied text would contain text inside CDATA sections and comments
rniwa@webkit.org [Thu, 10 Nov 2016 22:21:35 +0000 (22:21 +0000)]
Copied text would contain text inside CDATA sections and comments
https://bugs.webkit.org/show_bug.cgi?id=164578
Source/WebCore:

<rdar://problem/19834542>

Reviewed by Darin Adler.

The bug was caused by HTMLConverter::_traverseNode always including the content of a Text node.
Since Comment and CDataSection nodes are also Text nodes, we need to exclude them.

In the long term, we should check the visibility of the text as done in MarkupAccumulator.

Test: editing/mac/attributed-string/comment-cdata-section.html

* editing/cocoa/HTMLConverter.mm:
(HTMLConverter::_traverseNode):

LayoutTests:

Reviewed by Darin Adler.

Added a regression test for creating an attributed string from different kinds of Text nodes.
Comment and CDataSection should not be included in the attributed string.

* editing/mac/attributed-string/comment-cdata-section-expected.txt: Added.
* editing/mac/attributed-string/comment-cdata-section.html: Added.
* platform/mac-yosemite/editing/mac/attributed-string/comment-cdata-section-expected.txt: Added.

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

3 years agotest262: DataView / TypedArray methods should throw RangeErrors for negative numbers...
commit-queue@webkit.org [Thu, 10 Nov 2016 22:03:24 +0000 (22:03 +0000)]
test262: DataView / TypedArray methods should throw RangeErrors for negative numbers (ToIndex)
https://bugs.webkit.org/show_bug.cgi?id=164450

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

JSTests:

* stress/dataview-typedarray-toindex.js: Added.
Tests for all cases where ToIndex should be used.

* test262.yaml:
New passing tests.

Source/JavaScriptCore:

* runtime/JSCJSValue.h:
* runtime/JSCJSValueInlines.h:
(JSC::JSValue::toIndex):
Introduce a method for toIndex, which is used by DataView and TypedArrays
to convert an argument to a number with the possibility of throwing
RangeErrors for negative values. We also throw RangeErrors for large
values, because wherever this is used we expect an unsigned.

* runtime/JSArrayBufferConstructor.cpp:
(JSC::constructArrayBuffer):
* runtime/JSDataViewPrototype.cpp:
(JSC::getData):
(JSC::setData):
* runtime/JSGenericTypedArrayViewConstructorInlines.h:
(JSC::constructGenericTypedArrayViewWithArguments):
(JSC::constructGenericTypedArrayView):
Use toIndex instead of toUint32 where required.

LayoutTests:

* fast/canvas/webgl/data-view-crash-expected.txt:
* fast/canvas/webgl/data-view-test-expected.txt:
Better error message.

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

3 years agoA few bits of minor code clean up.
mark.lam@apple.com [Thu, 10 Nov 2016 21:42:33 +0000 (21:42 +0000)]
A few bits of minor code clean up.
https://bugs.webkit.org/show_bug.cgi?id=164523

Reviewed by Yusuke Suzuki.

* interpreter/StackVisitor.cpp:
(JSC::StackVisitor::Frame::dump):
- Insert a space to make the dump more legible.

* runtime/Options.h:
- Fixed some typos.

* runtime/StringPrototype.cpp:
(JSC::stringProtoFuncReplaceUsingRegExp):
(JSC::stringProtoFuncReplaceUsingStringSearch):
- Use the VM& that is already available.

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

3 years agobmalloc threads should have a non-default QoS
ggaren@apple.com [Thu, 10 Nov 2016 21:40:56 +0000 (21:40 +0000)]
bmalloc threads should have a non-default QoS
https://bugs.webkit.org/show_bug.cgi?id=164612

Reviewed by Filip Pizlo.

* bmalloc/AsyncTask.h:
(bmalloc::Function>::threadEntryPoint): Request user-interactive quality
of service because user-interactive tasks use malloc.

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

3 years agoWeb Inspector: Call RuntimeAgent.disableControlFlowProfiler when Code Coverage Profil...
nvasilyev@apple.com [Thu, 10 Nov 2016 21:31:01 +0000 (21:31 +0000)]
Web Inspector: Call RuntimeAgent.disableControlFlowProfiler when Code Coverage Profiler is turned off
https://bugs.webkit.org/show_bug.cgi?id=163407
<rdar://problem/28764230>

Reviewed by Joseph Pecoraro.

Turning Code Coverage off by clicking [C] icon now disables its backend by calling RuntimeAgent.disableControlFlowProfiler().

* UserInterface/Views/SourceCodeTextEditor.js:
(WebInspector.SourceCodeTextEditor.prototype.set _basicBlockAnnotatorEnabled):

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

3 years agoGraph::methodOfGettingAValueProfileFor() should be returning the profile for the...
mark.lam@apple.com [Thu, 10 Nov 2016 21:19:52 +0000 (21:19 +0000)]
Graph::methodOfGettingAValueProfileFor() should be returning the profile for the operand node.
https://bugs.webkit.org/show_bug.cgi?id=164600
<rdar://problem/28828676>

Reviewed by Filip Pizlo.

JSTests:

* stress/osr-exit-on-op-negate-should-no-fail-assertions.js: Added.

Source/JavaScriptCore:

Currently, Graph::methodOfGettingAValueProfileFor() assumes that the operand DFG
node that it is provided with always has a different origin than the node that is
using that operand.  For example, in a DFG graph that looks like this:

    a: ...
    b: ArithAdd(@a, ...)

... when emitting speculation checks on @a for the ArithAdd node at @b,
Graph::methodOfGettingAValueProfileFor() is passed @a, and expects @a's to
originate from a different bytecode than @b.  The intent here is to get the
profile for @a so that the OSR exit ramp for @b can update @a's profile with the
observed result type from @a so that future type prediction on incoming args for
the ArithAdd node can take this into consideration.

However, op_negate can be compiled into the following series of nodes:

    a: ...
    b: BooleanToNumber(@a)
    c: DoubleRep(@b)
    d: ArithNegate(@c)

All 3 nodes @b, @c, and @d maps to the same op_negate bytecode i.e. they have the
same origin.  When the speculativeJIT emits a speculationCheck for DoubleRep, it
calls Graph::methodOfGettingAValueProfileFor() to get the ArithProfile for the
BooleanToNumber node.  But because all 3 nodes have the same origin,
Graph::methodOfGettingAValueProfileFor() erroneously returns the ArithProfile for
the op_negate.  Subsequently, the OSR exit ramp will modify the ArithProfile of
the op_negate and corrupt its profile.  Instead, what the OSR exit ramp should be
doing is update the ArithProfile of op_negate's operand i.e. BooleanToNumber's
operand @a in this case.

The fix is to always pass the current node we're generating code for (in addition
to the operand node) to Graph::methodOfGettingAValueProfileFor().  This way, we
know the profile is valid if and only if the current node and its operand node
does not have the same origin.

In this patch, we also fixed the following:
1. Teach Graph::methodOfGettingAValueProfileFor() to get the profile for
   BooleanToNumber's operand if the operand node it is given is BooleanToNumber.
2. Change JITCompiler::appendExceptionHandlingOSRExit() to explicitly pass an
   empty MethodOfGettingAValueProfile().  It was implicitly doing this before.
3. Change SpeculativeJIT::emitInvalidationPoint() to pass an empty
   MethodOfGettingAValueProfile().  It has no child node.  Hence, it doesn't
   make sense to call Graph::methodOfGettingAValueProfileFor() for a child node
   that does not exist.

* dfg/DFGGraph.cpp:
(JSC::DFG::Graph::methodOfGettingAValueProfileFor):
* dfg/DFGGraph.h:
* dfg/DFGJITCompiler.cpp:
(JSC::DFG::JITCompiler::appendExceptionHandlingOSRExit):
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::speculationCheck):
(JSC::DFG::SpeculativeJIT::emitInvalidationPoint):
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::appendOSRExitDescriptor):

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

3 years ago[MediaStream] apply constraints passed to getUserMedia()
eric.carlson@apple.com [Thu, 10 Nov 2016 20:52:54 +0000 (20:52 +0000)]
[MediaStream] apply constraints passed to getUserMedia()
https://bugs.webkit.org/show_bug.cgi?id=164561

Reviewed by Youenn Fablet.
<rdar://problem/29191384>

Source/WebCore:

No new tests, updated existing tests.

* Modules/mediastream/UserMediaRequest.cpp:
(WebCore::UserMediaRequest::allow): Pass constraints into createMediaStream instead of applying
  them after the stream has been created.

* WebCore.xcodeproj/project.pbxproj: Remove MediaConstraintsMock.cpp/.h.

* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updatePausedImage): Remove a bogus assert.
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::currentReadyState): Drive-by fix: a stream
  that is receiving media data is as ready as it will ever be so it's readyState should be
  at HAVE_ENOUGH_DATA.

Simplify CaptureDeviceManager by removing all code for constraint validation because some
constraints can't be validated without a live capture device. Ports that are able to resolve
constraints without creating a live source can do so in a derived capture device class.
* platform/mediastream/CaptureDeviceManager.cpp:
(CaptureDeviceManager::bestSourcesForTypeAndConstraints): Return a list of UIDs, not a list
  of live sources, because that is all the caller will use. This will allows ports to avoid
  source creation in some cases.
(CaptureDeviceManager::sourceWithUID): Add parameters for new source constraints and invalid
  constraint.
(CaptureDeviceManager::verifyConstraintsForMediaType): Deleted.
(CaptureDeviceManager::bestDeviceForFacingMode): Deleted.
(facingModeFromString): Deleted.
(CaptureDeviceManager::sessionSupportsConstraint): Deleted.
(CaptureDeviceManager::isSupportedFrameRate): Deleted.
* platform/mediastream/CaptureDeviceManager.h:
(WebCore::CaptureDeviceManager::defaultCaptureSession): Deleted.

* platform/mediastream/MediaConstraints.cpp:
(WebCore::FlattenedConstraint::find): New, make it possible to examine resolved constraints.
* platform/mediastream/MediaConstraints.h:
(WebCore::NumericConstraint::fitnessDistance): Reject invalid constraints.
(WebCore::NumericConstraint::valueForCapabilityRange): New, resolve a constraint for a
  capability range.
(WebCore::MediaTrackConstraintSetMap::width): Expose constraints held in the map.
(WebCore::MediaTrackConstraintSetMap::height):
(WebCore::MediaTrackConstraintSetMap::sampleRate):
(WebCore::MediaTrackConstraintSetMap::sampleSize):
(WebCore::MediaTrackConstraintSetMap::aspectRatio):
(WebCore::MediaTrackConstraintSetMap::frameRate):
(WebCore::MediaTrackConstraintSetMap::volume):
(WebCore::MediaTrackConstraintSetMap::echoCancellation):
(WebCore::MediaTrackConstraintSetMap::facingMode):
(WebCore::MediaTrackConstraintSetMap::deviceId):
(WebCore::MediaTrackConstraintSetMap::groupId):

Resolve and apply width, height, and frameRate all at once because the ability to support
one may depend on the value of another.
* platform/mediastream/RealtimeMediaSource.cpp:
(WebCore::RealtimeMediaSource::supportsSizeAndFrameRate):
(WebCore::applyNumericConstraint): Move the guts of the logic into valueForCapabilityRange.
(WebCore::RealtimeMediaSource::applySizeAndFrameRate):
(WebCore::RealtimeMediaSource::selectSettings):
(WebCore::RealtimeMediaSource::supportsConstraints):
(WebCore::RealtimeMediaSource::applyConstraints): Support null success/failure lambdas.
* platform/mediastream/RealtimeMediaSource.h:

* platform/mediastream/RealtimeMediaSourceCenter.h:
* platform/mediastream/mac/AVAudioCaptureSource.h:
* platform/mediastream/mac/AVAudioCaptureSource.mm:
(WebCore::AVAudioCaptureSource::create): Add parameter for creation constraints.
(WebCore::AVAudioCaptureSource::AVAudioCaptureSource): Ditto.

Remove all constraint validation code, it is done by the audio and video capture sources. Add
support for stream creation constraints.
* platform/mediastream/mac/AVCaptureDeviceManager.h:
* platform/mediastream/mac/AVCaptureDeviceManager.mm:
(WebCore::AVCaptureDeviceManager::captureDeviceList):
(WebCore::AVCaptureDeviceManager::createMediaSourceForCaptureDeviceWithConstraints):
(WebCore::AVCaptureDeviceManager::bestSourcesForTypeAndConstraints): Deleted.
(WebCore::AVCaptureDeviceManager::sourceWithUID): Deleted.
(WebCore::AVCaptureDeviceManager::verifyConstraintsForMediaType): Deleted.
(WebCore::AVCaptureDeviceManager::defaultCaptureSession): Deleted.
(WebCore::AVCaptureDeviceManager::sessionSupportsConstraint): Deleted.
(WebCore::AVCaptureDeviceManager::isSupportedFrameRate): Deleted.
(WebCore::AVCaptureDeviceManager::supportedConstraints): Deleted.

* platform/mediastream/mac/AVMediaCaptureSource.h:
(WebCore::AVMediaCaptureSource::constraints): Deleted.
* platform/mediastream/mac/AVMediaCaptureSource.mm:
(WebCore::AVMediaCaptureSource::AVMediaCaptureSource):
(WebCore::AVMediaCaptureSource::~AVMediaCaptureSource):
(WebCore::AVMediaCaptureSource::startProducingData):
(WebCore::AVMediaCaptureSource::stopProducingData):
(WebCore::AVMediaCaptureSource::beginConfiguration):
(WebCore::AVMediaCaptureSource::commitConfiguration):
(WebCore::AVMediaCaptureSource::capabilities):
(WebCore::AVMediaCaptureSource::setupSession):
(WebCore::AVMediaCaptureSource::reset):

Validate and apply constraints, support source creation constraints, initialize capabilities
and supported constraints by examining device capabilities.
* platform/mediastream/mac/AVVideoCaptureSource.h:
* platform/mediastream/mac/AVVideoCaptureSource.mm:
(WebCore::AVVideoCaptureSource::create):
(WebCore::AVVideoCaptureSource::AVVideoCaptureSource):
(WebCore::updateSizeMinMax):
(WebCore::updateAspectRatioMinMax):
(WebCore::AVVideoCaptureSource::initializeCapabilities):
(WebCore::AVVideoCaptureSource::initializeSupportedConstraints):
(WebCore::AVVideoCaptureSource::applySize):
(WebCore::AVVideoCaptureSource::setPreset):
(WebCore::AVVideoCaptureSource::applyFrameRate):
(WebCore::AVVideoCaptureSource::applySizeAndFrameRate):
(WebCore::AVVideoCaptureSource::setupCaptureSession):
(WebCore::AVVideoCaptureSource::currentFrameCGImage):
(WebCore::AVVideoCaptureSource::bestSessionPresetForVideoDimensions):
(WebCore::AVVideoCaptureSource::supportsSizeAndFrameRate):

* platform/mediastream/mac/MockRealtimeVideoSourceMac.h:
* platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
(WebCore::MockRealtimeVideoSource::create): Apply creation constraints, return null if they
  can not be applied successfully.
(WebCore::MockRealtimeVideoSourceMac::MockRealtimeVideoSourceMac):
(WebCore::MockRealtimeVideoSource::createMuted):

Update RealtimeMediaSourceCenters for API changes.
* platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
(WebCore::RealtimeMediaSourceCenterMac::validateRequestConstraints):
(WebCore::RealtimeMediaSourceCenterMac::createMediaStream):
* platform/mediastream/mac/RealtimeMediaSourceCenterMac.h:
* platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp:
(WebCore::RealtimeMediaSourceCenterOwr::validateRequestConstraints):
(WebCore::RealtimeMediaSourceCenterOwr::createMediaStream):
(WebCore::RealtimeMediaSourceCenterOwr::mediaSourcesAvailable):
* platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.h:

Mock media sources support constraint validation and application directly so "mock constraints"
are no longer necessary.
* platform/mock/MediaConstraintsMock.cpp: Removed.
* platform/mock/MediaConstraintsMock.h: Removed.
* platform/mock/MockRealtimeAudioSource.cpp:
(WebCore::MockRealtimeAudioSource::create):
(WebCore::MockRealtimeAudioSource::createMuted):
(WebCore::MockRealtimeAudioSource::updateSettings):
(WebCore::MockRealtimeAudioSource::initializeCapabilities):
(WebCore::MockRealtimeAudioSource::initializeSupportedConstraints):
* platform/mock/MockRealtimeAudioSource.h:
* platform/mock/MockRealtimeMediaSourceCenter.cpp:
(WebCore::MockRealtimeMediaSourceCenter::validateRequestConstraints):
(WebCore::MockRealtimeMediaSourceCenter::createMediaStream):
* platform/mock/MockRealtimeMediaSourceCenter.h:
* platform/mock/MockRealtimeVideoSource.cpp:
(WebCore::MockRealtimeVideoSource::create):
(WebCore::MockRealtimeVideoSource::createMuted):
* platform/mock/MockRealtimeVideoSource.h:
* platform/mock/RTCPeerConnectionHandlerMock.cpp:

Source/WebKit2:

* UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
(WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):

LayoutTests:

* fast/mediastream/MediaDevices-getUserMedia.html:
* fast/mediastream/MediaStream-video-element-expected.txt:
* fast/mediastream/MediaStream-video-element-track-stop-expected.txt:
* fast/mediastream/MediaStreamTrack-getCapabilities-expected.txt:
* fast/mediastream/MediaStreamTrack-getSettings-expected.txt:

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

3 years agoMove SecurityOrigin::databaseIdentifier() to SecurityOriginData
achristensen@apple.com [Thu, 10 Nov 2016 20:52:17 +0000 (20:52 +0000)]
Move SecurityOrigin::databaseIdentifier() to SecurityOriginData
https://bugs.webkit.org/show_bug.cgi?id=164573

Reviewed by Brady Eidson.

Source/WebCore:

No change in behavior.

* Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp:
(WebCore::WebKitMediaKeySession::mediaKeysStorageDirectory):
* Modules/indexeddb/IDBDatabaseIdentifier.cpp:
(WebCore::IDBDatabaseIdentifier::databaseDirectoryRelativeToRoot):
* Modules/indexeddb/server/IDBServer.cpp:
(WebCore::IDBServer::IDBServer::performCloseAndDeleteDatabasesForOrigins):
* Modules/webdatabase/DatabaseTracker.cpp:
(WebCore::DatabaseTracker::hasEntryForOriginNoLock):
(WebCore::DatabaseTracker::hasEntryForDatabase):
(WebCore::DatabaseTracker::originPath):
(WebCore::DatabaseTracker::fullPathForDatabaseNoLock):
(WebCore::DatabaseTracker::databaseNamesForOriginNoLock):
(WebCore::DatabaseTracker::detailsForNameAndOrigin):
(WebCore::DatabaseTracker::setDatabaseDetails):
(WebCore::DatabaseTracker::originLockFor):
(WebCore::DatabaseTracker::deleteOriginLockFor):
(WebCore::DatabaseTracker::quotaForOriginNoLock):
(WebCore::DatabaseTracker::setQuota):
(WebCore::DatabaseTracker::addDatabase):
(WebCore::DatabaseTracker::deleteOrigin):
(WebCore::DatabaseTracker::deleteDatabase):
(WebCore::DatabaseTracker::removeDeletedOpenedDatabases):
* Modules/webdatabase/SQLTransactionCoordinator.cpp:
(WebCore::getDatabaseIdentifier):
* dom/Document.cpp:
(WebCore::Document::origin):
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::mediaPlayerMediaKeysStorageDirectory):
* loader/appcache/ApplicationCacheStorage.cpp:
(WebCore::ApplicationCacheStorage::calculateQuotaForOrigin):
(WebCore::ApplicationCacheStorage::calculateUsageForOrigin):
(WebCore::ApplicationCacheStorage::calculateRemainingSizeForOriginExcludingCache):
(WebCore::ApplicationCacheStorage::storeUpdatedQuotaForOrigin):
(WebCore::ApplicationCacheStorage::store):
(WebCore::ApplicationCacheStorage::ensureOriginRecord):
* page/SecurityOrigin.cpp:
(WebCore::SecurityOrigin::databaseIdentifier): Deleted.
* page/SecurityOrigin.h:
* page/SecurityOriginData.cpp:
(WebCore::SecurityOriginData::databaseIdentifier):
* page/SecurityOriginData.h:

Source/WebKit:

* Storage/StorageAreaImpl.cpp:
(WebKit::StorageAreaImpl::create):
* Storage/StorageTracker.cpp:
(WebKit::StorageTracker::deleteOrigin):
(WebKit::StorageTracker::diskUsageForOrigin):

Source/WebKit/mac:

* WebCoreSupport/WebSecurityOrigin.mm:
(-[WebSecurityOrigin databaseIdentifier]):

Source/WebKit2:

* Shared/API/c/WKSecurityOriginRef.cpp:
(WKSecurityOriginCopyDatabaseIdentifier):
* UIProcess/Storage/LocalStorageDatabaseTracker.cpp:
(WebKit::LocalStorageDatabaseTracker::databasePath):
(WebKit::LocalStorageDatabaseTracker::didOpenDatabaseWithOrigin):
(WebKit::LocalStorageDatabaseTracker::deleteDatabaseWithOrigin):
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::removeMediaKeys):
* WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp:
(WebKit::GeolocationPermissionRequestManager::startRequestForGeolocation):
* WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
(WKBundlePageCopyOriginsWithApplicationCache):
* WebProcess/MediaCache/WebMediaKeyStorageManager.cpp:
(WebKit::WebMediaKeyStorageManager::mediaKeyStorageDirectoryForOrigin):
* WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
(WebKit::UserMediaPermissionRequestManager::startUserMediaRequest):
(WebKit::UserMediaPermissionRequestManager::enumerateMediaDevices):
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::exceededDatabaseQuota):
(WebKit::WebChromeClient::reachedApplicationCacheOriginQuota):

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

3 years agoMarking inspector/sampling-profiler tests as flaky timeouts.
ryanhaddad@apple.com [Thu, 10 Nov 2016 20:07:06 +0000 (20:07 +0000)]
Marking inspector/sampling-profiler tests as flaky timeouts.
https://bugs.webkit.org/show_bug.cgi?id=164388

Unreviewed test gardening.

* platform/mac/TestExpectations:

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

3 years agoRemove unused CFURLCACHE code
commit-queue@webkit.org [Thu, 10 Nov 2016 20:05:52 +0000 (20:05 +0000)]
Remove unused CFURLCACHE code
https://bugs.webkit.org/show_bug.cgi?id=164551

Patch by Alex Christensen <achristensen@webkit.org> on 2016-11-10
Reviewed by Antti Koivisto.

Source/WebKit2:

WebKit2 doesn't use CFURLCache, but we still have some unused code that seems to use it.

* NetworkProcess/NetworkProcess.cpp:
(WebKit::fetchDiskCacheEntries):
(WebKit::clearDiskCacheEntries):
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/cocoa/NetworkProcessCocoa.mm:
(WebKit::partitionName): Deleted.
(WebKit::NetworkProcess::cfURLCacheOrigins): Deleted.
(WebKit::NetworkProcess::clearCFURLCacheForOrigins): Deleted.

Source/WTF:

* wtf/Platform.h:

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

3 years agoRenderElement::invalidateFlowThreadContainingBlockIncludingDescendants should be...
zalan@apple.com [Thu, 10 Nov 2016 19:44:51 +0000 (19:44 +0000)]
RenderElement::invalidateFlowThreadContainingBlockIncludingDescendants should be on RenderBlock.
https://bugs.webkit.org/show_bug.cgi?id=164601

Reviewed by Simon Fraser.

FlowThread containing blocks are cached at RenderBlocks. It makes no sense to call the invalidate function on a RenderElement.
Move invalidateFlowThreadContainingBlockIncludingDescendants to RenderBlock.

No change in functionality.

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::invalidateFlowThreadContainingBlockIncludingDescendants):
* rendering/RenderBlock.h:
* rendering/RenderElement.cpp:
(WebCore::RenderElement::invalidateFlowThreadContainingBlockIncludingDescendants): Deleted.
* rendering/RenderElement.h:
* rendering/RenderInline.cpp:
(WebCore::RenderInline::splitInlines):

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

3 years agoMarking http/tests/cache/disk-cache/disk-cache-request-headers.html as flaky on ios...
ryanhaddad@apple.com [Thu, 10 Nov 2016 19:43:05 +0000 (19:43 +0000)]
Marking http/tests/cache/disk-cache/disk-cache-request-headers.html as flaky on ios-simulator.
https://bugs.webkit.org/show_bug.cgi?id=164594

Unreviewed test gardening.

* platform/ios-simulator/TestExpectations:

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

3 years agoMarking fast/loader/reload-zero-byte-plugin.html as flaky.
ryanhaddad@apple.com [Thu, 10 Nov 2016 19:38:58 +0000 (19:38 +0000)]
Marking fast/loader/reload-zero-byte-plugin.html as flaky.
https://bugs.webkit.org/show_bug.cgi?id=164570

Unreviewed test gardening.

* platform/mac/TestExpectations:

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

3 years agoUnmarking storage/domstorage/sessionstorage/blocked-file-access.html.
bfulgham@apple.com [Thu, 10 Nov 2016 19:00:26 +0000 (19:00 +0000)]
Unmarking storage/domstorage/sessionstorage/blocked-file-access.html.
https://bugs.webkit.org/show_bug.cgi?id=164592

Unreviewed test gardening after r208550.

* TestExpectations:

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

3 years agoAdd test that image load over default port using HTTP 0.9 protocol is blocked when...
dbates@webkit.org [Thu, 10 Nov 2016 18:56:55 +0000 (18:56 +0000)]
Add test that image load over default port using HTTP 0.9 protocol is blocked when page is
served with a different HTTP version
https://bugs.webkit.org/show_bug.cgi?id=164552

Reviewed by Brent Fulgham.

* http/tests/security/http-0.9/image-default-port-blocked-expected.txt: Added.
* http/tests/security/http-0.9/image-default-port-blocked.html: Added.

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

3 years agoLocal file restrictions should not block sessionStorage access.
bfulgham@apple.com [Thu, 10 Nov 2016 18:54:37 +0000 (18:54 +0000)]
Local file restrictions should not block sessionStorage access.
https://bugs.webkit.org/show_bug.cgi?id=155609
<rdar://problem/25229461>

Reviewed by Andy Estes.

Re-landing this fix that was lost when the localStorage change was rolled out.

Use of 'sessionStorage' is governed by SecurityOrigin with third party access
set to 'ShouldAllowFromThirdParty::AlwaysAllowFromThirdParty'. We should not
reject local files for this combination of arguments.

Tested by storage/domstorage/sessionstorage/blocked-file-access.html.

* page/SecurityOrigin.cpp:
(WebCore::SecurityOrigin::canAccessStorage): For the case of sessionStorage,
allow local file access.

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

3 years agoREGRESSION (r195004): Scripts and plugins blocked for subsequent loads in same WebContent
dbates@webkit.org [Thu, 10 Nov 2016 18:50:08 +0000 (18:50 +0000)]
REGRESSION (r195004): Scripts and plugins blocked for subsequent loads in same WebContent
process after receiving HTTP 0.9 response
https://bugs.webkit.org/show_bug.cgi?id=164387
<rdar://problem/28987537>

Reviewed by Brent Fulgham.

Source/WebCore:

Fixes an issue where the HTTP 0.9 sandbox persisted across subsequent loads in the same
WebContent process.

Currently when an HTTP 0.9 response is received for a request made to a default port
(e.g. 80) we apply a sandbox policy on the FrameLoader for the main resource that
disallows scripts and plugins. A FrameLoader may be re-used for navigations. Therefore,
the sandbox policy applied to one site may be applied to another site. Moreover the
sandbox policy was applied to the FrameLoader of the main resource regardless of whether
the HTTP response was for a subresource. Instead we should apply the sandbox on a per-
Document basis and only if we receive an HTTP 0.9 response for the document when the
corresponding HTTP request was made to a default port.

As a side benefit of this change, we emit exactly one console message to Web Inspector
when the HTTP 0.9 sandbox is applied to a document as opposed to three console messages.
Moreover, we only emit this console message when the document load is not blocked.

Test: http/tests/security/http-0.9/sandbox-should-not-persist-on-navigation.html

* dom/Document.cpp:
(WebCore::Document::initSecurityContext): Disallow scripts and plugins if an HTTP 0.9
response was received for this document. Note that if this function is called for a
document associated with an HTTP 0.9 response then the corresponding HTTP request was
made to a default port. DocumentLoader::responseReceived() blocks the load for a document
with an HTTP 0.9 response corresponding to an HTTP request made to a non-default port.
This invariant is covered by the tests LayoutTests/http/tests/security/http-0.9/default-port-{plugin, script}-blocked.html.
(WebCore::Document::shouldEnforceHTTP0_9Sandbox): Added. Returns whether an HTTP 0.9 response
was received for this document.
* dom/Document.h:
* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::responseReceived): Remove logic to apply sandbox policy to the
FrameLoader associated with the main resource. We will apply the sandbox during initialization
of the document.
* loader/ResourceLoader.cpp:
(WebCore::ResourceLoader::didReceiveResponse): Ditto.
* loader/SubresourceLoader.cpp:
(WebCore::SubresourceLoader::didReceiveResponse): Ditto.

LayoutTests:

Add a new test to ensure that the HTTP 0.9 sandbox policy does not persist across navigations.

Unskip HTTP 0.9 tests and update expected results for existing tests as needed.

* TestExpectations: Unskip the HTTP 0.9 tests.
* http/tests/security/http-0.9/default-port-plugin-blocked-expected.txt: Remove duplicate console
messages now that we emit the console message exactly once per document.
* http/tests/security/http-0.9/default-port-script-blocked-expected.txt: Ditto.
* http/tests/security/http-0.9/iframe-blocked-expected.txt: Update expected result now that we
no longer emit a console message for a blocked load.
* http/tests/security/http-0.9/image-blocked-expected.txt: Ditto.
* http/tests/security/http-0.9/image-on-HTTP-0.9-default-port-page-allowed-expected.txt: Remove
duplicate console messages now that we emit the console message exactly once per document.
* http/tests/security/http-0.9/image-on-HTTP-0.9-page-blocked-expected.txt: Ditto.
* http/tests/security/http-0.9/resources/sandbox-should-not-persist-on-navigation.html: Added.
* http/tests/security/http-0.9/sandbox-should-not-persist-on-navigation-expected.txt: Added.
* http/tests/security/http-0.9/sandbox-should-not-persist-on-navigation.html: Added.
* http/tests/security/http-0.9/worker-connect-src-blocked-expected.txt: Update expected result
now that we no longer apply a sandbox policy to the main resource if a subresource had an HTTP 0.9
response.
* http/tests/security/http-0.9/worker-importScripts-blocked-expected.txt: Ditto.
* http/tests/security/http-0.9/xhr-asynchronous-blocked-expected.txt: Ditto.

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

3 years agoUpdate SubtleCrypto::importKey to match the latest spec
jiewen_tan@apple.com [Thu, 10 Nov 2016 18:36:44 +0000 (18:36 +0000)]
Update SubtleCrypto::importKey to match the latest spec
https://bugs.webkit.org/show_bug.cgi?id=164446
<rdar://problem/29123621>

Reviewed by Brent Fulgham.

LayoutTests/imported/w3c:

* WebCryptoAPI/idlharness-expected.txt:

Source/WebCore:

This patch does following few things:
1. It updates the SubtleCrypto::importKey method to match the latest spec:
   https://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-importKey.
   It also refers to the latest Editor's Draft at a certain degree:
   https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-importKey.
2. It implements importKey operations of following algorithms: AES-CBC, AES-KW,
   HMAC, RSAES-PKCS1-V1_5, RSASSA-PKCS1-V1_5, and RSA-OAEP.
3. It fixes some minor problems of SubtleCrypto::generateKey.
4. It addes move constructors for CryptoKeyAES, CryptoKeyHMAC, CryptoKeyRSA and
   CryptoKeyDataRSAComponents.
5. It renames HmacKeyGenParams to HmacKeyParams to serve the purpose of both
   HmacKeyGenParams and HmacImportParams which are essentially the same.
6. It enforces the key length in bits of CryptoKeyHMAC to be multiples of 8.
7. It also fixes the following bugs:
   https://bugs.webkit.org/show_bug.cgi?id=126033,
   https://bugs.webkit.org/show_bug.cgi?id=126034,
   https://bugs.webkit.org/show_bug.cgi?id=151308.
P.S. We currently only support Raw and Jwk key format.

Tests: crypto/subtle/aes-cbc-import-jwk-key-length-128.html
       crypto/subtle/aes-cbc-import-jwk-key-length-192.html
       crypto/subtle/aes-cbc-import-jwk-key-length-256.html
       crypto/subtle/aes-cbc-import-jwk-key-minimum.html
       crypto/subtle/aes-cbc-import-jwk-key-non-extractable.html
       crypto/subtle/aes-cbc-import-raw-key-length-128.html
       crypto/subtle/aes-cbc-import-raw-key-length-192.html
       crypto/subtle/aes-cbc-import-raw-key-length-256.html
       crypto/subtle/aes-import-key-malformed-parameters.html
       crypto/subtle/aes-kw-import-jwk-key-length-128.html
       crypto/subtle/aes-kw-import-jwk-key-length-192.html
       crypto/subtle/aes-kw-import-jwk-key-length-256.html
       crypto/subtle/aes-kw-import-raw-key.html
       crypto/subtle/generate-key-malformed-parameters.html
       crypto/subtle/hmac-import-jwk-key-minimum.html
       crypto/subtle/hmac-import-jwk-key-non-extractable.html
       crypto/subtle/hmac-import-jwk-key-sha1.html
       crypto/subtle/hmac-import-jwk-key-sha224.html
       crypto/subtle/hmac-import-jwk-key-sha256.html
       crypto/subtle/hmac-import-jwk-key-sha384.html
       crypto/subtle/hmac-import-jwk-key-sha512.html
       crypto/subtle/hmac-import-malformed-parameters.html
       crypto/subtle/hmac-import-raw-key-customized-length.html
       crypto/subtle/hmac-import-raw-key.html
       crypto/subtle/import-key-malformed-parameters.html
       crypto/subtle/rsa-import-key-malformed-parameters.html
       crypto/subtle/rsa-oaep-import-jwk-private-key.html
       crypto/subtle/rsa-oaep-import-jwk-public-key-sha1.html
       crypto/subtle/rsa-oaep-import-jwk-public-key-sha224.html
       crypto/subtle/rsa-oaep-import-jwk-public-key-sha256.html
       crypto/subtle/rsa-oaep-import-jwk-public-key-sha384.html
       crypto/subtle/rsa-oaep-import-jwk-public-key-sha512.html
       crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-private-key.html
       crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key-leading-zero.html
       crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key-minimum.html
       crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key-non-extractable.html
       crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key.html
       crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-private-key.html
       crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha1.html
       crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha224.html
       crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha256.html
       crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha384.html
       crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha512.html
       crypto/workers/subtle/aes-import-jwk-key.html
       crypto/workers/subtle/aes-import-raw-key.html
       crypto/workers/subtle/hmac-import-jwk-key.html
       crypto/workers/subtle/hmac-import-raw-key.html
       crypto/workers/subtle/rsa-import-jwk-private-key.html
       crypto/workers/subtle/rsa-import-jwk-public-key.html

* CMakeLists.txt:
* DerivedSources.make:
* PlatformEfl.cmake:
* PlatformGTK.cmake:
* PlatformMac.cmake:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSSubtleCryptoCustom.cpp:
(WebCore::normalizeCryptoAlgorithmParameters):
(WebCore::cryptoKeyUsageFromString):
(WebCore::cryptoKeyUsagesFromJSValue):
(WebCore::toKeyData):
(WebCore::jsSubtleCryptoFunctionGenerateKeyPromise):
(WebCore::jsSubtleCryptoFunctionImportKeyPromise):
(WebCore::JSSubtleCrypto::importKey):
* crypto/CryptoAlgorithm.cpp:
(WebCore::CryptoAlgorithm::importKey):
* crypto/CryptoAlgorithm.h:
* crypto/CryptoAlgorithmParameters.h:
* crypto/JsonWebKey.h: Added.
* crypto/JsonWebKey.idl: Added.
* crypto/RsaOtherPrimesInfo.h: Added.
* crypto/RsaOtherPrimesInfo.idl: Added.
* crypto/SubtleCrypto.h:
* crypto/SubtleCrypto.idl:
* crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
(WebCore::CryptoAlgorithmAES_CBC::generateKey):
(WebCore::CryptoAlgorithmAES_CBC::importKey):
* crypto/algorithms/CryptoAlgorithmAES_CBC.h:
* crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
(WebCore::CryptoAlgorithmAES_KW::generateKey):
(WebCore::CryptoAlgorithmAES_KW::importKey):
* crypto/algorithms/CryptoAlgorithmAES_KW.h:
* crypto/algorithms/CryptoAlgorithmHMAC.cpp:
(WebCore::CryptoAlgorithmHMAC::generateKey):
(WebCore::CryptoAlgorithmHMAC::importKey):
* crypto/algorithms/CryptoAlgorithmHMAC.h:
* crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
(WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::importKey):
* crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h:
* crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
(WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey):
* crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h:
* crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
(WebCore::CryptoAlgorithmRSA_OAEP::importKey):
* crypto/algorithms/CryptoAlgorithmRSA_OAEP.h:
* crypto/keys/CryptoKeyAES.cpp:
(WebCore::CryptoKeyAES::CryptoKeyAES):
(WebCore::CryptoKeyAES::generate):
(WebCore::CryptoKeyAES::importRaw):
(WebCore::CryptoKeyAES::importJwk):
* crypto/keys/CryptoKeyAES.h:
* crypto/keys/CryptoKeyDataRSAComponents.cpp:
(WebCore::CryptoKeyDataRSAComponents::CryptoKeyDataRSAComponents):
* crypto/keys/CryptoKeyDataRSAComponents.h:
* crypto/keys/CryptoKeyHMAC.cpp:
(WebCore::CryptoKeyHMAC::CryptoKeyHMAC):
(WebCore::CryptoKeyHMAC::generate):
(WebCore::CryptoKeyHMAC::importRaw):
(WebCore::CryptoKeyHMAC::importJwk):
(WebCore::CryptoKeyHMAC::buildAlgorithm):
* crypto/keys/CryptoKeyHMAC.h:
* crypto/keys/CryptoKeyRSA.cpp: Added.
(WebCore::CryptoKeyRSA::importJwk):
* crypto/keys/CryptoKeyRSA.h:
* crypto/parameters/CryptoAlgorithmHmacKeyParams.h: Renamed from Source/WebCore/crypto/parameters/CryptoAlgorithmHmacKeyGenParams.h.
* crypto/parameters/CryptoAlgorithmRsaHashedImportParams.h: Added.
* crypto/parameters/HmacKeyParams.idl: Renamed from Source/WebCore/crypto/parameters/HmacKeyGenParams.idl.
* crypto/parameters/RsaHashedImportParams.idl: Added.

LayoutTests:

Besides adding test cases for SubtleCrypto::importKey. This patch also corrects a typo:
generate-key-malformed-paramters*.

* crypto/subtle/aes-cbc-import-jwk-key-length-128-expected.txt: Added.
* crypto/subtle/aes-cbc-import-jwk-key-length-128.html: Added.
* crypto/subtle/aes-cbc-import-jwk-key-length-192-expected.txt: Added.
* crypto/subtle/aes-cbc-import-jwk-key-length-192.html: Added.
* crypto/subtle/aes-cbc-import-jwk-key-length-256-expected.txt: Added.
* crypto/subtle/aes-cbc-import-jwk-key-length-256.html: Added.
* crypto/subtle/aes-cbc-import-jwk-key-minimum-expected.txt: Added.
* crypto/subtle/aes-cbc-import-jwk-key-minimum.html: Added.
* crypto/subtle/aes-cbc-import-jwk-key-non-extractable-expected.txt: Added.
* crypto/subtle/aes-cbc-import-jwk-key-non-extractable.html: Added.
* crypto/subtle/aes-cbc-import-raw-key-length-128-expected.txt: Added.
* crypto/subtle/aes-cbc-import-raw-key-length-128.html: Added.
* crypto/subtle/aes-cbc-import-raw-key-length-192-expected.txt: Added.
* crypto/subtle/aes-cbc-import-raw-key-length-192.html: Added.
* crypto/subtle/aes-cbc-import-raw-key-length-256-expected.txt: Added.
* crypto/subtle/aes-cbc-import-raw-key-length-256.html: Added.
* crypto/subtle/aes-import-key-malformed-parameters-expected.txt: Added.
* crypto/subtle/aes-import-key-malformed-parameters.html: Added.
* crypto/subtle/aes-kw-import-jwk-key-length-128-expected.txt: Added.
* crypto/subtle/aes-kw-import-jwk-key-length-128.html: Added.
* crypto/subtle/aes-kw-import-jwk-key-length-192-expected.txt: Added.
* crypto/subtle/aes-kw-import-jwk-key-length-192.html: Added.
* crypto/subtle/aes-kw-import-jwk-key-length-256-expected.txt: Added.
* crypto/subtle/aes-kw-import-jwk-key-length-256.html: Added.
* crypto/subtle/aes-kw-import-raw-key-expected.txt: Added.
* crypto/subtle/aes-kw-import-raw-key.html: Added.
* crypto/subtle/generate-key-malformed-parameters-expected.txt: Renamed from LayoutTests/crypto/subtle/generate-key-malformed-paramters-expected.txt.
* crypto/subtle/generate-key-malformed-parameters.html: Renamed from LayoutTests/crypto/subtle/generate-key-malformed-paramters.html.
* crypto/subtle/hmac-generate-key-customized-length-expected.txt:
* crypto/subtle/hmac-generate-key-customized-length.html:
* crypto/subtle/hmac-generate-key-malformed-parameters-expected.txt:
* crypto/subtle/hmac-generate-key-malformed-parameters.html:
* crypto/subtle/hmac-import-raw-key-customized-length-expected.txt:
* crypto/subtle/hmac-import-raw-key-customized-length.html:
* crypto/subtle/hmac-import-jwk-key-minimum-expected.txt: Added.
* crypto/subtle/hmac-import-jwk-key-minimum.html: Added.
* crypto/subtle/hmac-import-jwk-key-non-extractable-expected.txt: Added.
* crypto/subtle/hmac-import-jwk-key-non-extractable.html: Added.
* crypto/subtle/hmac-import-jwk-key-sha1-expected.txt: Added.
* crypto/subtle/hmac-import-jwk-key-sha1.html: Added.
* crypto/subtle/hmac-import-jwk-key-sha224-expected.txt: Added.
* crypto/subtle/hmac-import-jwk-key-sha224.html: Added.
* crypto/subtle/hmac-import-jwk-key-sha256-expected.txt: Added.
* crypto/subtle/hmac-import-jwk-key-sha256.html: Added.
* crypto/subtle/hmac-import-jwk-key-sha384-expected.txt: Added.
* crypto/subtle/hmac-import-jwk-key-sha384.html: Added.
* crypto/subtle/hmac-import-jwk-key-sha512-expected.txt: Added.
* crypto/subtle/hmac-import-jwk-key-sha512.html: Added.
* crypto/subtle/hmac-import-malformed-parameters-expected.txt: Added.
* crypto/subtle/hmac-import-malformed-parameters.html: Added.
* crypto/subtle/hmac-import-raw-key-customized-length-expected.txt: Added.
* crypto/subtle/hmac-import-raw-key-customized-length.html: Added.
* crypto/subtle/hmac-import-raw-key-expected.txt: Added.
* crypto/subtle/hmac-import-raw-key.html: Added.
* crypto/subtle/import-key-malformed-parameters-expected.txt: Added.
* crypto/subtle/import-key-malformed-parameters.html: Added.
* crypto/subtle/rsa-import-key-malformed-parameters-expected.txt: Added.
* crypto/subtle/rsa-import-key-malformed-parameters.html: Added.
* crypto/subtle/rsa-oaep-import-jwk-private-key-expected.txt: Added.
* crypto/subtle/rsa-oaep-import-jwk-private-key.html: Added.
* crypto/subtle/rsa-oaep-import-jwk-public-key-sha1-expected.txt: Added.
* crypto/subtle/rsa-oaep-import-jwk-public-key-sha1.html: Added.
* crypto/subtle/rsa-oaep-import-jwk-public-key-sha224-expected.txt: Added.
* crypto/subtle/rsa-oaep-import-jwk-public-key-sha224.html: Added.
* crypto/subtle/rsa-oaep-import-jwk-public-key-sha256-expected.txt: Added.
* crypto/subtle/rsa-oaep-import-jwk-public-key-sha256.html: Added.
* crypto/subtle/rsa-oaep-import-jwk-public-key-sha384-expected.txt: Added.
* crypto/subtle/rsa-oaep-import-jwk-public-key-sha384.html: Added.
* crypto/subtle/rsa-oaep-import-jwk-public-key-sha512-expected.txt: Added.
* crypto/subtle/rsa-oaep-import-jwk-public-key-sha512.html: Added.
* crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-private-key-expected.txt: Added.
* crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-private-key.html: Added.
* crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key-expected.txt: Added.
* crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key-leading-zero-expected.txt: Added.
* crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key-leading-zero.html: Added.
* crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key-minimum-expected.txt: Added.
* crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key-minimum.html: Added.
* crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key-non-extractable-expected.txt: Added.
* crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key-non-extractable.html: Added.
* crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key.html: Added.
* crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-private-key-expected.txt: Added.
* crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-private-key.html: Added.
* crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha1-expected.txt: Added.
* crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha1.html: Added.
* crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha224-expected.txt: Added.
* crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha224.html: Added.
* crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha256-expected.txt: Added.
* crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha256.html: Added.
* crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha384-expected.txt: Added.
* crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha384.html: Added.
* crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha512-expected.txt: Added.
* crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha512.html: Added.
* crypto/webkitSubtle/hmac-generate-key-expected.txt:
* crypto/webkitSubtle/hmac-generate-key.html:
* crypto/webkitSubtle/hmac-import-jwk-expected.txt:
* crypto/webkitSubtle/hmac-import-jwk.html:
* crypto/webkitSubtle/hmac-postMessage-expected.txt:
* crypto/webkitSubtle/hmac-postMessage.html:
* crypto/webkitSubtle/hmac-sign-verify-expected.txt:
* crypto/webkitSubtle/hmac-sign-verify.html:
* crypto/workers/subtle/aes-import-jwk-key-expected.txt: Added.
* crypto/workers/subtle/aes-import-jwk-key.html: Added.
* crypto/workers/subtle/aes-import-raw-key-expected.txt: Added.
* crypto/workers/subtle/aes-import-raw-key.html: Added.
* crypto/workers/subtle/hmac-import-jwk-key-expected.txt: Added.
* crypto/workers/subtle/hmac-import-jwk-key.html: Added.
* crypto/workers/subtle/hmac-import-raw-key-expected.txt: Added.
* crypto/workers/subtle/hmac-import-raw-key.html: Added.
* crypto/workers/subtle/hmac-postMessage-worker-expected.txt:
* crypto/workers/subtle/hmac-postMessage-worker.html:
* crypto/workers/subtle/resources/aes-import-jwk-key.js: Added.
* crypto/workers/subtle/resources/aes-import-raw-key.js: Added.
* crypto/workers/subtle/resources/hmac-import-jwk-key.js: Added.
* crypto/workers/subtle/resources/hmac-import-raw-key.js: Added.
* crypto/workers/subtle/resources/hmac-postMessage-worker.js:
* crypto/workers/subtle/resources/rsa-import-jwk-private-key.js: Added.
* crypto/workers/subtle/resources/rsa-import-jwk-public-key.js: Added.
* crypto/workers/subtle/rsa-import-jwk-private-key-expected.txt: Added.
* crypto/workers/subtle/rsa-import-jwk-private-key.html: Added.
* crypto/workers/subtle/rsa-import-jwk-public-key-expected.txt: Added.
* crypto/workers/subtle/rsa-import-jwk-public-key.html: Added.

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

3 years agoMarking media/modern-media-controls/ios-inline-media-controls/ios-inline-media-contro...
ryanhaddad@apple.com [Thu, 10 Nov 2016 18:31:59 +0000 (18:31 +0000)]
Marking media/modern-media-controls/ios-inline-media-controls/ios-inline-media-controls-buttons-styles.html as flaky.
https://bugs.webkit.org/show_bug.cgi?id=164598

Unreviewed test gardening.

* platform/mac/TestExpectations:

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

3 years agoTemporarily marking storage/domstorage/sessionstorage/blocked-file-access.html as...
ryanhaddad@apple.com [Thu, 10 Nov 2016 18:08:06 +0000 (18:08 +0000)]
Temporarily marking storage/domstorage/sessionstorage/blocked-file-access.html as failing.
https://bugs.webkit.org/show_bug.cgi?id=164592

Unreviewed test gardening.

* TestExpectations:

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

3 years agoIndexedDB 2.0: REGRESSION(r208467) Fix flaky crashes in IDB GC-related code.
beidson@apple.com [Thu, 10 Nov 2016 18:04:03 +0000 (18:04 +0000)]
IndexedDB 2.0: REGRESSION(r208467) Fix flaky crashes in IDB GC-related code.
https://bugs.webkit.org/show_bug.cgi?id=164596

Reviewed by Eric Carlson.

No new tests (Covered by existing tests).

We can't just WTFMove the pointers from the deleted-IDBObject maps...
We need to remove the entries, too.

* Modules/indexeddb/IDBObjectStore.cpp:
(WebCore::IDBObjectStore::rollbackForVersionChangeAbort):

* Modules/indexeddb/IDBTransaction.cpp:
(WebCore::IDBTransaction::internalAbort):

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

3 years agoMediaStreamTrack should use more Ref<> and less RefPtr<>
commit-queue@webkit.org [Thu, 10 Nov 2016 17:26:22 +0000 (17:26 +0000)]
MediaStreamTrack should use more Ref<> and less RefPtr<>
https://bugs.webkit.org/show_bug.cgi?id=164560

Patch by Youenn Fablet <youennf@gmail.com> on 2016-11-10
Reviewed by Eric Carlson.

No change of behavior.

Make MediaStreamTrack take a Ref<>& instead of a reference.
Using Ref<>&& instead of RefPtr<>&& in MediaStreamTrackPrivate.
Updating constness of some methods accordingly.

* Modules/mediastream/MediaEndpointPeerConnection.cpp:
(WebCore::MediaEndpointPeerConnection::createReceiver):
* Modules/mediastream/MediaStreamTrack.cpp:
(WebCore::MediaStreamTrack::create):
(WebCore::MediaStreamTrack::MediaStreamTrack):
(WebCore::MediaStreamTrack::clone):
* Modules/mediastream/MediaStreamTrack.h:
* Modules/webaudio/MediaStreamAudioSource.cpp:
(WebCore::MediaStreamAudioSource::capabilities):
(WebCore::MediaStreamAudioSource::settings):
* Modules/webaudio/MediaStreamAudioSource.h:
* platform/mediastream/MediaEndpoint.cpp:
* platform/mediastream/MediaStreamPrivate.cpp:
(WebCore::MediaStreamPrivate::create):
* platform/mediastream/MediaStreamTrackPrivate.cpp:
(WebCore::MediaStreamTrackPrivate::create):
(WebCore::MediaStreamTrackPrivate::MediaStreamTrackPrivate):
(WebCore::MediaStreamTrackPrivate::clone):
* platform/mediastream/MediaStreamTrackPrivate.h:
(WebCore::MediaStreamTrackPrivate::setMuted):
(WebCore::MediaStreamTrackPrivate::source):
* platform/mediastream/RealtimeMediaSource.h:
* platform/mediastream/mac/AVMediaCaptureSource.h:
* platform/mediastream/mac/AVMediaCaptureSource.mm:
(WebCore::AVMediaCaptureSource::initializeSettings):
(WebCore::AVMediaCaptureSource::settings):
(WebCore::AVMediaCaptureSource::initializeCapabilities):
(WebCore::AVMediaCaptureSource::capabilities):
* platform/mediastream/openwebrtc/RealtimeMediaSourceOwr.h:
(WebCore::RealtimeMediaSourceOwr::capabilities):
(WebCore::RealtimeMediaSourceOwr::settings):
* platform/mock/MockRealtimeMediaSource.cpp:
(WebCore::MockRealtimeMediaSource::initializeCapabilities):
(WebCore::MockRealtimeMediaSource::capabilities):
(WebCore::MockRealtimeMediaSource::initializeSettings):
(WebCore::MockRealtimeMediaSource::settings):
* platform/mock/MockRealtimeMediaSource.h:

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

3 years ago[Win32] Crash in layout tests.
pvollan@apple.com [Thu, 10 Nov 2016 17:23:01 +0000 (17:23 +0000)]
[Win32] Crash in layout tests.
https://bugs.webkit.org/show_bug.cgi?id=164411

Reviewed by Mark Lam.

Use the calling convention expected by the callers of the generated functions.

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateImplementation):
* bindings/scripts/test/JS/JSTestDOMJIT.cpp:
(WebCore::unsafeJsTestDOMJITPrototypeFunctionGetAttribute):
(WebCore::unsafeJsTestDOMJITPrototypeFunctionItem):
(WebCore::unsafeJsTestDOMJITPrototypeFunctionHasAttribute):
(WebCore::unsafeJsTestDOMJITPrototypeFunctionGetElementById):
(WebCore::unsafeJsTestDOMJITPrototypeFunctionGetElementsByName):

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

3 years agoWeb Inspector: AXI: clarify button roles (e.g. toggle or popup button)
commit-queue@webkit.org [Thu, 10 Nov 2016 17:10:09 +0000 (17:10 +0000)]
Web Inspector: AXI: clarify button roles (e.g. toggle or popup button)
https://bugs.webkit.org/show_bug.cgi?id=130726
<rdar://problem/16420420>

Patch by Aaron Chu <aaron_chu@apple.com> on 2016-11-10
Reviewed by Brian Burg.

Source/JavaScriptCore:

Add the isPopupButton flag to the AccessibilityProperties type.

* inspector/protocol/DOM.json:

Source/WebCore:

Test: accessibility/ax-differentiate-button-types.html

Added special case logic to make sure PopUpButtonRole and ToggleButtonRole to user ButtonRole as role.
Added an "isPopUpButton" property to be exposed to the Inspector's use.

* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::computedRoleString):
* inspector/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::buildObjectForAccessibilityProperties):

Source/WebInspectorUI:

Updated Inspector to show the button type using the new mapping information.

* Localizations/en.lproj/localizedStrings.js:
* UserInterface/Models/DOMNode.js:
(WebInspector.DOMNode.prototype.accessibilityProperties.accessibilityPropertiesCallback):
(WebInspector.DOMNode.prototype.accessibilityProperties):
* UserInterface/Views/DOMNodeDetailsSidebarPanel.js:
(WebInspector.DOMNodeDetailsSidebarPanel.prototype._refreshAccessibility.accessibilityPropertiesCallback):
(WebInspector.DOMNodeDetailsSidebarPanel.prototype._refreshAccessibility):

LayoutTests:

Updated related test cases.

* accessibility/roles-computedRoleString-expected.txt:
* accessibility/roles-computedRoleString.html:
* inspector/dom/getAccessibilityPropertiesForNode-expected.txt:
* inspector/dom/getAccessibilityPropertiesForNode.html:
* platform/mac/accessibility/roles-computedRoleString-expected.txt:

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

3 years ago[EME] Add no-op Web-facing APIs
zandobersek@gmail.com [Thu, 10 Nov 2016 17:08:41 +0000 (17:08 +0000)]
[EME] Add no-op Web-facing APIs
https://bugs.webkit.org/show_bug.cgi?id=164028

Reviewed by Jer Noble.

LayoutTests/imported/w3c:

Add the text baseline for the web-platform-tests/encrypted-media/idlharness.html
test. It's the only meaningful test we can run at the moment, and all but one of
the subtests pass.

* web-platform-tests/encrypted-media/idlharness-expected.txt: Added.

Source/WebCore:

Add no-op implementation of the Web-facing APIs as defined in
the EME specification. This will be the basis for implementing
the various algorithms the same specification defines, and for
implementing the relevant platform abstractions.

Dictionaries and enumerations defined by the specification are
defined in separate headers, and not in the implementation files
for the class where they are used. This will ease their use
across different implementation files.

BufferSource now exposes the Variant object it holds. This is
needed to support the iterable property on the MediaKeyStatusMap
class.

CodeGeneratorJS is fixed to support JS-to-native conversion of
sequences of dictionaries.

* CMakeLists.txt:
* DerivedSources.cpp:
* DerivedSources.make:
* Modules/encryptedmedia/MediaKeyMessageEvent.cpp: Added.
(WebCore::MediaKeyMessageEvent::MediaKeyMessageEvent):
(WebCore::MediaKeyMessageEvent::eventInterface):
* Modules/encryptedmedia/MediaKeyMessageEvent.h: Added.
* Modules/encryptedmedia/MediaKeyMessageEvent.idl: Added.
* Modules/encryptedmedia/MediaKeyMessageEventInit.h: Added.
(WebCore::MediaKeyMessageEventInit::MediaKeyMessageEventInit):
* Modules/encryptedmedia/MediaKeyMessageType.h: Added.
* Modules/encryptedmedia/MediaKeySession.cpp: Added.
(WebCore::MediaKeySession::create):
(WebCore::MediaKeySession::MediaKeySession):
(WebCore::MediaKeySession::sessionId):
(WebCore::MediaKeySession::expiration):
(WebCore::MediaKeySession::keyStatuses):
(WebCore::MediaKeySession::generateRequest):
(WebCore::MediaKeySession::load):
(WebCore::MediaKeySession::update):
(WebCore::MediaKeySession::close):
(WebCore::MediaKeySession::remove):
(WebCore::MediaKeySession::hasPendingActivity):
(WebCore::MediaKeySession::activeDOMObjectName):
(WebCore::MediaKeySession::canSuspendForDocumentSuspension):
(WebCore::MediaKeySession::stop):
* Modules/encryptedmedia/MediaKeySession.h: Added.
* Modules/encryptedmedia/MediaKeySession.idl: Added.
* Modules/encryptedmedia/MediaKeySessionType.h: Added.
* Modules/encryptedmedia/MediaKeyStatus.h: Added.
* Modules/encryptedmedia/MediaKeyStatusMap.cpp: Added.
(WebCore::MediaKeyStatusMap::size):
(WebCore::MediaKeyStatusMap::has):
(WebCore::MediaKeyStatusMap::get):
(WebCore::MediaKeyStatusMap::Iterator::Iterator):
(WebCore::MediaKeyStatusMap::Iterator::next):
* Modules/encryptedmedia/MediaKeyStatusMap.h: Added.
(WebCore::MediaKeyStatusMap::create):
(WebCore::MediaKeyStatusMap::createIterator):
* Modules/encryptedmedia/MediaKeyStatusMap.idl: Added.
* Modules/encryptedmedia/MediaKeySystemAccess.cpp: Added.
(WebCore::MediaKeySystemAccess::keySystem):
(WebCore::MediaKeySystemAccess::getConfiguration):
(WebCore::MediaKeySystemAccess::createMediaKeys):
* Modules/encryptedmedia/MediaKeySystemAccess.h: Added.
(WebCore::MediaKeySystemAccess::create):
* Modules/encryptedmedia/MediaKeySystemAccess.idl: Added.
* Modules/encryptedmedia/MediaKeySystemConfiguration.h: Added.
* Modules/encryptedmedia/MediaKeySystemConfiguration.idl: Added.
* Modules/encryptedmedia/MediaKeySystemMediaCapability.h: Added.
* Modules/encryptedmedia/MediaKeySystemMediaCapability.idl: Added.
* Modules/encryptedmedia/MediaKeys.cpp: Added.
(WebCore::MediaKeys::createSession):
(WebCore::MediaKeys::setServerCertificate):
* Modules/encryptedmedia/MediaKeys.h: Added.
(WebCore::MediaKeys::create):
* Modules/encryptedmedia/MediaKeys.idl: Added.
* Modules/encryptedmedia/MediaKeysRequirement.h: Added.
* Modules/encryptedmedia/NavigatorEME.cpp: Added.
(WebCore::NavigatorEME::requestMediaKeySystemAccess):
* Modules/encryptedmedia/NavigatorEME.h: Added.
* Modules/encryptedmedia/NavigatorEME.idl: Added.
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/BufferSource.h:
(WebCore::BufferSource::BufferSource):
(WebCore::BufferSource::variant):
* bindings/js/JSMediaKeySessionCustom.cpp: Added.
(WebCore::JSMediaKeySession::closed):
* bindings/js/JSMediaKeySystemAccessCustom.cpp: Added.
(WebCore::JSMediaKeySystemAccess::getConfiguration):
* bindings/scripts/CodeGeneratorJS.pm:
(GetNativeVectorInnerType):
* dom/EventNames.h:
* dom/EventNames.in:
* dom/EventTargetFactory.in:
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::mediaKeys):
(WebCore::HTMLMediaElement::setMediaKeys):
* html/HTMLMediaElement.h:
* html/HTMLMediaElement.idl:
* html/MediaEncryptedEvent.cpp: Added.
(WebCore::MediaEncryptedEvent::MediaEncryptedEvent):
(WebCore::MediaEncryptedEvent::eventInterface):
(WebCore::MediaEncryptedEvent::initDataType):
(WebCore::MediaEncryptedEvent::initData):
* html/MediaEncryptedEvent.h: Added.
* html/MediaEncryptedEvent.idl: Added.
* html/MediaEncryptedEventInit.h: Added.
(WebCore::MediaEncryptedEventInit::MediaEncryptedEventInit):

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

3 years ago[Linux] Memory process values shown by the WebMemorySampler in linux are wrong
carlosgc@webkit.org [Thu, 10 Nov 2016 16:03:51 +0000 (16:03 +0000)]
[Linux] Memory process values shown by the WebMemorySampler in linux are wrong
https://bugs.webkit.org/show_bug.cgi?id=164591

Reviewed by Michael Catanzaro.

It's parsing /proc/self/statm, and returning the values as if they were bytes, but they are number of pages, so
to get the bytes we need to take the page size into account. In r208534 I added a method to get /proc/self/statm
values in bytes to Platform layer, so we can simply use that instead.

* Shared/linux/WebMemorySamplerLinux.cpp:
(WebKit::WebMemorySampler::sampleWebKit): Use currentProcessMemoryStatus() and update the descriptions to
clarify that values are in bytes.

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

3 years ago[Modern Media Controls] Media Controller: update controls based on fullscreen playbac...
commit-queue@webkit.org [Thu, 10 Nov 2016 15:43:53 +0000 (15:43 +0000)]
[Modern Media Controls] Media Controller: update controls based on fullscreen playback on macOS
https://bugs.webkit.org/show_bug.cgi?id=164554
<rdar://problem/29183439>

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

Source/WebCore:

When toggling fullscreen on macOS, toggle between MacOSInlineMediaControls and MacOSFullscreenMediaControls.
To facilitate this, support objects are created and destroyed when changing the controls in order for the
right control objects to be hooked up to the media controller. A new destroy() method on MediaControllerSupport
subclasses can be overridden to remove event listeners added by support objects in their constructor.

Test: media/modern-media-controls/media-controller/media-controller-fullscreen-change.html

* Modules/modern-media-controls/media/fullscreen-support.js:
(FullscreenSupport.prototype.destroy):
* Modules/modern-media-controls/media/media-controller-support.js:
(MediaControllerSupport.prototype.destroy):
* Modules/modern-media-controls/media/media-controller.js:
(MediaController):
(MediaController.prototype.get layoutTraits):
(MediaController.prototype.handleEvent):
(MediaController.prototype._updateControlsIfNeeded):
(MediaController.prototype._controlsClass):

LayoutTests:

Adding a new test to check that we use fullscreen controls on macOS once we've entered fullscreen.

* media/modern-media-controls/media-controller/media-controller-fullscreen-change-expected.txt: Added.
* media/modern-media-controls/media-controller/media-controller-fullscreen-change.html: Added.
* platform/ios-simulator/TestExpectations:

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

3 years ago[Linux] Memory values shown by memory pressure handler logger are not useful
carlosgc@webkit.org [Thu, 10 Nov 2016 15:02:08 +0000 (15:02 +0000)]
[Linux] Memory values shown by memory pressure handler logger are not useful
https://bugs.webkit.org/show_bug.cgi?id=164589

Reviewed by Michael Catanzaro.

We are currently using the VmSize field from /proc/self/status which is the virtual memory size of the process
and doesn't normally change even when the memory pressure handler manages to release memory. So, most of the
time we see that there's no changes in memory usage in the logs.
We should use the actual memory used by the process, memory that the process can release and then it's relevant
for the memory pressure handler. Using other fields from /proc/self/status we could do something like VmRSS -
(RssFile + RssShme), but there's also /proc/self/statm that provides the same information in a single. The main
different is that statm provides both resident and shared memory directly, but in number of pages, so we need to
multiply by the size of the page.
This patch adds a method to parse /proc/self/statm in its given file, because I plan to use this for the linux
memory sampler that is incorrectly parsing /proc/self/statm.

* platform/Linux.cmake: Add new files to compilation.
* platform/linux/CurrentProcessMemoryStatus.cpp: Added.
(WebCore::systemPageSize): Return the page size.
(WebCore::currentProcessMemoryStatus): Parse /proc/self/statm and fill the given ProcessMemoryStatus.
* platform/linux/CurrentProcessMemoryStatus.h: Added.
* platform/linux/MemoryPressureHandlerLinux.cpp:
(WebCore::MemoryPressureHandler::processMemoryUsage(): Helper function to return the memory used by the process
in bytes.
(WebCore::MemoryPressureHandler::ReliefLogger::platformMemoryUsage): Use processMemoryUsage().

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

3 years agoUnreviewed. Added myself to the list of committers.
magomez@igalia.com [Thu, 10 Nov 2016 14:38:06 +0000 (14:38 +0000)]
Unreviewed. Added myself to the list of committers.

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

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

3 years agoMemoryPressureHandler shouldn't know how to release WebCore memory
carlosgc@webkit.org [Thu, 10 Nov 2016 14:24:26 +0000 (14:24 +0000)]
MemoryPressureHandler shouldn't know how to release WebCore memory
https://bugs.webkit.org/show_bug.cgi?id=160497

Reviewed by Michael Catanzaro.

Source/WebCore:

All processes should set their own low memory handler, instead of leaving the web process using the default one
that needs to access APIs that are not in platform layer. This patch fixes all the layering violations in the
MemoryPressureHandler. Since the default implementation, that releases the WebCore memory, is shared by the
WebProcess in WebKit2 and WebKit1 ports, it has been moved to its own file to the WebCore layer.

* CMakeLists.txt: Add new files to compilation.
* PlatformMac.cmake: Ditto.
* WebCore.xcodeproj/project.pbxproj: Ditto.
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::commitProvisionalLoad): Use WebCore::jettisonExpensiveObjectsOnTopLevelNavigation().
* page/MemoryRelease.cpp: Added.
(WebCore::releaseNoncriticalMemory):
(WebCore::releaseCriticalMemory):
(WebCore::releaseMemory):
(WebCore::platformReleaseMemory):
(WebCore::jettisonExpensiveObjectsOnTopLevelNavigation):
(WebCore::registerMemoryReleaseNotifyCallbacks):
* page/MemoryRelease.h: Added.
* page/cocoa/MemoryReleaseCocoa.mm: Added.
(WebCore::platformReleaseMemory):
(WebCore::jettisonExpensiveObjectsOnTopLevelNavigation):
(WebCore::registerMemoryReleaseNotifyCallbacks):
* platform/MemoryPressureHandler.cpp:
(WebCore::MemoryPressureHandler::MemoryPressureHandler):
(WebCore::MemoryPressureHandler::beginSimulatedMemoryPressure):
(WebCore::MemoryPressureHandler::releaseMemory): Use the current handler if it has been set.
(WebCore::MemoryPressureHandler::platformReleaseMemory): Deleted.
* platform/MemoryPressureHandler.h:
(WebCore::MemoryPressureHandler::setLowMemoryHandler):
(WebCore::MemoryPressureHandler::m_releaseMemoryBlock):
* platform/cocoa/MemoryPressureHandlerCocoa.mm:
(WebCore::MemoryPressureHandler::respondToMemoryPressure): Call releaseMemory() instead of using the handler directly.
(WebCore::MemoryPressureHandler::platformReleaseMemory): Deleted.
* platform/linux/MemoryPressureHandlerLinux.cpp:
* platform/win/MemoryPressureHandlerWin.cpp:
(WebCore::MemoryPressureHandler::respondToMemoryPressure): Call releaseMemory() instead of using the handler directly.

Source/WebKit/mac:

Set the low memory handler before installing the memory pressure handler.

* WebView/WebView.mm:
(-[WebView _commonInitializationWithFrameName:groupName:]):

Source/WebKit/win:

Set the low memory handler before installing the memory pressure handler.

* WebView.cpp:
(WebView::initWithFrame):

Source/WebKit2:

Set the low memory handler before installing the memory pressure handler.

* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::initializeWebProcess):
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::platformInitializeWebProcess):

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

3 years ago[ARM] Unreviewed buildfix after r208450.
ossy@webkit.org [Thu, 10 Nov 2016 13:37:38 +0000 (13:37 +0000)]
[ARM] Unreviewed buildfix after r208450.

* assembler/MacroAssemblerARM.h:
(JSC::MacroAssemblerARM::load8SignedExtendTo32): Added.

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

3 years ago[GTK] New API to notify about dynamically added forms
svillar@igalia.com [Thu, 10 Nov 2016 10:15:30 +0000 (10:15 +0000)]
[GTK] New API to notify about dynamically added forms
https://bugs.webkit.org/show_bug.cgi?id=164050

Reviewed by Carlos Garcia Campos.

Source/WebKit2:

This new API exports the WebCore event didAssociateFormControls through the web extension
mechanism. This will help clients (mainly web browsers) to implement robust auto filling
mechanisms. It deals nicely with dynamically created forms (and form controls) as many JS
frameworks do nowadays.

* WebProcess/InjectedBundle/API/gtk/WebKitWebPage.cpp: Added a FormClient implementation of
API::InjectedBundle::FormClient.
(webkitWebPageFormControlsAssociated): Emit the new signal.
(webkit_web_page_class_init): Added the new signal "forms-controls-associated".
(webkitWebPageCreate): Set the WebPage as a FormClient.

Tools:

Added a new test case to verify that dinamically added forms correctly trigger the
"form-controls-associated" signal from WebPage.

* TestWebKitAPI/Tests/WebKit2Gtk/TestWebExtensions.cpp:
(didAssociateFormControlsCallback):
(testWebExtensionFormControlsAssociated):
(beforeAll):
* TestWebKitAPI/Tests/WebKit2Gtk/WebExtensionTest.cpp:
(DelayedSignal::DelayedSignal):
(emitFormControlsAssociated):
(formControlsAssociatedCallback):
(pageCreatedCallback):

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

3 years ago[css-grid] Fix fr tracks sizing under min|max-size constraints
svillar@igalia.com [Thu, 10 Nov 2016 10:08:19 +0000 (10:08 +0000)]
[css-grid] Fix fr tracks sizing under min|max-size constraints
https://bugs.webkit.org/show_bug.cgi?id=150674

Reviewed by Darin Adler.

Source/WebCore:

The min|max-sizes must be used to compute the flex fraction for indefinite free
spaces. According to the spec "If using this flex fraction would cause the grid to be
smaller than the grid container’s min-width/height (or larger than the grid container’s
max-width/height), then redo this step, treating the free space as definite and the
available grid space as equal to the grid container’s content box size when it’s sized to
its min-width/height (max-width/height)."

This only affects indefinite heights because during layout both definite sizes and any kind
of widths are properly constrained by min|max-width restrictions.

Tests: fast/css-grid-layout/flex-sizing-columns-min-max-width.html
       fast/css-grid-layout/flex-sizing-rows-min-max-height.html

* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::computeUsedBreadthOfGridTracks):
(WebCore::RenderGrid::computeFlexSizedTracksGrowth):
* rendering/RenderGrid.h:

LayoutTests:

* fast/css-grid-layout/flex-sizing-columns-min-max-width-expected.txt: Added.
* fast/css-grid-layout/flex-sizing-columns-min-max-width.html: Added.
* fast/css-grid-layout/flex-sizing-rows-min-max-height-expected.txt: Added.
* fast/css-grid-layout/flex-sizing-rows-min-max-height.html: Added.

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

3 years ago[WebRTC] [OpenWebRTC] RTX default parameters broken after r207952
commit-queue@webkit.org [Thu, 10 Nov 2016 09:01:21 +0000 (09:01 +0000)]
[WebRTC] [OpenWebRTC] RTX default parameters broken after r207952
https://bugs.webkit.org/show_bug.cgi?id=164541

Patch by Alejandro G. Castro <alex@igalia.com> on 2016-11-10
Reviewed by Philippe Normand.

Fixed typo in refactoring.

* platform/mediastream/openwebrtc/MediaEndpointOwr.cpp:
(WebCore::MediaEndpointOwr::getDefaultVideoPayloads):

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

3 years ago[GTK] Allow to use WebMemorySampler feature.
clopez@igalia.com [Thu, 10 Nov 2016 08:46:13 +0000 (08:46 +0000)]
[GTK] Allow to use WebMemorySampler feature.
https://bugs.webkit.org/show_bug.cgi?id=164517

Reviewed by Carlos Garcia Campos.

Enable the WebMemorySampler with the environment variable WEBKIT_SAMPLE_MEMORY.

When enabled, it will dump the stats to /tmp each second.

* UIProcess/API/gtk/WebKitWebContext.cpp:
(webkitWebContextConstructed):

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

3 years ago[WK2][GTK][GStreamer] Build fails when -plugins-base and -core headers are not instal...
philn@webkit.org [Thu, 10 Nov 2016 08:01:10 +0000 (08:01 +0000)]
[WK2][GTK][GStreamer] Build fails when -plugins-base and -core headers are not installed in the same directory
https://bugs.webkit.org/show_bug.cgi?id=148894

Reviewed by Carlos Garcia Campos.

The pbutils (gst-plugins-base-utils) headers are needed in
WebKit2/GTK for the permission request API related with the
GStreamer codec installer. It builds fine in most cases without
explicitely requiring the pbutils include directory path because
usually all the GStreamer headers are installed in the same path,
excepted for some distributions, like NixOS.

* PlatformGTK.cmake: The GStreamer pbutils include directory was
missing in the header search path.

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

3 years agoWebHTMLView's _attributeStringFromDOMRange should use HTMLConverter instead of NSAttr...
rniwa@webkit.org [Thu, 10 Nov 2016 07:53:34 +0000 (07:53 +0000)]
WebHTMLView's _attributeStringFromDOMRange should use HTMLConverter instead of NSAttributedString's _initWithDOMRange
https://bugs.webkit.org/show_bug.cgi?id=164501
<rdar://problem/29152282>

Reviewed by Sam Weinig.

Source/WebKit/mac:

Align what [WebHTMLView attributedString] returns to what would be used on copy & paste by using HTMLConverter
instead of _initWithDOMRange in [WebHTMLView _attributeStringFromDOMRange].

* WebView/WebHTMLView.mm:
(-[WebHTMLView _attributedStringFromDOMRange:]): Renamed from _attributeStringFromDOMRange.
(-[WebHTMLView attributedString]):
(-[WebHTMLView selectedAttributedString]):
(-[WebHTMLView selectedString]): Moved to reduce the number of occurrences of the if-defs.

Tools:

* DumpRenderTree/mac/TextInputController.m:
(-[TextInputController legacyAttributedString:]):

LayoutTests:

Prior to this patch, attributed-string tests were inadvertently testing NSAttributedString's _initWithDOMRange
instead of HTMLConverter as intended because _attributeStringFromDOMRange was using _initWithDOMRange.

This patch aliens [WebHTMLView attributedString] to what we use on copy & paste by using HTMLConverter instead.
The rebaselined done below highlights the existing behavior difference between AppKit's converter and HTMLConverter.

I've manually confirmed that these test results didn't change across the large refactoring as seen in:
https://trac.webkit.org/log/trunk/Source/WebCore/platform/mac/HTMLConverter.mm?rev=166145

* editing/mac/attributed-string/anchor-element-expected.txt:
* editing/mac/attributed-string/basic-expected.txt:
* editing/mac/attributed-string/font-size-expected.txt:
* editing/mac/attributed-string/font-style-variant-effect-expected.txt:
* editing/mac/attributed-string/font-weight-expected.txt:
* editing/mac/attributed-string/letter-spacing-expected.txt:
* editing/mac/attributed-string/text-decorations-expected.txt:
* editing/mac/attributed-string/vertical-align-expected.txt:
* platform/mac-elcapitan/editing/mac/attributed-string/font-style-variant-effect-expected.txt:
* platform/mac-yosemite/editing/mac/attributed-string/anchor-element-expected.txt:
* platform/mac-yosemite/editing/mac/attributed-string/basic-expected.txt:
* platform/mac-yosemite/editing/mac/attributed-string/font-size-expected.txt:
* platform/mac-yosemite/editing/mac/attributed-string/font-style-variant-effect-expected.txt:
* platform/mac-yosemite/editing/mac/attributed-string/font-weight-expected.txt:
* platform/mac-yosemite/editing/mac/attributed-string/letter-spacing-expected.txt:
* platform/mac-yosemite/editing/mac/attributed-string/text-decorations-expected.txt:
* platform/mac-yosemite/editing/mac/attributed-string/vertical-align-expected.txt:

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

3 years ago[WK2][!NETWORK_SESSION] Add support for downloading file backed blobs
cdumez@apple.com [Thu, 10 Nov 2016 07:46:17 +0000 (07:46 +0000)]
[WK2][!NETWORK_SESSION] Add support for downloading file backed blobs
https://bugs.webkit.org/show_bug.cgi?id=164522

Reviewed by Alex Christensen.

Source/WebKit2:

Add support for downloading file backed blobs for the non-NETWORK_SESSION
code path of WebKit2, which is still use on pre-Sierra macOS.

* NetworkProcess/Downloads/Download.cpp:
(WebKit::Download::~Download):
* NetworkProcess/Downloads/Download.h:
(WebKit::Download::setBlobFileReferences):
* NetworkProcess/Downloads/DownloadManager.cpp:
(WebKit::DownloadManager::startDownload):
(WebKit::DownloadManager::convertNetworkLoadToDownload):
* NetworkProcess/Downloads/DownloadManager.h:
* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::convertToDownload):

LayoutTests:

Unskip corresponding tests now that they pass on Yosemite and El Capitan.

* platform/mac-wk2/TestExpectations:

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

3 years ago[WebRTC] white-list turns urls from the RTCConfiguration
philn@webkit.org [Thu, 10 Nov 2016 07:46:01 +0000 (07:46 +0000)]
[WebRTC] white-list turns urls from the RTCConfiguration
https://bugs.webkit.org/show_bug.cgi?id=164506

Reviewed by Alejandro G. Castro.

LayoutTests/imported/w3c:

* web-platform-tests/webrtc/rtcpeerconnection/rtcpeerconnection-constructor-expected.txt: Rebaseline test, since turns servers are now parsed.

Source/WebCore:

* Modules/mediastream/RTCConfiguration.cpp:
(WebCore::validateIceServerURL): Add the turns URL scheme to the
list of supported relay and signaling server protocols.

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

3 years ago[JSC] Avoid cloned arguments allocation in ArrayPrototype methods
utatane.tea@gmail.com [Thu, 10 Nov 2016 06:34:05 +0000 (06:34 +0000)]
[JSC] Avoid cloned arguments allocation in ArrayPrototype methods
https://bugs.webkit.org/show_bug.cgi?id=164502

Reviewed by Saam Barati.

JSTests:

* stress/argument-intrinsic-basic.js: Added.
(shouldBe):
(builtin.createBuiltin):
* stress/argument-intrinsic-inlining-with-result-escape.js: Added.
(shouldBe):
(builtin.createBuiltin):
(escape):
* stress/argument-intrinsic-nested-inlining.js: Added.
(shouldBe):
(builtin.createBuiltin):
(builtinCaller1):
(builtinCaller2):
(escape):
* stress/argument-intrinsic-not-convert-to-get-argument.js: Added.
(shouldBe):
(builtin.createBuiltin):
* stress/argument-intrinsic-with-stack-write.js: Added.
(shouldBe):
(builtin.createBuiltin):

Source/JavaScriptCore:

In many builtin functions, we use `arguments` to just get optional parameters.
While FTL argument elimination can drop `arguments` allocations, it leaves
the allocations in LLInt, Baseline, and DFG. And we found that DFG compiled
Array#map is heavily used in ES6SampleBench/Basic. And it always creates
a meaningless ClonedArguments.

Using ES6 default parameter here is not a solution. It increases the number
of parameters of the CodeBlock (not `function.length`). And the optional
parameters in Array.prototype.xxx methods are not typically passed. For
example, we typically do not pass `thisArg` to `Array.prototype.map` function.
In this case, the arity check frequently fails. It requires the additional C
call to fixup arguments and it becomes pure overhead.

To solve this problem, this patch introduces a new bytecode intrinsic @argument().
This offers the way to retrieve the argument value without increasing the
arity of the function. And if the argument is not passed (out of bounds), it
just returns `undefined`. The semantics of this intrinsic is the same to the C++
ExecState::argument(). This operation does not require `arguments` object. And we
can drop the `argument` references even in lower 3 tiers.

We implement op_get_argument for this intrinsic. And later this will be converted
to DFG GetArgument node. All the tiers handles this feature.

This patch improves ES6SampleBench/Basic 13.8% in steady state. And in summary,
it improves 4.5%.

In the future, we can improve the implementation of the default parameters.
Currently, the default parameter always increases the arity of the function. So
if you do not pass the argument, the arity check fails. But since it is the default
parameter, it is likely that we don't pass the argument. Using op_get_argument to
implement the default parameter can decrease the case in which the arity check
frequently fails. And it can change the builtin implementation to use the ES6
default parameters instead of using the special @argument() intrinsic in the future.
And at that case, the user code also receives the benefit.

ES6SampleBench/Basic.
    Baseline:
        Running... Basic ( 1  to go)
        firstIteration:     39.38 ms +- 4.48 ms
        averageWorstCase:   20.79 ms +- 0.96 ms
        steadyState:        1959.22 ms +- 65.55 ms

    Patched:
        Running... Basic ( 1  to go)
        firstIteration:     37.85 ms +- 4.09 ms
        averageWorstCase:   18.60 ms +- 0.76 ms
        steadyState:        1721.89 ms +- 57.58 ms

All summary.
    Baseline:
        summary:            164.34 ms +- 5.01 ms
    Patched:
        summary:            157.26 ms +- 5.96 ms

* builtins/ArrayConstructor.js:
* builtins/ArrayPrototype.js:
(reduce):
(reduceRight):
(every):
(forEach):
(filter):
(map):
(some):
(fill):
(find):
(findIndex):
(includes):
(copyWithin):
* builtins/DatePrototype.js:
(toLocaleString):
(toLocaleDateString):
(toLocaleTimeString):
* builtins/MapPrototype.js:
(forEach):
* builtins/NumberPrototype.js:
(toLocaleString):
* builtins/SetPrototype.js:
(forEach):
* builtins/StringPrototype.js:
(padStart):
(padEnd):
(localeCompare):
* builtins/TypedArrayConstructor.js:
* builtins/TypedArrayPrototype.js:
(every):
(fill):
(find):
(findIndex):
(forEach):
(some):
(reduce):
(reduceRight):
(map):
(filter):
* bytecode/BytecodeIntrinsicRegistry.h:
* bytecode/BytecodeList.json:
* bytecode/BytecodeUseDef.h:
(JSC::computeUsesForBytecodeOffset):
(JSC::computeDefsForBytecodeOffset):
* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::dumpBytecode):
(JSC::CodeBlock::finishCreation):
* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::emitGetArgument):
* bytecompiler/BytecodeGenerator.h:
* bytecompiler/NodesCodegen.cpp:
(JSC::BytecodeIntrinsicNode::emit_intrinsic_argument):
* dfg/DFGAbstractInterpreterInlines.h:
(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::parseBlock):
* dfg/DFGCapabilities.cpp:
(JSC::DFG::capabilityLevel):
* dfg/DFGClobberize.h:
(JSC::DFG::clobberize):
* dfg/DFGDoesGC.cpp:
(JSC::DFG::doesGC):
* dfg/DFGFixupPhase.cpp:
(JSC::DFG::FixupPhase::fixupNode):
* dfg/DFGNode.h:
(JSC::DFG::Node::hasHeapPrediction):
(JSC::DFG::Node::hasArgumentIndex):
(JSC::DFG::Node::argumentIndex):
* dfg/DFGNodeType.h:
* dfg/DFGPreciseLocalClobberize.h:
(JSC::DFG::PreciseLocalClobberizeAdaptor::readTop):
* dfg/DFGPredictionPropagationPhase.cpp:
* dfg/DFGSafeToExecute.h:
(JSC::DFG::safeToExecute):
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compileGetArgument):
* dfg/DFGSpeculativeJIT.h:
* dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* ftl/FTLCapabilities.cpp:
(JSC::FTL::canCompile):
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileNode):
(JSC::FTL::DFG::LowerDFGToB3::compileGetArgument):
* jit/JIT.cpp:
(JSC::JIT::privateCompileMainPass):
* jit/JIT.h:
* jit/JITOpcodes.cpp:
(JSC::JIT::emit_op_get_argument):
* jit/JITOpcodes32_64.cpp:
(JSC::JIT::emit_op_get_argument):
* llint/LowLevelInterpreter32_64.asm:
* llint/LowLevelInterpreter64.asm:

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

3 years agoWeb Inspector: DebuggerManager.Event.Resumed introduces test flakiness
joepeck@webkit.org [Thu, 10 Nov 2016 06:07:07 +0000 (06:07 +0000)]
Web Inspector: DebuggerManager.Event.Resumed introduces test flakiness
https://bugs.webkit.org/show_bug.cgi?id=161951
<rdar://problem/28295767>

Reviewed by Brian Burg.

Source/JavaScriptCore:

This removes an ambiguity in the protocol when stepping through
JavaScript. Previously, when paused and issuing a Debugger.step*
command the frontend would always receive a Debugger.resumed event and
then, maybe, a Debugger.paused event indicating we paused again (after
stepping). However, this ambiguity means that the frontend needs to
wait for a short period of time to determine if we really resumed
or not. And even still that decision may be incorrect if the step
takes a sufficiently long period of time.

The new approach removes this ambiguity. Now, in response to a
Debugger.step* command the backend MUST send a single Debugger.paused
event or Debugger.resumed event. Now the frontend knows that the
next Debugger event it receives after issuing the step command is
the result (stepped and paused, or stepped and resumed).

To make resuming consistent in all cases, a Debugger.resume command
will always respond with a Debugger.resumed event.

Finally, Debugger.continueToLocation is treated like a "big step"
in cases where we can resolve the location. If we can't resolve the
location it is treated as a resume, maintaining the old behavior.

* inspector/agents/InspectorDebuggerAgent.h:
* inspector/agents/InspectorDebuggerAgent.cpp:
(Inspector::InspectorDebuggerAgent::stepOver):
(Inspector::InspectorDebuggerAgent::stepInto):
(Inspector::InspectorDebuggerAgent::stepOut):
(Inspector::InspectorDebuggerAgent::willStepAndMayBecomeIdle):
(Inspector::InspectorDebuggerAgent::didBecomeIdleAfterStepping):
When stepping register a VM exit observer so that we can issue
a Debugger.resumed event if the step caused us to exit the VM.

(Inspector::InspectorDebuggerAgent::resume):
Set a flag to issue a Debugger.resumed event once we break out
of the nested run loop.

(Inspector::InspectorDebuggerAgent::didPause):
We are issuing Debugger.paused so clear the state to indicate that
we no longer need to issue Debugger.resumed event, we have paused.

(Inspector::InspectorDebuggerAgent::didContinue):
Only issue the Debugger.resumed event if needed (explicitly asked
to resume).

(Inspector::InspectorDebuggerAgent::continueToLocation):
(Inspector::InspectorDebuggerAgent::clearDebuggerBreakpointState):
All places that do continueProgram should be audited. In error cases,
if we are paused and continue we should remember to send Debugger.resumed.

* inspector/protocol/Debugger.json:
Clarify in the protocol description the contract of these methods.

Source/WebCore:

Covered by existing tests that would ASSERT otherwise.

* inspector/InspectorClient.cpp:
(WebCore::InspectorClient::doDispatchMessageOnFrontendPage):
When paused on an exception in the inspected page and evaluating
commands in the inspector frontend page (which evaluates JavaScript)
we ASSERT when entering the Global DOM VM with an existing exception.
This makes it so when we evaluate JavaScript in the frontend we
suspend / ignore the state of the VM for the inspected page, and
restore it when we return from the inspector.

Source/WebInspectorUI:

* UserInterface/Controllers/DebuggerManager.js:
(WebInspector.DebuggerManager.prototype.debuggerDidResume):
Now, Debugger.resumed events really mean the debugger resumed,
so act immediately instead of guessing. We must still guess
in legacy backends.

* UserInterface/Test/Test.js:
When the inspector frontend encounters an issue, log it.

* UserInterface/Views/DebuggerSidebarPanel.js:
(WebInspector.DebuggerSidebarPanel.prototype._debuggerDidPause):
(WebInspector.DebuggerSidebarPanel.prototype._debuggerActiveCallFrameDidChange):
Always enable the step out button. I don't think it makes sense to disable
it sometimes, and if there are issues with this we should solve the issues
instead of hiding them.

LayoutTests:

Rewrite tests to be more deterministic. For tests that
relied on a Resumed event to happen after a short amount
of time, instead have the test dispatch an event when it is
appropriate to continue. Take this opportunity to rewrite
some tests using new style and best practices.

* inspector/debugger/break-in-constructor-before-super.html:
* inspector/debugger/break-on-exception-throw-in-promise.html:
* inspector/debugger/break-on-exception.html:
* inspector/debugger/break-on-uncaught-exception-throw-in-promise.html:
* inspector/debugger/break-on-uncaught-exception.html:
* inspector/debugger/breakpoint-syntax-error-top-level.html:
* inspector/debugger/command-line-api-exception-expected.txt:
* inspector/debugger/command-line-api-exception-nested-catch.html:
* inspector/debugger/command-line-api-exception.html:
* inspector/debugger/csp-exceptions.html:
* inspector/debugger/didSampleProbe-multiple-probes.html:
* inspector/debugger/evaluateOnCallFrame-CommandLineAPI.html:
* inspector/debugger/evaluateOnCallFrame-errors.html:
* inspector/debugger/pause-reason-expected.txt:
* inspector/debugger/pause-reason.html:
* inspector/debugger/paused-scopes-expected.txt:
* inspector/debugger/paused-scopes.html:
* inspector/debugger/resources/exceptions.js:
* inspector/debugger/scriptParsed.html:
* inspector/debugger/sourceURL-repeated-identical-executions.html:
* inspector/debugger/sourceURLs.html:
* inspector/debugger/stepping/stepping-pause-in-inner-step-to-parent.html:

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

3 years ago[WK2][NETWORK_SESSION] Add support for downloading file backed blobs
cdumez@apple.com [Thu, 10 Nov 2016 05:28:53 +0000 (05:28 +0000)]
[WK2][NETWORK_SESSION] Add support for downloading file backed blobs
https://bugs.webkit.org/show_bug.cgi?id=164458
<rdar://problem/28905514>

Reviewed by Darin Adler.

Source/WebKit2:

Add support for downloading file backed blobs on WebKit2.
It previously wasn't working because we weren't calling
BlobDataFileReference::prepareForFileAccess() for each blob file before
starting the download, similarly to what is done in NetworkResourceLoader's
consumeSandboxExtensions().

* NetworkProcess/Downloads/DownloadManager.cpp:
(WebKit::DownloadManager::startDownload):
* NetworkProcess/Downloads/DownloadManager.h:
(WebKit::DownloadManager::startDownload):
* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::startDownload):
(WebKit::NetworkConnectionToWebProcess::convertMainResourceLoadToDownload):
* NetworkProcess/NetworkDataTask.cpp:
(WebKit::NetworkDataTask::create):
* NetworkProcess/NetworkDataTask.h:
* NetworkProcess/NetworkDataTaskBlob.cpp:
(WebKit::NetworkDataTaskBlob::NetworkDataTaskBlob):
(WebKit::NetworkDataTaskBlob::~NetworkDataTaskBlob):
(WebKit::NetworkDataTaskBlob::download):
* NetworkProcess/NetworkDataTaskBlob.h:
* NetworkProcess/NetworkLoad.cpp:
(WebKit::NetworkLoad::NetworkLoad):
* NetworkProcess/NetworkLoadParameters.h:
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::downloadRequest):
* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::NetworkResourceLoader):
(WebKit::NetworkResourceLoader::startNetworkLoad):
* NetworkProcess/PingLoad.h:

Tools:

Add testRunner.setShouldDownloadUndisplayableMIMETypes(bool) API so that layout
tests can request that such resources are downloaded instead of being ignored.

* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::setShouldDownloadUndisplayableMIMETypes):
* WebKitTestRunner/InjectedBundle/TestRunner.h:
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::decidePolicyForNavigationResponse):
* WebKitTestRunner/TestController.h:
(WTR::TestController::setShouldDownloadUndisplayableMIMETypes):
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::didReceiveMessageFromInjectedBundle):

LayoutTests:

Add layout test coverage for downloading blobs, both via <a download> or
because a load is later converted into a download.

* fast/dom/HTMLAnchorElement/anchor-file-blob-convert-to-download-expected.txt: Added.
* fast/dom/HTMLAnchorElement/anchor-file-blob-convert-to-download.html: Added.
* fast/dom/HTMLAnchorElement/anchor-file-blob-download-expected.txt: Added.
* fast/dom/HTMLAnchorElement/anchor-file-blob-download.html: Added.
* platform/ios-simulator-wk1/TestExpectations:
* platform/ios-simulator-wk2/TestExpectations:
* platform/mac-wk1/TestExpectations:
* platform/win/TestExpectations:

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

3 years agoNetworkSession: Network process crash when converting main resource to download
commit-queue@webkit.org [Thu, 10 Nov 2016 04:49:09 +0000 (04:49 +0000)]
NetworkSession: Network process crash when converting main resource to download
https://bugs.webkit.org/show_bug.cgi?id=164220

Patch by Carlos Garcia Campos <cgarcia@igalia.com> on 2016-11-09
Reviewed by Alex Christensen.

Source/WebKit2:

Right after the main resource load is converted to a download, the web process deletes the ResourceLoader which
sends the RemoveLoadIdentifier to the network process and the load is aborted. Sometimes it happens that
NetworkResourceLoader::abort() is called while the NetworkLoad is still deciding the destination of the
download. In such case, NetworkResourceLoader::didConvertToDownload() has already been called, but not
NetworkResourceLoader::didBecomeDownload(). In NetworkResourceLoader::abort() we already handle the case of
having a NetworkLoad after NetworkResourceLoader::didConvertToDownload() has been called, to avoid canceling the
load in such case, however cleanup() is always called unconditionally and the NetworkLoad is deleted before
NetworkResourceLoader::didBecomeDownload() is called. When the NetworkLoad is destroyed the NetworkDataTask
client becomes nullptr, leaving it in a state where both the client is nullptr and the download hasn't been
created yet. That's not expected to happen and when the response completion handler is called in the
NetworkDataTask it tries to use either the client or the download and it crashes.
We need to cleanup and destroy the ResourceLoader as soon as it becomes a download, because that's the expected
behavior, but at the same time we need to keep the NetworkLoad alive until the NetworkDataTask finishes to become
a download. This patch creates a PendingDownload to take the ownership of the NetworkLoad, so that
ResourceLoader can be cleaned up and destroyed. The DownloadManager now will handle the PendingDownload as if it
was created by startDownload(), but ensuring it's deleted right before the final Download object is added to the
downloads map. That way NetworkDataTask will always have a valid client until the final Download is created,
first the ResourceLoader and then the PendingDownload. Since the DownloadManager is the owner of the
PendingDownload we no longer need the didBecomeDownload() callback to delete the NetworkLoad, because the
NetworkLoad will always be owned by the PendingDownload now that will be deleted by the DownloadManager.

* NetworkProcess/Downloads/DownloadManager.cpp:
(WebKit::DownloadManager::dataTaskBecameDownloadTask): Change the ASSERT because at this point we should always
have a PendingDownload, and then remove it from the map here before adding the final Download to the map.
(WebKit::DownloadManager::convertNetworkLoadToDownload): This replaces convertHandleToDownload, but it also now
used for the NetworkSession. It creates a PendingDownload for the given NetworkLoad.
(WebKit::DownloadManager::continueDecidePendingDownloadDestination): Do not take the PendingDownload from the
map here, just check it's present, because it will be removed from dataTaskBecameDownloadTask().
(WebKit::DownloadManager::convertHandleToDownload): Deleted.
* NetworkProcess/Downloads/DownloadManager.h:
* NetworkProcess/Downloads/PendingDownload.cpp:
(WebKit::PendingDownload::PendingDownload): Add a constructor that receives a NetworkLoad.
* NetworkProcess/Downloads/PendingDownload.h:
* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::convertMainResourceLoadToDownload): Just ask the ResourceLoader to be
converted to a download.
* NetworkProcess/NetworkDataTask.h:
* NetworkProcess/NetworkDataTaskBlob.cpp:
(WebKit::NetworkDataTaskBlob::download): Do not call didBecomeDownload() and add an assert to ensure the client
has already been removed right after the final Download object is created.
* NetworkProcess/NetworkLoad.cpp:
(WebKit::NetworkLoad::NetworkLoad): Use a pointer for the client instead of a reference because now we need to
change the client when the load is converted to a download. We don't need to null check the client in any case
because the member is only updated internally and always from a passed reference.
(WebKit::NetworkLoad::sharedDidReceiveResponse):
(WebKit::NetworkLoad::sharedWillSendRedirectedRequest):
(WebKit::NetworkLoad::convertTaskToDownload): This now receives a PendingDownload. It updates the client and no
longer sends DidStart, because the PendingDownload sends it now.
(WebKit::NetworkLoad::didReceiveChallenge):
(WebKit::NetworkLoad::didReceiveData):
(WebKit::NetworkLoad::didCompleteWithError):
(WebKit::NetworkLoad::didSendData):
(WebKit::NetworkLoad::wasBlocked):
(WebKit::NetworkLoad::cannotShowURL):
(WebKit::NetworkLoad::didReceiveBuffer):
(WebKit::NetworkLoad::didFinishLoading):
(WebKit::NetworkLoad::didFail):
(WebKit::NetworkLoad::canAuthenticateAgainstProtectionSpaceAsync):
(WebKit::NetworkLoad::didBecomeDownload): Deleted.
* NetworkProcess/NetworkLoad.h:
* NetworkProcess/NetworkLoadClient.h: Remove didBecomeDownload().
* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::convertToDownload): This replaces didBecomeDownload() and
didConvertToDownload(). It transfers the NetworkLoad to the DownloadManager.
(WebKit::NetworkResourceLoader::abort): We don't need to check if the load was converted to a download here,
because m_networkLoad will always be null here in such case.
(WebKit::NetworkResourceLoader::didBecomeDownload): Deleted
(WebKit::NetworkResourceLoader::didConvertToDownload): Deleted
* NetworkProcess/NetworkResourceLoader.h:
* NetworkProcess/PingLoad.h: Remove didBecomeDownload().
* NetworkProcess/cache/NetworkCacheSpeculativeLoad.h: Ditto.
* NetworkProcess/cocoa/NetworkDataTaskCocoa.h: Ditto.
* NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: Ditto.
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(-[WKNetworkSessionDelegate URLSession:dataTask:didBecomeDownloadTask:]): Do not call didBecomeDownload().
* NetworkProcess/soup/NetworkDataTaskSoup.cpp:
(WebKit::NetworkDataTaskSoup::download): Do not call didBecomeDownload() and add an assert to ensure the client
has already been removed right after the final Download object is created.

Tools:

Split /webkit2/Downloads/policy-decision-download in two, one to test the full load when main resource is
converted to a download and another one to test the cancellation as the test was doing before. When doing the
full load, delay a bit the decide destination to ensure the load is aborted before the data task has became a
download.

* TestWebKitAPI/Tests/WebKit2Gtk/TestDownloads.cpp:
(testPolicyResponseDownload):
(testPolicyResponseDownloadCancel):
(beforeAll):

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

3 years agoWeb Inspector: Associate Worker Resources with the Worker and not the Page
joepeck@webkit.org [Thu, 10 Nov 2016 03:54:06 +0000 (03:54 +0000)]
Web Inspector: Associate Worker Resources with the Worker and not the Page
https://bugs.webkit.org/show_bug.cgi?id=164342
<rdar://problem/29075775>

Reviewed by Timothy Hatcher.

Source/JavaScriptCore:

* inspector/protocol/Network.json:
* inspector/protocol/Page.json:
Associate Resource data with a target.

Source/WebCore:

Test: inspector/worker/resources-in-worker.html

Provide a way to associate an initiator identifier with a ResourceRequest.
This will allow Web Inspector to identify who started particular resource
loads. This is important to associate Worker(...), importScript(...), and
XMLHttpRequest / Fetch loads with that specific Worker.

* platform/network/ResourceRequestBase.cpp:
(WebCore::ResourceRequestBase::setAsIsolatedCopy):
* platform/network/ResourceRequestBase.h:
(WebCore::ResourceRequestBase::initiatorIdentifier):
(WebCore::ResourceRequestBase::setInitiatorIdentifier):
Optional initiator identifier. Currently used only be Web Inspector.

* dom/ScriptExecutionContext.h:
(WebCore::ScriptExecutionContext::resourceRequestIdentifier):
Non-page execution contexts, like WorkerGlobalScope, should provide
a unique identifier that may be used to distinguish loads initiated
from within that context.

* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::createRequest):
* Modules/fetch/FetchLoader.cpp:
(WebCore::FetchLoader::start):
* Modules/fetch/FetchRequest.cpp:
(WebCore::FetchRequest::initializeWith):
XHR / Fetch loads should include the ScriptExecutionContext's
initiator identifier.

* workers/WorkerScriptLoader.cpp:
(WebCore::WorkerScriptLoader::WorkerScriptLoader):
(WebCore::WorkerScriptLoader::loadSynchronously):
(WebCore::WorkerScriptLoader::loadAsynchronously):
(WebCore::WorkerScriptLoader::createResourceRequest):
* workers/WorkerScriptLoader.h:
Provide a way to provide initiator identifier information for
Worker script loads. Currently this is `new Worker(...)` and
`importScripts(...)` resource loads.

* workers/Worker.cpp:
(WebCore::Worker::Worker):
(WebCore::Worker::create):
* workers/Worker.h:
* workers/WorkerGlobalScope.cpp:
(WebCore::WorkerGlobalScope::WorkerGlobalScope):
(WebCore::WorkerGlobalScope::importScripts):
* workers/WorkerGlobalScope.h:
Give Worker itself the unique identifier, because `new Worker(...)`
loads happen before the WorkerGlobalScript (ScriptExecutionContext)
is actually created, but we want to associate it with this Worker.

* workers/DedicatedWorkerGlobalScope.cpp:
(WebCore::DedicatedWorkerGlobalScope::create):
(WebCore::DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope):
* workers/DedicatedWorkerGlobalScope.h:
* workers/DedicatedWorkerThread.cpp:
(WebCore::DedicatedWorkerThread::DedicatedWorkerThread):
(WebCore::DedicatedWorkerThread::createWorkerGlobalScope):
* workers/DedicatedWorkerThread.h:
* workers/WorkerInspectorProxy.cpp:
(WebCore::WorkerInspectorProxy::WorkerInspectorProxy):
* workers/WorkerInspectorProxy.h:
* workers/WorkerMessagingProxy.cpp:
(WebCore::WorkerMessagingProxy::WorkerMessagingProxy):
(WebCore::WorkerMessagingProxy::startWorkerGlobalScope):
* workers/WorkerThread.cpp:
(WebCore::WorkerThreadStartupData::WorkerThreadStartupData):
(WebCore::WorkerThread::WorkerThread):
(WebCore::WorkerThread::workerThread):
* workers/WorkerThread.h:
Pass the MainThread's Worker identifier through to the WorkerGlobalScope
created on the WorkerThread. They should be the same identifier.

* inspector/InspectorNetworkAgent.cpp:
(WebCore::InspectorNetworkAgent::willSendRequest):
* inspector/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::buildObjectForFrameTree):
Pass the initiator identifier data to the frontend. This identifier is
equivalent to a "target identifier" in the frontend. Currently the only
non-Page targets are Workers.

* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::shouldContinueAfterNotifyingLoadedFromMemoryCache):
When using the memory cache we create a new resource request. Be sure
to copy over useful inspector data, like the initiator identifier,
from the original request.

* platform/network/cf/ResourceRequestCFNet.cpp:
(WebCore::ResourceRequest::updateFromDelegatePreservingOldProperties):
When rebuilding a ResourceRequest from NSURLRequest, copy over the
initiator identifier property that wouldn't otherwise have survived
the transition.

Source/WebInspectorUI:

A Target may have its own list of Resource. For example, Workers may
request any resources via XHR/Fetch. So we associate a ResourceCollection
with a Target, and ensure we show them in Web Inspector as you would expect.
At this point, Target starts acting like Frame. Target has a resourceCollection
and extraScriptsCollection just like Frame. Target has events for ResourceAdded
just like Frame.

Even though Resource loads are happening in Workers, the Network data
still comes from the Page's Network agent. The added "targetId" data
with the Resource will let us associate a Resoure with a Target.

When opening inspector after a page has loaded, the frontend loads Resources
via the Page.getResourceTree path. In this case, the frontend may be
informed of Resources for a Target that it does not know about yet. In
these cases, it sets them aside as Orphaned resources for a target. Later,
when that Target is created, it will adopt its Orphaned resources.

Places that used to listen to just Frame.Event.ResourceWasAdded should now
also listen for Target.Event.ResourceAdded to ensure it sees the resources
associated with non-page targets.

* UserInterface/Protocol/Target.js:
(WebInspector.Target):
(WebInspector.Target.prototype.get identifier):
(WebInspector.Target.prototype.get resourceCollection):
(WebInspector.Target.prototype.get extraScriptCollection):
(WebInspector.Target.prototype.addResource):
(WebInspector.Target.prototype.adoptResource):
(WebInspector.Target.prototype.addScript):
Give Target resource collections.

(WebInspector.MainTarget):
(WebInspector.MainTarget.prototype.get mainResource):
Pass through to the FrameResourceManager for the MainTarget.

(WebInspector.WorkerTarget):
(WebInspector.WorkerTarget.prototype.initialize):
Adopt orphaned resources on creation.

* UserInterface/Models/Resource.js:
(WebInspector.Resource):
(WebInspector.Resource.prototype.get target):
(WebInspector.Resource.prototype.get type):
Resource now has a Target. During creation, if there is a targetId
then we must produce a Target or null (orphaned).

(WebInspector.Resource.prototype.associateWithScript):
When associating a Resource with a Script, we can use this opportunity
to convert from an XML / Other type to Script.

* UserInterface/Models/Script.js:
(WebInspector.Script.prototype._resolveResource):
When associating Scripts with a resource we must associate resources
from within the proper Target. If it is the Main target we still use
the FrameResourceManager which keep searches across all Frames.

* UserInterface/Protocol/NetworkObserver.js:
(WebInspector.NetworkObserver.prototype.requestWillBeSent):
* UserInterface/Controllers/FrameResourceManager.js:
(WebInspector.FrameResourceManager.prototype.initialize):
(WebInspector.FrameResourceManager.prototype.frameDidNavigate):
(WebInspector.FrameResourceManager.prototype.resourceRequestWillBeSent):
(WebInspector.FrameResourceManager.prototype.resourceRequestWasServedFromMemoryCache):
(WebInspector.FrameResourceManager.prototype.resourceRequestDidReceiveResponse):
(WebInspector.FrameResourceManager.prototype.adoptOrphanedResourcesForTarget):
(WebInspector.FrameResourceManager.prototype._addNewResourceToFrameOrTarget):
(WebInspector.FrameResourceManager.prototype._addResourceToTarget):
(WebInspector.FrameResourceManager.prototype._createResource):
(WebInspector.FrameResourceManager.prototype._addFrameTreeFromFrameResourceTreePayload):
(WebInspector.FrameResourceManager.prototype._addOrphanedResource):
(WebInspector.FrameResourceManager.prototype._mainFrameDidChange):
(WebInspector.FrameResourceManager.prototype._addNewResourceToFrame): Deleted.
When creating Resources from Network events we may now have a targetId.
Once created a Resource must be associated with a Frame, Target, or orphaned.

* UserInterface/Main.html:
* UserInterface/Views/TargetTreeElement.js: Removed.
* UserInterface/Views/WorkerTreeElement.js: Added.
(WebInspector.WorkerTreeElement):
(WebInspector.WorkerTreeElement.prototype.get target):
(WebInspector.WorkerTreeElement.prototype.onexpand):
(WebInspector.WorkerTreeElement.prototype.oncollapse):
(WebInspector.WorkerTreeElement.prototype.onpopulate):
(WebInspector.WorkerTreeElement.prototype.updateSourceMapResources):
(WebInspector.WorkerTreeElement.prototype.onattach):
(WebInspector.WorkerTreeElement.prototype.compareChildTreeElements):
(WebInspector.WorkerTreeElement.prototype._handleContextMenuEvent):
(WebInspector.WorkerTreeElement.prototype._scriptAdded):
(WebInspector.WorkerTreeElement.prototype._resourceAdded):
Convert TargetTreeElement to WorkerTreeElement as that is clearer.
Behave like FrameTreeElement and populate resources on creation,
handle SourceMapResource, etc.

* UserInterface/Views/FolderizedTreeElement.js:
(WebInspector.FolderizedTreeElement.prototype.registerFolderizeSettings):
(WebInspector.FolderizedTreeElement.prototype._compareTreeElementsByMainTitle):
(WebInspector.FolderizedTreeElement.prototype._parentTreeElementForRepresentedObject):
If the display name for a folder is `null` then there is no folder,
and place such child tree elements at the top level. This will be
the case for a Worker's Script's, which we choose not to folderize.

* UserInterface/Controllers/DebuggerManager.js:
(WebInspector.DebuggerManager.prototype.scriptDidParse):
* UserInterface/Controllers/TargetManager.js:
(WebInspector.TargetManager.prototype.targetForIdentifier):

* UserInterface/Models/DefaultDashboard.js:
(WebInspector.DefaultDashboard):
* UserInterface/Controllers/TimelineManager.js:
(WebInspector.TimelineManager):
* UserInterface/Controllers/WorkerManager.js:
(WebInspector.WorkerManager.prototype.workerCreated):
* UserInterface/Views/OpenResourceDialog.js:
(WebInspector.OpenResourceDialog.prototype.didDismissDialog):
(WebInspector.OpenResourceDialog.prototype.didPresentDialog):
(WebInspector.OpenResourceDialog.prototype._addScriptsForTarget): Deleted.
(WebInspector.OpenResourceDialog.prototype._addResourcesForTarget): Added.
Ensure those that listen for Frame.Event.ResourceWasAdded now also
listen for Target.Event.ResourceAdded.

* UserInterface/Views/ContextMenuUtilities.js:
(WebInspector.appendContextMenuItemsForSourceCode):
(WebInspector.appendContextMenuItemsForResource): Deleted.
* UserInterface/Views/ResourceTimelineDataGridNode.js:
(WebInspector.ResourceTimelineDataGridNode.prototype.appendContextMenuItems):
* UserInterface/Views/ResourceTreeElement.js:
(WebInspector.ResourceTreeElement.prototype._updateTitles):
(WebInspector.ResourceTreeElement.prototype._handleContextMenuEvent):
Generalize ContextMenu helper to SourceCode so it can be used on a Script or Resource.

* UserInterface/Views/ResourceDetailsSidebarPanel.js:
(WebInspector.ResourceDetailsSidebarPanel.prototype.inspect):
When looking at a WorkerTarget's mainResource (Script) show the
Resource Details sidebar for its Resource.

* UserInterface/Views/ResourceSidebarPanel.js:
(WebInspector.ResourceSidebarPanel):
(WebInspector.ResourceSidebarPanel.prototype._scriptWasAdded):
(WebInspector.ResourceSidebarPanel.prototype._scriptsCleared):
(WebInspector.ResourceSidebarPanel.prototype._addTargetWithMainResource):
(WebInspector.ResourceSidebarPanel.prototype._targetRemoved):
(WebInspector.ResourceSidebarPanel.prototype._addScriptForNonMainTarget): Deleted.
Simplify ResourceSidebarPanel to only handle adding WorkerTreeElements,
which will do the rest of the work for their Resources/Scripts.

* UserInterface/Views/SourceCodeTreeElement.js:
(WebInspector.SourceCodeTreeElement.prototype.descendantResourceTreeElementTypeDidChange):
When we were changing the type of a resource, it would remove and re-insert.
This would collapse the parent if it was the only child in removal, and not
expand the parent when re-inserting. This ensures we re-expand.

LayoutTests:

* inspector/worker/resources-in-worker-expected.txt: Added.
* inspector/worker/resources-in-worker.html: Added.
* inspector/worker/resources/dataFetch.json: Added.
* inspector/worker/resources/dataXHR.json: Added.
* inspector/worker/resources/resource-utilities.js: Added.
(loadResourceXHR):
(loadResourceFetch):
* inspector/worker/resources/worker-resources.js: Added.
(importScript):
(onmessage):

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

3 years ago[EFL] fix error message caused by eina log
hyuki.kim@samsung.com [Thu, 10 Nov 2016 03:06:45 +0000 (03:06 +0000)]
[EFL] fix error message caused by eina log
https://bugs.webkit.org/show_bug.cgi?id=164546

Reviewed by Gyuyoung Kim.

Fix error message caused by eina log when MiniBrowser is working with help option.

* MiniBrowser/efl/main.c:
(quit):

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

3 years agoIndexedDB 2.0: Clean up some exception ordering.
beidson@apple.com [Thu, 10 Nov 2016 01:42:24 +0000 (01:42 +0000)]
IndexedDB 2.0: Clean up some exception ordering.
https://bugs.webkit.org/show_bug.cgi?id=164566

LayoutTests/imported/w3c:

Reviewed by NOBODY (OOPS!).

* IndexedDB-private-browsing/idbcursor_advance_index7-expected.txt:
* IndexedDB-private-browsing/idbcursor_continue_index7-expected.txt:
* web-platform-tests/IndexedDB/idbcursor_advance_index7-expected.txt:
* web-platform-tests/IndexedDB/idbcursor_continue_index7-expected.txt:
* web-platform-tests/IndexedDB/idbobjectstore_createIndex14-exception_order-expected.txt:

Source/WebCore:

Reviewed by Alex Christensen.

No new tests (Covered by existing tests).

* Modules/indexeddb/IDBCursor.cpp:
(WebCore::IDBCursor::advance):
(WebCore::IDBCursor::continueFunction):

* Modules/indexeddb/IDBObjectStore.cpp:
(WebCore::IDBObjectStore::createIndex):

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

3 years agoWindows localStorage tests will fail until Bug 155185 is fixed.
bfulgham@apple.com [Thu, 10 Nov 2016 01:36:34 +0000 (01:36 +0000)]
Windows localStorage tests will fail until Bug 155185 is fixed.
https://bugs.webkit.org/show_bug.cgi?id=155185

* platform/win/TestExpectations: Mark localStorage tests as expected
to fail for now.

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

3 years agoMarking media/modern-media-controls/pip-support/pip-support-enabled.html as flaky.
ryanhaddad@apple.com [Thu, 10 Nov 2016 01:34:30 +0000 (01:34 +0000)]
Marking media/modern-media-controls/pip-support/pip-support-enabled.html as flaky.
https://bugs.webkit.org/show_bug.cgi?id=164336

Unreviewed test gardening.

* platform/mac-wk1/TestExpectations:

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

3 years agoUnreviewed build fix after r208509.
bfulgham@apple.com [Thu, 10 Nov 2016 01:33:15 +0000 (01:33 +0000)]
Unreviewed build fix after r208509.

* DumpRenderTree/win/TestRunnerWin.cpp:
(TestRunner::setNeedsStorageAccessFromFileURLsQuirk): Add missing TestRunner implementation."

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

3 years agojsc CLI should work with the remote inspector
keith_miller@apple.com [Thu, 10 Nov 2016 01:22:10 +0000 (01:22 +0000)]
jsc CLI should work with the remote inspector
https://bugs.webkit.org/show_bug.cgi?id=164569

Reviewed by Joseph Pecoraro.

This patch enables using the remote inspector on the jsc CLI.
In order to use the remote inspector, jsc users need to pass an option.

* jsc.cpp:
(CommandLine::parseArguments):
(runJSC):

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

3 years agoUnreviewed, rolling out r208438.
achristensen@apple.com [Thu, 10 Nov 2016 01:21:56 +0000 (01:21 +0000)]
Unreviewed, rolling out r208438.

crashes

Reverted changeset:

"[WK2][NETWORK_SESSION] Add support for downloading file
backed blobs"
https://bugs.webkit.org/show_bug.cgi?id=164458
http://trac.webkit.org/changeset/208438

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

3 years agoMarking two media/modern-media-controls tests as flaky.
ryanhaddad@apple.com [Thu, 10 Nov 2016 01:16:20 +0000 (01:16 +0000)]
Marking two media/modern-media-controls tests as flaky.

Unreviewed test gardening.

* TestExpectations:
* platform/mac/TestExpectations:

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

3 years agoChange the decoding for some animated images to be asynchronous
commit-queue@webkit.org [Thu, 10 Nov 2016 01:13:05 +0000 (01:13 +0000)]
Change the decoding for some animated images to be asynchronous
https://bugs.webkit.org/show_bug.cgi?id=161566

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

Source/WebCore:

Tests: fast/images/slower-animation-than-decoding-image.html
       fast/images/slower-decoding-than-animation-image.html
       fast/images/stopped-animation-deleted-image.html

Request the next frame before firing the animation timer. The asynchronous
image decoding work queue notifies the BitmapImage when the frame finishes
decoding. If the timer fires before the frame is decoded, no repaint will
be requested. Only when the image frame is ready, the animation will be
advanced and the image will be repainted.

* loader/cache/CachedImage.cpp:
(WebCore::CachedImage::load): Cache the image settings in CachedImage.
(WebCore::CachedImage::createImage): No need to pass allowSubsampling to BitmapImage. It can be retrieved through Image::imageObserver().
(WebCore::CachedImage::changedInRect): Change the parameter to notifyObservers() to be a pointer.
* loader/cache/CachedImage.h: Cache the settings: allowSubsampling, allowAsyncImageDecoding and showDebugBackground through m_loader.
* platform/graphics/BitmapImage.cpp:
(WebCore::BitmapImage::dataChanged): Fix a logging message.
(WebCore::BitmapImage::draw): Store the current SubsamplingLevel to be used when requesting decoding the image of the next frame.
Draw a debug rectangle if the next frame is missed because it is being decoded and the setting showDebugBackground is on.
(WebCore::BitmapImage::startAnimation): Deleted. Moved to the header file.
(WebCore::BitmapImage::internalStartAnimation): Added. Request asynchronous image decoding for the next frame if required. Return the
result of starting the animation.
(WebCore::BitmapImage::advanceAnimation): Call internalAdvanceAnimation() if the frame image is not being decoded. If it is being decoded
and the setting showDebugBackground is on, force repaint so the debug rectangle is drawn.
(WebCore::BitmapImage::internalAdvanceAnimation): This is the old body of advanceAnimation().
(WebCore::BitmapImage::stopAnimation): Stop the asynchronous image decoding if it is started.
(WebCore::BitmapImage::newFrameNativeImageAvailableAtIndex): This function is called from the async image decoding work queue when finishing decoding a native image frame.
* platform/graphics/BitmapImage.h:
(WebCore::BitmapImage::startAnimation): Added. It is now calls internalStartAnimation().
* platform/graphics/Color.h: Define a constant for the yellow color.
* platform/graphics/ImageFrameCache.cpp:
(WebCore::ImageFrameCache::clearMetadata): Delete unreferenced member.
(WebCore::ImageFrameCache::requestFrameAsyncDecodingAtIndex): Return true if the frame is requested for async decoding.
* platform/graphics/ImageFrameCache.h:
* platform/graphics/ImageObserver.h:  Add virtual functions for allowSubsampling, allowAsyncImageDecoding and showDebugBackground.
* platform/graphics/ImageSource.cpp:
(WebCore::ImageSource::maximumSubsamplingLevel): Move checking allowSubsampling() to the caller BitmapImage::draw().
* platform/graphics/ImageSource.h: Remove the setting allowSubsampling(); it can be retrieved from imageObserver().
(WebCore::ImageSource::setAllowSubsampling): Deleted.
* rendering/RenderImageResource.cpp:
(WebCore::RenderImageResource::shutdown): Stop the animation of an image when shutting down the resource.
* rendering/RenderImageResourceStyleImage.cpp:
(WebCore::RenderImageResourceStyleImage::shutdown): Ditto.
svg/graphics/SVGImageClients.h: Change the parameter to ImageObserver::changedInRect() to be a pointer.
(WebCore::SVGImageChromeClient::invalidateContentsAndRootView):
* testing/Internals.cpp:
(WebCore::Internals::setImageFrameDecodingDuration): Sets a fixed frame decoding duration for testing.
* testing/Internals.h:
* testing/Internals.idl: Adds an internal option for ImageFrameDecodingDuration.

LayoutTests:

* fast/images/slower-animation-than-decoding-image-expected.txt: Added.
* fast/images/slower-animation-than-decoding-image.html: Added.
* fast/images/slower-decoding-than-animation-image-expected.txt: Added.
* fast/images/slower-decoding-than-animation-image.html: Added.
In these tests, CanvasRenderingContext2D.drawImage() is used to better
control advancing the animation of an animated image. A setTimeout() is
used instead of the frame duration to schedule when the drawing happens.
The first test ensures that faster decoding does not overrule the frame
duration; the setTimeout interval in this case. The second test ensures
the animation is not advanced unless decoding the next frame has finished.

* fast/images/stopped-animation-deleted-image-expected.txt: Added.
* fast/images/stopped-animation-deleted-image.html: Added.
This test ensures that if an animated image is removed from the document,
its draw() method won't be called even if the animation timer fires or the
decoding new frame availability notification is received.

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

3 years agoWeb Inspector: Settings tab sections overlap each other in docked Inspector window
nvasilyev@apple.com [Thu, 10 Nov 2016 01:11:36 +0000 (01:11 +0000)]
Web Inspector: Settings tab sections overlap each other in docked Inspector window
https://bugs.webkit.org/show_bug.cgi?id=164564

Reviewed by Joseph Pecoraro.

* UserInterface/Views/SettingsTabContentView.css:
(.content-view.settings):
Make settings sections non-shrinkable and make the content view vertically scrollable.

(.content-view.settings > .setting-container):
Set vertical padding that looks good for non-shrinkable sections.

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

3 years agoLocal HTML should be blocked from localStorage access unless "Disable Local File...
bfulgham@apple.com [Thu, 10 Nov 2016 00:58:35 +0000 (00:58 +0000)]
Local HTML should be blocked from localStorage access unless "Disable Local File Restrictions" is checked
https://bugs.webkit.org/show_bug.cgi?id=155185
<rdar://problem/11101440>

Reviewed by Brady Eidson.

Source/WebCore:

Add a new quirk for localStorage that defaults to 'on'. When active, this quirk says that
localStorage access should be granted, without needing to grant universal file access.

If the quirk is turned off, then localStorage is blocked unless the WebKit client explicitly
grants universal file access.

Tests: storage/domstorage/localstorage/blocked-file-access-permitted-by-quirk.html
       storage/domstorage/localstorage/blocked-file-access.html

* dom/Document.cpp:
(WebCore::Document::initSecurityContext): Set localStorage quirk mode based on settings.
* page/SecurityOrigin.cpp:
(WebCore::SecurityOrigin::SecurityOrigin): Use more C++11 initializers.
(WebCore::SecurityOrigin::canAccessStorage): If the origin is a local file, and we are NOT in
localStorage quirks mode, and we have not been granted universal file access, prevent access
to DOM localStorage.
(WebCore::SecurityOrigin::setNeedsLocalStorageQuirk): Added.
* page/SecurityOrigin.h:
(WebCore::SecurityOrigin::needsLocalStorageQuirk): Added.
* page/Settings.in:
* workers/WorkerGlobalScope.cpp:
(WebCore::WorkerGlobalScope::WorkerGlobalScope): Make sure Workers know what the
localStorage quirks mode is set to.

Source/WebKit/mac:

Provide SPI to access the new quirk for localStorage. The quirk defaults to 'on'. When active, this
quirk says that localStorage access should be granted, without needing to grant universal file access.

If the quirk is turned off, then localStorage is blocked unless the WebKit client explicitly
grants universal file access.

* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(-[WebPreferences needsLocalStorageQuirk]): Added.
(-[WebPreferences setNeedsLocalStorageQuirk:]): Added.
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]): Honor the new localStorage quirk.

Source/WebKit2:

Provide SPI to access the new quirk for localStorage. The quirk defaults to 'on'. When active, this
quirk says that localStorage access should be granted, without needing to grant universal file access.

If the quirk is turned off, then localStorage is blocked unless the WebKit client explicitly
grants universal file access.

Tested by existing TestWebKitAPI tests and WebKit2.LocalStorageQuirkTest

* Shared/WebPreferencesDefinitions.h:
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetNeedsLocalStorageQuirk): Added.
(WKPreferencesGetNeedsLocalStorageQuirk): Added.
* UIProcess/API/C/WKPreferencesRefPrivate.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _initializeWithConfiguration:]): Honor the new localStorage quirk.
* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration init]): Honor the new localStorage quirk flag.
(-[WKWebViewConfiguration copyWithZone:]): Ditto.
(-[WKWebViewConfiguration _needsLocalStorageQuirk]): Added.
(-[WKWebViewConfiguration _setNeedsLocalStorageQuirk:]): Added.
* UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
* WebProcess/InjectedBundle/API/c/WKBundle.cpp:
(WKBundleSetNeedsLocalStorageQuirk): Added.
* WebProcess/InjectedBundle/API/c/WKBundlePrivate.h:
* WebProcess/InjectedBundle/InjectedBundle.cpp:
(WebKit::InjectedBundle::setNeedsLocalStorageQuirk): Added.
* WebProcess/InjectedBundle/InjectedBundle.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences): Honor the new localStorage quirk flag.

Tools:

* DumpRenderTree/TestRunner.cpp:
(setNeedsLocalStorageQuirkCallback): Added.
(TestRunner::staticFunctions):
* DumpRenderTree/TestRunner.h:
* DumpRenderTree/mac/DumpRenderTree.mm:
(resetWebPreferencesToConsistentValues): Update for new quirk setting.
* DumpRenderTree/mac/TestRunnerMac.mm:
(TestRunner::setNeedsLocalStorageQuirk):
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2/CloseFromWithinCreatePage.cpp:
* TestWebKitAPI/Tests/WebKit2Cocoa/LocalStorageClear.mm:
* TestWebKitAPI/Tests/WebKit2Cocoa/LocalStorageNullEntries.mm:
* TestWebKitAPI/Tests/WebKit2Cocoa/LocalStorageQuirkEnabled.html: Added.
* TestWebKitAPI/Tests/WebKit2Cocoa/LocalStorageQuirkTest.mm: Added.
(-[LocalStorageQuirkMessageHandler userContentController:didReceiveScriptMessage:]):
* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
(WTR::InjectedBundle::beginTesting): Update for new quirk setting.
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::setNeedsLocalStorageQuirk): Added.
* WebKitTestRunner/InjectedBundle/TestRunner.h:

LayoutTests:

* storage/domstorage/localstorage/blocked-file-access-expected.txt: Added.
* storage/domstorage/localstorage/blocked-file-access-permitted-by-quirk-expected.txt: Added.
* storage/domstorage/localstorage/blocked-file-access-permitted-by-quirk.html: Added.
* storage/domstorage/localstorage/blocked-file-access.html: Added.
* storage/domstorage/localstorage/resources/allowed-example.html: Added.
* storage/domstorage/localstorage/resources/blocked-example.html: Added.

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

3 years agoURLParser should not consider path of URLs with no host to start at the first slash...
commit-queue@webkit.org [Thu, 10 Nov 2016 00:30:31 +0000 (00:30 +0000)]
URLParser should not consider path of URLs with no host to start at the first slash after the colon
https://bugs.webkit.org/show_bug.cgi?id=164555

Patch by Alex Christensen <achristensen@webkit.org> on 2016-11-09
Reviewed by Tim Horton.

LayoutTests/imported/w3c:

* web-platform-tests/url/a-element-expected.txt:
* web-platform-tests/url/a-element-xhtml-expected.txt:
* web-platform-tests/url/url-constructor-expected.txt:

Source/WebCore:

When we see a url that is only scheme:// we treated the // as the path.  Firefox did this with unrecognized schemes,
but based on https://github.com/whatwg/url/issues/148 they seem willing to change.  We had added similar behavior to
URL::parse, and I added this to URLParser in r206783 which this effectively reverts.

Covered by API and layout tests.

* platform/URLParser.cpp:
(WebCore::URLParser::parse):
Don't move m_userStart to m_pathStart back by two when we see an empty host.

Tools:

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

LayoutTests:

* fast/url/segments-expected.txt:
* fast/url/segments-from-data-url-expected.txt:
* fast/loader/url-parse-1-expected.txt:
* fetch/fetch-url-serialization-expected.txt:

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

3 years agoSimplify logic of SecurityOrigin::databaseIdentifier
achristensen@apple.com [Thu, 10 Nov 2016 00:18:54 +0000 (00:18 +0000)]
Simplify logic of SecurityOrigin::databaseIdentifier
https://bugs.webkit.org/show_bug.cgi?id=164565

Reviewed by Brady Eidson.

No change in behavior.

SecurityOrigins with the file scheme need a special database identifier to be backwards-compatible with existing storage.
Instead of determining whether this is a file SecurityOrigin at parsing time and only using that information when
making the database identifier, just determine whether we need this quirk when making the database identifier.
I'm planning to move this logic to SecurityOriginData in another patch.

* page/SecurityOrigin.cpp:
(WebCore::SecurityOrigin::SecurityOrigin):
(WebCore::SecurityOrigin::create):
(WebCore::SecurityOrigin::databaseIdentifier):
* page/SecurityOrigin.h:

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

3 years agoUnreviewed, build fix after r208460
ljaehun.lim@samsung.com [Thu, 10 Nov 2016 00:11:30 +0000 (00:11 +0000)]
Unreviewed, build fix after r208460

isValidColorString() was renamed isValidSimpleColorString().

* html/ColorInputType.cpp:
(WebCore::ColorInputType::suggestions):

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

3 years agoFix Windows build after r208499
achristensen@apple.com [Wed, 9 Nov 2016 23:59:58 +0000 (23:59 +0000)]
Fix Windows build after r208499
https://bugs.webkit.org/show_bug.cgi?id=164562

* WebKitDLL.cpp:
(shutDownWebKit):

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

3 years agoFix STP build.
andersca@apple.com [Wed, 9 Nov 2016 23:51:28 +0000 (23:51 +0000)]
Fix STP build.

* WebCorePrefix.h:

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