WebKit-https.git
17 months ago[WinCairo] Support --no-copy for jsc tests in wincairo tests, add copying of dlls...
commit-queue@webkit.org [Sat, 28 Apr 2018 00:21:55 +0000 (00:21 +0000)]
[WinCairo] Support --no-copy for jsc tests in wincairo tests, add copying of dlls for copy case
https://bugs.webkit.org/show_bug.cgi?id=185049

Patch by Stephan Szabo <stephan.szabo@sony.com> on 2018-04-27
Reviewed by Keith Miller.

* Scripts/run-javascriptcore-tests:
(runJSCStressTests):
* Scripts/run-jsc-stress-tests:

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

17 months agoRebaseline imported/w3c/web-platform-tests/url/url-setters.html after r231110.
ryanhaddad@apple.com [Sat, 28 Apr 2018 00:07:38 +0000 (00:07 +0000)]
Rebaseline imported/w3c/web-platform-tests/url/url-setters.html after r231110.

Unreviewed test gardening..

* web-platform-tests/url/url-setters-expected.txt:

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

17 months agoUpdate TestExpectations for fast/loader/submit-form-while-parsing-2.html.
ryanhaddad@apple.com [Sat, 28 Apr 2018 00:02:56 +0000 (00:02 +0000)]
Update TestExpectations for fast/loader/submit-form-while-parsing-2.html.
https://bugs.webkit.org/show_bug.cgi?id=184051

Unreviewed test gardening.

* platform/mac-wk2/TestExpectations:

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

17 months agoMark http/wpt/resource-timing/rt-resources-per-worker.html as flaky on iOS.
ryanhaddad@apple.com [Sat, 28 Apr 2018 00:02:54 +0000 (00:02 +0000)]
Mark http/wpt/resource-timing/rt-resources-per-worker.html as flaky on iOS.
https://bugs.webkit.org/show_bug.cgi?id=180260

Unreviewed test gardening.

* platform/ios/TestExpectations:

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

17 months ago[JSC][ARM64][Linux] Add collectCPUFeatures using auxiliary vector
utatane.tea@gmail.com [Sat, 28 Apr 2018 00:01:14 +0000 (00:01 +0000)]
[JSC][ARM64][Linux] Add collectCPUFeatures using auxiliary vector
https://bugs.webkit.org/show_bug.cgi?id=185055

Reviewed by JF Bastien.

This patch is paving the way to emitting jscvt instruction if possible.
To do that, we need to determine jscvt instruction is supported in the
given CPU.

We add a function collectCPUFeatures, which is responsible to collect
CPU features if necessary. In Linux, we can use auxiliary vector to get
the information without parsing /proc/cpuinfo.

Currently, nobody calls this function. It is later called when we emit
jscvt instruction. To make it possible, we also need to add disassembler
support too.

* assembler/AbstractMacroAssembler.h:
* assembler/MacroAssemblerARM64.cpp:
(JSC::MacroAssemblerARM64::collectCPUFeatures):
* assembler/MacroAssemblerARM64.h:
* assembler/MacroAssemblerX86Common.h:

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

17 months ago[LFC] Add FormattingContext::computeWidth/computeHeight logic.
zalan@apple.com [Fri, 27 Apr 2018 23:46:31 +0000 (23:46 +0000)]
[LFC] Add FormattingContext::computeWidth/computeHeight logic.
https://bugs.webkit.org/show_bug.cgi?id=185091

Reviewed by Antti Koivisto.

Inflow width and height can't really be computed without knowing the exact context.

* layout/FormattingContext.cpp:
(WebCore::Layout::FormattingContext::computeWidth const):
(WebCore::Layout::FormattingContext::computeHeight const):
(WebCore::Layout::FormattingContext::computeOutOfFlowWidth const):
(WebCore::Layout::FormattingContext::computeFloatingWidth const):
(WebCore::Layout::FormattingContext::computeOutOfFlowHeight const):
(WebCore::Layout::FormattingContext::computeFloatingHeight const):
* layout/FormattingContext.h:
* layout/blockformatting/BlockFormattingContext.cpp:
(WebCore::Layout::BlockFormattingContext::computeInFlowWidth const):
(WebCore::Layout::BlockFormattingContext::computeInFlowHeight const):
(WebCore::Layout::BlockFormattingContext::computeWidth const): Deleted.
(WebCore::Layout::BlockFormattingContext::computeHeight const): Deleted.
* layout/blockformatting/BlockFormattingContext.h:
* layout/inlineformatting/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::computeInFlowWidth const):
(WebCore::Layout::InlineFormattingContext::computeInFlowHeight const):
* layout/inlineformatting/InlineFormattingContext.h:

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

17 months agoAlso run foldPathConstants before mussing up SSA
fpizlo@apple.com [Fri, 27 Apr 2018 23:43:30 +0000 (23:43 +0000)]
Also run foldPathConstants before mussing up SSA
https://bugs.webkit.org/show_bug.cgi?id=185069

Reviewed by Saam Barati.

This isn't needed now, but will be once I implement the phase in bug 185060.

This could be a speed-up, or a slow-down, independent of that phase. Most likely it's neutral.
Local testing seems to suggest that it's neutral. Anyway, whatever it ends up being, I want it to
be landed separately and measured separately from that phase.

It's probably nice for sanity to have this and reduceStrength run before tail duplication and
another round of reduceStrength, since that make for something that is closer to a fixpoint. But
it will increase FTL compile times. So, there's no way to guess if this change is good, bad, or
neutral. It all depends on what programs typically look like.

* b3/B3Generate.cpp:
(JSC::B3::generateToAir):

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

17 months agoPSON: Triggering a navigation to an invalid URL creates a new WebContent process
rniwa@webkit.org [Fri, 27 Apr 2018 22:30:43 +0000 (22:30 +0000)]
PSON: Triggering a navigation to an invalid URL creates a new WebContent process
https://bugs.webkit.org/show_bug.cgi?id=185066

Reviewed by Youenn Fablet.

Source/WebKit:

Don't create a new WebContent process when the target URL is invalid as well as when the source URL is invalid.

* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::processForNavigationInternal):

Tools:

Added a new test case (ProcessSwap.NavigateToInvalidURL) for navigating to an invalid URL.
WebKit should not swap WebContent process in this case.

* TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:
(-[PSONNavigationDelegate webView:didFailProvisionalNavigation:withError:]):
(-[PSONUIDelegate webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame:completionHandler:]):

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

17 months agoUse WindowProxy instead of DOMWindow in our IDL
cdumez@apple.com [Fri, 27 Apr 2018 22:11:00 +0000 (22:11 +0000)]
Use WindowProxy instead of DOMWindow in our IDL
https://bugs.webkit.org/show_bug.cgi?id=185022

Reviewed by Sam Weinig.

Source/WebCore:

Stop using DOMWindow in all of our IDL files and use WindowProxy as
per their respective specifications. As a result, the implementation
as also updated to use WindowProxy type instead of DOMWindow.

* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSDOMConvertWindowProxy.h: Removed.
* bindings/js/JSWindowProxy.cpp:
(WebCore::JSWindowProxy::windowProxy const):
(WebCore::JSWindowProxy::toWrapped):
* bindings/js/JSWindowProxy.h:
(WebCore::window):
Use static_cast<>() instead of jsCast<>() because jsCast<>()
relies on classInfo() which is not allowed to be called during
JS sweep due to an assertion inside classInfo(). The JSWindowProxy
objects are held strongly by the WindowProxy so we know the JSWindowProxy
object is not getting destroyed here.

(WebCore::toJS):
* bindings/js/WindowProxy.cpp:
(WebCore::WindowProxy::globalObject):
* bindings/js/WindowProxy.h:
(WebCore::WindowProxy::frame const):
* bindings/scripts/CodeGenerator.pm:
(IsBuiltinType):
(ComputeIsCallbackInterface):
(ComputeIsCallbackFunction):
* bindings/scripts/CodeGeneratorJS.pm:
(AddToIncludesForIDLType):
(GetBaseIDLType):
(NativeToJSValueDOMConvertNeedsState):
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod9Body):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethodOverloadDispatcher):
* bindings/scripts/test/TestObj.idl:
* dom/CompositionEvent.cpp:
(WebCore::CompositionEvent::CompositionEvent):
(WebCore::CompositionEvent::initCompositionEvent):
* dom/CompositionEvent.h:
* dom/CompositionEvent.idl:
* dom/Document.cpp:
(WebCore::Document::defaultView const):
* dom/Document.h:
* dom/Document.idl:
* dom/DocumentTouch.cpp:
(WebCore::DocumentTouch::createTouch):
* dom/DocumentTouch.h:
* dom/DocumentTouch.idl:
* dom/FocusEvent.cpp:
(WebCore::FocusEvent::FocusEvent):
* dom/FocusEvent.h:
* dom/InputEvent.cpp:
(WebCore::InputEvent::create):
(WebCore::InputEvent::InputEvent):
* dom/InputEvent.h:
* dom/KeyboardEvent.cpp:
(WebCore::KeyboardEvent::KeyboardEvent):
(WebCore::KeyboardEvent::create):
(WebCore::KeyboardEvent::initKeyboardEvent):
(WebCore::KeyboardEvent::charCode const):
* dom/KeyboardEvent.h:
* dom/KeyboardEvent.idl:
* dom/MessageEvent.h:
* dom/MessageEvent.idl:
* dom/MouseEvent.cpp:
(WebCore::MouseEvent::create):
(WebCore::MouseEvent::MouseEvent):
(WebCore::MouseEvent::initMouseEvent):
(WebCore::MouseEvent::initMouseEventQuirk):
* dom/MouseEvent.h:
* dom/MouseEvent.idl:
* dom/MouseRelatedEvent.cpp:
(WebCore::MouseRelatedEvent::MouseRelatedEvent):
(WebCore::MouseRelatedEvent::init):
(WebCore::MouseRelatedEvent::frameViewFromWindowProxy):
(WebCore::MouseRelatedEvent::initCoordinates):
(WebCore::MouseRelatedEvent::documentToAbsoluteScaleFactor const):
(WebCore::MouseRelatedEvent::computePageLocation):
(WebCore::MouseRelatedEvent::locationInRootViewCoordinates const):
* dom/MouseRelatedEvent.h:
* dom/Node.cpp:
* dom/SimulatedClick.cpp:
* dom/TextEvent.cpp:
(WebCore::TextEvent::create):
(WebCore::TextEvent::createForPlainTextPaste):
(WebCore::TextEvent::createForFragmentPaste):
(WebCore::TextEvent::createForDrop):
(WebCore::TextEvent::createForDictation):
(WebCore::TextEvent::TextEvent):
(WebCore::TextEvent::initTextEvent):
* dom/TextEvent.h:
* dom/TextEvent.idl:
* dom/TouchEvent.idl:
* dom/UIEvent.cpp:
(WebCore::UIEvent::UIEvent):
(WebCore::UIEvent::initUIEvent):
* dom/UIEvent.h:
(WebCore::UIEvent::create):
(WebCore::UIEvent::view const):
* dom/UIEvent.idl:
* dom/UIEventInit.h:
* dom/UIEventInit.idl:
* dom/UIEventWithKeyState.h:
(WebCore::UIEventWithKeyState::UIEventWithKeyState):
* dom/WheelEvent.cpp:
(WebCore::WheelEvent::WheelEvent):
(WebCore::WheelEvent::create):
(WebCore::WheelEvent::initWebKitWheelEvent):
* dom/WheelEvent.h:
* dom/WheelEvent.idl:
* editing/AlternativeTextController.cpp:
(WebCore::AlternativeTextController::insertDictatedText):
* editing/Editor.cpp:
(WebCore::Editor::pasteAsPlainText):
(WebCore::Editor::pasteAsFragment):
(WebCore::Editor::setComposition):
* html/HTMLDocument.cpp:
(WebCore::HTMLDocument::namedItem):
* html/HTMLDocument.h:
* html/HTMLDocument.idl:
* html/HTMLFrameElement.idl:
* html/HTMLFrameOwnerElement.cpp:
(WebCore::HTMLFrameOwnerElement::contentWindow const):
* html/HTMLFrameOwnerElement.h:
* html/HTMLFrameSetElement.cpp:
(WebCore::HTMLFrameSetElement::namedItem):
* html/HTMLFrameSetElement.h:
* html/HTMLFrameSetElement.idl:
* html/HTMLIFrameElement.idl:
* html/ImageDocument.cpp:
* page/DOMWindow.cpp:
(WebCore::PostMessageTimer::PostMessageTimer):
(WebCore::PostMessageTimer::event):
(WebCore::DOMWindow::postMessage):
* page/DragController.cpp:
(WebCore::DragController::dispatchTextInputEventFor):
* page/EventHandler.cpp:
(WebCore::EventHandler::handleTextInputEvent):

Source/WebKitLegacy/mac:

* DOM/DOMAbstractView.mm:
(kit):
(toWindowProxy):
* DOM/DOMAbstractViewInternal.h:
* DOM/DOMDocument.mm:
(-[DOMDocument defaultView]):
(-[DOMDocument getComputedStyle:pseudoElement:]):
(-[DOMDocument getMatchedCSSRules:pseudoElement:authorOnly:]):
* DOM/DOMHTMLFrameElement.mm:
(-[DOMHTMLFrameElement contentWindow]):
* DOM/DOMHTMLIFrameElement.mm:
(-[DOMHTMLIFrameElement contentWindow]):
* DOM/DOMKeyboardEvent.mm:
(-[DOMKeyboardEvent initKeyboardEvent:canBubble:cancelable:view:keyIdentifier:location:ctrlKey:altKey:shiftKey:metaKey:altGraphKey:]):
(-[DOMKeyboardEvent initKeyboardEvent:canBubble:cancelable:view:keyIdentifier:location:ctrlKey:altKey:shiftKey:metaKey:]):
(-[DOMKeyboardEvent initKeyboardEvent:canBubble:cancelable:view:keyIdentifier:keyLocation:ctrlKey:altKey:shiftKey:metaKey:altGraphKey:]):
(-[DOMKeyboardEvent initKeyboardEvent:canBubble:cancelable:view:keyIdentifier:keyLocation:ctrlKey:altKey:shiftKey:metaKey:]):
* DOM/DOMMouseEvent.mm:
(-[DOMMouseEvent initMouseEvent:canBubble:cancelable:view:detail:screenX:screenY:clientX:clientY:ctrlKey:altKey:shiftKey:metaKey:button:relatedTarget:]):
* DOM/DOMTextEvent.mm:
(-[DOMTextEvent initTextEvent:canBubbleArg:cancelableArg:viewArg:dataArg:]):
* DOM/DOMUIEvent.mm:
(-[DOMUIEvent view]):
(-[DOMUIEvent initUIEvent:canBubble:cancelable:view:detail:]):
* DOM/DOMWheelEvent.mm:
(-[DOMWheelEvent initWheelEvent:wheelDeltaY:view:screenX:screenY:clientX:clientY:ctrlKey:altKey:shiftKey:metaKey:]):

Source/WebKitLegacy/win:

* DOMCoreClasses.cpp:
(DOMDocument::getComputedStyle):

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

17 months agoAX: Accessibility needs to know which part of the content view is visible on iOS
n_wang@apple.com [Fri, 27 Apr 2018 21:58:33 +0000 (21:58 +0000)]
AX: Accessibility needs to know which part of the content view is visible on iOS
https://bugs.webkit.org/show_bug.cgi?id=185085
<rdar://problem/39801363>

Reviewed by Chris Fleizach.

Source/WebCore:

Exposed unobscuredContentRect() to iOS accessibility object wrapper.

Test: accessibility/ios-simulator/unobscured-content-rect.html

* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper accessibilityVisibleContentRect]):

Tools:

* WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
(WTR::AccessibilityUIElement::stringAttributeValue):

LayoutTests:

* accessibility/ios-simulator/unobscured-content-rect-expected.txt: Added.
* accessibility/ios-simulator/unobscured-content-rect.html: Added.
* platform/ios-wk1/TestExpectations:

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

17 months agoRefactor filter list checking code
simon.fraser@apple.com [Fri, 27 Apr 2018 21:35:56 +0000 (21:35 +0000)]
Refactor filter list checking code
https://bugs.webkit.org/show_bug.cgi?id=185087

Reviewed by Alan Bujtas.

Deduplicate code between filter and backdrop-filter for checking whether function lists
match, by making a shared function that takes a std::function.

The call sites have to declare the return type (-> const FilterOperations&) to avoid std::function
converting the return type into a value.

* animation/KeyframeEffectReadOnly.cpp:
(WebCore::KeyframeEffectReadOnly::checkForMatchingFilterFunctionLists const):
(WebCore::KeyframeEffectReadOnly::checkForMatchingFilterFunctionLists):
(WebCore::KeyframeEffectReadOnly::checkForMatchingBackdropFilterFunctionLists):
* animation/KeyframeEffectReadOnly.h:
* page/animation/KeyframeAnimation.cpp:
(WebCore::KeyframeAnimation::checkForMatchingFilterFunctionLists const):
(WebCore::KeyframeAnimation::checkForMatchingFilterFunctionLists):
(WebCore::KeyframeAnimation::checkForMatchingBackdropFilterFunctionLists):
* page/animation/KeyframeAnimation.h:

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

17 months agoRegression(r222392?): Events can have a negative timestamp which causes app breakage
cdumez@apple.com [Fri, 27 Apr 2018 21:21:30 +0000 (21:21 +0000)]
Regression(r222392?): Events can have a negative timestamp which causes app breakage
https://bugs.webkit.org/show_bug.cgi?id=185040
<rdar://problem/39638051>

Reviewed by Wenson Hsieh.

The real fix is in UIKit when generating the touch timestamps. However, this patch
does some hardening to make sure that Event.timestamp can never return a negative
value even if something goes wrong.

* dom/Event.cpp:
(WebCore::Event::timeStampForBindings const):

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

17 months agoURL::appendEncodedHostName is using the deprecated uidna_IDNToASCII function
bfulgham@apple.com [Fri, 27 Apr 2018 19:44:02 +0000 (19:44 +0000)]
URL::appendEncodedHostName is using the deprecated uidna_IDNToASCII function
https://bugs.webkit.org/show_bug.cgi?id=184836

Patch by Christopher Reid <chris.reid@sony.com> on 2018-04-27
Reviewed by Alex Christensen.

Source/WebCore:

Update URL::appendEncodedHostName to use uidna_nameToASCII as done in r208902.

Test: LayoutTests\fast\url\url-hostname-encoding.html

* platform/URL.cpp:

LayoutTests:

Verify that setting the host or hostname of URL objects will use IDNA2008.

* fast/url/url-hostname-encoding-expected.txt: Added.
* fast/url/url-hostname-encoding.html: Added.

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

17 months agoCachedRawResource is not handling incremental data computation correctly
youenn@apple.com [Fri, 27 Apr 2018 19:34:54 +0000 (19:34 +0000)]
CachedRawResource is not handling incremental data computation correctly
https://bugs.webkit.org/show_bug.cgi?id=184936
<rdar://problem/38798141>

Reviewed by Darin Adler.

* loader/cache/CachedRawResource.cpp:
(WebCore::CachedRawResource::updateBuffer): Fixing style.

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

17 months ago[LFC] Implement BlockFormattingContext::layout logic and its dependencies
zalan@apple.com [Fri, 27 Apr 2018 18:17:46 +0000 (18:17 +0000)]
[LFC] Implement BlockFormattingContext::layout logic and its dependencies
https://bugs.webkit.org/show_bug.cgi?id=185024

Reviewed by Antti Koivisto.

This patch implements the logic for block formatting context according to
https://www.w3.org/TR/CSS22/visuren.html#block-formatting

1. Traverse the tree iteratively (in post-order fashion) and compute the width/static position for the containers as
we visit the descendant nodes until we hit a leaf node.
2. Compute the position/geometry of the leaf node and move over to its sibling(s).
3. Finalize the container's height/final position as we climb back on the tree.
4. Run layout on the out-of-flow descendants.

Note that subtrees with a formatting context root need to be laid out completely before moving on to the next box.
The formatting root box is laid out in the formatting context it lives in, however its descendants get laid out
in a separate formatting context (excluding out-of-flow boxes that don't belong to the root).

* layout/FloatingContext.cpp:
(WebCore::Layout::FloatingContext::FloatingContext):
(WebCore::Layout::FloatingContext::computePosition):
* layout/FormattingContext.cpp:
(WebCore::Layout::FormattingContext::placeInFlowPositionedChildren const):
(WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const):
* layout/FormattingContext.h:
* layout/LayoutContext.cpp:
(WebCore::Layout::LayoutContext::updateLayout):
(WebCore::Layout::LayoutContext::establishedFormattingState):
* layout/LayoutContext.h:
* layout/blockformatting/BlockFormattingContext.cpp:
(WebCore::Layout::BlockFormattingContext::layout const):
(WebCore::Layout::BlockFormattingContext::layout): Deleted.
* layout/blockformatting/BlockFormattingContext.h:
* layout/inlineformatting/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::layout const):
(WebCore::Layout::InlineFormattingContext::layout): Deleted.
* layout/inlineformatting/InlineFormattingContext.h:

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

17 months agoUse NetworkLoadChecker for XHR/fetch loads
youenn@apple.com [Fri, 27 Apr 2018 18:10:18 +0000 (18:10 +0000)]
Use NetworkLoadChecker for XHR/fetch loads
https://bugs.webkit.org/show_bug.cgi?id=184741

Reviewed by Chris Dumez.

LayoutTests/imported/w3c:

* web-platform-tests/XMLHttpRequest/send-authentication-basic-cors-expected.txt:
* web-platform-tests/XMLHttpRequest/send-network-error-async-events.sub-expected.txt:
* web-platform-tests/cors/late-upload-events-expected.txt:
* web-platform-tests/fetch/api/basic/mode-same-origin.any-expected.txt:
* web-platform-tests/fetch/api/basic/scheme-about.any-expected.txt:
* web-platform-tests/fetch/api/basic/scheme-about.any.worker-expected.txt:
* web-platform-tests/fetch/api/redirect/redirect-to-dataurl-expected.txt:
* web-platform-tests/service-workers/service-worker/redirected-response.https-expected.txt:

Source/WebCore:

Covered by existing tests.

* loader/DocumentThreadableLoader.cpp:
(WebCore::DocumentThreadableLoader::shouldSetHTTPHeadersToKeep const):
We need to set this option for CORS done in NetworkProcess.
(WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
Set httpHeadersTokeep when needed (service worker or CORS loads).
Remove the synchronous disabling of preflight since this is now also done for asynchronous loads.
(WebCore::DocumentThreadableLoader::checkURLSchemeAsCORSEnabled):
Helper routine to make the same check for both simple and preflight case.
This allows more consistent error logging between WK1 and WK2.
(WebCore::DocumentThreadableLoader::makeCrossOriginAccessRequest):
Skip preflight in case this is done in NetworkProcess.
(WebCore::DocumentThreadableLoader::makeSimpleCrossOriginAccessRequest):
(WebCore::isResponseComingFromNetworkProcess):
(WebCore::DocumentThreadableLoader::redirectReceived):
Bypass security checks when they are already done in NetworkProcess.
(WebCore::DocumentThreadableLoader::didFail):
In case of AccessControl error, it might be due to a CSP check done in NetworkProcess.
Check it again to enable specific CSP console logging and error reporting.
(WebCore::DocumentThreadableLoader::loadRequest):
Recreating the error in case of synchronous loads to be able to log it adequately.
(WebCore::DocumentThreadableLoader::isDoingSecurityChecksInNetworkProcess const):
* loader/DocumentThreadableLoader.h:
* loader/SubresourceLoader.cpp:
(WebCore::SubresourceLoader::checkResponseCrossOriginAccessControl):
Specific handling of SameOrigin credential mode for which cross-origin load will not use any credential.
(WebCore::SubresourceLoader::checkRedirectionCrossOriginAccessControl):
We keep the application headers so that DocumentThreadableLoader does not have to restart a brand new load.
* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::requestResource):
DocumentThreadableLoader is setting referrer and origin directly. Until we fix that, we remove them from the original requests
as applications are not supposed to set these headers.

Source/WebKit:

* NetworkProcess/NetworkCORSPreflightChecker.cpp:
(WebKit::NetworkCORSPreflightChecker::didCompleteWithError):
Pass the preflight error as completion error if any.
* NetworkProcess/NetworkLoad.cpp:
(WebKit::NetworkLoad::willPerformHTTPRedirection):
Set response source to Network so that checks relying on that are correct.
* NetworkProcess/NetworkLoadChecker.cpp:
(WebKit::NetworkLoadChecker::validateResponse):
Adding Oppaqueredirect tainting.
(NetworkLoadChecker::doesNotNeedCORSCheck):
Adding a check to only activate CORS checks for CORS enabled schemes.
Non CORS enabled schemes loads should have failed in WebProcess already.
(WebKit::NetworkLoadChecker::checkCORSRedirectedRequest):
Remove Authorization header as done by SubresourceLoader.
(WebKit::NetworkLoadChecker::checkCORSRequestWithPreflight):
If error is cancellation, we still want to call the completion handler.
* NetworkProcess/NetworkResourceLoader.cpp:
Activate network load checker for all types of loads.
(WebKit::NetworkResourceLoader::willSendRedirectedRequest):
Handle manual redirection by directly calling didReceiveResponse.

LayoutTests:

* TestExpectations:
* http/tests/security/contentSecurityPolicy/1.1/child-src/worker-redirect-blocked-expected.txt:
* http/tests/security/contentSecurityPolicy/connect-src-eventsource-redirect-to-blocked-expected.txt:
* http/tests/security/contentSecurityPolicy/connect-src-xmlhttprequest-redirect-to-blocked-expected.txt:
* http/tests/security/contentSecurityPolicy/worker-csp-blocks-xhr-redirect-cross-origin-expected.txt:
* http/tests/xmlhttprequest/access-control-and-redirects-async-expected.txt:
* http/tests/xmlhttprequest/access-control-and-redirects-expected.txt:
* platform/mac-wk1/http/tests/security/contentSecurityPolicy/connect-src-eventsource-redirect-to-blocked-expected.txt: Added.
* platform/mac-wk1/http/tests/security/contentSecurityPolicy/worker-csp-blocks-xhr-redirect-cross-origin-expected.txt: Added.
* platform/mac-wk1/http/tests/xmlhttprequest/access-control-and-redirects-async-expected.txt: Added.
* platform/mac-wk1/imported/w3c/web-platform-tests/XMLHttpRequest/late-upload-events-expected.txt: Added.
* platform/mac-wk1/imported/w3c/web-platform-tests/XMLHttpRequest/send-authentication-basic-cors-expected.txt: Added.
* platform/mac-wk1/imported/w3c/web-platform-tests/XMLHttpRequest/send-network-error-async-events.sub-expected.txt: Added.
* platform/win/http/tests/security/contentSecurityPolicy/connect-src-eventsource-redirect-to-blocked-expected.txt: Added.
* platform/win/http/tests/security/contentSecurityPolicy/connect-src-xmlhttprequest-redirect-to-blocked-expected.txt: Added.
* platform/win/http/tests/security/contentSecurityPolicy/worker-csp-blocks-xhr-redirect-cross-origin-expected.txt: Added.
* platform/win/http/tests/xmlhttprequest/access-control-and-redirects-async-expected.txt: Added.
* platform/win/imported/w3c/web-platform-tests/XMLHttpRequest/late-upload-events-expected.txt: Added.
* platform/win/imported/w3c/web-platform-tests/XMLHttpRequest/send-authentication-basic-cors-expected.txt: Added.
* platform/win/imported/w3c/web-platform-tests/XMLHttpRequest/send-network-error-async-events.sub-expected.txt: Added.

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

17 months agoAdd an experimental feature flag for viewport "min-device-width"
wenson_hsieh@apple.com [Fri, 27 Apr 2018 18:03:15 +0000 (18:03 +0000)]
Add an experimental feature flag for viewport "min-device-width"
https://bugs.webkit.org/show_bug.cgi?id=185050
<rdar://problem/39624038>

Reviewed by Tim Horton.

Source/WebCore:

Add MinDeviceWidthEnabled as a new runtime-enabled feature.

* dom/ViewportArguments.cpp:
(WebCore::setViewportFeature):

Gate the parsing of "min-device-width" on the runtime-enabled feature being flipped on.

* page/RuntimeEnabledFeatures.h:
(WebCore::RuntimeEnabledFeatures::setMinDeviceWidthEnabled):
(WebCore::RuntimeEnabledFeatures::minDeviceWidthEnabled const):

Source/WebKit:

Add MinDeviceWidthEnabled as a new experimental feature, on by default in extra zoom mode and off elsewhere.

* Shared/WebPreferences.yaml:
* Shared/WebPreferencesDefaultValues.h:

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

17 months agoMake color-filter transform gradient colors
simon.fraser@apple.com [Fri, 27 Apr 2018 17:59:25 +0000 (17:59 +0000)]
Make color-filter transform gradient colors
https://bugs.webkit.org/show_bug.cgi?id=185080

Reviewed by Zalan Bujtas.
Source/WebCore:

In CSSGradientValue::computeStops(), transform the color of each gradient color
stop through the color filter. Having a color filter makes the gradient uncacheable.

Color filters can add alpha, so we also have to fix up CSSGradientValue::knownToBeOpaque()
to take a RenderStyle and convert the colors before testing opaqueness. Clean up some related
functions to take const RenderStyle&.

Test: css3/color-filters/color-filter-gradients.html

* css/CSSCrossfadeValue.cpp:
(WebCore::subimageKnownToBeOpaque):
* css/CSSFilterImageValue.cpp:
(WebCore::CSSFilterImageValue::knownToBeOpaque const):
* css/CSSFilterImageValue.h:
* css/CSSGradientValue.cpp:
(WebCore::CSSGradientValue::image):
(WebCore::CSSGradientValue::computeStops):
(WebCore::CSSGradientValue::knownToBeOpaque const):
(WebCore::CSSLinearGradientValue::createGradient):
(WebCore::CSSRadialGradientValue::createGradient):
* css/CSSGradientValue.h:
* css/CSSImageGeneratorValue.cpp:
(WebCore::CSSImageGeneratorValue::knownToBeOpaque const):
* css/CSSImageValue.cpp:
(WebCore::CSSImageValue::knownToBeOpaque const):
* css/CSSImageValue.h:

LayoutTests:

* css3/color-filters/color-filter-gradients-expected.html: Added.
* css3/color-filters/color-filter-gradients.html: Added.

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

17 months agoUnreviewed, rolling out r231086.
ryanhaddad@apple.com [Fri, 27 Apr 2018 17:22:35 +0000 (17:22 +0000)]
Unreviewed, rolling out r231086.

Caused JSC test failures due to an unchecked exception.

Reverted changeset:

"[ESNext][BigInt] Implement support for "*" operation"
https://bugs.webkit.org/show_bug.cgi?id=183721
https://trac.webkit.org/changeset/231086

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

17 months agoUIDelegate::UIClient::didResignInputElementStrongPasswordAppearance() is applicable...
dbates@webkit.org [Fri, 27 Apr 2018 17:20:36 +0000 (17:20 +0000)]
UIDelegate::UIClient::didResignInputElementStrongPasswordAppearance() is applicable to both Mac and iOS
https://bugs.webkit.org/show_bug.cgi?id=185079
<rdar://problem/39794960>

I inadvertently forgot to move the UIDelegate field webViewDidResignInputElementStrongPasswordAppearanceWithUserInfo
outside the PLATFORM(MAC)-guard.

* UIProcess/Cocoa/UIDelegate.h:

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

17 months agoUIDelegate::UIClient::didResignInputElementStrongPasswordAppearance() is applicable...
dbates@webkit.org [Fri, 27 Apr 2018 17:11:59 +0000 (17:11 +0000)]
UIDelegate::UIClient::didResignInputElementStrongPasswordAppearance() is applicable to both Mac and iOS
https://bugs.webkit.org/show_bug.cgi?id=185079
<rdar://problem/39794960>

Reviewed by Andy Estes.

* UIProcess/Cocoa/UIDelegate.h:
* UIProcess/Cocoa/UIDelegate.mm:
(WebKit::UIDelegate::setDelegate):
(WebKit::UIDelegate::UIClient::didResignInputElementStrongPasswordAppearance):

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

17 months agoDisable color-filter tests on Windows for now
simon.fraser@apple.com [Fri, 27 Apr 2018 16:30:23 +0000 (16:30 +0000)]
Disable color-filter tests on Windows for now
https://bugs.webkit.org/show_bug.cgi?id=185076

The experimental feature for color-filter is off by default, and Windows WebKit API
would have to change to enable it, so just skip the tests for now.

* platform/win/TestExpectations:

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

17 months agoFix color-filter to apply to text decorations
simon.fraser@apple.com [Fri, 27 Apr 2018 16:11:12 +0000 (16:11 +0000)]
Fix color-filter to apply to text decorations
https://bugs.webkit.org/show_bug.cgi?id=185068
<rdar://problem/39782136>

Reviewed by Alan Bujtas.
Source/WebCore:

Transform the colors of text shadows, and the shadows of text-decorations through
the color-filter.

Rather than clone the ShadowData stored on TextPainter and TextDecorationPainter
(which would have awkward ownership implications) we pass the color filters through
and just map the color through it before painting.

Re-order the members of TextPainter a little to optimize padding.

Also fix a bug where FilterOperations::transformColor() could transform an invalid
color to a valid one; we never want this.

Tests: css3/color-filters/color-filter-text-decoration-shadow.html
       css3/color-filters/color-filter-text-shadow.html

* platform/graphics/filters/FilterOperations.cpp:
(WebCore::FilterOperations::transformColor const):
* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::paintMarkedTextForeground):
(WebCore::InlineTextBox::paintMarkedTextDecoration):
* rendering/TextDecorationPainter.cpp:
(WebCore::TextDecorationPainter::paintTextDecoration):
* rendering/TextDecorationPainter.h:
(WebCore::TextDecorationPainter::setTextShadow):
(WebCore::TextDecorationPainter::setShadowColorFilter):
(WebCore::TextDecorationPainter::addTextShadow): Deleted.
* rendering/TextPainter.cpp:
(WebCore::ShadowApplier::ShadowApplier):
(WebCore::TextPainter::paintTextWithShadows):
(WebCore::TextPainter::paintTextAndEmphasisMarksIfNeeded): Simplify the logic that only paints the shadow
on the first iteration.
(WebCore::TextPainter::paintRange):
* rendering/TextPainter.h:
(WebCore::TextPainter::setShadowColorFilter):
* rendering/svg/SVGInlineTextBox.cpp:
(WebCore::SVGInlineTextBox::paintTextWithShadows):

LayoutTests:

* css3/color-filters/color-filter-text-decoration-shadow-expected.html: Added.
* css3/color-filters/color-filter-text-decoration-shadow.html: Added.
* css3/color-filters/color-filter-text-shadow-expected.html: Added.
* css3/color-filters/color-filter-text-shadow.html: Added.

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

17 months agoMark CSS color filters tests as failing on Windows.
pvollan@apple.com [Fri, 27 Apr 2018 16:09:49 +0000 (16:09 +0000)]
Mark CSS color filters tests as failing on Windows.
https://bugs.webkit.org/show_bug.cgi?id=185075

Unreviewed test gardening.

* platform/win/TestExpectations:

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

17 months agoUnreviewed test gardening, update expectations for test262/intl402/PluralRules tests...
ryanhaddad@apple.com [Fri, 27 Apr 2018 16:08:28 +0000 (16:08 +0000)]
Unreviewed test gardening, update expectations for test262/intl402/PluralRules tests after r231047.

* test262.yaml: Mark tests as passing.

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

17 months agoRename minimumLayoutSize to viewLayoutSize
wenson_hsieh@apple.com [Fri, 27 Apr 2018 16:07:19 +0000 (16:07 +0000)]
Rename minimumLayoutSize to viewLayoutSize
https://bugs.webkit.org/show_bug.cgi?id=185050
<rdar://problem/39624038>

Reviewed by Tim Horton.

Source/WebCore:

See WebKit/ChangeLog for more information. No change in behavior.

* page/ViewportConfiguration.cpp:
(WebCore::ViewportConfiguration::ViewportConfiguration):
(WebCore::ViewportConfiguration::setViewLayoutSize):

Remove a FIXME comment that is addressed by this refactoring.

(WebCore::ViewportConfiguration::shouldOverrideDeviceWidthWithMinDeviceWidth const):
(WebCore::ViewportConfiguration::initialScaleFromSize const):
(WebCore::ViewportConfiguration::minimumScale const):
(WebCore::ViewportConfiguration::updateMinimumLayoutSize):
(WebCore::ViewportConfiguration::setMinimumLayoutSize): Deleted.
* page/ViewportConfiguration.h:
(WebCore::ViewportConfiguration::viewLayoutSize const):
(WebCore::ViewportConfiguration::viewSize const): Deleted.

Source/WebKit:

Renames minimumLayoutSize to viewLayoutSize, since the minimum layout size in ViewportConfiguration is now
different from the minimum layout size that is currently pushed down from the UI process (e.g. WKWebView SPI) in
the case where `min-device-width` is used to override the minimum layout size.

* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::encode const):
(WebKit::WebPageCreationParameters::decode):
* Shared/WebPageCreationParameters.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _processDidExit]):
(-[WKWebView activeViewLayoutSize:]):
(-[WKWebView _dispatchSetViewLayoutSize:]):
(-[WKWebView _frameOrBoundsChanged]):
(-[WKWebView _minimumLayoutSizeOverride]):
(-[WKWebView _setViewLayoutSizeOverride:]):
(-[WKWebView _beginAnimatedResizeWithUpdates:]):
(-[WKWebView _endAnimatedResize]):
(-[WKWebView _overrideLayoutParametersWithMinimumLayoutSize:maximumUnobscuredSizeOverride:]):
(-[WKWebView _clearOverrideLayoutParameters]):
(-[WKWebView _minimumLayoutWidth]):
(-[WKWebView _setMinimumLayoutWidth:]):
(-[WKWebView activeMinimumLayoutSize:]): Deleted.
(-[WKWebView _dispatchSetMinimumLayoutSize:]): Deleted.
(-[WKWebView _setMinimumLayoutSizeOverride:]): Deleted.
(-[WKWebView _overrideLayoutParametersWithMinimumLayoutSize:minimumLayoutSizeForMinimalUI:maximumUnobscuredSizeOverride:]): Deleted.

Remove unused SPI that has been deprecated since iOS 9, has a simple drop-in replacement, and no longer has any
internal clients.

* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::setMinimumSizeForAutoLayout):
(WebKit::WebViewImpl::minimumSizeForAutoLayout const):
(WebKit::WebViewImpl::setIntrinsicContentSize):
* UIProcess/DrawingAreaProxy.h:
(WebKit::DrawingAreaProxy::viewLayoutSizeDidChange):
(WebKit::DrawingAreaProxy::minimumLayoutSizeDidChange): Deleted.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::creationParameters):
(WebKit::WebPageProxy::setViewLayoutSize):
(WebKit::WebPageProxy::setMinimumLayoutSize): Deleted.
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::viewLayoutSize const):
(WebKit::WebPageProxy::minimumLayoutSize const): Deleted.
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::dynamicViewportSizeUpdate):
(WebKit::WebPageProxy::setViewportConfigurationViewLayoutSize):
(WebKit::WebPageProxy::setViewportConfigurationMinimumLayoutSize): Deleted.
* UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
* UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
(WebKit::TiledCoreAnimationDrawingAreaProxy::viewLayoutSizeDidChange):
(WebKit::TiledCoreAnimationDrawingAreaProxy::didUpdateGeometry):
(WebKit::TiledCoreAnimationDrawingAreaProxy::intrinsicContentSizeDidChange):
(WebKit::TiledCoreAnimationDrawingAreaProxy::willSendUpdateGeometry):
(WebKit::TiledCoreAnimationDrawingAreaProxy::minimumLayoutSizeDidChange): Deleted.
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage):
* WebProcess/WebPage/ViewGestureGeometryCollector.cpp:
(WebKit::ViewGestureGeometryCollector::collectGeometryForSmartMagnificationGesture):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::m_credentialsMessenger):
(WebKit::WebPage::setViewLayoutSize):
(WebKit::WebPage::setMinimumLayoutSize): Deleted.
* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::viewLayoutSize const):
(WebKit::WebPage::minimumLayoutSize const): Deleted.
* WebProcess/WebPage/WebPage.messages.in:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::setViewportConfigurationViewLayoutSize):
(WebKit::WebPage::dynamicViewportSizeUpdate):
(WebKit::WebPage::setViewportConfigurationMinimumLayoutSize): Deleted.
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::updateIntrinsicContentSizeIfNeeded):
(WebKit::TiledCoreAnimationDrawingArea::updateGeometry):

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

17 months ago[LFC] Formatting contexts should create floating states.
zalan@apple.com [Fri, 27 Apr 2018 15:40:16 +0000 (15:40 +0000)]
[LFC] Formatting contexts should create floating states.
https://bugs.webkit.org/show_bug.cgi?id=185032

Reviewed by Antti Koivisto.

This patch implements the logic for sharing floating states across multiple formatting contexts.
At this point this is mostly about inline formatting contexts. They either create a new floating state
or inherit it from the parent formatting context.

* layout/FloatingState.cpp:
(WebCore::Layout::FloatingState::FloatingState):
* layout/FloatingState.h:
(WebCore::Layout::FloatingState::create):
* layout/FormattingContext.cpp:
(WebCore::Layout::FormattingContext::FormattingContext):
* layout/FormattingContext.h:
(WebCore::Layout::FormattingContext::layoutContext const):
* layout/FormattingState.cpp:
(WebCore::Layout::FormattingState::FormattingState):
* layout/FormattingState.h:
(WebCore::Layout::FormattingState::floatingState const):
* layout/LayoutContext.cpp:
(WebCore::Layout::LayoutContext::updateLayout):
(WebCore::Layout::LayoutContext::formattingStateForBox const):
(WebCore::Layout::LayoutContext::establishedFormattingState):
(WebCore::Layout::LayoutContext::formattingContext):
(WebCore::Layout::LayoutContext::formattingState): Deleted.
* layout/LayoutContext.h:
* layout/blockformatting/BlockFormattingContext.cpp:
(WebCore::Layout::BlockFormattingContext::BlockFormattingContext):
(WebCore::Layout::BlockFormattingContext::createFormattingState const):
(WebCore::Layout::BlockFormattingContext::createOrFindFloatingState const):
(WebCore::Layout::BlockFormattingContext::formattingState const): Deleted.
* layout/blockformatting/BlockFormattingContext.h:
* layout/blockformatting/BlockFormattingState.cpp:
(WebCore::Layout::BlockFormattingState::BlockFormattingState):
* layout/blockformatting/BlockFormattingState.h:
* layout/inlineformatting/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::InlineFormattingContext):
(WebCore::Layout::InlineFormattingContext::createFormattingState const):
(WebCore::Layout::InlineFormattingContext::createOrFindFloatingState const):
(WebCore::Layout::InlineFormattingContext::formattingState const): Deleted.
* layout/inlineformatting/InlineFormattingContext.h:
* layout/inlineformatting/InlineFormattingState.cpp:
(WebCore::Layout::InlineFormattingState::InlineFormattingState):
* layout/inlineformatting/InlineFormattingState.h:
* layout/layouttree/LayoutBox.cpp:
(WebCore::Layout::Box::formattingContextRoot const):
* layout/layouttree/LayoutBox.h:

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

17 months ago[Extra zoom mode] Add a mechanism to override default viewport behaviors in extra...
wenson_hsieh@apple.com [Fri, 27 Apr 2018 15:35:50 +0000 (15:35 +0000)]
[Extra zoom mode] Add a mechanism to override default viewport behaviors in extra zoom mode
https://bugs.webkit.org/show_bug.cgi?id=185050
<rdar://problem/39624038>

Reviewed by Tim Horton.

Source/WebCore:

Currently, in extra zoom mode, there's no way for web pages to opt out of the default viewport behaviors
(namely, laying out at a larger width and shrinking to fit) when the web view is very tall and narrow. This
patch adds a new experimental viewport attribute, "min-device-width", that can be used to prevent WebKit from
automatically clamping the web view width to a greater value for the device width in this scenario.

Note that after this patch, logic that plumbs a minimumLayoutSize from WKWebView to the viewport configuration
will need to be renamed to reflect that this size is no longer the minimum layout size, but rather, the view
size that is used for viewport device dimensions by default. This refactoring will be done in a followup part.

See per-method comments below for more detail.

Test: fast/viewport/extrazoom/viewport-change-min-device-width.html

* dom/ViewportArguments.cpp:
(WebCore::setViewportFeature):
(WebCore::operator<<):
* dom/ViewportArguments.h:

Removes `m_forceHorizontalShrinkToFit` (more detail below).

* page/ViewportConfiguration.cpp:
(WebCore::computedMinDeviceWidth):
(WebCore::ViewportConfiguration::ViewportConfiguration):
(WebCore::ViewportConfiguration::setMinimumLayoutSize):

Instead of directly setting the minimum layout size, setMinimumLayoutSize now first sets the view size (i.e. the
size we use for `device-width` in the viewport meta tag), and then updates the minimum layout size.

(WebCore::ViewportConfiguration::shouldOverrideDeviceWidthWithMinDeviceWidth const):

Replaces `m_forceHorizontalShrinkToFit`. Whether or not we shrink to fit is now determined by whether the
min-device-width attribute is actively clamping the width of the view.

(WebCore::ViewportConfiguration::shouldIgnoreHorizontalScalingConstraints const):
(WebCore::ViewportConfiguration::shouldIgnoreScalingConstraintsRegardlessOfContentSize const):
(WebCore::ViewportConfiguration::updateMinimumLayoutSize):

Computes and sets the minimum layout size using the view size, taking the minimum device width into account if
needed.

(WebCore::ViewportConfiguration::description const):
(WebCore::ViewportConfiguration::setForceHorizontalShrinkToFit): Deleted.
* page/ViewportConfiguration.h:

Source/WebKit:

Remove the forceHorizontalViewportShrinkToFit and minimumAllowedLayoutWidth SPI hooks from WebKit, and
additionally remove all logic for plumbing viewSize to WebCore. See WebCore/ChangeLog for more information.

* Shared/VisibleContentRectUpdateInfo.cpp:
(WebKit::VisibleContentRectUpdateInfo::encode const):
(WebKit::VisibleContentRectUpdateInfo::decode):
(WebKit::operator<<):
* Shared/VisibleContentRectUpdateInfo.h:
(WebKit::VisibleContentRectUpdateInfo::VisibleContentRectUpdateInfo):
(WebKit::VisibleContentRectUpdateInfo::allowShrinkToFit const):
(WebKit::operator==):
(WebKit::VisibleContentRectUpdateInfo::forceHorizontalShrinkToFit const): Deleted.
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _initializeWithConfiguration:]):
(-[WKWebView activeMinimumLayoutSize:]):
(-[WKWebView _dispatchSetMinimumLayoutSize:]):
(-[WKWebView _frameOrBoundsChanged]):
(-[WKWebView _setMinimumLayoutSizeOverride:]):
(-[WKWebView _beginAnimatedResizeWithUpdates:]):
(-[WKWebView _endAnimatedResize]):
(-[WKWebView _minimumAllowedLayoutWidth]): Deleted.
(-[WKWebView _setMinimumAllowedLayoutWidth:]): Deleted.
(-[WKWebView activeMinimumLayoutSizes:]): Deleted.
(-[WKWebView _dispatchSetMinimumLayoutSize:viewSize:]): Deleted.
(-[WKWebView _setForceHorizontalViewportShrinkToFit:]): Deleted.
(-[WKWebView _forceHorizontalViewportShrinkToFit]): Deleted.
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::creationParameters):
* UIProcess/WebPageProxy.h:
* UIProcess/ios/WKContentView.mm:
(-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInsets:unobscuredSafeAreaInsets:inputViewBounds:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]):
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::dynamicViewportSizeUpdate):
(WebKit::WebPageProxy::setViewportConfigurationMinimumLayoutSize):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::m_credentialsMessenger):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::setViewportConfigurationMinimumLayoutSize):
(WebKit::WebPage::dynamicViewportSizeUpdate):
(WebKit::WebPage::updateVisibleContentRects):

Tools:

Remove a test that's no longer useful, now that the SPI it was testing is gone. This functionality is now
tested by the layout test added in this patch.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/ios/ViewportSizingTests.mm: Removed.

LayoutTests:

Add a new layout test to check that:
• By default (with no `min-device-width` override), shrink-to-fit and expanded minimum layout sizes takes effect.
• `min-device-width` can be used to bail out of shrink-to-fit and viewport behaviors.
• A large `min-device-width` can be used to make extra zoom mode viewport heuristics even more aggressive.

* TestExpectations:
* fast/viewport/extrazoom/viewport-change-min-device-width.html: Added.
* resources/ui-helper.js:
(window.UIHelper.zoomScale):
(window.UIHelper):

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

17 months ago[LFC] Formatting contexts should take const Box&
zalan@apple.com [Fri, 27 Apr 2018 14:40:24 +0000 (14:40 +0000)]
[LFC] Formatting contexts should take const Box&
https://bugs.webkit.org/show_bug.cgi?id=185031

Reviewed by Sam Weinig.

The formatting root boxes are supposed to be all const. The only reason why
they are not is because WeakPtr<> does not support const objects yet.
Use const_cast instead (remove it when WeakPtr<> gains const support).

* layout/FormattingContext.cpp:
(WebCore::Layout::FormattingContext::FormattingContext):
* layout/FormattingContext.h:
* layout/LayoutContext.cpp:
(WebCore::Layout::LayoutContext::LayoutContext):
(WebCore::Layout::LayoutContext::formattingContext):
* layout/LayoutContext.h:
* layout/blockformatting/BlockFormattingContext.cpp:
(WebCore::Layout::BlockFormattingContext::BlockFormattingContext):
* layout/blockformatting/BlockFormattingContext.h:
* layout/inlineformatting/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::InlineFormattingContext):
* layout/inlineformatting/InlineFormattingContext.h:

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

17 months ago[LFC] Add layout tree iterators.
zalan@apple.com [Fri, 27 Apr 2018 14:34:47 +0000 (14:34 +0000)]
[LFC] Add layout tree iterators.
https://bugs.webkit.org/show_bug.cgi?id=185058

Reviewed by Antti Koivisto.

They work exactly like the renderer tree iterators.

* WebCore.xcodeproj/project.pbxproj:
* layout/layouttree/LayoutAncestorIterator.h: Added.
(WebCore::Layout::LayoutAncestorIterator<T>::LayoutAncestorIterator):
(WebCore::Layout::LayoutAncestorIterator<T>::operator):
(WebCore::Layout::LayoutAncestorIteratorAdapter<T>::LayoutAncestorIteratorAdapter):
(WebCore::Layout::LayoutAncestorIteratorAdapter<T>::begin const):
(WebCore::Layout::LayoutAncestorIteratorAdapter<T>::end const):
(WebCore::Layout::LayoutAncestorIteratorAdapter<T>::first const):
(WebCore::Layout::ancestorsOfType):
(WebCore::Layout::lineageOfType):
* layout/layouttree/LayoutBox.cpp:
* layout/layouttree/LayoutChildIterator.h: Added.
(WebCore::Layout::LayoutChildtIterator<T>::LayoutChildtIterator):
(WebCore::Layout::LayoutChildtIterator<T>::operator):
(WebCore::Layout::LayoutChildtIteratorAdapter<T>::LayoutChildtIteratorAdapter):
(WebCore::Layout::LayoutChildtIteratorAdapter<T>::begin const):
(WebCore::Layout::LayoutChildtIteratorAdapter<T>::end const):
(WebCore::Layout::LayoutChildtIteratorAdapter<T>::first const):
(WebCore::Layout::LayoutChildtIteratorAdapter<T>::last const):
(WebCore::Layout::childrenOfType):
* layout/layouttree/LayoutIterator.h: Added.
(WebCore::Layout::isLayoutBoxOfType):
(WebCore::Layout::Traversal::firstChild):
(WebCore::Layout::Traversal::lastChild):
(WebCore::Layout::Traversal::nextSibling):
(WebCore::Layout::Traversal::previousSibling):
(WebCore::Layout::Traversal::findAncestorOfType):
(WebCore::Layout::Traversal::nextAncestorSibling):
(WebCore::Layout::Traversal::nextWithin):
(WebCore::Layout::Traversal::firstWithin):
(WebCore::Layout::Traversal::next):
(WebCore::Layout::LayoutIterator<T>::LayoutIterator):
(WebCore::Layout::LayoutIterator<T>::traverseNextSibling):
(WebCore::Layout::LayoutIterator<T>::traverseNext):
(WebCore::Layout::LayoutIterator<T>::traversePreviousSibling):
(WebCore::Layout::LayoutIterator<T>::traverseAncestor):
(WebCore::Layout::LayoutIterator<T>::operator const):
(WebCore::Layout:: const):
(WebCore::Layout::= const):

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

17 months ago[GTK] Mark a few new test failures
csaavedra@igalia.com [Fri, 27 Apr 2018 11:47:37 +0000 (11:47 +0000)]
[GTK] Mark a few new test failures

Unreviewed gardening.
* platform/gtk/TestExpectations: Related to r230817

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

17 months agoUnreviewed, rolling out r231089.
commit-queue@webkit.org [Fri, 27 Apr 2018 10:07:58 +0000 (10:07 +0000)]
Unreviewed, rolling out r231089.
https://bugs.webkit.org/show_bug.cgi?id=185071

Broke and made crash some WPE EME tests (Requested by calvaris
on #webkit).

Reverted changeset:

"[EME][GStreamer] Move the decryptor from AppendPipeline to
PlaybackPipeline."
https://bugs.webkit.org/show_bug.cgi?id=181855
https://trac.webkit.org/changeset/231089

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

17 months agoREGRESSION(r230812): [WPE][GTK] WebKitWebViewSessionState.cpp throws away encoded...
carlosgc@webkit.org [Fri, 27 Apr 2018 08:40:52 +0000 (08:40 +0000)]
REGRESSION(r230812): [WPE][GTK] WebKitWebViewSessionState.cpp throws away encoded BackForwardList identifier
https://bugs.webkit.org/show_bug.cgi?id=184823

Reviewed by Michael Catanzaro.

Bump session sate format version to 2 and stop encoding the backfoward list item identifier, since it's always
regenerated.

* UIProcess/API/glib/WebKitWebViewSessionState.cpp:
(encodeBackForwardListItemState): Always encode version 2.
(encodeBackForwardListState): Ditto.
(encodeSessionState): Ditto.
(decodeBackForwardListItemStateV1): Decode list item state for version 1.
(decodeBackForwardListItemState): Receive the version and call decodeBackForwardListItemStateV1() if it's 1 or
use the version 2 otherwise.
(decodeSessionState): Load data for known formats and use the one that worked to decode it.

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

17 months ago[EME][GStreamer] Move the decryptor from AppendPipeline to PlaybackPipeline.
commit-queue@webkit.org [Fri, 27 Apr 2018 07:33:53 +0000 (07:33 +0000)]
[EME][GStreamer] Move the decryptor from AppendPipeline to PlaybackPipeline.
https://bugs.webkit.org/show_bug.cgi?id=181855

Patch by Yacine Bandou <yacine.bandou_ext@softathome.com> on 2018-04-27
Reviewed by Xabier Rodriguez-Calvar.

The goal of this move is to handle the limitation of SVP (Secure Video Path) memory size.

When the decryptor is in the AppendPipeline and we use SVP, we buffer in MediaSource queue
the decrypted GstBuffers that are in SVP memory.
This behavior cause an out-of-memory error, because we are limited in SVP memory size.

By moving the decryptor in PlaybackPipeline, we avoid to buffer the decrypted GstBuffers
which use the SVP memory and we buffer the encrypted GstBuffers that are in system memory.

This new architecture also allows to start the buffering before obtaining the DRM license
and it makes easier to manage dynamic change of the license or Key.

The decryptor is auto plugged by GStreamer playbin in PlaybackPipeline.

SVP: Secure Video Path also named trusted or protected video path, it is a memory which is
protected by a hardware access control engine, it is not accessible to other unauthorised
software or hardware components.

Tests:
    media/encrypted-media/clearKey/clearKey-cenc-audio-playback-mse.html
    media/encrypted-media/clearKey/clearKey-cenc-video-playback-mse.html

* platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
(webkitMediaCommonEncryptionDecryptSinkEventHandler):
* platform/graphics/gstreamer/mse/AppendPipeline.cpp:
(WebCore::dumpAppendState):
(WebCore::AppendPipeline::AppendPipeline):
(WebCore::AppendPipeline::handleNeedContextSyncMessage):
(WebCore::AppendPipeline::handleAppsrcNeedDataReceived):
(WebCore::AppendPipeline::setAppendState):
(WebCore::AppendPipeline::parseDemuxerSrcPadCaps):
(WebCore::AppendPipeline::appsinkNewSample):
(WebCore::AppendPipeline::connectDemuxerSrcPadToAppsinkFromAnyThread):
(WebCore::AppendPipeline::disconnectDemuxerSrcPadFromAppsinkFromAnyThread):
(WebCore::appendPipelineElementMessageCallback): Deleted.
(WebCore::AppendPipeline::handleElementMessage): Deleted.
(WebCore::AppendPipeline::dispatchPendingDecryptionStructure): Deleted.
(WebCore::AppendPipeline::dispatchDecryptionStructure): Deleted.
* platform/graphics/gstreamer/mse/AppendPipeline.h:
* platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
(WebCore::MediaPlayerPrivateGStreamerMSE::attemptToDecryptWithInstance):
* platform/graphics/gstreamer/mse/PlaybackPipeline.cpp:

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

17 months ago[EME][GStreamer] Add a new message "decrypt-key-needed" send from the decryptor to...
commit-queue@webkit.org [Fri, 27 Apr 2018 07:27:45 +0000 (07:27 +0000)]
[EME][GStreamer] Add a new message "decrypt-key-needed" send from the decryptor to the application.
https://bugs.webkit.org/show_bug.cgi?id=181858

Patch by Yacine Bandou <yacine.bandou_ext@softathome.com> on 2018-04-27
Reviewed by Xabier Rodriguez-Calvar.

Add a new message "decrypt-key-needed" that the decryptor can send when it doesn't have an available key.
This message should be handled by the application in order to dispatch or send the key to the decryptor.
This patch is a preparation for the patch 181855.
With the patch 181855, the decryptor will be in the PlaybackPipeline instead of AppendPipeline, thus we can
get the DRM license or key before to instantiate or load the decryptor plugin in PlaybackPipeline.
When the decryptor plugin is instantiated or loaded, it should able to ask the application to resend
the DRM license or key by using this new message "decrypt-key-needed".

* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::handleMessage):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
(WebCore::MediaPlayerPrivateGStreamerBase::dispatchCDMInstance):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
* platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
(webkitMediaCommonEncryptionDecryptTransformInPlace):

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

17 months agoExtend create-analysis-test API to be able to create with confirming test group.
dewei_zhu@apple.com [Fri, 27 Apr 2018 06:22:00 +0000 (06:22 +0000)]
Extend create-analysis-test API to be able to create with confirming test group.
https://bugs.webkit.org/show_bug.cgi?id=184958

Reviewed by Ryosuke Niwa.

Extend create-analysis-test API to be able to create an analysis task with confirming test group.
Update create analysis task UI in chart pane to adapt this new API.
Refactored '/privileged-api/create-test-group' API to share some creating test group logic with '/privileged-api/create-analysis-task' API.
Moved the shared logic to commit-sets-helpers.php.

* public/api/analysis-tasks.php: Use 'require_once' instead of 'require'.
* public/include/commit-sets-helpers.php: Added.
(create_test_group_and_build_requests): A helper function that creates test group and build requests for a analysis
task. In long term, this should be a class to avoid passing long argument list around.
(insert_commit_sets_and_construct_configuration_list): Based on commit sets returns build and test configurations.
(insert_build_request_for_configuration): Insert build requests based on configuration.
(commit_sets_from_revision_sets): Returns commit sets from given revision set list.
* public/privileged-api/create-analysis-task.php: Added the ability to create analysis task with confirming test
groups when repetition count is specified.
* public/privileged-api/create-test-group.php: Moved shared function to commit-sets-helpers.php.
* public/v3/models/analysis-task.js:
(AnalysisTask.create): Instead of accepting run ids, it now accepts points and test group name and confirming iterations.
It will conditionally add test group information into parameter when confirming iterations is a positive number.
(AnalysisTask):
* public/v3/models/commit-set.js:
(CommitSet.revisionSetsFromCommitSets): Move 'TestGroup._revisionSetsFromCommitSets' since CommitSet class is more
appropriate place and it will be shared by both TestGroup and AnalysisTask
(CommitSet):
* public/v3/models/test-group.js:
(TestGroup.createWithTask): Adapt 'CommitSet.revisionSetsFromCommitSets'.
(TestGroup.createWithCustomConfiguration): Adapt 'CommitSet.revisionSetsFromCommitSets'.
(TestGroup.createAndRefetchTestGroups): Adapt 'CommitSet.revisionSetsFromCommitSets'.
(TestGroup._revisionSetsFromCommitSets): Deleted and moved to 'CommitSet.revisionSetsFromCommitSets'.
* public/v3/pages/chart-pane.js:
(ChartPane.prototype.didConstructShadowTree): Added the logic to disable options when checkbox for creating confirming
test group is unchecked.
(ChartPane.prototype._analyzeRange): Conditionally create confirming test group from UI.
(ChartPane.cssTemplate):
* server-tests/privileged-api-create-analysis-task-tests.js: Added unit tests. Added a unit test for 'NodePrivilegedAPI'.
* unit-tests/analysis-task-tests.js: Added unit tests.
* unit-tests/commit-set-tests.js: Added unit test for 'CommitSet.revisionSetsFromCommitSets'.
* unit-tests/resources/mock-remote-api.js: Reset csrf token when BrowserPrivilegedAPI is used.
(MockRemoteAPI.inject):

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

17 months ago[ESNext][BigInt] Implement support for "*" operation
ticaiolima@gmail.com [Fri, 27 Apr 2018 04:18:32 +0000 (04:18 +0000)]
[ESNext][BigInt] Implement support for "*" operation
https://bugs.webkit.org/show_bug.cgi?id=183721

Reviewed by Saam Barati.

JSTests:

* bigIntTests.yaml:
* stress/big-int-mul-jit.js: Added.
* stress/big-int-mul-to-primitive-precedence.js: Added.
* stress/big-int-mul-to-primitive.js: Added.
* stress/big-int-mul-type-error.js: Added.
* stress/big-int-mul-wrapped-value.js: Added.
* stress/big-int-multiplication.js: Added.
* stress/big-int-multiply-memory-stress.js: Added.

Source/JavaScriptCore:

Added BigInt support into times binary operator into LLInt and on
JITOperations profiledMul and unprofiledMul. We are also replacing all
uses of int to unsigned when there is no negative values for
variables.

* dfg/DFGConstantFoldingPhase.cpp:
(JSC::DFG::ConstantFoldingPhase::foldConstants):
* jit/JITOperations.cpp:
* runtime/CommonSlowPaths.cpp:
(JSC::SLOW_PATH_DECL):
* runtime/JSBigInt.cpp:
(JSC::JSBigInt::JSBigInt):
(JSC::JSBigInt::allocationSize):
(JSC::JSBigInt::createWithLength):
(JSC::JSBigInt::toString):
(JSC::JSBigInt::multiply):
(JSC::JSBigInt::digitDiv):
(JSC::JSBigInt::internalMultiplyAdd):
(JSC::JSBigInt::multiplyAccumulate):
(JSC::JSBigInt::equals):
(JSC::JSBigInt::absoluteDivSmall):
(JSC::JSBigInt::calculateMaximumCharactersRequired):
(JSC::JSBigInt::toStringGeneric):
(JSC::JSBigInt::rightTrim):
(JSC::JSBigInt::allocateFor):
(JSC::JSBigInt::parseInt):
(JSC::JSBigInt::digit):
(JSC::JSBigInt::setDigit):
* runtime/JSBigInt.h:
* runtime/Operations.h:
(JSC::jsMul):

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

17 months agoUpdate code style guidelines to mention braced initialization style.
ross.kirsling@sony.com [Fri, 27 Apr 2018 04:00:01 +0000 (04:00 +0000)]
Update code style guidelines to mention braced initialization style.
https://bugs.webkit.org/show_bug.cgi?id=185053

Reviewed by Ryosuke Niwa.

* code-style.md:
Add a clause to the Spacing section about braced initialization.
(Also, fix an erroneous element ID on a neighboring line.)

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

17 months agotex[Sub]Image2D slow when passing in a <canvas>, faster with ImageData.
commit-queue@webkit.org [Fri, 27 Apr 2018 02:00:25 +0000 (02:00 +0000)]
tex[Sub]Image2D slow when passing in a <canvas>, faster with ImageData.
https://bugs.webkit.org/show_bug.cgi?id=184843
<rdar://problem/34898868>

Patch by Justin Fan <justin_fan@apple.com> on 2018-04-26
Reviewed by Simon Fraser.

On certain test pages passing 2d canvas objects to gl.texSubImage2D, we spend significant time doing an alpha unpremultiplication in FormatConverter::convert on a single thread.
For now, I am introducing use of the Accelerate framework to do canvas alpha unpremultiplication, specifically for RGBA8 > RGBA8.
This improves this rendering path by a factor of ~4. The rest of FormatConverter could use similar improvements; filed https://bugs.webkit.org/show_bug.cgi?id=185064 for these.

* platform/graphics/FormatConverter.cpp:
(WebCore::FormatConverter::convert):

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

17 months agoREGRESSION (r231039): RunUnitTests step reports disabled tests as failures
ryanhaddad@apple.com [Fri, 27 Apr 2018 01:25:10 +0000 (01:25 +0000)]
REGRESSION (r231039): RunUnitTests step reports disabled tests as failures
https://bugs.webkit.org/show_bug.cgi?id=185061

Reviewed by Aakash Jain.

* BuildSlaveSupport/build.webkit.org-config/steps.py:
(RunUnitTests.countFailures): Return the difference between the total number of tests run and the number that passed.
* BuildSlaveSupport/build.webkit.org-config/steps_unittest.py: Add a test.

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

17 months agoImplement rendering support for the color-filter CSS property
simon.fraser@apple.com [Fri, 27 Apr 2018 00:10:48 +0000 (00:10 +0000)]
Implement rendering support for the color-filter CSS property
https://bugs.webkit.org/show_bug.cgi?id=185047
rdar://problem/39664967

Reviewed by Tim Horton.

Source/WebCore:

The color-filter property transforms CSS colors just before painting. To support this,
add to RenderStyle colorByApplyingColorFilter() and visitedDependentColorWithColorFilter().
At most calls sites that transform colors for rendering, replace calls to
visitedDependentColor() with visitedDependentColorWithColorFilter(). The few locations
that don't use visitedDependentColor() (e.g. for shadows) call colorByApplyingColorFilter().

Color transformation is implemented via a new virtual function on FilterOperation;
BasicColorMatrixFilterOperation overrides this to use a new ColorMatrix class to
do color math, and BasicComponentTransferFilterOperation to do the equivalent of component
transfer operations. The math in both cases matches that for SVG filters, with the exception
that color components are stored as floats through multiple filters and then mapped to
normal 0-255 color components at the end.

Tests: css3/color-filters/color-filter-backgrounds-borders.html
       css3/color-filters/color-filter-box-shadow.html
       css3/color-filters/color-filter-brightness.html
       css3/color-filters/color-filter-color-property-list-item.html
       css3/color-filters/color-filter-color-property.html
       css3/color-filters/color-filter-color-text-decorations.html
       css3/color-filters/color-filter-column-rule.html
       css3/color-filters/color-filter-contrast.html
       css3/color-filters/color-filter-current-color.html
       css3/color-filters/color-filter-filter-list.html
       css3/color-filters/color-filter-grayscale.html
       css3/color-filters/color-filter-hue-rotate.html
       css3/color-filters/color-filter-inherits.html
       css3/color-filters/color-filter-invert.html
       css3/color-filters/color-filter-opacity.html
       css3/color-filters/color-filter-outline.html
       css3/color-filters/color-filter-saturate.html
       css3/color-filters/color-filter-sepia.html
       css3/color-filters/color-filter-text-emphasis.html

* html/HTMLTextFormControlElement.cpp:
(WebCore::HTMLTextFormControlElement::adjustInnerTextStyle const):
* page/FrameView.cpp:
(WebCore::FrameView::documentBackgroundColor const):
* platform/graphics/ColorUtilities.cpp:
(WebCore::ColorMatrix::ColorMatrix):
(WebCore::ColorMatrix::makeIdentity):
(WebCore::ColorMatrix::grayscaleMatrix):
(WebCore::ColorMatrix::saturationMatrix):
(WebCore::ColorMatrix::hueRotateMatrix):
(WebCore::ColorMatrix::sepiaMatrix):
(WebCore::ColorMatrix::transformColorComponents const):
* platform/graphics/ColorUtilities.h:
* platform/graphics/filters/FilterOperation.cpp:
(WebCore::BasicColorMatrixFilterOperation::transformColor const):
(WebCore::BasicComponentTransferFilterOperation::transformColor const):
* platform/graphics/filters/FilterOperation.h:
(WebCore::FilterOperation::transformColor const):
* platform/graphics/filters/FilterOperations.cpp:
(WebCore::FilterOperations::transformColor const):
* platform/graphics/filters/FilterOperations.h:
* rendering/BorderEdge.cpp:
(WebCore::BorderEdge::getBorderEdgeInfo):
* rendering/EllipsisBox.cpp:
(WebCore::EllipsisBox::paint):
(WebCore::EllipsisBox::paintSelection):
* rendering/InlineFlowBox.cpp:
(WebCore::InlineFlowBox::paintBoxDecorations):
* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::paintMarkedTextForeground):
(WebCore::InlineTextBox::paintMarkedTextDecoration):
(WebCore::InlineTextBox::paintCompositionUnderline const):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::paintRootBoxFillLayers):
(WebCore::RenderBox::paintBackground):
(WebCore::RenderBox::getBackgroundPaintedExtent const):
(WebCore::RenderBox::backgroundIsKnownToBeOpaqueInRect const):
(WebCore::RenderBox::backgroundHasOpaqueTopLayer const):
* rendering/RenderBoxModelObject.cpp:
(WebCore::applyBoxShadowForBackground):
(WebCore::RenderBoxModelObject::paintFillLayerExtended):
(WebCore::RenderBoxModelObject::boxShadowShouldBeAppliedToBackground const):
(WebCore::RenderBoxModelObject::paintBoxShadow):
* rendering/RenderDetailsMarker.cpp:
(WebCore::RenderDetailsMarker::paint):
* rendering/RenderElement.cpp:
(WebCore::RenderElement::selectionColor const):
(WebCore::RenderElement::selectionBackgroundColor const):
(WebCore::RenderElement::paintFocusRing):
(WebCore::RenderElement::paintOutline):
* rendering/RenderFileUploadControl.cpp:
(WebCore::RenderFileUploadControl::paintObject):
* rendering/RenderFrameSet.cpp:
(WebCore::RenderFrameSet::paintColumnBorder):
(WebCore::RenderFrameSet::paintRowBorder):
* rendering/RenderImage.cpp:
(WebCore::RenderImage::paintReplaced):
(WebCore::RenderImage::paintAreaElementFocusRing):
* rendering/RenderInline.cpp:
(WebCore::RenderInline::paintOutline):
* rendering/RenderLayerBacking.cpp:
(WebCore::canDirectlyCompositeBackgroundBackgroundImage):
(WebCore::RenderLayerBacking::rendererBackgroundColor const):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::rootOrBodyStyleChanged):
* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::paintItemForeground):
(WebCore::RenderListBox::paintItemBackground):
* rendering/RenderListMarker.cpp:
(WebCore::RenderListMarker::paint):
* rendering/RenderMenuList.cpp:
(RenderMenuList::itemStyle const):
(RenderMenuList::getItemBackgroundColor const):
(RenderMenuList::menuStyle const):
* rendering/RenderMultiColumnSet.cpp:
(WebCore::RenderMultiColumnSet::paintColumnRules):
* rendering/RenderSearchField.cpp:
(WebCore::RenderSearchField::menuStyle const):
* rendering/RenderTable.h:
(WebCore::RenderTable::bgColor const):
* rendering/RenderTableCell.cpp:
(WebCore::RenderTableCell::computeCollapsedStartBorder const):
(WebCore::RenderTableCell::computeCollapsedEndBorder const):
(WebCore::RenderTableCell::computeCollapsedBeforeBorder const):
(WebCore::RenderTableCell::computeCollapsedAfterBorder const):
(WebCore::RenderTableCell::paintBackgroundsBehindCell):
* rendering/RenderTableSection.cpp:
(WebCore::RenderTableSection::paintRowGroupBorder):
* rendering/RenderTheme.cpp:
(WebCore::RenderTheme::paintSliderTicks):
* rendering/TextDecorationPainter.cpp:
(WebCore::decorationColor):
* rendering/TextPaintStyle.cpp:
(WebCore::computeTextPaintStyle):
* rendering/mathml/MathOperator.cpp:
(WebCore::MathOperator::paint):
* rendering/mathml/RenderMathMLFraction.cpp:
(WebCore::RenderMathMLFraction::paint):
* rendering/mathml/RenderMathMLMenclose.cpp:
(WebCore::RenderMathMLMenclose::paint):
* rendering/mathml/RenderMathMLRoot.cpp:
(WebCore::RenderMathMLRoot::paint):
* rendering/mathml/RenderMathMLToken.cpp:
(WebCore::RenderMathMLToken::paint):
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::visitedDependentColorWithColorFilter const):
(WebCore::RenderStyle::colorByApplyingColorFilter const):
* rendering/style/RenderStyle.h:

Source/WebKitLegacy/mac:

The body background should reflect the filtered color.

* WebView/WebFrame.mm:
(-[WebFrame _bodyBackgroundColor]):
* WebView/WebView.mm:
(-[WebView updateTextTouchBar]): No logic change, just cleanup.

LayoutTests:

Tests for color-filter rendering.

* css3/color-filters/color-filter-backgrounds-borders-expected.html: Added.
* css3/color-filters/color-filter-backgrounds-borders.html: Added.
* css3/color-filters/color-filter-box-shadow-expected.html: Added.
* css3/color-filters/color-filter-box-shadow.html: Added.
* css3/color-filters/color-filter-brightness-expected.html: Added.
* css3/color-filters/color-filter-brightness.html: Added.
* css3/color-filters/color-filter-color-property-expected.html: Added.
* css3/color-filters/color-filter-color-property-list-item-expected.html: Added.
* css3/color-filters/color-filter-color-property-list-item.html: Added.
* css3/color-filters/color-filter-color-property.html: Added.
* css3/color-filters/color-filter-color-text-decorations-expected.html: Added.
* css3/color-filters/color-filter-color-text-decorations.html: Added.
* css3/color-filters/color-filter-column-rule-expected.html: Added.
* css3/color-filters/color-filter-column-rule.html: Added.
* css3/color-filters/color-filter-contrast-expected.html: Added.
* css3/color-filters/color-filter-contrast.html: Added.
* css3/color-filters/color-filter-current-color-expected.html: Added.
* css3/color-filters/color-filter-current-color.html: Added.
* css3/color-filters/color-filter-filter-list-expected.html: Added.
* css3/color-filters/color-filter-filter-list.html: Added.
* css3/color-filters/color-filter-grayscale-expected.html: Added.
* css3/color-filters/color-filter-grayscale.html: Added.
* css3/color-filters/color-filter-hue-rotate-expected.html: Added.
* css3/color-filters/color-filter-hue-rotate.html: Added.
* css3/color-filters/color-filter-inherits-expected.html: Added.
* css3/color-filters/color-filter-inherits.html: Added.
* css3/color-filters/color-filter-invert-expected.html: Added.
* css3/color-filters/color-filter-invert.html: Added.
* css3/color-filters/color-filter-opacity-expected.html: Added.
* css3/color-filters/color-filter-opacity.html: Added.
* css3/color-filters/color-filter-outline-expected.html: Added.
* css3/color-filters/color-filter-outline.html: Added.
* css3/color-filters/color-filter-saturate-expected.html: Added.
* css3/color-filters/color-filter-saturate.html: Added.
* css3/color-filters/color-filter-sepia-expected.html: Added.
* css3/color-filters/color-filter-sepia.html: Added.
* css3/color-filters/color-filter-text-emphasis-expected.html: Added.
* css3/color-filters/color-filter-text-emphasis.html: Added.

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

17 months agoUnreviewed build fix; fix WebInspectorUI copy resources step after r231063.
jer.noble@apple.com [Thu, 26 Apr 2018 23:30:21 +0000 (23:30 +0000)]
Unreviewed build fix; fix WebInspectorUI copy resources step after r231063.

* Configurations/Base.xcconfig:

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

17 months agoAdd timeout for ensurePositionInformationIsUpToDate
megan_gardner@apple.com [Thu, 26 Apr 2018 23:27:19 +0000 (23:27 +0000)]
Add timeout for ensurePositionInformationIsUpToDate
https://bugs.webkit.org/show_bug.cgi?id=184567

Reviewed by Wenson Hsieh.

We are having long hang times for WebKit, and this is one of the culprits.
If we do not get an answer for positionInformation in a reasonable amount of time, we should timeout,
so as to not hang the UI.

* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView ensurePositionInformationIsUpToDate:]):

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

17 months agoGardening: Speculative build fix for Windows.
mark.lam@apple.com [Thu, 26 Apr 2018 22:59:04 +0000 (22:59 +0000)]
Gardening: Speculative build fix for Windows.
https://bugs.webkit.org/show_bug.cgi?id=184976
<rdar://problem/39723901>

Not reviewed.

Source/JavaScriptCore:

* runtime/JSCPtrTag.h:

Source/WebCore:

* cssjit/CSSPtrTag.h:

Source/WTF:

* wtf/PtrTag.h:
(WTF::makePtrTagHash): Undo last speculative build fix that did not work for 64-bit.

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

17 months agoShow punycode if URL contains Latin small letter o with dot below character
bfulgham@apple.com [Thu, 26 Apr 2018 22:50:55 +0000 (22:50 +0000)]
Show punycode if URL contains Latin small letter o with dot below character
https://bugs.webkit.org/show_bug.cgi?id=185051
<rdar://problem/39459297>

Reviewed by David Kilzer.

Source/WebCore:

Revise our "lookalike character" logic to include the small Latin o
with dot below character.

Test: fast/url/host.html

* platform/mac/WebCoreNSURLExtras.mm:
(WebCore::isLookalikeCharacter):

LayoutTests:

* fast/url/host-expected.txt:
* fast/url/host.html:

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

17 months agoGardening: Windows build fix.
mark.lam@apple.com [Thu, 26 Apr 2018 21:53:28 +0000 (21:53 +0000)]
Gardening: Windows build fix.

Not reviewed.

* runtime/Options.cpp:

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

17 months agoTry again to fix the iOS build after r231063.
aestes@apple.com [Thu, 26 Apr 2018 21:48:32 +0000 (21:48 +0000)]
Try again to fix the iOS build after r231063.

* Configurations/Base.xcconfig:

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

17 months ago[iOS] LayoutTest http/tests/quicklook/hide-referer-on-navigation.html is failing
commit-queue@webkit.org [Thu, 26 Apr 2018 21:41:39 +0000 (21:41 +0000)]
[iOS] LayoutTest http/tests/quicklook/hide-referer-on-navigation.html is failing
https://bugs.webkit.org/show_bug.cgi?id=184825
<rdar://problem/38924997>

Patch by Sihui Liu <sihui_liu@apple.com> on 2018-04-26
Reviewed by Geoffrey Garen.

Policy decisions are made asynchronously now, so we need to set the async flag of this test.

* http/tests/quicklook/hide-referer-on-navigation.html:

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

17 months agoWK_COCOA_TOUCH the WK_ACCESSIBILITY_LDFLAGS
jer.noble@apple.com [Thu, 26 Apr 2018 21:40:31 +0000 (21:40 +0000)]
WK_COCOA_TOUCH the WK_ACCESSIBILITY_LDFLAGS
https://bugs.webkit.org/show_bug.cgi?id=185007
<rdar://problem/39735943>

Reviewed by Timothy Hatcher.

* Configurations/WebKit.xcconfig:

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

17 months agoUnreviewed build fix; fix iOS TAPI build step after r231063.
jer.noble@apple.com [Thu, 26 Apr 2018 21:32:05 +0000 (21:32 +0000)]
Unreviewed build fix; fix iOS TAPI build step after r231063.

* Configurations/WebKit.xcconfig:

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

17 months agoAdd release bots for WinCairo.
ross.kirsling@sony.com [Thu, 26 Apr 2018 21:26:19 +0000 (21:26 +0000)]
Add release bots for WinCairo.
https://bugs.webkit.org/show_bug.cgi?id=185042

Reviewed by Lucas Forschler.

* BuildSlaveSupport/build.webkit.org-config/config.json:
Add a release build bot and two test bots, replacing the outdated WinCairo release bots.

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

17 months agoFix the build following r231068
dbates@webkit.org [Thu, 26 Apr 2018 20:50:16 +0000 (20:50 +0000)]
Fix the build following r231068
(https://bugs.webkit.org/show_bug.cgi?id=185002)

Substitute mainResourceRequest.resourceRequest().url() for mainResourceRequest.url() as the
latter does not exist.

* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::loadMainResource):

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

17 months agoDocumentLoader::loadMainResource() should WTFMove() the passed ResourceRequest
dbates@webkit.org [Thu, 26 Apr 2018 20:43:32 +0000 (20:43 +0000)]
DocumentLoader::loadMainResource() should WTFMove() the passed ResourceRequest
https://bugs.webkit.org/show_bug.cgi?id=185002

Reviewed by Youenn Fablet and Alex Christensen.

In r224852 we extracted logic from DocumentLoader::startLoadingMainResource() into a new
function DocumentLoader::loadMainResource() that could be shared by both DocumentLoader::startLoadingMainResource()
and the service worker code. As part of this extraction, DocumentLoader::loadMainResource()
takes a ResourceRequest by rvalue reference, but it never actually takes ownership of this
ResourceRequest and subsequently makes a copy of it when instantiating a CachedResourceRequest.
Instead we should WTFMove() the passed request into the CachedResourceRequest.

* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::loadMainResource):

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

17 months ago-[WKHTTPCookieStore deleteCookie:completionHandler:] doesn't delete cookies
commit-queue@webkit.org [Thu, 26 Apr 2018 20:39:47 +0000 (20:39 +0000)]
-[WKHTTPCookieStore deleteCookie:completionHandler:] doesn't delete cookies
https://bugs.webkit.org/show_bug.cgi?id=184938
<rdar://problem/34737395>

Patch by Sihui Liu <sihui_liu@apple.com> on 2018-04-26
Reviewed by Geoffrey Garen.

Source/WebCore:

When a Cookie object was converted to NSHTTPCookie object, the HTTPOnly property information
was lost so the delete function cannot find the proper cookie to delete.
This patch implements a workaround that compares Cookie object instead of NSHTTPCookie
object. We might want to add the ability to set HTTPOnly header during conversion if there
is an easy way to do it later.

New API test: WebKit.WKHTTPCookieStoreHttpOnly

* platform/network/cocoa/CookieCocoa.mm:
(WebCore::Cookie::operator== const):
* platform/network/cocoa/NetworkStorageSessionCocoa.mm:
(WebCore::NetworkStorageSession::deleteCookie):

Tools:

Add API test coverage.

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

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

17 months agoUnreviewed, rolling out r231052.
commit-queue@webkit.org [Thu, 26 Apr 2018 20:36:48 +0000 (20:36 +0000)]
Unreviewed, rolling out r231052.
https://bugs.webkit.org/show_bug.cgi?id=185044

Broke test http/tests/security/credentials-main-resource.html
(Requested by dydz on #webkit).

Reverted changeset:

"DocumentLoader::loadMainResource() should WTFMove() the
passed ResourceRequest"
https://bugs.webkit.org/show_bug.cgi?id=185002
https://trac.webkit.org/changeset/231052

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

17 months agoMark http/tests/workers/worker-importScripts-banned-mimetype.html as flaky.
ryanhaddad@apple.com [Thu, 26 Apr 2018 20:19:39 +0000 (20:19 +0000)]
Mark http/tests/workers/worker-importScripts-banned-mimetype.html as flaky.
https://bugs.webkit.org/show_bug.cgi?id=184800

Unreviewed test gardening.

* TestExpectations:

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

17 months agoWinCairo test bots should run JSC tests with options for Windows command prompt.
ross.kirsling@sony.com [Thu, 26 Apr 2018 19:19:57 +0000 (19:19 +0000)]
WinCairo test bots should run JSC tests with options for Windows command prompt.
https://bugs.webkit.org/show_bug.cgi?id=185019

Reviewed by Per Arne Vollan.

* BuildSlaveSupport/build.webkit.org-config/steps.py:
(RunJavaScriptCoreTests.start):

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

17 months agoWK_COCOA_TOUCH all the things.
jer.noble@apple.com [Thu, 26 Apr 2018 19:15:20 +0000 (19:15 +0000)]
WK_COCOA_TOUCH all the things.
https://bugs.webkit.org/show_bug.cgi?id=185006
Source/JavaScriptCore:

<rdar://problem/39736025>

Reviewed by Tim Horton.

* Configurations/Base.xcconfig:

Source/WebCore:

Reviewed by Tim Horton.

* Configurations/WebCore.xcconfig:

Source/WebCore/PAL:

Reviewed by Tim Horton.

* Configurations/PAL.xcconfig:

Source/WebInspectorUI:

Reviewed by Tim Horton.

* Configurations/WebInspectorUIFramework.xcconfig:

Source/WebKit:

Reviewed by Tim Horton.

* Configurations/BaseTarget.xcconfig:
* Configurations/WebKit.xcconfig:

Source/WebKitLegacy/mac:

Reviewed by Tim Horton.

* Configurations/WebKitLegacy.xcconfig:

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

17 months agoASSERTION FAILED: ASSERT(!containsImage || MIMETypeRegistry::isSupportedImageResource...
dbates@webkit.org [Thu, 26 Apr 2018 18:46:42 +0000 (18:46 +0000)]
ASSERTION FAILED: ASSERT(!containsImage || MIMETypeRegistry::isSupportedImageResourceMIMEType([resource MIMEType])) in -[NSPasteboard(WebExtras) _web_writePromisedRTFDFromArchive:containsImage:]
https://bugs.webkit.org/show_bug.cgi?id=184161
<rdar://problem/39051645>

Reviewed by Dan Bernstein.

.:

* ManualTests/DragInlinePDFImageDocument.html: Added.
* ManualTests/resources/simple.pdf: Added.

Source/WebKitLegacy/mac:

Fixes an assertion failure when quitting an app that uses a Legacy WebKit web view after dragging-and-
dropping a PDF embedded using an HTML image element into the same web view.

When performing a drag-and-drop of a PDF document image (WebCore::PDFDocumentImage) we create a WebArchive
from the main frame's WebHTMLView and promise AppKit that we will provide a Rich Text Format (RTF) document
from this archive if needed. For some reason, on app termination AppKit requests that the WebHTMLView
fulfill its RTF document promise for the WebArchive created at the start of the drag operation. To do this,
we need to extract the image resource from the Web Archive. Currently we query MIMETypeRegistry::isSupportedImageResourceMIMEType()
to see if the contained image is one that we can handle. However MIMETypeRegistry::isSupportedImageResourceMIMEType()
only returns true if WebKit supports creating an image document for the specified MIME type. Disregarding
the iOS motivated setting Settings::useImageDocumentForSubframePDF, PDFs and PostScripts do not create an
image document when navigated to directly. Since we can support dragging PDF document images we need to
query if MIMETypeRegistry::isPDFOrPostScriptMIMEType() in addition to querying MIMETypeRegistry::isSupportedImageResourceMIMEType().
We need to do both such queries before falling back to using the main resource of the Web Archive as
the image. Otherwise, we will cause an assertion failure if the main resource of the Web Archive is
not an image document.

* Misc/WebNSPasteboardExtras.mm:
(-[NSPasteboard _web_writePromisedRTFDFromArchive:containsImage:]):

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

17 months agoRemove WebCore::-qualifier in NetworkLoadChecker.cpp
dbates@webkit.org [Thu, 26 Apr 2018 18:42:01 +0000 (18:42 +0000)]
Remove WebCore::-qualifier in NetworkLoadChecker.cpp
https://bugs.webkit.org/show_bug.cgi?id=185037

Reviewed by Youenn Fablet.

It is unncesssary to qualify WebCore types in NetworkLoadChecker.cpp as it has a
"using namespace WebCore" directive.

* NetworkProcess/NetworkLoadChecker.cpp:
(WebKit::NetworkLoadChecker::NetworkLoadChecker):
(WebKit::NetworkLoadChecker::checkRedirection):
(WebKit::NetworkLoadChecker::validateResponse):
(WebKit::NetworkLoadChecker::continueCheckingRequest): Removed extra space character and unnecessary
parentheses from the right-hand side of the assignment to m_storedCredentialsPolicy.
(WebKit::NetworkLoadChecker::processContentExtensionRulesForLoad):

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

17 months agoRename NetworkLoadChecker::returnError() to NetworkLoadChecker::accessControlErrorFor...
dbates@webkit.org [Thu, 26 Apr 2018 18:29:25 +0000 (18:29 +0000)]
Rename NetworkLoadChecker::returnError() to NetworkLoadChecker::accessControlErrorForValidationHandler()
https://bugs.webkit.org/show_bug.cgi?id=185035

Reviewed by Youenn Fablet.

Substitute NetworkLoadChecker::accessControlErrorForValidationHandler() for NetworkLoadChecker::returnError()
to better describe that it is a convenience function that returns a wrapped ResourceError object,
that represents an access control error, suitable to be passed directly to a validation handler.

* NetworkProcess/NetworkLoadChecker.cpp:
(WebKit::NetworkLoadChecker::checkRedirection): Update as needed for renaming.
(WebKit::NetworkLoadChecker::accessControlErrorForValidationHandler): Use auto -> syntax to avoid the need to
class-qualify the return type. Also renamed parameter from error to message as it represents the message/description
for the access control error.
(WebKit::NetworkLoadChecker::checkRequest): Update as needed for renaming. Also substitute "message" for "error"
to match the argument of accessControlErrorForValidationHandler() with the same name.
(WebKit::NetworkLoadChecker::continueCheckingRequest): Update as needed for renaming.
(WebKit::NetworkLoadChecker::returnError): Deleted; renamed to accessControlErrorForValidationHandler().
* NetworkProcess/NetworkLoadChecker.h:

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

17 months agoMake WAKScrollView delegate a weak property
ddkilzer@apple.com [Thu, 26 Apr 2018 18:22:03 +0000 (18:22 +0000)]
Make WAKScrollView delegate a weak property
<https://webkit.org/b/184799>
<rdar://problem/39469669>

Reviewed by Simon Fraser.

* platform/ios/wak/WAKScrollView.h:
- Remove `delegate` instance variable declaration.
- Declare `delegate` property as weak.
(-[WAKScrollView setDelegate:]): Delete declaration.
(-[WAKScrollView delegate]): Ditto.
* platform/ios/wak/WAKScrollView.mm:
- Synthesize getter/setter methods for `delegate` property.
(-[WAKScrollView setDelegate:]): Delete implementation.
(-[WAKScrollView delegate]): Ditto.

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

17 months agoRemove access to keychain from the WebContent process
jiewen_tan@apple.com [Thu, 26 Apr 2018 18:20:50 +0000 (18:20 +0000)]
Remove access to keychain from the WebContent process
https://bugs.webkit.org/show_bug.cgi?id=184428
<rdar://problem/13150903>

Part 3.

Tighten WebContent Process' sandbox profile to all Security.framework services.

Reviewed by Brent Fulgham.

* WebProcess/com.apple.WebProcess.sb.in:

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

17 months agoLayoutTests/imported/w3c:
youenn@apple.com [Thu, 26 Apr 2018 18:17:55 +0000 (18:17 +0000)]
LayoutTests/imported/w3c:
preflight checker should add a console message when preflight load is blocked
https://bugs.webkit.org/show_bug.cgi?id=185021

Reviewed by Chris Dumez.

* web-platform-tests/XMLHttpRequest/send-authentication-basic-cors-expected.txt:
* web-platform-tests/cors/late-upload-events-expected.txt:

Source/WebCore:
CORS preflight checker should add a console message when preflight load is blocked
https://bugs.webkit.org/show_bug.cgi?id=185021

Reviewed by Chris Dumez.

No change of behavior, adding a JS console message when preflight load is blocked.
This mirrors what is being done in preflighting done from NetworkProcess.
Covered by existing tests.

* loader/CrossOriginPreflightChecker.cpp:
(WebCore::CrossOriginPreflightChecker::notifyFinished):
(WebCore::CrossOriginPreflightChecker::doPreflight):

LayoutTests:
CORS preflight checker should add a console message when preflight load is blocked
https://bugs.webkit.org/show_bug.cgi?id=185021

Reviewed by Chris Dumez.

* TestExpectations: Skipping console JS logging for some WPT tests to keep them consistent between WK1 and WK2.
* http/tests/xmlhttprequest/redirect-cross-origin-post-expected.txt:
* http/tests/xmlhttprequest/simple-cross-origin-denied-events-post-expected.txt:
* platform/mac-wk1/imported/w3c/web-platform-tests/XMLHttpRequest/send-authentication-cors-basic-setrequestheader-expected.txt: Removed.
* platform/mac-wk1/imported/w3c/web-platform-tests/XMLHttpRequest/send-authentication-cors-setrequestheader-no-cred-expected.txt: Removed.
* platform/mac-wk1/imported/w3c/web-platform-tests/cors/request-headers-expected.txt: Removed.
* platform/win/imported/w3c/web-platform-tests/XMLHttpRequest/send-authentication-cors-basic-setrequestheader-expected.txt: Removed.
* platform/win/imported/w3c/web-platform-tests/XMLHttpRequest/send-authentication-cors-setrequestheader-no-cred-expected.txt: Removed.
* platform/win/imported/w3c/web-platform-tests/cors/request-headers-expected.txt: Removed.

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

17 months agoLayoutTests/imported/w3c:
youenn@apple.com [Thu, 26 Apr 2018 18:16:55 +0000 (18:16 +0000)]
LayoutTests/imported/w3c:
Mak cross origin redirection error messages consistent between SubresourceLoader and NetworkLoadChecker
https://bugs.webkit.org/show_bug.cgi?id=185023

Reviewed by Chris Dumez.

Fix message cross origin check failed in case of redirection

* web-platform-tests/service-workers/service-worker/fetch-request-fallback.https-expected.txt:

Source/WebKit:
Make cross origin redirection error messages consistent between SubresourceLoader and NetworkLoadChecker
https://bugs.webkit.org/show_bug.cgi?id=185023

Reviewed by Chris Dumez.

Align NetworkLoadChecker with what SubresourceLoader is doing so that we can keep WK1 and WK2 error messages as consistent as possible.

* NetworkProcess/NetworkLoadChecker.cpp:
(WebKit::NetworkLoadChecker::checkRedirection):
(WebKit::NetworkLoadChecker::validateResponse):

LayoutTests:
Make cross origin redirection error messages consistent between SubresourceLoader and NetworkLoadChecker
https://bugs.webkit.org/show_bug.cgi?id=185023

Reviewed by Chris Dumez.

* http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-redirect-expected.txt:
* http/tests/security/shape-image-cors-redirect-error-message-logging-1-expected.txt:
* http/tests/security/shape-image-cors-redirect-error-message-logging-2-expected.txt:
* platform/mac-wk1/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-redirect-expected.txt: Removed.
* platform/mac-wk1/http/tests/security/shape-image-cors-redirect-error-message-logging-1-expected.txt: Removed.
* platform/mac-wk1/http/tests/security/shape-image-cors-redirect-error-message-logging-2-expected.txt: Removed.
* platform/win/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-redirect-expected.txt: Removed.
* platform/win/http/tests/security/shape-image-cors-redirect-error-message-logging-1-expected.txt: Removed.
* platform/win/http/tests/security/shape-image-cors-redirect-error-message-logging-2-expected.txt: Removed.

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

17 months agoActivate selection when interacting with editable content
megan_gardner@apple.com [Thu, 26 Apr 2018 18:05:20 +0000 (18:05 +0000)]
Activate selection when interacting with editable content
https://bugs.webkit.org/show_bug.cgi?id=185017

Reviewed by Tim Horton.

Source/WebKit:

Fixes a regression from r231016 where selection now does not work when interacting with
editable content. When we go into editable content, we should turn on the assistant.
This fulfills the requirement of user interaction as well, so any javascript selections
after this point should be valid.

* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _startAssistingKeyboard]):
(-[WKContentView _stopAssistingKeyboard]):

LayoutTests:

Fixed double-tap-on-editable-and-noneditable test, as it was not actually written correctly.
Should actually double tap on correct content and check for the correct output now.
Added two more tests to make sure that selections really are happening in editable content.

* fast/events/touch/ios/double-tap-on-editable-and-noneditable.html:
* fast/events/touch/ios/double-tap-on-editable-content-for-selection-expected.txt: Added.
* fast/events/touch/ios/double-tap-on-editable-content-for-selection-then-drag-right-to-change-selected-text-expected.txt: Added.
* fast/events/touch/ios/double-tap-on-editable-content-for-selection-then-drag-right-to-change-selected-text.html: Added.
* fast/events/touch/ios/double-tap-on-editable-content-for-selection.html: Added.

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

17 months agoWinCairo WKL Debug Test bot is not using DRT.
ross.kirsling@sony.com [Thu, 26 Apr 2018 17:54:42 +0000 (17:54 +0000)]
WinCairo WKL Debug Test bot is not using DRT.
https://bugs.webkit.org/show_bug.cgi?id=185009

Reviewed by Per Arne Vollan.

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

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

17 months agoDocumentLoader::loadMainResource() should WTFMove() the passed ResourceRequest
dbates@webkit.org [Thu, 26 Apr 2018 17:46:32 +0000 (17:46 +0000)]
DocumentLoader::loadMainResource() should WTFMove() the passed ResourceRequest
https://bugs.webkit.org/show_bug.cgi?id=185002

Reviewed by Youenn Fablet and Alex Christensen.

In r224852 we extracted logic from DocumentLoader::startLoadingMainResource() into a new
function DocumentLoader::loadMainResource() that could be shared by both DocumentLoader::startLoadingMainResource()
and the service worker code. As part of this extraction, DocumentLoader::loadMainResource()
takes a ResourceRequest by rvalue reference, but it never actually takes ownership of this
ResourceRequest and subsequently makes a copy of it when instantiating a CachedResourceRequest.
Instead we should WTFMove() the passed request into the CachedResourceRequest.

* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::loadMainResource):

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

17 months agoDisable content filtering in minimal simulator mode
pvollan@apple.com [Thu, 26 Apr 2018 17:29:16 +0000 (17:29 +0000)]
Disable content filtering in minimal simulator mode
https://bugs.webkit.org/show_bug.cgi?id=185027
<rdar://problem/39736091>

Reviewed by Jer Noble.

Source/JavaScriptCore:

* Configurations/FeatureDefines.xcconfig:

Source/WebCore:

* Configurations/FeatureDefines.xcconfig:

Source/WebCore/PAL:

* Configurations/FeatureDefines.xcconfig:

Source/WebKit:

* Configurations/FeatureDefines.xcconfig:

Source/WebKitLegacy/mac:

* Configurations/FeatureDefines.xcconfig:

Tools:

* TestWebKitAPI/Configurations/FeatureDefines.xcconfig:

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

17 months agoAdd port 548 (afpovertcp) to port blacklist
bfulgham@apple.com [Thu, 26 Apr 2018 17:12:46 +0000 (17:12 +0000)]
Add port 548 (afpovertcp) to port blacklist
https://bugs.webkit.org/show_bug.cgi?id=185000
<rdar://problem/39540481>

Reviewed by David Kilzer.

Source/WebCore:

Tested by security/block-test.html.

* platform/URL.cpp:
(WebCore::portAllowed):Also block port 548.

LayoutTests:

Update test and expectations for new port.

* platform/gtk/security/block-test-expected.txt:
* platform/mac/security/block-test-expected.txt:
* platform/wpe/security/block-test-expected.txt:
* security/block-test-expected.txt:
* security/block-test.html:

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

17 months ago[WPE] Gardening of tests for the WPE Debug bot.
clopez@igalia.com [Thu, 26 Apr 2018 16:48:45 +0000 (16:48 +0000)]
[WPE] Gardening of tests for the WPE Debug bot.

Mark tests timing out.
An attempt to make the new WPE debug bot not abort early.

* platform/gtk/TestExpectations: workers/bomb.html for debug was skipped in the root expectations file,
  but we were overriding it to simply "slow" here because we missed the tag for release.
  Let's put both expectations together to make this clearer.
* platform/wpe/TestExpectations: Ditto.

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

17 months agoAdd a setting for keeping around all processes and always reusing them per-origin.
beidson@apple.com [Thu, 26 Apr 2018 16:39:21 +0000 (16:39 +0000)]
Add a setting for keeping around all processes and always reusing them per-origin.
<rdar://problem/39695798> and https://bugs.webkit.org/show_bug.cgi?id=185020

Reviewed by Andy Estes.

Source/WebKit:

* UIProcess/API/APIProcessPoolConfiguration.cpp:
(API::ProcessPoolConfiguration::copy):
* UIProcess/API/APIProcessPoolConfiguration.h:

* UIProcess/API/C/WKContextConfigurationRef.cpp:
(WKContextConfigurationAlwaysKeepAndReuseSwappedProcesses):
(WKContextConfigurationSetAlwaysKeepAndReuseSwappedProcesses):
* UIProcess/API/C/WKContextConfigurationRef.h:

* UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
* UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
(-[_WKProcessPoolConfiguration setAlwaysKeepAndReuseSwappedProcesses:]):
(-[_WKProcessPoolConfiguration alwaysKeepAndReuseSwappedProcesses]):

* UIProcess/SuspendedPageProxy.cpp:
(WebKit::SuspendedPageProxy::webProcessDidClose):
(WebKit::SuspendedPageProxy::destroyWebPageInWebProcess):
* UIProcess/SuspendedPageProxy.h:

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::suspendedPageClosed):
(WebKit::WebPageProxy::suspendedPageProcessClosed): Deleted.
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::suspendedPage const):

* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::shouldTerminate):
(WebKit::WebProcessPool::disconnectProcess):
(WebKit::WebProcessPool::addProcessToOriginCacheSet):
(WebKit::WebProcessPool::removeProcessFromOriginCacheSet):
(WebKit::WebProcessPool::processForNavigation): If a swap will occur, cache the old process.
(WebKit::WebProcessPool::processForNavigationInternal): Consider re-using a previously cached process.
* UIProcess/WebProcessPool.h:

* WebProcess/WebPage/WebPage.cpp:
(WebKit::m_credentialsMessenger):

Tools:

* TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:

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

17 months ago[INTL] Implement Intl.PluralRules
commit-queue@webkit.org [Thu, 26 Apr 2018 16:37:26 +0000 (16:37 +0000)]
[INTL] Implement Intl.PluralRules
https://bugs.webkit.org/show_bug.cgi?id=184312

Patch by Andy VanWagoner <thetalecrafter@gmail.com> on 2018-04-26
Reviewed by JF Bastien.

.:

Added Intl.PluralRules feature flag.

* Source/cmake/WebKitFeatures.cmake:

Source/JavaScriptCore:

Use UNumberFormat to enforce formatting, and then UPluralRules to find
the correct plural rule for the given number. Relies on ICU v59+ for
resolvedOptions().pluralCategories and trailing 0 detection.
Behind the useIntlPluralRules option and INTL_PLURAL_RULES flag.

* CMakeLists.txt:
* Configurations/FeatureDefines.xcconfig:
* DerivedSources.make:
* JavaScriptCore.xcodeproj/project.pbxproj:
* Sources.txt:
* builtins/BuiltinNames.h:
* runtime/BigIntObject.cpp:
(JSC::BigIntObject::create): Moved to ensure complete JSGlobalObject definition.
* runtime/BigIntObject.h:
* runtime/CommonIdentifiers.h:
* runtime/IntlObject.cpp:
(JSC::IntlObject::finishCreation):
* runtime/IntlObject.h:
* runtime/IntlPluralRules.cpp: Added.
(JSC::IntlPluralRules::UPluralRulesDeleter::operator() const):
(JSC::IntlPluralRules::UNumberFormatDeleter::operator() const):
(JSC::UEnumerationDeleter::operator() const):
(JSC::IntlPluralRules::create):
(JSC::IntlPluralRules::createStructure):
(JSC::IntlPluralRules::IntlPluralRules):
(JSC::IntlPluralRules::finishCreation):
(JSC::IntlPluralRules::destroy):
(JSC::IntlPluralRules::visitChildren):
(JSC::IntlPRInternal::localeData):
(JSC::IntlPluralRules::initializePluralRules):
(JSC::IntlPluralRules::resolvedOptions):
(JSC::IntlPluralRules::select):
* runtime/IntlPluralRules.h: Added.
* runtime/IntlPluralRulesConstructor.cpp: Added.
(JSC::IntlPluralRulesConstructor::create):
(JSC::IntlPluralRulesConstructor::createStructure):
(JSC::IntlPluralRulesConstructor::IntlPluralRulesConstructor):
(JSC::IntlPluralRulesConstructor::finishCreation):
(JSC::constructIntlPluralRules):
(JSC::callIntlPluralRules):
(JSC::IntlPluralRulesConstructorFuncSupportedLocalesOf):
(JSC::IntlPluralRulesConstructor::visitChildren):
* runtime/IntlPluralRulesConstructor.h: Added.
* runtime/IntlPluralRulesPrototype.cpp: Added.
(JSC::IntlPluralRulesPrototype::create):
(JSC::IntlPluralRulesPrototype::createStructure):
(JSC::IntlPluralRulesPrototype::IntlPluralRulesPrototype):
(JSC::IntlPluralRulesPrototype::finishCreation):
(JSC::IntlPluralRulesPrototypeFuncSelect):
(JSC::IntlPluralRulesPrototypeFuncResolvedOptions):
* runtime/IntlPluralRulesPrototype.h: Added.
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::init):
(JSC::JSGlobalObject::intlPluralRulesAvailableLocales):
* runtime/JSGlobalObject.h:
* runtime/Options.h:
* runtime/RegExpPrototype.cpp: Added inlines header.
* runtime/VM.cpp:
(JSC::VM::VM):
* runtime/VM.h:

Source/WebCore:

Added Intl.PluralRules feature flag.

Test: js/intl-pluralrules.html

* Configurations/FeatureDefines.xcconfig:

Source/WebCore/PAL:

Added Intl.PluralRules feature flag.

* Configurations/FeatureDefines.xcconfig:

Source/WebKit:

Added Intl.PluralRules feature flag.

* Configurations/FeatureDefines.xcconfig:

Source/WebKitLegacy/mac:

Added Intl.PluralRules feature flag.

* Configurations/FeatureDefines.xcconfig:

Source/WTF:

Added Intl.PluralRules feature flag.

* wtf/FeatureDefines.h:

Tools:

Added Intl.PluralRules feature flag.

* Scripts/webkitperl/FeatureList.pm:
* TestWebKitAPI/Configurations/FeatureDefines.xcconfig:

LayoutTests:

* js/intl-pluralrules-expected.txt: Added.
* js/intl-pluralrules.html: Added.
* js/script-tests/intl-pluralrules.js: Added.
* platform/win/TestExpectations: Disabled Intl.PluralRules tests on win.

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

17 months ago[Cocoa] Adopt CCRSAGetCRTComponents and stop using CCBigNum
darin@apple.com [Thu, 26 Apr 2018 16:14:37 +0000 (16:14 +0000)]
[Cocoa] Adopt CCRSAGetCRTComponents and stop using CCBigNum
https://bugs.webkit.org/show_bug.cgi?id=184637

Reviewed by Alexey Proskuryakov.

* crypto/CommonCryptoUtilities.cpp: Compile out WebCore::CCBigNum class if
HAVE(CCRSAGetCRTComponents) is true.

* crypto/CommonCryptoUtilities.h: Define HAVE(CCRSAGetCRTComponents) on new
enough versions of iOS and macOS that have it and add declarations of the
function for the non-Apple-internal-SDK case. Also don't define the
WebCore::CCBigNum class if HAVE(CCRSAGetCRTComponents) is true.

* crypto/mac/CryptoKeyRSAMac.cpp:
(WebCore::getPrivateKeyComponents): Use CCRSAGetCRTComponents if present.

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

17 months agoAdd lazy initialization of caption display mode for videos.
pvollan@apple.com [Thu, 26 Apr 2018 15:04:16 +0000 (15:04 +0000)]
Add lazy initialization of caption display mode for videos.
https://bugs.webkit.org/show_bug.cgi?id=184993

The call to MACaptionAppearanceGetDisplayType in CaptionUserPreferencesMediaAF::captionDisplayMode()
is showing up in samples when called from HTMLMediaElement::finishInitialization().

Reviewed by Eric Carlson.

No new tests, covered by existing tests.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::finishInitialization):
(WebCore::HTMLMediaElement::setSelectedTextTrack):
(WebCore::HTMLMediaElement::mediaPlayerCharacteristicChanged):
(WebCore::HTMLMediaElement::captionPreferencesChanged):
(WebCore::HTMLMediaElement::captionDisplayMode):
* html/HTMLMediaElement.h:

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

17 months ago[MIPS] Fix branch offsets in branchNeg32
commit-queue@webkit.org [Thu, 26 Apr 2018 12:04:22 +0000 (12:04 +0000)]
[MIPS] Fix branch offsets in branchNeg32
https://bugs.webkit.org/show_bug.cgi?id=185025

Patch by Dominik Infuehr <dinfuehr@igalia.com> on 2018-04-26
Reviewed by Yusuke Suzuki.

Two nops were removed in branch(Not)Equal in #183130 but the offset wasn't adjusted.

* assembler/MacroAssemblerMIPS.h:
(JSC::MacroAssemblerMIPS::branchNeg32):

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

17 months ago[GTK][WPE] Initial ASYNC_SCROLLING support
zandobersek@gmail.com [Thu, 26 Apr 2018 07:54:19 +0000 (07:54 +0000)]
[GTK][WPE] Initial ASYNC_SCROLLING support
https://bugs.webkit.org/show_bug.cgi?id=184961

Reviewed by Carlos Garcia Campos.

.:

* Source/cmake/OptionsGTK.cmake: Enable ASYNC_SCROLLING as a private option.
* Source/cmake/OptionsWPE.cmake: Ditto.

Source/WebCore:

Add CoordinatedGraphics-specific code that will be required for async
scrolling support. The ScrollingCoordinatorCoordinatedGraphics and
ScrollingTreeCoordinatedGraphics classes are mostly complete already,
but the new ScrollingTreeNode-inheriting classes will need further
work that will have to be done in parallel with other improvements
planned for the CoordinatedGraphics subsystem.

While the build-time flag is enabled, the feature is still not enabled
at runtime due to being marked as unsupported by the DrawingArea
implementation in the WebKit layer. It would also not work yet if it
were enabled due to the before-mentioned pending changes.

Various build fixes that address non-Cocoa usage of ASYNC_SCROLLING
code are included.

* Sources.txt: Add AsyncScrollingCoordinator.cpp to build.
* SourcesCocoa.txt:
* SourcesGTK.txt: Add new files to build.
* SourcesWPE.txt: Ditto.
* page/scrolling/AsyncScrollingCoordinator.cpp:
Guard setStateScrollingNodeSnapOffsetsAsFloat() with CSS_SCROLL_SNAP.
* page/scrolling/ScrollingTree.h:
* page/scrolling/ThreadedScrollingTree.cpp:
* page/scrolling/ThreadedScrollingTree.h:
currentSnapPointIndicesDidChange() method is only invoked in
Cocoa-specific code, and its implementation calls Cocoa-specific method
on the AsyncScrollingCoordinator class.
* page/scrolling/coordinatedgraphics/ScrollingCoordinatorCoordinatedGraphics.cpp:
(WebCore::ScrollingCoordinator::create):
(WebCore::ScrollingCoordinatorCoordinatedGraphics::ScrollingCoordinatorCoordinatedGraphics):
(WebCore::ScrollingCoordinatorCoordinatedGraphics::~ScrollingCoordinatorCoordinatedGraphics):
(WebCore::ScrollingCoordinatorCoordinatedGraphics::pageDestroyed):
(WebCore::ScrollingCoordinatorCoordinatedGraphics::commitTreeStateIfNeeded):
(WebCore::ScrollingCoordinatorCoordinatedGraphics::handleWheelEvent):
(WebCore::ScrollingCoordinatorCoordinatedGraphics::scheduleTreeStateCommit):
(WebCore::ScrollingCoordinatorCoordinatedGraphics::commitTreeState):
* page/scrolling/coordinatedgraphics/ScrollingCoordinatorCoordinatedGraphics.h: Added.
* page/scrolling/coordinatedgraphics/ScrollingTreeCoordinatedGraphics.cpp: Added.
(WebCore::ScrollingTreeCoordinatedGraphics::create):
(WebCore::ScrollingTreeCoordinatedGraphics::ScrollingTreeCoordinatedGraphics):
(WebCore::ScrollingTreeCoordinatedGraphics::createScrollingTreeNode):
* page/scrolling/coordinatedgraphics/ScrollingTreeCoordinatedGraphics.h: Added.
* page/scrolling/coordinatedgraphics/ScrollingTreeFixedNode.cpp: Added.
(WebCore::ScrollingTreeFixedNode::create):
(WebCore::ScrollingTreeFixedNode::ScrollingTreeFixedNode):
(WebCore::ScrollingTreeFixedNode::~ScrollingTreeFixedNode):
(WebCore::ScrollingTreeFixedNode::commitStateBeforeChildren):
(WebCore::ScrollingTreeFixedNode::updateLayersAfterAncestorChange):
* page/scrolling/coordinatedgraphics/ScrollingTreeFixedNode.h: Added.
* page/scrolling/coordinatedgraphics/ScrollingTreeFrameScrollingNodeCoordinatedGraphics.cpp: Added.
(WebCore::ScrollingTreeFrameScrollingNodeCoordinatedGraphics::create):
(WebCore::ScrollingTreeFrameScrollingNodeCoordinatedGraphics::ScrollingTreeFrameScrollingNodeCoordinatedGraphics):
(WebCore::ScrollingTreeFrameScrollingNodeCoordinatedGraphics::handleWheelEvent):
(WebCore::ScrollingTreeFrameScrollingNodeCoordinatedGraphics::scrollPosition const):
(WebCore::ScrollingTreeFrameScrollingNodeCoordinatedGraphics::setScrollPosition):
(WebCore::ScrollingTreeFrameScrollingNodeCoordinatedGraphics::setScrollPositionWithoutContentEdgeConstraints):
(WebCore::ScrollingTreeFrameScrollingNodeCoordinatedGraphics::setScrollLayerPosition):
(WebCore::ScrollingTreeFrameScrollingNodeCoordinatedGraphics::updateLayersAfterViewportChange):
* page/scrolling/coordinatedgraphics/ScrollingTreeFrameScrollingNodeCoordinatedGraphics.h: Added.
* page/scrolling/coordinatedgraphics/ScrollingTreeStickyNode.cpp: Added.
(WebCore::ScrollingTreeStickyNode::create):
(WebCore::ScrollingTreeStickyNode::ScrollingTreeStickyNode):
(WebCore::ScrollingTreeStickyNode::~ScrollingTreeStickyNode):
(WebCore::ScrollingTreeStickyNode::commitStateBeforeChildren):
(WebCore::ScrollingTreeStickyNode::updateLayersAfterAncestorChange):
* page/scrolling/coordinatedgraphics/ScrollingTreeStickyNode.h: Added.
* platform/PlatformWheelEvent.h: Enable PlatformWheelEventPhase code
for WPE. Guard latching-specific methods under ASYNC_SCROLLING.
* platform/TextureMapper.cmake: Two build targets have been moved to
SourcesGTK.txt and SourcesWPE.txt.

Source/WebKit:

Guard RemoteScrollingCoordinator and RemoteScrollingCoordinatorProxy
usage in WebChromeClient and WebPageProxy, respectively, with
PLATFORM(COCOA) in addition to the ASYNC_SCROLLING guards.

Despite enabling the code at build-time, the feature (as intended) is
not yet used because of the DrawingArea rejection in the WebPage
constructor.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::initializeWebPage):
(WebKit::WebPageProxy::handleWheelEvent):
(WebKit::WebPageProxy::updateTouchEventTracking):
* UIProcess/WebPageProxy.h:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::createScrollingCoordinator const):

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

17 months ago[WPE] Build and link against latest WPEBackend and WPEBackend-fdo
mcatanzaro@igalia.com [Thu, 26 Apr 2018 06:40:04 +0000 (06:40 +0000)]
[WPE] Build and link against latest WPEBackend and WPEBackend-fdo
https://bugs.webkit.org/show_bug.cgi?id=184643

Reviewed by Žan Doberšek.

.:

Update find modules to include the API versions.

* Source/cmake/FindWPEBackend-fdo.cmake:
* Source/cmake/FindWPEBackend.cmake:

Source/WebCore:

Adapt to single-header WPE includes.

* platform/graphics/egl/GLContextEGLWPE.cpp:
* platform/graphics/wpe/PlatformDisplayWPE.cpp:
* platform/wpe/PlatformPasteboardWPE.cpp:

Source/WebKit:

Adapt to single-header WPE includes.

Null-initialize padding to silence -Wmissing-field-initializers. (Yuck.)

* Shared/NativeWebTouchEvent.h:
* Shared/wpe/WebEventFactory.cpp:
* UIProcess/API/glib/WebKitPrivate.cpp:
* UIProcess/API/wpe/CompositingManagerProxy.cpp:
* UIProcess/API/wpe/ScrollGestureController.h:
* UIProcess/API/wpe/WPEView.cpp:
(WKWPE::m_backend):
* UIProcess/API/wpe/WebKitWebViewBackend.h:
* UIProcess/Launcher/glib/ProcessLauncherGLib.cpp:
* WebProcess/WebPage/wpe/AcceleratedSurfaceWPE.cpp:
(WebKit::AcceleratedSurfaceWPE::initialize):

Tools:

Add missing INCLUDE_DIRS in many places.

Adapt to single-header WPE includes.

Null-initialize padding to silence -Wmissing-field-initializers. (Yuck.)

* TestWebKitAPI/PlatformWPE.cmake:
* TestWebKitAPI/Tests/WebKitGLib/TestWebKitWebView.cpp:
(testWebViewWebBackend):
* TestWebKitAPI/glib/PlatformWPE.cmake:
* WebKitTestRunner/EventSenderProxy.h:
* WebKitTestRunner/PlatformWPE.cmake:
* WebKitTestRunner/wpe/EventSenderProxyWPE.cpp:
* wpe/HeadlessViewBackend/CMakeLists.txt:
* wpe/HeadlessViewBackend/HeadlessViewBackend.cpp:
* wpe/HeadlessViewBackend/HeadlessViewBackend.h:
* wpe/jhbuild.modules:

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

17 months agodlopen the bundle's executable before calling -[NSBundle load] since that will also...
sbarati@apple.com [Thu, 26 Apr 2018 03:33:58 +0000 (03:33 +0000)]
dlopen the bundle's executable before calling -[NSBundle load] since that will also do a bunch of other things we don't need
https://bugs.webkit.org/show_bug.cgi?id=184904

Reviewed by Geoffrey Garen.

Loading an NSBundle does a lot of work to find the principal class inside
the bundle. This means it walks all the objective C class names loaded
by the bundle. Doing this is *really* expensive.

Some users of the injected bundle define a WKBundleInitialize function.
In such a case, we don't need the principal class, so we can skip loading
the NSBundle. Now, before we load the bundle, we dlopen and dlsym looking
for the WKBundleInitialize function. If we find it, we skip loading
the bundle. If we don't find the WKBundleInitialize function, we fall
back to loading the bundle and finding the principal class.

This speeds up initializeWebProcess by ~70ms on my MBP.

* WebProcess/InjectedBundle/mac/InjectedBundleMac.mm:
(WebKit::InjectedBundle::initialize):

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

17 months agoUse NetworkLoadChecker for all subresource loads except fetch/XHR
youenn@apple.com [Thu, 26 Apr 2018 03:21:55 +0000 (03:21 +0000)]
Use NetworkLoadChecker for all subresource loads except fetch/XHR
https://bugs.webkit.org/show_bug.cgi?id=184870
<rdar://problem/39370034>

Reviewed by Chris Dumez.

LayoutTests/imported/w3c:

* web-platform-tests/fetch/api/basic/mode-same-origin.any-expected.txt:
* web-platform-tests/fetch/api/basic/mode-same-origin.any.worker-expected.txt:
* web-platform-tests/fetch/api/redirect/redirect-to-dataurl-expected.txt:
* web-platform-tests/fetch/api/redirect/redirect-to-dataurl-worker-expected.txt:
* web-platform-tests/service-workers/service-worker/fetch-request-redirect.https-expected.txt:

Source/WebCore:

No change of behavior.
Update CachedResourceLoader error messages to match NetworkProcess error messages.

* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::printAccessDeniedMessage const):

Source/WebKit:

Relax rules to check for non HTTP(s) redirections to throw only when WebProcess says to load it after redirection.
This allows WebProcess to load redirected non HTTP(s) URLs, such as data URLs.
We keep these checks when WebProcess asks to continue the load and for all PingLoads.

Update error messages to be more consistent with WK1.

* NetworkProcess/NetworkLoadChecker.cpp:
(WebKit::NetworkLoadChecker::checkRedirection):
(WebKit::NetworkLoadChecker::continueCheckingRequest):
(WebKit::NetworkLoadChecker::validateResourceResponse):
(WebKit::NetworkLoadChecker::continueCheckingRequest):
* NetworkProcess/NetworkLoadChecker.h:
(WebKit::NetworkLoadChecker::validateResponse):
* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::shouldUseNetworkLoadChecker):
(WebKit::NetworkResourceLoader::continueWillSendRequest):

LayoutTests:

* TestExpectations:
* http/tests/security/contentSecurityPolicy/1.1/child-src/worker-redirect-blocked-expected.txt:
* http/tests/security/cross-origin-xsl-BLOCKED-expected.txt:
* http/tests/security/cross-origin-xsl-redirect-BLOCKED-expected.txt:
* http/tests/security/isolatedWorld/bypass-main-world-csp-worker-redirect-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-redirect-expected.txt:
* http/tests/security/shape-image-cors-redirect-error-message-logging-1-expected.txt:
* http/tests/security/shape-image-cors-redirect-error-message-logging-2-expected.txt:
* http/tests/security/worker-cross-origin-expected.txt:
* http/tests/security/xss-DENIED-xml-external-entity-expected.txt:
* http/tests/security/xss-DENIED-xsl-document-expected.txt:
* http/tests/security/xss-DENIED-xsl-external-entity-expected.txt:
* http/tests/workers/worker-redirect-expected.txt:
* http/tests/xmlhttprequest/access-control-and-redirects-expected.txt:
* http/tests/xmlhttprequest/redirect-cross-origin-post-sync-expected.txt:
* http/tests/xmlhttprequest/redirect-cross-origin-sync-expected.txt:
* http/tests/xmlhttprequest/xmlhttprequest-unsafe-redirect-expected.txt:
* platform/mac-wk1/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-redirect-expected.txt: Added.
* platform/mac-wk1/http/tests/security/shape-image-cors-redirect-error-message-logging-1-expected.txt: Added.
* platform/mac-wk1/http/tests/security/shape-image-cors-redirect-error-message-logging-2-expected.txt: Added.
* platform/mac-wk1/http/tests/workers/worker-redirect-expected.txt: Added.
* platform/mac-wk1/http/tests/security/contentSecurityPolicy/1.1/child-src/worker-redirect-blocked-expected.txt: Added.
* platform/mac-wk1/http/tests/security/isolatedWorld/bypass-main-world-csp-worker-redirect-expected.txt: Added.
* platform/mac-wk1/http/tests/security/worker-cross-origin-expected.txt: Added.
* platform/mac-wk2/TestExpectations:
* platform/win/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-redirect-expected.txt: Added.
* platform/win/http/tests/security/shape-image-cors-redirect-error-message-logging-1-expected.txt: Added.
* platform/win/http/tests/security/shape-image-cors-redirect-error-message-logging-2-expected.txt: Added.
* platform/win/http/tests/workers/worker-redirect-expected.txt: Added.
* platform/win/http/tests/security/contentSecurityPolicy/1.1/child-src/worker-redirect-blocked-expected.txt: Added.
* platform/win/http/tests/security/isolatedWorld/bypass-main-world-csp-worker-redirect-expected.txt: Added.
* platform/win/http/tests/security/worker-cross-origin-expected.txt: Added.

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

17 months agoREGRESSION (r230998): Bot watcher's dashboard doesn't display number of API test...
jbedard@apple.com [Thu, 26 Apr 2018 02:10:59 +0000 (02:10 +0000)]
REGRESSION (r230998): Bot watcher's dashboard doesn't display number of API test failures
https://bugs.webkit.org/show_bug.cgi?id=184982

Rubber-stamped by Aakash Jain.

Correctly count the number of API test failures.

* BuildSlaveSupport/build.webkit.org-config/steps.py:
(RunUnitTests.countFailures): Count the number of test failures for the new run-api-tests.
* BuildSlaveSupport/build.webkit.org-config/steps_unittest.py:
* Scripts/webkitpy/api_tests/manager.py:
(Manager.run): Disabled tests are not run.

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

17 months ago[LFC] Add support for is<> and downcast<>
zalan@apple.com [Thu, 26 Apr 2018 02:04:48 +0000 (02:04 +0000)]
[LFC] Add support for is<> and downcast<>
https://bugs.webkit.org/show_bug.cgi?id=185016

Reviewed by Antti Koivisto.

* layout/layouttree/LayoutBlockContainer.cpp:
(WebCore::Layout::BlockContainer::BlockContainer):
* layout/layouttree/LayoutBlockContainer.h:
* layout/layouttree/LayoutBox.cpp:
(WebCore::Layout::Box::Box):
* layout/layouttree/LayoutBox.h:
(WebCore::Layout::Box::isContainer const):
(WebCore::Layout::Box::isBlockContainer const):
(WebCore::Layout::Box::isInlineBox const):
(WebCore::Layout::Box::isInlineContainer const):
* layout/layouttree/LayoutContainer.cpp:
(WebCore::Layout::Container::Container):
* layout/layouttree/LayoutContainer.h:
* layout/layouttree/LayoutInlineBox.cpp:
(WebCore::Layout::InlineBox::InlineBox):
* layout/layouttree/LayoutInlineBox.h:
* layout/layouttree/LayoutInlineContainer.cpp:
(WebCore::Layout::InlineContainer::InlineContainer):
* layout/layouttree/LayoutInlineContainer.h:

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

17 months agowindow.postMessage() / focus() / blur() throw a TypeError when called on a RemoteDOMW...
cdumez@apple.com [Thu, 26 Apr 2018 00:55:49 +0000 (00:55 +0000)]
window.postMessage() / focus() / blur() throw a TypeError when called on a RemoteDOMWindow
https://bugs.webkit.org/show_bug.cgi?id=184981

Reviewed by Sam Weinig.

Source/WebCore:

window.postMessage() / focus() / blur() was throwing a TypeError when called on a RemoteDOMWindow,
complaining that |this| is not a Window. This was caused by a copy & paste mistake in
JSDOMWindowCustom where we were calling the JSDOMWindow methods instead of the JSRemoteDOMWindow
ones.

No new tests, updated existing tests.

* bindings/js/JSDOMWindowCustom.cpp:
(WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess):
* page/RemoteDOMWindow.cpp:
(WebCore::RemoteDOMWindow::postMessage):
* page/RemoteDOMWindow.h:
* page/RemoteDOMWindow.idl:

LayoutTests:

Add layout test coverage.

* http/tests/navigation/process-swap-window-open-expected.txt:
* http/tests/navigation/process-swap-window-open.html:

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

17 months agoUnreviewed test gardening
jiewen_tan@apple.com [Thu, 26 Apr 2018 00:42:20 +0000 (00:42 +0000)]
Unreviewed test gardening

Mark http/tests/misc/submit-post-keygen.html as 'Skip' in Win because of lacking corresponding
implementations.

* platform/win/TestExpectations:

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

17 months agoGardening: Speculative build fix for Windows 32-bit to compensate for MSVC's lack...
mark.lam@apple.com [Thu, 26 Apr 2018 00:13:35 +0000 (00:13 +0000)]
Gardening: Speculative build fix for Windows 32-bit to compensate for MSVC's lack of smarts.
https://bugs.webkit.org/show_bug.cgi?id=184976
<rdar://problem/39723901>

Not reviewed.

According to https://stackoverflow.com/questions/37658794/integer-constant-overflow-warning-in-constexpr,
disabling the warning around the definition of the function will not disable it
for all clients of the function.

* wtf/PtrTag.h:
(WTF::makePtrTagHash):

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

17 months agoIn FTLLowerDFGToB3.cpp::compileCreateRest, always use a contiguous array as the index...
rmorisset@apple.com [Wed, 25 Apr 2018 23:32:58 +0000 (23:32 +0000)]
In FTLLowerDFGToB3.cpp::compileCreateRest, always use a contiguous array as the indexing type when under isWatchingHavingABadTimeWatchpoint
https://bugs.webkit.org/show_bug.cgi?id=184773
<rdar://problem/37773612>

Reviewed by Filip Pizlo.

JSTests:

This bug requires a race between the thread doing FTL compilation and the main thread, but it triggers in 100% of cases (before the fix) on my machine
so I decided to add it to the stress tests nonetheless.

* stress/create-rest-while-having-a-bad-time.js: Added.
(f):
(g):
(h):

Source/JavaScriptCore:

We were calling restParameterStructure(), which returns arrayStructureForIndexingTypeDuringAllocation(ArrayWithContiguous).
arrayStructureForIndexingTypeDuringAllocation uses m_arrayStructureForIndexingShapeDuringAllocation, which is set to SlowPutArrayStorage when we are 'having a bad time'.
This is problematic, because the structure is then passed to allocateUninitializedContiguousJSArray, which ASSERTs that the indexing type is contiguous (or int32).
We solve the problem by using originalArrayStructureForIndexingType which always returns a structure with the right indexing type (contiguous), even if we are having a bad time.
This is safe, as we are under isWatchingHavingABadTimeWatchpoint, so if we have a bad time, the code we generate will never be installed.

* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileCreateRest):

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

17 months agobrightness() filter should default to 1, and not allow negative values
simon.fraser@apple.com [Wed, 25 Apr 2018 23:24:47 +0000 (23:24 +0000)]
brightness() filter should default to 1, and not allow negative values
https://bugs.webkit.org/show_bug.cgi?id=184937

Reviewed by Dean Jackson.
Source/WebCore:

Remove the special-casing for brightness() in consumeFilterFunction(), so it now
follows the same logic as the other color-related filters in not allowing negative
values.

Removed the special-casing for brightness() in createFilterOperations() so its default
value is now 1.

Modified existing tests.

* css/StyleResolver.cpp:
(WebCore::StyleResolver::createFilterOperations):
* css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::allowsValuesGreaterThanOne):
(WebCore::CSSPropertyParserHelpers::consumeFilterFunction):

LayoutTests:

Added negative value tests to filter-property-parsing.html and backdropfilter-property-parsing.html,
and made these tests more similar.

Fixed expected computed value for brightness() to be brightness(1) in the tests.

The effect-brightness* test results failed because elements with invalid brightness values now
no longer create a RenderLayer.

* css3/color-filters/color-filter-parsing-expected.txt:
* css3/color-filters/color-filter-parsing.html:
* css3/filters/backdrop/backdropfilter-property-computed-style-expected.txt:
* css3/filters/backdrop/backdropfilter-property-computed-style.html:
* css3/filters/backdrop/backdropfilter-property-parsing-expected.txt:
* css3/filters/backdrop/backdropfilter-property-parsing.html:
* css3/filters/effect-brightness-expected.txt:
* css3/filters/filter-property-computed-style-expected.txt:
* css3/filters/filter-property-computed-style.html:
* css3/filters/filter-property-parsing-expected.txt:
* css3/filters/filter-property-parsing.html:
* css3/filters/unprefixed-expected.txt:
* css3/filters/unprefixed.html:
* fast/filter-image/parse-filter-image-expected.txt:
* fast/filter-image/parse-filter-image.html:
* platform/mac/css3/filters/effect-brightness-clamping-expected.txt:

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

17 months agoMissing closing parenthesis when determining INSTALL_PATH build setting in WebCore...
wenson_hsieh@apple.com [Wed, 25 Apr 2018 23:23:00 +0000 (23:23 +0000)]
Missing closing parenthesis when determining INSTALL_PATH build setting in WebCore.xcconfig
https://bugs.webkit.org/show_bug.cgi?id=184999

Reviewed by Tim Horton.

Tweaks a line in WebCore.xcconfig that computes INSTALL_PATH, so that it doesn't use WK_NOT or WK_EMPTY.

* Configurations/WebCore.xcconfig:

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

17 months agoPSON: Don't create a new process when navigating to a blob URL, data URL, and about...
rniwa@webkit.org [Wed, 25 Apr 2018 23:17:31 +0000 (23:17 +0000)]
PSON: Don't create a new process when navigating to a blob URL, data URL, and about:blank
https://bugs.webkit.org/show_bug.cgi?id=184962

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

Build fix. Revert the change in r231019 to remove the empty URL and about:blank check here.
These checks are for the source / originating URL, not the target URL.

* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::processForNavigation):

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

17 months ago[WPE][Debug] Test gardening of EME related tests.
clopez@igalia.com [Wed, 25 Apr 2018 23:13:13 +0000 (23:13 +0000)]
[WPE][Debug] Test gardening of EME related tests.

Report and mark the tests crashing on the Debug build.

* platform/wpe/TestExpectations:

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

17 months ago[LFC] Implement LayoutContexet::layout() and its dependencies.
zalan@apple.com [Wed, 25 Apr 2018 22:54:01 +0000 (22:54 +0000)]
[LFC] Implement LayoutContexet::layout() and its dependencies.
https://bugs.webkit.org/show_bug.cgi?id=184951

Reviewed by Antti Koivisto.

* layout/FormattingContext.cpp:
(WebCore::Layout::FormattingContext::FormattingContext):
(WebCore::Layout::FormattingContext::~FormattingContext):
(WebCore::Layout::FormattingContext::computeStaticPosition):
(WebCore::Layout::FormattingContext::computeInFlowPositionedPosition):
(WebCore::Layout::FormattingContext::computeOutOfFlowPosition):
(WebCore::Layout::FormattingContext::computeWidth):
(WebCore::Layout::FormattingContext::computeHeight):
(WebCore::Layout::FormattingContext::marginTop):
(WebCore::Layout::FormattingContext::marginLeft):
(WebCore::Layout::FormattingContext::marginBottom):
(WebCore::Layout::FormattingContext::marginRight):
* layout/FormattingContext.h:
* layout/FormattingState.cpp:
(WebCore::Layout::FormattingState::FormattingState):
* layout/FormattingState.h:
* layout/LayoutContext.cpp:
(WebCore::Layout::LayoutContext::LayoutContext):
(WebCore::Layout::LayoutContext::updateLayout):
(WebCore::Layout::LayoutContext::formattingState):
(WebCore::Layout::LayoutContext::formattingContext):
* layout/LayoutContext.h:
* layout/blockformatting/BlockFormattingContext.cpp:
(WebCore::Layout::BlockFormattingContext::BlockFormattingContext):
(WebCore::Layout::BlockFormattingContext::layout):
(WebCore::Layout::BlockFormattingContext::formattingState const):
(WebCore::Layout::BlockFormattingContext::computeStaticPosition):
(WebCore::Layout::BlockFormattingContext::computeWidth):
(WebCore::Layout::BlockFormattingContext::computeHeight):
(WebCore::Layout::BlockFormattingContext::marginTop):
(WebCore::Layout::BlockFormattingContext::marginBottom):
* layout/blockformatting/BlockFormattingContext.h:
* layout/blockformatting/BlockFormattingState.cpp:
(WebCore::Layout::BlockFormattingState::BlockFormattingState):
* layout/blockformatting/BlockFormattingState.h:
* layout/inlineformatting/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::InlineFormattingContext):
(WebCore::Layout::InlineFormattingContext::layout):
(WebCore::Layout::InlineFormattingContext::formattingState const):
* layout/inlineformatting/InlineFormattingContext.h:
* layout/inlineformatting/InlineFormattingState.cpp:
(WebCore::Layout::InlineFormattingState::InlineFormattingState):
* layout/inlineformatting/InlineFormattingState.h:

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

17 months agoPush the definition of PtrTag down to the WTF layer.
mark.lam@apple.com [Wed, 25 Apr 2018 22:31:13 +0000 (22:31 +0000)]
Push the definition of PtrTag down to the WTF layer.
https://bugs.webkit.org/show_bug.cgi?id=184976
<rdar://problem/39723901>

Reviewed by Saam Barati.

Source/JavaScriptCore:

* CMakeLists.txt:
* JavaScriptCore.xcodeproj/project.pbxproj:
* assembler/ARM64Assembler.h:
* assembler/AbstractMacroAssembler.h:
* assembler/MacroAssemblerCodeRef.cpp:
* assembler/MacroAssemblerCodeRef.h:
* b3/B3MathExtras.cpp:
* bytecode/LLIntCallLinkInfo.h:
* disassembler/Disassembler.h:
* ftl/FTLJITCode.cpp:
* interpreter/InterpreterInlines.h:
* jit/ExecutableAllocator.h:
* jit/JITOperations.cpp:
* jit/ThunkGenerator.h:
* jit/ThunkGenerators.h:
* llint/LLIntOffsetsExtractor.cpp:
* llint/LLIntPCRanges.h:
* runtime/JSCPtrTag.h: Added.
* runtime/NativeFunction.h:
* runtime/PtrTag.h: Removed.
* runtime/VMTraps.cpp:

Source/WebCore:

No new tests needed.  This is covered by existing tests.

* cssjit/CSSPtrTag.h:
* cssjit/SelectorCompiler.h:
(WebCore::SelectorCompiler::ruleCollectorSimpleSelectorCheckerFunction):
(WebCore::SelectorCompiler::querySelectorSimpleSelectorCheckerFunction):
(WebCore::SelectorCompiler::ruleCollectorSelectorCheckerFunctionWithCheckingContext):
(WebCore::SelectorCompiler::querySelectorSelectorCheckerFunctionWithCheckingContext):

Source/WTF:

This is in preparation for doing pointer profiling at the WTF layer as well.
Also deleted an unused ptrTag() function.

* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/PtrTag.h: Copied from Source/JavaScriptCore/runtime/PtrTag.h.
(WTF::makePtrTagHash):
(JSC::ptrTagName): Deleted.
(JSC::tagForPtr): Deleted.
(JSC::ptrTag): Deleted.
(JSC::tagCodePtr): Deleted.
(JSC::untagCodePtr): Deleted.
(JSC::retagCodePtr): Deleted.
(JSC::removeCodePtrTag): Deleted.
(JSC::tagCFunctionPtr): Deleted.
(JSC::untagCFunctionPtr): Deleted.
(JSC::assertIsCFunctionPtr): Deleted.
(JSC::assertIsNullOrCFunctionPtr): Deleted.
(JSC::assertIsNotTagged): Deleted.
(JSC::assertIsTagged): Deleted.
(JSC::assertIsNullOrTagged): Deleted.
(JSC::assertIsTaggedWith): Deleted.
(JSC::assertIsNullOrTaggedWith): Deleted.

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

17 months agoWebLoaderStrategy::networkMetricsFromResourceLoadIdentifier should use DoNotProcessIn...
youenn@apple.com [Wed, 25 Apr 2018 22:27:49 +0000 (22:27 +0000)]
WebLoaderStrategy::networkMetricsFromResourceLoadIdentifier should use DoNotProcessIncomingMessagesWhenWaitingForSyncReply
https://bugs.webkit.org/show_bug.cgi?id=184978
<rdar://problem/39667094>

Reviewed by Simon Fraser.

Use DoNotProcessIncomingMessagesWhenWaitingForSyncReply to keep a consistent state after the sync IPC call.

* WebProcess/Network/WebLoaderStrategy.cpp:
(WebKit::WebLoaderStrategy::responseFromResourceLoadIdentifier):
(WebKit::WebLoaderStrategy::networkMetricsFromResourceLoadIdentifier):

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

17 months ago[iOS] remove media element parameter from MediaElementSession methods
eric.carlson@apple.com [Wed, 25 Apr 2018 22:25:13 +0000 (22:25 +0000)]
[iOS] remove media element parameter from MediaElementSession methods
https://bugs.webkit.org/show_bug.cgi?id=184992
<rdar://problem/39731624>

Reviewed by Jon Lee.

No new tests, no behavior change.

* Modules/mediacontrols/MediaControlsHost.cpp:
(WebCore::MediaControlsHost::allowsInlineMediaPlayback const):
(WebCore::MediaControlsHost::userGestureRequired const):
* accessibility/AccessibilityMediaObject.cpp:
(WebCore::AccessibilityMediaObject::isPlayingInline const):
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::~HTMLMediaElement):
(WebCore::HTMLMediaElement::parseAttribute):
(WebCore::HTMLMediaElement::prepareForLoad):
(WebCore::HTMLMediaElement::selectMediaResource):
(WebCore::HTMLMediaElement::loadResource):
(WebCore::HTMLMediaElement::canTransitionFromAutoplayToPlay const):
(WebCore::HTMLMediaElement::setReadyState):
(WebCore::HTMLMediaElement::play):
(WebCore::HTMLMediaElement::pause):
(WebCore::HTMLMediaElement::pauseInternal):
(WebCore::HTMLMediaElement::setVolume):
(WebCore::HTMLMediaElement::mediaPlayerDidAddAudioTrack):
(WebCore::HTMLMediaElement::sourceWasAdded):
(WebCore::HTMLMediaElement::mediaEngineWasUpdated):
(WebCore::HTMLMediaElement::mediaPlayerCharacteristicChanged):
(WebCore::HTMLMediaElement::updatePlayState):
(WebCore::HTMLMediaElement::clearMediaPlayer):
(WebCore::HTMLMediaElement::resume):
(WebCore::HTMLMediaElement::webkitShowPlaybackTargetPicker):
(WebCore::HTMLMediaElement::addEventListener):
(WebCore::HTMLMediaElement::removeEventListener):
(WebCore::HTMLMediaElement::enqueuePlaybackTargetAvailabilityChangedEvent):
(WebCore::HTMLMediaElement::exitFullscreen):
(WebCore::HTMLMediaElement::configureMediaControls):
(WebCore::HTMLMediaElement::createMediaPlayer):
(WebCore::HTMLMediaElement::mediaPlayerIsFullscreenPermitted const):
(WebCore::HTMLMediaElement::updateMediaState):
(WebCore::HTMLMediaElement::mediaState const):
(WebCore::HTMLMediaElement::allowsMediaDocumentInlinePlaybackChanged):
(WebCore::HTMLMediaElement::updateShouldPlay):
* html/HTMLVideoElement.cpp:
(WebCore::HTMLVideoElement::parseAttribute):
(WebCore::HTMLVideoElement::supportsFullscreen const):
(WebCore::HTMLVideoElement::webkitEnterFullscreen):
(WebCore::HTMLVideoElement::webkitWirelessVideoPlaybackDisabled const):
(WebCore::HTMLVideoElement::webkitSupportsPresentationMode const):
(WebCore::HTMLVideoElement::setFullscreenMode):
* html/MediaElementSession.cpp:
(WebCore::MediaElementSession::playbackPermitted const):
(WebCore::MediaElementSession::dataLoadingPermitted const):
(WebCore::MediaElementSession::fullscreenPermitted const):
(WebCore::MediaElementSession::pageAllowsDataLoading const):
(WebCore::MediaElementSession::pageAllowsPlaybackAfterResuming const):
(WebCore::MediaElementSession::canShowControlsManager const):
(WebCore::MediaElementSession::showPlaybackTargetPicker):
(WebCore::MediaElementSession::hasWirelessPlaybackTargets const):
(WebCore::MediaElementSession::wirelessVideoPlaybackDisabled const):
(WebCore::MediaElementSession::setWirelessVideoPlaybackDisabled):
(WebCore::MediaElementSession::setHasPlaybackTargetAvailabilityListeners):
(WebCore::MediaElementSession::mediaStateDidChange):
(WebCore::MediaElementSession::effectivePreloadForElement const):
(WebCore::MediaElementSession::requiresFullscreenForVideoPlayback const):
(WebCore::MediaElementSession::allowsAutomaticMediaDataLoading const):
(WebCore::MediaElementSession::mediaEngineUpdated):
(WebCore::MediaElementSession::allowsPictureInPicture const):
* html/MediaElementSession.h:
* platform/cocoa/PlaybackSessionModelMediaElement.mm:
(WebCore::PlaybackSessionModelMediaElement::wirelessVideoPlaybackDisabled const):

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

17 months agoRemove access to keychain from the WebContent process
jiewen_tan@apple.com [Wed, 25 Apr 2018 22:10:01 +0000 (22:10 +0000)]
Remove access to keychain from the WebContent process
https://bugs.webkit.org/show_bug.cgi?id=184428
<rdar://problem/13150903>

Reviewed by Brent Fulgham.

Source/WebCore:

Part 2.

This patch move the operation of HTMLKeygenElement from WebContent Process to UI Process.
Function signedPublicKeyAndChallengeString is therefore marked as WEBCORE_EXPORT. Also, a
localized string is marked WEBCORE_EXPORT as well to support the API test.

Covered by existing tests and api tests.

* WebCore.xcodeproj/project.pbxproj:
* dom/Document.cpp:
(WebCore::Document::signedPublicKeyAndChallengeString):
* dom/Document.h:
* html/HTMLKeygenElement.cpp:
(WebCore::HTMLKeygenElement::appendFormData):
* page/ChromeClient.h:
* platform/LocalizedStrings.h:
* platform/SSLKeyGenerator.h:

Source/WebKit:

This patch does the followings:
1. Added necessary support to move HTMLKeygenElement's operation from WebContent Process to UI Process.
2. Craft new SPI copySignedPublicKeyAndChallengeString to supply HTMLKeygenElement with dummy data such
that WebKitTestRunner tests will not modify the underlying key store (e.g., the macOS Keychain).

* UIProcess/API/APINavigationClient.h:
(API::NavigationClient::signedPublicKeyAndChallengeString):
* UIProcess/API/C/WKPage.cpp:
(WKPageSetPageNavigationClient):
* UIProcess/API/C/WKPageNavigationClient.h:
* UIProcess/Cocoa/NavigationState.h:
* UIProcess/Cocoa/NavigationState.mm:
(WebKit::NavigationState::NavigationClient::signedPublicKeyAndChallengeString):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::signedPublicKeyAndChallengeString):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::signedPublicKeyAndChallengeString const):
* WebProcess/WebCoreSupport/WebChromeClient.h:

Source/WebKitLegacy/mac:

This patch does the followings:
1. Added necessary support to move HTMLKeygenElement's operation from WebCore space to Client space.
2. Craft new SPI signedPublicKeyAndChallengeStringForWebView to supply HTMLKeygenElement with dummy data
such that DumpRenderTree tests will not modify the underlying key store (e.g., the macOS Keychain).

* WebCoreSupport/WebChromeClient.h:
* WebCoreSupport/WebChromeClient.mm:
(WebChromeClient::signedPublicKeyAndChallengeString const):
* WebView/WebUIDelegatePrivate.h:

Tools:

This patch does the followings:
1. Added an API test for this patch.
2. Instrument DumpRenderTree and WebKitTestRunner to take advantages of new SPIs.

* DumpRenderTree/mac/UIDelegate.mm:
(-[UIDelegate signedPublicKeyAndChallengeStringForWebView:]):
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/mac/SSLKeyGenerator.mm: Added.
(TestWebKitAPI::SSLKeyGeneratorTest::SetUp):
(TestWebKitAPI::SSLKeyGeneratorTest::TearDown):
(TestWebKitAPI::TEST_F):
* WebKitTestRunner/TestController.cpp:
(WTR::copySignedPublicKeyAndChallengeString):
(WTR::TestController::createOtherPage):
(WTR::TestController::createWebViewWithOptions):

LayoutTests:

Alter the layout test to match dummy data supplied by the test runners.
Modify expectations as well.

* http/tests/misc/resources/check-keygen-post.php:
* platform/gtk/TestExpectations:
* platform/ios/TestExpectations:
* platform/mac/TestExpectations:

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

17 months ago[Extra zoom mode] The search field on www.bing.com is missing label text
wenson_hsieh@apple.com [Wed, 25 Apr 2018 21:23:27 +0000 (21:23 +0000)]
[Extra zoom mode] The search field on bing.com is missing label text
https://bugs.webkit.org/show_bug.cgi?id=184975
<rdar://problem/39723081>

Reviewed by Tim Horton.

Source/WebKit:

Adds support for displaying the "aria-label" attribute as the input view's label text in extra zoom mode. Also
adds support for grabbing the input label's text for testing.

Test: fast/forms/extrazoom/form-control-label-text.html

* Shared/AssistedNodeInformation.cpp:
(WebKit::AssistedNodeInformation::encode const):
(WebKit::AssistedNodeInformation::decode):
* Shared/AssistedNodeInformation.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView formInputLabel]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView formInputLabel]):
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::getAssistedNodeInformation):

Tools:

Adds UIScriptController.formInputLabel, which asynchronously requests the input label text for the currently
focused element in extra zoom mode.

* DumpRenderTree/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptController::formInputLabel const):
* TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
* TestRunnerShared/UIScriptContext/UIScriptController.cpp:
(WTR::UIScriptController::formInputLabel const):
* TestRunnerShared/UIScriptContext/UIScriptController.h:
* WebKitTestRunner/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptController::formInputLabel const):

LayoutTests:

Adds a layout test to check that the label text of the focused form control in the input view can be sourced
from (1) the "placeholder" attribute, (2) the "title" attribute, (3) the "aria-label" attribute, or (4) an
associated label element.

* fast/forms/extrazoom/form-control-label-text-expected.txt: Added.
* fast/forms/extrazoom/form-control-label-text.html: Added.
* resources/ui-helper.js:
(window.UIHelper.formInputLabel):
(window.UIHelper):

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

17 months ago[WPE] Should load injected bundle from builddir in developer builds
mcatanzaro@igalia.com [Wed, 25 Apr 2018 21:16:49 +0000 (21:16 +0000)]
[WPE] Should load injected bundle from builddir in developer builds
https://bugs.webkit.org/show_bug.cgi?id=184983

Reviewed by Carlos Alberto Lopez Perez.

Set WEBKIT_INJECTED_BUNDLE_PATH when running WPE MiniBrowser.

* Scripts/run-minibrowser:

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

17 months ago[WPE] libgstggtk.so broken in jhbuild environment
mcatanzaro@igalia.com [Wed, 25 Apr 2018 21:13:33 +0000 (21:13 +0000)]
[WPE] libgstggtk.so broken in jhbuild environment
https://bugs.webkit.org/show_bug.cgi?id=184984

Reviewed by Carlos Alberto Lopez Perez.

Don't pass --enable-glx=no when building libepoxy, to ensure it's compatible with
gst-plugins-good.

* wpe/jhbuild.modules:

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

17 months agoPSON: Don't create a new process when navigating to a blob URL, data URL, and about...
rniwa@webkit.org [Wed, 25 Apr 2018 20:48:03 +0000 (20:48 +0000)]
PSON: Don't create a new process when navigating to a blob URL, data URL, and about:blank
https://bugs.webkit.org/show_bug.cgi?id=184962

Reviewed by Youenn Fablet.

Source/WebCore:

Added NavigationAction::treatAsSameOriginNavigation, which signifies WebKit code to avoid creating
a new WebContent process when navigating to a blob URL, data URL, and about:blank.

Tests: ProcessSwap.SameOriginBlobNavigation
       ProcessSwap.CrossOriginBlobNavigation
       ProcessSwap.NavigateToAboutBlank
       ProcessSwap.NavigateToDataURL

* loader/NavigationAction.cpp:
(WebCore::treatAsSameOriginNavigation):
* loader/NavigationAction.h:
(WebCore::NavigationAction::treatAsSameOriginNavigation const):

Source/WebKit:

Don't create a new WebContent process when navigating to a blob object URL since doing so
can result in a race condition in which the blog URL is removed from the blob registry of
the network process by the time the navigation gets commited. This causes a failure in
fast/dom/HTMLAnchorElement/anchor-download-unset.html and oher layout tests.

In the future, the network process should verify that a given WebContent process has access
to a given blob URL. For now, we rely on WebContent process to tell us whether it can
navigate to a given blob URL or not.

* Shared/NavigationActionData.cpp:
(WebKit::NavigationActionData::encode const): Encode newly added treatAsSameOriginNavigation.
(WebKit::NavigationActionData::decode): Ditto for decoding.
* Shared/NavigationActionData.h:
(WebKit::NavigationActionData::treatAsSameOriginNavigation): Added.
* UIProcess/API/APINavigation.h:
(API::Navigation::setTreatAsSameOriginNavigation): Added.
(API::Navigation::treatAsSameOriginNavigation const): Added.
* UIProcess/API/APIProcessPoolConfiguration.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::decidePolicyForNavigationAction): Use the current process when
treatAsSameOriginNavigation is set to true; i.e. when navigating to a blob URL the current
document has access.
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::processForNavigation):
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):

Tools:

Added four test cases for navigating to a blob URL, data URL, and about:blank with process-swap-on-navigation turned on.

* TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:
(ProcessSwap.SameOriginBlobNavigation): Added.
(ProcessSwap.CrossOriginBlobNavigation): Added.
(ProcessSwap.NavigateToAboutBlank): Added.
(ProcessSwap.NavigateToDataURL): Added.

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

17 months agogetUnlinkedGlobalFunctionExecutable should only save things to the code cache if...
keith_miller@apple.com [Wed, 25 Apr 2018 20:43:42 +0000 (20:43 +0000)]
getUnlinkedGlobalFunctionExecutable should only save things to the code cache if the option is set
https://bugs.webkit.org/show_bug.cgi?id=184998

Reviewed by Saam Barati.

* runtime/CodeCache.cpp:
(JSC::CodeCache::getUnlinkedGlobalFunctionExecutable):

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