2019-11-04 Kocsen Chung Cherry-pick r248552. rdar://problem/56868427 Replace multiparameter overloads of append() in StringBuilder as a first step toward standardizinging on the flexibleAppend() implementation https://bugs.webkit.org/show_bug.cgi?id=200614 Reviewed by Darin Adler. Renames StringBuilder::append(const LChar*, unsigned), StringBuilder::append(const UChar*, unsigned) and StringBuilder::append(const char*, unsigned) to StringBuilder::appendCharacters(...). Renames StringBuilder::append(const String& string, unsigned offset, unsigned length) to StringBuilder::appendSubstring(...). Source/JavaScriptCore: * dfg/DFGStrengthReductionPhase.cpp: (JSC::DFG::StrengthReductionPhase::handleNode): * runtime/ConfigFile.cpp: (JSC::ConfigFile::parse): * runtime/LiteralParser.cpp: (JSC::LiteralParser::Lexer::lexStringSlow): * tools/FunctionOverrides.cpp: (JSC::parseClause): Update for renames. Source/WebCore: * dom/Range.cpp: (WebCore::Range::toString const): * editing/Editing.cpp: (WebCore::stringWithRebalancedWhitespace): * editing/MarkupAccumulator.cpp: (WebCore::appendCharactersReplacingEntitiesInternal): * editing/TextIterator.cpp: (WebCore::TextIteratorCopyableText::appendToStringBuilder const): * html/HTMLTextFormControlElement.cpp: (WebCore::HTMLTextFormControlElement::valueWithHardLineBreaks const): * html/parser/HTMLTokenizer.cpp: (WebCore::HTMLTokenizer::bufferedCharacters const): * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp: (WebCore::InbandTextTrackPrivateAVF::processNativeSamples): * platform/text/SegmentedString.cpp: (WebCore::SegmentedString::Substring::appendTo const): * platform/text/TextCodecICU.cpp: (WebCore::TextCodecICU::decode): * xml/XSLTProcessorLibxslt.cpp: (WebCore::writeToStringBuilder): Update for renames. Source/WebKit: * Shared/mac/AuxiliaryProcessMac.mm: (WebKit::setAndSerializeSandboxParameters): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::didReceiveInvalidMessage): Update for renames. Source/WTF: * wtf/HexNumber.h: (WTF::appendUnsignedAsHexFixedSize): Add overload that explicitly takes a StringBuilder to work around rename from append to appendCharacters. * wtf/text/StringBuilder.cpp: (WTF::StringBuilder::appendCharacters): (WTF::StringBuilder::append): * wtf/text/StringBuilder.h: (WTF::StringBuilder::appendCharacters): (WTF::StringBuilder::append): (WTF::StringBuilder::appendSubstring): (WTF::StringBuilder::appendLiteral): (WTF::IntegerToStringConversionTrait::flush): Update for renames. Tools: * TestWebKitAPI/Tests/WTF/StringBuilder.cpp: (TestWebKitAPI::TEST): Update for renames. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248552 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-08-12 Sam Weinig Replace multiparameter overloads of append() in StringBuilder as a first step toward standardizinging on the flexibleAppend() implementation https://bugs.webkit.org/show_bug.cgi?id=200614 Reviewed by Darin Adler. Renames StringBuilder::append(const LChar*, unsigned), StringBuilder::append(const UChar*, unsigned) and StringBuilder::append(const char*, unsigned) to StringBuilder::appendCharacters(...). Renames StringBuilder::append(const String& string, unsigned offset, unsigned length) to StringBuilder::appendSubstring(...). * wtf/HexNumber.h: (WTF::appendUnsignedAsHexFixedSize): Add overload that explicitly takes a StringBuilder to work around rename from append to appendCharacters. * wtf/text/StringBuilder.cpp: (WTF::StringBuilder::appendCharacters): (WTF::StringBuilder::append): * wtf/text/StringBuilder.h: (WTF::StringBuilder::appendCharacters): (WTF::StringBuilder::append): (WTF::StringBuilder::appendSubstring): (WTF::StringBuilder::appendLiteral): (WTF::IntegerToStringConversionTrait::flush): Update for renames. 2019-10-24 Kocsen Chung Cherry-pick r250640. rdar://problem/56237433 REGRESSION (r245672): dropdown with text-rendering: optimizeLegibility freezes Safari https://bugs.webkit.org/show_bug.cgi?id=202198 Reviewed by Tim Horton. * wtf/Platform.h: 2019-10-03 Alan Coon Cherry-pick r248319. rdar://problem/55964805 Unreviewed, a build fix after r248308 Use kSecUseDataProtectionKeychain for iOS 13 and macOS Catalina or newer. Source/WebKit: * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm: (WebKit::LocalAuthenticator::makeCredential): (WebKit::LocalAuthenticator::continueMakeCredentialAfterUserConsented): (WebKit::LocalAuthenticator::continueMakeCredentialAfterAttested): (WebKit::LocalAuthenticator::getAssertion): (WebKit::LocalAuthenticator::continueGetAssertionAfterUserConsented): Source/WTF: * wtf/Platform.h: Tools: * WebKitTestRunner/cocoa/TestControllerCocoa.mm: (WTR::TestController::addTestKeyToKeychain): (WTR::TestController::cleanUpKeychain): (WTR::TestController::keyExistsInKeychain): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248319 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-08-06 Jiewen Tan Unreviewed, a build fix after r248308 Use kSecUseDataProtectionKeychain for iOS 13 and macOS Catalina or newer. * wtf/Platform.h: 2019-10-03 Alan Coon Cherry-pick r248308. rdar://problem/55964805 [WebAuthN] Enable LocalAuthenticator for macOS https://bugs.webkit.org/show_bug.cgi?id=182772 Reviewed by Brent Fulgham. Source/WebKit: This patch enables LocalAuthenticator for macOS. The majority of this patch is to tweak macOS keychain to use the modern one. * Configurations/WebKit.xcconfig: * Platform/spi/Cocoa/DeviceIdentitySPI.h: * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm: (WebKit::LocalAuthenticatorInternal::toVector): (WebKit::LocalAuthenticator::makeCredential): (WebKit::LocalAuthenticator::continueMakeCredentialAfterUserConsented): (WebKit::LocalAuthenticator::continueMakeCredentialAfterAttested): (WebKit::LocalAuthenticator::getAssertion): (WebKit::LocalAuthenticator::continueGetAssertionAfterUserConsented): * UIProcess/WebAuthentication/Cocoa/LocalConnection.mm: (WebKit::LocalConnection::getUserConsent const): (WebKit::LocalConnection::getAttestation const): * UIProcess/WebAuthentication/Cocoa/LocalService.mm: (WebKit::LocalService::isAvailable): * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm: (WebKit::MockLocalConnection::getAttestation const): * config.h: Source/WTF: * wtf/Platform.h: Adds HAVE_DEVICE_IDENTITY. * wtf/spi/cocoa/SecuritySPI.h: Adds a SPI for telling macOS keychain to use the modern one. Tools: Add an entitlement file to WebKitTestRunner such that it can access the modern macOS keychain. * WebKitTestRunner/Configurations/WebKitTestRunner.entitlements: Added. * WebKitTestRunner/Configurations/WebKitTestRunner.xcconfig: * WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj: * WebKitTestRunner/cocoa/TestControllerCocoa.mm: (WTR::TestController::addTestKeyToKeychain): (WTR::TestController::cleanUpKeychain): (WTR::TestController::keyExistsInKeychain): LayoutTests: Enable existing local authenticator tests for macOS. Since OpenSource bots don't have the internal setting to include restricted entitlements, tests will fail on OpenSource bots. * platform/mac-wk2/TestExpectations: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248308 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-08-06 Jiewen Tan [WebAuthN] Enable LocalAuthenticator for macOS https://bugs.webkit.org/show_bug.cgi?id=182772 Reviewed by Brent Fulgham. * wtf/Platform.h: Adds HAVE_DEVICE_IDENTITY. * wtf/spi/cocoa/SecuritySPI.h: Adds a SPI for telling macOS keychain to use the modern one. 2019-10-03 Kocsen Chung Cherry-pick r249068. rdar://problem/55927255 Unreviewed, build fix after r249059 Source/WebKit: * UIProcess/WebAuthentication/Cocoa/NfcConnection.mm: (WebKit::NfcConnection::NfcConnection): Remove the HAVE() macro. Source/WTF: * wtf/Platform.h: Make HAVE_NEAR_FIELD available only on iOS 13+ and macOS Catalina+. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@249068 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-08-23 Jiewen Tan Unreviewed, build fix after r249059 * wtf/Platform.h: Make HAVE_NEAR_FIELD available only on iOS 13+ and macOS Catalina+. 2019-10-03 Kocsen Chung Cherry-pick r249059. rdar://problem/55927255 [WebAuthn] Support NFC authenticators for iOS https://bugs.webkit.org/show_bug.cgi?id=188624 Reviewed by Chris Dumez. Source/WebCore: Tests: http/wpt/webauthn/ctap-nfc-failure.https.html http/wpt/webauthn/public-key-credential-create-failure-nfc.https.html http/wpt/webauthn/public-key-credential-create-success-nfc.https.html http/wpt/webauthn/public-key-credential-get-failure-nfc.https.html http/wpt/webauthn/public-key-credential-get-success-nfc.https.html * Modules/webauthn/apdu/ApduResponse.h: Adds a new method to support moving m_data. * Modules/webauthn/fido/FidoConstants.h: Adds constants for NFC applet selection. Source/WebKit: This patch implements support for NFC authenticators including both FIDO2 and U2F ones. It utilizes a private framework called NearField instead of CoreNFC to be able to supply a custom UI later if necessary. The patch follows almost the same flow as previous HID and Local authenticator support. 1) Discovery is via NfcService which will invoke NFHardwareManager to start a generic NFC reader session. 2) Once a reader session is established, a NfcConnection is created to start the polling and register the WKNFReaderSessionDelegate to wait for 'didDetectTags'. 3) When tags are detected, NfcConnection will determine if it meets our requriements: { type, connectability, fido applet availability }. The first tag that meets all requirement will then be returned for WebAuthn operations. 4) The first WebAuthn operation is to send authenticatorGetInfo command to determine the supported protocol, and then initialize corresponding authenticators. Noted, the sending/receiving of this command is now abstracted into FidoService which will be shared across HidService and NfcService. 5) From then, the actual WebAuthn request, either makeCredential or getAssertion will be sent. For testing, this patch follows the same flow as well. 1) MockNfcService overrides NfcService to mock the behavior of NFC Tags discovery. 2) The same class also swizzles methods from NFReaderSession to mock tag connection and communication. * Platform/spi/Cocoa/NearFieldSPI.h: Added. * Sources.txt: * SourcesCocoa.txt: * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreSetWebAuthenticationMockConfiguration): * UIProcess/WebAuthentication/AuthenticatorManager.cpp: (WebKit::AuthenticatorManagerInternal::collectTransports): * UIProcess/WebAuthentication/AuthenticatorTransportService.cpp: (WebKit::AuthenticatorTransportService::create): (WebKit::AuthenticatorTransportService::createMock): * UIProcess/WebAuthentication/Cocoa/HidService.h: * UIProcess/WebAuthentication/Cocoa/HidService.mm: (WebKit::HidService::HidService): (WebKit::HidService::deviceAdded): (WebKit::HidService::continueAddDeviceAfterGetInfo): Deleted. * UIProcess/WebAuthentication/Cocoa/NearFieldSoftLink.h: Copied from Source/WebKit/UIProcess/WebAuthentication/Cocoa/HidService.h. * UIProcess/WebAuthentication/Cocoa/NearFieldSoftLink.mm: Copied from Source/WebKit/UIProcess/WebAuthentication/Cocoa/HidService.h. * UIProcess/WebAuthentication/Cocoa/NfcConnection.h: Copied from Source/WebKit/UIProcess/WebAuthentication/Cocoa/HidService.h. * UIProcess/WebAuthentication/Cocoa/NfcConnection.mm: Added. (WebKit::fido::compareVersion): (WebKit::NfcConnection::NfcConnection): (WebKit::NfcConnection::~NfcConnection): (WebKit::NfcConnection::transact const): (WebKit::NfcConnection::didDetectTags const): * UIProcess/WebAuthentication/Cocoa/NfcService.h: Copied from Source/WebKit/UIProcess/WebAuthentication/Cocoa/HidService.h. * UIProcess/WebAuthentication/Cocoa/NfcService.mm: Added. (WebKit::NfcService::NfcService): (WebKit::NfcService::~NfcService): (WebKit::NfcService::didConnectTag): (WebKit::NfcService::startDiscoveryInternal): (WebKit::NfcService::platformStartDiscovery): * UIProcess/WebAuthentication/Cocoa/WKNFReaderSessionDelegate.h: Copied from Source/WebKit/UIProcess/WebAuthentication/Cocoa/HidService.h. * UIProcess/WebAuthentication/Cocoa/WKNFReaderSessionDelegate.mm: Copied from Source/WebKit/UIProcess/WebAuthentication/Cocoa/HidService.h. (-[WKNFReaderSessionDelegate initWithConnection:]): (-[WKNFReaderSessionDelegate readerSession:didDetectTags:]): * UIProcess/WebAuthentication/Mock/MockHidConnection.cpp: (WebKit::MockHidConnection::send): (WebKit::MockHidConnection::registerDataReceivedCallbackInternal): (WebKit::MockHidConnection::parseRequest): (WebKit::MockHidConnection::feedReports): (WebKit::MockHidConnection::shouldContinueFeedReports): * UIProcess/WebAuthentication/Mock/MockNfcService.h: Copied from Source/WebKit/UIProcess/WebAuthentication/Cocoa/HidService.h. * UIProcess/WebAuthentication/Mock/MockNfcService.mm: Added. (-[WKMockNFTag type]): (-[WKMockNFTag initWithNFTag:]): (-[WKMockNFTag description]): (-[WKMockNFTag isEqualToNFTag:]): (-[WKMockNFTag initWithType:]): (WebKit::MockNfcService::MockNfcService): (WebKit::MockNfcService::transceive): (WebKit::MockNfcService::platformStartDiscovery): (WebKit::MockNfcService::detectTags const): * UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h: * UIProcess/WebAuthentication/fido/CtapAuthenticator.cpp: * UIProcess/WebAuthentication/fido/CtapAuthenticator.h: * UIProcess/WebAuthentication/fido/CtapNfcDriver.cpp: Added. (WebKit::CtapNfcDriver::CtapNfcDriver): (WebKit::CtapNfcDriver::transact): (WebKit::CtapNfcDriver::respondAsync const): * UIProcess/WebAuthentication/fido/CtapNfcDriver.h: Copied from Source/WebKit/UIProcess/WebAuthentication/Cocoa/HidService.h. * UIProcess/WebAuthentication/fido/FidoService.cpp: Added. (WebKit::FidoService::FidoService): (WebKit::FidoService::getInfo): (WebKit::FidoService::continueAfterGetInfo): * UIProcess/WebAuthentication/fido/FidoService.h: Copied from Source/WebKit/UIProcess/WebAuthentication/Cocoa/HidService.h. * UIProcess/WebAuthentication/fido/U2fAuthenticator.cpp: * UIProcess/WebAuthentication/fido/U2fAuthenticator.h: * UIProcess/ios/WebPageProxyIOS.mm: * WebKit.xcodeproj/project.pbxproj: Source/WTF: * wtf/Platform.h: Add a feature flag for NearField. Tools: * WebKitTestRunner/InjectedBundle/TestRunner.cpp: (WTR::TestRunner::setWebAuthenticationMockConfiguration): Setup NFC mock testing configuration. LayoutTests: * http/wpt/webauthn/ctap-nfc-failure.https-expected.txt: Added. * http/wpt/webauthn/ctap-nfc-failure.https.html: Added. * http/wpt/webauthn/public-key-credential-create-failure-nfc.https-expected.txt: Added. * http/wpt/webauthn/public-key-credential-create-failure-nfc.https.html: Added. * http/wpt/webauthn/public-key-credential-create-success-hid.https-expected.txt: * http/wpt/webauthn/public-key-credential-create-success-hid.https.html: This patch replaces the "local" keyword with "hid". * http/wpt/webauthn/public-key-credential-create-success-nfc.https-expected.txt: Added. * http/wpt/webauthn/public-key-credential-create-success-nfc.https.html: Added. * http/wpt/webauthn/public-key-credential-get-failure-nfc.https-expected.txt: Added. * http/wpt/webauthn/public-key-credential-get-failure-nfc.https.html: Added. * http/wpt/webauthn/public-key-credential-get-success-nfc.https-expected.txt: Added. * http/wpt/webauthn/public-key-credential-get-success-nfc.https.html: Added. * http/wpt/webauthn/resources/util.js: * platform/ios-simulator-wk2/TestExpectations: Skip NFC tests for simulators. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@249059 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-08-21 Jiewen Tan [WebAuthn] Support NFC authenticators for iOS https://bugs.webkit.org/show_bug.cgi?id=188624 Reviewed by Chris Dumez. * wtf/Platform.h: Add a feature flag for NearField. 2019-09-29 Alan Coon Cherry-pick r250345. rdar://problem/55825352 [iPadOS] [DataActivation] Focus moves away after focusing input fields on www.att.com https://bugs.webkit.org/show_bug.cgi?id=202167 Reviewed by Tim Horton. Source/WebCore: Adds a new site-specific quirk. See WebKit ChangeLog for more details. * page/Quirks.cpp: (WebCore::Quirks::shouldUseLegacySelectPopoverDismissalBehaviorInDataActivation const): * page/Quirks.h: * platform/RuntimeApplicationChecks.h: * platform/cocoa/RuntimeApplicationChecksCocoa.mm: (WebCore::IOSApplication::isDataActivation): Source/WebKit: When using the data activation page on www.att.com, one of the sections on the page contains several select elements; in the case where the user agent: 1. contains the string "iPad", and 2. does not contain the string "Safari" ...www.att.com's data activation page will opt into a mode where it adds blur event listeners to the select elements; in this blur event listener, www.att.com proceeds to programmatically focus a non-editable div element after a 1 second timeout. The reasons for this behavior remain unclear to me, though it's worth noting that the blur event handler name is "screenReaderFocus", which suggests that this is in place to ensure compatibility with screen readers. In iOS 12, dismissing the popover would blur the focused select menu with an animation. Since the animation would take a slightly less than 1 second, www.att.com's logic would have the effect of moving focus to the div element shortly after dismissing the select menu. However, after r243808, we no longer attempt to blur the focused select element when dismissing the popover. This means that the select element is only blurred the next time the user activates another focused element, such as one of the input fields on the page, or a different select element. Consequently, the logic to move focus into a div element now occurs only after a different element has already been focused; this results in focus moving away from newly focused elements after 1 second in the case where a select element has previously focused. To mitigate this, restore iOS 12 behavior behind a site- and app-specific quirk. See comments below for more details. * Shared/FocusedElementInformation.cpp: (WebKit::FocusedElementInformation::encode const): (WebKit::FocusedElementInformation::decode): * Shared/FocusedElementInformation.h: Add a new behavioral quirk flag to FocusedElementInformation to determine whether we should use "legacy" select popover dismissal behavior (i.e. blurring the focused select element when dismissing the select popover, as well as dismissing the popover with animation). * Shared/WebPreferences.yaml: Enable site-specific quirks by default in WKWebView. With regards to this bug, this change allows for site-specific hacks (namely, legacy select popover dismissal) in DataActivation. However, this also fixes various known bugs that are otherwise addressed in Safari only, via site-specific quirks. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _initializeWithConfiguration:]): For apps linked on or before iOS 13 and macOS 10.15, revert the default of value of NeedsSiteSpecificQuirks to false. This is done here instead of in a default value function in WebPreferencesDefaultValues to prevent the default values of NeedsSiteSpecificQuirks in the web process and UI process from going out of sync, since the web process is not necessarily linked against the same SDK as the application. * UIProcess/Cocoa/VersionChecks.h: Add a new DYLD version check for the first version of iOS and macOS where site-specific quirks are enabled by default. * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView endEditingAndUpdateFocusAppearanceWithReason:]): (-[WKContentView _elementDidBlur]): (-[WKContentView _shouldUseLegacySelectPopoverDismissalBehavior]): We only use "legacy" select popover dismissal behavior in the case where the site-specific quirk flag is on, a select popover is used (i.e. the device is an iPad and a select element is focused), and the application bundle is "com.apple.DataActivation". * UIProcess/ios/forms/WKFormSelectPopover.mm: (-[WKSelectTableViewController shouldDismissWithAnimation]): Keyed off of _shouldUseLegacySelectPopoverDismissalBehavior. (-[WKSelectPopover controlEndEditing]): * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::getFocusedElementInformation): Source/WTF: Declare DYLD_IOS_VERSION_13_2. * wtf/spi/darwin/dyldSPI.h: Tools: Rebaseline an API test. * TestWebKitAPI/Tests/WebKit/WKPreferences.cpp: (TestWebKitAPI::TEST): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250345 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-09-25 Wenson Hsieh [iPadOS] [DataActivation] Focus moves away after focusing input fields on www.att.com https://bugs.webkit.org/show_bug.cgi?id=202167 Reviewed by Tim Horton. Declare DYLD_IOS_VERSION_13_2. * wtf/spi/darwin/dyldSPI.h: 2019-08-19 Alan Coon Cherry-pick r248852. rdar://problem/54454547 Unreviewed build fix for macOS 10.14 after r248832. * wtf/Platform.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248852 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-08-19 Per Arne Vollan Unreviewed build fix for macOS 10.14 after r248832. * wtf/Platform.h: 2019-08-18 Babak Shafiei Cherry-pick r248832. rdar://problem/54454547 [Mac] Use the PID of the WebContent process when issuing local file read sandbox extensions https://bugs.webkit.org/show_bug.cgi?id=200543 Source/WebKit: Reviewed by Brent Fulgham. Adopt SPI to issue a process-specific sandbox extension for local file read, passing it the process identifier of the WebContent process. * Shared/Cocoa/SandboxExtensionCocoa.mm: (WebKit::SandboxExtensionImpl::sandboxExtensionForType): (WebKit::SandboxExtension::createHandleForReadByPid): * Shared/SandboxExtension.h: * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::WebPageProxy::createSandboxExtensionsIfNeeded): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::maybeInitializeSandboxExtensionHandle): (WebKit::WebPageProxy::loadFile): Source/WTF: Reviewed by Brent Fulgham. Add new SPI. * wtf/Platform.h: * wtf/spi/darwin/SandboxSPI.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248832 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-08-18 Per Arne Vollan [Mac] Use the PID of the WebContent process when issuing local file read sandbox extensions https://bugs.webkit.org/show_bug.cgi?id=200543 Reviewed by Brent Fulgham. Add new SPI. * wtf/Platform.h: * wtf/spi/darwin/SandboxSPI.h: 2019-08-18 Babak Shafiei Cherry-pick r248823. rdar://problem/54454713 Source/WebKit: Use bundlePath SPI in AccessibilitySupport for WebProcessLoader https://bugs.webkit.org/show_bug.cgi?id=200367 Patch by Eric Liang on 2019-08-17 Reviewed by Darin Adler. * Platform/spi/ios/AccessibilitySupportSPI.h: * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::accessibilityWebProcessLoaderBundlePath): (WebKit::registerWithAccessibility): Source/WTF: Added HAVE_ACCESSIBILITY_BUNDLES_PATH https://bugs.webkit.org/show_bug.cgi?id=200367 Patch by Eric Liang on 2019-08-17 Reviewed by Darin Adler. * wtf/Platform.h: Tools: Tested that accessibility WebProcessLoader bundle is loaded for the correct path. https://bugs.webkit.org/show_bug.cgi?id=200367 Patch by Eric Liang on 2019-08-17 Reviewed by Darin Adler. Added AccessibilityTestPlugin on the web process to report whether a bundle is loaded and its path, so that it can be tested on WKContentView. * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: * TestWebKitAPI/Tests/WebKitCocoa/AccessibilityTestPlugin.mm: Added. (-[AccessibilityTestPlugin webProcessPlugIn:didCreateBrowserContextController:]): (-[AccessibilityTestPlugin checkAccessibilityWebProcessLoaderBundleIsLoaded:]): * TestWebKitAPI/Tests/WebKitCocoa/AccessibilityTestSupportProtocol.h: Added. * TestWebKitAPI/Tests/ios/AccessibilityTestsIOS.mm: (TestWebKitAPI::TEST): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248823 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-08-17 Eric Liang Added HAVE_ACCESSIBILITY_BUNDLES_PATH https://bugs.webkit.org/show_bug.cgi?id=200367 Reviewed by Darin Adler. * wtf/Platform.h: 2019-08-15 Alan Coon Cherry-pick r248731. rdar://problem/54360857 Unreviewed, rolling out r248440. https://bugs.webkit.org/show_bug.cgi?id=200772 Introduced regressions related to loading of local files. (Requested by perarne on #webkit). Reverted changeset: "[Mac] Use the PID of the WebContent process when issuing local file read sandbox extensions" https://bugs.webkit.org/show_bug.cgi?id=200543 https://trac.webkit.org/changeset/248440 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248731 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-08-15 Commit Queue Unreviewed, rolling out r248440. https://bugs.webkit.org/show_bug.cgi?id=200772 Introduced regressions related to loading of local files. (Requested by perarne on #webkit). Reverted changeset: "[Mac] Use the PID of the WebContent process when issuing local file read sandbox extensions" https://bugs.webkit.org/show_bug.cgi?id=200543 https://trac.webkit.org/changeset/248440 2019-08-13 Alan Coon Cherry-pick r248440. rdar://problem/54237795 [Mac] Use the PID of the WebContent process when issuing local file read sandbox extensions https://bugs.webkit.org/show_bug.cgi?id=200543 Source/WebKit: Reviewed by Brent Fulgham. Adopt SPI to issue a process-specific sandbox extension for local file read, passing it the process identifier of the WebContent process. * Shared/Cocoa/SandboxExtensionCocoa.mm: (WebKit::SandboxExtensionImpl::sandboxExtensionForType): (WebKit::SandboxExtension::createHandleForReadByPid): * Shared/SandboxExtension.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::maybeInitializeSandboxExtensionHandle): Source/WTF: Reviewed by Brent Fulgham. Add new SPI. * wtf/Platform.h: * wtf/spi/darwin/SandboxSPI.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248440 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-08-08 Per Arne Vollan [Mac] Use the PID of the WebContent process when issuing local file read sandbox extensions https://bugs.webkit.org/show_bug.cgi?id=200543 Reviewed by Brent Fulgham. Add new SPI. * wtf/Platform.h: * wtf/spi/darwin/SandboxSPI.h: 2019-08-06 Alan Coon Apply patch. rdar://problem/53992160 2019-08-06 Per Arne Vollan [Win] Fix AppleWin build https://bugs.webkit.org/show_bug.cgi?id=200414 Reviewed by Brent Fulgham. * wtf/CMakeLists.txt: * wtf/PlatformPlayStation.cmake: 2019-07-31 Alan Coon Cherry-pick r248071. rdar://problem/53789003 Use CTFontCreateForCharactersWithLanguageAndOption if available instead of CTFontCreateForCharactersWithLanguage https://bugs.webkit.org/show_bug.cgi?id=200241 Source/WebCore: Reviewed by Myles C. Maxfield. We can use CTFontCreateForCharactersWithLanguageAndOption instead of CTFontCreateForCharactersWithLanguage as it allows setting more easily the fallback option. This allows us to never fallback to user installed fonts. In such a case, we no longer need to wrap the fonts to change the fallback option. We also prewarm the fonts with the same SPI and use system fallback as the default value. Covered by existing tests. * platform/graphics/cocoa/FontCacheCoreText.cpp: (WebCore::preparePlatformFont): (WebCore::lookupFallbackFont): (WebCore::FontCache::systemFallbackForCharacters): (WebCore::FontCache::prewarm): (WebCore::fontFamiliesForPrewarming): Source/WebCore/PAL: Reviewed by Myles C. Maxfield. Add new SPI. * pal/spi/cocoa/CoreTextSPI.h: Source/WTF: Reviewed by Myles C. Maxfield. * wtf/Platform.h: Add macro to enable/disable new SPI. LayoutTests: We update the tests to flush font caches as otherwise some debug asserts would be hit. This is due to changing the user installed font runtime flag while browsing which is not a typical situation. Reviewed by Myles C. Maxfield. * fast/text/user-installed-fonts/extended-character-with-user-font.html: * fast/text/user-installed-fonts/extended-character.html: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248071 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-07-31 Youenn Fablet Use CTFontCreateForCharactersWithLanguageAndOption if available instead of CTFontCreateForCharactersWithLanguage https://bugs.webkit.org/show_bug.cgi?id=200241 Reviewed by Myles C. Maxfield. * wtf/Platform.h: Add macro to enable/disable new SPI. 2019-07-31 Alan Coon Cherry-pick r248018. rdar://problem/53764057 REGRESSION(r241288): Text on Yahoo Japan mobile looks too bold https://bugs.webkit.org/show_bug.cgi?id=200065 Reviewed by Simon Fraser. Source/WebCore: Before r241288, we were mapping Japanese sans-serif to Hiragino Kaku Gothic ProN, which has a 300 weight and a 600 weight. However, we can't use that font because it's user-installed, so in r241288 we switched to using Hiragino Sans, which has a 300 weight, a 600 weight, and an 800 weight. According to the CSS font selection algorithm, sites that request a weight of 700 would get the 800 weight instead of the 600 weight, which caused the text to look too heavy. Therefore, the apparent visual change is from a weight change from 600 to 800. In general, this is working as intended. However, text on Yahoo Japan looks too heavy in weight 800. Instead, this patch adds a quirk specific to Yahoo Japan that overwrites any font requests to give them a weight of 600 instead of 700. This way, the lighter font will be used. No new tests because quirks cannot be tested. * css/CSSFontSelector.cpp: (WebCore::resolveGenericFamily): (WebCore::CSSFontSelector::fontRangesForFamily): * page/Quirks.cpp: (WebCore::Quirks::shouldLightenJapaneseBoldSansSerif const): * page/Quirks.h: Source/WTF: * wtf/Platform.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248018 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-07-30 Myles C. Maxfield REGRESSION(r241288): Text on Yahoo Japan mobile looks too bold https://bugs.webkit.org/show_bug.cgi?id=200065 Reviewed by Simon Fraser. * wtf/Platform.h: 2019-07-29 Alan Coon Cherry-pick r247673. rdar://problem/53449723 Speed up HashTable decoding by reserving capacity and avoiding rehashing https://bugs.webkit.org/show_bug.cgi?id=199982 Reviewed by Saam Barati. Source/WebKit: Use HashMap::reserveInitialCapacity() in the HashMap IPC decoder for performance. I measured a ~35% improvement when decoding a very large HashMap of Strings (~160k entries) in the context of the StorageManager::GetValues IPC. * Platform/IPC/ArgumentCoders.h: * Shared/API/c/WKDictionary.cpp: (WKDictionaryCreate): Source/WTF: Introduce reserveInitialCapacity() on HashMap to reserve capacity on a HashMap and cut down on rehashing cost when possible. * wtf/HashMap.h: * wtf/HashTable.h: (WTF::HashTable::reserveInitialCapacity): * wtf/persistence/PersistentCoders.h: Use HashMap::reserveInitialCapacity() in the HashMap persistent decoder for performance. Tools: Add API test coverage. * TestWebKitAPI/Tests/WTF/HashMap.cpp: (TestWebKitAPI::TEST): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@247673 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-07-20 Chris Dumez Speed up HashTable decoding by reserving capacity and avoiding rehashing https://bugs.webkit.org/show_bug.cgi?id=199982 Reviewed by Saam Barati. Introduce reserveInitialCapacity() on HashMap to reserve capacity on a HashMap and cut down on rehashing cost when possible. * wtf/HashMap.h: * wtf/HashTable.h: (WTF::HashTable::reserveInitialCapacity): * wtf/persistence/PersistentCoders.h: Use HashMap::reserveInitialCapacity() in the HashMap persistent decoder for performance. 2019-07-29 Alan Coon Cherry-pick r247837. rdar://problem/53648220 Add helper for ignoring deprecated implementation warnings https://bugs.webkit.org/show_bug.cgi?id=200135 Reviewed by Wenson Hsieh. Add ALLOW_DEPRECATED_IMPLEMENTATIONS_BEGIN/END macro which is IGNORE_WARNINGS_BEGIN("deprecated-implementations") Source/WebCore: * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (-[WebAccessibilityObjectWrapper ALLOW_DEPRECATED_IMPLEMENTATIONS_END]): (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]): (-[WebAccessibilityObjectWrapper accessibilityIsAttributeSettable:]): (-[WebAccessibilityObjectWrapper accessibilityPerformAction:]): (-[WebAccessibilityObjectWrapper accessibilitySetValue:forAttribute:]): (-[WebAccessibilityObjectWrapper accessibilityActionDescription:]): (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]): (-[WebAccessibilityObjectWrapper IGNORE_WARNINGS_END]): Deleted. * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm: (-[WebAVStreamDataParserListener streamDataParserWillProvideContentKeyRequestInitializationData:forTrackID:]): (-[WebAVStreamDataParserListener streamDataParser:didProvideContentKeyRequestInitializationData:forTrackID:]): * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm: (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveAuthenticationChallenge:]): (-[WebCoreResourceHandleAsOperationQueueDelegate connection:canAuthenticateAgainstProtectionSpace:]): Source/WebKit: * UIProcess/API/Cocoa/LegacyBundleForClass.mm: * UIProcess/API/Cocoa/WKBrowsingContextController.mm: (IGNORE_WARNINGS_BEGIN): Deleted. * UIProcess/API/Cocoa/WKBrowsingContextGroup.mm: (IGNORE_WARNINGS_BEGIN): Deleted. * UIProcess/API/Cocoa/WKConnection.mm: (IGNORE_WARNINGS_BEGIN): Deleted. * UIProcess/API/Cocoa/WKPreviewElementInfo.mm: * UIProcess/API/Cocoa/WKProcessGroup.mm: (IGNORE_WARNINGS_BEGIN): Deleted. * UIProcess/API/Cocoa/WKTypeRefWrapper.mm: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView ALLOW_DEPRECATED_IMPLEMENTATIONS_END]): (-[WKWebView draggedImage:endedAt:operation:]): (-[WKWebView accessibilityAttributeValue:]): (-[WKWebView accessibilityAttributeValue:forParameter:]): (-[WKWebView namesOfPromisedFilesDroppedAtDestination:]): (-[WKWebView IGNORE_WARNINGS_END]): Deleted. * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: (-[WKWebViewConfiguration ALLOW_DEPRECATED_IMPLEMENTATIONS_END]): (-[WKWebViewConfiguration _setWebsiteDataStore:]): (-[WKWebViewConfiguration IGNORE_WARNINGS_END]): Deleted. * UIProcess/API/Cocoa/_WKWebsiteDataStore.mm: * UIProcess/API/mac/WKView.mm: (-[WKView ALLOW_DEPRECATED_IMPLEMENTATIONS_END]): (-[WKView draggedImage:endedAt:operation:]): (-[WKView accessibilityAttributeValue:]): (-[WKView accessibilityAttributeValue:forParameter:]): (-[WKView namesOfPromisedFilesDroppedAtDestination:]): (-[WKView IGNORE_WARNINGS_END]): Deleted. * UIProcess/WKImagePreviewViewController.mm: (-[WKImagePreviewViewController ALLOW_DEPRECATED_IMPLEMENTATIONS_END]): (-[WKImagePreviewViewController IGNORE_WARNINGS_END]): Deleted. * UIProcess/ios/forms/WKAirPlayRoutePicker.mm: (-[WKAirPlayRoutePicker popoverControllerDidDismissPopover:]): * UIProcess/ios/forms/WKFileUploadPanel.mm: (-[WKFileUploadPanel popoverControllerDidDismissPopover:]): * UIProcess/ios/forms/WKFormPopover.mm: (-[WKRotatingPopover popoverControllerDidDismissPopover:]): * WebProcess/Plugins/PDF/PDFPlugin.mm: (-[WKPDFPluginAccessibilityObject ALLOW_DEPRECATED_IMPLEMENTATIONS_END]): (-[WKPDFPluginAccessibilityObject accessibilityAttributeValue:]): (-[WKPDFPluginAccessibilityObject accessibilityAttributeValue:forParameter:]): (-[WKPDFPluginAccessibilityObject accessibilityPerformAction:]): (-[WKPDFPluginAccessibilityObject accessibilityIsAttributeSettable:]): (-[WKPDFPluginAccessibilityObject accessibilitySetValue:forAttribute:]): (-[WKPDFPluginAccessibilityObject IGNORE_WARNINGS_END]): Deleted. * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm: (-[WKAccessibilityWebPageObject ALLOW_DEPRECATED_IMPLEMENTATIONS_END]): (-[WKAccessibilityWebPageObject accessibilityIsAttributeSettable:]): (-[WKAccessibilityWebPageObject accessibilitySetValue:forAttribute:]): (-[WKAccessibilityWebPageObject accessibilityAttributeValue:]): (-[WKAccessibilityWebPageObject accessibilityAttributeValue:forParameter:]): (-[WKAccessibilityWebPageObject IGNORE_WARNINGS_END]): Deleted. Source/WebKitLegacy/mac: * Misc/WebDownload.mm: (-[WebDownload initWithRequest:delegate:]): * Misc/WebIconDatabase.mm: * Plugins/WebBaseNetscapePluginView.mm: (-[WebBaseNetscapePluginView ALLOW_DEPRECATED_IMPLEMENTATIONS_END]): (-[WebBaseNetscapePluginView IGNORE_WARNINGS_END]): Deleted. * WebView/WebDynamicScrollBarsView.mm: (-[WebDynamicScrollBarsView ALLOW_DEPRECATED_IMPLEMENTATIONS_END]): (-[WebDynamicScrollBarsView IGNORE_WARNINGS_END]): Deleted. * WebView/WebHTMLView.mm: (-[WebHTMLView draggingSourceOperationMaskForLocal:]): (-[WebHTMLView draggedImage:endedAt:operation:]): (-[WebHTMLView namesOfPromisedFilesDroppedAtDestination:]): (-[WebHTMLView accessibilityAttributeValue:]): (-[WebHTMLView ALLOW_DEPRECATED_IMPLEMENTATIONS_END]): (-[WebHTMLView characterIndexForPoint:]): (-[WebHTMLView firstRectForCharacterRange:]): (-[WebHTMLView attributedSubstringFromRange:]): (-[WebHTMLView setMarkedText:selectedRange:]): (-[WebHTMLView doCommandBySelector:]): (-[WebHTMLView insertText:]): (-[WebHTMLView IGNORE_WARNINGS_END]): Deleted. Source/WTF: * wtf/Compiler.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@247837 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-07-25 Dean Jackson Add helper for ignoring deprecated implementation warnings https://bugs.webkit.org/show_bug.cgi?id=200135 Reviewed by Wenson Hsieh. Add ALLOW_DEPRECATED_IMPLEMENTATIONS_BEGIN/END macro which is IGNORE_WARNINGS_BEGIN("deprecated-implementations") * wtf/Compiler.h: 2019-07-29 Alan Coon Cherry-pick r247714. rdar://problem/53647616 [bmalloc] Each IsoPage gets 1MB VA because VMHeap::tryAllocateLargeChunk rounds up https://bugs.webkit.org/show_bug.cgi?id=200024 Reviewed by Saam Barati. Source/bmalloc: When we allocate IsoHeap's page, we reused VMHeap::tryAllocateLargeChunk. However, this function is originally designed to be used for Large allocation in bmalloc (e.g. allocating Chunk in bmalloc). As a result, this function rounds up the requested size with 1MB (bmalloc::chunkSize). As a result, all IsoHeap's 16KB page gets 1MB VA while it just uses 16KB of the allocated region. This leads to VA exhaustion since IsoHeap now uses 64x VA than we expected! This patch fixes the above VA exhaustion issue by allocating a page by using tryVMAllocate. When allocating a page, we start using a VM tag for IsoHeap. We discussed at e-mail and we decided reusing a VM tag previously assigned to CLoop Stack since this is less profitable. Since this tag is not Malloc-related tag, Leaks tool can scan memory region conservatively without registering allocated region into Zone, which was previously done in VMHeap and that's why we reused VMHeap for IsoHeap. * bmalloc/BVMTags.h: * bmalloc/IsoPage.cpp: (bmalloc::IsoPageBase::allocatePageMemory): * bmalloc/IsoTLS.cpp: (bmalloc::IsoTLS::ensureEntries): * bmalloc/VMAllocate.h: (bmalloc::vmAllocate): Source/JavaScriptCore: Discussed and we decided to use this VM tag for IsoHeap instead of CLoop stack. * interpreter/CLoopStack.cpp: (JSC::CLoopStack::CLoopStack): Source/WebCore: Changed how we interpret VM tags. Add IsoHeap VM tag support, and rename WebAssembly tag to Gigacage tag. * page/ResourceUsageData.h: * page/ResourceUsageOverlay.h: * page/cocoa/ResourceUsageOverlayCocoa.mm: (WebCore::HistoricResourceUsageData::HistoricResourceUsageData): * page/cocoa/ResourceUsageThreadCocoa.mm: (WebCore::displayNameForVMTag): (WebCore::categoryForVMTag): Source/WTF: Start using a VM tag for IsoHeap instead of CLoop Stack. * wtf/OSAllocator.h: * wtf/VMTags.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@247714 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-07-22 Yusuke Suzuki [bmalloc] Each IsoPage gets 1MB VA because VMHeap::tryAllocateLargeChunk rounds up https://bugs.webkit.org/show_bug.cgi?id=200024 Reviewed by Saam Barati. Start using a VM tag for IsoHeap instead of CLoop Stack. * wtf/OSAllocator.h: * wtf/VMTags.h: 2019-07-24 Alan Coon Cherry-pick r247754. rdar://problem/53483290 Enable HAVE_APP_LINKS_WITH_ISENABLED for entire iOS family https://bugs.webkit.org/show_bug.cgi?id=200040 Reviewed by Tim Horton. This feature was enabled for just iOS, but should be enabled for tvOS and watchOS, too. * wtf/Platform.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@247754 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-07-23 Keith Rollin Enable HAVE_APP_LINKS_WITH_ISENABLED for entire iOS family https://bugs.webkit.org/show_bug.cgi?id=200040 Reviewed by Tim Horton. This feature was enabled for just iOS, but should be enabled for tvOS and watchOS, too. * wtf/Platform.h: 2019-07-23 Alan Coon Revert r247673. rdar://problem/53449723 2019-07-23 Alan Coon Cherry-pick r247673. rdar://problem/53449723 Speed up HashTable decoding by reserving capacity and avoiding rehashing https://bugs.webkit.org/show_bug.cgi?id=199982 Reviewed by Saam Barati. Source/WebKit: Use HashMap::reserveInitialCapacity() in the HashMap IPC decoder for performance. I measured a ~35% improvement when decoding a very large HashMap of Strings (~160k entries) in the context of the StorageManager::GetValues IPC. * Platform/IPC/ArgumentCoders.h: * Shared/API/c/WKDictionary.cpp: (WKDictionaryCreate): Source/WTF: Introduce reserveInitialCapacity() on HashMap to reserve capacity on a HashMap and cut down on rehashing cost when possible. * wtf/HashMap.h: * wtf/HashTable.h: (WTF::HashTable::reserveInitialCapacity): * wtf/persistence/PersistentCoders.h: Use HashMap::reserveInitialCapacity() in the HashMap persistent decoder for performance. Tools: Add API test coverage. * TestWebKitAPI/Tests/WTF/HashMap.cpp: (TestWebKitAPI::TEST): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@247673 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-07-20 Chris Dumez Speed up HashTable decoding by reserving capacity and avoiding rehashing https://bugs.webkit.org/show_bug.cgi?id=199982 Reviewed by Saam Barati. Introduce reserveInitialCapacity() on HashMap to reserve capacity on a HashMap and cut down on rehashing cost when possible. * wtf/HashMap.h: * wtf/HashTable.h: (WTF::HashTable::reserveInitialCapacity): * wtf/persistence/PersistentCoders.h: Use HashMap::reserveInitialCapacity() in the HashMap persistent decoder for performance. 2019-07-18 Alan Coon Cherry-pick r247566. rdar://problem/53279081 Make sure to set kCTFontFallbackOptionAttribute to kCTFontFallbackOptionSystem for system fonts https://bugs.webkit.org/show_bug.cgi?id=199769 Reviewed by Myles C. Maxfield. Source/WebCore: When getting a system font, set the appropriate attribute so that it does not fallback to a user initiated font. Add an ASSERT that checks that the font in use is not a user font if policy is to not use user installed fonts. Tests: fast/text/user-installed-fonts/extended-character-with-user-font.html fast/text/user-installed-fonts/extended-character.html * platform/graphics/Font.h: * platform/graphics/FontCascadeFonts.cpp: (WebCore::FontCascadeFonts::glyphDataForSystemFallback): * platform/graphics/cocoa/FontCacheCoreText.cpp: (WebCore::preparePlatformFont): (WebCore::FontDatabase::singletonAllowingUserInstalledFonts): (WebCore::FontDatabase::singletonDisallowingUserInstalledFonts): (WebCore::addAttributesForInstalledFonts): (WebCore::addAttributesForWebFonts): (WebCore::installedFontMandatoryAttributes): * platform/graphics/mac/SimpleFontDataCoreText.cpp: (WebCore::Font::isUserInstalledFont const): Source/WTF: * wtf/Platform.h: Tools: Add a font containing one extended character not found in system fonts. * WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj: * WebKitTestRunner/fonts/FakeHelvetica-SingleExtendedCharacter.ttf: Added. LayoutTests: Tests require WTR and recent MacOS, hence why they are disabled elsewhere. * TestExpectations: * platform/mac-wk2/TestExpectations: * fast/text/user-installed-fonts/extended-character-expected.html: Added. * fast/text/user-installed-fonts/extended-character-with-user-font-expected-mismatch.html: Added. * fast/text/user-installed-fonts/extended-character-with-user-font.html: Added. * fast/text/user-installed-fonts/extended-character.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@247566 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-07-18 Youenn Fablet Make sure to set kCTFontFallbackOptionAttribute to kCTFontFallbackOptionSystem for system fonts https://bugs.webkit.org/show_bug.cgi?id=199769 Reviewed by Myles C. Maxfield. * wtf/Platform.h: 2019-07-17 Kocsen Chung Cherry-pick r247482. rdar://problem/53229731 New York font erroneously gets synthetic bold https://bugs.webkit.org/show_bug.cgi?id=199653 Unreviewed MacCatalyst build fix. * wtf/Platform.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@247482 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-07-16 Myles C. Maxfield New York font erroneously gets synthetic bold https://bugs.webkit.org/show_bug.cgi?id=199653 Unreviewed MacCatalyst build fix. * wtf/Platform.h: 2019-07-17 Kocsen Chung Cherry-pick r247465. rdar://problem/53229731 New York font erroneously gets synthetic bold https://bugs.webkit.org/show_bug.cgi?id=199653 Unreviewed watchOS build fix. Source/WebCore: * page/ProcessWarming.cpp: (WebCore::ProcessWarming::prewarmGlobally): * page/cocoa/MemoryReleaseCocoa.mm: (WebCore::platformReleaseMemory): * platform/graphics/FontCascadeDescription.cpp: * platform/graphics/FontDescription.h: * platform/graphics/cocoa/FontCacheCoreText.cpp: (WebCore::invalidateFontCache): (WebCore::lookupFallbackFont): * platform/graphics/cocoa/FontDescriptionCocoa.cpp: (WebCore::FontCascadeDescription::effectiveFamilyAt const): * platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp: (WebCore::FontFamilySpecificationCoreText::fontRanges const): * platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp: Source/WTF: * wtf/Platform.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@247465 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-07-15 Myles C. Maxfield New York font erroneously gets synthetic bold https://bugs.webkit.org/show_bug.cgi?id=199653 Unreviewed watchOS build fix. * wtf/Platform.h: 2019-07-17 Kocsen Chung Cherry-pick r247461. rdar://problem/53229637 Make WKURLSchemeTask thread safe. and https://bugs.webkit.org/show_bug.cgi?id=199764 Reviewed by Alex Christensen. Source/WebKit: Punt most of the WKURLSchemeTask operations back to the main thread. Make accessing the NSURLRequest be thread safe with lock protection. * UIProcess/API/Cocoa/WKURLSchemeTask.mm: (getExceptionTypeFromMainRunLoop): (-[WKURLSchemeTaskImpl dealloc]): (-[WKURLSchemeTaskImpl request]): (-[WKURLSchemeTaskImpl _requestOnlyIfCached]): (-[WKURLSchemeTaskImpl didReceiveResponse:]): (-[WKURLSchemeTaskImpl didReceiveData:]): (-[WKURLSchemeTaskImpl didFinish]): (-[WKURLSchemeTaskImpl didFailWithError:]): (-[WKURLSchemeTaskImpl _didPerformRedirection:newRequest:]): * UIProcess/WebURLSchemeTask.cpp: (WebKit::WebURLSchemeTask::WebURLSchemeTask): (WebKit::WebURLSchemeTask::~WebURLSchemeTask): (WebKit::WebURLSchemeTask::didPerformRedirection): (WebKit::WebURLSchemeTask::didReceiveResponse): (WebKit::WebURLSchemeTask::didReceiveData): (WebKit::WebURLSchemeTask::didComplete): (WebKit::WebURLSchemeTask::pageDestroyed): (WebKit::WebURLSchemeTask::stop): (WebKit::WebURLSchemeTask::nsRequest const): * UIProcess/WebURLSchemeTask.h: (WebKit::WebURLSchemeTask::identifier const): (WebKit::WebURLSchemeTask::pageID const): (WebKit::WebURLSchemeTask::process): (WebKit::WebURLSchemeTask::process const): Deleted. (WebKit::WebURLSchemeTask::request const): Deleted. Source/WTF: * wtf/MainThread.cpp: (WTF::callOnMainAndWait): (WTF::callOnMainRunLoopAndWait): (WTF::callOnMainThreadAndWait): * wtf/MainThread.h: Tools: * TestWebKitAPI/Tests/WebKitCocoa/WKURLSchemeHandler-1.mm: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@247461 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-07-15 Brady Eidson Make WKURLSchemeTask thread safe. and https://bugs.webkit.org/show_bug.cgi?id=199764 Reviewed by Alex Christensen. * wtf/MainThread.cpp: (WTF::callOnMainAndWait): (WTF::callOnMainRunLoopAndWait): (WTF::callOnMainThreadAndWait): * wtf/MainThread.h: 2019-07-17 Kocsen Chung Cherry-pick r247454. rdar://problem/53229624 MacCatalyst asserts when command key is raised https://bugs.webkit.org/show_bug.cgi?id=199805 Reviewed by Tim Horton. Add USE_UIKIT_KEYBOARD_ADDITIONS for iOS 13+ and macCatalyst. * wtf/FeatureDefines.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@247454 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-07-15 Dean Jackson MacCatalyst asserts when command key is raised https://bugs.webkit.org/show_bug.cgi?id=199805 Reviewed by Tim Horton. Add USE_UIKIT_KEYBOARD_ADDITIONS for iOS 13+ and macCatalyst. * wtf/FeatureDefines.h: 2019-07-17 Kocsen Chung Cherry-pick r247377. rdar://problem/53229731 New York font erroneously gets synthetic bold https://bugs.webkit.org/show_bug.cgi?id=199653 Reviewed by Simon Fraser. Source/WebCore: This patch adds support for -apple-system-ui-serif, -apple-system-ui-monospaced, and -apple-system-ui-rounded, behind an SPI that is off-by-default. We don't want to expose these fonts to the web because we don't a standardization story for them yet, but we do want some apps to be able to use them. WebKit clients who want to use these fonts can set -[WKPreferences _shouldAllowDesignSystemUIFonts] = YES. The patch generalizes our existing system-ui infrastructure to handle these three additional fonts. It also explicitly disables the unsupported dot-prefixed names so they don't leak out into Web content. Tests: fast/text/design-system-ui-10.html fast/text/design-system-ui-11.html fast/text/design-system-ui-12.html fast/text/design-system-ui-13.html fast/text/design-system-ui-14.html fast/text/design-system-ui-15.html fast/text/design-system-ui-16.html fast/text/design-system-ui-2.html fast/text/design-system-ui-3.html fast/text/design-system-ui-4.html fast/text/design-system-ui-5.html fast/text/design-system-ui-6.html fast/text/design-system-ui-7.html fast/text/design-system-ui-8.html fast/text/design-system-ui-9.html fast/text/design-system-ui.html * css/CSSFontFace.cpp: (WebCore::CSSFontFace::shouldAllowDesignSystemUIFonts const): * css/CSSFontFace.h: * css/CSSFontFaceSource.cpp: (WebCore::CSSFontFaceSource::load): * css/StyleResolver.cpp: (WebCore::StyleResolver::initializeFontStyle): * page/Settings.yaml: * platform/graphics/FontDescription.cpp: (WebCore::m_shouldAllowDesignSystemUIFonts): (WebCore::m_shouldAllowUserInstalledFonts): Deleted. * platform/graphics/FontDescription.h: (WebCore::FontDescription::shouldAllowDesignSystemUIFonts const): (WebCore::FontDescription::setShouldAllowDesignSystemUIFonts): (WebCore::FontDescription::operator== const): * platform/graphics/cocoa/FontCacheCoreText.cpp: (WebCore::platformFontLookupWithFamily): (WebCore::fontWithFamily): * platform/graphics/cocoa/FontCacheCoreText.h: * platform/graphics/cocoa/FontDescriptionCocoa.cpp: (WebCore::systemFontUse): (WebCore::systemFontCascadeList): (WebCore::FontCascadeDescription::effectiveFamilyCount const): (WebCore::FontCascadeDescription::effectiveFamilyAt const): (WebCore::isSystemFontString): Deleted. (WebCore::isUIFontTextStyle): Deleted. * platform/graphics/cocoa/FontPlatformDataCocoa.mm: (WebCore::FontPlatformData::ctFont const): * platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp: (WebCore::SystemFontDatabaseCoreText::createSystemUI): (WebCore::SystemFontDatabaseCoreText::createDesignSystemUI): (WebCore::SystemFontDatabaseCoreText::createTextStyle): (WebCore::SystemFontDatabaseCoreText::cascadeList): (WebCore::SystemFontDatabaseCoreText::applyWeightItalicsAndFallbackBehavior): (WebCore::SystemFontDatabaseCoreText::systemFontParameters): * platform/graphics/cocoa/SystemFontDatabaseCoreText.h: * platform/graphics/ios/FontCacheIOS.mm: (WebCore::platformFontWithFamilySpecialCase): * platform/graphics/mac/FontCacheMac.mm: (WebCore::platformFontWithFamilySpecialCase): * style/StyleResolveForDocument.cpp: (WebCore::Style::resolveForDocument): * svg/graphics/SVGImage.cpp: (WebCore::SVGImage::dataChanged): * testing/InternalSettings.cpp: (WebCore::InternalSettings::Backup::Backup): (WebCore::InternalSettings::Backup::restoreTo): (WebCore::InternalSettings::setShouldAllowDesignSystemUIFonts): * testing/InternalSettings.h: * testing/InternalSettings.idl: Source/WebCore/PAL: * pal/spi/cocoa/CoreTextSPI.h: Source/WebKit: Add the SPI to enable the new fonts. * Shared/WebPreferences.yaml: * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetShouldAllowDesignSystemUIFonts): (WKPreferencesGetShouldAllowDesignSystemUIFonts): * UIProcess/API/C/WKPreferencesRefPrivate.h: * UIProcess/API/Cocoa/WKPreferences.mm: (-[WKPreferences _shouldAllowDesignSystemUIFonts]): (-[WKPreferences _setShouldAllowDesignSystemUIFonts:]): * UIProcess/API/Cocoa/WKPreferencesPrivate.h: Source/WTF: * wtf/Platform.h: LayoutTests: * TestExpectations: * fast/text/design-system-ui-10-expected-mismatch.html: Added. * fast/text/design-system-ui-10.html: Added. * fast/text/design-system-ui-11-expected-mismatch.html: Added. * fast/text/design-system-ui-11.html: Added. * fast/text/design-system-ui-12-expected-mismatch.html: Added. * fast/text/design-system-ui-12.html: Added. * fast/text/design-system-ui-13-expected-mismatch.html: Added. * fast/text/design-system-ui-13.html: Added. * fast/text/design-system-ui-14-expected-mismatch.html: Added. * fast/text/design-system-ui-14.html: Added. * fast/text/design-system-ui-15-expected-mismatch.html: Added. * fast/text/design-system-ui-15.html: Added. * fast/text/design-system-ui-16-expected-mismatch.html: Added. * fast/text/design-system-ui-16.html: Added. * fast/text/design-system-ui-2-expected.html: Added. * fast/text/design-system-ui-2.html: Added. * fast/text/design-system-ui-3-expected-mismatch.html: Added. * fast/text/design-system-ui-3.html: Added. * fast/text/design-system-ui-4-expected-mismatch.html: Added. * fast/text/design-system-ui-4.html: Added. * fast/text/design-system-ui-5-expected-mismatch.html: Added. * fast/text/design-system-ui-5.html: Added. * fast/text/design-system-ui-6-expected.html: Added. * fast/text/design-system-ui-6.html: Added. * fast/text/design-system-ui-7-expected.html: Added. * fast/text/design-system-ui-7.html: Added. * fast/text/design-system-ui-8-expected-mismatch.html: Added. * fast/text/design-system-ui-8.html: Added. * fast/text/design-system-ui-9-expected-mismatch.html: Added. * fast/text/design-system-ui-9.html: Added. * fast/text/design-system-ui-expected.html: Added. * fast/text/design-system-ui.html: Added. * platform/mac/TestExpectations: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@247377 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-07-11 Myles C. Maxfield New York font erroneously gets synthetic bold https://bugs.webkit.org/show_bug.cgi?id=199653 Reviewed by Simon Fraser. * wtf/Platform.h: 2019-07-15 Alan Coon Revert r247377. rdar://problem/53125241 2019-07-14 Chris Dumez Add threading assertion to WeakPtrFactory::createWeakPtr() https://bugs.webkit.org/show_bug.cgi?id=199639 Reviewed by Ryosuke Niwa. Add threading assertion to WeakPtrFactory::createWeakPtr() to make sure it is called on the same thread where the WeakPtrFactory wad constructed. * wtf/WeakPtr.h: (WTF::WeakPtrFactory::WeakPtrFactory): (WTF::WeakPtrFactory::createWeakPtr const): 2019-07-14 Dean Jackson WebGL not supported on WKWebView on UIKit for Mac https://bugs.webkit.org/show_bug.cgi?id=199785 Reviewed by Antoine Quint. MacCatalyst has Apple Graphics Control, although this area is very messy, see . * wtf/Platform.h: 2019-07-11 Myles C. Maxfield New York font erroneously gets synthetic bold https://bugs.webkit.org/show_bug.cgi?id=199653 Reviewed by Simon Fraser. * wtf/Platform.h: 2019-07-11 Pablo Saavedra [WPE][GTK] Build failure with ENABLE_ACCESSIBILITY=OFF https://bugs.webkit.org/show_bug.cgi?id=199625 Added ENABLE(ACCESSIBILITY) and replaced HAVE(ACCESSIBILITY) with ENABLE(ACCESSIBILITY) in the code. Additionally, the TestRunner code generator now honors the Conditional IDL format. Reviewed by Konstantin Tokarev. * wtf/FeatureDefines.h: * wtf/Platform.h: 2019-07-10 Ryan Haddad Unreviewed, rolling out r247286. Caused TestWTF.WTF.StringOperators to fail on debug bots Reverted changeset: "Add StringBuilder member function which allows makeString() style variadic argument construction" https://bugs.webkit.org/show_bug.cgi?id=198997 https://trac.webkit.org/changeset/247286 2019-07-09 Michael Catanzaro [WPE][GTK] GUniqueOutPtr::release should return a raw pointer https://bugs.webkit.org/show_bug.cgi?id=199579 Reviewed by Carlos Garcia Campos. GUniqueOutPtr::release should release to a raw pointer, rather than a GUniquePtr. If a GUniquePtr is desired, it's trivial to construct one from the raw pointer, but all existing callsites under Source/ would rather have a raw pointer. Currently they have to call release().release() to get the raw pointer, which is annoying. * wtf/glib/GUniquePtr.h: (WTF::GUniqueOutPtr::release): 2019-07-09 Sam Weinig Add StringBuilder member function which allows makeString() style variadic argument construction https://bugs.webkit.org/show_bug.cgi?id=198997 Reviewed by Darin Adler. Adds new StringBuilder::flexibleAppend(...) member function which allows passing one or more string-adaptable (in the sense that there is StringTypeAdapter specialization for the type) parameters. This re-ususes the variadic template infrastructure in StringConcatenate.h that is used for makeString(...) allowing for improvements in one to benefit the other. The advantage of StringBuilder::flexibleAppend(...) over calling StringBuilder::append(...) multiple times (beyond the code sharing with makeString(...) is that it can avoid unnecessary additional re-allocations when the StringBuilder needs to expand it's capacity. It does this by computing the complete required length for all the passed arguments and then ensuring enough capacity is available. It also reduces the allocation overhead versus the anti-pattern of builder.append(makeString(...)). Ideally, this member function should eventually just be called StringBuilder::append(...), but the current overload set for StringBuilder::append(...) makes this complicated due to overloads that take two arguments such as StringBuilder::append(const UChar*, unsigned). Going forward, we should rename or remove those overloads and move to a standard interface. * wtf/posix/FileSystemPOSIX.cpp: (WTF::FileSystemImpl::pathByAppendingComponents): Adopt StringBuilder::flexibleAppend, using to combine the append of '/' and component. * wtf/text/StringBuilder.cpp: (WTF::StringBuilder::appendUninitialized): (WTF::StringBuilder::appendUninitializedWithoutOverflowCheck): Extract the part of appendUnitialized that doesn't do the overflow check into it's own member function to allow callers that have already done the overflow check to bypass it. (WTF::StringBuilder::appendUninitializedWithoutOverflowCheckForUChar): (WTF::StringBuilder::appendUninitializedWithoutOverflowCheckForLChar): Added to allow template member function flexibleAppendFromAdapters to call appendUninitializedWithoutOverflowCheck without moving it to the header. * wtf/text/StringBuilder.h: (WTF::StringBuilder::flexibleAppendFromAdapters): (WTF::StringBuilder::flexibleAppend): Modeled on tryMakeStringFromAdapters in StringConcatenate.h, these eagerly compute the required length, expand the buffer and then use the existing string type adaptor accumulation functions used by makeString. * wtf/text/StringConcatenate.h: (WTF::stringTypeAdapterAccumulator): (WTF::tryMakeStringFromAdapters): (WTF::makeStringAccumulator): Deleted. Renames makeStringAccumulator to stringTypeAdapterAccumulator now that it is used by more than just makeString. 2019-07-09 Alex Christensen When parsing an IPv4 address, wait until after deciding it is indeed an IPv4 address before reporting syntax violations https://bugs.webkit.org/show_bug.cgi?id=199628 Reviewed by Brady Eidson. Otherwise, we sometimes report syntax violations on things that are not IPv4 addresses and don't have syntax violations. I added a unit test with one such URL that used to cause an assertion. * wtf/URLParser.cpp: (WTF::URLParser::parseIPv4Host): 2019-07-09 Alex Christensen Remove invalid assertion in URLParser::domainToASCII https://bugs.webkit.org/show_bug.cgi?id=199624 Reviewed by Brady Eidson. When a non-ASCII domain's punycode encoding is longer than 63 characters, the URL is supposed to fail to parse, according to https://www.unicode.org/reports/tr46/#ToASCII We and all other browsers do this. When uidna_nameToASCII tries to punycode encode such a domain, it can return a number larger than 63. In this case, processingDetails.errors is UIDNA_ERROR_LABEL_TOO_LONG and we fail to parse as desired and uidna_nameToASCII did not write out of bounds, so it was just the assertion that was wrong. I added some unit tests that would have hit the assertion and verify that we fail at the correct length. * wtf/URLParser.cpp: (WTF::URLParser::domainToASCII): 2019-07-09 Alex Christensen URLParser should reserialize IPv6 addresses that end with a colon https://bugs.webkit.org/show_bug.cgi?id=199627 Reviewed by Brady Eidson. When an IPv6 address ends in a colon, the colon should be removed which means the serialized output is different than the input, which the URLParser calls a syntax violation. This matches the URL specification, and I added a unit test that used to assert. * wtf/URLParser.cpp: (WTF::URLParser::parseIPv6Host): 2019-07-08 Chris Dumez Use WeakHashSet for WebUserContentControllerProxy::m_processes https://bugs.webkit.org/show_bug.cgi?id=199591 Reviewed by Youenn Fablet. Update WeakHashSet::add() to return an AddResult type, similarly to our other containers. * wtf/WeakHashSet.h: (WTF::WeakHashSet::add): 2019-07-08 Christopher Reid Implement MappedFileData for Windows https://bugs.webkit.org/show_bug.cgi?id=198269 Reviewed by Darin Adler. Original patch by Fujii Hironori. Add Windows implementations for MappedFileData constructor and destructor. * wtf/FileSystem.cpp: * wtf/FileSystem.h: * wtf/win/FileSystemWin.cpp: 2019-07-08 Chris Dumez Add threading assertion to WTF::CompletionHandler https://bugs.webkit.org/show_bug.cgi?id=199516 Reviewed by Alex Christensen. Add threading assertion to WTF::CompletionHandler to try and catch common cases of unsafe usage (completion handler constructed on one thread but called on another). * wtf/CompletionHandler.h: (WTF::CompletionHandler [Pointer Events] Enable only on the most recent version of the supported iOS family https://bugs.webkit.org/show_bug.cgi?id=199562 Reviewed by Dean Jackson. We really don't need HAVE_UI_WEB_TOUCH_EVENTS_GESTURE_RECOGNIZER_WITH_ACTIVE_TOUCHES_BY_ID since the UIKit SPI that was added in iOS 13 that it's checking for is really required for all parts of the implementation of Pointer Events, including dispatch of the "pointercancel" event and support for the "touch-action" CSS property. * wtf/Platform.h: 2019-07-05 Ryan Haddad Unreviewed, rolling out r247115. Breaks lldbWebKitTester (and by extension, test-webkitpy) Reverted changeset: "[WHLSL] Standard library is too big to directly include in WebCore" https://bugs.webkit.org/show_bug.cgi?id=198186 https://trac.webkit.org/changeset/247115 2019-07-03 Jonathan Bedard [Catalina] Enable WebKit build https://bugs.webkit.org/show_bug.cgi?id=199209 Reviewed by Darin Adler. * wtf/spi/cocoa/SecuritySPI.h: Declare SecTrustedApplicationCreateFromPath(...). 2019-07-03 Keith Miller PACCage should first cage leaving PAC bits intact then authenticate https://bugs.webkit.org/show_bug.cgi?id=199372 Reviewed by Saam Barati. * wtf/CagedPtr.h: (WTF::CagedPtr::get const): (WTF::CagedPtr::getMayBeNull const): (WTF::CagedPtr::mergePointers): 2019-07-03 Ryan Haddad Unreviewed, rolling out r246616. Caused http/tests/inspector/network/har/har-page.html to fail on Catalina. Reverted changeset: "Web Inspector: Network: replace CFNetwork SPI with new API where able" https://bugs.webkit.org/show_bug.cgi?id=198762 https://trac.webkit.org/changeset/246616 2019-07-02 Commit Queue Unreviewed, rolling out r247041. https://bugs.webkit.org/show_bug.cgi?id=199425 broke some iOS arm64e tests (Requested by keith_miller on #webkit). Reverted changeset: "PACCage should first cage leaving PAC bits intact then authenticate" https://bugs.webkit.org/show_bug.cgi?id=199372 https://trac.webkit.org/changeset/247041 2019-07-02 Chris Dumez ThreadSafeRefCounted is not safe to use in the UIProcess https://bugs.webkit.org/show_bug.cgi?id=199420 Reviewed by Ryosuke Niwa. * wtf/MainThread.cpp: (WTF::isMainRunLoop): (WTF::callOnMainRunLoop): * wtf/MainThread.h: Add some function to MainThread.h to be used by ThreadSafeRefCounted to interact with the main RunLoop. This is used to avoid a circular dependency between RunLoop (which is ThreadSafeRefCounted) and ThreadSafeReCounted. * wtf/ThreadSafeRefCounted.h: (WTF::ThreadSafeRefCounted::deref const): Add a new DestructionThread::MainRunLoop enum value to be used by classes that need to be destroyed on the main RunLoop rather than the main thread (which may be different when WK1 is invoved) 2019-07-02 Robin Morisset [WHLSL] the initializer in VariableDeclaration should be a std::unique_ptr, not Optional> https://bugs.webkit.org/show_bug.cgi?id=199389 Reviewed by Sam Weinig. * wtf/UniqueRef.h: (WTF::UniqueRef::moveToUniquePtr): Added. 2019-07-02 Keith Miller PACCage should first cage leaving PAC bits intact then authenticate https://bugs.webkit.org/show_bug.cgi?id=199372 Reviewed by Saam Barati. * wtf/CagedPtr.h: (WTF::CagedPtr::get const): (WTF::CagedPtr::getMayBeNull const): (WTF::CagedPtr::mergePointers): 2019-07-01 Philippe Normand [GStreamer] Cannot play Bert's Bytes radio stream from http://radio.dos.nl/ https://bugs.webkit.org/show_bug.cgi?id=198376 Reviewed by Xabier Rodriguez-Calvar. * wtf/glib/GLibUtilities.h: (enumToString): Utility function to get a string representation of of a GLib enum. 2019-06-22 Darin Adler Streamline some string code, focusing on functions that were using substringSharingImpl https://bugs.webkit.org/show_bug.cgi?id=198898 Reviewed by Daniel Bates. * wtf/URLHelpers.cpp: (WTF::URLHelpers::applyHostNameFunctionToURLString): Change code using substringSharingImpl so it could call String::find to call StringView::contains instead. Also rewrote lambdas to be simpler and likely more efficient. Rewrote another case using substringSharingImpl so it could call String::find to call StringView::find instead. * wtf/text/StringView.cpp: (WTF::StringView::startsWith const): Added. * wtf/text/StringView.h: Tweaked style a bit, and added an overload of StringView::contains that takes a CodeUnitMatchFunction and an overload of startsWith that cakes a UChar. 2019-06-28 Konstantin Tokarev Remove traces of ENABLE_ICONDATABASE remaining after its removal in 219733 https://bugs.webkit.org/show_bug.cgi?id=199317 Reviewed by Michael Catanzaro. While IconDatabase and all code using it was removed, ENABLE_ICONDATABASE still exists as build option and C++ macro. * wtf/FeatureDefines.h: 2019-06-27 Konstantin Tokarev Avoid using WTF::Function for passing local function pointers and closures in URLHelpers.cpp https://bugs.webkit.org/show_bug.cgi?id=199271 Reviewed by Yusuke Suzuki. WTF::Function allocates memory on heap, which is totally redundant in this case. * wtf/URLHelpers.cpp: (WTF::URLHelpers::isSecondLevelDomainNameAllowedByTLDRules): 2019-06-27 Timothy Hatcher Move WebKitLegacy off of a couple AppKit ivars. https://bugs.webkit.org/show_bug.cgi?id=199279 rdar://problem/34983438 Reviewed by Tim Horton. * wtf/Platform.h: Added HAVE_SUBVIEWS_IVAR_SPI. 2019-06-27 Beth Dakin Upstream use of MACCATALYST https://bugs.webkit.org/show_bug.cgi?id=199245 rdar://problem/51687723 Reviewed by Tim Horton. * Configurations/SDKVariant.xcconfig: * wtf/FeatureDefines.h: * wtf/Platform.h: 2019-06-27 Don Olmstead [FTW] Build JavaScriptCore https://bugs.webkit.org/show_bug.cgi?id=199254 Reviewed by Brent Fulgham. * wtf/PlatformFTW.cmake: Added. 2019-06-27 Fujii Hironori [CMake] Bump cmake_minimum_required version to 3.10 https://bugs.webkit.org/show_bug.cgi?id=199181 Reviewed by Don Olmstead. * CMakeLists.txt: 2019-06-26 Konstantin Tokarev Remove unneeded #include https://bugs.webkit.org/show_bug.cgi?id=199228 Reviewed by Michael Catanzaro. * wtf/MemoryPressureHandler.h: 2019-06-26 Myles C. Maxfield REGRESSION: ( r246394 ) webgpu/whlsl-buffer-fragment.html and webgpu/whlsl-buffer-vertex.html are failing https://bugs.webkit.org/show_bug.cgi?id=199012 Reviewed by Saam Barati. * wtf/Platform.h: 2019-06-25 Keith Miller CagedPtr doesn't merge PAC bits back into the resulting caged pointer. https://bugs.webkit.org/show_bug.cgi?id=199214 Reviewed by Yusuke Suzuki. The current code means that caging will just strip the any failed authentication bits. Adding this code doesn't appear to be a regression on iPhone Xs. * wtf/CagedPtr.h: (WTF::CagedPtr::get const): (WTF::CagedPtr::getMayBeNull const): (WTF::CagedPtr::getUnsafe const): (WTF::CagedPtr::mergePointers): 2019-06-25 Sam Weinig Experiment with simple structured bindings use https://bugs.webkit.org/show_bug.cgi?id=198905 Reviewed by Darin Adler. * wtf/URLHelpers.cpp: (WTF::URLHelpers::mapHostNames): Simplify code using c++ structured bindings (https://en.cppreference.com/w/cpp/language/structured_binding) to see if all the platforms will work with it. 2019-06-25 Adam Barth [fuchsia] Update to newer zx_clock_get syscall https://bugs.webkit.org/show_bug.cgi?id=199191 Reviewed by Sam Weinig. Fuchsia has changed the zx_clock_get syscall to return the clock value via an out parameter rather than via its return value. This change makes zx_clock_get consistent with all the other syscalls. This patch updates our use of zx_clock_get to use the new syscall. The old syscall is no longer supported by Fuchsia. * wtf/fuchsia/CPUTimeFuchsia.cpp: (WTF::CPUTime::get): Switch to using the out parameter. (WTF::CPUTime::forCurrentThread): Switch to using the out parameter. 2019-06-25 Michael Catanzaro Fully rename WebKitGTK+ -> WebKitGTK everywhere https://bugs.webkit.org/show_bug.cgi?id=199159 Reviewed by Carlos Garcia Campos. * wtf/URLParser.cpp: (WTF::URLParser::internationalDomainNameTranscoder): 2019-06-25 Michael Catanzaro Require GCC 7 https://bugs.webkit.org/show_bug.cgi?id=198914 Reviewed by Darin Adler. Remove now-stale GCC version check. * wtf/Compiler.h: 2019-06-23 Simon Fraser Add OverflowScrollProxyNodes to the scrolling tree https://bugs.webkit.org/show_bug.cgi?id=199132 Reviewed by Antti Koivisto. Setting indent is useful if you want to make a new stream with the indent of an existing stream. * wtf/text/TextStream.h: (WTF::TextStream::setIndent): 2019-06-20 Fujii Hironori Try to use C++14 std::enable_if_t in CheckedArithmetic.h again https://bugs.webkit.org/show_bug.cgi?id=199099 Reviewed by Ross Kirsling. r242235 changed CheckedArithmetic to not use C++14. Let's try C++14 again. * wtf/CheckedArithmetic.h: Use C++14 std::make_unsigned_t and std::enable_if_t. 2019-06-18 Darin Adler Tidy up the remaining bits of the AtomicString to AtomString rename https://bugs.webkit.org/show_bug.cgi?id=198990 Reviewed by Michael Catanzaro. * wtf/text/AtomString.cpp: Fix a comment. * wtf/text/AtomString.h: Tweak formatting a bit. Use nullptr instead of 0. Removed "using AtomicString = AtomString". * wtf/text/AtomStringImpl.cpp: (WTF::CStringTranslator::translate): Use setIsAtom instead of setIsAtomic. (WTF::UCharBufferTranslator::translate): Ditto. (WTF::HashAndUTF8CharactersTranslator::translate): Ditto. (WTF::SubstringTranslator::translate): Ditto. (WTF::LCharBufferTranslator::translate): Ditto. (WTF::BufferFromStaticDataTranslator::translate): Ditto. (WTF::AtomStringImpl::addSlowCase): Ditto. (WTF::AtomStringImpl::lookUpSlowCase): Updated assertion message. * wtf/text/AtomStringImpl.h: Tweaked the implementation of add. Updated comments to say AtomString. * wtf/text/AtomStringTable.cpp: (WTF::AtomStringTable::~AtomStringTable): Use setIsAtom. * wtf/text/StringImpl.h: Updated name of StringAtomic and s_hashFlagStringKindIsAtom. Renamed to flagIsAtom and setIsAtom. * wtf/text/WTFString.cpp: (WTF::String::isSafeToSendToAnotherThread const): Updated comment. 2019-06-20 Carlos Garcia Campos [GTK] Remove support for GTK2 plugins https://bugs.webkit.org/show_bug.cgi?id=199065 Reviewed by Sergio Villar Senin. * wtf/Platform.h: * wtf/glib/GTypedefs.h: 2019-06-19 Yusuke Suzuki [bmalloc] IsoHeap's initialization is racy with IsoHeap::isInitialized https://bugs.webkit.org/show_bug.cgi?id=199053 Reviewed by Saam Barati. Add constexpr static functions to generate pseudo random numbers from __LINE__. * wtf/WeakRandom.h: (WTF::WeakRandom::nextState): (WTF::WeakRandom::generate): (WTF::WeakRandom::advance): 2019-06-19 Fujii Hironori Add WTF::crossThreadCopy(T&&) to utilize String::isolatedCopy() && https://bugs.webkit.org/show_bug.cgi?id=198957 Reviewed by Alex Christensen. &&-qualified String::isolatedCopy() has a optimization path which does just WTFMove if it isSafeToSendToAnotherThread which means the object hasOneRef. However, WTF::crossThreadCopy was using only &-qualified isolatedCopy. To use the optimization, added WTF::crossThreadCopy(T&&) overloading. * wtf/CrossThreadCopier.h: (WTF::crossThreadCopy): Added a overload of (T&&). * wtf/CrossThreadTask.h: (WTF::createCrossThreadTask): Removed explicit template arguments of crossThreadCopy. 2019-06-19 Devin Rousso Web Inspector: Network: replace CFNetwork SPI with new API where able https://bugs.webkit.org/show_bug.cgi?id=198762 Reviewed by Timothy Hatcher. * wtf/Platform.h: 2019-06-19 Alex Christensen Add a unit test for client certificate authentication https://bugs.webkit.org/show_bug.cgi?id=197800 Reviewed by Youenn Fablet. * wtf/spi/cocoa/SecuritySPI.h: Move declarations from ArgumentCodersCF.cpp so they can be shared. 2019-06-19 Adrian Perez de Castro [WPE][GTK] Fix build with unified sources disabled https://bugs.webkit.org/show_bug.cgi?id=198752 Reviewed by Michael Catanzaro. * wtf/text/StringBuilder.h: Add missing include of StringConcatenateNumbers.h 2019-06-19 Zan Dobersek USE_ANGLE macro can be evaluated without being defined https://bugs.webkit.org/show_bug.cgi?id=198991 Reviewed by Carlos Garcia Campos. * wtf/Platform.h: On platforms not yet defining USE_ANGLE, the incompatibility check with some other flags leads to the macro being evaluated even when it was not defined, producing compiler warnings. To avoid this, the macro should be defined to 0 before the check in case it was not defined already. 2019-06-18 Dean Jackson UIContextMenuInteraction implementation for WKContentView https://bugs.webkit.org/show_bug.cgi?id=198986 Reviewed by Andy Estes. Add USE_UICONTEXTMENU for iOS 13+. * wtf/Platform.h: 2019-06-18 Kenneth Russell Add preliminary ANGLE backend to WebCore https://bugs.webkit.org/show_bug.cgi?id=197755 Reviewed by Dean Jackson. Add a USE_ANGLE definition to wtf/Platform.h (currently disabled) which, when enabled, uses ANGLE instead of the OpenGL or OpenGL ES backend. * wtf/Platform.h: 2019-06-17 Jiewen Tan Move SOAuthorization from WebKitAdditions to WebKit https://bugs.webkit.org/show_bug.cgi?id=198874 Reviewed by Brent Fulgham. * wtf/Platform.h: Adds a feature flag to detect AppSSO framework. 2019-06-17 Ryan Haddad Unreviewed, rolling out r246501. Breaks Apple internal builds. Reverted changeset: "Support using ANGLE as the backend for the WebGL implementation" https://bugs.webkit.org/show_bug.cgi?id=197755 https://trac.webkit.org/changeset/246501 2019-06-17 Kenneth Russell Support using ANGLE as the backend for the WebGL implementation https://bugs.webkit.org/show_bug.cgi?id=197755 Reviewed by Dean Jackson. Add a USE_ANGLE definition to wtf/Platform.h (currently disabled) which, when enabled, uses ANGLE instead of the OpenGL or OpenGL ES backend. * wtf/Platform.h: 2019-06-16 Darin Adler Rename AtomicString to AtomString https://bugs.webkit.org/show_bug.cgi?id=195276 Reviewed by Michael Catanzaro. * many files: Let do-webcore-rename do the renaming. * wtf/text/AtomString.h: After renaming, added AtomicString as a synonym for now; helps smooth things over with a tiny bit of Apple internal software so we don't have to do this all at once. Can remove it soon. 2019-06-16 Eric Carlson [MediaStream] Avoid roundoff error when setting AVCapture min/max frame rate https://bugs.webkit.org/show_bug.cgi?id=198875 Reviewed by Youenn Fablet. * wtf/MediaTime.h: (WTF::LogArgument::toString): (WTF::LogArgument::toString): 2019-06-12 Antoine Quint Show the web page URL when sharing an AR model https://bugs.webkit.org/show_bug.cgi?id=198812 Reviewed by Dean Jackson. * wtf/Platform.h: 2019-06-12 Youenn Fablet Use NSURLSession for WebSocket https://bugs.webkit.org/show_bug.cgi?id=198568 Reviewed by Geoffrey Garen. * wtf/Platform.h: Introduce compile flag for WebSocket NSURLSession 2019-06-12 Commit Queue Unreviewed, rolling out r246322. https://bugs.webkit.org/show_bug.cgi?id=198796 "It's a huge page load regression on iOS" (Requested by saamyjoon on #webkit). Reverted changeset: "Roll out PAC cage" https://bugs.webkit.org/show_bug.cgi?id=198726 https://trac.webkit.org/changeset/246322 2019-06-10 Simon Fraser Add logging for UI-side compositing hit-testing https://bugs.webkit.org/show_bug.cgi?id=198739 Reviewed by Antti Koivisto. Make it possible to output an Objective-C object to TextStream, which will log its -description. Also add a template for OptionSet<> printing. * WTF.xcodeproj/project.pbxproj: * wtf/text/TextStream.h: (WTF::operator<<): * wtf/text/cocoa/TextStreamCocoa.mm: Added. (WTF::TextStream::operator<<): 2019-06-11 Saam Barati Roll out PAC cage https://bugs.webkit.org/show_bug.cgi?id=198726 Reviewed by Keith Miller. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/CagedPtr.h: (WTF::CagedPtr::CagedPtr): (WTF::CagedPtr::get const): (WTF::CagedPtr::getMayBeNull const): (WTF::CagedPtr::operator=): (WTF::CagedPtr::operator== const): (WTF::CagedPtr::operator!= const): (WTF::CagedPtr::operator bool const): (WTF::CagedPtr::operator* const): (WTF::CagedPtr::operator-> const): (WTF::CagedPtr::operator[] const): (WTF::CagedPtr::getUnsafe const): Deleted. (WTF::CagedPtr::at const): Deleted. (WTF::CagedPtr::recage): Deleted. * wtf/CagedUniquePtr.h: (WTF::CagedUniquePtr::CagedUniquePtr): (WTF::CagedUniquePtr::create): (WTF::CagedUniquePtr::operator=): (WTF::CagedUniquePtr::~CagedUniquePtr): (WTF::CagedUniquePtr::destroy): * wtf/Gigacage.h: (Gigacage::caged): (Gigacage::cagedMayBeNull): Deleted. * wtf/PtrTag.h: (WTF::tagArrayPtr): Deleted. (WTF::untagArrayPtr): Deleted. (WTF::removeArrayPtrTag): Deleted. (WTF::retagArrayPtr): Deleted. * wtf/TaggedArrayStoragePtr.h: (WTF::TaggedArrayStoragePtr::TaggedArrayStoragePtr): Deleted. (WTF::TaggedArrayStoragePtr::get const): Deleted. (WTF::TaggedArrayStoragePtr::getUnsafe const): Deleted. (WTF::TaggedArrayStoragePtr::resize): Deleted. (WTF::TaggedArrayStoragePtr::operator bool const): Deleted. 2019-06-10 Andy Estes [iOS] Use PDFKit SPI for taking snapshots when the hosting app is not entitled for global capture https://bugs.webkit.org/show_bug.cgi?id=198731 Reviewed by Tim Horton. * wtf/FeatureDefines.h: 2019-06-10 Sam Weinig Remove Dashboard support https://bugs.webkit.org/show_bug.cgi?id=198615 Reviewed by Ryosuke Niwa. * wtf/FeatureDefines.h: 2019-06-10 Timothy Hatcher Integrate dark mode support for iOS. https://bugs.webkit.org/show_bug.cgi?id=198687 rdar://problem/51545643 Reviewed by Tim Horton. * wtf/Platform.h: 2019-06-08 Andy Estes [Apple Pay] If we have a bound interface identifier, set it on new PKPaymentRequests https://bugs.webkit.org/show_bug.cgi?id=198690 Reviewed by Tim Horton. * wtf/FeatureDefines.h: Defined HAVE_PASSKIT_BOUND_INTERFACE_IDENTIFIER, and cleaned up some other PassKit HAVEs. 2019-06-06 Caio Lima [JSCOnly] JSCOnly port is not building on macOS https://bugs.webkit.org/show_bug.cgi?id=198563 Reviewed by Don Olmstead. We are adding `` to fix build issues when compiling JSCOnly port on macOS. * wtf/WTFAssertions.cpp: 2019-06-03 Commit Queue Unreviewed, rolling out r246022. https://bugs.webkit.org/show_bug.cgi?id=198486 Causing Internal build failures and JSC test failures (Requested by ShawnRoberts on #webkit). Reverted changeset: "Reenable Gigacage on ARM64." https://bugs.webkit.org/show_bug.cgi?id=198453 https://trac.webkit.org/changeset/246022 2019-06-03 Darin Adler Finish cleanup of String::number for floating point https://bugs.webkit.org/show_bug.cgi?id=198471 Reviewed by Yusuke Suzuki. * wtf/JSONValues.cpp: (WTF::JSONImpl::Value::writeJSON const): Use appendNumber instead of appendECMAScriptNumber, since that's now the default. * wtf/text/StringBuilder.cpp: (WTF::StringBuilder::appendNumber): Renamed from appendShortestFormNumber. * wtf/text/StringBuilder.h: Removed appendShortestFormNumber and appendECMAScriptNumber, replacing both with overload of appendNumber. * wtf/text/WTFString.cpp: (WTF::String::number): Renamed from numberToStringShortest. * wtf/text/WTFString.h: Removed numberToStringShortest and numberToStringECMAScript, replacing both with overload of number. 2019-06-02 Keith Miller Reenable Gigacage on ARM64. https://bugs.webkit.org/show_bug.cgi?id=198453 Reviewed by Filip Pizlo. * wtf/CagedPtr.h: (WTF::CagedPtr::authenticatingLoad): (WTF::CagedPtr::get const): (WTF::CagedPtr::getMayBeNull const): 2019-05-31 Alex Christensen URLParser::parseIPv6Host should properly parse 0's around compression https://bugs.webkit.org/show_bug.cgi?id=198424 Reviewed by Tim Horton. * wtf/URLParser.cpp: (WTF::URLParser::parseIPv6Host): 2019-05-31 Alex Christensen URLParser::parseHostAndPort should not allow non-port characters after an ipv6 host https://bugs.webkit.org/show_bug.cgi?id=198428 Reviewed by Tim Horton. This matches Chrome and Firefox. * wtf/URLParser.cpp: (WTF::URLParser::parseHostAndPort): 2019-05-31 Tim Horton Optionally respect device management restrictions when loading from the network https://bugs.webkit.org/show_bug.cgi?id=198318 Reviewed by Alex Christensen. * wtf/Platform.h: Add a HAVE flag for DeviceManagement.framework. It does exist in the simulator, but does not function; pretend it doesn't exist. 2019-05-31 Geoffrey Garen Some WeakPtr cleanup https://bugs.webkit.org/show_bug.cgi?id=198390 Reviewed by Chris Dumez. * wtf/WeakHashSet.h: (WTF::HashTraits>::isReleasedWeakValue): (WTF::WeakHashSet::WeakHashSetConstIterator::WeakHashSetConstIterator): Updated for rename to WeakPtrImpl. (WTF::WeakHashSet::WeakHashSetConstIterator::get const): Updated for new get() interface. Also, switched to iterator operator* to help clarify the double dereference here. (WTF::WeakHashSet::add): (WTF::WeakHashSet::remove): (WTF::WeakHashSet::contains const): (WTF::WeakHashSet::computeSize const): (WTF::HashTraits>::isReleasedWeakValue): Deleted. Updated for rename to WeakPtrImpl. * wtf/WeakPtr.h: (WTF::WeakPtrImpl::create): (WTF::WeakPtrImpl::~WeakPtrImpl): Renamed WeakReference to WeakPtrImpl. Now we don't need a comment explaining that this class is the backing implementation of WeakPtr. (WTF::WeakPtrImpl::get): Return the pointer type we stored, rather than the pointer type requested by our client. It's a little too surprising for a field to store one pointer type and load another. (WTF::WeakPtrImpl::WeakPtrImpl): Fixed a theoretical type safety bug. Make sure to store T::WeakValueType* instead of T*, since they might not be the same pointer value. (In practice, T and T::WeakValueType* are always the same type in this constructor because WeakPtrFactory makes them so, but it's best not to depend on implementation details across classes.) (WTF::WeakPtr::get const): Updated for new get() interface. (WTF::WeakPtr::operator bool const): (WTF::WeakPtr::operator=): (WTF::WeakPtr::clear): (WTF::WeakPtr::WeakPtr): Updated for WeakPtrImpl rename. (WTF::WeakPtrFactory::~WeakPtrFactory): Updated for WeakPtrImpl rename. (WTF::WeakPtrFactory::createWeakPtr const): ASSERT that the passed-in pointer is equal to the stored pointer. As a space optimization, we require our client to remind us what we point to each time a weak pointer is created -- but nothing guarantees that our client will do this correctly. (WTF::WeakPtrFactory::revokeAll): Updated for WeakPtrImpl rename. (WTF::CanMakeWeakPtr::weakPtrFactory const): (WTF::CanMakeWeakPtr::weakPtrFactory): Use idiomatic accessor naming. (WTF::weak_ptr_impl_cast): Fixed a theoretical type safety bug. Previously, if Base and Derived both inherited CanMakeWeakPtr, and you casted WeakPtr to WeakPtr (or vice versa), and casting Base <-> Derived required pointer fixup, the previous compile-time check would accept the cast, even though the stored pointer would be wrong. (WTF::WeakPtr::WeakPtr): (WTF::=): (WTF::makeWeakPtr): (WTF::WeakReference::create): Deleted. (WTF::WeakReference::~WeakReference): Deleted. (WTF::WeakReference::get const): Deleted. (WTF::WeakReference::operator bool const): Deleted. (WTF::WeakReference::clear): Deleted. (WTF::WeakReference::WeakReference): Deleted. (WTF::weak_reference_cast): Deleted. Updated for rename to WeakPtrImpl. Don't export WeakPtrImpl because it's an implmenetation detail and it shouldn't be easy to use outside WTF. 2019-05-31 Don Olmstead [CMake] Add WebKit::WTF target https://bugs.webkit.org/show_bug.cgi?id=198400 Reviewed by Konstantin Tokarev. Create the WebKit::WTF target and use that to propagate headers. Use WEBKIT_COPY_FILES instead of WEBKIT_MAKE_FORWARDING_HEADERS. * wtf/CMakeLists.txt: 2019-05-30 Saam Barati [WHLSL] Enforce variable lifetimes https://bugs.webkit.org/show_bug.cgi?id=195794 Reviewed by Myles C. Maxfield. * wtf/PrintStream.h: 2019-05-30 Keith Rollin Fix yet more deprecated uses of -[UIApplication interfaceOrientation] https://bugs.webkit.org/show_bug.cgi?id=198381 Reviewed by Wenson Hsieh. r245267, r245272, and r245874 fixed many instances of this issue; this change fixes the issue for tvOS. * wtf/FeatureDefines.h: 2019-05-29 David Kilzer Clean up a few #include statements in WTF Reviewed by Alex Christensen. * benchmarks/HashSetDFGReplay.cpp: - Add missing "config.h" include. * wtf/ParallelJobsGeneric.cpp: - Replace include of ParallelJobs.h with ParallelJobsGeneric.h. * wtf/StackBounds.cpp: - Fix include ordering of StackBounds.h. 2019-05-29 Keith Rollin Followup to r245267 and r245272: fix even more deprecated uses of -[UIApplication interfaceOrientation] https://bugs.webkit.org/show_bug.cgi?id=198348 Reviewed by Wenson Hsieh. r245267 and r245272 fixed many instances of this issue; this change fixes the issue for watchOS. * wtf/FeatureDefines.h: 2019-05-29 David Kilzer IndexedDatabase Server thread in com.apple.WebKit.Networking process leaks objects into an autoreleasePool that's never cleared Reviewed by Brent Fulgham. * wtf/CrossThreadTaskHandler.cpp: (WTF::CrossThreadTaskHandler::CrossThreadTaskHandler): - Add optional second argument to enable use of an AutodrainedPool when running the runloop. (WTF::CrossThreadTaskHandler::taskRunLoop): - Create an AutodrainedPool if requested when CrossThreadTaskHandler was created. * wtf/CrossThreadTaskHandler.h: (WTF::CrossThreadTaskHandler::AutodrainedPoolForRunLoop): - Add enum class for enabling an AutodrainedPool for CrossThreadTaskHandler::taskRunLoop(). (WTF::CrossThreadTaskHandler::CrossThreadTaskHandler): - Add optional second argument to enable use of an AutodrainedPool when running the runloop. 2019-05-29 Geoffrey Garen WeakPtr breaks vtables when upcasting to base classes https://bugs.webkit.org/show_bug.cgi?id=188799 Reviewed by Youenn Fablet. This patch switches from reinterpret_cast to static_cast when loading from WeakReference storage. We know which type to cast *to* because it's specified by the type of the calling WeakPtr. We know which type to cast *from* because it's specified by a typedef in CanMakeWeakPtr. (Our convention is that we store a pointer to the class that derives from CanMakeWeakPtr. We cast from that pointer to derived pointers when we get(). This means that #include of the derived type header is now required in order to get() the pointer.) * wtf/WeakHashSet.h: (WTF::HashTraits>::isReleasedWeakValue): Definition is now eagerly required because WeakReference is not a template anymore. (WTF::WeakHashSet::WeakHashSetConstIterator::get const): (WTF::WeakHashSet::WeakHashSetConstIterator::skipEmptyBuckets): (WTF::WeakHashSet::remove): (WTF::WeakHashSet::contains const): (WTF::WeakHashSet::computesEmpty const): (WTF::WeakHashSet::hasNullReferences const): (WTF::WeakHashSet::computeSize const): (WTF::HashTraits>>::isReleasedWeakValue): Deleted. Updated for new WeakReference get() API. * wtf/WeakPtr.h: Use a macro for TestAPI support. We can't use template specialization because WeakReference is not a class template anymore. (Or maybe we could have kept it working with a dummy template argument? Felt weird, so I switched.) (WTF::WeakReference::create): (WTF::WeakReference::~WeakReference): (WTF::WeakReference::get const): (WTF::WeakReference::operator bool const): (WTF::WeakReference::WeakReference): WeakReference is just a void* now. It's the caller's responsibility, when creating and getting, to use a consistent storage type. We ensure a canonical storage type using a typedef inside CanMakeWeakPtr. (WTF::WeakPtr::WeakPtr): (WTF::WeakPtr::get const): (WTF::WeakPtr::operator bool const): (WTF::WeakPtr::operator-> const): (WTF::WeakPtr::operator* const): Adopted new WeakReference API. (WTF::WeakPtrFactory::createWeakPtr const): No need for reinterpret_cast. (WTF::weak_reference_cast): This isn't required for correctness, but it's nice to show a complier error at WeakPtr construction sites when you know that the types won't work. Otherwise, you get compiler errors at dereference sites, which are slightly more mysterious ways of saying that you constructed your WeakPtr incorrectly. (WTF::WeakPtr::WeakPtr): (WTF::=): (WTF::makeWeakPtr): (WTF::weak_reference_upcast): Deleted. (WTF::weak_reference_downcast): Deleted. 2019-05-29 Ryan Haddad Unreviewed, rolling out r245857. Breaks internal builds. Reverted changeset: "WeakPtr breaks vtables when upcasting to base classes" https://bugs.webkit.org/show_bug.cgi?id=188799 https://trac.webkit.org/changeset/245857 2019-05-28 Geoffrey Garen WeakPtr breaks vtables when upcasting to base classes https://bugs.webkit.org/show_bug.cgi?id=188799 Reviewed by Youenn Fablet. This patch switches from reinterpret_cast to static_cast when loading from WeakReference storage. We know which type to cast *to* because it's specified by the type of the calling WeakPtr. We know which type to cast *from* because it's specified by a typedef in CanMakeWeakPtr. (Our convention is that we store a pointer to the class that derives from CanMakeWeakPtr. We cast from that pointer to derived pointers when we get(). This means that #include of the derived type header is now required in order to get() the pointer.) * wtf/WeakHashSet.h: (WTF::HashTraits>::isReleasedWeakValue): Definition is now eagerly required because WeakReference is not a template anymore. (WTF::WeakHashSet::WeakHashSetConstIterator::get const): (WTF::WeakHashSet::WeakHashSetConstIterator::skipEmptyBuckets): (WTF::WeakHashSet::remove): (WTF::WeakHashSet::contains const): (WTF::WeakHashSet::computesEmpty const): (WTF::WeakHashSet::hasNullReferences const): (WTF::WeakHashSet::computeSize const): (WTF::HashTraits>>::isReleasedWeakValue): Deleted. Updated for new WeakReference get() API. * wtf/WeakPtr.h: Use a macro for TestAPI support. We can't use template specialization because WeakReference is not a class template anymore. (Or maybe we could have kept it working with a dummy template argument? Felt weird, so I switched.) (WTF::WeakReference::create): (WTF::WeakReference::~WeakReference): (WTF::WeakReference::get const): (WTF::WeakReference::operator bool const): (WTF::WeakReference::WeakReference): WeakReference is just a void* now. It's the caller's responsibility, when creating and getting, to use a consistent storage type. We ensure a canonical storage type using a typedef inside CanMakeWeakPtr. (WTF::WeakPtr::WeakPtr): (WTF::WeakPtr::get const): (WTF::WeakPtr::operator bool const): (WTF::WeakPtr::operator-> const): (WTF::WeakPtr::operator* const): Adopted new WeakReference API. (WTF::WeakPtrFactory::createWeakPtr const): No need for reinterpret_cast. (WTF::weak_reference_cast): This isn't required for correctness, but it's nice to show a complier error at WeakPtr construction sites when you know that the types won't work. Otherwise, you get compiler errors at dereference sites, which are slightly more mysterious ways of saying that you constructed your WeakPtr incorrectly. (WTF::WeakPtr::WeakPtr): (WTF::=): (WTF::makeWeakPtr): (WTF::weak_reference_upcast): Deleted. (WTF::weak_reference_downcast): Deleted. 2019-05-27 Chris Dumez Use a strongly-typed identifier for pages https://bugs.webkit.org/show_bug.cgi?id=198206 Reviewed by Youenn Fablet. * wtf/ObjectIdentifier.h: (WTF::operator<<): 2019-05-23 Don Olmstead [CMake] Use target oriented design for bmalloc https://bugs.webkit.org/show_bug.cgi?id=198046 Reviewed by Konstantin Tokarev. Use WebKit::bmalloc target. * wtf/CMakeLists.txt: 2019-05-23 Ross Kirsling [PlayStation] Implement platformUserPreferredLanguages. https://bugs.webkit.org/show_bug.cgi?id=198149 Reviewed by Fujii Hironori. * wtf/PlatformPlayStation.cmake: * wtf/playstation/LanguagePlayStation.cpp: Added. (WTF::platformUserPreferredLanguages): 2019-05-22 Myles C. Maxfield font-optical-sizing applies the wrong variation value https://bugs.webkit.org/show_bug.cgi?id=197528 Reviewed by Antti Koivisto. * wtf/Platform.h: 2019-05-22 Ryan Haddad Unreviewed, rolling out r245598. Breaks watchOS build. Reverted changeset: "font-optical-sizing applies the wrong variation value" https://bugs.webkit.org/show_bug.cgi?id=197528 https://trac.webkit.org/changeset/245598 2019-05-21 Ross Kirsling [PlayStation] Don't call fcntl. https://bugs.webkit.org/show_bug.cgi?id=197961 Reviewed by Fujii Hironori. * wtf/PlatformGTK.cmake: * wtf/PlatformJSCOnly.cmake: * wtf/PlatformPlayStation.cmake: * wtf/PlatformWPE.cmake: * wtf/UniStdExtras.h: * wtf/playstation/UniStdExtrasPlayStation.cpp: Added. (WTF::setCloseOnExec): (WTF::dupCloseOnExec): (WTF::setNonBlock): * wtf/unix/UniStdExtrasUnix.cpp: Renamed from Source/WTF/wtf/UniStdExtras.cpp. (WTF::setNonBlock): Move UniStdExtras to unix/, add a PlayStation version that doesn't use fcntl, add an abstraction for O_NONBLOCK. 2019-05-20 Tadeu Zagallo Only cache bytecode for API clients in data vaults https://bugs.webkit.org/show_bug.cgi?id=197898 Reviewed by Keith Miller. Add SPI to check if a filesystem path is restricted as a data vault. * WTF.xcodeproj/project.pbxproj: * wtf/spi/darwin/DataVaultSPI.h: Added. 2019-05-20 Carlos Garcia Campos [GLIB] Repeating timer is not stopped when stop is called from the callback https://bugs.webkit.org/show_bug.cgi?id=197986 Reviewed by Michael Catanzaro. In case of repeating timers we always update the ready time to fire interval after the user callback is called. * wtf/glib/RunLoopGLib.cpp: (WTF::RunLoop::TimerBase::stop): Reset m_fireInterval and m_isRepeating. 2019-05-19 Darin Adler Change String::number to use "shortest" instead of "fixed precision 6 digits" https://bugs.webkit.org/show_bug.cgi?id=178319 Reviewed by Sam Weinig. * wtf/text/StringBuilder.h: Delete appendNumber for floating point and appendECMAScriptNumber for single-precision. * wtf/text/WTFString.h: Delete String::number for floating point and numberToStringECMAScript for single-precision. 2019-05-18 Tadeu Zagallo Add extra information to dumpJITMemory https://bugs.webkit.org/show_bug.cgi?id=197998 Reviewed by Saam Barati. Add a new trace point code for JSC::dumpJITMemory * wtf/SystemTracing.h: 2019-05-17 Don Olmstead [CMake] Use builtin FindICU https://bugs.webkit.org/show_bug.cgi?id=197934 Reviewed by Michael Catanzaro. Remove uses of ICU_INCLUDE_DIRS and ICU_LIBRARIES. Use ICU:: targets which end up propagating to all consumers of WTF. * wtf/CMakeLists.txt: * wtf/PlatformPlayStation.cmake: 2019-05-17 Commit Queue Unreviewed, rolling out r245418. https://bugs.webkit.org/show_bug.cgi?id=197989 New API test causing crashes on Mojave testers (Requested by ShawnRoberts on #webkit). Reverted changeset: "Add a unit test for client certificate authentication" https://bugs.webkit.org/show_bug.cgi?id=197800 https://trac.webkit.org/changeset/245418 2019-05-16 Keith Miller Wasm should cage the memory base pointers in structs https://bugs.webkit.org/show_bug.cgi?id=197620 Reviewed by Saam Barati. Rename reauthenticate to recage. * wtf/CagedPtr.h: (WTF::CagedPtr::recage): (WTF::CagedPtr::reauthenticate): Deleted. 2019-05-16 Alex Christensen Add a unit test for client certificate authentication https://bugs.webkit.org/show_bug.cgi?id=197800 Reviewed by Youenn Fablet. * wtf/spi/cocoa/SecuritySPI.h: Move declarations from ArgumentCodersCF.cpp so they can be shared. 2019-05-16 Eike Rathke Fix memcpy() call for big endian https://bugs.webkit.org/show_bug.cgi?id=197945 Reviewed by Michael Catanzaro. * wtf/Packed.h: (WTF::alignof): 2019-05-15 Ross Kirsling [PlayStation] WTFCrash should preserve register state. https://bugs.webkit.org/show_bug.cgi?id=197932 Reviewed by Don Olmstead. * wtf/Assertions.cpp: * wtf/Assertions.h: Let r196397 apply to PlayStation port as well. 2019-05-15 Simon Fraser Make LOG_WITH_STREAM more efficient https://bugs.webkit.org/show_bug.cgi?id=197905 Reviewed by Alex Christensen. Add a streamable repeat() class that can be used to output a series of characters. This is useful for indenting output. * wtf/text/TextStream.h: (WTF::TextStream::repeat::repeat): (WTF::TextStream::operator<<): 2019-05-15 Víctor Manuel Jáquez Leal compilation failure with clang 9 https://bugs.webkit.org/show_bug.cgi?id=197911 Reviewed by Alex Christensen. Use std namespace for nullptr_t in tagArrayPtr templates. * wtf/PtrTag.h: (WTF::tagArrayPtr): 2019-05-14 Commit Queue Unreviewed, rolling out r245281. https://bugs.webkit.org/show_bug.cgi?id=197887 Broke API Test TestWebKitAPI.Challenge.ClientCertificate (Requested by aakashjain on #webkit). Reverted changeset: "Add a unit test for client certificate authentication" https://bugs.webkit.org/show_bug.cgi?id=197800 https://trac.webkit.org/changeset/245281 2019-05-14 Alex Christensen Add a unit test for client certificate authentication https://bugs.webkit.org/show_bug.cgi?id=197800 Reviewed by Youenn Fablet. * wtf/spi/cocoa/SecuritySPI.h: Move declarations from ArgumentCodersCF.cpp so they can be shared. 2019-05-13 Robin Morisset IndexSet::isEmpty should use BitVector::isEmpty() instead of size() https://bugs.webkit.org/show_bug.cgi?id=197857 Reviewed by Darin Adler. * wtf/IndexSet.h: (WTF::IndexSet::isEmpty const): 2019-05-13 Youenn Fablet [Mac] Use realpath for dlopen_preflight https://bugs.webkit.org/show_bug.cgi?id=197803 Reviewed by Eric Carlson. * wtf/cocoa/SoftLinking.h: 2019-05-13 Yusuke Suzuki Unreviewed, wrokaround for MACH_VM_MAX_ADDRESS in ARM32_64 https://bugs.webkit.org/show_bug.cgi?id=197730 Interestingly, MACH_VM_MAX_ADDRESS is larger than 32bit in ARM32_64, I think this is a bug. But for now, we workaround for this case by using `CPU(ADDRESS64)`. * wtf/WTFAssertions.cpp: 2019-05-13 Yusuke Suzuki [WTF] Remove Threading workaround for support libraries in Windows https://bugs.webkit.org/show_bug.cgi?id=197350 Reviewed by Darin Adler. We kept old APIs for some support libraries at 2017. This patch removes them. * wtf/Threading.h: * wtf/win/ThreadingWin.cpp: (WTF::createThread): Deleted. (WTF::waitForThreadCompletion): Deleted. 2019-05-13 Yusuke Suzuki [WTF] Simplify GCThread and CompilationThread flags by adding them to WTF::Thread https://bugs.webkit.org/show_bug.cgi?id=197146 Reviewed by Saam Barati. Since GCThread and CompilationThread flags exist in WTF, we put these flags into WTF::Thread directly instead of holding them in ThreadSpecific<>. And this patch removes dependency from Threading.h to ThreadSpecific.h. ThreadSpecific.h's OS threading primitives are moved to ThreadingPrimitives.h, and Threading.h relies on it instead. * wtf/CompilationThread.cpp: (WTF::isCompilationThread): (WTF::initializeCompilationThreads): Deleted. (WTF::exchangeIsCompilationThread): Deleted. * wtf/CompilationThread.h: (WTF::CompilationScope::CompilationScope): (WTF::CompilationScope::~CompilationScope): (WTF::CompilationScope::leaveEarly): * wtf/MainThread.cpp: (WTF::initializeMainThread): (WTF::initializeMainThreadToProcessMainThread): (WTF::isMainThreadOrGCThread): (WTF::initializeGCThreads): Deleted. (WTF::registerGCThread): Deleted. (WTF::mayBeGCThread): Deleted. * wtf/MainThread.h: * wtf/ThreadSpecific.h: (WTF::canBeGCThread>::ThreadSpecific): (WTF::canBeGCThread>::set): (WTF::threadSpecificKeyCreate): Deleted. (WTF::threadSpecificKeyDelete): Deleted. (WTF::threadSpecificSet): Deleted. (WTF::threadSpecificGet): Deleted. * wtf/Threading.cpp: (WTF::Thread::exchangeIsCompilationThread): (WTF::Thread::registerGCThread): (WTF::Thread::mayBeGCThread): * wtf/Threading.h: (WTF::Thread::isCompilationThread const): (WTF::Thread::gcThreadType const): (WTF::Thread::joinableState const): (WTF::Thread::hasExited const): (WTF::Thread::Thread): (WTF::Thread::joinableState): Deleted. (WTF::Thread::hasExited): Deleted. * wtf/ThreadingPrimitives.h: (WTF::threadSpecificKeyCreate): (WTF::threadSpecificKeyDelete): (WTF::threadSpecificSet): (WTF::threadSpecificGet): * wtf/win/ThreadSpecificWin.cpp: (WTF::flsKeys): 2019-05-13 Yusuke Suzuki Unreviewed, follow-up after r245214 https://bugs.webkit.org/show_bug.cgi?id=197730 Suggested by Sam. We should have static_assert with MACH_VM_MAX_ADDRESS. * wtf/WTFAssertions.cpp: 2019-05-13 Youenn Fablet Use kDNSServiceFlagsKnownUnique for DNSServiceRegisterRecord only on platforms supporting it https://bugs.webkit.org/show_bug.cgi?id=197802 Reviewed by Eric Carlson. * wtf/Platform.h: 2019-05-13 Yusuke Suzuki [JSC] Compress miscelaneous JIT related data structures with Packed<> https://bugs.webkit.org/show_bug.cgi?id=197830 Reviewed by Saam Barati. * wtf/Packed.h: (WTF::alignof): 2019-05-13 Michael Catanzaro Unreviewed, fix unused variable warnings in release builds * wtf/URLHelpers.cpp: (WTF::URLHelpers::escapeUnsafeCharacters): 2019-05-12 Yusuke Suzuki [JSC] Compress Watchpoint size by using enum type and Packed<> data structure https://bugs.webkit.org/show_bug.cgi?id=197730 Reviewed by Filip Pizlo. This patch introduces a new data structures, WTF::Packed, WTF::PackedPtr, and WTF::PackedAlignedPtr. - WTF::Packed WTF::Packed is data storage. We can read and write trivial (in C++ term [1]) data to this storage. The difference to the usual storage is that the alignment of this storage is always 1. We access the underlying data by using unalignedLoad/unalignedStore. This class offers alignment = 1 data structure instead of missing the following characteristics. 1. Load / Store are non atomic even if the data size is within a pointer width. We should not use this for a member which can be accessed in a racy way. (e.g. fields accessed optimistically from the concurrent compilers). 2. We cannot take reference / pointer to the underlying storage since they are unaligned. 3. Access to this storage is unaligned access. The code is using memcpy, and the compiler will convert to an appropriate unaligned access in certain architectures (x86_64 / ARM64). It could be slow. So use it for non performance sensitive & memory sensitive places. - WTF::PackedPtr WTF::PackedPtr is a specialization of WTF::Packed. And it is basically WTF::PackedAlignedPtr with alignment = 1. We further compact the pointer by leveraging the platform specific knowledge. In 64bit architectures, the effective width of pointers are less than 64 bit. In x86_64, it is 48 bits. And Darwin ARM64 is further smaller, 36 bits. This information allows us to compact the pointer to 6 bytes in x86_64 and 5 bytes in Darwin ARM64. - WTF::PackedAlignedPtr WTF::PackedAlignedPtr is the WTF::PackedPtr with alignment information of the T. If we use this alignment information, we could reduce the size of packed pointer further in some cases. For example, since we guarantee that JSCells are 16 byte aligned, low 4 bits are empty. Leveraging this information in Darwin ARM64 platform allows us to make packed JSCell pointer 4 bytes (36 - 4 bits). We do not use passed alignment information if it is not profitable. We also have PackedPtrTraits. This is new PtrTraits and use it for various data structures such as Bag<>. [1]: https://en.cppreference.com/w/cpp/types/is_trivial * WTF.xcodeproj/project.pbxproj: * wtf/Bag.h: (WTF::Bag::clear): (WTF::Bag::iterator::operator++): * wtf/CMakeLists.txt: * wtf/DumbPtrTraits.h: * wtf/DumbValueTraits.h: * wtf/MathExtras.h: (WTF::clzConstexpr): (WTF::clz): (WTF::ctzConstexpr): (WTF::ctz): (WTF::getLSBSetConstexpr): (WTF::getMSBSetConstexpr): * wtf/Packed.h: Added. (WTF::Packed::Packed): (WTF::Packed::get const): (WTF::Packed::set): (WTF::Packed::operator=): (WTF::Packed::exchange): (WTF::Packed::swap): (WTF::alignof): (WTF::PackedPtrTraits::exchange): (WTF::PackedPtrTraits::swap): (WTF::PackedPtrTraits::unwrap): * wtf/Platform.h: * wtf/SentinelLinkedList.h: (WTF::BasicRawSentinelNode::BasicRawSentinelNode): (WTF::BasicRawSentinelNode::prev): (WTF::BasicRawSentinelNode::next): (WTF::PtrTraits>::remove): (WTF::PtrTraits>::prepend): (WTF::PtrTraits>::append): (WTF::RawNode>::SentinelLinkedList): (WTF::RawNode>::remove): (WTF::BasicRawSentinelNode::remove): Deleted. (WTF::BasicRawSentinelNode::prepend): Deleted. (WTF::BasicRawSentinelNode::append): Deleted. * wtf/StdLibExtras.h: (WTF::roundUpToMultipleOfImpl): (WTF::roundUpToMultipleOfImpl0): Deleted. * wtf/UnalignedAccess.h: (WTF::unalignedLoad): (WTF::unalignedStore): 2019-05-10 Saam barati Bag's move operator= leaks memory https://bugs.webkit.org/show_bug.cgi?id=197757 Reviewed by Keith Miller. It was unused. So I'm just removing it. We can implement it properly if we ever need it. * wtf/Bag.h: (WTF::Bag::operator=): Deleted. 2019-05-10 Fujii Hironori [WinCairo] storage/indexeddb tests are timing out https://bugs.webkit.org/show_bug.cgi?id=196289 Reviewed by Alex Christensen. * wtf/FileSystem.h: Added hardLink. * wtf/glib/FileSystemGlib.cpp: (WTF::FileSystemImpl::hardLink): (WTF::FileSystemImpl::hardLinkOrCopyFile): * wtf/posix/FileSystemPOSIX.cpp: (WTF::FileSystemImpl::hardLink): (WTF::FileSystemImpl::hardLinkOrCopyFile): * wtf/win/FileSystemWin.cpp: (WTF::FileSystemImpl::hardLink): (WTF::FileSystemImpl::hardLinkOrCopyFile): Added hardLink. Let hardLinkOrCopyFile use the hardLink. 2019-05-10 Yusuke Suzuki [WTF] Remove "private:" from Noncopyable and Nonmovable macros https://bugs.webkit.org/show_bug.cgi?id=197767 Reviewed by Saam Barati. We no longer need "private:". * wtf/Noncopyable.h: * wtf/Nonmovable.h: 2019-05-08 Zan Dobersek [GLib] Rework WPE RunLoopSourcePriority values https://bugs.webkit.org/show_bug.cgi?id=197167 Reviewed by Carlos Garcia Campos. The GLib priorities for the WPE port were initially aligned on the -70 value, theory being that this would help avoid any default-priority GSources spawned in different dependency libraries affecting our scheduling. Today it seems that extra caution might not be really necessary. This change aligns the base priority value with GLib's default priority value of 0. We maintain the relativity of priority values by effectively increasing each priority by 70. * wtf/glib/RunLoopSourcePriority.h: 2019-05-08 Alex Christensen Add SPI to set HSTS storage directory https://bugs.webkit.org/show_bug.cgi?id=197259 Reviewed by Brady Eidson. * wtf/Platform.h: 2019-05-08 Keith Miller Remove Gigacage from arm64 and use PAC for arm64e instead https://bugs.webkit.org/show_bug.cgi?id=197110 Reviewed by Saam Barati. This patch changes the Gigacage to use PAC on arm64e. As part of this process all platforms must provide their length when materializing the caged pointer. Since it would be somewhat confusing to have two parameters for an operator [] those methods have been removed. Lastly, this patch removes the specializations for void* caged pointers, instead opting to use enable_if on the methods that would normally fail on void* e.g. anything that returns a T&. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/CagedPtr.h: (WTF::CagedPtr::CagedPtr): (WTF::CagedPtr::get const): (WTF::CagedPtr::getMayBeNull const): (WTF::CagedPtr::getUnsafe const): (WTF::CagedPtr::at const): (WTF::CagedPtr::reauthenticate): (WTF::CagedPtr::operator=): (WTF::CagedPtr::operator== const): (WTF::CagedPtr::operator bool const): (WTF::CagedPtr::operator* const): Deleted. (WTF::CagedPtr::operator-> const): Deleted. (WTF::CagedPtr::operator[] const): Deleted. (): Deleted. * wtf/CagedUniquePtr.h: (WTF::CagedUniquePtr::CagedUniquePtr): (WTF::CagedUniquePtr::create): (WTF::CagedUniquePtr::~CagedUniquePtr): (WTF::CagedUniquePtr::destroy): (): Deleted. * wtf/Gigacage.h: (Gigacage::cagedMayBeNull): * wtf/PtrTag.h: (WTF::tagArrayPtr): (WTF::untagArrayPtr): (WTF::removeArrayPtrTag): (WTF::retagArrayPtr): * wtf/TaggedArrayStoragePtr.h: Copied from Source/JavaScriptCore/runtime/ArrayBufferView.cpp. (WTF::TaggedArrayStoragePtr::TaggedArrayStoragePtr): (WTF::TaggedArrayStoragePtr::get const): (WTF::TaggedArrayStoragePtr::getUnsafe const): (WTF::TaggedArrayStoragePtr::resize): (WTF::TaggedArrayStoragePtr::operator bool const): 2019-05-08 Robin Morisset WTF::TimingScope should show the total duration and not just the mean https://bugs.webkit.org/show_bug.cgi?id=197672 Reviewed by Alex Christensen. * wtf/TimingScope.cpp: (WTF::TimingScope::scopeDidEnd): 2019-05-07 Yusuke Suzuki [JSC] LLIntPrototypeLoadAdaptiveStructureWatchpoint does not require Bag<> https://bugs.webkit.org/show_bug.cgi?id=197645 Reviewed by Saam Barati. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Nonmovable.h: Copied from Source/JavaScriptCore/bytecode/LLIntPrototypeLoadAdaptiveStructureWatchpoint.h. * wtf/Vector.h: (WTF::minCapacity>::uncheckedConstructAndAppend): 2019-05-07 Eric Carlson Define media buffering policy https://bugs.webkit.org/show_bug.cgi?id=196979 Reviewed by Jer Noble. * wtf/Platform.h: 2019-05-07 Robin Morisset WTF::BitVector should have an isEmpty() method https://bugs.webkit.org/show_bug.cgi?id=197637 Reviewed by Keith Miller. * wtf/BitVector.cpp: (WTF::BitVector::isEmptySlow const): * wtf/BitVector.h: (WTF::BitVector::isEmpty const): 2019-05-07 Brent Fulgham Correct JSON parser to address unterminated escape character https://bugs.webkit.org/show_bug.cgi?id=197582 Reviewed by Alex Christensen. Correct JSON parser code to properly deal with unterminated escape characters. * wtf/JSONValues.cpp: (WTF::JSONImpl::decodeString): (WTF::JSONImpl::parseStringToken): 2019-05-07 Alex Christensen Add a release assertion that Functions can only be constructed from non-null CompletionHandlers https://bugs.webkit.org/show_bug.cgi?id=197641 Reviewed by Chris Dumez. This will help us find the cause of rdar://problem/48679972 by seeing the crash when the Function is dispatched, not when it's called with no interesting stack trace. I manually verified this assertion is hit in such a case. We should also have no legitimate use of creating a Function out of a null CompletionHandler then never calling it. * wtf/CompletionHandler.h: (WTF::Detail::CallableWrapper [JSC] Respect already defined USE_LLINT_EMBEDDED_OPCODE_ID compiler variable. https://bugs.webkit.org/show_bug.cgi?id=197633 Reviewed by Don Olmstead. When the variable `USE_LLINT_EMBEDDED_OPCODE_ID` is defined, stop defining its value with platform default one. * wtf/Platform.h: 2019-05-03 Sihui Liu Add assertion to check whether shm files have maximum FileProtection of CompleteUnlessOpen https://bugs.webkit.org/show_bug.cgi?id=197390 Reviewed by Geoffrey Garen. * wtf/FileSystem.cpp: (WTF::FileSystemImpl::isSafeToUseMemoryMapForPath): (WTF::FileSystemImpl::makeSafeToUseMemoryMapForPath): * wtf/FileSystem.h: * wtf/cocoa/FileSystemCocoa.mm: (WTF::FileSystemImpl::isSafeToUseMemoryMapForPath): (WTF::FileSystemImpl::makeSafeToUseMemoryMapForPath): 2019-05-03 Commit Queue Unreviewed, rolling out r244881. https://bugs.webkit.org/show_bug.cgi?id=197559 Breaks compilation of jsconly on linux, breaking compilation for jsc-i386-ews, jsc-mips-ews and jsc-armv7-ews (Requested by guijemont on #webkit). Reverted changeset: "[CMake] Refactor WEBKIT_MAKE_FORWARDING_HEADERS into WEBKIT_COPY_FILES" https://bugs.webkit.org/show_bug.cgi?id=197174 https://trac.webkit.org/changeset/244881 2019-05-02 Alex Christensen Mark U+01C0 as a homograph of U+006C https://bugs.webkit.org/show_bug.cgi?id=197526 Reviewed by Tim Horton. * wtf/URLHelpers.cpp: (WTF::URLHelpers::isLookalikeCharacter): 2019-05-02 Don Olmstead [CMake] Refactor WEBKIT_MAKE_FORWARDING_HEADERS into WEBKIT_COPY_FILES https://bugs.webkit.org/show_bug.cgi?id=197174 Reviewed by Alex Christensen. Replace WEBKIT_MAKE_FORWARDING_HEADERS with WEBKIT_COPY_FILES. * wtf/CMakeLists.txt: 2019-05-01 Darin Adler WebKit has too much of its own UTF-8 code and should rely more on ICU's UTF-8 support https://bugs.webkit.org/show_bug.cgi?id=195535 Reviewed by Alexey Proskuryakov. * wtf/text/AtomicString.cpp: (WTF::AtomicString::fromUTF8Internal): Added code to compute string length when the end is nullptr; this behavior used to be implemented inside the calculateStringHashAndLengthFromUTF8MaskingTop8Bits function. * wtf/text/AtomicStringImpl.cpp: (WTF::HashAndUTF8CharactersTranslator::translate): Updated for change to convertUTF8ToUTF16. * wtf/text/AtomicStringImpl.h: Took the WTF_EXPORT_PRIVATE off of the AtomicStringImpl::addUTF8 function. This is used only inside a non-inlined function in the AtomicString class and its behavior changed subtly in this patch; it's helpful to document that it's not exported. * wtf/text/StringImpl.cpp: (WTF::StringImpl::utf8Impl): Don't pass "true" for strictness to convertUTF16ToUTF8 since strict is the default. Also updated for changes to ConversionResult. (WTF::StringImpl::utf8ForCharacters): Updated for change to convertLatin1ToUTF8. (WTF::StringImpl::tryGetUtf8ForRange const): Ditto. * wtf/text/StringView.cpp: Removed uneeded include of UTF8Conversion.h. * wtf/text/WTFString.cpp: (WTF::String::fromUTF8): Updated for change to convertUTF8ToUTF16. * wtf/unicode/UTF8Conversion.cpp: (WTF::Unicode::inlineUTF8SequenceLengthNonASCII): Deleted. (WTF::Unicode::inlineUTF8SequenceLength): Deleted. (WTF::Unicode::UTF8SequenceLength): Deleted. (WTF::Unicode::decodeUTF8Sequence): Deleted. (WTF::Unicode::convertLatin1ToUTF8): Use U8_APPEND, enabling us to remove almost everything in the function. Also changed resturn value to be a boolean to indicate success since there is only one possible failure (target exhausted). There is room for further simplification, since most callers have lengths rather than end pointers for the source buffer, and all but one caller supplies a buffer size known to be sufficient, so those don't need a return value, nor do they need to pass an end of buffer pointer. (WTF::Unicode::convertUTF16ToUTF8): Use U_IS_LEAD, U_IS_TRAIL, U16_GET_SUPPLEMENTARY, U_IS_SURROGATE, and U8_APPEND. Also changed behavior for non-strict mode so that unpaired surrogates will be turned into the replacement character instead of invalid UTF-8 sequences, because U8_APPEND won't create an invalid UTF-8 sequence, and because we don't need to do that for any good reason at any call site. (WTF::Unicode::isLegalUTF8): Deleted. (WTF::Unicode::readUTF8Sequence): Deleted. (WTF::Unicode::convertUTF8ToUTF16): Use U8_NEXT instead of inlineUTF8SequenceLength, isLegalUTF8, and readUTF8Sequence. Use U16_APPEND instead of lots of code that does the same thing. There is room for further simplification since most callers don't need the "all ASCII" feature and could probably pass the arguments in a more natural way. (WTF::Unicode::calculateStringHashAndLengthFromUTF8MaskingTop8Bits): Use U8_NEXT instead of isLegalUTF8, readUTF8Sequence, and various error handling checks for things that are handled by U8_NEXT. Also removed support for passing nullptr for end to specify a null-terminated string. (WTF::Unicode::equalUTF16WithUTF8): Ditto. * wtf/unicode/UTF8Conversion.h: Removed UTF8SequenceLength and decodeUTF8Sequence. Changed the ConversionResult to match WebKit coding style, with an eye toward perhaps removing it in the future. Changed the convertUTF8ToUTF16 return value to a boolean and removed the "strict" argument since no caller was passing false. Changed the convertLatin1ToUTF8 return value to a boolean. Tweaked comments. 2019-05-01 Shawn Roberts Unreviewed, rolling out r244821. Causing Reverted changeset: "WebKit has too much of its own UTF-8 code and should rely more on ICU's UTF-8 support" https://bugs.webkit.org/show_bug.cgi?id=195535 https://trac.webkit.org/changeset/244821 2019-05-01 Shawn Roberts Unreviewed, rolling out r244822. Causing 4 Test262 failures on JSC Release and Debug Reverted changeset: https://trac.webkit.org/changeset/244822 https://trac.webkit.org/changeset/244821 2019-04-29 Darin Adler WebKit has too much of its own UTF-8 code and should rely more on ICU's UTF-8 support https://bugs.webkit.org/show_bug.cgi?id=195535 Reviewed by Alexey Proskuryakov. * wtf/text/AtomicString.cpp: (WTF::AtomicString::fromUTF8Internal): Added code to compute string length when the end is nullptr; this behavior used to be implemented inside the calculateStringHashAndLengthFromUTF8MaskingTop8Bits function. * wtf/text/AtomicStringImpl.cpp: (WTF::HashAndUTF8CharactersTranslator::translate): Updated for change to convertUTF8ToUTF16. * wtf/text/AtomicStringImpl.h: Took the WTF_EXPORT_PRIVATE off of the AtomicStringImpl::addUTF8 function. This is used only inside a non-inlined function in the AtomicString class and its behavior changed subtly in this patch; it's helpful to document that it's not exported. * wtf/text/StringImpl.cpp: (WTF::StringImpl::utf8Impl): Don't pass "true" for strictness to convertUTF16ToUTF8 since strict is the default. Also updated for changes to ConversionResult. (WTF::StringImpl::utf8ForCharacters): Updated for change to convertLatin1ToUTF8. (WTF::StringImpl::tryGetUtf8ForRange const): Ditto. * wtf/text/StringView.cpp: Removed uneeded include of UTF8Conversion.h. * wtf/text/WTFString.cpp: (WTF::String::fromUTF8): Updated for change to convertUTF8ToUTF16. * wtf/unicode/UTF8Conversion.cpp: (WTF::Unicode::inlineUTF8SequenceLengthNonASCII): Deleted. (WTF::Unicode::inlineUTF8SequenceLength): Deleted. (WTF::Unicode::UTF8SequenceLength): Deleted. (WTF::Unicode::decodeUTF8Sequence): Deleted. (WTF::Unicode::convertLatin1ToUTF8): Use U8_APPEND, enabling us to remove almost everything in the function. Also changed resturn value to be a boolean to indicate success since there is only one possible failure (target exhausted). There is room for further simplification, since most callers have lengths rather than end pointers for the source buffer, and all but one caller supplies a buffer size known to be sufficient, so those don't need a return value, nor do they need to pass an end of buffer pointer. (WTF::Unicode::convertUTF16ToUTF8): Use U_IS_LEAD, U_IS_TRAIL, U16_GET_SUPPLEMENTARY, U_IS_SURROGATE, and U8_APPEND. Also changed behavior for non-strict mode so that unpaired surrogates will be turned into the replacement character instead of invalid UTF-8 sequences, because U8_APPEND won't create an invalid UTF-8 sequence, and because we don't need to do that for any good reason at any call site. (WTF::Unicode::isLegalUTF8): Deleted. (WTF::Unicode::readUTF8Sequence): Deleted. (WTF::Unicode::convertUTF8ToUTF16): Use U8_NEXT instead of inlineUTF8SequenceLength, isLegalUTF8, and readUTF8Sequence. Use U16_APPEND instead of lots of code that does the same thing. There is room for further simplification since most callers don't need the "all ASCII" feature and could probably pass the arguments in a more natural way. (WTF::Unicode::calculateStringHashAndLengthFromUTF8MaskingTop8Bits): Use U8_NEXT instead of isLegalUTF8, readUTF8Sequence, and various error handling checks for things that are handled by U8_NEXT. Also removed support for passing nullptr for end to specify a null-terminated string. (WTF::Unicode::equalUTF16WithUTF8): Ditto. * wtf/unicode/UTF8Conversion.h: Removed UTF8SequenceLength and decodeUTF8Sequence. Changed the ConversionResult to match WebKit coding style, with an eye toward perhaps removing it in the future. Changed the convertUTF8ToUTF16 return value to a boolean and removed the "strict" argument since no caller was passing false. Changed the convertLatin1ToUTF8 return value to a boolean. Tweaked comments. 2019-04-30 John Wilander Add logging of Ad Click Attribution errors and events to a dedicated channel https://bugs.webkit.org/show_bug.cgi?id=197332 Reviewed by Youenn Fablet. Added missing RELEASE_LOG_INFO and RELEASE_LOG_INFO_IF dummies for RELEASE_LOG_DISABLED. * wtf/Assertions.h: 2019-04-30 Youenn Fablet Make Document audio producers use WeakPtr https://bugs.webkit.org/show_bug.cgi?id=197382 Reviewed by Eric Carlson. * wtf/WeakHashSet.h: (WTF::WeakHashSet::hasNullReferences const): 2019-04-30 Commit Queue Unreviewed, rolling out r244773. https://bugs.webkit.org/show_bug.cgi?id=197436 Causing assertion failures on debug queues (Requested by ShawnRoberts on #webkit). Reverted changeset: "Make Document audio producers use WeakPtr" https://bugs.webkit.org/show_bug.cgi?id=197382 https://trac.webkit.org/changeset/244773 2019-04-30 Youenn Fablet Make Document audio producers use WeakPtr https://bugs.webkit.org/show_bug.cgi?id=197382 Reviewed by Eric Carlson. * wtf/WeakHashSet.h: (WTF::WeakHashSet::hasNullReferences const): 2019-04-29 Alex Christensen Fix internal High Sierra build https://bugs.webkit.org/show_bug.cgi?id=197388 * Configurations/Base.xcconfig: 2019-04-29 Yusuke Suzuki JITStubRoutineSet wastes 180KB of HashTable capacity on can.com https://bugs.webkit.org/show_bug.cgi?id=186732 Reviewed by Saam Barati. * wtf/Range.h: (WTF::Range::contains const): 2019-04-29 Basuke Suzuki [Win] Add flag to enable version information stamping and disable by default. https://bugs.webkit.org/show_bug.cgi?id=197249 Reviewed by Ross Kirsling. This feature is only used in AppleWin port. Add flag for this task and make it OFF by default. Then enable it by default on AppleWin. * wtf/CMakeLists.txt: 2019-04-26 Don Olmstead Add WTF::findIgnoringASCIICaseWithoutLength to replace strcasestr https://bugs.webkit.org/show_bug.cgi?id=197291 Reviewed by Konstantin Tokarev. Adds an implementation of strcasestr within WTF. * wtf/text/StringCommon.h: (WTF::findIgnoringASCIICaseWithoutLength): 2019-04-26 Sihui Liu Stop IDB transactions to release locked database files when network process is ready to suspend https://bugs.webkit.org/show_bug.cgi?id=196372 Reviewed by Brady Eidson. Provide a method to suspend the thread and block main thread until the thread is suspended. * wtf/CrossThreadTaskHandler.cpp: (WTF::CrossThreadTaskHandler::taskRunLoop): (WTF::CrossThreadTaskHandler::suspendAndWait): (WTF::CrossThreadTaskHandler::resume): * wtf/CrossThreadTaskHandler.h: 2019-04-25 Fujii Hironori Unreviewed, rolling out r244669. Windows ports can't clean build. Reverted changeset: "[Win] Add flag to enable version information stamping and disable by default." https://bugs.webkit.org/show_bug.cgi?id=197249 https://trac.webkit.org/changeset/244669 2019-04-25 Basuke Suzuki [Win] Add flag to enable version information stamping and disable by default. https://bugs.webkit.org/show_bug.cgi?id=197249 Reviewed by Ross Kirsling. This feature is only used in AppleWin port. Add flag for this task and make it OFF by default. Then enable it by default on AppleWin. * wtf/CMakeLists.txt: 2019-04-25 Timothy Hatcher Disable date and time inputs on iOSMac. https://bugs.webkit.org/show_bug.cgi?id=197287 rdar://problem/46794376 Reviewed by Wenson Hsieh. * wtf/FeatureDefines.h: 2019-04-25 Alex Christensen Fix High Sierra build after r244653 https://bugs.webkit.org/show_bug.cgi?id=197131 * wtf/StdLibExtras.h: High Sierra thinks __cplusplus is 201406 even when using C++17. Removing the __cplusplus check resolves the build failure on High Sierra. We can clean up StdLibExtras more later. 2019-04-25 Alex Christensen Start using C++17 https://bugs.webkit.org/show_bug.cgi?id=197131 Reviewed by Darin Adler. * Configurations/Base.xcconfig: * wtf/CMakeLists.txt: * wtf/Variant.h: (WTF::switchOn): 2019-04-25 Alex Christensen Remove DeprecatedOptional https://bugs.webkit.org/show_bug.cgi?id=197161 Reviewed by Darin Adler. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/DeprecatedOptional.h: Removed. 2019-04-24 Carlos Garcia Campos [GTK] Hardcoded text color in input fields https://bugs.webkit.org/show_bug.cgi?id=126907 Reviewed by Michael Catanzaro. Define HAVE_OS_DARK_MODE_SUPPORT for GTK port. * wtf/Platform.h: 2019-04-24 Tim Horton Clean up WKActionSheetAssistant's use of LaunchServices https://bugs.webkit.org/show_bug.cgi?id=194645 Reviewed by Andy Estes. * wtf/Platform.h: 2019-04-24 chris fleizach AX: Remove deprecated Accessibility Object Model events https://bugs.webkit.org/show_bug.cgi?id=197073 Reviewed by Ryosuke Niwa. * wtf/Platform.h: 2019-04-23 Commit Queue Unreviewed, rolling out r244558. https://bugs.webkit.org/show_bug.cgi?id=197219 Causing crashes on iOS Sim Release and Debug (Requested by ShawnRoberts on #webkit). Reverted changeset: "Remove DeprecatedOptional" https://bugs.webkit.org/show_bug.cgi?id=197161 https://trac.webkit.org/changeset/244558 2019-04-23 Alex Christensen Remove DeprecatedOptional https://bugs.webkit.org/show_bug.cgi?id=197161 Reviewed by Darin Adler. This was added in r209326 to be compatible with a shipping version of Safari. We have released several versions of Safari since then, so do what the comments say and remove it. The existence of this std::optional makes migrating to C++17 harder, and there's no reason to keep it. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/DeprecatedOptional.h: Removed. 2019-04-21 Zan Dobersek [WTF] Generic memoryFootprint() implementation should use bmalloc on Linux https://bugs.webkit.org/show_bug.cgi?id=196963 Reviewed by Don Olmstead. Have the generic memoryFootprint() implementation use bmalloc's memoryFootprint() API on Linux, whenever the system malloc option is not enabled. Limitation to Linux platforms is due to the bmalloc implementation being limited to those configurations (excluding iOS which doesn't use MemoryFootprintGeneric.cpp). * wtf/PlatformWPE.cmake: Switch to building MemoryFootprintGeneric.cpp. * wtf/generic/MemoryFootprintGeneric.cpp: (WTF::memoryFootprint): 2019-04-19 Ryosuke Niwa HashTable::removeIf always shrinks the hash table by half even if there is nothing left https://bugs.webkit.org/show_bug.cgi?id=196681 Reviewed by Darin Adler. Address Darin's comments by removing the explicit type from std::max. * wtf/HashTable.h: (WTF::KeyTraits>::computeBestTableSize): (WTF::KeyTraits>::shrinkToBestSize): 2019-04-18 Chris Dumez [iOS] Improve detection of when web views go to background / foreground https://bugs.webkit.org/show_bug.cgi?id=197035 Reviewed by Tim Horton. Add build time flag. * wtf/FeatureDefines.h: 2019-04-18 Jer Noble Add support for parsing FairPlayStreaming PSSH boxes. https://bugs.webkit.org/show_bug.cgi?id=197064 Reviewed by Eric Carlson. * wtf/Platform.h: 2019-04-18 Yusuke Suzuki [WTF] StringBuilder should set correct m_is8Bit flag when merging https://bugs.webkit.org/show_bug.cgi?id=197053 Reviewed by Saam Barati. When appending StringBuilder to the other StringBuilder, we have a path that does not set m_is8Bit flag correctly. This patch correctly sets this flag. And we also change 0 to nullptr when we are using 0 as a pointer. * wtf/text/StringBuilder.cpp: (WTF::StringBuilder::reserveCapacity): (WTF::StringBuilder::appendUninitializedSlow): (WTF::StringBuilder::append): * wtf/text/StringBuilder.h: (WTF::StringBuilder::append): (WTF::StringBuilder::characters8 const): (WTF::StringBuilder::characters16 const): (WTF::StringBuilder::clear): 2019-04-17 Tim Horton Adopt different scroll view flashing SPI https://bugs.webkit.org/show_bug.cgi?id=197043 Reviewed by Wenson Hsieh. * wtf/Platform.h: 2019-04-17 Jer Noble Enable HAVE_AVFOUNDATION_VIDEO_OUTPUT on PLATFORM(IOSMAC) https://bugs.webkit.org/show_bug.cgi?id=196994 Reviewed by Alex Christensen. * wtf/Platform.h: 2019-04-16 Stephan Szabo [PlayStation] Update port for system library changes https://bugs.webkit.org/show_bug.cgi?id=196978 Reviewed by Ross Kirsling. * wtf/PlatformPlayStation.cmake: Remove reference to deleted system library 2019-04-16 Jer Noble Enable HAVE_AVKIT on PLATFORM(IOSMAC) https://bugs.webkit.org/show_bug.cgi?id=196987 Reviewed by Tim Horton. * wtf/Platform.h: 2019-04-16 Robin Morisset [WTF] holdLock should be marked WARN_UNUSED_RETURN https://bugs.webkit.org/show_bug.cgi?id=196922 Reviewed by Keith Miller. * wtf/Locker.h: 2019-04-16 Don Olmstead [CMake] Set WTF_SCRIPTS_DIR https://bugs.webkit.org/show_bug.cgi?id=196917 Reviewed by Konstantin Tokarev. Use WTF_SCRIPTS_DIR for copying the unified sources script. * wtf/CMakeLists.txt: 2019-04-15 Myles C. Maxfield [Cocoa] FontPlatformData objects aren't cached at all when using font-family:system-ui https://bugs.webkit.org/show_bug.cgi?id=196846 Reviewed by Simon Fraser and Darin Adler. * wtf/RetainPtr.h: (WTF::safeCFEqual): (WTF::safeCFHash): 2019-04-12 Ryosuke Niwa HashTable::removeIf always shrinks the hash table by half even if there is nothing left https://bugs.webkit.org/show_bug.cgi?id=196681 Reviewed by Darin Adler. Made HashTable::removeIf shrink to the "best size", which is the least power of two bigger than twice the key count as already used in the copy constructor. * wtf/HashTable.h: (WTF::HashTable::computeBestTableSize): Extracted from the copy constructor. (WTF::HashTable::shrinkToBestSize): Added. (WTF::HashTable::removeIf): Use shrinkToBestSize instead of shrink. (WTF::HashTable::HashTable): 2019-04-12 Eric Carlson Update AudioSession route sharing policy https://bugs.webkit.org/show_bug.cgi?id=196776 Reviewed by Jer Noble. * wtf/Platform.h: Define HAVE_ROUTE_SHARING_POLICY_LONG_FORM_VIDEO. 2019-04-10 Said Abou-Hallawa requestAnimationFrame should execute before the next frame https://bugs.webkit.org/show_bug.cgi?id=177484 Reviewed by Simon Fraser. Add trace points for the page RenderingUpdate. * wtf/SystemTracing.h: 2019-04-10 Claudio Saavedra Do not generate empty unified sources when unified builds are disabled https://bugs.webkit.org/show_bug.cgi?id=196767 Reviewed by Konstantin Tokarev. If unified builds are disabled, the ruby script to generate them is still used to list the sources that need to be compiled. Currently, the script always generates bundled unified sources, even if it's being used just to list all the sources. So when the unified builds are disabled and no files are going to be bundled, the script generates one empty file per bundle manager (that is, one C++ and one ObjectiveC), that gets added to the sources to be compiled. * Scripts/generate-unified-source-bundles.rb: Only go through the bundle managers file generation when not running in PrintAllSources mode, to avoid generating empty bundle files. 2019-04-10 Enrique Ocaña González [WPE] Avoid async IO starving timers https://bugs.webkit.org/show_bug.cgi?id=196733 Reviewed by Carlos Garcia Campos. If AsyncIONetwork and DiskCacheRead priorities are higher than MainThreadSharedTimer the timers get starved. This causes the NetworkProcess to accumulate MB of data instead of handing it down to the WebProcess (done using a Timer). This eventually causes an Out Of Memory kill on the NetworkProcess on some embedded platforms with low memory limits. This patch levels the three priorities to the same value, while still leaving DiskCacheWrite with less priority than DiskCacheRead. * wtf/glib/RunLoopSourcePriority.h: Changed RunLoopSourcePriority values for WPE. 2019-04-09 Don Olmstead [CMake] WTF derived sources should only be referenced inside WTF https://bugs.webkit.org/show_bug.cgi?id=196706 Reviewed by Konstantin Tokarev. Use ${WTF_DERIVED_SOURCES_DIR} instead of ${DERIVED_SOURCES_DIR} within WTF. * wtf/CMakeLists.txt: * wtf/PlatformJSCOnly.cmake: * wtf/PlatformMac.cmake: 2019-04-09 Don Olmstead [CMake] Apple builds should use ICU_INCLUDE_DIRS https://bugs.webkit.org/show_bug.cgi?id=196720 Reviewed by Konstantin Tokarev. Copy ICU headers for Apple builds into ICU_INCLUDE_DIRS. * CMakeLists.txt: * wtf/PlatformMac.cmake: 2019-04-08 Don Olmstead [CMake][WinCairo] Separate copied headers into different directories https://bugs.webkit.org/show_bug.cgi?id=196655 Reviewed by Michael Catanzaro. * wtf/CMakeLists.txt: 2019-04-08 Guillaume Emont Enable DFG on MIPS https://bugs.webkit.org/show_bug.cgi?id=196689 Reviewed by Žan Doberšek. Since the bytecode change, we enabled the baseline JIT on mips in r240432, but DFG is still missing. With this change, all tests are passing on a ci20 board. * wtf/Platform.h: Enable DFG on MIPS by default. 2019-04-06 Ryosuke Niwa Added tests for WeakHashSet::computesEmpty and WeakHashSet::computeSize https://bugs.webkit.org/show_bug.cgi?id=196669 Reviewed by Geoffrey Garen. Removed the superflous type names from forward declarations, and made WeakHashSet::add take a const object to match other container types in WTF. * wtf/WeakHashSet.h: (WTF::WeakHashSet::add): * wtf/WeakPtr.h: 2019-04-05 Ryosuke Niwa Make WeakPtr possible and deploy it in form associated elements code https://bugs.webkit.org/show_bug.cgi?id=196626 Reviewed by Antti Koivisto. Make it possible to call WeakHashSet::remove and WeakHashSet::contains with a subclass type U of a type T used to define WeakReference. Also added computesEmpty, which is slightly more efficient than computeSize when m_set is either empty or when there are non-released weak references in the set. * wtf/WeakHashSet.h: (WTF::WeakHashSet::remove): (WTF::WeakHashSet::contains const): (WTF::WeakHashSet::computesEmpty const): Added. * wtf/WeakPtr.h: Added an explicit forward declaration of WeakHashSet to avoid build failures in GTK+ and WPE ports. 2019-04-05 Eric Carlson Remove AUDIO_TOOLBOX_AUDIO_SESSION https://bugs.webkit.org/show_bug.cgi?id=196653 Reviewed by Jer Noble. * wtf/Platform.h: 2019-04-05 Michael Catanzaro Unreviewed manual rollout of r243929 https://bugs.webkit.org/show_bug.cgi?id=196626 * wtf/WeakHashSet.h: (WTF::WeakHashSet::remove): (WTF::WeakHashSet::contains const): (WTF::WeakHashSet::computesEmpty const): Deleted. 2019-04-05 Commit Queue Unreviewed, rolling out r243833. https://bugs.webkit.org/show_bug.cgi?id=196645 This change breaks build of WPE and GTK ports (Requested by annulen on #webkit). Reverted changeset: "[CMake][WTF] Mirror XCode header directories" https://bugs.webkit.org/show_bug.cgi?id=191662 https://trac.webkit.org/changeset/243833 2019-04-05 Ryosuke Niwa Make WeakPtr possible and deploy it in form associated elements code https://bugs.webkit.org/show_bug.cgi?id=196626 Reviewed by Antti Koivisto. Make it possible to call WeakHashSet::remove and WeakHashSet::contains with a subclass type U of a type T used to define WeakReference. Also added computesEmpty, which is slightly more efficient than computeSize when m_set is either empty or when there are non-released weak references in the set. * wtf/WeakHashSet.h: (WTF::WeakHashSet::remove): (WTF::WeakHashSet::contains const): (WTF::WeakHashSet::computesEmpty const): Added. 2019-04-04 Yusuke Suzuki [WebCore] Put most of derived classes of ScriptWrappable into IsoHeap https://bugs.webkit.org/show_bug.cgi?id=196475 Reviewed by Saam Barati. * wtf/ForbidHeapAllocation.h: * wtf/IsoMalloc.h: * wtf/IsoMallocInlines.h: 2019-04-03 Don Olmstead [CMake][WTF] Mirror XCode header directories https://bugs.webkit.org/show_bug.cgi?id=191662 Reviewed by Konstantin Tokarev. Rename WTF forwarding header target to WTFFramework and update the install location to WTF_FRAMEWORK_HEADERS_DIR. * wtf/CMakeLists.txt: 2019-04-03 Joseph Pecoraro Web Inspector: Remote Inspector indicate callback should always happen on the main thread https://bugs.webkit.org/show_bug.cgi?id=196513 Reviewed by Devin Rousso. * wtf/MainThread.h: * wtf/cocoa/MainThreadCocoa.mm: (WTF::dispatchAsyncOnMainThreadWithWebThreadLockIfNeeded): * wtf/ios/WebCoreThread.cpp: * wtf/ios/WebCoreThread.h: 2019-04-02 Keith Rollin Inhibit CFNetwork logging in private sessions https://bugs.webkit.org/show_bug.cgi?id=196268 Fix a conditional in Platform.h where IOS should have been used instead of IOS_FAMILY. The latter happened to work, but we really want to be using the proper symbol here. Reviewed by Alexey Proskuryakov. * wtf/Platform.h: 2019-04-01 Michael Catanzaro Stop trying to support building JSC with clang 3.8 https://bugs.webkit.org/show_bug.cgi?id=195947 Reviewed by Darin Adler. It seems WebKit hasn't built with clang 3.8 in a while, no devs are using this compiler, we don't know how much effort it would be to make JSC work again, and it's making the code worse. Remove my hacks to support clang 3.8 from WTF. * wtf/MetaAllocator.cpp: (WTF::MetaAllocator::allocate): * wtf/text/StringConcatenate.h: (WTF::tryMakeStringFromAdapters): 2019-03-31 Yusuke Suzuki [JSC] Butterfly allocation from LargeAllocation should try "realloc" behavior if collector thread is not active https://bugs.webkit.org/show_bug.cgi?id=196160 Reviewed by Saam Barati. * wtf/FastMalloc.h: (WTF::FastMalloc::tryRealloc): * wtf/Gigacage.cpp: (Gigacage::tryRealloc): * wtf/Gigacage.h: 2019-03-31 Andy Estes [iOS] WebKit should consult the navigation response policy delegate before previewing a QuickLook document https://bugs.webkit.org/show_bug.cgi?id=196433 Reviewed by Tim Horton. * wtf/NeverDestroyed.h: (WTF::NeverDestroyed::operator->): (WTF::NeverDestroyed::operator-> const): 2019-03-28 Fujii Hironori Unreviewed build fix. * wtf/CMakeLists.txt: Added SpanningTree.h to WTF_PUBLIC_HEADERS. 2019-03-28 Saam Barati BackwardsGraph needs to consider back edges as the backward's root successor https://bugs.webkit.org/show_bug.cgi?id=195991 Reviewed by Filip Pizlo. Previously, our backwards graph analysis was slightly wrong. The idea of backwards graph is that the root of the graph has edges to terminals in the original graph. And then the original directed edges in the graph are flipped. However, we weren't considering loops as a form of terminality. For example, we wouldn't consider an infinite loop as a terminal. So there were no edges from the root to a node in the infinite loop. This lead us to make mistakes when we used backwards dominators to compute control flow equivalence. This is better understood in an example: ``` preheader: while (1) { if (!isCell(v)) continue; load structure ID if (cond) continue; return } ``` In the previous version of this algorithm, the only edge from the backwards root would be to the block containing the return. This would lead us to believe that the loading of the structureID backwards dominates the preheader, leading us to believe it's control flow equivalent to preheader. This is obviously wrong, since we can loop forever if "v" isn't a cell. The solution here is to treat any backedge in the graph as a "terminal" node. Since a backedge implies the existence of a loop. In the above example, the backwards root now has an edge to both blocks with "continue". This prevents us from falsely claiming that the return is control flow equivalent with the preheader. This patch uses DFS spanning trees to compute back edges. An edge u->v is a back edge when u is a descendent of v in the DFS spanning tree of the Graph. * WTF.xcodeproj/project.pbxproj: * wtf/BackwardsGraph.h: (WTF::BackwardsGraph::BackwardsGraph): * wtf/SpanningTree.h: Added. (SpanningTree::SpanningTree): (SpanningTree::isDescendent): 2019-03-28 Tim Horton Un-fix the build * wtf/Platform.h: It is no longer necessary to exclude this from PLATFORM(IOSMAC). 2019-03-27 Per Arne Vollan Layout Test js/math-clz32.html is failing https://bugs.webkit.org/show_bug.cgi?id=196209 Reviewed by Ross Kirsling. Use the correct number of loop iterations when counting leading zeros. Also, the count was off by one for the Win64 case. * wtf/MathExtras.h: (WTF::clz): 2019-03-26 Keith Rollin Inhibit CFNetwork logging in private sessions https://bugs.webkit.org/show_bug.cgi?id=196268 Reviewed by Alex Christensen. Before performing any logging, the NetworkProcess checks to see if it's performing an operation associated with a private (ephemeral) browsing session. If so, it skips the logging. However, networking layers below the NetworkProcess don't know about private browsing, so they would still perform their own logging. CFNetwork now has a flag that lets us control that, so set it to False if private browsing. * wtf/Platform.h: 2019-03-25 Alex Christensen Expected shouldn't assume its contained types are copyable https://bugs.webkit.org/show_bug.cgi?id=195986 Reviewed by JF Bastien. * wtf/Expected.h: (std::experimental::fundamentals_v3::__expected_detail::constexpr_base::constexpr_base): (std::experimental::fundamentals_v3::operator==): (std::experimental::fundamentals_v3::operator!=): * wtf/Unexpected.h: (std::experimental::fundamentals_v3::unexpected::unexpected): 2019-03-24 Keith Miller Unreviewed, forgot to refactor variable name for windows build in r243418. * wtf/MathExtras.h: (WTF::clz): (WTF::ctz): 2019-03-24 Andy Estes [watchOS] Remove unused Proximity Networking code https://bugs.webkit.org/show_bug.cgi?id=196188 Reviewed by Tim Horton. * wtf/FeatureDefines.h: 2019-03-23 Keith Miller Refactor clz/ctz and fix getLSBSet. https://bugs.webkit.org/show_bug.cgi?id=196162 Reviewed by Saam Barati. This patch makes clz32/64 and ctz32 generic so they work on any numeric type. Since these methods work on any type we don't need to have a separate implementation of getLSBSet, which also happened to be getMSBSet. This patch also adds getMSBSet as there may be users who want that in the future. * wtf/MathExtras.h: (WTF::clz): (WTF::ctz): (WTF::getLSBSet): (WTF::getMSBSet): (getLSBSet): Deleted. (WTF::clz32): Deleted. (WTF::clz64): Deleted. (WTF::ctz32): Deleted. 2019-03-22 Keith Rollin Enable ThinLTO support in Production builds https://bugs.webkit.org/show_bug.cgi?id=190758 Reviewed by Daniel Bates. Enable building with Thin LTO in Production when using Xcode 10.2 or later. This change results in a 1.45% progression in PLT5. Full Production build times increase about 2-3%. Incremental build times are more severely affected, and so LTO is not enabled for local engineering builds. LTO is enabled only on macOS for now, until rdar://problem/49013399, which affects ARM builds, is fixed. To change the LTO setting when building locally: - If building with `make`, specify WK_LTO_MODE={none,thin,full} on the command line. - If building with `build-webkit`, specify --lto-mode={none,thin,full} on the command line. - If building with `build-root`, specify --lto={none,thin,full} on the command line. - If building with Xcode, create a LocalOverrides.xcconfig file at the top level of your repository directory (if needed) and define WK_LTO_MODE to full, thin, or none. * Configurations/Base.xcconfig: 2019-03-22 Tim Horton Fix the build after r243354 * wtf/Platform.h: 2019-03-22 Tim Horton Fix the build after r243354 https://bugs.webkit.org/show_bug.cgi?id=196138 * wtf/Platform.h: 2019-03-21 Eric Carlson Add UI process WebRTC runtime logging. https://bugs.webkit.org/show_bug.cgi?id=196020 Reviewed by Youenn Fablet. * wtf/Logger.h: (WTF::LogArgument::toString): Add long long and unsigned long long variants. 2019-03-20 Simon Fraser Rename ENABLE_ACCELERATED_OVERFLOW_SCROLLING macro to ENABLE_OVERFLOW_SCROLLING_TOUCH https://bugs.webkit.org/show_bug.cgi?id=196049 Reviewed by Tim Horton. This macro is about the -webkit-overflow-scrolling CSS property, not accelerated overflow scrolling in general, so rename it. * wtf/FeatureDefines.h: 2019-03-20 Mark Lam Open source arm64e code. https://bugs.webkit.org/show_bug.cgi?id=196012 Reviewed by Keith Miller. * WTF.xcodeproj/project.pbxproj: * wtf/BlockPtr.h: * wtf/Platform.h: * wtf/PlatformRegisters.cpp: Added. (WTF::threadStateLRInternal): (WTF::threadStatePCInternal): * wtf/PlatformRegisters.h: * wtf/PointerPreparations.h: * wtf/PtrTag.cpp: Added. (WTF::tagForPtr): (WTF::ptrTagName): (WTF::registerPtrTagLookup): (WTF::reportBadTag): * wtf/PtrTag.h: (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImplHelper): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagInt): (WTF::assertIsCFunctionPtr): (WTF::assertIsNullOrCFunctionPtr): (WTF::assertIsNotTagged): (WTF::assertIsTagged): (WTF::assertIsNullOrTagged): (WTF::isTaggedWith): (WTF::assertIsTaggedWith): (WTF::assertIsNullOrTaggedWith): (WTF::usesPointerTagging): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::tagForPtr): Deleted. 2019-03-20 Keith Rollin Update checks that determine if WebKit is system WebKit https://bugs.webkit.org/show_bug.cgi?id=195756 Reviewed by Alexey Proskuryakov. The system WebKit can be installed in additional locations, so check for and allow those, too. * wtf/Platform.h: 2019-03-20 Michael Catanzaro Unreviewed, further attempt to fix clang 3.8 build https://bugs.webkit.org/show_bug.cgi?id=195947 * wtf/MetaAllocator.cpp: (WTF::MetaAllocator::allocate): 2019-03-20 Michael Catanzaro REGRESSION(r243115) breaks build for clang 3.8 https://bugs.webkit.org/show_bug.cgi?id=195947 Reviewed by Chris Dumez. * wtf/text/StringConcatenate.h: (WTF::tryMakeStringFromAdapters): 2019-03-20 Tim Horton Add an platform-driven spell-checking mechanism https://bugs.webkit.org/show_bug.cgi?id=195795 Reviewed by Ryosuke Niwa. * wtf/Platform.h: Add an ENABLE flag. 2019-03-19 Michael Catanzaro Build cleanly with GCC 9 https://bugs.webkit.org/show_bug.cgi?id=195920 Reviewed by Chris Dumez. WebKit triggers three new GCC 9 warnings: """ -Wdeprecated-copy, implied by -Wextra, warns about the C++11 deprecation of implicitly declared copy constructor and assignment operator if one of them is user-provided. """ Solution is to either add a copy constructor or copy assignment operator, if required, or else remove one if it is redundant. """ -Wredundant-move, implied by -Wextra, warns about redundant calls to std::move. -Wpessimizing-move, implied by -Wall, warns when a call to std::move prevents copy elision. """ These account for most of this patch. Solution is to just remove the bad WTFMove(). Additionally, -Wclass-memaccess has been enhanced to catch a few cases that GCC 8 didn't. These are solved by casting nontrivial types to void* before using memcpy. (Of course, it would be safer to not use memcpy on nontrivial types, but that's too complex for this patch. Searching for memcpy used with static_cast will reveal other cases to fix.) * wtf/CheckedArithmetic.h: (WTF::Checked::Checked): * wtf/MetaAllocator.cpp: (WTF::MetaAllocator::allocate): * wtf/URLParser.cpp: (WTF::CodePointIterator::operator!= const): (WTF::CodePointIterator::operator=): Deleted. * wtf/text/StringView.h: (WTF::StringView::CodePoints::Iterator::operator=): Deleted. 2019-03-19 Alex Christensen Make WTFLogChannelState and WTFLogLevel enum classes https://bugs.webkit.org/show_bug.cgi?id=195904 Reviewed by Eric Carlson. * wtf/Assertions.cpp: * wtf/Assertions.h: * wtf/Logger.h: (WTF::Logger::logAlways const): (WTF::Logger::error const): (WTF::Logger::warning const): (WTF::Logger::info const): (WTF::Logger::debug const): (WTF::Logger::willLog const): (WTF::Logger::log): * wtf/MemoryPressureHandler.cpp: * wtf/RefCountedLeakCounter.cpp: 2019-03-19 Michael Catanzaro Unreviewed, rolling out r243132. Broke GTK build Reverted changeset: "Make WTFLogChannelState and WTFLogLevel enum classes" https://bugs.webkit.org/show_bug.cgi?id=195904 https://trac.webkit.org/changeset/243132 2019-03-18 Alex Christensen Make WTFLogChannelState and WTFLogLevel enum classes https://bugs.webkit.org/show_bug.cgi?id=195904 Reviewed by Eric Carlson. * wtf/Assertions.cpp: * wtf/Assertions.h: * wtf/Logger.h: (WTF::Logger::logAlways const): (WTF::Logger::error const): (WTF::Logger::warning const): (WTF::Logger::info const): (WTF::Logger::debug const): (WTF::Logger::willLog const): (WTF::Logger::log): * wtf/MemoryPressureHandler.cpp: * wtf/RefCountedLeakCounter.cpp: 2019-03-18 Darin Adler Cut down on use of StringBuffer, possibly leading toward removing it entirely https://bugs.webkit.org/show_bug.cgi?id=195870 Reviewed by Daniel Bates. * wtf/URL.cpp: Remove a now-inaccurate comment mentioning StringBuffer. * wtf/text/StringView.cpp: (WTF::convertASCIICase): Use createUninitialized instead of StringBuffer. 2019-03-18 Xan Lopez [WTF] Remove redundant std::move in StringConcatenate https://bugs.webkit.org/show_bug.cgi?id=195798 Reviewed by Darin Adler. Remove redundant calls to WTFMove in return values for this method. C++ will already do an implicit move here since we are returning a local value where copy/move elision is not applicable. * wtf/text/StringConcatenate.h: (WTF::tryMakeStringFromAdapters): 2019-03-16 Darin Adler Improve normalization code, including moving from unorm.h to unorm2.h https://bugs.webkit.org/show_bug.cgi?id=195330 Reviewed by Michael Catanzaro. * wtf/URLHelpers.cpp: Removed unneeded include of unorm.h since the normalization code is now in StringView.cpp. (WTF::URLHelpers::escapeUnsafeCharacters): Renamed from createStringWithEscapedUnsafeCharacters since it now only creates a new string if one is needed. Use unsigned for string lengths, since that's what WTF::String uses, not size_t. Added a first loop so that we can return the string unmodified if no lookalike characters are found. Removed unnecessary round trip from UTF-16 and then back in the case where the character is not a lookalike. (WTF::URLHelpers::toNormalizationFormC): Deleted. Moved this logic into the WTF::normalizedNFC function in StringView.cpp. (WTF::URLHelpers::userVisibleURL): Call escapeUnsafeCharacters and normalizedNFC. The normalizedNFC function is better in multiple ways, but primarily it handles 8-bit strings and other already-normalized strings much more efficiently. * wtf/text/StringView.cpp: (WTF::normalizedNFC): Added. This has two overloads. One is for when we already have a String, and want to re-use it if no normalization is needed, and another is when we only have a StringView, and may need to allocate a String to hold the result. Includes a fast special case for 8-bit and already-normalized strings, and uses the same strategy that JSC::normalize was already using: calls unorm2_normalize twice, first just to determine the length. * wtf/text/StringView.h: Added normalizedNFC, which can be called with either a StringView or a String. Also moved StringViewWithUnderlyingString here from JSString.h, here for use as the return value of normalizedNFC; it is used for a similar purpose in the JavaScriptCore rope implementation. Also removed an inaccurate comment. 2019-03-16 Diego Pino Garcia [GTK] [WPE] Fix compilation errors due to undefined ALWAYS_LOG_IF https://bugs.webkit.org/show_bug.cgi?id=195850 Unreviewed build fix after r243033. * wtf/LoggerHelper.h: 2019-03-15 Per Arne Vollan [iOS] Block the accessibility server when accessibility is not enabled. https://bugs.webkit.org/show_bug.cgi?id=195342 Reviewed by Brent Fulgham. Add SPI to issue a mach extension to a process by pid. Also, add a macro for the availability of this SPI. * wtf/Platform.h: * wtf/spi/darwin/SandboxSPI.h: 2019-03-15 Eric Carlson Add media stream release logging https://bugs.webkit.org/show_bug.cgi?id=195823 Reviewed by Youenn Fablet. * wtf/LoggerHelper.h: Add LOG_IF variants that check a condition before logging. 2019-03-15 Truitt Savell Unreviewed, rolling out r243008. This revision broke High Sierra builders Reverted changeset: "[iOS] Block the accessibility server when accessibility is not enabled." https://bugs.webkit.org/show_bug.cgi?id=195342 https://trac.webkit.org/changeset/243008 2019-03-15 Per Arne Vollan [iOS] Block the accessibility server when accessibility is not enabled. https://bugs.webkit.org/show_bug.cgi?id=195342 Reviewed by Brent Fulgham. Add SPI to issue a mach extension to a process by pid. * wtf/spi/darwin/SandboxSPI.h: 2019-03-13 Sam Weinig Add utility function to allow easy reverse range-based iteration of a container https://bugs.webkit.org/show_bug.cgi?id=195542 Reviewed by Antti Koivisto. Add functions to create an IteratorRange that will iterate a container backwards. It works with any container that is compatible with std::rbegin() and std::rend(). It is expected to be used in conjunction with range-based for-loops like so: for (auto& value : WTF::makeReversedRange(myContainer)) ... * wtf/IteratorRange.h: (WTF::makeReversedRange): 2019-03-13 Keith Rollin Add support for new StagedFrameworks layout https://bugs.webkit.org/show_bug.cgi?id=195543 Reviewed by Alexey Proskuryakov. Opportunistic cleanup: remove unused JAVASCRIPTCORE_FRAMEWORKS_DIR variable. * Configurations/Base.xcconfig: 2019-03-13 Dominik Infuehr String overflow when using StringBuilder in JSC::createError https://bugs.webkit.org/show_bug.cgi?id=194957 Reviewed by Mark Lam. When calculating the new capacity of a StringBuilder object, use a limit of MaxLength instead of MaxLength+1. Allocating a string of size MaxLength+1 always fails. This means that expanding a StringBuilder only worked when the newly doubled capacity is less or equal to MaxLength. * wtf/text/StringBuilder.cpp: 2019-03-13 Chris Dumez Better build fix after r242901. Reviewed by Jer Noble. * wtf/Logger.h: (WTF::LogArgument::toString): 2019-03-13 Jer Noble Add AggregateLogger, a Logger specialization for singleton classes. https://bugs.webkit.org/show_bug.cgi?id=195644 Reviewed by Eric Carlson. Add a new class, AggregateLogger, which will log messages to each of its aggregated loggers. Drive-by fixes: allow "const void*" to be directly logged by converting the pointer to a hex string. * WTF.xcodeproj/project.pbxproj: * wtf/AggregateLogger.h: Added. (WTF::AggregateLogger::create): (WTF::AggregateLogger::addLogger): (WTF::AggregateLogger::removeLogger): (WTF::AggregateLogger::logAlways const): (WTF::AggregateLogger::error const): (WTF::AggregateLogger::warning const): (WTF::AggregateLogger::info const): (WTF::AggregateLogger::debug const): (WTF::AggregateLogger::willLog const): (WTF::AggregateLogger::AggregateLogger): (WTF::AggregateLogger::log const): * wtf/CMakeLists.h: * wtf/Logger.cpp: (WTF::>::toString): * wtf/Logger.h: 2019-03-12 Commit Queue Unreviewed, rolling out r242747. https://bugs.webkit.org/show_bug.cgi?id=195641 Performance measurement is difficult in this period, rolling out it and rolling in later to isolate it from the other sensitive patches (Requested by yusukesuzuki on #webkit). Reverted changeset: "[JSC] Make StaticStringImpl & StaticSymbolImpl actually static" https://bugs.webkit.org/show_bug.cgi?id=194212 https://trac.webkit.org/changeset/242747 2019-03-12 Robin Morisset A lot more classes have padding that can be reduced by reordering their fields https://bugs.webkit.org/show_bug.cgi?id=195579 Reviewed by Mark Lam. * wtf/CrossThreadQueue.h: * wtf/Logger.h: * wtf/MemoryPressureHandler.h: * wtf/MetaAllocator.h: * wtf/Threading.cpp: 2019-03-11 Alex Christensen WTF::Expected should use std::addressof instead of operator& https://bugs.webkit.org/show_bug.cgi?id=195604 Reviewed by Myles Maxfield. The latter was causing problems with types that do tricky things with constructors and operator&, specifically UniqueRef but I made a reduced test case. When it used operator&, it would get the contained type and call the constructor that takes a contained type instead of the move constructor. * wtf/Expected.h: (std::experimental::fundamentals_v3::__expected_detail::base::base): (std::experimental::fundamentals_v3::expected::swap): 2019-03-11 Ross Kirsling Add Optional to Forward.h. https://bugs.webkit.org/show_bug.cgi?id=195586 Reviewed by Darin Adler. * wtf/Forward.h: Add forward declaration for Optional. * wtf/CPUTime.h: * wtf/Expected.h: * wtf/MainThread.h: * wtf/MemoryFootprint.h: * wtf/URLHelpers.cpp: * wtf/URLHelpers.h: * wtf/cocoa/CPUTimeCocoa.cpp: * wtf/fuchsia/CPUTimeFuchsia.cpp: * wtf/unix/CPUTimeUnix.cpp: * wtf/win/CPUTimeWin.cpp: Remove unnecessary includes from headers. 2019-03-11 Andy Estes [Apple Pay] Use PKPaymentAuthorizationController to present the Apple Pay UI remotely from the Networking service on iOS https://bugs.webkit.org/show_bug.cgi?id=195530 Reviewed by Alex Christensen. * wtf/FeatureDefines.h: Defined ENABLE_APPLE_PAY_REMOTE_UI. 2019-03-11 Yusuke Suzuki [JSC] Make StaticStringImpl & StaticSymbolImpl actually static https://bugs.webkit.org/show_bug.cgi?id=194212 Reviewed by Mark Lam. Avoid mutation onto refcounts if `isStatic()` returns true so that the content of StaticStringImpl never gets modified. * wtf/text/StringImpl.h: (WTF::StringImpl::ref): (WTF::StringImpl::deref): 2019-03-11 Sihui Liu Crash under WebCore::IDBDatabase::connectionToServerLost https://bugs.webkit.org/show_bug.cgi?id=195563 CrossThreadTask should protect callee if it is ThreadSafeRefCounted. Reviewed by Geoffrey Garen. * wtf/CrossThreadTask.h: (WTF::createCrossThreadTask): 2019-03-11 Ryan Haddad Unreviewed, rolling out r242688, r242643, r242624. Caused multiple layout test failures and crashes on iOS and macOS. Reverted changeset: "requestAnimationFrame should execute before the next frame" https://bugs.webkit.org/show_bug.cgi?id=177484 https://trac.webkit.org/changeset/242624/webkit * wtf/SystemTracing.h: 2019-03-11 Darin Adler Specify fixed precision explicitly to prepare to change String::number and StringBuilder::appendNumber floating point behavior https://bugs.webkit.org/show_bug.cgi?id=195533 Reviewed by Brent Fulgham. Soon, we will change String::number and StringBuilder::appendNumber for floating point to use "shortest form" serialization instead of the current default, which is "6-digit fixed precision stripping trailing zeros". To prepare to do this safely without accidentally changing any behavior, changing callers to call the explicit versions. Later, we may want to return and change many of them to use shortest form instead, but that may require rebaselining tests, and in some extreme cases, getting rid of flawed logic that converts between different single and double precision floating point; such problems may be hidden by fixed precision serialization. Since "shortest form" is already the behavior for AtomicString::number and for makeString, no changes required for clients of either of those. * wtf/Logger.h: (WTF::LogArgument::toString): Use numberToStringFixedPrecision. * wtf/MediaTime.cpp: (WTF::MediaTime::toString const): Use appendFixedPrecisionNumber. * wtf/text/ValueToString.h: (WTF::ValueToString::string): Use numberToStringFixedPrecision. (WTF::ValueToString::string): Ditto. 2019-03-11 Truitt Savell Unreviewed, rolling out r242702. Broke High Sierra builders. Reverted changeset: "Add utility function to allow easy reverse range-based iteration of a container" https://bugs.webkit.org/show_bug.cgi?id=195542 https://trac.webkit.org/changeset/242702 2019-03-11 Sam Weinig Add utility function to allow easy reverse range-based iteration of a container https://bugs.webkit.org/show_bug.cgi?id=195542 Reviewed by Antti Koivisto. Add functions to create an IteratorRange that will iterate a container backwards. It works with any container that is compatible with std::rbegin() and std::rend(). It is expected to be used in conjunction with range-based for-loops like so: for (auto& value : WTF::makeReversedRange(myContainer)) ... * wtf/IteratorRange.h: (WTF::makeReversedRange): 2019-03-10 Yusuke Suzuki and Fujii Hironori [WTF] Align assumption in RunLoopWin to the other platform's RunLoop https://bugs.webkit.org/show_bug.cgi?id=181151 Reviewed by Don Olmstead. This patch fixes RunLoop in Windows to align it to the implementations in the other platforms to use RunLoop more aggressively. * wtf/RunLoop.h: (WTF::RunLoop::Timer::Timer): * wtf/win/MainThreadWin.cpp: (initializeMainThreadPlatform): Call RunLoop::registerRunLoopMessageWindowClass. * wtf/win/RunLoopWin.cpp: (WTF::RunLoop::wndProc): (WTF::RunLoop::iterate): (WTF::RunLoop::stop): PostQuitMessage is only available in the RunLoop's thread. We should post a message and call it inside this task. (WTF::RunLoop::registerRunLoopMessageWindowClass): Changed the return type from bool to void, and added RELEASE_ASSERT to check the return value of RegisterClass. (WTF::RunLoop::~RunLoop): When the RunLoop's thread is freed, its associated window is freed. We do not need to do here. (WTF::RunLoop::TimerBase::timerFired): (WTF::RunLoop::TimerBase::TimerBase): (WTF::RunLoop::TimerBase::start): (WTF::RunLoop::TimerBase::stop): (WTF::RunLoop::TimerBase::isActive const): (WTF::RunLoop::TimerBase::secondsUntilFire const): (WTF::generateTimerID): Deleted. We can use TimerBase's pointer as ID since it is uintptr_t. 2019-03-07 Said Abou-Hallawa requestAnimationFrame should execute before the next frame https://bugs.webkit.org/show_bug.cgi?id=177484 Reviewed by Simon Fraser. Add trace points for the page RenderingUpdate. * wtf/SystemTracing.h: 2019-03-06 Ross Kirsling [Win] Remove -DUCHAR_TYPE=wchar_t stopgap and learn to live with char16_t. https://bugs.webkit.org/show_bug.cgi?id=195346 Reviewed by Fujii Hironori. * wtf/PlatformWin.cmake: * wtf/text/AtomicString.h: (WTF::AtomicString::AtomicString): * wtf/text/WTFString.h: (WTF::String::String): * wtf/text/win/StringWin.cpp: Added. (WTF::String::wideCharacters const): Renamed from WTF::stringToNullTerminatedWChar. * wtf/text/win/WCharStringExtras.h: (WTF::ucharFrom): (WTF::wcharFrom): (WTF::stringToNullTerminatedWChar): Deleted. (WTF::wcharToString): Deleted. (WTF::nullTerminatedWCharToString): Deleted. Add static_assert-guarded reinterpret_cast wrappers for going between UChar* and wchar_t*. Move existing to/from-String helpers into the String (and AtomicString) class(es). * wtf/win/FileSystemWin.cpp: (WTF::FileSystemImpl::getFindData): (WTF::FileSystemImpl::getFinalPathName): (WTF::FileSystemImpl::createSymbolicLink): (WTF::FileSystemImpl::deleteFile): (WTF::FileSystemImpl::deleteEmptyDirectory): (WTF::FileSystemImpl::moveFile): (WTF::FileSystemImpl::pathByAppendingComponent): (WTF::FileSystemImpl::fileSystemRepresentation): (WTF::FileSystemImpl::makeAllDirectories): (WTF::FileSystemImpl::pathGetFileName): (WTF::FileSystemImpl::storageDirectory): (WTF::FileSystemImpl::generateTemporaryPath): (WTF::FileSystemImpl::openTemporaryFile): (WTF::FileSystemImpl::openFile): (WTF::FileSystemImpl::hardLinkOrCopyFile): (WTF::FileSystemImpl::deleteNonEmptyDirectory): * wtf/win/LanguageWin.cpp: (WTF::localeInfo): * wtf/win/PathWalker.cpp: (WTF::PathWalker::PathWalker): Use wchar helpers as needed. 2019-02-28 Ryosuke Niwa Add WeakHashSet https://bugs.webkit.org/show_bug.cgi?id=195152 Reviewed by Antti Koivisto. Added WeakHashSet which is a HashSet of WeakPtr. When the object pointed by WeakPtr is deleted, WeakHashSet treats the key to be no longer in the set. That is, WeakHashSet::contains returns false and const_iterator skips such a WeakPtr in the set. We decided not to make HashSet> work because it involves weird semantics such as making find(X) delete the table entry as remove(find(X)) would be a no-op otherwise as find(X) would return necessarily need to return HashSet>::end(). Furthermore, we cannot determine the true size of this set in O(1) because the objected pointed by some of WeakPtr in the set may have already been deleted. This has implications that we can't have size(), isEmpty(), random(), etc... as O(1) operation. WeakHashSet is implemented as HashSet>. HashTable::rehash has been updated to delete WeakReference's whose m_ptr has become null, and HashTable::expand first deletes any such entry before deciding an actual expansion is needed. This is accomplished via newly added hash trait, hasIsReleasedWeakValueFunction, and HashTraits>>::isReleasedWeakValue which returns true for when WeakReference pointed by Ref> has null m_ptr, not to be confused with Ref> itself pointing to a null WeakReference. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Forward.h: * wtf/HashSet.h: (WTF::HashSet::checkConsistency const): Added. * wtf/HashTable.h: (WTF::HashTable::isReleasedWeakBucket): Added. (WTF::HashTable::expand): Delete WeakReference with null m_ptr first. This updates m_keyCount and may make mustRehashInPlace() return true. (WTF::HashTable::deleteReleasedWeakBuckets): Added. (WTF::HashTable::rehash): Delete WeakReference with null m_ptr. Also refactored the code a bit to avoid keep repeating oldTable[i]. * wtf/HashTraits.h: (WTF::HashTraits::isHashTraitsReleasedWeakValue): Added. (WTF::RefHashTraits): Extracted from HashTraits> to share code with HashTraits>>. (WTF::HashTraitsReleasedWeakValueChecker): Added. (WTF::isHashTraitsReleasedWeakValue): Added. * wtf/WeakHashSet.h: Added. (WTF::WeakHashSet): Added. (WTF::WeakHashSet::WeakHashSetConstIterator::WeakHashSetConstIterator): (WTF::WeakHashSet::WeakHashSetConstIterator::get const): (WTF::WeakHashSet::WeakHashSetConstIterator::operator* const): (WTF::WeakHashSet::WeakHashSetConstIterator::operator-> const): (WTF::WeakHashSet::WeakHashSetConstIterator::operator++): (WTF::WeakHashSet::WeakHashSetConstIterator::skipEmptyBuckets): (WTF::WeakHashSet::WeakHashSetConstIterator::operator== const): (WTF::WeakHashSet::WeakHashSetConstIterator::operator!= const): (WTF::WeakHashSet::WeakHashSet): (WTF::WeakHashSet::begin const): (WTF::WeakHashSet::end const): (WTF::WeakHashSet::add): (WTF::WeakHashSet::remove): (WTF::WeakHashSet::contains const): (WTF::WeakHashSet::capacity const): (WTF::WeakHashSet::computeSize const): Deletes any WeakReference with null m_ptr first. (WTF::WeakHashSet::checkConsistency const): (WTF::HashTraits>>): Added. This hash traits triggers the new code in HashTable's expand and rehash methods to delete WeakReference with null m_ptr. (WTF::HashTraits>>::isReleasedWeakValue): * wtf/WeakPtr.h: (WTF::WeakReference::~WeakReference): Added so that we can keep track the number of live WeakReference in API tests by template specializations. 2019-03-03 Darin Adler Prepare to improve handling of conversion of float to strings https://bugs.webkit.org/show_bug.cgi?id=195262 Reviewed by Daniel Bates. * wtf/dtoa.cpp: (WTF::truncateTrailingZeros): Renamed from formatStringTruncatingTrailingZerosIfNeeded and removed the calls to double_conversion::StringBuilder::Finalizer, since the caller already does that. (WTF::numberToFixedPrecisionString): Added an overload for float and updated to use the new truncateTrailingZeros. (WTF::numberToFixedWidthString): Added an overload for float. * wtf/text/AtomicString.cpp: (WTF::AtomicString::number): Added float overload. This is a behavior change, but in all cases for the better. The old behavior was to convert to double first and then do "shortest form" conversion, and it's always better to just do that as float. * wtf/text/AtomicString.h: Added float overload of AtomicString::number. * wtf/text/StringBuilder.cpp: (WTF::StringBuilder::appendFixedPrecisionNumber): Added float overload. (WTF::StringBuilder::appendShortestFormNumber): Renamed from appendECMAScriptNumber and did the above. (WTF::StringBuilder::appendFixedWidthNumber): Ditto. * wtf/text/StringBuilder.h: Added overloads for float and appendShortestFormNumber. The appendNumber and appendECMAScriptNumber functions are now inlines in the header, since they are expressed entirely in terms of the other functions. * wtf/text/WTFString.cpp: (WTF::String::numberToStringFixedPrecision): Added float overload. Removed unnecessary explicit conversion to String. (WTF::String::numberToStringShortest): Renamed from numberToStringECMAScript and did the above. (WTF::String::numberToStringFixedWidth): Ditto. * wtf/text/WTFString.h: Added overloads for float and numberToStringShortest. The number and numberToStringECMAScript functions are now inlines in the header, since they are expressed entirely in terms of the other functions. 2019-03-04 Andy Estes [Apple Pay] Move WebPaymentCoordinatorProxy from Source/WebKit/UIProcess to Source/WebKit/Shared https://bugs.webkit.org/show_bug.cgi?id=195080 Reviewed by Antti Koivisto. * wtf/FeatureDefines.h: 2019-03-04 Michael Catanzaro URLHelpers should use unorm2_quickCheck before converting to NFC https://bugs.webkit.org/show_bug.cgi?id=194272 Reviewed by Darin Adler. If the string is already in normalization form C, don't try to normalize it. * wtf/URLHelpers.cpp: (WTF::URLHelpers::toNormalizationFormC): 2019-03-02 Darin Adler Retire legacy dtoa function and DecimalNumber class https://bugs.webkit.org/show_bug.cgi?id=195253 Reviewed by Daniel Bates. * WTF.xcodeproj/project.pbxproj: Removed DecimalNumber.cpp/h. * wtf/CMakeLists.txt: Ditto. * wtf/DecimalNumber.cpp: Removed. * wtf/DecimalNumber.h: Removed. * wtf/JSONValues.cpp: (WTF::JSONImpl::Value::writeJSON const): Use StringBuilder::appendECMAScriptNumber instead of custom logic using the DecimalNumber class. * wtf/dtoa.cpp: (WTF::storeInc): Deleted. (WTF::BigInt): Deleted. (WTF::multadd): Deleted. (WTF::hi0bits): Deleted. (WTF::lo0bits): Deleted. (WTF::i2b): Deleted. (WTF::mult): Deleted. (WTF::P5Node::P5Node): Deleted. (WTF::pow5mult): Deleted. (WTF::lshift): Deleted. (WTF::cmp): Deleted. (WTF::diff): Deleted. (WTF::d2b): Deleted. (WTF::quorem): Deleted. (WTF::dtoa): Deleted. * wtf/dtoa.h: Removed DtoaBuffer, dtoa, and NumberToStringBufferLength. 2019-02-27 Darin Adler Fixed makeString(float) to do shortest-form serialization without first converting to double https://bugs.webkit.org/show_bug.cgi?id=195142 Reviewed by Daniel Bates. * wtf/DecimalNumber.cpp: Removed unneeded includes. * wtf/DecimalNumber.h: Removed unused constructors; over time we will be deprecating DecimalNumber, so we should removed the unused parts. Also marked the constructor explicit, removed types used only for arguments for the constructors, and removed the sign, exponent, significand, and precision member functions. * wtf/JSONValues.cpp: (WTF::JSONImpl::Value::writeJSON const): Updated for changes to DecimalNumber switched from NumberToLStringBuffer to NumberToStringBuffer, and for use of std::array instead of C arrays. * wtf/dtoa.cpp: Removed unused dtoaRoundSF and dtoaRoundDP functions. (WTF::dtoa): Updated to use std::array instead of C arrays. (WTF::dtoaRoundSF): Removed. (WTF::dtoaRoundDP): Removed. (WTF::numberToString): Added an overload for float and updated to use std::array. (WTF::formatStringTruncatingTrailingZerosIfNeeded): Updated to use std::array. (WTF::numberToFixedPrecisionString): Ditto. (WTF::numberToFixedWidthString): Ditto. * wtf/dtoa.h: Changed arrays to be std::array instead of C arrays so the array types will be checked. Removed dtoaRoundSF and dtoaRoundDP. Added float overloads for numberToString, numberToFixedPrecisionString, and numberToFixedWidthString. The only one of these that is called at this time is numberToString, called by the floating point StringTypeAdapter in StringConcatenateNummbers.h. * wtf/text/StringConcatenateNumbers.h: Updated for std::array. 2019-03-01 Darin Adler Finish removing String::format https://bugs.webkit.org/show_bug.cgi?id=194893 Reviewed by Daniel Bates. * wtf/Assertions.cpp: (WTF::createWithFormatAndArguments): Moved this here from WTFString.cpp. (WTFLog): Use WTF::createWithFormatAndArguments instead of String::format. * wtf/HexNumber.h: Deleted unneeded toString function. * wtf/text/StringConcatenate.h: Got rid of unneeded forward declaration of StringTypeAdapter, since that's now in Forward.h. Tweaked formatting of templates a bit. Use function templates for writeTo functions rather than having two of each. Removed unused toString functions. Optimized case where we use have a UChar* and a length of zero to not force the result to be 16-bit. Also gets rid of a small NO_RETURN_DUE_TO_CRASH mess that we don't need. Refactored constructors to use some static member helper functions to compute string lengths. Added the pad function and the PaddingSpecification struct template, so we can add padding to anything we can turn into a string. Got rid of the special case overload for single arguments, since it only worked for things that the String constructor can handle. Instead we will now use StringTypeAdapter, which works for more types. Possibly less optimal for some special cases, which we could specialize for later if we like. * wtf/text/StringConcatenateNumbers.h: Ditto. * wtf/text/StringOperators.h: Ditto. * wtf/text/StringView.h: Ditto. * wtf/text/WTFString.cpp: (WTF::createWithFormatAndArguments): Deleted. (WTF::String::format): Deleted. * wtf/text/WTFString.h: Deleted declaration of String::format. 2019-03-01 Alex Christensen Revert r241223, r241235, and r241287 https://bugs.webkit.org/show_bug.cgi?id=194427 * wtf/spi/darwin/XPCSPI.h: 2019-03-01 Simon Fraser Add a system trace scope for event region building https://bugs.webkit.org/show_bug.cgi?id=195226 Reviewed by Jon Lee. This trace scope measures the time spend converting element rects into Region objects, which can be large on some pages. The value for "Display Refresh Dispatch to main thread" was wrong and I fixed it. * wtf/SystemTracing.h: 2019-02-28 Yusuke Suzuki [JSC] sizeof(JSString) should be 16 https://bugs.webkit.org/show_bug.cgi?id=194375 Reviewed by Saam Barati. * wtf/text/StringImpl.h: (WTF::StringImpl::flagIs8Bit): (WTF::StringImpl::flagIsAtomic): (WTF::StringImpl::flagIsSymbol): (WTF::StringImpl::maskStringKind): * wtf/text/WTFString.cpp: (WTF::nullString): * wtf/text/WTFString.h: 2019-02-28 Mark Lam Change CheckedArithmetic to not use std::enable_if_t. https://bugs.webkit.org/show_bug.cgi?id=195187 Reviewed by Keith Miller. Because C++11 does not like std::enable_if_t and there's a need to use this file with C++11. * wtf/CheckedArithmetic.h: 2019-02-27 Simon Fraser Roll out r242014; it caused crashes in compositing logging (webkit.org/b/195141) * wtf/Assertions.cpp: (WTF::createWithFormatAndArguments): Deleted. * wtf/HexNumber.h: (WTF::StringTypeAdapter::toString const): * wtf/text/StringConcatenate.h: (WTF::makeString): (WTF::pad): Deleted. (WTF::StringTypeAdapter>::StringTypeAdapter): Deleted. (WTF::StringTypeAdapter>::length const): Deleted. (WTF::StringTypeAdapter>::is8Bit const): Deleted. (WTF::StringTypeAdapter>::writeTo const): Deleted. * wtf/text/StringConcatenateNumbers.h: (WTF::FormattedNumber::fixedPrecision): (WTF::FormattedNumber::fixedWidth): (WTF::StringTypeAdapter::toString const): * wtf/text/StringOperators.h: (WTF::StringAppend::StringAppend): * wtf/text/StringView.h: (WTF::StringView::invalidate): * wtf/text/WTFString.cpp: (WTF::createWithFormatAndArguments): (WTF::String::format): * wtf/text/WTFString.h: 2019-02-26 Mark Lam Remove remaining poisoning code. https://bugs.webkit.org/show_bug.cgi?id=194138 Reviewed by Saam Barati. This patch removes the instantiation of Poisoned variants of the various containers but retains the ability of those containers to work with pointer traits. This allows us to use them with smart pointers in the future (just like we used to with Poisoned values). At minimum, this ability will be useful when we want to insert an observer into the container storage type for debugging purposes, or to collect statistics for profiling. * WTF.xcodeproj/project.pbxproj: * wtf/Bag.h: * wtf/CMakeLists.txt: * wtf/Platform.h: * wtf/Poisoned.cpp: Removed. * wtf/Poisoned.h: Removed. * wtf/PoisonedUniquePtr.h: Removed. * wtf/Ref.h: * wtf/RefCountedArray.h: * wtf/RefPtr.h: * wtf/WTFAssertions.cpp: 2019-02-26 Keith Miller Code quality cleanup in NeverDestroyed https://bugs.webkit.org/show_bug.cgi?id=194824 Reviewed by Yusuke Suzuki. First, move data members to the end of the class per WebKit style. Also, add forbid heap allocation since we expect the NeverDestroyed classes to be static. * wtf/NeverDestroyed.h: 2019-02-25 Xabier Rodriguez Calvar Fix WTFLogVerbose variadic parameters forwarding https://bugs.webkit.org/show_bug.cgi?id=194920 Reviewed by Alex Christensen. WTFLogVerbose was passing the va_list to WTFLog but this function also used variadic parameters and this is not allowed in C (that part of the code is extern "C"). * wtf/Assertions.cpp: (WTF::WTFLogVaList): Created to take a va_list argument instead of variadic parameters. (WTF::WTFLog): Kept with variadic parameters, which are transformed to va_list and passed to WTFLogVaList. (WTF::WTFLogVerbose): Use WTFLogVaList instead of WTFLog. 2019-02-25 Sam Weinig Update double-conversion to the latest version https://bugs.webkit.org/show_bug.cgi?id=194994 Import the latest version of the double-conversion library based on https://github.com/google/double-conversion/commit/990c44707c70832dc1ce1578048c2198bafd3307 In additon to importing the code, the following changes were applied (or re-applied) to maintain parity with what we had previously: - Add #include "config.h" to each cpp file. - Put everything inside the WTF namespace. - Changed all in library includes to be of the form #include . - Renamed double_conversion::Vector<> to double_conversion::BufferReference<>. - Replaced duplicated functions with ASCIICType.h variants - Made CachedPower table a constexpr. - Exported (via WTF_EXPORT_PRIVATE) several functions in double-conversion.h. - Made substantial changes to StringToDoubleConverter to avoid unnecessary overhead of parameterization, as we only ever want one configuration. Instead of constructing a configured class and calling StringToDouble on it, StringToDouble is now a static function. This allows a bunch of now dead code (hex support, octal support, etc.) to be eliminated. As StringToDoubleConverter now supports single precision floats, some additional templating of StringToIeee was added to avoid extra unnecessary branching. - Added RemoveCharacters function to double_conversion::StringBuilder. Reviewed by Darin Adler. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/dtoa/AUTHORS: Added. * wtf/dtoa/README: Removed. * wtf/dtoa/README.md: Added. * wtf/dtoa/bignum-dtoa.cc: * wtf/dtoa/bignum-dtoa.h: * wtf/dtoa/bignum.cc: * wtf/dtoa/bignum.h: (WTF::double_conversion::Bignum::Times10): (WTF::double_conversion::Bignum::Equal): (WTF::double_conversion::Bignum::LessEqual): (WTF::double_conversion::Bignum::Less): (WTF::double_conversion::Bignum::PlusEqual): (WTF::double_conversion::Bignum::PlusLessEqual): (WTF::double_conversion::Bignum::PlusLess): (WTF::double_conversion::Bignum::EnsureCapacity): (WTF::double_conversion::Bignum::BigitLength const): * wtf/dtoa/cached-powers.cc: * wtf/dtoa/cached-powers.h: * wtf/dtoa/diy-fp.cc: * wtf/dtoa/diy-fp.h: (WTF::double_conversion::DiyFp::DiyFp): (WTF::double_conversion::DiyFp::Subtract): (WTF::double_conversion::DiyFp::Minus): (WTF::double_conversion::DiyFp::Times): (WTF::double_conversion::DiyFp::Normalize): (WTF::double_conversion::DiyFp::f const): (WTF::double_conversion::DiyFp::e const): (WTF::double_conversion::DiyFp::set_f): (WTF::double_conversion::DiyFp::set_e): * wtf/dtoa/double-conversion.cc: * wtf/dtoa/double-conversion.h: (WTF::double_conversion::DoubleToStringConverter::DoubleToStringConverter): (WTF::double_conversion::DoubleToStringConverter::ToShortest const): (WTF::double_conversion::DoubleToStringConverter::ToShortestSingle const): (WTF::double_conversion::StringToDoubleConverter::StringToDoubleConverter): * wtf/dtoa/double.h: Removed. * wtf/dtoa/fast-dtoa.cc: * wtf/dtoa/fast-dtoa.h: * wtf/dtoa/fixed-dtoa.cc: * wtf/dtoa/fixed-dtoa.h: * wtf/dtoa/ieee.h: Added. (WTF::double_conversion::double_to_uint64): (WTF::double_conversion::uint64_to_double): (WTF::double_conversion::float_to_uint32): (WTF::double_conversion::uint32_to_float): (WTF::double_conversion::Double::Double): (WTF::double_conversion::Double::AsDiyFp const): (WTF::double_conversion::Double::AsNormalizedDiyFp const): (WTF::double_conversion::Double::AsUint64 const): (WTF::double_conversion::Double::NextDouble const): (WTF::double_conversion::Double::PreviousDouble const): (WTF::double_conversion::Double::Exponent const): (WTF::double_conversion::Double::Significand const): (WTF::double_conversion::Double::IsDenormal const): (WTF::double_conversion::Double::IsSpecial const): (WTF::double_conversion::Double::IsNan const): (WTF::double_conversion::Double::IsInfinite const): (WTF::double_conversion::Double::Sign const): (WTF::double_conversion::Double::UpperBoundary const): (WTF::double_conversion::Double::NormalizedBoundaries const): (WTF::double_conversion::Double::LowerBoundaryIsCloser const): (WTF::double_conversion::Double::value const): (WTF::double_conversion::Double::SignificandSizeForOrderOfMagnitude): (WTF::double_conversion::Double::Infinity): (WTF::double_conversion::Double::NaN): (WTF::double_conversion::Double::DiyFpToUint64): (WTF::double_conversion::Single::Single): (WTF::double_conversion::Single::AsDiyFp const): (WTF::double_conversion::Single::AsUint32 const): (WTF::double_conversion::Single::Exponent const): (WTF::double_conversion::Single::Significand const): (WTF::double_conversion::Single::IsDenormal const): (WTF::double_conversion::Single::IsSpecial const): (WTF::double_conversion::Single::IsNan const): (WTF::double_conversion::Single::IsInfinite const): (WTF::double_conversion::Single::Sign const): (WTF::double_conversion::Single::NormalizedBoundaries const): (WTF::double_conversion::Single::UpperBoundary const): (WTF::double_conversion::Single::LowerBoundaryIsCloser const): (WTF::double_conversion::Single::value const): (WTF::double_conversion::Single::Infinity): (WTF::double_conversion::Single::NaN): * wtf/dtoa/strtod.cc: * wtf/dtoa/strtod.h: * wtf/dtoa/utils.h: (abort_noreturn): (WTF::double_conversion::Max): (WTF::double_conversion::Min): (WTF::double_conversion::StrLength): (WTF::double_conversion::BufferReference::BufferReference): (WTF::double_conversion::BufferReference::SubVector): (WTF::double_conversion::BufferReference::length const): (WTF::double_conversion::BufferReference::is_empty const): (WTF::double_conversion::BufferReference::start const): (WTF::double_conversion::BufferReference::operator[] const): (WTF::double_conversion::BufferReference::first): (WTF::double_conversion::BufferReference::last): (WTF::double_conversion::StringBuilder::StringBuilder): (WTF::double_conversion::StringBuilder::~StringBuilder): (WTF::double_conversion::StringBuilder::size const): (WTF::double_conversion::StringBuilder::position const): (WTF::double_conversion::StringBuilder::Reset): (WTF::double_conversion::StringBuilder::AddCharacter): (WTF::double_conversion::StringBuilder::AddString): (WTF::double_conversion::StringBuilder::AddSubstring): (WTF::double_conversion::StringBuilder::AddPadding): (WTF::double_conversion::StringBuilder::RemoveCharacters): (WTF::double_conversion::StringBuilder::Finalize): (WTF::double_conversion::StringBuilder::is_finalized const): (WTF::double_conversion::BitCast): (WTF::double_conversion::BufferReference::SubBufferReference): Deleted. (WTF::double_conversion::StringBuilder::SetPosition): Deleted. 2019-02-20 Darin Adler Finish removing String::format https://bugs.webkit.org/show_bug.cgi?id=194893 Reviewed by Daniel Bates. * wtf/Assertions.cpp: (WTF::createWithFormatAndArguments): Moved this here from WTFString.cpp. (WTFLog): Use WTF::createWithFormatAndArguments instead of String::format. * wtf/HexNumber.h: Deleted unneeded toString function. * wtf/text/StringConcatenate.h: Got rid of unneeded forward declaration of StringTypeAdapter, since that's now in Forward.h. Tweaked formatting of templates a bit. Use function templates for writeTo functions rather than having two of each. Removed unused toString functions. Optimized case where we use have a UChar* and a length of zero to not force the result to be 16-bit. Also gets rid of a small NO_RETURN_DUE_TO_CRASH mess that we don't need. Refactored constructors to use some static member helper functions to compute string lengths. Added the pad function and the PaddingSpecification struct template, so we can add padding to anything we can turn into a string. Got rid of the special case overload for single arguments, since it only worked for things that the String constructor can handle. Instead we will now use StringTypeAdapter, which works for more types. Possibly less optimal for some special cases, which we could specialize for later if we like. * wtf/text/StringConcatenateNumbers.h: Ditto. * wtf/text/StringOperators.h: Ditto. * wtf/text/StringView.h: Ditto. * wtf/text/WTFString.cpp: (WTF::createWithFormatAndArguments): Deleted. (WTF::String::format): Deleted. * wtf/text/WTFString.h: Deleted declaration of String::format. 2019-02-23 Michael Catanzaro Unreviewed, fix find/replace error from r232178 Looks like this was the only such error in that commit. * wtf/URLHelpers.cpp: (WTF::URLHelpers::isLookalikeCharacter): 2019-02-23 Mark Lam Add an exception check and some assertions in StringPrototype.cpp. https://bugs.webkit.org/show_bug.cgi?id=194962 Reviewed by Yusuke Suzuki and Saam Barati. Add an AssertNoOverflow overflow handler which allows us to do CheckedArithmetic for assertion purpose only on debug builds but sacrifices no performance on release builds. * wtf/CheckedArithmetic.h: (WTF::AssertNoOverflow::overflowed): (WTF::AssertNoOverflow::clearOverflow): (WTF::AssertNoOverflow::crash): (WTF::AssertNoOverflow::hasOverflowed const): (WTF::observesOverflow): (WTF::observesOverflow): (WTF::safeAdd): (WTF::safeSub): (WTF::safeMultiply): (WTF::Checked::operator+=): (WTF::Checked::operator-=): (WTF::Checked::operator*=): (WTF::operator+): (WTF::operator-): (WTF::operator*): 2019-02-23 Keith Miller Add new mac target numbers https://bugs.webkit.org/show_bug.cgi?id=194955 Reviewed by Tim Horton. * Configurations/Base.xcconfig: * Configurations/DebugRelease.xcconfig: 2019-02-21 Antoine Quint Move UIWebTouchEventsGestureRecognizer.activeTouchesByIdentifier to SPI https://bugs.webkit.org/show_bug.cgi?id=194531 Reviewed by Tim Horton. Follow-up commit to ensure this SPI is only called on newer versions of iOS. * wtf/Platform.h: 2019-02-21 Dean Jackson Rotation animations sometimes use the wrong origin (affects apple.com) https://bugs.webkit.org/show_bug.cgi?id=194878 Follow-up commit to ensure this change only affects newer versions of iOS. * wtf/Platform.h: Add a version check. 2019-02-20 Alex Christensen URL percent-encode operations should use checked arithmetic for buffer allocation length https://bugs.webkit.org/show_bug.cgi?id=194877 Reviewed by Tim Horton. * wtf/URLHelpers.cpp: (WTF::URLHelpers::userVisibleURL): * wtf/cocoa/NSURLExtras.mm: (WTF::dataWithUserTypedString): 2019-02-20 Dean Jackson Rotation animations sometimes use the wrong origin (affects apple.com) https://bugs.webkit.org/show_bug.cgi?id=194878 Reviewed by Simon Fraser. * wtf/Platform.h: Add HAVE(CA_WHERE_ADDITIVE_TRANSFORMS_ARE_REVERSED). 2019-02-20 Andy Estes [Xcode] Add SDKVariant.xcconfig to various Xcode projects https://bugs.webkit.org/show_bug.cgi?id=194869 Rubber-stamped by Jer Noble. * WTF.xcodeproj/project.pbxproj: 2019-02-20 Adrian Perez de Castro [WPE][GTK] Enable support for CONTENT_EXTENSIONS https://bugs.webkit.org/show_bug.cgi?id=167941 Reviewed by Carlos Garcia Campos. Add specialization of the refGPtr() and derefGPtr() templates for GMappedFile. * wtf/glib/GRefPtr.cpp: (WTF::refGPtr): Added. (WTF::derefGPtr): Added. * wtf/glib/GRefPtr.h: Declare template specializations. 2019-02-19 Commit Queue Unreviewed, rolling out r241770. https://bugs.webkit.org/show_bug.cgi?id=194833 Caused crashes (Requested by smfr on #webkit). Reverted changeset: "Code quality cleanup in NeverDestroyed" https://bugs.webkit.org/show_bug.cgi?id=194824 https://trac.webkit.org/changeset/241770 2019-02-19 Keith Miller Code quality cleanup in NeverDestroyed https://bugs.webkit.org/show_bug.cgi?id=194824 Reviewed by Yusuke Suzuki. First, move data members to the end of the class per WebKit style. Also, add forbid heap allocation since we expect the NeverDestroyed classes to be static. * wtf/NeverDestroyed.h: 2019-02-16 Darin Adler Continue reducing use of String::format, now focusing on hex: "%p", "%x", etc. https://bugs.webkit.org/show_bug.cgi?id=194752 Reviewed by Daniel Bates. * WTF.xcodeproj/project.pbxproj: Added HexNumber.cpp and Logger.cpp. * wtf/CMakeLists.txt: Ditto. * wtf/HexNumber.cpp: Added. (WTF::Internal::appendHex): Non-inline, non-template hex formatting logic. * wtf/HexNumber.h: (WTF::Internal::appendHex): Refactored main logic of appendUnsignedAsHex and appendUnsignedAsHexFixedSize so they can be reused in a function named hex for use with StringTypeAdapter. (WTF::appendUnsignedAsHex): Ditto. (WTF::appendUnsignedAsHexFixedSize): Ditto. (WTF::hex): Added. (WTF::StringTypeAdapter): Added. * wtf/Logger.cpp: Added. (WTF::Logger::LogSiteIdentifier::toString const): Made this a non-template function and moved it here so that we don't need to include HexNumber.h in Logger.h. Since HexNumber.h has substantial code in it, it's good if we don't include it in any other headers. * wtf/Logger.h: (WTF::LogArgument::toString): Changed to call a non-template function, LogSiteIdentifier::toString. * wtf/text/StringConcatenateNumbers.h: Replaced overloaded writeTo functions with function templates and used StringImpl::copyCharacters instead of hand-written loops. 2019-02-18 Joseph Pecoraro Web Inspector: Better categorize CPU usage per-thread / worker https://bugs.webkit.org/show_bug.cgi?id=194564 Reviewed by Devin Rousso. * wtf/Threading.h: * wtf/Threading.cpp: (WTF::Thread::allThreadsMutex): (WTF::Thread::create): (WTF::Thread::didExit): Add a set of all WTF::Thread created threads. 2019-02-18 Tadeu Zagallo Bytecode cache should a have a boot-specific validation https://bugs.webkit.org/show_bug.cgi?id=194769 Reviewed by Keith Miller. Add helper to get kern.bootsessionuuid from sysctl * wtf/UUID.cpp: (WTF::bootSessionUUIDString): * wtf/UUID.h: 2019-02-17 David Kilzer Unreviewed, rolling out r241620. "Causes use-after-free crashes running layout tests with ASan and GuardMalloc." (Requested by ddkilzer on #webkit.) Reverted changeset: "[WTF] Add environment variable helpers" https://bugs.webkit.org/show_bug.cgi?id=192405 https://trac.webkit.org/changeset/241620 2019-02-15 Ross Kirsling [WTF] Add environment variable helpers https://bugs.webkit.org/show_bug.cgi?id=192405 Reviewed by Michael Catanzaro. Create a new Environment API as a platform-independent, thread-safe(r) way to get and set environment variables. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Environment.h: Added. * wtf/PlatformGTK.cmake: * wtf/PlatformJSCOnly.cmake: * wtf/PlatformMac.cmake: * wtf/PlatformPlayStation.cmake: * wtf/PlatformWPE.cmake: * wtf/PlatformWin.cmake: * wtf/posix/EnvironmentPOSIX.cpp: Added. * wtf/win/EnvironmentWin.cpp: Added. Introduce WTF::Environment. * wtf/Threading.cpp: (WTF::threadingIsInitialized): (WTF::initializeThreading): * wtf/Threading.h: Introduce WTF::threadingIsInitialized() so that we can ASSERT that it's false before setting an environment variable through the new API. * wtf/DataLog.cpp: (WTF::initializeLogFileOnce): * wtf/NumberOfCores.cpp: (WTF::numberOfProcessorCores): * wtf/posix/FileSystemPOSIX.cpp: (WTF::FileSystemImpl::openTemporaryFile): Utilize WTF::Environment where possible. 2019-02-15 Brian Burg [Mac] WebInspectorUI.framework does not need to be soft-linked anymore https://bugs.webkit.org/show_bug.cgi?id=194411 Reviewed by Joseph Pecoraro. * wtf/cocoa/SoftLinking.h: Remove macro that now has no uses. 2019-02-15 Commit Queue Unreviewed, rolling out r241559 and r241566. https://bugs.webkit.org/show_bug.cgi?id=194710 Causes layout test crashes under GuardMalloc (Requested by ryanhaddad on #webkit). Reverted changesets: "[WTF] Add environment variable helpers" https://bugs.webkit.org/show_bug.cgi?id=192405 https://trac.webkit.org/changeset/241559 "Unreviewed build fix for WinCairo Debug after r241559." https://trac.webkit.org/changeset/241566 2019-02-15 Truitt Savell Unreviewed, rolling out r241564. Caused 50+ Timeouts on Mac WK2, mostly in the http/ directory Reverted changeset: "[Mac] WebInspectorUI.framework does not need to be soft- linked anymore" https://bugs.webkit.org/show_bug.cgi?id=194411 https://trac.webkit.org/changeset/241564 2019-02-15 Dominik Infuehr Fix deadlock on Linux/x64 between SamplingProfiler and VMTraps https://bugs.webkit.org/show_bug.cgi?id=194014 Reviewed by Michael Catanzaro. Do not block SIGUSR1 when installing signal handlers, since this signal is used to suspend/resume machine threads on Linux. ftl-ai-filter-phantoms-should-clear-clear-value.js deadlocked with enabled watchdog and sampling. Deadlock happened in the following situation: Thread 1 (Sampling): SamplingProfiler.cpp:takeSample takes all needed locks and then tries to suspend the main thread. Thread 2 (Watchdog/VMTraps): Before the Sampling-Thread suspends the main thread a signal is caught and the signal handler is invoked (VMTraps.cpp:SignalSender). SignalSender tries to lock codeBlockSet, but this is already locked by the SamplingProfiler. The SamplingProfiler can only give up the lock when it suspends the thread. However since the VMTraps signal handler is active, all other signals blocked, therefore the SamplingProfiler also waits until its signal handler is invoked. This patch fixes this by not blocking SIGUSR1 in installSignalHandler, since it is used to suspend/resume threads on Linux. * wtf/Threading.h: * wtf/posix/ThreadingPOSIX.cpp: * wtf/threads/Signals.cpp: (WTF::installSignalHandler): 2019-02-15 Saam barati [WebAssembly] Write a new register allocator for Air O0 and make BBQ use it https://bugs.webkit.org/show_bug.cgi?id=194036 Reviewed by Yusuke Suzuki. * wtf/IndexMap.h: (WTF::IndexMap::at): (WTF::IndexMap::at const): (WTF::IndexMap::operator[]): (WTF::IndexMap::operator[] const): 2019-02-14 Brian Burg [Mac] WebInspectorUI.framework does not need to be soft-linked anymore https://bugs.webkit.org/show_bug.cgi?id=194411 Reviewed by Joseph Pecoraro. * wtf/cocoa/SoftLinking.h: Remove macro that now has no uses. 2019-02-14 Ross Kirsling [WTF] Add environment variable helpers https://bugs.webkit.org/show_bug.cgi?id=192405 Reviewed by Michael Catanzaro. Create a new Environment API as a platform-independent, thread-safe(r) way to get and set environment variables. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Environment.h: Added. * wtf/PlatformGTK.cmake: * wtf/PlatformJSCOnly.cmake: * wtf/PlatformMac.cmake: * wtf/PlatformPlayStation.cmake: * wtf/PlatformWPE.cmake: * wtf/PlatformWin.cmake: * wtf/posix/EnvironmentPOSIX.cpp: Added. * wtf/win/EnvironmentWin.cpp: Added. Introduce WTF::Environment. * wtf/Threading.cpp: (WTF::threadingIsInitialized): (WTF::initializeThreading): * wtf/Threading.h: Introduce WTF::threadingIsInitialized() so that we can ASSERT that it's false before setting an environment variable through the new API. * wtf/DataLog.cpp: (WTF::initializeLogFileOnce): * wtf/NumberOfCores.cpp: (WTF::numberOfProcessorCores): * wtf/posix/FileSystemPOSIX.cpp: (WTF::FileSystemImpl::openTemporaryFile): Utilize WTF::Environment where possible. 2019-02-13 Yusuke Suzuki We should only make rope strings when concatenating strings long enough. https://bugs.webkit.org/show_bug.cgi?id=194465 Reviewed by Mark Lam. * wtf/text/StringImpl.h: (WTF::StringImpl::headerSize): 2019-02-12 Tim Horton Remove WKLegacyPDFView https://bugs.webkit.org/show_bug.cgi?id=194559 Reviewed by Andy Estes. * wtf/FeatureDefines.h: 2019-02-12 David Kilzer REGRESSION (r238955, r240494): Soft-linking optional Lookup.framework triggers release assertion when missing Reviewed by Eric Carlson. * wtf/cocoa/SoftLinking.h: (SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT_AND_IS_OPTIONAL): Rename SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT_AND_ASSERTION() to this and change `assertion` argument to `isOptional`. Pass `isOptional` to framework##Library() method to control assertion behavior. Only check RELEASE_ASSERT() if `!isOptional`, else that code should be optimized out by the compiler. This fixes the crash. (NO_ASSERT): Remove macro since it's no longer used. (SOFT_LINK_IS_OPTIONAL): Add macro to use for soft-linking optional classes. (SOFT_LINK_IS_NOT_OPTIONAL): Add macro to use for soft-linking non-optional classes. (SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT): Update to use new SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT_AND_IS_OPTIONAL() macro. (SOFT_LINK_CLASS_FOR_SOURCE_OPTIONAL_WITH_EXPORT): Ditto. (SOFT_LINK_CLASS_FOR_SOURCE): Ditto. (SOFT_LINK_CLASS_FOR_SOURCE_OPTIONAL): Ditto. 2019-02-12 Andy Estes [iOSMac] Enable Parental Controls Content Filtering https://bugs.webkit.org/show_bug.cgi?id=194521 Reviewed by Tim Horton. * wtf/Platform.h: 2019-02-11 Myles C. Maxfield [Cocoa] Ask platform for generic font family mappings https://bugs.webkit.org/show_bug.cgi?id=187723 Reviewed by Brent Fulgham. Add an ENABLE in Platform. * wtf/Platform.h: 2019-02-11 Truitt Savell Unreviewed, rolling out r241229. Revision broke internal builds for watchOS. Reverted changeset: "[Cocoa] Ask platform for generic font family mappings" https://bugs.webkit.org/show_bug.cgi?id=187723 https://trac.webkit.org/changeset/241229 2019-02-10 Darin Adler Switch uses of StringBuilder with String::format for hex numbers to use HexNumber.h instead https://bugs.webkit.org/show_bug.cgi?id=194485 Reviewed by Daniel Bates. * wtf/HexNumber.h: Removed unused functions placeByteAsHexCompressIfPossible and placeByteAsHex. Can always bring them back if someone needs them. Updated appendUnsignedAsHex to be a template so we can use it on any integer type, got rid of unnecessary use of Vector and unnecessary reversing, and got rid of appendUnsigned64AsHex since callers can now just use appendUnsignedAsHex. Rewrote appendUnsignedAsHexFixedSize to share mode code rather than replicating. * wtf/Logger.h: Use appendUnsignedAsHex instead of appendUnsigned64AsHex. * wtf/URL.cpp: Removed unnecessary include of HexNumber.h. * wtf/cocoa/NSURLExtras.h: Added missing include of Foundation.h that was worked around in NSURLExtras.mm. * wtf/cocoa/NSURLExtras.mm: Removed unnecessary includes of HexNumber.h and Foundation.h. 2019-02-09 Darin Adler Eliminate unnecessary String temporaries by using StringConcatenateNumbers https://bugs.webkit.org/show_bug.cgi?id=194021 Reviewed by Geoffrey Garen. * wtf/URL.cpp: (WTF::URL::setPort): Remove String::number and let makeString do the conversion without allocating/destroying a String. Added a cast to "unsigned" to sidestep the ambiguity with 16-bit unsigned types that are sometimes used for numbers (uint16_t) and sometimes used for UTF-16 code units (UChar) and can be the same type. * wtf/text/StringConcatenateNumbers.h: Changed FormattedNumber::fixedPrecision to more closely match String::number and StringBuilder::appendNumber by defaulting to truncating trailing zeros and using a named enumeration for the truncation policy rather than a boolean. 2019-02-09 Yusuke Suzuki Unreviewed, rolling in r241237 again https://bugs.webkit.org/show_bug.cgi?id=194469 After the measurement, this patch was unrelated to recent regression. * wtf/text/StringImpl.h: (WTF::StringImpl::isSubString const): (WTF::StringImpl::createSubstringSharingImpl): 2019-02-09 Commit Queue Unreviewed, rolling out r241237. https://bugs.webkit.org/show_bug.cgi?id=194474 Shows significant memory increase in WSL (Requested by yusukesuzuki on #webkit). Reverted changeset: "[WTF] Use BufferInternal StringImpl if substring StringImpl takes more memory" https://bugs.webkit.org/show_bug.cgi?id=194469 https://trac.webkit.org/changeset/241237 2019-02-08 Yusuke Suzuki [WTF] Use BufferInternal StringImpl if substring StringImpl takes more memory https://bugs.webkit.org/show_bug.cgi?id=194469 Reviewed by Geoffrey Garen. Because pointer is large and aligned in 64bit in 64bit architecture, BufferSubstring StringImpl implementation takes more memory than BufferInternal StringImpl implementation for small strings. And BufferInternal StringImpl does not have a problem like, small substring StringImpl keeps super large owner StringImpl. This patch calculates the required size of memory and selects the more efficient one. * wtf/text/StringImpl.h: (WTF::StringImpl::isSubString const): (WTF::StringImpl::createSubstringSharingImpl): 2019-02-08 Alex Christensen Add SPI to use networking daemon instead of XPC service https://bugs.webkit.org/show_bug.cgi?id=194427 Reviewed by Geoffrey Garen. * wtf/spi/darwin/XPCSPI.h: Instead of using XPC bootstrap SPI, we just send a separate message. xpc_copy_bootstrap does not seem to work in daemons. 2019-02-08 Truitt Savell Unreviewed, rolling out r241197. Broke iOS Simulator Debug build and casued 1 API failure on High Sierra Reverted changeset: "Add SPI to use networking daemon instead of XPC service" https://bugs.webkit.org/show_bug.cgi?id=194427 https://trac.webkit.org/changeset/241197 2019-02-08 Alex Christensen Add SPI to use networking daemon instead of XPC service https://bugs.webkit.org/show_bug.cgi?id=194427 Reviewed by Geoffrey Garen. * wtf/spi/darwin/XPCSPI.h: Instead of using XPC bootstrap SPI, we just send a separate message. xpc_copy_bootstrap does not seem to work in daemons. 2019-02-08 Benjamin Poulain clampTo(): do not convert the input to double when dealing with integers https://bugs.webkit.org/show_bug.cgi?id=194263 Reviewed by Darin Adler. Previously, every use of clampTo() was converting the input to double, doing the comparison in double, then casting back to whatever type was needed. In many case, that was very wasteful. WebKit has many cases of clampTo() with the same type as input/output, or with integer types of different size/sign. This patch adds a few versions of clampTo() for the common cases seen in WebKit. In each case, I tried to minimize the amount of conversion needed at runtime. * wtf/MathExtras.h: (clampTo): 2019-02-07 Chris Dumez Mark more heap-allocated classes as fast allocated https://bugs.webkit.org/show_bug.cgi?id=194422 Reviewed by Ryosuke Niwa. * wtf/Function.h: (WTF::Function [macOS] Block coreservicesd in sandbox. https://bugs.webkit.org/show_bug.cgi?id=192670 Reviewed by Alexey Proskuryakov. Add HAVE_CSCHECKFIXDISABLE define. * wtf/Platform.h: 2019-02-07 Eric Carlson [MSE] Convert debug-only logging to runtime logging https://bugs.webkit.org/show_bug.cgi?id=194348 Reviewed by Jer Noble. * wtf/LoggerHelper.h: (WTF::LoggerHelper::childLogIdentifier const): Helper to generate a log identifier for an object that is associated with another logging object. * wtf/MediaTime.cpp: (WTF::MediaTime::toJSONObject const): (WTF::MediaTime::toJSONString const): (WTF::MediaTimeRange::toJSONString const): (WTF::toJSONStringInternal): Deleted. * wtf/MediaTime.h: 2019-02-05 Keith Rollin Enable the automatic checking and regenerations of .xcfilelists during builds https://bugs.webkit.org/show_bug.cgi?id=194124 Reviewed by Tim Horton. Bug 193790 add a facility for checking -- during build time -- that any needed .xcfilelist files are up-to-date and for updating them if they are not. This facility was initially opt-in by setting WK_ENABLE_CHECK_XCFILELISTS until other pieces were in place and until the process seemed robust. Its now time to enable this facility and make it opt-out. If there is a need to disable this facility, set and export WK_DISABLE_CHECK_XCFILELISTS=1 in your environment before running `make` or `build-webkit`, or before running Xcode from the command line. Additionally, remove the step that generates a list of source files going into the UnifiedSources build step. It's only necessarily to specify Sources.txt and SourcesCocoa.txt as inputs. * Scripts/generate-unified-source-bundles.rb: 2019-02-05 Yusuke Suzuki [JSC] Shrink sizeof(UnlinkedCodeBlock) https://bugs.webkit.org/show_bug.cgi?id=194281 Reviewed by Michael Saboff. * wtf/TriState.h: 2019-02-05 Zan Dobersek [GLib] Stop URI-escaping file system representations https://bugs.webkit.org/show_bug.cgi?id=194213 Reviewed by Carlos Garcia Campos. Stop URI-escaping of file representation strings in FileSystem::stringFromFileSystemRepresentation(), and URI-unescaping of strings in FileSystem::fileSystemRepresentation(). This behavior deviates from POSIX and CF implementations and is currently breaking IndexedDB-specific calculation of database sizes due to directory components used in that process that are URL-based and are as such URI-escaped. When unescaped, those single directory components explode into multiple directory components, leading to incorrect total database size calculation when iterating the database directory. FileSystem::stringFromFileSystemRepresentation() now retrieves GLib's filename charsets and in worst case converts the filesystem representation to UTF-8 before String::fromUTF8() is used. FileSystem::fileSystemRepresentation() reverses that process, taking String's UTF-8 data and converting it to target charset if necessary. Other FileSystem functions are adjusted to convert passed-in String objects to filesystem representations. * wtf/glib/FileSystemGlib.cpp: (WTF::FileSystemImpl::stringFromFileSystemRepresentation): (WTF::FileSystemImpl::fileSystemRepresentation): (WTF::FileSystemImpl::validRepresentation): (WTF::FileSystemImpl::filenameForDisplay): (WTF::FileSystemImpl::fileExists): (WTF::FileSystemImpl::deleteFile): (WTF::FileSystemImpl::deleteEmptyDirectory): (WTF::FileSystemImpl::getFileStat): (WTF::FileSystemImpl::getFileLStat): (WTF::FileSystemImpl::makeAllDirectories): (WTF::FileSystemImpl::createSymbolicLink): (WTF::FileSystemImpl::pathGetFileName): (WTF::FileSystemImpl::getVolumeFreeSpace): (WTF::FileSystemImpl::directoryName): (WTF::FileSystemImpl::listDirectory): (WTF::FileSystemImpl::openFile): (WTF::FileSystemImpl::moveFile): (WTF::FileSystemImpl::hardLinkOrCopyFile): (WTF::FileSystemImpl::getFileDeviceId): Align with POSIX implementation and treat input CString as an existing filesystem representation. (WTF::FileSystemImpl::unescapedFilename): Deleted. 2019-02-04 Ms2ger [GTK][WPE] Need a function to convert internal URI to display ("pretty") URI https://bugs.webkit.org/show_bug.cgi?id=174816 Reviewed by Michael Catanzaro. Translate userVisibleString and dependent code into platform-neutral C++ in wtf/URLHelpers.{h,cpp}. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/URLHelpers.cpp: Added. (WTF::URLHelpers::loadIDNScriptWhiteList): (WTF::URLHelpers::isArmenianLookalikeCharacter): (WTF::URLHelpers::isArmenianScriptCharacter): (WTF::URLHelpers::isASCIIDigitOrValidHostCharacter): (WTF::URLHelpers::isLookalikeCharacter): (WTF::URLHelpers::whiteListIDNScript): (WTF::URLHelpers::initializeDefaultIDNScriptWhiteList): (WTF::URLHelpers::allCharactersInIDNScriptWhiteList): (WTF::URLHelpers::isSecondLevelDomainNameAllowedByTLDRules): (WTF::URLHelpers::isRussianDomainNameCharacter): (WTF::URLHelpers::allCharactersAllowedByTLDRules): (WTF::URLHelpers::mapHostName): (WTF::URLHelpers::collectRangesThatNeedMapping): (WTF::URLHelpers::applyHostNameFunctionToMailToURLString): (WTF::URLHelpers::applyHostNameFunctionToURLString): (WTF::URLHelpers::mapHostNames): (WTF::URLHelpers::createStringWithEscapedUnsafeCharacters): (WTF::URLHelpers::toNormalizationFormC): (WTF::URLHelpers::userVisibleURL): * wtf/URLHelpers.h: Added. * wtf/cocoa/NSURLExtras.mm: (WTF::URLHelpers::loadIDNScriptWhiteList): (WTF::decodePercentEscapes): (WTF::decodeHostName): (WTF::encodeHostName): (WTF::URLWithUserTypedString): (WTF::userVisibleString): 2019-02-03 Commit Queue Unreviewed, rolling out r240896. https://bugs.webkit.org/show_bug.cgi?id=194202 "Fixes leaks, but is probably not the correct fix." (Requested by ddkilzer on #webkit). Reverted changeset: "Leak of WTF::StringImpl under SymbolImpl::createNullSymbol() (48 bytes) in com.apple.WebKit.WebContent running layout tests" https://bugs.webkit.org/show_bug.cgi?id=193291 https://trac.webkit.org/changeset/240896 2019-02-02 David Kilzer Leak of WTF::StringImpl under SymbolImpl::createNullSymbol() (48 bytes) in com.apple.WebKit.WebContent running layout tests Reviewed by Keith Miller. * wtf/text/SymbolImpl.h: (WTF::SymbolImpl::~SymbolImpl): Fix the leak by implementing the class destructor that calls StringImpl::deref() on `m_owner`. Two of the three constructors leak the StringImpl when setting `m_owner`, so we need to balance that by manually calling deref(). 2018-12-16 Darin Adler Convert additional String::format clients to alternative approaches https://bugs.webkit.org/show_bug.cgi?id=192746 Reviewed by Alexey Proskuryakov. * wtf/JSONValues.cpp: (WTF::appendDoubleQuotedStringEscapedCharacter): Renamed from escapeChar and reordered arguments to make sense as an append function. (WTF::appendDoubleQuotedString): Renamed from doubleQuoteString, reordered arguments to make sense as an append function, take a StringView instead of a String, used early exit to make the code a bit easier to read. Use the ASCIIHexDigit functions to construct a hex number a nibble at a time rather than using String::format. (WTF::JSONImpl::Value::writeJSON const): Update for name change. (WTF::JSONImpl::ObjectBase::writeJSON const): Ditto. 2019-01-31 Carlos Garcia Campos Unreviewed. Fix WPE compile warnings due to deprecated glib API. * wtf/Platform.h: 2019-01-29 Chris Dumez Make sure WTF::generateObjectIdentifier() internal counter does not get duplicated https://bugs.webkit.org/show_bug.cgi?id=193848 Reviewed by Youenn Fablet. Move WTF::generateObjectIdentifier()'s internal counter out-of-line so make sure it never gets duplicated at each call site. This has caused some hard-to-debug issues with duplicate identifiers such as Bug 193761. Also move it to ObjectIdentifier and rename it to generate() as this make call sites nicer when they have a typedef for the ObjectIdentifier type. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/ObjectIdentifier.cpp: Copied from Source/WebCore/platform/Process.cpp. (WTF::ObjectIdentifierBase::generateIdentifierInternal): (WTF::ObjectIdentifierBase::generateThreadSafeIdentifierInternal): * wtf/ObjectIdentifier.h: (WTF::ObjectIdentifier::generate): (WTF::ObjectIdentifier::generateThreadSafe): 2019-01-28 Ross Kirsling Move platform-specific files out of WTF root directory. https://bugs.webkit.org/show_bug.cgi?id=193929 Reviewed by Alex Christensen. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/PlatformGTK.cmake: * wtf/PlatformJSCOnly.cmake: * wtf/PlatformMac.cmake: * wtf/PlatformPlayStation.cmake: * wtf/PlatformWPE.cmake: * wtf/PlatformWin.cmake: * wtf/cf/RunLoopTimerCF.cpp: Renamed from Source/WTF/wtf/RunLoopTimerCF.cpp. * wtf/cf/SchedulePairCF.cpp: Renamed from Source/WTF/wtf/SchedulePairCF.cpp. * wtf/mac/SchedulePairMac.mm: Renamed from Source/WTF/wtf/SchedulePairMac.mm. * wtf/posix/OSAllocatorPOSIX.cpp: Renamed from Source/WTF/wtf/OSAllocatorPosix.cpp. * wtf/posix/ThreadingPOSIX.cpp: Renamed from Source/WTF/wtf/ThreadingPthreads.cpp. * wtf/win/CONTRIBUTORS.pthreads-win32: Renamed from Source/WTF/wtf/CONTRIBUTORS.pthreads-win32. * wtf/win/OSAllocatorWin.cpp: Renamed from Source/WTF/wtf/OSAllocatorWin.cpp. * wtf/win/ThreadSpecificWin.cpp: Renamed from Source/WTF/wtf/ThreadSpecificWin.cpp. * wtf/win/ThreadingWin.cpp: Renamed from Source/WTF/wtf/ThreadingWin.cpp. 2019-01-28 Andy Estes [watchOS] Enable Parental Controls content filtering https://bugs.webkit.org/show_bug.cgi?id=193939 Reviewed by Ryosuke Niwa. * wtf/Platform.h: 2019-01-28 Ross Kirsling [JSCOnly][WTF] Expose FileSystem. https://bugs.webkit.org/show_bug.cgi?id=193789 Reviewed by Don Olmstead. * wtf/FileSystem.h: * wtf/PlatformJSCOnly.cmake: * wtf/posix/FileSystemPOSIX.cpp: (WTF::FileSystemImpl::getVolumeFreeSpace): * wtf/win/FileSystemWin.cpp: (WTF::FileSystemImpl::fileSystemRepresentation): 2019-01-28 Eric Carlson AVStreamSession isn't always available, make a HAVE compile flag for it https://bugs.webkit.org/show_bug.cgi?id=193889 Reviewed by Jer Noble. * wtf/FeatureDefines.h: 2018-12-15 Darin Adler Replace many uses of String::format with more type-safe alternatives https://bugs.webkit.org/show_bug.cgi?id=192742 Reviewed by Mark Lam. * wtf/WorkQueue.cpp: (WTF::WorkQueue::concurrentApply): Use makeString. * wtf/dtoa.cpp: (WTF::dtoa): Use sprintf instead of String::format in the comments, since these functions have nothing to do with WTF::String. 2019-01-25 Chris Dumez [iOS] Add support for the download attribute https://bugs.webkit.org/show_bug.cgi?id=167341 Reviewed by Geoffrey Garen. Turn on HTML download attribute support on iOS. * wtf/FeatureDefines.h: 2019-01-25 David Kilzer Move soft-linking of Lookup.framework out of LookupSPI.h Reviewed by Tim Horton. * wtf/cocoa/SoftLinking.h: (SOFT_LINK_CONSTANT_FOR_HEADER): (SOFT_LINK_CONSTANT_FOR_SOURCE_WITH_EXPORT): (SOFT_LINK_CONSTANT_MAY_FAIL_FOR_HEADER): - Remove local declaration of constant. This should be handled by including *SPI.h or "real" headers. (SOFT_LINK_CONSTANT_MAY_FAIL_FOR_SOURCE_WITH_EXPORT): - Remove local declaration of constant. - Rename from SOFT_LINK_CONSTANT_MAY_FAIL_FOR_SOURCE() and add `export` argument to support exporting of functions. (SOFT_LINK_CONSTANT_MAY_FAIL_FOR_SOURCE): - Redefine in terms of SOFT_LINK_CONSTANT_MAY_FAIL_FOR_SOURCE_WITH_EXPORT(). 2019-01-24 Youenn Fablet Use MonotonicTime in WorkerRunLoop https://bugs.webkit.org/show_bug.cgi?id=193417 Reviewed by Saam Barati. * wtf/MessageQueue.h: (WTF::MessageQueue::waitForMessage): (WTF::MessageQueue::waitForMessageFilteredWithTimeout): 2019-01-24 Ross Kirsling Move FileSystem to WTF https://bugs.webkit.org/show_bug.cgi?id=193602 Reviewed by Yusuke Suzuki. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/FileMetadata.h: Renamed from Source/WebCore/platform/FileMetadata.h. * wtf/FileSystem.cpp: Renamed from Source/WebCore/platform/FileSystem.cpp. * wtf/FileSystem.h: Renamed from Source/WebCore/platform/FileSystem.h. * wtf/PlatformGTK.cmake: * wtf/PlatformMac.cmake: * wtf/PlatformPlayStation.cmake: * wtf/PlatformWPE.cmake: * wtf/PlatformWin.cmake: * wtf/cf/FileSystemCF.cpp: Renamed from Source/WebCore/platform/cf/FileSystemCF.cpp. * wtf/cocoa/FileSystemCocoa.mm: Renamed from Source/WebCore/platform/cocoa/FileSystemCocoa.mm. * wtf/glib/FileSystemGlib.cpp: Renamed from Source/WebCore/platform/glib/FileSystemGlib.cpp. * wtf/mac/FileSystemMac.mm: Renamed from Source/WebCore/platform/mac/FileSystemMac.mm. * wtf/posix/FileSystemPOSIX.cpp: Renamed from Source/WebCore/platform/posix/FileSystemPOSIX.cpp. * wtf/spi/mac/MetadataSPI.h: Renamed from Source/WebCore/PAL/pal/spi/mac/MetadataSPI.h. * wtf/win/FileSystemWin.cpp: Renamed from Source/WebCore/platform/win/FileSystemWin.cpp. * wtf/win/PathWalker.cpp: Renamed from Source/WebCore/platform/win/PathWalker.cpp. * wtf/win/PathWalker.h: Renamed from Source/WebCore/platform/win/PathWalker.h. 2019-01-24 Guillaume Emont [JSC] Reenable baseline JIT on mips https://bugs.webkit.org/show_bug.cgi?id=192983 Reviewed by Mark Lam. Use baseline JIT by default on MIPS. * wtf/Platform.h: 2019-01-24 David Kilzer Duplicate global variables: WTF::asciiCaseFoldTable Reviewed by Michael Catanzaro. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: - Add ASCIICType.cpp to build systems. * wtf/ASCIICType.cpp: Added. (WTF::asciiCaseFoldTable): Move table to here so there is only one copy. Mark as exported for other frameworks to use. * wtf/ASCIICType.h: (WTF::asciiCaseFoldTable): Change to extern declaration, and mark as exported for other frameworks to use. 2019-01-23 Mark Lam ARM64E should not ENABLE(SEPARATED_WX_HEAP). https://bugs.webkit.org/show_bug.cgi?id=193744 Reviewed by Saam Barati. * wtf/Platform.h: 2019-01-23 David Kilzer Switch remaining CoreMedia soft-linking in WebKit over to CoreMediaSoftLink.{cpp,h} Reviewed by Tim Horton. * wtf/win/SoftLinking.h: (SOFT_LINK_CONSTANT_FOR_SOURCE_WITH_EXPORT): - Implement for Windows. (SOFT_LINK_CONSTANT_FOR_SOURCE): - Define using SOFT_LINK_CONSTANT_FOR_SOURCE_WITH_EXPORT(). 2019-01-22 Tadeu Zagallo Cache bytecode to disk https://bugs.webkit.org/show_bug.cgi?id=192782 Reviewed by Keith Miller. BitVectors have to be friends with JSC::CacheBitVector to allow serializing its buffer as part of the bytecode cache encoding. * wtf/BitVector.h: 2019-01-21 Claudio Saavedra [GTK] Speculative build fix for Ubuntu LTS https://bugs.webkit.org/show_bug.cgi?id=193651 Unreviewed build fix. * wtf/Assertions.h: Add missing include. 2019-01-20 Saam Barati Rollout r240210: It broke tests on iOS https://bugs.webkit.org/show_bug.cgi?id=193640 Unreviewed. * wtf/BitVector.h: 2019-01-20 Tadeu Zagallo Cache bytecode to disk https://bugs.webkit.org/show_bug.cgi?id=192782 Reviewed by Keith Miller. BitVectors have to be friends with JSC::CacheBitVector to allow serializing its buffer as part of the bytecode cache encoding. * wtf/BitVector.h: 2019-01-18 Tim Horton Get rid of ADVANCED_SPELL_CHECKING https://bugs.webkit.org/show_bug.cgi?id=193592 Reviewed by Wenson Hsieh. * wtf/Platform.h: 2019-01-18 Jer Noble SDK_VARIANT build destinations should be separate from non-SDK_VARIANT builds https://bugs.webkit.org/show_bug.cgi?id=189553 Reviewed by Tim Horton. * Configurations/Base.xcconfig: * Configurations/SDKVariant.xcconfig: Added. 2019-01-18 Keith Miller Gigacages should start allocations from a slide https://bugs.webkit.org/show_bug.cgi?id=193523 Reviewed by Mark Lam. This patch changes some macros into constants since macros are the devil. * wtf/Gigacage.cpp: * wtf/Gigacage.h: 2019-01-18 Matt Lewis Unreviewed, rolling out r240160. This broke multiple internal builds. Reverted changeset: "Gigacages should start allocations from a slide" https://bugs.webkit.org/show_bug.cgi?id=193523 https://trac.webkit.org/changeset/240160 2019-01-18 Keith Miller Gigacages should start allocations from a slide https://bugs.webkit.org/show_bug.cgi?id=193523 Reviewed by Mark Lam. This patch changes some macros into constants since macros are the devil. * wtf/Gigacage.cpp: * wtf/Gigacage.h: 2019-01-17 Truitt Savell Unreviewed, rolling out r240124. This commit broke an internal build. Reverted changeset: "SDK_VARIANT build destinations should be separate from non- SDK_VARIANT builds" https://bugs.webkit.org/show_bug.cgi?id=189553 https://trac.webkit.org/changeset/240124 2019-01-17 Jer Noble SDK_VARIANT build destinations should be separate from non-SDK_VARIANT builds https://bugs.webkit.org/show_bug.cgi?id=189553 Reviewed by Tim Horton. * Configurations/Base.xcconfig: * Configurations/SDKVariant.xcconfig: Added. 2019-01-16 Keith Miller bmalloc should use JSC VM tag for gigacage https://bugs.webkit.org/show_bug.cgi?id=193496 Reviewed by Mark Lam. Move most of the macros for vm tagging to bmalloc. * wtf/VMTags.h: 2019-01-16 Alberto Garcia [WTF] Compilation fails with system malloc https://bugs.webkit.org/show_bug.cgi?id=172445 Reviewed by Michael Catanzaro. Follow-up to r217270. The sysinfo() system call is specific to Linux so update the #ifdef checks accordingly. * wtf/RAMSize.cpp: (WTF::computeRAMSize): 2019-01-15 Chris Dumez Unreviewed, revert part of r239997 as it is not needed to fix the build. * wtf/RefCounter.h: 2019-01-15 Alex Christensen Fix iOS build after r239993 https://bugs.webkit.org/show_bug.cgi?id=193361 * wtf/RefCounter.h: 2019-01-14 Michael Catanzaro Use unorm2_normalize instead of precomposedStringWithCanonicalMapping in userVisibleString https://bugs.webkit.org/show_bug.cgi?id=192945 Reviewed by Alex Christensen. Replace use of the nice NSString function precomposedStringWithCanonicalMapping with the ICU API unorm2_normalize. This is to prep the code for translation to cross-platform C++. Of course this is much worse than the preexisting code, but this is just a transitional measure and not the final state of the code. It wouldn't make sense to do this if the code were to remain Objective C++. * wtf/cocoa/NSURLExtras.mm: (WTF::toNormalizationFormC): (WTF::userVisibleString): 2019-01-14 Alex Christensen Bulgarian TLD should not punycode-encode URLs with Bulgarian Cyrillic characters https://bugs.webkit.org/show_bug.cgi?id=193411 Reviewed by Alexey Proskuryakov. * wtf/cocoa/NSURLExtras.mm: (WTF::allCharactersAllowedByTLDRules): 2019-01-12 Timothy Hatcher Have prefers-color-scheme: light always match on macOS versions before Mojave. https://bugs.webkit.org/show_bug.cgi?id=191655 rdar://problem/46074680 Reviewed by Megan Gardner. * wtf/Platform.h: Define HAVE_OS_DARK_MODE_SUPPORT on macOS 10.14. 2019-01-11 David Kilzer Follow-up: WorkQueue::concurrentApply() passes a raw pointer to a temporary String to Thread::create(). https://bugs.webkit.org/show_bug.cgi?id=191350 * wtf/WorkQueue.cpp: (WTF::WorkQueue::concurrentApply): Fix whitespace. 2019-01-11 Devin Rousso Fix style CFNetworkSPI style checker warnings from r239698 https://bugs.webkit.org/show_bug.cgi?id=193369 Reviewed by Joseph Pecoraro. * wtf/Platform.h: 2019-01-11 Said Abou-Hallawa WorkQueue::concurrentApply() passes a raw pointer to a temporary String to Thread::create(). https://bugs.webkit.org/show_bug.cgi?id=191350 Reviewed by Brent Fulgham. The non COCOA version of WorkQueue::concurrentApply() creates a temporary String for the threadName and passes the raw pointer of this String to Thread::create(). After freeing this String, Thread::entryPoint() uses the raw char pointer to internally initialize the thread. The fix is to use a single literal string for all the threads' names since they are created for a thread-pool. * wtf/WorkQueue.cpp: (WTF::WorkQueue::concurrentApply): 2019-01-11 Dominik Infuehr Enable DFG on ARM/Linux again https://bugs.webkit.org/show_bug.cgi?id=192496 Reviewed by Yusuke Suzuki. After changing the bytecode format DFG was disabled on all 32-bit architectures. Enable DFG now again on ARM/Linux. * wtf/Platform.h: 2019-01-10 Commit Queue Unreviewed, rolling out r239825. https://bugs.webkit.org/show_bug.cgi?id=193330 Broke tests on armv7/linux bots (Requested by guijemont on #webkit). Reverted changeset: "Enable DFG on ARM/Linux again" https://bugs.webkit.org/show_bug.cgi?id=192496 https://trac.webkit.org/changeset/239825 2019-01-10 John Wilander Override the session configuration for cookieAcceptPolicy https://bugs.webkit.org/show_bug.cgi?id=190925 Reviewed by Alexey Proskuryakov and Alex Christensen. * wtf/Platform.h: Definition of HAVE_CFNETWORK_OVERRIDE_SESSION_COOKIE_ACCEPT_POLICY. 2019-01-10 Dominik Infuehr Enable DFG on ARM/Linux again https://bugs.webkit.org/show_bug.cgi?id=192496 Reviewed by Yusuke Suzuki. After changing the bytecode format DFG was disabled on all 32-bit architectures. Enable DFG now again on ARM/Linux. * wtf/Platform.h: 2019-01-10 Carlos Garcia Campos [FreeType] Color emoji not properly supported https://bugs.webkit.org/show_bug.cgi?id=191976 Reviewed by Michael Catanzaro. Add a name for combining enclosing keycap character. * wtf/unicode/CharacterNames.h: 2019-01-09 Carlos Eduardo Ramalho and Fujii Hironori Use directory local sequential numbers for Unified Sources filenames instead of global sequential numbers for CMake https://bugs.webkit.org/show_bug.cgi?id=192391 Reviewed by Don Olmstead. Unified Source Builds are using global sequential numbers for bundle filenames UnifiedSource{sequential-number}.cpp. As the result, every new source file added would shift the next ones and prevent compiler caches from speeding up consecutive builds e.g. in git-bisect sessions. Changed it to directory local sequential numbers, UnifiedSource-{hash-of-dir-name}-{sequential-number-within-the-dir}.cpp. This is affecting only CMake builds which is where no '--max-cpp-bundle-count' nor '--max-obj-c-bundle-count' options are set. Xcode builds still use the old convention. * Scripts/generate-unified-source-bundles.rb: Add new instance variables @currentDirectory and @extraFiles to BundleManager. Still use global sequential numbers if --max-cpp-bundle-count or --max-obj-c-bundle-count is given. 2019-01-09 Alex Christensen Expand use of sourceApplicationAuditData https://bugs.webkit.org/show_bug.cgi?id=192995 Reviewed by Brady Eidson. * wtf/Platform.h: 2019-01-09 Mark Lam Gigacage disabling checks should handle the GIGACAGE_ALLOCATION_CAN_FAIL case properly. https://bugs.webkit.org/show_bug.cgi?id=193292 Reviewed by Yusuke Suzuki. Update the USE_SYSTEM_MALLOC version of Gigacage.h to match the bmalloc version. * wtf/Gigacage.h: 2019-01-07 David Kilzer Prefer RetainPtr to RetainPtr Reviewed by Alex Christensen. * wtf/RetainPtr.h: (WTF::RetainPtr::HelperPtrType): - Use C++ template metaprogramming to define a shared return type for adoptNS() and retainPtr() that uses RetainPtr instead of RetainPtr. The non-Objective-C typedef is used with retainPtr() for CFTypeRef objects. (WTF::adoptNS): - Only make declarations available when compilng with Objective-C. The inline implementation is only available for Objective-C, so this makes the declarations consistent. - Change return type to remove '*' from NS types using RetainPtr::HelperPtrType. (WTF::retainPtr): - Change return type to remove '*' from NS types using RetainPtr::HelperPtrType. * wtf/SchedulePair.h: - Remove '*' from RetainPtr<> type. 2019-01-07 Eric Carlson A MediaTime timescale must never be zero https://bugs.webkit.org/show_bug.cgi?id=193156 Reviewed by Jer Noble. * wtf/MediaTime.cpp: (WTF::greatestCommonDivisor): ASSERT if either parameter or return value is zero. (WTF::MediaTime::MediaTime): Create +/- infinity if passed zero timescale. (WTF::MediaTime::createWithFloat): Ditto. (WTF::MediaTime::createWithDouble): Ditto. (WTF::MediaTime::setTimeScale): Ditto. 2019-01-02 Alex Christensen Homograph with LATIN SMALL LETTER R WITH FISHHOOK https://bugs.webkit.org/show_bug.cgi?id=192944 Reviewed by Tim Horton. * wtf/cocoa/NSURLExtras.mm: (WTF::isLookalikeCharacter): 2019-01-02 Commit Queue Unreviewed, rolling out r239524. https://bugs.webkit.org/show_bug.cgi?id=193083 basic browsing seems not to work (Requested by thorton on #webkit). Reverted changeset: "Expand use of sourceApplicationAuditData" https://bugs.webkit.org/show_bug.cgi?id=192995 https://trac.webkit.org/changeset/239524 2018-12-28 Yusuke Suzuki Add ENABLE_UNIFIED_BUILDS option to cmake ports https://bugs.webkit.org/show_bug.cgi?id=193045 Reviewed by Don Olmstead. * Scripts/generate-unified-source-bundles.rb: 2018-12-27 Alex Christensen Resurrect Mac CMake build https://bugs.webkit.org/show_bug.cgi?id=192658 Reviewed by Yusuke Suzuki. * wtf/PlatformMac.cmake: * wtf/cf/CFURLExtras.cpp: * wtf/cf/CFURLExtras.h: * wtf/cf/URLCF.cpp: * wtf/cocoa/NSURLExtras.h: * wtf/cocoa/NSURLExtras.mm: * wtf/cocoa/URLCocoa.mm: 2018-12-21 Dan Bernstein Fixed building for macOS 10.13 using the macOS 10.14 SDK. * wtf/Platform.h: Changed HAVE_AUTHORIZATION_STATUS_FOR_MEDIA_TYPE to depend on the deployment target, not the SDK. 2018-12-20 Yusuke Suzuki [JSC] Implement "well-formed JSON.stringify" proposal https://bugs.webkit.org/show_bug.cgi?id=191677 Reviewed by Darin Adler. This patch implements "well-formed JSON.stringify" proposal[1], which is now stage 3. JSON.stringify appended surrogate pair codes even if it is not paired appropriately. The proposal requires that broken surrogate pairs are unicode-escaped. [1]: https://github.com/tc39/proposal-well-formed-stringify * wtf/text/StringBuilderJSON.cpp: (WTF::appendQuotedJSONStringInternal): 2018-12-21 Alex Christensen Expand use of sourceApplicationAuditData https://bugs.webkit.org/show_bug.cgi?id=192995 Reviewed by Brady Eidson. * wtf/Platform.h: 2018-12-21 Alex Christensen Revert r239503. https://bugs.webkit.org/show_bug.cgi?id=192944 * wtf/cocoa/NSURLExtras.mm: (WTF::isLookalikeCharacter): 2018-12-20 Brent Fulgham Show punycode if URL contains Latin small letter dotless i https://bugs.webkit.org/show_bug.cgi?id=192944 Reviewed by Andy Estes. Revise our "lookalike character" logic to include the small Latin dotless i character. Test: fast/url/host.html * wtf/cocoa/NSURLExtras.mm: (WTF::isLookalikeCharacter): 2018-12-20 Chris Dumez Use Optional::hasValue() instead of Optional::has_value() https://bugs.webkit.org/show_bug.cgi?id=192948 Reviewed by Tim Horton. * wtf/Hasher.h: (WTF::add): * wtf/Optional.h: 2018-12-20 Chris Dumez Use Optional::valueOr() instead of Optional::value_or() https://bugs.webkit.org/show_bug.cgi?id=192933 Reviewed by Geoffrey Garen. * wtf/Optional.h: (WTF::Optional Consistently use MaxLength for all WTF strings https://bugs.webkit.org/show_bug.cgi?id=192853 Reviewed by Mark Lam. MaxLength was introduced to be INT_MAX for WTF::String and StringImpl, but all the assertions were still done using UINT_MAX. Change it to use MaxLength for all checks. * wtf/text/StringImpl.cpp: (WTF::StringImpl::createUninitializedInternalNonEmpty): (WTF::StringImpl::reallocateInternal): (WTF::StringImpl::create): (WTF::StringImpl::convertToLowercaseWithoutLocale): (WTF::StringImpl::convertToUppercaseWithoutLocale): (WTF::StringImpl::convertToLowercaseWithLocale): (WTF::StringImpl::convertToUppercaseWithLocale): (WTF::StringImpl::foldCase): (WTF::StringImpl::find): (WTF::StringImpl::replace): (WTF::StringImpl::utf8ForCharacters): (WTF::StringImpl::tryGetUtf8ForRange const): * wtf/text/StringImpl.h: (WTF::lengthOfNullTerminatedString): (WTF::StringImpl::tryCreateUninitialized): (WTF::StringImpl::adopt): (WTF::StringImpl::maxInternalLength): * wtf/text/WTFString.cpp: (WTF::String::append): (WTF::String::insert): (WTF::String::fromUTF8): * wtf/text/WTFString.h: (WTF::String::reverseFind const): 2018-12-19 Chris Dumez wtf/Optional.h: move-constructor and move-assignment operator should disengage the value being moved from https://bugs.webkit.org/show_bug.cgi?id=192728 Reviewed by Geoff Garen. Update optional's move-constructor and move-assignment operator to disengage the value being moved from. Rename to optional to Optional, make_optional() to makeOptional(), and move class from std to WTF namespace. Based on patch by David Kilzer. * wtf/*: 2018-12-19 Eric Carlson [MediaStream] Force system camera/microphone TCC prompt if necessary https://bugs.webkit.org/show_bug.cgi?id=192820 Reviewed by Jer Noble. * wtf/Platform.h: Define HAVE_AUTHORIZATION_STATUS_FOR_MEDIA_TYPE. 2018-12-17 Chris Fleizach Some builds are broken after r239262 https://bugs.webkit.org/show_bug.cgi?id=192777 Reviewed by Simon Fraser. * wtf/Platform.h: 2018-12-17 Daniel Bates Support concatenating StringView with other string types https://bugs.webkit.org/show_bug.cgi?id=177566 Reviewed by Darin Adler. Add operator+ overloads to StringOperators.h to support concatenating a StringView with other string types (e.g. String). This lets a person write more naturally looking code: stringView + string Instead of: makeString(stringView, string) * wtf/text/StringOperators.h: (WTF::operator+): Added various operator+ overloads. 2018-12-17 Commit Queue Unreviewed, rolling out r239265 and r239274. https://bugs.webkit.org/show_bug.cgi?id=192765 unorm_normalize is deprecated, and broke an internal build (Requested by Truitt on #webkit). Reverted changesets: "[GTK][WPE] Need a function to convert internal URI to display ("pretty") URI" https://bugs.webkit.org/show_bug.cgi?id=174816 https://trac.webkit.org/changeset/239265 "Fix the Apple Internal Mac build with a newer SDK" https://trac.webkit.org/changeset/239274 2018-12-17 Daniel Bates Fix the Apple Internal Mac build with a newer SDK * wtf/URLHelpers.cpp: (WTF::URLHelpers::userVisibleURL): 2018-12-17 Matt Lewis Unreviewed, rolling out r239254. This broke the Windows 10 Debug build Reverted changeset: "Replace many uses of String::format with more type-safe alternatives" https://bugs.webkit.org/show_bug.cgi?id=192742 https://trac.webkit.org/changeset/239254 2018-12-17 Ms2ger [GTK][WPE] Need a function to convert internal URI to display ("pretty") URI https://bugs.webkit.org/show_bug.cgi?id=174816 Reviewed by Michael Catanzaro. Translate userVisibleString and dependent code into platform-neutral C++ in wtf/URLHelpers.{h,cpp}. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/URLHelpers.cpp: Added. (WTF::URLHelpers::loadIDNScriptWhiteList): (WTF::URLHelpers::isArmenianLookalikeCharacter): (WTF::URLHelpers::isArmenianScriptCharacter): (WTF::URLHelpers::isASCIIDigitOrValidHostCharacter): (WTF::URLHelpers::isLookalikeCharacter): (WTF::URLHelpers::whiteListIDNScript): (WTF::URLHelpers::initializeDefaultIDNScriptWhiteList): (WTF::URLHelpers::allCharactersInIDNScriptWhiteList): (WTF::URLHelpers::isSecondLevelDomainNameAllowedByTLDRules): (WTF::URLHelpers::isRussianDomainNameCharacter): (WTF::URLHelpers::allCharactersAllowedByTLDRules): (WTF::URLHelpers::mapHostName): (WTF::URLHelpers::collectRangesThatNeedMapping): (WTF::URLHelpers::applyHostNameFunctionToMailToURLString): (WTF::URLHelpers::applyHostNameFunctionToURLString): (WTF::URLHelpers::mapHostNames): (WTF::URLHelpers::createStringWithEscapedUnsafeCharacters): (WTF::URLHelpers::userVisibleURL): * wtf/URLHelpers.h: Added. * wtf/cocoa/NSURLExtras.mm: (WTF::URLHelpers::loadIDNScriptWhiteList): (WTF::decodePercentEscapes): (WTF::decodeHostName): (WTF::encodeHostName): (WTF::URLWithUserTypedString): (WTF::userVisibleString): 2018-12-15 Darin Adler Use warning-ignoring macros more consistently and simply https://bugs.webkit.org/show_bug.cgi?id=192743 Reviewed by Mark Lam. * wtf/Assertions.h: Use IGNORE_WARNINGS_BEGIN rather than IGNORE_CLANG_WARNINGS_BEGIN since we don't need special handling for non-clang compilers, in part since the code is already inside #if COMPILER(CLANG), but also because it would be harmless to ignore this warning on non-clang; we should almost never use IGNORE_CLANG_WARNINGS_BEGIN. 2018-12-15 Darin Adler Replace many uses of String::format with more type-safe alternatives https://bugs.webkit.org/show_bug.cgi?id=192742 Reviewed by Mark Lam. * wtf/WorkQueue.cpp: (WTF::WorkQueue::concurrentApply): Use makeString. * wtf/dtoa.cpp: (WTF::dtoa): Use sprintf instead of String::format in the comments, since these functions have nothing to do with WTF::String. 2018-12-14 Darin Adler Verify size is valid in USE_SYSTEM_MALLOC version of tryAllocateZeroedVirtualPages https://bugs.webkit.org/show_bug.cgi?id=192738 rdar://problem/37502342 Reviewed by Mark Lam. * wtf/Gigacage.cpp: (Gigacage::tryAllocateZeroedVirtualPages): Added a RELEASE_ASSERT just like the one in tryLargeZeroedMemalignVirtual in bmalloc. 2018-12-14 David Kilzer clang-tidy: Fix unnecessary copy of AtomicString each time one is logged Reviewed by Eric Carlson. * wtf/Logger.h: (WTF::LogArgument::toString): Make argument a const reference to avoid the copy. 2018-12-14 Zan Dobersek [GLib] RunLoop::dispatchAfter() GSource requires microsecond precision https://bugs.webkit.org/show_bug.cgi?id=192696 Reviewed by Michael Catanzaro. The GSource we set up in GLib's RunLoop::dispatchAfter() implementation should support microsecond-precision delays. Such delays are common in JSC's Watchdog implementation and missing support for them has been causing test failures in the `testapi` program as well as some JSC tests that depend on the termination determination functionality of the JSC::Watchdog class. RunLoop::dispatchAfter() is changed to spawn a raw GSource that uses the existing GSourceFuncs implementation used elsewhere in GLib's RunLoop. The GSource's ready time is set manually, now with the necessary microsecond precision. * wtf/glib/RunLoopGLib.cpp: (WTF::RunLoop::dispatchAfter): 2018-12-13 Saam Barati The JSC shell should listen for memory pressure events and respond to them https://bugs.webkit.org/show_bug.cgi?id=192647 Reviewed by Keith Miller. * wtf/MemoryPressureHandler.cpp: (WTF::MemoryPressureHandler::MemoryPressureHandler): (WTF::MemoryPressureHandler::setDispatchQueue): Make it so that we can customize which dispatch queue memory pressure events get handled on. * wtf/MemoryPressureHandler.h: (WTF::MemoryPressureHandler::setShouldLogMemoryMemoryPressureEvents): Make it so that we can disable logging that happens on each memory pressure event. * wtf/cocoa/MemoryPressureHandlerCocoa.mm: (WTF::MemoryPressureHandler::install): (WTF::MemoryPressureHandler::uninstall): (WTF::MemoryPressureHandler::holdOff): 2018-12-13 David Kilzer clang-tidy: Fix unnecessary parameter copies in ParallelHelperPool.cpp Reviewed by Alex Christensen. * wtf/ParallelHelperPool.cpp: (WTF::ParallelHelperClient::ParallelHelperClient): Use rvalue reference and WTFMove(). (WTF::ParallelHelperClient::setTask): Ditto. (WTF::ParallelHelperClient::runTaskInParallel): Ditto. (WTF::ParallelHelperClient::runTask): Use const reference. * wtf/ParallelHelperPool.h: Update declarations to match implementations. 2018-12-12 Alex Christensen Implement safe browsing in WebKit on WatchOS https://bugs.webkit.org/show_bug.cgi?id=192641 Reviewed by Geoff Garen. * wtf/Platform.h: WatchOS has safe browsing, too! 2018-12-11 Fujii Hironori [Win][Clang] Fix compilation warnings of WTF https://bugs.webkit.org/show_bug.cgi?id=192583 Reviewed by Alex Christensen. clang-cl reports the following warnings. > [92/206] Building CXX object Source\WTF\wtf\CMakeFiles\WTF.dir\StackBounds.cpp.obj > ..\..\Source\WTF\wtf\StackBounds.cpp(163,48): warning: missing field 'AllocationBase' initializer [-Wmissing-field-initializers] > MEMORY_BASIC_INFORMATION stackOrigin = { 0 }; > ^ > 1 warning generated. > [160/206] Building CXX object Source\WTF\wtf\CMakeFiles\WTF.dir\win\RunLoopWin.cpp.obj > ..\..\Source\WTF\wtf\win\RunLoopWin.cpp(34,54): warning: ISO C++11 does not allow conversion from string literal to 'const LPWSTR' (aka 'wchar_t *const') [-Wwritable-strings] > static const LPWSTR kRunLoopMessageWindowClassName = L"RunLoopMessageWindow"; > ^ > ..\..\Source\WTF\wtf\win\RunLoopWin.cpp(86,32): warning: missing field 'lpfnWndProc' initializer [-Wmissing-field-initializers] > WNDCLASS windowClass = { 0 }; > ^ > 2 warnings generated. > [175/206] Building CXX object Source\WTF\wtf\CMakeFiles\WTF.dir\DateMath.cpp.obj > ..\..\Source\WTF\wtf\DateMath.cpp(125,20): warning: unused function 'getLocalTime' [-Wunused-function] > static inline void getLocalTime(const time_t* localTime, struct tm* localTM) > ^ > 1 warning generated. * wtf/DateMath.cpp: (WTF::getLocalTime): Defined only if used. * wtf/StackBounds.cpp: (WTF::StackBounds::currentThreadStackBoundsInternal): Initialize stackOrigin with '{ }'. * wtf/win/RunLoopWin.cpp: Change the type of kRunLoopMessageWindowClassName to LPCWSTR. (WTF::RunLoop::registerRunLoopMessageWindowClass): Initialize windowClass with '{ }'. 2018-12-11 Andy Estes Introduce makeBlockPtr for lambdas https://bugs.webkit.org/show_bug.cgi?id=192594 Reviewed by Alex Christensen. BlockPtr<...>::fromCallable is cumbersome because it requires repeating the callable's signature as a class template argument. This patch introduces an overload of makeBlockPtr that deduces the correct BlockPtr instantiation from a lambda's operator() signature. * wtf/BlockPtr.h: (WTF::makeBlockPtr): Adopted makeBlockPtr. * wtf/cocoa/WorkQueueCocoa.cpp: (WTF::WorkQueue::dispatch): (WTF::WorkQueue::dispatchAfter): (WTF::WorkQueue::concurrentApply): 2018-12-10 Don Olmstead Move ENABLE_RESOURCE_LOAD_STATISTICS to FeatureDefines.xcconfig https://bugs.webkit.org/show_bug.cgi?id=192573 Reviewed by Simon Fraser. Remove ENABLE_RESOURCE_LOAD_STATISTICS from Platform.h and instead rely on it being set in FeatureDefines.xcconfig. * wtf/Platform.h: 2018-12-10 Alexey Proskuryakov Move ENABLE_SEC_ITEM_SHIM out of WebKit's config.h https://bugs.webkit.org/show_bug.cgi?id=192428 Reviewed by Tim Horton. * wtf/Platform.h: 2018-12-10 Alexey Proskuryakov Move more macros out of WebKit's config.h https://bugs.webkit.org/show_bug.cgi?id=192430 Reviewed by Tim Horton. * wtf/Platform.h: 2018-12-09 Yusuke Suzuki Unreviewed, fix build failure on GCC 8.2, part 2 Add RefCountedArray::assign, and use it instead of operator= internally. We should have operator=(const RefCountedArray&) since it will be automatically generated if we do not have correct implementation here. * wtf/RefCountedArray.h: (WTF::RefCountedArray::operator=): (WTF::RefCountedArray::assign): 2018-12-09 Yusuke Suzuki Unreviewed, fix build failure on GCC 8.2 We remove operator= call since it is not necessary. This is a workaround. It seems that GCC 8.2 fails to parse this specialization. * wtf/RefCountedArray.h: 2018-12-08 Darin Adler Fix stray-semicolon warning seen with a new version of clang in Xcode https://bugs.webkit.org/show_bug.cgi?id=192534 Reviewed by Alexey Proskuryakov. * wtf/Lock.h: Removed an unneeded semicolon. 2018-12-08 Adrian Perez de Castro [WTF] Debug build fails due conflicting abort() method https://bugs.webkit.org/show_bug.cgi?id=192491 Reviewed by Michael Catanzaro. * wtf/Assertions.h: Use namespaced std::abort() insted of plain abort() to avoid clashes inside classes which have an ::abort() method, but only when __cplusplus is defined to allow inclusion of the header in plain C sources. 2018-12-07 Andy Estes [Cocoa] Add optional variants of SOFT_LINK_CLASS_FOR_SOURCE https://bugs.webkit.org/show_bug.cgi?id=192498 Reviewed by Tim Horton. Added SOFT_LINK_CLASS_FOR_SOURCE_OPTIONAL and SOFT_LINK_CLASS_FOR_SOURCE_OPTIONAL_WITH_EXPORT, which behave like their non-optional variants but do not require their classes to exist. * wtf/cocoa/SoftLinking.h: 2018-12-06 Alexey Proskuryakov Move USE_NEW_THEME out of WebCore's config.h https://bugs.webkit.org/show_bug.cgi?id=192426 Reviewed by Tim Horton. * wtf/Platform.h: 2018-12-04 Carlos Garcia Campos [SOUP] Move URLSoup back to WebCore after r238771 https://bugs.webkit.org/show_bug.cgi?id=192306 Reviewed by Michael Catanzaro. In r238771 URL was moved from WebCore to WTF, including the soup implementation. Unfortunately that added libsoup as a new dependency of libjavascriptcoregtk. * wtf/PlatformGTK.cmake: * wtf/PlatformWPE.cmake: * wtf/URL.h: * wtf/glib/URLGLib.cpp: Copied from Source/WTF/wtf/glib/URLSoup.cpp. 2018-12-03 Don Olmstead Fix some unused parameter warnings https://bugs.webkit.org/show_bug.cgi?id=192336 Reviewed by Fujii Hironori. * wtf/StackTrace.cpp: (WTFGetBacktrace): (WTF::StackTrace::demangle): * wtf/generic/MemoryPressureHandlerGeneric.cpp: (WTF::MemoryPressureHandler::holdOff): (WTF::MemoryPressureHandler::respondToMemoryPressure): 2018-12-01 Alexey Proskuryakov Modernize version check for _suppressedAutoAddedHTTPHeaders https://bugs.webkit.org/show_bug.cgi?id=192175 Reviewed by Tim Horton. * wtf/Platform.h: 2018-11-30 Alex Christensen Fix Windows build after r238771 https://bugs.webkit.org/show_bug.cgi?id=190234 * wtf/URLParser.h: Just make defaultPortForProtocol public so we don't have to worry about DLL linkage. 2018-11-30 Alex Christensen Move URL from WebCore to WTF https://bugs.webkit.org/show_bug.cgi?id=190234 Reviewed by Keith Miller. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Forward.h: * wtf/PlatformGTK.cmake: * wtf/PlatformMac.cmake: * wtf/PlatformWPE.cmake: * wtf/PlatformWin.cmake: * wtf/URL.cpp: Renamed from Source/WebCore/platform/URL.cpp. (WTF::URL::protocolIs): * wtf/URL.h: Renamed from Source/WebCore/platform/URL.h. * wtf/URLHash.h: Renamed from Source/WebCore/platform/URLHash.h. (WTF::URLHash::hash): (WTF::URLHash::equal): * wtf/URLParser.cpp: Renamed from Source/WebCore/platform/URLParser.cpp. (WTF::URLParser::isInUserInfoEncodeSet): (WTF::URLParser::parseAuthority): * wtf/URLParser.h: Renamed from Source/WebCore/platform/URLParser.h. (WTF::URLParser::URLParser): (WTF::URLParser::result): * wtf/cf/CFURLExtras.cpp: Renamed from Source/WebCore/platform/cf/CFURLExtras.cpp. * wtf/cf/CFURLExtras.h: Renamed from Source/WebCore/platform/cf/CFURLExtras.h. * wtf/cf/URLCF.cpp: Renamed from Source/WebCore/platform/cf/URLCF.cpp. * wtf/cocoa/NSURLExtras.h: Copied from Source/WebCore/loader/archive/ArchiveResourceCollection.h. * wtf/cocoa/NSURLExtras.mm: Copied from Source/WebCore/platform/mac/WebCoreNSURLExtras.mm. (WTF::isArmenianLookalikeCharacter): (WTF::isArmenianScriptCharacter): (WTF::isASCIIDigitOrValidHostCharacter): (WTF::isLookalikeCharacter): (WTF::whiteListIDNScript): (WTF::readIDNScriptWhiteListFile): (WTF::allCharactersInIDNScriptWhiteList): (WTF::isSecondLevelDomainNameAllowedByTLDRules): (WTF::isRussianDomainNameCharacter): (WTF::allCharactersAllowedByTLDRules): (WTF::mapHostNameWithRange): (WTF::hostNameNeedsDecodingWithRange): (WTF::hostNameNeedsEncodingWithRange): (WTF::decodeHostNameWithRange): (WTF::encodeHostNameWithRange): (WTF::decodeHostName): (WTF::encodeHostName): (WTF::collectRangesThatNeedMapping): (WTF::collectRangesThatNeedEncoding): (WTF::collectRangesThatNeedDecoding): (WTF::applyHostNameFunctionToMailToURLString): (WTF::applyHostNameFunctionToURLString): (WTF::mapHostNames): (WTF::stringByTrimmingWhitespace): (WTF::URLByTruncatingOneCharacterBeforeComponent): (WTF::URLByRemovingResourceSpecifier): (WTF::URLWithData): (WTF::dataWithUserTypedString): (WTF::URLWithUserTypedString): (WTF::URLWithUserTypedStringDeprecated): (WTF::hasQuestionMarkOnlyQueryString): (WTF::dataForURLComponentType): (WTF::URLByRemovingComponentAndSubsequentCharacter): (WTF::URLByRemovingUserInfo): (WTF::originalURLData): (WTF::createStringWithEscapedUnsafeCharacters): (WTF::userVisibleString): (WTF::isUserVisibleURL): (WTF::rangeOfURLScheme): (WTF::looksLikeAbsoluteURL): * wtf/cocoa/URLCocoa.mm: Renamed from Source/WebCore/platform/mac/URLMac.mm. (WTF::URL::URL): (WTF::URL::createCFURL const): * wtf/glib/GUniquePtrSoup.h: Renamed from Source/WebCore/platform/network/soup/GUniquePtrSoup.h. * wtf/glib/URLSoup.cpp: Renamed from Source/WebCore/platform/soup/URLSoup.cpp. 2018-11-30 Alexey Proskuryakov Move USE_CFNETWORK_IGNORE_HSTS to its proper place https://bugs.webkit.org/show_bug.cgi?id=192173 Reviewed by Tim Horton. * wtf/Platform.h: Also renamed it to better match other version checks. 2018-11-29 Alexey Proskuryakov Modernize the check for kCFURLRequestContentDecoderSkipURLCheck existence https://bugs.webkit.org/show_bug.cgi?id=192041 Reviewed by Tim Horton. * wtf/Platform.h: 2018-11-28 Mark Lam ENABLE_SEPARATED_WX_HEAP needs to be defined in Platform.h. https://bugs.webkit.org/show_bug.cgi?id=192110 Reviewed by Saam Barati. Contrary my previous claim in r238564, ENABLE_SEPARATED_WX_HEAP needs to be defined in Platform.h because it is also needed in WebCore for the CSS JIT. Also contrary to my previous claim, ENABLE(FAST_JIT_PERMISSIONS) is defined for WebCore (and other projects) as well as JSC. Hence, there's no reason why ENABLE_SEPARATED_WX_HEAP cannot be defined in Platform.h. * wtf/Platform.h: 2018-11-28 Keith Rollin Update generate-unified-source-bundles.rb to generate .xcfilelist files https://bugs.webkit.org/show_bug.cgi?id=192029 Reviewed by Alex Christensen. Update generate-unified-source-bundles.rb to generate output for .xcfilelist files. These files are used to indicate the sets of input and output files to Run Script build phases in Xcode. By invoking generate-unified-source-bundles.rb with -generate-xcfilelists, the script generates these .xcfilelist files. These .xcfilelist files can then be used to specify the inputs and outputs of the Generate Unified Sources build phases. * Scripts/generate-unified-source-bundles.rb: 2018-11-28 Alexey Proskuryakov Remove another OS version check from NetworkDataTaskCocoa.mm https://bugs.webkit.org/show_bug.cgi?id=192046 Reviewed by Alex Christensen. * wtf/Platform.h: 2018-11-28 Alexey Proskuryakov Modernize version checks for same site cookie support https://bugs.webkit.org/show_bug.cgi?id=192054 Reviewed by Tim Horton. * wtf/Platform.h: 2018-11-27 Alexey Proskuryakov Modernize the check for async _saveCookies existence https://bugs.webkit.org/show_bug.cgi?id=191987 Reviewed by Dean Jackson. * wtf/Platform.h: Added a specific macro for this. Not changing the behavior here, although it seems very likely that we want to do the same on other iOS family OSes. 2018-11-26 Fujii Hironori [Win][Clang] SOFT_LINK reports warning: implicit conversion between pointer-to-function and pointer-to-object is a Microsoft extension [-Wmicrosoft-cast] https://bugs.webkit.org/show_bug.cgi?id=191960 Reviewed by Alex Christensen. * wtf/win/SoftLinking.h: Do reinterpret_cast a function pointer argument of EncodePointer. Changed the type of stored function pointer returned by EncodePointer. 2018-11-26 Sam Weinig Streamline ListHashSet use in floating object code https://bugs.webkit.org/show_bug.cgi?id=191957 Reviewed by Alex Christensen. * wtf/ListHashSet.h: Reverses the order of the template arguments for the find() and contains() overload that allow specifying a hash translator to allow the compiler to deduce type T. This simplifies call sites and matches other WTF containers. 2018-11-25 Michael Catanzaro CRASH() should call abort() except on Darwin and in developer builds https://bugs.webkit.org/show_bug.cgi?id=184408 Reviewed by Daniel Bates. CRASH() should call abort() except on Darwin and in developer builds, as discussed on webkit-dev. This should be slightly nicer than dereferencing 0xbadbeef. On Darwin, CRASH() uses a breakpoint trap, which seems to corrupt the stack on Linux, so we can't do that. Continue to call WTFCrash() in developer mode, and make no changes to WTFCrash(), since it is reportedly useful in nightmare scenarios where core dumps are unavailable. We also have to define CRASH_UNDER_CONSTEXPR_CONTEXT(). It's a bit odd that it's possible to use a non-constexpr function here, but it works. Currently this macro uses WTFCrash(), which is also non-constexpr. * wtf/Assertions.h: 2018-11-25 Michael Catanzaro Unreviewed, rolling out r238469. Broke the build Reverted changeset: "CRASH() should call abort() except on Darwin and in developer builds" https://bugs.webkit.org/show_bug.cgi?id=184408 https://trac.webkit.org/changeset/238469 2018-11-24 Andy Estes [Cocoa] SOFT_LINK_CLASS_FOR_{HEADER,SOURCE} should generate a more concise getter function https://bugs.webkit.org/show_bug.cgi?id=191899 Reviewed by Dean Jackson. Currently, SOFT_LINK_CLASS_FOR_HEADER declares a class getter function that includes the framework name. For example, NSView would have a class getter named namespace::get_AppKit_NSViewClass(). Including the framework name in the getter is unnecessary. Objective-C classes already exist in a global namespace, so there is no need to disambiguate class names by framework. This patch elides the framework name from the getter function. For example, NSView would now have a getter named namespace::getNSViewClass(). * wtf/cocoa/SoftLinking.h: 2018-11-24 Michael Catanzaro CRASH() should call abort() except on Darwin and in developer builds https://bugs.webkit.org/show_bug.cgi?id=184408 Reviewed by Daniel Bates. CRASH() should call abort() except on Darwin and in developer builds, as discussed on webkit-dev. This should be slightly nicer than dereferencing 0xbadbeef. On Darwin, CRASH() uses a breakpoint trap, which seems to corrupt the stack on Linux, so we can't do that. Continue to call WTFCrash() in developer mode, and make no changes to WTFCrash(), since it is reportedly useful in nightmare scenarios where core dumps are unavailable. * wtf/Assertions.h: 2018-11-23 Sam Weinig Add raw pointer overloads to ListHashSet via SmartPtr specialized functions https://bugs.webkit.org/show_bug.cgi?id=191936 Reviewed by Zalan Bujtas. Adds overloads for find, contains, insertBefore and remove that take raw pointers when the value type V of a ListHashSet is true for the predicate IsSmartPtr::value. This brings the interface to ListHashSet closer inline with HashSet, HashMap and HashCountedSet which already have this functionality. Like in the other collections, this is especially useful when using std::unique_ptr<> as the value, since there would be no way to pass it to these functions. One difference between this set of overloads is the inclusion of insertBefore, which is unique to ListHashSet. As would be expected, this specialization only changes the first parameter, the one that needs to be found, to support a raw pointer. * wtf/ListHashSet.h: (WTF::U>::find): (WTF::U>::find const): (WTF::U>::contains const): (WTF::U>::insertBefore): (WTF::U>::remove): 2018-11-21 Yusuke Suzuki [JSC] Drop ARM_TRADITIONAL support in LLInt, baseline JIT, and DFG https://bugs.webkit.org/show_bug.cgi?id=191675 Reviewed by Mark Lam. * wtf/InlineASM.h: * wtf/Platform.h: 2018-11-21 Andy Estes [Cocoa] Create a soft-linking file for PassKit https://bugs.webkit.org/show_bug.cgi?id=191875 Reviewed by Myles Maxfield. * wtf/Platform.h: Defined USE_PASSKIT. * wtf/cocoa/SoftLinking.h: Added _WITH_EXPORT variants of SOFT_LINK_FRAMEWORK_FOR_SOURCE, SOFT_LINK_PRIVATE_FRAMEWORK_FOR_SOURCE, SOFT_LINK_CLASS_FOR_SOURCE, SOFT_LINK_FUNCTION_FOR_SOURCE, and SOFT_LINK_CONSTANT_FOR_SOURCE. 2018-11-21 Dominik Infuehr Enable JIT on ARM/Linux https://bugs.webkit.org/show_bug.cgi?id=191548 Reviewed by Yusuke Suzuki. Enable JIT by default on ARMv7/Linux after it was disabled with recent bytcode format change. * wtf/Platform.h: 2018-11-14 Keith Rollin Fix #end vs. #endif typo. https://bugs.webkit.org/show_bug.cgi?id=191668 Reviewed by Alexey Proskuryakov. Source/WebCore/SourcesCocoa.txt had a #end that should have been a #endif. Fix this, an add a check to generate-unified-source-bundles.rb to detect similar typos. * Scripts/generate-unified-source-bundles.rb: 2018-11-12 Mark Lam Add OOM detection to StringPrototype's substituteBackreferences(). https://bugs.webkit.org/show_bug.cgi?id=191563 Reviewed by Saam Barati. Enhanced StringBuilder::toString() to skip the shrinkToFit(), reifyString(), and the hasOverflowed() check if m_string is not null. When m_string is not null, the StringBuilder either only has a single String in m_string (with m_buffer being null), or reifyString() has already been called (resulting in a non-null m_string with a possibly non-null m_buffer). We can skip the overflow check because: 1. if the StringBuilder only has a single String, then there cannot be an overflow. 2. if reifyString() has already been called, then the hasOverflowed() checked has already been done because every code path that calls reifyString() first does the hasOverflowed() check. We can skip shrinkToFit() because it only applies to m_buffer. 1. if the StringBuilder only has a single String, then there's no m_buffer to shrink. 2. if reifyString() has already been called, then we either came down a. the toString() path with a null m_string previously, where we would have already called shrinkToFit() before reifyString(), or b. the toStringPreserveCapacity() path where we don't want to shrinkToFit(). We can skip reifyString() because: 1. if the StringBuilder only has a single String, then the string is already reified. 2. if reifyString() has been already called, then the string is already reified. Note that if m_string is the null string and m_buffer is null, reifyString() will replace it with the empty string. For this reason, we cannot solely check for !m_buffer because we need to reify the null string into the empty string. Note also that if m_string is null and m_buffer is non-null, reifyString() will create a String and set m_string to it. However, m_buffer remains non-null. For this reason, we cannot assert !m_buffer alone when m_string is non-null. We add a m_isReified flag (only when assertions are enabled) to track the reified case where both m_buffer and m_string are non-null. * wtf/text/StringBuilder.cpp: (WTF::StringBuilder::reifyString const): * wtf/text/StringBuilder.h: (WTF::StringBuilder::toString): 2018-11-10 Benjamin Poulain Fix a fixme: rename wtfObjcMsgSend to wtfObjCMsgSend https://bugs.webkit.org/show_bug.cgi?id=191492 Reviewed by Alex Christensen. Because renaming ObjcRuntimeExtras.h to ObjCRuntimeExtras.h only changes the cases, some systems have issues with applying this patch. To work around the problem, the change is made is two patches, first rename to WTFObjCRuntimeExtras.h, then back to ObjCRuntimeExtras.h. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/WTFObjCRuntimeExtras.h: Renamed from Source/WTF/wtf/ObjcRuntimeExtras.h. (wtfObjCMsgSend): 2018-11-09 Keith Miller LLInt VectorSizeOffset should be based on offset extraction https://bugs.webkit.org/show_bug.cgi?id=191468 Reviewed by Yusuke Suzuki. Make things friends with LLIntOffsetsExtractor. * wtf/RefCountedArray.h: * wtf/Vector.h: 2018-11-09 Jim Mason [WTF] Changes in bug 188867 break non-Linux Unix builds https://bugs.webkit.org/show_bug.cgi?id=191380 The intention of 188867 was to split out platform-specific heap query/release code. Any unsupported platform would use a generic, no-op stub. However, wtf/PlatformGTK.cmake ended up sending all non-Linux platforms through the Linux implementation, which breaks the build for those platforms. This includes any user of the GTK target which is not Linux, such as the *BSDs, Solaris, etc. Reviewed by Yusuke Suzuki. * wtf/PlatformGTK.cmake: Updated to include Linux-specific code only for Linux; all other platforms use the generic stub. 2018-11-06 Geoffrey Garen Removed mbmalloc target from WTF https://bugs.webkit.org/show_bug.cgi?id=191313 Reviewed by Saam Barati. For benchmarking, WTF::fastMalloc is no longer meaningfully different from bmalloc. (And bmalloc has its own mbmalloc target.) * Configurations/mbmalloc.xcconfig: Removed. * WTF.xcodeproj/project.pbxproj: * wtf/mbmalloc.cpp: Removed. 2018-11-08 Alexey Proskuryakov Re-add PLATFORM(IOS), now with the strict meaning https://bugs.webkit.org/show_bug.cgi?id=191281 Reviewed by Tim Horton. * wtf/Platform.h: No change in behavior. Some of the macros look a bit weird when expanded, it might be that the values are incorrect for some flavors of iOS family. 2018-11-08 Dean Jackson Add a String literal that returns a String https://bugs.webkit.org/show_bug.cgi?id=191425 Reviewed by Sam Weinig. Add a new String literal, _str, that will return a String type. This is useful when ""_s won't work, such as for things that don't take an ASCIILiteral directly e.g. ExceptionOr or Variants. * wtf/text/WTFString.h: (WTF::StringLiterals::operator _str): Added. 2018-11-06 Justin Fan [WebGPU] Experimental prototype for WebGPURenderPipeline and WebGPUSwapChain https://bugs.webkit.org/show_bug.cgi?id=191291 Reviewed by Myles Maxfield. Properly disable WEBGPU on all non-Metal platforms for now. * wtf/Platform.h: 2018-11-05 Myles C. Maxfield Cache glyph paths and share underline skipping code between all the ports https://bugs.webkit.org/show_bug.cgi?id=191239 Reviewed by Alex Christensen. Remove CSS3_TEXT_DECORATION_SKIP_INK. It's now interoperable and part of the Web Platform. * wtf/Platform.h: 2018-11-05 Dominik Infuehr Enable LLInt on ARMv7/Linux https://bugs.webkit.org/show_bug.cgi?id=191190 Reviewed by Yusuke Suzuki. After enabling the new bytecode format in r237547, C_LOOP was forced on all 32-bit platforms. Now enable LLInt again on ARMv7-Thumb2/Linux by default. * wtf/Platform.h: 2018-11-04 Fujii Hironori [Win] Use C++14, not C++17 https://bugs.webkit.org/show_bug.cgi?id=191101 Reviewed by Alex Christensen. * wtf/StdLibExtras.h: Use _MSVC_LANG to check C++ language version instead of _MSC_FULL_VER. 2018-11-02 Justin Fan [WebGPU] Experimental prototype for MSL shaders https://bugs.webkit.org/show_bug.cgi?id=191084 Reviewed by Dean Jackson. Disabling WebGPU on non-Cocoa platforms and iOS Simulator. * wtf/Platform.h: 2018-11-01 Jiewen Tan Replace CommonRandom SPI with API https://bugs.webkit.org/show_bug.cgi?id=191178 Reviewed by Brent Fulgham. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/RandomDevice.cpp: (WTF::RandomDevice::cryptographicallyRandomValues): * wtf/spi/darwin/CommonCryptoSPI.h: Removed. 2018-11-01 Fujii Hironori Rename to in order to avoid conflicting with ICU's unicode/utf8.h https://bugs.webkit.org/show_bug.cgi?id=189693 Reviewed by Yusuke Suzuki. * WTF.xcodeproj/project.pbxproj: Replaced unicode/UTF8.{cpp,h} with unicode/UTF8Conversion.{cpp,h}. * wtf/CMakeLists.txt: Ditto. * wtf/text/AtomicStringImpl.cpp: Replaced with . * wtf/text/StringImpl.cpp: Ditto. * wtf/text/StringView.cpp: Ditto. * wtf/text/WTFString.cpp: Ditto. * wtf/unicode/UTF8Conversion.cpp: Renamed from Source/WTF/wtf/unicode/UTF8.cpp. * wtf/unicode/UTF8Conversion.h: Renamed from Source/WTF/wtf/unicode/UTF8.h. 2018-10-30 Don Olmstead [PlayStation] Enable JavaScriptCore https://bugs.webkit.org/show_bug.cgi?id=191072 Reviewed by Brent Fulgham. Add platform files for the PlayStation port. * wtf/PlatformPlayStation.cmake: Added. 2018-10-30 David Kilzer XSLTProcessor should limit max transform depth Reviewed by Alex Christensen. * wtf/cocoa/SoftLinking.h: (SOFT_LINK_VARIABLE_FOR_HEADER): (SOFT_LINK_VARIABLE_FOR_SOURCE): - Add macros for non-constant global variables. 2018-10-30 Alexey Proskuryakov Clean up some obsolete MAX_ALLOWED macros https://bugs.webkit.org/show_bug.cgi?id=190916 Reviewed by Tim Horton. * WTF.xcodeproj/project.pbxproj: * wtf/PlatformMac.cmake: * wtf/spi/cocoa/NSMapTableSPI.h: Removed. This was only needed for old SDKs. 2018-10-29 Mark Lam Correctly detect string overflow when using the 'Function' constructor. https://bugs.webkit.org/show_bug.cgi?id=184883 Reviewed by Saam Barati. 1. Enhanced StringBuilder so that it supports 2 modes of behavior: a. StringBuilder::OverflowHandler::CrashOnOverflow. b. StringBuilder::OverflowHandler::RecordOverflow. CrashOnOverflow will crash the moment an overflow or failure to allocate memory is detected. RecordOverflow will make StringBuilder::hasOverflowed() return true when an overflow or failure to allocate memory is detected. However, if the user invokes toString(), toStringPreserveCapacity(), toAtomicString(), length(), capacity(), isEmpty(), characters8(), or characters16(), then the StringBuilder will crash regardless because these methods can only meaningfully do their work and return a result if and only if the builder has not overflowed. By default, the StringBuilder crashes on overflow (the old behavior) unless it is explicitly constructed with the StringBuilder::OverflowHandler::RecordOverflow enum. Design note: The StringBuilder can only be put in 1 of the 2 modes at the time of construction. This means that we could have implemented it as a template that is parameterized on an OverflowHandler class (like CheckedArithmetic) instead of using a runtime check in the ConditionalCrashOnOverflow handler. However, I was not able to get clang to export the explicitly instantiated instances (despite the methods having being decorated with WTF_EXPORT_PRIVATE). Since the StringBuilder is a transient object (not stored for a long time on the heap), and the runtime check of the boolean is not that costly compared to other work that StringBuilder routinely does (e.g. memcpy), using the new ConditionalCrashOnOverflow (which does a runtime check to determine to crash or not on overflow) is fine. When clang is able to export explicitly instantiated template methods, we can templatize StringBuilder and do away with ConditionalCrashOnOverflow. See https://bugs.webkit.org/show_bug.cgi?id=191050. To support the above, we also did: 2. Enhanced all StringBuilder append and buffer allocation methods to be able to fail without crashing. This also meant that ... 3. Added tryReallocate() support to StringImpl. tryRealloc() was added to FastMalloc, and bmalloc (and related peers) to enable this. 4. Added ConditionalCrashOnOverflow, which can choose at runtime whether to behave like CrashOnOverflow or RecordOverflow. * wtf/CheckedArithmetic.h: (WTF::ConditionalCrashOnOverflow::overflowed): (WTF::ConditionalCrashOnOverflow::shouldCrashOnOverflow const): (WTF::ConditionalCrashOnOverflow::setShouldCrashOnOverflow): (WTF::ConditionalCrashOnOverflow::hasOverflowed const): (WTF::ConditionalCrashOnOverflow::clearOverflow): (WTF::ConditionalCrashOnOverflow::crash): (WTF::RecordOverflow::overflowed): (WTF::Checked::unsafeGet const): * wtf/FastMalloc.cpp: (WTF::tryFastRealloc): * wtf/FastMalloc.h: * wtf/text/StringBuilder.cpp: (WTF::expandedCapacity): (WTF::StringBuilder::reifyString const): (WTF::StringBuilder::resize): (WTF::StringBuilder::allocateBuffer): (WTF::StringBuilder::allocateBufferUpConvert): (WTF::StringBuilder::reallocateBuffer): (WTF::StringBuilder::reallocateBuffer): (WTF::StringBuilder::reserveCapacity): (WTF::StringBuilder::appendUninitialized): (WTF::StringBuilder::appendUninitializedSlow): (WTF::StringBuilder::append): (WTF::StringBuilder::canShrink const): (WTF::StringBuilder::shrinkToFit): * wtf/text/StringBuilder.h: (WTF::StringBuilder::StringBuilder): (WTF::StringBuilder::didOverflow): (WTF::StringBuilder::hasOverflowed const): (WTF::StringBuilder::crashesOnOverflow const): (WTF::StringBuilder::append): (WTF::StringBuilder::toString): (WTF::StringBuilder::toStringPreserveCapacity const): (WTF::StringBuilder::toAtomicString const): (WTF::StringBuilder::length const): (WTF::StringBuilder::capacity const): (WTF::StringBuilder::operator[] const): (WTF::StringBuilder::swap): (WTF::StringBuilder::getBufferCharacters): * wtf/text/StringBuilderJSON.cpp: (WTF::StringBuilder::appendQuotedJSONString): * wtf/text/StringImpl.cpp: (WTF::StringImpl::reallocateInternal): (WTF::StringImpl::reallocate): (WTF::StringImpl::tryReallocate): * wtf/text/StringImpl.h: 2018-10-29 Tim Horton Modernize WebKit nibs and lprojs for localization's sake https://bugs.webkit.org/show_bug.cgi?id=190911 Reviewed by Dan Bernstein. * WTF.xcodeproj/project.pbxproj: English->en 2018-10-29 Tadeu Zagallo New bytecode format for JSC https://bugs.webkit.org/show_bug.cgi?id=187373 Reviewed by Filip Pizlo. * wtf/Forward.h: Fix WTF_LAZY_FOR_EACH_TERM on MSVC and add WTF_LAZY_HAS_REST to check whether a macro was passed multiple arguments * wtf/Platform.h: Force ENABLE_JIT=false on all 32-bit platforms * wtf/Vector.h: (WTF::minCapacity>::insertVector): Allow vectors with different overflow handlers to be passed to insertVector 2018-10-28 Geoffrey Garen HashMap should support selecting a random entry https://bugs.webkit.org/show_bug.cgi?id=190814 Reviewed by Ryosuke Niwa. * wtf/HashTable.h: (WTF::HashTable::random): (WTF::HashTable::random const): Merge the empty and deleted checks, and use more idiomatic addressing. 2018-10-26 Commit Queue Unreviewed, rolling out r237479 and r237484. https://bugs.webkit.org/show_bug.cgi?id=190978 broke JSC on iOS (Requested by tadeuzagallo on #webkit). Reverted changesets: "New bytecode format for JSC" https://bugs.webkit.org/show_bug.cgi?id=187373 https://trac.webkit.org/changeset/237479 "Gardening: Build fix after r237479." https://bugs.webkit.org/show_bug.cgi?id=187373 https://trac.webkit.org/changeset/237484 2018-10-26 Tadeu Zagallo New bytecode format for JSC https://bugs.webkit.org/show_bug.cgi?id=187373 Reviewed by Filip Pizlo. * wtf/Forward.h: Fix WTF_LAZY_FOR_EACH_TERM on MSVC and add WTF_LAZY_HAS_REST to check whether a macro was passed multiple arguments * wtf/Platform.h: Force ENABLE_JIT=false on all 32-bit platforms * wtf/Vector.h: (WTF::minCapacity>::insertVector): Allow vectors with different overflow handlers to be passed to insertVector 2018-10-26 Geoffrey Garen HashMap should support selecting a random entry https://bugs.webkit.org/show_bug.cgi?id=190814 Reviewed by Antti Koivisto. * wtf/HashTable.h: (WTF::HashTable::random): (WTF::HashTable::random const): Draw a new random bucket any time we have a miss, to avoid bias caused by lopsided tables. 2018-10-26 Antti Koivisto hashSet.remove(hashSet.random()) doesn't build https://bugs.webkit.org/show_bug.cgi?id=190953 Reviewed by Chris Dumez. * wtf/HashSet.h: Remove non-const random(). HashSet only returns const iterators (it is immutable via iterator). * wtf/HashTable.h: (WTF::HashTable::random const): Invoke const_iterator() by using static_cast<> instead of trying to do it directly. 2018-10-26 Alicia Boya García [MSE][WTF][Media] Invalid MediaTime should be falsy https://bugs.webkit.org/show_bug.cgi?id=190893 Reviewed by Jer Noble. This patch modifies the definition of MediaTime so that invalid times are evaluated to false in the context of a boolean expression. * wtf/MediaTime.cpp: (WTF::MediaTime::operator! const): (WTF::MediaTime::operator bool const): 2018-10-26 Keith Miller Some internal projects include wtf headers and build with C++11 https://bugs.webkit.org/show_bug.cgi?id=190791 Reviewed by Alexey Proskuryakov. C++11 doesn't support constexpr functions that contain statements. This patch removes getLSBSet set from builds before C++14 to avoid this for now. * wtf/MathExtras.h: (getLSBSet): 2018-10-25 Ross Kirsling Cleanup: inline constexpr is redundant as constexpr implies inline https://bugs.webkit.org/show_bug.cgi?id=190819 Reviewed by Mark Lam. * wtf/Bitmap.h: (WTF::WordType>::Bitmap): * wtf/LEBDecoder.h: (WTF::LEBDecoder::maxByteLength): * wtf/MathExtras.h: (defaultMinimumForClamp): (defaultMaximumForClamp): (clampToAccepting64): (isLessThan): (isLessThanEqual): (isGreaterThan): (isGreaterThanEqual): (WTF::roundUpToPowerOfTwo): (WTF::maskForSize): * wtf/Optional.h: * wtf/PtrTag.h: (WTF::tagCodePtr): (WTF::untagCodePtr): (WTF::retagCodePtr): (WTF::removeCodePtrTag): * wtf/StdLibExtras.h: (WTF::roundUpToMultipleOf): * wtf/Variant.h: (WTF::operator==): (WTF::operator!=): (WTF::operator>=): (WTF::operator<=): (WTF::operator>): (WTF::operator<): * wtf/text/StringImpl.h: (WTF::StringImplShape::StringImplShape): (WTF::StringImpl::StaticStringImpl::StaticStringImpl): 2018-10-25 Geoffrey Garen HashMap should support selecting a random entry https://bugs.webkit.org/show_bug.cgi?id=190814 Reviewed by Antti Koivisto. In some cases, remove(begin()) is not quite good enough as a random eviction strategy. (See https://bugs.webkit.org/show_bug.cgi?id=190792.) So, let's support real random eviction. (And by "real" I mean "pseudo".) * wtf/HashCountedSet.h: * wtf/HashMap.h: * wtf/HashSet.h: * wtf/ListHashSet.h: (WTF::ListHashSet::random): (WTF::ListHashSet::random const): * wtf/LoggingHashMap.h: * wtf/LoggingHashSet.h: Plumb through the random() iterator. * wtf/HashTable.h: (WTF::HashTable::random): (WTF::HashTable::random const): Implement the random() iterator. makeIterator() already supports starting from any bucket, so this is pretty easy. In the subtle case where we select end(), we choose to wrap around and return begin(). We expect that clients don't really think of the end() bucket as being in the domain of the random search. Also, we don't want to annoy clients who know their tables are non-empty with needless checks for end(). * wtf/RandomNumber.cpp: (WTF::weakRandomUint32): * wtf/RandomNumber.h: Added a free function for weak random numbers so that clients that want cheap random numbers aren't required to allocate storage for a WeakRandom generator. 2018-10-24 Megan Gardner Turn on Conic Gradients https://bugs.webkit.org/show_bug.cgi?id=190810 Reviewed by Tim Horton. * wtf/FeatureDefines.h: 2018-10-24 Christopher Reid [Win] Add function call name information to stack traces https://bugs.webkit.org/show_bug.cgi?id=190761 Reviewed by Fujii Hironori. Add symbol information to stack traces using dbghelp.dll This library will use symbols files from these sources: - The current working directory - The directory containing the application's executable - _NT_SYMBOL_PATH environment variable - _NT_ALTERNATE_SYMBOL_PATH environment variable This functionality is currently only enabled in debug mode since dbghelp is not threadsafe. The DbgHelper class attempts to synchronize calls to dbghelp.dll but external code can still attempt to call the library at the same time as WebKit. * wtf/CMakeLists.txt: * wtf/PlatformWin.cmake: * wtf/StackTrace.cpp: * wtf/win/DbgHelperWin.cpp: Added. * wtf/win/DbgHelperWin.h: Added. 2018-10-22 Alexey Proskuryakov Really prevent PLATFORM(IOS) from being used https://bugs.webkit.org/show_bug.cgi?id=190813 Reviewed by Tim Horton. * wtf/Platform.h: This relies on -Wundef, which we have enabled. 2018-10-22 Chris Dumez Deque's contains() and findIf() should be const https://bugs.webkit.org/show_bug.cgi?id=190796 Reviewed by Antti Koivisto. Deque's contains() and findIf() should be const as they do not modify the container. * wtf/Deque.h: (WTF::inlineCapacity>::findIf): (WTF::inlineCapacity>::findIf const): (WTF::inlineCapacity>::contains const): (WTF::inlineCapacity>::contains): Deleted. 2018-10-18 Alicia Boya García [Media] Use nanoseconds as MaximumTimeScale https://bugs.webkit.org/show_bug.cgi?id=190631 1e9 is a much more useful timescale than the previous one 2^31-1. Unlike 2^31-1, which is a prime number, nanosecond scale is pretty common among some formats like WebM and frameworks like GStreamer where base 10 timescale is common... and it's those big timescales the ones that are usually scaled up to MaximumTimeScale. Reviewed by Jer Noble. * wtf/MediaTime.cpp: 2018-10-18 Alexey Proskuryakov Remove PLATFORM(IOS) for now https://bugs.webkit.org/show_bug.cgi?id=190737 Reviewed by Tim Horton. * wtf/Platform.h: 2018-10-18 Alexey Proskuryakov Switch from PLATFORM(IOS) to PLATFORM(IOS_FAMILY) https://bugs.webkit.org/show_bug.cgi?id=190729 Reviewed by Tim Horton. * wtf/Assertions.h: * wtf/FeatureDefines.h: * wtf/InlineASM.h: * wtf/MemoryPressureHandler.cpp: (WTF::thresholdForPolicy): * wtf/Platform.h: * wtf/cocoa/MemoryPressureHandlerCocoa.mm: (WTF::MemoryPressureHandler::install): (WTF::MemoryPressureHandler::respondToMemoryPressure): * wtf/spi/cocoa/NSMapTableSPI.h: * wtf/spi/darwin/XPCSPI.h: * wtf/text/StringCommon.h: * wtf/text/TextBreakIterator.cpp: * wtf/text/TextBreakIterator.h: * wtf/unicode/icu/CollatorICU.cpp: (WTF::copyDefaultLocale): 2018-10-18 Alex Christensen Clean up FrameLoader two-state enums https://bugs.webkit.org/show_bug.cgi?id=190731 Reviewed by Chris Dumez. * wtf/EnumTraits.h: (WTF::isValidEnum): 2018-10-17 Commit Queue Unreviewed, rolling out r237208. https://bugs.webkit.org/show_bug.cgi?id=190691 Caused the API test that was changed to failure continuously (Requested by Truitt on #webkit). Reverted changeset: "[Media] Use nanoseconds as MaximumTimeScale" https://bugs.webkit.org/show_bug.cgi?id=190631 https://trac.webkit.org/changeset/237208 2018-10-16 Alicia Boya García [Media] Use nanoseconds as MaximumTimeScale https://bugs.webkit.org/show_bug.cgi?id=190631 1e9 is a much more useful timescale than the previous one 2^31-1. Unlike 2^31-1, which is a prime number, nanosecond scale is pretty common among some formats like WebM and frameworks like GStreamer where base 10 timescale is common... and it's those big timescales the ones that are usually scaled up to MaximumTimeScale. Reviewed by Jer Noble. * wtf/MediaTime.cpp: 2018-10-15 Keith Miller Support arm64 CPUs with a 32-bit address space https://bugs.webkit.org/show_bug.cgi?id=190273 Reviewed by Michael Saboff. Use WTF_CPU_ADDRESS64/32 to decide if the system is running on arm64_32. * wtf/MathExtras.h: (getLSBSet): * wtf/Platform.h: 2018-10-15 Timothy Hatcher Add support for prefers-color-scheme media query https://bugs.webkit.org/show_bug.cgi?id=190499 rdar://problem/45212025 Reviewed by Dean Jackson. * wtf/FeatureDefines.h: Added ENABLE_DARK_MODE_CSS. 2018-10-15 Saam barati Emit fjcvtzs on ARM64E on Darwin https://bugs.webkit.org/show_bug.cgi?id=184023 Reviewed by Yusuke Suzuki and Filip Pizlo. * wtf/Platform.h: 2018-10-15 Alex Christensen Use pragma once in WTF https://bugs.webkit.org/show_bug.cgi?id=190527 Reviewed by Chris Dumez. We also need to consistently include wtf headers from within wtf so we can build wtf without symbol redefinition errors from including the copy in Source and the copy in the build directory. * wtf/ASCIICType.h: * wtf/Assertions.cpp: * wtf/Assertions.h: * wtf/Atomics.h: * wtf/AutomaticThread.cpp: * wtf/AutomaticThread.h: * wtf/BackwardsGraph.h: * wtf/Bag.h: * wtf/BagToHashMap.h: * wtf/BitVector.cpp: * wtf/BitVector.h: * wtf/Bitmap.h: * wtf/BloomFilter.h: * wtf/Box.h: * wtf/BubbleSort.h: * wtf/BumpPointerAllocator.h: * wtf/ByteOrder.h: * wtf/CPUTime.cpp: * wtf/CallbackAggregator.h: * wtf/CheckedArithmetic.h: * wtf/CheckedBoolean.h: * wtf/ClockType.cpp: * wtf/ClockType.h: * wtf/CommaPrinter.h: * wtf/CompilationThread.cpp: * wtf/CompilationThread.h: * wtf/Compiler.h: * wtf/ConcurrentPtrHashSet.cpp: * wtf/ConcurrentVector.h: * wtf/Condition.h: * wtf/CountingLock.cpp: * wtf/CrossThreadTaskHandler.cpp: * wtf/CryptographicUtilities.cpp: * wtf/CryptographicUtilities.h: * wtf/CryptographicallyRandomNumber.cpp: * wtf/CryptographicallyRandomNumber.h: * wtf/CurrentTime.cpp: * wtf/DataLog.cpp: * wtf/DataLog.h: * wtf/DateMath.cpp: * wtf/DateMath.h: * wtf/DecimalNumber.cpp: * wtf/DecimalNumber.h: * wtf/Deque.h: * wtf/DisallowCType.h: * wtf/Dominators.h: * wtf/DoublyLinkedList.h: * wtf/FastBitVector.cpp: * wtf/FastMalloc.cpp: * wtf/FastMalloc.h: * wtf/FeatureDefines.h: * wtf/FilePrintStream.cpp: * wtf/FilePrintStream.h: * wtf/FlipBytes.h: * wtf/FunctionDispatcher.cpp: * wtf/FunctionDispatcher.h: * wtf/GetPtr.h: * wtf/Gigacage.cpp: * wtf/GlobalVersion.cpp: * wtf/GraphNodeWorklist.h: * wtf/GregorianDateTime.cpp: * wtf/GregorianDateTime.h: * wtf/HashFunctions.h: * wtf/HashMap.h: * wtf/HashMethod.h: * wtf/HashSet.h: * wtf/HashTable.cpp: * wtf/HashTraits.h: * wtf/Indenter.h: * wtf/IndexSparseSet.h: * wtf/InlineASM.h: * wtf/Insertion.h: * wtf/IteratorAdaptors.h: * wtf/IteratorRange.h: * wtf/JSONValues.cpp: * wtf/JSValueMalloc.cpp: * wtf/LEBDecoder.h: * wtf/Language.cpp: * wtf/ListDump.h: * wtf/Lock.cpp: * wtf/Lock.h: * wtf/LockAlgorithm.h: * wtf/LockedPrintStream.cpp: * wtf/Locker.h: * wtf/MD5.cpp: * wtf/MD5.h: * wtf/MainThread.cpp: * wtf/MainThread.h: * wtf/MallocPtr.h: * wtf/MathExtras.h: * wtf/MediaTime.cpp: * wtf/MediaTime.h: * wtf/MemoryPressureHandler.cpp: * wtf/MessageQueue.h: * wtf/MetaAllocator.cpp: * wtf/MetaAllocator.h: * wtf/MetaAllocatorHandle.h: * wtf/MonotonicTime.cpp: * wtf/MonotonicTime.h: * wtf/NakedPtr.h: * wtf/NoLock.h: * wtf/NoTailCalls.h: * wtf/Noncopyable.h: * wtf/NumberOfCores.cpp: * wtf/NumberOfCores.h: * wtf/OSAllocator.h: * wtf/OSAllocatorPosix.cpp: * wtf/OSRandomSource.cpp: * wtf/OSRandomSource.h: * wtf/ObjcRuntimeExtras.h: * wtf/OrderMaker.h: * wtf/PackedIntVector.h: * wtf/PageAllocation.h: * wtf/PageBlock.cpp: * wtf/PageBlock.h: * wtf/PageReservation.h: * wtf/ParallelHelperPool.cpp: * wtf/ParallelHelperPool.h: * wtf/ParallelJobs.h: * wtf/ParallelJobsLibdispatch.h: * wtf/ParallelVectorIterator.h: * wtf/ParkingLot.cpp: * wtf/ParkingLot.h: * wtf/Platform.h: * wtf/PointerComparison.h: * wtf/Poisoned.cpp: * wtf/PrintStream.cpp: * wtf/PrintStream.h: * wtf/ProcessID.h: * wtf/ProcessPrivilege.cpp: * wtf/RAMSize.cpp: * wtf/RAMSize.h: * wtf/RandomDevice.cpp: * wtf/RandomNumber.cpp: * wtf/RandomNumber.h: * wtf/RandomNumberSeed.h: * wtf/RangeSet.h: * wtf/RawPointer.h: * wtf/ReadWriteLock.cpp: * wtf/RedBlackTree.h: * wtf/Ref.h: * wtf/RefCountedArray.h: * wtf/RefCountedLeakCounter.cpp: * wtf/RefCountedLeakCounter.h: * wtf/RefCounter.h: * wtf/RefPtr.h: * wtf/RetainPtr.h: * wtf/RunLoop.cpp: * wtf/RunLoop.h: * wtf/RunLoopTimer.h: * wtf/RunLoopTimerCF.cpp: * wtf/SHA1.cpp: * wtf/SHA1.h: * wtf/SaturatedArithmetic.h: (saturatedSubtraction): * wtf/SchedulePair.h: * wtf/SchedulePairCF.cpp: * wtf/SchedulePairMac.mm: * wtf/ScopedLambda.h: * wtf/Seconds.cpp: * wtf/Seconds.h: * wtf/SegmentedVector.h: * wtf/SentinelLinkedList.h: * wtf/SharedTask.h: * wtf/SimpleStats.h: * wtf/SingleRootGraph.h: * wtf/SinglyLinkedList.h: * wtf/SixCharacterHash.cpp: * wtf/SixCharacterHash.h: * wtf/SmallPtrSet.h: * wtf/Spectrum.h: * wtf/StackBounds.cpp: * wtf/StackBounds.h: * wtf/StackStats.cpp: * wtf/StackStats.h: * wtf/StackTrace.cpp: * wtf/StdLibExtras.h: * wtf/StreamBuffer.h: * wtf/StringHashDumpContext.h: * wtf/StringPrintStream.cpp: * wtf/StringPrintStream.h: * wtf/ThreadGroup.cpp: * wtf/ThreadMessage.cpp: * wtf/ThreadSpecific.h: * wtf/Threading.cpp: * wtf/Threading.h: * wtf/ThreadingPrimitives.h: * wtf/ThreadingPthreads.cpp: * wtf/TimeWithDynamicClockType.cpp: * wtf/TimeWithDynamicClockType.h: * wtf/TimingScope.cpp: * wtf/TinyLRUCache.h: * wtf/TinyPtrSet.h: * wtf/TriState.h: * wtf/TypeCasts.h: * wtf/UUID.cpp: * wtf/UnionFind.h: * wtf/VMTags.h: * wtf/ValueCheck.h: * wtf/Vector.h: * wtf/VectorTraits.h: * wtf/WallTime.cpp: * wtf/WallTime.h: * wtf/WeakPtr.h: * wtf/WeakRandom.h: * wtf/WordLock.cpp: * wtf/WordLock.h: * wtf/WorkQueue.cpp: * wtf/WorkQueue.h: * wtf/WorkerPool.cpp: * wtf/cf/LanguageCF.cpp: * wtf/cf/RunLoopCF.cpp: * wtf/cocoa/Entitlements.mm: * wtf/cocoa/MachSendRight.cpp: * wtf/cocoa/MainThreadCocoa.mm: * wtf/cocoa/MemoryFootprintCocoa.cpp: * wtf/cocoa/WorkQueueCocoa.cpp: * wtf/dtoa.cpp: * wtf/dtoa.h: * wtf/ios/WebCoreThread.cpp: * wtf/ios/WebCoreThread.h: * wtf/mac/AppKitCompatibilityDeclarations.h: * wtf/mac/DeprecatedSymbolsUsedBySafari.mm: * wtf/mbmalloc.cpp: * wtf/persistence/PersistentCoders.cpp: * wtf/persistence/PersistentDecoder.cpp: * wtf/persistence/PersistentEncoder.cpp: * wtf/spi/cf/CFBundleSPI.h: * wtf/spi/darwin/CommonCryptoSPI.h: * wtf/text/ASCIIFastPath.h: * wtf/text/ASCIILiteral.cpp: * wtf/text/AtomicString.cpp: * wtf/text/AtomicString.h: * wtf/text/AtomicStringHash.h: * wtf/text/AtomicStringImpl.cpp: * wtf/text/AtomicStringImpl.h: * wtf/text/AtomicStringTable.cpp: * wtf/text/AtomicStringTable.h: * wtf/text/Base64.cpp: * wtf/text/CString.cpp: * wtf/text/CString.h: * wtf/text/ConversionMode.h: * wtf/text/ExternalStringImpl.cpp: * wtf/text/IntegerToStringConversion.h: * wtf/text/LChar.h: * wtf/text/LineEnding.cpp: * wtf/text/StringBuffer.h: * wtf/text/StringBuilder.cpp: * wtf/text/StringBuilder.h: * wtf/text/StringBuilderJSON.cpp: * wtf/text/StringCommon.h: * wtf/text/StringConcatenate.h: * wtf/text/StringHash.h: * wtf/text/StringImpl.cpp: * wtf/text/StringImpl.h: * wtf/text/StringOperators.h: * wtf/text/StringView.cpp: * wtf/text/StringView.h: * wtf/text/SymbolImpl.cpp: * wtf/text/SymbolRegistry.cpp: * wtf/text/SymbolRegistry.h: * wtf/text/TextBreakIterator.cpp: * wtf/text/TextBreakIterator.h: * wtf/text/TextBreakIteratorInternalICU.h: * wtf/text/TextPosition.h: * wtf/text/TextStream.cpp: * wtf/text/UniquedStringImpl.h: * wtf/text/WTFString.cpp: * wtf/text/WTFString.h: * wtf/text/cocoa/StringCocoa.mm: * wtf/text/cocoa/StringViewCocoa.mm: * wtf/text/cocoa/TextBreakIteratorInternalICUCocoa.cpp: * wtf/text/icu/UTextProvider.cpp: * wtf/text/icu/UTextProvider.h: * wtf/text/icu/UTextProviderLatin1.cpp: * wtf/text/icu/UTextProviderLatin1.h: * wtf/text/icu/UTextProviderUTF16.cpp: * wtf/text/icu/UTextProviderUTF16.h: * wtf/threads/BinarySemaphore.cpp: * wtf/threads/BinarySemaphore.h: * wtf/threads/Signals.cpp: * wtf/unicode/CharacterNames.h: * wtf/unicode/Collator.h: * wtf/unicode/CollatorDefault.cpp: * wtf/unicode/UTF8.cpp: * wtf/unicode/UTF8.h: 2018-10-12 Alex Christensen Allow encoding of small enum classes https://bugs.webkit.org/show_bug.cgi?id=190531 Reviewed by Tim Horton. * wtf/Forward.h: 2018-10-11 Alexey Proskuryakov Add PLATFORM(IOS_FAMILY) and OS(IOS_FAMILY) https://bugs.webkit.org/show_bug.cgi?id=190477 Reviewed by Tim Horton. Currently, PLATFORM(IOS) and OS(IOS) are true when building for any TARGET_OS_IPHONE target, which is quite confusing. Add a better named alternative, as a first step towards mass replacing PLATFORM(IOS). Can't so it all at once because of dependencies in other source repositories. * wtf/Platform.h: Changed to the new name in this file though. Kept a few instances that actually target iOS only, having a version check. 2018-10-11 Yusuke Suzuki Use currentStackPointer more https://bugs.webkit.org/show_bug.cgi?id=190503 Reviewed by Saam Barati. Use WTF::currentStackPointer more in WebKit to adopt ASAN detect_stack_use_after_return option. * wtf/StackBounds.cpp: (WTF::testStackDirection2): (WTF::testStackDirection): * wtf/ThreadingPthreads.cpp: (WTF::Thread::signalHandlerSuspendResume): (WTF::getApproximateStackPointer): Deleted. 2018-10-11 Ross Kirsling [WTF] Semaphore.h conflicts with POSIX header https://bugs.webkit.org/show_bug.cgi?id=190486 Reviewed by Yusuke Suzuki. Rename Semaphore.h to WTFSemaphore.h to avoid conflict with POSIX semaphore.h on case-insensitive file systems. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/WTFSemaphore.h: Renamed from wtf/Semaphore.h. 2018-10-10 Mark Lam Changes towards allowing use of the ASAN detect_stack_use_after_return option. https://bugs.webkit.org/show_bug.cgi?id=190405 Reviewed by Michael Saboff. Introduce WTF::currentStackPointer() which computes its caller's stack pointer value. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/StackBounds.h: (WTF::StackBounds::checkConsistency const): * wtf/StackPointer.cpp: Added. (WTF::currentStackPointer): * wtf/StackPointer.h: Added. 2018-10-09 Mark Lam StringTypeAdapter constructor is not properly enforcing String::MaxLength. https://bugs.webkit.org/show_bug.cgi?id=190392 Reviewed by Saam Barati. Previously, the StringTypeAdapter constructor for a UChar* string was summing the unsigned length of the source string without an overflow check. We now make that length a size_t which removes this issue, and assert that it's within String::MaxLength thereafter. Also made the StringTypeAdapter constructor for a LChar* string behave in an equivalent manner for consistency. In both cases, we'll crash in a RELEASE_ASSERT if the source string length exceeds String::MaxLength. * wtf/text/StringConcatenate.h: 2018-10-09 Mark Lam Revert temporary asserts for debugging a mysterious ASAN bot crash. https://bugs.webkit.org/show_bug.cgi?id=190396 Reviewed by Yusuke Suzuki. * wtf/StackBounds.cpp: (WTF::StackBounds::newThreadStackBounds): * wtf/StackBounds.h: (WTF::StackBounds::checkConsistency const): 2018-10-08 Aditya Keerthi Make a runtime enabled (on-by-default) feature https://bugs.webkit.org/show_bug.cgi?id=189162 Reviewed by Wenson Hsieh and Tim Horton. * wtf/FeatureDefines.h: 2018-10-06 Mark Lam Adding some temporary asserts with data logging to debug a mysterious ASAN bot crash. https://bugs.webkit.org/show_bug.cgi?id=190334 Reviewed by Yusuke Suzuki. These assertions are needed because we can't reproduce the issue locally. We'll remove these asserts after the needed data has been collected from the bot. * wtf/StackBounds.cpp: (WTF::StackBounds::newThreadStackBounds): * wtf/StackBounds.h: (WTF::StackBounds::checkConsistency const): 2018-10-07 Yusuke Suzuki Name Heap threads https://bugs.webkit.org/show_bug.cgi?id=190337 Reviewed by Mark Lam. Add a functionality naming threads of ParallelHelperPool. * wtf/ParallelHelperPool.cpp: (WTF::ParallelHelperPool::ParallelHelperPool): * wtf/ParallelHelperPool.h: 2018-10-06 Mark Lam Adding some temporary asserts to debug a mysterious ASAN bot crash. https://bugs.webkit.org/show_bug.cgi?id=190331 Reviewed by Filip Pizlo. These assertions are needed because we can't reproduce the issue locally. We'll remove these asserts after the needed data has been collected from the bot. * wtf/StackBounds.h: (WTF::StackBounds::checkConsistency const): 2018-10-05 Yusuke Suzuki [JSC][Linux] Support Perf JITDump logging https://bugs.webkit.org/show_bug.cgi?id=189893 Reviewed by Mark Lam. * wtf/PageReservation.h: (WTF::PageReservation::reserveAndCommitWithGuardPages): 2018-10-03 Dan Bernstein WTF part of [Xcode] Update some build settings as recommended by Xcode 10 https://bugs.webkit.org/show_bug.cgi?id=190250 Reviewed by Alex Christensen. * Configurations/Base.xcconfig: Enabled CLANG_WARN_COMMA, CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS, and CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF. * WTF.xcodeproj/project.pbxproj: Let Xcode update LastUpgradeCheck. * wtf/MathExtras.h: (WTF::fastLog2): Addressed newly-enabled CLANG_WARN_COMMA by splitting some comma-separated expressions into individual statements. 2018-10-03 Mark Lam Make string MaxLength for all WTF and JS strings consistently equal to INT_MAX. https://bugs.webkit.org/show_bug.cgi?id=190187 Reviewed by Michael Saboff. * wtf/text/StringConcatenate.h: (WTF::tryMakeStringFromAdapters): (WTF::sumWithOverflow): Deleted. * wtf/text/StringImpl.h: * wtf/text/WTFString.h: 2018-10-03 Michael Catanzaro -Wunused-variable in RenderLayer::updateScrollableAreaSet https://bugs.webkit.org/show_bug.cgi?id=190200 Reviewed by Yusuke Suzuki. Add a new UNUSED_VARIABLE() macro. It's the same as UNUSED_PARAM(), just named differently. * wtf/Compiler.h: 2018-10-01 Dean Jackson [macOS] Switching to discrete GPU should be done in the UI process https://bugs.webkit.org/show_bug.cgi?id=189361 Reviewed by Simon Fraser. Define GL_SILENCE_DEPRECATION to avoid deprecation warnings for OpenGL. * wtf/Platform.h: 2018-10-02 Commit Queue Unreviewed, rolling out r236624 and r236671. https://bugs.webkit.org/show_bug.cgi?id=190207 The change in r236624 introduced crashes on the bots (Requested by ryanhaddad on #webkit). Reverted changesets: "Refactoring: eliminate raw pointer usage in Fullscreen code" https://bugs.webkit.org/show_bug.cgi?id=188747 https://trac.webkit.org/changeset/236624 "Unify implementation in VideoFullscreenInterfaceAVKit" https://bugs.webkit.org/show_bug.cgi?id=190091 https://trac.webkit.org/changeset/236671 2018-10-02 Caio Lima [BigInt] BigInt.proptotype.toString is broken when radix is power of 2 https://bugs.webkit.org/show_bug.cgi?id=190033 Reviewed by Yusuke Suzuki. * wtf/MathExtras.h: (WTF::ctz32): 2018-10-01 Andy Estes [watchOS] Adopt NSURLSessionCompanionProxyPreference https://bugs.webkit.org/show_bug.cgi?id=190177 Reviewed by Wenson Hsieh. * wtf/FeatureDefines.h: 2018-10-01 Koby Boyango [WTF][JSCONLY] Use MainThreadWin on Windows in the JSCOnly port https://bugs.webkit.org/show_bug.cgi?id=190121 Reviewed by Yusuke Suzuki. This fixes JSCOnly build on Windows after r236617. * wtf/PlatformJSCOnly.cmake: 2018-10-01 Commit Queue Unreviewed, rolling out r236647. https://bugs.webkit.org/show_bug.cgi?id=190124 Breaking test stress/big-int-to-string.js (Requested by caiolima_ on #webkit). Reverted changeset: "[BigInt] BigInt.proptotype.toString is broken when radix is power of 2" https://bugs.webkit.org/show_bug.cgi?id=190033 https://trac.webkit.org/changeset/236647 2018-09-30 Caio Lima [BigInt] BigInt.proptotype.toString is broken when radix is power of 2 https://bugs.webkit.org/show_bug.cgi?id=190033 Reviewed by Yusuke Suzuki. * wtf/MathExtras.h: (WTF::ctz32): 2018-09-28 Jer Noble Refactoring: eliminate raw pointer usage in Fullscreen code https://bugs.webkit.org/show_bug.cgi?id=188747 Reviewed by Alex Christensen. * WTF.xcodeproj/project.pbxproj: * wtf/WeakPtrContainer.h: Added. 2018-09-28 Yusuke Suzuki [WTF] Make isMainThread more reliable https://bugs.webkit.org/show_bug.cgi?id=189880 Reviewed by Mark Lam. isMainThread() relied on Thread::current(). This API becomes broken in Windows when the Thread is about to be destroyed since TLS is already cleared. This causes a bug since `isMainThread()` is called in Thread::didExit in Windows. This patch makes this `isMainThread` more reliable in all the platforms. In Windows, we use `Thread::currentID()` instead of `Thread::current()` since `Thread::currentID` uses Win32 GetCurrentThreadId directly. In the other system, we use `pthread_main_np` or `pthread_self` instead. We also move `holdLock` code inside `if (shouldRemoveThreadFromThreadGroup())`. If the other thread takes a mutex and destroyed, this `holdLock` waits forever. This problem only happens in Windows since Windows calls TLS destructor for the main thread. * WTF.xcodeproj/project.pbxproj: * wtf/MainThread.cpp: (WTF::initializeMainThread): (): Deleted. (WTF::isMainThread): Deleted. (WTF::isMainThreadIfInitialized): Deleted. * wtf/Platform.h: * wtf/PlatformMac.cmake: * wtf/Threading.cpp: (WTF::Thread::didExit): * wtf/cocoa/MainThreadCocoa.mm: Renamed from Source/WTF/wtf/mac/MainThreadMac.mm. * wtf/generic/MainThreadGeneric.cpp: (WTF::initializeMainThreadPlatform): (WTF::isMainThread): (WTF::isMainThreadIfInitialized): * wtf/win/MainThreadWin.cpp: (WTF::initializeMainThreadPlatform): (WTF::isMainThread): (WTF::isMainThreadIfInitialized): 2018-09-28 Commit Queue Unreviewed, rolling out r236605. https://bugs.webkit.org/show_bug.cgi?id=190087 caused three API test timeouts (Requested by jernoble on #webkit). Reverted changeset: "Refactoring: eliminate raw pointer usage in Fullscreen code" https://bugs.webkit.org/show_bug.cgi?id=188747 https://trac.webkit.org/changeset/236605 2018-09-28 Brian Burg Replace recently added line comments in Compiler.h https://bugs.webkit.org/show_bug.cgi?id=190062 Reviewed by Joseph Pecoraro. This breaks some Apple-internal tooling. For now, work around it by changing the comment style. On the other side, the issue will be fixed more permanently by adopting the approach from r230213. * wtf/Compiler.h: Use multiline comments. 2018-09-28 Jer Noble Refactoring: eliminate raw pointer usage in Fullscreen code https://bugs.webkit.org/show_bug.cgi?id=188747 Reviewed by Alex Christensen. * WTF.xcodeproj/project.pbxproj: * wtf/WeakPtrContainer.h: Added. 2018-09-28 Koby Boyango [WTF] Add ExternalStringImpl, a StringImpl for user controlled buffers https://bugs.webkit.org/show_bug.cgi?id=189991 Reviewed by Yusuke Suzuki. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/text/ExternalStringImpl.cpp: Added. * wtf/text/ExternalStringImpl.h: Added. * wtf/text/StringImpl.cpp: * wtf/text/StringImpl.h: 2018-09-27 Saam barati Verify the contents of AssemblerBuffer on arm64e https://bugs.webkit.org/show_bug.cgi?id=190057 Reviewed by Mark Lam. * wtf/PtrTag.h: (WTF::tagInt): 2018-09-27 Jer Noble MediaPlayer should have mediaPlayerWaitingForKeyChanged() / bool waitingForKey() accessor https://bugs.webkit.org/show_bug.cgi?id=189951 Reviewed by Eric Carlson. Templated functions should take r-value references, as they have perfect type deduction for all parameter types; references, l-value references, and r-value references in template function parameters have special type deduction semantics. See: Previously, const reference parameters would be copied when passed into anyOf(), and containers of Ref<> would generate compile errors when passed into anyOf, as they cannot be copied. Now, with r-value reference types in template parameters, a const reference is mapped to a const reference, a non-const reference is mapped to a non-const reference, and a r-value reference is mapped to an r-value reference. * wtf/Algorithms.h: (WTF::forEach): (WTF::anyOf): (WTF::allOf): 2018-09-25 John Wilander Change from HAVE(CFNETWORK_STORAGE_PARTITIONING) to ENABLE(RESOURCE_LOAD_STATISTICS) https://bugs.webkit.org/show_bug.cgi?id=189959 Reviewed by Chris Dumez. * wtf/Platform.h: Enables RESOURCE_LOAD_STATISTICS for Cocoa platforms. 2018-09-24 Fujii Hironori Rename WTF_COMPILER_GCC_OR_CLANG to WTF_COMPILER_GCC_COMPATIBLE https://bugs.webkit.org/show_bug.cgi?id=189733 Reviewed by Michael Catanzaro. Clang for Windows build enables WTF_COMPILER_CLANG and WTF_COMPILER_MSVC, but disables WTF_COMPILER_GCC_OR_CLANG. It is strange WTF_COMPILER_GCC_OR_CLANG is not enabled even though WTF_COMPILER_CLANG is enabled. However, Clang for Windows imitates MSVC, and codes for COMPILER(GCC_OR_CLANG) are for non MSVC. At least at the moment, it is not feasible to define WTF_COMPILER_GCC_OR_CLANG for Clang for Windows. To solve the issue, this change renames WTF_COMPILER_GCC_OR_CLANG to WTF_COMPILER_GCC_COMPATIBLE. As an exception, I'd like to use IGNORE_WARNINGS_* macros even in Clang for Windows builds. * wtf/Assertions.cpp: Replaced COMPILER(GCC_OR_CLANG) with COMPILER(GCC_COMPATIBLE). * wtf/Assertions.h: Ditto. * wtf/Atomics.h: Ditto. * wtf/CheckedArithmetic.h: Ditto. * wtf/FastMalloc.h: Ditto. * wtf/MathExtras.h: Ditto. * wtf/Platform.h: Ditto. * wtf/StdLibExtras.h: Ditto. * wtf/Vector.h: Ditto. * wtf/text/ASCIIFastPath.h: Ditto. * wtf/Compiler.h: Ditto. Replaced "COMPILER(GCC_OR_CLANG)" with "COMPILER(GCC) || COMPILER(CLANG)" of IGNORE_WARNINGS_* macros. 2018-09-21 Yusuke Suzuki [JSC] Enable LLInt ASM interpreter on X64 and ARM64 in non JIT configuration https://bugs.webkit.org/show_bug.cgi?id=189778 Reviewed by Keith Miller. This patch adds ENABLE(C_LOOP) which indicates we use CLoop as the interpreter. Previously, we used !ENABLE(JIT) for this configuration. But now, we have a build configuration that has LLInt ASM interpreter (not CLoop) and !ENABLE(JIT). We enable LLInt ASM interpreter for non JIT environment in X86_64 and ARM64 architectures. And we enable ENABLE(ASSEMBLER) for non JIT environment since it offers machine register information which is used for LLInt and SamplingProfiler. * wtf/Platform.h: 2018-09-21 Keith Miller Add Promise SPI https://bugs.webkit.org/show_bug.cgi?id=189809 Reviewed by Saam Barati. Fix issue where creating a JSContextRef off the main thread before creating initializing the main thread would cause an assertion failure. * wtf/MainThread.cpp: (WTF::isMainThreadIfInitialized): * wtf/MainThread.h: * wtf/mac/MainThreadMac.mm: (WTF::isMainThreadIfInitialized): * wtf/text/cf/StringImplCF.cpp: (WTF::StringImpl::createCFString): 2018-09-21 Ryan Haddad Unreviewed, rolling out r236359. Broke the Windows build. Reverted changeset: "Add Promise SPI" https://bugs.webkit.org/show_bug.cgi?id=189809 https://trac.webkit.org/changeset/236359 2018-09-21 Keith Miller Add Promise SPI https://bugs.webkit.org/show_bug.cgi?id=189809 Reviewed by Saam Barati. Fix issue where creating a JSContextRef off the main thread before creating initializing the main thread would cause an assertion failure. * wtf/MainThread.cpp: (WTF::isMainThreadIfInitialized): * wtf/MainThread.h: * wtf/mac/MainThreadMac.mm: (WTF::isMainThreadIfInitialized): * wtf/text/cf/StringImplCF.cpp: (WTF::StringImpl::createCFString): 2018-09-20 Fujii Hironori [Win][Clang] UNUSED_PARAM(this) causes compilation error of "cannot take the address of an rvalue of type" https://bugs.webkit.org/show_bug.cgi?id=189732 Reviewed by Per Arne Vollan. Clang for Windows can't compile the MSVC workaround of UNUSED_PARAM which has been introduced for Windows CE and Visual Studio 10. I think it's safe just to remove it. * wtf/Compiler.h: Removed the code for COMPILER(MSVC). 2018-09-20 Alex Christensen Unreviewed, rolling out r235976. Broke ARM Reverted changeset: "Use a Variant instead of a union in CSSSelector" https://bugs.webkit.org/show_bug.cgi?id=188559 https://trac.webkit.org/changeset/235976 2018-09-17 Yusuke Suzuki [WTF] Use Semaphore and BinarySemaphore instead of dispatch_semaphore_t https://bugs.webkit.org/show_bug.cgi?id=185339 Reviewed by Mark Lam. This patch adds WTF::Semaphore, which is based on WTF::Lock and WTF::Condition. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Semaphore.h: Added. (WTF::Semaphore::Semaphore): (WTF::Semaphore::signal): (WTF::Semaphore::waitUntil): (WTF::Semaphore::waitFor): (WTF::Semaphore::wait): * wtf/generic/WorkQueueGeneric.cpp: (WorkQueue::platformInitialize): * wtf/threads/BinarySemaphore.cpp: (WTF::BinarySemaphore::waitUntil): (WTF::BinarySemaphore::wait): Deleted. * wtf/threads/BinarySemaphore.h: (WTF::BinarySemaphore::waitFor): (WTF::BinarySemaphore::wait): Align the names of the functions to WTF::Condition. Add BinarySemaphore::wait(), which is the same to waitUntil(WallTime::infinity()). 2018-09-17 Jer Noble Add support for HEVC codec types in Media Capabilities https://bugs.webkit.org/show_bug.cgi?id=189565 Reviewed by Eric Carlson. Extract the toIntegralType template into its own header. * wtf/CMakeLists.txt: * wtf/text/StringConversion.h: Added. (isCharacterAllowedInBase): (toIntegralType): * wtf/text/WTFString.cpp: 2018-09-17 Jer Noble Enable USE_MEDIAREMOTE on iOS https://bugs.webkit.org/show_bug.cgi?id=189096 Reviewed by Eric Carlson. * wtf/Platform.h: 2018-09-17 Frederic Wang Build error in ImageBufferCG when compiled with IOSurfacePool https://bugs.webkit.org/show_bug.cgi?id=189579 Reviewed by Tim Horton. IOSurface.h might be included with different value of IOSURFACE_CANVAS_BACKING_STORE, causing compilation errors when files in the same unified source do not agree on the definition. This patch moves the definition of IOSURFACE_CANVAS_BACKING_STORE from ImageBufferDataCG.h to Platform.h so that IOSURFACE_CANVAS_BACKING_STORE is set to the same value in all files. Finally some minors changes to explicitly declare/define ImageBuffer are performed in order to prevent future issues with Unified build rotating. * wtf/Platform.h: Move definition from ImageBufferDataCG.h. 2018-09-14 Ryan Haddad Unreviewed, rolling out r235990. Introduced TestWebKitAPI.NowPlayingTest timeouts on iOS Reverted changeset: "Enable USE_MEDIAREMOTE on iOS" https://bugs.webkit.org/show_bug.cgi?id=189096 https://trac.webkit.org/changeset/235990 2018-09-13 Jer Noble Enable USE_MEDIAREMOTE on iOS https://bugs.webkit.org/show_bug.cgi?id=189096 Reviewed by Eric Carlson. * wtf/Platform.h: 2018-09-13 Alex Christensen Use a Variant instead of a union in CSSSelector https://bugs.webkit.org/show_bug.cgi?id=188559 Reviewed by Antti Koivisto. * wtf/Variant.h: Add packing macros to make it so Variant-containing structures don't always have 7 bytes of padding per Variant. 2018-09-12 Guillaume Emont Add IGNORE_WARNING_.* macros https://bugs.webkit.org/show_bug.cgi?id=188996 Reviewed by Michael Catanzaro. * wtf/Assertions.cpp: * wtf/Assertions.h: * wtf/Compiler.h: * wtf/MD5.cpp: (WTF::MD5::MD5): (WTF::MD5::addBytes): (WTF::MD5::checksum): * wtf/PrintStream.cpp: (WTF::PrintStream::printfVariableFormat): * wtf/SHA1.cpp: (WTF::SHA1::SHA1): (WTF::SHA1::addBytes): (WTF::SHA1::computeHash): * wtf/ThreadingPthreads.cpp: * wtf/Vector.h: (WTF::VectorBuffer::endOfBuffer): * wtf/text/WTFString.cpp: (WTF::createWithFormatAndArguments): == Rolled over to ChangeLog-2018-09-11 ==