WebKit-https.git
21 months agopytest is not correctly auto-installed
commit-queue@webkit.org [Tue, 19 Feb 2019 10:22:14 +0000 (10:22 +0000)]
pytest is not correctly auto-installed
https://bugs.webkit.org/show_bug.cgi?id=194707

Patch by Pablo Saavedra <psaavedra@igalia.com> on 2019-02-19
Reviewed by Carlos Garcia Campos.

* Scripts/webkitpy/thirdparty/__init__.py:
(AutoinstallImportHook._install_pytest):

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

21 months agoMove bytecode cache-related filesystem code out of CodeCache
tzagallo@apple.com [Tue, 19 Feb 2019 10:04:53 +0000 (10:04 +0000)]
Move bytecode cache-related filesystem code out of CodeCache
https://bugs.webkit.org/show_bug.cgi?id=194675

Reviewed by Saam Barati.

The code is only used for the bytecode-cache tests, so it should live in
jsc.cpp rather than in the CodeCache. The logic now lives in ShellSourceProvider,
which overrides the a virtual method in SourceProvider, `cacheBytecode`,
in order to write the cache to disk.

* jsc.cpp:
(ShellSourceProvider::create):
(ShellSourceProvider::~ShellSourceProvider):
(ShellSourceProvider::cachePath const):
(ShellSourceProvider::loadBytecode):
(ShellSourceProvider::ShellSourceProvider):
(jscSource):
(GlobalObject::moduleLoaderFetch):
(functionDollarEvalScript):
(runWithOptions):
* parser/SourceProvider.h:
(JSC::SourceProvider::cacheBytecode const):
* runtime/CodeCache.cpp:
(JSC::writeCodeBlock):
* runtime/CodeCache.h:
(JSC::CodeCacheMap::fetchFromDiskImpl):

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

21 months agoWeb Inspector: Scripts timeline on-going-recording text looks poor in dark mode
commit-queue@webkit.org [Tue, 19 Feb 2019 09:18:08 +0000 (09:18 +0000)]
Web Inspector: Scripts timeline on-going-recording text looks poor in dark mode
https://bugs.webkit.org/show_bug.cgi?id=194809

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2019-02-19
Reviewed by Matt Baker.

* UserInterface/Views/TimelineRecordingContentView.css:
(.content-view.timeline-recording > .content-browser .recording-progress > .status):

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

21 months ago[ARM] Fix crash with sampling profiler
dinfuehr@igalia.com [Tue, 19 Feb 2019 07:15:57 +0000 (07:15 +0000)]
[ARM] Fix crash with sampling profiler
https://bugs.webkit.org/show_bug.cgi?id=194772

Reviewed by Mark Lam.

JSTests:

Do not skip test since crash with sampling profiler is now fixed.

* stress/sampling-profiler-richards.js:

Source/JavaScriptCore:

sampling-profiler-richards.js was crashing with an enabled sampling profiler. add32
did not update the stack pointer in a single instruction. The src register was first
moved into the stack pointer, the immediate imm was added in a subsequent instruction.

This was problematic when a signal handler was invoked before applying the immediate,
when the stack pointer is still set to the temporary value. Avoid this by calculating src+imm in
a temporary register and then move it in one go into the stack pointer.

* assembler/MacroAssemblerARMv7.h:
(JSC::MacroAssemblerARMv7::add32):

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

21 months agoAdjust test expectations after r241754
achristensen@apple.com [Tue, 19 Feb 2019 03:43:35 +0000 (03:43 +0000)]
Adjust test expectations after r241754
https://bugs.webkit.org/show_bug.cgi?id=194510

* platform/wk2/TestExpectations:

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

21 months agoRevert functional part of r241451
achristensen@apple.com [Tue, 19 Feb 2019 03:03:02 +0000 (03:03 +0000)]
Revert functional part of r241451
https://bugs.webkit.org/show_bug.cgi?id=194510

Source/WebKit:

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didFinishDocumentLoadForFrame):
It caused crashes and assertions on Linux and Cocoa without safe browsing, which
means it's fundamentally flawed in some way.  The testing piping was fine.

LayoutTests:

* platform/wk2/TestExpectations:

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

21 months agoFix DFG doesGC() for CompareEq/Less/LessEq/Greater/GreaterEq and CompareStrictEq...
mark.lam@apple.com [Tue, 19 Feb 2019 02:32:10 +0000 (02:32 +0000)]
Fix DFG doesGC() for CompareEq/Less/LessEq/Greater/GreaterEq and CompareStrictEq nodes.
https://bugs.webkit.org/show_bug.cgi?id=194800
<rdar://problem/48183773>

Reviewed by Yusuke Suzuki.

Fix doesGC() for the following nodes:

    CompareEq:
    CompareLess:
    CompareLessEq:
    CompareGreater:
    CompareGreaterEq:
    CompareStrictEq:
        Only return false (i.e. does not GC) for child node use kinds that have
        been vetted to not do anything that can GC.  For all other use kinds
        (including StringUse and BigIntUse), we return true (i.e. does GC).

* dfg/DFGDoesGC.cpp:
(JSC::DFG::doesGC):

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

21 months agoREGRESSION (PSON): Can't access optumbank.com from myuhc.com
cdumez@apple.com [Tue, 19 Feb 2019 02:29:02 +0000 (02:29 +0000)]
REGRESSION (PSON): Can't access optumbank.com from myuhc.com
https://bugs.webkit.org/show_bug.cgi?id=194797
<rdar://problem/48055151>

Reviewed by Geoffrey Garen.

Source/WebKit:

The issue was caused by us mistakenly process-swapping for a same-site server side redirect.
The reason we were getting it wrong is because the logic in
WebProcessPool::processForNavigationInternal() was expecting page.process() to be the source
process and page.pageLoadState().url() to be the source URL. Those assumptions are incorrect
when a server-side redirect occurs in a provisional process. In such case, the source process
is the ProvisionalPageProxy's process and the source URL is the provisional URL, not the
committed one.

* UIProcess/ProvisionalPageProxy.cpp:
(WebKit::ProvisionalPageProxy::didPerformServerRedirect):
(WebKit::ProvisionalPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame):
(WebKit::ProvisionalPageProxy::didReceiveMessage):
* UIProcess/ProvisionalPageProxy.h:
Make sure the provisional page forwards IPC related to server-side redirects to the page so
that the client gets informed.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::receivedNavigationPolicyDecision):
(WebKit::WebPageProxy::didPerformServerRedirect):
(WebKit::WebPageProxy::didPerformServerRedirectShared):
* UIProcess/WebPageProxy.h:
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::processForNavigation):
(WebKit::WebProcessPool::processForNavigationInternal):
* UIProcess/WebProcessPool.h:

Tools:

Add API test coverage.

* TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:

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

21 months agoContinue reducing use of String::format, now focusing on hex: "%p", "%x", etc.
darin@apple.com [Tue, 19 Feb 2019 02:04:33 +0000 (02:04 +0000)]
Continue reducing use of String::format, now focusing on hex: "%p", "%x", etc.
https://bugs.webkit.org/show_bug.cgi?id=194752

Reviewed by Daniel Bates.

Source/JavaScriptCore:

* heap/HeapSnapshotBuilder.cpp:
(JSC::HeapSnapshotBuilder::json): Added back the "0x" that was removed when changing
this file to use appendUnsignedAsHex instead of "%p". The intent at that time was to
keep behavior the same, so let's do that.

* parser/Lexer.cpp:
(JSC::Lexer<T>::invalidCharacterMessage const): Use makeString and hex instead of
String::format and "%04x".

Source/WebCore:

* Modules/websockets/WebSocket.cpp: Added an include of HexNumber.h. This previously
got included because of Logger.h, but that no longer pulls in HexNumber.h.

* css/CSSMarkup.cpp: Removed unneeded include of StringBuffer.h.
* css/CSSPrimitiveValue.cpp: Ditto.

* css/CSSUnicodeRangeValue.cpp:
(WebCore::CSSUnicodeRangeValue::customCSSText const): Use makeString and hex instead
of String::format and "%x".

* html/HTMLMediaElement.h:
(WTF::ValueToString<WebCore::TextTrackCue::string): Use a non-template function,
TextTrackCure::debugString, so we don't need to use HextNumber.h in a header.

* html/canvas/WebGLRenderingContextBase.cpp:
(GetErrorString): Use makeString and hex instead of String::format and "%04x".

* html/track/TextTrackCue.cpp:
(WebCore::TextTrackCue::debugString const): Added. Moved string conversion here
from HTMLMediaElement.h and use makeString instead of String::format. Also use
the word "debug" to make it clear that it's not OK to use this string, with a
pointer value serialized into it, outside of debugging.
* html/track/TextTrackCue.h: Added TextTrackCue::debugString.

* page/linux/ResourceUsageOverlayLinux.cpp:
(WebCore::formatByteNumber): Use makeString and FormattedNumber::fixedWidth
instead of String::format and "%.1f" etc.

* platform/cocoa/KeyEventCocoa.mm:
(WebCore::keyIdentifierForCharCode): Use the new hex function here instead of
the old code that did each of the four characters explicitly.

* platform/gamepad/mac/HIDGamepad.cpp:
(WebCore::HIDGamepad::HIDGamepad): Use makeString instead of String::format.

* platform/graphics/Color.cpp:
(WebCore::Color::nameForRenderTreeAsText const): Use hex instead of doing each
digit separately.

* platform/graphics/FloatPolygon.cpp:
(WebCore::FloatPolygonEdge::debugString const): Added. Moved string conversion here
from the header and use makeString instead of String::format. Also use
the word "debug" to make it clear that it's not OK to use this string, with a
pointer value serialized into it, outside of debugging.
* platform/graphics/FloatPolygon.h: Updated for the above.

* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::setName): Use makeString instead of String::format.
(WebCore::GraphicsLayerCA::recursiveCommitChanges): DItto.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::load): Ditto.
(WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin): Ditto.
* platform/gtk/PlatformKeyboardEventGtk.cpp:
(WebCore::PlatformKeyboardEvent::keyIdentifierForGdkKeyCode): Ditto.
* platform/libwpe/PlatformKeyboardEventLibWPE.cpp:
(WebCore::PlatformKeyboardEvent::keyIdentifierForWPEKeyCode): Ditto.
* platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp:
(WebCore::GStreamerVideoEncoder::makeElement): Ditto.
(WebCore::GStreamerVideoEncoder::InitEncode): Ditto.

* platform/text/TextCodecLatin1.cpp: Removed unneeded include of StringBuffer.h
and "using namespace WTF".

* platform/win/GDIObjectCounter.cpp:
(WebCore::GDIObjectCounter::GDIObjectCounter): Use makeString instead of String::format.
* platform/win/KeyEventWin.cpp:
(WebCore::keyIdentifierForWindowsKeyCode): Ditto.

* rendering/FloatingObjects.cpp:
(WebCore::FloatingObject::debugString const): Added. Moved string conversion here
from the header and use makeString instead of String::format. Also use
the word "debug" to make it clear that it's not OK to use this string, with a
pointer value serialized into it, outside of debugging.
* rendering/FloatingObjects.h: Updated for the above.

* rendering/RenderFragmentContainer.cpp:
(WebCore::RenderFragmentContainer::debugString const): Added. Moved string
conversion here from the header and use makeString instead of String::format.
Also use the word "debug" to make it clear that it's not OK to use this string,
with a pointer value serialized into it, outside of debugging.
* rendering/RenderFragmentContainer.h: Updated for the above.
* rendering/RenderFragmentedFlow.h: Ditto.

* testing/Internals.cpp:
(WebCore::Internals::address): Use makeString instead of String::format.

Source/WebCore/PAL:

* pal/FileSizeFormatter.cpp:
(fileSizeDescription): Use makeString instead of String::format.

Source/WebKit:

* Platform/IPC/win/ConnectionWin.cpp:
(IPC::Connection::createServerAndClientIdentifiers): Use makeString instead of
String::format.
* Shared/win/WebEventFactory.cpp:
(WebKit::keyIdentifierFromEvent): Ditto.

* UIProcess/API/APINavigation.cpp:
(API::Navigation::loggingString const): Use hex instead of String::format.
* UIProcess/SuspendedPageProxy.cpp:
(WebKit::SuspendedPageProxy::loggingString const): Ditto.

* UIProcess/WebBackForwardList.cpp:
(WebKit::WebBackForwardList::loggingString): Added a "0x".

* UIProcess/gtk/InputMethodFilter.cpp:
(WebKit::InputMethodFilter::logHandleKeyboardEventForTesting): Use makeString and hex
instead of String::format and "%x".
(WebKit::InputMethodFilter::logHandleKeyboardEventWithCompositionResultsForTesting):
Ditto.

Source/WTF:

* WTF.xcodeproj/project.pbxproj: Added HexNumber.cpp and Logger.cpp.
* wtf/CMakeLists.txt: Ditto.

* wtf/HexNumber.cpp: Added.
(WTF::Internal::appendHex): Non-inline, non-template hex formatting logic.

* wtf/HexNumber.h:
(WTF::Internal::appendHex): Refactored main logic of appendUnsignedAsHex and
appendUnsignedAsHexFixedSize so they can be reused in a function named hex for
use with StringTypeAdapter.
(WTF::appendUnsignedAsHex): Ditto.
(WTF::appendUnsignedAsHexFixedSize): Ditto.
(WTF::hex): Added.
(WTF::StringTypeAdapter<HexNumberBuffer>): Added.

* wtf/Logger.cpp: Added.
(WTF::Logger::LogSiteIdentifier::toString const): Made this a non-template
function and moved it here so that we don't need to include HexNumber.h
in Logger.h. Since HexNumber.h has substantial code in it, it's good if we
don't include it in any other headers.

* wtf/Logger.h:
(WTF::LogArgument<Logger::LogSiteIdentifier>::toString): Changed to call
a non-template function, LogSiteIdentifier::toString.

* wtf/text/StringConcatenateNumbers.h: Replaced overloaded writeTo functions
with function templates and used StringImpl::copyCharacters instead of
hand-written loops.

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

21 months agoWeb Inspector: Provide a way to avoid a recording auto-stop on reload
commit-queue@webkit.org [Tue, 19 Feb 2019 00:52:40 +0000 (00:52 +0000)]
Web Inspector: Provide a way to avoid a recording auto-stop on reload
https://bugs.webkit.org/show_bug.cgi?id=194793

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2019-02-18
Reviewed by Matt Baker.

* Localizations/en.lproj/localizedStrings.js:
New tooltip.

* UserInterface/Controllers/TimelineManager.js:
(WI.TimelineManager.prototype.willAutoStop):
(WI.TimelineManager.prototype.relaxAutoStop):
Getter and relaxer for auto stop behavior.

* UserInterface/Views/AuditNavigationSidebarPanel.js:
(WI.AuditNavigationSidebarPanel.prototype.showDefaultContentView):
Drive-by fix some whitespace issues.

* UserInterface/Views/TimelineTabContentView.js:
(WI.TimelineTabContentView):
(WI.TimelineTabContentView.prototype._showRecordButton):
(WI.TimelineTabContentView.prototype._showContinueButton):
(WI.TimelineTabContentView.prototype._updateNavigationBarButtons):
(WI.TimelineTabContentView.prototype._capturingStartedOrStopped):
(WI.TimelineTabContentView.prototype._globalModifierKeysDidChange):
(WI.TimelineTabContentView.prototype._continueButtonClicked):
Show a "continue" like icon instead of the usual stop button when
a recording would auto-stop and the alt key is down. When pressed
this button will relax the auto-stop and continue the recording
until explicitly stopped by the user.

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

21 months ago[iOS] Support pasting item-provider-backed data on the pasteboard as attachment elements
wenson_hsieh@apple.com [Tue, 19 Feb 2019 00:43:40 +0000 (00:43 +0000)]
[iOS] Support pasting item-provider-backed data on the pasteboard as attachment elements
https://bugs.webkit.org/show_bug.cgi?id=194670
<rdar://problem/39066529>

Reviewed by Tim Horton.

Source/WebCore:

Adds support for pasting files on the pasteboard as attachment elements, if the attachment element runtime
switch is enabled. Currently, the only types of data that can be pasted as attachments are images, which take a
special codepath in WebContentReader::readImage.

This patch adds a readDataBuffer method that converts a given blob of data from the pasteboard into an
attachment-element-backed representation in the DOM (i.e. either an attachment element or image element that
contains an attachment element). In the case where the given pasteboard item has been explicitly marked as an
attachment (via the preferredPresentationStyle hint) and the item has at least one type representation that
conforms to "public.content", we take this codepath instead of first attempting the web content reading types
supported by default in WebKit.

See below for more detail.

Test: WKAttachmentTestsIOS.InsertPastedFilesAsAttachments

* editing/Editor.cpp:
(WebCore::Editor::clientReplacementURLForResource): Deleted.
* editing/Editor.h:
* editing/WebContentReader.h:
* editing/cocoa/WebContentReaderCocoa.mm:
(WebCore::mimeTypeFromContentType):
(WebCore::contentTypeIsSuitableForInlineImageRepresentation):
(WebCore::createFragmentAndAddResources):
(WebCore::sanitizeMarkupWithArchive):

Remove all logic for handling subresource URL replacement. See WebKit ChangeLog for more details on this.

(WebCore::WebContentReader::readImage):
(WebCore::attachmentForFilePath):
(WebCore::attachmentForData):

Add a helper that creates an attachment element for a given blob of data and content type. The logic here is
quite similar to that of attachmentForFilePath, and we should find a way to either merge them, or pull out more
of their similarities into helper functions.

(WebCore::WebContentReader::readDataBuffer):
(WebCore::replaceSubresourceURLsWithURLsFromClient): Deleted.

Remove more logic for handling subresource URL replacement. See WebKit ChangeLog for more details on this.

* loader/EmptyClients.cpp:
* page/EditorClient.h:
* platform/Pasteboard.h:
* platform/PasteboardItemInfo.h:
(WebCore::PasteboardItemInfo::contentTypeForHighestFidelityItem const):
(WebCore::PasteboardItemInfo::pathForHighestFidelityItem const):
(WebCore::PasteboardItemInfo::encode const):
(WebCore::PasteboardItemInfo::decode):

Add contentTypesByFidelity to PasteboardItemInfo, instead of requesting this information using a separate IPC
message. This means we can also remove getTypesByFidelityForItemAtIndex, and just use the item's types in
fidelity order instead.

* platform/PasteboardStrategy.h:
* platform/PlatformPasteboard.h:
* platform/ios/AbstractPasteboard.h:
* platform/ios/PasteboardIOS.mm:
(WebCore::Pasteboard::read):

Shave off (potentially many) sync IPC messages to the UI process by pulling each call to
informationForItemAtIndex out of the inner loop when reading web content.

(WebCore::Pasteboard::readRespectingUTIFidelities):

Shave off one extraneous sync IPC message by rolling the types in fidelity order into the request for
PasteboardItemInfo, instead of being sent in a separate message.

* platform/ios/PlatformPasteboardIOS.mm:
(WebCore::PlatformPasteboard::informationForItemAtIndex):

Populate contentTypesForFileUpload in the case where UIPasteboard is used (i.e. copy and paste).

(WebCore::PlatformPasteboard::getTypesByFidelityForItemAtIndex): Deleted.
* platform/ios/WebItemProviderPasteboard.h:
* platform/ios/WebItemProviderPasteboard.mm:
(-[WebItemProviderPasteboard pasteboardTypesByFidelityForItemAtIndex:]): Deleted.

Source/WebKit:

Remove all IPC plumbing for getTypesByFidelityForItemAtIndex, now that the types in fidelity order have been
rolled into PasteboardItemInfo.

Additionally, remove support for subresource URL replacement. This feature was originally added with the
intention that private clients (i.e. Mail) would intercept pasted or dropped images and replace their URLs.
However, since <rdar://problem/43216836>, our strategy for this scenario has changed, such that WebKit now
handles the drop/paste, and later delivers the image data to the client via NSFileWrappers in the UI process.
At this time, there are no adopters of this SPI, and no adopters of the V2 injected bundle editing client. As
such, we can simply revert all of this to its state prior to the introduction of the replacement URL SPI, with
the exception to changes in WKBundlePageEditorClient.h, wherein there is a nonzero (but likely tiny) chance of
completely breaking binary compatability with any third parties on macOS which may have tried to adopt
subresource URL replacement.

* UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
(WebKit::WebPasteboardProxy::getPasteboardTypesByFidelityForItemAtIndex): Deleted.
* UIProcess/WebPasteboardProxy.h:
* UIProcess/WebPasteboardProxy.messages.in:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView canPerformActionForWebView:withSender:]):

Return YES for -paste: in the case where:
1. The pasteboard contains items that are explicitly marked as attachments.
2. The selection is richly contenteditable.
3. Attachment elements are enabled.

Among other things, this allows the callout bar on iOS to show the "Paste" action.

* WebProcess/InjectedBundle/API/APIInjectedBundleEditorClient.h:
(API::InjectedBundle::EditorClient::performTwoStepDrop):
(API::InjectedBundle::EditorClient::replacementURLForResource): Deleted.
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInEditingDelegate.h:
* WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
(-[WKWebProcessPlugInBrowserContextController _setEditingDelegate:]):
* WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp:
(WebKit::InjectedBundlePageEditorClient::replacementURLForResource): Deleted.
* WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h:
* WebProcess/WebCoreSupport/WebEditorClient.cpp:
(WebKit::WebEditorClient::replacementURLForResource): Deleted.
* WebProcess/WebCoreSupport/WebEditorClient.h:
* WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
(WebKit::WebPlatformStrategies::getTypesByFidelityForItemAtIndex): Deleted.
* WebProcess/WebCoreSupport/WebPlatformStrategies.h:

Source/WebKitLegacy/mac:

* WebCoreSupport/WebEditorClient.h:
* WebCoreSupport/WebEditorClient.mm:
(WebEditorClient::replacementURLForResource): Deleted.
* WebCoreSupport/WebPlatformStrategies.h:
* WebCoreSupport/WebPlatformStrategies.mm:
(WebPlatformStrategies::getTypesByFidelityForItemAtIndex): Deleted.

Source/WebKitLegacy/win:

* WebCoreSupport/WebEditorClient.cpp:
(WebEditorClient::replacementURLForResource): Deleted.
* WebCoreSupport/WebEditorClient.h:

Tools:

Remove code and tests for subresource URL replacement, and also add a new test to verify that copied data can be
pasted in an editable area as attachment elements.

* TestWebKitAPI/Tests/WebKitCocoa/BundleEditingDelegatePlugIn.mm:
(-[BundleEditingDelegatePlugIn webProcessPlugIn:didCreateBrowserContextController:]):
(-[BundleEditingDelegatePlugIn _webProcessPlugInBrowserContextController:replacementURLForResource:mimeType:]): Deleted.
* TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm:
(TestWebKitAPI::TEST):
* WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
(WTR::InjectedBundlePage::InjectedBundlePage):

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

21 months agoClean up and modernize RenderThemeIOS::paintCheckboxDecorations()
dbates@webkit.org [Tue, 19 Feb 2019 00:15:34 +0000 (00:15 +0000)]
Clean up and modernize RenderThemeIOS::paintCheckboxDecorations()
https://bugs.webkit.org/show_bug.cgi?id=194785

Reviewed by Simon Fraser.

Change from early return to else-clause to make the states clearer and make it more straightforward
to share more common code. Use constexpr, allocate temporary vectors with inline capacity, and
switch to uniform initializer syntax.

* rendering/RenderThemeIOS.mm:
(WebCore::RenderThemeIOS::paintCheckboxDecorations):

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

21 months ago[iOS] Focus ring for checkboxes, radio buttons, buttons and search fields should...
dbates@webkit.org [Tue, 19 Feb 2019 00:10:35 +0000 (00:10 +0000)]
[iOS] Focus ring for checkboxes, radio buttons, buttons and search fields should hug tighter to the contour
https://bugs.webkit.org/show_bug.cgi?id=193599
<rdar://problem/47399602>

Reviewed by Simon Fraser.

Source/WebCore:

For now, iOS uses a 3px outline width for its focus rings. Do not inset the focus ring on iOS
for text fields, textareas, keygens, and selects so as to match the visual appearance of all
the other controls.

Tests: fast/forms/ios/focus-button.html
       fast/forms/ios/focus-checkbox.html
       fast/forms/ios/focus-checked-checkbox.html
       fast/forms/ios/focus-checked-radio.html
       fast/forms/ios/focus-radio.html
       fast/forms/ios/focus-reset-button.html
       fast/forms/ios/focus-search-field.html
       fast/forms/ios/focus-submit-button.html
       fast/forms/ios/focus-text-field.html
       fast/forms/ios/focus-textarea.html

* css/html.css:
(:focus): Use 3px outline width.
(input:focus, textarea:focus, keygen:focus, select:focus): Guard this code to exclude it when building for iOS.
* rendering/RenderBox.cpp:
(WebCore::RenderBox::paintBoxDecorations): Add FIXME comment.
* rendering/RenderElement.cpp:
(WebCore::RenderElement::paintOutline): Call RenderTheme::adjustPaintRect() to adjust the paint rect.
Otherwise, the focus rings for radios and checkboxes are drawn at the wrong y-coordinate and are not snug.

LayoutTests:

Ideally we should find a way to write non-pixel tests for focus rings. For now, add some mismatch ref
tests.

We cannot write a "good" mismatch ref test for <select> at the moment since there is no way to defocus
a <select> without closing its popup. We also cannot change outline-color when outline-style: auto is
used and outline-style: auto is needed to get shrink-wrapped focus rings :(

* fast/forms/ios/focus-button-expected-mismatch.html: Added.
* fast/forms/ios/focus-button.html: Added.
* fast/forms/ios/focus-checkbox-expected-mismatch.html: Added.
* fast/forms/ios/focus-checkbox.html: Added.
* fast/forms/ios/focus-checked-checkbox-expected-mismatch.html: Added.
* fast/forms/ios/focus-checked-checkbox.html: Added.
* fast/forms/ios/focus-checked-radio-expected-mismatch.html: Added.
* fast/forms/ios/focus-checked-radio.html: Added.
* fast/forms/ios/focus-radio-expected-mismatch.html: Added.
* fast/forms/ios/focus-radio.html: Added.
* fast/forms/ios/focus-reset-button-expected-mismatch.html: Added.
* fast/forms/ios/focus-reset-button.html: Added.
* fast/forms/ios/focus-search-field-expected-mismatch.html: Added.
* fast/forms/ios/focus-search-field.html: Added.
* fast/forms/ios/focus-submit-button-expected-mismatch.html: Added.
* fast/forms/ios/focus-submit-button.html: Added.
* fast/forms/ios/focus-text-field-expected-mismatch.html: Added.
* fast/forms/ios/focus-text-field.html: Added.
* fast/forms/ios/focus-textarea-expected-mismatch.html: Added.
* fast/forms/ios/focus-textarea.html: Added.
* platform/ios/TestExpectations: Skip the tests for now on iOS we do not build with ENABLE(FULL_KEYBOARD_ACCESS) enabled.

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

21 months ago[css-grid] Handle indefinite percentages in fit-content()
commit-queue@webkit.org [Mon, 18 Feb 2019 23:40:50 +0000 (23:40 +0000)]
[css-grid] Handle indefinite percentages in fit-content()
https://bugs.webkit.org/show_bug.cgi?id=194509

Patch by Oriol Brufau <obrufau@igalia.com> on 2019-02-18
Reviewed by Javier Fernandez.

LayoutTests/imported/w3c:

Import WPT test.

* web-platform-tests/css/css-grid/layout-algorithm/grid-fit-content-percentage-expected.txt: Added.
* web-platform-tests/css/css-grid/layout-algorithm/grid-fit-content-percentage.html: Added.
* web-platform-tests/css/css-grid/layout-algorithm/w3c-import.log:

Source/WebCore:

Test: imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/grid-fit-content-percentage.html

If the size of the grid container depends on the size of its tracks,
a percentage in fit-content() is indefinite. Without this patch, some
places treated this case as fit-content(0), which prevented the grid
container from growing enough to contain the max-content contribution
of its grid items.

This patch treats such fit-content() as minmax(auto, max-content),
but once the size of the grid container is known and it is laid out
"for real", then the percentage is definite and it's used.

* rendering/GridTrackSizingAlgorithm.cpp:
(WebCore::GridTrackSizingAlgorithm::gridTrackSize const):
(WebCore::GridTrackSizingAlgorithm::initializeTrackSizes):

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

21 months agoexitFullscreen should not instantiate a new model/interface mapping.
commit-queue@webkit.org [Mon, 18 Feb 2019 23:40:44 +0000 (23:40 +0000)]
exitFullscreen should not instantiate a new model/interface mapping.
https://bugs.webkit.org/show_bug.cgi?id=191988
rdar://problem/42327939

Patch by Jeremy Jones <jeremyj@apple.com> on 2019-02-18
Reviewed by Jer Noble.

This change is a speculative fix for a crash that cannot be reproduced.

Somehow, exitFullscreen is being requested after didCleanupFullscreen has completed.
This change should allow us to prevent the crash in release, and assert in debug.

* UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
(WebKit::VideoFullscreenManagerProxy::exitFullscreen):

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

21 months agoWeb Inspector: Fix a typo causing assertions in ConsoleManager
commit-queue@webkit.org [Mon, 18 Feb 2019 23:27:07 +0000 (23:27 +0000)]
Web Inspector: Fix a typo causing assertions in ConsoleManager
https://bugs.webkit.org/show_bug.cgi?id=194792

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2019-02-18
Reviewed by Matt Baker.

* UserInterface/Controllers/ConsoleManager.js:
(WI.ConsoleManager.prototype.initializeLogChannels):
Extra comma produced an undefined value in the list.

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

21 months agoCheck the existence of the frame in Document::hasFrameSpecificStorageAccess() and...
wilander@apple.com [Mon, 18 Feb 2019 23:13:58 +0000 (23:13 +0000)]
Check the existence of the frame in Document::hasFrameSpecificStorageAccess() and Document::setHasFrameSpecificStorageAccess()
https://bugs.webkit.org/show_bug.cgi?id=194777
<rdar://problem/47731945>

Reviewed by Geoffrey Garen and Chris Dumez.

Source/WebCore:

Test: http/tests/storageAccess/remove-requesting-iframe.html

* dom/Document.cpp:
(WebCore::Document::hasFrameSpecificStorageAccess const):
    Now checks for the existence of the frame.
(WebCore::Document::setHasFrameSpecificStorageAccess):
    Now checks for the existence of the frame.
* loader/ResourceLoadObserver.cpp:
(WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
    Now checks that the session ID is valid.

Source/WebKit:

* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::logUserInteraction):
   Now returns early if the incoming session ID is invalid.
   Added an ASSERT to help us find other call sites passing invalid session IDs.

LayoutTests:

* http/tests/storageAccess/remove-requesting-iframe-expected.txt: Added.
* http/tests/storageAccess/remove-requesting-iframe.html: Added.
* http/tests/storageAccess/resources/request-storage-access-and-immediately-postmessage-iframe.html: Added.

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

21 months ago-[AVSampleBufferDisplayLayer player]: Unrecognized selector crash
jer.noble@apple.com [Mon, 18 Feb 2019 23:12:33 +0000 (23:12 +0000)]
-[AVSampleBufferDisplayLayer player]: Unrecognized selector crash
https://bugs.webkit.org/show_bug.cgi?id=194790
<rdar://problem/33866742>

Reviewed by Jon Lee.

Ensure that a WebVideoContainerLayer's sole sublayer is actually an AVPlayerLayer (and not
an AVSampleBufferDisplayLayer) before reporting that the layer type is LayerTypeAVPlayerLayer.

* platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
(WebCore::PlatformCALayerCocoa::layerTypeForPlatformLayer):

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

21 months ago[JSC] Add LazyClassStructure::getInitializedOnMainThread
ysuzuki@apple.com [Mon, 18 Feb 2019 22:58:46 +0000 (22:58 +0000)]
[JSC] Add LazyClassStructure::getInitializedOnMainThread
https://bugs.webkit.org/show_bug.cgi?id=194784
<rdar://problem/48154820>

Reviewed by Mark Lam.

JSTests:

* stress/lazy-initialization-done-a-priori-if-jit-enabled.js: Added.
(getProperties):
(getRandomProperty):
(i.catch):

Source/JavaScriptCore:

LazyClassStructure::get and LazyProperty::get functions do not allow compiler threads to call them. But for booleanPrototype, numberPrototype and symbolPrototype cases,
we would like to call them from compiler threads. We eagerly initialize them if VM::canUseJIT() is true, so that compiler threads can safely call LazyClassStructure::get
and LazyProperty::get for booleanPrototype, numberPrototype and symbolPrototype. But still assertion hits because the assertion requires that these functions need to be
called in non compiler threads. Calling `getConcurrently()` is not possible since symbolPrototype() function is called from both the main thread and compiler threads,
and we would like to lazily initialize SymbolPrototype object if it is called from the main thread, which can happen with non-JIT configuration.

This patch adds `getInitializedOnMainThread()`. Compiler threads can call it only when we know that the value is already initialized on the main thread. The main thread
can call it at anytime and this function lazily initializes the value. This is useful to make some of prototypes lazy with non-JIT configuration: With non-JIT configuration,
this function is always called from the main thread and it initializes the value lazily. Non-JIT configuration does not care about compiler threads since they do not exist.
With JIT configuration, we eagerly initialize them in JSGlobalObject::init so that `getInitializedOnMainThread()` always succeeds.

Basically, `getInitializedOnMainThread()` is `get` with different assertion location: While `get` always crashes if it is called from compiler threads, `getInitializedOnMainThread()`
crashes only when actual initialization happens on compiler threads. We do not merge them since `get` is still useful to find accidental initialization from compiler threads.

* runtime/JSGlobalObject.h:
(JSC::JSGlobalObject::booleanPrototype const):
(JSC::JSGlobalObject::numberPrototype const):
(JSC::JSGlobalObject::symbolPrototype const):
* runtime/LazyClassStructure.h:
(JSC::LazyClassStructure::getInitializedOnMainThread const):
(JSC::LazyClassStructure::prototypeInitializedOnMainThread const):
(JSC::LazyClassStructure::constructorInitializedOnMainThread const):
* runtime/LazyProperty.h:
(JSC::LazyProperty::get const):
(JSC::LazyProperty::getInitializedOnMainThread const):

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

21 months agoWeb Inspector: Styles: typing ";" shouldn't focus on the next property when there...
nvasilyev@apple.com [Mon, 18 Feb 2019 22:45:55 +0000 (22:45 +0000)]
Web Inspector: Styles: typing ";" shouldn't focus on the next property when there's open parenthesis or comment
https://bugs.webkit.org/show_bug.cgi?id=194789

Reviewed by Matt Baker.

* UserInterface/Views/SpreadsheetStyleProperty.js:
(WI.SpreadsheetStyleProperty.prototype._handleValueBeforeInput):

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

21 months agoWeb Inspector: Better categorize CPU usage per-thread / worker
commit-queue@webkit.org [Mon, 18 Feb 2019 22:44:06 +0000 (22:44 +0000)]
Web Inspector: Better categorize CPU usage per-thread / worker
https://bugs.webkit.org/show_bug.cgi?id=194564

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2019-02-18
Reviewed by Devin Rousso.

Source/JavaScriptCore:

* inspector/protocol/CPUProfiler.json:
Add additional properties per-Event, and new per-Thread object info.

Source/WebCore:

Test: inspector/cpu-profiler/threads.html

* workers/WorkerThread.cpp:
(WebCore::WorkerThread::workerThreadsMutex):
(WebCore::WorkerThread::workerThreadCount):
(WebCore::WorkerThread::WorkerThread):
(WebCore::WorkerThread::~WorkerThread):
(WebCore::WorkerThread::workerThread):
(WebCore::WorkerThread::releaseFastMallocFreeMemoryInAllThreads):
* workers/WorkerThread.h:
(WebCore::WorkerThread::identifier const):
Expose the set of all WorkerThreads.

* inspector/agents/InspectorCPUProfilerAgent.cpp:
(WebCore::InspectorCPUProfilerAgent::collectSample):
Send inspector additional per-thread data.

* page/ResourceUsageData.h:
(WebCore::WorkerCPUInfo::WorkerCPUInfo):
* page/cocoa/ResourceUsageThreadCocoa.mm:
(WebCore::ThreadInfo::ThreadInfo):
(WebCore::threadInfos):
(WebCore::ResourceUsageThread::platformCollectCPUData):
(WebCore::threadSendRights): Deleted.
(WebCore::cpuUsage): Deleted.
Compute per-thread values on cocoa ports.

* page/linux/ResourceUsageThreadLinux.cpp:
(WebCore::ResourceUsageThread::platformCollectCPUData):
Stub per-thread values on linux ports.

Source/WebInspectorUI:

* UserInterface/Controllers/TimelineManager.js:
(WI.TimelineManager.prototype.cpuProfilerTrackingUpdated):
* UserInterface/Models/CPUTimelineRecord.js:
(WI.CPUTimelineRecord.prototype.get mainThreadUsage):
(WI.CPUTimelineRecord.prototype.get webkitThreadUsage):
(WI.CPUTimelineRecord.prototype.get workerThreadUsage):
(WI.CPUTimelineRecord.prototype.get unknownThreadUsage):
Build a better record from the protocol events.

Source/WTF:

* wtf/Threading.h:
* wtf/Threading.cpp:
(WTF::Thread::allThreadsMutex):
(WTF::Thread::create):
(WTF::Thread::didExit):
Add a set of all WTF::Thread created threads.

LayoutTests:

* inspector/cpu-profiler/resources/busy-worker.js: Added.
* inspector/cpu-profiler/threads-expected.txt: Added.
* inspector/cpu-profiler/threads.html: Added.
Test that WebKit receives per-Thread CPU usage numbers.

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

21 months agoUncaught Exception crash in MediaPlayerPrivateAVFoundationObjC::setShouldObserveTimeC...
jer.noble@apple.com [Mon, 18 Feb 2019 22:43:10 +0000 (22:43 +0000)]
Uncaught Exception crash in MediaPlayerPrivateAVFoundationObjC::setShouldObserveTimeControlStatus()
https://bugs.webkit.org/show_bug.cgi?id=194786

Reviewed by Eric Carlson.

Convert a runtime crash to a debug assert by wrapping the call to -[AVPlayer removeObserver:forKeyPath:]
in an exception handler.

* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldObserveTimeControlStatus):

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

21 months agoIt should be possible to get the mouse event modifiers for a page overlay client.
pvollan@apple.com [Mon, 18 Feb 2019 22:43:07 +0000 (22:43 +0000)]
It should be possible to get the mouse event modifiers for a page overlay client.
https://bugs.webkit.org/show_bug.cgi?id=189621
<rdar://problem/44437279>

Reviewed by Daniel Bates.

When access to the WindowServer is blocked, [NSEvent modifierFlags] always returns 0.
This can be fixed by swizzling the class method, and getting the cached modifiers from
PlatformKeyboardEvent.

* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::currentModifierFlags):
(WebKit::WebProcess::platformInitializeProcess):

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

21 months agoFix API test after r241728
achristensen@apple.com [Mon, 18 Feb 2019 21:34:26 +0000 (21:34 +0000)]
Fix API test after r241728
       ​https://bugs.webkit.org/show_bug.cgi?id=194723

* TestWebKitAPI/Tests/WebKitCocoa/SafeBrowsing.mm:
(TEST):
The test should check the default preference value, not make sure the preference is NO after setting it to YES :/

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

21 months agoWebPageProxy::didFinishDocumentLoadForFrame() crashing in WPE and GTK+ ports
achristensen@apple.com [Mon, 18 Feb 2019 21:30:29 +0000 (21:30 +0000)]
WebPageProxy::didFinishDocumentLoadForFrame() crashing in WPE and GTK+ ports
https://bugs.webkit.org/show_bug.cgi?id=194774

Patch by Claudio Saavedra <csaavedra@igalia.com> on 2019-02-18
Reviewed by Alex Christensen.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didFinishDocumentLoadForFrame):
Null check navigation before using it.
This is a regression from r241451.

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

21 months ago[iOS] Keyups for non-modifier keys identified as "Dead" when not focused in a content...
dbates@webkit.org [Mon, 18 Feb 2019 21:16:19 +0000 (21:16 +0000)]
[iOS] Keyups for non-modifier keys identified as "Dead" when not focused in a content-editable element
https://bugs.webkit.org/show_bug.cgi?id=192824
<rdar://problem/47100332>

Reviewed by Wenson Hsieh.

Source/WebCore:

When building with USE(UIKIT_KEYBOARD_ADDITIONS) enabled, normalize input strings for some more key codes
now that hardware key events to non-editable elements use the same code path as for editable elements.

* platform/ios/KeyEventIOS.mm:
(WebCore::windowsKeyCodeForCharCode): Demarcate mappings that are only needed when building with
!USE(UIKIT_KEYBOARD_ADDITIONS) in the hope that one day we can remove this code.
(WebCore::isFunctionKey): Ditto.
* platform/ios/WebEvent.mm:
(normalizedStringWithAppKitCompatibilityMapping): Normalize some more input strings when building with
USE(UIKIT_KEYBOARD_ADDITIONS) enabled.

Source/WebCore/PAL:

Expose more enumerators.

* pal/spi/cocoa/IOKitSPI.h:

Source/WebKit:

Use the same code path for key events to editable elements and non-editable elements.

Currently we have different code paths for hardware key events depending on whether the active element
is editable or non-editable. Historically to support dispatching DOM keyboard events for hardware key
presses this differentiation was a necessary workaround for UIKit's event processing precedence of
interpreting key events for system text editing commands and app commands before dispatching unhandled
key events to WebKit. This workaround intercepted raw key UIEvents and manually reconstructed a
WebEvent from it. However there is not enough information in an UIEvent to reconstruct a WebEvent that
is identical to the WebEvent that UIKit would have dispatched. In particular, keyup UIEvents always have
empty modified and unmodified input strings. The UIKit keyboard machinery maintains additional state
that is necessary to manufacture the correct WebEvent corresponding to a UIEvent.

As a side benefit of this change, with the exception of modifier flag changes, both hardware and software
key events use the same code path.

* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView shouldShowAutomaticKeyboardUI]): Extracted code from _requiresKeyboardWhenFirstResponder
(-[WKContentView _disableAutomaticKeyboardUI]): Implement UIKit SPI to prevent showing the keyboard UI
when there is no focused element now that we are no longer intercepting key UIEvents. Formerly the
keyboard UI was disabled as a side effect of not becoming first responder when there was no focused
element (by returning NO in -_requiresKeyboardWhenFirstResponder).
(-[WKContentView _requiresKeyboardWhenFirstResponder]): Always return YES when building with USE(UIKIT_KEYBOARD_ADDITIONS)
so that we always accept key events. Instead of selectively replying to create a keyboard as a means of
hiding the automatic keyboard UI we now implement _disableAutomaticKeyboardUI to selectively hide the
automatic keyboard UI.
(-[WKContentView applyAutocorrection:toString:withCompletionHandler:]): If we are not in an editable
element then we cannot perform the replacement. This logic was necessary now that we always require a
keyboard.
(-[WKContentView requestAutocorrectionContextWithCompletionHandler:]): If we are not in an editable
element then return an autocorrection object that indicates that we could not compute this data. This
logic was necessary now that we always require a keyboard.
(-[WKContentView textInputTraits]): Do not update traits when the keyboard is going to be dismissed
now that we require a keyboard when first responder even if the focused element is non-editable.
(-[WKContentView _didHandleKeyEvent:eventWasHandled:]): Skip logic for re-sending UIEvents to UIKit
as UIKit now processes the event first. This logic was necessary in order to finally allow UIKit
its chance to interpret the UIEvent, we intercepted, for app key commands.
(-[WKContentView _elementDidBlur]): Call [self _endEditing] so that we dismiss any open form controls
(e.g. a <select> popover menu). Currently this happens either by -_requiresKeyboardWhenFirstResponder
responding NO when switching to another field or pressing Tab or Shift + Tab key command, which we will
no longer use when building with USE(UIKIT_KEYBOARD_ADDITIONS) once I land <https://bugs.webkit.org/show_bug.cgi?id=193048>.
* UIProcess/ios/forms/WKFormSelectPopover.mm:
(-[WKSelectPopover initWithView:hasGroups:]): Do not assign ourself as the keyboard delegate. Otherwise,
type ahead and tab cycling will not work. Currently type ahead and tab cycling work by using the non-
editable code path via -_handleKeyUIEvent. Now that we no longer differentiate between key events for
editable and non-editable elements we need to ensure that the WKContentView is the keyboard delegate
when the popover is presented.

Tools:

Fix a bug where the wrong usage code was used for F13 thru F24.

* WebKitTestRunner/ios/HIDEventGenerator.mm:
(keyCodeForDOMFunctionKey):

LayoutTests:

Update tests and expected results. As it turns out fixing the bug in WebKitTestRunner/ios/HIDEventGenerator.mm
so that we now dispatch key events for F17 thru F24 exposed a bug in UIKit. See <rdar://problem/47128940>.
This same bug is also responsible for a lack of key events when the Insert key is pressed.

Added sub-test for Tab key to keypress-keys-in-non-editable-element.html. Changed expected result in test
keypress-keys-in-non-editable-element.html for the forward delete key to expect failure. We expect that pressing
the forward delete key will not dispatch a keypress to match the behavior on Mac. This will be addressed by a
UIKit fix.

* fast/events/ios/keydown-keyup-special-keys-in-non-editable-element-expected.txt:
* fast/events/ios/keydown-keyup-special-keys-in-non-editable-element.html:
* fast/events/ios/keypress-keys-in-non-editable-element-expected.txt:
* fast/events/ios/keypress-keys-in-non-editable-element.html:

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

21 months agoBytecode cache should a have a boot-specific validation
tzagallo@apple.com [Mon, 18 Feb 2019 20:55:45 +0000 (20:55 +0000)]
Bytecode cache should a have a boot-specific validation
https://bugs.webkit.org/show_bug.cgi?id=194769
<rdar://problem/48149509>

Reviewed by Keith Miller.

Source/JavaScriptCore:

Add the boot UUID to the cached bytecode to enforce that it is not reused
across reboots.

* runtime/CachedTypes.cpp:
(JSC::Encoder::malloc):
(JSC::GenericCacheEntry::GenericCacheEntry):
(JSC::GenericCacheEntry::tag const):
(JSC::CacheEntry::CacheEntry):
(JSC::CacheEntry::decode const):
(JSC::GenericCacheEntry::decode const):
(JSC::encodeCodeBlock):

Source/WTF:

Add helper to get kern.bootsessionuuid from sysctl

* wtf/UUID.cpp:
(WTF::bootSessionUUIDString):
* wtf/UUID.h:

Tools:

Add test for WTF::bootSessionUUIDString()

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WTF/UUID.cpp: Added.
(TEST):

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

21 months agoWeb Inspector: duplicate left double quotation mark (\u201C) in 'Unable to show certi...
drousso@apple.com [Mon, 18 Feb 2019 20:11:16 +0000 (20:11 +0000)]
Web Inspector: duplicate left double quotation mark (\u201C) in 'Unable to show certificate for “%s“.'
https://bugs.webkit.org/show_bug.cgi?id=194782
<rdar://problem/48159683>

Reviewed by Joseph Pecoraro.

* UserInterface/Models/Resource.js:
(WI.Resource.prototype.async showCertificate):
* Localizations/en.lproj/localizedStrings.js:

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

21 months agoTell Networking Process to not optimize load
jiewen_tan@apple.com [Mon, 18 Feb 2019 19:47:03 +0000 (19:47 +0000)]
Tell Networking Process to not optimize load
https://bugs.webkit.org/show_bug.cgi?id=194753
<rdar://problem/48143603>

Reviewed by Brent Fulgham.

* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(WebKit::NetworkSessionCocoa::NetworkSessionCocoa):

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

21 months agoiOS Safari will not load USDZ in QLPreview when opening as BLOB
dino@apple.com [Mon, 18 Feb 2019 19:09:39 +0000 (19:09 +0000)]
iOS Safari will not load USDZ in QLPreview when opening as BLOB
https://bugs.webkit.org/show_bug.cgi?id=194766
<rdar://problem/42769186>

Reviewed by Wenson Hsieh.

A download from a Blob URL can happen effectively instantly, which means
that the loadHandler on the registerItemForTypeIdentifier method might not have
been called yet, and we haven't been told what the completionHandler is.
In this case, keep a record of the URL we finished with, and call the completionHandler
right away.

* UIProcess/Cocoa/SystemPreviewControllerCocoa.mm: Add a new private member variable: _downloadedURL.
(-[_WKPreviewControllerDataSource previewController:previewItemAtIndex:]): Call the completionHandler
right away if we've finished.
(-[_WKPreviewControllerDataSource finish:]): Remember that we've finished by recording the URL.

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

21 months agoAdd MSE logging configuration
eric.carlson@apple.com [Mon, 18 Feb 2019 18:38:03 +0000 (18:38 +0000)]
Add MSE logging configuration
https://bugs.webkit.org/show_bug.cgi?id=194719
<rdar://problem/48122151>

Reviewed by Joseph Pecoraro.

Source/JavaScriptCore:

* inspector/ConsoleMessage.cpp:
(Inspector::messageSourceValue):
* inspector/protocol/Console.json:
* inspector/scripts/codegen/generator.py:
* runtime/ConsoleTypes.h:

Source/WebCore:

No new tests, updated inspector/console/webcore-logging.html.

* dom/Document.cpp:
(WebCore::messageSourceForWTFLogChannel): Recognize the MSE logging channel.

* inspector/agents/WebConsoleAgent.cpp:
(WebCore::WebConsoleAgent::getLoggingChannels): Ditto.

Source/WebInspectorUI:

* Localizations/en.lproj/localizedStrings.js:
* UserInterface/Models/ConsoleMessage.js:
* UserInterface/Models/IssueMessage.js:
(WI.IssueMessage):
* UserInterface/Views/LogContentView.js:
(WI.LogContentView):
* UserInterface/Views/SettingsTabContentView.js:
(WI.SettingsTabContentView.prototype._createGeneralSettingsView):

Source/WebKitLegacy/mac:

* WebCoreSupport/WebChromeClient.mm:
(stringForMessageSource): Recognize the MSE message source.

LayoutTests:

* inspector/console/webcore-logging-expected.txt:

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

21 months agoDisable safe browsing in WKWebView and remove its WKPreferences API
achristensen@apple.com [Mon, 18 Feb 2019 18:34:41 +0000 (18:34 +0000)]
Disable safe browsing in WKWebView and remove its WKPreferences API
https://bugs.webkit.org/show_bug.cgi?id=194723
<rdar://problem/48122993>

Reviewed by Geoffrey Garen.

Source/WebKit:

* Shared/WebPreferences.yaml:
* UIProcess/API/Cocoa/WKPreferences.h:
* UIProcess/API/Cocoa/WKPreferences.mm:
(-[WKPreferences setSafeBrowsingEnabled:]): Deleted.
(-[WKPreferences isSafeBrowsingEnabled]): Deleted.

Tools:

* TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:
* TestWebKitAPI/Tests/WebKitCocoa/SafeBrowsing.mm:
(TEST):
(safeBrowsingView):
Make tests use SPI instead of API.

LayoutTests:

* platform/mac-wk2/http/tests/navigation/keyboard-events-during-provisional-navigation-expected.txt:
This test has results that depend on timing, and I need to update its results when I disable safe browsing.
I've done this several times before.  See r237876 for an example.

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

21 months ago[iOS] Dispatch additional events along with pointerdown and pointerup
graouts@webkit.org [Mon, 18 Feb 2019 17:52:34 +0000 (17:52 +0000)]
[iOS] Dispatch additional events along with pointerdown and pointerup
https://bugs.webkit.org/show_bug.cgi?id=194776
<rdar://problem/48164284>

Reviewed by Brent Fulgham.

Source/WebCore:

The Pointer Events specification mandates that "pointerover" and "pointerenter" events precede a "pointerdown" event and that "pointerout"
and "pointerleave" events follow a "pointerup" event. We remove the EventHandler::dispatchPointerEventForTouchAtIndex() method and replace
it with a PointerCaptureController::dispatchEventForTouchAtIndex() that can handle the dispatch of such additional events correctly, also
allowing for two PointerCaptureController methods (pointerEventWillBeDispatched and pointerEventWasDispatched) to become private.

Test: pointerevents/ios/over-enter-out-leave.html

* dom/EventNames.h: Add the new "pointerover", "pointerenter", "pointerout" and "pointerleave" event types.
* dom/PointerEvent.h:
* dom/ios/PointerEventIOS.cpp:
(WebCore::PointerEvent::create):
* page/EventHandler.cpp:
(WebCore::EventHandler::dispatchPointerEventForTouchAtIndex): Deleted.
* page/EventHandler.h:
* page/PointerCaptureController.cpp:
(WebCore::PointerCaptureController::dispatchEventForTouchAtIndex): Take the existing code from EventHandler::dispatchPointerEventForTouchAtIndex()
and extend it to dispatch additional events as mandated. Since several events may be dispatched we check whether the dispatch of any of those events
had defaultPrevented() or defaultHanded() return true and return those values as a pair.
(WebCore::PointerCaptureController::pointerEventWasDispatched):
* page/PointerCaptureController.h:

LayoutTests:

Added a new test that checks that "pointerover" and "pointerenter" precede "pointerdown" and that "pointerout" and "pointerleave" follow "pointerup".

* pointerevents/ios/over-enter-out-leave-expected.txt: Added.
* pointerevents/ios/over-enter-out-leave.html: Added.

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

21 months agoIndexedDB: leak IDBDatabase and IDBTransacstion in layout tests
sihui_liu@apple.com [Mon, 18 Feb 2019 17:30:18 +0000 (17:30 +0000)]
IndexedDB: leak IDBDatabase and IDBTransacstion in layout tests
https://bugs.webkit.org/show_bug.cgi?id=194709

Reviewed by Geoffrey Garen.

Source/WebCore:

When connection to IDB server is closed, IDBTransaction would abort without notifying IDBDatabase, so
IDBDatabase didn't clear its reference to IDBTransaction which created a reference cycle.

Also IDBTransaction didn't clear its reference to IDBRequest in this case and it led to another reference cycle
between IDBOpenDBRequest and IDBTransaction.

Test: storage/indexeddb/IDBObject-leak.html

* Modules/indexeddb/IDBDatabase.cpp:
(WebCore::IDBDatabase::connectionToServerLost):
* Modules/indexeddb/IDBTransaction.cpp:
(WebCore::IDBTransaction::IDBTransaction):
(WebCore::IDBTransaction::~IDBTransaction):
(WebCore::IDBTransaction::finishedDispatchEventForRequest):
(WebCore::IDBTransaction::connectionClosedFromServer):
* Modules/indexeddb/IDBTransaction.h:
* testing/Internals.cpp:
(WebCore::Internals::numberOfIDBTransactions const):
* testing/Internals.h:
* testing/Internals.idl:

LayoutTests:

* storage/indexeddb/IDBObject-leak.html: Added.

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

21 months agoAX: PSON: Going back from apple.com to search results, cannot interact with HTML...
cfleizach@apple.com [Mon, 18 Feb 2019 17:17:46 +0000 (17:17 +0000)]
AX: PSON: Going back from apple.com to search results, cannot interact with HTML content. Disabling Swap Processes on Cross-Site Navigation resolves the issue.
https://bugs.webkit.org/show_bug.cgi?id=194742

Reviewed by Chris Dumez.

Source/WebCore:

With the new process model, WebProcess hits a case where it tries to send the "page loaded" notification before VoiceOver
had a chance to register for any notifications. This leads to those notifications being dropped (and thus this bug).

This change instead asks the UIProcess to send the notification, which we know VoiceOver has registered for, and can reliably
receive notifications.

It also sends the notification for "load failures," which to the VO users' perspective amounts to the same thing as a successful
page load.

* accessibility/mac/AXObjectCacheMac.mm:
(WebCore::AXObjectCache::frameLoadingEventPlatformNotification):

Source/WebKit:

Re-initialize the accessibility web process tokens when swapping processes.
Send page load notifications from the UIProcess instead of the WebProcess to improve reliability.

* UIProcess/mac/PageClientImplMac.mm:
(WebKit::PageClientImpl::didFinishLoadForMainFrame):
(WebKit::PageClientImpl::didFailLoadForMainFrame):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::reinitializeWebPage):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/gtk/WebPageGtk.cpp:
(WebKit::WebPage::platformReinitialize):
(WebKit::WebPage::platformDetach): Deleted.
(WebKit::WebPage::platformEditorState const): Deleted.
(WebKit::WebPage::updateAccessibilityTree): Deleted.
(WebKit::WebPage::performDefaultBehaviorForKeyEvent): Deleted.
(WebKit::WebPage::platformCanHandleRequest): Deleted.
(WebKit::WebPage::platformUserAgent const): Deleted.
(WebKit::WebPage::getCenterForZoomGesture): Deleted.
(WebKit::WebPage::setInputMethodState): Deleted.
(WebKit::WebPage::collapseSelectionInFrame): Deleted.
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::platformReinitialize):
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::platformReinitialize):
* WebProcess/WebPage/win/WebPageWin.cpp:
(WebKit::WebPage::platformReinitialize):
* WebProcess/WebPage/wpe/WebPageWPE.cpp:
(WebKit::WebPage::platformReinitialize):

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

21 months agoTurn On Smart Delete
megan_gardner@apple.com [Mon, 18 Feb 2019 16:53:32 +0000 (16:53 +0000)]
Turn On Smart Delete
https://bugs.webkit.org/show_bug.cgi?id=194320

Reviewed by Ryosuke Niwa.

Source/WebCore:

Updated the following tests to work with iOS:
* editing/deleting/smart-delete-001.html:
* editing/deleting/smart-delete-002.html:
* editing/deleting/smart-delete-003.html:
* editing/deleting/smart-delete-004.html:
* editing/deleting/smart-delete-across-editable-boundaries-2.html:
* editing/selection/delete-word-granularity-text-control.html:

Turn on Smart delete for iOS at all times. Modify checks to allow Mac and iOS and other
platforms to turn on smart delete when desired.

* editing/Editor.cpp:
(WebCore::Editor::shouldSmartDelete):
Allow platfroms to determine if smart delete should be on.
On mac, this is via word granularity, on iOS this is just on all the time.
(WebCore::Editor::canSmartCopyOrDelete):
(WebCore::Editor::performCutOrCopy):
* editing/Editor.h:
* editing/EditorCommand.cpp:
(WebCore::executeDelete):
* editing/ios/EditorIOS.mm:
(WebCore::Editor::shouldSmartDelete):
* editing/mac/EditorMac.mm:
(WebCore::Editor::shouldSmartDelete):

LayoutTests:

Update smart-delete-* tests, and rebase many other tests to work with the new smart delete setting.

* editing/deleting/smart-delete-001-expected.txt: Added.
* editing/deleting/smart-delete-001.html:
* editing/deleting/smart-delete-002-expected.txt:
* editing/deleting/smart-delete-002.html:
* editing/deleting/smart-delete-003-expected.txt: Copied from LayoutTests/platform/mac/editing/deleting/smart-delete-003-expected.txt.
* editing/deleting/smart-delete-003.html:
* editing/deleting/smart-delete-004-expected.txt: Renamed from LayoutTests/platform/mac/editing/deleting/smart-delete-004-expected.txt.
* editing/deleting/smart-delete-004.html:
* editing/deleting/smart-delete-across-editable-boundaries-2-expected.txt:
* editing/deleting/smart-delete-across-editable-boundaries-2.html:
* editing/selection/delete-word-granularity-text-control.html:
* platform/ios-wk1/editing/deleting/smart-delete-003-expected.txt: Removed.
* platform/ios-wk1/editing/deleting/smart-delete-004-expected.txt: Removed.
* platform/ios-wk2/editing/deleting/smart-delete-003-expected.txt: Removed.
* platform/ios-wk2/editing/pasteboard/cut-text-001-expected.png: Removed.
* platform/ios/TestExpectations:
* platform/ios/editing/deleting/5206311-1-expected.txt:
* platform/ios/editing/deleting/delete-across-editable-content-boundaries-2-expected.txt: Added.
* platform/ios/editing/deleting/delete-across-editable-content-boundaries-3-expected.txt: Added.
* platform/ios/editing/deleting/delete-and-undo-expected.txt:
* platform/ios/editing/deleting/delete-block-merge-contents-012-expected.txt:
* platform/ios/editing/deleting/delete-block-merge-contents-017-expected.txt:
* platform/ios/editing/deleting/delete-contiguous-ws-001-expected.txt:
* platform/ios/editing/deleting/delete-image-003-expected.txt:
* platform/ios/editing/deleting/delete-leading-ws-001-expected.txt:
* platform/ios/editing/deleting/delete-selection-001-expected.txt:
* platform/ios/editing/deleting/delete-trailing-ws-001-expected.txt:
* platform/ios/editing/deleting/delete-ws-fixup-002-expected.txt:
* platform/ios/editing/deleting/delete-ws-fixup-003-expected.txt:
* platform/ios/editing/deleting/delete-ws-fixup-004-expected.txt:
* platform/ios/editing/deleting/smart-delete-001-expected.txt:
* platform/ios/editing/deleting/smart-delete-002-expected.txt: Added.
* platform/ios/editing/deleting/smart-delete-003-expected.txt: Copied from LayoutTests/platform/mac/editing/deleting/smart-delete-003-expected.txt.
* platform/ios/editing/deleting/smart-delete-004-expected.txt: Renamed from LayoutTests/platform/mac/editing/deleting/smart-delete-003-expected.txt.
* platform/ios/editing/deleting/smart-delete-across-editable-boundaries-2-expected.txt: Added.
* platform/ios/editing/deleting/table-cells-expected.txt:
* platform/ios/editing/execCommand/delete-line-and-insert-text-in-font-inside-blockquote-expected.txt: Added.
* platform/ios/editing/pasteboard/cut-text-001-expected.txt: Renamed from LayoutTests/platform/ios-wk2/editing/pasteboard/cut-text-001-expected.txt.
* platform/ios/editing/pasteboard/paste-2-expected.txt:
* platform/mac/editing/deleting/smart-delete-001-expected.png: Removed.
* platform/mac/editing/deleting/smart-delete-001-expected.txt: Removed.
* platform/mac/editing/deleting/smart-delete-002-expected.png: Removed.
* platform/mac/editing/deleting/smart-delete-003-expected.png: Removed.
* platform/mac/editing/deleting/smart-delete-004-expected.png: Removed.
* resources/ui-helper.js:
(window.UIHelper.async.doubleActivateAt):
(window.UIHelper.async.doubleActivateAtSelectionStart):
(window.UIHelper.async.selectWordByDoubleTapOrClick):

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

21 months ago[ARM] Test gardening: Test running out of executable memory
dinfuehr@igalia.com [Mon, 18 Feb 2019 11:17:35 +0000 (11:17 +0000)]
[ARM] Test gardening: Test running out of executable memory
https://bugs.webkit.org/show_bug.cgi?id=194771

Unreviewed. Do not run test without LLInt, test is running out of executable
memory on ARM otherwise.

* stress/tagged-template-object-collect.js:

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

21 months agoUnreviewed, skip the test on platforms without sampling profiler
tpopela@redhat.com [Mon, 18 Feb 2019 10:32:52 +0000 (10:32 +0000)]
Unreviewed, skip the test on platforms without sampling profiler

* stress/sampling-profiler-stack-trace-with-double-quote-in-function-name.js:
(platformSupportsSamplingProfiler.foo):
(platformSupportsSamplingProfiler.test):
(platformSupportsSamplingProfiler):
(foo): Deleted.
(test): Deleted.

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

21 months agoAdd version number to cached bytecode
tzagallo@apple.com [Mon, 18 Feb 2019 10:20:28 +0000 (10:20 +0000)]
Add version number to cached bytecode
https://bugs.webkit.org/show_bug.cgi?id=194768
<rdar://problem/48147968>

Reviewed by Saam Barati.

Add a version number to the bytecode cache that should be unique per build.

* CMakeLists.txt:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* runtime/CachedTypes.cpp:
(JSC::Encoder::malloc):
(JSC::GenericCacheEntry::GenericCacheEntry):
(JSC::CacheEntry::CacheEntry):
(JSC::CacheEntry::encode):
(JSC::CacheEntry::decode const):
(JSC::GenericCacheEntry::decode const):
(JSC::decodeCodeBlockImpl):
* runtime/CodeCache.h:
(JSC::CodeCacheMap::fetchFromDiskImpl):

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

21 months ago[GTK] Crash while filling selection data during drag and drop
carlosgc@webkit.org [Mon, 18 Feb 2019 09:12:48 +0000 (09:12 +0000)]
[GTK] Crash while filling selection data during drag and drop
https://bugs.webkit.org/show_bug.cgi?id=194698

Reviewed by Michael Catanzaro.

I can't reproduce this, but it seems that m_draggingSelectionData is nullptr in fillDragData(). That can happen
when startDrag cancels a previous DND operation, because the new m_draggingSelectionData is set before the
current DND operation is cancelled, which sets it to nullptr.

* UIProcess/gtk/DragAndDropHandler.cpp:
(WebKit::DragAndDropHandler::startDrag): Finish the previous operation before setting m_draggingSelectionData.

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

21 months agohttps://device.login.microsoftonline.com is hanging on STP75
youenn@apple.com [Mon, 18 Feb 2019 06:49:01 +0000 (06:49 +0000)]
https://device.login.microsoftonline.com is hanging on STP75
https://bugs.webkit.org/show_bug.cgi?id=194734
<rdar://problem/47573830>

Reviewed by Jiewen Tan.

Make sure to only go the XPC route if SecKeyProxyStore has credentials.
Tested manually by going to the above website with and without the patch.
Load hangs without the patch and completes with the patch.

* UIProcess/Authentication/AuthenticationChallengeProxy.cpp:
(WebKit::AuthenticationChallengeProxy::AuthenticationChallengeProxy):
* UIProcess/Authentication/cocoa/SecKeyProxyStore.h:
* UIProcess/Authentication/cocoa/SecKeyProxyStore.mm:
(WebKit::SecKeyProxyStore::initialize):

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

21 months agoWasmB3IRGenerator models some effects incorrectly
sbarati@apple.com [Mon, 18 Feb 2019 04:40:14 +0000 (04:40 +0000)]
WasmB3IRGenerator models some effects incorrectly
https://bugs.webkit.org/show_bug.cgi?id=194038

Reviewed by Keith Miller.

* wasm/WasmB3IRGenerator.cpp:
(JSC::Wasm::B3IRGenerator::restoreWasmContextInstance):
(JSC::Wasm::B3IRGenerator::restoreWebAssemblyGlobalState):
These two functions were using global state instead of the
arguments passed into the function.

(JSC::Wasm::B3IRGenerator::addOp<F64ConvertUI64>):
(JSC::Wasm::B3IRGenerator::addOp<OpType::F32ConvertUI64>):
(JSC::Wasm::B3IRGenerator::addOp<OpType::I64TruncUF64>):
(JSC::Wasm::B3IRGenerator::addOp<OpType::I64TruncUF32>):
Any patchpoint that allows scratch register usage must
also say that it clobbers the scratch registers.

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

21 months agoUse dumpJSConsoleLogInStdErr=true webkit-test-runner option for non-imported tests...
Hironori.Fujii@sony.com [Mon, 18 Feb 2019 02:15:37 +0000 (02:15 +0000)]
Use dumpJSConsoleLogInStdErr=true webkit-test-runner option for non-imported tests instead of using DumpJSConsoleLogInStdErr expectation in TestExpectations
https://bugs.webkit.org/show_bug.cgi?id=194586

Reviewed by Ross Kirsling.

Tools:

* DumpRenderTree/win/DumpRenderTree.cpp:
(runTest): Pass true to setDumpJSConsoleLogInStdErr if options.dumpJSConsoleLogInStdErr is true.
* Scripts/webkitpy/port/driver.py:
(Driver._command_from_driver_input): Convert Cygwin absolute path of tests to Windows path.

LayoutTests:

DumpJSConsoleLogInStdErr expectation is considered a bad idea.
And, we have dumpJSConsoleLogInStdErr test option now (Bug 177027).

Added dumpJSConsoleLogInStdErr=true webkit-test-runner option to all non-imported tests.

* TestExpectations: Removed DumpJSConsoleLogInStdErr expectations of non-imported tests.
* http/tests/appcache/404-resource-with-slow-main-resource.php: Added dumpJSConsoleLogInStdErr=true webkit-test-runner option.
* http/tests/appcache/deferred-events-delete-while-raising-timer.html: Ditto.
* http/tests/appcache/deferred-events-delete-while-raising.html: Ditto.
* http/tests/appcache/fail-on-update-2.html: Ditto.
* http/tests/appcache/fail-on-update.html: Ditto.
* http/tests/cache/disk-cache/redirect-chain-limits.html: Ditto.
* http/tests/security/contentSecurityPolicy/block-all-mixed-content/insecure-css-in-main-frame.html: Ditto.
* http/tests/security/cross-origin-cached-images-parallel.html: Ditto.
* http/tests/security/frame-loading-via-document-write-async-delegates.html: Ditto.
* http/tests/security/frame-loading-via-document-write.html: Ditto.
* http/tests/xmlhttprequest/redirect-cross-origin-sync-double.html: Ditto.
* http/wpt/beacon/cors/cors-redirect-failure.html: Ditto.
* http/wpt/html/browsers/history/the-location-interface/location-protocol-setter-non-broken-async-delegate.html: Ditto.
* media/event-queue-crash.html: Ditto.

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

21 months agoDeadlock when adding a Structure property transition and then doing incremental marking
sbarati@apple.com [Mon, 18 Feb 2019 01:27:22 +0000 (01:27 +0000)]
Deadlock when adding a Structure property transition and then doing incremental marking
https://bugs.webkit.org/show_bug.cgi?id=194767

Reviewed by Mark Lam.

JSTests:

* stress/incremental-marking-should-not-dead-lock-in-new-property-transition.js: Added.

Source/JavaScriptCore:

This can happen in the following scenario:

You have a Structure S. S is on the mark stack. Then:
1. S grabs its lock
2. S adds a new property transition
3. We find out we need to do some incremental marking
4. We mark S
5. visitChildren on S will try to grab its lock
6. We are now in a deadlock

* heap/Heap.cpp:
(JSC::Heap::performIncrement):
* runtime/Structure.cpp:
(JSC::Structure::addNewPropertyTransition):

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

21 months agoUnreviewed, rolling out r241620.
ddkilzer@apple.com [Mon, 18 Feb 2019 00:11:24 +0000 (00:11 +0000)]
Unreviewed, rolling out r241620.

"Causes use-after-free crashes running layout tests with ASan and GuardMalloc."
(Requested by ddkilzer on #webkit.)

Reverted changeset:

"[WTF] Add environment variable helpers"
https://bugs.webkit.org/show_bug.cgi?id=192405
https://trac.webkit.org/changeset/241620# Please enter the commit message for your changes. Lines starting

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

21 months agoWeb Inspector: Move CSS completion logic from SpreadsheetTextField to SpreadsheetStyl...
nvasilyev@apple.com [Mon, 18 Feb 2019 00:08:52 +0000 (00:08 +0000)]
Web Inspector: Move CSS completion logic from SpreadsheetTextField to SpreadsheetStyleProperty
https://bugs.webkit.org/show_bug.cgi?id=194724

Reviewed by Devin Rousso.

Move CSS value completion logic from SpreadsheetTextField, a generic text field,
to SpreadsheetStyleProperty.

* UserInterface/Views/SpreadsheetStyleProperty.js:
(WI.SpreadsheetStyleProperty.prototype._nameCompletionDataProvider):
(WI.SpreadsheetStyleProperty.prototype._valueCompletionDataProvider):

* UserInterface/Views/SpreadsheetTextField.js:
(WI.SpreadsheetTextField):
(WI.SpreadsheetTextField.prototype.completionSuggestionsSelectedCompletion):
(WI.SpreadsheetTextField.prototype.completionSuggestionsClickedCompletion):
(WI.SpreadsheetTextField.prototype._updateCompletions):
(WI.SpreadsheetTextField.prototype._showSuggestionsView):
(WI.SpreadsheetTextField.prototype._getCompletionPrefix): Deleted.

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

21 months agoWeb Inspector: Frontend performance is very slow reloading theverge.com - 50% of...
mattbaker@apple.com [Sun, 17 Feb 2019 20:49:38 +0000 (20:49 +0000)]
Web Inspector: Frontend performance is very slow reloading theverge.com - 50% of time in TreeOutline _indexOfTreeElement
https://bugs.webkit.org/show_bug.cgi?id=193605
<rdar://problem/47403986>

Reviewed by Devin Rousso.

Source/WebInspectorUI:

SelectionController should track an unordered Set of represented objects
instead of an ordered set of indexes. This eliminates the costly and
error-prone updates needed to keep the selected indexes in sync as items
are added and removed from TreeOutline (and Table, to a far lesser extent).

The SelectionController interface is largely the same. Class and delegate
methods have been renamed to reflect the change from indexes to objects.
SelectionController tracks selected items in selection order. For the
operations that rely on objects being in insertion order, the controller
uses a comparator function provided at construction time.

* UserInterface/Base/IndexSet.js: Removed.
No longer used. SelectionController now uses a plain Set.

* UserInterface/Base/Utilities.js:
(value):
(get return):
Add utilities previously supplied by IndexSet and used by SelectionController.

* UserInterface/Controllers/SelectionController.js:
(WI.SelectionController):
(WI.SelectionController.prototype.get lastSelectedItem):
(WI.SelectionController.prototype.get selectedItems):
(WI.SelectionController.prototype.set allowsMultipleSelection):
(WI.SelectionController.prototype.hasSelectedItem):
(WI.SelectionController.prototype.selectItem):
(WI.SelectionController.prototype.deselectItem):
(WI.SelectionController.prototype.selectAll):
(WI.SelectionController.prototype.deselectAll):
(WI.SelectionController.prototype.removeSelectedItems):
(WI.SelectionController.prototype.reset):
(WI.SelectionController.prototype.didRemoveItems):
(WI.SelectionController.prototype.handleKeyDown):
(WI.SelectionController.prototype.handleItemMouseDown):
(WI.SelectionController.prototype._deselectAllAndSelect):
(WI.SelectionController.prototype._selectItemsFromArrowKey):
(WI.SelectionController.prototype._firstSelectableItem):
(WI.SelectionController.prototype._lastSelectableItem):
(WI.SelectionController.prototype._previousSelectableItem):
(WI.SelectionController.prototype._nextSelectableItem):
(WI.SelectionController.prototype._updateSelectedItems):
(WI.SelectionController.prototype._addRange):
(WI.SelectionController.prototype._deleteRange):
(WI.SelectionController.prototype.get numberOfItems): Deleted.
(WI.SelectionController.prototype.didInsertItem): Deleted.
(WI.SelectionController.prototype.handleItemMouseDown.normalizeRange): Deleted.
(WI.SelectionController.prototype._nextSelectableIndex): Deleted.
(WI.SelectionController.prototype._previousSelectableIndex): Deleted.

* UserInterface/Main.html:
* UserInterface/Test.html:
Remove IndexSet.

* UserInterface/Views/CookieStorageContentView.js:
(WI.CookieStorageContentView.prototype.tableIndexForRepresentedObject):
(WI.CookieStorageContentView.prototype.tableRepresentedObjectForIndex):

* UserInterface/Views/DOMTreeOutline.js:
(WI.DOMTreeOutline.prototype.objectForSelection):

* UserInterface/Views/NetworkTableContentView.js:
(WI.NetworkTableContentView.prototype.tableIndexForRepresentedObject):
(WI.NetworkTableContentView.prototype.tableRepresentedObjectForIndex):

* UserInterface/Views/Table.js:
(WI.Table):
(WI.Table.prototype.get selectedRow):
(WI.Table.prototype.get selectedRows):
(WI.Table.prototype.isRowSelected):
(WI.Table.prototype.selectRow):
(WI.Table.prototype.deselectRow):
(WI.Table.prototype.removeRow):
(WI.Table.prototype.removeSelectedRows):
(WI.Table.prototype.selectionControllerSelectionDidChange):
(WI.Table.prototype.selectionControllerFirstSelectableItem):
(WI.Table.prototype.selectionControllerLastSelectableItem):
(WI.Table.prototype.selectionControllerPreviousSelectableItem):
(WI.Table.prototype.selectionControllerNextSelectableItem):
(WI.Table.prototype._handleMouseDown):
(WI.Table.prototype._removeRows):
(WI.Table.prototype._indexForRepresentedObject):
(WI.Table.prototype._representedObjectForIndex):
(WI.Table.prototype.selectionControllerNumberOfItems): Deleted.
(WI.Table.prototype.selectionControllerNextSelectableIndex): Deleted.
(WI.Table.prototype.selectionControllerPreviousSelectableIndex): Deleted.
(WI.Table.prototype._toggleSelectedRowStyle): Deleted.

* UserInterface/Views/TreeOutline.js:
(WI.TreeOutline.compareSiblings):
(WI.TreeOutline):
(WI.TreeOutline.prototype.get selectedTreeElement):
(WI.TreeOutline.prototype.set selectedTreeElement):
(WI.TreeOutline.prototype.get selectedTreeElements):
(WI.TreeOutline.prototype.removeChildAtIndex):
(WI.TreeOutline.prototype.removeChildren):
(WI.TreeOutline.prototype._rememberTreeElement):
(WI.TreeOutline.prototype.getCachedTreeElement):
(WI.TreeOutline.prototype.selectionControllerSelectionDidChange):
(WI.TreeOutline.prototype.selectionControllerFirstSelectableItem):
(WI.TreeOutline.prototype.selectionControllerLastSelectableItem):
(WI.TreeOutline.prototype.selectionControllerPreviousSelectableItem):
(WI.TreeOutline.prototype.selectionControllerNextSelectableItem):
(WI.TreeOutline.prototype.objectForSelection):
(WI.TreeOutline._generateStyleRulesIfNeeded):
(WI.TreeOutline.prototype.selectionControllerNextSelectableIndex): Deleted.
(WI.TreeOutline.prototype.selectionControllerPreviousSelectableIndex): Deleted.
(WI.TreeOutline._generateStyleRulesIfNeeded._indexesForSubtree.numberOfElementsInSubtree): Deleted.

LayoutTests:

* inspector/table/resources/table-utilities.js:
(TestPage.registerInitializer.InspectorTest.TableDataSource.prototype.tableIndexForRepresentedObject):
(TestPage.registerInitializer.InspectorTest.TableDataSource.prototype.tableRepresentedObjectForIndex):
(TestPage.registerInitializer.InspectorTest.TableDataSource):
New Table data source methods.

* inspector/unit-tests/index-set-expected.txt: Removed.
* inspector/unit-tests/index-set.html: Removed.
* inspector/unit-tests/set-utilities-expected.txt:
* inspector/unit-tests/set-utilities.html:
Remove IndexSet tests and update tests for Set utilities to include new
helper methods `equals` and `difference`, and `firstValue`.

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

21 months agoUnreviewed, rolling out r241612.
commit-queue@webkit.org [Sun, 17 Feb 2019 18:13:23 +0000 (18:13 +0000)]
Unreviewed, rolling out r241612.
https://bugs.webkit.org/show_bug.cgi?id=194762

"It regressed JetStream2 parsing tests by ~40%" (Requested by
saamyjoon on #webkit).

Reverted changeset:

"Move bytecode cache-related filesystem code out of CodeCache"
https://bugs.webkit.org/show_bug.cgi?id=194675
https://trac.webkit.org/changeset/241612

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

21 months ago[JSC] JSWrapperObject should not be destructible
ysuzuki@apple.com [Sat, 16 Feb 2019 18:50:08 +0000 (18:50 +0000)]
[JSC] JSWrapperObject should not be destructible
https://bugs.webkit.org/show_bug.cgi?id=194743

Reviewed by Saam Barati.

JSWrapperObject should be just a wrapper object for JSValue, thus, it should not be a JSDestructibleObject.
Currently it is destructible object because DateInstance uses it. This patch changes Base of DateInstance from
JSWrapperObject to JSDestructibleObject, and makes JSWrapperObject non-destructible.

* runtime/BigIntObject.cpp:
(JSC::BigIntObject::BigIntObject):
* runtime/BooleanConstructor.cpp:
(JSC::BooleanConstructor::finishCreation):
* runtime/BooleanObject.cpp:
(JSC::BooleanObject::BooleanObject):
* runtime/BooleanObject.h:
* runtime/DateInstance.cpp:
(JSC::DateInstance::DateInstance):
(JSC::DateInstance::finishCreation):
* runtime/DateInstance.h:
* runtime/DatePrototype.cpp:
(JSC::dateProtoFuncGetTime):
(JSC::dateProtoFuncSetTime):
(JSC::setNewValueFromTimeArgs):
(JSC::setNewValueFromDateArgs):
(JSC::dateProtoFuncSetYear):
* runtime/JSCPoison.h:
* runtime/JSWrapperObject.h:
(JSC::JSWrapperObject::JSWrapperObject):
* runtime/NumberObject.cpp:
(JSC::NumberObject::NumberObject):
* runtime/NumberObject.h:
* runtime/StringConstructor.cpp:
(JSC::StringConstructor::finishCreation):
* runtime/StringObject.cpp:
(JSC::StringObject::StringObject):
* runtime/StringObject.h:
(JSC::StringObject::internalValue const):
* runtime/SymbolObject.cpp:
(JSC::SymbolObject::SymbolObject):
* runtime/SymbolObject.h:

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

21 months ago[LFC] RenderImage's default intrinsic size is 0.
zalan@apple.com [Sat, 16 Feb 2019 16:28:44 +0000 (16:28 +0000)]
[LFC] RenderImage's default intrinsic size is 0.
https://bugs.webkit.org/show_bug.cgi?id=194745

Reviewed by Antti Koivisto.

Source/WebCore:

While the images are being loaded, their intrinsic size is set to 0 (RenderImage c'tor). Note that this code is temporary.
* layout/layouttree/LayoutTreeBuilder.cpp:
(WebCore::Layout::TreeBuilder::createSubTree):

Tools:

* LayoutReloaded/misc/LFC-passing-tests.txt:

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

21 months ago[LFC][BFC] Add support for block replaced intrinsic width.
zalan@apple.com [Sat, 16 Feb 2019 12:56:11 +0000 (12:56 +0000)]
[LFC][BFC] Add support for block replaced intrinsic width.
https://bugs.webkit.org/show_bug.cgi?id=194705

Reviewed by Simon Fraser.

Source/WebCore:

Replaced boxes should report their intrinsic width as preferred widths.

Test: fast/block/block-only/replaced-intrinsic-width-simple.html

* layout/blockformatting/BlockFormattingContextGeometry.cpp:
(WebCore::Layout::BlockFormattingContext::Geometry::intrinsicWidthConstraints):

Tools:

* LayoutReloaded/misc/LFC-passing-tests.txt:

LayoutTests:

* fast/block/block-only/replaced-intrinsic-width-simple-expected.html: Added.
* fast/block/block-only/replaced-intrinsic-width-simple.html: Added.

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

21 months ago[LFC] Apply min/max width constraints to preferred width computation
zalan@apple.com [Sat, 16 Feb 2019 12:54:01 +0000 (12:54 +0000)]
[LFC] Apply min/max width constraints to preferred width computation
https://bugs.webkit.org/show_bug.cgi?id=194739

Reviewed by Simon Fraser.

Source/WebCore:

Ensure that both min-height and max-height are taken into account while computing the preferred width.

Test: fast/block/block-only/min-max-and-preferred-width-simple.html

* layout/blockformatting/BlockFormattingContextGeometry.cpp:
(WebCore::Layout::BlockFormattingContext::Geometry::intrinsicWidthConstraints):

Tools:

* LayoutReloaded/misc/LFC-passing-tests.txt:

LayoutTests:

* fast/block/block-only/min-max-and-preferred-width-simple-expected.html: Added.
* fast/block/block-only/min-max-and-preferred-width-simple.html: Added.

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

21 months ago[JSC] Shrink UnlinkedFunctionExecutable
ysuzuki@apple.com [Sat, 16 Feb 2019 08:58:36 +0000 (08:58 +0000)]
[JSC] Shrink UnlinkedFunctionExecutable
https://bugs.webkit.org/show_bug.cgi?id=194733

Reviewed by Mark Lam.

UnlinkedFunctionExecutable has sourceURLDirective and sourceMappingURLDirective. These
directives can be found in the comment of non typical function's source code (Program,
Eval code, and Global function from function constructor etc.), and tricky thing is that
SourceProvider's directives are updated by Parser. The reason why we have these fields in
UnlinkedFunctionExecutable is that we need to update the SourceProvider's directives even
if we skip parsing by using CodeCache. These fields are effective only if (1)
UnlinkedFunctionExecutable is for non typical function things, and (2) it has sourceURLDirective
or sourceMappingURLDirective. This is rare enough to purge them to a separated
UnlinkedFunctionExecutable::RareData to make UnlinkedFunctionExecutable small.
sizeof(UnlinkedFunctionExecutable) is very important since it is super frequently allocated
cell. Furthermore, the current JSC allocates two MarkedBlocks for UnlinkedFunctionExecutable
in JSGlobalObject initialization, but the usage of the second MarkedBlock is quite low (8%).
If we can reduce the size of UnlinkedFunctionExecutable, we can make them one MarkedBlock.
Since UnlinkedFunctionExecutable is allocated from IsoSubspace, we do not need to fit it to
one of size class.

This patch adds RareData to UnlinkedFunctionExecutable and move some rare datas into RareData.
And kill one MarkedBlock allocation in JSC initialization phase.

* bytecode/UnlinkedFunctionExecutable.cpp:
(JSC::UnlinkedFunctionExecutable::UnlinkedFunctionExecutable):
(JSC::UnlinkedFunctionExecutable::ensureRareDataSlow):
* bytecode/UnlinkedFunctionExecutable.h:
* debugger/DebuggerLocation.cpp:
(JSC::DebuggerLocation::DebuggerLocation):
* inspector/ScriptDebugServer.cpp:
(Inspector::ScriptDebugServer::dispatchDidParseSource):
* parser/Lexer.h:
(JSC::Lexer::sourceURLDirective const):
(JSC::Lexer::sourceMappingURLDirective const):
(JSC::Lexer::sourceURL const): Deleted.
(JSC::Lexer::sourceMappingURL const): Deleted.
* parser/Parser.h:
(JSC::Parser<LexerType>::parse):
* parser/SourceProvider.h:
(JSC::SourceProvider::sourceURLDirective const):
(JSC::SourceProvider::sourceMappingURLDirective const):
(JSC::SourceProvider::setSourceURLDirective):
(JSC::SourceProvider::setSourceMappingURLDirective):
(JSC::SourceProvider::sourceURL const): Deleted. We rename it from sourceURL to sourceURLDirective
since it is the correct name.
(JSC::SourceProvider::sourceMappingURL const): Deleted. We rename it from sourceMappingURL to
sourceMappingURLDirective since it is the correct name.
* runtime/CachedTypes.cpp:
(JSC::CachedSourceProviderShape::encode):
(JSC::CachedFunctionExecutableRareData::encode):
(JSC::CachedFunctionExecutableRareData::decode const): CachedFunctionExecutable did not have
sourceMappingURL to sourceMappingURLDirective. So this patch keeps the same logic.
(JSC::CachedFunctionExecutable::rareData const):
(JSC::CachedFunctionExecutable::encode):
(JSC::CachedFunctionExecutable::decode const):
(JSC::UnlinkedFunctionExecutable::UnlinkedFunctionExecutable):
* runtime/CodeCache.cpp:
(JSC::CodeCache::getUnlinkedGlobalCodeBlock):
(JSC::CodeCache::getUnlinkedGlobalFunctionExecutable):
* runtime/CodeCache.h:
(JSC::generateUnlinkedCodeBlockImpl):
* runtime/FunctionExecutable.h:
* runtime/SamplingProfiler.cpp:
(JSC::SamplingProfiler::StackFrame::url):

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

21 months ago[JSC] Remove unused global private variables
ysuzuki@apple.com [Sat, 16 Feb 2019 07:41:20 +0000 (07:41 +0000)]
[JSC] Remove unused global private variables
https://bugs.webkit.org/show_bug.cgi?id=194741

Reviewed by Joseph Pecoraro.

There are some private functions and constants that are no longer referenced from builtin JS code.
This patch cleans up them.

* builtins/BuiltinNames.h:
* builtins/ObjectConstructor.js:
(entries):
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::init):

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

21 months agoWeb Inspector: Logging a native function to the console, such as `alert`, produces...
commit-queue@webkit.org [Sat, 16 Feb 2019 06:41:55 +0000 (06:41 +0000)]
Web Inspector: Logging a native function to the console, such as `alert`, produces unhandled rejection
https://bugs.webkit.org/show_bug.cgi?id=194740

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2019-02-15
Reviewed by Matt Baker.

* UserInterface/Protocol/RemoteObject.js:
(WI.RemoteObject.prototype.findFunctionSourceCodeLocation):
In case of a protocol error (common when attempting to get a location
for a native function) produce the NoSourceFound result.

* UserInterface/Views/ConsoleMessageView.js:
(WI.ConsoleMessageView.prototype._appendLocationLink):
Simplify with an arrow function.

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

21 months agoWeb Inspector: Some timelines views work, show Legacy CPU timeline
commit-queue@webkit.org [Sat, 16 Feb 2019 05:29:36 +0000 (05:29 +0000)]
Web Inspector: Some timelines views work, show Legacy CPU timeline
https://bugs.webkit.org/show_bug.cgi?id=194738

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2019-02-15
Reviewed by Yusuke Suzuki.

* UserInterface/Views/ContentView.js:
(WI.ContentView.createFromRepresentedObject):

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

21 months agoNetworkDataTask should check its client before calling shouldCaptureExtraNetworkLoadM...
youenn@apple.com [Sat, 16 Feb 2019 04:57:09 +0000 (04:57 +0000)]
NetworkDataTask should check its client before calling shouldCaptureExtraNetworkLoadMetrics
https://bugs.webkit.org/show_bug.cgi?id=194732

Reviewed by Geoffrey Garen.

NetworkDataTask may be kept alive if refing it after its NetworkLoad is gone.
This might happen for instance in DownloadManager or when checking for TLS certificates.
In that case, if the NetworkLoad gets destroyed, it clears the client of the NetworkDataTask.
To ensure that NetworkDataTask does not try to use its client, add a null check.

* NetworkProcess/NetworkDataTask.cpp:
(WebKit::NetworkDataTask::shouldCaptureExtraNetworkLoadMetrics const):

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

21 months ago[JSC] Lazily create empty RegExp
ysuzuki@apple.com [Sat, 16 Feb 2019 04:32:42 +0000 (04:32 +0000)]
[JSC] Lazily create empty RegExp
https://bugs.webkit.org/show_bug.cgi?id=194735

Reviewed by Keith Miller.

Some scripts do not have any RegExp. In that case, allocating MarkedBlock for RegExp is costly.
Previously, there was always one RegExp, "empty RegExp". This patch lazily creates it and drop
one MarkedBlock.

* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::init):
* runtime/RegExpCache.cpp:
(JSC::RegExpCache::ensureEmptyRegExpSlow):
(JSC::RegExpCache::initialize): Deleted.
* runtime/RegExpCache.h:
(JSC::RegExpCache::ensureEmptyRegExp):
(JSC::RegExpCache::emptyRegExp const): Deleted.
* runtime/RegExpCachedResult.cpp:
(JSC::RegExpCachedResult::lastResult):
* runtime/RegExpCachedResult.h:
* runtime/VM.cpp:
(JSC::VM::VM):

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

21 months agoAX: Audit tab should have built-in accessibility tests.
aaron_chu@apple.com [Sat, 16 Feb 2019 03:51:41 +0000 (03:51 +0000)]
AX: Audit tab should have built-in accessibility tests.
https://bugs.webkit.org/show_bug.cgi?id=194005
<rdar://problem/47657503>

Updated built-in accessibility audits test suite.

Reviewed by Devin Rousso.

* Localizations/en.lproj/localizedStrings.js:
* UserInterface/Controllers/AuditManager.js:
(WI.AuditManager.prototype.addDefaultTestsIfNeeded):
(WI.AuditManager):
(WI.AuditManager.prototype.addDefaultTestsIfNeeded.): Deleted.

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

21 months agoWeb Inspector: Dark Mode: commas in CSS selectors are too dim
nvasilyev@apple.com [Sat, 16 Feb 2019 02:03:32 +0000 (02:03 +0000)]
Web Inspector: Dark Mode: commas in CSS selectors are too dim
https://bugs.webkit.org/show_bug.cgi?id=194729
<rdar://problem/48128592>

Reviewed by Matt Baker.

Use `--text-color-tertiary` for both light and dark modes.

* UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.css:
(.spreadsheet-style-declaration-editor):
* UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.css:
(.spreadsheet-css-declaration):
(.spreadsheet-css-declaration .selector > span):
(@media (prefers-color-scheme: dark)):
* UserInterface/Views/Variables.css:
(:root):

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

21 months ago[JSC] Make builtin objects more lazily initialized under non-JIT mode
ysuzuki@apple.com [Sat, 16 Feb 2019 01:38:17 +0000 (01:38 +0000)]
[JSC] Make builtin objects more lazily initialized under non-JIT mode
https://bugs.webkit.org/show_bug.cgi?id=194727

Reviewed by Saam Barati.

Source/JavaScriptCore:

Boolean, Symbol, and Number constructors and prototypes are initialized eagerly, but this is largely
because concurrent compiler can touch NumberPrototype etc. when traversing object's prototypes. This
means that eager initialization is not necessary under non-JIT mode. While we can investigate all the
accesses to these prototypes from the concurrent compiler threads, this "lazily initialize under non-JIT"
is safe and beneficial to non-JIT mode. This patch lazily initializes them under non-JIT mode, and
drop some @Number references to avoid eager initialization. This removes some object allocations and 1
MarkedBlock allocation just for Symbols.

* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::init):
(JSC::JSGlobalObject::visitChildren):
* runtime/JSGlobalObject.h:
(JSC::JSGlobalObject::numberToStringWatchpoint):
(JSC::JSGlobalObject::booleanPrototype const):
(JSC::JSGlobalObject::numberPrototype const):
(JSC::JSGlobalObject::symbolPrototype const):
(JSC::JSGlobalObject::booleanObjectStructure const):
(JSC::JSGlobalObject::symbolObjectStructure const):
(JSC::JSGlobalObject::numberObjectStructure const):
(JSC::JSGlobalObject::stringObjectStructure const):

Source/WebCore:

* Modules/streams/ReadableByteStreamInternals.js:
(privateInitializeReadableByteStreamController):
(readableByteStreamControllerRespond):

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

21 months agoUnreviewed, fix intentation.
nvasilyev@apple.com [Sat, 16 Feb 2019 01:21:47 +0000 (01:21 +0000)]
Unreviewed, fix intentation.

* UserInterface/Views/SpreadsheetRulesStyleDetailsPanel.css:
(.sidebar > .panel.details.css-style .rules):
(.sidebar > .panel.details.css-style > .content > .rules .section-header):

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

21 months ago[PSON] Allow tweaking WebProcess cache parameters via user defaults
cdumez@apple.com [Sat, 16 Feb 2019 01:18:25 +0000 (01:18 +0000)]
[PSON] Allow tweaking WebProcess cache parameters via user defaults
https://bugs.webkit.org/show_bug.cgi?id=194731
<rdar://problem/48125377>

Reviewed by Geoffrey Garen.

Allow tweaking WebProcess cache parameters via user defaults like so:
$ defaults write com.apple.Safari WebProcessCacheCachedProcessLifetimeInSeconds 120
-> Cached processes will be evicted after 2 minutes (instead of 30)

$ defaults write com.apple.Safari WebProcessCacheClearingDelayAfterApplicationResignsActiveInSeconds 60
-> Web process cache will be cleared if Safari is no longer active for 1 minutes (instead of 5).

* SourcesCocoa.txt:
* UIProcess/Cocoa/WebProcessCacheCocoa.mm: Copied from Source/WebKit/UIProcess/WebProcessCache.h.
(WebKit::WebProcessCache::platformInitialize):
* UIProcess/WebProcessCache.cpp:
(WebKit::WebProcessCache::WebProcessCache):
(WebKit::WebProcessCache::platformInitialize):
* UIProcess/WebProcessCache.h:
* WebKit.xcodeproj/project.pbxproj:

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

21 months agoRELEASE_ASSERT at com.apple.JavaScriptCore: JSC::jsSubstringOfResolved
msaboff@apple.com [Sat, 16 Feb 2019 01:13:57 +0000 (01:13 +0000)]
RELEASE_ASSERT at com.apple.JavaScriptCore: JSC::jsSubstringOfResolved
https://bugs.webkit.org/show_bug.cgi?id=194558

Reviewed by Saam Barati.

JSTests:

New regression test.

* stress/regexp-unicode-within-string.js: Added.

Source/JavaScriptCore:

Added an in bounds check before the read of the next character for Unicode regular expressions
for pattern generation that didn't already have such checks.

* yarr/YarrJIT.cpp:
(JSC::Yarr::YarrGenerator::generatePatternCharacterOnce):
(JSC::Yarr::YarrGenerator::generatePatternCharacterFixed):
(JSC::Yarr::YarrGenerator::generateCharacterClassOnce):
(JSC::Yarr::YarrGenerator::generateCharacterClassFixed):

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

21 months agoAllow emulation of user gestures from Web Inspector console
dino@apple.com [Sat, 16 Feb 2019 00:52:56 +0000 (00:52 +0000)]
Allow emulation of user gestures from Web Inspector console
https://bugs.webkit.org/show_bug.cgi?id=194725
<rdar://problem/48126604>

Reviewed by Joseph Pecoraro and Devin Rousso.

Source/JavaScriptCore:

* inspector/agents/InspectorRuntimeAgent.cpp: Add a new optional parameter, emulateUserGesture,
to the evaluate function, and mark the function as override so that PageRuntimeAgent
can change the behaviour.
(Inspector::InspectorRuntimeAgent::evaluate):
* inspector/agents/InspectorRuntimeAgent.h:
* inspector/protocol/Runtime.json:

Source/WebCore:

Test: inspector/runtime/evaluate-userGestureEmulation.html

* inspector/agents/page/PageRuntimeAgent.cpp: Override the emulate method and create
a UserGestureIndicator based on the emulateUserGesture option.
(WebCore::PageRuntimeAgent::evaluate):
* inspector/agents/page/PageRuntimeAgent.h:

Source/WebInspectorUI:

Add some UI for emulating a User Gesture when evaluating in the console. This
allows the developer to do things that would otherwise require actual interaction
with the page, such as start playback of media on iOS.

* Localizations/en.lproj/localizedStrings.js:
* UserInterface/Base/Setting.js: Add a new setting for this option.
* UserInterface/Controllers/JavaScriptLogViewController.js:
(WI.JavaScriptLogViewController.prototype.consolePromptTextCommitted):
* UserInterface/Controllers/RuntimeManager.js: Call evaluate with this new option.
(WI.RuntimeManager.prototype.evaluateInInspectedWindow):
* UserInterface/Views/LogContentView.js: Add a new checkbox in the upper bar
that allows the user to toggle the setting.
(WI.LogContentView):
(WI.LogContentView.prototype.get navigationItems):
(WI.LogContentView.prototype._handleEmulateInUserGestureSettingChanged):

* UserInterface/Views/NetworkTableContentView.js: Two drive-by typo fixes :)
(WI.NetworkTableContentView): perserve -> preserve
(WI.NetworkTableContentView.prototype.get navigationItems): checkboxs -> checkboxes

LayoutTests:

* inspector/runtime/evaluate-userGestureEmulation-expected.txt: Added.
* inspector/runtime/evaluate-userGestureEmulation.html: Added.

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

21 months agoSample domainsVisited diagnostic logging
cdumez@apple.com [Sat, 16 Feb 2019 00:36:06 +0000 (00:36 +0000)]
Sample domainsVisited diagnostic logging
https://bugs.webkit.org/show_bug.cgi?id=194657

Reviewed by Ryosuke Niwa.

Sample domainsVisited diagnostic logging, we are getting a lot of data from
this key and this is hurting our other keys.

* page/Page.cpp:
(WebCore::Page::logNavigation):

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

21 months ago[PSON] Disable WebContent process cache on devices with less than 3GB of RAM
cdumez@apple.com [Sat, 16 Feb 2019 00:35:05 +0000 (00:35 +0000)]
[PSON] Disable WebContent process cache on devices with less than 3GB of RAM
https://bugs.webkit.org/show_bug.cgi?id=194726
<rdar://problem/48126255>

Reviewed by Geoffrey Garen.

* UIProcess/WebProcessCache.cpp:
(WebKit::WebProcessCache::updateCapacity):

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

21 months ago[JSC] Do not initialize Wasm related data if Wasm is not enabled
ysuzuki@apple.com [Sat, 16 Feb 2019 00:18:54 +0000 (00:18 +0000)]
[JSC] Do not initialize Wasm related data if Wasm is not enabled
https://bugs.webkit.org/show_bug.cgi?id=194728

Reviewed by Mark Lam.

Under non-JIT mode, these data structures are unnecessary. Should not allocate extra memory for that.

* runtime/InitializeThreading.cpp:
(JSC::initializeThreading):
* runtime/JSLock.cpp:
(JSC::JSLock::didAcquireLock):

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

21 months agoCrash in the hit testing code via HTMLPlugInElement::isReplacementObscured()
rniwa@webkit.org [Fri, 15 Feb 2019 23:49:56 +0000 (23:49 +0000)]
Crash in the hit testing code via HTMLPlugInElement::isReplacementObscured()
https://bugs.webkit.org/show_bug.cgi?id=194691

Reviewed by Simon Fraser.

Source/WebCore:

The crash was caused by HTMLPlugInElement::isReplacementObscured updating the document
without updating the layout of ancestor documents (i.e. documents in which frame owner
elements appear) even though it hit-tests against the top-level document's RenderView.

Fixed the bug by updating the layout of the top-level document as needed.

Test: plugins/unsupported-plugin-with-replacement-in-iframe-crash.html

* html/HTMLPlugInElement.cpp:
(WebCore::HTMLPlugInElement::isReplacementObscured):

LayoutTests:

Added a regression test. It hits the newly added debug assertion without the fix.

* platform/mac-wk1/TestExpectations: Skip the test since DumpRenderTree doesn't support
testRunner.setPluginSupportedMode.
* plugins/unsupported-plugin-with-replacement-in-iframe-crash-expected.txt: Added.
* plugins/unsupported-plugin-with-replacement-in-iframe-crash.html: Added.

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

21 months ago[iOS] Stop setting a background color on the PDF host view
aestes@apple.com [Fri, 15 Feb 2019 23:45:54 +0000 (23:45 +0000)]
[iOS] Stop setting a background color on the PDF host view
https://bugs.webkit.org/show_bug.cgi?id=194722
<rdar://48124152>

Reviewed by Wenson Hsieh.

PDFKit already sets a background color on this view, so there’s no need (and some harm) in
us doing it too.

* UIProcess/ios/WKPDFView.mm:
(-[WKPDFView web_setContentProviderData:suggestedFilename:]):

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

21 months agoWeb Inspector: Styles: valid values in style attributes are reported as unsupported...
nvasilyev@apple.com [Fri, 15 Feb 2019 23:44:15 +0000 (23:44 +0000)]
Web Inspector: Styles: valid values in style attributes are reported as unsupported property values
https://bugs.webkit.org/show_bug.cgi?id=194619
<rdar://problem/47917373>

Source/WebInspectorUI:

Reviewed by Devin Rousso.

Payload of inline styles may contain `range` that doesn't match
the actual text of the payload - it has an extra empty line at the end.
Mismatching ranges caused data corruption.

* UserInterface/Models/DOMNodeStyles.js:
(WI.DOMNodeStyles.prototype._parseStylePropertyPayload):

LayoutTests:

Reviewed by Devin Rousso and Joseph Pecoraro.

* inspector/css/modify-inline-style-expected.txt: Added.
* inspector/css/modify-inline-style.html: Added.

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

21 months agoUpdate IPC code generator unit test expectations after r241611
achristensen@apple.com [Fri, 15 Feb 2019 23:39:27 +0000 (23:39 +0000)]
Update IPC code generator unit test expectations after r241611
https://bugs.webkit.org/show_bug.cgi?id=194678

* Scripts/webkit/LegacyMessages-expected.h:
* Scripts/webkit/Messages-expected.h:
* Scripts/webkit/MessagesSuperclass-expected.h:

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

21 months agoWeb Inspector: remove unused parameter in _parseStylePropertyPayload
nvasilyev@apple.com [Fri, 15 Feb 2019 23:37:51 +0000 (23:37 +0000)]
Web Inspector: remove unused parameter in _parseStylePropertyPayload
https://bugs.webkit.org/show_bug.cgi?id=194642

Reviewed by Devin Rousso.

* UserInterface/Models/DOMNodeStyles.js:
(WI.DOMNodeStyles.prototype._parseStyleDeclarationPayload):
The `styleText` parameter was never used

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

21 months ago[WTF] Add environment variable helpers
ross.kirsling@sony.com [Fri, 15 Feb 2019 22:47:26 +0000 (22:47 +0000)]
[WTF] Add environment variable helpers
https://bugs.webkit.org/show_bug.cgi?id=192405

Reviewed by Michael Catanzaro.

Source/JavaScriptCore:

* inspector/remote/glib/RemoteInspectorGlib.cpp:
(Inspector::RemoteInspector::RemoteInspector):
(Inspector::RemoteInspector::start):
* jsc.cpp:
(startTimeoutThreadIfNeeded):
* runtime/Options.cpp:
(JSC::overrideOptionWithHeuristic):
(JSC::Options::overrideAliasedOptionWithHeuristic):
(JSC::Options::initialize):
* runtime/VM.cpp:
(JSC::enableAssembler):
(JSC::VM::VM):
* tools/CodeProfiling.cpp:
(JSC::CodeProfiling::notifyAllocator):
Utilize WTF::Environment where possible.

Source/WebCore:

* platform/NotImplemented.h:
* platform/cocoa/SystemVersion.mm:
(WebCore::createSystemMarketingVersion):
* platform/graphics/gstreamer/GStreamerCommon.cpp:
(WebCore::initializeGStreamer):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
* platform/graphics/nicosia/NicosiaPaintingEngine.cpp:
(Nicosia::PaintingEngine::create):
* platform/graphics/texmap/TextureMapperFPSCounter.cpp:
(WebCore::TextureMapperFPSCounter::TextureMapperFPSCounter):
* platform/graphics/x11/PlatformDisplayX11.cpp:
(WebCore::PlatformDisplayX11::create):
* platform/gtk/RenderThemeWidget.cpp:
(WebCore::RenderThemeScrollbar::RenderThemeScrollbar):
* platform/gtk/ScrollbarThemeGtk.cpp:
(WebCore::ScrollbarThemeGtk::ScrollbarThemeGtk):
* platform/network/curl/CurlContext.cpp:
(WebCore::CurlContext::CurlContext):
(WebCore::EnvironmentVariableReader::read): Deleted.
(WebCore::EnvironmentVariableReader::defined): Deleted.
(WebCore::EnvironmentVariableReader::readAs): Deleted.
(WebCore::EnvironmentVariableReader::sscanTemplate): Deleted.
(WebCore::EnvironmentVariableReader::sscanTemplate<signed>): Deleted.
(WebCore::EnvironmentVariableReader::sscanTemplate<unsigned>): Deleted.
* platform/network/curl/NetworkStorageSessionCurl.cpp:
(WebCore::defaultCookieJarPath):
* platform/network/playstation/CurlSSLHandlePlayStation.cpp:
(WebCore::getCACertPathEnv):
* platform/network/win/CurlSSLHandleWin.cpp:
(WebCore::getCACertPathEnv):
* platform/text/hyphen/HyphenationLibHyphen.cpp:
(WebCore::topLevelPath):
(WebCore::webkitBuildDirectory):
* platform/unix/LoggingUnix.cpp:
(WebCore::logLevelString):
* platform/win/LoggingWin.cpp:
(WebCore::logLevelString):
Utilize WTF::Environment where possible.

Source/WebCore/PAL:

* pal/unix/LoggingUnix.cpp:
(PAL::logLevelString):
* pal/win/LoggingWin.cpp:
(PAL::logLevelString):
Utilize WTF::Environment where possible.

Source/WebKit:

* NetworkProcess/EntryPoint/unix/NetworkProcessMain.cpp:
(main):
* Platform/unix/LoggingUnix.cpp:
(WebKit::logLevelString):
* Platform/win/LoggingWin.cpp:
(WebKit::logLevelString):
* PluginProcess/mac/PluginProcessMac.mm:
(WebKit::shouldCallRealDebugger):
* Shared/Plugins/unix/PluginSearchPath.cpp:
(WebKit::pluginsDirectories):
* Shared/glib/ProcessExecutablePathGLib.cpp:
(WebKit::findWebKitProcess):
* UIProcess/API/glib/WebKitSettings.cpp:
(webKitSettingsConstructed):
(webKitSettingsSetProperty):
* UIProcess/API/glib/WebKitWebContext.cpp:
(injectedBundleDirectory):
(webkitWebContextConstructed):
* UIProcess/API/gtk/WebKitWebViewGtk.cpp:
(webkitWebViewMaximizeWindow):
(webkitWebViewRestoreWindow):
* UIProcess/API/wpe/WPEView.cpp:
(WKWPE::m_backend):
* UIProcess/AuxiliaryProcessProxy.cpp:
(WebKit::AuxiliaryProcessProxy::getLaunchOptions):
* UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
(WebKit::XDGDBusProxyLauncher::launch):
(WebKit::bindDBusSession):
(WebKit::bindX11):
(WebKit::bindWayland):
(WebKit::bindPulse):
(WebKit::bindPathVar):
(WebKit::bindGStreamerData):
(WebKit::bubblewrapSpawn):
* UIProcess/Launcher/glib/ProcessLauncherGLib.cpp:
(WebKit::ProcessLauncher::launchProcess):
* UIProcess/Launcher/mac/ProcessLauncherMac.mm:
(WebKit::systemDirectoryPath):
(WebKit::ProcessLauncher::launchProcess):
* UIProcess/glib/WebProcessPoolGLib.cpp:
(WebKit::memoryPressureMonitorDisabled):
(WebKit::WebProcessPool::platformInitialize):
(WebKit::WebProcessPool::platformInitializeWebProcess):
* UIProcess/gtk/HardwareAccelerationManager.cpp:
(WebKit::HardwareAccelerationManager::HardwareAccelerationManager):
* WebProcess/EntryPoint/unix/WebProcessMain.cpp:
(main):
* WebProcess/gtk/WebProcessMainGtk.cpp:
* WebProcess/wpe/WebProcessMainWPE.cpp:
Utilize WTF::Environment where possible.

Source/WebKitLegacy/ios:

* Misc/WebUIKitSupport.mm:
(WebKitPlatformSystemRootDirectory):
Utilize WTF::Environment where possible.

Source/WebKitLegacy/mac:

* WebView/WebView.mm:
(-[WebView _initWithFrame:frameName:groupName:]):
Utilize WTF::Environment where possible.

Source/WTF:

Create a new Environment API as a platform-independent, thread-safe(r)
way to get and set environment variables.

* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/Environment.h: Added.
* wtf/PlatformGTK.cmake:
* wtf/PlatformJSCOnly.cmake:
* wtf/PlatformMac.cmake:
* wtf/PlatformPlayStation.cmake:
* wtf/PlatformWPE.cmake:
* wtf/PlatformWin.cmake:
* wtf/posix/EnvironmentPOSIX.cpp: Added.
* wtf/win/EnvironmentWin.cpp: Added.
Introduce WTF::Environment.

* wtf/Threading.cpp:
(WTF::threadingIsInitialized):
(WTF::initializeThreading):
* wtf/Threading.h:
Introduce WTF::threadingIsInitialized() so that we can ASSERT that it's
false before setting an environment variable through the new API.

* wtf/DataLog.cpp:
(WTF::initializeLogFileOnce):
* wtf/NumberOfCores.cpp:
(WTF::numberOfProcessorCores):
* wtf/posix/FileSystemPOSIX.cpp:
(WTF::FileSystemImpl::openTemporaryFile):
Utilize WTF::Environment where possible.

Tools:

* DumpRenderTree/mac/DumpRenderTree.mm:
(libraryPathForDumpRenderTree):
* DumpRenderTree/win/DumpRenderTree.cpp:
(libraryPathForDumpRenderTree):
* TestRunnerShared/IOSLayoutTestCommunication.cpp:
(setUpIOSLayoutTestCommunication):
* TestWebKitAPI/Tests/WebKitGLib/TestAutomationSession.cpp:
(beforeAll):
* TestWebKitAPI/glib/WebKitGLib/TestMain.cpp:
(main):
* TestWebKitAPI/glib/WebKitGLib/WebKitTestBus.cpp:
(WebKitTestBus::run):
* WebKitTestRunner/InjectedBundle/gtk/ActivateFontsGtk.cpp:
(WTR::getOutputDir):
(WTR::initializeFontConfigSetting):
* WebKitTestRunner/InjectedBundle/gtk/InjectedBundleGtk.cpp:
(WTR::InjectedBundle::platformInitialize):
* WebKitTestRunner/InjectedBundle/gtk/InjectedBundleUtilities.cpp:
(WTR::topLevelPath):
* WebKitTestRunner/InjectedBundle/wpe/ActivateFontsWPE.cpp:
(WTR::topLevelPath):
(WTR::getOutputDir):
(WTR::activateFonts):
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::libraryPathForTesting):
(WTR::TestController::generateContextConfiguration const):
(WTR::TestController::generatePageConfiguration):
(WTR::TestController::decideDestinationWithSuggestedFilename):
(WTR::TestController::platformAdjustContext):
* WebKitTestRunner/TestController.h:
* WebKitTestRunner/cocoa/TestControllerCocoa.mm:
(WTR::TestController::cocoaPlatformInitialize):
(WTR::TestController::platformAdjustContext):
* WebKitTestRunner/gtk/main.cpp:
(main):
* WebKitTestRunner/mac/TestControllerMac.mm:
(WTR::TestController::configureContentExtensionForTest):
* WebKitTestRunner/wpe/main.cpp:
(main):
Utilize WTF::Environment where possible.

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

21 months agoAdd SPI version of WKPreferences.safeBrowsingEnabled
achristensen@apple.com [Fri, 15 Feb 2019 22:19:04 +0000 (22:19 +0000)]
Add SPI version of WKPreferences.safeBrowsingEnabled
https://bugs.webkit.org/show_bug.cgi?id=194718
<rdar://problem/48122993>

Rubber-stamped by Brady Eidson.

* UIProcess/API/Cocoa/WKPreferences.mm:
(-[WKPreferences _isSafeBrowsingEnabled]):
(-[WKPreferences _setSafeBrowsingEnabled:]):
* UIProcess/API/Cocoa/WKPreferencesPrivate.h:

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

21 months agoAdd a method to dispatch a PointerEvent based on a PlatformTouchEvent
graouts@webkit.org [Fri, 15 Feb 2019 22:18:36 +0000 (22:18 +0000)]
Add a method to dispatch a PointerEvent based on a PlatformTouchEvent
https://bugs.webkit.org/show_bug.cgi?id=194702
<rdar://problem/48109355>

Reviewed by Dean Jackson.

* page/EventHandler.cpp:
(WebCore::EventHandler::dispatchPointerEventForTouchAtIndex):
* page/EventHandler.h:

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

21 months agoWeb Inspector: Canvas: all actions after an offscreen path modification are marked...
drousso@apple.com [Fri, 15 Feb 2019 22:14:29 +0000 (22:14 +0000)]
Web Inspector: Canvas: all actions after an offscreen path modification are marked as offscreen path errors
https://bugs.webkit.org/show_bug.cgi?id=194684

Reviewed by Joseph Pecoraro.

* UserInterface/Models/RecordingAction.js:
(WI.RecordingAction.prototype.process):

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

21 months agoSamplingProfiler::stackTracesAsJSON() should escape strings.
mark.lam@apple.com [Fri, 15 Feb 2019 21:41:15 +0000 (21:41 +0000)]
SamplingProfiler::stackTracesAsJSON() should escape strings.
https://bugs.webkit.org/show_bug.cgi?id=194649
<rdar://problem/48072386>

Reviewed by Saam Barati.

JSTests:

* stress/sampling-profiler-stack-trace-with-double-quote-in-function-name.js: Added.
* stress/type-profiler-with-double-quote-in-constructor-name.js: Added.
* stress/type-profiler-with-double-quote-in-field-name.js: Added.
* stress/type-profiler-with-double-quote-in-optional-field-name.js: Added.

Source/JavaScriptCore:

Ditto for TypeSet::toJSONString() and TypeSet::toJSONString().

* runtime/SamplingProfiler.cpp:
(JSC::SamplingProfiler::stackTracesAsJSON):
* runtime/TypeSet.cpp:
(JSC::TypeSet::toJSONString const):
(JSC::StructureShape::toJSONString const):

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

21 months ago[iOS] WKWebView callout bar is missing Change Writing Direction item
wenson_hsieh@apple.com [Fri, 15 Feb 2019 21:35:52 +0000 (21:35 +0000)]
[iOS] WKWebView callout bar is missing Change Writing Direction item
https://bugs.webkit.org/show_bug.cgi?id=190015
<rdar://problem/44810366>

Reviewed by Tim Horton.

Source/WebKit:

Support -makeTextWritingDirectionLeftToRight: and -makeTextWritingDirectionRightToLeft: in WKWebView on iOS.
To match behavior in native UITextViews on iOS, we implement these methods by changing the *base* writing
direction, rather than the text writing direction (this is in contrast to macOS, which has different
NSResponder methods for changing the base writing direction as opposed to the text writing direction).

Additionally fixes the implementation of -makeTextWritingDirectionNatural:, which currently attempts to change
the text writing direction instead of the base writing direction.

* Platform/spi/ios/UIKitSPI.h:

Add a forward declaration for keyboards SPI to determine whether the user has an active RTL keyboard.

* Shared/EditorState.cpp:
(WebKit::EditorState::PostLayoutData::encode const):
(WebKit::EditorState::PostLayoutData::decode):
(WebKit::operator<<):
* Shared/EditorState.h:

Plumb the base writing direction to the UI process through EditorState.

* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView makeTextWritingDirectionNaturalForWebView:]):
(-[WKContentView makeTextWritingDirectionLeftToRightForWebView:]):
(-[WKContentView makeTextWritingDirectionRightToLeftForWebView:]):

Implement the new SPI (see above for more details).

(-[WKContentView canPerformActionForWebView:withSender:]):

Implement -canPerformAction: for LTR and RTL actions. To match existing UIWebView behavior, we only enable
these actions if either the base writing direction is RTL, or the user has an active RTL keyboard. This means,
for instance, that in the case where a user with only an English keyboard is editing LTR content, we would never
show an option to convert to RTL.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::editorState const):

Tools:

Make an existing API test that exercises platform SPI to change the inline text writing direction run only on
macOS, and add a new API test that uses similarly named SPI on iOS to change the base writing direction.

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

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

21 months ago[JSC] CodeBlock::jettison should clear related watchpoints
rmorisset@apple.com [Fri, 15 Feb 2019 21:34:19 +0000 (21:34 +0000)]
[JSC] CodeBlock::jettison should clear related watchpoints
https://bugs.webkit.org/show_bug.cgi?id=194544

Reviewed by Mark Lam.

* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::jettison):
* dfg/DFGCommonData.h:
(JSC::DFG::CommonData::clearWatchpoints): Added.
* dfg/CommonData.cpp:
(JSC::DFG::CommonData::clearWatchpoints): Added.

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

21 months agoMove bytecode cache-related filesystem code out of CodeCache
tzagallo@apple.com [Fri, 15 Feb 2019 21:27:54 +0000 (21:27 +0000)]
Move bytecode cache-related filesystem code out of CodeCache
https://bugs.webkit.org/show_bug.cgi?id=194675

Reviewed by Saam Barati.

That code is only used for the bytecode-cache tests, so it should live in
jsc.cpp rather than in the CodeCache.

* jsc.cpp:
(CliSourceProvider::create):
(CliSourceProvider::~CliSourceProvider):
(CliSourceProvider::cachePath const):
(CliSourceProvider::loadBytecode):
(CliSourceProvider::CliSourceProvider):
(jscSource):
(GlobalObject::moduleLoaderFetch):
(functionDollarEvalScript):
(runWithOptions):
* parser/SourceProvider.h:
(JSC::SourceProvider::cacheBytecode const):
* runtime/CodeCache.cpp:
(JSC::writeCodeBlock):
* runtime/CodeCache.h:
(JSC::CodeCacheMap::fetchFromDiskImpl):

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

21 months agoMake WebPaymentCoordinatorProxy more robust and modern
achristensen@apple.com [Fri, 15 Feb 2019 21:25:28 +0000 (21:25 +0000)]
Make WebPaymentCoordinatorProxy more robust and modern
https://bugs.webkit.org/show_bug.cgi?id=194678

Reviewed by Andy Estes.

Use WeakPtr instead of storing raw pointers in lambdas or the global activePaymentCoordinatorProxy to avoid UAF problems.
Call CompletionHandlers in all code paths to avoid hangs.
Use Delayed instead of LegacySync for synchronous messaging to progress towards removing LegacySync messages.

* Scripts/webkit/messages.py:
* UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp:
(WebKit::activePaymentCoordinatorProxy):
(WebKit::WebPaymentCoordinatorProxy::~WebPaymentCoordinatorProxy):
(WebKit::WebPaymentCoordinatorProxy::availablePaymentNetworks):
(WebKit::WebPaymentCoordinatorProxy::canMakePayments):
(WebKit::WebPaymentCoordinatorProxy::showPaymentUI):
(WebKit::WebPaymentCoordinatorProxy::didReachFinalState):
* UIProcess/ApplePay/WebPaymentCoordinatorProxy.h:
* UIProcess/ApplePay/WebPaymentCoordinatorProxy.messages.in:
* UIProcess/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm:
(WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI):
* UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
(WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI):

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

21 months ago[JSC] DFG, FTL, and Wasm worklist creation should be fenced
ysuzuki@apple.com [Fri, 15 Feb 2019 21:21:44 +0000 (21:21 +0000)]
[JSC] DFG, FTL, and Wasm worklist creation should be fenced
https://bugs.webkit.org/show_bug.cgi?id=194714

Reviewed by Mark Lam.

Let's consider about the following extreme case.

1. VM (A) is created.
2. Another VM (B) is created on a different thread.
3. (A) is being destroyed. It calls DFG::existingWorklistForIndexOrNull in a destructor.
4. At the same time, (B) starts using DFG Worklist and it is instantiated in call_once.
5. But (A) reads the pointer directly through DFG::existingWorklistForIndexOrNull.
6. (A) sees the half-baked worklist, which may be in the middle of creation.

This patch puts store-store fence just before putting a pointer to a global variable.
This fence is executed only three times at most, for DFG, FTL, and Wasm worklist initializations.

* dfg/DFGWorklist.cpp:
(JSC::DFG::ensureGlobalDFGWorklist):
(JSC::DFG::ensureGlobalFTLWorklist):
* wasm/WasmWorklist.cpp:
(JSC::Wasm::ensureWorklist):

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

21 months agoMake ServiceWorkerClientFetch closer to WebResourceLoader
youenn@apple.com [Fri, 15 Feb 2019 21:18:47 +0000 (21:18 +0000)]
Make ServiceWorkerClientFetch closer to WebResourceLoader
https://bugs.webkit.org/show_bug.cgi?id=194651

Unreviewed, build fix for WPE.

* WebProcess/Storage/WebServiceWorkerFetchTaskClient.h:

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

21 months ago[WebVTT] Inline WebVTT styles should start with '::cue'
pvollan@apple.com [Fri, 15 Feb 2019 21:13:06 +0000 (21:13 +0000)]
[WebVTT] Inline WebVTT styles should start with '::cue'
https://bugs.webkit.org/show_bug.cgi?id=194227

Reviewed by Eric Carlson.

Source/WebCore:

The original fix in r241203 is not sufficient, since it only checks if the CSS string starts
with '::cue'. Before accepting a CSS string from a WebVTT file, it should be checked that
all selectors starts with '::cue'.

Test: media/track/track-cue-css.html

* html/track/WebVTTParser.cpp:
(WebCore::WebVTTParser::checkAndStoreStyleSheet):

LayoutTests:

Add invalid 'STYLE' blocks which the WebVTT parser should reject.

* media/track/captions-webvtt/css-styling.vtt:

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

21 months agoAdd binding tests for ContextAllowsMediaDevices and ContextHasServiceWorkerScheme
youenn@apple.com [Fri, 15 Feb 2019 21:09:47 +0000 (21:09 +0000)]
Add binding tests for ContextAllowsMediaDevices and ContextHasServiceWorkerScheme
https://bugs.webkit.org/show_bug.cgi?id=194713

Reviewed by Eric Carlson.

Binding tests covering mediaDevices and serviceWorker attributes.

* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::JSTestObjPrototype::finishCreation):
(WebCore::jsTestObjMediaDevices1Getter):
(WebCore::jsTestObjMediaDevices1):
(WebCore::jsTestObjMediaDevices2Getter):
(WebCore::jsTestObjMediaDevices2):
(WebCore::jsTestObjServiceWorkers1Getter):
(WebCore::jsTestObjServiceWorkers1):
(WebCore::jsTestObjServiceWorkers2Getter):
(WebCore::jsTestObjServiceWorkers2):
* bindings/scripts/test/TestObj.idl:

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

21 months agoRegression(PSON) Navigating quickly back and forth can lead to getting 'about:blank...
cdumez@apple.com [Fri, 15 Feb 2019 21:03:53 +0000 (21:03 +0000)]
Regression(PSON) Navigating quickly back and forth can lead to getting 'about:blank' in the backforward list
https://bugs.webkit.org/show_bug.cgi?id=194717
<rdar://problem/47884404>

Reviewed by Brady Eidson.

Source/WebKit:

When the client does a history navigation, the UIProcess sends a WebPage::GoToBackForwardItem IPC to the
WebProcess and the WebProcess sends a WebPageProxy::BackForwardGoToItem IPC back to the UIProcess to
update the current item in the BackForwardList. This means that there is a slight delay between the
point a client requests a history navigation and the point where the BackForwardList's current item gets
update. This delay is pre-existing behavior and not new to PSON.

However, with PSON enabled, if we decide to process-swap for the history navigation, we'll tell the
previous (committed) process to ignore the load and we ask a new (provisional) process to do the history
navigation. When the previous process receives the request to ignore the history navigation, it restores
the History's current item to the one previous the navigation, which sends a WebPageProxy::GoToBackForwardItem
IPC to the UIProcess to update the BackForwardList as well. In parallel, the new process starts the
history navigation and also sends a WebPageProxy::GoToBackForwardItem to update the BackForwardList's
current item as well. We end up with a race between the 2 GoToBackForwardItem IPC messages coming from
the old and new process. If the old process's message loses the race, we end up with the wrong current
history item getting set in the UIProcess. Later, when we commit the provisional load and try to suspend
the previous page, we would save the SuspendedPage on the *wrong* BackForwardList item. If one tries to
load this BackForwardList item later, we'll use its SuspendedPage and try to unsuspend it. However,
because the PageCache entry is saved on another HistoryItem than the one getting loaded in the WebProcess
side, we attempt to do a regular load instead of a PageCache restore. We end up failing the load because
pages cannot trigger new loads while in page cache. Because the load fails, we end up loading the
initial empty document and this is how we end up with 'about:blank' in the back forward list.

To address the issue, update WebPageProxy::backForwardGoToItem() to ignore messages from the old/committed
WebProcess when there is a pending provisional load. If the committed processes starts a legit new
load, it would clear any existing pending provisional load before attempting the call backForwardGoToItem().
As a result, ignoring such messages from the old processes when there is a pending provisional load is
safe.

In the future, we should probably move more of the history / backForwardList management to the UIProcess
to avoid this sort of issues. This would be a much larger refactoring though so I am going with this
simpler fix that is easily cherry-pickable for now.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::suspendCurrentPageIfPossible):
(WebKit::WebPageProxy::continueNavigationInNewProcess):
(WebKit::WebPageProxy::backForwardGoToItem):

Tools:

Add API test coverage.

* TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:

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

21 months agoBuild fix.
bdakin@apple.com [Fri, 15 Feb 2019 21:00:01 +0000 (21:00 +0000)]
Build fix.

* rendering/RenderThemeIOS.mm:
(WebCore::iconForAttachment):

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

21 months agoUpdate IPC code generator unit test expectations after r241595
achristensen@apple.com [Fri, 15 Feb 2019 20:55:34 +0000 (20:55 +0000)]
Update IPC code generator unit test expectations after r241595
https://bugs.webkit.org/show_bug.cgi?id=194679

* Scripts/webkit/LegacyMessageReceiver-expected.cpp:
(WebKit::WebPage::didReceiveSyncWebPageMessage):
* Scripts/webkit/MessageReceiver-expected.cpp:
(WebKit::WebPage::didReceiveSyncMessage):

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

21 months agoMake ServiceWorkerClientFetch closer to WebResourceLoader
youenn@apple.com [Fri, 15 Feb 2019 20:25:02 +0000 (20:25 +0000)]
Make ServiceWorkerClientFetch closer to WebResourceLoader
https://bugs.webkit.org/show_bug.cgi?id=194651

Reviewed by Alex Christensen.

Source/WebCore:

Check for redirection response and if so call a specific client API.
Ensure ServiceWorkerFetch::Client gets called in the service worker thread proxy
so that its m_connection is only accessed on that thread.

Covered by existing tests.

* platform/network/FormData.h:
* platform/network/ResourceErrorBase.h:
* workers/service/context/ServiceWorkerFetch.cpp:
(WebCore::ServiceWorkerFetch::processResponse):
* workers/service/context/ServiceWorkerFetch.h:
* workers/service/context/ServiceWorkerThreadProxy.cpp:
(WebCore::ServiceWorkerThreadProxy::cancelFetch):
(WebCore::ServiceWorkerThreadProxy::continueDidReceiveFetchResponse):
* workers/service/context/ServiceWorkerThreadProxy.h:

Source/WebKit:

The goal of this refactoring is to, at some point use the regular network process load path for service worker loads.
This should simplify things and allow less IPC exchanges, for instance in the case of fetch not handled by service worker.

Introduce two IPC messages for supporting redirect responses and allow the didReceiveResponse/continueDidReceiveResponse
handshake for navigation loads.

This makes ServiceWorker having to buffer load information for this particular case.

* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::didReceiveFetchRedirectResponse):
(WebKit::NetworkProcess::didReceiveFetchResponse):
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.messages.in:
* NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
(WebKit::WebSWServerConnection::continueDidReceiveFetchResponse):
(WebKit::WebSWServerConnection::didReceiveFetchRedirectResponse):
(WebKit::WebSWServerConnection::didReceiveFetchResponse):
* NetworkProcess/ServiceWorker/WebSWServerConnection.h:
* NetworkProcess/ServiceWorker/WebSWServerConnection.messages.in:
* WebProcess/Storage/ServiceWorkerClientFetch.cpp:
(WebKit::ServiceWorkerClientFetch::start):
(WebKit::ServiceWorkerClientFetch::didReceiveRedirectResponse):
(WebKit::ServiceWorkerClientFetch::didReceiveResponse):
(WebKit::ServiceWorkerClientFetch::didReceiveData):
(WebKit::ServiceWorkerClientFetch::didFinish):
(WebKit::ServiceWorkerClientFetch::didFail):
(WebKit::ServiceWorkerClientFetch::didNotHandle):
(WebKit::ServiceWorkerClientFetch::cancel):
* WebProcess/Storage/ServiceWorkerClientFetch.h:
* WebProcess/Storage/ServiceWorkerClientFetch.messages.in:
* WebProcess/Storage/WebSWClientConnection.cpp:
(WebKit::WebSWClientConnection::startFetch):
(WebKit::WebSWClientConnection::cancelFetch):
(WebKit::WebSWClientConnection::continueDidReceiveFetchResponse):
* WebProcess/Storage/WebSWClientConnection.h:
* WebProcess/Storage/WebSWContextManagerConnection.cpp:
(WebKit::WebSWContextManagerConnection::continueDidReceiveFetchResponse):
(WebKit::WebSWContextManagerConnection::startFetch):
* WebProcess/Storage/WebSWContextManagerConnection.h:
* WebProcess/Storage/WebSWContextManagerConnection.messages.in:
* WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp:
(WebKit::WebServiceWorkerFetchTaskClient::WebServiceWorkerFetchTaskClient):
(WebKit::WebServiceWorkerFetchTaskClient::didReceiveRedirection):
(WebKit::WebServiceWorkerFetchTaskClient::didReceiveResponse):
(WebKit::WebServiceWorkerFetchTaskClient::didReceiveData):
(WebKit::WebServiceWorkerFetchTaskClient::didReceiveFormDataAndFinish):
(WebKit::WebServiceWorkerFetchTaskClient::didFail):
(WebKit::WebServiceWorkerFetchTaskClient::didFinish):
(WebKit::WebServiceWorkerFetchTaskClient::continueDidReceiveResponse):
* WebProcess/Storage/WebServiceWorkerFetchTaskClient.h:

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

21 months agoMake navigator.mediaDevices SecureContext
youenn@apple.com [Fri, 15 Feb 2019 19:22:35 +0000 (19:22 +0000)]
Make navigator.mediaDevices SecureContext
https://bugs.webkit.org/show_bug.cgi?id=194666

Reviewed by Eric Carlson.

Source/WebCore:

Make navigator.mediaDevices SecureContext.
This can still be enabled for unsecure context using the existing page settings.
To cover that case, introduce ContextHasMediaDevices custom IDL keyword.

Covered by API test.

* Modules/mediastream/NavigatorMediaDevices.idl:
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateRuntimeEnableConditionalString):
* bindings/scripts/IDLAttributes.json:
* dom/ScriptExecutionContext.cpp:
(WebCore::ScriptExecutionContext::hasMediaDevices const):
(WebCore::ScriptExecutionContext::hasServiceWorkerScheme const):
* dom/ScriptExecutionContext.h:

Tools:

* TestWebKitAPI/Tests/WebKitCocoa/UserMediaDisabled.mm:
(MediaCaptureDisabledTest::loadTestAndWaitForMessage):
(TEST_F):

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

21 months agoWeb Inspector: Canvas: taking a second recording doesn't select the Initial State...
drousso@apple.com [Fri, 15 Feb 2019 19:12:20 +0000 (19:12 +0000)]
Web Inspector: Canvas: taking a second recording doesn't select the Initial State by default
https://bugs.webkit.org/show_bug.cgi?id=194685

Reviewed by Matt Baker.

* UserInterface/Views/CanvasSidebarPanel.js:
(WI.CanvasSidebarPanel.prototype._recordingChanged):

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

21 months agoLayout Test accessibility/loading-iframe-sends-notification.html is timing out
pvollan@apple.com [Fri, 15 Feb 2019 19:09:34 +0000 (19:09 +0000)]
Layout Test accessibility/loading-iframe-sends-notification.html is timing out
https://bugs.webkit.org/show_bug.cgi?id=194712

Unreviewed test gardening.

* platform/win/TestExpectations:

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

21 months agoWebSocket should not fire events after being stopped
youenn@apple.com [Fri, 15 Feb 2019 19:08:06 +0000 (19:08 +0000)]
WebSocket should not fire events after being stopped
https://bugs.webkit.org/show_bug.cgi?id=194690

Reviewed by Geoffrey Garen.

dispatchOrQueueErrorEvent is scheduled using RunLoop::main().dispatch or dispatch_async.
This makes it possible to dispatch an event while WebSocket is already stopped.
Instead, use Document::postTask so that the task is only executed if WebSocket is not stopped.

As a refactoring, make use of PendingActivity to keep track of setPendingActivity/unsetPendingActivity more easily.

* Modules/websockets/WebSocket.cpp:
(WebCore::WebSocket::stop):
(WebCore::WebSocket::connect):
* Modules/websockets/WebSocket.h:

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

21 months agoPerformance should not fire events when its context is stopped
youenn@apple.com [Fri, 15 Feb 2019 19:06:47 +0000 (19:06 +0000)]
Performance should not fire events when its context is stopped
https://bugs.webkit.org/show_bug.cgi?id=194689

Reviewed by Alex Christensen.

Stop the timer when its context is destroyed.
Add an assertion to ensure the timer does not fire after context is destroyed.

* page/Performance.cpp:
(WebCore::Performance::stop):

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

21 months ago[Mac] WebInspectorUI.framework does not need to be soft-linked anymore
bburg@apple.com [Fri, 15 Feb 2019 19:01:52 +0000 (19:01 +0000)]
[Mac] WebInspectorUI.framework does not need to be soft-linked anymore
https://bugs.webkit.org/show_bug.cgi?id=194411
<rdar://problem/47787614>

Reviewed by Joseph Pecoraro.

Source/WebKit:

* Configurations/WebKit.xcconfig:
Conditionalize weak linking to WebInspectorUI.framework for Mac only.

* UIProcess/mac/WebInspectorProxyMac.mm:
(WebKit::WebInspectorProxy::inspectorPageURL):
(WebKit::WebInspectorProxy::inspectorTestPageURL):
(WebKit::WebInspectorProxy::inspectorBaseURL):
* WebProcess/WebPage/mac/WebInspectorUIMac.mm:
(WebKit::webInspectorUILocalizedStringsURL):
Rewrite uses of the bundle to exit early if bundle couldn't be loaded.

Source/WebKitLegacy/mac:

* Configurations/WebKitLegacy.xcconfig:
Conditionalize weak linking to WebInspectorUI.framework for Mac only.

* WebCoreSupport/WebInspectorClient.mm:
(WebInspectorFrontendClient::localizedStringsURL):
(-[WebInspectorWindowController inspectorPagePath]):
(-[WebInspectorWindowController inspectorTestPagePath]):
Rewrite uses of the bundle to exit early if bundle couldn't be loaded.

Source/WTF:

* wtf/cocoa/SoftLinking.h:
Remove macro that now has no uses.

Tools:

Remove unnecessary soft linking macro usage.

* DumpRenderTree/mac/TestRunnerMac.mm:
(TestRunner::inspectorTestStubURL):
(SOFT_LINK_STAGED_FRAMEWORK): Deleted.
* WebKitTestRunner/InjectedBundle/mac/TestRunnerMac.mm:
(WTR::TestRunner::inspectorTestStubURL):

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

21 months agoLayout Test fast/replaced/encrypted-pdf-as-object-and-embed.html is failing
pvollan@apple.com [Fri, 15 Feb 2019 19:01:50 +0000 (19:01 +0000)]
Layout Test fast/replaced/encrypted-pdf-as-object-and-embed.html is failing
https://bugs.webkit.org/show_bug.cgi?id=194711

Unreviewed test gardening.

* platform/win/TestExpectations:

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

21 months agoIPC code should support messages with both Delayed and WantsConnection attributes
achristensen@apple.com [Fri, 15 Feb 2019 18:53:02 +0000 (18:53 +0000)]
IPC code should support messages with both Delayed and WantsConnection attributes
https://bugs.webkit.org/show_bug.cgi?id=194679

Reviewed by Geoffrey Garen.

* Platform/IPC/HandleMessage.h:
(IPC::callMemberFunctionImpl):
(IPC::callMemberFunction):
(IPC::handleMessageDelayedWantsConnection):
* Scripts/webkit/messages.py:
* UIProcess/WebStorage/StorageManager.cpp:
(WebKit::StorageManager::getValues):
* UIProcess/WebStorage/StorageManager.h:
* UIProcess/WebStorage/StorageManager.messages.in:

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

21 months agoREGRESSION: ( r240978-r240985 ) [ iOS Release ] Layout Test imported/w3c/web-platform...
achristensen@apple.com [Fri, 15 Feb 2019 18:51:09 +0000 (18:51 +0000)]
REGRESSION: ( r240978-r240985 ) [ iOS Release ] Layout Test imported/w3c/web-platform-tests/xhr/send-redirect-post-upload.htm is crashing
https://bugs.webkit.org/show_bug.cgi?id=194523

Reviewed by Geoffrey Garen.

The scope of the FormCreationContext was limited to the scope of createHTTPBodyCFReadStream,
so when it was used in formCreate it was lucky to get the same context if the stack hadn't been overwritten
and if the FormData hadn't been freed.  Instead, keep it alive with new/delete like we do the FormStreamFields.
A younger me should've noticed this when reviewing r218517.

* platform/network/cf/FormDataStreamCFNet.cpp:
(WebCore::formCreate):
(WebCore::createHTTPBodyCFReadStream):

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

21 months agoUnreviewed, rolling out r241559 and r241566.
commit-queue@webkit.org [Fri, 15 Feb 2019 18:26:16 +0000 (18:26 +0000)]
Unreviewed, rolling out r241559 and r241566.
https://bugs.webkit.org/show_bug.cgi?id=194710

Causes layout test crashes under GuardMalloc (Requested by
ryanhaddad on #webkit).

Reverted changesets:

"[WTF] Add environment variable helpers"
https://bugs.webkit.org/show_bug.cgi?id=192405
https://trac.webkit.org/changeset/241559

"Unreviewed build fix for WinCairo Debug after r241559."
https://trac.webkit.org/changeset/241566

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