WebKit-https.git
4 months agoLoads using loadHTMLString() cause flashing when process-swapping
cdumez@apple.com [Tue, 9 Apr 2019 14:20:12 +0000 (14:20 +0000)]
Loads using loadHTMLString() cause flashing when process-swapping
https://bugs.webkit.org/show_bug.cgi?id=196714
<rdar://problem/49637354>

Reviewed by Antti Koivisto.

Source/WebKit:

Our logic to decide if we should construct a SuspendedPageProxy on process-swap was assuming
a SuspendedPageProxy is only useful for PageCache and would therefore not create one if PageCache
is disabled or if there is no associated WebBackForwardListItem. However, constructing a
SuspendedPageProxy is also useful to prevent flashing when process-swapping as we need to keep
displaying the layer of the previous process until there is something meaningful to show in the
new process.

This patch makes it so that we now construct a SuspendedPageProxy on process-swap, even if
PageCache is disabled or if there is no associated WebBackForwardListItem. The process in
question will not be useful for PageCache but it will avoid flashing. The SuspendedPageProxy's
process may also get used for future navigations to the same site (as demonstrated by the
API test) which is beneficial for performance.

* UIProcess/SuspendedPageProxy.cpp:
(WebKit::SuspendedPageProxy::SuspendedPageProxy):
* UIProcess/SuspendedPageProxy.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::suspendCurrentPageIfPossible):
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::findReusableSuspendedPageProcess):

Tools:

Add API test coverage.

* TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:

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

4 months agoInitialize trackTypeAsString for call to GST_INFO_OBJECT() in TrackType::Text
commit-queue@webkit.org [Tue, 9 Apr 2019 10:21:03 +0000 (10:21 +0000)]
Initialize trackTypeAsString for call to GST_INFO_OBJECT() in TrackType::Text
https://bugs.webkit.org/show_bug.cgi?id=196350

Patch by Eike Rathke <erack@redhat.com> on 2019-04-09
Reviewed by Xabier Rodriguez-Calvar.

trackTypeAsString was uninitialized in the
TrackPrivateBaseGStreamer::TrackType::Text case when calling
GST_INFO_OBJECT().

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

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

4 months agoUnreviewed. Fix ATK accessibility tests after r244059.
carlosgc@webkit.org [Tue, 9 Apr 2019 09:48:21 +0000 (09:48 +0000)]
Unreviewed. Fix ATK accessibility tests after r244059.

We are failing to load the injected bundle due to undefined symbol
AccessibilityUIElement::replaceTextInRange().

* WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:
(WTR::AccessibilityUIElement::replaceTextInRange):

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

4 months ago[ATK] Cleanup WebKitAccessibleHyperlink
carlosgc@webkit.org [Tue, 9 Apr 2019 09:01:35 +0000 (09:01 +0000)]
[ATK] Cleanup WebKitAccessibleHyperlink
https://bugs.webkit.org/show_bug.cgi?id=196602

Reviewed by Michael Catanzaro.

Cleanups:

 - Rename webkitAccessibleHyperlinkNew() as webkitAccessibleHyperlinkGetOrCreate() and move the code to get/set
   the object data here.
 - Use WEBKIT_DEFINE_TYPE instead of custom type registration. This ensures that all CStrings used in private
   struct are no longer leaked.
 - Remove all confusing core() functions and simply use webkitAccessibleGetAccessibilityObject().
 - Use nullptr instead of 0 and other coding style issues.

* accessibility/atk/WebKitAccessibleHyperlink.cpp:
(webkitAccessibleHyperlinkActionDoAction):
(webkitAccessibleHyperlinkActionGetNActions):
(webkitAccessibleHyperlinkActionGetDescription):
(webkitAccessibleHyperlinkActionGetKeybinding):
(webkitAccessibleHyperlinkActionGetName):
(atk_action_interface_init):
(webkitAccessibleHyperlinkGetURI):
(webkitAccessibleHyperlinkGetObject):
(rangeLengthForObject):
(webkitAccessibleHyperlinkGetStartIndex):
(webkitAccessibleHyperlinkGetEndIndex):
(webkitAccessibleHyperlinkIsValid):
(webkitAccessibleHyperlinkGetNAnchors):
(webkitAccessibleHyperlinkIsSelectedLink):
(webkitAccessibleHyperlinkGetProperty):
(webkitAccessibleHyperlinkSetProperty):
(webkit_accessible_hyperlink_class_init):
(webkitAccessibleHyperlinkGetOrCreate):
(core): Deleted.
(atkActionInterfaceInit): Deleted.
(getRangeLengthForObject): Deleted.
(webkitAccessibleHyperlinkFinalize): Deleted.
(webkitAccessibleHyperlinkClassInit): Deleted.
(webkitAccessibleHyperlinkInit): Deleted.
(webkitAccessibleHyperlinkGetType): Deleted.
(webkitAccessibleHyperlinkNew): Deleted.
(webkitAccessibleHyperlinkGetAccessibilityObject): Deleted.
* accessibility/atk/WebKitAccessibleHyperlink.h:
* accessibility/atk/WebKitAccessibleInterfaceHyperlinkImpl.cpp:
(webkitAccessibleHyperlinkImplGetHyperlink):
(webkitAccessibleHyperlinkImplInterfaceInit):

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

4 months agoASSERTION FAILED: !scope.exception() || !hasProperty in JSObject::get
tzagallo@apple.com [Tue, 9 Apr 2019 07:54:18 +0000 (07:54 +0000)]
ASSERTION FAILED: !scope.exception() || !hasProperty in JSObject::get
https://bugs.webkit.org/show_bug.cgi?id=196708
<rdar://problem/49556803>

Reviewed by Yusuke Suzuki.

JSTests:

* stress/proxy-getter-stack-overflow.js: Added.
(const.handler.get target):
(const.handler.has):
(try.with):
(catch):

Source/JavaScriptCore:

`operationPutToScope` needs to return early if an exception is thrown while
checking if `hasProperty`.

* jit/JITOperations.cpp:

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

4 months agoRemove some iOS #ifdefs around sticky-related code
simon.fraser@apple.com [Tue, 9 Apr 2019 06:23:21 +0000 (06:23 +0000)]
Remove some iOS #ifdefs around sticky-related code
https://bugs.webkit.org/show_bug.cgi?id=196726

Reviewed by Zalan Bujtas.

Now that async overflow scrolling can be enabled on macOS, RenderLayerCompositor::isAsyncScrollableStickyLayer()
should not have iOS-only code.

The answer to the FIXME in RenderLayerCompositor::computeStickyViewportConstraints is obvious: composited
overflow:scroll can be the container for sticky. The assertion can be removed.

* rendering/RenderLayer.cpp: Fix spacing in some logging.
(WebCore::outputPaintOrderTreeRecursive):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::isAsyncScrollableStickyLayer const):
(WebCore::RenderLayerCompositor::computeStickyViewportConstraints const):

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

4 months ago[JSC] DFG should respect node's strict flag
ysuzuki@apple.com [Tue, 9 Apr 2019 03:23:15 +0000 (03:23 +0000)]
[JSC] DFG should respect node's strict flag
https://bugs.webkit.org/show_bug.cgi?id=196617

Reviewed by Saam Barati.

JSTests:

* stress/put-by-val-direct-should-respect-strict-mode-of-inlining-codeblock.js: Added.
(shouldEqual):
(makeUnwriteableUnconfigurableObject):
(runTest):
* stress/put-dynamic-var-strict-and-sloppy.js: Added.
(shouldBe):
(shouldThrow):
(with.result):
(with.putValueStrict):
(with.putValueSloppy):

Source/JavaScriptCore:

We accidentally use codeBlock->isStrictMode() directly in DFG and FTL. But this is wrong since this CodeBlock is the top level DFG/FTL CodeBlock,
and this code does not respect the isStrictMode flag for the inlined CodeBlocks. In this patch, we start using isStrictModeFor(CodeOrigin) consistently
in DFG and FTL to get the right isStrictMode flag for the DFG node.
And we also split compilePutDynamicVar into compilePutDynamicVarStrict and compilePutDynamicVarNonStrict since (1) it is cleaner than accessing inlined
callframe in the operation function, and (2) it is aligned to the other functions like operationPutByValDirectNonStrict etc.
This bug is discovered by RandomizingFuzzerAgent by expanding the DFG coverage.

* dfg/DFGAbstractInterpreterInlines.h:
(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
* dfg/DFGConstantFoldingPhase.cpp:
(JSC::DFG::ConstantFoldingPhase::foldConstants):
* dfg/DFGFixupPhase.cpp:
(JSC::DFG::FixupPhase::fixupToThis):
* dfg/DFGOperations.cpp:
* dfg/DFGOperations.h:
* dfg/DFGPredictionPropagationPhase.cpp:
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compileDoublePutByVal):
(JSC::DFG::SpeculativeJIT::compilePutByValForIntTypedArray):
(JSC::DFG::SpeculativeJIT::compilePutDynamicVar):
(JSC::DFG::SpeculativeJIT::compileToThis):
* dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::compileContiguousPutByVal):
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compilePutByVal):
(JSC::FTL::DFG::LowerDFGToB3::compilePutDynamicVar):

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

4 months agoAX: Support API: accessibilityReplaceRange:withText
Hironori.Fujii@sony.com [Tue, 9 Apr 2019 01:54:24 +0000 (01:54 +0000)]
AX: Support API: accessibilityReplaceRange:withText
https://bugs.webkit.org/show_bug.cgi?id=196636

Unreviewed build fix for Windows port.

* WebKitTestRunner/InjectedBundle/win/AccessibilityUIElementWin.cpp:
(WTR::AccessibilityUIElement::replaceTextInRange): Added.

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

4 months ago[CMake][WinCairo] Separate copied headers into different directories
don.olmstead@sony.com [Tue, 9 Apr 2019 01:38:50 +0000 (01:38 +0000)]
[CMake][WinCairo] Separate copied headers into different directories
https://bugs.webkit.org/show_bug.cgi?id=196655

Reviewed by Michael Catanzaro.

.:

Add variables for the paths to copied framework headers. This is done to be
explicit rather than relying on ${FORWARDING_HEADERS_DIR}.

Currently all ports but WinCairo will default to ${FORWARDING_HEADERS_DIR}.
WinCairo overrides them to provide a directory structure that looks more
like what happens in an XCode build. This is meant as an intermediate step
towards making all CMake ports behave like this.

* Source/cmake/OptionsWinCairo.cmake:
* Source/cmake/WebKitFS.cmake:
* Source/cmake/WebKitMacros.cmake:

Source/JavaScriptCore:

* CMakeLists.txt:
* shell/PlatformWin.cmake:

Source/WebCore:

* CMakeLists.txt:
* PlatformWin.cmake:

Source/WebCore/PAL:

* pal/CMakeLists.txt:

Source/WebKit:

* CMakeLists.txt:
* PlatformWin.cmake:

Source/WebKitLegacy:

* CMakeLists.txt:
* PlatformWin.cmake:

Source/WTF:

* wtf/CMakeLists.txt:

Tools:

* DumpRenderTree/CMakeLists.txt:
* MiniBrowser/win/CMakeLists.txt:
* TestWebKitAPI/CMakeLists.txt:
* TestWebKitAPI/PlatformWin.cmake:

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

4 months agoLog stack-trace for run-webkit-tests when interrupted
jbedard@apple.com [Tue, 9 Apr 2019 01:32:17 +0000 (01:32 +0000)]
Log stack-trace for run-webkit-tests when interrupted
https://bugs.webkit.org/show_bug.cgi?id=176393
<rdar://problem/34262310>

Reviewed by Lucas Forschler.

* Scripts/webkitpy/common/interrupt_debugging.py: Added.
(log_stack_trace): Given a Python frame object, log a stack trace to the provided file.
(StackTraceFileContext): Context which allows stack-traces to be printed to stderr or to a file.
(log_stack_trace_on_term): Attach a listener to SIGTERM so that a stack-trace can be logged when a program is terminated.
(log_stack_trace_on_ctrl_c): Attach a listener to SIGINT so that a stack-trace can be logged when a program is CTRL+Ced.
* Scripts/webkitpy/layout_tests/run_webkit_tests.py:
(main): Set handlers to log stack trace on interruption.

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

4 months agoWeb Inspector: Elements tab: Classes toggle should use accent color on hover
mattbaker@apple.com [Tue, 9 Apr 2019 01:31:54 +0000 (01:31 +0000)]
Web Inspector: Elements tab: Classes toggle should use accent color on hover
https://bugs.webkit.org/show_bug.cgi?id=196266

Reviewed by Devin Rousso.

* UserInterface/Views/GeneralStyleDetailsSidebarPanel.css:
(.sidebar > .panel.details.css-style > .content ~ .options-container > .toggle-class-toggle):
(.sidebar > .panel.details.css-style > .content ~ .options-container > .toggle-class-toggle::before):
(.sidebar > .panel.details.css-style > .content ~ .options-container > .toggle-class-toggle:matches(.selected, :hover)):
(.sidebar > .panel.details.css-style > .content ~ .options-container > .toggle-class-toggle:matches(.selected, :hover)::before):
(.sidebar > .panel.details.css-style > .content ~ .options-container > .toggle-class-toggle:not(.selected):hover::before):
(.sidebar > .panel.details.css-style > .content ~ .options-container > .toggle-class-toggle.selected:active::before):
(.sidebar > .panel.details.css-style > .content ~ .options-container > .toggle-class-toggle.selected): Deleted.
(.sidebar > .panel.details.css-style > .content ~ .options-container > .toggle-class-toggle:not(.selected):hover): Deleted.

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

4 months agoAX: Support API: accessibilityReplaceRange:withText
Hironori.Fujii@sony.com [Tue, 9 Apr 2019 01:26:23 +0000 (01:26 +0000)]
AX: Support API: accessibilityReplaceRange:withText
https://bugs.webkit.org/show_bug.cgi?id=196636

Unreviewed build fix for Windows port.

* DumpRenderTree/AccessibilityUIElement.cpp:
(AccessibilityUIElement::replaceTextInRange): Changed the return value type from void to bool.

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

4 months agoAX: Automatically compute accessibility labels for Apple Pay buttons
cfleizach@apple.com [Tue, 9 Apr 2019 00:58:19 +0000 (00:58 +0000)]
AX: Automatically compute accessibility labels for Apple Pay buttons
https://bugs.webkit.org/show_bug.cgi?id=196661

Reviewed by Joanmarie Diggs.

Source/WebCore:

Detect Apple Pay buttons and return a standard role and label for them based on their type.

Test: accessibility/mac/apple-pay-labels.html
      accessibility/mac/apple-pay-session-v4.html

* accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::isControl const):
* accessibility/AccessibilityNodeObject.h:
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::applePayButtonDescription const):
(WebCore::AccessibilityRenderObject::titleElementText const):
(WebCore::AccessibilityRenderObject::determineAccessibilityRole):
(WebCore::AccessibilityRenderObject::isApplePayButton const):
(WebCore::AccessibilityRenderObject::applePayButtonType const):
* accessibility/AccessibilityRenderObject.h:
* en.lproj/Localizable.strings:
* platform/LocalizedStrings.cpp:
(WebCore::AXApplePayPlainLabel):
(WebCore::AXApplePayBuyLabel):
(WebCore::AXApplePaySetupLabel):
(WebCore::AXApplePayDonateLabel):
(WebCore::AXApplePayCheckOutLabel):
(WebCore::AXApplePayBookLabel):
(WebCore::AXApplePaySubscribeLabel):
* platform/LocalizedStrings.h:

LayoutTests:

* accessibility/mac/apple-pay-labels-expected.txt: Added.
* accessibility/mac/apple-pay-labels.html: Added.
* accessibility/mac/apple-pay-session-v4-expected.txt: Added.
* accessibility/mac/apple-pay-session-v4.html: Added.

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

4 months ago[ews-build] Scripts using Buildbot API have CORS error
aakash_jain@apple.com [Tue, 9 Apr 2019 00:42:28 +0000 (00:42 +0000)]
[ews-build] Scripts using Buildbot API have CORS error
https://bugs.webkit.org/show_bug.cgi?id=196709

Reviewed by Alexey Proskuryakov.

* BuildSlaveSupport/ews-build/master.cfg: Set allowed_origins appropriately.

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

4 months agoAX: Support API: accessibilityReplaceRange:withText
cfleizach@apple.com [Tue, 9 Apr 2019 00:39:50 +0000 (00:39 +0000)]
AX: Support API: accessibilityReplaceRange:withText
https://bugs.webkit.org/show_bug.cgi?id=196636

Reviewed by Daniel Bates.

Source/WebCore:

Support this platform API on mac to provide a way to replace a range of editable text.

Test: accessibility/mac/replace-text-with-range.html

* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::replaceTextInRange):
* accessibility/AccessibilityObject.h:
* accessibility/mac/AccessibilityObjectBase.mm:
(WebCore::PlainTextRange::PlainTextRange):
* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper accessibilityReplaceRange:withText:]):

Tools:

* DumpRenderTree/AccessibilityUIElement.cpp:
(replaceTextInRangeCallback):
(AccessibilityUIElement::replaceTextInRange):
(AccessibilityUIElement::getJSClass):
* DumpRenderTree/AccessibilityUIElement.h:
* DumpRenderTree/ios/AccessibilityUIElementIOS.mm:
(AccessibilityUIElement::replaceTextInRange):
* DumpRenderTree/mac/AccessibilityUIElementMac.mm:
(AccessibilityUIElement::replaceTextInRange):
* WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
* WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl:
* WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
(WTR::AccessibilityUIElement::replaceTextInRange):
* WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
(WTR::AccessibilityUIElement::replaceTextInRange):

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

4 months ago[JSC] isRope jump in StringSlice should not jump over register allocations
ysuzuki@apple.com [Tue, 9 Apr 2019 00:00:24 +0000 (00:00 +0000)]
[JSC] isRope jump in StringSlice should not jump over register allocations
https://bugs.webkit.org/show_bug.cgi?id=196716

Reviewed by Saam Barati.

JSTests:

* stress/is-rope-check-in-string-slice-should-not-jump-over-register-allocations.js: Added.
(foo.bar):
(foo):

Source/JavaScriptCore:

Jumping over the register allocation code in DFG (like the following) is wrong.

    auto jump = m_jit.branchXXX();
    {
        GPRTemporary reg(this);
        GPRReg regGPR = reg.gpr();
        ...
    }
    jump.link(&m_jit);

When GPRTemporary::gpr allocates a new register, it can flush the previous register value into the stack and make the register usable.
Jumping over this register allocation code skips the flushing code, and makes the DFG's stack and register content tracking inconsistent:
DFG thinks that the content is flushed and stored in particular stack slot even while this flushing code is skipped.
In this patch, we perform register allocations before jumping to the slow path based on `isRope` condition in StringSlice.

* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compileStringSlice):

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

4 months ago[JSC] to_index_string should not assume incoming value is Uint32
ysuzuki@apple.com [Mon, 8 Apr 2019 23:33:05 +0000 (23:33 +0000)]
[JSC] to_index_string should not assume incoming value is Uint32
https://bugs.webkit.org/show_bug.cgi?id=196713

Reviewed by Saam Barati.

JSTests:

* stress/to-index-string-should-not-assume-incoming-value-is-uint32.js: Added.
(foo):

Source/JavaScriptCore:

The slow path of to_index_string assumes that incoming value is Uint32. But we should not have
this assumption since DFG may decide we should have it double format. This patch removes this
assumption, and instead, we should assume that incoming value is AnyInt and the range of this
is within Uint32.

* runtime/CommonSlowPaths.cpp:
(JSC::SLOW_PATH_DECL):

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

4 months ago[iOS] Do not allow starting selection drags when selection views are not visible
wenson_hsieh@apple.com [Mon, 8 Apr 2019 22:49:20 +0000 (22:49 +0000)]
[iOS] Do not allow starting selection drags when selection views are not visible
https://bugs.webkit.org/show_bug.cgi?id=196686
<rdar://problem/49399192>

Reviewed by Tim Horton.

Source/WebCore:

See WebKit ChangeLog for more details.

Tests:  DragAndDropTests.CanDragImageWhenNotFirstResponder
        DragAndDropTests.DoNotPerformSelectionDragWhenNotFirstResponder

* page/DragController.cpp:
(WebCore::DragController::draggableElement const):

Make this respect the case where m_dragSourceAction does not include DragSourceActionSelection. All the other
drag source types are currently consulted in this method, with the exception of DragSourceActionSelection.

Source/WebKit:

Currently, on iOS, it's possible to start dragging selected text in a web view even if the selection itself is
not visible. This can happen if the user selects some text, focuses a native text field, and then long presses
the previously selected text. This is because the text is still selected in the document since we don't clear
the selection when resigning first responder on iOS, despite the fact that the native selection view is no
longer present.

To fix this, we add plumbing to specify the set of allowed drag source actions when requesting drag start; this
set of allowed drag source actions only includes DragSourceActionSelection if the selection view can be visible
(i.e. the content view is first responder, and isn't suppressing text interactions). We then update WebPage's
allowed drag source actions with this given set of actions, while sending "dragstart" to the page.

* UIProcess/WebPageProxy.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView hasSelectablePositionAtPoint:]):
(-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):

Only bail out of text selection in text that is already selected if the web view allows dragging text selections
(i.e. the web view is first responder, and is not suppressing text interactions).

(-[WKContentView _allowedDragSourceActions]):
(-[WKContentView _dragInteraction:itemsForAddingToSession:withTouchAtPoint:completion:]):
(-[WKContentView _dragInteraction:prepareForSession:completion:]):

Pass the set of allowed drag source actions when requesting a drag start or adding items to an existing session.

* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::requestDragStart):
(WebKit::WebPageProxy::requestAdditionalItemsForDragSession):

Plumb the allowed drag source actions from the UI process (WKContentView) over to the web process (WebPage).

* WebProcess/WebCoreSupport/WebDragClient.cpp:
(WebKit::WebDragClient::dragSourceActionMaskForPoint):

Instead of always returning Any, consult WebPage's allowed drag source actions.

* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::allowedDragSourceActions const):
* WebProcess/WebPage/WebPage.messages.in:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::requestDragStart):
(WebKit::WebPage::requestAdditionalItemsForDragSession):

Set WebPage's allowed drag source actions to the given set of actions when sending a drag start to the page.

Tools:

Adjust some existing API tests to make the web view become first responder before trying to begin dragging, and
also add some new API tests to cover scenarios where the web view is not first responder.

* TestWebKitAPI/Tests/ios/DragAndDropTestsIOS.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/cocoa/DragAndDropSimulator.h:

Add a switch to optionally make the web view first responder when starting the simulated drag.

* TestWebKitAPI/ios/DragAndDropSimulatorIOS.mm:
(-[DragAndDropSimulator initWithWebView:]):
(-[DragAndDropSimulator runFrom:to:additionalItemRequestLocations:]):

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

4 months agoAdd a test to check for the service worker process name
youenn@apple.com [Mon, 8 Apr 2019 22:29:47 +0000 (22:29 +0000)]
Add a test to check for the service worker process name
https://bugs.webkit.org/show_bug.cgi?id=196621

Reviewed by Chris Dumez.

Source/WebCore:

Add a service worker internal API to get process name.
Covered by updated test.

* WebCore.xcodeproj/project.pbxproj:
* testing/ServiceWorkerInternals.cpp:
(WebCore::ServiceWorkerInternals::processName const):
* testing/ServiceWorkerInternals.h:
* testing/ServiceWorkerInternals.idl:
* testing/ServiceWorkerInternals.mm: Added.

LayoutTests:

* http/wpt/service-workers/online-worker.js:
(async.doTest):

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

4 months agoUnreviewed, speculative fix for build failure in old macOS after r243887
ysuzuki@apple.com [Mon, 8 Apr 2019 22:26:19 +0000 (22:26 +0000)]
Unreviewed, speculative fix for build failure in old macOS after r243887
https://bugs.webkit.org/show_bug.cgi?id=196475

* dom/NodeList.h:

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

4 months ago[Web GPU] Fix Web GPU experimental feature on iOS
justin_fan@apple.com [Mon, 8 Apr 2019 22:11:01 +0000 (22:11 +0000)]
[Web GPU] Fix Web GPU experimental feature on iOS
https://bugs.webkit.org/show_bug.cgi?id=196632

Reviewed by Myles C. Maxfield.

Source/JavaScriptCore:

Properly make Web GPU available on iOS 11+.

* Configurations/FeatureDefines.xcconfig:
* Configurations/WebKitTargetConditionals.xcconfig:

Source/ThirdParty/libwebrtc:

Add conditionals for iOS 11.

* Configurations/WebKitTargetConditionals.xcconfig:

Source/WebCore:

Add feature conditionals for iOS 11.
Properly make Web GPU available on iOS 11+.

* Configurations/FeatureDefines.xcconfig:
* Configurations/WebKitTargetConditionals.xcconfig:

Source/WebCore/PAL:

Add feature conditionals for iOS 11.
Properly make Web GPU available on iOS 11+.

* Configurations/FeatureDefines.xcconfig:
* Configurations/WebKitTargetConditionals.xcconfig:

Source/WebKit:

Add feature conditionals for iOS 11.
Properly make Web GPU available on iOS 11+.

* Configurations/FeatureDefines.xcconfig:
* Configurations/WebKitTargetConditionals.xcconfig:

Source/WebKitLegacy/mac:

Add feature conditionals for iOS 11.
Properly make Web GPU available on iOS 11+.

* Configurations/FeatureDefines.xcconfig:
* Configurations/WebKitTargetConditionals.xcconfig:

Tools:

Properly make Web GPU available on iOS 11+.

* TestWebKitAPI/Configurations/FeatureDefines.xcconfig:

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

4 months ago[JSC] Add more tests for r243966
ysuzuki@apple.com [Mon, 8 Apr 2019 22:01:32 +0000 (22:01 +0000)]
[JSC] Add more tests for r243966
https://bugs.webkit.org/show_bug.cgi?id=196711

Reviewed by Saam Barati.

Adding one more test for r243966 fix. The added test will not crash after r243966.

* stress/stress-cleared-calllinkinfo.js: Added.
(runNearStackLimit.t):
(runNearStackLimit):
(repeat):
(cls):
(let.item.of.array.runNearStackLimit):

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

4 months agoFix selector name after r243834
achristensen@apple.com [Mon, 8 Apr 2019 21:42:47 +0000 (21:42 +0000)]
Fix selector name after r243834
https://bugs.webkit.org/show_bug.cgi?id=196549

* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
I forgot the colon in the setter's name.

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

4 months agofast/parser/xml-error-adopted.xml is a flaky timeout
sroberts@apple.com [Mon, 8 Apr 2019 21:41:49 +0000 (21:41 +0000)]
fast/parser/xml-error-adopted.xml is a flaky timeout
https://bugs.webkit.org/show_bug.cgi?id=186581

Unreviewed test gardening.

* platform/ios-simulator-wk2/TestExpectations:

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

4 months agoUnreviewed build fix for iOSMac after r243893.
timothy@apple.com [Mon, 8 Apr 2019 21:31:52 +0000 (21:31 +0000)]
Unreviewed build fix for iOSMac after r243893.
https://bugs.webkit.org/show_bug.cgi?id=196707

* dom/Element.cpp:
(WebCore::parentCrossingFrameBoundaries): Remove ENABLE(POINTER_EVENTS) since computedTouchActions()
no longer uses parentCrossingFrameBoundaries().

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

4 months agoFixed a typo on a test expectation
sroberts@apple.com [Mon, 8 Apr 2019 21:29:16 +0000 (21:29 +0000)]
Fixed a typo on a test expectation
https://bugs.webkit.org/show_bug.cgi?id=187391

Unreviewed test gardening.

* platform/mac-wk2/TestExpectations: Updating test expectations

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

4 months ago-f[no-]var-tracking-assignments is GCC-only
ross.kirsling@sony.com [Mon, 8 Apr 2019 20:57:38 +0000 (20:57 +0000)]
-f[no-]var-tracking-assignments is GCC-only
https://bugs.webkit.org/show_bug.cgi?id=196699

Reviewed by Don Olmstead.

* CMakeLists.txt:
Just remove the build flag altogether -- it supposedly doesn't solve the problem it was meant to
and said problem evidently no longer occurs as of GCC 9.

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

4 months agoLazily construct Navigator serviceWorker
youenn@apple.com [Mon, 8 Apr 2019 20:51:20 +0000 (20:51 +0000)]
Lazily construct Navigator serviceWorker
https://bugs.webkit.org/show_bug.cgi?id=196692

Reviewed by Chris Dumez.

Make NavigatorBase a ContextDestructionObserver.
This allows to get the navigator script execution context.
Use it when creating the navigator ServiceWorkerContainer object.
For GC, introduce serviceWorkerIfAny which returns the container if created.
No JS observable change of behavior.
Covered by existing tests.

* bindings/js/JSNavigatorCustom.cpp:
(WebCore::JSNavigator::visitAdditionalChildren):
* bindings/js/JSWorkerNavigatorCustom.cpp:
(WebCore::JSWorkerNavigator::visitAdditionalChildren):
* page/NavigatorBase.cpp:
(WebCore::NavigatorBase::NavigatorBase):
(WebCore::NavigatorBase::serviceWorkerIfAny):
(WebCore::NavigatorBase::serviceWorker):
* page/NavigatorBase.h:

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

4 months agoCompute touch actions for touch point from remote layer tree regions
antti@apple.com [Mon, 8 Apr 2019 20:50:08 +0000 (20:50 +0000)]
Compute touch actions for touch point from remote layer tree regions
https://bugs.webkit.org/show_bug.cgi?id=196701

Reviewed by Simon Fraser.

Add a function for finding the right layer and getting the touch actions in UI process side.

The code is not used yet.

* UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h:
* UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
(WebKit::touchActionsForPoint):

Use the same code as overlap hit testing for collecting the candidate layers for the touch point,
taking event regions into account.
Return the touch actions from the deepest event sensitive layer hit.

(-[UIView _web_findDescendantViewAtPoint:withEvent:]):

Modernize.

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

4 months agoinspector/canvas/css-canvas-clients.html is a constant timeout/failure
sroberts@apple.com [Mon, 8 Apr 2019 20:48:19 +0000 (20:48 +0000)]
inspector/canvas/css-canvas-clients.html is a constant timeout/failure
https://bugs.webkit.org/show_bug.cgi?id=174272

Unreviewed test gardening.

* platform/mac/TestExpectations: Updating test expectations to skip test

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

4 months agoWebAssembly.RuntimeError missing exception check
sbarati@apple.com [Mon, 8 Apr 2019 20:46:39 +0000 (20:46 +0000)]
WebAssembly.RuntimeError missing exception check
https://bugs.webkit.org/show_bug.cgi?id=196700
<rdar://problem/49693932>

Reviewed by Yusuke Suzuki.

JSTests:

* wasm/js-api/runtime-error-should-exception-check.js: Added.

Source/JavaScriptCore:

* wasm/js/JSWebAssemblyRuntimeError.h:
* wasm/js/WebAssemblyRuntimeErrorConstructor.cpp:
(JSC::constructJSWebAssemblyRuntimeError):

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

4 months agoWeb Inspector: REGRESSION: Audit: default audits aren't added when an existing audit...
drousso@apple.com [Mon, 8 Apr 2019 20:46:34 +0000 (20:46 +0000)]
Web Inspector: REGRESSION: Audit: default audits aren't added when an existing audit is present
https://bugs.webkit.org/show_bug.cgi?id=196663
<rdar://problem/49660757>

Reviewed by Timothy Hatcher.

Rather than have a button that allows the user to re-add the default audits, prevent them
from being deletable in the first place. "Deleting" a default audit will instead mark it as
disabled (and beep if it is already disabled).

* UserInterface/Controllers/AuditManager.js:
(WI.AuditManager.prototype.loadStoredTests):
(WI.AuditManager.prototype.removeTest):
(WI.AuditManager.prototype._addDefaultTests): Added.
(WI.AuditManager.prototype.addDefaultTestsIfNeeded): Deleted.

* UserInterface/Views/AuditNavigationSidebarPanel.js:
(WI.AuditNavigationSidebarPanel.prototype._addTest):
(WI.AuditNavigationSidebarPanel.prototype._updateStartStopButtonNavigationItemState):
(WI.AuditNavigationSidebarPanel.prototype._updateNoAuditsPlaceholder):
(WI.AuditNavigationSidebarPanel.prototype._handleAuditTestRemoved):
* UserInterface/Views/AuditNavigationSidebarPanel.css:
(.sidebar > .panel.navigation.audit.has-results > .content > .message-text-view.no-enabled-audits): Added.
(.sidebar > .panel.navigation.audit.has-results:not(.has-tests) > .content > .message-text-view): Deleted.
(.sidebar > .panel.navigation.audit.has-results:not(.has-tests) > .content > .message-text-view > .message): Deleted.
(.sidebar > .panel.navigation.audit.has-results:not(.has-tests) > .content > .message-text-view > button): Deleted.

* Localizations/en.lproj/localizedStrings.js:

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

4 months agoUnreviewed, rolling in r243948 with test fix
ysuzuki@apple.com [Mon, 8 Apr 2019 20:43:18 +0000 (20:43 +0000)]
Unreviewed, rolling in r243948 with test fix
https://bugs.webkit.org/show_bug.cgi?id=196486

JSTests:

* stress/arrow-function-and-use-strict-directive.js: Added.
* stress/arrow-function-syntax.js: Added.
(checkSyntax):
(checkSyntaxError):

Source/JavaScriptCore:

* parser/ASTBuilder.h:
(JSC::ASTBuilder::createString):
* parser/Lexer.cpp:
(JSC::Lexer<T>::parseMultilineComment):
(JSC::Lexer<T>::lexWithoutClearingLineTerminator):
(JSC::Lexer<T>::lex): Deleted.
* parser/Lexer.h:
(JSC::Lexer::hasLineTerminatorBeforeToken const):
(JSC::Lexer::setHasLineTerminatorBeforeToken):
(JSC::Lexer<T>::lex):
(JSC::Lexer::prevTerminator const): Deleted.
(JSC::Lexer::setTerminator): Deleted.
* parser/Parser.cpp:
(JSC::Parser<LexerType>::allowAutomaticSemicolon):
(JSC::Parser<LexerType>::parseSingleFunction):
(JSC::Parser<LexerType>::parseStatementListItem):
(JSC::Parser<LexerType>::maybeParseAsyncFunctionDeclarationStatement):
(JSC::Parser<LexerType>::parseFunctionInfo):
(JSC::Parser<LexerType>::parseClass):
(JSC::Parser<LexerType>::parseExportDeclaration):
(JSC::Parser<LexerType>::parseAssignmentExpression):
(JSC::Parser<LexerType>::parseYieldExpression):
(JSC::Parser<LexerType>::parseProperty):
(JSC::Parser<LexerType>::parsePrimaryExpression):
(JSC::Parser<LexerType>::parseMemberExpression):
* parser/Parser.h:
(JSC::Parser::nextWithoutClearingLineTerminator):
(JSC::Parser::lexCurrentTokenAgainUnderCurrentContext):
(JSC::Parser::internalSaveLexerState):
(JSC::Parser::restoreLexerState):

LayoutTests:

The test relied on the wrong EOF token's offset. This patch also fixes the test.

* inspector/runtime/parse-expected.txt:
* inspector/runtime/parse.html:

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

4 months agoUpdate touch-action region on property changes
antti@apple.com [Mon, 8 Apr 2019 20:32:53 +0000 (20:32 +0000)]
Update touch-action region on property changes
https://bugs.webkit.org/show_bug.cgi?id=196608

Reviewed by Simon Fraser.

Source/WebCore:

Test: pointerevents/ios/touch-action-region-dynamic.html

* rendering/EventRegion.cpp:
(WebCore::EventRegion::touchActionsForPoint const):

Correctly return 'auto' when nothing is found from the regions (this code is not used yet).

* rendering/RenderElement.cpp:
(WebCore::RenderElement::styleWillChange):

React to 'touch-action' property changes, similarly to 'pointer-events'.

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::invalidateEventRegion):

Test if need to invalidate.

* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::setContentsNeedDisplay):
(WebCore::RenderLayerBacking::setContentsNeedDisplayInRect):

Call invalidateEventRegion explicitly instead of relying on compositing update. This ensures
that we update the top level event region correctly when we have touch-actions.

LayoutTests:

* pointerevents/ios/touch-action-region-dynamic-expected.txt: Added.
* pointerevents/ios/touch-action-region-dynamic.html: Added.

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

4 months agoImplement white-space:break-spaces value
jfernandez@igalia.com [Mon, 8 Apr 2019 20:31:05 +0000 (20:31 +0000)]
Implement white-space:break-spaces value
https://bugs.webkit.org/show_bug.cgi?id=177327

Reviewed by Myles Maxfield and Zalan Bujtas.

LayoutTests/imported/w3c:

Imoprted a few aditional tests from the CSS Text WPT suite that are relevant for this change.

* web-platform-tests/css/css-text/overflow-wrap/overflow-wrap-break-word-008-expected.html: Added.
* web-platform-tests/css/css-text/overflow-wrap/overflow-wrap-break-word-008.html: Added.
* web-platform-tests/css/css-text/overflow-wrap/w3c-import.log:
* web-platform-tests/css/css-text/parsing/white-space-valid-expected.txt:
* web-platform-tests/css/css-text/white-space/break-spaces-003-expected.html: Added.
* web-platform-tests/css/css-text/white-space/break-spaces-003.html: Added.
* web-platform-tests/css/css-text/white-space/break-spaces-009-expected.html: Added.
* web-platform-tests/css/css-text/white-space/break-spaces-009.html: Added.
* web-platform-tests/css/css-text/white-space/w3c-import.log:

Source/WebCore:

Finally the CSS WG decided [1] to move back the 'break-spaces' value to
the 'white-space' property. This makes the parsing logic easier than
the previous approach of using the 'overflow-wrap' property.

This new value prevents the white-space sequence to collapse and gives
breaking opportunities after every preserved white-space.

https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces

Additionally, unlike 'pre-wrap', non-collapsible spaces or tabs at the
end of a line cannot be hung or visually collapsed, since we want them
to be preserved and broken.

[1] https://github.com/w3c/csswg-drafts/pull/2841

Tests: imported/w3c/web-platform-tests/css/css-text/overflow-wrap/overflow-wrap-break-word-008.html
       imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-003.html
       imported/w3c/web-platform-tests/css/css-text/white-space/break-spaces-009.html

* css/CSSPrimitiveValueMappings.h:
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue): New mapping for CSSVaueBreakSpaces.
(WebCore::CSSPrimitiveValue::operator WhiteSpace const): New value BreakSpaces for the Whitespace enum.
* css/CSSProperties.json: new 'break-spaces' value for the 'white-space' property.
* css/CSSValueKeywords.in: new break-spaces keyword
* css/parser/CSSParserFastPaths.cpp:
(WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
* rendering/SimpleLineLayout.cpp:  The SimpleLineLayut codepath must handle properly the new behavior of preserved whitespaces.
(WebCore::SimpleLineLayout::LineState::hasTrailingWhitespace const): Require that m_trailingWhitespaceWidth being greater than zero.
(WebCore::SimpleLineLayout::LineState::hasWhitespaceFragments const): New function to detect former whitespae fragments that could be breaking opportunities.
(WebCore::SimpleLineLayout::removeTrailingWhitespace): The 'break-spaces' feature forbids to remove any trailing whitespace.
(WebCore::SimpleLineLayout::firstFragment): We have now leading whitespace sequences comming from the previous line.
(WebCore::SimpleLineLayout::createLineRuns): We should revert some breaking opportunities if others were formerly found in the line.
* rendering/SimpleLineLayoutTextFragmentIterator.cpp:
(WebCore::SimpleLineLayout::TextFragmentIterator::Style::Style): New style fields to determine whether the break-space feature is being used. Also split out the break-all and breal-all values.
* rendering/SimpleLineLayoutTextFragmentIterator.h:
* rendering/line/BreakingContext.h: Different codepath but similar changes to properly handle the new behavior of preserved whitespace.
(WebCore::BreakingContext::BreakingContext): New class field to determine whether there are some whitespace that may prevent the word ot be broken.
(WebCore::BreakingContext::handleText): New line-breaking logic to implement the break-spaces behavior.
(WebCore::BreakingContext::trailingSpacesHang): Cases where the preserved breakspaces should hand or overflow.
* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::collapseWhiteSpace): With break-spaces collapsing whitespaces is not allowed.
(WebCore::RenderStyle::breakOnlyAfterWhiteSpace const): Add the WhiteSpace::BreakSpaces to this group.
* rendering/style/RenderStyleConstants.h: A new constan added.

LayoutTests:

Removed many failure expectations of tests that pass now thanks to this change.

The overflow-wrap-break-word-003.html tests fails in mac and iOS platforms due to an issue related to
how we compute widths using 'ch' units and 'monospace' fonts. I filed bug #196169 to report the specific
case of this test (break-word+pre-wrap) but the root cause it's probably the bug #196353.

I have submitted a PR [1] to the Web Platform Tests to change several tests that failed only if the
monospace font is used, but pass with the Ahem font. Additionally, I've requested another PR [2] to
add new layout tests, with the same case than overflow-wrap-break-word-003.html but using the Ahem
font.

[1] https://github.com/web-platform-tests/wpt/pull/16137
[2] https://github.com/web-platform-tests/wpt/pull/16124

* TestExpectations: Removed many Failure entries on tests that pass now thanks to this change.
* platform/mac/TestExpectations: Added one Failure entry and filed the corresponding bug report.

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

4 months agoMake HSTS list handling more robust against unexpected content
bfulgham@apple.com [Mon, 8 Apr 2019 20:24:34 +0000 (20:24 +0000)]
Make HSTS list handling more robust against unexpected content
https://bugs.webkit.org/show_bug.cgi?id=196552
<rdar://problem/43403817>

Reviewed by Chris Dumez.

Crash logs indicate we sometimes encounter null key values during processing.
This patch adds some debug assertions to catch this in test environments, and
allows the code to skip the bad entries if encountered.

It also avoids calling CFDictionaryApplyFunction when the HSTS policies returned
by _CFNetworkCopyHSTSPolicies is nullptr, which is a possible return value.

* NetworkProcess/cocoa/NetworkProcessCocoa.mm:
(WebKit::filterPreloadHSTSEntry):
(WebKit::NetworkProcess::getHostNamesWithHSTSCache):

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

4 months agoLibWebRTCMediaEndpoint does not need to hop to the signaling thread to gather stats
youenn@apple.com [Mon, 8 Apr 2019 20:22:11 +0000 (20:22 +0000)]
LibWebRTCMediaEndpoint does not need to hop to the signaling thread to gather stats
https://bugs.webkit.org/show_bug.cgi?id=196697
<rdar://problem/47477113>

Reviewed by Eric Carlson.

It is not thread safe to use m_backend in another thread than the main thread.
It is not useful anymore to hop to the signaling thread to gather stats.
No change of behavior.

* Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
(WebCore::LibWebRTCMediaEndpoint::getStats):
(WebCore::LibWebRTCMediaEndpoint::gatherStatsForLogging):

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

4 months agoWeb Automation: clean up some WebAutomationSession methods to use modern async IPC
bburg@apple.com [Mon, 8 Apr 2019 19:31:45 +0000 (19:31 +0000)]
Web Automation: clean up some WebAutomationSession methods to use modern async IPC
https://bugs.webkit.org/show_bug.cgi?id=196168

Reviewed by Devin Rousso.

Modern WebKit IPC is capable of providing completion handlers and can track callback IDs.
So, most messages between WebAutomationSession and its proxy can use this facility and stop
keeping track of callback IDs manually. This makes most code easier to read on both the
sender and receiver side.

There are two cases that could not be converted:
- For evaluateJavaScript, we cannot use async IPC because WebAutomationSession expects to
be able to cancel all pending replies when a page navigates away, the web process crashes,
or when handling an alert.
- For takeScreenshot, there is not currently support in the modern async IPC code paths for
sending the result back. ShareableBitmap and friends lack a modern decoder implementation.

* UIProcess/Automation/WebAutomationSession.cpp:
(WebKit::WebAutomationSession::resolveChildFrameHandle):
(WebKit::WebAutomationSession::resolveParentFrameHandle):
(WebKit::WebAutomationSession::computeElementLayout):
(WebKit::WebAutomationSession::selectOptionElement):
(WebKit::WebAutomationSession::getAllCookies):
(WebKit::WebAutomationSession::deleteSingleCookie):
(WebKit::WebAutomationSession::viewportInViewCenterPointOfElement):
(WebKit::WebAutomationSession::didResolveChildFrame): Deleted.
(WebKit::WebAutomationSession::didResolveParentFrame): Deleted.
(WebKit::WebAutomationSession::didComputeElementLayout): Deleted.
(WebKit::WebAutomationSession::didSelectOptionElement): Deleted.
(WebKit::WebAutomationSession::didGetCookiesForFrame): Deleted.
(WebKit::WebAutomationSession::didDeleteCookie): Deleted.
* UIProcess/Automation/WebAutomationSession.h:
* UIProcess/Automation/WebAutomationSession.messages.in:
* WebProcess/Automation/WebAutomationSessionProxy.cpp:
(WebKit::WebAutomationSessionProxy::resolveChildFrameWithOrdinal):
(WebKit::WebAutomationSessionProxy::resolveChildFrameWithNodeHandle):
(WebKit::WebAutomationSessionProxy::resolveChildFrameWithName):
(WebKit::WebAutomationSessionProxy::resolveParentFrame):
(WebKit::WebAutomationSessionProxy::computeElementLayout):
(WebKit::WebAutomationSessionProxy::selectOptionElement):
(WebKit::WebAutomationSessionProxy::getCookiesForFrame):
(WebKit::WebAutomationSessionProxy::deleteCookie):
* WebProcess/Automation/WebAutomationSessionProxy.h:
* WebProcess/Automation/WebAutomationSessionProxy.messages.in:

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

4 months ago[ Mac WK2 iOS Debug ] REGRESSION(r233667) Layout Test imported/w3c/web-platform-tests...
graouts@webkit.org [Mon, 8 Apr 2019 18:50:41 +0000 (18:50 +0000)]
[ Mac WK2 iOS Debug ] REGRESSION(r233667) Layout Test imported/w3c/web-platform-tests/web-animations/interfaces/DocumentTimeline/constructor.html is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=195233
<rdar://problem/48527231>

Reviewed by Dean Jackson.

We need to create the "main" document timeline (document.timeline) if it doesn't already exist and use its current time as a basis for any other DocumentTimeline instance.

* animation/DocumentTimeline.cpp:
(WebCore::DocumentTimeline::currentTime):

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

4 months ago[Web Animations] JS wrapper may be deleted while animation is yet to dispatch its...
graouts@webkit.org [Mon, 8 Apr 2019 18:49:04 +0000 (18:49 +0000)]
[Web Animations] JS wrapper may be deleted while animation is yet to dispatch its finish event
https://bugs.webkit.org/show_bug.cgi?id=196118
<rdar://problem/46614137>

Reviewed by Chris Dumez.

Source/WebCore:

Test: webanimations/js-wrapper-kept-alive.html

We need to teach WebAnimation to keep its JS wrapper alive if it's relevant or could become relevant again by virtue of having a timeline.
We also need to ensure that the new implementation of hasPendingActivity() does not interfere with the ability of pages to enter the page
cache when running animations.

* animation/WebAnimation.cpp:
(WebCore::WebAnimation::canSuspendForDocumentSuspension const):
(WebCore::WebAnimation::stop):
(WebCore::WebAnimation::hasPendingActivity const):
* animation/WebAnimation.h:

LayoutTests:

Add a test that starts a short animation, sets a custom property on it, registers a "finish" event listener on it and deletes
the sole reference to it in the JS world before triggering garbage collection. Prior to this fix, this test would time out
because the JS wrapper would be garbage-collected prior to the animation completing and thus the event listener would not
be called. To complete successfully, this test checks that it receives the event and its target is the same animation object
that was originally created by checking the custom property is still set.

We also make sure that a test, which was found to have regressed with a previous version of this patch, uses the animation
engine that it is expected to be testing.

* legacy-animation-engine/animations/resume-after-page-cache.html:
* webanimations/js-wrapper-kept-alive-expected.txt: Added.
* webanimations/js-wrapper-kept-alive.html: Added.

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

4 months agoREGRESSION(236463) DownloadManager can call a null CompletionHandler
achristensen@apple.com [Mon, 8 Apr 2019 18:45:15 +0000 (18:45 +0000)]
REGRESSION(236463) DownloadManager can call a null CompletionHandler
https://bugs.webkit.org/show_bug.cgi?id=196414
<rdar://problem/48389434>

Reviewed by Geoff Garen.

* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::convertToDownload):
DownloadManager::continueDecidePendingDownloadDestination is being called when there is no completion handler.
r236463 introduced an unchecked code path that can allow this to happen.

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

4 months agoAX: <svg> elements with labels and no accessible contents are exposed as empty AXGroups
commit-queue@webkit.org [Mon, 8 Apr 2019 18:09:33 +0000 (18:09 +0000)]
AX: <svg> elements with labels and no accessible contents are exposed as empty AXGroups
https://bugs.webkit.org/show_bug.cgi?id=156774

Patch by Eric Liang <ericliang@apple.com> on 2019-04-08
Reviewed by Chris Fleizach.

Source/WebCore:

Labelled SVGs without accessible descendants are exposed as AXImage rather than groups.

Unlabelled equivalents are not exposed. Otherwise, SVGs with accessible descendants are exposed as AXGroup.
Also added back functionalities from last patch of determining whether a SVG element should be ignored.

Test: accessibility/svg-shape-labelled.html

* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::updateRoleAfterChildrenCreation):
* accessibility/AccessibilitySVGElement.cpp:
(WebCore::AccessibilitySVGElement::computeAccessibilityIsIgnored const):

LayoutTests:

Added tests that verify svgs shapes that are labelled are exposed as images.
* accessibility/resources/apple-logo.svg: Added.
* accessibility/svg-shape-labelled-expected.txt: Added.
* accessibility/svg-shape-labelled.html: Added.

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

4 months agoUnreviewed, rolling out r243948.
ryanhaddad@apple.com [Mon, 8 Apr 2019 18:01:42 +0000 (18:01 +0000)]
Unreviewed, rolling out r243948.

Caused inspector/runtime/parse.html to fail

Reverted changeset:

"SIGSEGV in JSC::BytecodeGenerator::addStringConstant"
https://bugs.webkit.org/show_bug.cgi?id=196486
https://trac.webkit.org/changeset/243948

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

4 months agoMake sure UniqueIDBDatabaseConnection unregisters itself even if its database is...
youenn@apple.com [Mon, 8 Apr 2019 17:29:51 +0000 (17:29 +0000)]
Make sure UniqueIDBDatabaseConnection unregisters itself even if its database is gone
https://bugs.webkit.org/show_bug.cgi?id=196651

Reviewed by Brady Eidson.

In UniqueIDBDatabase methods, many operations are refing the transaction
so that it stays alive until a quota check decision is made.
This extends the lifetime of the transaction which may be lasting
longer than its database that may be cleared without waiting for the quota check decisions.

We therefore need to make sure that the transaction is cleaning itself correctly at destruction time.

Make sure that the transaction is unregistering itself from its IDBServer.
To do so, the transaction keeps a weak ref to the IDBServer.

This is timing sensitive hence difficult to test.

* Modules/indexeddb/server/IDBServer.h:
* Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp:
(WebCore::IDBServer::UniqueIDBDatabaseConnection::didAbortTransaction):
Like done below for UniqueIDBDatabaseConnection::didCommitTransaction,
add a check to ensure that either the database is we are in an error case.
* Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp:
(WebCore::IDBServer::UniqueIDBDatabaseTransaction::UniqueIDBDatabaseTransaction):
(WebCore::IDBServer::UniqueIDBDatabaseTransaction::~UniqueIDBDatabaseTransaction):
* Modules/indexeddb/server/UniqueIDBDatabaseTransaction.h:

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

4 months agoLayout tests imported/w3c/IndexedDB-private-browsing/idbobjectstore_createIndex7...
sroberts@apple.com [Mon, 8 Apr 2019 17:29:05 +0000 (17:29 +0000)]
Layout tests imported/w3c/IndexedDB-private-browsing/idbobjectstore_createIndex7-event_order.html
imported/w3c/IndexedDB-private-browsing/idbobjectstore_createIndex6-event_order.html are flaky failures
https://bugs.webkit.org/show_bug.cgi?id=195961

Unreviewed test gardening

* platform/mac-wk2/TestExpectations: Updating test expectations for Debug flaky failure

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

4 months agoUndefined Behavior: m_experimentalImageMenuEnabled isn't initialized in HTMLImageElem...
chris.reid@sony.com [Mon, 8 Apr 2019 17:27:35 +0000 (17:27 +0000)]
Undefined Behavior: m_experimentalImageMenuEnabled isn't initialized in HTMLImageElement when SERVICE_CONTROLS is disabled
https://bugs.webkit.org/show_bug.cgi?id=196664

Reviewed by Ross Kirsling.

No observable change in behavior.

Initialize m_experimentalImageMenuEnabled regardless of ENABLE(SERVICE_CONTROLS)

* html/HTMLImageElement.cpp:

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

4 months ago[ews-build] Do not upload archive when Compile Fails
aakash_jain@apple.com [Mon, 8 Apr 2019 16:32:11 +0000 (16:32 +0000)]
[ews-build] Do not upload archive when Compile Fails
https://bugs.webkit.org/show_bug.cgi?id=196674

Reviewed by Alexey Proskuryakov.

* BuildSlaveSupport/ews-build/factories.py:
(BuildFactory.__init__): Remove steps which require dynamic decision about whether to run or not.
* BuildSlaveSupport/ews-build/steps.py:
(CompileWebKit.evaluateCommand): Dynamically decide which steps to run based on compile status.
(CompileWebKitToT.evaluateCommand): Explicitly override Compile.evaluateCommand so that it
doesn't inherit CompileWebKit.evaluateCommand which dynamically adds more steps.

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

4 months agoUnreviewed, rolling out r243943.
ryanhaddad@apple.com [Mon, 8 Apr 2019 15:51:19 +0000 (15:51 +0000)]
Unreviewed, rolling out r243943.

Caused test262 failures.

Reverted changeset:

"[JSC] Filter DontEnum properties in
ProxyObject::getOwnPropertyNames()"
https://bugs.webkit.org/show_bug.cgi?id=176810
https://trac.webkit.org/changeset/243943

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

4 months ago[JSC] Partially fix the build with unified builds disabled
csaavedra@igalia.com [Mon, 8 Apr 2019 14:45:08 +0000 (14:45 +0000)]
[JSC] Partially fix the build with unified builds disabled
https://bugs.webkit.org/show_bug.cgi?id=196647

Reviewed by Konstantin Tokarev.

If you disable unified builds you find all kind of build
errors. This partially tries to fix them but there's a lot
more.

* API/JSBaseInternal.h:
* b3/air/AirAllocateRegistersAndStackAndGenerateCode.cpp:
* b3/air/AirHandleCalleeSaves.h:
* bytecode/ExecutableToCodeBlockEdge.cpp:
* bytecode/ExitFlag.h:
* bytecode/ICStatusUtils.h:
* bytecode/UnlinkedMetadataTable.h:
* dfg/DFGPureValue.h:
* heap/IsoAlignedMemoryAllocator.cpp:
* heap/IsoAlignedMemoryAllocator.h:

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

4 months agoEnable DFG on MIPS
guijemont@igalia.com [Mon, 8 Apr 2019 12:32:57 +0000 (12:32 +0000)]
Enable DFG on MIPS
https://bugs.webkit.org/show_bug.cgi?id=196689

Reviewed by Žan Doberšek.

Since the bytecode change, we enabled the baseline JIT on mips in
r240432, but DFG is still missing. With this change, all tests are
passing on a ci20 board.

Source/JavaScriptCore:

* jit/RegisterSet.cpp:
(JSC::RegisterSet::calleeSaveRegisters):
Added s0, which is used in llint.

Source/WTF:

* wtf/Platform.h: Enable DFG on MIPS by default.

Tools:

* Scripts/run-jsc-stress-tests: Enable DFG tests on MIPS.

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

4 months ago[Flatpak] Second run update-webkitwpe-flatpak fails
commit-queue@webkit.org [Mon, 8 Apr 2019 12:14:43 +0000 (12:14 +0000)]
[Flatpak] Second run update-webkitwpe-flatpak fails
https://bugs.webkit.org/show_bug.cgi?id=192702

Patch by Philippe Normand <pnormand@igalia.com> on 2019-04-08
Reviewed by Carlos Garcia Campos.

* flatpak/flatpakutils.py:
(FlatpakObject.flatpak): Fix typo.
(FlatpakPackage.install): When installing, also update to the configured remote commit.
* flatpak/org.webkit.WebKit.yaml: Update GNOME 3.28 SDK/runtime hashes.

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

4 months ago[CMake] Detect SSE2 at compile time
commit-queue@webkit.org [Mon, 8 Apr 2019 10:16:22 +0000 (10:16 +0000)]
[CMake] Detect SSE2 at compile time
https://bugs.webkit.org/show_bug.cgi?id=196488

Patch by Xan Lopez <xan@igalia.com> on 2019-04-08
Reviewed by Carlos Garcia Campos.

.:

* CMakeLists.txt: Use FindSSE2.cmake to detect SSE2 support.
* Source/cmake/FindSSE2.cmake: Added.

Source/JavaScriptCore:

* assembler/MacroAssemblerX86Common.cpp: Remove unnecessary (and
incorrect) static_assert.

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

4 months ago[GTK][WPE] outlook.live.com displays old-fashioned UI
svillar@igalia.com [Mon, 8 Apr 2019 09:09:01 +0000 (09:09 +0000)]
[GTK][WPE] outlook.live.com displays old-fashioned UI
https://bugs.webkit.org/show_bug.cgi?id=196642

Reviewed by Carlos Garcia Campos.

Source/WebCore:

The new good looking UI is shown as long as pretend we're a Mac in the UA.

* platform/UserAgentQuirks.cpp:
(WebCore::urlRequiresChromeBrowser):

Tools:

* TestWebKitAPI/Tests/WebCore/UserAgentQuirks.cpp:
(TestWebKitAPI::TEST): New Mac platform quirk test.

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

4 months ago[ATK] Cleanup accessible wrapper base class
carlosgc@webkit.org [Mon, 8 Apr 2019 08:11:19 +0000 (08:11 +0000)]
[ATK] Cleanup accessible wrapper base class
https://bugs.webkit.org/show_bug.cgi?id=196601

Reviewed by Mario Sanchez Prada.

Cleanups:

 - Rename WebKitAccessibleWrapperAtk cpp and header as WebKitAccessible for consistency with the class name.
 - Use WEBKIT_DEFINE_TYPE instead of custom type registration. This ensures that all CStrings used in private
   struct are no longer leaked.
 - Move core object pointer to the private struct.
 - Remove confusing core() function and simply get the core object from the private struct.
 - Use nullptr instead of 0 and other coding style issues.
 - Rename cacheAndReturnAtkProperty as webkitAccessibleCacheAndReturnAtkProperty and use WebKitAccessible as
   instance parameter.
 - Make webkitAccessibleGetAccessibilityObject() return a reference, since we use a fallback object on detach it
   never returns nullptr.
 - Move objectFocusedAndCaretOffsetUnignored() to WebKitAccessibleUtil.

* SourcesGTK.txt:
* accessibility/atk/AXObjectCacheAtk.cpp:
* accessibility/atk/WebKitAccessible.cpp: Renamed from Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp.
(webkitAccessibleGetName):
(webkitAccessibleGetDescription):
(setAtkRelationSetFromCoreObject):
(isRootObject):
(webkitAccessibleGetParent):
(webkitAccessibleGetNChildren):
(webkitAccessibleRefChild):
(webkitAccessibleGetIndexInParent):
(webkitAccessibleGetAttributes):
(atkRole):
(webkitAccessibleGetRole):
(webkitAccessibleRefStateSet):
(webkitAccessibleRefRelationSet):
(webkitAccessibleInit):
(webkitAccessibleGetObjectLocale):
(webkit_accessible_class_init):
(interfaceMaskFromObject):
(uniqueAccessibilityTypeName):
(accessibilityTypeFromObject):
(webkitAccessibleNew):
(webkitAccessibleGetAccessibilityObject):
(webkitAccessibleDetach):
(webkitAccessibleIsDetached):
(webkitAccessibleCacheAndReturnAtkProperty):
* accessibility/atk/WebKitAccessible.h: Renamed from Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.h.
* accessibility/atk/WebKitAccessibleHyperlink.cpp:
(core):
* accessibility/atk/WebKitAccessibleInterfaceAction.cpp:
(core):
(webkitAccessibleActionGetKeybinding):
(webkitAccessibleActionGetName):
* accessibility/atk/WebKitAccessibleInterfaceComponent.cpp:
(core):
* accessibility/atk/WebKitAccessibleInterfaceDocument.cpp:
(core):
(documentAttributeValue):
* accessibility/atk/WebKitAccessibleInterfaceEditableText.cpp:
(core):
* accessibility/atk/WebKitAccessibleInterfaceHypertext.cpp:
(core):
* accessibility/atk/WebKitAccessibleInterfaceImage.cpp:
(core):
(webkitAccessibleImageGetImageDescription):
* accessibility/atk/WebKitAccessibleInterfaceSelection.cpp:
(core):
* accessibility/atk/WebKitAccessibleInterfaceTable.cpp:
(core):
* accessibility/atk/WebKitAccessibleInterfaceTableCell.cpp:
(core):
* accessibility/atk/WebKitAccessibleInterfaceText.cpp:
(core):
* accessibility/atk/WebKitAccessibleInterfaceValue.cpp:
(core):
* accessibility/atk/WebKitAccessibleUtil.cpp:
(objectFocusedAndCaretOffsetUnignored):
* accessibility/atk/WebKitAccessibleUtil.h:
* editing/atk/FrameSelectionAtk.cpp:

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

4 months agoUnreviewed, rolling out r243956.
commit-queue@webkit.org [Mon, 8 Apr 2019 02:58:26 +0000 (02:58 +0000)]
Unreviewed, rolling out r243956.
https://bugs.webkit.org/show_bug.cgi?id=196688

Broke API Test SafeBrowsing.WKWebViewGoBackIFrame (Requested
by aakashjain on #webkit).

Reverted changeset:

"Clicking "Go Back" from a safe browsing warning from an
iframe should navigate the WKWebView back to the previous
page"
https://bugs.webkit.org/show_bug.cgi?id=196665
https://trac.webkit.org/changeset/243956

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

4 months agoRemove stray byte added by r241131
ggaren@apple.com [Sun, 7 Apr 2019 23:31:01 +0000 (23:31 +0000)]
Remove stray byte added by r241131
https://bugs.webkit.org/show_bug.cgi?id=196682

Reviewed by Alexey Proskuryakov.

Sublime Text thinks WKWebView.mm is binary instead of text.

According to online documentation and bisecting, this is because r241131
introduced a stray byte (probably a null byte?) into the file.

I fixed this with Cmd-C Cmd-V.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _initializeWithConfiguration:]):

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

4 months agoREGRESSION (r243642): Crash in reddit.com page
msaboff@apple.com [Sun, 7 Apr 2019 23:24:45 +0000 (23:24 +0000)]
REGRESSION (r243642): Crash in reddit.com page
https://bugs.webkit.org/show_bug.cgi?id=196684

Reviewed by Geoffrey Garen.

JSTests:

New regression test.

* stress/regexp-nongreedy-charclass-backtracks.js: Added.

Source/JavaScriptCore:

In r243642, the code that saves and restores the count for non-greedy character classes
was inadvertently put inside an if statement.  This code should be generated for all
non-greedy character classes.

* yarr/YarrJIT.cpp:
(JSC::Yarr::YarrGenerator::generateCharacterClassNonGreedy):
(JSC::Yarr::YarrGenerator::backtrackCharacterClassNonGreedy):

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

4 months ago[JSC] CallLinkInfo should clear Callee or CodeBlock even if it is unlinked by jettison
ysuzuki@apple.com [Sun, 7 Apr 2019 19:25:59 +0000 (19:25 +0000)]
[JSC] CallLinkInfo should clear Callee or CodeBlock even if it is unlinked by jettison
https://bugs.webkit.org/show_bug.cgi?id=196683

Reviewed by Saam Barati.

JSTests:

* stress/clear-callee-or-codeblock-in-calllinkinfo-even-cleared-by-jettison.js: Added.
(foo):

Source/JavaScriptCore:

In r243626, we stop repatching CallLinkInfo when the CallLinkInfo is held by jettisoned CodeBlock.
But we still need to clear the Callee or CodeBlock since they are now dead. Otherwise, CodeBlock's
visitWeak eventually accesses this dead cells and crashes because the owner CodeBlock of CallLinkInfo
can be still live.

We also move all repatching operations from CallLinkInfo.cpp to Repatch.cpp for consistency because the
other repatching operations in CallLinkInfo are implemented in Repatch.cpp side.

* bytecode/CallLinkInfo.cpp:
(JSC::CallLinkInfo::setCallee):
(JSC::CallLinkInfo::clearCallee):
* jit/Repatch.cpp:
(JSC::linkFor):
(JSC::revertCall):

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

4 months agoAdded tests for WeakHashSet::computesEmpty and WeakHashSet::computeSize
rniwa@webkit.org [Sun, 7 Apr 2019 03:55:59 +0000 (03:55 +0000)]
Added tests for WeakHashSet::computesEmpty and WeakHashSet::computeSize
https://bugs.webkit.org/show_bug.cgi?id=196669

Reviewed by Geoffrey Garen.

Source/WTF:

Removed the superflous type names from forward declarations, and made WeakHashSet::add
take a const object to match other container types in WTF.

* wtf/WeakHashSet.h:
(WTF::WeakHashSet::add):
* wtf/WeakPtr.h:

Tools:

Added three new unit tests for WeakHashSet.

* TestWebKitAPI/Tests/WTF/WeakPtr.cpp:
(WTF_WeakPtr.WeakHashSetConstObjects):
(WTF_WeakPtr.WeakHashSetComputesEmpty):
(WTF_WeakPtr.WeakHashSetComputeSize):

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

4 months agoREGRESSION(r237196): Web Inspector: Computed panel shouldn't update when it isn't...
nvasilyev@apple.com [Sun, 7 Apr 2019 02:54:58 +0000 (02:54 +0000)]
REGRESSION(r237196): Web Inspector: Computed panel shouldn't update when it isn't visible
https://bugs.webkit.org/show_bug.cgi?id=196667
<rdar://problem/49664912>

Reviewed by Timothy Hatcher.

Explicitly define `hidden` and `shown` methods instead of relying on SidebarPanel's `visible` getter.

* UserInterface/Views/GeneralStyleDetailsSidebarPanel.js:
(WI.GeneralStyleDetailsSidebarPanel.prototype.visibilityDidChange): Deleted.
(WI.GeneralStyleDetailsSidebarPanel.prototype.hidden): Added.
(WI.GeneralStyleDetailsSidebarPanel.prototype.shown): Added.

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

4 months agoHide next and previous form control buttons when WKWebView is editable
wenson_hsieh@apple.com [Sun, 7 Apr 2019 02:25:36 +0000 (02:25 +0000)]
Hide next and previous form control buttons when WKWebView is editable
https://bugs.webkit.org/show_bug.cgi?id=196672
<rdar://problem/35625321>

Reviewed by Tim Horton.

Source/WebKit:

Adopt new UIKit SPI to hide or show next and previous controls in the form accessory view when changing
editability.

Test: KeyboardInputTests.FormNavigationAssistantBarButtonItems

* Platform/spi/ios/UIKitSPI.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _setEditable:]):
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _updateAccessory]):
(-[WKContentView _didChangeWebViewEditability]):

Tools:

Add a new API test.

* TestWebKitAPI/Tests/ios/KeyboardInputTestsIOS.mm:
(-[TestWKWebView lastTrailingBarButtonGroup]):
(TestWebKitAPI::TEST):
* TestWebKitAPI/ios/UIKitSPI.h:

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

4 months agoCombine event and touch action regions into a single class
antti@apple.com [Sat, 6 Apr 2019 16:48:58 +0000 (16:48 +0000)]
Combine event and touch action regions into a single class
https://bugs.webkit.org/show_bug.cgi?id=196644
<rdar://problem/49643614>

Reviewed by Darin Adler.

Source/WebCore:

This patch replaces the existing TouchActionRegion class with the more general EventRegion class.
It collects both the overall event region and the touch action regions. This avoids duplication
and simplifies the code.

The patch also adds serialization support for EventRegion, so touch-action regions gets passed
to the UI process too.

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* platform/graphics/GraphicsLayer.cpp:
(WebCore::GraphicsLayer::setEventRegion):
(WebCore::GraphicsLayer::dumpProperties const):
(WebCore::GraphicsLayer::setTouchActionRegion): Deleted.
* platform/graphics/GraphicsLayer.h:
(WebCore::GraphicsLayer::eventRegion const):
(WebCore::GraphicsLayer::touchActionRegion const): Deleted.
* platform/graphics/Region.cpp:
(WebCore::operator<<):
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::setEventRegion):
(WebCore::GraphicsLayerCA::setTouchActionRegion): Deleted.
* platform/graphics/ca/GraphicsLayerCA.h:
* platform/graphics/ca/PlatformCALayer.h:
* platform/graphics/ca/cocoa/PlatformCALayerCocoa.h:
* rendering/EventRegion.cpp: Copied from Source/WebCore/rendering/TouchActionRegion.cpp.
(WebCore::EventRegion::operator== const):
(WebCore::EventRegion::unite):
(WebCore::EventRegion::translate):
(WebCore::EventRegion::uniteTouchActions):
(WebCore::EventRegion::touchActionsForPoint const):
(WebCore::operator<<):
(WebCore::TouchActionRegion::unite): Deleted.
(WebCore::TouchActionRegion::actionsForPoint const): Deleted.
(WebCore::TouchActionRegion::translate): Deleted.
* rendering/EventRegion.h: Copied from Source/WebCore/rendering/TouchActionRegion.h.
(WebCore::EventRegion::isEmpty const):
(WebCore::EventRegion::contains const):
(WebCore::EventRegion::hasTouchActions const):
(WebCore::EventRegion::encode const):
(WebCore::EventRegion::decode):
(WebCore::TouchActionRegion::isEmpty const): Deleted.
(WebCore::TouchActionRegion::operator== const): Deleted.
* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::paint):
* rendering/PaintInfo.h:
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::paintObject):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::collectEventRegionForFragments):
* rendering/RenderLayer.h:
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateEventRegion):
* rendering/RenderLayerModelObject.cpp:
* rendering/SimpleLineLayoutFunctions.cpp:
(WebCore::SimpleLineLayout::paintFlow):
* rendering/TouchActionRegion.cpp: Removed.
* rendering/TouchActionRegion.h: Removed.

Source/WebKit:

* Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
* Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
(WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
* UIProcess/RemoteLayerTree/RemoteLayerTreeNode.h:
(WebKit::RemoteLayerTreeNode::eventRegion const):
* UIProcess/RemoteLayerTree/RemoteLayerTreeNode.mm:
(WebKit::RemoteLayerTreeNode::setEventRegion):
* WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
(WebKit::PlatformCALayerRemote::setEventRegion):
* WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h:

LayoutTests:

* pointerevents/ios/touch-action-region-basic-expected.txt:
* pointerevents/ios/touch-action-region-layers-expected.txt:
* pointerevents/ios/touch-action-region-pan-x-y-expected.txt:

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

4 months agoWe should pass minimumEffectiveDeviceWidth to web process on new page creation.
commit-queue@webkit.org [Sat, 6 Apr 2019 03:41:26 +0000 (03:41 +0000)]
We should pass minimumEffectiveDeviceWidth to web process on new page creation.
https://bugs.webkit.org/show_bug.cgi?id=196077
<rdar://problem/49108202>

Patch by Yongjun Zhang <yongjun_zhang@apple.com> on 2019-04-05
Reviewed by Chris Dumez.

Source/WebCore:

If the page doesn't specify it requires to use the device width in viewport tag, we should try to scale down
the page to fit the window width.

Test: fast/viewport/ios/shrink-to-fit-for-page-without-viewport-meta.html

* page/ViewportConfiguration.cpp:
(WebCore::ViewportConfiguration::updateDefaultConfiguration): Also update the minimum layout size
    when the default configuration is changed.
(WebCore::ViewportConfiguration::nativeWebpageParametersWithShrinkToFit): Make sure we fit the content
    to window width.

Source/WebKit:

When a new web view is created, it is possible we don't have the web content process till a load
is requested. This patch stashes minimumEffectiveDeviceWidth in WebPageProxy.cpp and passes that
value down to web process via WebPageCreationParameters when a new process is created, just like
we did for other values like viewportConfigurationLayoutSizeScaleFactor or viewportConfigurationViewLayoutSize.

* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::encode const): Encode viewportConfigurationMinimumEffectiveDeviceWidth value.
(WebKit::WebPageCreationParameters::decode): Decode viewportConfigurationMinimumEffectiveDeviceWidth value.
* Shared/WebPageCreationParameters.h:
* UIProcess/API/Cocoa/WKWebView.mm: Now that we stash the minimumEffectiveDeviceWidth value in WebPageProxy, we
    don't need the iVar in WKWebView any more.
(-[WKWebView _dispatchSetViewLayoutSize:]): Use _page->minimumEffectiveDeviceWidth().
(-[WKWebView _setViewScale:]): Ditto.
(-[WKWebView _setMinimumEffectiveDeviceWidth:]): Ditto.
(-[WKWebView _minimumEffectiveDeviceWidth]): Ditto.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::creationParameters): Also add viewportConfigurationMinimumEffectiveDeviceWidth to
    web process creation parameter.
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::minimumEffectiveDeviceWidth const): Returns m_viewportConfigurationMinimumEffectiveDeviceWidth.
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::setViewportConfigurationViewLayoutSize): Pass parameters.viewportConfigurationMinimumEffectiveDeviceWidth
    to web process.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage): Take viewportConfigurationMinimumEffectiveDeviceWidth value from the parameter and
    set that to viewport configuration.

Tools:

Add an API test to verify the minimumEffectDeviceWidth is passed to web content process
on new web view.

* TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:

LayoutTests:

Add a layout test to verify the page shrinks to fit the window width when ignoreMetaViewport
flag is turned on.

* fast/viewport/ios/shrink-to-fit-for-page-without-viewport-meta-expected.txt: Added.
* fast/viewport/ios/shrink-to-fit-for-page-without-viewport-meta.html: Added.

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

4 months agoMake compare-results understand MotionMark
sbarati@apple.com [Sat, 6 Apr 2019 02:05:11 +0000 (02:05 +0000)]
Make compare-results understand MotionMark
https://bugs.webkit.org/show_bug.cgi?id=196666

Reviewed by Yusuke Suzuki.

* Scripts/compare-results:
(PLT5Results):
(detectMotionMark):
(detectMotionMark1_1):
(motionMarkResults):
(motionMark1_1Results):
(detectBenchmark):
(biggerIsBetter):
(main):

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

4 months ago[JSC] OSRExit recovery for SpeculativeAdd does not consier "A = A + A" pattern
ysuzuki@apple.com [Sat, 6 Apr 2019 01:57:16 +0000 (01:57 +0000)]
[JSC] OSRExit recovery for SpeculativeAdd does not consier "A = A + A" pattern
https://bugs.webkit.org/show_bug.cgi?id=196582

Reviewed by Saam Barati.

JSTests:

* stress/add-overflow-check-with-three-same-registers.js: Added.
(foo):
(Number.prototype.valueOf):
(runWithNumber):

Source/JavaScriptCore:

In DFG, our ArithAdd with overflow is executed speculatively, and we recover the value when overflow flag is set.
The recovery is subtracting the operand from the destination to get the original two operands. Our recovery code
handles A + B = A, A + B = B cases. But it misses A + A = A case (here, A and B are GPRReg). Our recovery code
attempts to produce the original operand by performing A - A, and it always produces zero accidentally.

This patch adds the recovery code for A + A = A case. Because we know that this ArithAdd overflows, and operands were
same values, we can calculate the original operand from the destination value by `((int32_t)value >> 1) ^ 0x80000000`.

We also found that FTL recovery code is dead. We remove them in this patch.

* dfg/DFGOSRExit.cpp:
(JSC::DFG::OSRExit::executeOSRExit):
(JSC::DFG::OSRExit::compileExit):
* dfg/DFGOSRExit.h:
(JSC::DFG::SpeculationRecovery::SpeculationRecovery):
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compileArithAdd):
* ftl/FTLExitValue.cpp:
(JSC::FTL::ExitValue::dataFormat const):
(JSC::FTL::ExitValue::dumpInContext const):
* ftl/FTLExitValue.h:
(JSC::FTL::ExitValue::isArgument const):
(JSC::FTL::ExitValue::hasIndexInStackmapLocations const):
(JSC::FTL::ExitValue::adjustStackmapLocationsIndexByOffset):
(JSC::FTL::ExitValue::recovery): Deleted.
(JSC::FTL::ExitValue::isRecovery const): Deleted.
(JSC::FTL::ExitValue::leftRecoveryArgument const): Deleted.
(JSC::FTL::ExitValue::rightRecoveryArgument const): Deleted.
(JSC::FTL::ExitValue::recoveryFormat const): Deleted.
(JSC::FTL::ExitValue::recoveryOpcode const): Deleted.
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileNode):
(JSC::FTL::DFG::LowerDFGToB3::preparePatchpointForExceptions):
(JSC::FTL::DFG::LowerDFGToB3::appendOSRExit):
(JSC::FTL::DFG::LowerDFGToB3::exitValueForNode):
(JSC::FTL::DFG::LowerDFGToB3::addAvailableRecovery): Deleted.
* ftl/FTLOSRExitCompiler.cpp:
(JSC::FTL::compileRecovery):

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

4 months ago[Cocoa] Deactivate the audio session before the WebProcess suspends.
jer.noble@apple.com [Sat, 6 Apr 2019 01:08:50 +0000 (01:08 +0000)]
[Cocoa] Deactivate the audio session before the WebProcess suspends.
https://bugs.webkit.org/show_bug.cgi?id=196658

Reviewed by Eric Carlson.

Source/WebCore:

Test: platform/mac/media/audio-session-deactivated-when-suspended.html

Deactivate the audio session when we are notified that the session will suspend.

Drive-by fix: don't try to begin playback when the process is suspended.

* platform/audio/PlatformMediaSessionManager.cpp:
(WebCore::PlatformMediaSessionManager::sessionWillBeginPlayback):
(WebCore::PlatformMediaSessionManager::processWillSuspend):
(WebCore::PlatformMediaSessionManager::processDidResume):
* platform/audio/PlatformMediaSessionManager.h:
(WebCore::PlatformMediaSessionManager::processIsSuspended const):
* testing/InternalSettings.cpp:
(WebCore::InternalSettings::Backup::Backup):
(WebCore::InternalSettings::Backup::restoreTo):
(WebCore::InternalSettings::setShouldDeactivateAudioSession):
* testing/InternalSettings.h:
* testing/InternalSettings.idl:
* testing/Internals.cpp:
(WebCore::Internals::processWillSuspend):
(WebCore::Internals::processDidResume):
* testing/Internals.h:
* testing/Internals.idl:

Source/WebKit:

Notify the PlatformMediaSessionManager when the process suspends or resumes.

* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::actualPrepareToSuspend):
(WebKit::WebProcess::cancelPrepareToSuspend):
(WebKit::WebProcess::processDidResume):

LayoutTests:

* platform/mac/media/audio-session-deactivated-when-suspended-expected.txt: Added.
* platform/mac/media/audio-session-deactivated-when-suspended.html: Added.

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

4 months ago[iOS] Web process gets suspended while holding locked database files
sihui_liu@apple.com [Sat, 6 Apr 2019 01:02:44 +0000 (01:02 +0000)]
[iOS] Web process gets suspended while holding locked database files
https://bugs.webkit.org/show_bug.cgi?id=196519
<rdar://problem/49531797>

Reviewed by Chris Dumez.

Source/WebCore:

Don't use DatabaseTracker singleton before it is initialized.

* Modules/webdatabase/DatabaseTracker.cpp:
(WebCore::DatabaseTracker::isInitialized):
* Modules/webdatabase/DatabaseTracker.h:

Source/WebKit:

* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::actualPrepareToSuspend):

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

4 months agoClicking "Go Back" from a safe browsing warning from an iframe should navigate the...
achristensen@apple.com [Sat, 6 Apr 2019 00:10:15 +0000 (00:10 +0000)]
Clicking "Go Back" from a safe browsing warning from an iframe should navigate the WKWebView back to the previous page
https://bugs.webkit.org/show_bug.cgi?id=196665
<rdar://45115669>

Reviewed by Geoff Garen.

Source/WebKit:

It is insufficient to just not navigate the subframe.  We must leave the page that contained it.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _showSafeBrowsingWarning:completionHandler:]):
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::showSafeBrowsingWarning):

Tools:

* TestWebKitAPI/Tests/WebKitCocoa/SafeBrowsing.mm:
(goBack):
(+[SimpleLookupContext sharedLookupContext]):
(-[SimpleLookupContext lookUpURL:completionHandler:]):
(TEST):
(+[Simple3LookupContext sharedLookupContext]): Deleted.
(-[Simple3LookupContext lookUpURL:completionHandler:]): Deleted.

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

4 months agoUnreviewed, rolling out r243665.
ryanhaddad@apple.com [Sat, 6 Apr 2019 00:05:32 +0000 (00:05 +0000)]
Unreviewed, rolling out r243665.

Caused iOS JSC tests to exit with an exception.

Reverted changeset:

"Assertion failed in JSC::createError"
https://bugs.webkit.org/show_bug.cgi?id=196305
https://trac.webkit.org/changeset/243665

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

4 months agoMake WeakPtr<Element> possible and deploy it in form associated elements code
rniwa@webkit.org [Sat, 6 Apr 2019 00:03:46 +0000 (00:03 +0000)]
Make WeakPtr<Element> possible and deploy it in form associated elements code
https://bugs.webkit.org/show_bug.cgi?id=196626

Reviewed by Antti Koivisto.

Source/WebCore:

Make Element inherit from CanMakeWeakPtr and deploy WeakPtr<*Element> in FormAssociatedElement and HTMLFormElement.

No new tests sine there should be no behavioral change.

* dom/Element.h:
* html/FormAssociatedElement.cpp:
(WebCore::FormAssociatedElement::FormAssociatedElement):
(WebCore::FormAssociatedElement::insertedIntoAncestor):
(WebCore::FormAssociatedElement::setForm):
(WebCore::FormAssociatedElement::resetFormOwner):
(WebCore::FormAssociatedElement::formAttributeChanged):
* html/FormAssociatedElement.h:
(WebCore::FormAssociatedElement::form const):
* html/HTMLElement.cpp:
(WebCore::HTMLElement::asFormNamedItem):
(WebCore::HTMLElement::asFormAssociatedElement):
* html/HTMLElement.h:
(WebCore::HTMLElement::asFormNamedItem): Deleted.
* html/HTMLFormControlElement.h:
* html/HTMLFormControlsCollection.cpp:
(WebCore::HTMLFormControlsCollection::formImageElements const): Inlined into updateNamedElementCache.
(WebCore::HTMLFormControlsCollection::updateNamedElementCache const):
* html/HTMLFormControlsCollection.h:
* html/HTMLFormElement.cpp:
(WebCore::HTMLFormElement::registerInvalidAssociatedFormControl):
(WebCore::HTMLFormElement::removeInvalidAssociatedFormControlIfNeeded):
(WebCore::HTMLFormElement::registerImgElement):
(WebCore::HTMLFormElement::defaultButton const):
(WebCore::HTMLFormElement::resetDefaultButton):
(WebCore::HTMLFormElement::matchesValidPseudoClass const):
(WebCore::HTMLFormElement::matchesInvalidPseudoClass const):
* html/HTMLFormElement.h:
* html/HTMLImageElement.cpp:
(WebCore::HTMLImageElement::HTMLImageElement):
(WebCore::HTMLImageElement::insertedIntoAncestor):
* html/HTMLImageElement.h:
* html/HTMLInputElement.h:
* html/HTMLMediaElement.h:
* html/HTMLObjectElement.h:
* html/HTMLPictureElement.h:
* html/HTMLSlotElement.h:
* svg/SVGElement.h:

Source/WTF:

Make it possible to call WeakHashSet::remove and WeakHashSet::contains with
a subclass type U of a type T used to define WeakReference<T>.

Also added computesEmpty, which is slightly more efficient than computeSize
when m_set is either empty or when there are non-released weak references in the set.

* wtf/WeakHashSet.h:
(WTF::WeakHashSet::remove):
(WTF::WeakHashSet::contains const):
(WTF::WeakHashSet::computesEmpty const): Added.
* wtf/WeakPtr.h: Added an explicit forward declaration of WeakHashSet to avoid
build failures in GTK+ and WPE ports.

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

4 months agoWeb Inspector: TestSuite test cases should have their own timeout to ensure tests...
drousso@apple.com [Fri, 5 Apr 2019 23:39:16 +0000 (23:39 +0000)]
Web Inspector: TestSuite test cases should have their own timeout to ensure tests fail with output instead of timeout by test runner
https://bugs.webkit.org/show_bug.cgi?id=162814
<rdar://problem/28574102>

Reviewed by Brian Burg.

Source/WebInspectorUI:

A 10s timer is started for every test case added to an async suite. The timer is cleared
when the test finishes, but if the timer fires, the test is forcibly ended with an error.

This timer can be configured by setting a `timeout` value when adding the test case. Values
are expected to be in milliseconds. The value `-1` will prevent a timer from being set.

This change also relaxes the expectation that any individual test case failure will stop the
rest of the suite from running. Since timers are set per test case, it is possible to
recover from a "bad" test case to still run the remaining test cases.

NOTE: there may be unexpected behaviour if a test times out, as the timer doesn't actually
stop the execution of the test, so it may still run and log information, which may appear
"out of nowhere" in the middle of other tests.

* UserInterface/Test/TestSuite.js:
(TestSuite.prototype.get passCount):
(AsyncTestSuite.prototype.runTestCases):
(SyncTestSuite.prototype.runTestCases):

LayoutTests:

* inspector/unit-tests/async-test-suite.html:
* inspector/unit-tests/async-test-suite-expected.txt:
* inspector/unit-tests/sync-test-suite.html:
* inspector/unit-tests/sync-test-suite-expected.txt:

* http/tests/inspector/network/set-resource-caching-disabled-disk-cache-expected.txt:
* inspector/canvas/recording-2d.html:
* inspector/canvas/recording-webgl-snapshots.html:
* inspector/canvas/recording-webgl.html:
* inspector/canvas/resources/shaderProgram-utilities.js:
(TestPage.registerInitializer.whenProgramAdded): Added.
(TestPage.registerInitializer.whenProgramRemoved): Added.
(TestPage.registerInitializer.window.initializeTestSuite):
(TestPage.registerInitializer.window.addSimpleTestCase):
(TestPage.registerInitializer.window.addParentCanvasRemovedTestCase):
(TestPage.registerInitializer.awaitProgramAdded): Added.
(TestPage.registerInitializer.awaitProgramRemoved): Added.
* inspector/console/command-line-api-expected.txt:
* inspector/console/heap-snapshot.html:
* inspector/debugger/async-stack-trace-truncate-expected.txt:
* inspector/debugger/pause-for-internal-scripts-expected.txt:
* inspector/formatting/resources/utilities.js:
(TestPage.registerInitializer.window.addFormattingTests):

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

4 months ago[ews-build] Add configuration and architecture for windows builders
aakash_jain@apple.com [Fri, 5 Apr 2019 23:25:27 +0000 (23:25 +0000)]
[ews-build] Add configuration and architecture for windows builders
https://bugs.webkit.org/show_bug.cgi?id=196660

Reviewed by Lucas Forschler.

* BuildSlaveSupport/ews-build/config.json:

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

4 months agoUndeprecate WKNavigationData
achristensen@apple.com [Fri, 5 Apr 2019 23:06:46 +0000 (23:06 +0000)]
Undeprecate WKNavigationData
https://bugs.webkit.org/show_bug.cgi?id=196559
<rdar://44927425>

Reviewed by Geoff Garen.

* UIProcess/API/Cocoa/WKNavigationData.h:
It is used to communicate information from FrameLoaderClient::updateGlobalHistory() to the application.
This use in WKBrowsingContextHistoryDelegate is definitely still deprecated, but its use in
WKHistoryDelegatePrivate does not have an adequate replacement yet, so it must remain undeprecated SPI.

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

4 months agoSIGSEGV in JSC::BytecodeGenerator::addStringConstant
ysuzuki@apple.com [Fri, 5 Apr 2019 21:58:32 +0000 (21:58 +0000)]
SIGSEGV in JSC::BytecodeGenerator::addStringConstant
https://bugs.webkit.org/show_bug.cgi?id=196486

Reviewed by Saam Barati.

JSTests:

* stress/arrow-function-and-use-strict-directive.js: Added.
* stress/arrow-function-syntax.js: Added. Checking EOF token handling.
(checkSyntax):
(checkSyntaxError): Currently not using it. But it is useful for testing more things related to arrow function syntax.

Source/JavaScriptCore:

When parsing a FunctionExpression / FunctionDeclaration etc., we use SyntaxChecker for the body of the function because we do not have any interest on the nodes of the body at that time.
The nodes will be parsed with the ASTBuilder when the function itself is parsed for code generation. This works well previously because all the function ends with "}" previously.
SyntaxChecker lexes this "}" token, and parser restores the context back to ASTBuilder and continues parsing.

But now, we have ArrowFunctionExpression without braces `arrow => expr`. Let's consider the following code.

        arrow => expr
        "string!"

We parse arrow function's body with SyntaxChecker. At that time, we lex "string!" token under the SyntaxChecker context. But this means that we may not build string content for this token
since SyntaxChecker may not have interest on string content itself in certain case. After the parser is back to ASTBuilder, we parse "string!" as ExpressionStatement with string constant,
generate StringNode with non-built identifier (nullptr), and we accidentally create StringNode with nullptr.

This patch fixes this problem. The root cause of this problem is that the last token lexed in the previous context is used. We add lexCurrentTokenAgainUnderCurrentContext which will re-lex
the current token under the current context (may be ASTBuilder). This should be done only when the caller's context is different from SyntaxChecker, which avoids unnecessary lexing.
We leverage existing SavePoint mechanism to implement lexCurrentTokenAgainUnderCurrentContext cleanly.

And we also fix the bug in the existing SavePoint mechanism, which is shown in the attached test script. When we save LexerState, we do not save line terminator status. This patch also introduces
lexWithoutClearingLineTerminator, which lex the token without clearing line terminator status.

* parser/ASTBuilder.h:
(JSC::ASTBuilder::createString):
* parser/Lexer.cpp:
(JSC::Lexer<T>::parseMultilineComment):
(JSC::Lexer<T>::lexWithoutClearingLineTerminator): EOF token also should record offset information. This offset information is correctly handled in Lexer::setOffset too.
(JSC::Lexer<T>::lex): Deleted.
* parser/Lexer.h:
(JSC::Lexer::hasLineTerminatorBeforeToken const):
(JSC::Lexer::setHasLineTerminatorBeforeToken):
(JSC::Lexer<T>::lex):
(JSC::Lexer::prevTerminator const): Deleted.
(JSC::Lexer::setTerminator): Deleted.
* parser/Parser.cpp:
(JSC::Parser<LexerType>::allowAutomaticSemicolon):
(JSC::Parser<LexerType>::parseSingleFunction):
(JSC::Parser<LexerType>::parseStatementListItem):
(JSC::Parser<LexerType>::maybeParseAsyncFunctionDeclarationStatement):
(JSC::Parser<LexerType>::parseFunctionInfo):
(JSC::Parser<LexerType>::parseClass):
(JSC::Parser<LexerType>::parseExportDeclaration):
(JSC::Parser<LexerType>::parseAssignmentExpression):
(JSC::Parser<LexerType>::parseYieldExpression):
(JSC::Parser<LexerType>::parseProperty):
(JSC::Parser<LexerType>::parsePrimaryExpression):
(JSC::Parser<LexerType>::parseMemberExpression):
* parser/Parser.h:
(JSC::Parser::nextWithoutClearingLineTerminator):
(JSC::Parser::lexCurrentTokenAgainUnderCurrentContext):
(JSC::Parser::internalSaveLexerState):
(JSC::Parser::restoreLexerState):

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

4 months agoREGRESSION(AppleWebKit/605.1.15): WebDownloadDelegate delegate methods called on...
achristensen@apple.com [Fri, 5 Apr 2019 21:52:51 +0000 (21:52 +0000)]
REGRESSION(AppleWebKit/605.1.15): WebDownloadDelegate delegate methods called on non-main thread
https://bugs.webkit.org/show_bug.cgi?id=190918
<rdar://problem/45603890>

Reviewed by Darin Adler.

Source/WebKitLegacy/mac:

Since we not doing networking on the main thread but WebView is to be used on the main thread,
we need to hop delegate calls to the main thread similarly to how we do it in the non-download
delegate calls in WebCoreResourceHandleAsOperationQueueDelegate.

* Misc/WebDownload.mm:
(-[WebDownloadInternal downloadDidBegin:]):
(-[WebDownloadInternal download:willSendRequest:redirectResponse:]):
(-[WebDownloadInternal download:didReceiveAuthenticationChallenge:]):
(-[WebDownloadInternal download:didReceiveResponse:]):
(-[WebDownloadInternal download:didReceiveDataOfLength:]):
(-[WebDownloadInternal download:shouldDecodeSourceDataOfMIMEType:]):
(-[WebDownloadInternal download:decideDestinationWithSuggestedFilename:]):
(-[WebDownloadInternal download:didCreateDestination:]):
(-[WebDownloadInternal downloadDidFinish:]):
(-[WebDownloadInternal download:didFailWithError:]):

Tools:

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKitLegacy/mac/DownloadThread.mm: Added.
(-[DownloadThreadChecker webView:decidePolicyForMIMEType:request:frame:decisionListener:]):
(-[DownloadThreadChecker downloadDidBegin:]):
(-[DownloadThreadChecker download:shouldDecodeSourceDataOfMIMEType:]):
(-[DownloadThreadChecker download:decideDestinationWithSuggestedFilename:]):
(-[DownloadThreadChecker download:didCreateDestination:]):
(-[DownloadThreadChecker downloadDidFinish:]):
(TestWebKitAPI::TEST):

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

4 months agoFlaky API Test TestWebKitAPI.WebKit.PerformedActionForURL
achristensen@apple.com [Fri, 5 Apr 2019 21:50:06 +0000 (21:50 +0000)]
Flaky API Test TestWebKitAPI.WebKit.PerformedActionForURL
https://bugs.webkit.org/show_bug.cgi?id=196151

Reviewed by Chris Dumez.

* TestWebKitAPI/Tests/WebKitCocoa/ContentRuleListNotification.mm:
(TEST):
We were assuming that messages were received in a certain order.
Actually wait for all messages to be received before checking results.

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

4 months ago[Mac WK2 iOS Sim] Layout Test imported/w3c/web-platform-tests/webrtc/RTCRtpReceiver...
ryanhaddad@apple.com [Fri, 5 Apr 2019 21:49:29 +0000 (21:49 +0000)]
[Mac WK2 iOS Sim] Layout Test imported/w3c/web-platform-tests/webrtc/RTCRtpReceiver-getSynchronizationSources.https.html is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=196633

Unreviewed test gardening.

* platform/ios-wk2/TestExpectations: Mark test as flaky.
* platform/mac-wk2/TestExpectations: Ditto.

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

4 months agoRemove AUDIO_TOOLBOX_AUDIO_SESSION
eric.carlson@apple.com [Fri, 5 Apr 2019 21:36:15 +0000 (21:36 +0000)]
Remove AUDIO_TOOLBOX_AUDIO_SESSION
https://bugs.webkit.org/show_bug.cgi?id=196653
<rdar://problem/49652098>

Reviewed by Jer Noble.

Source/WebKitLegacy/mac:

* WebView/WebPreferences.mm:
(-[WebPreferences setAudioSessionCategoryOverride:]):

Source/WTF:

* wtf/Platform.h:

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

4 months ago[JSC] Filter DontEnum properties in ProxyObject::getOwnPropertyNames()
caitp@igalia.com [Fri, 5 Apr 2019 21:28:10 +0000 (21:28 +0000)]
[JSC] Filter DontEnum properties in ProxyObject::getOwnPropertyNames()
https://bugs.webkit.org/show_bug.cgi?id=176810

Reviewed by Saam Barati.

JSTests:

Add tests for the DontEnum filtering, and variations of other tests
take the DontEnum-filtering path.

* stress/proxy-own-keys.js:
(i.catch):
(set assert):
(set add):
(let.set new):
(get let):

Source/JavaScriptCore:

This adds conditional logic following the invariant checks, to perform
filtering in common uses of getOwnPropertyNames.

While this would ideally only be done in JSPropertyNameEnumerator, adding
the filtering to ProxyObject::performGetOwnPropertyNames maintains the
invariant that the EnumerationMode is properly followed.

* runtime/PropertyNameArray.h:
(JSC::PropertyNameArray::reset):
* runtime/ProxyObject.cpp:
(JSC::ProxyObject::performGetOwnPropertyNames):

Source/WebCore:

Previously, there was a comment here indicating uncertainty of whether it
was necessary to filter DontEnum properties explicitly or not. It turns
out that it was necessary in the case of JSC ProxyObjects.

This patch adds DontEnum filtering for ProxyObjects, however we continue
to explicitly filter them in JSDOMConvertRecord, which needs to use the
property descriptor after filtering. This change prevents observably
fetching the property descriptor twice per property.

* bindings/js/JSDOMConvertRecord.h:

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

4 months agoediting/execCommand/print.html is crashing on iOS Debug
sroberts@apple.com [Fri, 5 Apr 2019 21:13:47 +0000 (21:13 +0000)]
editing/execCommand/print.html is crashing on iOS Debug
https://bugs.webkit.org/show_bug.cgi?id=196654

Unreviewed test gardening.

* platform/ios-simulator-wk2/TestExpectations: Skipping test on iOS Debug while waiting for a fix

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

4 months agoUnreviewed manual rollout of r243929
mcatanzaro@igalia.com [Fri, 5 Apr 2019 18:32:43 +0000 (18:32 +0000)]
Unreviewed manual rollout of r243929
https://bugs.webkit.org/show_bug.cgi?id=196626

Source/WebCore:

* dom/Element.h:
* html/FormAssociatedElement.cpp:
(WebCore::FormAssociatedElement::FormAssociatedElement):
(WebCore::FormAssociatedElement::insertedIntoAncestor):
(WebCore::FormAssociatedElement::setForm):
(WebCore::FormAssociatedElement::resetFormOwner):
(WebCore::FormAssociatedElement::formAttributeChanged):
* html/FormAssociatedElement.h:
(WebCore::FormAssociatedElement::form const):
* html/HTMLElement.cpp:
(WebCore::HTMLElement::asFormNamedItem): Deleted.
(WebCore::HTMLElement::asFormAssociatedElement): Deleted.
* html/HTMLElement.h:
(WebCore::HTMLElement::asFormNamedItem):
* html/HTMLFormControlElement.h:
* html/HTMLFormControlsCollection.cpp:
(WebCore:: const):
(WebCore::HTMLFormControlsCollection::updateNamedElementCache const):
* html/HTMLFormControlsCollection.h:
* html/HTMLFormElement.cpp:
(WebCore::HTMLFormElement::registerInvalidAssociatedFormControl):
(WebCore::HTMLFormElement::removeInvalidAssociatedFormControlIfNeeded):
(WebCore::HTMLFormElement::registerImgElement):
(WebCore::HTMLFormElement::defaultButton const):
(WebCore::HTMLFormElement::resetDefaultButton):
(WebCore::HTMLFormElement::matchesValidPseudoClass const):
(WebCore::HTMLFormElement::matchesInvalidPseudoClass const):
* html/HTMLFormElement.h:
* html/HTMLImageElement.cpp:
(WebCore::HTMLImageElement::HTMLImageElement):
(WebCore::HTMLImageElement::insertedIntoAncestor):
* html/HTMLImageElement.h:
* html/HTMLInputElement.h:
* html/HTMLMediaElement.h:
* html/HTMLObjectElement.h:
* html/HTMLPictureElement.h:
* html/HTMLSlotElement.h:
* svg/SVGElement.h:

Source/WTF:

* wtf/WeakHashSet.h:
(WTF::WeakHashSet::remove):
(WTF::WeakHashSet::contains const):
(WTF::WeakHashSet::computesEmpty const): Deleted.

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

4 months agoStop including <AudioToolbox/AudioSession.h>
eric.carlson@apple.com [Fri, 5 Apr 2019 18:21:40 +0000 (18:21 +0000)]
Stop including <AudioToolbox/AudioSession.h>
https://bugs.webkit.org/show_bug.cgi?id=196648
<rdar://problem/39665771>

Reviewed by Jer Noble.

* WebView/WebPreferencesPrivate.h:

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

4 months ago[iOS] Web process gets suspended while holding locked database files
sihui_liu@apple.com [Fri, 5 Apr 2019 18:06:09 +0000 (18:06 +0000)]
[iOS] Web process gets suspended while holding locked database files
https://bugs.webkit.org/show_bug.cgi?id=196519
<rdar://problem/49531797>

Reviewed by Chris Dumez.

Source/WebCore:

We should close all databases and make sure not open new databases when web process is ready to suspend.

* platform/sql/SQLiteDatabase.cpp:
(WebCore::SQLiteDatabase::setIsDatabaseOpeningForbidden):
(WebCore::SQLiteDatabase::open):
* platform/sql/SQLiteDatabase.h:
* platform/sql/SQLiteDatabaseTracker.cpp:
(WebCore::SQLiteDatabaseTracker::setClient):
(WebCore::SQLiteDatabaseTracker::incrementTransactionInProgressCount):
(WebCore::SQLiteDatabaseTracker::decrementTransactionInProgressCount):
(WebCore::SQLiteDatabaseTracker::hasTransactionInProgress):

Source/WebKit:

* Shared/WebSQLiteDatabaseTracker.cpp:
(WebKit::WebSQLiteDatabaseTracker::~WebSQLiteDatabaseTracker):
* Shared/WebSQLiteDatabaseTracker.h:
* WebProcess/WebProcess.cpp:
(WebKit::m_webSQLiteDatabaseTracker):
(WebKit::WebProcess::actualPrepareToSuspend):
(WebKit::WebProcess::processWillSuspendImminently):
(WebKit::WebProcess::cancelPrepareToSuspend):
(WebKit::WebProcess::processDidResume):
* WebProcess/WebProcess.h:

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

4 months agowebkitpy: Don't run subsequent rounds if interrupted
jbedard@apple.com [Fri, 5 Apr 2019 17:14:23 +0000 (17:14 +0000)]
webkitpy: Don't run subsequent rounds if interrupted
https://bugs.webkit.org/show_bug.cgi?id=196646

Reviewed by Aakash Jain.

* Scripts/webkitpy/layout_tests/controllers/manager.py:
(Manager.run): Bail out if interrupted.

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

4 months agoTest sessionStorage in PSON private browsing mode
sihui_liu@apple.com [Fri, 5 Apr 2019 16:30:34 +0000 (16:30 +0000)]
Test sessionStorage in PSON private browsing mode
https://bugs.webkit.org/show_bug.cgi?id=196561

Reviewed by Alex Christensen.

* TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:

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

4 months agoUnreviewed, rolling out r243833.
commit-queue@webkit.org [Fri, 5 Apr 2019 15:35:32 +0000 (15:35 +0000)]
Unreviewed, rolling out r243833.
https://bugs.webkit.org/show_bug.cgi?id=196645

This change breaks build of WPE and GTK ports (Requested by
annulen on #webkit).

Reverted changeset:

"[CMake][WTF] Mirror XCode header directories"
https://bugs.webkit.org/show_bug.cgi?id=191662
https://trac.webkit.org/changeset/243833

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

4 months agoJSTests:
caitp@igalia.com [Fri, 5 Apr 2019 13:45:08 +0000 (13:45 +0000)]
JSTests:
[JSC] throw if 'ownKeys' Proxy trap result contains duplicate keys
https://bugs.webkit.org/show_bug.cgi?id=185211

Reviewed by Saam Barati.

This is for the normative spec change in https://github.com/tc39/ecma262/pull/833

This changes several assertions to expect a TypeError to be thrown (in some cases,
changing thee expected message).

* es6/Proxy_ownKeys_duplicates.js:
(handler):
(shouldThrow):
(test):
* stress/Object_static_methods_Object.getOwnPropertyDescriptors-proxy.js:
(shouldThrow):
* stress/proxy-own-keys.js:
(i.catch):
(assert):

LayoutTests/imported/w3c:
[JSC] throw if 'ownKeys' Proxy trap result contains duplicate keys
https://bugs.webkit.org/show_bug.cgi?id=185211

Reviewed by Saam Barati.

This is for the normative spec change in https://github.com/tc39/ecma262/pull/833

Change some test expectations which were previously expected to fail.

* web-platform-tests/fetch/api/headers/headers-record-expected.txt:

Source/JavaScriptCore:
[JSC] throw if ownKeys Proxy trap result contains duplicate keys
https://bugs.webkit.org/show_bug.cgi?id=185211

Reviewed by Saam Barati.

Implements the normative spec change in https://github.com/tc39/ecma262/pull/833

This involves tracking duplicate keys returned from the ownKeys trap in yet
another HashTable, and may incur a minor performance penalty in some cases. This
is not expected to significantly affect web performance.

* runtime/ProxyObject.cpp:
(JSC::ProxyObject::performGetOwnPropertyNames):

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

4 months agoREGRESSION(r240685): Remove duplicate Headers entry for _WKInspectorWindow.h in Xcode...
ddkilzer@apple.com [Fri, 5 Apr 2019 12:42:44 +0000 (12:42 +0000)]
REGRESSION(r240685): Remove duplicate Headers entry for _WKInspectorWindow.h in Xcode project
<https://bugs.webkit.org/show_bug.cgi?id=193951>
<rdar://problem/47621366>

Fixes the following build warnings:
    Warning: Multiple build commands for output file WebKit2_WebKit.roots/BuildRecords/WebKit2_installhdrs/Root/System/Library/Frameworks/WebKit.framework/PrivateHeaders/_WKInspectorWindow.h
    Warning: Multiple build commands for output file WebKit2_WebKit.roots/BuildRecords/WebKit2_installapi/Root/System/Library/Frameworks/WebKit.framework/PrivateHeaders/_WKInspectorWindow.h
    Warning: Multiple build commands for output file WebKit2_WebKit.roots/BuildRecords/WebKit2_install/Root/System/Library/Frameworks/WebKit.framework/PrivateHeaders/_WKInspectorWindow.h

* WebKit.xcodeproj/project.pbxproj: Remove duplicate entry for
_WKInspectorWindow.h.  In r240685, a second Headers entry was
added, but the first one was never removed.

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

4 months agoREGRESSION(r243887): Try to fix Windows builds by including <wtf/IsoMalloc.h>
ddkilzer@apple.com [Fri, 5 Apr 2019 12:25:05 +0000 (12:25 +0000)]
REGRESSION(r243887): Try to fix Windows builds by including <wtf/IsoMalloc.h>

Caused by:
    [WebCore] Put most of derived classes of ScriptWrappable into IsoHeap
    https://bugs.webkit.org/show_bug.cgi?id=196475

* css/CSSComputedStyleDeclaration.h:
* dom/DOMRectReadOnly.h:
* dom/LiveNodeList.h:
* dom/NodeIterator.h:
* dom/TreeWalker.h:
* fileapi/Blob.h:
* fileapi/File.h:
* fileapi/FileList.h:
* html/CachedHTMLCollection.h:
* html/HTMLFormElement.h:
* html/HTMLNameCollection.h:
* html/canvas/GPUBasedCanvasRenderingContext.h:
* page/RemoteDOMWindow.h:

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

4 months ago[WPE] Unreviewed gardening, update unexpected passes
dpino@igalia.com [Fri, 5 Apr 2019 11:30:38 +0000 (11:30 +0000)]
[WPE] Unreviewed gardening, update unexpected passes

* platform/wpe/TestExpectations:

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

4 months agoMake WeakPtr<Element> possible and deploy it in form associated elements code
rniwa@webkit.org [Fri, 5 Apr 2019 08:22:39 +0000 (08:22 +0000)]
Make WeakPtr<Element> possible and deploy it in form associated elements code
https://bugs.webkit.org/show_bug.cgi?id=196626

Reviewed by Antti Koivisto.

Source/WebCore:

Make Element inherit from CanMakeWeakPtr and deploy WeakPtr<*Element> in FormAssociatedElement and HTMLFormElement.

No new tests sine there should be no behavioral change.

* dom/Element.h:
* html/FormAssociatedElement.cpp:
(WebCore::FormAssociatedElement::FormAssociatedElement):
(WebCore::FormAssociatedElement::insertedIntoAncestor):
(WebCore::FormAssociatedElement::setForm):
(WebCore::FormAssociatedElement::resetFormOwner):
(WebCore::FormAssociatedElement::formAttributeChanged):
* html/FormAssociatedElement.h:
(WebCore::FormAssociatedElement::form const):
* html/HTMLElement.cpp:
(WebCore::HTMLElement::asFormNamedItem):
(WebCore::HTMLElement::asFormAssociatedElement):
* html/HTMLElement.h:
(WebCore::HTMLElement::asFormNamedItem): Deleted.
* html/HTMLFormControlElement.h:
* html/HTMLFormControlsCollection.cpp:
(WebCore::HTMLFormControlsCollection::formImageElements const): Inlined into updateNamedElementCache.
(WebCore::HTMLFormControlsCollection::updateNamedElementCache const):
* html/HTMLFormControlsCollection.h:
* html/HTMLFormElement.cpp:
(WebCore::HTMLFormElement::registerInvalidAssociatedFormControl):
(WebCore::HTMLFormElement::removeInvalidAssociatedFormControlIfNeeded):
(WebCore::HTMLFormElement::registerImgElement):
(WebCore::HTMLFormElement::defaultButton const):
(WebCore::HTMLFormElement::resetDefaultButton):
(WebCore::HTMLFormElement::matchesValidPseudoClass const):
(WebCore::HTMLFormElement::matchesInvalidPseudoClass const):
* html/HTMLFormElement.h:
* html/HTMLImageElement.cpp:
(WebCore::HTMLImageElement::HTMLImageElement):
(WebCore::HTMLImageElement::insertedIntoAncestor):
* html/HTMLImageElement.h:
* html/HTMLInputElement.h:
* html/HTMLMediaElement.h:
* html/HTMLObjectElement.h:
* html/HTMLPictureElement.h:
* html/HTMLSlotElement.h:
* svg/SVGElement.h:

Source/WTF:

Make it possible to call WeakHashSet::remove and WeakHashSet::contains with
a subclass type U of a type T used to define WeakReference<T>.

Also added computesEmpty, which is slightly more efficient than computeSize
when m_set is either empty or when there are non-released weak references in the set.

* wtf/WeakHashSet.h:
(WTF::WeakHashSet::remove):
(WTF::WeakHashSet::contains const):
(WTF::WeakHashSet::computesEmpty const): Added.

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

4 months ago[ATK] Use a smart pointer for AccessibilityObject wrapper and remove GTK specific...
carlosgc@webkit.org [Fri, 5 Apr 2019 07:35:24 +0000 (07:35 +0000)]
[ATK] Use a smart pointer for AccessibilityObject wrapper and remove GTK specific code
https://bugs.webkit.org/show_bug.cgi?id=196593
<rdar://problem/49599153>

Reviewed by Michael Catanzaro.

Source/WebCore:

We have specific code for GTK to get/set the wrapper only because we don't use smart pointers. Also use
WebKitAccessible as AccessibilityObjectWrapper instead of generic AtkObject, to enforce wrappers to be
WebKitAccessible instances. This requires a few casts to AtkObject.

* accessibility/AccessibilityObject.h:
(WebCore::AccessibilityObject::setWrapper):
* accessibility/AccessibilityObjectInterface.h:
* accessibility/atk/AXObjectCacheAtk.cpp:
(WebCore::AXObjectCache::detachWrapper):
(WebCore::AXObjectCache::attachWrapper):
(WebCore::notifyChildrenSelectionChange):
(WebCore::AXObjectCache::postPlatformNotification):
(WebCore::AXObjectCache::nodeTextChangePlatformNotification):
(WebCore::AXObjectCache::frameLoadingEventPlatformNotification):
(WebCore::AXObjectCache::platformHandleFocusedUIElementChanged):
* accessibility/atk/AccessibilityObjectAtk.cpp:
* accessibility/atk/WebKitAccessibleInterfaceComponent.cpp:
(webkitAccessibleComponentRefAccessibleAtPoint):
* accessibility/atk/WebKitAccessibleInterfaceHypertext.cpp:
(webkitAccessibleHypertextGetLink):
(webkitAccessibleHypertextGetNLinks):
* accessibility/atk/WebKitAccessibleInterfaceSelection.cpp:
(webkitAccessibleSelectionRefSelection):
* accessibility/atk/WebKitAccessibleInterfaceTable.cpp:
(webkitAccessibleTableRefAt):
(webkitAccessibleTableGetColumnHeader):
(webkitAccessibleTableGetRowHeader):
(webkitAccessibleTableGetCaption):
* accessibility/atk/WebKitAccessibleInterfaceTableCell.cpp:
(convertToGPtrArray):
(webkitAccessibleTableCellGetTable):
* accessibility/atk/WebKitAccessibleInterfaceText.cpp:
(accessibilityObjectLength):
* accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
(setAtkRelationSetFromCoreObject):
(atkParentOfRootObject):
(webkitAccessibleGetParent):
(webkitAccessibleRefChild):
(isTextWithCaret):
* editing/atk/FrameSelectionAtk.cpp:
(WebCore::emitTextSelectionChange):
(WebCore::maybeEmitTextFocusChange):

Source/WebKit:

* WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.cpp:
(accessibilityRootObjectWrapper): Cast wrapper() as AtkObject.

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

4 months agoSimple iframe scrolling test fails to get a composited scrolling frame in WebKitTestR...
simon.fraser@apple.com [Fri, 5 Apr 2019 06:42:05 +0000 (06:42 +0000)]
Simple iframe scrolling test fails to get a composited scrolling frame in WebKitTestRunnerApp
https://bugs.webkit.org/show_bug.cgi?id=196635

Reviewed by Antti Koivisto.
Source/WebKit:

Remove WKBundleSetAsyncFrameScrollingEnabled().

* WebProcess/InjectedBundle/API/c/WKBundle.cpp:
(WKBundleSetAsyncFrameScrollingEnabled): Deleted.
* WebProcess/InjectedBundle/API/c/WKBundlePrivate.h:

Tools:

InjectedBundle::beginTesting() calling WKBundleSetAsyncFrameScrollingEnabled() makes it impossible
for a test to enable async frame scrolling via:
    <!-- webkit-test-runner [ internal:AsyncFrameScrollingEnabled=true ] -->
so remove it and have TestController::resetPreferencesToConsistentValues() set the default value.

Test: scrollingcoordinator/ios/programmatic-frame-scroll.html

* WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
(WTR::InjectedBundle::beginTesting):
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::resetPreferencesToConsistentValues):

LayoutTests:

* scrollingcoordinator/ios/programmatic-frame-scroll-expected.html: Added.
* scrollingcoordinator/ios/programmatic-frame-scroll.html: Added.

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

4 months ago[iOS WK2] REGRESSION (r242687): Programmatic scroll of overflow scroll results in...
simon.fraser@apple.com [Fri, 5 Apr 2019 05:18:17 +0000 (05:18 +0000)]
[iOS WK2] REGRESSION (r242687): Programmatic scroll of overflow scroll results in bad rendering
https://bugs.webkit.org/show_bug.cgi?id=195584

Reviewed by Zalan Bujtas.

Source/WebCore:

Push data to the scrolling tree about whether an overflow:scroll scroll was programmatic, by having
RenderLayer::scrollToOffset() call into AsyncScrollingCoordinator::requestScrollPositionUpdate(),
just as we do for frames.

AsyncScrollingCoordinator::requestScrollPositionUpdate() is generalized to take any ScrollableArea.

Fix an assumption in the ScrollingTree that we only care about programmatic scrolls on the root node.
ScrollingTree::commitTreeState() no longer sets isHandlingProgrammaticScroll; instead,
callers of ScrollingTreeScrollingNode::scrollTo() pass a ScrollType. Commit functions pass
ScrollType::Programmatic when handling RequestedScrollPosition changes as necessary.

Programmatic scrolls need to get to the scrolling tree in the UI process so that we update
the tree's notion of scroll position, and trigger actual UIScrollView scrolls (layers may have
already been put in the right locations, but the UI process needs to know that a scroll happened).
However, we need to prevent notifications from programmatic scrolls getting back to the
web process, because this causes jumpiness. This is done via an early return in
RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidScroll().

Tests: scrollingcoordinator/ios/programmatic-overflow-scroll.html
       scrollingcoordinator/ios/programmatic-page-scroll.html

* page/scrolling/AsyncScrollingCoordinator.cpp:
(WebCore::AsyncScrollingCoordinator::requestScrollPositionUpdate):
* page/scrolling/AsyncScrollingCoordinator.h:
* page/scrolling/ScrollingCoordinator.h:
(WebCore::ScrollingCoordinator::requestScrollPositionUpdate):
* page/scrolling/ScrollingTree.cpp:
(WebCore::ScrollingTree::commitTreeState):
(WebCore::ScrollingTree::isHandlingProgrammaticScroll): Deleted.
* page/scrolling/ScrollingTree.h:
(WebCore::ScrollingTree::isHandlingProgrammaticScroll const):
(WebCore::ScrollingTree::setIsHandlingProgrammaticScroll):
* page/scrolling/ScrollingTreeScrollingNode.cpp:
(WebCore::ScrollingTreeScrollingNode::scrollBy):
(WebCore::ScrollingTreeScrollingNode::scrollTo):
* page/scrolling/ScrollingTreeScrollingNode.h:
* page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
(WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateAfterChildren):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::scrollToOffset):
(WebCore::RenderLayer::scrollingNodeID const):
* rendering/RenderLayer.h:
* rendering/RenderMarquee.cpp:
(WebCore::RenderMarquee::timerFired):

Source/WebKit:

Push data to the scrolling tree about whether an overflow:scroll scroll was programmatic, by having
RenderLayer::scrollToOffset() call into AsyncScrollingCoordinator::requestScrollPositionUpdate(),
just as we do for frames.

AsyncScrollingCoordinator::requestScrollPositionUpdate() is generalized to take any ScrollableArea.

Fix an assumption in the ScrollingTree that we only care about programmatic scrolls on the root node.
ScrollingTree::commitTreeState() no longer sets isHandlingProgrammaticScroll; instead,
callers of ScrollingTreeScrollingNode::scrollTo() pass a ScrollType. Commit functions pass
ScrollType::Programmatic when handling RequestedScrollPosition changes as necessary.

Programmatic scrolls need to get to the scrolling tree in the UI process so that we update
the tree's notion of scroll position, and trigger actual UIScrollView scrolls (layers may have
already been put in the right locations, but the UI process needs to know that a scroll happened).
However, we need to prevent notifications from programmatic scrolls getting back to the
web process, because this causes jumpiness. This is done via an early return in
RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidScroll().

* UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
(WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidScroll):
* UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm:
(WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::commitStateAfterChildren): Subframe nodes have
a delegate, and that will take care of the requestedScrollPosition update.
* UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.h:
* UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
(WebKit::ScrollingTreeOverflowScrollingNodeIOS::commitStateAfterChildren):
* UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
(WebKit::ScrollingTreeScrollingNodeDelegateIOS::commitStateAfterChildren):

LayoutTests:

Testing of programmatic scrolls in frames is prevented by webkit.org/b/196635.

* scrollingcoordinator/ios/programmatic-overflow-scroll-expected.html: Added.
* scrollingcoordinator/ios/programmatic-overflow-scroll.html: Added.
* scrollingcoordinator/ios/programmatic-page-scroll-expected.html: Added.
* scrollingcoordinator/ios/programmatic-page-scroll.html: Added.

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

4 months ago[JSC] makeBoundFunction should not assume incoming "length" value is Int32 because...
ysuzuki@apple.com [Fri, 5 Apr 2019 04:17:44 +0000 (04:17 +0000)]
[JSC] makeBoundFunction should not assume incoming "length" value is Int32 because it performs some calculation in bytecode
https://bugs.webkit.org/show_bug.cgi?id=196631

Reviewed by Saam Barati.

JSTests:

* stress/make-bound-function-should-not-assume-int32-length.js: Added.
(assert):
(test):
(foo):

Source/JavaScriptCore:

makeBoundFunction assumes that "length" argument is always Int32. But this should not be done since this "length" value is calculated in builtin JS code.
DFG may store this value in Double format so that we should not rely on that this value is Int32. This patch fixes makeBoundFunction function to perform
toInt32 operation. We also insert a missing exception check for `JSString::value(ExecState*)` in makeBoundFunction.

* JavaScriptCore.xcodeproj/project.pbxproj:
* Sources.txt:
* interpreter/CallFrameInlines.h:
* runtime/DoublePredictionFuzzerAgent.cpp: Copied from Source/JavaScriptCore/interpreter/CallFrameInlines.h.
(JSC::DoublePredictionFuzzerAgent::DoublePredictionFuzzerAgent):
(JSC::DoublePredictionFuzzerAgent::getPrediction):
* runtime/DoublePredictionFuzzerAgent.h: Copied from Source/JavaScriptCore/interpreter/CallFrameInlines.h.
* runtime/JSGlobalObject.cpp:
(JSC::makeBoundFunction):
* runtime/Options.h:
* runtime/VM.cpp:
(JSC::VM::VM):

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

4 months agoUnreviewed, speculative fix for build failure
ysuzuki@apple.com [Fri, 5 Apr 2019 01:45:12 +0000 (01:45 +0000)]
Unreviewed, speculative fix for build failure
https://bugs.webkit.org/show_bug.cgi?id=196475

* Modules/webgpu/WHLSL/Metal/WHLSLNativeFunctionWriter.h:

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

4 months agoElement::isFocusable() debug asserts too frequently
rniwa@webkit.org [Fri, 5 Apr 2019 01:09:44 +0000 (01:09 +0000)]
Element::isFocusable() debug asserts too frequently
https://bugs.webkit.org/show_bug.cgi?id=196634

Reviewed by Geoffrey Garen.

Remove the debug assertion for now.

* dom/Element.cpp:
(WebCore::Element::isFocusable const):

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

4 months agoUse a correct LC_RPATH when building with ASan
ap@apple.com [Fri, 5 Apr 2019 00:49:40 +0000 (00:49 +0000)]
Use a correct LC_RPATH when building with ASan
https://bugs.webkit.org/show_bug.cgi?id=196576

Reviewed by David Kilzer.

* asan/asan.xcconfig: As a temporary hack, just force LC_RPATH on all binaries,
so that ../Frameworks is checked. This is simpler and more reliable than updating
each SPC service xcconfig.

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

4 months agoAdd another status-bubble iframe to display results from new EWS
aakash_jain@apple.com [Fri, 5 Apr 2019 00:31:41 +0000 (00:31 +0000)]
Add another status-bubble iframe to display results from new EWS
https://bugs.webkit.org/show_bug.cgi?id=196308

Reviewed by Lucas Forschler.

* js/status-bubble.js:
(handleStatusBubbleMessage): Added URL for new EWS.
(handleStatusBubbleLoadNewEWS): Method to post message to new EWS.
* code-review.js: Added another iframe to display results from new EWS.
* template/en/default/attachment/edit.html.tmpl: Ditto.
* template/en/default/attachment/list.html.tmpl: Ditto.
* template/en/default/attachment/reviewform.html.tmpl: Ditto.

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

4 months agoUnreviewed. Make the test from r243906 catch the thrown exceptions.
sbarati@apple.com [Fri, 5 Apr 2019 00:28:21 +0000 (00:28 +0000)]
Unreviewed. Make the test from r243906 catch the thrown exceptions.

* stress/inferred-types-regex-matches-array.js:

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