WebKit-https.git
4 years agoREGRESSION (Safari 10 combined with WK changes): Unable to store WebCrypto keys in...
beidson@apple.com [Fri, 30 Sep 2016 22:38:58 +0000 (22:38 +0000)]
REGRESSION (Safari 10 combined with WK changes): Unable to store WebCrypto keys in IndexedDB database.
<rdar://problem/28334440> and https://bugs.webkit.org/show_bug.cgi?id=162554

Reviewed by Alexey Proskuryakov.

Safari 10 has a WKPageNavigation client but does not implement the "copyWebCryptoMasterKey" callback.

WebKit just fails in this case, instead of falling back to "getDefaultWebCryptoMasterKey".
It should fall back.

Additionally there's a WKContextClient callback to get the crypto key, also, but it is completely unused.
So it should be pulled.

* UIProcess/API/APILoaderClient.h:
(API::LoaderClient::webCryptoMasterKey): Deleted.
* UIProcess/API/C/WKContext.h:

* UIProcess/API/C/WKPage.cpp:
(WKPageSetPageLoaderClient):
(WKPageSetPageNavigationClient): If the client doesn't implement this method, fallback to getDefaultWebCryptoMasterKey.

* UIProcess/Cocoa/NavigationState.mm:
(WebKit::NavigationState::NavigationClient::webCryptoMasterKey): If the client doesn't implement this method,
  fallback to getDefaultWebCryptoMasterKey.

* UIProcess/WebContextClient.cpp:
(WebKit::WebContextClient::copyWebCryptoMasterKey): Deleted.
* UIProcess/WebContextClient.h:

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::wrapCryptoKey): Only ask the NavigationClient before falling back. Don't ask the loader client.
(WebKit::WebPageProxy::unwrapCryptoKey): Ditto.

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

4 years agoThe dragged image should be the current frame only of the animated image
commit-queue@webkit.org [Fri, 30 Sep 2016 22:30:20 +0000 (22:30 +0000)]
The dragged image should be the current frame only of the animated image
https://bugs.webkit.org/show_bug.cgi?id=162109

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

Source/WebCore:

Instead of creating an NSImage with all the frames for the dragImage,
create an NSImage with the current frame only.

* dom/DataTransferMac.mm:
(WebCore::DataTransfer::createDragImage): Call currentFrameNSImage() to create the dragImage.
* editing/cocoa/HTMLConverter.mm:
(fileWrapperForElement):  Call the Image function with its new name.
* platform/graphics/BitmapImage.h:
* platform/graphics/Image.h:
(WebCore::Image::nsImage): Rename getNSImage() to nsImage().
(WebCore::Image::currentFrameNSImage): Returns the NSImage of the current frame.
(WebCore::Image::tiffRepresentation): Rename getTIFFRepresentation() to tiffRepresentation().
(WebCore::Image::getNSImage): Deleted.
(WebCore::Image::getTIFFRepresentation): Deleted.
* platform/graphics/mac/ImageMac.mm:
(WebCore::BitmapImage::tiffRepresentation): Rename getTIFFRepresentation() to tiffRepresentation().
(WebCore::BitmapImage::nsImage): Rename getNSImage() to nsImage().
(WebCore::BitmapImage::currentFrameNSImage): Returns the NSImage of the current frame.
(WebCore::BitmapImage::getTIFFRepresentation): Deleted.
(WebCore::BitmapImage::getNSImage): Deleted.
* platform/mac/CursorMac.mm:
(WebCore::createCustomCursor): Call currentFrameNSImage() since the cursor does not animate anyway.
* platform/mac/DragImageMac.mm:
(WebCore::createDragImageFromImage): Use currentFrameNSImage() for the dragImage.
* platform/mac/PasteboardMac.mm:
(WebCore::Pasteboard::write): Call the Image function with its new name.

Source/WebKit/mac:

* DOM/DOM.mm:
(-[DOMElement image]): Call the Image function with its new name.
(-[DOMElement _imageTIFFRepresentation]): Ditto.
* Misc/WebElementDictionary.mm:
(-[WebElementDictionary _image]): Call the Image function with its new name.
* Misc/WebIconDatabase.mm:
(-[WebIconDatabase defaultIconWithSize:]): Call currentFrameNSImage() to create the icon image.
(webGetNSImage): Call the Image function with its new name.
* WebCoreSupport/WebContextMenuClient.mm:
(WebContextMenuClient::imageForCurrentSharingServicePickerItem): Call currentFrameNSImage() instead of nsImage()..
(WebContextMenuClient::contextMenuForEvent): Ditto.
* WebView/WebHTMLView.mm:
(-[WebHTMLView pasteboard:provideDataForType:]): Call the Image function with its new name.

Source/WebKit2:

* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::provideDataForPasteboard): Call the Image function with its new name.

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

4 years agoB3::moveConstants should be able to edit code to minimize the number of constants
fpizlo@apple.com [Fri, 30 Sep 2016 22:29:24 +0000 (22:29 +0000)]
B3::moveConstants should be able to edit code to minimize the number of constants
https://bugs.webkit.org/show_bug.cgi?id=162764

Reviewed by Saam Barati.

Source/JavaScriptCore:

There are some interesting cases where we can reduce the number of constant materializations if
we teach moveConstants() how to edit code. The two examples that this patch supports are:

    - Loads and stores from a constant pointer. Since loads and stores get an offset for free
      and the instruction selector is really good at handling it, and since we can query Air to
      see what kinds of offsets are legal, we can sometimes avoid using a constant pointer that
      is specific to the absolute address of that load and instead pick some other constant
      that is within offset distance of ours.

    - Add and Sub by a constant (x + c, x - c). Since x + c = x - -c and x - c = x + -c, we can
      flip Add to Sub or vice versa if the negated constant is available.

This change makes moveConstants() pick the most dominant constant that works for an value. In
the case of memory accesses, it uses Air::Arg::isValidAddrForm() to work out what other
constants would work. In the case of Add/Sub, it simply looks for the negated constant. This
should result in something like a minimal number of constants since these rules always pick the
most dominant constant that works - so if an Add's constant is already most dominant then
nothing changes, but if the negated one is more dominant then it becomes a Sub.

This is a 0.5% speed-up on LongSpider and neutral elsewhere. It's a speed-up because the
absolute address thing reduces the number of address materializations that we have to do, while
the add/sub thing prevents us from having to materialize 0x1000000000000 to box doubles.
However, this may introduce a pathology, which I've filed a bug for: bug 162796.

* b3/B3MoveConstants.cpp:
* b3/B3MoveConstants.h:
* b3/B3UseCounts.h:
* b3/air/AirFixObviousSpills.cpp:
* b3/testb3.cpp:
(JSC::B3::testMoveConstants):
(JSC::B3::run):

Source/WTF:

I thought it would be a good idea to document the fact that dominator traversal happens in a
particular order for a reason.

* wtf/Dominators.h:

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

4 years ago[iOS] Allow sequence<Touch> input in TouchEvent constructor
cdumez@apple.com [Fri, 30 Sep 2016 22:21:59 +0000 (22:21 +0000)]
[iOS] Allow sequence<Touch> input in TouchEvent constructor
https://bugs.webkit.org/show_bug.cgi?id=162806
<rdar://problem/28566429>

Reviewed by Ryosuke Niwa.

Allow sequence<Touch> input in TouchEvent constructor in addition to
TouchList objects. It is convenient for developers to pass arrays of
Touch objects.

No new tests, already covered by:
imported/w3c/web-platform-tests/touch-events/touch-touchevent-constructor.html

* bindings/js/JSDOMBinding.h:
(WebCore::toRefNativeArray):
(WebCore::toRefPtrNativeArray):
* bindings/js/JSDictionary.cpp:
(WebCore::JSDictionary::convertValue):

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

4 years agoMarking http/tests/media/hls/hls-video-resize.html as flaky on mac-wk1.
ryanhaddad@apple.com [Fri, 30 Sep 2016 22:21:40 +0000 (22:21 +0000)]
Marking http/tests/media/hls/hls-video-resize.html as flaky on mac-wk1.
https://bugs.webkit.org/show_bug.cgi?id=162507

Unreviewed test gardening.

* platform/mac-wk1/TestExpectations:

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

4 years agoParse font-variation-settings
mmaxfield@apple.com [Fri, 30 Sep 2016 21:59:15 +0000 (21:59 +0000)]
Parse font-variation-settings
https://bugs.webkit.org/show_bug.cgi?id=162781

Reviewed by Simon Fraser.

Source/WebCore:

CSS Fonts level 4 [1] details the font-variation-settings property which allows variations
to be applied to fonts which accept it. The property accepts a list of key/value
pairs where the keys are four-character Ascii codes and the values are floating
point values. The implementation uses font-feature-settings as a model, but with one
big difference: font-variation-settings can be animated. The set of variation points
are animated individually.

This font variations work is being done behind a run-time switch, which is settable from
the Safari Develop menu.

Now that FontDescription is growing, I'd like to do an investigation into the possibility of
moving some of the rare pieces of it into their own class to reduce memory. However, upon
advice, this investigation will be fairly involved and should be done in its own bug.

Test: fast/text/variations/getComputedStyle.html

* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:
* css/CSSAllInOne.cpp:
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::propertyValue):
* css/CSSFontVariationValue.cpp: Copied from Source/WebCore/platform/graphics/FontTaggedSettings.cpp.
(WebCore::CSSFontVariationValue::CSSFontVariationValue):
(WebCore::CSSFontVariationValue::customCSSText):
(WebCore::CSSFontVariationValue::equals):
* css/CSSFontVariationValue.h: Copied from Source/WebCore/platform/graphics/FontTaggedSettings.cpp.
* css/CSSPropertyNames.in:
* css/CSSValue.cpp:
(WebCore::CSSValue::equals):
(WebCore::CSSValue::cssText):
(WebCore::CSSValue::destroy):
* css/CSSValue.h:
(WebCore::CSSValue::isFontVariationValue):
(WebCore::CSSValue::isFontFeatureValue): Deleted.
* css/StyleBuilderConverter.h:
(WebCore::StyleBuilderConverter::convertFontVariationSettings):
* css/StyleBuilderCustom.h:
(WebCore::StyleBuilderCustom::applyInitialFontVariationSettings):
(WebCore::StyleBuilderCustom::applyInheritFontVariationSettings):
(WebCore::StyleBuilderCustom::applyInheritFontFeatureSettings): Deleted.
* css/parser/CSSParser.cpp:
(WebCore::CSSParserContext::CSSParserContext):
(WebCore::operator==):
(WebCore::CSSParser::parseValue):
(WebCore::CSSParser::parseFontFeatureSettings):
(WebCore::CSSParser::parseFontVariationTag):
(WebCore::CSSParser::parseFontVariationSettings):
* css/parser/CSSParser.h:
* css/parser/CSSParserMode.h:
* platform/graphics/FontCache.h:
(WebCore::FontDescriptionKey::FontDescriptionKey):
(WebCore::FontDescriptionKey::operator==):
(WebCore::FontDescriptionKey::computeHash):
* platform/graphics/FontDescription.cpp:
* platform/graphics/FontDescription.h:
(WebCore::FontDescription::variationSettings):
(WebCore::FontDescription::setVariationSettings):
(WebCore::FontDescription::operator==):
(WebCore::FontDescription::featureSettings): Deleted.
(WebCore::FontDescription::setFeatureSettings): Deleted.
* platform/graphics/FontTaggedSettings.cpp:
(WebCore::FontVariationSettings::hash):
(WebCore::operator<<):
* platform/graphics/FontTaggedSettings.h:

LayoutTests:

* fast/text/variations/getComputedStyle-expected.txt: Added.
* fast/text/variations/getComputedStyle.html: Added.

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

4 years agoMark inspector/debugger/breakpoints tests as slow on release, skipped on debug.
ryanhaddad@apple.com [Fri, 30 Sep 2016 21:53:38 +0000 (21:53 +0000)]
Mark inspector/debugger/breakpoints tests as slow on release, skipped on debug.

Unreviewed test gardening.

* TestExpectations:

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

4 years agoRebaseline results after r206654.
joepeck@webkit.org [Fri, 30 Sep 2016 21:43:53 +0000 (21:43 +0000)]
Rebaseline results after r206654.

Better location for unary expressions.

* js/stack-trace-expected.txt:

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

4 years agoFollowup patch to r206664
mmaxfield@apple.com [Fri, 30 Sep 2016 21:41:23 +0000 (21:41 +0000)]
Followup patch to r206664
https://bugs.webkit.org/show_bug.cgi?id=162774

Unreviewed.

No new tests because there is no behavior change.

* platform/graphics/FontTaggedSettings.h:
(WebCore::FourCharacterTagHashTraits::isDeletedValue): Deleted.

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

4 years agoSecond time going into fullscreen using silverlight, will hide the menu bar and dock...
andersca@apple.com [Fri, 30 Sep 2016 21:32:54 +0000 (21:32 +0000)]
Second time going into fullscreen using silverlight, will hide the menu bar and dock for Safari
https://bugs.webkit.org/show_bug.cgi?id=162805
rdar://problem/28208495

Reviewed by Dan Bernstein.

Turns out that the WindowRef wrappers for full screen NSWindows can end up in the m_windows HashSet,
and never go away.

Fix this by storing the canonical CGWindowIDs in the hash map instead.

* PluginProcess/mac/PluginProcessMac.mm:
(WebKit::cgWindowID):
(WebKit::windowCoversAnyScreen):
(WebKit::FullscreenWindowTracker::windowShown):
(WebKit::FullscreenWindowTracker::windowHidden):

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

4 years agoFix modules tests after r206653 handle breakpoint locations in import/export statements
joepeck@webkit.org [Fri, 30 Sep 2016 21:23:34 +0000 (21:23 +0000)]
Fix modules tests after r206653 handle breakpoint locations in import/export statements
https://bugs.webkit.org/show_bug.cgi?id=162807

Reviewed by Mark Lam.

* parser/ASTBuilder.h:
(JSC::ASTBuilder::createExportDefaultDeclaration):
(JSC::ASTBuilder::createExportLocalDeclaration):
Don't record an extra breakpoint location for the statement
within an export statement.

* parser/Parser.cpp:
(JSC::Parser<LexerType>::parseModuleSourceElements):
Record a pause location for import/export statements.

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

4 years agoFix fast/text/trak-optimizeLegibility.html
mmaxfield@apple.com [Fri, 30 Sep 2016 21:17:47 +0000 (21:17 +0000)]
Fix fast/text/trak-optimizeLegibility.html
https://bugs.webkit.org/show_bug.cgi?id=162779

Reviewed by Simon Fraser.

Source/WebCore:

I accidentally created this test to allow an unnecessary delta
in the width comparison. This covered the fact that the fonts
were not being selected correctly in our testing code. Update the
font selection code to work with system fonts correctly and
update the test to not use a delta when performing width
comparisons.

Test: fast/text/trak-optimizeLegibility.html

* platform/graphics/cocoa/FontCacheCoreText.cpp:
(WebCore::isSystemFont):
(WebCore::platformFontLookupWithFamily):

LayoutTests:

* fast/text/trak-optimizeLegibility.html:
* platform/ios-simulator/fast/text/trak-optimizeLegibility-expected.txt:
* platform/mac-elcapitan/fast/text/trak-optimizeLegibility-expected.txt: Removed.
* platform/mac/fast/text/trak-optimizeLegibility-expected.txt:

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

4 years agoCreate runtime flag for variation font work
mmaxfield@apple.com [Fri, 30 Sep 2016 21:16:07 +0000 (21:16 +0000)]
Create runtime flag for variation font work
https://bugs.webkit.org/show_bug.cgi?id=162780

Reviewed by Alex Christensen.

Source/WebCore:

No new tests because there is no behavior change.

Variation font work should be behind a runtime flag.

* page/Settings.in:
* testing/InternalSettings.cpp:
(WebCore::InternalSettings::Backup::Backup):
(WebCore::InternalSettings::Backup::restoreTo):
(WebCore::InternalSettings::variationFontsEnabled):
(WebCore::InternalSettings::setVariationFontsEnabled):
* testing/InternalSettings.h:
* testing/InternalSettings.idl:

Source/WebKit2:

* Shared/WebPreferencesDefinitions.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):

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

4 years agoTemplatize internal FontFeatureSettings class for variation font support
mmaxfield@apple.com [Fri, 30 Sep 2016 21:11:21 +0000 (21:11 +0000)]
Templatize internal FontFeatureSettings class for variation font support
https://bugs.webkit.org/show_bug.cgi?id=162774

Reviewed by Alex Christensen.

Font features and font variations are similar in that they are identified
by four-character tags and an associated value. However, the value is an
int for font features and is a float for font variations. In order to
simplify code, we can use the same class for both, and use a template
argument to distinguish between the two. Then, typedefs can be used to
name them.

No new tests because there is no behavior change.

* WebCore.xcodeproj/project.pbxproj: Rename FontFeatureSettings.{cpp,h}
to FontTaggedSettings.{cpp,h}
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::propertyValue):
* css/CSSFontFace.h:
* css/CSSFontFaceSource.h:
* css/CSSFontFeatureValue.cpp:
(WebCore::CSSFontFeatureValue::CSSFontFeatureValue):
* css/CSSFontFeatureValue.h:
* css/FontFace.cpp:
(WebCore::FontFace::featureSettings):
* css/parser/CSSParser.cpp:
(WebCore::CSSParser::parseFontFeatureTag):
* loader/cache/CachedFont.h:
* platform/graphics/FontDescription.h:
* platform/graphics/FontFeatureSettings.cpp:
(WebCore::FontFeature::FontFeature): Deleted.
(WebCore::FontFeature::operator==): Deleted.
(WebCore::FontFeature::operator<): Deleted.
(WebCore::FontFeatureSettings::insert): Deleted.
(WebCore::FontFeatureSettings::hash): Deleted.
* platform/graphics/FontFeatureSettings.h: Removed.
(WebCore::fontFeatureTag): Deleted.
(WebCore::FontFeatureTagHash::hash): Deleted.
(WebCore::FontFeatureTagHash::equal): Deleted.
(WebCore::FontFeatureTagHashTraits::constructDeletedValue): Deleted.
(WebCore::FontFeatureTagHashTraits::isDeletedValue): Deleted.
(WebCore::FontFeature::operator!=): Deleted.
(WebCore::FontFeature::tag): Deleted.
(WebCore::FontFeature::value): Deleted.
(WebCore::FontFeature::enabled): Deleted.
(WebCore::FontFeatureSettings::operator==): Deleted.
(WebCore::FontFeatureSettings::operator!=): Deleted.
(WebCore::FontFeatureSettings::size): Deleted.
(WebCore::FontFeatureSettings::operator[]): Deleted.
(WebCore::FontFeatureSettings::at): Deleted.
(WebCore::FontFeatureSettings::begin): Deleted.
(WebCore::FontFeatureSettings::end): Deleted.
* platform/graphics/FontTaggedSettings.cpp: Renamed from Source/WebCore/platform/graphics/FontFeatureSettings.cpp.
(WebCore::FontFeatureSettings::hash):
* platform/graphics/FontTaggedSettings.h: Added.
(WebCore::fontFeatureTag):
(WebCore::FourCharacterTagHash::hash):
(WebCore::FourCharacterTagHash::equal):
(WebCore::FourCharacterTagHashTraits::constructDeletedValue):
(WebCore::FourCharacterTagHashTraits::isDeletedValue):
(WebCore::FontTaggedSetting::operator!=):
(WebCore::FontTaggedSetting::tag):
(WebCore::FontTaggedSetting::value):
(WebCore::FontTaggedSetting::enabled):
(WebCore::FontTaggedSetting<T>::FontTaggedSetting):
(WebCore::=):
(WebCore::FontTaggedSetting<T>::operator<):
(WebCore::FontTaggedSettings::operator==):
(WebCore::FontTaggedSettings::operator!=):
(WebCore::FontTaggedSettings::isEmpty):
(WebCore::FontTaggedSettings::size):
(WebCore::FontTaggedSettings::operator[]):
(WebCore::FontTaggedSettings::at):
(WebCore::FontTaggedSettings::begin):
(WebCore::FontTaggedSettings::end):
(WebCore::FontTaggedSettings<T>::insert):
* platform/graphics/cocoa/FontCacheCoreText.cpp:
(WebCore::tagEquals):
(WebCore::appendOpenTypeFeature):
* platform/graphics/mac/FontCustomPlatformData.h:

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

4 years agoFragment serialization should always use 'xml:' prefix for attributes in XML namespace
cdumez@apple.com [Fri, 30 Sep 2016 21:03:27 +0000 (21:03 +0000)]
Fragment serialization should always use 'xml:' prefix for attributes in XML namespace
https://bugs.webkit.org/show_bug.cgi?id=162803

Reviewed by Sam Weinig.

LayoutTests/imported/w3c:

Rebaseline W3C test now that more checks are passing.

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

Source/WebCore:

Fragment serialization should always use 'xml:' prefix for attributes in XML namespace:
- https://html.spec.whatwg.org/#serialising-html-fragments
"""
If the attribute is in the XML namespace
-> The attribute's serialized name is the string "xml:" followed by the attribute's local name.
"""

- https://www.w3.org/TR/DOM-Parsing/#dfn-concept-xml-serialization-algorithm
"""
If ns is the XML namespace, then let qualified name be the concatenation of the string "xml:"
and the value of node's localName.
"""

Firefox complies with the specification.

No new tests, rebaselined existing test.

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

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

4 years agoUnreviewed, rolling out r206611.
zalan@apple.com [Fri, 30 Sep 2016 20:58:29 +0000 (20:58 +0000)]
Unreviewed, rolling out r206611.

Scroll perf did not recover.

Reverted changeset:

"Unreviewed, rolling out r206483."
https://bugs.webkit.org/show_bug.cgi?id=162750
http://trac.webkit.org/changeset/206611

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

4 years agoRemove ClipRects's custom refcounting.
zalan@apple.com [Fri, 30 Sep 2016 20:52:02 +0000 (20:52 +0000)]
Remove ClipRects's custom refcounting.
https://bugs.webkit.org/show_bug.cgi?id=162798

Reviewed by Simon Fraser.

It's safer to use RefCounted<>.

No change in functionality.

* rendering/RenderLayer.cpp:
(WebCore::ClipRects::ClipRects):
(WebCore::ClipRectsCache::getClipRects):
(WebCore::ClipRectsCache::setClipRects):
(WebCore::ClipRectsCache::getIndex):
(WebCore::RenderLayer::updateClipRects):
(WebCore::ClipRects::ref): Deleted.
(WebCore::ClipRects::deref): Deleted.

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

4 years agoRebaseline js/dom/stack-trace.html after r206654.
ryanhaddad@apple.com [Fri, 30 Sep 2016 20:47:51 +0000 (20:47 +0000)]
Rebaseline js/dom/stack-trace.html after r206654.

Unreviewed test gardening.

* js/dom/stack-trace-expected.txt:

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

4 years agoFileSaver.js does not work in WebKit
cdumez@apple.com [Fri, 30 Sep 2016 20:08:27 +0000 (20:08 +0000)]
FileSaver.js does not work in WebKit
https://bugs.webkit.org/show_bug.cgi?id=162788

Reviewed by Sam Weinig.

Source/WebCore:

FileSaver.js does not work in WebKit:
- https://eligrey.com/demos/FileSaver.js/

It works in Firefox and Chrome, but in WebKit, we were getting a
"Synthetic clicks on anchors that have a download attribute are
ignored." warning. We were too strict in restricting synthetic clicks.
We now allow synthetic clicks as long as they are triggered by a user
gesture.

Test: fast/dom/HTMLAnchorElement/anchor-download-user-triggered-synthetic-click.html

* html/HTMLAnchorElement.cpp:
(WebCore::HTMLAnchorElement::handleClick):

LayoutTests:

Add layout test coverage.

* fast/dom/HTMLAnchorElement/anchor-download-synthetic-click-expected.txt:
* fast/dom/HTMLAnchorElement/anchor-download-user-triggered-synthetic-click-expected.txt: Added.
* fast/dom/HTMLAnchorElement/anchor-download-user-triggered-synthetic-click.html: Added.

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

4 years agoRemove the dumping of the stack back trace in VM::verifyExceptionCheckNeedIsSatisfied().
mark.lam@apple.com [Fri, 30 Sep 2016 19:47:54 +0000 (19:47 +0000)]
Remove the dumping of the stack back trace in VM::verifyExceptionCheckNeedIsSatisfied().
https://bugs.webkit.org/show_bug.cgi?id=162797

Reviewed by Geoffrey Garen.

This is because the RELEASE_ASSERT() that follows immediately after will also
dump the stack back trace.  Hence, the first dump will be redundant.

Also removed an extra space in the dataLog output.

* runtime/VM.cpp:
(JSC::VM::verifyExceptionCheckNeedIsSatisfied):

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

4 years agoMarking fast/images/gif-loop-count.html as flaky on ios-simulator.
ryanhaddad@apple.com [Fri, 30 Sep 2016 19:45:58 +0000 (19:45 +0000)]
Marking fast/images/gif-loop-count.html as flaky on ios-simulator.
https://bugs.webkit.org/show_bug.cgi?id=162739

Unreviewed test gardening.

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

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

4 years agoMarking http/tests/security/cached-cross-origin-preloading-css-stylesheet.html as...
ryanhaddad@apple.com [Fri, 30 Sep 2016 19:43:46 +0000 (19:43 +0000)]
Marking http/tests/security/cached-cross-origin-preloading-css-stylesheet.html as flaky on mac-wk1.
https://bugs.webkit.org/show_bug.cgi?id=162791

Unreviewed test gardening.

* platform/mac-wk1/TestExpectations:

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

4 years agoWeb Inspector: Make debugger stepping highlights work in inline <script>s
joepeck@webkit.org [Fri, 30 Sep 2016 19:24:32 +0000 (19:24 +0000)]
Web Inspector: Make debugger stepping highlights work in inline <script>s
https://bugs.webkit.org/show_bug.cgi?id=162753
<rdar://problem/28551332>

Reviewed by Brian Burg.

* UserInterface/Models/TextRange.js:
(WebInspector.TextRange.prototype.contains):
Check if a given line/column falls within this range.

* UserInterface/Views/SourceCodeTextEditor.js:
(WebInspector.SourceCodeTextEditor.prototype._getAssociatedScript):
If we are in a Document resource find the associated script at a given position.

(WebInspector.SourceCodeTextEditor.prototype.textEditorExecutionHighlightRange):
When comparing offsets to SyntaxTree offsets, the SyntaxTree's offset of 0 is the
first character of the Script, which differs from the current SourceCode's offset.
Adjust the offset by the Script's startOffset.

* UserInterface/Views/TextEditor.js:
(WebInspector.TextEditor.prototype.currentPositionToOriginalPosition):
(WebInspector.TextEditor.prototype._updateExecutionRangeHighlight):
Pass both the original offset and original position to the delegate.

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

4 years agoWeb Inspector: Stepping through `a(); b(); c();` it is unclear where we are and what...
joepeck@webkit.org [Fri, 30 Sep 2016 19:24:29 +0000 (19:24 +0000)]
Web Inspector: Stepping through `a(); b(); c();` it is unclear where we are and what is about to execute
https://bugs.webkit.org/show_bug.cgi?id=161658
<rdar://problem/28181254>

Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

* parser/Parser.cpp:
(JSC::Parser<LexerType>::parseAssignmentExpression):
Updated pause location for unary expressions.

Source/WebInspectorUI:

* UserInterface/Models/Script.js:
(WebInspector.Script.prototype.requestScriptSyntaxTree):
Fix first calls to requestScriptSyntaxTree. They were getting an uncaught
exception because the content argument was missing.

* UserInterface/Models/ScriptSyntaxTree.js:
(WebInspector.ScriptSyntaxTree.prototype.containersOfOffset):
Find all AST nodes that contain a particular offset.

* UserInterface/Views/SourceCodeTextEditor.js:
(WebInspector.SourceCodeTextEditor):
(WebInspector.SourceCodeTextEditor.prototype.close):
(WebInspector.SourceCodeTextEditor.prototype._activeCallFrameDidChange):
(WebInspector.SourceCodeTextEditor.prototype._activeCallFrameSourceCodeLocationChanged):
(WebInspector.SourceCodeTextEditor.prototype.textEditorExecutionHighlightRange):
Provide a good highlight range for a given offset. This is normally the start
of a statement/expression, inside a statement/expression, or the closing brace
of a function (leaving a function). Provide good ranges for each of these.

* UserInterface/Views/TextEditor.js:
(WebInspector.TextEditor):
(WebInspector.TextEditor.set string.update):
(WebInspector.TextEditor.prototype.set string):
(WebInspector.TextEditor.prototype.setExecutionLineAndColumn):
(WebInspector.TextEditor.prototype.revealPosition.revealAndHighlightLine):
(WebInspector.TextEditor.prototype.revealPosition):
(WebInspector.TextEditor.prototype.currentPositionToOriginalOffset):
(WebInspector.TextEditor.prototype._updateAfterFormatting):
(WebInspector.TextEditor.prototype.set executionLineNumber): Deleted.
(WebInspector.TextEditor.prototype.set executionColumnNumber): Deleted.
(WebInspector.TextEditor.prototype._updateExecutionLine.update): Deleted.
Always set the execution line and column together, to simplify how we update highlights.

(WebInspector.TextEditor.prototype._clearMultilineExecutionLineHighlights):
(WebInspector.TextEditor.prototype._updateExecutionLine):
When updating the main highlight clear any multi-line highlights.

(WebInspector.TextEditor.prototype._updateExecutionRangeHighlight):
Ask the delegate for a specific highlight range. If provided use that range,
otherwise just highlight the end of the line. Once we know the range, if it
is multiple lines, give the extra lines the full line highlight as well.
Also make adjustments, such as not highlighting trailing whitespace.

* UserInterface/Views/TextEditor.css:
(.text-editor > .CodeMirror .execution-line.primary .CodeMirror-linenumber::after):
(.text-editor > .CodeMirror .execution-line):
(.text-editor > .CodeMirror .execution-line .CodeMirror-matchingbracket):
(.text-editor > .CodeMirror .execution-range-highlight):
Styles for execution lines and execution range highlights.

LayoutTests:

* inspector/debugger/stepping/stepping-loops-expected.txt:
* inspector/debugger/stepping/stepping-misc-expected.txt:
Updated pause location for unary expressions.

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

4 years agoBreakpoints on blank lines or comments don't break
joepeck@webkit.org [Fri, 30 Sep 2016 19:22:50 +0000 (19:22 +0000)]
Breakpoints on blank lines or comments don't break
https://bugs.webkit.org/show_bug.cgi?id=9885
<rdar://problem/6134406>

Reviewed by Mark Lam.

Source/JavaScriptCore:

This change introduces a way to perform a Debugger Parse of a script.
This debugger parse gathers a list of breakpoint locations, which
the backend uses to resolve breakpoint locations that came from the
Inspector frontend to the exact location we would actually pause.
We gather this information from the parser so that we can eagerly
get this information without requiring the code to have executed (the
real op_debugs are generated during bytecode generation when code
is actually evaluated).

If an input location was on a line with whitespace or a comment, the
resolved breakpoint location would be before the next statement that
will be executed. That may be the next line, or even later. We also
update our policy when setting breakpoints on and around function
statements to better match user expectations.

For example, when resolving breakpoints in:

    1.  // Comment
    2.  before;
    3.
    4.  function foo() {
    5.      inside;
    6.  }
    7.
    8.  after;

A breakpoint on line 1, a comment, resolves to line 2 the next
statement that will execute.

A breakpoint on line 3 or 7, empty lines, resolves to line 8 the next
statement that will execute. This skips past the definition of foo,
just like stepping would have done. The creation of foo would have
been hoisted, which would have happened before execution of the
other statements.

A breakpoint on line 4, a function signature, resolves to line 5,
inside the function. Users would expect to pause inside of a function
when setting a breakpoint on that function's name or opening brace.

A breakpoint on line 6, a function's closing brace, resolves to
line 6. The debugger will pause whenever execution leaves foo due to
a return and not an exception. This matches stepping behavior. An
explicit or implicit return (the implicit return undefined) will
pause on the closing brace as we leave the function, giving users
an opportunity to inspect the final state before leaving.

--

At this point, op_debug's are still emitted at custom locations during
bytecode generation of other statements / expressions. In order to
ensure the generated op_debugs correspond to locations the Parser
determined were breakpoint locations, the Parser sets a "needs debug
hook" flag on the nodes it will use for breakpoint locations, and
we assert during bytecode generation that op_debugs are only emitted
for nodes that were marked as needing debug hooks.

This still leaves open the possibility that the Parser will mark
some nodes that get missed during bytecode generation, so we might
fail to emit some op_debugs. The next step will be eliminating the
custom emitDebugHooks spread across StatementNode and ExpressionNode
subclasses, and instead always generating op_debugs whenever we
emit a flagged node.

--

* CMakeLists.txt:
* JavaScriptCore.xcodeproj/project.pbxproj:
New DebuggerParseData files.

* API/JSScriptRef.cpp:
(OpaqueJSScript::OpaqueJSScript):
* jsc.cpp:
(functionCheckModuleSyntax):
* parser/SourceCode.h:
(JSC::makeSource):
* parser/SourceProvider.cpp:
(JSC::SourceProvider::SourceProvider):
* parser/SourceProvider.h:
(JSC::SourceProvider::sourceType):
(JSC::StringSourceProvider::create):
(JSC::StringSourceProvider::StringSourceProvider):
(JSC::WebAssemblySourceProvider::WebAssemblySourceProvider):
(JSC::SourceProvider::startPosition): Deleted.
Add a new type on SourceProvider to distinguish if its script was
intended to be a Script, Module, or WebAssembly. This information
will be needed to know how to best parse this file when the
debugger decides to lazily parse.

* runtime/Executable.cpp:
(JSC::EvalExecutable::EvalExecutable):
(JSC::ProgramExecutable::ProgramExecutable):
(JSC::ModuleProgramExecutable::ModuleProgramExecutable):
(JSC::WebAssemblyExecutable::WebAssemblyExecutable):
* runtime/ModuleLoaderPrototype.cpp:
(JSC::moduleLoaderPrototypeParseModule):
ASSERT the SourceProvider type matches the executable type we are
creating for it.

* parser/ASTBuilder.h:
(JSC::ASTBuilder::breakpointLocation):
* parser/SyntaxChecker.h:
(JSC::SyntaxChecker::operatorStackPop):
When gathering breakpoint positions, get the position from the
current node. In the SyntaxChecker, return an invalid position.

* parser/Nodes.h:
(JSC::ExpressionNode::needsDebugHook):
(JSC::ExpressionNode::setNeedsDebugHook):
(JSC::StatementNode::needsDebugHook):
(JSC::StatementNode::setNeedsDebugHook):
When gathering breakpoint positions, mark the node as needing
a debug hook. For now we assert op_debugs generated must come
from these nodes. Later we should just generate op_debugs for
these nodes.

* parser/Parser.cpp:
(JSC::Parser<LexerType>::Parser):
(JSC::Parser<LexerType>::parseStatementListItem):
(JSC::Parser<LexerType>::parseDoWhileStatement):
(JSC::Parser<LexerType>::parseWhileStatement):
(JSC::Parser<LexerType>::parseArrowFunctionSingleExpressionBodySourceElements):
(JSC::Parser<LexerType>::parseForStatement):
(JSC::Parser<LexerType>::parseWithStatement):
(JSC::Parser<LexerType>::parseSwitchStatement):
(JSC::Parser<LexerType>::parseStatement):
(JSC::Parser<LexerType>::parseFunctionBody):
(JSC::Parser<LexerType>::parseFunctionInfo):
(JSC::Parser<LexerType>::parseIfStatement):
(JSC::Parser<LexerType>::parseAssignmentExpression):
* parser/Parser.h:
(JSC::parse):
Add an optional DebuggerParseData struct to the Parser. When available
the Parser will gather debugger data, and parse all functions with the
ASTBuilder instead of SyntaxChecking inner functions.

* debugger/DebuggerParseData.cpp: Added.
(JSC::DebuggerPausePositions::breakpointLocationForLineColumn):
(JSC::DebuggerPausePositions::sort):
(JSC::gatherDebuggerParseData):
(JSC::gatherDebuggerParseDataForSource):
* debugger/DebuggerParseData.h: Copied from Source/JavaScriptCore/debugger/DebuggerPrimitives.h.
(JSC::DebuggerPausePositions::DebuggerPausePositions):
(JSC::DebuggerPausePositions::appendPause):
(JSC::DebuggerPausePositions::appendEntry):
(JSC::DebuggerPausePositions::appendLeave):
The DebuggerParseData struct currently only contains a list of pause positions.
Once populated it can resolve an input location to a pause position.

* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::emitCall):
(JSC::BytecodeGenerator::emitCallVarargs):
(JSC::BytecodeGenerator::emitDebugHook):
(JSC::BytecodeGenerator::emitEnumeration):
* bytecompiler/BytecodeGenerator.h:
* bytecompiler/NodesCodegen.cpp:
(JSC::EmptyStatementNode::emitBytecode):
(JSC::DebuggerStatementNode::emitBytecode):
(JSC::ExprStatementNode::emitBytecode):
(JSC::DeclarationStatement::emitBytecode):
(JSC::IfElseNode::emitBytecode):
(JSC::DoWhileNode::emitBytecode):
(JSC::WhileNode::emitBytecode):
(JSC::ForNode::emitBytecode):
(JSC::ForInNode::emitBytecode):
(JSC::ContinueNode::emitBytecode):
(JSC::BreakNode::emitBytecode):
(JSC::ReturnNode::emitBytecode):
(JSC::WithNode::emitBytecode):
(JSC::SwitchNode::emitBytecode):
(JSC::ThrowNode::emitBytecode):
Emit op_debugs for the nodes themselves. Assert when we do that the
Parser had marked them as needing a debug hook.

* debugger/Breakpoint.h:
(JSC::Breakpoint::Breakpoint):
A breakpoint may be resolved or unresolved. Debugger::resolveBreakpoint
must be used to resolve the breakpoint. Most methods now require a
resolved breakpoint.

* debugger/Debugger.h:
* debugger/Debugger.cpp:
(JSC::Debugger::detach):
(JSC::Debugger::toggleBreakpoint):
(JSC::Debugger::debuggerParseData):
(JSC::Debugger::resolveBreakpoint):
(JSC::Debugger::setBreakpoint):
(JSC::Debugger::clearParsedData):
Provide a public method to resolve a breakpoint location in a script.
This will gather debugger parse data for the script if none is available.
Ensure clients have resolved a breakpoint before attempting to set it.
Currently we allow only a single breakpoint at a location. This may
need to change if multiple breakpoints resolve to the same location
but have different actions.

* inspector/ScriptDebugListener.h:
ScriptDebugServer::Script is effectively duplicating most of the data from
a SourceProvider. We should eliminate this and just use SourceProvider.

* inspector/ScriptDebugServer.cpp:
(Inspector::ScriptDebugServer::setBreakpointActions):
(Inspector::ScriptDebugServer::removeBreakpointActions):
(Inspector::ScriptDebugServer::getActionsForBreakpoint):
(Inspector::ScriptDebugServer::clearBreakpointActions):
(Inspector::ScriptDebugServer::evaluateBreakpointAction):
(Inspector::ScriptDebugServer::dispatchDidParseSource):
(Inspector::ScriptDebugServer::handleBreakpointHit):
(Inspector::ScriptDebugServer::setBreakpoint): Deleted.
(Inspector::ScriptDebugServer::removeBreakpoint): Deleted.
(Inspector::ScriptDebugServer::clearBreakpoints): Deleted.
* inspector/ScriptDebugServer.h:
Reduce ScriptDebugServer's involvement in breakpoints to just handling
breakpoint actions. Eventually we should eliminate it alltogether and
fold breakpoint logic into Debugger or DebugAgent.

* inspector/agents/InspectorDebuggerAgent.h:
* inspector/agents/InspectorDebuggerAgent.cpp:
(Inspector::buildDebuggerLocation):
(Inspector::parseLocation):
(Inspector::InspectorDebuggerAgent::setBreakpointByUrl):
(Inspector::InspectorDebuggerAgent::setBreakpoint):
(Inspector::InspectorDebuggerAgent::didSetBreakpoint):
(Inspector::InspectorDebuggerAgent::resolveBreakpoint):
(Inspector::InspectorDebuggerAgent::removeBreakpoint):
(Inspector::InspectorDebuggerAgent::continueToLocation):
(Inspector::InspectorDebuggerAgent::didParseSource):
(Inspector::InspectorDebuggerAgent::clearDebuggerBreakpointState):
The Inspector can set breakpoints in multiple ways.
Ensure that once we have the Script that we always
resolve the breakpoint location before setting the
breakpoint. The different paths are:

- setBreakpoint(scriptId, location)
  - Here we know the SourceProvider by its SourceID
    - resolve and set

- setBreakpointByURL(url, location)
  - Search for existing Scripts that match the URL
    - resolve in each and set
  - When new Scripts are parsed that match the URL
    - resolve and set

Source/WebCore:

Tests: inspector/debugger/breakpoints/resolved-dump-all-pause-locations.html
       inspector/debugger/breakpoints/resolved-dump-each-line.html

* bindings/js/CachedScriptSourceProvider.h:
(WebCore::CachedScriptSourceProvider::CachedScriptSourceProvider):

LayoutTests:

* inspector/debugger/breakpoints/resolved-dump-all-pause-locations-expected.txt: Added.
* inspector/debugger/breakpoints/resolved-dump-all-pause-locations.html: Added.
* inspector/debugger/breakpoints/resolved-dump-each-line-expected.txt: Added.
* inspector/debugger/breakpoints/resolved-dump-each-line.html: Added.
* inspector/debugger/breakpoints/resources/dump-functions.js: Added.
* inspector/debugger/breakpoints/resources/dump-general.js: Added.
Test for resolved breakpoint locations in all kinds of different source code.

* inspector/debugger/breakpoints/resources/dump.js: Added.
(TestPage.registerInitializer):
(TestPage.registerInitializer.window.addDumpAllPauseLocationsTestCase):
(TestPage.registerInitializer.window.addDumpEachLinePauseLocationTestCase):
Shared code to run different generalized tests for logging all resolved
breakpoint locations or the resolved breakpoint location if a breakpoint
is set on each individual line.

* inspector/debugger/resources/log-pause-location.js:
(TestPage.registerInitializer.insertCaretIntoStringAtIndex):
(TestPage.registerInitializer.window.findScript):
(TestPage.registerInitializer.window.loadLinesFromSourceCode):
(TestPage.registerInitializer.window.loadMainPageContent):
(TestPage.registerInitializer.window.logResolvedBreakpointLinesWithContext):
(TestPage.registerInitializer.window.logLinesWithContext):
Make some more code shared and provide a way to log two locations,
used to see where a breakpoint was set and where it resolved to.

* inspector/debugger/setBreakpoint-expected.txt:
Update error message. Should not include a period.

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

4 years agoWeb Inspector: Stepping out of a function finishes the line that called it.
joepeck@webkit.org [Fri, 30 Sep 2016 19:22:37 +0000 (19:22 +0000)]
Web Inspector: Stepping out of a function finishes the line that called it.
https://bugs.webkit.org/show_bug.cgi?id=155325
<rdar://problem/25094578>

Reviewed by Mark Lam.

Source/JavaScriptCore:

Also addresses:
<https://webkit.org/b/161721> Web Inspector: Stepping all the way through program should not cause a pause on the next program that executes
<https://webkit.org/b/161716> Web Inspector: Stepping into a function / program should not require stepping to the first statement

This change introduces a new op_debug hook: WillExecuteExpression.
Currently this new hook is only used for pausing at function calls.
We may decide to add it to other places later where pausing with
finer granularity then statements (or lines) if useful.

This updates the location and behavior of some of the existing debug
hooks, to be more consistent and useful if the exact location of the
pause is displayed. For example, in control flow statements like
`if` and `while`, the pause location is the expression itself that
will be evaluated, not the location of the `if` or `while` keyword.
For example:

    if (|condition)
    while (|condition)

Finally, this change gets rid of some unnecessary / useless pause
locations such as on entering a function and on entering a program.
These pauses are not needed because if there is a statement, we
would pause before the statement and it is equivalent. We continue
to pause when leaving a function via stepping by uniformly jumping
to the closing brace of the function. This gives users a chance
to observe state before leaving the function.

* bytecode/CodeBlock.cpp:
(JSC::debugHookName):
* bytecode/UnlinkedCodeBlock.cpp:
(JSC::dumpLineColumnEntry):
Logging strings for the new debug hook.

* bytecompiler/BytecodeGenerator.h:
* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::emitCallInTailPosition):
(JSC::BytecodeGenerator::emitCallEval):
(JSC::BytecodeGenerator::emitCallVarargsInTailPosition):
(JSC::BytecodeGenerator::emitConstructVarargs):
(JSC::BytecodeGenerator::emitCallForwardArgumentsInTailPosition):
(JSC::BytecodeGenerator::emitCallDefineProperty):
(JSC::BytecodeGenerator::emitConstruct):
(JSC::BytecodeGenerator::emitGetTemplateObject):
(JSC::BytecodeGenerator::emitIteratorNext):
(JSC::BytecodeGenerator::emitIteratorNextWithValue):
(JSC::BytecodeGenerator::emitIteratorClose):
(JSC::BytecodeGenerator::emitDelegateYield):
All emitCall variants now take an enum to decide whether or not to
emit the WillExecuteExpression debug hook.

(JSC::BytecodeGenerator::emitCall):
(JSC::BytecodeGenerator::emitCallVarargs):
In the two real implementations, actually decide to emit the debug
hook or not based on the parameter.

(JSC::BytecodeGenerator::emitEnumeration):
This is shared looping code used by for..of iteration of iterables.
When used by ForOfNode, we want to emit a pause location during
iteration.

(JSC::BytecodeGenerator::emitWillLeaveCallFrameDebugHook):
This is shared call frame leave code to emit a consistent pause
location when leaving a function.

* bytecompiler/NodesCodegen.cpp:
(JSC::EvalFunctionCallNode::emitBytecode):
(JSC::FunctionCallValueNode::emitBytecode):
(JSC::FunctionCallResolveNode::emitBytecode):
(JSC::BytecodeIntrinsicNode::emit_intrinsic_tailCallForwardArguments):
(JSC::FunctionCallBracketNode::emitBytecode):
(JSC::FunctionCallDotNode::emitBytecode):
(JSC::CallFunctionCallDotNode::emitBytecode):
(JSC::ApplyFunctionCallDotNode::emitBytecode):
(JSC::TaggedTemplateNode::emitBytecode):
(JSC::ArrayPatternNode::bindValue):
All tail position calls are the function calls that we want to emit
debug hooks for. All non-tail call calls appear to be internal
implementation details, and these should not have the debug hook.

(JSC::IfElseNode::emitBytecode):
(JSC::WhileNode::emitBytecode):
(JSC::WithNode::emitBytecode):
(JSC::SwitchNode::emitBytecode):
Make the pause location consistent at the expression.

(JSC::DoWhileNode::emitBytecode):
Make the pause location consistent at the expression.
Remove the errant pause at the do's '}' when entering the do block.

(JSC::ForNode::emitBytecode):
(JSC::ForInNode::emitMultiLoopBytecode):
(JSC::ForOfNode::emitBytecode):
Make the pause location consistent at expressions.
Also allow stepping to the traditional for loop's
update expression, which was previously not possible.

(JSC::ReturnNode::emitBytecode):
(JSC::FunctionNode::emitBytecode):
Make the pause location when leaving a function consistently be the
function's closing brace. The two cases are stepping through a return
statement, or the implicit return undefined at the end of a function.

(JSC::LabelNode::emitBytecode):
(JSC::TryNode::emitBytecode):
Remove unnecessary pauses that add no value, as they contain a
statement and we will then pause at that statement.

* parser/Nodes.h:
(JSC::StatementNode::isFunctionNode):
(JSC::StatementNode::isForOfNode):
(JSC::EnumerationNode::lexpr):
(JSC::ForOfNode::isForOfNode):
New virtual methods to distinguish different nodes.

* debugger/Debugger.h:
Rename m_pauseAtNextStatement to m_pauseAtNextOpportunity.
This is the finest granularity of stepping, and it can be
pausing at a location that is not a statement.
Introduce state to properly handle step out and stepping
when there are multiple expressions in a statement.

* debugger/Debugger.cpp:
(JSC::Debugger::Debugger):
(JSC::Debugger::setPauseOnNextStatement):
(JSC::Debugger::breakProgram):
(JSC::Debugger::continueProgram):
(JSC::Debugger::stepIntoStatement):
(JSC::Debugger::exception):
(JSC::Debugger::didReachBreakpoint):

Use new variable names, and clarify if we should attempt
to pause or not.

(JSC::Debugger::stepOutOfFunction):
Set a new state to indicate a step out action.

(JSC::Debugger::updateCallFrame):
(JSC::Debugger::updateCallFrameAndPauseIfNeeded): Deleted.
(JSC::Debugger::updateCallFrameInternal):
(JSC::Debugger::pauseIfNeeded):
Allow updateCallFrame to either attempt a pause or not.

(JSC::Debugger::atStatement):
Attempt pause and reset the at first expression flag.

(JSC::Debugger::atExpression):
Attempt a pause when not stepping over. Also skip
the first expression pause, since that would be
equivalent to when we paused for the expression.

(JSC::Debugger::callEvent):
Do not pause when entering a function.

(JSC::Debugger::returnEvent):
Attempt pause when leaving a function.
If the user did a step-over and is leaving the
function, then behave like step-out.

(JSC::Debugger::unwindEvent):
Behave like return except don't change any
pausing states. If we needed to pause the
Debugger::exception will have handled it.

(JSC::Debugger::willExecuteProgram):
Do not pause when entering a program.

(JSC::Debugger::didExecuteProgram):
Attempt pause when leaving a program that has a caller.
This can be useful for exiting an eval(...) program.
Otherwise treat this like return, and step-over out
of the program should behave like step-out. We use
pause at next opportunity because there may be extra
callframes we do not know about.
When the program doesn't have a parent, clear all
our state so we don't errantly pause on the next
JavaScript microtask that gets executed.

(JSC::Debugger::clearNextPauseState):
Helper to clear all of the pause states now that
it happens in a couple places.

* interpreter/Interpreter.cpp:
(JSC::notifyDebuggerOfUnwinding):
Treat unwinding slightly differently from returning.
We will not want to pause when unwinding callframes.

(JSC::Interpreter::debug):
* interpreter/Interpreter.h:
New debug hook.

* inspector/agents/InspectorDebuggerAgent.cpp:
(Inspector::InspectorDebuggerAgent::stepInto):
(Inspector::InspectorDebuggerAgent::didPause):
* inspector/agents/InspectorDebuggerAgent.h:
Remove unnecessary stepInto code notification for listeners.
The listeners are never notified if the debugger resumes,
so whatever state they were setting by this is going to
get out of date.

Source/WebCore:

Tests: inspector/debugger/stepping/stepInto.html
       inspector/debugger/stepping/stepOut.html
       inspector/debugger/stepping/stepOver.html
       inspector/debugger/stepping/stepping-arrow-functions.html
       inspector/debugger/stepping/stepping-classes.html
       inspector/debugger/stepping/stepping-control-flow.html
       inspector/debugger/stepping/stepping-function-calls.html
       inspector/debugger/stepping/stepping-function-default-parameters.html
       inspector/debugger/stepping/stepping-literal-construction.html
       inspector/debugger/stepping/stepping-loops.html
       inspector/debugger/stepping/stepping-misc.html
       inspector/debugger/stepping/stepping-switch.html
       inspector/debugger/stepping/stepping-template-string.html
       inspector/debugger/stepping/stepping-try-catch-finally.html

* inspector/InspectorDOMDebuggerAgent.h:
* inspector/InspectorDOMDebuggerAgent.cpp:
(WebCore::InspectorDOMDebuggerAgent::stepInto): Deleted.
Setting this state in step-into does not make sense since we do not
know when the debugger resumes and won't know when to clear it.

LayoutTests:

* inspector/debugger/break-on-exception-throw-in-promise.html:
Drive-by remove debug only code that shouldn't have been checked in.

* inspector/debugger/resources/log-pause-location.js: Added.
(TestPage.registerInitializer.String.prototype.myPadStart):
(TestPage.registerInitializer.insertCaretIntoStringAtIndex):
(TestPage.registerInitializer.logLinesWithContext):
(TestPage.registerInitializer.window.logPauseLocation):
(TestPage.registerInitializer.window.step):
(TestPage.registerInitializer.window.initializeSteppingTestSuite):
(TestPage.registerInitializer.window.addSteppingTestCase):
(TestPage.registerInitializer.window.loadMainPageContent):
Shared code for stepping tests that runs in the inspected page.

(global):
When the test page is loaded outside of the test runner,
create buttons for each of the different entry test functions.
This makes it very easy to inspect the test page and run
through an individual test.

* inspector/debugger/stepping/stepInto-expected.txt: Added.
* inspector/debugger/stepping/stepInto.html: Added.
* inspector/debugger/stepping/stepOut-expected.txt: Added.
* inspector/debugger/stepping/stepOut.html: Added.
* inspector/debugger/stepping/stepOver-expected.txt: Added.
* inspector/debugger/stepping/stepOver.html: Added.
* inspector/debugger/stepping/stepping-arrow-functions-expected.txt: Added.
* inspector/debugger/stepping/stepping-arrow-functions.html: Added.
* inspector/debugger/stepping/stepping-classes-expected.txt: Added.
* inspector/debugger/stepping/stepping-classes.html: Added.
* inspector/debugger/stepping/stepping-control-flow-expected.txt: Added.
* inspector/debugger/stepping/stepping-control-flow.html: Added.
* inspector/debugger/stepping/stepping-function-calls-expected.txt: Added.
* inspector/debugger/stepping/stepping-function-calls.html: Added.
* inspector/debugger/stepping/stepping-function-default-parameters-expected.txt: Added.
* inspector/debugger/stepping/stepping-function-default-parameters.html: Added.
* inspector/debugger/stepping/stepping-literal-construction-expected.txt: Added.
* inspector/debugger/stepping/stepping-literal-construction.html: Added.
* inspector/debugger/stepping/stepping-loops-expected.txt: Added.
* inspector/debugger/stepping/stepping-loops.html: Added.
* inspector/debugger/stepping/stepping-misc-expected.txt: Added.
* inspector/debugger/stepping/stepping-misc.html: Added.
* inspector/debugger/stepping/stepping-switch-expected.txt: Added.
* inspector/debugger/stepping/stepping-switch.html: Added.
* inspector/debugger/stepping/stepping-template-string-expected.txt: Added.
* inspector/debugger/stepping/stepping-template-string.html: Added.
* inspector/debugger/stepping/stepping-try-catch-finally-expected.txt: Added.
* inspector/debugger/stepping/stepping-try-catch-finally.html: Added.
Test stepping in different common scenarios.

* inspector/debugger/regress-133182.html:
* inspector/debugger/regress-133182-expected.txt:
* inspector/debugger/tail-deleted-frames-from-vm-entry-expected.txt:
* inspector/debugger/tail-deleted-frames-from-vm-entry.html:
Rebaseline. No need for a double step. And the second pause doesn't make any sense
in the tail deleted frames test.

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

4 years ago[WK2][iOS] Add radiusX / radiusY / rotationAngle to WebPlatformTouchPoint
cdumez@apple.com [Fri, 30 Sep 2016 19:19:44 +0000 (19:19 +0000)]
[WK2][iOS] Add radiusX / radiusY / rotationAngle to WebPlatformTouchPoint
https://bugs.webkit.org/show_bug.cgi?id=162787
<rdar://problem/28554292>

Reviewed by Benjamin Poulain.

Source/WebKit2:

Add radiusX / radiusY / rotationAngle to WebPlatformTouchPoint.

* Platform/spi/ios/UIKitSPI.h:
* Shared/WebEvent.h:
(WebKit::WebPlatformTouchPoint::setRadiusX):
(WebKit::WebPlatformTouchPoint::radiusX):
(WebKit::WebPlatformTouchPoint::setRadiusY):
(WebKit::WebPlatformTouchPoint::radiusY):
(WebKit::WebPlatformTouchPoint::setRotationAngle):
(WebKit::WebPlatformTouchPoint::rotationAngle):
* Shared/WebEventConversion.cpp:
(WebKit::WebKit2PlatformTouchPoint::WebKit2PlatformTouchPoint):
* Shared/ios/NativeWebTouchEventIOS.mm:
(WebKit::NativeWebTouchEvent::extractWebTouchPoint):
* Shared/ios/WebPlatformTouchPointIOS.cpp:
(WebKit::WebPlatformTouchPoint::encode):
(WebKit::WebPlatformTouchPoint::decode):

LayoutTests:

Extend Touch constructor test coverage to cover radiusX / radiusY / rotationAngle
attributes.

* fast/events/touch/touch-constructor.html:

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

4 years agoFix off-by-one error in URLParser::parseIPv4Host
achristensen@apple.com [Fri, 30 Sep 2016 18:50:49 +0000 (18:50 +0000)]
Fix off-by-one error in URLParser::parseIPv4Host
https://bugs.webkit.org/show_bug.cgi?id=162789

Reviewed by Tim Horton.

Source/WebCore:

The spec says "If any but the last item in numbers is greater than 255, return failure."
This means check up to size - 1, not size - 2.

Covered by a new API test.

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

Tools:

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

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

4 years agoURLParser: parsing a URL with an empty host and a colon should fail
achristensen@apple.com [Fri, 30 Sep 2016 18:48:28 +0000 (18:48 +0000)]
URLParser: parsing a URL with an empty host and a colon should fail
https://bugs.webkit.org/show_bug.cgi?id=162795

Reviewed by Tim Horton.

Source/WebCore:

Covered by new API tests.

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

Tools:

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

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

4 years agoURLParser: handle syntax violations in non-UTF-8 encoded queries
achristensen@apple.com [Fri, 30 Sep 2016 18:46:28 +0000 (18:46 +0000)]
URLParser: handle syntax violations in non-UTF-8 encoded queries
https://bugs.webkit.org/show_bug.cgi?id=162770

Reviewed by Tim Horton.

Source/WebCore:

There is a fast path for queries of URLs that use UTF-8 encoding, which are quite common.
For non-UTF-8 encoded queries, which are less common, we put the code points in a Vector<UChar>
and encode them all at once.  If there is a syntax violation in the query, we need to copy the
syntax-violation-free string up to the beginning of the query, then encode the query.

Covered by new API tests.

* platform/URLParser.cpp:
(WebCore::URLParser::percentEncodeByte):
(WebCore::URLParser::encodeQuery):
(WebCore::URLParser::parse):
* platform/URLParser.h:

Tools:

* TestWebKitAPI/Tests/WebCore/URLParser.cpp:
(TestWebKitAPI::checkURL):
(TestWebKitAPI::TEST_F):
Tests with emoji change behavior when we insert a tab between the surrogates, so don't do the
insert-tab-at-each-location verification that syntax violations are handled correctly.

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

4 years agoArrow functions should not allow duplicate parameter names
sbarati@apple.com [Fri, 30 Sep 2016 18:44:16 +0000 (18:44 +0000)]
Arrow functions should not allow duplicate parameter names
https://bugs.webkit.org/show_bug.cgi?id=162741

Reviewed by Filip Pizlo.

JSTests:

* test262.yaml:

Source/JavaScriptCore:

This patch makes parsing arrow function parameters throw
a syntax error when there are duplicate parameter names.
It also starts to make some syntax errors for arrow functions
better, however, this is trickier than it seems since we need
to choose between two parsing productions when we decide to
throw a syntax error. I'm going to work on this problem
in another patch specifically devoted to making the error
messages better for parsing arrow functions:
https://bugs.webkit.org/show_bug.cgi?id=162794

* parser/Parser.cpp:
(JSC::Parser<LexerType>::isArrowFunctionParameters):
(JSC::Parser<LexerType>::parseFormalParameters):
(JSC::Parser<LexerType>::parseFunctionParameters):
(JSC::Parser<LexerType>::parseAssignmentExpression):
* parser/Parser.h:

LayoutTests:

* js/parser-syntax-check-expected.txt:
* js/script-tests/parser-syntax-check.js:

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

4 years agoMake some microbenchmarks run for less time.
sbarati@apple.com [Fri, 30 Sep 2016 18:39:59 +0000 (18:39 +0000)]
Make some microbenchmarks run for less time.

Rubber stamped by Filip Pizlo.

* microbenchmarks/bound-function-construction-performance.js:
(foo):
* microbenchmarks/getter-richards-try-catch.js:

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

4 years agoMake it possible to test web-related user-interface features
commit-queue@webkit.org [Fri, 30 Sep 2016 18:39:30 +0000 (18:39 +0000)]
Make it possible to test web-related user-interface features
https://bugs.webkit.org/show_bug.cgi?id=162657

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

Source/WebKit2:

Added the ability to pull the strings from an Action Sheet and pass them to
test scripts to make sure we are giving the correct available actions for
the item we are interacting with.
Added a test for long press on an image, and used the sheet scraping functionality
to make sure that the correct actions were being displayed.
Test for previous patch, Changeset 205915; Bug 161761

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _contentsOfUserInterfaceItem:]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/ios/WKActionSheetAssistant.h:
* UIProcess/ios/WKActionSheetAssistant.mm:
(-[WKActionSheetAssistant currentAvailableActionStrings]):
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _contentsOfUserInterfaceItem:]):

Tools:

* DumpRenderTree/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptController::contentsOfUserInterfaceItem):
(WTR::UIScriptController::selectFormAccessoryPickerRow): Deleted.
* TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
* TestRunnerShared/UIScriptContext/UIScriptController.cpp:
(WTR::UIScriptController::contentsOfUserInterfaceItem):
(WTR::UIScriptController::selectFormAccessoryPickerRow): Deleted.
* TestRunnerShared/UIScriptContext/UIScriptController.h:
* WebKitTestRunner/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptController::contentsOfUserInterfaceItem):
(WTR::UIScriptController::selectFormAccessoryPickerRow): Deleted.

LayoutTests:

* fast/events/touch/ios/long-press-on-image-expected.txt: Added.
* fast/events/touch/ios/long-press-on-image.html: Added.

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

4 years agoRemove a couple of unused members from PlatformKeyboardEvent
andersca@apple.com [Fri, 30 Sep 2016 18:29:31 +0000 (18:29 +0000)]
Remove a couple of unused members from PlatformKeyboardEvent
https://bugs.webkit.org/show_bug.cgi?id=162641

Reviewed by Tim Horton.

Source/WebCore:

* platform/PlatformKeyboardEvent.h:
(WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent):
(WebCore::PlatformKeyboardEvent::nativeVirtualKeyCode): Deleted.
(WebCore::PlatformKeyboardEvent::macCharCode): Deleted.
* platform/mac/PlatformEventFactoryMac.mm:
(WebCore::PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder):
* replay/SerializationMethods.cpp:
(JSC::EncodingTraits<PlatformKeyboardEvent>::encodeValue):
(JSC::EncodingTraits<PlatformKeyboardEvent>::decodeValue):

Source/WebKit2:

* Shared/WebEventConversion.cpp:
(WebKit::WebKit2PlatformKeyboardEvent::WebKit2PlatformKeyboardEvent):

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

4 years agoUse topVMEntryFrame to determine whether to skip the re-throw of a simulated throw.
mark.lam@apple.com [Fri, 30 Sep 2016 18:15:38 +0000 (18:15 +0000)]
Use topVMEntryFrame to determine whether to skip the re-throw of a simulated throw.
https://bugs.webkit.org/show_bug.cgi?id=162793

Reviewed by Saam Barati.

Change the ThrowScope destructor to use topVMEntryFrame (instead of topCallFrame)
in the determination of whether to skip the re-throw of a simulated throw.  This
is needed because the topCallFrame is not updated in operationConstructArityCheck()
(and does not need to be), whereas topVMEntryFrame is always updated properly.
Hence, we should just switch to using the more reliable topVMEntryFrame instead.

This issue was discovered by existing JSC tests when exception check validation
is enabled.

* runtime/ThrowScope.cpp:
(JSC::ThrowScope::~ThrowScope):

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

4 years ago64-bit LLInt needs to have a concurrency-aware barrier
fpizlo@apple.com [Fri, 30 Sep 2016 17:02:46 +0000 (17:02 +0000)]
64-bit LLInt needs to have a concurrency-aware barrier
https://bugs.webkit.org/show_bug.cgi?id=162790

Reviewed by Mark Lam.

In a concurrent GC the barrier definitely has to be after the store, not before it.

* llint/LowLevelInterpreter64.asm:

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

4 years agoRemove "rem" unit optimization for document element font size changes
antti@apple.com [Fri, 30 Sep 2016 17:00:22 +0000 (17:00 +0000)]
Remove "rem" unit optimization for document element font size changes
https://bugs.webkit.org/show_bug.cgi?id=162778

Reviewed by Alex Christensen.

We awkwardly track from the parser level if any stylesheet in a document uses any rem units. This is only used to minimally
optimize a case where document element's (<html>) font size changes dynamically.

In practice such changes are rare. Browsing around I couldn't find a single case where this optimization got used.
Even if it was used it would be of low value as a full style resolution is likely to happen anyway (as font inherits)
and the only thing really saved is that we don't need to invalidate the matched properties cache.

* css/CSSGrammar.y.in:
* css/StyleSheetContents.cpp:
(WebCore::StyleSheetContents::StyleSheetContents):
* css/StyleSheetContents.h:
* dom/AuthorStyleSheets.cpp:
(WebCore::AuthorStyleSheets::updateActiveStyleSheets):
* dom/AuthorStyleSheets.h:
(WebCore::AuthorStyleSheets::usesRemUnits): Deleted.
(WebCore::AuthorStyleSheets::setUsesRemUnit): Deleted.
* dom/Document.cpp:
(WebCore::Document::recalcStyle):
(WebCore::Document::updateBaseURL):
* style/StyleTreeResolver.cpp:
(WebCore::Style::TreeResolver::resolveElement):

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

4 years agoAir should have a way of expressing additional instruction flags
fpizlo@apple.com [Fri, 30 Sep 2016 16:59:24 +0000 (16:59 +0000)]
Air should have a way of expressing additional instruction flags
https://bugs.webkit.org/show_bug.cgi?id=162699

Reviewed by Mark Lam.
Source/JavaScriptCore:

This follows a similar change in B3 (r206595) and replaces Air::Opcode with Air::Kind,
which holds onto the opcode and some additional flags. Because Air is an orthogonal ISA
(the opcode tells you what the operation does but each operand is allowed to also contain
effectively instructions for what to do to read or write that operand), the flags are
meant to be orthogonal to opcode. This allows us to say things like Add32<Trap>, which
makes sense if any of the operands to the Add32 are addresses.

To demonstrate the flags facility this partly adds a trap flag to Air. B3 doesn't use it
yet, but I made sure that Air respects it. Basically that means blocking DCE when the flag
is set, by making it imply hasNonArgNonControlEffects.

* CMakeLists.txt:
* JavaScriptCore.xcodeproj/project.pbxproj:
* b3/B3CheckSpecial.cpp:
(JSC::B3::Air::numB3Args):
(JSC::B3::CheckSpecial::Key::Key):
(JSC::B3::CheckSpecial::Key::dump):
(JSC::B3::CheckSpecial::CheckSpecial):
(JSC::B3::CheckSpecial::hiddenBranch):
(JSC::B3::CheckSpecial::forEachArg):
(JSC::B3::CheckSpecial::generate):
(JSC::B3::CheckSpecial::dumpImpl):
(JSC::B3::CheckSpecial::deepDumpImpl):
* b3/B3CheckSpecial.h:
(JSC::B3::CheckSpecial::Key::Key):
(JSC::B3::CheckSpecial::Key::operator==):
(JSC::B3::CheckSpecial::Key::kind):
(JSC::B3::CheckSpecial::Key::hash):
(JSC::B3::CheckSpecial::Key::opcode): Deleted.
* b3/B3Kind.cpp:
(JSC::B3::Kind::dump):
* b3/air/AirDumpAsJS.cpp:
(JSC::B3::Air::dumpAsJS):
* b3/air/AirFixObviousSpills.cpp:
* b3/air/AirFixPartialRegisterStalls.cpp:
* b3/air/AirGenerate.cpp:
(JSC::B3::Air::generate):
* b3/air/AirHandleCalleeSaves.cpp:
(JSC::B3::Air::handleCalleeSaves):
* b3/air/AirInst.cpp:
(JSC::B3::Air::Inst::jsHash):
(JSC::B3::Air::Inst::dump):
* b3/air/AirInst.h:
(JSC::B3::Air::Inst::Inst):
(JSC::B3::Air::Inst::kind):
(JSC::B3::Air::Inst::operator bool):
(JSC::B3::Air::Inst::opcode): Deleted.
* b3/air/AirInstInlines.h:
(JSC::B3::Air::Inst::extraClobberedRegs):
(JSC::B3::Air::Inst::extraEarlyClobberedRegs):
(JSC::B3::Air::Inst::forEachDefWithExtraClobberedRegs):
(JSC::B3::Air::Inst::reportUsedRegisters):
(JSC::B3::Air::Inst::shouldTryAliasingDef):
* b3/air/AirIteratedRegisterCoalescing.cpp:
* b3/air/AirKind.cpp: Added.
(JSC::B3::Air::Kind::dump):
* b3/air/AirKind.h: Added.
(JSC::B3::Air::Kind::Kind):
(JSC::B3::Air::Kind::operator==):
(JSC::B3::Air::Kind::operator!=):
(JSC::B3::Air::Kind::hash):
(JSC::B3::Air::Kind::operator bool):
* b3/air/AirLowerAfterRegAlloc.cpp:
(JSC::B3::Air::lowerAfterRegAlloc):
* b3/air/AirLowerEntrySwitch.cpp:
(JSC::B3::Air::lowerEntrySwitch):
* b3/air/AirLowerMacros.cpp:
(JSC::B3::Air::lowerMacros):
* b3/air/AirOptimizeBlockOrder.cpp:
(JSC::B3::Air::optimizeBlockOrder):
* b3/air/AirReportUsedRegisters.cpp:
(JSC::B3::Air::reportUsedRegisters):
* b3/air/AirSimplifyCFG.cpp:
(JSC::B3::Air::simplifyCFG):
* b3/air/AirTmpWidth.cpp:
(JSC::B3::Air::TmpWidth::recompute):
* b3/air/AirUseCounts.h:
(JSC::B3::Air::UseCounts::UseCounts):
* b3/air/AirValidate.cpp:
* b3/air/opcode_generator.rb:
* b3/testb3.cpp:
(JSC::B3::testTernarySubInstructionSelection):
(JSC::B3::testBranchBitAndImmFusion):

Source/WTF:

* wtf/CommaPrinter.h:
(WTF::CommaPrinter::CommaPrinter):
(WTF::CommaPrinter::dump):
(WTF::CommaPrinter::didPrint):

Websites/webkit.org:

* docs/b3/assembly-intermediate-representation.html:

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

4 years agoRenderLayer::clipRects may return nullptr.
zalan@apple.com [Fri, 30 Sep 2016 16:52:47 +0000 (16:52 +0000)]
RenderLayer::clipRects may return nullptr.
https://bugs.webkit.org/show_bug.cgi?id=162729

Reviewed by Chris Dumez.

This patch refactors RenderLayer::updateClipRects(), parentClipRects() and backgroundClipRect()
so that we don't have to rely on this seemingly unsafe line: clipRects = *parent()->clipRects(clipRectsContext);
Now updateClipRects() returns the computed/cached clip rects as opposed to update and refetch them.
While this patch makes the code look more readable/safer, it also eliminates cached item tripple retrievals.

No change in functionality.

* rendering/RenderLayer.cpp:
(WebCore::ClipRectsCache::getClipRects):
(WebCore::ClipRectsCache::setClipRects):
(WebCore::RenderLayer::updateClipRects):
(WebCore::RenderLayer::clipRects):
(WebCore::RenderLayer::calculateClipRects):
* rendering/RenderLayer.h:

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

4 years agoAdd a way to go from a RefPtr<T> to Ref<const T>
commit-queue@webkit.org [Fri, 30 Sep 2016 16:41:20 +0000 (16:41 +0000)]
Add a way to go from a RefPtr<T> to Ref<const T>
https://bugs.webkit.org/show_bug.cgi?id=162683

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

Source/WebCore:

No change of behavior.

* Modules/fetch/FetchBody.cpp:
(WebCore::FetchBody::extract):

Source/WTF:

* wtf/RefPtr.h:
(WTF::RefPtr::releaseConstNonNull): Added.

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

4 years agoUnreviewed, fix 32-bit build.
said@apple.com [Fri, 30 Sep 2016 16:18:25 +0000 (16:18 +0000)]
Unreviewed, fix 32-bit build.

* loader/cache/CachedImage.cpp:
(WebCore::CachedImage::decodedSizeChanged):

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

4 years agoFetchBody should use UTF8Encoding to encode text data
commit-queue@webkit.org [Fri, 30 Sep 2016 16:08:30 +0000 (16:08 +0000)]
FetchBody should use UTF8Encoding to encode text data
https://bugs.webkit.org/show_bug.cgi?id=162775

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

LayoutTests/imported/w3c:

* web-platform-tests/fetch/api/basic/text-utf8-expected.txt:
* web-platform-tests/fetch/api/basic/text-utf8.html:
* web-platform-tests/fetch/api/resources/utils.js:
(encode_utf8):

Source/WebCore:

Covered by added tests.

Removing unnecesary vector allocation when extracting UTF8 bytes from a Request/Response text/URLSearchParams body.
Making use of UTF8Encoding for consistency with  the upload code path.

* Modules/fetch/FetchBody.cpp:
(WebCore::FetchBody::consumeAsStream):
(WebCore::FetchBody::consumeText):
(WebCore::extractBytesFromText): Deleted.

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

4 years agoChange the MemoryCache and CachedResource adjustSize functions to take a long argument
said@apple.com [Fri, 30 Sep 2016 16:01:36 +0000 (16:01 +0000)]
Change the MemoryCache and CachedResource adjustSize functions to take a long argument
https://bugs.webkit.org/show_bug.cgi?id=162708
<rdar://problem/28555702>

Reviewed by Brent Fulgham.

Source/WebCore:

Because the MemoryCache stores the size of the cached memory in unsigned,
two problems my happen when reporting a change in the size of the memory:

1. Signed integer overflow -- which can happen because MemoryCache::adjustSize()
   takes a signed integer argument. If the allocated or the freed memory size is
   larger than the maximum of a signed integer, an overflow will happen.
   For the image caching code, this can be seen where the unsigned decodedSize
   is casted to an integer before passing it to ImageObserver::decodedSizeChanged().

2. Unsigned integer overflow -- which can happen if the new allocated memory
   size plus the currentSize exceeds the maximum of unsigned.
   This can be seen in MemoryCache::adjustSize() where we add delta to m_liveSize
   or m_deadSize without checking whether this addition will overflow or not. We
   do not assert for overflow although we assert for underflow.

The fix for these two problems can be the following:

1. Make all the adjustSize functions all the way till MemoryCache::adjustSize()
   take a signed long integer argument.

2. Do not create a NativeImagePtr for an ImageFrame if its frameBytes plus the
   ImageFrameCache::decodedSize() will exceed the maximum of an unsigned integer.

* loader/cache/CachedImage.cpp:
(WebCore::CachedImage::decodedSizeChanged): Change the argument to be long. No overflow will happen when casting the argument from unsigned to long.
* loader/cache/CachedImage.h:
* loader/cache/CachedResource.cpp:
(WebCore::CachedResource::setDecodedSize): Use long integer casting when calling MemoryCache::adjustSize().
(WebCore::CachedResource::setEncodedSize): Ditto.
* loader/cache/MemoryCache.cpp:
(WebCore::MemoryCache::MemoryCache): Add as static assert to ensure sizeof(long long) can hold any unsigned or its negation.
(WebCore::MemoryCache::revalidationSucceeded): Use long integer casting when calling MemoryCache::adjustSize().
(WebCore::MemoryCache::remove): Ditto.
(WebCore::MemoryCache::adjustSize): Change the function argument to long integer. No overflow will happen when casting the argument from unsigned to long.
* loader/cache/MemoryCache.h:
* platform/graphics/ImageFrameCache.cpp:
(WebCore::ImageFrameCache::destroyIncompleteDecodedData): Call a function with its new name.
(WebCore::ImageFrameCache::decodedSizeChanged): Change the function argument to long integer. No overflow will happen when casting the argument from unsigned to long.
(WebCore::ImageFrameCache::decodedSizeIncreased): Use long integer casting when calling decodedSizeChanged().
(WebCore::ImageFrameCache::decodedSizeDecreased): Ditto.
(WebCore::ImageFrameCache::decodedSizeReset): Ditto.
(WebCore::ImageFrameCache::didDecodeProperties): Ditto.
(WebCore::ImageFrameCache::frameAtIndex): Do not create the NativeImage if adding its frameByes to the MemoryCache will cause numerical overflow.
(WebCore::ImageFrameCache::decodedSizeIncremented): Deleted. This function is renamed decodedSizeIncreased().
(WebCore::ImageFrameCache::decodedSizeDecremented): Deleted. This function is renamed decodedSizeDecreased().
* platform/graphics/ImageFrameCache.h:
* platform/graphics/ImageObserver.h:
* platform/graphics/IntSize.h:
(WebCore::IntSize::unclampedArea): Returns the area of an IntSize in size_t.
* platform/graphics/cg/PDFDocumentImage.cpp:
(WebCore::PDFDocumentImage::decodedSizeChanged): Use long integer casting when calling ImageObserver::decodedSizeChanged().

LayoutTests:

* TestExpectations: Remove failed tests.

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

4 years agoAdd support for ImageData.data attribute
cdumez@apple.com [Fri, 30 Sep 2016 14:20:25 +0000 (14:20 +0000)]
Add support for ImageData.data attribute
https://bugs.webkit.org/show_bug.cgi?id=162767

Reviewed by Sam Weinig.

LayoutTests/imported/w3c:

Rebaseline W3C test now that one more check is passing.

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

Source/WebCore:

Add support for ImageData.data attribute:
- https://html.spec.whatwg.org/#imagedata

Firefox already supports it.

No new tests, updated existing tests.

* html/ImageData.idl:

LayoutTests:

Add layout test coverage.

* fast/canvas/canvas-imageData-expected.txt:
* fast/canvas/script-tests/canvas-imageData.js:

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

4 years agoDumpRenderTree crashed in com.apple.WebCore: WTF::Optional<WebCore::FetchBodyOwner...
commit-queue@webkit.org [Fri, 30 Sep 2016 08:27:02 +0000 (08:27 +0000)]
DumpRenderTree crashed in com.apple.WebCore: WTF::Optional<WebCore::FetchBodyOwner::BlobLoader>::operator bool const + 12
https://bugs.webkit.org/show_bug.cgi?id=162483

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

Source/WebCore:

Test: fetch/closing-while-fetching-blob.html
No change of behavior.

* Modules/fetch/FetchBodyOwner.cpp:
(WebCore::FetchBodyOwner::stop): Asserting m_blobLoader is null (meaning that unsetPendingActivity was done)
only in case FetchBodyOwner has no risk being destroyed.

LayoutTests:

* fetch/closing-while-fetching-blob-expected.txt: Added.
* fetch/closing-while-fetching-blob.html: Added.

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

4 years ago[Fetch API] Add support for URLSearchParams body
commit-queue@webkit.org [Fri, 30 Sep 2016 08:04:52 +0000 (08:04 +0000)]
[Fetch API] Add support for URLSearchParams body
https://bugs.webkit.org/show_bug.cgi?id=162667

Patch by Youenn Fablet <youennf@gmail.com> on 2016-09-30
Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

Adding new tests to consume, stream and upload URLSearchParams bodies.

* web-platform-tests/fetch/api/basic/request-headers-expected.txt:
* web-platform-tests/fetch/api/basic/request-headers-worker-expected.txt:
* web-platform-tests/fetch/api/basic/request-headers.js:
(checkContentType):
(requestHeaders):
* web-platform-tests/fetch/api/basic/request-upload-expected.txt: Added.
* web-platform-tests/fetch/api/basic/request-upload-worker-expected.txt: Added.
* web-platform-tests/fetch/api/basic/request-upload-worker.html: Added.
* web-platform-tests/fetch/api/basic/request-upload.html: Added.
* web-platform-tests/fetch/api/basic/request-upload.js: Added.
(testUpload):
* web-platform-tests/fetch/api/request/request-consume-empty-expected.txt:
* web-platform-tests/fetch/api/request/request-consume-empty.html:
* web-platform-tests/fetch/api/request/request-init-002-expected.txt:
* web-platform-tests/fetch/api/resources/echo-content.py: Added.
(main):
* web-platform-tests/fetch/api/response/response-consume-empty-expected.txt:
* web-platform-tests/fetch/api/response/response-consume-empty.html:
* web-platform-tests/fetch/api/response/response-consume-expected.txt:
* web-platform-tests/fetch/api/response/response-consume-stream-expected.txt:
* web-platform-tests/fetch/api/response/response-consume-stream.html:
* web-platform-tests/fetch/api/response/response-consume.html:
* web-platform-tests/fetch/api/response/response-init-002-expected.txt:

Source/WebCore:

Tests: imported/w3c/web-platform-tests/fetch/api/basic/request-upload-worker.html
       imported/w3c/web-platform-tests/fetch/api/basic/request-upload.html

* Modules/fetch/FetchBody.cpp:
(WebCore::extractBytesFromText): Moving to a static function that should be moved to a String method.
(WebCore::FetchBody::FetchBody): Adding constructor for URLSearchParams.
(WebCore::FetchBody::extract): Adding URLSearchParams body initialization.
(WebCore::FetchBody::consume): Consuming URLSearchParams bodies.
(WebCore::FetchBody::consumeAsStream): Ditto.
(WebCore::FetchBody::consumeText): Updated to take a parameter to handle both text and URLSearchParams bodies.
(WebCore::FetchBody::bodyForInternalRequest): Add URLSearchParams body upload.
(WebCore::FetchBody::clone): Add URLSearchParams body cloning
* Modules/fetch/FetchBody.h:
(WebCore::FetchBody::urlSearchParamsBody):
* html/URLSearchParams.cpp:
(WebCore::URLSearchParams::toString):
* html/URLSearchParams.h:

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

4 years agoRe-order the arguments to drawPattern() functions
simon.fraser@apple.com [Fri, 30 Sep 2016 06:41:08 +0000 (06:41 +0000)]
Re-order the arguments to drawPattern() functions
https://bugs.webkit.org/show_bug.cgi?id=162772

Reviewed by Zalan Bujtas.

Re-order the arguments to have the destination rect come near the front,
leaving CompositeOperator and BlendMode hanging out at the back like
other drawing functions.

No behavior change.

* platform/graphics/BitmapImage.cpp:
(WebCore::BitmapImage::drawPattern):
* platform/graphics/BitmapImage.h:
* platform/graphics/CrossfadeGeneratedImage.cpp:
(WebCore::CrossfadeGeneratedImage::drawPattern):
* platform/graphics/CrossfadeGeneratedImage.h:
* platform/graphics/GeneratedImage.h:
* platform/graphics/GradientImage.cpp:
(WebCore::GradientImage::drawPattern):
* platform/graphics/GradientImage.h:
* platform/graphics/GraphicsContext.h:
* platform/graphics/Image.cpp:
(WebCore::Image::drawTiled):
* platform/graphics/Image.h:
* platform/graphics/ImageBuffer.h:
* platform/graphics/NamedImageGeneratedImage.cpp:
(WebCore::NamedImageGeneratedImage::drawPattern):
* platform/graphics/NamedImageGeneratedImage.h:
* platform/graphics/cairo/GraphicsContextCairo.cpp:
(WebCore::GraphicsContext::drawPattern):
* platform/graphics/cairo/ImageBufferCairo.cpp:
(WebCore::ImageBuffer::drawPattern):
* platform/graphics/cairo/ImageCairo.cpp:
(WebCore::Image::drawPattern):
* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::GraphicsContext::drawPattern):
* platform/graphics/cg/ImageBufferCG.cpp:
(WebCore::ImageBuffer::drawPattern):
* platform/graphics/cg/ImageCG.cpp: This file can probably be removed and the code moved, since the
code is almost the same as the cairo code, and not platform-specific.
(WebCore::Image::drawPattern):
* platform/graphics/displaylists/DisplayListItems.cpp:
(WebCore::DisplayList::DrawPattern::DrawPattern):
(WebCore::DisplayList::DrawPattern::apply):
* platform/graphics/displaylists/DisplayListItems.h:
(WebCore::DisplayList::DrawPattern::create):
* platform/graphics/displaylists/DisplayListRecorder.cpp:
(WebCore::DisplayList::Recorder::drawPattern):
* platform/graphics/displaylists/DisplayListRecorder.h:
* svg/graphics/SVGImage.cpp:
(WebCore::SVGImage::drawPatternForContainer):
* svg/graphics/SVGImageForContainer.cpp:
(WebCore::SVGImageForContainer::drawPattern):
* svg/graphics/SVGImageForContainer.h:

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

4 years agoAdd support for download attribute on area elements
cdumez@apple.com [Fri, 30 Sep 2016 05:05:35 +0000 (05:05 +0000)]
Add support for download attribute on area elements
https://bugs.webkit.org/show_bug.cgi?id=162765

Reviewed by Brent Fulgham.

LayoutTests/imported/w3c:

Rebaseline W3C test now that more checks are passing.

* web-platform-tests/html/dom/reflection-embedded-expected.txt:

Source/WebCore:

Add support for download attribute on area elements:
- https://html.spec.whatwg.org/#htmlanchorelement

Because HTMLAreaElement inherits from HTMLAnchorElement on native side,
and because HTMLAnchorElement already supports the download attribute,
all that was needed was to add the download attribute to
HTMLAreaElement.idl file.

Test: http/tests/download/area-download.html

* html/HTMLAreaElement.idl:

LayoutTests:

Add layout test coverage.

* http/tests/download/area-download-expected.txt: Added.
* http/tests/download/area-download.html: Added.
* http/tests/download/resources/FAIL-notify-done.html: Added.

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

4 years agoEditor::findStringAndScrollToVisible is unused
rniwa@webkit.org [Fri, 30 Sep 2016 02:04:07 +0000 (02:04 +0000)]
Editor::findStringAndScrollToVisible is unused
https://bugs.webkit.org/show_bug.cgi?id=162762

Reviewed by Simon Fraser.

Deleted the unused function.

* editing/Editor.cpp:
(WebCore::Editor::findStringAndScrollToVisible): Deleted.
* editing/Editor.h:

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

4 years agoREGRESSION(r206555): It made Dromaeo/jslib-style-jquery.html crash
fpizlo@apple.com [Fri, 30 Sep 2016 00:48:55 +0000 (00:48 +0000)]
REGRESSION(r206555): It made Dromaeo/jslib-style-jquery.html crash
https://bugs.webkit.org/show_bug.cgi?id=162721

Reviewed by Keith Miller.

The put_by_id-in-put_by_val optimization had the write barrier in the wrong place and
incorrectly filtered on value instead of base.

No reduced test case. You really need to run Dromaeo/jslib to catch it. I love Dromaeo's
ability to catch GC bugs.

* jit/JITPropertyAccess.cpp:
(JSC::JIT::emitPutByValWithCachedId):

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

4 years agoExpose CryptoKey to web workers
jiewen_tan@apple.com [Fri, 30 Sep 2016 00:47:21 +0000 (00:47 +0000)]
Expose CryptoKey to web workers
https://bugs.webkit.org/show_bug.cgi?id=162640
<rdar://problem/28182204>

Reviewed by Brent Fulgham.

Source/WebCore:

Tests: crypto/workers/aes-postMessage-worker.html
       crypto/workers/hmac-postMessage-worker.html
       crypto/workers/hrsa-postMessage-worker.html
       crypto/workers/multiple-postMessage-worker.html
       crypto/workers/rsa-postMessage-worker.html

* crypto/CryptoKey.idl:
* crypto/SerializedCryptoKeyWrap.h:
* crypto/mac/SerializedCryptoKeyWrapMac.mm:
(WebCore::deleteDefaultWebCryptoMasterKey):
Add a way to delete the default web crypto master key such that we can test
these APIs and cleanup.
* workers/WorkerGlobalScope.cpp:
(WebCore::WorkerGlobalScope::wrapCryptoKey):
(WebCore::WorkerGlobalScope::unwrapCryptoKey):
* workers/WorkerGlobalScope.h:

Tools:

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebCore/SerializedCryptoKeyWrap.mm: Added.
(TestWebKitAPI::TEST_F):
Add API tests for SerializedCryptoKeyWrap APIs.

LayoutTests:

* crypto/resources/common.js: Renamed from LayoutTests/crypto/subtle/resources/common.js.
* crypto/subtle/aes-cbc-192-encrypt-decrypt.html:
* crypto/subtle/aes-cbc-256-encrypt-decrypt.html:
* crypto/subtle/aes-cbc-encrypt-decrypt-with-padding.html:
* crypto/subtle/aes-cbc-encrypt-decrypt.html:
* crypto/subtle/aes-cbc-generate-key.html:
* crypto/subtle/aes-cbc-import-jwk.html:
* crypto/subtle/aes-cbc-invalid-length.html:
* crypto/subtle/aes-cbc-unwrap-failure.html:
* crypto/subtle/aes-cbc-unwrap-rsa.html:
* crypto/subtle/aes-cbc-wrap-rsa-non-extractable.html:
* crypto/subtle/aes-cbc-wrap-rsa.html:
* crypto/subtle/aes-cbc-wrong-key-class.html:
* crypto/subtle/aes-export-key.html:
* crypto/subtle/aes-kw-key-manipulation.html:
* crypto/subtle/aes-kw-wrap-unwrap-aes.html:
* crypto/subtle/aes-postMessage-expected.txt:
* crypto/subtle/aes-postMessage.html:
* crypto/subtle/argument-conversion.html:
* crypto/subtle/array-buffer-view-offset.html:
* crypto/subtle/crypto-key-algorithm-gc.html:
* crypto/subtle/crypto-key-usages-gc.html:
* crypto/subtle/hmac-check-algorithm.html:
* crypto/subtle/hmac-export-key.html:
* crypto/subtle/hmac-generate-key.html:
* crypto/subtle/hmac-import-jwk.html:
* crypto/subtle/hmac-postMessage-expected.txt:
* crypto/subtle/hmac-postMessage.html:
* crypto/subtle/hmac-sign-verify-empty-key.html:
* crypto/subtle/hmac-sign-verify.html:
* crypto/subtle/import-jwk.html:
* crypto/subtle/jwk-export-use-values.html:
* crypto/subtle/jwk-import-use-values.html:
* crypto/subtle/postMessage-worker-expected.txt: Removed.
* crypto/subtle/rsa-export-generated-keys.html:
* crypto/subtle/rsa-export-key.html:
* crypto/subtle/rsa-export-private-key.html:
* crypto/subtle/rsa-indexeddb-non-exportable-private.html:
* crypto/subtle/rsa-indexeddb-non-exportable.html:
* crypto/subtle/rsa-indexeddb-private.html:
* crypto/subtle/rsa-indexeddb.html:
* crypto/subtle/rsa-oaep-generate-non-extractable-key.html:
* crypto/subtle/rsa-oaep-key-manipulation.html:
* crypto/subtle/rsa-oaep-plaintext-length.html:
* crypto/subtle/rsa-oaep-wrap-unwrap-aes.html:
* crypto/subtle/rsa-postMessage.html:
* crypto/subtle/rsaes-pkcs1-v1_5-decrypt.html:
* crypto/subtle/rsaes-pkcs1-v1_5-wrap-unwrap-aes.html:
* crypto/subtle/rsassa-pkcs1-v1_5-generate-key-with-leading-zeroes-in-exponent.html:
* crypto/subtle/rsassa-pkcs1-v1_5-generate-key.html:
* crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-small-key.html:
* crypto/subtle/rsassa-pkcs1-v1_5-import-jwk.html:
* crypto/subtle/rsassa-pkcs1-v1_5-sign-verify.html:
* crypto/subtle/sha-1.html:
* crypto/subtle/sha-224.html:
* crypto/subtle/sha-256.html:
* crypto/subtle/sha-384.html:
* crypto/subtle/sha-512.html:
* crypto/subtle/unimplemented-unwrap-crash.html:
* crypto/subtle/unwrapKey-check-usage.html:
* crypto/subtle/wrapKey-check-usage.html:
* crypto/workers/aes-postMessage-worker-expected.txt: Added.
* crypto/workers/aes-postMessage-worker.html: Added.
* crypto/workers/hmac-postMessage-worker-expected.txt: Added.
* crypto/workers/hmac-postMessage-worker.html: Renamed from LayoutTests/crypto/subtle/postMessage-worker.html.
* crypto/workers/hrsa-postMessage-worker-expected.txt: Added.
* crypto/workers/hrsa-postMessage-worker.html: Added.
* crypto/workers/multiple-postMessage-worker-expected.txt: Added.
* crypto/workers/multiple-postMessage-worker.html: Added.
* crypto/workers/resources/aes-postMessage-worker.js: Added.
* crypto/workers/resources/hmac-postMessage-worker.js: Renamed from LayoutTests/crypto/subtle/resources/postMessage-worker.js.
* crypto/workers/resources/hrsa-postMessage-worker.js: Added.
* crypto/workers/resources/rsa-postMessage-worker.js: Added.
* crypto/workers/rsa-postMessage-worker-expected.txt: Added.
* crypto/workers/rsa-postMessage-worker.html: Added.
* js/dom/global-constructors-attributes-dedicated-worker-expected.txt:

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

4 years agoAX: iOS: Tapping <input> in Safari zooms in a bit when page has max scale = 1
n_wang@apple.com [Fri, 30 Sep 2016 00:38:18 +0000 (00:38 +0000)]
AX: iOS: Tapping <input> in Safari zooms in a bit when page has max scale = 1
https://bugs.webkit.org/show_bug.cgi?id=162471

Reviewed by Simon Fraser.

Source/WebCore:

If the author has defined a maximum scale, we should honor that when keyboard focus moves
to a text field, instead of using the forceAlwaysUserScalableMaximumScale.

Tests: fast/forms/ios/user-scalable-does-not-scale-for-keyboard-focus-with-author-defined-scale.html
       fast/forms/ios/user-scalable-does-not-scale-for-keyboard-focus-with-user-scalable-no.html
       fast/forms/ios/user-scalable-scales-for-keyboard-focus-with-no-author-defined-scale.html

* page/ViewportConfiguration.cpp:
(WebCore::ViewportConfiguration::allowsUserScaling):
(WebCore::ViewportConfiguration::allowsUserScalingIgnoringAlwaysScalable):
(WebCore::ViewportConfiguration::allowsUserScalingIgnoringForceAlwaysScaling): Deleted.
* page/ViewportConfiguration.h:
(WebCore::ViewportConfiguration::maximumScaleIgnoringAlwaysScalable):
(WebCore::ViewportConfiguration::maximumScale): Deleted.

Source/WebKit2:

* Shared/AssistedNodeInformation.cpp:
(WebKit::AssistedNodeInformation::encode):
(WebKit::AssistedNodeInformation::decode):
* Shared/AssistedNodeInformation.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _displayFormNodeInputView]):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::maximumPageScaleFactorIgnoringAlwaysScalable):
(WebKit::WebPage::getAssistedNodeInformation):

LayoutTests:

Moved focus input related tests to the right place.

* fast/forms/ios/user-scalable-does-not-scale-for-keyboard-focus-with-author-defined-scale-expected.txt: Added.
* fast/forms/ios/user-scalable-does-not-scale-for-keyboard-focus-with-author-defined-scale.html: Added.
* fast/forms/ios/user-scalable-does-not-scale-for-keyboard-focus-with-user-scalable-no-expected.txt: Added.
* fast/forms/ios/user-scalable-does-not-scale-for-keyboard-focus-with-user-scalable-no.html: Added.
* fast/forms/ios/user-scalable-scales-for-keyboard-focus-with-no-author-defined-scale-expected.txt: Added.
* fast/forms/ios/user-scalable-scales-for-keyboard-focus-with-no-author-defined-scale.html: Added.
* fast/viewport/ios/user-scalable-does-not-scale-for-keyboard-focus-with-author-defined-scale-expected.txt: Removed.
* fast/viewport/ios/user-scalable-does-not-scale-for-keyboard-focus-with-author-defined-scale.html: Removed.
* fast/viewport/ios/user-scalable-scales-for-keyboard-focus-with-no-author-defined-scale-expected.txt: Removed.
* fast/viewport/ios/user-scalable-scales-for-keyboard-focus-with-no-author-defined-scale.html: Removed.

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

4 years agoMark NetworkLoad as final
dbates@webkit.org [Thu, 29 Sep 2016 23:05:35 +0000 (23:05 +0000)]
Mark NetworkLoad as final
https://bugs.webkit.org/show_bug.cgi?id=162681

Reviewed by Alex Christensen.

Mark class NetworkLoad as final as we do not have any derived classes at the moment and it
is unclear if it would make sense to subclass it. We can always unmark the class if it turns
out that it makes sense to subclass it.

* NetworkProcess/NetworkLoad.h:

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

4 years agoVersioning.
bshafiei@apple.com [Thu, 29 Sep 2016 22:23:31 +0000 (22:23 +0000)]
Versioning.

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

4 years ago[iOS] Update Touch constructor test to cover clientX / clientY attributes
cdumez@apple.com [Thu, 29 Sep 2016 22:16:58 +0000 (22:16 +0000)]
[iOS] Update Touch constructor test to cover clientX / clientY attributes
https://bugs.webkit.org/show_bug.cgi?id=162757

Reviewed by Sam Weinig.

Update Touch constructor test to cover clientX / clientY attributes.

* fast/events/touch/touch-constructor.html:

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

4 years agoWeb Inspector: AXI: linkified refs to #document and #text are not usually navigable...
commit-queue@webkit.org [Thu, 29 Sep 2016 22:15:57 +0000 (22:15 +0000)]
Web Inspector: AXI: linkified refs to #document and #text are not usually navigable nodes; consider delinkifying them
https://bugs.webkit.org/show_bug.cgi?id=130600
<rdar://problem/16391333>

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

.:

Added a manual test to test the node links in the Accessibility Inspector
https://bugs.webkit.org/show_bug.cgi?id=130600

* ManualTests/accessibility/delinkified-non-navigable-links.html: Added.

Source/WebInspectorUI:

Removing link style for non-navigable nodes by first
checking nodeType of the node.

* UserInterface/Base/DOMUtilities.js:
(WebInspector.linkifyNodeReference):

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

4 years agoFix syntax violation handling in IPv4 address parsing
achristensen@apple.com [Thu, 29 Sep 2016 22:02:04 +0000 (22:02 +0000)]
Fix syntax violation handling in IPv4 address parsing
https://bugs.webkit.org/show_bug.cgi?id=162756

Reviewed by Tim Horton.

Source/WebCore:

When we are parsing the up to 4 numbers in an IPv4 address, if we find a syntax violation
(the canonicalized address would be different than the input string) then wait to report
it until we have determined that this is a valid IPv4 address that will be canonicalized.
If it is not a valid IPv4 address, then we will just treat the characters as the host, and
that could be no syntax violation.

Covered by a new API test and existing API tests.

* platform/URLParser.cpp:
(WebCore::URLParser::URLParser):
(WebCore::URLParser::parseIPv4Number):
(WebCore::URLParser::parseIPv4Host):
* platform/URLParser.h:

Tools:

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

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

4 years agoFix post-landing nits after r206561.
cdumez@apple.com [Thu, 29 Sep 2016 21:28:45 +0000 (21:28 +0000)]
Fix post-landing nits after r206561.
https://bugs.webkit.org/show_bug.cgi?id=162659

Reviewed by Alex Christensen.

Uses more StringViews and constness.

* dom/SecurityContext.cpp:
(WebCore::SecurityContext::isSupportedSandboxPolicy):
* dom/SecurityContext.h:
* html/DOMTokenList.cpp:
(WebCore::DOMTokenList::DOMTokenList):
(WebCore::DOMTokenList::supports):
* html/DOMTokenList.h:
(WebCore::DOMTokenList::DOMTokenList):
* html/HTMLAnchorElement.cpp:
(WebCore::HTMLAnchorElement::relList):
* html/HTMLIFrameElement.cpp:
(WebCore::HTMLIFrameElement::sandbox):
* html/HTMLLinkElement.cpp:
(WebCore::HTMLLinkElement::relList):
* html/LinkRelAttribute.cpp:
(WebCore::LinkRelAttribute::isSupported):
* html/LinkRelAttribute.h:

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

4 years agoURLParser should correctly parse ports with leading 0's
achristensen@apple.com [Thu, 29 Sep 2016 21:25:14 +0000 (21:25 +0000)]
URLParser should correctly parse ports with leading 0's
https://bugs.webkit.org/show_bug.cgi?id=162752

* platform/URLParser.cpp:
(WebCore::URLParser::parsePort):
Followup.  Remove branches based on Geoffrey's feedback.

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

4 years agoURLParser should correctly parse ports with leading 0's
achristensen@apple.com [Thu, 29 Sep 2016 21:20:43 +0000 (21:20 +0000)]
URLParser should correctly parse ports with leading 0's
https://bugs.webkit.org/show_bug.cgi?id=162752

Reviewed by Tim Horton.

Source/WebCore:

Covered by new API tests.

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

Tools:

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

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

4 years ago[iOS] Add test for Touch constructor
cdumez@apple.com [Thu, 29 Sep 2016 21:13:33 +0000 (21:13 +0000)]
[iOS] Add test for Touch constructor
https://bugs.webkit.org/show_bug.cgi?id=162736
<rdar://problem/28520007>

Reviewed by Ryosuke Niwa.

Add test for Touch constructor. There are no expected results because
the test (folder) is skipped in the open source.

* fast/events/touch/touch-constructor.html: Added.

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

4 years agoFix flaky test media/click-placeholder-not-pausing.html
adachan@apple.com [Thu, 29 Sep 2016 21:04:34 +0000 (21:04 +0000)]
Fix flaky test media/click-placeholder-not-pausing.html
https://bugs.webkit.org/show_bug.cgi?id=162661

Reviewed by Eric Carlson.

This test became flaky after r201474 when we started to delay showing
the inline placeholder until we are sure the video layer has been moved
into the video fullscreen layer. This means we can't guarantee that the
placeholder is visible right away after the video's presentation mode
changes to "picture-in-picture".

To fix this, wait for the placeholder to become visible before clicking it.

* media/click-placeholder-not-pausing.html:
* platform/mac-wk2/TestExpectations:

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

4 years agoUnreviewed, rolling out r206483.
commit-queue@webkit.org [Thu, 29 Sep 2016 21:02:59 +0000 (21:02 +0000)]
Unreviewed, rolling out r206483.
https://bugs.webkit.org/show_bug.cgi?id=162750

May have caused iOS perf regression (Requested by smfr on
#webkit).

Reverted changeset:

"REGRESSION (r204552): Yelp carousel animation is not smooth."
https://bugs.webkit.org/show_bug.cgi?id=162632
http://trac.webkit.org/changeset/206483

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

4 years agoArrow functions do not infer name from computed property but normal functions do
joepeck@webkit.org [Thu, 29 Sep 2016 20:33:21 +0000 (20:33 +0000)]
Arrow functions do not infer name from computed property but normal functions do
https://bugs.webkit.org/show_bug.cgi?id=162720

Reviewed by Saam Barati.

JSTests:

* stress/inferred-names.js:

Source/JavaScriptCore:

* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::emitSetFunctionNameIfNeeded):
Set function name on arrow functions as well.

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

4 years agoURLParser: make parsing invalid IPv4 addresses more robust and correct
achristensen@apple.com [Thu, 29 Sep 2016 20:21:54 +0000 (20:21 +0000)]
URLParser: make parsing invalid IPv4 addresses more robust and correct
https://bugs.webkit.org/show_bug.cgi?id=162746

Reviewed by Tim Horton.

Source/WebCore:

If parsing an IPv4 address fails, the characters are just treated as a regular domain.

Covered by new API tests.

* platform/URLParser.cpp:
(WebCore::URLParser::parseIPv4Number):
(WebCore::URLParser::parseIPv4Host):

Tools:

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

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

4 years agoURLParser: IPv6 addresses followed by a colon are invalid
achristensen@apple.com [Thu, 29 Sep 2016 20:18:16 +0000 (20:18 +0000)]
URLParser: IPv6 addresses followed by a colon are invalid
https://bugs.webkit.org/show_bug.cgi?id=162747

Reviewed by Tim Horton.

Source/WebCore:

Covered by new API tests.

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

Tools:

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

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

4 years agoRemoving El Capitan modifier from flaky test media/restore-from-page-cache.html.
ryanhaddad@apple.com [Thu, 29 Sep 2016 20:03:11 +0000 (20:03 +0000)]
Removing El Capitan modifier from flaky test media/restore-from-page-cache.html.
https://bugs.webkit.org/show_bug.cgi?id=158747

Unreviewed test gardening.

* platform/mac/TestExpectations:

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

4 years ago[Modern Media Controls] scheduler for layout nodes
commit-queue@webkit.org [Thu, 29 Sep 2016 20:02:25 +0000 (20:02 +0000)]
[Modern Media Controls] scheduler for layout nodes
https://bugs.webkit.org/show_bug.cgi?id=162726
<rdar://problem/28543043>

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

Source/WebCore:

For the work on the modern media controls we will be using a tree of LayoutNode objects that will
commit to the DOM in coordinated `requestAnimationFrame()` calls to ensure all layouts are done
in an efficient and coordinated manner. As a preamble, we introduce a `scheduler` singleton which
provides a single public method `scheduleLayout(callback)` to queue callbacks to be fired in the
next `requestAnimationFrame()` callback.

Tests: media/modern-media-controls/scheduler/not-reentrant.html
       media/modern-media-controls/scheduler/single-callback-when-registered-multiple-times.html

* Modules/modern-media-controls/controls/scheduler.js: Added.
(const.scheduler.new.prototype.scheduleLayout):
(const.scheduler.new.prototype._requestFrameIfNeeded):
(const.scheduler.new.prototype._frameDidFire):
(const.scheduler.new.prototype._layout):

LayoutTests:

Testing the basic functionality for the LayoutNode scheduler.

* media/modern-media-controls/scheduler/not-reentrant-expected.txt: Added.
* media/modern-media-controls/scheduler/not-reentrant.html: Added.
* media/modern-media-controls/scheduler/single-callback-when-registered-multiple-times-expected.txt: Added.
* media/modern-media-controls/scheduler/single-callback-when-registered-multiple-times.html: Added.

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

4 years agoText nodes assigned to a linked slot are not clickable
rniwa@webkit.org [Thu, 29 Sep 2016 19:49:54 +0000 (19:49 +0000)]
Text nodes assigned to a linked slot are not clickable
https://bugs.webkit.org/show_bug.cgi?id=162091
<rdar://problem/28383300>

Reviewed by Antti Koivisto.

Source/WebCore:

The bug was caused by updateMouseEventTargetNode adjusting the target to its parent element when
the original target was a text node. Fixed the bug by using the parent element in the composed tree.

Also fixed the bug that the hit testing was not finding the anchor element and keeping the cursor
in I-beam by traversing the composed tree instead.

Test: fast/shadow-dom/click-text-inside-linked-slot.html

* dom/Node.cpp:
(WebCore::Node::enclosingLinkEventParentOrSelf): Fixed the cursor problem.
* page/EventHandler.cpp:
(WebCore::EventHandler::updateMouseEventTargetNode): Fixed the activation problem.

LayoutTests:

Added a regression test for clicking inside a text node assigned to a slot inside a hyperlink.

Unfortunately, there is not a way to make this a W3C style test until the web platform tests
start supporting WebDriver.

* fast/shadow-dom/click-text-inside-linked-slot-expected.txt: Added.
* fast/shadow-dom/click-text-inside-linked-slot.html: Added.
* platform/ios-simulator-wk2/TestExpectations:

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

4 years agoAllow overriding some NSURLSessionConfiguration properties on a per-NetworkProcess...
weinig@apple.com [Thu, 29 Sep 2016 19:48:25 +0000 (19:48 +0000)]
Allow overriding some NSURLSessionConfiguration properties on a per-NetworkProcess basis
<rdar://problem/27648683>
https://bugs.webkit.org/show_bug.cgi?id=162735

Reviewed by Dan Bernstein.

Source/WebCore:

* platform/spi/cf/CFNetworkSPI.h:
Forward declare _sourceApplicationSecondaryIdentifier and _CTDataConnectionServiceType

Source/WebKit2:

Add SPI for overriding the following NSURLSessionConfigurations properties:
    - _sourceApplicationBundleIdentifier
    - _sourceApplicationSecondaryIdentifier
    - _CTDataConnectionServiceType

* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::initializeNetworkProcess):
* NetworkProcess/NetworkProcessCreationParameters.cpp:
(WebKit::NetworkProcessCreationParameters::encode):
(WebKit::NetworkProcessCreationParameters::decode):
* NetworkProcess/NetworkProcessCreationParameters.h:
* NetworkProcess/NetworkSession.h:
* NetworkProcess/cocoa/NetworkProcessCocoa.mm:
(WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(WebKit::globalSourceApplicationBundleIdentifier):
(WebKit::globalSourceApplicationSecondaryIdentifier):
(WebKit::globalCTDataConnectionServiceType):
(WebKit::NetworkSession::setCustomProtocolManager):
(WebKit::NetworkSession::setSourceApplicationAuditTokenData):
(WebKit::NetworkSession::setSourceApplicationBundleIdentifier):
(WebKit::NetworkSession::setSourceApplicationSecondaryIdentifier):
(WebKit::NetworkSession::setCTDataConnectionServiceType):
(WebKit::NetworkSession::NetworkSession):
* UIProcess/API/APIProcessPoolConfiguration.cpp:
(API::ProcessPoolConfiguration::copy):
* UIProcess/API/APIProcessPoolConfiguration.h:
* UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
* UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
(-[_WKProcessPoolConfiguration sourceApplicationBundleIdentifier]):
(-[_WKProcessPoolConfiguration setSourceApplicationBundleIdentifier:]):
(-[_WKProcessPoolConfiguration sourceApplicationSecondaryIdentifier]):
(-[_WKProcessPoolConfiguration setSourceApplicationSecondaryIdentifier:]):
(-[_WKProcessPoolConfiguration CTDataConnectionServiceType]):
(-[_WKProcessPoolConfiguration setCTDataConnectionServiceType:]):
* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::WebProcessPool::platformInitializeNetworkProcess):
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::initializeWebProcess):
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::platformInitializeWebProcess):

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

4 years agoRemove addSubresourceStyleURLs functions
antti@apple.com [Thu, 29 Sep 2016 19:36:39 +0000 (19:36 +0000)]
Remove addSubresourceStyleURLs functions
https://bugs.webkit.org/show_bug.cgi?id=162731

Reviewed by Ryosuke Niwa.

Use the generic std::function taking traverseSubresources instead. This prevents bugs caused by the code paths
not being in sync.

These functions are only used by the legacy webarchive code to gather URLs to locate CachedResources from the memory cache.
This can be improved further by returning the cached resources themselves instead of the URLs.

* css/CSSFontFaceSrcValue.cpp:
(WebCore::CSSFontFaceSrcValue::addSubresourceStyleURLs): Deleted.
* css/CSSFontFaceSrcValue.h:
* css/CSSPrimitiveValue.cpp:
(WebCore::CSSPrimitiveValue::addSubresourceStyleURLs): Deleted.
* css/CSSPrimitiveValue.h:
* css/CSSReflectValue.cpp:
(WebCore::CSSReflectValue::addSubresourceStyleURLs): Deleted.
* css/CSSReflectValue.h:
* css/CSSValue.cpp:
(WebCore::CSSValue::addSubresourceStyleURLs): Deleted.
* css/CSSValue.h:
* css/CSSValueList.cpp:
(WebCore::CSSValueList::addSubresourceStyleURLs): Deleted.
* css/CSSValueList.h:
* css/StyleProperties.cpp:
(WebCore::StyleProperties::addSubresourceStyleURLs): Deleted.
* css/StyleProperties.h:
* css/StyleRuleImport.h:
* css/StyleSheetContents.cpp:
(WebCore::StyleSheetContents::traverseSubresources):

    Fix a bug where this would miss @import rules in @imported stylesheets.
    Include the CachedResource for the imported stylesheet itself.

    Tested by the test cases under LayoutTests/webarchive

(WebCore::StyleSheetContents::addSubresourceStyleURLs): Deleted.
* css/StyleSheetContents.h:
* dom/StyledElement.cpp:
(WebCore::StyledElement::addSubresourceAttributeURLs):
* html/HTMLLinkElement.cpp:
(WebCore::HTMLLinkElement::addSubresourceAttributeURLs):
* html/HTMLStyleElement.cpp:
(WebCore::HTMLStyleElement::addSubresourceAttributeURLs):

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

4 years agoMarking fast/images/load-img-with-empty-src.html as crashing.
ryanhaddad@apple.com [Thu, 29 Sep 2016 19:22:56 +0000 (19:22 +0000)]
Marking fast/images/load-img-with-empty-src.html as crashing.
https://bugs.webkit.org/show_bug.cgi?id=162696

Unreviewed test gardening.

* TestExpectations:

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

4 years agoRe-enable StringView life-cycle checking.
mark.lam@apple.com [Thu, 29 Sep 2016 19:17:03 +0000 (19:17 +0000)]
Re-enable StringView life-cycle checking.
https://bugs.webkit.org/show_bug.cgi?id=160384
<rdar://problem/28479434>

Reviewed by Saam Barati.

Re-landing after slow running tests have been resolved.

* wtf/text/StringView.h:

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

4 years agoBreak some slow running tests into smaller bits so they don't time out.
mark.lam@apple.com [Thu, 29 Sep 2016 19:11:05 +0000 (19:11 +0000)]
Break some slow running tests into smaller bits so they don't time out.
https://bugs.webkit.org/show_bug.cgi?id=162743

Reviewed by Keith Miller.

The following tests have shown to be slow running:
    op_div.js
    op_lshift.js
    op_mod.js
    op_mul.js
    op_rshift.js
    op_sub.js
    op_urshift

These tests auto-generate permutations of values to apply to binary operations.
They also test the operations with 3 permutations of value types:
    1. VarVar - both operands variables
    2. VarConst - variable operand 1, constant / literal operand 2
    3. ConstVar - constant / literal operand 1, variable operand 2

We can prevent these tests from timing out by breaking each up to only run 1 of
the 3 permutations of value types.

* stress/op_div-ConstVar.js: Added.
* stress/op_div-VarConst.js: Added.
* stress/op_div-VarVar.js: Copied from JSTests/stress/op_div.js.
(o1.valueOf): Deleted.
* stress/op_div.js: Removed.
* stress/op_lshift-ConstVar.js: Added.
* stress/op_lshift-VarConst.js: Added.
* stress/op_lshift-VarVar.js: Copied from JSTests/stress/op_lshift.js.
(o1.valueOf): Deleted.
* stress/op_lshift.js: Removed.
* stress/op_mod-ConstVar.js: Added.
* stress/op_mod-VarConst.js: Added.
* stress/op_mod-VarVar.js: Copied from JSTests/stress/op_mod.js.
(o1.valueOf): Deleted.
* stress/op_mod.js: Removed.
* stress/op_mul-ConstVar.js: Added.
* stress/op_mul-VarConst.js: Added.
* stress/op_mul-VarVar.js: Copied from JSTests/stress/op_mul.js.
(o1.valueOf): Deleted.
* stress/op_mul.js: Removed.
* stress/op_rshift-ConstVar.js: Added.
* stress/op_rshift-VarConst.js: Added.
* stress/op_rshift-VarVar.js: Copied from JSTests/stress/op_rshift.js.
(o1.valueOf): Deleted.
* stress/op_rshift.js: Removed.
* stress/op_sub-ConstVar.js: Added.
* stress/op_sub-VarConst.js: Added.
* stress/op_sub-VarVar.js: Copied from JSTests/stress/op_sub.js.
(o1.valueOf): Deleted.
* stress/op_sub.js: Removed.
* stress/op_urshift-ConstVar.js: Added.
* stress/op_urshift-VarConst.js: Added.
* stress/op_urshift-VarVar.js: Copied from JSTests/stress/op_urshift.js.
(o1.valueOf): Deleted.
* stress/op_urshift.js: Removed.
* stress/resources/binary-op-values.js: Added.
(o1.valueOf):

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

4 years agotest262: class and function names should be inferred in assignment
commit-queue@webkit.org [Thu, 29 Sep 2016 19:01:42 +0000 (19:01 +0000)]
test262: class and function names should be inferred in assignment
https://bugs.webkit.org/show_bug.cgi?id=146262

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

JSTests:

* stress/arrowfunction-name.js: Added.
Quick tests for arrow function names.

* stress/inferred-names.js: Added.
General test for inferred function names.

* test262.yaml:
Pass many tests checking inferred function names.

Source/JavaScriptCore:

* parser/ASTBuilder.h:
(JSC::ASTBuilder::appendParameter):
(JSC::ASTBuilder::appendArrayPatternEntry):
(JSC::ASTBuilder::appendObjectPatternEntry):
(JSC::ASTBuilder::tryInferFunctionNameInPattern):
Assign names to default value functions and classes in destructuring.

(JSC::ASTBuilder::createAssignResolve):
(JSC::ASTBuilder::createProperty):
(JSC::ASTBuilder::makeAssignNode):
Assign names to both normal and arrow functions.

* parser/Nodes.h:
(JSC::ExpressionNode::isBaseFuncExprNode):
Both functions and arrow functions infer name, they both extend
this base so give the base an is check.

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

4 years agoMarking fast/images/pdf-as-image-with-annotations.html as crashing.
ryanhaddad@apple.com [Thu, 29 Sep 2016 18:59:44 +0000 (18:59 +0000)]
Marking fast/images/pdf-as-image-with-annotations.html as crashing.
https://bugs.webkit.org/show_bug.cgi?id=162696

Unreviewed test gardening.

* TestExpectations:

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

4 years ago[Win][Direct2D] Add D2D Font handling code
bfulgham@apple.com [Thu, 29 Sep 2016 18:45:08 +0000 (18:45 +0000)]
[Win][Direct2D] Add D2D Font handling code
https://bugs.webkit.org/show_bug.cgi?id=162712

Reviewed by Brent Fulgham.

This patch lands a set of new files that implement

No new tests until complete backend lands.

* platform/graphics/Font.h:
* platform/graphics/FontCascade.h:
(WebCore::FontCascade::syntheticObliqueAngle): Added helper function.
* platform/graphics/FontPlatformData.h:
(WebCore::FontPlatformData::dwFont): Added.
(WebCore::FontPlatformData::dwFontFace): Ditto.
* platform/graphics/GlyphBuffer.h:
* platform/graphics/cocoa/FontCascadeCocoa.mm:
(WebCore::FontCascade::drawGlyphs): Use helper function.
* platform/graphics/win/FontCGWin.cpp:
(WebCore::FontCascade::drawGlyphs): Ditto.
* platform/graphics/win/FontCacheWin.cpp:
(WebCore::FontCache::createFontPlatformData): Add case for Direct2D.
* platform/graphics/win/FontCascadeDirect2D.cpp: Added.
* platform/graphics/win/FontCustomPlatformData.cpp:
(WebCore::FontCustomPlatformData::~FontCustomPlatformData): Fix whitespace.
(WebCore::FontCustomPlatformData::fontPlatformData): Add Direct2D case.
* platform/graphics/win/FontPlatformDataCGWin.cpp:
(WebCore::FontPlatformData::FontPlatformData): Clean up C++ initializers.
* platform/graphics/win/FontPlatformDataCairoWin.cpp:
(WebCore::FontPlatformData::FontPlatformData): Ditto.
* platform/graphics/win/FontPlatformDataDirect2D.cpp: Added.
* platform/graphics/win/FontPlatformDataWin.cpp:
(WebCore::FontPlatformData::FontPlatformData): Clean up C++ initializers.
* platform/graphics/win/GlyphPageTreeNodeDirect2D.cpp: Added.
* platform/graphics/win/SimpleFontDataDirect2D.cpp: Added.
* platform/graphics/win/TextAnalyzerHelper.cpp: Added.
* platform/graphics/win/TextAnalyzerHelper.h: Added.

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

4 years agoMake WKTR short timeout dynamic
ap@apple.com [Thu, 29 Sep 2016 18:44:54 +0000 (18:44 +0000)]
Make WKTR short timeout dynamic
https://bugs.webkit.org/show_bug.cgi?id=162733

Reviewed by Alex Christensen.

WebKitTestRunner has a hardcoded value for how long to wait for IPC responses,
which is 5 seconds, or 10 seconds under ASan. But some of the operations can be
fairly time consuming - e.g. launching Networking process on demand.
These may take longer under load, especially with GuardMalloc.

* WebKitTestRunner/TestController.cpp:
(WTR::TestController::resetStateToConsistentValues):
(WTR::TestController::reattachPageToWebProcess):
* WebKitTestRunner/TestController.h:
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::shortTimeout):
(WTR::TestInvocation::invoke):
(WTR::TestInvocation::dumpResults):

* WebKitTestRunner/TestInvocation.h:
(WTR::TestInvocation::customTimeout): Deleted, this function was unused.

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

4 years agoB3 opcodes should leave room for flags
fpizlo@apple.com [Thu, 29 Sep 2016 18:44:53 +0000 (18:44 +0000)]
B3 opcodes should leave room for flags
https://bugs.webkit.org/show_bug.cgi?id=162692

Reviewed by Keith Miller.
Source/JavaScriptCore:

It used to be that the main thing that determined what a Value did was the opcode. The
Opcode was how you knew what subclass of Value you had. The opcode told you what the Value
actually did. This change replaces Opcode with Kind, which is a tuple of opcode and other
stuff.

Opcodes are great, and that's how most compilers work. But opcodes are one-dimensional. Here
is how this manifests. Say you have an opcode, like Load. You will be happy if your IR has
one Load opcode. But then, you might add Load8S/Load8Z/Load16S/Load16Z opcodes, as we have
done in B3. B3 has one dimension of Load opcodes, which determines something like the C type
of the load. But in the very near future, we will want to add two more dimensions to Loads:

- A flag to say if the load traps.
- A flag to say if the load has acquire semantics.

Mapping these three dimensions (type, trap, acquire) onto the one-dimensional Opcode space
would create mayham: Load8S, Load8STrap, Load8SAcquire, Load8STrapAcquire, Load8Z,
Load8ZTrap, etc.

This happens in other parts of the IR. For example, we have a dimension of arithmetic
operations: add, sub, mul, div, mod, etc. Then we have the chill flag. But since opcodes
are one-dimensional, that means having ChillDiv and ChillMod, and tons of places in the
compiler that case on both Div and ChillDiv, or case on both Mod and ChillMod, since they
are only interested in the kind of arithmetic being done and not the chillness.

Though the examples all involve bits (chill or not, trapping or not, etc), I can imagine
other properties that behave more like small enums, like if we fill out more memory ordering
modes other than just "acquire? yes/no". There will eventually have to be something like a
std::memory_order associated with memory accesses.

One approach to this problem is to have a Value subclass that contains fields with the meta
data. I don't like this for two reasons:

- In bug 162688, I want to make trapping memory accesses have stackmaps. This means that a
  trapping memory access would have a different Value subclass than a non-trapping memory
  access. So, this meta-data needs to channel into ValueType::accepts(). Currently that
  takes Opcode and nothing else.

- Compiler IRs are all about making common tasks easy. If it becomes commonplace for opcodes
  to require a custom Value subclass just for a bit then that's not very easy.

This change addresses this problem by making the compiler pass around Kinds rather than
Opcodes. A Kind contains an Opcode as well as any number of opcode-specific bits. This
change demonstrates how Kind should be used by converting chillness to it. Kind has
hasIsChill(), isChill(), and setIsChill() methods. hasIsChill() is true only for Div and
Mod. setIsChill() asserts if !hasIsChill(). If you want to create a Chill Div, you say
chill(Div). IR dumps will print it like this:

    Int32 @38 = Div<Chill>(@36, @37, DFG:@24, ControlDependent)

Where "Div<Chill>" is how a Kind that hasExtraBits() dumps itself. If a Kind does not
hasExtraBits() (the normal case) then it dumps like a normal Opcode (without the "<>").

I replaced many uses of Opcode with Kind. New code has to be mindful that Opcode may not be
the right way to summarize what a value does, and so in many cases it's better to carry
around a Kind instead - especially if you will use it to stamp out new Values. Opcode is no
longer sufficient to perform a dynamic Value cast, since that code now uses Kind. ValueKey
now wants a Kind instead of an Opcode. All Value constructors now take Kind instead of
Opcode. But most opcodes don't get any extra Kind bits, and so the code that operates on
those opcodes is largely unchanged.

* CMakeLists.txt:
* JavaScriptCore.xcodeproj/project.pbxproj:
* b3/B3ArgumentRegValue.h:
* b3/B3CCallValue.h:
* b3/B3CheckValue.cpp:
(JSC::B3::CheckValue::convertToAdd):
(JSC::B3::CheckValue::CheckValue):
* b3/B3CheckValue.h:
(JSC::B3::CheckValue::accepts):
* b3/B3Const32Value.h:
* b3/B3Const64Value.h:
* b3/B3ConstDoubleValue.h:
* b3/B3ConstFloatValue.h:
* b3/B3FenceValue.h:
* b3/B3Kind.cpp: Added.
(JSC::B3::Kind::dump):
* b3/B3Kind.h: Added.
(JSC::B3::Kind::Kind):
(JSC::B3::Kind::opcode):
(JSC::B3::Kind::setOpcode):
(JSC::B3::Kind::hasExtraBits):
(JSC::B3::Kind::hasIsChill):
(JSC::B3::Kind::isChill):
(JSC::B3::Kind::setIsChill):
(JSC::B3::Kind::operator==):
(JSC::B3::Kind::operator!=):
(JSC::B3::Kind::hash):
(JSC::B3::Kind::isHashTableDeletedValue):
(JSC::B3::chill):
(JSC::B3::KindHash::hash):
(JSC::B3::KindHash::equal):
* b3/B3LowerMacros.cpp:
* b3/B3LowerToAir.cpp:
(JSC::B3::Air::LowerToAir::lower):
* b3/B3MemoryValue.h:
* b3/B3Opcode.cpp:
(WTF::printInternal):
* b3/B3Opcode.h:
* b3/B3PatchpointValue.h:
(JSC::B3::PatchpointValue::accepts):
* b3/B3ReduceStrength.cpp:
* b3/B3SlotBaseValue.h:
* b3/B3StackmapValue.cpp:
(JSC::B3::StackmapValue::StackmapValue):
* b3/B3StackmapValue.h:
* b3/B3SwitchValue.h:
(JSC::B3::SwitchValue::accepts):
* b3/B3UpsilonValue.h:
* b3/B3Validate.cpp:
* b3/B3Value.cpp:
(JSC::B3::Value::dump):
(JSC::B3::Value::deepDump):
(JSC::B3::Value::invertedCompare):
(JSC::B3::Value::effects):
(JSC::B3::Value::key):
(JSC::B3::Value::typeFor):
(JSC::B3::Value::badKind):
(JSC::B3::Value::badOpcode): Deleted.
* b3/B3Value.h:
* b3/B3ValueInlines.h:
(JSC::B3::Value::as):
* b3/B3ValueKey.cpp:
(JSC::B3::ValueKey::dump):
(JSC::B3::ValueKey::materialize):
* b3/B3ValueKey.h:
(JSC::B3::ValueKey::ValueKey):
(JSC::B3::ValueKey::kind):
(JSC::B3::ValueKey::opcode):
(JSC::B3::ValueKey::operator==):
(JSC::B3::ValueKey::hash):
* b3/B3ValueKeyInlines.h:
(JSC::B3::ValueKey::ValueKey):
* b3/B3VariableValue.cpp:
(JSC::B3::VariableValue::VariableValue):
* b3/B3VariableValue.h:
* b3/testb3.cpp:
(JSC::B3::testChillDiv):
(JSC::B3::testChillDivTwice):
(JSC::B3::testChillDiv64):
(JSC::B3::testChillModArg):
(JSC::B3::testChillModArgs):
(JSC::B3::testChillModImms):
(JSC::B3::testChillModArg32):
(JSC::B3::testChillModArgs32):
(JSC::B3::testChillModImms32):
(JSC::B3::testSwitchChillDiv):
(JSC::B3::testEntrySwitchWithCommonPaths):
(JSC::B3::testEntrySwitchWithCommonPathsAndNonTrivialEntrypoint):
* ftl/FTLOutput.cpp:
(JSC::FTL::Output::chillDiv):
(JSC::FTL::Output::chillMod):

Websites/webkit.org:

Updated the documentation to talk about Kind and the isChill bit, and to remove
ChillDiv/ChillMod.

* docs/b3/intermediate-representation.html:

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

4 years agoparser-syntax-check should display the output of syntax errors
sbarati@apple.com [Thu, 29 Sep 2016 18:44:14 +0000 (18:44 +0000)]
parser-syntax-check should display the output of syntax errors
https://bugs.webkit.org/show_bug.cgi?id=162738

Reviewed by Joseph Pecoraro.

It's good to have this test display the syntax error messages
when we're expecting a syntax error because it will both allow
us to track changes in error messages and verify that we get
the expected error message when writing new tests.

* js/parser-syntax-check-expected.txt:
* js/script-tests/parser-syntax-check.js:
(runTest):

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

4 years agoURLParser should fail to parse unclosed IPv6 addresses
achristensen@apple.com [Thu, 29 Sep 2016 18:19:31 +0000 (18:19 +0000)]
URLParser should fail to parse unclosed IPv6 addresses
https://bugs.webkit.org/show_bug.cgi?id=162715

Reviewed by Tim Horton.

Source/WebCore:

Covered by new API tests.

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

Tools:

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

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

4 years agoURLParser should ignore tabs at all possible locations
achristensen@apple.com [Thu, 29 Sep 2016 18:18:04 +0000 (18:18 +0000)]
URLParser should ignore tabs at all possible locations
https://bugs.webkit.org/show_bug.cgi?id=162711

Reviewed by Tim Horton.

Source/WebCore:

The URL spec says to remove all tabs and newlines before parsing a URL.
To reduce passes on the URL and copies of data, I chose to just ignore them every time I increment the iterator.
This is fragile, but faster.  It can be completely tested, though.  That is what this patch does.

Covered by an addition to the API tests that tries inserting one tab at each location of each test.

* platform/URLParser.cpp:
(WebCore::URLParser::advance):
(WebCore::URLParser::isWindowsDriveLetter):
(WebCore::URLParser::appendWindowsDriveLetter):
(WebCore::URLParser::isPercentEncodedDot):
(WebCore::URLParser::isSingleDotPathSegment):
(WebCore::URLParser::isDoubleDotPathSegment):
(WebCore::URLParser::consumeSingleDotPathSegment):
(WebCore::URLParser::consumeDoubleDotPathSegment):
(WebCore::URLParser::checkLocalhostCodePoint):
(WebCore::URLParser::isAtLocalhost):
(WebCore::URLParser::isLocalhost):
(WebCore::URLParser::URLParser):
(WebCore::URLParser::parse):
(WebCore::isPercentEncodedDot): Deleted.
(WebCore::isSingleDotPathSegment): Deleted.
(WebCore::isDoubleDotPathSegment): Deleted.
(WebCore::consumeSingleDotPathSegment): Deleted.
(WebCore::consumeDoubleDotPathSegment): Deleted.
* platform/URLParser.h:
(WebCore::URLParser::advance):

Tools:

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

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

4 years agoFix hit testing on display:block <svg> elements
simon.fraser@apple.com [Thu, 29 Sep 2016 18:09:59 +0000 (18:09 +0000)]
Fix hit testing on display:block <svg> elements
https://bugs.webkit.org/show_bug.cgi?id=162717
rdar://problem/23261130

Reviewed by Zalan Bujtas.
Source/WebCore:

RenderSVGRoot::nodeAtPoint() needs to test for both the HitTestBlockBackground and
HitTestChildBlockBackground phases, since we only get the HitTestChildBlockBackground
phase when the <svg> is a block. This is similar to code in RenderTable::nodeAtPoint(),
and matches Blink code.

This fixes the point dragging on http://anthonydugois.com/svg-path-builder/.

Test: svg/hittest/block-svg.html

* rendering/svg/RenderSVGRoot.cpp:
(WebCore::RenderSVGRoot::nodeAtPoint):

LayoutTests:

Test hit testing on inline and block <svg> elements.

* svg/hittest/block-svg-expected.txt: Added.
* svg/hittest/block-svg.html: Added.

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

4 years agoWe don't properly propagate non-simple-parameter-list when parsing a setter
sbarati@apple.com [Thu, 29 Sep 2016 18:03:23 +0000 (18:03 +0000)]
We don't properly propagate non-simple-parameter-list when parsing a setter
https://bugs.webkit.org/show_bug.cgi?id=160483

Reviewed by Joseph Pecoraro.

JSTests:

* test262.yaml:

Source/JavaScriptCore:

* parser/Parser.cpp:
(JSC::Parser<LexerType>::parseFunctionParameters):

LayoutTests:

* js/parser-syntax-check-expected.txt:
* js/script-tests/parser-syntax-check.js:

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

4 years agoAssigning non-numeric to input.minlength should set minlength to 0
cdumez@apple.com [Thu, 29 Sep 2016 17:41:50 +0000 (17:41 +0000)]
Assigning non-numeric to input.minlength should set minlength to 0
https://bugs.webkit.org/show_bug.cgi?id=162727

Reviewed by Ryosuke Niwa.

LayoutTests/imported/w3c:

Import test coverage.

* web-platform-tests/html/semantics/forms/the-input-element/minlength-expected.txt: Added.
* web-platform-tests/html/semantics/forms/the-input-element/minlength.html: Added.

Source/WebCore:

There was a typo when we were updating the m_minLength member from the 'min'
content attribute instead of the 'minlength' one.

Test: imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/minlength.html.

* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::parseAttribute):

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

4 years ago[Web IDL] Fix overload resolution when the distinguishing argument is a Window
cdumez@apple.com [Thu, 29 Sep 2016 17:18:35 +0000 (17:18 +0000)]
[Web IDL] Fix overload resolution when the distinguishing argument is a Window
https://bugs.webkit.org/show_bug.cgi?id=162728

Reviewed by Ryosuke Niwa.

Fix overload resolution when the distinguishing argument is a Window.
Window is special because we could have a window or a proxy to the
Window (JSDOMWindowShell).

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateOverloadedFunctionOrConstructor):
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod9):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod10):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod11):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod12):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod13):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod):
* bindings/scripts/test/TestObj.idl:

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

4 years agoFixed compilation of PluginView when NETSCAPE_PLUGIN_API is disabled
annulen@yandex.ru [Thu, 29 Sep 2016 17:08:41 +0000 (17:08 +0000)]
Fixed compilation of PluginView when NETSCAPE_PLUGIN_API is disabled
https://bugs.webkit.org/show_bug.cgi?id=162725

Reviewed by Alex Christensen.

Fix for r206460, streamDidFinishLoading() does not override anything
when NETSCAPE_PLUGIN_API is disabled because PlugivView does not
inherit PluginStreamClient in this case.

* Plugins/PluginView.h:

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

4 years agoUnreviewed, rolling out r206563.
commit-queue@webkit.org [Thu, 29 Sep 2016 17:08:28 +0000 (17:08 +0000)]
Unreviewed, rolling out r206563.
https://bugs.webkit.org/show_bug.cgi?id=162732

Caused stress/op_*.js.ftl-no-cjit tests to time out (Requested
by ryanhaddad on #webkit).

Reverted changeset:

"Re-enable StringView life-cycle checking."
https://bugs.webkit.org/show_bug.cgi?id=160384
http://trac.webkit.org/changeset/206563

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

4 years ago[Win] Compile fix.
pvollan@apple.com [Thu, 29 Sep 2016 15:47:00 +0000 (15:47 +0000)]
[Win] Compile fix.
https://bugs.webkit.org/show_bug.cgi?id=162262

Reviewed by Anders Carlsson.

If CoreText.h is included, we will get redefinition compile errors on some older SDK
versions.

* platform/spi/win/CoreTextSPIWin.h:

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

4 years agoNetworkSession: HTTP authentication doesn't work if PROTECTION_SPACE_AUTH_CALLBACK...
carlosgc@webkit.org [Thu, 29 Sep 2016 15:30:33 +0000 (15:30 +0000)]
NetworkSession: HTTP authentication doesn't work if PROTECTION_SPACE_AUTH_CALLBACK is not enabled
https://bugs.webkit.org/show_bug.cgi?id=162724

Reviewed by Alex Christensen.

NetworkLoad always expects continueCanAuthenticateAgainstProtectionSpace() to be called to complete the
authentication challenge, which is only defined when PROTECTION_SPACE_AUTH_CALLBACK is enabled.
I've added missing #ifdefs for PROTECTION_SPACE_AUTH_CALLBACK.

* NetworkProcess/Downloads/DownloadManager.cpp:
(WebKit::DownloadManager::continueCanAuthenticateAgainstProtectionSpace):
* NetworkProcess/Downloads/DownloadManager.h:
* NetworkProcess/Downloads/PendingDownload.cpp:
(WebKit::PendingDownload::continueCanAuthenticateAgainstProtectionSpace):
* NetworkProcess/Downloads/PendingDownload.h:
* NetworkProcess/NetworkLoad.cpp:
(WebKit::NetworkLoad::~NetworkLoad):
(WebKit::NetworkLoad::didReceiveChallenge): Call completeAuthenticationChallenge() instead of
canAuthenticateAgainstProtectionSpaceAsync() when PROTECTION_SPACE_AUTH_CALLBACK is not enabled.
(WebKit::NetworkLoad::completeAuthenticationChallenge): Moved common code to complete the authentication
challenge from continueCanAuthenticateAgainstProtectionSpace().
(WebKit::NetworkLoad::continueCanAuthenticateAgainstProtectionSpace): Call completeAuthenticationChallenge().
(WebKit::NetworkLoad::canAuthenticateAgainstProtectionSpaceAsync):
* NetworkProcess/NetworkLoad.h:
* NetworkProcess/NetworkLoadClient.h:
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::continueCanAuthenticateAgainstProtectionSpaceDownload):
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.messages.in:
* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::canAuthenticateAgainstProtectionSpaceAsync):
(WebKit::NetworkResourceLoader::continueCanAuthenticateAgainstProtectionSpace):
* NetworkProcess/NetworkResourceLoader.h:
* NetworkProcess/cache/NetworkCacheSpeculativeLoad.h:
* Shared/Authentication/AuthenticationManager.h:
* UIProcess/Downloads/DownloadProxy.cpp:
(WebKit::DownloadProxy::canAuthenticateAgainstProtectionSpace):
* UIProcess/Downloads/DownloadProxy.h:
* UIProcess/Downloads/DownloadProxy.messages.in:

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

4 years ago[SOUP] Remove WebCoreSynchronousLoader from ResourceHandleSoup
carlosgc@webkit.org [Thu, 29 Sep 2016 15:28:54 +0000 (15:28 +0000)]
[SOUP] Remove WebCoreSynchronousLoader from ResourceHandleSoup
https://bugs.webkit.org/show_bug.cgi?id=162723

Reviewed by Sergio Villar Senin.

Since all soup based ports switched to NetworkProcess this is dead code.

* platform/network/soup/ResourceHandleSoup.cpp:
(WebCore::ResourceHandle::platformLoadResourceSynchronously):

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

4 years agoAX: Meter: [Mac] Content in label element should be used as AXTitle or AXDescription
n_wang@apple.com [Thu, 29 Sep 2016 15:13:00 +0000 (15:13 +0000)]
AX: Meter: [Mac] Content in label element should be used as AXTitle or AXDescription
https://bugs.webkit.org/show_bug.cgi?id=162586

Reviewed by Chris Fleizach.

Source/WebCore:

Exposed the label element's text as AXDescription for meter elements.
Also refactored the code for fetching the label element's text and taken care of
the case where aria-label and aria-labelledby attributes are used on label elements.

Test: accessibility/mac/meter-with-label-element.html

* accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::isLabelable):
(WebCore::AccessibilityNodeObject::textForLabelElement):
(WebCore::AccessibilityNodeObject::titleElementText):
(WebCore::AccessibilityNodeObject::title):
(WebCore::AccessibilityNodeObject::usesAltTagForTextComputation): Deleted.
* accessibility/AccessibilityNodeObject.h:
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::exposesTitleUIElement):

LayoutTests:

* accessibility/mac/aria-label-on-label-element-expected.txt:
* accessibility/mac/aria-label-on-label-element.html:
* accessibility/mac/meter-with-label-element-expected.txt: Added.
* accessibility/mac/meter-with-label-element.html: Added.

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

4 years agoClang 3.9 reports a compilation warning about ENABLE_EXCEPTION_SCOPE_VERIFICATION
commit-queue@webkit.org [Thu, 29 Sep 2016 15:12:54 +0000 (15:12 +0000)]
Clang 3.9 reports a compilation warning about ENABLE_EXCEPTION_SCOPE_VERIFICATION
https://bugs.webkit.org/show_bug.cgi?id=162718

Patch by Fujii Hironori <Hironori.Fujii@sony.com> on 2016-09-29
Reviewed by Alex Christensen.

Clang 3.9 reports a following compilation warning:
  Source/JavaScriptCore/runtime/VM.h:656:5: warning: macro expansion producing 'defined' has undefined behavior [-Wexpansion-to-defined]

* wtf/Platform.h: Changed the definition of ENABLE_EXCEPTION_SCOPE_VERIFICATION not to use 'defined'.

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

4 years ago[Streams API] Improve ReadableStreamDefaultController.h/cpp
commit-queue@webkit.org [Thu, 29 Sep 2016 12:48:16 +0000 (12:48 +0000)]
[Streams API] Improve ReadableStreamDefaultController.h/cpp
https://bugs.webkit.org/show_bug.cgi?id=160293

Patch by Romain Bellessort <romain.bellessort@crf.canon.fr> on 2016-09-29
Reviewed by Youenn Fablet.

Various small improvements in ReadableStreamDefaultController code (helper methods and asserts).

No change in behaviour.

* bindings/js/ReadableStreamDefaultController.cpp:
(WebCore::ReadableStreamDefaultController::isControlledReadableStreamLocked): Added an assert and updated based
on new helper methods.
* bindings/js/ReadableStreamDefaultController.h:
(WebCore::ReadableStreamDefaultController::close): Updated based on new helper methods.
(WebCore::ReadableStreamDefaultController::error): Updated based on new helper methods.
(WebCore::ReadableStreamDefaultController::enqueue): Added an assert and updated based on new helper methods.
(WebCore::ReadableStreamDefaultController::jsController): New helper method.
(WebCore::ReadableStreamDefaultController::globalObject): Return reference instead of pointer.
(WebCore::ReadableStreamDefaultController::globalExec): New helper; return reference after performing an assert.
(WebCore::ReadableStreamDefaultController::error<String>): Added an assert and updated based on new helper methods.

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

4 years ago[EFL] Add search button to url bar in MiniBrowser
commit-queue@webkit.org [Thu, 29 Sep 2016 10:28:14 +0000 (10:28 +0000)]
[EFL] Add search button to url bar in MiniBrowser
https://bugs.webkit.org/show_bug.cgi?id=162716

Patch by Gyuyoung Kim <gyuyoung.kim@navercorp.com> on 2016-09-29
Reviewed by Michael Catanzaro.

As a bug title, it would be good to add a search button to URL bar.
Additionally this patch changes color of button to recognize the buttons.

* MiniBrowser/efl/main.c:
(_search_button_clicked_cb):
(_create_toolbar_button):
(window_create):
(create_toolbar_button): Deleted.

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

4 years agoAdded Beacon API to the Feature Status page.
jond@apple.com [Thu, 29 Sep 2016 09:52:52 +0000 (09:52 +0000)]
Added Beacon API to the Feature Status page.
https://bugs.webkit.org/show_bug.cgi?id=162630

Reviewed by Alex Christensen.

* features.json:

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

4 years agoImport touch-events web-platform-tests
cdumez@apple.com [Thu, 29 Sep 2016 04:44:24 +0000 (04:44 +0000)]
Import touch-events web-platform-tests
https://bugs.webkit.org/show_bug.cgi?id=162713

Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

Import touch-events web-platform-tests.

* web-platform-tests/touch-events/OWNERS: Added.
* web-platform-tests/touch-events/create-touch-touchlist.html: Added.
* web-platform-tests/touch-events/historical.html: Added.
* web-platform-tests/touch-events/multi-touch-interactions.js: Added.
(debug_print):
(check_list_subset_of_two_targetlists):
(is_at_least_one_item_in_targetlist):
(check_no_item_in_targetlist):
(check_targets):
(run.):
(run):
* web-platform-tests/touch-events/touch-globaleventhandler-interface.html: Added.
* web-platform-tests/touch-events/touch-support.js: Added.
(check_Touch_object):
(check_TouchEvent):
* web-platform-tests/touch-events/touch-touchevent-constructor.html: Added.
* web-platform-tests/touch-events/w3c-import.log: Added.

LayoutTests:

Skip on all platforms that do not have Touch enabled.

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

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

4 years agoDrop first 'state' parameter to JSDOMWindow::toWrapped() / JSEventTarget::toWrapped()
cdumez@apple.com [Thu, 29 Sep 2016 03:58:33 +0000 (03:58 +0000)]
Drop first 'state' parameter to JSDOMWindow::toWrapped() / JSEventTarget::toWrapped()
https://bugs.webkit.org/show_bug.cgi?id=162709

Reviewed by Alex Christensen.

Drop first 'state' parameter to JSDOMWindow::toWrapped() / JSEventTarget::toWrapped()
as it is unused. This is the quickest way to allow DOMWindow / EventTarget members
in IDL dictionaries. This is because the generated bindings code relies on
convertWrapperType() in JSDOMConvert.h which calls toWrapped() with a single
parameter. Right now, the only type that requires an ExecState for its toWrapped()
is XPathNSResolver (which should likely be a callback interface rather than a
regular interface).

* bindings/js/JSDOMWindowCustom.cpp:
(WebCore::JSDOMWindow::toWrapped):
* bindings/js/JSDictionary.cpp:
(WebCore::JSDictionary::convertValue):
* bindings/js/JSEventTargetCustom.cpp:
(WebCore::JSEventTarget::toWrapped):
* bindings/js/JSMessageEventCustom.cpp:
(WebCore::handleInitMessageEvent):
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateHeader):
(JSValueToNative):

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

4 years agoMarking fast/images/object-image.html as crashing.
ryanhaddad@apple.com [Thu, 29 Sep 2016 01:36:42 +0000 (01:36 +0000)]
Marking fast/images/object-image.html as crashing.
https://bugs.webkit.org/show_bug.cgi?id=162696

Unreviewed test gardening.

* TestExpectations:

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

4 years agostringProtoFuncRepeatCharacter will return `null` when it should not
sbarati@apple.com [Thu, 29 Sep 2016 01:29:03 +0000 (01:29 +0000)]
stringProtoFuncRepeatCharacter will return `null` when it should not
https://bugs.webkit.org/show_bug.cgi?id=161944

Reviewed by Yusuke Suzuki.

JSTests:

* stress/pad-start-calls-repeat-character-with-double.js: Added.
(logLinesWithContext):

Source/JavaScriptCore:

stringProtoFuncRepeatCharacter was expecting its second argument
to always be a boxed integer. This is not correct. The DFG may decide
to represent a particular value as a double instead of integer. This
function needs to have correct behavior when its second argument is
a boxed double. I also added an assertion stating that the second argument
is always a number. We can guarantee this since it's only called from
builtins.

* runtime/StringPrototype.cpp:
(JSC::stringProtoFuncRepeatCharacter):

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