WebKit-https.git
16 months agoAllow new vector types to work with the interactive interpreter
commit-queue@webkit.org [Mon, 27 Aug 2018 18:22:06 +0000 (18:22 +0000)]
Allow new vector types to work with the interactive interpreter
https://bugs.webkit.org/show_bug.cgi?id=188988

Patch by Thomas Denney <tdenney@apple.com> on 2018-08-27
Reviewed by Myles C. Maxfield.

* WebGPUShadingLanguageRI/FlattenedStructOffsetGatherer.js:
(FlattenedStructOffsetGatherer.prototype.visitTypeRef): Do not
unncessarily visit the type arguments of a TypeRef, as by this point
there are none that are relevant.
* WebGPUShadingLanguageRI/Intrinsics.js:
(Intrinsics): Treat VectorType as a primitive type.

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

16 months agoFix internal builds after r235368
achristensen@apple.com [Mon, 27 Aug 2018 17:54:04 +0000 (17:54 +0000)]
Fix internal builds after r235368

* UIProcess/API/Cocoa/WKBrowsingContextLoadDelegate.h:
At least the ios macros need an introductory version.

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

16 months agoUpdate WPT tools to 87329a1
youenn@apple.com [Mon, 27 Aug 2018 17:38:38 +0000 (17:38 +0000)]
Update WPT tools to 87329a1
https://bugs.webkit.org/show_bug.cgi?id=188766

Reviewed by Ryosuke Niwa.

LayoutTests/imported/w3c:

* resources/config.json:
* web-platform-tests/fetch/cross-origin-resource-policy/fetch.any.js:
Fixing test that was including testharness.js twice once explictly and once with WPT test template.
* web-platform-tests/infrastructure: Refreshed.
* web-platform-tests/infrastructure/testdriver/bless.html: Added.
* web-platform-tests/tools: Refreshed

LayoutTests:

The test name (.any.serviceworker.html) is clashing with the new WPT server.

* http/wpt/service-workers/cors-preflight-star.any-serviceworker-expected.txt: Renamed from LayoutTests/http/wpt/service-workers/cors-preflight-star.any.serviceworker-expected.txt.
* http/wpt/service-workers/cors-preflight-star.any-serviceworker.html: Renamed from LayoutTests/http/wpt/service-workers/cors-preflight-star.any.serviceworker.html.

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

16 months agoBuild system support for LTO
krollin@apple.com [Mon, 27 Aug 2018 17:16:17 +0000 (17:16 +0000)]
Build system support for LTO
https://bugs.webkit.org/show_bug.cgi?id=187785
<rdar://problem/42353132>

Reviewed by Dan Bernstein.

.:

Add support for building WebKit with LTO (Link Time Optimization) on
macOS and iOS. Both variations are supported: "full" (which performs
all the optimizations it can regardless of the cost) and "thin" (which
sacrifices some optimizations in order to recover build time and
memory usage).

By default, LTO is disabled for Debug and Release builds, but is
enabled for Production builds. For Debug and Release builds, LTO is
controlled as follows:

- When using `make` from the command line, include
  WK_LTO_MODE={none,thin,full}. For example, `make WK_LTO_MODE=full
  release`. As when specifying debug/release, the LTO configuration
  information is written to the WebKitBuild directory and is used as
  the default on the next build if a new setting is not specified.

- When using `build-webkit`, include --lto-mode={none,thin,full} on
  the command line. For example, `build-webkit --lto-mode=full ...`.

- When using Xcode, create a configuration file called
  LocalOverrides.xcconfig at the root level of your WebKit checkout
  directory. Include within it a line that says:

    WK_LTO_MODE={none,thin,full}

  For example:

    WK_LTO_MODE=full

Note that LocalOverrides.xcconfig is included in the .gitignore file,
so you won't accidentally check your changes into source control.

Enabling LTO can greatly increase build times, especially when using
"full" LTO with 32GB or RAM or less. Following is a table of full
build times for a Release build on a fully decked-out 2017 iMac Pro:

    LTO     macOS      iOS
    -----  -------   -------
    None:   9m 11s   14m 11s
    Thin:  11m 44s   17m 30s
    Full:  21m 39s   28m 56s

Incremental times are affected even more greatly. The actual
optimization and compilation of LLVM bitcode is moved to the link
phase, meaning that the link phase, which previously took only
seconds, can now take many minutes. It's for this reason that LTO is
not enabled in Debug and Release builds, since incremental builds are
an integral part of those configurations. However, using the
mechanisms described above, developers can perform optional LTO builds
if needed to track down build or runtime issues in that configuration.

* .gitignore: Include LocalOverrides.xcconfig.
* Makefile.shared: Add support for WK_LTO_MODE on the command line.

Source/bmalloc:

Update Base.xcconfig and DebugRelease.xcconfig to optionally enable
LTO.

* Configurations/Base.xcconfig:
* Configurations/DebugRelease.xcconfig:

Source/JavaScriptCore:

Update Base.xcconfig and DebugRelease.xcconfig to optionally enable
LTO.

* Configurations/Base.xcconfig:
* Configurations/DebugRelease.xcconfig:

Source/ThirdParty/ANGLE:

Update Base.xcconfig and DebugRelease.xcconfig to optionally enable
LTO.

* Configurations/Base.xcconfig:
* Configurations/DebugRelease.xcconfig:

Source/ThirdParty/libwebrtc:

Update Base.xcconfig and DebugRelease.xcconfig to optionally enable
LTO.

* Configurations/Base.xcconfig:
* Configurations/DebugRelease.xcconfig:

Source/WebCore:

Update Base.xcconfig and DebugRelease.xcconfig to optionally enable
LTO.

No new tests -- no new WebKit functionality.

* Configurations/Base.xcconfig:
* Configurations/DebugRelease.xcconfig:

Source/WebCore/PAL:

Update Base.xcconfig and DebugRelease.xcconfig to optionally enable
LTO.

* Configurations/Base.xcconfig:
* Configurations/DebugRelease.xcconfig:

Source/WebInspectorUI:

Update Base.xcconfig and DebugRelease.xcconfig to optionally enable
LTO.

* Configurations/Base.xcconfig:
* Configurations/DebugRelease.xcconfig:

Source/WebKit:

Update Base.xcconfig and DebugRelease.xcconfig to optionally enable
LTO.

* Configurations/Base.xcconfig:
* Configurations/DebugRelease.xcconfig:

Source/WebKitLegacy/mac:

Update Base.xcconfig and DebugRelease.xcconfig to optionally enable
LTO.

* Configurations/Base.xcconfig:
* Configurations/DebugRelease.xcconfig:

Source/WTF:

Update Base.xcconfig and DebugRelease.xcconfig to optionally enable
LTO.

* Configurations/Base.xcconfig:
* Configurations/DebugRelease.xcconfig:

Tools:

Add tools/scripts support for controlling LTO builds.

* Scripts/build-webkit: Add --lto-mode={none,thin,full}.
* Scripts/set-webkit-configuration: Add support for saving LTO
configuration to WebKitBuild/LTO.
* Scripts/webkitdirs.pm: Add support for reading configuration from
WebKitBuild/LTO and providing it to xcodebuild.
(determineLTOMode):
(ltoMode):
(XcodeOptions):

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

16 months ago[iOS] Make color of spelling dots match UIKit
dbates@webkit.org [Mon, 27 Aug 2018 17:10:55 +0000 (17:10 +0000)]
[iOS] Make color of spelling dots match UIKit
https://bugs.webkit.org/show_bug.cgi?id=188861

Reviewed by Simon Fraser.

* rendering/RenderThemeCocoa.h:
* rendering/RenderThemeCocoa.mm:
(WebCore::RenderThemeCocoa::drawLineForDocumentMarker): Modified to call colorForMarkerLineStyle()
for the color to use for the line style.
(WebCore::colorForStyle): Deleted.
* rendering/RenderThemeIOS.h:
* rendering/RenderThemeIOS.mm:
(WebCore::RenderThemeIOS::colorForMarkerLineStyle): Added.
* rendering/RenderThemeMac.h:
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::colorForMarkerLineStyle): Added.

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

16 months agoRemove extern variable and simplify state initialization in TextCheckerMac.mm
dbates@webkit.org [Mon, 27 Aug 2018 17:09:20 +0000 (17:09 +0000)]
Remove extern variable and simplify state initialization in TextCheckerMac.mm
https://bugs.webkit.org/show_bug.cgi?id=188820

Reviewed by Simon Fraser.

Use the same approach to initializing the TextCheckerState in TextCheckerMac.mm as we did in
TextCheckerIOS.mm. Make use of a static, non-member, file-local function and NeverDestroyed
to initialize a TextCheckerState object once and provide access to it from other implementation
functions.

* UIProcess/mac/TextCheckerMac.mm:
(WebKit::mutableState):
(WebKit::TextChecker::state):
(WebKit::TextChecker::setTestingMode):
(WebKit::TextChecker::setContinuousSpellCheckingEnabled):
(WebKit::TextChecker::setGrammarCheckingEnabled):
(WebKit::TextChecker::setAutomaticSpellingCorrectionEnabled):
(WebKit::TextChecker::setAutomaticQuoteSubstitutionEnabled):
(WebKit::TextChecker::setAutomaticDashSubstitutionEnabled):
(WebKit::TextChecker::setAutomaticLinkDetectionEnabled):
(WebKit::TextChecker::setAutomaticTextReplacementEnabled):
(WebKit::TextChecker::didChangeAutomaticTextReplacementEnabled):
(WebKit::TextChecker::didChangeAutomaticSpellingCorrectionEnabled):
(WebKit::TextChecker::didChangeAutomaticQuoteSubstitutionEnabled):
(WebKit::TextChecker::didChangeAutomaticDashSubstitutionEnabled):
(WebKit::TextChecker::continuousSpellCheckingEnabledStateChanged):
(WebKit::TextChecker::grammarCheckingEnabledStateChanged):
(WebKit::initializeState): Deleted.

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

16 months agoSpelling dots do not scale with page on iOS; share spelling dot painting code between...
dbates@webkit.org [Mon, 27 Aug 2018 17:06:09 +0000 (17:06 +0000)]
Spelling dots do not scale with page on iOS; share spelling dot painting code between Mac and iOS
https://bugs.webkit.org/show_bug.cgi?id=188828
<rdar://problem/15966403>

Reviewed by Simon Fraser.

The look of the spelling dots on Mac and iOS are identical up to color. Towards making the
spelling dots in WebKit on iOS more closely match the look of the spelling dots in UIKit-
apps, standardize on using the same painting code for both Mac and iOS.

Currently iOS uses bitmaps to render the spelling dots and does not account for user/CSS
zooming. As a result, the spelling dots on iOS render with artifacts (e.g. truncated dots).
A side benefit of having iOS share the same painting code as Mac is that iOS will now paint
the dots programmatically and we avoid both the need to use bitmaps and fix the bugs in
the painting of the bitmap dots with respect to zooming.

* Resources/DictationPhraseWithAlternativesDot.png: Removed.
* Resources/DictationPhraseWithAlternativesDot@2x.png: Removed.
* Resources/SpellingDot.png: Removed.
* Resources/SpellingDot@2x.png: Removed.
* Resources/SpellingDot@3x.png: Removed.
* WebCore.xcodeproj/project.pbxproj:
* page/Page.cpp:
(WebCore::Page::setDeviceScaleFactor):
* platform/graphics/GraphicsContext.h:
* platform/graphics/cairo/GraphicsContextCairo.cpp:
(WebCore::GraphicsContext::updateDocumentMarkerResources): Deleted.
* platform/graphics/cocoa/GraphicsContextCocoa.mm:
(WebCore::GraphicsContext::drawLineForDocumentMarker):
(WebCore::findImage): Deleted.
(WebCore::createDotPattern): Deleted.
(WebCore::GraphicsContext::updateDocumentMarkerResources): Deleted.
* platform/graphics/win/GraphicsContextCGWin.cpp:
(WebCore::GraphicsContext::updateDocumentMarkerResources): Deleted.
* platform/graphics/win/GraphicsContextDirect2D.cpp:
(WebCore::GraphicsContext::updateDocumentMarkerResources): Deleted.
* platform/ios/wak/WKGraphics.mm:
(WKRectFill): Incorporated the logic from _FillRectUsingOperation().
(_FillRectUsingOperation): Deleted; moved the logic into WKRectFill() since WKRectFill()
is now the only caller of this function.
(WKRectFillUsingOperation): Deleted.
(imageResourcePath): Deleted.
(WKGraphicsCreateImageFromBundleWithName): Deleted.
(WKDrawPatternBitmap): Deleted.
(WKReleasePatternBitmap): Deleted.
(WKSetPattern): Deleted.
* platform/ios/wak/WKGraphicsInternal.h: Removed.
* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::paintPlatformDocumentMarker):
* rendering/RenderThemeCocoa.h: Add headers RenderText.h and GraphicsContextCG.h. Fix some style nits while I am here;
substitute #import for #include and remove some unnecessary headers TranslateTransformOperation.h, RenderStyle.h, and
RenderElement.h.
* rendering/RenderThemeCocoa.mm:
(WebCore::colorForStyle):
(WebCore::RenderThemeCocoa::drawLineForDocumentMarker): Moved from RenderThemeMac. I renamed
the local variable ctx to context and fixed a type in a comment while moving this code.
* rendering/RenderThemeMac.h:
* rendering/RenderThemeMac.mm:
(WebCore::colorForStyle): Deleted; moved to class RenderThemeCocoa.
(WebCore::RenderThemeMac::drawLineForDocumentMarker): Deleted; moved to class RenderThemeCocoa.

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

16 months agoWeb Inspector: REGRESSION: virtualized TreeOutline is empty when filtering
drousso@apple.com [Mon, 27 Aug 2018 16:59:39 +0000 (16:59 +0000)]
Web Inspector: REGRESSION: virtualized TreeOutline is empty when filtering
https://bugs.webkit.org/show_bug.cgi?id=188959

Reviewed by Brian Burg.

* UserInterface/Views/TreeElement.js:
(WI.TreeElement.prototype.set hidden):
Only set `focusedTreeElement` if the `WI.TreeElement` is selected and not hidden. There is
no reason to focus a hidden or unselected `WI.TreeElement`.

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

16 months agolldb-webkit: Pretty-print OptionSet
dbates@webkit.org [Mon, 27 Aug 2018 16:59:32 +0000 (16:59 +0000)]
lldb-webkit: Pretty-print OptionSet
https://bugs.webkit.org/show_bug.cgi?id=188936

Reviewed by Simon Fraser.

Add LLDB formatters to pretty-print an OptionSet.

* lldb/lldbWebKitTester/main.cpp:
(testSummaryProviders):
* lldb/lldb_webkit.py:
(__lldb_init_module):
(__lldb_init_module.lldb_webkit):
(WTFOptionSet_SummaryProvider):
(WTFOptionSetProvider):
(WTFOptionSetProvider.__init__):
(WTFOptionSetProvider.has_children):
(WTFOptionSetProvider.num_children):
(WTFOptionSetProvider.get_child_index):
(WTFOptionSetProvider.get_child_at_index):
(WTFOptionSetProvider.update):
* lldb/lldb_webkit_unittest.py:
(TestSummaryProviders.serial_test_WTFHashSet_tablesize_and_size):
(TestSummaryProviders):
(TestSummaryProviders.serial_test_WTFOptionSet_SummaryProvider_empty):
(TestSummaryProviders.serial_test_WTFOptionSet_SummaryProvider_simple):
(TestSummaryProviders.serial_test_WTFOptionSetProvider_empty):
(TestSummaryProviders.serial_test_WTFOptionSetProvider_simple):

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

16 months ago[Attachment Support] [WK2] Images copied from Mail message view paste with the wrong...
wenson_hsieh@apple.com [Mon, 27 Aug 2018 16:45:24 +0000 (16:45 +0000)]
[Attachment Support] [WK2] Images copied from Mail message view paste with the wrong file name in compose
https://bugs.webkit.org/show_bug.cgi?id=188957
<rdar://problem/43737715>

Reviewed by Darin Adler.

Source/WebCore:

Allow the alt attribute of a pasted image element to determine the name of an image attachment, rather than
using the source URL's last path component first. This is because in some clients, such as Mail, the source of
the image element is some nondescript UUID, and the alt text contains the real name of the image.

Test: WKAttachmentTests.PasteWebArchiveContainingImages

* editing/cocoa/WebContentReaderCocoa.mm:
(WebCore::replaceRichContentWithAttachments):

Tools:

Add a new API test to verify that pasting a web archive containing several image elements with alt attributes
generates _WKAttachments whose names reflect those alt attributes.

* TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm:
(testGIFFileURL):
(testGIFData):
(TestWebKitAPI::TEST):

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

16 months agoDon't launch network process in WebCookieManagerProxy::setHTTPCookieAcceptPolicy
sihui_liu@apple.com [Mon, 27 Aug 2018 16:43:23 +0000 (16:43 +0000)]
Don't launch network process in WebCookieManagerProxy::setHTTPCookieAcceptPolicy
https://bugs.webkit.org/show_bug.cgi?id=188906
<rdar://problem/42875795>

Reviewed by Ryosuke Niwa.

Add callback in early return.

* UIProcess/WebCookieManagerProxy.cpp:
(WebKit::WebCookieManagerProxy::setHTTPCookieAcceptPolicy):

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

16 months ago[GTK][JSC] Add warn_unused_result attribute to some APIs
commit-queue@webkit.org [Mon, 27 Aug 2018 16:39:11 +0000 (16:39 +0000)]
[GTK][JSC] Add warn_unused_result attribute to some APIs
https://bugs.webkit.org/show_bug.cgi?id=188983

Patch by Patrick Griffis <pgriffis@igalia.com> on 2018-08-27
Reviewed by Michael Catanzaro.

* API/glib/JSCValue.h:

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

16 months agoUnreviewed, rolling out r235367.
achristensen@apple.com [Mon, 27 Aug 2018 16:34:11 +0000 (16:34 +0000)]
Unreviewed, rolling out r235367.

Broke iOS build.

Reverted changeset:

"Translate 4 tests using WKPageLoaderClient to ObjC"
https://bugs.webkit.org/show_bug.cgi?id=188827
https://trac.webkit.org/changeset/235367

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

16 months agoFix GTK build.
achristensen@apple.com [Mon, 27 Aug 2018 16:27:31 +0000 (16:27 +0000)]
Fix GTK build.

* TestWebKitAPI/CMakeLists.txt:

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

16 months agoFix iOS build.
achristensen@apple.com [Mon, 27 Aug 2018 16:25:10 +0000 (16:25 +0000)]
Fix iOS build.

* TestWebKitAPI/PlatformWebView.h:

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

16 months agoTransition WKBrowsingContextController from WKPageLoaderClient to WKPageNavigationClient
achristensen@apple.com [Mon, 27 Aug 2018 16:16:10 +0000 (16:16 +0000)]
Transition WKBrowsingContextController from WKPageLoaderClient to WKPageNavigationClient
https://bugs.webkit.org/show_bug.cgi?id=188942

Reviewed by Andy Estes.

* UIProcess/API/Cocoa/WKBrowsingContextController.mm:
(didStartProvisionalNavigation):
(didReceiveServerRedirectForProvisionalNavigation):
(didFailProvisionalNavigation):
(didCommitNavigation):
(didFinishNavigation):
(didFailNavigation):
(canAuthenticateAgainstProtectionSpace):
(didReceiveAuthenticationChallenge):
(setUpPageLoaderClient):
(-[WKBrowsingContextController setLoadDelegate:]):
(didStartProvisionalLoadForFrame): Deleted.
(didReceiveServerRedirectForProvisionalLoadForFrame): Deleted.
(didFailProvisionalLoadWithErrorForFrame): Deleted.
(didCommitLoadForFrame): Deleted.
(didFinishLoadForFrame): Deleted.
(didFailLoadWithErrorForFrame): Deleted.
(canAuthenticateAgainstProtectionSpaceInFrame): Deleted.
(didReceiveAuthenticationChallengeInFrame): Deleted.
(didStartProgress): Deleted.
(didChangeProgress): Deleted.
(didFinishProgress): Deleted.
(didChangeBackForwardList): Deleted.
* UIProcess/API/Cocoa/WKBrowsingContextLoadDelegate.h:

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

16 months agoTranslate 4 tests using WKPageLoaderClient to ObjC
achristensen@apple.com [Mon, 27 Aug 2018 16:08:17 +0000 (16:08 +0000)]
Translate 4 tests using WKPageLoaderClient to ObjC
https://bugs.webkit.org/show_bug.cgi?id=188827

Reviewed by Tim Horton.

They use processDidBecomeUnresponsive, didChangeBackForwardList, or willGoToBackForwardListItem.
Rather than introduce these to WKPageNavigationClient, I just translated the tests to use WKNavigationDelegate, which already have equivalent callbacks.
willGoToBackForwardListItem had userData from the InjectedBundle, but nobody was using it so I did not add that to the ObjC SPI, so I don't test that unused
bundle functionality any more.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit/ResponsivenessTimer.cpp: Removed.
* TestWebKitAPI/Tests/WebKit/ResponsivenessTimerDoesntFireEarly.cpp: Removed.
* TestWebKitAPI/Tests/WebKit/RestoreSessionStateWithoutNavigation.cpp: Removed.
* TestWebKitAPI/Tests/WebKit/ShouldGoToBackForwardListItem.cpp: Removed.
* TestWebKitAPI/Tests/WebKit/ShouldGoToBackForwardListItem_Bundle.cpp: Removed.
* TestWebKitAPI/Tests/WebKitCocoa/ResponsivenessTimer.mm: Copied from Tools/TestWebKitAPI/Tests/WebKit/ResponsivenessTimer.cpp.
(-[ResponsivenessTimerDelegate webView:didFinishNavigation:]):
(-[ResponsivenessTimerDelegate _webViewWebProcessDidBecomeUnresponsive:]):
(TestWebKitAPI::TEST):
(): Deleted.
(TestWebKitAPI::didFinishLoadForFrame): Deleted.
(TestWebKitAPI::processDidBecomeUnresponsive): Deleted.
(TestWebKitAPI::setPageLoaderClient): Deleted.
* TestWebKitAPI/Tests/WebKitCocoa/ResponsivenessTimerDoesntFireEarly.mm: Copied from Tools/TestWebKitAPI/Tests/WebKit/ResponsivenessTimerDoesntFireEarly.cpp.
(-[ResponsivenessDelegate webView:didFinishNavigation:]):
(-[ResponsivenessDelegate _webViewWebProcessDidBecomeUnresponsive:]):
(TestWebKitAPI::TEST):
(TestWebKitAPI::didReceiveMessageFromInjectedBundle): Deleted.
(TestWebKitAPI::didFinishLoadForFrame): Deleted.
(TestWebKitAPI::processDidBecomeUnresponsive): Deleted.
(TestWebKitAPI::setInjectedBundleClient): Deleted.
(TestWebKitAPI::setPageLoaderClient): Deleted.
* TestWebKitAPI/Tests/WebKitCocoa/RestoreSessionStateWithoutNavigation.mm: Copied from Tools/TestWebKitAPI/Tests/WebKit/RestoreSessionStateWithoutNavigation.cpp.
(-[SessionStateDelegate webView:didFinishNavigation:]):
(-[SessionStateDelegate _webView:backForwardListItemAdded:removed:]):
(TestWebKitAPI::createSessionStateData):
(TestWebKitAPI::TEST):
(TestWebKitAPI::didFinishLoadForFrame): Deleted.
(TestWebKitAPI::didChangeBackForwardListForPage): Deleted.
(TestWebKitAPI::setPageLoaderClient): Deleted.
* TestWebKitAPI/Tests/WebKitCocoa/ShouldGoToBackForwardListItem.mm: Copied from Tools/TestWebKitAPI/Tests/WebKit/ShouldGoToBackForwardListItem.cpp.
(-[BackForwardClient webView:didFinishNavigation:]):
(-[BackForwardClient _webView:willGoToBackForwardListItem:inPageCache:]):
(TestWebKitAPI::TEST):
(TestWebKitAPI::didFinishLoadForFrame): Deleted.
(TestWebKitAPI::willGoToBackForwardListItem): Deleted.
(TestWebKitAPI::setPageLoaderClient): Deleted.

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

16 months ago[Cocoa] Adapt more WebKit code to be ARC-compatible
darin@apple.com [Mon, 27 Aug 2018 15:51:24 +0000 (15:51 +0000)]
[Cocoa] Adapt more WebKit code to be ARC-compatible
https://bugs.webkit.org/show_bug.cgi?id=188955

Reviewed by Anders Carlsson.

* NetworkProcess/cocoa/NetworkDataTaskCocoa.h: Use __strong for an in/out argument.
* NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
(WebKit::NetworkDataTaskCocoa::applySniffingPoliciesAndBindRequestToInferfaceIfNeeded):
Use __strong for a in/out argument.
(WebKit::NetworkDataTaskCocoa::applyCookieBlockingPolicy): Call a NSURLSessionTask
method using an explicit category declaration rather than by using performSelector:
since ARC is unable to correctly compile a call when it doesn't know argument and
result types.

* PluginProcess/mac/PluginProcessMac.mm:
(WebKit::initializeCocoaOverrides): Add some __bridge casts.

* Shared/API/Cocoa/WKRemoteObjectCoder.mm: Use HashSet<CFTypeRef> instead of
HashSet<Class> since Class ia an ARC-managed type and WTF hash tables can't
currently handle those as key types.
(-[WKRemoteObjectDecoder decodeValueOfObjCType:at:]): Changed types and added casts
to adapt to the above.
(decodeObjectFromObjectStream): Ditto.
(checkIfClassIsAllowed): Ditto.
(decodeInvocationArguments): Ditto.
(decodeObject): Ditto.
(-[WKRemoteObjectDecoder decodeObjectOfClasses:forKey:]): Ditto.
(-[WKRemoteObjectDecoder allowedClasses]): Ditto.
* Shared/API/Cocoa/_WKRemoteObjectInterface.mm:
(propertyListClasses): Ditto.
(initializeMethod): Ditto.
(-[_WKRemoteObjectInterface debugDescription]): Ditto.
(classesForSelectorArgument): Ditto.
(-[_WKRemoteObjectInterface classesForSelector:argumentIndex:ofReply:]): Ditto.
(-[_WKRemoteObjectInterface setClasses:forSelector:argumentIndex:ofReply:]): Ditto.
(-[_WKRemoteObjectInterface _allowedArgumentClassesForSelector:]): Ditto.
(-[_WKRemoteObjectInterface _allowedArgumentClassesForReplyBlockOfSelector:]): Ditto.
* Shared/API/Cocoa/_WKRemoteObjectInterfaceInternal.h: Ditto.

* Shared/API/c/cf/WKStringCF.mm:
(WKStringCreateWithCFString): Use CFRetain instead of -[NSObject retain]. Also use
a __bridge cast.
* Shared/API/c/cf/WKURLCF.mm:
(WKURLCreateWithCFURL): Ditto.

* Shared/Cocoa/APIObject.mm:
(API::Object::ref): Added a __bridge cast.
(API::Object::deref): Ditto.
(API::allocateWKObject): Use class_createInstance instead of NSAllocateObject.
(API::Object::wrap): Use a __bridge cast.
(API::Object::unwrap): Ditto.

* Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.h: Use CFTypeRef for layers
or views in the RelatedLayerMap since we don't want the items retained, and can't
use __unsafe_uretained because the header is used in non-Objective-C contexts.
* Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm:
(WebKit::RemoteLayerTreePropertyApplier::applyProperties): Added __bridge casts,
needed because of the above change.

* UIProcess/API/Cocoa/WKBrowsingContextController.mm:
(WebKit::browsingContextControllerMap): Use __unsafe_unretained.

* UIProcess/API/Cocoa/WKConnection.mm:
(didReceiveMessage): Use a __bridge cast.

* UIProcess/API/Cocoa/WKContentRuleListStore.mm:
(-[WKContentRuleListStore compileContentRuleListForIdentifier:encodedContentRuleList:completionHandler:]):
Use a retain here so we don't have to have a "releasesArgument:" boolean. The cost of a single
retain/release pair should be infinitesmal compared to the entire process of compiling.
(-[WKContentRuleListStore _compileContentRuleListForIdentifier:encodedContentRuleList:completionHandler:]):
Moved the code for the "releases argument" version here since the private method is now the
actual method that does the work. The public method now simply calls this private one after
doing a retain. The optimization of releasing the argument at the correct moment should be intact.

* UIProcess/API/Cocoa/WKHTTPCookieStore.mm: Use CFTypeRef for the key to the _observers
HashMap since the WTF collections can't yet handle ARC types for keys.
(-[WKHTTPCookieStore addObserver:]): Added __bridge cast for compatibility with the above.
(-[WKHTTPCookieStore removeObserver:]): Ditto.

* UIProcess/API/Cocoa/WKProcessGroup.mm:
(setUpConnectionClient): Added a __bridge cast.
(setUpHistoryClient): Ditto.

* UIProcess/API/Cocoa/WKViewPrivate.h: Added a declaration of the
-[WKView _shouldLoadIconWithParameters:completionHandler:] method. This peculiar idiom
should be removed, but I didn't bother doing that since the entire WKView class is already
deprecated and so will eventually be removed.

* UIProcess/API/Cocoa/WKWebView.mm: Use __unsafe_unretained for the keys in the page to
view map.
(accessibilityEventsEnabledChangedCallback): Use a __bridge cast.
(-[WKWebView _certificateChain]): Ditto.
(-[WKWebView certificateChain]): Ditto.

* UIProcess/API/mac/WKView.mm:
(-[WKView maybeInstallIconLoadingClient]): Call the method
_shouldLoadIconWithParameters:completionHandler: in a normal way rather than using
performSelector:withObject:withObject: since ARC is unable to correctly compile a call
when it doesn't know argument and result types.

* UIProcess/Cocoa/NavigationState.mm:
(WebKit::NavigationState::NavigationClient::webCryptoMasterKey): Use the overload
of API::Data::createWithoutCopying that knows how to work with an NSData rather than
re-implementing it here.
* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::WebProcessPool::platformInitializeWebProcess): Ditto. Also removed unneeded
use of RetainPtr.

* UIProcess/Cocoa/WebViewImpl.h: Use NSObject * as the result type of
immediateActionAnimationControllerForHitTestResult. Our techniques for defining such
functions in headers while remaining compatible with non-Objective-C will still work
fine given how we use this, and converting to and from void* rather than NSObject *
would be difficult to do correctly under ARC.

* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::acceptsFirstMouse): Use CFRetain/CFAutorelease instead of
retain/autorelease.
(WebKit::WebViewImpl::shouldDelayWindowOrderingForEvent): Ditto.
(WebKit::WebViewImpl::immediateActionAnimationControllerForHitTestResult):
Updated return type to NSObject *.
(WebKit::WebViewImpl::performKeyEquivalent): Use CFRetain/CFAutorelease.

* UIProcess/PageClient.h: Use NSObject * as the result type, as above.

* UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
(WebKit::RemoteLayerTreeHost::updateLayerTree): Use __bridge casts to be compatible
with the changes to the RelatedLayerMap types.
(WebKit::recursivelyMapIOSurfaceBackingStore): Use __bridge cast.

* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::immediateActionAnimationControllerForHitTestResult):
Use NSObject * as the result type, as above.
* Source/WebKit/UIProcess/WebPageProxy.h: Ditto.

* UIProcess/mac/PageClientImplMac.h: Use NSObject * as the result type, as above.
* UIProcess/mac/PageClientImplMac.mm:
(WebKit::PageClientImpl::immediateActionAnimationControllerForHitTestResult):
Ditto.
(WebKit::PageClientImpl::refView): Use __bridge cast.
(WebKit::PageClientImpl::derefView): Ditto.

* UIProcess/mac/ServicesController.mm:
(WebKit::ServicesController::refreshExistingServices): Removed unnecessary use
of NeverDestroyed for Objective-C object pointers. Simpler and more efficient
both with and without ARC.

* UIProcess/mac/WKImmediateActionController.mm:
(-[WKImmediateActionController _updateImmediateActionItem]): Removed unneeded
cast now that immediateActionAnimationControllerForHitTestResult has a more
accurate return type.

* UIProcess/mac/WKPrintingView.mm:
(-[WKPrintingView dealloc]): Use a more direct approach to making sure we do the
non-thread-safe actions on the main thread with a call to callOnMainThread.
The old solution, WebCoreObjCScheduleDeallocateOnMainThread, may not be possible
in an ARC-compatible way, but this one should work fine.
(linkDestinationName): Changed to return an NSString * to make sure we get the
object lifetimes correct under ARC.
(-[WKPrintingView _drawPDFDocument:page:atPoint:]): Added __bridge casts.

* WebProcess/InjectedBundle/API/mac/WKDOMInternals.h: Use __unsafe_unretained
for the value types in DOM caches.
* WebProcess/InjectedBundle/API/mac/WKDOMInternals.mm:
(WebKit::toWKDOMNode): Updated for the above.
(WebKit::toWKDOMRange): Ditto.

* WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
(WebKit::NetscapePlugin::platformPreInitialize): Rewrote the class_replaceMethod
call to sidestep the rules about not using @selector(release) under ARC.
(WebKit::NetscapePlugin::updatePluginLayer): Use __bridge casts.

* WebProcess/Plugins/PDF/PDFPlugin.mm: Added an include of
WebAccessibilityObjectWrapperMac.h, without which this code doesn't compile
under ARC.

* WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm:
(WebKit::changeWordCase): Use a function rather than a selector, since ARC is unable
to correctly compile a method call when it doesn't know argument and result types.
(WebKit::WebEditorClient::uppercaseWord): Updated to use a function rather than a selector.
(WebKit::WebEditorClient::lowercaseWord): Ditto.
(WebKit::WebEditorClient::capitalizeWord): Ditto.

* WebProcess/cocoa/WebProcessCocoa.mm: Added an include of
WebAccessibilityObjectWrapperIOS/Mac.h, without which this code doesn't compile
under ARC.

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

16 months agoFix authentication for clients of WKPageLoaderClient after r234941
achristensen@apple.com [Mon, 27 Aug 2018 15:44:18 +0000 (15:44 +0000)]
Fix authentication for clients of WKPageLoaderClient after r234941
https://bugs.webkit.org/show_bug.cgi?id=188939

Reviewed by Youenn Fablet.

I simplified the authentication code path elegantly for clients of WKPageNavigationClient/WKNavigationDelegate,
but clients of WKPageLoaderClient that do not implement didReceiveAuthenticationChallengeInFrame would hang.
This fixes that.  I've also made the performDefaultHandling (when delegates are not implemented) and rejectProtectionSpaceAndContinue
(when canAuthenticationAgainstProtectionSpace returns false) behave correctly.

* UIProcess/API/APILoaderClient.h:
(API::LoaderClient::didReachLayoutMilestone):
(API::LoaderClient::canAuthenticateAgainstProtectionSpaceInFrame): Deleted.
* UIProcess/API/C/WKPage.cpp:
(WKPageSetPageLoaderClient):
(WKPageSetPageNavigationClient):
* UIProcess/Cocoa/NavigationState.mm:
(WebKit::NavigationState::NavigationClient::didReceiveAuthenticationChallenge):

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

16 months agoFix IOSMAC build
achristensen@apple.com [Mon, 27 Aug 2018 15:42:07 +0000 (15:42 +0000)]
Fix IOSMAC build
https://bugs.webkit.org/show_bug.cgi?id=188934
<rdar://problem/43694979>

Reviewed by Darin Adler.

* platform/network/cf/FormDataStreamCFNet.cpp:

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

16 months agoUnreviewed, bump WPE/GTK version numbers
mcatanzaro@igalia.com [Mon, 27 Aug 2018 14:31:23 +0000 (14:31 +0000)]
Unreviewed, bump WPE/GTK version numbers

We have a pkg-config dependency on 2.21.92 but trunk is stuck on 2.21.5. So bump the version
number to 2.23.0. It seems like a good version number to use until the next real release
(2.23.1).

* Source/cmake/OptionsGTK.cmake:
* Source/cmake/OptionsWPE.cmake:

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

16 months agoLayout Test fast/events/dblclick-event-getModifierState.html is failing
pvollan@apple.com [Mon, 27 Aug 2018 14:02:45 +0000 (14:02 +0000)]
Layout Test fast/events/dblclick-event-getModifierState.html is failing
https://bugs.webkit.org/show_bug.cgi?id=188948

Unreviewed test gardening.

* platform/win/TestExpectations:

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

16 months agoXMLHTTPRequest.send for Document should have same Content-Type processing rules as...
commit-queue@webkit.org [Mon, 27 Aug 2018 13:40:44 +0000 (13:40 +0000)]
XMLHTTPRequest.send for Document should have same Content-Type processing rules as String
https://bugs.webkit.org/show_bug.cgi?id=188953

Patch by Rob Buis <rbuis@igalia.com> on 2018-08-27
Reviewed by Darin Adler.

LayoutTests/imported/w3c:

* web-platform-tests/xhr/setrequestheader-content-type-expected.txt:

Source/WebCore:

Processing rules for Content-Type have been implemented for send with String as parameter, but
not for Document, but both should be treated the same according to the spec [1]. This patch
implements this.

Behavior matches Firefox.

[1] https://xhr.spec.whatwg.org/#the-send()-method

Test: web-platform-tests/XMLHttpRequest/setrequestheader-content-type.htm

* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::send):

LayoutTests:

* platform/gtk/imported/w3c/web-platform-tests/xhr/setrequestheader-content-type-expected.txt:
* platform/ios/imported/w3c/web-platform-tests/xhr/setrequestheader-content-type-expected.txt:
* platform/wpe/imported/w3c/web-platform-tests/xhr/setrequestheader-content-type-expected.txt:

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

16 months agotest262-runner -s --test-only should replace test results
keith_miller@apple.com [Mon, 27 Aug 2018 11:49:08 +0000 (11:49 +0000)]
test262-runner -s --test-only should replace test results
https://bugs.webkit.org/show_bug.cgi?id=188450

Reviewed by Michael Saboff.

* Scripts/test262/Runner.pm:
(main):
(SetFailureForTest):
(UpdateResults):

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

16 months ago[IntersectionObserver] Implement intersection logic for the explicit root case
ajuma@chromium.org [Mon, 27 Aug 2018 11:13:51 +0000 (11:13 +0000)]
[IntersectionObserver] Implement intersection logic for the explicit root case
https://bugs.webkit.org/show_bug.cgi?id=188809

Reviewed by Simon Fraser.

LayoutTests/imported/w3c:

Rebaseline tests now that some intersection logic has been implemented.

* web-platform-tests/intersection-observer/bounding-box-expected.txt:
* web-platform-tests/intersection-observer/containing-block-expected.txt:
* web-platform-tests/intersection-observer/edge-inclusive-intersection-expected.txt:
* web-platform-tests/intersection-observer/isIntersecting-change-events-expected.txt:
* web-platform-tests/intersection-observer/remove-element-expected.txt:
* web-platform-tests/intersection-observer/same-document-root-expected.txt:
* web-platform-tests/intersection-observer/unclipped-root-expected.txt:

Source/WebCore:

Add logic to Document::updateIntersectionObservations to compute the intersection
between the target and root elements, for the case where an IntersectionObserver
has a root element.

There are no changes to the scheduling of intersection observations in this patch,
so observations are still only computed once for each observer.

* dom/Document.cpp:
(WebCore::computeIntersectionRects):
(WebCore::Document::updateIntersectionObservations):
* page/FrameView.cpp:
(WebCore::FrameView::absoluteToClientRect const):
* page/FrameView.h:
* page/IntersectionObserver.cpp:
(WebCore::IntersectionObserver::IntersectionObserver):
(WebCore::IntersectionObserver::createTimestamp const):
* page/IntersectionObserver.h:
* platform/graphics/FloatRect.h:
(WebCore::FloatRect::area const):
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::isContainingBlockAncestorFor const):
* rendering/RenderBlock.h:

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

16 months agoShrink size of HTMLCollection
yusukesuzuki@slowstart.org [Mon, 27 Aug 2018 08:52:40 +0000 (08:52 +0000)]
Shrink size of HTMLCollection
https://bugs.webkit.org/show_bug.cgi?id=188945

Reviewed by Darin Adler.

Shrink the size of HTMLCollection by reordering members.

No behavior change.

* html/HTMLCollection.cpp:
(WebCore::HTMLCollection::HTMLCollection):
* html/HTMLCollection.h:

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

16 months ago[JSC] Array.prototype.reverse modifies JSImmutableButterfly
yusukesuzuki@slowstart.org [Mon, 27 Aug 2018 08:31:43 +0000 (08:31 +0000)]
[JSC] Array.prototype.reverse modifies JSImmutableButterfly
https://bugs.webkit.org/show_bug.cgi?id=188794

Reviewed by Saam Barati.

JSTests:

* stress/reverse-with-immutable-butterfly.js: Added.
(shouldBe):
(reverseInt):
(reverseDouble):
(reverseContiguous):

Source/JavaScriptCore:

While Array.prototype.reverse modifies the butterfly of the given Array,
it does not account JSImmutableButterfly case. So it accidentally modifies
the content of JSImmutableButterfly.
This patch converts CoW arrays to writable arrays before reversing.

* runtime/ArrayPrototype.cpp:
(JSC::arrayProtoFuncReverse):
* runtime/JSObject.h:
(JSC::JSObject::ensureWritable):

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

16 months agoShrink size of XMLHttpRequest
yusukesuzuki@slowstart.org [Mon, 27 Aug 2018 08:30:58 +0000 (08:30 +0000)]
Shrink size of XMLHttpRequest
https://bugs.webkit.org/show_bug.cgi?id=188944

Reviewed by Saam Barati.

Source/WebCore:

Shrink the size of XMLHttpRequest by packing bits and reordering members.
It reduces the size from 1248 to 1176.

No behavior change.

* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::XMLHttpRequest):
(WebCore::XMLHttpRequest::responseText):
(WebCore::XMLHttpRequest::createResponseBlob):
(WebCore::XMLHttpRequest::createResponseArrayBuffer):
(WebCore::XMLHttpRequest::setResponseType):
(WebCore::XMLHttpRequest::changeState):
(WebCore::XMLHttpRequest::callReadyStateChangeListener):
(WebCore::XMLHttpRequest::setWithCredentials):
(WebCore::XMLHttpRequest::open):
(WebCore::XMLHttpRequest::prepareToSend):
(WebCore::XMLHttpRequest::createRequest):
(WebCore::XMLHttpRequest::abort):
(WebCore::XMLHttpRequest::overrideMimeType):
(WebCore::XMLHttpRequest::setRequestHeader):
(WebCore::XMLHttpRequest::getAllResponseHeaders const):
(WebCore::XMLHttpRequest::getResponseHeader const):
(WebCore::XMLHttpRequest::status const):
(WebCore::XMLHttpRequest::statusText const):
(WebCore::XMLHttpRequest::didFinishLoading):
(WebCore::XMLHttpRequest::createDecoder const):
(WebCore::XMLHttpRequest::didReceiveData):
(WebCore::XMLHttpRequest::didReachTimeout):
(WebCore::XMLHttpRequest::readyState const): Deleted.
* xml/XMLHttpRequest.h:
(WebCore::XMLHttpRequest::responseType const):
(WebCore::XMLHttpRequest::readyState const):
* xml/XMLHttpRequestProgressEventThrottle.cpp:
(WebCore::XMLHttpRequestProgressEventThrottle::XMLHttpRequestProgressEventThrottle):
* xml/XMLHttpRequestProgressEventThrottle.h:

Source/WTF:

StringBuilder is included in XMLHttpRequest. We reduce the size of StringBuilder too
by reordering members.

* wtf/text/StringBuilder.h:
(WTF::StringBuilder::StringBuilder):

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

16 months agoUpdate WPT XHR tests to 87329a1
youenn@apple.com [Mon, 27 Aug 2018 07:48:54 +0000 (07:48 +0000)]
Update WPT XHR tests to 87329a1
https://bugs.webkit.org/show_bug.cgi?id=188816

Reviewed by Ryosuke Niwa.

LayoutTests/imported/w3c:

Moved tests from XMLHttpRequest to xhr.
Updated xhr tests according upstream WPT.

* resources/import-expectations.json:
* resources/resource-files.json:
* web-platform-tests/XMLHttpRequest: Removed.
* web-platform-tests/xhr: Added.

LayoutTests:

Update expectations according renamed XMLHttpRequest to xhr folder.

* TestExpectations:
* platform/gtk/TestExpectations:
* platform/gtk/imported/w3c/web-platform-tests/xhr/send-entity-body-get-head-async-expected.txt: Renamed from LayoutTests/platform/gtk/imported/w3c/web-platform-tests/XMLHttpRequest/send-entity-body-get-head-async-expected.txt.
* platform/gtk/imported/w3c/web-platform-tests/xhr/send-entity-body-get-head-expected.txt: Renamed from LayoutTests/platform/gtk/imported/w3c/web-platform-tests/XMLHttpRequest/send-entity-body-get-head-expected.txt.
* platform/gtk/imported/w3c/web-platform-tests/xhr/send-network-error-sync-events.sub-expected.txt: Renamed from LayoutTests/platform/gtk/imported/w3c/web-platform-tests/XMLHttpRequest/send-network-error-sync-events.sub-expected.txt.
* platform/gtk/imported/w3c/web-platform-tests/xhr/send-redirect-expected.txt: Renamed from LayoutTests/platform/gtk/imported/w3c/web-platform-tests/XMLHttpRequest/send-redirect-expected.txt.
* platform/gtk/imported/w3c/web-platform-tests/xhr/setrequestheader-content-type-expected.txt: Renamed from LayoutTests/platform/gtk/imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-content-type-expected.txt.
* platform/ios-wk1/imported/w3c/web-platform-tests/xhr/send-network-error-sync-events.sub-expected.txt: Renamed from LayoutTests/platform/ios-wk1/imported/w3c/web-platform-tests/XMLHttpRequest/send-network-error-sync-events.sub-expected.txt.
* platform/ios/imported/w3c/web-platform-tests/xhr/getresponseheader-case-insensitive-expected.txt: Renamed from LayoutTests/platform/ios/imported/w3c/web-platform-tests/XMLHttpRequest/getresponseheader-case-insensitive-expected.txt.
* platform/ios/imported/w3c/web-platform-tests/xhr/send-blob-with-no-mime-type-expected.txt: Renamed from LayoutTests/platform/ios/imported/w3c/web-platform-tests/XMLHttpRequest/send-blob-with-no-mime-type-expected.txt.
* platform/ios/imported/w3c/web-platform-tests/xhr/send-entity-body-empty-expected.txt: Renamed from LayoutTests/platform/ios/imported/w3c/web-platform-tests/XMLHttpRequest/send-entity-body-empty-expected.txt.
* platform/ios/imported/w3c/web-platform-tests/xhr/send-entity-body-none-expected.txt: Renamed from LayoutTests/platform/ios/imported/w3c/web-platform-tests/XMLHttpRequest/send-entity-body-none-expected.txt.
* platform/ios/imported/w3c/web-platform-tests/xhr/setrequestheader-content-type-expected.txt: Renamed from LayoutTests/platform/ios/imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-content-type-expected.txt.
* platform/mac-sierra/imported/w3c/web-platform-tests/xhr/send-blob-with-no-mime-type-expected.txt: Renamed from LayoutTests/platform/mac-sierra/imported/w3c/web-platform-tests/XMLHttpRequest/send-blob-with-no-mime-type-expected.txt.
* platform/mac-wk1/TestExpectations:
* platform/mac-wk1/imported/w3c/web-platform-tests/xhr/access-control-and-redirects-expected.txt: Renamed from LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/XMLHttpRequest/access-control-and-redirects-expected.txt.
* platform/mac-wk1/imported/w3c/web-platform-tests/xhr/late-upload-events-expected.txt: Renamed from LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/XMLHttpRequest/late-upload-events-expected.txt.
* platform/mac-wk1/imported/w3c/web-platform-tests/xhr/send-authentication-basic-cors-expected.txt: Renamed from LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/XMLHttpRequest/send-authentication-basic-cors-expected.txt.
* platform/mac-wk1/imported/w3c/web-platform-tests/xhr/send-network-error-async-events.sub-expected.txt: Renamed from LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/XMLHttpRequest/send-network-error-async-events.sub-expected.txt.
* platform/mac-wk1/imported/w3c/web-platform-tests/xhr/xmlhttprequest-sync-default-feature-policy.sub-expected.txt: Renamed from LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/XMLHttpRequest/xmlhttprequest-sync-default-feature-policy.sub-expected.txt.
* platform/mac-wk2/TestExpectations:
* platform/mac/TestExpectations:
* platform/mac/imported/w3c/web-platform-tests/xhr/getresponseheader-case-insensitive-expected.txt: Renamed from LayoutTests/platform/mac/imported/w3c/web-platform-tests/XMLHttpRequest/getresponseheader-case-insensitive-expected.txt.
* platform/mac/imported/w3c/web-platform-tests/xhr/send-blob-with-no-mime-type-expected.txt: Renamed from LayoutTests/platform/mac/imported/w3c/web-platform-tests/XMLHttpRequest/send-blob-with-no-mime-type-expected.txt.
* platform/mac/imported/w3c/web-platform-tests/xhr/send-entity-body-empty-expected.txt: Renamed from LayoutTests/platform/mac/imported/w3c/web-platform-tests/XMLHttpRequest/send-entity-body-empty-expected.txt.
* platform/mac/imported/w3c/web-platform-tests/xhr/send-entity-body-none-expected.txt: Renamed from LayoutTests/platform/mac/imported/w3c/web-platform-tests/XMLHttpRequest/send-entity-body-none-expected.txt.
* platform/win/imported/w3c/web-platform-tests/xhr/access-control-and-redirects-expected.txt: Renamed from LayoutTests/platform/win/imported/w3c/web-platform-tests/XMLHttpRequest/access-control-and-redirects-expected.txt.
* platform/win/imported/w3c/web-platform-tests/xhr/late-upload-events-expected.txt: Renamed from LayoutTests/platform/win/imported/w3c/web-platform-tests/XMLHttpRequest/late-upload-events-expected.txt.
* platform/win/imported/w3c/web-platform-tests/xhr/send-authentication-basic-cors-expected.txt: Renamed from LayoutTests/platform/win/imported/w3c/web-platform-tests/XMLHttpRequest/send-authentication-basic-cors-expected.txt.
* platform/win/imported/w3c/web-platform-tests/xhr/send-network-error-async-events.sub-expected.txt: Renamed from LayoutTests/platform/win/imported/w3c/web-platform-tests/XMLHttpRequest/send-network-error-async-events.sub-expected.txt.
* platform/wpe/TestExpectations:
* platform/wpe/imported/w3c/web-platform-tests/xhr/access-control-basic-cors-safelisted-request-headers-expected.txt: Renamed from LayoutTests/platform/wpe/imported/w3c/web-platform-tests/XMLHttpRequest/access-control-basic-cors-safelisted-request-headers-expected.txt.
* platform/wpe/imported/w3c/web-platform-tests/xhr/access-control-basic-get-fail-non-simple-expected.txt: Renamed from LayoutTests/platform/wpe/imported/w3c/web-platform-tests/XMLHttpRequest/access-control-basic-get-fail-non-simple-expected.txt.
* platform/wpe/imported/w3c/web-platform-tests/xhr/access-control-basic-post-with-non-cors-safelisted-content-type-expected.txt: Renamed from LayoutTests/platform/wpe/imported/w3c/web-platform-tests/XMLHttpRequest/access-control-basic-post-with-non-cors-safelisted-content-type-expected.txt.
* platform/wpe/imported/w3c/web-platform-tests/xhr/send-entity-body-get-head-async-expected.txt: Renamed from LayoutTests/platform/wpe/imported/w3c/web-platform-tests/XMLHttpRequest/send-entity-body-get-head-async-expected.txt.
* platform/wpe/imported/w3c/web-platform-tests/xhr/send-entity-body-get-head-expected.txt: Renamed from LayoutTests/platform/wpe/imported/w3c/web-platform-tests/XMLHttpRequest/send-entity-body-get-head-expected.txt.
* platform/wpe/imported/w3c/web-platform-tests/xhr/send-redirect-expected.txt: Renamed from LayoutTests/platform/wpe/imported/w3c/web-platform-tests/XMLHttpRequest/send-redirect-expected.txt.
* platform/wpe/imported/w3c/web-platform-tests/xhr/send-redirect-infinite-expected.txt: Renamed from LayoutTests/platform/wpe/imported/w3c/web-platform-tests/XMLHttpRequest/send-redirect-infinite-expected.txt.
* platform/wpe/imported/w3c/web-platform-tests/xhr/send-redirect-infinite-sync-expected.txt: Renamed from LayoutTests/platform/wpe/imported/w3c/web-platform-tests/XMLHttpRequest/send-redirect-infinite-sync-expected.txt.
* platform/wpe/imported/w3c/web-platform-tests/xhr/setrequestheader-content-type-expected.txt: Renamed from LayoutTests/platform/wpe/imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-content-type-expected.txt.
* platform/wpe/imported/w3c/web-platform-tests/xhr/xmlhttprequest-network-error-expected.txt: Renamed from LayoutTests/platform/wpe/imported/w3c/web-platform-tests/XMLHttpRequest/xmlhttprequest-network-error-expected.txt.
* platform/wpe/imported/w3c/web-platform-tests/xhr/xmlhttprequest-network-error-sync-expected.txt: Renamed from LayoutTests/platform/wpe/imported/w3c/web-platform-tests/XMLHttpRequest/xmlhttprequest-network-error-sync-expected.txt.

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

16 months agoUnreviewed WPE gardening. Enabling more tests under the fast/ directory.
zandobersek@gmail.com [Mon, 27 Aug 2018 06:57:42 +0000 (06:57 +0000)]
Unreviewed WPE gardening. Enabling more tests under the fast/ directory.

* platform/wpe/TestExpectations:
* platform/wpe/fast/backgrounds: Added 28 baselines.
* platform/wpe/fast/block: Added 267 baselines.
* platform/wpe/fast/body-propagation: Added 65 baselines.
* platform/wpe/fast/borders: Added 69 baselines.
* platform/wpe/fast/css: Added 193 baselines.
* platform/wpe/fast/css3-text: Added 2 baselines.
* platform/wpe/fast/frames: Added 27 baselines.
* platform/wpe/fast/hidpi: Added 20 baselines.
* platform/wpe/fast/html: Added 64 baselines.
* platform/wpe/fast/images: Added 14 baselines.
* platform/wpe/fast/layers: Added 12 baselines.
* platform/wpe/fast/multicol: Added 98 baselines.
* platform/wpe/fast/overflow: Added 43 baselines.
* platform/wpe/fast/reflections: Added 9 baselines.
* platform/wpe/fast/selectors: Added 101 baselines.
* platform/wpe/fast/sub-pixel: Added 6 baselines.
* platform/wpe/fast/table: Added 162 baselines.
* platform/wpe/fast/visual-viewport: Added 1 baseline.

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

16 months ago[LFC][Floating] FloatBox -> FloatAvoider
zalan@apple.com [Mon, 27 Aug 2018 05:01:28 +0000 (05:01 +0000)]
[LFC][Floating] FloatBox -> FloatAvoider
https://bugs.webkit.org/show_bug.cgi?id=188941

Reviewed by Antti Koivisto.

This is in preparation for the float avoidance feature where formatting context root boxes avoid existing floats.

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* layout/displaytree/DisplayBox.h:
* layout/floats/FloatAvoider.cpp: Renamed from Source/WebCore/layout/floats/FloatBox.cpp.
(WebCore::Layout::FloatAvoider::FloatAvoider):
(WebCore::Layout::FloatAvoider::initializePosition):
(WebCore::Layout::FloatAvoider::isLeftAligned const):
(WebCore::Layout::FloatAvoider::setLeft):
(WebCore::Layout::FloatAvoider::setTopLeft):
(WebCore::Layout::FloatAvoider::resetVertically):
(WebCore::Layout::FloatAvoider::resetHorizontally):
(WebCore::Layout::FloatAvoider::topLeftInContainingBlock const):
* layout/floats/FloatAvoider.h: Renamed from Source/WebCore/layout/floats/FloatBox.h.
(WebCore::Layout::FloatAvoider::top const):
(WebCore::Layout::FloatAvoider::left const):
(WebCore::Layout::FloatAvoider::marginTop const):
(WebCore::Layout::FloatAvoider::marginLeft const):
(WebCore::Layout::FloatAvoider::marginBottom const):
(WebCore::Layout::FloatAvoider::marginRight const):
(WebCore::Layout::FloatAvoider::rectWithMargin const):
(WebCore::Layout::FloatAvoider::setTop):
* layout/floats/FloatingContext.cpp:
(WebCore::Layout::FloatingContext::positionForFloat const):
(WebCore::Layout::FloatingContext::floatingPosition const):
* layout/floats/FloatingContext.h:

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

16 months ago[Curl] Implement deleteCookie()
chris.reid@sony.com [Mon, 27 Aug 2018 04:55:10 +0000 (04:55 +0000)]
[Curl] Implement deleteCookie()
https://bugs.webkit.org/show_bug.cgi?id=188908

Reviewed by Fujii Hironori.

Support deleting cookies from the web inspector

Tested from the web inspector.

* platform/network/curl/CookieJarCurlDatabase.cpp:
(WebCore::CookieJarCurlDatabase::deleteCookie const):

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

16 months ago[LFC][Floating] Simplify FloatingState::FloatItem class
zalan@apple.com [Mon, 27 Aug 2018 04:03:25 +0000 (04:03 +0000)]
[LFC][Floating] Simplify FloatingState::FloatItem class
https://bugs.webkit.org/show_bug.cgi?id=188912

Reviewed by Antti Koivisto.

Let's remove some redundant code now that FloatingState::FloatItem is not used for incoming floats anymore.

* layout/Verification.cpp:
(WebCore::Layout::LayoutContext::verifyAndOutputMismatchingLayoutTree const):
* layout/floats/FloatBox.cpp:
(WebCore::Layout::FloatBox::resetVertically):
* layout/floats/FloatingContext.cpp:
(WebCore::Layout::FloatingPair::left const):
(WebCore::Layout::FloatingPair::right const):
(WebCore::Layout::FloatingPair::intersects const):
(WebCore::Layout::previousFloatingIndex):
(WebCore::Layout::Iterator::operator++):
(WebCore::Layout::Iterator::set):
* layout/floats/FloatingState.cpp:
(WebCore::Layout::FloatingState::FloatItem::FloatItem):
(WebCore::Layout::FloatingState::remove):
(WebCore::Layout::FloatingState::bottom const):
* layout/floats/FloatingState.h:
(WebCore::Layout::FloatingState::FloatItem::operator== const):
(WebCore::Layout::FloatingState::FloatItem::isLeftPositioned const):
(WebCore::Layout::FloatingState::FloatItem::rectWithMargin const):
(WebCore::Layout::FloatingState::FloatItem::bottom const):
(WebCore::Layout::FloatingState::leftBottom const):
(WebCore::Layout::FloatingState::rightBottom const):
(WebCore::Layout::FloatingState::bottom const):
(WebCore::Layout::FloatingState::FloatItem::inFormattingContext const):
(WebCore::Layout::FloatingState::FloatItem::layoutBox const): Deleted.
(WebCore::Layout::FloatingState::FloatItem::containingBlock const): Deleted.
(WebCore::Layout::FloatingState::FloatItem::displayBox const): Deleted.
(WebCore::Layout::FloatingState::FloatItem::containingBlockDisplayBox const): Deleted.

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

16 months ago[Apple Pay] Introduce new values for -apple-pay-button-type
aestes@apple.com [Mon, 27 Aug 2018 03:32:48 +0000 (03:32 +0000)]
[Apple Pay] Introduce new values for -apple-pay-button-type
https://bugs.webkit.org/show_bug.cgi?id=188949
<rdar://problem/39992228>

Reviewed by Anders Carlsson.

Source/WebCore:

Added "in-store", "checkout", "book", and "subscribe" keywords for -apple-pay-button-type,
and mapped those values to their equivalent PKPaymentButtonTypes.

Tests: http/tests/ssl/applepay/ApplePayButton.html
       http/tests/ssl/applepay/ApplePayButtonV4.html

* css/CSSPrimitiveValueMappings.h:
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
(WebCore::CSSPrimitiveValue::operator ApplePayButtonType const):
* css/CSSValueKeywords.in:
* css/parser/CSSParserFastPaths.cpp:
(WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
* rendering/RenderThemeCocoa.mm:
(WebCore::toPKPaymentButtonType):
* rendering/style/RenderStyleConstants.h:

Source/WebCore/PAL:

* pal/spi/cocoa/PassKitSPI.h:

LayoutTests:

* http/tests/ssl/applepay/ApplePayButton.html: Added.
* http/tests/ssl/applepay/ApplePayButtonV4.html: Added.
* platform/mac-highsierra/http/tests/ssl/applepay/ApplePayButton-expected.png:
* platform/mac-highsierra/http/tests/ssl/applepay/ApplePayButton-expected.txt:
* platform/mac/http/tests/ssl/applepay/ApplePayButton-expected.png: Added.
* platform/mac/http/tests/ssl/applepay/ApplePayButton-expected.txt: Added.
* platform/mac/http/tests/ssl/applepay/ApplePayButtonV4-expected.png: Added.
* platform/mac/http/tests/ssl/applepay/ApplePayButtonV4-expected.txt: Added.
* platform/mac-wk2/TestExpectations:

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

16 months ago[CMake] Remove stale comment from WebKitFeatures.cmake
mcatanzaro@igalia.com [Mon, 27 Aug 2018 02:54:13 +0000 (02:54 +0000)]
[CMake] Remove stale comment from WebKitFeatures.cmake
https://bugs.webkit.org/show_bug.cgi?id=188918

Reviewed by Fujii Hironori.

This comment at the top of WebKitFeatures.cmake is no longer accurate because feature defaults are no longer defined in FeatureList.pm (thank goodness!)

* Source/cmake/WebKitFeatures.cmake:

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

16 months agoUpdate test expectations for http/tests/ssl/applepay/ApplePayButton.html on macOS...
aestes@apple.com [Mon, 27 Aug 2018 02:48:19 +0000 (02:48 +0000)]
Update test expectations for http/tests/ssl/applepay/ApplePayButton.html on macOS High Sierra.

* platform/mac-highsierra/http/tests/ssl/applepay/ApplePayButton-expected.png: Renamed from LayoutTests/platform/mac-sierra/http/tests/ssl/applepay/ApplePayButton-expected.png.
* platform/mac-highsierra/http/tests/ssl/applepay/ApplePayButton-expected.txt: Renamed from LayoutTests/platform/mac-sierra/http/tests/ssl/applepay/ApplePayButton-expected.txt.

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

16 months agoUsing _WKRemoteObjectInterface with a protocol that inherits from a non-NSObject...
commit-queue@webkit.org [Mon, 27 Aug 2018 02:45:52 +0000 (02:45 +0000)]
Using _WKRemoteObjectInterface with a protocol that inherits from a non-NSObject protocol crashes
https://bugs.webkit.org/show_bug.cgi?id=188958

Patch by Sam Weinig <sam@webkit.org> on 2018-08-26
Reviewed by Anders Carlsson.

Source/WebKit:

* Shared/API/Cocoa/_WKRemoteObjectInterface.mm:
(initializeMethods):
Fix infinite recursion by using the passed in protocol rather
than always using the one from the initial interface.

Tools:

* TestWebKitAPI/Tests/WebKitCocoa/RemoteObjectRegistry.h:
Update test protocol to have inheritance.

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

16 months agoMake IDBCursor::m_request a WeakPtr
youenn@apple.com [Mon, 27 Aug 2018 02:44:15 +0000 (02:44 +0000)]
Make IDBCursor::m_request a WeakPtr
https://bugs.webkit.org/show_bug.cgi?id=188938

Reviewed by Alex Christensen.

Make m_request a WeakPtr so that if m_request is destroyed, the related cursor will not use the invalid pointer.

Covered by existing tests.

* Modules/indexeddb/IDBCursor.cpp:
(WebCore::IDBCursor::continuePrimaryKey): Other continue and advance methods that are calling uncheckedIterateCursor do check for m_request.
Apply the same check for continuePrimaryKey.
(WebCore::IDBCursor::uncheckedIterateCursor):
* Modules/indexeddb/IDBCursor.h:
(WebCore::IDBCursor::setRequest):
(WebCore::IDBCursor::clearRequest):
(WebCore::IDBCursor::request):
* Modules/indexeddb/IDBRequest.h:

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

16 months agoIDBCursor does not need to be an ActiveDOMObject
youenn@apple.com [Mon, 27 Aug 2018 02:43:26 +0000 (02:43 +0000)]
IDBCursor does not need to be an ActiveDOMObject
https://bugs.webkit.org/show_bug.cgi?id=188937

Reviewed by Alex Christensen.

Remove ActiveDOMObject from IDBCursor IDL.
Update constructors and call sites accordingly.
This allows removing m_outstandingRequestCount and related code in IDBRequest.

Covered by existing tests.

* Modules/indexeddb/IDBCursor.cpp:
(WebCore::IDBCursor::create):
(WebCore::IDBCursor::IDBCursor):
(WebCore::IDBCursor::update):
(WebCore::IDBCursor::uncheckedIterateCursor):
(WebCore::IDBCursor::deleteFunction):
(WebCore::IDBCursor::activeDOMObjectName const): Deleted.
(WebCore::IDBCursor::canSuspendForDocumentSuspension const): Deleted.
(WebCore::IDBCursor::hasPendingActivity const): Deleted.
(WebCore::IDBCursor::decrementOutstandingRequestCount): Deleted.
* Modules/indexeddb/IDBCursor.h:
* Modules/indexeddb/IDBCursor.idl:
* Modules/indexeddb/IDBCursorWithValue.cpp:
(WebCore::IDBCursorWithValue::create):
(WebCore::IDBCursorWithValue::IDBCursorWithValue):
* Modules/indexeddb/IDBCursorWithValue.h:
* Modules/indexeddb/IDBCursorWithValue.idl:
* Modules/indexeddb/IDBRequest.cpp:
(WebCore::IDBRequest::setSource):
(WebCore::IDBRequest::dispatchEvent):
(WebCore::IDBRequest::willIterateCursor):
(WebCore::IDBRequest::didOpenOrIterateCursor):
* Modules/indexeddb/IDBRequest.h:
* Modules/indexeddb/IDBTransaction.cpp:
(WebCore::IDBTransaction::requestOpenCursor):
* WebCore.xcodeproj/project.pbxproj:

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

16 months ago[Attachment Support] Dropping and pasting images should insert inline image elements...
wenson_hsieh@apple.com [Mon, 27 Aug 2018 02:37:22 +0000 (02:37 +0000)]
[Attachment Support] Dropping and pasting images should insert inline image elements with _WKAttachments
https://bugs.webkit.org/show_bug.cgi?id=188933
<rdar://problem/43699724>

Reviewed by Darin Adler.

Source/WebCore:

Support the ability to drop and paste images as image elements, with attachment elements, only if attachment
elements are enabled. See changes below for more detail.

Tests:  WKAttachmentTests.CutAndPastePastedImage
        WKAttachmentTests.MovePastedImageByDragging
        WKAttachmentTests.RemoveNewlinesBeforePastedImage

* editing/Editor.h:
* editing/cocoa/EditorCocoa.mm:
(WebCore::Editor::getPasteboardTypesAndDataForAttachment):

Adjust this helper to take an Element& rather than an HTMLAttachmentElement&, and address a FIXME by writing the
document origin identifier to the pasteboard via custom pasteboard data when dragging an attachment. This allows
us to avoid creating extra image and attachment elements when dragging an image backed by an attachment within
the same document.

* editing/cocoa/WebContentReaderCocoa.mm:
(WebCore::contentTypeIsSuitableForInlineImageRepresentation):

Add a helper to determine whether a content type (UTI or MIME type) should be read as an inline image.

(WebCore::createFragmentForImageAttachment):
(WebCore::replaceRichContentWithAttachments):
(WebCore::WebContentReader::readFilePaths):

Teach codepaths where we currently create attachment elements to instead create image elements if the MIME type,
is something suitable for display via an inline image element; add the attachment element under the shadow root
of the image element.

* editing/markup.cpp:
(WebCore::StyledMarkupAccumulator::appendCustomAttributes):
(WebCore::restoreAttachmentElementsInFragment):

When dragging or copying an image element, we need to make sure that any attachment element backing the image
is preserved in the pasted or dropped fragment. To do this, we use a technique similar to what was done for
r180785 and r224593 and write a temporary "webkitattachmentid" attribute to the serialized markup on copy. Upon
deserializing the markup back to a fragment, we then create an attachment element with the same identifier under
the image.

(WebCore::createFragmentFromMarkup):
* html/HTMLAttachmentElement.h:
* html/HTMLImageElement.cpp:
(WebCore::HTMLImageElement::setAttachmentElement):
(WebCore::HTMLImageElement::attachmentElement const):

Helper methods to get and set an attachment element under an image element. Setting an image's attachment
element puts that attachment element under the shadow root of the image, and also hides the attachment element.

(WebCore::HTMLImageElement::attachmentIdentifier const):

Returns the identifier of an attachment element associated with the image element, or null.

* html/HTMLImageElement.h:
* html/HTMLImageElement.idl:

Add HTMLImageElement.webkitAttachmentIdentifier, a readonly attribute guarded by runtime-enabled attachment
element feature.

* page/DragController.cpp:
(WebCore::DragController::startDrag):

In the case of dragging an image, if that image element is backed by an attachment element, don't bother writing
the image data to the clipboard; instead, write the attachment data as a promise.

(WebCore::DragController::doImageDrag):

Plumb promised attachment information to DragController::doSystemDrag.

(WebCore::DragController::promisedAttachmentInfo):

Teach this to handle attachment elements as well as image elements that are backed by attachment elements.

* page/DragController.h:
* platform/PromisedAttachmentInfo.h:
(WebCore::PromisedAttachmentInfo::operator bool const):

A valid PromisedAttachmentInfo no longer requires a contentType to be set; instead, an attachment identifier
alone is sufficient, since an up-to-date content type can be requested in the UI process from the API attachment
object.

Source/WebKit:

Support the ability to drop and paste images as image elements, with attachment elements, only if attachment
elements are enabled. See changes below for more detail.

* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<PromisedAttachmentInfo>::encode):
(IPC::ArgumentCoder<PromisedAttachmentInfo>::decode):

Rename "filename" to "fileName", for consistency with WKContentView and WebViewImpl.

* UIProcess/API/APIAttachment.cpp:
(API::Attachment::mimeType const):
(API::Attachment::fileName const):
* UIProcess/API/APIAttachment.h:

Push getters for MIME type, UTI, and the file name down from _WKAttachment to API::Attachment. This allows
WKContentView and WebViewImpl to ask an API::Attachment questions about its UTI and file name without
additionally creating a wrapper object.

* UIProcess/API/Cocoa/APIAttachmentCocoa.mm: Added.
(API::mimeTypeInferredFromFileExtension):
(API::isDeclaredOrDynamicTypeIdentifier):
(API::Attachment::mimeType const):
(API::Attachment::utiType const):
(API::Attachment::fileName const):
* UIProcess/API/Cocoa/WKUIDelegatePrivate.h:

Add a private delegate hook to notify the UI delegate when a drop has been performed. This is used by tests to
know when a drop with file promises has been processed by the page.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _web_didPerformDragOperation:]):
* UIProcess/API/Cocoa/_WKAttachment.mm:
(-[_WKAttachmentInfo initWithFileWrapper:filePath:mimeType:utiType:]):
(-[_WKAttachmentInfo fileWrapper]):
(-[_WKAttachmentInfo contentType]):
(-[_WKAttachment info]):
(-[_WKAttachmentInfo initWithFileWrapper:filePath:contentType:]): Deleted.
(isDeclaredOrDynamicTypeIdentifier): Deleted.
(-[_WKAttachmentInfo _typeIdentifierFromPathExtension]): Deleted.
(-[_WKAttachmentInfo mimeType]): Deleted.
(-[_WKAttachmentInfo utiType]): Deleted.

Moved to APIAttachmentCocoa.mm.

* UIProcess/API/mac/WKView.mm:
(-[WKView _web_didPerformDragOperation:]):
* UIProcess/Cocoa/WebViewImpl.h:
* UIProcess/Cocoa/WebViewImpl.mm:
(-[WKPromisedAttachmentContext initWithIdentifier:blobURL:fileName:]):

Adjust this constructor to take each piece of data separately. This is because, in the case where our
PromisedAttachmentInfo contains an attachment identifier, we determine the UTI and file name from the associated
file wrapper.

(-[WKPromisedAttachmentContext fileName]):
(WebKit::WebViewImpl::fileNameForFilePromiseProvider):
(WebKit::WebViewImpl::didPerformDragOperation):
(WebKit::WebViewImpl::startDrag):

Determine UTI and file name from the attachment element corresponding to the attachment identifier when
dragging. This is because the attachment element in the web process shouldn't need to have type and title
attributes set when starting a drag if it already has an identifier that maps to attachment data in the UI
process. An example of this is in inline images backed by attachments, for which we don't need to bother keeping
specifying display attributes, since they are never visible.

(-[WKPromisedAttachmentContext initWithAttachmentInfo:]): Deleted.
(-[WKPromisedAttachmentContext filename]): Deleted.
* UIProcess/PageClient.h:
(WebKit::PageClient::didPerformDragOperation):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didPerformDragOperation):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:

Rename DidPerformDataInteractionControllerOperation to DidPerformDragOperation, and make it cross-platform (this
was previously only sent on iOS). Add plumbing through PageClient and friends on macOS to notify the UI
delegate when a drop is handled by the web process.

* UIProcess/ios/PageClientImplIOS.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::didPerformDragOperation):
(WebKit::PageClientImpl::didPerformDataInteractionControllerOperation): Deleted.
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _didPerformDragOperation:]):
(-[WKContentView _prepareToDragPromisedAttachment:]):

Just like in WebViewImpl::startDrag, infer content type and file name from the API attachment object.

(-[WKContentView _didPerformDataInteractionControllerOperation:]): Deleted.
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::didPerformDataInteractionControllerOperation): Deleted.
* UIProcess/mac/PageClientImplMac.h:
* UIProcess/mac/PageClientImplMac.mm:
(WebKit::PageClientImpl::didPerformDragOperation):
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::performDragControllerAction):

Tools:

Rebaseline existing API tests that involve dropping or pasting image files, and additionally write some new
tests. These new tests exercise the following cases:
•       Inserting and removing newlines before an inline image with an attachment element does not cause new
        _WKAttachments to be created and destroyed.
•       Pasting an image, cutting it, and then pasting it again propagates an attachment update to the UI
        process with the original _WKAttachment.
•       A pasted attachment in the document can be moved around by dragging, and doing so does not cause us to
        lose a _WKAttachment.

* TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm:
(-[TestWKWebView expectElementCount:tagName:]):
(TestWebKitAPI::TEST):

Add the new tests described above, and also adjust existing tests to check that images are dropped or pasted
as image elements, but still have associated attachment elements whose attachment identifiers (observed via
script) match that of the corresponding _WKAttachment's uniqueIdentifier in the UI process.

* TestWebKitAPI/mac/DragAndDropSimulatorMac.mm:
(-[DragAndDropSimulator runFrom:to:]):
(-[DragAndDropSimulator continueDragSession]):
(-[DragAndDropSimulator performDragInWebView:atLocation:withImage:pasteboard:source:]):

Teach DragAndDropSimulator on macOS to wait until the drop has been handled by the web process before returning
execution to the caller. This ensures that tests which involve dropping promised files as attachments aren't
flaky, due to how the promised data is retrieved asynchronously when performing the drop.

(-[DragAndDropSimulator _webView:didPerformDragOperation:]):

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

16 months ago[Apple Pay] PaymentRequest.show() should reject when an unsupported ApplePayRequest...
aestes@apple.com [Mon, 27 Aug 2018 01:39:49 +0000 (01:39 +0000)]
[Apple Pay] PaymentRequest.show() should reject when an unsupported ApplePayRequest version is specified
https://bugs.webkit.org/show_bug.cgi?id=188954

Reviewed by Darin Adler.

Source/WebCore:

In Apple Pay JS, calling the ApplePaySession constructor with an unsupported version results
in an exception being thrown. We need to do something similar for Payment Request.

This patch moves the logic for validating the version from ApplePaySession to a common
routine in ApplePayRequestBase that both APIs call to convert requests into a common format.

In Apple Pay JS, an exception will still be thrown when constructing an ApplePaySession. In
Payment Request, the promise returned by show() will be rejected.

Added test cases to http/tests/ssl/applepay/PaymentRequest.https.html.

* Modules/applepay/ApplePayRequestBase.cpp:
(WebCore::convertAndValidate):
* Modules/applepay/ApplePaySession.cpp:
(WebCore::ApplePaySession::create):

LayoutTests:

* http/tests/ssl/applepay/PaymentRequest.https-expected.txt:
* http/tests/ssl/applepay/PaymentRequest.https.html:

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

16 months ago[Apple Pay] Add a test for rendering Apple Pay buttons
aestes@apple.com [Mon, 27 Aug 2018 01:27:01 +0000 (01:27 +0000)]
[Apple Pay] Add a test for rendering Apple Pay buttons
https://bugs.webkit.org/show_bug.cgi?id=188947

Reviewed by Sam Weinig.

* http/tests/ssl/applepay/ApplePayButton.html: Added.
* platform/mac-sierra/http/tests/ssl/applepay/ApplePayButton-expected.png: Added.
* platform/mac-sierra/http/tests/ssl/applepay/ApplePayButton-expected.txt: Added.
* platform/mac/http/tests/ssl/applepay/ApplePayButton-expected.png: Added.
* platform/mac/http/tests/ssl/applepay/ApplePayButton-expected.txt: Added.

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

16 months ago[Xcode] Don’t make unnecessary, broken WebKitPluginAgent symlink when WK_USE_OVERRIDE...
mitz@apple.com [Mon, 27 Aug 2018 01:00:21 +0000 (01:00 +0000)]
[Xcode] Don’t make unnecessary, broken WebKitPluginAgent symlink when WK_USE_OVERRIDE_FRAMEWORKS_DIR=YES
https://bugs.webkit.org/show_bug.cgi?id=188956
<rdar://problem/43253221>

Reviewed by Darin Adler.

* WebKitLegacy.xcodeproj/project.pbxproj: Updated the Symlink WebKitPluginHost build phase.

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

16 months agoOpen for business.
lforschler@apple.com [Mon, 27 Aug 2018 00:48:43 +0000 (00:48 +0000)]
Open for business.

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

16 months agoUnreviewed test fix after r235249
mmaxfield@apple.com [Fri, 24 Aug 2018 23:33:30 +0000 (23:33 +0000)]
Unreviewed test fix after r235249
https://bugs.webkit.org/show_bug.cgi?id=178981

* WebGPUShadingLanguageRI/Test.js:

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

16 months agoClick event from click() is not composed
rniwa@webkit.org [Fri, 24 Aug 2018 23:12:28 +0000 (23:12 +0000)]
Click event from click() is not composed
https://bugs.webkit.org/show_bug.cgi?id=170211

Reviewed by Wenson Hsieh.

LayoutTests/imported/w3c:

Rebaselined the test now that all test cases pass.

* web-platform-tests/shadow-dom/event-composed-expected.txt:

Source/WebCore:

Fixed the bug. All simulated clicks should be composed regardless of whether it's trusted or not.
See: https://html.spec.whatwg.org/multipage/interaction.html#dom-click
     https://html.spec.whatwg.org/multipage/webappapis.html#fire-a-synthetic-mouse-event

* dom/SimulatedClick.cpp:

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

16 months agoImprove unified source generator script logging and error messages
timothy_horton@apple.com [Fri, 24 Aug 2018 22:54:23 +0000 (22:54 +0000)]
Improve unified source generator script logging and error messages
https://bugs.webkit.org/show_bug.cgi?id=188932

Reviewed by Simon Fraser.

* Scripts/generate-unified-source-bundles.rb:
Add the ability to explain why you're getting usage() instead of just printing it.
Capitalize log messages, and improve the wording in a few places.

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

16 months agoAvoid calling setUntrusted in SimulatedMouseEvent
rniwa@webkit.org [Fri, 24 Aug 2018 22:51:33 +0000 (22:51 +0000)]
Avoid calling setUntrusted in SimulatedMouseEvent
https://bugs.webkit.org/show_bug.cgi?id=188929

Reviewed by Simon Fraser.

Added IsTrusted flag to Event constructors instead of creating a trusted event
and making it untrusted in the constructor of SimulatedMouseEvent.

This makes EventTarget::dispatchEventForBindings the only caller of setUntrusted().

* dom/Event.cpp:
(WebCore::Event::Event):
* dom/Event.h:
* dom/KeyboardEvent.cpp:
(WebCore::KeyboardEvent::KeyboardEvent):
* dom/MouseEvent.cpp:
(WebCore::MouseEvent::create):
(WebCore::MouseEvent::MouseEvent):
* dom/MouseEvent.h:
* dom/MouseRelatedEvent.cpp:
(WebCore::MouseRelatedEvent::MouseRelatedEvent):
* dom/MouseRelatedEvent.h:
* dom/SimulatedClick.cpp:
* dom/UIEvent.cpp:
(WebCore::UIEvent::UIEvent):
* dom/UIEvent.h:
* dom/UIEventWithKeyState.h:
(WebCore::UIEventWithKeyState::UIEventWithKeyState):
* dom/WheelEvent.cpp:
(WebCore::WheelEvent::WheelEvent):

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

16 months agoUsing Touch Bar to scrub video on Youtube results in video playback freeze
jer.noble@apple.com [Fri, 24 Aug 2018 21:40:50 +0000 (21:40 +0000)]
Using Touch Bar to scrub video on Youtube results in video playback freeze
https://bugs.webkit.org/show_bug.cgi?id=188926

Reviewed by Eric Carlson.

Source/WebCore:

Test: media/media-source/media-source-seek-twice.html

When converting from a double-precision float to a MediaTime, a certain amount of precision is lost. If that
results in a round-trip between `float in -> MediaTime -> float out` where in != out, we will wait forever for
the time jump observer to fire. Break the cycle by comparing m_lastSeekTime to the synchronizerTime only after
m_lastSeekTime has been normalized into a rational-time value.

* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seekInternal):

LayoutTests:

* media/media-source/media-source-seek-twice-expected.txt: Added.
* media/media-source/media-source-seek-twice.html: Added.

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

16 months agoYARR: Update UCS canonicalization tables for Unicode 11
msaboff@apple.com [Fri, 24 Aug 2018 21:15:00 +0000 (21:15 +0000)]
YARR: Update UCS canonicalization tables for Unicode 11
https://bugs.webkit.org/show_bug.cgi?id=188928

Reviewed by Mark Lam.

Generated YarrCanonicalizeUCS2.cpp from YarrCanonicalizeUCS2.js.

This passes JavaScriptCore and test262 tests.

* yarr/YarrCanonicalizeUCS2.cpp:
* yarr/YarrCanonicalizeUCS2.js:
(printHeader):

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

16 months agoRemove -[WKNavigationDelegate _webView:decidePolicyForPluginLoadWithCurrentPolicy...
jeffm@apple.com [Fri, 24 Aug 2018 20:36:56 +0000 (20:36 +0000)]
Remove -[WKNavigationDelegate _webView:decidePolicyForPluginLoadWithCurrentPolicy:pluginInfo:unavailabilityDescription:]
https://bugs.webkit.org/show_bug.cgi?id=188889

Reviewed by Alex Christensen.

* UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
Remove obsolete method.

* UIProcess/Cocoa/NavigationState.h:
Remove obsolete flag.

* UIProcess/Cocoa/NavigationState.mm:
(WebKit::NavigationState::setNavigationDelegate):
Remove obsolete flag.

(WebKit::NavigationState::NavigationClient::decidePolicyForPluginLoad):
Remove support for obsolete delegate method.

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

16 months agoPass in IsComposed flag to Event constructors
rniwa@webkit.org [Fri, 24 Aug 2018 20:14:50 +0000 (20:14 +0000)]
Pass in IsComposed flag to Event constructors
https://bugs.webkit.org/show_bug.cgi?id=188720
<rdar://problem/43580387>

Reviewed by Simon Fraser.

Source/WebCore:

This patch replaces the logic in Event::isComposed to decide whether an event is composed or not by
explicitly passing IsComposed flag to Event constructor. This decouples being composed from whether
an event is trusted and of a partciular event type, paving our way to make synthetic click event
dispatched by an author script composable in webkit.org/b/170211.

This patch also removes IsTrusted from the argument list of event constructors and create functions
to systematically eliminate the possibility of this patch making an event uncomposed by not setting
IsComposed flag.

No new tests since there should be no behavioral change.

* dom/ClipboardEvent.cpp:
(WebCore::ClipboardEvent::ClipboardEvent): A trusted ClipboardEvent is composed.
* dom/ClipboardEvent.h:
(WebCore::ClipboardEvent::ClipboardEvent): Removed IsTrusted from the variant which takes Init object
to make sure this refactoring is correct.
(WebCore::ClipboardEvent::create): Ditto.
* dom/CompositionEvent.cpp:
(WebCore::CompositionEvent::CompositionEvent): A trusted CompositionEvent is composed.
* dom/CompositionEvent.h:
* dom/Element.cpp:
(WebCore::Element::dispatchMouseEvent): A trusted dblclick event is composed (this is a non-standard
event but virtually every mouse event is composed so it makes sense to make this composed).
* dom/Event.cpp:
(WebCore::Event::Event):
(WebCore::Event::create):
(WebCore::Event::composed const): Deleted. The trival implementation moved to the header file.
* dom/Event.h:
(WebCore::Event::composed const):
* dom/FocusEvent.cpp:
(WebCore::FocusEvent::FocusEvent): A trusted Focus event is composed.
* dom/FocusEvent.h:
(WebCore::FocusEvent::create): Removed IsTrusted from Init variant for the correctness guarantee.
(WebCore::FocusEvent::FocusEvent): Ditto.
* dom/InputEvent.cpp:
(WebCore::InputEvent::create): Removed IsTrusted from Init variant for the correctness guarantee.
(WebCore::InputEvent::InputEvent): A trsuted InputEvent is composed.
* dom/InputEvent.h:
* dom/KeyboardEvent.cpp:
(WebCore::KeyboardEvent::KeyboardEvent): A trsuted KeyboardEvent is composed.
(WebCore::KeyboardEvent::create): Removed IsTrusted from Init variant for the correctness guarantee.
* dom/KeyboardEvent.h:
* dom/MouseEvent.cpp:
(WebCore::MouseEvent::create): Removed IsTrusted from Init variant for the correctness guarantee.
(WebCore::MouseEvent::MouseEvent): Explicitly take IsComposed flag from subclasses since simulated click
does not currently compose.
* dom/MouseEvent.h:
* dom/MouseRelatedEvent.cpp:
(WebCore::MouseRelatedEvent::MouseRelatedEvent): A trusted touch event is composed.
* dom/MouseRelatedEvent.h:
* dom/Node.cpp:
(WebCore::Node::dispatchDOMActivateEvent): A trusted DOMActivateEvent event is composed.
(WebCore::Node::dispatchInputEvent): A trusted input event is composed.
* dom/SimulatedClick.cpp:
(SimulatedMouseEvent::SimulatedMouseEvent): A simulated click is composed if it's a trusted event for now.
This is the bug to be fixed in webkit.org/b/170211.
* dom/TextEvent.cpp:
(WebCore::TextEvent::TextEvent): A trsuted textInput event is composed.
* dom/UIEvent.cpp:
(WebCore::UIEvent::UIEvent): Added IsComposed as an argument to the variant which creates a trusted event,
and removed IsTrusted from Init variant for the correctness guarantee.
* dom/UIEvent.h:
(WebCore::UIEvent::create): Ditto.
* dom/UIEventWithKeyState.h:
(WebCore::UIEventWithKeyState::UIEventWithKeyState): Ditto.
* dom/WheelEvent.cpp:
(WebCore::WheelEvent::WheelEvent): A trusted Wheel event, which is a subclass of MouseEvent, is composed.
(WebCore::WheelEvent::create): Removed IsTrusted from Init variant for the correctness guarantee.
* dom/WheelEvent.h:
* editing/Editor.cpp:
(WebCore::dispatchBeforeInputEvent):
(WebCore::dispatchInputEvent):
(WebCore::dispatchClipboardEvent): Call the newly added variant which takes DataTransfer directly so that
we can remove IsTrusted from the variant which takes Init for the correctness guarantee.
* page/EventHandler.cpp:
(WebCore::EventHandler::dispatchDragEvent): A trusted mouse event is composed.

Source/WebKit:

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::navigateToPDFLinkWithSimulatedClick): A trusted click event is composed regardless of
whether it's simulated or not.

Source/WebKitLegacy/ios:

* WebView/WebPDFViewPlaceholder.mm:
(-[WebPDFViewPlaceholder simulateClickOnLinkToURL:]): A trusted click event is composed regardless
of whether it's simulated or not.

Source/WebKitLegacy/mac:

* WebView/WebPDFView.mm:
(-[WebPDFView PDFViewWillClickOnLink:withURL:]): A trusted click event is composed regardless of
whether it's simulated or not.

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

16 months agoRemove the flaky test expectation now that the test isn't flaky on bots after r235274.
rniwa@webkit.org [Fri, 24 Aug 2018 20:12:43 +0000 (20:12 +0000)]
Remove the flaky test expectation now that the test isn't flaky on bots after r235274.

* platform/wk2/TestExpectations:

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

16 months agoAdd getModifierState to MouseEvent
rniwa@webkit.org [Fri, 24 Aug 2018 20:07:36 +0000 (20:07 +0000)]
Add getModifierState to MouseEvent
https://bugs.webkit.org/show_bug.cgi?id=188913
<rdar://problem/43668772>

Reviewed by Simon Fraser.

Source/WebCore:

Moved getModifierState from KeyboardEvent to UIEventWithKeyState and exposed it in MouseEvent.
See https://www.w3.org/TR/2016/WD-uievents-20160804/#mouseevent

This patch also fixes the bug that initMouseEvent was not clearing AltGraph and CapsLock states,
which was preserved in the refactoring done in r235158.

Tests: fast/events/constructors/mouse-event-getModifierState.html
       fast/events/dblclick-event-getModifierState.html

* dom/KeyboardEvent.cpp:
(WebCore::KeyboardEvent::getModifierState const): Moved to UIEventWithKeyState.
* dom/KeyboardEvent.h:
* dom/KeyboardEvent.idl: Insert a blank line to match the spec's IDL.
* dom/MouseEvent.idl: Added getModifierState.
* dom/UIEventWithKeyState.cpp:
(WebCore::UIEventWithKeyState::modifiersFromInitializer): Moved from the header file.
(WebCore::UIEventWithKeyState::getModifierState const):
(WebCore::UIEventWithKeyState::setModifierKeys): Moved from the header file.
* dom/UIEventWithKeyState.h:
(WebCore::UIEventWithKeyState::modifierKeys const):
(WebCore::UIEventWithKeyState::setModifierKeys): Deleted the variant which didn't take altGraphKey
since that variant behaves same as the one which takes altGraphKey.

LayoutTests:

Added two tests for getModifierState: one manually setting modifier key states in MouseEvent's constructor,
and another one for dblclick inheriting modifier key states from the click event.

Also improved the test coverage for KeyboardEvent's getModifierState.

* fast/events/constructors/keyboard-event-getModifierState-expected.txt:
* fast/events/constructors/keyboard-event-getModifierState.html: Added more test cases.
* fast/events/constructors/mouse-event-getModifierState-expected.txt: Added.
* fast/events/constructors/mouse-event-getModifierState.html: Added.
* fast/events/dblclick-event-getModifierState-expected.txt: Added.
* fast/events/dblclick-event-getModifierState.html: Added.
* fast/events/init-event-clears-capslock-expected.txt:
* fast/events/init-event-clears-capslock.html: Added tests for MouseEvent. Note that initMouseEvent doesn't
take altGraphKey boolean unlike initKeyboardEvent.
* platform/ios/TestExpectations: Skip the dblclick test in iOS since click event isn't supported on iOS.

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

16 months agoAdd WKWebView._mainFrame SPI
achristensen@apple.com [Fri, 24 Aug 2018 19:43:20 +0000 (19:43 +0000)]
Add WKWebView._mainFrame SPI
https://bugs.webkit.org/show_bug.cgi?id=188925

Reviewed by Brian Burg.

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

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

16 months agolibwebrtc PeerConnection::AddTrack sometimes fail
youenn@apple.com [Fri, 24 Aug 2018 19:30:27 +0000 (19:30 +0000)]
libwebrtc PeerConnection::AddTrack sometimes fail
https://bugs.webkit.org/show_bug.cgi?id=188914

Reviewed by Eric Carlson.

LayoutTests/imported/w3c:

* web-platform-tests/webrtc/RTCPeerConnection-addTrack.https-expected.txt:

Source/WebCore:

AddTrack may fail so test the result and if not successful, make JS addTrack to throw an exception.
This makes some tests to fail now.
These tests should pass again when unified plan will be enabled.
Covered by rebased tests.

* Modules/mediastream/PeerConnectionBackend.h:
(WebCore::PeerConnectionBackend::notifyAddedTrack):
* Modules/mediastream/RTCPeerConnection.cpp:
(WebCore::RTCPeerConnection::addTrack):
(WebCore::RTCPeerConnection::addTransceiver):
* Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
(WebCore::LibWebRTCMediaEndpoint::addTrack):
* Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
* Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
(WebCore::LibWebRTCPeerConnectionBackend::notifyAddedTrack):
* Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:

LayoutTests:

* fast/mediastream/RTCPeerConnection-add-removeTrack-expected.txt:

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

16 months ago[Curl] Match the interface used in NetworkDataTask and ResourceHandle.
Basuke.Suzuki@sony.com [Fri, 24 Aug 2018 19:14:36 +0000 (19:14 +0000)]
[Curl] Match the interface used in NetworkDataTask and ResourceHandle.
https://bugs.webkit.org/show_bug.cgi?id=188922

Reviewed by Alex Christensen.

The interfaces for NetworkDataTask and ResourceHandle are diverged.
It should be same for the same purpose because they do same thing.

No change in behavior.

* NetworkProcess/curl/NetworkDataTaskCurl.cpp:
(WebKit::NetworkDataTaskCurl::NetworkDataTaskCurl):
(WebKit::NetworkDataTaskCurl::createCurlRequest):
(WebKit::NetworkDataTaskCurl::willPerformHTTPRedirection):
(WebKit::NetworkDataTaskCurl::restartWithCredential):
* NetworkProcess/curl/NetworkDataTaskCurl.h:

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

16 months ago[FreeType] Do not cast through GLib types in FontCustomPlatformDataFreeType.cpp
aperez@igalia.com [Fri, 24 Aug 2018 19:13:02 +0000 (19:13 +0000)]
[FreeType] Do not cast through GLib types in FontCustomPlatformDataFreeType.cpp
https://bugs.webkit.org/show_bug.cgi?id=188919

Reviewed by Michael Catanzaro.

No new tests needed.

* platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp:
(WebCore::FontCustomPlatformData::FontCustomPlatformData): Cast
through "void (*)(void)" instead of GCallback to avoid the warning
produced by -Wcast-function-type.

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

16 months agoFollow up to r235323
achristensen@apple.com [Fri, 24 Aug 2018 19:10:19 +0000 (19:10 +0000)]
Follow up to r235323
https://bugs.webkit.org/show_bug.cgi?id=188923
<rdar://problem/34657861>

* UIProcess/API/C/mac/WKInspectorPrivateMac.h:
* UIProcess/mac/WebInspectorProxyMac.mm:
(-[WKWebInspectorProxyObjCAdapter inspector]):
A _WKInspector * accessor in the WKWebInspectorProxyObjCAdapter is nice, too.

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

16 months agoIntroduce _WKInspector
achristensen@apple.com [Fri, 24 Aug 2018 18:41:19 +0000 (18:41 +0000)]
Introduce _WKInspector
https://bugs.webkit.org/show_bug.cgi?id=188923
<rdar://problem/34657861>

Reviewed by Brian Burg.

Source/WebKit:

* Shared/Cocoa/APIObject.mm:
(API::Object::newObject):
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _inspector]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/API/Cocoa/_WKInspector.h: Added.
* UIProcess/API/Cocoa/_WKInspector.mm: Added.
(-[_WKInspector webView]):
(-[_WKInspector isConnected]):
(-[_WKInspector isVisible]):
(-[_WKInspector isFront]):
(-[_WKInspector isProfilingPage]):
(-[_WKInspector isElementSelectionActive]):
(-[_WKInspector connect]):
(-[_WKInspector show]):
(-[_WKInspector hide]):
(-[_WKInspector close]):
(-[_WKInspector showConsole]):
(-[_WKInspector showResources]):
(-[_WKInspector showMainResourceForFrame:]):
(-[_WKInspector attach]):
(-[_WKInspector detach]):
(-[_WKInspector showTimelines]):
(-[_WKInspector togglePageProfiling]):
(-[_WKInspector toggleElementSelection]):
(-[_WKInspector printErrorToConsole:]):
(-[_WKInspector _apiObject]):
* UIProcess/API/Cocoa/_WKInspectorInternal.h: Added.
* WebKit.xcodeproj/project.pbxproj:

Tools:

* MiniBrowser/mac/WK2BrowserWindowController.m:
(-[WK2BrowserWindowController validateMenuItem:]):
(-[WK2BrowserWindowController showHideWebInspector:]):

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

16 months agoYARR: JIT RegExps with non-greedy parenthesized sub patterns
msaboff@apple.com [Fri, 24 Aug 2018 18:22:29 +0000 (18:22 +0000)]
YARR: JIT RegExps with non-greedy parenthesized sub patterns
https://bugs.webkit.org/show_bug.cgi?id=180876

Reviewed by Filip Pizlo.

Implemented the non-greedy nested parenthesis based on the prior greedy nested parenthesis work.
For the matching code, the greedy path was correct except that we don't try matching for the
non-greedy case.  Added a jump out to the term after the parenthesis and a label to perform the
first / next match when we backtrack.  The backtracking code needs to check to see if we have
tried the first match or if we can do another match.

Updated the disassembly annotations to include parenthesis capturing info, quantifier type and
count.  Did other minor cleanup as well.

Fixed function name typo, added missing 't' in "setUsesPaternContextBuffer()".

Updated the text in some comments, both for this change as well as accuracy for existing code.

* yarr/YarrJIT.cpp:
(JSC::Yarr::YarrGenerator::generate):
(JSC::Yarr::YarrGenerator::backtrack):
(JSC::Yarr::YarrGenerator::opCompileParenthesesSubpattern):
(JSC::Yarr::YarrGenerator::compile):
(JSC::Yarr::dumpCompileFailure):
(JSC::Yarr::jitCompile):
* yarr/YarrJIT.h:
(JSC::Yarr::YarrCodeBlock::setUsesPatternContextBuffer):
(JSC::Yarr::YarrCodeBlock::setUsesPaternContextBuffer): Deleted.

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

16 months agoDon't launch network process in WebCookieManagerProxy::setHTTPCookieAcceptPolicy
sihui_liu@apple.com [Fri, 24 Aug 2018 17:46:01 +0000 (17:46 +0000)]
Don't launch network process in WebCookieManagerProxy::setHTTPCookieAcceptPolicy
https://bugs.webkit.org/show_bug.cgi?id=188906
<rdar://problem/43539661>

Reviewed by Geoffrey Garen.

In WebCookieManagerProxy::setHTTPCookieAcceptPolicy, we persist the cookieAcceptPolicy of
sharedCookieStorage. When we launch the network process later, we pass the
identifier of sharedCookieStorage to network process, so network process has the correct
cookieAcceptPolicy. Therefore, we don't have to launch the network process and send the
setting message if the network process is not launched.

* UIProcess/WebCookieManagerProxy.cpp:
(WebKit::WebCookieManagerProxy::setHTTPCookieAcceptPolicy):

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

16 months agoMark media/video-load-preload-metadata.html as flaky on iOS
ryanhaddad@apple.com [Fri, 24 Aug 2018 16:35:04 +0000 (16:35 +0000)]
Mark media/video-load-preload-metadata.html as flaky on iOS
https://bugs.webkit.org/show_bug.cgi?id=128312

Unreviewed test gardening.

* platform/ios/TestExpectations:

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

16 months ago[Apple Pay] Allow $0 totals
aestes@apple.com [Fri, 24 Aug 2018 15:20:48 +0000 (15:20 +0000)]
[Apple Pay] Allow $0 totals
https://bugs.webkit.org/show_bug.cgi?id=185150
<rdar://problem/39212331>

Reviewed by Dan Bernstein.

Source/WebCore:

Relaxed payment request validation to allow $0 totals. This matches PassKit behavior.

Updated test cases in http/tests/ssl/applepay/.

* Modules/applepay/PaymentRequestValidator.mm:
(WebCore::PaymentRequestValidator::validateTotal):

LayoutTests:

* http/tests/ssl/applepay/ApplePaySession-expected.txt:
* http/tests/ssl/applepay/ApplePaySession.html:
* http/tests/ssl/applepay/ApplePaySessionV3-expected.txt:
* http/tests/ssl/applepay/ApplePaySessionV3.html:
* http/tests/ssl/applepay/ApplePaySessionV4-expected.txt:
* http/tests/ssl/applepay/ApplePaySessionV4.html:
* http/tests/ssl/applepay/PaymentRequest.https-expected.txt:
* http/tests/ssl/applepay/PaymentRequest.https.html:

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

16 months agoFix handling of iOS minor versions in default_baseline_search_path
jbedard@apple.com [Fri, 24 Aug 2018 14:03:30 +0000 (14:03 +0000)]
Fix handling of iOS minor versions in default_baseline_search_path
https://bugs.webkit.org/show_bug.cgi?id=188902

Reviewed by Aakash Jain.

* Scripts/webkitpy/port/ios.py:
(IOSPort.default_baseline_search_path): When the major version matches the major version of the CURRENT_VERSION, treat
it as a the CURRENT_VERSION.

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

16 months agoRemove ScrollByPrecisePixel granularity
commit-queue@webkit.org [Fri, 24 Aug 2018 10:12:56 +0000 (10:12 +0000)]
Remove ScrollByPrecisePixel granularity
https://bugs.webkit.org/show_bug.cgi?id=188915

Patch by Frederic Wang <fwang@igalia.com> on 2018-08-24
Reviewed by Carlos Garcia Campos.

ScrollByPrecisePixel was introduced in bug 87535 and bug 91020 for Chromium Linux/Windows but
it is no longer used.

No new tests, behavior unchanged.

* platform/ScrollAnimatorSmooth.cpp:
(WebCore::ScrollAnimatorSmooth::scroll): Remove special handling for ScrollByPrecisePixel.
* platform/ScrollTypes.h: Remove ScrollByPrecisePixel, it is never used.
* platform/ScrollableArea.cpp:
(WebCore::ScrollableArea::scroll): Remove special handling for ScrollByPrecisePixel.
* platform/gtk/ScrollAnimatorGtk.cpp:
(WebCore::ScrollAnimatorGtk::scroll): Remove special handling for ScrollByPrecisePixel.

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

16 months agoAllow creating WeakPtrs to const objects
antti@apple.com [Fri, 24 Aug 2018 09:30:52 +0000 (09:30 +0000)]
Allow creating WeakPtrs to const objects
https://bugs.webkit.org/show_bug.cgi?id=188785

Reviewed by Geoff Garen.

Source/WebCore:

Remove some unneeded const_casts.

* css/MediaQueryEvaluator.cpp:
(WebCore::MediaQueryEvaluator::MediaQueryEvaluator):
(WebCore::MediaQueryEvaluator::evaluate const):
* css/MediaQueryEvaluator.h:
* rendering/FloatingObjects.cpp:
(WebCore::ComputeFloatOffsetAdapter::ComputeFloatOffsetAdapter):
(WebCore::ComputeFloatOffsetForFloatLayoutAdapter::ComputeFloatOffsetForFloatLayoutAdapter):
(WebCore::ComputeFloatOffsetForLineLayoutAdapter::ComputeFloatOffsetForLineLayoutAdapter):
(WebCore::FindNextFloatLogicalBottomAdapter::FindNextFloatLogicalBottomAdapter):
(WebCore::FloatingObjects::FloatingObjects):
* rendering/FloatingObjects.h:
(WebCore::FloatingObjects::renderer const):

Source/WTF:

const Foo foo;
WeakPtr<const Foo> weakConstFoo = makeWeakPtr(foo);

* wtf/WeakPtr.h:
(WTF::WeakPtrFactory::createWeakPtr const):

Add a separate factory function for const T.
The underlying WeakReference is kept non-const in all cases.

Tools:

* TestWebKitAPI/Tests/WTF/WeakPtr.cpp:
(TestWebKitAPI::Base::weakPtrFactory const):
(TestWebKitAPI::TEST):
(TestWebKitAPI::Base::weakPtrFactory): Deleted.

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

16 months ago[CoordGraphics] Move inline methods on CoordinatedGraphicsLayer out-of-line
zandobersek@gmail.com [Fri, 24 Aug 2018 09:13:46 +0000 (09:13 +0000)]
[CoordGraphics] Move inline methods on CoordinatedGraphicsLayer out-of-line
https://bugs.webkit.org/show_bug.cgi?id=188916

Reviewed by Carlos Garcia Campos.

Style checker produced complaints that CoordinatedGraphicsLayer class is
using inline-defined methods despite the WEBCORE_EXPORT macro being used
for the whole class. Keep the macro where it is but instead move the
method definitions out-of-line.

* platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
(WebCore::CoordinatedGraphicsLayer::isCoordinatedGraphicsLayer const):
(WebCore::CoordinatedGraphicsLayer::id const):
(WebCore::CoordinatedGraphicsLayer::primaryLayerID const):
(WebCore::CoordinatedGraphicsLayer::usesContentsLayer const):
* platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:

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

16 months ago[GTK][WPE] Add API to inject/register user content in isolated worlds
carlosgc@webkit.org [Fri, 24 Aug 2018 08:04:28 +0000 (08:04 +0000)]
[GTK][WPE] Add API to inject/register user content in isolated worlds
https://bugs.webkit.org/show_bug.cgi?id=188883

Reviewed by Michael Catanzaro.

Source/WebKit:

Add new API to create user scripts/stylesheets for a given script world and to register/unregister user script
messages in a given script world.

* UIProcess/API/glib/WebKitUserContent.cpp:
(webkitUserContentWorld):
(_WebKitUserStyleSheet::_WebKitUserStyleSheet):
(webkit_user_style_sheet_new):
(webkit_user_style_sheet_new_for_world):
(_WebKitUserScript::_WebKitUserScript):
(webkit_user_script_new):
(webkit_user_script_new_for_world):
* UIProcess/API/glib/WebKitUserContentManager.cpp:
(webkit_user_content_manager_register_script_message_handler_in_world):
(webkit_user_content_manager_unregister_script_message_handler_in_world):
* UIProcess/API/glib/WebKitUserContentPrivate.h:
* UIProcess/API/gtk/WebKitUserContent.h:
* UIProcess/API/gtk/WebKitUserContentManager.h:
* UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
* UIProcess/API/wpe/WebKitUserContent.h:
* UIProcess/API/wpe/WebKitUserContentManager.h:
* WebProcess/UserContent/WebUserContentController.cpp:
(WebKit::WebUserContentController::addUserContentWorlds):

Tools:

Add test cases for the new API.

* TestWebKitAPI/Tests/WebKitGLib/TestWebKitUserContentManager.cpp:
(isStyleSheetInjectedForURLAtPath):
(isScriptInjectedForURLAtPath):
(testUserContentManagerInjectedStyleSheet):
(testUserContentManagerInjectedScript):
(UserScriptMessageTest::registerHandler):
(UserScriptMessageTest::unregisterHandler):
(UserScriptMessageTest::postMessageAndWaitUntilReceived):
(testUserContentManagerScriptMessageInWorldReceived):
(beforeAll):

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

16 months agoUse OptionSet::containsAny and containsAll in some more places
antti@apple.com [Fri, 24 Aug 2018 07:43:44 +0000 (07:43 +0000)]
Use OptionSet::containsAny and containsAll in some more places
https://bugs.webkit.org/show_bug.cgi?id=188885

Reviewed by Sam Weinig.

* page/PerformanceMonitor.cpp:
(WebCore::PerformanceMonitor::activityStateChanged):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::updateLayerPositionsAfterScroll):
(WebCore::RenderLayer::paintLayerContents):
(WebCore::RenderLayer::calculateClipRects const):
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::~RenderLayerBacking):

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

16 months agofast/files/blob-network-process-crash.html is flaky
rniwa@webkit.org [Fri, 24 Aug 2018 05:51:34 +0000 (05:51 +0000)]
fast/files/blob-network-process-crash.html is flaky
https://bugs.webkit.org/show_bug.cgi?id=188911

Reviewed by Saam Barati.

The flakiness appears to come from the web content process not getting notified of
the termination of the network process in time. Wait for the network process to
relaunch after terminating one by continuously fetch'ing itself with an increasing
time interval until it succeeds.

* fast/files/blob-network-process-crash.html:

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

16 months agoWeb Inspector: Color picker: can't enter decimal numbers for opacity
drousso@apple.com [Fri, 24 Aug 2018 04:55:28 +0000 (04:55 +0000)]
Web Inspector: Color picker: can't enter decimal numbers for opacity
https://bugs.webkit.org/show_bug.cgi?id=187026
<rdar://problem/41446500>

Reviewed by Brian Burg.

After every "input" event, we update the `color` value of the `WI.ColorPicker` based on a
generated string using the values of the various <input>. The issue with this approach is
that adding a decimal point (e.g. "0.") would still be construed as 0, meaning that the
color wouldn't change and would instead be reset back to it's old value. This patch adds an
early return if the newly generated color has the same value as the current color, thereby
meaning that the `color` wouldn't change when changing from "0" to "0.".

* UserInterface/Views/ColorPicker.js:
(WI.ColorPicker):
(WI.ColorPicker.createColorInput):
(WI.ColorPicker.prototype._handleColorInputInput):

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

16 months agoAdd support for dumping GC heap snapshots, and a viewer
simon.fraser@apple.com [Fri, 24 Aug 2018 04:10:31 +0000 (04:10 +0000)]
Add support for dumping GC heap snapshots, and a viewer
https://bugs.webkit.org/show_bug.cgi?id=186416

Reviewed by Joseph Pecoraro.

Source/JavaScriptCore:

Make a way to dump information about the GC heap that is useful for looking for leaked
or abandoned objects. This dump is obtained (on Apple platforms) via:
    notifyutil -p com.apple.WebKit.dumpGCHeap
which writes a JSON file to /tmp which can then be loaded into the viewer in Tools/GCHeapInspector.

This leverages the heap snapshot used by Web Inspector, adding an alternate format for
the snapshot JSON that adds additional data about objects and why they are GC roots.

SlotVisitor maintains a RootMarkReason (via SetRootMarkReasonScope) that allows
the HeapSnapshotBuilder to keep track of why a JSCell was treated as a GC root. For
objects visited via opaque roots, we record the reason why via a new out param to
isReachableFromOpaqueRoots().

HeapSnapshotBuilder is enhanced to produce GCDebuggingSnapshot JSON output. This contains
additional information including the address of the JSCell* and the wrapped object (for
JSDOMWrappers), the root reasons, and for some objects like JSDocument a label which can
be the document URL.

GCDebuggingSnapshots are always full snapshots (previous snapshots are not kept around).

* API/JSAPIWrapperObject.mm:
(JSAPIWrapperObjectHandleOwner::isReachableFromOpaqueRoots):
* API/JSManagedValue.mm:
(JSManagedValueHandleOwner::isReachableFromOpaqueRoots):
* API/glib/JSAPIWrapperObjectGLib.cpp:
(JSAPIWrapperObjectHandleOwner::isReachableFromOpaqueRoots):
* CMakeLists.txt:
* heap/ConservativeRoots.h:
(JSC::ConservativeRoots::size const):
(JSC::ConservativeRoots::size): Deleted.
* heap/Heap.cpp:
(JSC::Heap::addCoreConstraints):
* heap/HeapSnapshotBuilder.cpp:
(JSC::HeapSnapshotBuilder::getNextObjectIdentifier):
(JSC::HeapSnapshotBuilder::HeapSnapshotBuilder):
(JSC::HeapSnapshotBuilder::~HeapSnapshotBuilder):
(JSC::HeapSnapshotBuilder::buildSnapshot):
(JSC::HeapSnapshotBuilder::appendNode):
(JSC::HeapSnapshotBuilder::appendEdge):
(JSC::HeapSnapshotBuilder::setOpaqueRootReachabilityReasonForCell):
(JSC::HeapSnapshotBuilder::setWrappedObjectForCell):
(JSC::HeapSnapshotBuilder::previousSnapshotHasNodeForCell):
(JSC::snapshotTypeToString):
(JSC::rootTypeToString):
(JSC::HeapSnapshotBuilder::setLabelForCell):
(JSC::HeapSnapshotBuilder::descriptionForCell const):
(JSC::HeapSnapshotBuilder::json):
(JSC::HeapSnapshotBuilder::hasExistingNodeForCell): Deleted.
* heap/HeapSnapshotBuilder.h:
* heap/SlotVisitor.cpp:
(JSC::SlotVisitor::appendSlow):
* heap/SlotVisitor.h:
(JSC::SlotVisitor::heapSnapshotBuilder const):
(JSC::SlotVisitor::rootMarkReason const):
(JSC::SlotVisitor::setRootMarkReason):
(JSC::SetRootMarkReasonScope::SetRootMarkReasonScope):
(JSC::SetRootMarkReasonScope::~SetRootMarkReasonScope):
* heap/WeakBlock.cpp:
(JSC::WeakBlock::specializedVisit):
* heap/WeakHandleOwner.cpp:
(JSC::WeakHandleOwner::isReachableFromOpaqueRoots):
* heap/WeakHandleOwner.h:
* runtime/SimpleTypedArrayController.cpp:
(JSC::SimpleTypedArrayController::JSArrayBufferOwner::isReachableFromOpaqueRoots):
* runtime/SimpleTypedArrayController.h:
* tools/JSDollarVM.cpp:

Source/WebCore:

Make a way to dump information about the GC heap that is useful for looking for leaked
or abandoned objects. This dump is obtained (on Apple platforms) via:
    notifyutil -p com.apple.WebKit.dumpGCHeap
which writes a JSON file to /tmp which can then be loaded into the viewer in Tools/GCHeapInspector.

This leverages the heap snapshot used by Web Inspector, adding an alternate format for
the snapshot JSON that adds additional data about objects and why they are GC roots.

The generated bindings code is changed to include the output root reason from isReachableFromOpaqueRoots(),
and to implement heapSnapshot() which provides the address of the wrapped object. A new IDL attribute,
CustomHeapSnapshot, is used to allow custom heapSnapshot() implementations for classes like JSDocument
that need to decorate the heap snapshot cell data with things like the document URL.

GCController registers a notifyutil callback which gathers the debug heap snapshot, and dumps it
to a file in /tmp. The file path is printed out to the system log.

* bindings/js/DOMGCOutputConstraint.cpp:
(WebCore::DOMGCOutputConstraint::executeImpl):
* bindings/js/GCController.cpp:
(WebCore::GCController::GCController):
(WebCore::GCController::dumpHeap):
* bindings/js/GCController.h:
* bindings/js/JSCSSRuleListCustom.cpp:
(WebCore::JSCSSRuleListOwner::isReachableFromOpaqueRoots):
* bindings/js/JSCallbackData.cpp:
(WebCore::JSCallbackDataWeak::WeakOwner::isReachableFromOpaqueRoots):
* bindings/js/JSCallbackData.h:
* bindings/js/JSCanvasRenderingContext2DCustom.cpp:
(WebCore::JSCanvasRenderingContext2DOwner::isReachableFromOpaqueRoots):
* bindings/js/JSDOMWindowCustom.cpp:
(WebCore::JSDOMWindow::getOwnPropertySlot):
(WebCore::JSDOMWindow::heapSnapshot):
* bindings/js/JSDeprecatedCSSOMValueCustom.cpp:
(WebCore::JSDeprecatedCSSOMValueOwner::isReachableFromOpaqueRoots):
* bindings/js/JSDocumentCustom.cpp:
(WebCore::JSDocument::heapSnapshot):
* bindings/js/JSMicrotaskCallback.h:
(WebCore::JSMicrotaskCallback::call):
* bindings/js/JSMutationObserverCustom.cpp:
(WebCore::JSMutationObserverOwner::isReachableFromOpaqueRoots):
* bindings/js/JSNavigatorCustom.cpp:
(WebCore::JSNavigator::visitAdditionalChildren):
* bindings/js/JSNodeCustom.cpp:
(WebCore::isReachableFromDOM):
(WebCore::JSNodeOwner::isReachableFromOpaqueRoots):
* bindings/js/JSNodeListCustom.cpp:
(WebCore::JSNodeListOwner::isReachableFromOpaqueRoots):
* bindings/js/JSOffscreenCanvasRenderingContext2DCustom.cpp:
(WebCore::JSOffscreenCanvasRenderingContext2DOwner::isReachableFromOpaqueRoots):
* bindings/js/JSPerformanceObserverCustom.cpp:
(WebCore::JSPerformanceObserverOwner::isReachableFromOpaqueRoots):
* bindings/js/JSPopStateEventCustom.cpp:
* bindings/js/JSTextTrackCueCustom.cpp:
(WebCore::JSTextTrackCueOwner::isReachableFromOpaqueRoots):
* bindings/js/WebCoreTypedArrayController.cpp:
(WebCore::WebCoreTypedArrayController::JSArrayBufferOwner::isReachableFromOpaqueRoots):
* bindings/js/WebCoreTypedArrayController.h:
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateHeader):
(GenerateImplementation):
* bindings/scripts/IDLAttributes.json:
* bindings/scripts/test/JS/JSInterfaceName.cpp:
(WebCore::JSInterfaceName::heapSnapshot):
(WebCore::JSInterfaceNameOwner::isReachableFromOpaqueRoots):
* bindings/scripts/test/JS/JSInterfaceName.h:
* bindings/scripts/test/JS/JSMapLike.cpp:
(WebCore::JSMapLike::heapSnapshot):
(WebCore::JSMapLikeOwner::isReachableFromOpaqueRoots):
* bindings/scripts/test/JS/JSMapLike.h:
* bindings/scripts/test/JS/JSReadOnlyMapLike.cpp:
(WebCore::JSReadOnlyMapLike::heapSnapshot):
(WebCore::JSReadOnlyMapLikeOwner::isReachableFromOpaqueRoots):
* bindings/scripts/test/JS/JSReadOnlyMapLike.h:
* bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
(WebCore::JSTestActiveDOMObject::heapSnapshot):
(WebCore::JSTestActiveDOMObjectOwner::isReachableFromOpaqueRoots):
* bindings/scripts/test/JS/JSTestActiveDOMObject.h:
* bindings/scripts/test/JS/JSTestCEReactions.cpp:
(WebCore::JSTestCEReactions::heapSnapshot):
(WebCore::JSTestCEReactionsOwner::isReachableFromOpaqueRoots):
* bindings/scripts/test/JS/JSTestCEReactions.h:
* bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
(WebCore::JSTestCEReactionsStringifier::heapSnapshot):
(WebCore::JSTestCEReactionsStringifierOwner::isReachableFromOpaqueRoots):
* bindings/scripts/test/JS/JSTestCEReactionsStringifier.h:
* bindings/scripts/test/JS/JSTestCallTracer.cpp:
(WebCore::JSTestCallTracer::heapSnapshot):
(WebCore::JSTestCallTracerOwner::isReachableFromOpaqueRoots):
* bindings/scripts/test/JS/JSTestCallTracer.h:
* bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
(WebCore::JSTestClassWithJSBuiltinConstructor::heapSnapshot):
(WebCore::JSTestClassWithJSBuiltinConstructorOwner::isReachableFromOpaqueRoots):
* bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.h:
* bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp:
(WebCore::JSTestCustomConstructorWithNoInterfaceObject::heapSnapshot):
(WebCore::JSTestCustomConstructorWithNoInterfaceObjectOwner::isReachableFromOpaqueRoots):
* bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.h:
* bindings/scripts/test/JS/JSTestDOMJIT.cpp:
(WebCore::JSTestDOMJIT::heapSnapshot):
* bindings/scripts/test/JS/JSTestDOMJIT.h:
* bindings/scripts/test/JS/JSTestEnabledBySetting.cpp:
(WebCore::JSTestEnabledBySetting::heapSnapshot):
(WebCore::JSTestEnabledBySettingOwner::isReachableFromOpaqueRoots):
* bindings/scripts/test/JS/JSTestEnabledBySetting.h:
* bindings/scripts/test/JS/JSTestEventConstructor.cpp:
(WebCore::JSTestEventConstructor::heapSnapshot):
* bindings/scripts/test/JS/JSTestEventConstructor.h:
* bindings/scripts/test/JS/JSTestEventTarget.cpp:
(WebCore::JSTestEventTarget::heapSnapshot):
* bindings/scripts/test/JS/JSTestEventTarget.h:
* bindings/scripts/test/JS/JSTestException.cpp:
(WebCore::JSTestException::heapSnapshot):
(WebCore::JSTestExceptionOwner::isReachableFromOpaqueRoots):
* bindings/scripts/test/JS/JSTestException.h:
* bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
(WebCore::JSTestGenerateIsReachable::heapSnapshot):
(WebCore::JSTestGenerateIsReachableOwner::isReachableFromOpaqueRoots):
* bindings/scripts/test/JS/JSTestGenerateIsReachable.h:
* bindings/scripts/test/JS/JSTestGlobalObject.cpp:
(WebCore::JSTestGlobalObject::heapSnapshot):
(WebCore::JSTestGlobalObjectOwner::isReachableFromOpaqueRoots):
* bindings/scripts/test/JS/JSTestGlobalObject.h:
* bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.cpp:
(WebCore::JSTestIndexedSetterNoIdentifier::heapSnapshot):
(WebCore::JSTestIndexedSetterNoIdentifierOwner::isReachableFromOpaqueRoots):
* bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.h:
* bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.cpp:
(WebCore::JSTestIndexedSetterThrowingException::heapSnapshot):
(WebCore::JSTestIndexedSetterThrowingExceptionOwner::isReachableFromOpaqueRoots):
* bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.h:
* bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp:
(WebCore::JSTestIndexedSetterWithIdentifier::heapSnapshot):
(WebCore::JSTestIndexedSetterWithIdentifierOwner::isReachableFromOpaqueRoots):
* bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.h:
* bindings/scripts/test/JS/JSTestInterface.cpp:
(WebCore::JSTestInterface::heapSnapshot):
(WebCore::JSTestInterfaceOwner::isReachableFromOpaqueRoots):
* bindings/scripts/test/JS/JSTestInterface.h:
* bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp:
(WebCore::JSTestInterfaceLeadingUnderscore::heapSnapshot):
(WebCore::JSTestInterfaceLeadingUnderscoreOwner::isReachableFromOpaqueRoots):
* bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.h:
* bindings/scripts/test/JS/JSTestIterable.cpp:
(WebCore::JSTestIterable::heapSnapshot):
(WebCore::JSTestIterableOwner::isReachableFromOpaqueRoots):
* bindings/scripts/test/JS/JSTestIterable.h:
* bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
(WebCore::JSTestMediaQueryListListener::heapSnapshot):
(WebCore::JSTestMediaQueryListListenerOwner::isReachableFromOpaqueRoots):
* bindings/scripts/test/JS/JSTestMediaQueryListListener.h:
* bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.cpp:
(WebCore::JSTestNamedAndIndexedSetterNoIdentifier::heapSnapshot):
(WebCore::JSTestNamedAndIndexedSetterNoIdentifierOwner::isReachableFromOpaqueRoots):
* bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.h:
* bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.cpp:
(WebCore::JSTestNamedAndIndexedSetterThrowingException::heapSnapshot):
(WebCore::JSTestNamedAndIndexedSetterThrowingExceptionOwner::isReachableFromOpaqueRoots):
* bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.h:
* bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp:
(WebCore::JSTestNamedAndIndexedSetterWithIdentifier::heapSnapshot):
(WebCore::JSTestNamedAndIndexedSetterWithIdentifierOwner::isReachableFromOpaqueRoots):
* bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.h:
* bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
(WebCore::JSTestNamedConstructor::heapSnapshot):
(WebCore::JSTestNamedConstructorOwner::isReachableFromOpaqueRoots):
* bindings/scripts/test/JS/JSTestNamedConstructor.h:
* bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.cpp:
(WebCore::JSTestNamedDeleterNoIdentifier::heapSnapshot):
(WebCore::JSTestNamedDeleterNoIdentifierOwner::isReachableFromOpaqueRoots):
* bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.h:
* bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.cpp:
(WebCore::JSTestNamedDeleterThrowingException::heapSnapshot):
(WebCore::JSTestNamedDeleterThrowingExceptionOwner::isReachableFromOpaqueRoots):
* bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.h:
* bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp:
(WebCore::JSTestNamedDeleterWithIdentifier::heapSnapshot):
(WebCore::JSTestNamedDeleterWithIdentifierOwner::isReachableFromOpaqueRoots):
* bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.h:
* bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.cpp:
(WebCore::JSTestNamedDeleterWithIndexedGetter::heapSnapshot):
(WebCore::JSTestNamedDeleterWithIndexedGetterOwner::isReachableFromOpaqueRoots):
* bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.h:
* bindings/scripts/test/JS/JSTestNamedGetterCallWith.cpp:
(WebCore::JSTestNamedGetterCallWith::heapSnapshot):
(WebCore::JSTestNamedGetterCallWithOwner::isReachableFromOpaqueRoots):
* bindings/scripts/test/JS/JSTestNamedGetterCallWith.h:
* bindings/scripts/test/JS/JSTestNamedGetterNoIdentifier.cpp:
(WebCore::JSTestNamedGetterNoIdentifier::heapSnapshot):
(WebCore::JSTestNamedGetterNoIdentifierOwner::isReachableFromOpaqueRoots):
* bindings/scripts/test/JS/JSTestNamedGetterNoIdentifier.h:
* bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.cpp:
(WebCore::JSTestNamedGetterWithIdentifier::heapSnapshot):
(WebCore::JSTestNamedGetterWithIdentifierOwner::isReachableFromOpaqueRoots):
* bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.h:
* bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.cpp:
(WebCore::JSTestNamedSetterNoIdentifier::heapSnapshot):
(WebCore::JSTestNamedSetterNoIdentifierOwner::isReachableFromOpaqueRoots):
* bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.h:
* bindings/scripts/test/JS/JSTestNamedSetterThrowingException.cpp:
(WebCore::JSTestNamedSetterThrowingException::heapSnapshot):
(WebCore::JSTestNamedSetterThrowingExceptionOwner::isReachableFromOpaqueRoots):
* bindings/scripts/test/JS/JSTestNamedSetterThrowingException.h:
* bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp:
(WebCore::JSTestNamedSetterWithIdentifier::heapSnapshot):
(WebCore::JSTestNamedSetterWithIdentifierOwner::isReachableFromOpaqueRoots):
* bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.h:
* bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp:
(WebCore::JSTestNamedSetterWithIndexedGetter::heapSnapshot):
(WebCore::JSTestNamedSetterWithIndexedGetterOwner::isReachableFromOpaqueRoots):
* bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.h:
* bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp:
(WebCore::JSTestNamedSetterWithIndexedGetterAndSetter::heapSnapshot):
(WebCore::JSTestNamedSetterWithIndexedGetterAndSetterOwner::isReachableFromOpaqueRoots):
* bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.h:
* bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.cpp:
(WebCore::JSTestNamedSetterWithOverrideBuiltins::heapSnapshot):
(WebCore::JSTestNamedSetterWithOverrideBuiltinsOwner::isReachableFromOpaqueRoots):
* bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.h:
* bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp:
(WebCore::JSTestNamedSetterWithUnforgableProperties::heapSnapshot):
(WebCore::JSTestNamedSetterWithUnforgablePropertiesOwner::isReachableFromOpaqueRoots):
* bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.h:
* bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.cpp:
(WebCore::JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins::heapSnapshot):
(WebCore::JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsOwner::isReachableFromOpaqueRoots):
* bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.h:
* bindings/scripts/test/JS/JSTestNode.cpp:
(WebCore::JSTestNode::heapSnapshot):
* bindings/scripts/test/JS/JSTestNode.h:
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::JSTestObj::heapSnapshot):
(WebCore::JSTestObjOwner::isReachableFromOpaqueRoots):
* bindings/scripts/test/JS/JSTestObj.h:
* bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
(WebCore::JSTestOverloadedConstructors::heapSnapshot):
(WebCore::JSTestOverloadedConstructorsOwner::isReachableFromOpaqueRoots):
* bindings/scripts/test/JS/JSTestOverloadedConstructors.h:
* bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
(WebCore::JSTestOverloadedConstructorsWithSequence::heapSnapshot):
(WebCore::JSTestOverloadedConstructorsWithSequenceOwner::isReachableFromOpaqueRoots):
* bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.h:
* bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
(WebCore::JSTestOverrideBuiltins::heapSnapshot):
(WebCore::JSTestOverrideBuiltinsOwner::isReachableFromOpaqueRoots):
* bindings/scripts/test/JS/JSTestOverrideBuiltins.h:
* bindings/scripts/test/JS/JSTestPluginInterface.cpp:
(WebCore::JSTestPluginInterface::heapSnapshot):
(WebCore::JSTestPluginInterfaceOwner::isReachableFromOpaqueRoots):
* bindings/scripts/test/JS/JSTestPluginInterface.h:
* bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp:
(WebCore::JSTestPromiseRejectionEvent::heapSnapshot):
* bindings/scripts/test/JS/JSTestPromiseRejectionEvent.h:
* bindings/scripts/test/JS/JSTestSerialization.cpp:
(WebCore::JSTestSerialization::heapSnapshot):
(WebCore::JSTestSerializationOwner::isReachableFromOpaqueRoots):
* bindings/scripts/test/JS/JSTestSerialization.h:
* bindings/scripts/test/JS/JSTestSerializationIndirectInheritance.cpp:
(WebCore::JSTestSerializationIndirectInheritance::heapSnapshot):
* bindings/scripts/test/JS/JSTestSerializationIndirectInheritance.h:
* bindings/scripts/test/JS/JSTestSerializationInherit.cpp:
(WebCore::JSTestSerializationInherit::heapSnapshot):
* bindings/scripts/test/JS/JSTestSerializationInherit.h:
* bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp:
(WebCore::JSTestSerializationInheritFinal::heapSnapshot):
* bindings/scripts/test/JS/JSTestSerializationInheritFinal.h:
* bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
(WebCore::JSTestSerializedScriptValueInterface::heapSnapshot):
(WebCore::JSTestSerializedScriptValueInterfaceOwner::isReachableFromOpaqueRoots):
* bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.h:
* bindings/scripts/test/JS/JSTestStringifier.cpp:
(WebCore::JSTestStringifier::heapSnapshot):
(WebCore::JSTestStringifierOwner::isReachableFromOpaqueRoots):
* bindings/scripts/test/JS/JSTestStringifier.h:
* bindings/scripts/test/JS/JSTestStringifierAnonymousOperation.cpp:
(WebCore::JSTestStringifierAnonymousOperation::heapSnapshot):
(WebCore::JSTestStringifierAnonymousOperationOwner::isReachableFromOpaqueRoots):
* bindings/scripts/test/JS/JSTestStringifierAnonymousOperation.h:
* bindings/scripts/test/JS/JSTestStringifierNamedOperation.cpp:
(WebCore::JSTestStringifierNamedOperation::heapSnapshot):
(WebCore::JSTestStringifierNamedOperationOwner::isReachableFromOpaqueRoots):
* bindings/scripts/test/JS/JSTestStringifierNamedOperation.h:
* bindings/scripts/test/JS/JSTestStringifierOperationImplementedAs.cpp:
(WebCore::JSTestStringifierOperationImplementedAs::heapSnapshot):
(WebCore::JSTestStringifierOperationImplementedAsOwner::isReachableFromOpaqueRoots):
* bindings/scripts/test/JS/JSTestStringifierOperationImplementedAs.h:
* bindings/scripts/test/JS/JSTestStringifierOperationNamedToString.cpp:
(WebCore::JSTestStringifierOperationNamedToString::heapSnapshot):
(WebCore::JSTestStringifierOperationNamedToStringOwner::isReachableFromOpaqueRoots):
* bindings/scripts/test/JS/JSTestStringifierOperationNamedToString.h:
* bindings/scripts/test/JS/JSTestStringifierReadOnlyAttribute.cpp:
(WebCore::JSTestStringifierReadOnlyAttribute::heapSnapshot):
(WebCore::JSTestStringifierReadOnlyAttributeOwner::isReachableFromOpaqueRoots):
* bindings/scripts/test/JS/JSTestStringifierReadOnlyAttribute.h:
* bindings/scripts/test/JS/JSTestStringifierReadWriteAttribute.cpp:
(WebCore::JSTestStringifierReadWriteAttribute::heapSnapshot):
(WebCore::JSTestStringifierReadWriteAttributeOwner::isReachableFromOpaqueRoots):
* bindings/scripts/test/JS/JSTestStringifierReadWriteAttribute.h:
* bindings/scripts/test/JS/JSTestTypedefs.cpp:
(WebCore::JSTestTypedefs::heapSnapshot):
(WebCore::JSTestTypedefsOwner::isReachableFromOpaqueRoots):
* bindings/scripts/test/JS/JSTestTypedefs.h:
* dom/Document.idl:
* page/DOMWindow.idl:

Source/WebInspectorUI:

Make a way to dump information about the GC heap that is useful for looking for leaked
or abandoned objects. This dump is obtained (on Apple platforms) via:
    notifyutil -p com.apple.WebKit.dumpGCHeap
which writes a JSON file to /tmp which can then be loaded into the viewer in Tools/GCHeapInspector.

This leverages the heap snapshot used by Web Inspector, adding an alternate format for
the snapshot JSON that adds additional data about objects and why they are GC roots.

The generated bindings code is changed to include the output root reason from isReachableFromOpaqueRoots(),
and to implement heapSnapshot() which provides the address of the wrapped object. A new IDL attribute,
CustomHeapSnapshot, is used to allow custom heapSnapshot() implementations for classes like JSDocument
that need to decorate the heap snapshot cell data with things like the document URL.

GCController registers a notifyutil callback which gathers the debug heap snapshot, and dumps it
to a file in /tmp. The file path is printed out to the system log.

* UserInterface/Workers/HeapSnapshot/HeapSnapshot.js:
(HeapSnapshot):

Tools:

Add a viewer for GC heap snapshots. A snapshot JSON file can be dragged into this
page for inspection (or set via the 'filename' URL parameter).

For now, this page shows all objects, all roots, and the shortest path from a root
to all HTMLDocuments and Windows.

* GCHeapInspector/gc-heap-inspector.html: Added.
* GCHeapInspector/heap-analysis/HeapSnapshot.js: Copied from Source/WebInspectorUI/UserInterface/Workers/HeapSnapshot/HeapSnapshot.js.
* GCHeapInspector/script/interface.js: Added.

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

16 months agoAdd a flaky failing test expectation to fast/files/blob-network-process-crash.html
rniwa@webkit.org [Fri, 24 Aug 2018 03:41:48 +0000 (03:41 +0000)]
Add a flaky failing test expectation to fast/files/blob-network-process-crash.html
while we investigate the root cause in webkit.org/b/188911.

* platform/wk2/TestExpectations:

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

16 months agoinitKeyboardEvent doesn't clear CapsLock state
rniwa@webkit.org [Fri, 24 Aug 2018 02:01:29 +0000 (02:01 +0000)]
initKeyboardEvent doesn't clear CapsLock state
https://bugs.webkit.org/show_bug.cgi?id=188909

Reviewed by Wenson Hsieh.

Source/WebCore:

Fixed the bug by not preserving CapsLock state in setModifierKeys variant which takes boolean
for altGraphKey, which is only called by KeyboardEvent::initKeyboardEvent.

Test: fast/events/init-event-clears-capslock.html

* dom/UIEventWithKeyState.h:
(WebCore::UIEventWithKeyState::setModifierKeys):

LayoutTests:

Added a regression test. Note that altGraph is only supported in WebKit
so Chrome and Firefox would fail to reset it via initKeyboardEvent.

* fast/events/init-event-clears-capslock-expected.txt: Added.
* fast/events/init-event-clears-capslock.html: Added.

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

16 months agoUse unified build for UIProcess
timothy_horton@apple.com [Fri, 24 Aug 2018 00:59:11 +0000 (00:59 +0000)]
Use unified build for UIProcess
https://bugs.webkit.org/show_bug.cgi?id=185014

Reviewed by Alex Christensen.

* Sources.txt:
* SourcesCocoa.txt:
* UIProcess/API/APIWebsiteDataStore.h:
* UIProcess/API/Cocoa/WKWebView.mm:
* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration urlSchemeHandlerForURLScheme:]):
* UIProcess/API/glib/IconDatabase.cpp:
* UIProcess/API/gtk/PageClientImpl.cpp:
* UIProcess/API/gtk/WebKitColorChooser.cpp:
* UIProcess/API/gtk/WebKitPopupMenu.cpp:
* UIProcess/API/gtk/WebKitRemoteInspectorProtocolHandler.cpp:
* UIProcess/ApplicationStateTracker.mm:
* UIProcess/Authentication/mac/WebCredentialMac.mm:
* UIProcess/Automation/cocoa/WebAutomationSessionCocoa.mm:
* UIProcess/Automation/ios/WebAutomationSessionIOS.mm:
* UIProcess/Automation/mac/WebAutomationSessionMac.mm:
* UIProcess/Cocoa/NavigationState.mm:
* UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
* UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
* UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
* UIProcess/Cocoa/ViewGestureController.cpp:
* UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm:
(-[WKWebViewContentProviderRegistry initWithConfiguration:]):
(-[WKWebViewContentProviderRegistry addPage:]):
(-[WKWebViewContentProviderRegistry removePage:]):
* UIProcess/Cocoa/WebPageProxyCocoa.mm:
* UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
* UIProcess/Cocoa/WebURLSchemeHandlerCocoa.mm:
* UIProcess/Cocoa/WebViewImpl.mm:
(-[WKTextTouchBarItemController itemForIdentifier:]):
(WebKit::WebViewImpl::performDragOperation):
* UIProcess/Downloads/DownloadProxy.cpp:
* UIProcess/DrawingAreaProxy.cpp:
* UIProcess/Gamepad/UIGamepad.cpp:
* UIProcess/Gamepad/UIGamepadProvider.cpp:
* UIProcess/Gamepad/cocoa/UIGamepadProviderCocoa.mm:
* UIProcess/HighPerformanceGraphicsUsageSampler.cpp:
* UIProcess/Network/NetworkProcessProxy.cpp:
* UIProcess/Notifications/WebNotificationManagerProxy.cpp:
* UIProcess/PerActivityStateCPUUsageSampler.cpp:
* UIProcess/Plugins/PluginInfoStore.cpp:
* UIProcess/Plugins/PluginProcessProxy.cpp:
* UIProcess/Plugins/mac/PluginInfoStoreMac.mm:
* UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
* UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
* UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
* UIProcess/RemoteLayerTree/RemoteLayerTreeScrollingPerformanceData.mm:
* UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
* UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
* UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
* UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
* UIProcess/RemoteWebInspectorProxy.cpp:
* UIProcess/ResourceLoadStatisticsMemoryStore.cpp:
* UIProcess/ServiceWorkerProcessProxy.cpp:
* UIProcess/Storage/StorageProcessProxy.cpp:
* UIProcess/SuspendedPageProxy.cpp:
* UIProcess/TextCheckerCompletion.cpp:
* UIProcess/UIMessagePortChannelProvider.cpp:
* UIProcess/UserMediaPermissionCheckProxy.cpp:
* UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
* UIProcess/UserMediaPermissionRequestProxy.cpp:
* UIProcess/VisitedLinkStore.cpp:
* UIProcess/WKInspectorHighlightView.mm:
(findIntersectionOnLineBetweenPoints):
(quadIntersection):
(layerPathWithHole):
(layerPath):
(-[WKInspectorHighlightView _layoutForNodeHighlight:offset:]):
(-[WKInspectorHighlightView _layoutForNodeListHighlight:]):
(-[WKInspectorHighlightView _layoutForRectsHighlight:]):
(-[WKInspectorHighlightView update:]):
* UIProcess/WebBackForwardList.cpp:
* UIProcess/WebContextMenuListenerProxy.cpp:
* UIProcess/WebCookieManagerProxy.cpp:
* UIProcess/WebEditCommandProxy.cpp:
* UIProcess/WebFrameProxy.cpp:
* UIProcess/WebFullScreenManagerProxy.cpp:
* UIProcess/WebInspectorProxy.cpp:
* UIProcess/WebNavigationState.cpp:
* UIProcess/WebOpenPanelResultListenerProxy.cpp:
* UIProcess/WebPageInjectedBundleClient.cpp:
* UIProcess/WebPageProxy.cpp:
* UIProcess/WebProcessPool.cpp:
* UIProcess/WebProcessProxy.cpp:
* UIProcess/WebStorage/LocalStorageDatabaseTracker.cpp:
* UIProcess/WebURLSchemeHandler.cpp:
* UIProcess/WebURLSchemeTask.cpp:
* UIProcess/gtk/AcceleratedBackingStoreWayland.cpp:
* UIProcess/gtk/AcceleratedBackingStoreX11.cpp:
* UIProcess/ios/DragDropInteractionState.mm:
* UIProcess/ios/InputViewUpdateDeferrer.mm:
* UIProcess/ios/PageClientImplIOS.mm:
(-[WKEditCommandObjC initWithWebEditCommandProxy:]):
(-[WKEditCommandObjC command]):
* UIProcess/ios/SmartMagnificationController.mm:
* UIProcess/ios/TextCheckerIOS.mm:
* UIProcess/ios/ViewGestureControllerIOS.mm:
(WebKit::ViewGestureController::beginSwipeGesture):
(WebKit::ViewGestureController::removeSwipeSnapshot):
* UIProcess/ios/WKActionSheetAssistant.mm:
(presentationStyleForView):
* UIProcess/ios/WKApplicationStateTrackingView.mm:
(-[WKApplicationStateTrackingView initWithFrame:webView:]):
(-[WKApplicationStateTrackingView _applicationDidEnterBackground]):
(-[WKApplicationStateTrackingView _applicationDidFinishSnapshottingAfterEnteringBackground]):
(-[WKApplicationStateTrackingView _applicationWillEnterForeground]):
* UIProcess/ios/WKGeolocationProviderIOS.mm:
(-[WKGeolocationProviderIOS _startUpdating]):
(-[WKGeolocationProviderIOS _stopUpdating]):
(-[WKGeolocationProviderIOS _setEnableHighAccuracy:]):
(-[WKGeolocationProviderIOS init]):
(-[WKGeolocationProviderIOS initWithProcessPool:]):
(-[WKGeolocationProviderIOS decidePolicyForGeolocationRequestFromOrigin:frame:completionHandler:view:]):
(-[WKGeolocationProviderIOS geolocationAuthorizationGranted]):
(-[WKLegacyCoreLocationProvider positionChanged:]):
* UIProcess/ios/WKKeyboardScrollingAnimator.mm:
(-[WKKeyboardScrollingAnimator _scrollOffsetForEvent:]):
(-[WKKeyboardScrollingAnimator beginWithEvent:]):
(-[WKKeyboardScrollingAnimator handleKeyEvent:]):
(-[WKKeyboardScrollingAnimator startAnimatedScroll]):
(-[WKKeyboardScrollingAnimator stopAnimatedScroll]):
* UIProcess/ios/WKLegacyPDFView.mm:
* UIProcess/ios/WKPDFView.mm:
(-[WKPDFView web_setContentProviderData:suggestedFilename:]):
* UIProcess/ios/WKScrollView.mm:
(-[WKScrollView _systemContentInset]):
* UIProcess/ios/WKSystemPreviewView.mm:
* UIProcess/ios/WebPageProxyIOS.mm:
* UIProcess/mac/CorrectionPanel.mm:
(correctionIndicatorType):
* UIProcess/mac/PageClientImplMac.mm:
* UIProcess/mac/RemoteWebInspectorProxyMac.mm:
(-[WKRemoteWebInspectorProxyObjCAdapter initWithRemoteWebInspectorProxy:]):
* UIProcess/mac/TextCheckerMac.mm:
* UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
* UIProcess/mac/ViewGestureControllerMac.mm:
* UIProcess/mac/ViewSnapshotStore.mm:
* UIProcess/mac/WKFullKeyboardAccessWatcher.mm:
(-[WKFullKeyboardAccessWatcher notifyAllProcessPools]):
* UIProcess/mac/WKFullScreenWindowController.mm:
(WebKit::WKFullScreenWindowControllerVideoFullscreenModelClient::setInterface):
(WebKit::WKFullScreenWindowControllerVideoFullscreenModelClient::interface const):
(-[WKFullScreenWindowController initWithWindow:webView:page:]):
(-[WKFullScreenWindowController enterFullScreen:]):
(-[WKFullScreenWindowController finishedEnterFullScreenAnimation:]):
(-[WKFullScreenWindowController finishedExitFullScreenAnimation:]):
(-[WKFullScreenWindowController windowDidEnterFullScreen:]):
(-[WKFullScreenWindowController windowDidExitFullScreen:]):
(-[WKFullScreenWindowController _manager]):
(-[WKFullScreenWindowController _replaceView:with:]):
(zoomAnimation):
(createMask):
(maskAnimation):
* UIProcess/mac/WKImmediateActionController.mm:
(-[WKImmediateActionController initWithPage:view:viewImpl:recognizer:]):
(-[WKImmediateActionController willDestroyView:]):
(-[WKImmediateActionController _clearImmediateActionState]):
(-[WKImmediateActionController didPerformImmediateActionHitTest:contentPreventsDefault:userData:]):
(-[WKImmediateActionController immediateActionRecognizerWillPrepare:]):
(-[WKImmediateActionController immediateActionRecognizerWillBeginAnimation:]):
(-[WKImmediateActionController _webHitTestResult]):
(-[WKImmediateActionController _defaultAnimationController]):
(-[WKImmediateActionController menuItem:maxSizeForPoint:]):
(-[WKImmediateActionController _animationControllerForDataDetectedText]):
(-[WKImmediateActionController _animationControllerForDataDetectedLink]):
(-[WKImmediateActionController _animationControllerForText]):
* UIProcess/mac/WKInspectorViewController.mm:
(-[WKInspectorViewController initWithInspectedPage:]):
(-[WKInspectorViewController webView]):
(-[WKInspectorViewController configuration]):
(-[WKInspectorViewController webView:runOpenPanelWithParameters:initiatedByFrame:completionHandler:]):
(-[WKInspectorViewController webView:decidePolicyForNavigationAction:decisionHandler:]):
(-[WKInspectorViewController inspectorWKWebViewReload:]):
* UIProcess/mac/WKPrintingView.mm:
(-[WKPrintingView _expectedPreviewCallbackForRect:]):
(pageDidDrawToImage):
(-[WKPrintingView _preparePDFDataForPrintingOnSecondaryThread]):
(pageDidComputePageRects):
(-[WKPrintingView _askPageToComputePageRects]):
(-[WKPrintingView _pageForRect:]):
(-[WKPrintingView _drawPDFDocument:page:atPoint:]):
(-[WKPrintingView _drawPreview:]):
(-[WKPrintingView drawRect:]):
(-[WKPrintingView rectForPage:]):
* UIProcess/mac/WKTextFinderClient.mm:
(-[WKTextFinderClient initWithPage:view:]):
(-[WKTextFinderClient findMatchesForString:relativeToMatch:findOptions:maxResults:resultCollector:]):
(-[WKTextFinderClient getSelectedText:]):
(arrayFromRects):
(-[WKTextFinderClient didFindStringMatchesWithRects:didWrapAround:]):
(-[WKTextFinderClient didGetImageForMatchResult:]):
* UIProcess/mac/WKTextInputWindowController.mm:
* UIProcess/mac/WKViewLayoutStrategy.mm:
(+[WKViewLayoutStrategy layoutStrategyWithPage:view:viewImpl:mode:]):
(-[WKViewLayoutStrategy initWithPage:view:viewImpl:mode:]):
(-[WKViewViewSizeLayoutStrategy initWithPage:view:viewImpl:mode:]):
(-[WKViewFixedSizeLayoutStrategy initWithPage:view:viewImpl:mode:]):
(-[WKViewDynamicSizeComputedFromViewScaleLayoutStrategy initWithPage:view:viewImpl:mode:]):
(-[WKViewDynamicSizeComputedFromMinimumDocumentSizeLayoutStrategy initWithPage:view:viewImpl:mode:]):
* UIProcess/mac/WebColorPickerMac.mm:
* UIProcess/mac/WebContextMenuProxyMac.mm:
(-[WKMenuTarget forwardContextMenuAction:]):
(WebKit::menuItemIdentifier):
(WebKit::WebContextMenuProxyMac::createContextMenuItem):
* UIProcess/mac/WebInspectorProxyMac.mm:
(-[WKWebInspectorProxyObjCAdapter initWithWebInspectorProxy:]):
* UIProcess/mac/WebPageProxyMac.mm:
* UIProcess/mac/WebPopupMenuProxyMac.mm:
* UIProcess/win/PageClientImpl.cpp:
* UIProcess/win/TextCheckerWin.cpp:
* UIProcess/win/WebContextMenuProxyWin.cpp:
* UIProcess/win/WebPopupMenuProxyWin.cpp:
* UIProcess/win/WebView.cpp:
* UIProcess/wpe/TextCheckerWPE.cpp:
* UIProcess/wpe/WebPasteboardProxyWPE.cpp:
* WebKit.xcodeproj/project.pbxproj:

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

16 months agoStore the timer we scheduled in the global object.
rniwa@webkit.org [Fri, 24 Aug 2018 00:43:31 +0000 (00:43 +0000)]
Store the timer we scheduled in the global object.
The underlying bug is tracked by https://webkit.org/b/188911.

* fast/files/blob-network-process-crash.html:

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

16 months agoUnreviewed, fix the Windows build after r235245.
akeerthi@apple.com [Fri, 24 Aug 2018 00:16:44 +0000 (00:16 +0000)]
Unreviewed, fix the Windows build after r235245.

* html/InputMode.cpp:
(WebCore::stringForInputMode):

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

16 months agoEWS bubbles are being hidden due to lack of space.
ross.kirsling@sony.com [Thu, 23 Aug 2018 23:57:56 +0000 (23:57 +0000)]
EWS bubbles are being hidden due to lack of space.
https://bugs.webkit.org/show_bug.cgi?id=188607

Reviewed by Daniel Bates.

* PrettyPatch/PrettyPatch.rb:
* code-review.js:
* js/status-bubble.js: Added.
Refactor Review Patch page so that the postMessage to resize EWS iframes may be used on other pages too.

* template/en/default/attachment/edit.html.tmpl:
* template/en/default/attachment/list.html.tmpl:
Resize EWS iframes via postMessage on bug page and attachment details page.

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

16 months agoJSRunLoopTimer may run part of a member function after it's destroyed
sbarati@apple.com [Thu, 23 Aug 2018 23:57:03 +0000 (23:57 +0000)]
JSRunLoopTimer may run part of a member function after it's destroyed
https://bugs.webkit.org/show_bug.cgi?id=188426

Reviewed by Mark Lam.

Source/JavaScriptCore:

When I was reading the JSRunLoopTimer code, I noticed that it is possible
to end up running timer code after the class had been destroyed.

The issue I spotted was in this function:
```
void JSRunLoopTimer::timerDidFire()
{
    JSLock* apiLock = m_apiLock.get();
    if (!apiLock) {
        // Likely a buggy usage: the timer fired while JSRunLoopTimer was being destroyed.
        return;
    }
    // HERE
    std::lock_guard<JSLock> lock(*apiLock);
    RefPtr<VM> vm = apiLock->vm();
    if (!vm) {
        // The VM has been destroyed, so we should just give up.
        return;
    }

    doWork();
}
```

Look at the comment 'HERE'. Let's say that the timer callback thread gets context
switched before grabbing the API lock. Then, some other thread destroys the VM.
And let's say that the VM owns (perhaps transitively) this timer. Then, the
timer would run code and access member variables after it was destroyed.

This patch fixes this issue by introducing a new timer manager class.
This class manages timers on a per VM basis. When a timer is scheduled,
this class refs the timer. It also calls the timer callback while actively
maintaining a +1 ref to it. So, it's no longer possible to call the timer
callback after the timer has been destroyed. However, calling a timer callback
can still race with the VM being destroyed. We continue to detect this case and
bail out of the callback early.

This patch also removes a lot of duplicate code between GCActivityCallback
and JSRunLoopTimer.

* heap/EdenGCActivityCallback.cpp:
(JSC::EdenGCActivityCallback::doCollection):
(JSC::EdenGCActivityCallback::lastGCLength):
(JSC::EdenGCActivityCallback::deathRate):
* heap/EdenGCActivityCallback.h:
* heap/FullGCActivityCallback.cpp:
(JSC::FullGCActivityCallback::doCollection):
(JSC::FullGCActivityCallback::lastGCLength):
(JSC::FullGCActivityCallback::deathRate):
* heap/FullGCActivityCallback.h:
* heap/GCActivityCallback.cpp:
(JSC::GCActivityCallback::doWork):
(JSC::GCActivityCallback::scheduleTimer):
(JSC::GCActivityCallback::didAllocate):
(JSC::GCActivityCallback::willCollect):
(JSC::GCActivityCallback::cancel):
(JSC::GCActivityCallback::cancelTimer): Deleted.
(JSC::GCActivityCallback::nextFireTime): Deleted.
* heap/GCActivityCallback.h:
* heap/Heap.cpp:
(JSC::Heap::reportAbandonedObjectGraph):
(JSC::Heap::notifyIncrementalSweeper):
(JSC::Heap::updateAllocationLimits):
(JSC::Heap::didAllocate):
* heap/IncrementalSweeper.cpp:
(JSC::IncrementalSweeper::scheduleTimer):
(JSC::IncrementalSweeper::doWork):
(JSC::IncrementalSweeper::doSweep):
(JSC::IncrementalSweeper::sweepNextBlock):
(JSC::IncrementalSweeper::startSweeping):
(JSC::IncrementalSweeper::stopSweeping):
* heap/IncrementalSweeper.h:
* heap/StopIfNecessaryTimer.cpp:
(JSC::StopIfNecessaryTimer::doWork):
(JSC::StopIfNecessaryTimer::scheduleSoon):
* heap/StopIfNecessaryTimer.h:
* runtime/JSRunLoopTimer.cpp:
(JSC::epochTime):
(JSC::JSRunLoopTimer::Manager::timerDidFireCallback):
(JSC::JSRunLoopTimer::Manager::PerVMData::setRunLoop):
(JSC::JSRunLoopTimer::Manager::PerVMData::PerVMData):
(JSC::JSRunLoopTimer::Manager::PerVMData::~PerVMData):
(JSC::JSRunLoopTimer::Manager::timerDidFire):
(JSC::JSRunLoopTimer::Manager::shared):
(JSC::JSRunLoopTimer::Manager::registerVM):
(JSC::JSRunLoopTimer::Manager::unregisterVM):
(JSC::JSRunLoopTimer::Manager::scheduleTimer):
(JSC::JSRunLoopTimer::Manager::cancelTimer):
(JSC::JSRunLoopTimer::Manager::timeUntilFire):
(JSC::JSRunLoopTimer::Manager::didChangeRunLoop):
(JSC::JSRunLoopTimer::timerDidFire):
(JSC::JSRunLoopTimer::JSRunLoopTimer):
(JSC::JSRunLoopTimer::timeUntilFire):
(JSC::JSRunLoopTimer::setTimeUntilFire):
(JSC::JSRunLoopTimer::cancelTimer):
(JSC::JSRunLoopTimer::setRunLoop): Deleted.
(JSC::JSRunLoopTimer::timerDidFireCallback): Deleted.
(JSC::JSRunLoopTimer::scheduleTimer): Deleted.
* runtime/JSRunLoopTimer.h:
(JSC::JSRunLoopTimer::Manager::PerVMData::PerVMData):
* runtime/PromiseDeferredTimer.cpp:
(JSC::PromiseDeferredTimer::doWork):
(JSC::PromiseDeferredTimer::runRunLoop):
(JSC::PromiseDeferredTimer::addPendingPromise):
(JSC::PromiseDeferredTimer::hasPendingPromise):
(JSC::PromiseDeferredTimer::hasDependancyInPendingPromise):
(JSC::PromiseDeferredTimer::cancelPendingPromise):
(JSC::PromiseDeferredTimer::scheduleWorkSoon):
* runtime/PromiseDeferredTimer.h:
* runtime/VM.cpp:
(JSC::VM::VM):
(JSC::VM::~VM):
(JSC::VM::setRunLoop):
(JSC::VM::registerRunLoopTimer): Deleted.
(JSC::VM::unregisterRunLoopTimer): Deleted.
* runtime/VM.h:
(JSC::VM::runLoop const):
* wasm/js/WebAssemblyPrototype.cpp:
(JSC::webAssemblyModuleValidateAsyncInternal):
(JSC::instantiate):
(JSC::compileAndInstantiate):
(JSC::webAssemblyModuleInstantinateAsyncInternal):
(JSC::webAssemblyCompileStreamingInternal):
(JSC::webAssemblyInstantiateStreamingInternal):

Source/WebCore:

* page/cocoa/ResourceUsageThreadCocoa.mm:
(WebCore::ResourceUsageThread::platformThreadBody):
* page/linux/ResourceUsageThreadLinux.cpp:
(WebCore::ResourceUsageThread::platformThreadBody):

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

16 months agoMove legacy directory configuration from WebProcessPool to API::WebsiteDataStore
sihui_liu@apple.com [Thu, 23 Aug 2018 23:37:45 +0000 (23:37 +0000)]
Move legacy directory configuration from WebProcessPool to API::WebsiteDataStore
https://bugs.webkit.org/show_bug.cgi?id=188765
<rdar://problem/43633183>

Reviewed by Geoffrey Garen.

Diretories are parameters of websiteDataStore instead of webProcessPool, so we should move
legacy default paths to API::WebsiteDataStore, which already stores default paths for
non-legacy cases.

* UIProcess/API/APIProcessPoolConfiguration.cpp:
(API::ProcessPoolConfiguration::createWithLegacyOptions):
(API::ProcessPoolConfiguration::createWithWebsiteDataStoreConfiguration):
* UIProcess/API/APIWebsiteDataStore.cpp:
(API::WebsiteDataStore::legacyDefaultDataStoreConfiguration):
* UIProcess/API/APIWebsiteDataStore.h:
* UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm:
(API::WebsiteDataStore::legacyDefaultApplicationCacheDirectory):
(API::WebsiteDataStore::legacyDefaultNetworkCacheDirectory):
(API::WebsiteDataStore::legacyDefaultWebSQLDatabaseDirectory):
(API::WebsiteDataStore::legacyDefaultIndexedDBDatabaseDirectory):
(API::WebsiteDataStore::legacyDefaultLocalStorageDirectory):
(API::WebsiteDataStore::legacyDefaultMediaCacheDirectory):
(API::WebsiteDataStore::legacyDefaultMediaKeysStorageDirectory):
(API::WebsiteDataStore::legacyDefaultJavaScriptConfigurationDirectory):
* UIProcess/API/glib/APIWebsiteDataStoreGLib.cpp:
(API::WebsiteDataStore::legacyDefaultApplicationCacheDirectory):
(API::WebsiteDataStore::legacyDefaultNetworkCacheDirectory):
(API::WebsiteDataStore::legacyDefaultWebSQLDatabaseDirectory):
(API::WebsiteDataStore::legacyDefaultIndexedDBDatabaseDirectory):
(API::WebsiteDataStore::legacyDefaultLocalStorageDirectory):
(API::WebsiteDataStore::legacyDefaultMediaCacheDirectory):
(API::WebsiteDataStore::legacyDefaultMediaKeysStorageDirectory):
(API::WebsiteDataStore::legacyDefaultJavaScriptConfigurationDirectory):
* UIProcess/API/win/APIWebsiteDataStoreWin.cpp:
(API::WebsiteDataStore::legacyDefaultApplicationCacheDirectory):
(API::WebsiteDataStore::legacyDefaultNetworkCacheDirectory):
(API::WebsiteDataStore::legacyDefaultWebSQLDatabaseDirectory):
(API::WebsiteDataStore::legacyDefaultIndexedDBDatabaseDirectory):
(API::WebsiteDataStore::legacyDefaultLocalStorageDirectory):
(API::WebsiteDataStore::legacyDefaultMediaCacheDirectory):
(API::WebsiteDataStore::legacyDefaultMediaKeysStorageDirectory):
(API::WebsiteDataStore::legacyDefaultJavaScriptConfigurationDirectory):
* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::WebProcessPool::legacyPlatformDefaultWebSQLDatabaseDirectory): Deleted.
(WebKit::WebProcessPool::legacyPlatformDefaultIndexedDBDatabaseDirectory): Deleted.
(WebKit::WebProcessPool::legacyPlatformDefaultLocalStorageDirectory): Deleted.
(WebKit::WebProcessPool::legacyPlatformDefaultMediaCacheDirectory): Deleted.
(WebKit::WebProcessPool::legacyPlatformDefaultMediaKeysStorageDirectory): Deleted.
(WebKit::WebProcessPool::legacyPlatformDefaultApplicationCacheDirectory): Deleted.
(WebKit::WebProcessPool::legacyPlatformDefaultNetworkCacheDirectory): Deleted.
(WebKit::WebProcessPool::legacyPlatformDefaultJavaScriptConfigurationDirectory): Deleted.
* UIProcess/WebProcessPool.h:
* UIProcess/gtk/WebProcessPoolGtk.cpp:
(WebKit::WebProcessPool::legacyPlatformDefaultApplicationCacheDirectory): Deleted.
(WebKit::WebProcessPool::legacyPlatformDefaultMediaCacheDirectory): Deleted.
(WebKit::WebProcessPool::legacyPlatformDefaultWebSQLDatabaseDirectory): Deleted.
(WebKit::WebProcessPool::legacyPlatformDefaultIndexedDBDatabaseDirectory): Deleted.
(WebKit::WebProcessPool::legacyPlatformDefaultLocalStorageDirectory): Deleted.
(WebKit::WebProcessPool::legacyPlatformDefaultMediaKeysStorageDirectory): Deleted.
(WebKit::WebProcessPool::legacyPlatformDefaultNetworkCacheDirectory): Deleted.
(WebKit::WebProcessPool::legacyPlatformDefaultJavaScriptConfigurationDirectory): Deleted.
* UIProcess/win/WebProcessPoolWin.cpp:
(WebKit::WebProcessPool::legacyPlatformDefaultApplicationCacheDirectory): Deleted.
(WebKit::WebProcessPool::legacyPlatformDefaultMediaCacheDirectory): Deleted.
(WebKit::WebProcessPool::legacyPlatformDefaultWebSQLDatabaseDirectory): Deleted.
(WebKit::WebProcessPool::legacyPlatformDefaultIndexedDBDatabaseDirectory): Deleted.
(WebKit::WebProcessPool::legacyPlatformDefaultLocalStorageDirectory): Deleted.
(WebKit::WebProcessPool::legacyPlatformDefaultMediaKeysStorageDirectory): Deleted.
(WebKit::WebProcessPool::legacyPlatformDefaultNetworkCacheDirectory): Deleted.
(WebKit::WebProcessPool::legacyPlatformDefaultJavaScriptConfigurationDirectory): Deleted.
* UIProcess/wpe/WebProcessPoolWPE.cpp:
(WebKit::WebProcessPool::legacyPlatformDefaultApplicationCacheDirectory): Deleted.
(WebKit::WebProcessPool::legacyPlatformDefaultMediaCacheDirectory): Deleted.
(WebKit::WebProcessPool::legacyPlatformDefaultWebSQLDatabaseDirectory): Deleted.
(WebKit::WebProcessPool::legacyPlatformDefaultIndexedDBDatabaseDirectory): Deleted.
(WebKit::WebProcessPool::legacyPlatformDefaultLocalStorageDirectory): Deleted.
(WebKit::WebProcessPool::legacyPlatformDefaultMediaKeysStorageDirectory): Deleted.
(WebKit::WebProcessPool::legacyPlatformDefaultNetworkCacheDirectory): Deleted.
(WebKit::WebProcessPool::legacyPlatformDefaultJavaScriptConfigurationDirectory): Deleted.

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

16 months agoAdd new _webViewRequestPointerLock SPI with a completionHandler
achristensen@apple.com [Thu, 23 Aug 2018 23:37:01 +0000 (23:37 +0000)]
Add new _webViewRequestPointerLock SPI with a completionHandler
https://bugs.webkit.org/show_bug.cgi?id=188907
<rdar://problem/35871109>

Reviewed by Andy Estes.

Source/WebKit:

* UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
* UIProcess/Cocoa/UIDelegate.h:
* UIProcess/Cocoa/UIDelegate.mm:
(WebKit::UIDelegate::setDelegate):
(WebKit::UIDelegate::UIClient::requestPointerLock):

Tools:

* TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm:
(-[PointerLockDelegate _webViewRequestPointerLock:completionHandler:]):
(-[PointerLockDelegate webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame:completionHandler:]):
(TEST):

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

16 months agoUnreviewed, rolling out r235129.
david_fenton@apple.com [Thu, 23 Aug 2018 23:36:02 +0000 (23:36 +0000)]
Unreviewed, rolling out r235129.

broke internal builds

Reverted changeset:

"Allow creating WeakPtrs to const objects"
https://bugs.webkit.org/show_bug.cgi?id=188785
https://trac.webkit.org/changeset/235129

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

16 months agoWeb Inspector: fix typos in some compositing reasons
bburg@apple.com [Thu, 23 Aug 2018 23:32:47 +0000 (23:32 +0000)]
Web Inspector: fix typos in some compositing reasons
https://bugs.webkit.org/show_bug.cgi?id=188905
<rdar://problem/43624825>

Reviewed by Simon Fraser.

* Localizations/en.lproj/localizedStrings.js:
* UserInterface/Views/LayerTreeDetailsSidebarPanel.js:
(WI.LayerTreeDetailsSidebarPanel.prototype._populateListOfCompositingReasons):
(WI.LayerTreeDetailsSidebarPanel):
* UserInterface/Views/Layers3DContentView.js:
(WI.Layers3DContentView.prototype._updateReasonsList):
(WI.Layers3DContentView):

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

16 months ago[iOS] Test editing/undo/replace-text-in-node-preserving-markers-crash.html crashes
dbates@webkit.org [Thu, 23 Aug 2018 23:19:59 +0000 (23:19 +0000)]
[iOS] Test editing/undo/replace-text-in-node-preserving-markers-crash.html crashes
https://bugs.webkit.org/show_bug.cgi?id=188898

Reviewed by Simon Fraser.

Not all document markers may have a dictation metadata on iOS.

Currently we assume that every marker has dictation alternatives (i.e. DocumentMarker::alternatives()
can be called) when deleting a selection preserving document markers on iOS. However, only markers
for dictation may have dictation alternatives. For example, document markers for misspelled words do
not have dictation metadata by definition. Instead of assuming every marker has dictation alternatives
on iOS we need to check the marker type to determine whether it has associated dictation metadata and
invoke the appropriate DocumentMarkerController::addMarker() overload.

* dom/DocumentMarker.h:
(WebCore::DocumentMarker::isDictation const): Added.
* editing/CompositeEditCommand.cpp:
(WebCore::CompositeEditCommand::replaceTextInNodePreservingMarkers): Only access DocumentMarker::alternatives()
and add a dictation marker on iOS if the marker is a dictation marker.

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

16 months agoShow t-test results based on individual measurements to analysis task page.
dewei_zhu@apple.com [Thu, 23 Aug 2018 23:11:10 +0000 (23:11 +0000)]
Show t-test results based on individual measurements to analysis task page.
https://bugs.webkit.org/show_bug.cgi?id=188425

Reviewed by Ryosuke Niwa.

Added comparison for individual iterations in analysis task page.
Added comparison for individual iterations for notification on A/B tests completion.
Refactored t-distribution inverse lookup to any degree of freedom with 5 significant figures.

* public/shared/statistics.js: Refactored t-distribution inverse lookup function and adapted this
change to all invocations.
(Statistics.new.this.supportedConfidenceIntervalProbabilities):
(Statistics.new.this.supportedOneSideTTestProbabilities):
(Statistics.new.this.confidenceIntervalDelta):
(Statistics.new.sampleMeanAndVarianceForMultipleSamples):
(Statistics.new.this.probabilityRangeForWelchsT):
(Statistics.new.this.probabilityRangeForWelchsTFromTwoSampleSets):
(Statistics.new.this._determinetwoSidedProbabilityBoundaryForWelchsT):
(Statistics.new.this.computeWelchsT):
(Statistics.new.this._computeWelchsTFromStatistics):
(Statistics.new.this.minimumTForOneSidedProbability): Function that does t-distribution inverse lookup.
* public/v3/components/analysis-results-viewer.js: Adapted TestGroup.compareTestResults change.
(AnalysisResultsViewer.TestGroupStackingBlock.prototype._measurementsForCommitSet):
(AnalysisResultsViewer.TestGroupStackingBlock.prototype._computeTestGroupStatus):
(AnalysisResultsViewer.TestGroupStackingBlock.prototype._valuesForCommitSet): Deleted.
* public/v3/components/test-group-results-viewer.js: Show both comparisions for both individual and mean.
(TestGroupResultsViewer.prototype._renderResultsTable):
(TestGroupResultsViewer.prototype._buildRowForMetric.):
(TestGroupResultsViewer.prototype._buildValueMap):
* public/v3/models/test-group.js:
(TestGroup.compareTestResults): Added comparison for individual iterations.
* tools/js/test-group-result-page.js:
(TestGroupResultPage.prototype._constructTableForMetric):
(TestGroupResultPage.prototype.get styleTemplate):
(TestGroupResultPage):
(TestGroupResultPage.prototype._URLForAnalysisTask): Renamed to '_resultsForTestGroup'
* unit-tests/statistics-tests.js: Updated and added unit tests.

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

16 months agoMove vmEntryGlobalObject() to VM from CallFrame.
mark.lam@apple.com [Thu, 23 Aug 2018 22:57:09 +0000 (22:57 +0000)]
Move vmEntryGlobalObject() to VM from CallFrame.
https://bugs.webkit.org/show_bug.cgi?id=188900
<rdar://problem/43655753>

Reviewed by Michael Saboff.

Source/JavaScriptCore:

Also introduced CallFrame::isGlobalExec() which makes use of one property of
GlobalExecs to identify them i.e. GlobalExecs have null callerFrame and returnPCs.
CallFrame::initGlobalExec() ensures this.

In contrast, normal CallFrames always have a callerFrame (because they must at
least be preceded by a VM EntryFrame) and a returnPC (at least return to the
VM entry glue).

* API/APIUtils.h:
(handleExceptionIfNeeded):
(setException):
* API/JSBase.cpp:
(JSEvaluateScript):
(JSCheckScriptSyntax):
* API/JSContextRef.cpp:
(JSGlobalContextRetain):
(JSGlobalContextRelease):
(JSGlobalContextCopyName):
(JSGlobalContextSetName):
(JSGlobalContextGetRemoteInspectionEnabled):
(JSGlobalContextSetRemoteInspectionEnabled):
(JSGlobalContextGetIncludesNativeCallStackWhenReportingExceptions):
(JSGlobalContextSetIncludesNativeCallStackWhenReportingExceptions):
(JSGlobalContextGetDebuggerRunLoop):
(JSGlobalContextSetDebuggerRunLoop):
(JSGlobalContextGetAugmentableInspectorController):
* API/JSValue.mm:
(reportExceptionToInspector):
* API/glib/JSCClass.cpp:
(jscContextForObject):
* API/glib/JSCContext.cpp:
(jsc_context_evaluate_in_object):
* debugger/Debugger.cpp:
(JSC::Debugger::pauseIfNeeded):
* debugger/DebuggerCallFrame.cpp:
(JSC::DebuggerCallFrame::vmEntryGlobalObject const):
(JSC::DebuggerCallFrame::evaluateWithScopeExtension):
* interpreter/CallFrame.cpp:
(JSC::CallFrame::vmEntryGlobalObject): Deleted.
* interpreter/CallFrame.h:
(JSC::ExecState::scope const):
(JSC::ExecState::noCaller):
(JSC::ExecState::isGlobalExec const):
* interpreter/Interpreter.cpp:
(JSC::notifyDebuggerOfUnwinding):
(JSC::Interpreter::notifyDebuggerOfExceptionToBeThrown):
(JSC::Interpreter::debug):
* runtime/CallData.cpp:
(JSC::profiledCall):
* runtime/Completion.cpp:
(JSC::evaluate):
(JSC::profiledEvaluate):
(JSC::evaluateWithScopeExtension):
(JSC::loadAndEvaluateModule):
(JSC::loadModule):
(JSC::linkAndEvaluateModule):
(JSC::importModule):
* runtime/ConstructData.cpp:
(JSC::profiledConstruct):
* runtime/Error.cpp:
(JSC::getStackTrace):
* runtime/VM.cpp:
(JSC::VM::throwException):
(JSC::VM::vmEntryGlobalObject const):
* runtime/VM.h:

Source/WebCore:

No new tests needed because this patch does not introduce new functionality.

* bindings/js/JSCustomXPathNSResolver.cpp:
(WebCore::JSCustomXPathNSResolver::create):
* bindings/js/JSDOMGlobalObject.cpp:
(WebCore::callerGlobalObject):
(WebCore::toJSDOMGlobalObject): Deleted.
* bindings/js/JSDOMWindowBase.cpp:
(WebCore::firstDOMWindow):
* bridge/c/c_utility.cpp:
(JSC::Bindings::convertValueToNPVariant):
* bridge/objc/WebScriptObject.mm:
(WebCore::addExceptionToConsole):
* bridge/objc/objc_instance.mm:
(ObjcInstance::moveGlobalExceptionToExecState):
* bridge/objc/objc_runtime.mm:
(JSC::Bindings::convertValueToObjcObject):
* bridge/objc/objc_utility.mm:
(JSC::Bindings::convertValueToObjcValue):
* testing/Internals.cpp:
(WebCore::Internals::cloneArrayBuffer):

Source/WebKitLegacy/mac:

* WebView/WebScriptDebugger.mm:
(WebScriptDebugger::sourceParsed):

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

16 months ago[CMake] Have checks are not getting set inside CMake properly
don.olmstead@sony.com [Thu, 23 Aug 2018 22:53:05 +0000 (22:53 +0000)]
[CMake] Have checks are not getting set inside CMake properly
https://bugs.webkit.org/show_bug.cgi?id=188901

Reviewed by Michael Catanzaro.

.:

Make sure the variable's value is sent to SET_AND_EXPOSE_TO_BUILD
within the WEBKIT_CHECK_HAVE_* macros.

* Source/cmake/WebKitFeatures.cmake:

PerformanceTests:

Add notification that MallocBench is disabled.

* CMakeLists.txt:

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

16 months agoAPI tests should output json results
jbedard@apple.com [Thu, 23 Aug 2018 22:50:52 +0000 (22:50 +0000)]
API tests should output json results
https://bugs.webkit.org/show_bug.cgi?id=188869
<rdar://problem/43615652>

Reviewed by Aakash Jain.

JSON output for API tests is of the form:
    {
        "Failed": [{"name": <test name>, "output": <test log>}],
        "Timedout": [...],
        "Skipped": [...],
        "Crashed": [...]
    }
Tests which are successful are not displayed in the json output.

* Scripts/webkitpy/api_tests/manager.py:
(Manager.run): Print test results to provided file as a json dictionary.
* Scripts/webkitpy/api_tests/run_api_tests.py:
(run): Pass json option.
(parse_args): Add --json-output flag.

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

16 months ago[Apple Pay] Introduce Apple Pay JS v4 on iOS 12 and macOS Mojave
aestes@apple.com [Thu, 23 Aug 2018 22:23:18 +0000 (22:23 +0000)]
[Apple Pay] Introduce Apple Pay JS v4 on iOS 12 and macOS Mojave
https://bugs.webkit.org/show_bug.cgi?id=188829

Reviewed by Tim Horton.

Source/JavaScriptCore:

* Configurations/FeatureDefines.xcconfig:

Source/WebCore:

Test: http/tests/ssl/applepay/ApplePaySessionV4.html

* Configurations/FeatureDefines.xcconfig:
* testing/MockPaymentCoordinator.cpp:
(WebCore::MockPaymentCoordinator::supportsVersion):

Source/WebCore/PAL:

* Configurations/FeatureDefines.xcconfig:

Source/WebKit:

* Configurations/FeatureDefines.xcconfig:
* WebProcess/ApplePay/WebPaymentCoordinator.cpp:
(WebKit::WebPaymentCoordinator::supportsVersion):

Source/WebKitLegacy/mac:

* Configurations/FeatureDefines.xcconfig:

Tools:

* TestWebKitAPI/Configurations/FeatureDefines.xcconfig:

LayoutTests:

* http/tests/ssl/applepay/ApplePaySession-expected.txt:
* http/tests/ssl/applepay/ApplePaySession.html:
* http/tests/ssl/applepay/ApplePaySessionV3-expected.txt:
* http/tests/ssl/applepay/ApplePaySessionV3.html:
* http/tests/ssl/applepay/ApplePaySessionV4-expected.txt: Added.
* http/tests/ssl/applepay/ApplePaySessionV4.html: Added.
* platform/mac-wk2/TestExpectations:

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

16 months ago[WSL] Ternary expressions appear to be unimplemented
mmaxfield@apple.com [Thu, 23 Aug 2018 21:43:03 +0000 (21:43 +0000)]
[WSL] Ternary expressions appear to be unimplemented
https://bugs.webkit.org/show_bug.cgi?id=178981

Reviewed by Saam Barati.

Implement ternary statements. These can be both lvalues and rvalues. (a ? b : c ? d : e)
is parsed as (a ? b : (c ? d : e)).

* WebGPUShadingLanguageRI/All.js:
* WebGPUShadingLanguageRI/Checker.js:
(Checker.prototype.visitTernaryExpression):
* WebGPUShadingLanguageRI/Evaluator.js:
(Evaluator.prototype.visitTernaryExpression):
* WebGPUShadingLanguageRI/NormalUsePropertyResolver.js:
(NormalUsePropertyResolver.prototype.visitTernaryExpression):
(NormalUsePropertyResolver):
* WebGPUShadingLanguageRI/Parse.js:
(parsePossibleTernaryConditional):
* WebGPUShadingLanguageRI/PropertyResolver.js:
(PropertyResolver.prototype._visitRValuesWithinLValue.RValueFinder.prototype.visitTernaryExpression):
(PropertyResolver.prototype._visitRValuesWithinLValue.RValueFinder):
(PropertyResolver.prototype._visitRValuesWithinLValue):
* WebGPUShadingLanguageRI/Rewriter.js:
(Rewriter.prototype.visitTernaryExpression):
* WebGPUShadingLanguageRI/SPIRV.html:
* WebGPUShadingLanguageRI/Test.html:
* WebGPUShadingLanguageRI/Test.js:
* WebGPUShadingLanguageRI/Visitor.js:
(Visitor.prototype.visitProtocolDecl):
* WebGPUShadingLanguageRI/index.html:

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

16 months agoWeb Inspector: support breakpoints for timers and animation-frame events
drousso@apple.com [Thu, 23 Aug 2018 21:36:40 +0000 (21:36 +0000)]
Web Inspector: support breakpoints for timers and animation-frame events
https://bugs.webkit.org/show_bug.cgi?id=188778

Reviewed by Brian Burg.

Source/JavaScriptCore:

* inspector/protocol/Debugger.json:
Add `AnimationFrame` and `Timer` types to the list of pause reasons.

* inspector/protocol/DOMDebugger.json:
Introduced `setEventBreakpoint` and `removeEventBreakpoint` to replace the more specific:
 - `setEventListenerBreakpoint`
 - `removeEventListenerBreakpoint`
 - `setInstrumentationBreakpoint`
 - `removeInstrumentationBreakpoint`
Also created an `EventBreakpointType` to enumerate the available types of event breakpoints.

* inspector/scripts/codegen/generate_cpp_protocol_types_header.py:
(CppProtocolTypesHeaderGenerator.generate_output):
(CppProtocolTypesHeaderGenerator._generate_forward_declarations_for_binding_traits):
(CppProtocolTypesHeaderGenerator._generate_declarations_for_enum_conversion_methods):
(CppProtocolTypesHeaderGenerator._generate_hash_declarations): Added.
Generate `DefaultHash` for all `enum class` used by inspector protocols.

* inspector/scripts/tests/generic/expected/commands-with-async-attribute.json-result:
* inspector/scripts/tests/generic/expected/commands-with-optional-call-return-parameters.json-result:
* inspector/scripts/tests/generic/expected/enum-values.json-result:
* inspector/scripts/tests/generic/expected/type-declaration-array-type.json-result:
* inspector/scripts/tests/generic/expected/type-declaration-enum-type.json-result:
* inspector/scripts/tests/generic/expected/type-declaration-object-type.json-result:
* inspector/scripts/tests/generic/expected/type-requiring-runtime-casts.json-result:

Source/WebCore:

The original implementation of "instrumentation" breakpoints relied upon the frontend
sending somewhat arbitrary strings when enabling breakpoints for specific events. As an
example, setting a breakpoint for `requestAnimationFrame` expects `"animationFrameFired"`
as the string, which doesn't make much sense. This patch removes the usage of these strings
and instead expects the agent to implement a method that matches what is happening.

Tests: inspector/dom-debugger/event-animation-frame-breakpoints.html
       inspector/dom-debugger/event-listener-breakpoints.html
       inspector/dom-debugger/event-timer-breakpoints.html

* inspector/InspectorInstrumentation.h:
(WebCore::InspectorInstrumentation::willFireTimer):
* inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::didInstallTimerImpl):
(WebCore::InspectorInstrumentation::didRemoveTimerImpl):
(WebCore::InspectorInstrumentation::willFireTimerImpl):
(WebCore::InspectorInstrumentation::didRequestAnimationFrameImpl):
(WebCore::InspectorInstrumentation::didCancelAnimationFrameImpl):
(WebCore::InspectorInstrumentation::willFireAnimationFrameImpl):
(WebCore::InspectorInstrumentation::pauseOnNativeEventIfNeeded): Deleted.

* inspector/agents/InspectorDOMDebuggerAgent.h:
* inspector/agents/InspectorDOMDebuggerAgent.cpp:
(WebCore::InspectorDOMDebuggerAgent::setEventBreakpoint): Added.
(WebCore::InspectorDOMDebuggerAgent::removeEventBreakpoint): Added.
(WebCore::InspectorDOMDebuggerAgent::willHandleEvent):
(WebCore::InspectorDOMDebuggerAgent::willFireTimer): Added.
(WebCore::InspectorDOMDebuggerAgent::willFireAnimationFrame): Added.
(WebCore::InspectorDOMDebuggerAgent::setEventListenerBreakpoint): Deleted.
(WebCore::InspectorDOMDebuggerAgent::setInstrumentationBreakpoint): Deleted.
(WebCore::InspectorDOMDebuggerAgent::setBreakpoint): Deleted.
(WebCore::InspectorDOMDebuggerAgent::removeEventListenerBreakpoint): Deleted.
(WebCore::InspectorDOMDebuggerAgent::removeInstrumentationBreakpoint): Deleted.
(WebCore::InspectorDOMDebuggerAgent::removeBreakpoint): Deleted.
(WebCore::InspectorDOMDebuggerAgent::pauseOnNativeEventIfNeeded): Deleted.
Unify the event listener and instrumentation breakpoint commands into a single method,
`setEventBreakpoint`, that takes in both an `EventBreakpointType` and `eventName`.

* page/DOMTimer.cpp:
(WebCore::DOMTimer::fired):

Source/WebInspectorUI:

Add a `type` to `WI.EventBreakpoint` that matches `DOMDebugger.EventBreakpointType`:
 - `AnimationFrame` for `requestAnimationFrame`
 - `Listener` for any named DOM Event
 - `Timer` for `setTimeout` and `setInterval`

Modified `WI.EventBreakpointPopover` to provide ways for selecting these other types, which
is then passed to `WI.DOMDebuggerManager`, which now calls through to the newly added
`DOMDebugger.removeEventBreakpoint` and `DOMDebugger.setEventBreakpoint` that sets
breakpoints for all event types.

* Localizations/en.lproj/localizedStrings.js:
* UserInterface/Images/EventBreakpointAnimationFrame.svg: Added.
* UserInterface/Images/EventBreakpointListener.svg: Renamed from Source/WebInspectorUI/UserInterface/Images/EventBreakpoint.svg.
* UserInterface/Images/EventBreakpointTimer.svg: Added.

* UserInterface/Controllers/DOMDebuggerManager.js:
(WI.DOMDebuggerManager.supportsEventBreakpoints): Added.
(WI.DOMDebuggerManager.prototype.eventBreakpointForTypeAndEventName): Added.
(WI.DOMDebuggerManager.prototype.addEventBreakpoint):
(WI.DOMDebuggerManager.prototype.removeEventBreakpoint.breakpointRemoved): Added.
(WI.DOMDebuggerManager.prototype.removeEventBreakpoint):
(WI.DOMDebuggerManager.prototype._updateEventBreakpoint):
(WI.DOMDebuggerManager.prototype.eventBreakpointForEventName): Deleted.

* UserInterface/Controllers/DOMTreeManager.js:
(WI.DOMTreeManager.prototype.setBreakpointForEventListener):

* UserInterface/Controllers/DebuggerManager.js:
(WI.DebuggerManager.prototype._pauseReasonFromPayload):

* UserInterface/Models/EventBreakpoint.js:
(WI.EventBreakpoint):
(WI.EventBreakpoint.fromPayload):
(WI.EventBreakpoint.prototype.get type): Added.
(WI.EventBreakpoint.prototype.get serializableInfo):
(WI.EventBreakpoint.prototype.saveIdentityToCookie):

* UserInterface/Views/DebuggerSidebarPanel.js:
(WI.DebuggerSidebarPanel.prototype._updatePauseReasonSection):
(WI.DebuggerSidebarPanel.prototype.willDismissPopover):

* UserInterface/Views/EventBreakpointPopover.js:
(WI.EventBreakpointPopover):
(WI.EventBreakpointPopover.prototype.get breakpoint): Added.
(WI.EventBreakpointPopover.prototype.show):
(WI.EventBreakpointPopover.prototype.show.createOption): Added.
(WI.EventBreakpointPopover.prototype.dismiss): Added.
(WI.EventBreakpointPopover.prototype._presentOverTargetElement):
(WI.EventBreakpointPopover.prototype._handleTypeSelectChange): Added.
(WI.EventBreakpointPopover.prototype.get result): Deleted.
(WI.EventBreakpointPopover.prototype.get value): Deleted.
* UserInterface/Views/EventBreakpointPopover.css:
(.popover .event-breakpoint-content > .event-type): Added.
(.popover .event-breakpoint-content > input): Deleted.

* UserInterface/Views/EventBreakpointTreeElement.js:
(WI.EventBreakpointTreeElement):
* UserInterface/Views/EventBreakpointTreeElement.css:
(.breakpoint.event.animation-frame:not(.breakpoint-paused-icon) .icon): Added.
(.breakpoint.event.listener:not(.breakpoint-paused-icon) .icon): Added.
(.breakpoint.event.timer:not(.breakpoint-paused-icon) .icon): Added.
(.breakpoint.event:not(.breakpoint-paused-icon) .icon): Deleted.

LayoutTests:

* inspector/dom-debugger/event-animation-frame-breakpoints-expected.txt: Added.
* inspector/dom-debugger/event-animation-frame-breakpoints.html: Added.

* inspector/dom-debugger/event-breakpoint-with-navigation.html:

* inspector/dom-debugger/event-timer-breakpoints-expected.txt: Added.
* inspector/dom-debugger/event-timer-breakpoints.html: Added.

* inspector/dom-debugger/event-listener-breakpoints-expected.txt: Renamed from LayoutTests/inspector/dom-debugger/event-breakpoints-expected.txt.
* inspector/dom-debugger/event-listener-breakpoints.html: Renamed from LayoutTests/inspector/dom-debugger/event-breakpoints.html.

* inspector/dom-debugger/resources/event-breakpoint-utilities.js: Added.
(TestPage.registerInitializer.window.teardown):
(TestPage.registerInitializer.window.failOnPause):
(TestPage.registerInitializer.window.addBreakpoint):
(TestPage.registerInitializer.window.removeBreakpoint):
(TestPage.registerInitializer.window.disableBreakpoint):
(TestPage.registerInitializer.window.awaitEvent):

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

16 months agoUnreviewed, rolling out r234942.
ryanhaddad@apple.com [Thu, 23 Aug 2018 21:31:22 +0000 (21:31 +0000)]
Unreviewed, rolling out r234942.

Caused page loading issues in iTunes

Reverted changeset:

"Transition more WKWebViewConfiguration ivars to
API::PageConfiguration values"
https://bugs.webkit.org/show_bug.cgi?id=188663
https://trac.webkit.org/changeset/234942

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

16 months ago[iOS] Support the inputmode attribute on contenteditable elements
akeerthi@apple.com [Thu, 23 Aug 2018 21:24:42 +0000 (21:24 +0000)]
[iOS] Support the inputmode attribute on contenteditable elements
https://bugs.webkit.org/show_bug.cgi?id=188878

Reviewed by Ryosuke Niwa.

LayoutTests/imported/w3c:

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

Source/WebCore:

The inputmode attribute should apply to contenteditable elements, in addition to
textfield inputs and textareas.

Moved the inputmode attribute from HTMLInputElement.idl and
HTMLTextAreaElement.idl to HTMLElement.idl to reflect the specification.

Also moved all logic to convert between the InputMode enum and string values
into InputMode.cpp to avoid exposing unnecessary details to WebKit. Furthermore,
InputMode::Auto was renamed to InputMode::Unspecified to avoid confusion with the
specification.

Spec: https://html.spec.whatwg.org/multipage/interaction.html#input-modalities:-the-inputmode-attribute

Tests: fast/forms/inputmode-attribute-contenteditable.html
       fast/forms/inputmode-attribute-input.html
       fast/forms/inputmode-attribute-textarea.html

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* html/HTMLElement.cpp:
(WebCore::HTMLElement::canonicalInputMode const):
(WebCore::HTMLElement::inputMode const):
(WebCore::HTMLElement::setInputMode):
* html/HTMLElement.h:
* html/HTMLElement.idl:
* html/HTMLInputElement.idl:
* html/HTMLTextAreaElement.idl:
* html/HTMLTextFormControlElement.cpp:
* html/HTMLTextFormControlElement.h:
* html/InputMode.cpp: Renamed from Source/WebCore/html/InputModeNames.cpp.
(WebCore::inputModeForAttributeValue):
(WebCore::stringForInputMode):
* html/InputMode.h: Renamed from Source/WebCore/html/InputModeNames.h.

Source/WebKit:

Ensured that the assistedNodeInformation for a contenteditable element reflects
the value of the element's inputmode attribute.

Moved logic to obtain the InputMode from the attribute value into WebCore.

* Shared/AssistedNodeInformation.h:
* UIProcess/ios/WKContentViewInteraction.mm:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::getAssistedNodeInformation):

LayoutTests:

Added additional tests to verify the inputmode attribute is accessible on
HTMLElements.

* fast/forms/inputmode-attribute-contenteditable-expected.txt: Added.
* fast/forms/inputmode-attribute-contenteditable.html: Added.
* fast/forms/inputmode-attribute-input-expected.txt: Renamed from LayoutTests/fast/forms/inputmode-attribute-expected.txt.
* fast/forms/inputmode-attribute-input.html: Renamed from LayoutTests/fast/forms/inputmode-attribute.html.
* fast/forms/inputmode-attribute-textarea-expected.txt: Added.
* fast/forms/inputmode-attribute-textarea.html: Added.
* js/dom/dom-static-property-for-in-iteration-expected.txt: Rebaseline.

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

16 months agoAssert in NetworkBlobRegistry::unregisterBlobURL after network process had terminated
rniwa@webkit.org [Thu, 23 Aug 2018 20:51:19 +0000 (20:51 +0000)]
Assert in NetworkBlobRegistry::unregisterBlobURL after network process had terminated
https://bugs.webkit.org/show_bug.cgi?id=188880

Reviewed by Saam Barati.

Source/WebKit:

Removed the debug assertion. WebContent process might be asking this network process
to unregister a blob registered from another network processs which had since crashed.

We could keep track of which blob had been registered with which network process
in WebContent process and avoid sending IPC to the network process but that's a lot of
house-keeping for virtually no benefit other than not hitting this assertion.

* NetworkProcess/FileAPI/NetworkBlobRegistry.cpp:
(WebKit::NetworkBlobRegistry::unregisterBlobURL):

Tools:

Fixed the bug that testRunner's terminateNetworkProcess, terminateServiceWorkerProcess, and terminateStorageProcess
were asynchronously terminating respective processes. Do so synchronously so that we can deterministically
test WebKit's behavior in layout tests.

* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::terminateNetworkProcess):
(WTR::TestRunner::terminateServiceWorkerProcess):
(WTR::TestRunner::terminateStorageProcess):
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::didReceiveMessageFromInjectedBundle):
(WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):

LayoutTests:

Added a layout test which demonstrates this debug assertion.

* TestExpectations:
* fast/files/blob-network-process-crash-expected.txt: Added.
* fast/files/blob-network-process-crash.html: Added.
* platform/wk2/TestExpectations:

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

16 months agoWeb Inspector: `console.inspect(sessionStorage)` first time does not show Session...
drousso@apple.com [Thu, 23 Aug 2018 20:20:15 +0000 (20:20 +0000)]
Web Inspector: `console.inspect(sessionStorage)` first time does not show Session Storage content view if Storage tab was previously unvisited
https://bugs.webkit.org/show_bug.cgi?id=188801

Reviewed by Matt Baker.

* UserInterface/Base/Main.js:
(WI.tabContentViewClassForRepresentedObject):
(WI._storageWasInspected):
Since the `WI.StorageSidebarPanel` is not created until the `WI.StorageTabContentView` is
created, the `WI.StorageManager.Event.DOMStorageObjectWasInspected` and
`WI.StorageManager.Event.DatabaseWasInspected` events do not reach the sidebar. We should
follow what `WI._domNodeWasInspected` does and additionally call `WI.showRepresentedObject`
on the inspected object.

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

16 months ago[CMake] Add HAVE_MALLOC_TRIM definition
don.olmstead@sony.com [Thu, 23 Aug 2018 20:08:03 +0000 (20:08 +0000)]
[CMake] Add HAVE_MALLOC_TRIM definition
https://bugs.webkit.org/show_bug.cgi?id=188897

Reviewed by Konstantin Tokarev.

.:

Add CMake check for malloc_trim.

* Source/cmake/OptionsCommon.cmake:

PerformanceTests:

MallocBench should only be built on Apple platforms and platforms that
have malloc_trim.

* CMakeLists.txt:

Source/WTF:

Use HAVE(MALLOC_TRIM) check instead of __GLIBC__.

* wtf/linux/MemoryPressureHandlerLinux.cpp:
(WTF::MemoryPressureHandler::platformReleaseMemory):

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

16 months agoWeb Inspector: REGRESSION: InspectorStyleSheet not visible in the resources sidebar
drousso@apple.com [Thu, 23 Aug 2018 20:06:14 +0000 (20:06 +0000)]
Web Inspector: REGRESSION: InspectorStyleSheet not visible in the resources sidebar
https://bugs.webkit.org/show_bug.cgi?id=188819
<rdar://problem/43579039>

Reviewed by Brian Burg.

* UserInterface/Models/ResourceCollection.js:
(WI.ResourceCollection.prototype.objectIsRequiredType):

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

16 months agoRemove keys of defaults that are no longer used in webProcessPool
sihui_liu@apple.com [Thu, 23 Aug 2018 19:58:30 +0000 (19:58 +0000)]
Remove keys of defaults that are no longer used in webProcessPool
https://bugs.webkit.org/show_bug.cgi?id=188855

Reviewed by Alex Christensen.

* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::registerUserDefaultsIfNeeded):

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

16 months agoYARR: Need to JIT compile a RegExp before using containsNestedSubpatterns flag
msaboff@apple.com [Thu, 23 Aug 2018 19:57:44 +0000 (19:57 +0000)]
YARR: Need to JIT compile a RegExp before using containsNestedSubpatterns flag
https://bugs.webkit.org/show_bug.cgi?id=188895

Reviewed by Mark Lam.

Found while working on another change.  This will allow processing of nested
parenthesis that require saved ParenContext structures.

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

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