WebKit-https.git
2 years agoCrash in ImageFrameCache::decodedSizeChanged() after image load cancellation
said@apple.com [Sat, 6 May 2017 03:27:16 +0000 (03:27 +0000)]
Crash in ImageFrameCache::decodedSizeChanged() after image load cancellation
https://bugs.webkit.org/show_bug.cgi?id=171736

Reviewed by Tim Horton.

Tests: Covered by run-webkit-tests fast/images/image-formats-support.html
--guard-malloc.

Because an image format is not supported, the ImageObserver of the Image
is deleted then the Image itself is deleted. In BitmapImage destructor,
we make a call which ends up accessing the deleted ImageObserver.

To fix this, we need to change the BitImage destructor to avoid calling
ImageFrameCache::decodedSizeChanged() since it is not really needed.

* platform/graphics/BitmapImage.cpp:
(WebCore::BitmapImage::~BitmapImage):

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

2 years agoREGRESSION (r212998): Web Inspector: bad spacing of go-to arrow for HTTP POST request...
nvasilyev@apple.com [Sat, 6 May 2017 01:59:14 +0000 (01:59 +0000)]
REGRESSION (r212998): Web Inspector: bad spacing of go-to arrow for HTTP POST request data
https://bugs.webkit.org/show_bug.cgi?id=171674

Reviewed by Matt Baker.

* UserInterface/Views/DetailsSection.css:
(body[dir=ltr] .details-section > .content > .group > .row.simple > .value .go-to-arrow):
(body[dir=rtl] .details-section > .content > .group > .row.simple > .value .go-to-arrow):
Swap margin-left and margin-right. This regressed when RTL support was added.

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

2 years ago[Mac] Adjust cursor position for dragged link (and stop it from moving based on how...
timothy_horton@apple.com [Sat, 6 May 2017 01:39:00 +0000 (01:39 +0000)]
[Mac] Adjust cursor position for dragged link (and stop it from moving based on how fast you are dragging)
https://bugs.webkit.org/show_bug.cgi?id=171764
<rdar://problem/32005865>

Reviewed by Simon Fraser.

* page/DragController.cpp:
(WebCore::DragController::startDrag):
Compute dragImageAnchorPoint only if it is needed.
Don't compute a random unused imageRect.
Factor link drag image offset computation out into DragImage functions
for platforms to override.

Pass dragOrigin (the mouseDown point), not mouseDraggedPoint, to
doSystemDrag, just like all the other drag types. This plus the
WebKit2 change makes the link stable vs. the cursor, instead of
positioned based on how fast you move after the mouse down.

* page/DragController.h:
* page/gtk/DragControllerGtk.cpp:
* page/mac/DragControllerMac.mm:
* page/win/DragControllerWin.cpp:
Move LinkDragBorderInset into DragImage, and share between the non-Mac platforms.

* platform/DragImage.cpp:
(WebCore::dragOffsetForLinkDragImage):
(WebCore::anchorPointForLinkDragImage):
* platform/DragImage.h:
As previously mentioned, move the computation of drag image offset here.

* platform/mac/DragImageMac.mm:
(WebCore::dragOffsetForLinkDragImage):
(WebCore::anchorPointForLinkDragImage):
Put the new drag image to the bottom right of the cursor.

* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::dragImageForView):
Always use the last mouse down event to originate the drag; this was a 2004 hack
to work around a seemingly-fixed macOS bug that somehow propagated into WebKit2.
With WebKit2, this would cause trouble because currentEvent could move on
during the bounce to the Web Content process and back, causing the delta between
clientPoint and the mouse point to be dependent on timing, and thus causing the
link to sit at timing-dependent distance from the cursor, instead of exactly
where dragOffsetForLinkDragImage placed it.

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

2 years agoMark compositing/tiling/non-active-window-tiles-size.html as flaky
ryanhaddad@apple.com [Sat, 6 May 2017 01:10:32 +0000 (01:10 +0000)]
Mark compositing/tiling/non-active-window-tiles-size.html as flaky
https://bugs.webkit.org/show_bug.cgi?id=171763

Unreviewed test gardening.

Patch by Matt Lewis <jlewis3@apple.com> on 2017-05-05

* platform/mac-wk2/TestExpectations:

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

2 years agoMove trivial String prototype functions to JS builtins
oliver@apple.com [Sat, 6 May 2017 00:33:20 +0000 (00:33 +0000)]
Move trivial String prototype functions to JS builtins
https://bugs.webkit.org/show_bug.cgi?id=171737

Reviewed by Saam Barati.

Source/JavaScriptCore:

Super simple change to migrate all of the old school
html-ifying string operations to builtin JS.

Core implementation is basically a 1-for-1 match to the spec.

* builtins/StringPrototype.js:
(globalPrivate.createHTML):
(anchor):
(big):
(blink):
(bold):
(fixed):
(fontcolor):
(fontsize):
(italics):
(link):
(small):
(strike):
(sub):
(sup):
* runtime/StringPrototype.cpp:
(JSC::StringPrototype::finishCreation):
(JSC::stringProtoFuncBig): Deleted.
(JSC::stringProtoFuncSmall): Deleted.
(JSC::stringProtoFuncBlink): Deleted.
(JSC::stringProtoFuncBold): Deleted.
(JSC::stringProtoFuncFixed): Deleted.
(JSC::stringProtoFuncItalics): Deleted.
(JSC::stringProtoFuncStrike): Deleted.
(JSC::stringProtoFuncSub): Deleted.
(JSC::stringProtoFuncSup): Deleted.
(JSC::stringProtoFuncFontcolor): Deleted.
(JSC::stringProtoFuncFontsize): Deleted.
(JSC::stringProtoFuncAnchor): Deleted.
(JSC::stringProtoFuncLink): Deleted.

LayoutTests:

Updated output

* js/dom/string-anchor-expected.txt:
* js/dom/string-anchor.html:
* js/dom/string-fontcolor-expected.txt:
* js/dom/string-fontcolor.html:
* js/dom/string-fontsize-expected.txt:
* js/dom/string-fontsize.html:
* js/dom/string-link-expected.txt:
* js/dom/string-link.html:

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

2 years agoLeaks always reports "WebKit Malloc Memory Pressure Handler" dispatch_queue/source...
commit-queue@webkit.org [Sat, 6 May 2017 00:24:11 +0000 (00:24 +0000)]
Leaks always reports "WebKit Malloc Memory Pressure Handler" dispatch_queue/source as leaking
https://bugs.webkit.org/show_bug.cgi?id=171532

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2017-05-05
Reviewed by Geoffrey Garen.

* bmalloc/Heap.cpp:
(bmalloc::Heap::Heap):
* bmalloc/Heap.h:
Store the dispatch_source_t in a member to avoid a false positive leak.

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

2 years ago...and now the GTK and Windows builds.
dino@apple.com [Sat, 6 May 2017 00:17:00 +0000 (00:17 +0000)]
...and now the GTK and Windows builds.

* platform/gtk/WidgetGtk.cpp:
(WebCore::Widget::paint):
* platform/win/WidgetWin.cpp:
(WebCore::Widget::paint):

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

2 years ago[WTF] Do not export deleted constructor in StringView
commit-queue@webkit.org [Sat, 6 May 2017 00:08:55 +0000 (00:08 +0000)]
[WTF] Do not export deleted constructor in StringView
https://bugs.webkit.org/show_bug.cgi?id=171751

Patch by Don Olmstead <don.olmstead@am.sony.com> on 2017-05-05
Reviewed by Alexey Proskuryakov.

* wtf/text/StringView.h:

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

2 years agoAPI test WebKit2.WebsiteDataStoreCustomPaths is failing on ios-simulator.
beidson@apple.com [Sat, 6 May 2017 00:08:42 +0000 (00:08 +0000)]
API test WebKit2.WebsiteDataStoreCustomPaths is failing on ios-simulator.
<rdar://problem/31977294> and https://bugs.webkit.org/show_bug.cgi?id=171513

Reviewed by Andy Estes.

Source/WebCore:

Covered by API test.

* platform/spi/cf/CFNetworkSPI.h:

Source/WebKit2:

* NetworkProcess/cocoa/NetworkProcessCocoa.mm:
(WebKit::NetworkProcess::syncAllCookies):

Tools:

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

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

2 years agoTry to fix iOS build.
dino@apple.com [Sat, 6 May 2017 00:04:37 +0000 (00:04 +0000)]
Try to fix iOS build.

* platform/ios/WidgetIOS.mm:
(WebCore::Widget::paint):

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

2 years ago[JSC] Remove export from Intrinsic
commit-queue@webkit.org [Sat, 6 May 2017 00:03:25 +0000 (00:03 +0000)]
[JSC] Remove export from Intrinsic
https://bugs.webkit.org/show_bug.cgi?id=171752

Patch by Don Olmstead <don.olmstead@am.sony.com> on 2017-05-05
Reviewed by Alexey Proskuryakov.

* runtime/Intrinsic.h:

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

2 years agoRestrict SVG filters to accessible security origins
dino@apple.com [Fri, 5 May 2017 23:49:41 +0000 (23:49 +0000)]
Restrict SVG filters to accessible security origins
https://bugs.webkit.org/show_bug.cgi?id=118689
<rdar://problem/27362159>

Reviewed by Brent Fulgham.

Source/WebCore:

Certain SVG filters should only be allowed to operate
on content that is has SecurityOrigin access to. Implement
this by including a flag in PaintInfo and LayerPaintingInfo,
and have RenderWidget make sure the documents have acceptable
SecurityOrigins as it goes to paint.

This could be used as the first step in a "safe painting"
strategy, allowing some content to be rendered into a
canvas or via the element() CSS function... but it is only
a small first step.

Test: http/tests/css/filters-on-iframes.html

* page/FrameView.cpp:
(WebCore::FrameView::paintContents):
* page/FrameView.h:
* platform/ScrollView.cpp:
(WebCore::ScrollView::paint):
* platform/ScrollView.h:
* platform/Scrollbar.cpp:
(WebCore::Scrollbar::paint):
* platform/Scrollbar.h:
* platform/Widget.h:
* platform/graphics/filters/FilterOperation.h:
(WebCore::FilterOperation::shouldBeRestrictedBySecurityOrigin):
* platform/graphics/filters/FilterOperations.cpp:
(WebCore::FilterOperations::hasFilterThatShouldBeRestrictedBySecurityOrigin):
* platform/graphics/filters/FilterOperations.h:
* platform/mac/WidgetMac.mm:
(WebCore::Widget::paint):
* rendering/FilterEffectRenderer.cpp:
(WebCore::FilterEffectRenderer::build):
* rendering/FilterEffectRenderer.h:
* rendering/PaintInfo.h:
(WebCore::PaintInfo::PaintInfo):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::paint):
(WebCore::RenderLayer::setupFilters):
(WebCore::RenderLayer::paintForegroundForFragmentsWithPhase):
* rendering/RenderLayer.h:
* rendering/RenderScrollbar.cpp:
(WebCore::RenderScrollbar::paint):
* rendering/RenderScrollbar.h:
* rendering/RenderWidget.cpp:
(WebCore::RenderWidget::paintContents):

Source/WebKit2:

Update parameter lists.

* WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::paint):
* WebProcess/Plugins/PluginView.h:

LayoutTests:

Add a test that shows safe frames, unsafe frames, and
then a safe frame that itself has an unsafe frame, to
show that the security requirements are being forwarded
down the tree.

* http/tests/css/filters-on-iframes-expected.html: Added.
* http/tests/css/filters-on-iframes.html: Added.
* http/tests/css/resources/blank.html: Added.
* http/tests/css/resources/references-external.html: Added.
* http/tests/css/resources/solid-red.html: Added.

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

2 years agoUnreviewed, rolling out r216273.
ryanhaddad@apple.com [Fri, 5 May 2017 23:46:45 +0000 (23:46 +0000)]
Unreviewed, rolling out r216273.

This change caused an assertion failure on WK1.

Reverted changeset:

"Crash in ImageFrameCache::decodedSizeChanged() after image
load cancellation"
https://bugs.webkit.org/show_bug.cgi?id=171736
http://trac.webkit.org/changeset/216273

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

2 years ago[Cocoa] Converting from WebCore::Cookie to NSHTTPCookie always marks cookies as sessi...
bburg@apple.com [Fri, 5 May 2017 23:45:05 +0000 (23:45 +0000)]
[Cocoa] Converting from WebCore::Cookie to NSHTTPCookie always marks cookies as session cookies
https://bugs.webkit.org/show_bug.cgi?id=171748
<rdar://problem/32027327>

Reviewed by Michael Catanzaro.

Source/WebCore:

The function that we use to convert from WebCore::Cookie to NSHTTPCookie was
also misusing the NSHTTPCookieDiscard property. If any value is provided for
this key, even @NO, CFNetwork interprets that to mean that the cookie has the
"session" flag.

This is known to affect cookies set via WebCookieManager, WKHTTPCookieStore,
and WebAutomationSession.

This is covered by existing test WebKit2.WKHTTPCookieStore.

* platform/network/cocoa/CookieCocoa.mm:
(WebCore::Cookie::operator NSHTTPCookie *):
Don't include the property if the cookie is not a session cookie.

Tools:

Remove temporary workaround now that the assertion failure is fixed.

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

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

2 years agoMake it possible to test rotation in iOS WebKitTestRunner
simon.fraser@apple.com [Fri, 5 May 2017 23:39:19 +0000 (23:39 +0000)]
Make it possible to test rotation in iOS WebKitTestRunner
https://bugs.webkit.org/show_bug.cgi?id=171755

Reviewed by Tim Horton.

Tools:

Add to UIScriptController:
    void simulateRotation(DeviceOrientation orientation, object callback);
    void simulateRotationLikeSafari(DeviceOrientation orientation, object callback);

The former just does a view resize, as a simple WKWebView app would do. The second does
animation more like MobileSafari, using _begin/_endAnimatedResize. and associated override
layout size and interface orientation. The two behaviors produce different resize and
orientationchange events and sizes, and both need to be tested.

Rotation is initiated by a call on UIDevice, and responded to by the root view controller,
which is now a custom subclass (PlatformWebViewController).

* DumpRenderTree/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptController::simulateRotation):
(WTR::UIScriptController::simulateRotationLikeSafari):
* DumpRenderTree/mac/UIScriptControllerMac.mm:
(WTR::UIScriptController::simulateRotation):
(WTR::UIScriptController::simulateRotationLikeSafari):
* TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
* TestRunnerShared/UIScriptContext/UIScriptController.cpp:
(WTR::toDeviceOrientation):
(WTR::UIScriptController::simulateRotation):
(WTR::UIScriptController::simulateRotationLikeSafari):
* TestRunnerShared/UIScriptContext/UIScriptController.h:
* WebKitTestRunner/cocoa/TestRunnerWKWebView.h:
* WebKitTestRunner/cocoa/TestRunnerWKWebView.mm:
(-[TestRunnerWKWebView dealloc]):
(-[TestRunnerWKWebView _didEndRotation]):
* WebKitTestRunner/ios/PlatformWebViewIOS.mm:
(-[PlatformWebViewController viewWillTransitionToSize:withTransitionCoordinator:]):
(WTR::PlatformWebView::PlatformWebView):
* WebKitTestRunner/ios/TestControllerIOS.mm:
(WTR::TestController::platformResetStateToConsistentValues):
* WebKitTestRunner/ios/UIScriptControllerIOS.mm:
(WTR::toUIDeviceOrientation):
(WTR::UIScriptController::simulateRotation):
(WTR::UIScriptController::simulateRotationLikeSafari):
(WTR::UIScriptController::platformClearAllCallbacks):
* WebKitTestRunner/mac/UIScriptControllerMac.mm:
(WTR::UIScriptController::simulateRotation):
(WTR::UIScriptController::simulateRotationLikeSafari):

LayoutTests:

Two rotation tests and one that comes last to ensure that the device was not left in a rotated state.

* fast/events/ios/rotation/basic-rotation-expected.txt: Added.
* fast/events/ios/rotation/basic-rotation.html: Added.
* fast/events/ios/rotation/safari-like-rotation-expected.txt: Added.
* fast/events/ios/rotation/safari-like-rotation.html: Added.
* fast/events/ios/rotation/zz-no-rotation-expected.txt: Added.
* fast/events/ios/rotation/zz-no-rotation.html: Added.

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

2 years agoEnsure NSColorPickerTouchBarItem only uses sRGB colors
bdakin@apple.com [Fri, 5 May 2017 23:33:04 +0000 (23:33 +0000)]
Ensure NSColorPickerTouchBarItem only uses sRGB colors
https://bugs.webkit.org/show_bug.cgi?id=171758
-and corresponding-
rdar://problem/28314183

Reviewed by Tim Horton.

* UIProcess/Cocoa/WebViewImpl.mm:
(-[WKTextTouchBarItemController itemForIdentifier:]):

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

2 years agoMark http/tests/loading/resourceLoadStatistics/prevalent-resource-without-user-intera...
ryanhaddad@apple.com [Fri, 5 May 2017 23:26:01 +0000 (23:26 +0000)]
Mark http/tests/loading/resourceLoadStatistics/prevalent-resource-without-user-interaction.html as flaky.
https://bugs.webkit.org/show_bug.cgi?id=171756

Unreviewed test gardening.

* platform/wk2/TestExpectations:

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

2 years agoUse ImageDiff built by host SDK and remove ImageDiff from DumpRenderTree
jbedard@apple.com [Fri, 5 May 2017 22:56:29 +0000 (22:56 +0000)]
Use ImageDiff built by host SDK and remove ImageDiff from DumpRenderTree
https://bugs.webkit.org/show_bug.cgi?id=168945
<rdar://problem/30745695>

Reviewed by David Kilzer.

Use ImageDiff built with the host machine's SDK and stop building ImageDiff with the
target SDK. These two changes must happen simultaneously because some archives will
clobber the ImageDiff from the host SDK with the ImageDiff from the target SDK.

* DumpRenderTree/mac/Configurations/ImageDiff.xcconfig: Remove ImageDiff from project.
* DumpRenderTree/PlatformWin.cmake: Remove ImageDiff. Note that the CMakeLists.txt in the
tools directory still includes ImageDiff.
* DumpRenderTree/cg/ImageDiffCG.cpp: Removed.
* DumpRenderTree/mac/Configurations/DumpRenderTree.xcconfig: Removed.
* Scripts/webkitpy/port/darwin.py:
(DarwinPort._path_to_image_diff): Return the correct path to ImageDiff when building
locally or when running archives.
* Scripts/webkitpy/port/image_diff.py:
(IOSSimulatorImageDiffer): Deleted.
* Scripts/webkitpy/port/ios_simulator.py:
(IOSSimulatorPort.diff_image): Deleted.

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

2 years agoTURNS gathering is not working properly
commit-queue@webkit.org [Fri, 5 May 2017 22:50:56 +0000 (22:50 +0000)]
TURNS gathering is not working properly
https://bugs.webkit.org/show_bug.cgi?id=171747

Patch by Youenn Fablet <youenn@apple.com> on 2017-05-05
Reviewed by Eric Carlson.

Did manual testing on real TURNS servers.

* Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
(WebCore::configurationFromMediaEndpointConfiguration): Disabling TURNS servers gathering.

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

2 years agoMark test http/tests/security/module-correct-mime-types.html slow.
ryanhaddad@apple.com [Fri, 5 May 2017 22:43:43 +0000 (22:43 +0000)]
Mark test http/tests/security/module-correct-mime-types.html slow.
https://bugs.webkit.org/show_bug.cgi?id=164960

Unreviewed test gardening.

Patch by Matt Lewis <jlewis3@apple.com> on 2017-05-05

* platform/ios-wk2/TestExpectations:

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

2 years agoputDirectIndex does not properly do defineOwnProperty
sbarati@apple.com [Fri, 5 May 2017 22:35:31 +0000 (22:35 +0000)]
putDirectIndex does not properly do defineOwnProperty
https://bugs.webkit.org/show_bug.cgi?id=171591
<rdar://problem/31735695>

Reviewed by Geoffrey Garen.

JSTests:

* stress/array-prototype-splice-making-typed-array.js:
(test):
* stress/array-species-config-array-constructor.js:
(shouldThrow):
(test):
* stress/put-direct-index-broken-2.js: Added.
(assert):
(test):
(makeLengthWritable):
(set get restoreOldDesc):
* stress/put-direct-index-broken.js: Added.
(whatToTest):
(tryRunning):
(tryItOut):
* stress/put-indexed-getter-setter.js: Added.
(foo.X.prototype.set 7):
(foo.X.prototype.get 7):
(foo.X):
(foo):

Source/JavaScriptCore:

This patch fixes putDirectIndex and its JIT implementations to be
compatible with the ES6 spec. I think our code became out of date
when we implemented ArraySpeciesCreate since ArraySpeciesCreate may
return arbitrary objects. We perform putDirectIndex on that arbitrary
object. The behavior we want is as if we performed defineProperty({configurable:true, enumerable:true, writable:true}).
However, we weren't doing this. putDirectIndex assumed it could just splat
data into any descendent of JSObject's butterfly. For example, this means
we'd just splat into the butterfly of a typed array, even though a typed
array doesn't use its butterfly to store its indexed properties in the usual
way. Also, typed array properties are non-configurable, so this operation
should throw. This also means if we saw a ProxyObject, we'd just splat
into its butterfly, but this is obviously wrong because ProxyObject should
intercept the defineProperty operation.

This patch fixes this issue by adding a whitelist of cell types that can
go down putDirectIndex's fast path. Anything not in that whitelist will
simply call into defineOwnProperty.

* bytecode/ByValInfo.h:
(JSC::jitArrayModePermitsPutDirect):
* dfg/DFGArrayMode.cpp:
(JSC::DFG::ArrayMode::refine):
* jit/JITOperations.cpp:
* runtime/ArrayPrototype.cpp:
(JSC::arrayProtoFuncSplice):
* runtime/ClonedArguments.cpp:
(JSC::ClonedArguments::createStructure):
* runtime/JSGenericTypedArrayViewInlines.h:
(JSC::JSGenericTypedArrayView<Adaptor>::defineOwnProperty):
* runtime/JSObject.cpp:
(JSC::canDoFastPutDirectIndex):
(JSC::JSObject::defineOwnIndexedProperty):
(JSC::JSObject::putDirectIndexSlowOrBeyondVectorLength):
(JSC::JSObject::putDirectIndexBeyondVectorLength): Deleted.
* runtime/JSObject.h:
(JSC::JSObject::putDirectIndex):
(JSC::JSObject::canSetIndexQuicklyForPutDirect): Deleted.
* runtime/JSType.h:

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

2 years agoUnreviewed, rolling out r216275.
ryanhaddad@apple.com [Fri, 5 May 2017 22:30:03 +0000 (22:30 +0000)]
Unreviewed, rolling out r216275.

This change broke internal builds.

Reverted changeset:

"[Cocoa] CTFontDescriptorCreateMatchingFontDescriptor() is not
case insensitive"
https://bugs.webkit.org/show_bug.cgi?id=171636
http://trac.webkit.org/changeset/216275

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

2 years ago[WK2][iOS][macOS] Expand sandbox to access vm.footprint_suspend
bfulgham@apple.com [Fri, 5 May 2017 22:23:51 +0000 (22:23 +0000)]
[WK2][iOS][macOS] Expand sandbox to access vm.footprint_suspend
https://bugs.webkit.org/show_bug.cgi?id=171749
<rdar://problem/32019494>

Reviewed by Geoffrey Garen.

The 'sysctl' whitelist needs to be extended to support an additional VM-related feature.

* DatabaseProcess/mac/com.apple.WebKit.Databases.sb.in:
* NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
* PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
* Resources/SandboxProfiles/ios/com.apple.WebKit.Databases.sb:
* Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
* WebProcess/com.apple.WebProcess.sb.in:

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

2 years ago[Cocoa] CTFontDescriptorCreateMatchingFontDescriptor() is not case insensitive
mmaxfield@apple.com [Fri, 5 May 2017 21:54:59 +0000 (21:54 +0000)]
[Cocoa] CTFontDescriptorCreateMatchingFontDescriptor() is not case insensitive
https://bugs.webkit.org/show_bug.cgi?id=171636
<rdar://problem/30811218>

Reviewed by Dean Jackson.

Source/WebCore:

LastResort is the only name which needs to be looked up case-sensitively. We can handle
this in our existing function which handles special font names (like -apple-system) to
make sure that we always do the right thing.

Test: fast/text/lastResort.html

* platform/spi/cocoa/CoreTextSPI.h:
* platform/graphics/ios/FontCacheIOS.mm:
(WebCore::platformFontWithFamilySpecialCase):
* platform/graphics/mac/FontCacheMac.mm:
(WebCore::platformFontWithFamilySpecialCase):

LayoutTests:

* fast/text/lastResort-expected.html: Added.
* fast/text/lastResort.html: Added.

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

2 years ago[GTK][JSCOnly] Merge MainThread implementations and use generic one
utatane.tea@gmail.com [Fri, 5 May 2017 21:36:58 +0000 (21:36 +0000)]
[GTK][JSCOnly] Merge MainThread implementations and use generic one
https://bugs.webkit.org/show_bug.cgi?id=171738

Reviewed by Michael Catanzaro.

GLib MainThread implementation is generic enough to be used in JSCOnly.
We move it to generic/ and GTK (GLib ports) and JSCOnly use it.
And we also drop GLib MainThread's isMainThread function because
generic thread ID one is enough.

This patch also cleans up initializing main thread code by using std::call_once.

* wtf/MainThread.cpp:
(WTF::initializeMainThread):
(WTF::isMainThread):
(WTF::initializeMainThreadToProcessMainThread):
(WTF::initializeWebThread):
(WTF::canAccessThreadLocalDataForThread):
(WTF::initializeMainThreadOnce): Deleted.
(WTF::initializeMainThreadToProcessMainThreadOnce): Deleted.
(WTF::initializeWebThreadOnce): Deleted.
* wtf/PlatformGTK.cmake:
* wtf/PlatformJSCOnly.cmake:
* wtf/generic/MainThreadGeneric.cpp:
(WTF::MainThreadDispatcher::MainThreadDispatcher):
(WTF::MainThreadDispatcher::schedule):
(WTF::MainThreadDispatcher::fired):
(WTF::scheduleDispatchFunctionsOnMainThread):
* wtf/glib/MainThreadGLib.cpp: Removed.

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

2 years agoCrash in ImageFrameCache::decodedSizeChanged() after image load cancellation
said@apple.com [Fri, 5 May 2017 21:35:54 +0000 (21:35 +0000)]
Crash in ImageFrameCache::decodedSizeChanged() after image load cancellation
https://bugs.webkit.org/show_bug.cgi?id=171736

Reviewed by Tim Horton.

Tests: Covered by run-webkit-tests fast/images/image-formats-support.html
--guard-malloc.

Because an image format is not supported, the ImageObserver of the Image
is deleted then the Image itself is deleted. In BitmapImage destructor,
we make a call which ends up accessing the deleted ImageObserver.

To fix this, we need to setImageObsever of the Image to-be-deleted to
nullptr. So the Image can avoid accessing its ImageObserver, while it is
being deleted. Also we can change the BitImage destructor to avoid calling
ImageFrameCache::decodedSizeChanged() since it is not really needed.

* loader/cache/CachedImage.cpp:
(WebCore::CachedImage::clearImage):
* platform/graphics/BitmapImage.cpp:
(WebCore::BitmapImage::~BitmapImage):

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

2 years agoAPI test WebKit2.WKHTTPCookieStore fails due to possible issue with handling non...
bburg@apple.com [Fri, 5 May 2017 21:15:51 +0000 (21:15 +0000)]
API test WebKit2.WKHTTPCookieStore fails due to possible issue with handling non-session cookies
https://bugs.webkit.org/show_bug.cgi?id=171748

Unreviewed test gardening.

The assertion failure will be investigated separately in order to avoid rolling out
the fix for "secure" cookies. This assertion fails even without r216258 applied.

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

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

2 years agoUnreviewed, rolling out r216260.
jbedard@apple.com [Fri, 5 May 2017 20:52:37 +0000 (20:52 +0000)]
Unreviewed, rolling out r216260.

Breaks internal iOS testers

Reverted changeset:

"Use ImageDiff built by host SDK and remove ImageDiff from
DumpRenderTree"
https://bugs.webkit.org/show_bug.cgi?id=168945
http://trac.webkit.org/changeset/216260

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

2 years agoUnskip media/click-placeholder-not-pausing.html.
ryanhaddad@apple.com [Fri, 5 May 2017 20:36:24 +0000 (20:36 +0000)]
Unskip media/click-placeholder-not-pausing.html.

Unreviewed test gardening.

* platform/mac-wk2/TestExpectations:

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

2 years agoREGRESSION: LayoutTest streams/reference-implementation/readable-stream-templated...
joepeck@webkit.org [Fri, 5 May 2017 20:31:56 +0000 (20:31 +0000)]
REGRESSION: LayoutTest streams/reference-implementation/readable-stream-templated.html is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=171580
<rdar://problem/32009647>

Rubber-stamped by Alexey Proskuryakov.

* TestExpectations:
* streams/reference-implementation/pipe-to-expected.txt:
Rebaseline expectations. This test was previously flakey so the results were
missed unless the test was run with --force.

* streams/reference-implementation/readable-stream-templated-expected.txt:
* streams/reference-implementation/readable-stream-templated.html:
Silence unhandled rejections. This test did not expect unhandled promise
rejections to affect test results, so ignore them.

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

2 years ago[macOS Sierra] LayoutTest http/tests/inspector/network/resource-request-headers.html...
joepeck@webkit.org [Fri, 5 May 2017 20:31:53 +0000 (20:31 +0000)]
[macOS Sierra] LayoutTest http/tests/inspector/network/resource-request-headers.html is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=170702
<rdar://problem/31616643>

Rubber-stamped by Brian Burg.

* platform/mac-wk2/TestExpectations:
* http/tests/inspector/network/resource-request-headers.html:
Make this test unflakey by ensuring we wait for the load to complete.

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

2 years agoResource Load Statistics: Don't cover in-memory and disk caches during website data...
wilander@apple.com [Fri, 5 May 2017 20:23:28 +0000 (20:23 +0000)]
Resource Load Statistics: Don't cover in-memory and disk caches during website data removal
https://bugs.webkit.org/show_bug.cgi?id=171741
<rdar://problem/32020691>

Reviewed by Brent Fulgham.

* UIProcess/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::removeDataRecords):
    No longer removes WebsiteDataType::DiskCache or WebsiteDataType::MemoryCache.

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

2 years ago[JSC] include JSCInlines.h in ObjectInitializationScope.cpp
commit-queue@webkit.org [Fri, 5 May 2017 20:21:17 +0000 (20:21 +0000)]
[JSC] include JSCInlines.h in ObjectInitializationScope.cpp
https://bugs.webkit.org/show_bug.cgi?id=171744

Patch by Guillaume Emont <guijemont@igalia.com> on 2017-05-05
Reviewed by Mark Lam.

* runtime/ObjectInitializationScope.cpp:

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

2 years agoCrashTracer: [USER] com.apple.WebKit.WebContent.Development at com.apple.WebCore...
bburg@apple.com [Fri, 5 May 2017 19:44:47 +0000 (19:44 +0000)]
CrashTracer: [USER] com.apple.WebKit.WebContent.Development at com.apple.WebCore: WebCore::commonVMSlow + 57
https://bugs.webkit.org/show_bug.cgi?id=171669
<rdar://problem/31967684>

Reviewed by Mark Lam.

Source/WebCore:

* bindings/js/CommonVM.h:
(WebCore::commonVMOrNull):
Add an inline accessor function to expose the global variable.

Source/WebKit2:

safaridriver's AutomaticInspection capability causes us to call WebInspectorProxy::connect()
underneath the Automation.inspectBrowsingContext command. This fires a NeedDebuggerBreak
interrupt for the web content's VM, but this is racy because the web content process may
not yet be fully initialized when this interrupt is handled.

To work around this, just don't deliver any interrupts if the VM singleton is still null.
This is a reliable signal that the web content process is not fully initialized yet. Not delivering
is harmless; the interrupt only exists to break out of infinite loops in JS code, but there
could not be any such infinite loop yet if the web content process is not fully initialized.

* WebProcess/WebPage/WebInspectorInterruptDispatcher.cpp:
(WebKit::WebInspectorInterruptDispatcher::notifyNeedDebuggerBreak):

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

2 years agoGCController.cpp's collect() should be Async
fpizlo@apple.com [Fri, 5 May 2017 19:43:22 +0000 (19:43 +0000)]
GCController.cpp's collect() should be Async
https://bugs.webkit.org/show_bug.cgi?id=171708

Reviewed by Saam Barati.

No new tests because no change in behavior.

This is one step towards not requesting sync GCs in WebCore. I'm landing this incrementally to
make bisecting super easy.

* bindings/js/GCController.cpp:
(WebCore::collect):

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

2 years agoWeb Automation: cookie-related commands don't work correctly
bburg@apple.com [Fri, 5 May 2017 19:31:21 +0000 (19:31 +0000)]
Web Automation: cookie-related commands don't work correctly
https://bugs.webkit.org/show_bug.cgi?id=171713
<rdar://problem/29829930>

Reviewed by Alexey Proskuryakov.

Commands that use WebCookieManager directly should complete when
the manager's completion handler is called. Otherwise, this will race
with subsequent accesses to cookies via the web process (document.cookie).

Also, these commands need to use the active browsing context's session ID.
They currently use the process pool's storage session, which is wrong
since we specially configure automation instances with an ephemeral store.

* UIProcess/Automation/WebAutomationSession.cpp:
(WebKit::WebAutomationSession::addSingleCookie):
(WebKit::WebAutomationSession::deleteAllCookies):

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

2 years agoUse ImageDiff built by host SDK and remove ImageDiff from DumpRenderTree
jbedard@apple.com [Fri, 5 May 2017 19:26:35 +0000 (19:26 +0000)]
Use ImageDiff built by host SDK and remove ImageDiff from DumpRenderTree
https://bugs.webkit.org/show_bug.cgi?id=168945
<rdar://problem/30745695>

Reviewed by David Kilzer.

Use ImageDiff built with the host machine's SDK and stop building ImageDiff with the
target SDK. These two changes must happen simultaneously because some archives will
clobber the ImageDiff from the host SDK with the ImageDiff from the target SDK.

* DumpRenderTree/mac/Configurations/ImageDiff.xcconfig: Remove ImageDiff from project.
* DumpRenderTree/PlatformWin.cmake: Remove ImageDiff. Note that the CMakeLists.txt in the
tools directory still includes ImageDiff.
* DumpRenderTree/cg/ImageDiffCG.cpp: Removed.
* DumpRenderTree/mac/Configurations/DumpRenderTree.xcconfig: Removed.
* Scripts/webkitpy/port/darwin.py:
(DarwinPort._path_to_image_diff): Return the correct path to ImageDiff when building
locally or when running archives.
* Scripts/webkitpy/port/image_diff.py:
(IOSSimulatorImageDiffer): Deleted.
* Scripts/webkitpy/port/ios_simulator.py:
(IOSSimulatorPort.diff_image): Deleted.

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

2 years agoAttr Nodes should not have children
cdumez@apple.com [Fri, 5 May 2017 19:26:11 +0000 (19:26 +0000)]
Attr Nodes should not have children
https://bugs.webkit.org/show_bug.cgi?id=171688
<rdar://problem/31998412>

Reviewed by Andreas Kling.

Source/WebCore:

Attr Nodes should not have children as per the latest DOM specification:
- https://dom.spec.whatwg.org/#interface-attr
- https://dom.spec.whatwg.org/#dom-attr-value
- https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity (Step 1)

Firefox and Chrome both have been matching the DOM specification for a while so I think
we should do the same. This aligns us with other browsers, simplifies the code, is
more efficient and the code being removed has been prone to security bugs.

Test: fast/dom/Attr/cannot-have-children.html

* dom/Attr.cpp:
(WebCore::Attr::Attr):
(WebCore::Attr::create):
(WebCore::Attr::setValue):
(WebCore::Attr::cloneNodeInternal):
* dom/Attr.h:
- Have Attr subclass Node instead of ContainerNode as it can no longer have children.
- Drop logic to dealing with children / creating a Text child.

* dom/CharacterData.cpp:
(WebCore::CharacterData::notifyParentAfterChange):
Drop useless check found by the compiler. parentNode() can no longer be an Attr node.

* dom/Node.cpp:
(WebCore::appendTextContent):
appendTextContent() is called by Node.TextContent(). For Attr Nodes, we should no longer traverse
its subtree to gather Text Nodes. Instead, we now return Attr.value, as per the specification:
- https://dom.spec.whatwg.org/#dom-node-textcontent

* dom/Range.cpp:
(WebCore::lengthOfContentsInNode):
As per https://dom.spec.whatwg.org/#concept-node-length, we should return the number of children
for Attr Nodes, which will always be 0.

* xml/XPathUtil.cpp:
(WebCore::XPath::isValidContextNode):
Always return true for TEXT_NODE as the !(node->parentNode() && node->parentNode()->isAttributeNode())
check will also with true now. This is because a parentNode() cannot be an Attribute Node.

LayoutTests:

* fast/dom/Attr/cannot-have-children-expected.txt: Added.
* fast/dom/Attr/cannot-have-children.html: Added.
Add layout test coverage. I have verified that this test passes in both
Firefox and Chrome.

* dom/html/level1/*: Removed legacy / outdated tests.
* dom/xhtml/level1/*: Removed legacy / outdated tests.

* fast/dom/Attr/child-nodes-cache-expected.txt: Removed.
* fast/dom/Attr/child-nodes-cache.html: Removed.
* fast/dom/Attr/child-nodes-length-cache-expected.txt: Removed.
* fast/dom/Attr/child-nodes-length-cache.html: Removed.
* fast/dom/Attr/invalidate-nodelist-after-attr-setvalue-expected.txt: Removed.
* fast/dom/Attr/invalidate-nodelist-after-attr-setvalue.html: Removed.
* fast/dom/attribute-change-on-mutate-expected.txt: Removed.
* fast/dom/attribute-change-on-mutate.html: Removed.
* svg/custom/image-with-attr-change-after-delete-crash-expected.txt: Removed.
* svg/custom/image-with-attr-change-after-delete-crash.html: Removed.
* traversal/moz-bug590771-expected.txt: Removed.
* traversal/moz-bug590771.html: Removed.
Removed some outdated tests.

* fast/custom-elements/reactions-for-webkit-extensions-expected.txt:
* fast/custom-elements/reactions-for-webkit-extensions.html:
* fast/dom/Attr/change-id-via-attr-node-value-expected.txt:
* fast/dom/Attr/change-id-via-attr-node-value.html:
* fast/dom/Element/normalize-crash.html:
* fast/dom/Element/normalize-crash2.html:
* fast/dom/HTMLLinkElement/event-while-removing-attribute-expected.txt:
* fast/dom/HTMLLinkElement/event-while-removing-attribute.html:
* fast/dom/MutationObserver/observe-attributes-expected.txt:
* fast/dom/MutationObserver/observe-attributes.html:
* fast/dom/import-attribute-node.html:
* fast/dom/insertedIntoDocument-child.html:
* fast/dom/insertedIntoDocument-sibling.html:
* fast/dom/no-assert-for-malformed-js-url-attribute-expected.txt:
* fast/dom/no-assert-for-malformed-js-url-attribute.html:
* fast/dom/normalize-attributes-mutation-event-crash.html:
* fast/dom/serialize-nodes.xhtml:
* http/tests/security/xss-DENIED-iframe-src-alias-expected.txt:
Update existing tests so they stop relying on Attr Node having Text children.

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

2 years ago[Cocoa] Converting from WebCore::Cookie to NSHTTPCookie always marks cookies as secure
bburg@apple.com [Fri, 5 May 2017 19:21:37 +0000 (19:21 +0000)]
[Cocoa] Converting from WebCore::Cookie to NSHTTPCookie always marks cookies as secure
https://bugs.webkit.org/show_bug.cgi?id=171700
<rdar://problem/32017975>

Reviewed by Brady Eidson.

Source/WebCore:

The function that we use to convert from WebCore::Cookie to NSHTTPCookie was
misusing the NSHTTPCookieSecure property. If any value is provided for this key,
even @NO, CFNetwork interprets that to mean that the cookie has the "secure" flag.
Thus, in some cases we would store an "insecure" cookie on a site that uses the
http:// protocol, and be unable to later retrieve the cookie. This is known to
affect cookies set via WebCookieManager, WKHTTPCookieStore, and WebAutomationSession.

This is covered by existing test WebKit2.WKHTTPCookieStore.
The test had a bug that masked this problem.

* platform/network/cocoa/CookieCocoa.mm:
(WebCore::Cookie::operator NSHTTPCookie *):
Don't include the property if the cookie is not secure.

Tools:

Fix a mistake in the test that should have caught this bug.

* TestWebKitAPI/Tests/WebKit2Cocoa/WKHTTPCookieStore.mm:
(TEST):
The assertions that were meant to check round-tripping were actually checking
the properties of the original cookie objects, not the round-tripped ones.
This test now fails without the bugfix and passes when it is applied.

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

2 years agoAdd SPI to WebItemProviderPasteboard to synchronously load data with a given timeout
wenson_hsieh@apple.com [Fri, 5 May 2017 19:20:32 +0000 (19:20 +0000)]
Add SPI to WebItemProviderPasteboard to synchronously load data with a given timeout
https://bugs.webkit.org/show_bug.cgi?id=171725
<rdar://problem/32014052>

Reviewed by Beth Dakin.

Adds a synchronousTimeout: argument to doAfterLoadingProvidedContentIntoFileURLs:. If a positive timeout
interval is specified by the client, then we will block the main thread for at most that amount of time after
beginning to load from the item providers.

To do this, we introduce another `dispatch_group_t` in parallel to the `fileLoadingGroup` that is entered and
left in the same places. However, instead of attaching a handler block, we simply perform a synchronous wait for
either the time limit to be reached, or the item providers to finish loading.

No new tests -- no change in behavior yet.

* platform/ios/WebItemProviderPasteboard.h:
* platform/ios/WebItemProviderPasteboard.mm:
(-[WebItemProviderPasteboard doAfterLoadingProvidedContentIntoFileURLs:]):
(-[WebItemProviderPasteboard doAfterLoadingProvidedContentIntoFileURLs:synchronousTimeout:]):

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

2 years agoClean up Attr.idl
cdumez@apple.com [Fri, 5 May 2017 19:16:03 +0000 (19:16 +0000)]
Clean up Attr.idl
https://bugs.webkit.org/show_bug.cgi?id=171691

Reviewed by Andreas Kling.

Clean up Attr.idl to match the spec:
- https://dom.spec.whatwg.org/#interface-attr

No Web-facing behavior change except for Attr properties being enumerated
in a slightly different order.

* dom/Attr.idl:

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

2 years agoUse EXPECT_EQ() when comparing strings in TestWebKitAPI tests
dbates@webkit.org [Fri, 5 May 2017 18:45:16 +0000 (18:45 +0000)]
Use EXPECT_EQ() when comparing strings in TestWebKitAPI tests
https://bugs.webkit.org/show_bug.cgi?id=171698

Reviewed by Darin Adler.

We should use EXPECT_EQ() instead of EXPECT_TRUE() to compare WTF::String() objects
so that we get pretty diff output when the actual string differs from the expected
string as opposed to seeing a boolean result. The former makes makes it straightforward
to diagnose a regression without reading the code for the test or instrumenting it to
determine the actual string that was compared.

* TestWebKitAPI/Tests/WTF/WTFString.cpp:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebCore/mac/GPUFunction.mm:
(TestWebKitAPI::TEST_F):
* TestWebKitAPI/Tests/WebCore/mac/GPULibrary.mm:
(TestWebKitAPI::TEST_F):

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

2 years agoMark w3c test persisted-user-state-restoration/scroll-restoration-fragment-scrolling...
ryanhaddad@apple.com [Fri, 5 May 2017 18:41:36 +0000 (18:41 +0000)]
Mark w3c test persisted-user-state-restoration/scroll-restoration-fragment-scrolling-cross-origin.html as flaky on mac-wk1.
https://bugs.webkit.org/show_bug.cgi?id=161360

Unreviewed test gardening.

* platform/mac-wk1/TestExpectations:

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

2 years agoASSERTION FAILED: !frame().document()->inRenderTreeUpdate() in WebCore::FrameView...
antti@apple.com [Fri, 5 May 2017 18:39:30 +0000 (18:39 +0000)]
ASSERTION FAILED: !frame().document()->inRenderTreeUpdate() in WebCore::FrameView::layout(bool)
https://bugs.webkit.org/show_bug.cgi?id=171717

Reviewed by Brent Fulgham.

* loader/FrameLoader.cpp:
(WebCore::FrameLoader::checkCompleted):

    Don't allow frame load to complete in the middle of a render tree update. Instead delay the check.

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

2 years agoMark 2 webrtc test as failing.
ryanhaddad@apple.com [Fri, 5 May 2017 18:22:45 +0000 (18:22 +0000)]
Mark 2 webrtc test as failing.
https://bugs.webkit.org/show_bug.cgi?id=171728

Unreviewed test gardening.

Patch by Matt Lewis <jlewis3@apple.com> on 2017-05-05

* platform/ios-wk2/TestExpectations:

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

2 years agoRefactor / Clean up Element.idl
cdumez@apple.com [Fri, 5 May 2017 18:14:12 +0000 (18:14 +0000)]
Refactor / Clean up Element.idl
https://bugs.webkit.org/show_bug.cgi?id=171734

Reviewed by Sam Weinig.

Source/WebCore:

Refactor / Clean up Element.idl to match the latest specification:
- https://dom.spec.whatwg.org/#interface-element

There is no Web-facing behavior change in this patch besides the Element properties
being enumerated in a slightly different order. Things that do not match the
specification have merely been annotated with FIXME comments for now. This makes
it much more obvious what's standard, what's not and what needs fixing.

* dom/Element.idl:

LayoutTests:

Rebaseline a couple of tests due to Element properties being enumerated in a slightly
different order and because exception messages have changed slightly.

* fast/dom/Element/attr-param-typechecking-expected.txt:
* js/dom/dom-static-property-for-in-iteration-expected.txt:

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

2 years agoLink drag images for apple.com front page links have a lot of spurious whitespace
timothy_horton@apple.com [Fri, 5 May 2017 18:13:18 +0000 (18:13 +0000)]
Link drag images for apple.com front page links have a lot of spurious whitespace
https://bugs.webkit.org/show_bug.cgi?id=171719
<rdar://problem/32010854>

Reviewed by Wenson Hsieh.

* page/DragController.cpp:
(WebCore::DragController::startDrag):
Use the white-space-simplified string that we put on the pasteboard
for the drag image, too!

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

2 years agoRename webProcessDidCrashWithReason callback to webProcessDidTerminate and stop calli...
cdumez@apple.com [Fri, 5 May 2017 18:11:46 +0000 (18:11 +0000)]
Rename webProcessDidCrashWithReason callback to webProcessDidTerminate and stop calling webProcessDidCrash for client terminations
https://bugs.webkit.org/show_bug.cgi?id=171624

Reviewed by Dan Bernstein.

Source/WebKit2:

Follow-up fixes after r216129 based on feedback I have received:
- Rename webProcessDidCrashWithReason callback function to webProcessDidTerminate given that this is called
  for non-crashes (e.g. terminations requested by the client).
- Rename WKProcessCrashReason / ProcessCrashReason to WKProcessTerminationReason / ProcessTerminationReason
  for consistency with the new naming.
- Stop calling processDidCrash / webProcessDidCrash for terminations requested by the client, to maintain
  pre-r216129 behavior. Those are not crashes (The client used an API such as WKPageTerminateProcess()).
  webProcessDidTerminate will still be called though.
- Fix a bug where - for terminations due to resource limits - WebPageProxy::processDidCrash() was getting
  called twice: First by WebProcessProxy::requestTermination() with reason "RequestedByClient" then a
  second time by WebProcessProxy::terminateProcessDueToResourceLimits() with the proper reason.

* Shared/ProcessTerminationReason.h: Renamed from Source/WebKit2/Shared/ProcessCrashReason.h.
* UIProcess/API/APINavigationClient.h:
(API::NavigationClient::processDidTerminate):
* UIProcess/API/C/WKAPICast.h:
(WebKit::toAPI):
* UIProcess/API/C/WKPage.cpp:
(WKPageTerminate):
(WKPageSetPageNavigationClient):
* UIProcess/API/C/WKPageNavigationClient.h:
* UIProcess/API/C/WKProcessTerminationReason.h: Renamed from Source/WebKit2/UIProcess/API/C/WKProcessCrashReason.h.
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _killWebContentProcessAndResetState]):
* UIProcess/Cocoa/NavigationState.h:
* UIProcess/Cocoa/NavigationState.mm:
(WebKit::NavigationState::NavigationClient::processDidTerminate):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::processDidTerminate):
* UIProcess/WebPageProxy.h:
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::didClose):
(WebKit::WebProcessProxy::requestTermination):
(WebKit::WebProcessProxy::logDiagnosticMessageForResourceLimitTermination):
(WebKit::WebProcessProxy::didExceedActiveMemoryLimit):
(WebKit::WebProcessProxy::didExceedInactiveMemoryLimit):
(WebKit::WebProcessProxy::didExceedBackgroundCPULimit):
* UIProcess/WebProcessProxy.h:
* WebKit2.xcodeproj/project.pbxproj:

Tools:

Extend API test coverage to cover crashes in addition to terminations requested by the client.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2/ProcessDidTerminate.cpp: Renamed from Tools/TestWebKitAPI/Tests/WebKit2/ProcessDidCrashWithReason.cpp.
(TestWebKitAPI::webProcessWasTerminatedByClient):
(TestWebKitAPI::webProcessCrashed):
(TestWebKitAPI::TEST):

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

2 years agoMac cmake buildfix after r216037
commit-queue@webkit.org [Fri, 5 May 2017 18:10:41 +0000 (18:10 +0000)]
Mac cmake buildfix after r216037
https://bugs.webkit.org/show_bug.cgi?id=171558

Patch by Derek Schuff <dschuff@chromium.org> on 2017-05-05
Reviewed by JF Bastien.

* PlatformMac.cmake:

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

2 years ago[GTK] Enable runtime flag for MediaDevices with enable-media-stream property.
clopez@igalia.com [Fri, 5 May 2017 17:35:53 +0000 (17:35 +0000)]
[GTK] Enable runtime flag for MediaDevices with enable-media-stream property.
https://bugs.webkit.org/show_bug.cgi?id=171730

Reviewed by Michael Catanzaro.

After r215939 the MediaDevices runtime setting has to be enabled
also to use MediaStream / WebRTC.

Enable it as part of the enable-media-stream property of the
WebKitGTK+ API.

* UIProcess/API/gtk/WebKitSettings.cpp:
(webkit_settings_set_enable_media_stream):

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

2 years agoDRT's setAudioResultCallback() and IDBRequest::setResult() need to acquire the JSLock.
mark.lam@apple.com [Fri, 5 May 2017 16:14:49 +0000 (16:14 +0000)]
DRT's setAudioResultCallback() and IDBRequest::setResult() need to acquire the JSLock.
https://bugs.webkit.org/show_bug.cgi?id=171716
<rdar://problem/30878027>

Reviewed by Saam Barati.

Source/WebCore:

No new tests.  This issue was caught by existing tests.

IDBRequest::setResult() needs to acquire the JSLock before calling toJS() (which
does JS conversion and therefore, potentially JS allocations).

* Modules/indexeddb/IDBRequest.cpp:
(WebCore::IDBRequest::setResult):
(WebCore::IDBRequest::setResultToStructuredClone):

Tools:

setAudioResultCallback() needs to acquire the JSLock before calling toJS() (which
does JS conversion and therefore, potentially JS allocations) and accessing
methods of internal JS data structures (which may do JS invocation, etc).

* DumpRenderTree/TestRunner.cpp:
(setAudioResultCallback):

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

2 years agoREGRESSION (r215951): LayoutTest media/modern-media-controls/placard-support/placard...
commit-queue@webkit.org [Fri, 5 May 2017 15:49:54 +0000 (15:49 +0000)]
REGRESSION (r215951): LayoutTest media/modern-media-controls/placard-support/placard-support-pip.html is a flaky crash
https://bugs.webkit.org/show_bug.cgi?id=171610
<rdar://problem/31976820>

Patch by Jeremy Jones <jeremyj@apple.com> on 2017-05-05
Reviewed by Eric Carlson.

Source/WebKit/mac:

Fullscreen state gets confused because WK1 WebChromeClient doesn't implement exitVideoFullscreenToModeWithoutAnimation.

* WebCoreSupport/WebChromeClient.h:
* WebCoreSupport/WebChromeClient.mm:
(WebChromeClient::exitVideoFullscreenToModeWithoutAnimation):

LayoutTests:

enable test: media/modern-media-controls/pip-support/pip-support-click.html

* platform/mac-wk1/TestExpectations:

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

2 years agobuildbot: Cleanup simulators after running tests
jbedard@apple.com [Fri, 5 May 2017 15:33:18 +0000 (15:33 +0000)]
buildbot: Cleanup simulators after running tests
https://bugs.webkit.org/show_bug.cgi?id=171679
<rdar://problem/31994361>

Reviewed by Aakash Jain.

We shutdown the simulator process between tests, but in some cases, this is not
sufficient. Explicitly shutdown every booted simulator.

* BuildSlaveSupport/kill-old-processes:
(main): Shutdown all booted simulators.

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

2 years ago[GTK] Assertion failure in Inspector::RemoteInspector::setRemoteInspectorClient when...
carlosgc@webkit.org [Fri, 5 May 2017 13:37:13 +0000 (13:37 +0000)]
[GTK] Assertion failure in Inspector::RemoteInspector::setRemoteInspectorClient when disposing WebKitWebContext
https://bugs.webkit.org/show_bug.cgi?id=171644

Reviewed by Michael Catanzaro.

Source/JavaScriptCore:

Fix ASSERT that requires given client to be a valid pointer, since it's valid to pass nullptr to unset the
client. The ASSERT now ensures that client is set or unset. I also renamed the function to setClient because
setRemoteInspectorClient is redundant for a class named RemoteInspector. And added a getter too, to check if the
remote inspector has a client.

* inspector/remote/RemoteInspector.cpp:
(Inspector::RemoteInspector::setClient):
* inspector/remote/RemoteInspector.h:

Source/WebKit2:

Ensure that it's not possible to enable automation in more than one WebKitWebContext at the same time. Instead
of creating the AutomationClient unconditionally when the context is constructed, it's now created only when
automation is enabled, and deleted if it's disabled.

* UIProcess/API/gtk/WebKitWebContext.cpp:
(webkitWebContextConstructed):
(webkit_web_context_is_automation_allowed):
(webkit_web_context_set_automation_allowed):
* UIProcess/Cocoa/AutomationClient.mm:
(WebKit::AutomationClient::AutomationClient):
(WebKit::AutomationClient::~AutomationClient):

Tools:

Check that only one WebKitWebContext can have automation enabled.

* TestWebKitAPI/Tests/WebKit2Gtk/TestAutomationSession.cpp:
(testAutomationSessionRequestSession):

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

2 years agoUnreviewed GTK+ gardening. Update expectations of tests failing after GST upgrade...
carlosgc@webkit.org [Fri, 5 May 2017 13:29:56 +0000 (13:29 +0000)]
Unreviewed GTK+ gardening. Update expectations of tests failing after GST upgrade to 1.10.4.

* platform/gtk/TestExpectations:

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

2 years ago[GTK] TestController timeout source callback should return G_SOURCE_REMOVE
carlosgc@webkit.org [Fri, 5 May 2017 13:20:15 +0000 (13:20 +0000)]
[GTK] TestController timeout source callback should return G_SOURCE_REMOVE
https://bugs.webkit.org/show_bug.cgi?id=171724

Reviewed by Michael Catanzaro.

It's currently returning CONTINUE which causes it to be called again even if the run loop has been stopped.

* WebKitTestRunner/gtk/TestControllerGtk.cpp:
(WTR::timeoutSource):

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

2 years ago[GStreamer] Do not report more errors after the first one
carlosgc@webkit.org [Fri, 5 May 2017 12:05:39 +0000 (12:05 +0000)]
[GStreamer] Do not report more errors after the first one
https://bugs.webkit.org/show_bug.cgi?id=171722

Reviewed by Xabier Rodriguez-Calvar.

We can receive several error messages for the same error from different elements. That's not expected by the
media source selection algorithm implementation. I don't know if didn't happen with previous versions of GST,
but since the upgrade to 1.10.4 several tests are failing because of this.

Fixes: media/video-error-does-not-exist.html
       media/video-load-networkState.html
       media/video-source-error.html
       media/video-source-none-supported.html
       media/video-source-moved.html

* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::handleMessage): Return early also when an error already occured.

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

2 years ago[GStreamer] Fix handling of gst errors in MediaPlayerPrivateGStreamer::handleMessage
carlosgc@webkit.org [Fri, 5 May 2017 12:02:33 +0000 (12:02 +0000)]
[GStreamer] Fix handling of gst errors in MediaPlayerPrivateGStreamer::handleMessage
https://bugs.webkit.org/show_bug.cgi?id=171721

Reviewed by Xabier Rodriguez-Calvar.

We are checking the GError only comparing the code, and ignoring the domain in some cases. Use g_error_matches()
in those cases instead of only checking the code.

* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::handleMessage):

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

2 years agoUnreviewed GTK+ gardening. Rebaseline several tests.
carlosgc@webkit.org [Fri, 5 May 2017 11:56:22 +0000 (11:56 +0000)]
Unreviewed GTK+ gardening. Rebaseline several tests.

* platform/gtk/editing/simple-line-layout-caret-is-gone-expected.txt: Added.
* platform/gtk/fast/repaint/mutate-non-visible-expected.txt: Added.
* platform/gtk/fast/visual-viewport/rubberbanding-viewport-rects-extended-background-expected.txt:
* platform/gtk/http/tests/security/video-cross-origin-accessfailure-expected.txt: Added.
* platform/gtk/imported/w3c/web-platform-tests/fetch/http-cache/cc-request-expected.txt: Added.

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

2 years agoUnreviewed. Fix wrong assert after r215176.
carlosgc@webkit.org [Fri, 5 May 2017 08:53:23 +0000 (08:53 +0000)]
Unreviewed. Fix wrong assert after r215176.

Cairo surface received by computeMD5HashStringForCairoSurface() doesn't need to be ARGB32 since r215176, it
could also be RGB24 when created from a web view snapshot.

* WebKitTestRunner/cairo/TestInvocationCairo.cpp:
(WTR::computeMD5HashStringForCairoSurface):

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

2 years agoUnreviewed GTK+ gardening.
zandobersek@gmail.com [Fri, 5 May 2017 08:37:17 +0000 (08:37 +0000)]
Unreviewed GTK+ gardening.

* platform/gtk/TestExpectations: Enable already-passing Web Crypto layout tests
for the GTK+ port. Also update expectations for the imported W3C Web Crypto tests.

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

2 years agolldb_webkit.py should provide a type summary for WebCore::URL
bburg@apple.com [Fri, 5 May 2017 06:37:48 +0000 (06:37 +0000)]
lldb_webkit.py should provide a type summary for WebCore::URL
https://bugs.webkit.org/show_bug.cgi?id=171670

Reviewed by Jer Noble.

Just print out the underlying string using the WTFString provider.

* lldb/lldb_webkit.py:
(__lldb_init_module):
(WebCoreURL_SummaryProvider):
(WebCoreURLProvider):
(WebCoreURLProvider.__init__):
(WebCoreURLProvider.to_string):

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

2 years agoUnreviewed, rolling out r216206.
commit-queue@webkit.org [Fri, 5 May 2017 05:37:54 +0000 (05:37 +0000)]
Unreviewed, rolling out r216206.
https://bugs.webkit.org/show_bug.cgi?id=171714

Multiple LayoutTests crashing in Document::page() (Requested
by ap on #webkit).

Reverted changeset:

"Remove support for legacy Notifications"
https://bugs.webkit.org/show_bug.cgi?id=171487
http://trac.webkit.org/changeset/216206

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

2 years agoDrop remaining uses of PassRefPtr from CompositeEditCommand
cdumez@apple.com [Fri, 5 May 2017 05:09:56 +0000 (05:09 +0000)]
Drop remaining uses of PassRefPtr from CompositeEditCommand
https://bugs.webkit.org/show_bug.cgi?id=171645

Reviewed by Darin Adler.

Drop remaining uses of PassRefPtr from CompositeEditCommand.

* editing/ApplyBlockElementCommand.cpp:
(WebCore::ApplyBlockElementCommand::rangeForParagraphSplittingTextNodesIfNeeded):
(WebCore::ApplyBlockElementCommand::endOfNextParagraphSplittingTextNodesIfNeeded):
* editing/ApplyStyleCommand.cpp:
(WebCore::ApplyStyleCommand::applyRelativeFontStyleChange):
(WebCore::ApplyStyleCommand::cleanupUnstyledAppleStyleSpans):
(WebCore::ApplyStyleCommand::splitAncestorsWithUnicodeBidi):
(WebCore::ApplyStyleCommand::removeEmbeddingUpToEnclosingBlock):
(WebCore::ApplyStyleCommand::applyInlineStyleToNodeRange):
(WebCore::ApplyStyleCommand::removeInlineStyleFromElement):
(WebCore::ApplyStyleCommand::replaceWithSpanOrRemoveIfWithoutAttributes):
(WebCore::ApplyStyleCommand::removeImplicitlyStyledElement):
(WebCore::ApplyStyleCommand::removeCSSStyle):
(WebCore::ApplyStyleCommand::applyInlineStyleToPushDown):
(WebCore::ApplyStyleCommand::splitTextAtStart):
(WebCore::ApplyStyleCommand::splitTextAtEnd):
(WebCore::ApplyStyleCommand::splitTextElementAtStart):
(WebCore::ApplyStyleCommand::splitTextElementAtEnd):
(WebCore::ApplyStyleCommand::surroundNodeRangeWithElement):
(WebCore::ApplyStyleCommand::addBlockStyle):
(WebCore::ApplyStyleCommand::addInlineStyleIfNeeded):
(WebCore::ApplyStyleCommand::applyInlineStyleChange):
(WebCore::ApplyStyleCommand::joinChildTextNodes):
* editing/BreakBlockquoteCommand.cpp:
(WebCore::BreakBlockquoteCommand::doApply):
* editing/CompositeEditCommand.cpp:
(WebCore::applyCommand):
(WebCore::CompositeEditCommand::insertNodeAt):
(WebCore::CompositeEditCommand::removeChildrenInRange):
(WebCore::CompositeEditCommand::removeNode):
(WebCore::CompositeEditCommand::removeNodePreservingChildren):
(WebCore::CompositeEditCommand::removeNodeAndPruneAncestors):
(WebCore::CompositeEditCommand::moveRemainingSiblingsToNewParent):
(WebCore::CompositeEditCommand::replaceElementWithSpanPreservingChildrenAndAttributes):
(WebCore::CompositeEditCommand::prune):
(WebCore::CompositeEditCommand::splitTextNode):
(WebCore::CompositeEditCommand::splitElement):
(WebCore::CompositeEditCommand::mergeIdenticalElements):
(WebCore::CompositeEditCommand::splitTextNodeContainingElement):
(WebCore::CompositeEditCommand::positionOutsideTabSpan):
(WebCore::CompositeEditCommand::removeNodeAttribute):
(WebCore::CompositeEditCommand::setNodeAttribute):
(WebCore::CompositeEditCommand::deleteInsignificantText):
(WebCore::CompositeEditCommand::removePlaceholderAt):
(WebCore::CompositeEditCommand::moveParagraphContentsToNewBlockIfNecessary):
(WebCore::CompositeEditCommand::pushAnchorElementDown):
(WebCore::CompositeEditCommand::cleanupAfterDeletion):
(WebCore::CompositeEditCommand::moveParagraphs):
* editing/CompositeEditCommand.h:
* editing/DeleteSelectionCommand.cpp:
(WebCore::DeleteSelectionCommand::handleSpecialCaseBRDelete):
(WebCore::DeleteSelectionCommand::removeNodeUpdatingStates):
(WebCore::DeleteSelectionCommand::removeNode):
(WebCore::DeleteSelectionCommand::makeStylingElementsDirectChildrenOfEditableRootToPreventStyleLoss):
(WebCore::DeleteSelectionCommand::handleGeneralDelete):
(WebCore::DeleteSelectionCommand::mergeParagraphs):
(WebCore::DeleteSelectionCommand::removePreviouslySelectedEmptyTableRows):
(WebCore::DeleteSelectionCommand::removeRedundantBlocks):
* editing/DeleteSelectionCommand.h:
* editing/Editor.cpp:
(WebCore::ClearTextCommand::CreateAndApply):
(WebCore::Editor::replaceSelectionWithFragment):
(WebCore::Editor::handleAcceptedCandidate):
* editing/EditorCommand.cpp:
(WebCore::executeFormatBlock):
* editing/IndentOutdentCommand.cpp:
(WebCore::IndentOutdentCommand::outdentParagraph):
* editing/InsertLineBreakCommand.cpp:
(WebCore::InsertLineBreakCommand::doApply):
* editing/InsertListCommand.cpp:
(WebCore::InsertListCommand::fixOrphanedListChild):
(WebCore::InsertListCommand::doApplyForSingleParagraph):
(WebCore::InsertListCommand::unlistifyParagraph):
* editing/InsertParagraphSeparatorCommand.cpp:
(WebCore::InsertParagraphSeparatorCommand::doApply):
* editing/InsertTextCommand.cpp:
(WebCore::InsertTextCommand::insertTab):
* editing/ModifySelectionListLevel.cpp:
(WebCore::ModifySelectionListLevelCommand::insertSiblingNodeRangeBefore):
(WebCore::ModifySelectionListLevelCommand::insertSiblingNodeRangeAfter):
(WebCore::ModifySelectionListLevelCommand::appendSiblingNodeRange):
(WebCore::DecreaseSelectionListLevelCommand::doApply):
* editing/RemoveNodePreservingChildrenCommand.cpp:
(WebCore::RemoveNodePreservingChildrenCommand::RemoveNodePreservingChildrenCommand):
(WebCore::RemoveNodePreservingChildrenCommand::doApply):
* editing/RemoveNodePreservingChildrenCommand.h:
(WebCore::RemoveNodePreservingChildrenCommand::create):
* editing/ReplaceNodeWithSpanCommand.cpp:
(WebCore::ReplaceNodeWithSpanCommand::ReplaceNodeWithSpanCommand):
(WebCore::ReplaceNodeWithSpanCommand::doApply):
(WebCore::ReplaceNodeWithSpanCommand::doUnapply):
(WebCore::ReplaceNodeWithSpanCommand::getNodesInCommand):
* editing/ReplaceNodeWithSpanCommand.h:
(WebCore::ReplaceNodeWithSpanCommand::create):
* editing/ReplaceSelectionCommand.cpp:
(WebCore::ReplacementFragment::removeNodePreservingChildren):
(WebCore::ReplacementFragment::removeInterchangeNodes):
(WebCore::ReplaceSelectionCommand::removeRedundantStylesAndKeepStyleSpanInline):
(WebCore::ReplaceSelectionCommand::makeInsertedContentRoundTrippableWithHTMLTreeBuilder):
(WebCore::ReplaceSelectionCommand::moveNodeOutOfAncestor):
(WebCore::ReplaceSelectionCommand::removeUnrenderedTextNodesAtEnds):
(WebCore::handleStyleSpansBeforeInsertion):
(WebCore::ReplaceSelectionCommand::handleStyleSpans):
(WebCore::ReplaceSelectionCommand::doApply):
(WebCore::ReplaceSelectionCommand::mergeTextNodesAroundPosition):
(WebCore::ReplaceSelectionCommand::insertAsListItems):
(WebCore::ReplaceSelectionCommand::performTrivialReplace):
* editing/SetNodeAttributeCommand.cpp:
(WebCore::SetNodeAttributeCommand::SetNodeAttributeCommand):
(WebCore::SetNodeAttributeCommand::getNodesInCommand):
* editing/SetNodeAttributeCommand.h:
(WebCore::SetNodeAttributeCommand::create):
* editing/SimplifyMarkupCommand.cpp:
(WebCore::SimplifyMarkupCommand::doApply):
(WebCore::SimplifyMarkupCommand::pruneSubsequentAncestorsToRemove):
* editing/SimplifyMarkupCommand.h:
* editing/SplitElementCommand.cpp:
(WebCore::SplitElementCommand::SplitElementCommand):
(WebCore::SplitElementCommand::executeApply):
(WebCore::SplitElementCommand::getNodesInCommand):
* editing/SplitElementCommand.h:
(WebCore::SplitElementCommand::create):
* editing/SplitTextNodeCommand.cpp:
(WebCore::SplitTextNodeCommand::SplitTextNodeCommand):
(WebCore::SplitTextNodeCommand::doApply):
(WebCore::SplitTextNodeCommand::doUnapply):
(WebCore::SplitTextNodeCommand::doReapply):
(WebCore::SplitTextNodeCommand::insertText1AndTrimText2):
* editing/SplitTextNodeCommand.h:
(WebCore::SplitTextNodeCommand::create):
* editing/SplitTextNodeContainingElementCommand.cpp:
(WebCore::SplitTextNodeContainingElementCommand::SplitTextNodeContainingElementCommand):
(WebCore::SplitTextNodeContainingElementCommand::doApply):
* editing/SplitTextNodeContainingElementCommand.h:
(WebCore::SplitTextNodeContainingElementCommand::create):
* editing/TextInsertionBaseCommand.cpp:
(WebCore::TextInsertionBaseCommand::applyTextInsertionCommand):
* editing/TypingCommand.cpp:
(WebCore::TypingCommand::makeEditableRootEmpty):
* page/ContextMenuController.cpp:
(WebCore::ContextMenuController::contextMenuItemSelected):

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

2 years agoFix misspelled word "interrupt" as pointed out by Darin Adler
dbates@webkit.org [Fri, 5 May 2017 04:04:35 +0000 (04:04 +0000)]
Fix misspelled word "interrupt" as pointed out by Darin Adler
in <https://bugs.webkit.org/show_bug.cgi?id=171577>.

* loader/FrameLoader.cpp:
(WebCore::FrameLoader::transitionToCommitted):

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

2 years agoAPI test WTF.StaticStringImpl crashing in TestWebKitAPI::WTF_StaticStringImpl_Test...
mark.lam@apple.com [Fri, 5 May 2017 03:24:55 +0000 (03:24 +0000)]
API test WTF.StaticStringImpl crashing in TestWebKitAPI::WTF_StaticStringImpl_Test::TestBody() + 3188
https://bugs.webkit.org/show_bug.cgi?id=171702

Reviewed by Filip Pizlo.

The test was supposed to use the MAKE_STATIC_STRING_IMPL macro.  I had previously
changed it to instantiate an automatic StaticStringImpl (i.e. stack allocated) to
confirm that the test will detect a regression.  Unfortunately, I forgot to
change it back to using MAKE_STATIC_STRING_IMPL before I landed the test.
This patch fixes that.

* TestWebKitAPI/Tests/WTF/StringImpl.cpp:
(TestWebKitAPI::neverDestroyedString):

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

2 years agoDisable failing API test WebKit2.ResizeWithHiddenContentDoesNotHang.
ryanhaddad@apple.com [Fri, 5 May 2017 03:20:46 +0000 (03:20 +0000)]
Disable failing API test WebKit2.ResizeWithHiddenContentDoesNotHang.
https://bugs.webkit.org/show_bug.cgi?id=170195

Unreviewed test gardening.

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

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

2 years agoUIColor +whiteColor and +clearColor are ambiguous and need to be casted when soft...
commit-queue@webkit.org [Fri, 5 May 2017 02:32:26 +0000 (02:32 +0000)]
UIColor +whiteColor and +clearColor are ambiguous and need to be casted when soft linked.
https://bugs.webkit.org/show_bug.cgi?id=171704

Patch by Jeremy Jones <jeremyj@apple.com> on 2017-05-04
Reviewed by Jer Noble.

Source/WebCore:

No new tests because no behavior change.

Fix build by casting result of +clearColor to UIColor.

* platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
(clearUIColor):
(WebVideoFullscreenInterfaceAVKit::setupFullscreen):
(WebVideoFullscreenInterfaceAVKit::exitFullscreen):
(WebVideoFullscreenInterfaceAVKit::didStopPictureInPicture):

Source/WebKit/mac:

Fix build by casting result of +whiteColor to UIColor.

* WebView/WebView.mm:
(-[WebView _createImageWithPlatterForImage:boundingRect:contentScaleFactor:clippingRects:]):

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

2 years agoElement.slot should be marked as [Unscopable]
cdumez@apple.com [Fri, 5 May 2017 02:19:14 +0000 (02:19 +0000)]
Element.slot should be marked as [Unscopable]
https://bugs.webkit.org/show_bug.cgi?id=171683

Reviewed by Darin Adler.

Source/WebCore:

Element.slot should be marked as [Unscopable]:
- https://dom.spec.whatwg.org/#interface-element
- https://heycam.github.io/webidl/#Unscopable

Test: fast/shadow-dom/Element-slot-unscopable.html

* dom/Element.idl:

LayoutTests:

Add layout test coverage. This test is passing in Firefox and Chrome.

* fast/shadow-dom/Element-slot-unscopable-expected.txt: Added.
* fast/shadow-dom/Element-slot-unscopable.html: Added.

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

2 years ago[Win] Remove redundant macros that are set in the CMake config
commit-queue@webkit.org [Fri, 5 May 2017 02:11:26 +0000 (02:11 +0000)]
[Win] Remove redundant macros that are set in the CMake config
https://bugs.webkit.org/show_bug.cgi?id=171571

Patch by Don Olmstead <don.olmstead@am.sony.com> on 2017-05-04
Reviewed by Brent Fulgham.

.:

* Source/cmake/OptionsWin.cmake:

Source/JavaScriptCore:

* config.h:

Source/ThirdParty/ANGLE:

* CMakeLists.txt:

Source/WebCore:

No new tests. No change in behavior.

* WebCorePrefix.h:
* config.h:
* platform/win/COMPtr.h:
* platform/win/WindowsTouch.h:
* testing/js/WebCoreTestSupportPrefix.h:

Source/WebCore/PAL:

No new tests. No change in behavior.

* config.h:

Source/WebKit/win:

* COMEnumVariant.h:
* COMPropertyBag.h:
* WebKitPrefix.h:

Source/WTF:

* config.h:

Tools:

* DumpRenderTree/config.h:
* MiniBrowser/win/stdafx.h:
* TestWebKitAPI/config.h:

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

2 years ago[Mac] Modernize image for dragged link
timothy_horton@apple.com [Fri, 5 May 2017 02:07:22 +0000 (02:07 +0000)]
[Mac] Modernize image for dragged link
https://bugs.webkit.org/show_bug.cgi?id=171701
<rdar://problem/31978818>

Reviewed by Simon Fraser.

* WebCore.xcodeproj/project.pbxproj:
* page/mac/DragControllerMac.mm:
* platform/mac/DragImageMac.mm:
(WebCore::dragImageSize):
(WebCore::scaleDragImage):
(WebCore::dissolveDragImageToFraction):
(WebCore::createDragImageFromImage):
(WebCore::LinkImageLayout::LinkImageLayout):
(WebCore::LinkImageLayout::layOutText):
(WebCore::LinkImageLayout::addLine):
(WebCore::createDragImageForLink):
(WebCore::fontFromNSFont): Deleted.
(WebCore::canUseFastRenderer): Deleted.
(WebCore::widthWithFont): Deleted.
(WebCore::drawAtPoint): Deleted.
(WebCore::drawDoubledAtPoint): Deleted.
* platform/spi/cocoa/LinkPresentationSPI.h: Added.
Improve the design of URL drag images.
The margins are increased, the background is now white, the text is
not drawn doubled-up, the title will now wrap to two lines, and the
domain name will appear simplified and de-punycoded.

Much of the implementation of text painting is borrowed from
<attachment> for now, but we should figure out how to generalize
it for UI-like parts of WebKit in the future.

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

2 years agoChange the asynchronous image decoding tests to use the event webkitImageFrameReady
commit-queue@webkit.org [Fri, 5 May 2017 01:53:30 +0000 (01:53 +0000)]
Change the asynchronous image decoding tests to use the event webkitImageFrameReady
https://bugs.webkit.org/show_bug.cgi?id=171634

Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2017-05-04
Reviewed by Simon Fraser.

To test the async image decoding reliably we need to do the following:

-- Make sure to load the image before setting its src to the element.
-- Call document.body.offsetHeight to force layout.
-- Call testRunner.display() to force the first paint.
-- Use the webkitImageFrameReady to reliably know when an image frame is ready.
-- When webkitImageFrameReady is fired call testRunner.notifyDone(). This
   will force the second paint.

* fast/images/async-image-background-image-repeated.html:
* fast/images/async-image-background-image.html:
* fast/images/sprite-sheet-image-draw.html:

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

2 years agoUnreviewed, rolling out r216223.
commit-queue@webkit.org [Fri, 5 May 2017 01:42:40 +0000 (01:42 +0000)]
Unreviewed, rolling out r216223.
https://bugs.webkit.org/show_bug.cgi?id=171706

not quite ready (Requested by thorton on #webkit).

Reverted changeset:

"[Mac] Modernize image for dragged link"
https://bugs.webkit.org/show_bug.cgi?id=171701
http://trac.webkit.org/changeset/216223

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

2 years ago[Mac] Modernize image for dragged link
timothy_horton@apple.com [Fri, 5 May 2017 01:36:49 +0000 (01:36 +0000)]
[Mac] Modernize image for dragged link
https://bugs.webkit.org/show_bug.cgi?id=171701
<rdar://problem/31978818>

Reviewed by Simon Fraser.

* page/mac/DragControllerMac.mm:
* platform/mac/DragImageMac.mm:
(WebCore::dragImageSize):
(WebCore::scaleDragImage):
(WebCore::dissolveDragImageToFraction):
(WebCore::createDragImageFromImage):
(WebCore::LinkImageLayout::LinkImageLayout):
(WebCore::LinkImageLayout::addLine):
(WebCore::createDragImageForLink):
(WebCore::fontFromNSFont): Deleted.
(WebCore::canUseFastRenderer): Deleted.
(WebCore::widthWithFont): Deleted.
(WebCore::drawAtPoint): Deleted.
(WebCore::drawDoubledAtPoint): Deleted.
Improve the design of URL drag images.
The margins are increased, the background is now white, the text is
not drawn doubled-up, the title will now wrap to two lines, and the
domain name will appear simplified and de-punycoded.

Much of the implementation of text painting is borrowed from
<attachment> for now, but we should figure out how to generalize
it for UI-like parts of WebKit in the future.

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

2 years agoMark webrtc/libwebrtc/descriptionGetters.html as flaky.
ryanhaddad@apple.com [Fri, 5 May 2017 01:05:58 +0000 (01:05 +0000)]
Mark webrtc/libwebrtc/descriptionGetters.html as flaky.
https://bugs.webkit.org/show_bug.cgi?id=171703

Unreviewed test gardening.

Patch by Matt Lewis <jlewis3@apple.com> on 2017-05-04

* platform/mac-wk2/TestExpectations:

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

2 years agoUse if instead of return early for 13 places in WebAVPlayerController
commit-queue@webkit.org [Fri, 5 May 2017 00:57:51 +0000 (00:57 +0000)]
Use if instead of return early for 13 places in WebAVPlayerController
https://bugs.webkit.org/show_bug.cgi?id=171692

Patch by Jeremy Jones <jeremyj@apple.com> on 2017-05-04
Reviewed by Jer Noble.

No new tests because no behavior change.

* platform/ios/WebAVPlayerController.mm:
(-[WebAVPlayerController play:]):
(-[WebAVPlayerController pause:]):
(-[WebAVPlayerController togglePlayback:]):
(-[WebAVPlayerController beginScrubbing:]):
(-[WebAVPlayerController endScrubbing:]):
(-[WebAVPlayerController seekToTime:]):
(-[WebAVPlayerController beginScanningForward:]):
(-[WebAVPlayerController endScanningForward:]):
(-[WebAVPlayerController beginScanningBackward:]):
(-[WebAVPlayerController endScanningBackward:]):
(-[WebAVPlayerController seekToBeginning:]):
(-[WebAVPlayerController seekToEnd:]):
(-[WebAVPlayerController toggleMuted:]):

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

2 years agoGardening: Build fix for Windows after r216217.
mark.lam@apple.com [Fri, 5 May 2017 00:46:43 +0000 (00:46 +0000)]
Gardening: Build fix for Windows after r216217.
https://bugs.webkit.org/show_bug.cgi?id=171586

Not reviewed.

* shell/PlatformWin.cmake:

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

2 years agoAdd testRunner.display() to force displaying the web page for testing
commit-queue@webkit.org [Fri, 5 May 2017 00:06:50 +0000 (00:06 +0000)]
Add testRunner.display() to force displaying the web page for testing
https://bugs.webkit.org/show_bug.cgi?id=171694

Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2017-05-04
Reviewed by Simon Fraser.

Unlike testRunner.displayAndTrackRepaints(), this new function forces
drawing the web page but without track repaints.

* DumpRenderTree/TestRunner.cpp:
(displayCallback):
(TestRunner::staticFunctions):
* DumpRenderTree/TestRunner.h:
* DumpRenderTree/mac/TestRunnerMac.mm:
(TestRunner::display):
* DumpRenderTree/win/TestRunnerWin.cpp:
(TestRunner::display):
* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::display):
* WebKitTestRunner/InjectedBundle/TestRunner.h:

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

2 years agoJSC::Heap should expose a richer API for requesting GCs
fpizlo@apple.com [Thu, 4 May 2017 23:37:52 +0000 (23:37 +0000)]
JSC::Heap should expose a richer API for requesting GCs
https://bugs.webkit.org/show_bug.cgi?id=171690

Reviewed by Geoffrey Garen.
Source/JavaScriptCore:

I want to stop WebCore from requesting synchronous GCs. But various parts of that work
may cause regressions, so I'd like to land it separately from the functionality that is
needed on the JSC side. This change is mostly a JSC-side refactoring that does not
change behavior. In the future I'll land the behavior changes (i.e. not requesting sync
GCs).

This change allows you to enumerate over synchronousness, so that we can make all APIs
take synchronousness as an argument. It replaces the collectAllGarbage API with a
collectNow(Synchronousness, GCRequest) API. GCRequest is a new concept, which subsumes
std::optional<CollectionScope> and gives us the ability to register callbacks along
with a GC. So, you can ask for an async GC and get a callback when it's done.

Also adds ability to request that fastMalloc memory be released after the incremental
sweeper finishes.

* API/JSBase.cpp:
(JSSynchronousGarbageCollectForDebugging):
* CMakeLists.txt:
* JavaScriptCore.xcodeproj/project.pbxproj:
* heap/FullGCActivityCallback.cpp:
(JSC::FullGCActivityCallback::doCollection):
* heap/FullGCActivityCallback.h:
* heap/GCRequest.cpp: Added.
(JSC::GCRequest::subsumedBy):
(JSC::GCRequest::dump):
* heap/GCRequest.h: Added.
(JSC::GCRequest::GCRequest):
* heap/Heap.cpp:
(JSC::Heap::collect):
(JSC::Heap::collectNow):
(JSC::Heap::collectAsync):
(JSC::Heap::collectSync):
(JSC::Heap::runBeginPhase):
(JSC::Heap::runEndPhase):
(JSC::Heap::requestCollection):
(JSC::Heap::willStartCollection):
(JSC::Heap::sweeper):
(JSC::Heap::collectNowFullIfNotDoneRecently):
(JSC::Heap::shouldDoFullCollection):
(JSC::Heap::collectAllGarbage): Deleted.
(JSC::Heap::collectAllGarbageIfNotDoneRecently): Deleted.
* heap/Heap.h:
* heap/HeapSnapshotBuilder.cpp:
(JSC::HeapSnapshotBuilder::buildSnapshot):
* heap/IncrementalSweeper.cpp:
(JSC::IncrementalSweeper::doSweep):
* heap/IncrementalSweeper.h:
(JSC::IncrementalSweeper::freeFastMallocMemoryAfterSweeping):
* heap/MarkedAllocator.cpp:
(JSC::MarkedAllocator::doTestCollectionsIfNeeded):
* heap/MarkedSpace.cpp:
(JSC::MarkedSpace::sweep):
* heap/Synchronousness.cpp: Added.
(WTF::printInternal):
* heap/Synchronousness.h: Added.
* inspector/agents/InspectorHeapAgent.cpp:
(Inspector::InspectorHeapAgent::gc):
* jsc.cpp:
(functionGCAndSweep):
(runJSC):
* tools/JSDollarVMPrototype.cpp:
(JSC::JSDollarVMPrototype::gc):
* wasm/WasmMemory.cpp:

Source/WebCore:

No new tests because this is just a refactoring.

Change some function calls now that some JSC::Heap APIs got renamed.

* bindings/js/GCController.cpp:
(WebCore::collect):
(WebCore::GCController::garbageCollectNow):
(WebCore::GCController::garbageCollectNowIfNotDoneRecently):

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

2 years agoNeverDestroyed<String>(ASCIILiteral(...)) is not thread safe.
mark.lam@apple.com [Thu, 4 May 2017 23:24:13 +0000 (23:24 +0000)]
NeverDestroyed<String>(ASCIILiteral(...)) is not thread safe.
https://bugs.webkit.org/show_bug.cgi?id=171586
<rdar://problem/31873190>

Reviewed by Yusuke Suzuki.

Source/JavaScriptCore:

JavaScriptCore allows multiple VMs to be instantiated, and each of these should
be able to run concurrently on different threads.  There is code in the VM that
allocates NeverDestroyed<String>(ASCIILiteral(...)) to defined immortal strings
meant to be shared by all VMs.

However, NeverDestroyed<String>(ASCIILiteral(...)) is not thread-safe because
each thread will ref and deref the underlying StringImpl.  Since this ref and
deref is not done in a thread-safe way, the NeverDestroyed<String> may get
destroyed due to the ref/deref races.  Additionally, each thread may modify the
StringImpl by setting its hash and also twiddling its flags.

The fix is to use the StaticStringImpl class which is safe for ref/derefing
concurrently from different threads.  StaticStringImpl is also pre-set with a
hash on construction, and its flags are set in such a way as to prevent twiddling
at runtime.  Hence, we will be able to share a NeverDestroyed<String> between
VMs, as long as it is backed by a StaticStringImpl.

An alternative solution would be to change all the uses of NeverDestroyed<String>
to use per-VM strings.  However, this solution is cumbersome, and makes it harder
to allocate the intended shared string.  It also uses more memory and takes more
CPU time because it requires allocating the same string for each VM instance.
The StaticStringImpl solution wins out because it is more efficient and is easier
to use.

The StaticStringImpl solution also can be used in WTF without a layer violation.
See Source/WTF/wtf/text/icu/TextBreakIteratorICU.h for an example.

Also added the MultithreadedMultiVMExecutionTest which runs multiple VMs in
multiple threads, all banging on the BuiltinExecutable's baseConstructorCode
NeverDestroyed<String>.  The test will manifest the issue reliably (before this
fix) if run on an ASAN build.

* API/tests/MultithreadedMultiVMExecutionTest.cpp: Added.
(threadsList):
(startMultithreadedMultiVMExecutionTest):
(finalizeMultithreadedMultiVMExecutionTest):
* API/tests/MultithreadedMultiVMExecutionTest.h: Added.
* API/tests/testapi.c:
(main):
* JavaScriptCore.xcodeproj/project.pbxproj:
* builtins/BuiltinExecutables.cpp:
(JSC::BuiltinExecutables::createDefaultConstructor):
* inspector/agents/InspectorDebuggerAgent.cpp:
(Inspector::objectGroupForBreakpointAction):
* replay/scripts/CodeGeneratorReplayInputsTemplates.py:
* replay/scripts/tests/expected/generate-enum-encoding-helpers-with-guarded-values.json-TestReplayInputs.cpp:
(JSC::InputTraits<Test::SavedMouseButton>::type):
* replay/scripts/tests/expected/generate-enum-encoding-helpers.json-TestReplayInputs.cpp:
(JSC::InputTraits<Test::SavedMouseButton>::type):
* replay/scripts/tests/expected/generate-enum-with-guard.json-TestReplayInputs.cpp:
(JSC::InputTraits<Test::HandleWheelEvent>::type):
* replay/scripts/tests/expected/generate-enums-with-same-base-name.json-TestReplayInputs.cpp:
(JSC::InputTraits<Test::FormCombo>::type):
* replay/scripts/tests/expected/generate-input-with-guard.json-TestReplayInputs.cpp:
(JSC::InputTraits<Test::GetCurrentTime>::type):
(JSC::InputTraits<Test::SetRandomSeed>::type):
* replay/scripts/tests/expected/generate-input-with-vector-members.json-TestReplayInputs.cpp:
(JSC::InputTraits<Test::ArrayOfThings>::type):
(JSC::InputTraits<Test::SavedHistory>::type):
* replay/scripts/tests/expected/generate-inputs-with-flags.json-TestReplayInputs.cpp:
(JSC::InputTraits<Test::ScalarInput1>::type):
(JSC::InputTraits<Test::ScalarInput2>::type):
* replay/scripts/tests/expected/generate-memoized-type-modes.json-TestReplayInputs.cpp:
(JSC::InputTraits<Test::ScalarInput>::type):
(JSC::InputTraits<Test::MapInput>::type):
* runtime/IntlObject.cpp:
(JSC::numberingSystemsForLocale):

Source/WebCore:

No new tests because we're just converting uses of ASCIILiteral (in the
instantiation of NeverDestroyed<String> and NeverDestroyed<const String>) to
MAKE_STATIC_STRING_IMPL.

The correctness of using MAKE_STATIC_STRING_IMPL is tested in the newly added
API test in this patch.

Also changed "static NeverDestroyed<ASCIILiteral>" instances in
SQLiteIDBBackingStore.cpp to "static const char* const" because they are only
ever used to get the underlying const char*.

* Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
(WebCore::IDBServer::SQLiteIDBBackingStore::getRecord):
(WebCore::IDBServer::SQLiteIDBBackingStore::cachedStatementForGetAllObjectStoreRecords):
* Modules/mediastream/MediaEndpointSessionDescription.cpp:
* Modules/mediastream/RTCRtpTransceiver.cpp:
* Modules/mediastream/SDPProcessor.cpp:
* Modules/navigatorcontentutils/NavigatorContentUtils.cpp:
(WebCore::customHandlersStateString):
(WebCore::NavigatorContentUtils::isProtocolHandlerRegistered):
* Modules/speech/SpeechSynthesis.cpp:
(WebCore::SpeechSynthesis::boundaryEventOccurred):
* accessibility/AccessibilityMediaControls.cpp:
(WebCore::AccessibilityMediaControl::controlTypeName):
(WebCore::AccessibilityMediaControl::title):
(WebCore::AccessibilityMediaControlsContainer::elementTypeName):
(WebCore::AccessibilityMediaTimeline::helpText):
(WebCore::AccessibilityMediaTimeDisplay::accessibilityDescription):
* bindings/js/JSLazyEventListener.cpp:
(WebCore::eventParameterName):
* contentextensions/ContentExtensionsBackend.cpp:
(WebCore::ContentExtensions::ContentExtensionsBackend::displayNoneCSSRule):
* css/CSSDefaultStyleSheets.cpp:
(WebCore::screenEval):
(WebCore::printEval):
* css/MediaList.cpp:
(WebCore::addResolutionWarningMessageToConsole):
* css/StyleSheetContents.cpp:
(WebCore::StyleSheetContents::parseAuthorStyleSheet):
* dom/Document.cpp:
(WebCore::Document::readyState):
* dom/LoadableClassicScript.cpp:
(WebCore::LoadableClassicScript::notifyFinished):
* dom/PseudoElement.cpp:
(WebCore::PseudoElement::pseudoElementNameForEvents):
* editing/MarkupAccumulator.cpp:
(WebCore::MarkupAccumulator::shouldAddNamespaceElement):
* editing/cocoa/DataDetection.mm:
(WebCore::DataDetection::dataDetectorURLProtocol):
* editing/markup.cpp:
(WebCore::StyledMarkupAccumulator::styleNodeCloseTag):
(WebCore::createMarkupInternal):
* html/FormController.cpp:
(WebCore::formStateSignature):
* html/ImageInputType.cpp:
(WebCore::ImageInputType::appendFormData):
* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::realizeSaves):
(WebCore::CanvasRenderingContext2D::getImageData):
* html/parser/XSSAuditor.cpp:
(WebCore::XSSAuditor::init):
(WebCore::XSSAuditor::eraseDangerousAttributesIfInjected):
* html/track/VTTCue.cpp:
(WebCore::startKeyword):
(WebCore::middleKeyword):
(WebCore::endKeyword):
(WebCore::leftKeyword):
(WebCore::rightKeyword):
(WebCore::verticalGrowingLeftKeyword):
(WebCore::verticalGrowingRightKeyword):
(WebCore::VTTCue::determineTextDirection):
(WebCore::VTTCue::markFutureAndPastNodes):
* inspector/InspectorCSSAgent.cpp:
(WebCore::computePseudoClassMask):
* inspector/InspectorIndexedDBAgent.cpp:
* inspector/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::sourceMapURLForResource):
* inspector/PageDebuggerAgent.cpp:
(WebCore::PageDebuggerAgent::sourceMapURLForScript):
* loader/ImageLoader.cpp:
(WebCore::ImageLoader::notifyFinished):
* loader/TextTrackLoader.cpp:
(WebCore::TextTrackLoader::corsPolicyPreventedLoad):
* loader/icon/IconDatabase.cpp:
(WebCore::IconDatabase::defaultDatabaseFilename):
* page/CaptionUserPreferencesMediaAF.cpp:
(WebCore::CaptionUserPreferencesMediaAF::captionsTextEdgeCSS):
* page/SecurityOrigin.cpp:
(WebCore::SecurityOrigin::urlWithUniqueSecurityOrigin):
* page/UserContentURLPattern.cpp:
(WebCore::UserContentURLPattern::parse):
* platform/MIMETypeRegistry.cpp:
(WebCore::defaultMIMEType):
* platform/animation/Animation.cpp:
(WebCore::Animation::initialName):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::engineDescription):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::engineDescription):
* platform/graphics/cocoa/FontCacheCoreText.cpp:
(WebCore::FontCache::similarFont):
* platform/gtk/UserAgentGtk.cpp:
(WebCore::platformVersionForUAString):
* platform/mock/mediasource/MockBox.cpp:
(WebCore::MockTrackBox::type):
(WebCore::MockInitializationBox::type):
(WebCore::MockSampleBox::type):
* platform/network/HTTPHeaderValues.cpp:
(WebCore::HTTPHeaderValues::textPlainContentType):
(WebCore::HTTPHeaderValues::formURLEncodedContentType):
(WebCore::HTTPHeaderValues::noCache):
(WebCore::HTTPHeaderValues::maxAge0):
* platform/network/HTTPParsers.cpp:
(WebCore::parseXSSProtectionHeader):
* replay/MemoizedDOMResult.cpp:
(JSC::InputTraits<MemoizedDOMResultBase>::type):
* svg/SVGTransformValue.cpp:
(WebCore::SVGTransformValue::transformTypePrefixForParsing):

Source/WebKit2:

* Shared/API/APIError.cpp:
(API::Error::webKitErrorDomain):
(API::Error::webKitNetworkErrorDomain):
(API::Error::webKitPolicyErrorDomain):
(API::Error::webKitPluginErrorDomain):
(API::Error::webKitDownloadErrorDomain):
(API::Error::webKitPrintErrorDomain):
* Shared/WebPreferencesKeys.cpp:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::executeEditCommand):
* WebProcess/WebCoreSupport/WebEditorClient.cpp:
(WebKit::WebEditorClient::didBeginEditing):
(WebKit::WebEditorClient::respondToChangedContents):
(WebKit::WebEditorClient::respondToChangedSelection):
(WebKit::WebEditorClient::didEndEditing):

Source/WTF:

StaticStringImpl is meant to be thread-safe.  However, it has a bug: it did not
set the s_hashFlagDidReportCost flag.  As a result, if cost() is called on it,
different threads may try to change its flags bits at the same time.  This patch
changes StaticStringImpl to always set the s_hashFlagDidReportCost flag.

Also factored out StringImplShape and made StringImpl and StaticStringImpl extend
it.  This makes it more clear that the 2 are intended to have the same shape.
Note: there is already a static_assert that the 2 have the same size.  This
change also ensures that they both have the same shape, which is a requirement in
order for StaticStringImpl to work.

Introduced the MAKE_STATIC_STRING_IMPL macro as a convenient way to instantiate
StaticStringImpls from literal strings.  This allows us to trivially change

    NeverDestroyed<String> myString(ASCIILiteral("myString"));

to ...

    NeverDestroyed<String> myString(MAKE_STATIC_STRING_IMPL("myString"));

and by so doing, make it thread-safe.

MAKE_STATIC_STRING_IMPL instantiates a lambda function to create the static
StaticStringImpls.

* wtf/text/StringImpl.h:
(WTF::StringImplShape::StringImplShape):
(WTF::StringImpl::StringImpl):
(WTF::StringImpl::cost):
(WTF::StringImpl::setHash):
(WTF::StringImpl::StaticStringImpl::StaticStringImpl):
(WTF::StringImpl::StaticStringImpl::operator StringImpl&):
* wtf/text/WTFString.h:
(WTF::String::String):
* wtf/text/icu/TextBreakIteratorICU.h:
(WTF::caretRules):

Tools:

API test for exercising StaticStringImpl and the MAKE_STATIC_STRING_IMPL macro.

* TestWebKitAPI/Tests/WTF/StringImpl.cpp:
(TestWebKitAPI::neverDestroyedString):
(TestWebKitAPI::getNeverDestroyedStringAtStackDepth):
(TestWebKitAPI::TEST):

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

2 years agoSource/WebCore:
commit-queue@webkit.org [Thu, 4 May 2017 23:18:48 +0000 (23:18 +0000)]
Source/WebCore:
Add muted to WebPlaybackSessionModel.
https://bugs.webkit.org/show_bug.cgi?id=171592
rdar://problem/31814074

Patch by Jeremy Jones <jeremyj@apple.com> on 2017-05-04
Reviewed by Jer Noble.

No behavior change. This just adds the ability for UI to mute.

* platform/cocoa/WebPlaybackSessionModel.h:
(WebCore::WebPlaybackSessionModelClient::mutedChanged):
* platform/cocoa/WebPlaybackSessionModelMediaElement.h:
* platform/cocoa/WebPlaybackSessionModelMediaElement.mm:
(WebCore::WebPlaybackSessionModelMediaElement::updateForEventName):
(WebCore::WebPlaybackSessionModelMediaElement::toggleMuted):
(WebCore::WebPlaybackSessionModelMediaElement::observedEventNames):
(WebCore::WebPlaybackSessionModelMediaElement::isMuted):
* platform/ios/WebAVPlayerController.h:
* platform/ios/WebAVPlayerController.mm:
(-[WebAVPlayerController toggleMuted:]):
* platform/ios/WebPlaybackSessionInterfaceAVKit.h:
* platform/ios/WebPlaybackSessionInterfaceAVKit.mm:
(WebCore::WebPlaybackSessionInterfaceAVKit::mutedChanged):
* platform/ios/WebVideoFullscreenControllerAVKit.mm:
(WebVideoFullscreenControllerContext::mutedChanged):
(WebVideoFullscreenControllerContext::isMuted):
(WebVideoFullscreenControllerContext::toggleMuted):
* platform/spi/ios/MediaPlayerSPI.h:

Source/WebKit2:
Add mute to WebPlaybackSessionModel.
https://bugs.webkit.org/show_bug.cgi?id=171592
rdar://problem/31814074

Patch by Jeremy Jones <jeremyj@apple.com> on 2017-05-04
Reviewed by Jer Noble.

Plumb through muted.

* UIProcess/Cocoa/WebPlaybackSessionManagerProxy.h:
* UIProcess/Cocoa/WebPlaybackSessionManagerProxy.messages.in:
* UIProcess/Cocoa/WebPlaybackSessionManagerProxy.mm:
(WebKit::WebPlaybackSessionModelContext::toggleMuted):
(WebKit::WebPlaybackSessionModelContext::setMuted):
(WebKit::WebPlaybackSessionManagerProxy::setMuted):
(WebKit::WebPlaybackSessionManagerProxy::toggleMuted):
* WebProcess/cocoa/WebPlaybackSessionManager.h:
* WebProcess/cocoa/WebPlaybackSessionManager.messages.in:
* WebProcess/cocoa/WebPlaybackSessionManager.mm:
(WebKit::WebPlaybackSessionInterfaceContext::mutedChanged):
(WebKit::WebPlaybackSessionManager::mutedChanged):
(WebKit::WebPlaybackSessionManager::toggleMuted):

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

2 years agoREGRESSION(r216138): Web Inspector: ASSERT(!content.isNull()) when checking for sourc...
joepeck@webkit.org [Thu, 4 May 2017 23:04:34 +0000 (23:04 +0000)]
REGRESSION(r216138): Web Inspector: ASSERT(!content.isNull()) when checking for source map url opening inspector
https://bugs.webkit.org/show_bug.cgi?id=171697
<rdar://problem/31999512>

Reviewed by Matt Baker.

* inspector/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::cachedResourceContent):
Always set base64Encoded when returning true. Return the empty
string instead of a null string matching previous behavior.

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

2 years ago[INTL] Add PerformanceTests for Intl objects
commit-queue@webkit.org [Thu, 4 May 2017 23:03:52 +0000 (23:03 +0000)]
[INTL] Add PerformanceTests for Intl objects
https://bugs.webkit.org/show_bug.cgi?id=171695

Patch by Andy VanWagoner <thetalecrafter@gmail.com> on 2017-05-04
Reviewed by Benjamin Poulain.

* Intl/collator-compare-all-options.html: Added.
* Intl/collator-compare-default.html: Added.
* Intl/collator-create-all-options.html: Added.
* Intl/collator-create-default.html: Added.
* Intl/datetimeformat-create-all-options.html: Added.
* Intl/datetimeformat-create-default.html: Added.
* Intl/datetimeformat-format-all-options.html: Added.
* Intl/datetimeformat-format-default.html: Added.
* Intl/numberformat-create-all-options.html: Added.
* Intl/numberformat-create-default.html: Added.
* Intl/numberformat-format-all-options.html: Added.
* Intl/numberformat-format-default.html: Added.

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

2 years ago[WK2] Image action sheets sometimes do not dismiss when beginning data interaction
wenson_hsieh@apple.com [Thu, 4 May 2017 22:35:31 +0000 (22:35 +0000)]
[WK2] Image action sheets sometimes do not dismiss when beginning data interaction
https://bugs.webkit.org/show_bug.cgi?id=171687
<rdar://problem/31996534>

Reviewed by Beth Dakin.

When presenting an image sheet using WKActionSheetAssistant, we may present the popover asynchronously. In this
case, even if -cleanupSheet is invoked after -showImageSheet, the popover will still be presented. To fix this,
add a flag, _hasPendingActionSheet, that is set to true when an image action sheet will be presented in the
future.

In cleanupSheet, we revert this flag to NO, and in the sheet presentation block, we first check to see if there
is a pending action sheet. If there is not, then simply do not invoke the image sheet presentation block.

* UIProcess/ios/WKActionSheetAssistant.mm:
(-[WKActionSheetAssistant showImageSheet]):
(-[WKActionSheetAssistant cleanupSheet]):

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

2 years ago[WK2] Add support for keeping the selection in a focused editable element when draggi...
wenson_hsieh@apple.com [Thu, 4 May 2017 22:28:22 +0000 (22:28 +0000)]
[WK2] Add support for keeping the selection in a focused editable element when dragging begins
https://bugs.webkit.org/show_bug.cgi?id=171585
<rdar://problem/31544320>

Reviewed by Beth Dakin and Zalan Bujtas.

Source/WebCore:

Covered by 4 API tests.

* dom/DocumentMarker.h:

Introduces the DraggedContent DocumentMarker type, which applies to the Range in the DOM that is being used as
a drag source. Also adds DraggedContentData, which contains nodes found by the TextIterator in the process of
finding Ranges to mark.

(WebCore::DocumentMarker::AllMarkers::AllMarkers):
* dom/DocumentMarkerController.cpp:
(WebCore::DocumentMarkerController::addDraggedContentMarker):
(WebCore::shouldInsertAsSeparateMarker):
(WebCore::DocumentMarkerController::addMarker):

When adding DocumentMarkers of type DraggedContent, keep adjacent RenderReplaced elements separate, rather than
merging them into existing RenderedDocumentMarkers. This is because the data for each of these (i.e. the target
node) needs to be preserved.

(WebCore::DocumentMarkerController::markersFor):

Bail and return an empty list if the map of document markers cannot possibly contain a dragged content marker.

* dom/DocumentMarkerController.h:
* page/DragController.h:
* page/DragState.h:

Add draggedContentRange to DragState. This tracks the Range that is being dragged; it is created when the drag
session has begun, and ends when drag session finishes (either via WebPage::dragEnded or WebPage::dragCancelled).

* page/EventHandler.cpp:
(WebCore::repaintContentsOfRange):
(WebCore::EventHandler::dragCancelled):

Called when a drag is cancelled in the UI process without a session ever getting a chance to begin. We use this
as a hook to remove all DraggedContent document markers from the document of the dragged content range.

(WebCore::EventHandler::didStartDrag):

Called when a drag session has begun in the UI process. We use this as a hook to set up document markers for the
Range of content being dragged.

(WebCore::EventHandler::dragSourceEndedAt):

Called when a drag session ends. We use this as a hook to remove all DraggedContent document markers from the
document of the dragged content range.

(WebCore::EventHandler::draggedElement):
* page/EventHandler.h:
* page/FocusController.cpp:
(WebCore::shouldClearSelectionWhenChangingFocusedElement):

Prevent the selection from clearing when the previously focused element is editable and also contains the drag
source element. Ideally, we should experiment with clearing out the selection whenever the element is blurred
(and not have additional restrictions on editability and containing the drag source), but this change is much
riskier.

(WebCore::FocusController::setFocusedElement):
* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::paint):

Use RenderText::draggedContentStartEnd to find the range of text (if any) that is dragged content, and paint
these ranges of text at a lower alpha using TextPainter::paintTextInRange.

* rendering/RenderReplaced.cpp:
(WebCore::draggedContentContainsReplacedElement):

Determines whether or not the element being rendered is contained within a dragged content range. Assuming that
the DraggedContent type flag is set in DocumentMarkerController, we first look to see whether or not the
container node is in the document marker map. If so, instead of consulting node offset ranges (since this is, in
the worst-case, linear in the number of sibling nodes per RenderReplaced) we simply check the DraggedContentData
to see if the current element being rendered matches one of the target nodes.

(WebCore::RenderReplaced::paint):

If the element rendered by this RenderReplaced is dragged content, then render it at a low alpha.

* rendering/RenderText.cpp:
(WebCore::RenderText::draggedContentRangesBetweenOffsets):

Determines what range of text, if any, contains dragged content by consulting the Document's DocumentMarkers.

* rendering/RenderText.h:
* rendering/TextPainter.cpp:
(WebCore::TextPainter::paintTextInRange):

Teach TextPainter to only paint a given range in a TextRun.

* rendering/TextPainter.h:

Add TextPainter support for specifying special text offset ranges when rendering a TextRun, such that each
special range in text is rendered after applying some modification to the GraphicsContext.

Source/WebKit2:

Minor adjustments and refactoring in WebKit2. See WebCore ChangeLog for more details.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::startDrag):
(WebKit::WebPageProxy::didStartDrag):

Factor out code in WebPageProxy that sends a WebPage::DidStartDrag message to the web process into a separate
helper, and tweak the places where we directly send this IPC message to the web process to instead call this
helper.

* UIProcess/WebPageProxy.h:
* UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::setDragImage):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::didStartDrag):
(WebKit::WebPage::dragCancelled):

Clear out state in the web process and call out to the EventHandler to handle drag cancellation and the drag
start response from the UI process.

* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::didStartDrag): Deleted.
(WebKit::WebPage::dragCancelled): Deleted.

Tools:

Adds 1 new unit test and tweaks existing tests to check that when first responder status is lost after beginning
a drag while editing, content is still moved (and not copied) when performing data interaction on a different
element. ContentEditableMoveParagraphs checks that content can be shifted within a single element via a move
operation rather than a copy.

See WebCore ChangeLog for more details.

Tests:  DataInteractionSimulator.ContentEditableToContentEditable
        DataInteractionSimulator.ContentEditableToTextarea
        DataInteractionSimulator.ContentEditableMoveParagraphs
        DataInteractionSimulator.TextAreaToInput

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2Cocoa/two-paragraph-contenteditable.html: Added.
* TestWebKitAPI/Tests/ios/DataInteractionTests.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/ios/DataInteractionSimulator.h:
* TestWebKitAPI/ios/DataInteractionSimulator.mm:
(-[DataInteractionSimulator initWithWebView:]):
(-[DataInteractionSimulator dealloc]):
(-[DataInteractionSimulator _advanceProgress]):
(-[DataInteractionSimulator waitForInputSession]):
(-[DataInteractionSimulator _webView:focusShouldStartInputSession:]):
(-[DataInteractionSimulator _webView:didStartInputSession:]):

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

2 years agoTools:
commit-queue@webkit.org [Thu, 4 May 2017 21:46:39 +0000 (21:46 +0000)]
Tools:
Rename TestRunner.display() to TestRunner::displayAndTrackRepaints()
https://bugs.webkit.org/show_bug.cgi?id=171641

Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2017-05-04
Reviewed by Simon Fraser.

The plan is to add back the TestRunner.display() which does the display
only without track repaints.

* DumpRenderTree/DumpRenderTree.h:
* DumpRenderTree/TestRunner.cpp:
(displayAndTrackRepaintsCallback):
(TestRunner::staticFunctions):
(displayCallback): Deleted.
(displayInvalidatedRegionCallback): Deleted.
* DumpRenderTree/TestRunner.h:
* DumpRenderTree/mac/DumpRenderTree.mm:
(displayWebView):
(displayAndTrackRepaintsWebView):
* DumpRenderTree/mac/TestRunnerMac.mm:
(TestRunner::displayAndTrackRepaints):
(TestRunner::display): Deleted.
* DumpRenderTree/win/TestRunnerWin.cpp:
(TestRunner::displayAndTrackRepaints):
(TestRunner::display): Deleted.
* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::displayAndTrackRepaints):
(WTR::TestRunner::display): Deleted.
* WebKitTestRunner/InjectedBundle/TestRunner.h:

LayoutTests:
Rename testRunner.displayAndTrackRepaints() to testRunner.displayAndTrackRepaints()
https://bugs.webkit.org/show_bug.cgi?id=171641

Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2017-05-04
Reviewed by Simon Fraser.

Replace all the calls to testRunner.displayAndTrackRepaints() by testRunner.displayAndTrackRepaints()
Replace all the calls to testRunner.displayInvalidatedRegion() by
testRunner.displayAndTrackRepaints() since the former is a copy of the later.

* compositing/clip-change.html:
* compositing/geometry/foreground-offset-change.html:
* compositing/geometry/limit-layer-bounds-transformed-overflow.html:
* compositing/iframes/become-composited-nested-iframes.html:
* compositing/iframes/become-overlapped-iframe.html:
* compositing/iframes/connect-compositing-iframe-delayed.html:
* compositing/iframes/connect-compositing-iframe.html:
* compositing/iframes/connect-compositing-iframe2.html:
* compositing/iframes/connect-compositing-iframe3.html:
* compositing/iframes/enter-compositing-iframe.html:
* compositing/iframes/iframe-content-flipping.html:
* compositing/iframes/iframe-resize.html:
* compositing/iframes/iframe-size-to-zero.html:
* compositing/iframes/iframe-src-change.html:
* compositing/iframes/invisible-nested-iframe-hide.html:
* compositing/iframes/invisible-nested-iframe-show.html:
* compositing/iframes/leave-compositing-iframe.html:
* compositing/iframes/overlapped-iframe-iframe.html:
* compositing/iframes/overlapped-iframe.html:
* compositing/iframes/overlapped-nested-iframes.html:
* compositing/iframes/repaint-after-losing-scrollbars.html:
* compositing/iframes/resources/fixed-position-subframe.html:
* compositing/iframes/resources/fixed-position-transformed-subframe.html:
* compositing/iframes/resources/scrollgrandchild-inner.html:
* compositing/iframes/scrolling-iframe.html:
* compositing/overflow/content-gains-scrollbars.html:
* compositing/overflow/content-loses-scrollbars.html:
* compositing/overflow/do-not-paint-outline-into-composited-scrolling-contents.html:
* compositing/overflow/overflow-scrollbar-layers.html:
* compositing/overflow/paint-neg-z-order-descendants-into-scrolling-contents-layer.html:
* compositing/overflow/repaint-after-losing-scrollbars.html:
* compositing/patterns/direct-pattern-compositing-add-text-expected.html:
* compositing/patterns/direct-pattern-compositing-add-text.html:
* compositing/patterns/direct-pattern-compositing-change-expected.html:
* compositing/patterns/direct-pattern-compositing-change.html:
* compositing/patterns/direct-pattern-compositing-load-expected.html:
* compositing/patterns/direct-pattern-compositing-load.html:
* compositing/plugins/invalidate_rect.html:
* compositing/repaint/iframes/composited-iframe-with-fixed-background-doc-repaint.html:
* compositing/repaint/iframes/compositing-iframe-scroll-repaint.html:
* compositing/repaint/iframes/compositing-iframe-with-fixed-background-doc-repaint.html:
* compositing/repaint/newly-composited-on-scroll.html:
* compositing/repaint/newly-composited-repaint-rect.html:
* compositing/repaint/page-scale-repaint.html:
* compositing/repaint/requires-backing-repaint.html:
* compositing/repaint/transform-style-change.html:
* compositing/rtl/rtl-overflow-invalidation.html:
* compositing/scroll-painted-composited-content.html:
* compositing/tiling/huge-layer-resize.html:
* compositing/video-page-visibility.html:
* compositing/video/video-with-invalid-source.html:
* compositing/webgl/webgl-repaint.html:
* css3/filters/multiple-filters-invalidation.html:
* css3/flexbox/repaint-column-reverse.html:
* css3/flexbox/repaint-during-resize-no-flex.html:
* css3/flexbox/repaint-rtl-column.html:
* css3/flexbox/repaint.html:
* displaylists/canvas-display-list.html:
* displaylists/resources/dump-target-display-list.js:
(doTest):
* displaylists/resources/dump-target-replay-list.js:
(doTest):
* fast/animation/request-animation-frame-detach-element.html:
* fast/animation/request-animation-frame-detach-element2.html:
* fast/animation/request-animation-frame-during-modal.html:
* fast/animation/request-animation-frame-iframe.html:
* fast/animation/request-animation-frame-iframe2.html:
* fast/animation/script-tests/request-animation-frame-cancel.js:
* fast/animation/script-tests/request-animation-frame-cancel2.js:
* fast/animation/script-tests/request-animation-frame-disabled.js:
* fast/animation/script-tests/request-animation-frame-prefix.js:
(window.webkitRequestAnimationFrame):
(window.testRunner.window.setTimeout):
* fast/animation/script-tests/request-animation-frame-time-unit.js:
(window.requestAnimationFrame):
* fast/animation/script-tests/request-animation-frame-timestamps-advance.js:
(window.requestAnimationFrame):
(window.testRunner.window.setTimeout):
* fast/animation/script-tests/request-animation-frame-timestamps.js:
* fast/animation/script-tests/request-animation-frame-within-callback.js:
* fast/animation/script-tests/request-animation-frame.js:
* fast/backgrounds/obscured-background-child-style-change-expected.html:
* fast/backgrounds/obscured-background-child-style-change.html:
* fast/backgrounds/solid-color-context-restore.html:
* fast/canvas/canvas-as-image-incremental-repaint.html:
* fast/canvas/canvas-incremental-repaint-2.html:
* fast/canvas/canvas-incremental-repaint.html:
* fast/canvas/canvas-resize-after-paint.html:
* fast/canvas/resources/repaint.js:
(runRepaintTest):
* fast/canvas/script-tests/canvas-imageSmoothingEnabled-repaint.js:
(TestControllerPaint):
* fast/canvas/webgl/canvas-test.html:
* fast/canvas/webgl/webgl-layer-update.html:
* fast/css/pseudostyle-anonymous-text.html:
* fast/css/relative-positioned-block-crash.html:
* fast/dom/Window/post-message-crash.html:
* fast/dom/Window/web-timing-minimal-performance-now.html:
* fast/dynamic/containing-block-change.html:
* fast/dynamic/layer-no-longer-paginated.html:
* fast/events/touch/gesture/pad-gesture-cancel.js:
* fast/events/touch/gesture/pad-gesture-fling.js:
* fast/forms/hidden-listbox.html:
* fast/forms/listbox-clip.html:
* fast/frames/inline-object-inside-frameset.html:
* fast/frames/transparent-scrollbar.html:
* fast/images/animated-background-image-crash.html:
* fast/layers/add-layer-with-nested-stacking.html:
* fast/layers/inline-dirty-z-order-lists.html:
* fast/layers/layer-content-visibility-change.html:
* fast/layers/nested-layers-1.html:
* fast/layers/nested-layers-2.html:
* fast/layers/nested-layers-3.html:
* fast/layers/nested-layers-4.html:
* fast/layers/remove-layer-with-nested-stacking.html:
* fast/overflow/hidden-scrollbar-resize.html:
* fast/reflections/inline-crash.html:
* fast/repaint/animation-after-layer-scroll.html:
* fast/repaint/background-shorthand-with-gradient-and-height-changes.html:
* fast/repaint/fixed-child-move-after-scroll.html:
* fast/repaint/fixed-child-of-fixed-move-after-scroll.html:
* fast/repaint/fixed-child-of-transformed-move-after-scroll.html:
* fast/repaint/fixed-move-after-scroll.html:
* fast/repaint/no-animation-outside-viewport-subframe.html:
* fast/repaint/no-animation-outside-viewport.html:
* fast/repaint/obscured-background-no-repaint.html:
* fast/repaint/overflow-hidden-in-overflow-hidden-scrolled.html:
* fast/repaint/renderer-destruction-by-invalidateSelection-crash.html:
* fast/repaint/repaint-during-scroll-with-zoom.html:
* fast/repaint/resources/fixed-move-after-keyboard-scroll-iframe.html:
* fast/repaint/resources/iframe-scroll-repaint-iframe.html:
* fast/repaint/resources/line-flow-with-floats.js:
(beginTest):
* fast/repaint/resources/repaint.js:
(runRepaintTest):
* fast/repaint/table-overflow-hidden-in-overflow-hidden-scrolled.html:
* fast/replaced/width100percent-textarea.html:
* fast/scrolling/scrollbar-tickmarks-hittest.html:
* fast/table/border-collapsing/cached-69296.html:
* fast/table/border-collapsing/cached-cell-append.html:
* fast/table/border-collapsing/cached-cell-remove.html:
* fast/table/border-collapsing/cached-change-cell-border-color.html:
* fast/table/border-collapsing/cached-change-cell-border-width.html:
* fast/table/border-collapsing/cached-change-cell-sl-border-color.html:
* fast/table/border-collapsing/cached-change-col-border-color.html:
* fast/table/border-collapsing/cached-change-col-border-width.html:
* fast/table/border-collapsing/cached-change-colgroup-border-color.html:
* fast/table/border-collapsing/cached-change-colgroup-border-width.html:
* fast/table/border-collapsing/cached-change-row-border-color.html:
* fast/table/border-collapsing/cached-change-row-border-width.html:
* fast/table/border-collapsing/cached-change-table-border-color.html:
* fast/table/border-collapsing/cached-change-table-border-width.html:
* fast/table/border-collapsing/cached-change-tbody-border-color.html:
* fast/table/border-collapsing/cached-change-tbody-border-width.html:
* fast/table/empty-section-crash.html:
* fast/text/font-initial.html:
* fast/text/international/harfbuzz-runs-with-no-glyph.html:
* fast/text/text-shadow-extreme-value.html:
* http/tests/misc/slow-loading-image-in-pattern.html:
* media/audio-repaint.html:
* media/media-document-audio-repaint.html:
* plugins/windowless_plugin_paint_test.html:
* scrollbars/scrollbar-percent-padding-crash.html:
* svg/custom/non-scaling-stroke-update.svg:
* svg/custom/stale-resource-data-crash.svg:

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

2 years ago[ios-simulator] API test WebKit2.WebsiteDataStoreCustomPaths is failing.
beidson@apple.com [Thu, 4 May 2017 21:42:23 +0000 (21:42 +0000)]
[ios-simulator] API test WebKit2.WebsiteDataStoreCustomPaths is failing.
https://bugs.webkit.org/show_bug.cgi?id=171513

Unreviewed gardening.

* TestWebKitAPI/Tests/WebKit2Cocoa/WebsiteDataStoreCustomPaths.mm:
(TEST): Skip the failing parts of the test on iOS for now.

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

2 years agoCrash when pointer lock element is removed before pointer lock allowed arrives.
commit-queue@webkit.org [Thu, 4 May 2017 21:39:44 +0000 (21:39 +0000)]
Crash when pointer lock element is removed before pointer lock allowed arrives.
https://bugs.webkit.org/show_bug.cgi?id=171642

Patch by Jeremy Jones <jeremyj@apple.com> on 2017-05-04
Reviewed by Jer Noble.

Make sure there a pending lock before attempting to complete pointer lock.

* page/PointerLockController.cpp:
(WebCore::PointerLockController::didAcquirePointerLock):

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

2 years agoReformat / Clean up Node.idl to match the specification
cdumez@apple.com [Thu, 4 May 2017 21:27:11 +0000 (21:27 +0000)]
Reformat / Clean up Node.idl to match the specification
https://bugs.webkit.org/show_bug.cgi?id=171686

Reviewed by Sam Weinig.

Source/WebCore:

Reformat / Clean up Node.idl to match the specification:
- https://dom.spec.whatwg.org/#node

There should be no Web-facing behavior change, except for Node properties
being enumerated in a slightly different order.

* dom/Node.idl:

LayoutTests:

Rebaseline existing test now that the Node properties are enumerated in a
slightly different order.

* js/dom/dom-static-property-for-in-iteration-expected.txt:

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

2 years agoMake ImageDiff stand-alone
jbedard@apple.com [Thu, 4 May 2017 21:06:37 +0000 (21:06 +0000)]
Make ImageDiff stand-alone
https://bugs.webkit.org/show_bug.cgi?id=168939

Reviewed by David Kilzer.

Create ImageDiff without dependencies on bmalloc and WTF so that it exists as a
stand-alone project. Note that this change does not eliminate the ImageDiff inside
the DumpRenderTree project.

* ImageDiff/ImageDiff.xcodeproj: Added.
* ImageDiff/ImageDiff.xcodeproj/project.pbxproj: Added.
* ImageDiff/Makefile: Use ImageDiff project.
* ImageDiff/PlatformMac.cmake: Added.
* ImageDiff/PlatformWin.cmake: Added.
* ImageDiff/cg: Added.
* ImageDiff/cg/Configurations: Added.
* ImageDiff/cg/Configurations/Base.xcconfig: Copied from Tools/DumpRenderTree/mac/Configurations/Base.xcconfig.
* ImageDiff/cg/Configurations/DebugRelease.xcconfig: Copied from Tools/DumpRenderTree/mac/Configurations/DebugRelease.xcconfig.
* ImageDiff/cg/Configurations/ImageDiff.xcconfig: Copied from Tools/DumpRenderTree/mac/Configurations/ImageDiff.xcconfig.
* ImageDiff/cg/ImageDiff.cpp: Copied from Tools/DumpRenderTree/cg/ImageDiffCG.cpp.
(createImageFromStdin): Stop using RetainPtr.
(createDifferenceImage): Ditto.
(main): Ditto.
* Scripts/build-imagediff: Stop building WTF and bmalloc.

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

2 years agoRemove support for legacy Notifications
weinig@apple.com [Thu, 4 May 2017 20:56:00 +0000 (20:56 +0000)]
Remove support for legacy Notifications
https://bugs.webkit.org/show_bug.cgi?id=171487

Reviewed by Jon Lee.

Source/JavaScriptCore:

* Configurations/FeatureDefines.xcconfig:
Remove definition of ENABLE_LEGACY_NOTIFICATIONS.

Source/WebCore:

* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:
Remove files.

* Configurations/FeatureDefines.xcconfig:
Remove definition of ENABLE_LEGACY_NOTIFICATIONS.

* DerivedSources.make:
Remove IDL files.

* Modules/notifications/DOMWindowNotifications.cpp: Removed.
* Modules/notifications/DOMWindowNotifications.h: Removed.
* Modules/notifications/DOMWindowNotifications.idl: Removed.
* Modules/notifications/NotificationCenter.cpp: Removed.
* Modules/notifications/NotificationCenter.h: Removed.
* Modules/notifications/NotificationCenter.idl: Removed.
* Modules/notifications/NotificationClient.h:
* Modules/notifications/NotificationController.cpp:
* Modules/notifications/NotificationController.h:
* Modules/notifications/WorkerGlobalScopeNotifications.cpp: Removed.
* Modules/notifications/WorkerGlobalScopeNotifications.h: Removed.
* Modules/notifications/WorkerGlobalScopeNotifications.idl: Removed.
* Modules/notifications/Notification.idl:
* Modules/notifications/Notification.cpp:
* Modules/notifications/Notification.h:
* dom/EventTargetFactory.in:
* page/DOMWindow.cpp:
* workers/WorkerThread.h:
Remove code legacy Notification code. Replace use of NotificationCenter with direct
calls to the NotificationClient.

Source/WebCore/PAL:

* Configurations/FeatureDefines.xcconfig:
Remove definition of ENABLE_LEGACY_NOTIFICATIONS.

Source/WebKit/mac:

* Configurations/FeatureDefines.xcconfig:
* WebCoreSupport/WebNotificationClient.h:
* WebCoreSupport/WebNotificationClient.mm:
* WebView/WebNotification.mm:
* WebView/WebNotificationInternal.h:
* WebView/WebView.mm:
(-[WebView _commonInitializationWithFrameName:groupName:]):
(-[WebView _notificationIDForTesting:]):
Remove legacy notification specific code.

Source/WebKit/win:

* WebCoreSupport/WebChromeClient.cpp:
(WebChromeClient::WebChromeClient):
* WebCoreSupport/WebChromeClient.h:
* WebCoreSupport/WebDesktopNotificationsDelegate.cpp:
* WebCoreSupport/WebDesktopNotificationsDelegate.h:
Remove legacy notification specific code.

Source/WebKit2:

* Configurations/FeatureDefines.xcconfig:
* Shared/WebProcessCreationParameters.cpp:
* Shared/WebProcessCreationParameters.h:
* UIProcess/WebProcessPool.cpp:
* WebProcess/InjectedBundle/InjectedBundle.cpp:
* WebProcess/Notifications/NotificationPermissionRequestManager.cpp:
* WebProcess/Notifications/NotificationPermissionRequestManager.h:
* WebProcess/Notifications/WebNotificationManager.cpp:
* WebProcess/Notifications/WebNotificationManager.h:
* WebProcess/WebCoreSupport/WebNotificationClient.cpp:
* WebProcess/WebCoreSupport/WebNotificationClient.h:
* WebProcess/WebPage/WebPage.cpp:
* WebProcess/WebProcess.cpp:
Remove legacy notification specific code.

Source/WTF:

* wtf/FeatureDefines.h:
Remove definition of ENABLE_LEGACY_NOTIFICATIONS.

Tools:

* DumpRenderTree/win/DRTDesktopNotificationPresenter.cpp:
(DRTDesktopNotificationPresenter::checkNotificationPermission):
* Scripts/webkitperl/FeatureList.pm:
* TestWebKitAPI/Configurations/FeatureDefines.xcconfig:
Remove use and definition of ENABLE_LEGACY_NOTIFICATIONS.

LayoutTests:

- Remove fast/notifications/. It was skipped on all platforms and use legacy Notifications API.
- Remove http/notifications/legacy. It tested the legacy API.
- Update two tests in fast/history to use the non-legacy API to test page cache + notifications.
- Update TestExpectations for removals.

* TestExpectations:
* platform/gtk/TestExpectations:
* platform/ios/TestExpectations:
* platform/mac/TestExpectations:
* platform/win/TestExpectations:
* fast/history/page-cache-notification-non-suspendable.html:
* fast/history/page-cache-notification-suspendable.html:
* fast/notifications: Removed.
* fast/notifications/notification-after-close-expected.txt: Removed.
* fast/notifications/notification-after-close.html: Removed.
* fast/notifications/notification-permisssion-deletable-expected.txt: Removed.
* fast/notifications/notification-permisssion-deletable.html: Removed.
* fast/notifications/notifications-cancel-request-permission-expected.txt: Removed.
* fast/notifications/notifications-cancel-request-permission.html: Removed.
* fast/notifications/notifications-check-permission-expected.txt: Removed.
* fast/notifications/notifications-check-permission.html: Removed.
* fast/notifications/notifications-click-event-expected.txt: Removed.
* fast/notifications/notifications-click-event-focus-expected.txt: Removed.
* fast/notifications/notifications-click-event-focus.html: Removed.
* fast/notifications/notifications-click-event.html: Removed.
* fast/notifications/notifications-constructor-request-permission-expected.txt: Removed.
* fast/notifications/notifications-constructor-request-permission.html: Removed.
* fast/notifications/notifications-constructor-with-permission-expected.txt: Removed.
* fast/notifications/notifications-constructor-with-permission.html: Removed.
* fast/notifications/notifications-constructor-without-permission-expected.txt: Removed.
* fast/notifications/notifications-constructor-without-permission.html: Removed.
* fast/notifications/notifications-display-close-events-expected.txt: Removed.
* fast/notifications/notifications-display-close-events.html: Removed.
* fast/notifications/notifications-document-close-crash-expected.txt: Removed.
* fast/notifications/notifications-document-close-crash.html: Removed.
* fast/notifications/notifications-event-stop-propagation-expected.txt: Removed.
* fast/notifications/notifications-event-stop-propagation.html: Removed.
* fast/notifications/notifications-multi-events-expected.txt: Removed.
* fast/notifications/notifications-multi-events.html: Removed.
* fast/notifications/notifications-no-icon-expected.txt: Removed.
* fast/notifications/notifications-no-icon.html: Removed.
* fast/notifications/notifications-permission-expected.txt: Removed.
* fast/notifications/notifications-permission.html: Removed.
* fast/notifications/notifications-replace-expected.txt: Removed.
* fast/notifications/notifications-replace.html: Removed.
* fast/notifications/notifications-request-permission-expected.txt: Removed.
* fast/notifications/notifications-request-permission-optional-expected.txt: Removed.
* fast/notifications/notifications-request-permission-optional.html: Removed.
* fast/notifications/notifications-request-permission.html: Removed.
* fast/notifications/notifications-rtl-expected.txt: Removed.
* fast/notifications/notifications-rtl.html: Removed.
* fast/notifications/notifications-sandbox-permission-expected.txt: Removed.
* fast/notifications/notifications-sandbox-permission.html: Removed.
* fast/notifications/notifications-window-close-crash-expected.txt: Removed.
* fast/notifications/notifications-window-close-crash.html: Removed.
* fast/notifications/notifications-with-permission-expected.txt: Removed.
* fast/notifications/notifications-with-permission.html: Removed.
* fast/notifications/notifications-without-permission-expected.txt: Removed.
* fast/notifications/notifications-without-permission.html: Removed.
* fast/notifications/request-notification-permission-while-reloading-expected.txt: Removed.
* fast/notifications/request-notification-permission-while-reloading.html: Removed.
* fast/notifications/resources: Removed.
* fast/notifications/resources/notifications-cancel-request-permission.html: Removed.
* fast/notifications/resources/notifications-iframe.html: Removed.
* http/tests/notifications/legacy: Removed.
* http/tests/notifications/legacy/double-show-expected.txt: Removed.
* http/tests/notifications/legacy/double-show.html: Removed.
* http/tests/notifications/legacy/events-expected.txt: Removed.
* http/tests/notifications/legacy/events.html: Removed.
* http/tests/notifications/legacy/notification-request-permission-then-navigate-expected.txt: Removed.
* http/tests/notifications/legacy/notification-request-permission-then-navigate.html: Removed.
* http/tests/notifications/legacy/request-expected.txt: Removed.
* http/tests/notifications/legacy/request-no-callback-expected.txt: Removed.
* http/tests/notifications/legacy/request-no-callback.html: Removed.
* http/tests/notifications/legacy/request.html: Removed.
* http/tests/notifications/legacy/resources: Removed.
* http/tests/notifications/legacy/resources/notify-opener-done.html: Removed.
* http/tests/notifications/legacy/resources/request-permission-then-navigate.html: Removed.
* http/tests/notifications/legacy/show-expected.txt: Removed.
* http/tests/notifications/legacy/show.html: Removed.
* http/tests/notifications/legacy/window-show-on-click-expected.txt: Removed.
* http/tests/notifications/legacy/window-show-on-click.html: Removed.

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

2 years agoMarked http/tests/xmlhttprequest/workers/methods-async.html as flaky.
ryanhaddad@apple.com [Thu, 4 May 2017 20:20:32 +0000 (20:20 +0000)]
Marked http/tests/xmlhttprequest/workers/methods-async.html as flaky.
https://bugs.webkit.org/show_bug.cgi?id=160368

Unreviewed test gardening.

Patch by Matt Lewis <jlewis3@apple.com> on 2017-05-04

* platform/ios-wk2/TestExpectations:

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

2 years agoREGRESSION (Safari 10.1): When 'transition' contains -ms-transform, transform-origin...
antti@apple.com [Thu, 4 May 2017 20:16:01 +0000 (20:16 +0000)]
REGRESSION (Safari 10.1): When 'transition' contains -ms-transform, transform-origin is also transitioned
https://bugs.webkit.org/show_bug.cgi?id=171250
<rdar://problem/31827243>

Reviewed by Geoffrey Garen.

Source/WebCore:

We were mapping unknown properties to 'all' animation. With this patch we ignore them instead.
The patch also implements roundtripping of unknown properties via CSSOM, matching Blink and Gecko.

Test: transitions/transition-unknown-property-ignore.html

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::createTransitionPropertyValue):

    Return the correct name for unknown properties.

* css/CSSToStyleMap.cpp:
(WebCore::CSSToStyleMap::mapAnimationProperty):

    Map any unknown property to AnimateUnknownProperty mode instead of falling back to the default of AnimateAll.
    Save the unknown property name so we can roundtrip it properly.

* page/animation/CompositeAnimation.cpp:
(WebCore::CompositeAnimation::updateTransitions):

    Ignore AnimateUnknownProperty like AnimateNone.

* platform/animation/Animation.h:
(WebCore::Animation::unknownProperty):
(WebCore::Animation::setUnknownProperty):

LayoutTests:

* transitions/transition-unknown-property-ignore-expected.txt: Added.
* transitions/transition-unknown-property-ignore.html: Added.
* transitions/transitions-parsing-expected.txt:
* transitions/transitions-parsing.html:

    Update the roundtrip expectations for unknown properties. The new results match Blink and Gecko.

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

2 years agoGive +testwebkitapi_configurationWithTestPlugInClassName: a shorter name
aestes@apple.com [Thu, 4 May 2017 20:08:40 +0000 (20:08 +0000)]
Give +testwebkitapi_configurationWithTestPlugInClassName: a shorter name
https://bugs.webkit.org/show_bug.cgi?id=171673

Reviewed by Dan Bernstein.

* TestWebKitAPI/Tests/WebKit2Cocoa/AdditionalReadAccessAllowedURLs.mm:
(TEST):
* TestWebKitAPI/Tests/WebKit2Cocoa/BundleEditingDelegate.mm:
(TEST):
* TestWebKitAPI/Tests/WebKit2Cocoa/BundleParameters.mm:
(TEST):
* TestWebKitAPI/Tests/WebKit2Cocoa/BundleRangeHandle.mm:
(TEST):
* TestWebKitAPI/Tests/WebKit2Cocoa/CancelFontSubresource.mm:
(TEST):
* TestWebKitAPI/Tests/WebKit2Cocoa/ContentFiltering.mm:
(configurationWithContentFilterSettings):
(-[LazilyLoadPlatformFrameworksController init]):
* TestWebKitAPI/Tests/WebKit2Cocoa/RemoteObjectRegistry.mm:
(TEST):
* TestWebKitAPI/Tests/WebKit2Cocoa/RenderedImageWithOptions.mm:
(runTestWithWidth):
* TestWebKitAPI/Tests/WebKit2Cocoa/UserContentWorld.mm:
(TEST):
* TestWebKitAPI/Tests/ios/DataInteractionTests.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/WKWebViewConfigurationExtras.h:
* TestWebKitAPI/WKWebViewConfigurationExtras.mm:
(+[WKWebViewConfiguration _test_configurationWithTestPlugInClassName:]):
(+[WKWebViewConfiguration testwebkitapi_configurationWithTestPlugInClassName:]): Renamed to
+_test_configurationWithTestPlugInClassName:

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

2 years agoClean up MutationRecord.idl
cdumez@apple.com [Thu, 4 May 2017 20:02:42 +0000 (20:02 +0000)]
Clean up MutationRecord.idl
https://bugs.webkit.org/show_bug.cgi?id=171685

Reviewed by Sam Weinig.

Clean up MutationRecord.idl to match the specification:
- https://dom.spec.whatwg.org/#mutationrecord

There is no Web-facing behavior change.

* dom/MutationRecord.idl:

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

2 years ago[GTK][JSCOnly] Implement memoryFootprint for Linux
utatane.tea@gmail.com [Thu, 4 May 2017 20:00:36 +0000 (20:00 +0000)]
[GTK][JSCOnly] Implement memoryFootprint for Linux
https://bugs.webkit.org/show_bug.cgi?id=171680

Reviewed by Carlos Alberto Lopez Perez.

Darwin's phys_footprint returns the amount of dirty anonymous memory in the process.
This patch implements the same thing in Linux by reading /proc/self/smaps.
We sum sizes of private dirty pages in anonymous regions.

* wtf/MemoryFootprint.cpp:
(WTF::forEachLine):
(WTF::memoryFootprint):

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

2 years agoReformat / clean up Event.idl
cdumez@apple.com [Thu, 4 May 2017 19:55:05 +0000 (19:55 +0000)]
Reformat / clean up Event.idl
https://bugs.webkit.org/show_bug.cgi?id=171675

Reviewed by Sam Weinig.

Source/WebCore:

Reformat / clean up Event.idl to match the latest spec more closely:
- https://dom.spec.whatwg.org/#interface-event

There is no web-facing behavior change, except for properties being
enumerated in a slightly different order.

* dom/Event.idl:

LayoutTests:

Rebaseline test now that the Event properties are in a slightly different order.

* inspector/model/remote-object-get-properties-expected.txt:

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

2 years agoCleanup: Extract CachedScript::mimeTypeAllowedByNosniff() into a common function
dbates@webkit.org [Thu, 4 May 2017 19:49:48 +0000 (19:49 +0000)]
Cleanup: Extract CachedScript::mimeTypeAllowedByNosniff() into a common function
https://bugs.webkit.org/show_bug.cgi?id=171678

Reviewed by Andy Estes.

Extract CachedScript::mimeTypeAllowedByNosniff() into a common function that can
be shared by LoadableClassicScript and WorkerScriptLoader.

No functionality was changed. So, no new tests.

* dom/LoadableClassicScript.cpp:
(WebCore::LoadableClassicScript::notifyFinished): Modified to use WebCore::isScriptAllowedByNosniff().
* loader/cache/CachedScript.cpp:
(WebCore::CachedScript::mimeType): Deleted; incorporated into WebCore::isScriptAllowedByNosniff().
(WebCore::CachedScript::mimeTypeAllowedByNosniff): Deleted; incorporated into WebCore::isScriptAllowedByNosniff().
* loader/cache/CachedScript.h:
* platform/network/ResourceResponseBase.cpp:
(WebCore::isScriptAllowedByNosniff): Added. Note that it is sufficient to extract the MIME type
as-is and query the MIME type registry because the MIME type registry performs look ups case-insensitively.
* platform/network/ResourceResponseBase.h:
* workers/WorkerScriptLoader.cpp:
(WebCore::WorkerScriptLoader::didReceiveResponse): Modified to use WebCore::isScriptAllowedByNosniff().
(WebCore::mimeTypeAllowedByNosniff): Deleted.

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

2 years agoMake the [EnabledBySetting] extended attribute work for any attribute or operation...
commit-queue@webkit.org [Thu, 4 May 2017 18:39:03 +0000 (18:39 +0000)]
Make the [EnabledBySetting] extended attribute work for any attribute or operation on a prototype
https://bugs.webkit.org/show_bug.cgi?id=171588

Patch by Sam Weinig <sam@webkit.org> on 2017-05-04
Reviewed by Dean Jackson.

* bindings/js/JSDOMIterator.h:
(WebCore::JSDOMIterator::createPrototype):
* bindings/js/JSDOMWindowShell.cpp:
(WebCore::JSDOMWindowShell::setWindow):
* bindings/js/JSDOMWrapperCache.h:
(WebCore::getDOMStructure):
(WebCore::getDOMPrototype):
* bindings/js/WorkerScriptController.cpp:
(WebCore::WorkerScriptController::initScript):
Update to account for createPrototype and prototype taking the global object by reference.

* bindings/scripts/CodeGeneratorJS.pm:
(NeedsSettingsCheckForPrototypeProperty):
Add predicate to determine if an interface has any settings enabled properties on the prototype,
needed to determine if we should pass the global object to finishCreation.

(GenerateHeader):
Update signature of both createPrototype and prototype to take JSDOMGlobalObject& rather than
a JSC::JSGlobalObject*, this allows us to pass the more specific type to the prototype constructor,
and access the ScriptExecutionContext for the Settings.

(GeneratePropertiesHashTable):
Update to return, via out parameter, arrays with the attributes and operations that specify EnabledBySetting. This
mimics the model used for RuntimeEnabledFeatures.

(GenerateImplementation):
In {Class}Prototype::finishCreation, add code to check settings to see if an attribute or operation should be enabled,
and if it shouldn't remove it from the object. This, again, is modeled on RuntimeEnabledFeatures.

(GeneratePrototypeDeclaration):
Update signatures to take JSDOMGlobalObject& and specialize finishCreation to take one if there are any properties
that require settings to enable.

(GenerateConstructorHelperMethods):
Update for new signature of prototype(...).

* bindings/scripts/test/JS/JSInterfaceName.cpp:
* bindings/scripts/test/JS/JSInterfaceName.h:
* bindings/scripts/test/JS/JSMapLike.cpp:
* bindings/scripts/test/JS/JSMapLike.h:
* bindings/scripts/test/JS/JSReadOnlyMapLike.cpp:
* bindings/scripts/test/JS/JSReadOnlyMapLike.h:
* bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
* bindings/scripts/test/JS/JSTestActiveDOMObject.h:
* bindings/scripts/test/JS/JSTestCEReactions.cpp:
* bindings/scripts/test/JS/JSTestCEReactions.h:
* bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
* bindings/scripts/test/JS/JSTestCEReactionsStringifier.h:
* bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
* bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.h:
* bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp:
* bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.h:
* bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
* bindings/scripts/test/JS/JSTestCustomNamedGetter.h:
* bindings/scripts/test/JS/JSTestDOMJIT.cpp:
* bindings/scripts/test/JS/JSTestDOMJIT.h:
* bindings/scripts/test/JS/JSTestEventConstructor.cpp:
* bindings/scripts/test/JS/JSTestEventConstructor.h:
* bindings/scripts/test/JS/JSTestEventTarget.cpp:
* bindings/scripts/test/JS/JSTestEventTarget.h:
* bindings/scripts/test/JS/JSTestException.cpp:
* bindings/scripts/test/JS/JSTestException.h:
* bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
* bindings/scripts/test/JS/JSTestGenerateIsReachable.h:
* bindings/scripts/test/JS/JSTestGlobalObject.h:
* bindings/scripts/test/JS/JSTestInterface.cpp:
* bindings/scripts/test/JS/JSTestInterface.h:
* bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp:
* bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.h:
* bindings/scripts/test/JS/JSTestIterable.cpp:
* bindings/scripts/test/JS/JSTestIterable.h:
* bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
* bindings/scripts/test/JS/JSTestJSBuiltinConstructor.h:
* bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
* bindings/scripts/test/JS/JSTestMediaQueryListListener.h:
* bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
* bindings/scripts/test/JS/JSTestNamedConstructor.h:
* bindings/scripts/test/JS/JSTestNode.cpp:
* bindings/scripts/test/JS/JSTestNode.h:
* bindings/scripts/test/JS/JSTestObj.cpp:
* bindings/scripts/test/JS/JSTestObj.h:
* bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
* bindings/scripts/test/JS/JSTestOverloadedConstructors.h:
* bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
* bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.h:
* bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
* bindings/scripts/test/JS/JSTestOverrideBuiltins.h:
* bindings/scripts/test/JS/JSTestSerialization.cpp:
* bindings/scripts/test/JS/JSTestSerialization.h:
* bindings/scripts/test/JS/JSTestSerializationInherit.cpp:
* bindings/scripts/test/JS/JSTestSerializationInherit.h:
* bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp:
* bindings/scripts/test/JS/JSTestSerializationInheritFinal.h:
* bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
* bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.h:
* bindings/scripts/test/JS/JSTestTypedefs.cpp:
* bindings/scripts/test/JS/JSTestTypedefs.h:
Update test results for new test values and changes in signatures to pass JSDOMGlobalObject.

* bindings/scripts/test/TestObj.idl:
Add tests for [EnableBySetting] for attributes and operations.

* bridge/objc/objc_runtime.h:
* bridge/runtime_array.h:
* bridge/runtime_method.h:
* bridge/runtime_object.h:
* inspector/CommandLineAPIHost.cpp:
Update createPrototype function to take the global object by reference.

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

2 years ago[MediaStream] Allow host application to enable/disable media capture
eric.carlson@apple.com [Thu, 4 May 2017 18:32:29 +0000 (18:32 +0000)]
[MediaStream] Allow host application to enable/disable media capture
https://bugs.webkit.org/show_bug.cgi?id=171292
<rdar://problem/31821492>

Reviewed by Jer Noble.

Source/WebCore:

No new layout tests, added an API test instead.

* Modules/mediastream/MediaStream.cpp:
(WebCore::MediaStream::endStream): New, stop all tracks.
* Modules/mediastream/MediaStream.h:

* Modules/mediastream/MediaStreamRegistry.cpp:
(WebCore::MediaStreamRegistry::unregisterStream): Minor cleanup.
(WebCore::MediaStreamRegistry::forEach): New, call the lambda with each stream.
(WebCore::MediaStreamRegistry::MediaStreamRegistry): Deleted, unused.
* Modules/mediastream/MediaStreamRegistry.h:

* Modules/mediastream/MediaStreamTrack.cpp:
(WebCore::MediaStreamTrack::stopTrack): Add parameter so caller can specify if an 'ended'
event should be sent or not.
(WebCore::MediaStreamTrack::trackMutedChanged): Don't post an event if the track has ended.
* Modules/mediastream/MediaStreamTrack.h:

* dom/Document.cpp:
(WebCore::Document::stopMediaCapture): Stop all streams in the document.
* dom/Document.h:

* page/Page.cpp:
(WebCore::Page::stopMediaCapture): Stop all streams.
* page/Page.h:

* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::currentDisplayMode): Display a black frame
when the stream ends.
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::activeStatusChanged): Signal a characteristics
change to HTMLMediaElement refresh state.
* platform/mediastream/MediaStreamPrivate.h:

* platform/mediastream/mac/AVMediaCaptureSource.mm:
(WebCore::AVMediaCaptureSource::stopProducingData): Don't return early if the session isn't
running, we always need to clear m_session on iOS.

Source/WebKit2:

* UIProcess/API/C/WKPage.cpp:
(WKPageSetMediaCaptureEnabled): New.
(WKPageGetMediaCaptureEnabled): New.
* UIProcess/API/C/WKPagePrivate.h:

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _setMediaCaptureEnabled:]): New.
(-[WKWebView _mediaCaptureEnabled]): New.
* UIProcess/API/Cocoa/WKWebViewPrivate.h:

* UIProcess/Cocoa/UIDelegate.mm:
(WebKit::UIDelegate::setDelegate): Initialize webViewRequestUserMediaAuthorizationForDevicesURLMainFrameURLDecisionHandler
and webViewCheckUserMediaPermissionForURLMainFrameURLFrameIdentifierDecisionHandler on macOS
and iOS.

* UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
(WebKit::UserMediaPermissionRequestManagerProxy::UserMediaPermissionRequestManagerProxy):
Initialize the rejection timer.
(WebKit::UserMediaPermissionRequestManagerProxy::~UserMediaPermissionRequestManagerProxy):
Call invalidatePendingRequests.
(WebKit::UserMediaPermissionRequestManagerProxy::invalidatePendingRequests): Invalidate all
pending requests.
(WebKit::UserMediaPermissionRequestManagerProxy::stopCapture): New.
(WebKit::UserMediaPermissionRequestManagerProxy::rejectionTimerFired): Reject a promise and
schedule the timer if there are any others pending.
(WebKit::UserMediaPermissionRequestManagerProxy::scheduleNextRejection):
(WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame): Don't
prompt the user if capture is disabled.
(WebKit::UserMediaPermissionRequestManagerProxy::invalidateRequests): Deleted.
(WebKit::UserMediaPermissionRequestManagerProxy::clearCachedState): Deleted.
* UIProcess/UserMediaPermissionRequestManagerProxy.h:

* UIProcess/UserMediaProcessManager.cpp:
(WebKit::UserMediaProcessManager::willEnableMediaStreamInPage): Stop capture in the current
page on iOS.
(WebKit::UserMediaProcessManager::setCaptureEnabled):
* UIProcess/UserMediaProcessManager.h:

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::setMediaCaptureEnabled):

* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::mediaCaptureEnabled):

* WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
(WebKit::UserMediaPermissionRequestManager::cancelPendingRequests): New, cancel all pending
requests.
(WebKit::UserMediaPermissionRequestManager::cancelUserMediaRequest): Deny the request.
(WebKit::UserMediaPermissionRequestManager::cancelMediaDevicesEnumeration):
* WebProcess/MediaStream/UserMediaPermissionRequestManager.h:

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::stopMediaCapture):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:

Tools:

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2Cocoa/UserMediaDisabled.mm: Added.
(-[UserMediaMessageHandler userContentController:didReceiveScriptMessage:]):
(-[UserMediaUIDelegate _webView:requestUserMediaAuthorizationForDevices:url:mainFrameURL:decisionHandler:]):
(-[UserMediaUIDelegate _webView:checkUserMediaPermissionForURL:mainFrameURL:frameIdentifier:decisionHandler:]):
(MediaCaptureDisabledTest::SetUp):
(MediaCaptureDisabledTest::loadTestAndWaitForMessage):
(TEST_F):
* TestWebKitAPI/Tests/WebKit2Cocoa/disableGetUserMedia.html: Added.

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