Update Base64 encoding/decoding to match more modern WebKit conventions
https://bugs.webkit.org/show_bug.cgi?id=225920

Reviewed by Chris Dumez.

Source/WebCore:

- Updates to use new signatures for base64 encoding/decoding including
  utilizing the string type adaptor and makeString.
- Replace out parameter based getDefaultWebCryptoMasterKey() with
  Optional<Vector<uint8_t>> defaultWebCryptoMasterKey().
- Update synchronous loading code path to use uint8_t* consistently for
  data buffer representation.
- Replace out parameters in quotedPrintableEncode/quotedPrintableDecode
  with Optional.

* Modules/encryptedmedia/InitDataRegistry.cpp:
(WebCore::extractKeyIDsKeyids):
Update to use new base64URLDecode.

(WebCore::sanitizeKeyids):
Update to use new base64URLEncodeToString()

* Modules/encryptedmedia/legacy/LegacyCDMSessionClearKey.cpp:
(WebCore::CDMSessionClearKey::update):
Update to use new base64Decode().

* Modules/plugins/QuickTimePluginReplacement.mm:
(WebCore::jsValueWithDataInContext):
(WebCore::jsValueWithAVMetadataItemInContext):
Update to use new base64EncodeToString(). Replace string concatentation
using operator+ with makeString().

* Modules/webauthn/AuthenticatorCoordinator.cpp:
(WebCore::AuthenticatorCoordinatorInternal::produceClientDataJson):
Update to use new base64URLEncodeToString().

* Modules/webauthn/PublicKeyCredential.cpp:
(WebCore::PublicKeyCredential::PublicKeyCredential):
Update to use new base64URLEncodeToString().

* Modules/websockets/WebSocketHandshake.cpp:
(WebCore::generateSecWebSocketKey):
(WebCore::WebSocketHandshake::getExpectedWebSocketAccept):
Update to use new base64URLEncodeToString().

* crypto/SerializedCryptoKeyWrap.h:
Change from outparameter based getDefaultWebCryptoMasterKey() to new
Optional<Vector<uint8_t>> defaultWebCryptoMasterKey().

* crypto/gcrypt/CryptoKeyECGCrypt.cpp:
(WebCore::CryptoKeyEC::platformAddFieldElements const):
Update to use new base64URLEncodeToString().

* crypto/gcrypt/SerializedCryptoKeyWrapGCrypt.cpp:
(WebCore::defaultWebCryptoMasterKey):
(WebCore::getDefaultWebCryptoMasterKey): Deleted.
Update for new defaultWebCryptoMasterKey() signature.

* crypto/keys/CryptoKeyAES.cpp:
(WebCore::CryptoKeyAES::importJwk):
(WebCore::CryptoKeyAES::exportJwk const):
Update to use new base64URLDecode / base64URLEncodeToString().

* crypto/keys/CryptoKeyEC.cpp:
(WebCore::CryptoKeyEC::importJwk):
Update to use new base64URLDecode.

* crypto/keys/CryptoKeyHMAC.cpp:
(WebCore::CryptoKeyHMAC::importJwk):
(WebCore::CryptoKeyHMAC::exportJwk const):
Update to use new base64URLDecode / base64URLEncodeToString().

* crypto/keys/CryptoKeyRSA.cpp:
(WebCore::CryptoKeyRSA::importJwk):
(WebCore::CryptoKeyRSA::exportJwk const):
Update to use new base64URLDecode / base64URLEncodeToString().

* crypto/mac/CryptoKeyECMac.cpp:
(WebCore::CryptoKeyEC::platformAddFieldElements const):
Update to use new base64URLEncodeToString().

* crypto/mac/SerializedCryptoKeyWrapMac.mm:
(WebCore::createAndStoreMasterKey):
(WebCore::findMasterKey):
(WebCore::defaultWebCryptoMasterKey):
(WebCore::getDefaultWebCryptoMasterKey): Deleted.
Update for new defaultWebCryptoMasterKey() signature.

* crypto/openssl/SerializedCryptoKeyWrapOpenSSL.cpp:
(WebCore::defaultWebCryptoMasterKey):
(WebCore::getDefaultWebCryptoMasterKey): Deleted.
Update for new defaultWebCryptoMasterKey() signature.

* fileapi/FileReaderLoader.cpp:
(WebCore::FileReaderLoader::convertToDataURL):
Update to use new base64EncodeToString().

* inspector/DOMPatchSupport.cpp:
(WebCore::DOMPatchSupport::createDigest):
Update to use new base64EncodeToString().

* inspector/InspectorFrontendHost.cpp:
(WebCore::InspectorFrontendHost::showCertificate):
Update to use new base64URLDecode / base64URLEncodeToString().

* inspector/NetworkResourcesData.cpp:
(WebCore::NetworkResourcesData::ResourceData::decodeDataToContent):
Update to use new base64EncodeToString().

* inspector/agents/InspectorDOMAgent.cpp:
(WebCore::computeContentSecurityPolicySHA256Hash):
Update to use new base64Decode / base64EncodeToString().

* inspector/agents/InspectorNetworkAgent.cpp:
(WebCore::Inspector::buildWebSocketMessage):
(WebCore::InspectorNetworkAgent::didReceiveData):
(WebCore::InspectorNetworkAgent::getSerializedCertificate):
(WebCore::InspectorNetworkAgent::interceptWithRequest):
(WebCore::InspectorNetworkAgent::interceptWithResponse):
(WebCore::InspectorNetworkAgent::interceptRequestWithResponse):
(WebCore::InspectorNetworkAgent::cachedResourceContent):
Update to use new base64Decode / base64EncodeToString().

* inspector/agents/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::dataContent):
(WebCore::InspectorPageAgent::archive):
Update to use new base64EncodeToString().

* loader/FrameLoader.cpp:
(WebCore::FrameLoader::loadResourceSynchronously):
Switch to using Vector<uint8_t> buffer to match new loadResourceSynchronously
signature.

* loader/LoaderStrategy.h:
Switch to using Vector<uint8_t> for the data buffer.

* loader/PrivateClickMeasurement.cpp:
(WebCore::PrivateClickMeasurement::EphemeralSourceNonce::isValid const):
Update to use new base64URLDecode.

* loader/ResourceCryptographicDigest.cpp:
(WebCore::parseCryptographicDigestImpl):
(WebCore::decodeEncodedResourceCryptographicDigest):
Update to use new base64Decode.

* loader/archive/mhtml/MHTMLArchive.cpp:
(WebCore::MHTMLArchive::generateMHTMLData):
Switch to using new base64Encode and new quotedPrintableEncode.

* loader/archive/mhtml/MHTMLParser.cpp:
(WebCore::MHTMLParser::parseNextPart):
Switch to using new base64Decode and new quotedPrintableDecode.

* loader/cocoa/PrivateClickMeasurementCocoa.mm:
(WebCore::PrivateClickMeasurement::calculateAndUpdateSourceUnlinkableToken):
(WebCore::PrivateClickMeasurement::calculateAndUpdateSourceSecretToken):
Update to use new base64URLDecode / base64URLEncodeToString().

* page/Base64Utilities.cpp:
(WebCore::Base64Utilities::btoa):
(WebCore::Base64Utilities::atob):
Update to use new base64Decode / base64EncodeToString().

* page/Page.cpp:
(WebCore::Page::userStyleSheetLocationChanged):
Update to use new base64Decode.

* platform/SharedBuffer.cpp:
(WebCore::SharedBuffer::append):
* platform/SharedBuffer.h:
Add overload for append which allows passing in a uint8_t*.

* platform/encryptedmedia/clearkey/CDMClearKey.cpp:
(WebCore::parseLicenseFormat):
(WebCore::extractKeyidsFromCencInitData):
(WebCore::extractKeyIdFromWebMInitData):
(WebCore::CDMInstanceSessionClearKey::removeSessionData):
Update to use new base64URLDecode / base64URLEncodeToString().

* platform/graphics/avfoundation/CDMFairPlayStreaming.cpp:
(WebCore::extractSinfData):
Update to use new base64Decode.

* platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
(WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::requestLicense):
(WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::updateLicense):
(WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::didProvideRequests):
Update to use new base64Decode / base64EncodeToString().

* platform/graphics/cairo/ImageBufferCairoBackend.cpp:
(WebCore::ImageBufferCairoBackend::toDataURL const):
Update to use new base64EncodeToString().

* platform/graphics/cg/ImageBufferUtilitiesCG.cpp:
(WebCore::dataURL):
Update to use new base64EncodeToString().

* platform/graphics/win/FontCustomPlatformData.cpp:
(WebCore::createUniqueFontName):
Update to use new base64EncodeToString().

* platform/graphics/win/FontCustomPlatformDataCairo.cpp:
(WebCore::createUniqueFontName):
Update to use new base64EncodeToString().

* platform/mac/SSLKeyGeneratorMac.mm:
(WebCore::signedPublicKeyAndChallengeString):
Update to use new base64EncodeToString().

* platform/network/BlobRegistryImpl.cpp:
(WebCore::loadBlobResourceSynchronously):
Switch to using Vector<uint8_t> buffer to match new loadResourceSynchronously
signature.

* platform/network/BlobResourceHandle.cpp:
* platform/network/BlobResourceHandle.h:
(WebCore::BlobResourceHandle::loadResourceSynchronously):
Switch to using Vector<uint8_t> buffer to match new loadResourceSynchronously
signature.

* platform/network/CredentialBase.cpp:
* platform/network/CredentialBase.h:
(WebCore::CredentialBase::serializationForBasicAuthorizationHeader const):
Add helper to construct Basic auth header to replace duplicated logic in
call sites.

* platform/network/DataURLDecoder.cpp:
(WebCore::DataURLDecoder::decodeBase64):
(WebCore::DataURLDecoder::decodeEscaped):
(WebCore::DataURLDecoder::decodeSynchronously):
* platform/network/DataURLDecoder.h:
Update to use new base64Decode.

* platform/network/ResourceHandle.cpp:
* platform/network/ResourceHandle.h:
Switch to using Vector<uint8_t> for the data buffer in the synchronous load.

* platform/network/SynchronousLoaderClient.cpp:
(WebCore::SynchronousLoaderClient::didReceiveData):
* platform/network/SynchronousLoaderClient.h:
Switch to using Vector<uint8_t> buffer to match new loadResourceSynchronously
signature.

* platform/network/cf/ResourceHandleCFNet.cpp:
(WebCore::applyBasicAuthorizationHeader):
Use new serializationForBasicAuthorizationHeader() helper.

(WebCore::ResourceHandle::platformLoadResourceSynchronously):
Switch to using Vector<uint8_t> for the data buffer in the synchronous load.

* platform/network/curl/ResourceHandleCurl.cpp:
(WebCore::ResourceHandle::platformLoadResourceSynchronously):
(WebCore::ResourceHandle::handleDataURL):
Switch to using Vector<uint8_t> for the data buffer in the synchronous load.

* platform/network/mac/ResourceHandleMac.mm:
(WebCore::applyBasicAuthorizationHeader):
Use new serializationForBasicAuthorizationHeader() helper.

(WebCore::ResourceHandle::platformLoadResourceSynchronously):
Switch to using Vector<uint8_t> for the data buffer in the synchronous load.

* platform/network/soup/ResourceHandleSoup.cpp:
(WebCore::ResourceHandle::platformLoadResourceSynchronously):
Switch to using Vector<uint8_t> for the data buffer in the synchronous load.

* platform/network/soup/SoupNetworkSession.cpp:
(WebCore::HostTLSCertificateSet::computeCertificateHash):
Update to use new base64EncodeToString().

* platform/text/DecodeEscapeSequences.h:
(WebCore::decodeURLEscapeSequencesAsData):
Switch to returning Vector<uint8_t>.

* platform/text/QuotedPrintable.cpp:
* platform/text/QuotedPrintable.h:
(WebCore::lengthOfLineEndingAtIndex):
(WebCore::quotedPrintableEncode):
(WebCore::quotedPrintableDecode):
Replace uses of Vector<char> with Vector<uint8_t> and the out parameters
with Optional return values.

* platform/win/SSLKeyGeneratorWin.cpp:
(WebCore::signedPublicKeyAndChallengeString):
Update to use new base64EncodeToString().

* workers/service/server/SWScriptStorage.cpp:
(WebCore::SWScriptStorage::sha2Hash const):
Update to use new base64URLEncodeToString().

Source/WebKit:

* NetworkProcess/NetworkConnectionToWebProcess.messages.in:
* UIProcess/API/C/WKPage.cpp:
(WKPageSetPageNavigationClient):
* UIProcess/WebPageProxy.messages.in:
* UIProcess/WebURLSchemeHandler.h:
* UIProcess/WebURLSchemeTask.cpp:
(WebKit::WebURLSchemeTask::didComplete):
* UIProcess/WebURLSchemeTask.h:
* WebProcess/Network/WebLoaderStrategy.cpp:
(WebKit::WebLoaderStrategy::loadResourceSynchronously):
* WebProcess/Network/WebLoaderStrategy.h:
* WebProcess/WebPage/WebURLSchemeHandlerProxy.cpp:
(WebKit::WebURLSchemeHandlerProxy::loadSynchronously):
* WebProcess/WebPage/WebURLSchemeHandlerProxy.h:
Update to use uint8_t* data buffers more consistently for synchronous loads.

* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::sendReplyToSynchronousRequest):
Update to use uint8_t* data buffers more consistently for synchronous loads.

* NetworkProcess/PrivateClickMeasurementManager.cpp:
(WebKit::PrivateClickMeasurementManager::fireConversionRequest):
Update to use new base64URLDecode / base64URLEncodeToString().

* NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
(WebKit::applyBasicAuthorizationHeader):
Use new serializationForBasicAuthorizationHeader() helper.

* Shared/API/APIData.h:
(API::Data::create):
(API::Data::fastFreeBytes): Deleted.
Add new create function that takes ownership of a Vector's buffer rather
than copying it. Replace use of static functions with inline lambdas for
free-functions.

* Shared/mac/AuxiliaryProcessMac.mm:
(WebKit::sandboxFilePath):
Use makeString and new base64URLEncoded().

* UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm:
(produceClientDataJson):
Use new base64URLEncodeToString().

* UIProcess/Automation/cairo/WebAutomationSessionCairo.cpp:
(WebKit::base64EncodedPNGData):
Use new base64EncodeToString().

* UIProcess/Cocoa/NavigationState.mm:
(WebKit::NavigationState::NavigationClient::webCryptoMasterKey):
Use new defaultWebCryptoMasterKey() and new adopting API::Data::create function.

* UIProcess/Inspector/glib/RemoteInspectorClient.cpp:
(WebKit::RemoteInspectorClient::setBackendCommands):
Use new base64EncodeToString().

* UIProcess/Inspector/gtk/RemoteWebInspectorUIProxyGtk.cpp:
(WebKit::RemoteWebInspectorUIProxy::platformSave):
Use new base64Decode().

* UIProcess/Inspector/gtk/WebInspectorUIProxyGtk.cpp:
(WebKit::WebInspectorUIProxy::platformSave):
Use new base64Decode().

* UIProcess/Inspector/mac/RemoteWebInspectorUIProxyMac.mm:
(WebKit::RemoteWebInspectorUIProxy::platformSave):
Use new base64Decode().

* UIProcess/Inspector/mac/WebInspectorUIProxyMac.mm:
(WebKit::WebInspectorUIProxy::platformSave):
Use new base64Decode().

* UIProcess/Inspector/socket/RemoteInspectorClient.cpp:
(WebKit::RemoteInspectorClient::setBackendCommands):
Use new base64EncodeToString().

* UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
(WebKit::LocalAuthenticatorInternal::produceHashSet):
(WebKit::LocalAuthenticator::makeCredential):
(WebKit::LocalAuthenticator::getAssertion):
Use new base64EncodeToString().

* UIProcess/WebAuthentication/Mock/MockHidConnection.cpp:
(WebKit::MockHidConnection::feedReports):
Use new base64Decode().

* UIProcess/WebAuthentication/Mock/MockLocalConnection.mm:
(WebKit::MockLocalConnection::filterResponses const):
Use new base64EncodeToString().

Source/WebKitLegacy:

* WebCoreSupport/WebResourceLoadScheduler.cpp:
(WebResourceLoadScheduler::loadResourceSynchronously):
* WebCoreSupport/WebResourceLoadScheduler.h:
Update to match new signature. char -> uint8_t.

Source/WebKitLegacy/mac:

* WebCoreSupport/WebChromeClient.mm:
(WebChromeClient::wrapCryptoKey const):
(WebChromeClient::unwrapCryptoKey const):
Update to use new Optional returning defaultWebCryptoMasterKey().

* WebCoreSupport/WebInspectorClient.mm:
(WebInspectorFrontendClient::save):
Update to use new Optional returning base64Decode().

Source/WTF:

Bring base64 encoding/decoding up to more modern WebKit conventions by:
- Replace use of "out parameter + bool" with Optional return values.
- Using enum class for enumerations.
- Replacing SignedOrUnsignedCharVectorAdapter/ConstSignedOrUnsignedCharVectorAdapter
  with appropriate function overloads.

Also adds a new StringTypeAdapter for inline base64 encoding data in either makeString()
or StringBuilder. To make this work, a few modifications were need to the base64Encode()
functions to support the fixed size writeTo() function.

First, the length of the encoded data is now computed up front depending on the policy.
This has been extracted into a new calculateBase64EncodedSize() function used by both
the adaptor and by base64Encode when passed a Vector. Previously, when encoding using
some policies, the size was an overestimate and the resulting Vector would be resized
down after encoding.

Second, base64EncodeInternal was made into a template function to allow for two new
base64Encode functions, one of which has a UChar* destination. These are used by the
adaptor to write the encoded data.

One additional small change is that now a optional map type parameter has been added
to all the encoders to allow using either the default map or the URL one as defined
in RFC 4648. This simplifies the implementation of the StringTypeAdapter and makes the
base64URLEncode/base64URLDecode functions into simple convenience functions that use
the right defaults for the generic encode/decode functions.

* wtf/text/Base64.cpp:
(WTF::base64EncodeInternal):
(WTF::base64Encode):
(WTF::base64DecodeInternal):
(WTF::base64Decode):
(WTF::base64URLDecode):
(WTF::base64URLEncode): Deleted.
* wtf/text/Base64.h:
(WTF::base64Decode):
(WTF::base64Encode):
(WTF::base64URLEncode):
(WTF::isBase64OrBase64URLCharacter):
(WTF::calculateBase64EncodedSize):
(WTF::base64Encoded):
(WTF::base64URLEncoded):
(WTF::StringTypeAdapter<Base64Specification>::StringTypeAdapter):
(WTF::StringTypeAdapter<Base64Specification>::length const):
(WTF::StringTypeAdapter<Base64Specification>::is8Bit const):
(WTF::StringTypeAdapter<Base64Specification>::writeTo const):

Tools:

Update to use updated base64 and defaultWebCryptoMasterKey() related
functions.

* TestWebKitAPI/TCPServer.cpp:
(TestWebKitAPI::TCPServer::startSecureConnection):
(TestWebKitAPI::TCPServer::testCertificate):
(TestWebKitAPI::TCPServer::testPrivateKey):
* TestWebKitAPI/Tests/WebCore/ISOBox.cpp:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebCore/cocoa/PrivateClickMeasurementCocoa.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebCore/cocoa/SerializedCryptoKeyWrap.mm:
(TestWebKitAPI::TEST_F):
* TestWebKitAPI/Tests/WebKitCocoa/Challenge.mm:
(testIdentity2):
* TestWebKitAPI/Tests/WebKitCocoa/EventAttribution.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/mac/SSLKeyGenerator.mm:
(TestWebKitAPI::TEST_F):
* TestWebKitAPI/cocoa/HTTPServer.mm:
(TestWebKitAPI::Connection::webSocketHandshake):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@277740 268f45cc-cd09-0410-ab3c-d52691b4dbfc
110 files changed
tree: 1dd0b2e6007fa31f166d30f55ae96c313d51c31e
  1. JSTests/
  2. LayoutTests/
  3. ManualTests/
  4. PerformanceTests/
  5. resources/
  6. Source/
  7. Tools/
  8. WebDriverTests/
  9. WebKit.xcworkspace/
  10. WebKitLibraries/
  11. Websites/
  12. .ccls
  13. .clang-format
  14. .dir-locals.el
  15. .editorconfig
  16. .gitattributes
  17. .gitignore
  18. ChangeLog
  19. ChangeLog-2012-05-22
  20. ChangeLog-2018-01-01
  21. CMakeLists.txt
  22. Introduction.md
  23. Makefile
  24. Makefile.shared
  25. ReadMe.md
ReadMe.md

WebKit

WebKit is a cross-platform web browser engine. On iOS and macOS, it powers Safari, Mail, iBooks, and many other applications.

Feature Status

Visit WebKit Feature Status page to see which Web API has been implemented, in development, or under consideration.

Trying the Latest

On macOS, download Safari Technology Preview to test the latest version of WebKit. On Linux, download Epiphany Technology Preview. On Windows, you'll have to build it yourself.

Reporting Bugs

  1. Search WebKit Bugzilla to see if there is an existing report for the bug you've encountered.
  2. Create a Bugzilla account to to report bugs (and to comment on them) if you haven't done so already.
  3. File a bug in accordance with our guidelines.

Once your bug is filed, you will receive email when it is updated at each stage in the bug life cycle. After the bug is considered fixed, you may be asked to download the latest nightly and confirm that the fix works for you.

Getting the Code

On Windows, follow the instructions on our website.

Cloning the Git SVN Repository

Run the following command to clone WebKit's Git SVN repository:

git clone git@github.com:WebKit/WebKit.git WebKit

or

git clone https://github.com/WebKit/WebKit.git WebKit

If you want to be able to track Subversion revision from your git checkout, you can run the following command to do so:

Tools/Scripts/git-webkit setup-git-svn

For information about this, and other aspects of using Git with WebKit, read the wiki page.

Checking out the Subversion Repository

If you don‘t want to use Git, run the following command to check out WebKit’s Subversion repository:

svn checkout https://svn.webkit.org/repository/webkit/trunk WebKit

Building WebKit

Building macOS Port

Install Xcode and its command line tools if you haven't done so already:

  1. Install Xcode Get Xcode from https://developer.apple.com/downloads. To build WebKit for OS X, Xcode 5.1.1 or later is required. To build WebKit for iOS Simulator, Xcode 7 or later is required.
  2. Install the Xcode Command Line Tools In Terminal, run the command: xcode-select --install

Run the following command to build a debug build with debugging symbols and assertions:

Tools/Scripts/build-webkit --debug

For performance testing, and other purposes, use --release instead.

Using Xcode

You can open WebKit.xcworkspace to build and debug WebKit within Xcode.

If you don't use a custom build location in Xcode preferences, you have to update the workspace settings to use WebKitBuild directory. In menu bar, choose File > Workspace Settings, then click the Advanced button, select “Custom”, “Relative to Workspace”, and enter WebKitBuild for both Products and Intermediates.

Embedded Builds

iOS, tvOS and watchOS are all considered embedded builds. The first time after you install a new Xcode, you will need to run:

sudo Tools/Scripts/configure-xcode-for-embedded-development

Without this step, you will see the error message: “target specifies product type ‘com.apple.product-type.tool’, but there’s no such product type for the ‘iphonesimulator’ platform.” when building target JSCLLIntOffsetsExtractor of project JavaScriptCore.

Run the following command to build a debug build with debugging symbols and assertions for embededded simulators:

Tools/Scripts/build-webkit --debug --<platform>-simulator

or embedded devices:

Tools/Scripts/build-webkit --debug --<platform>-device

where platform is ios, tvos or watchos.

Building the GTK+ Port

For production builds:

cmake -DPORT=GTK -DCMAKE_BUILD_TYPE=RelWithDebInfo -GNinja
ninja
sudo ninja install

For development builds:

Tools/gtk/install-dependencies
Tools/Scripts/update-webkitgtk-libs
Tools/Scripts/build-webkit --gtk --debug

For more information on building WebKitGTK+, see the wiki page.

Building the WPE Port

For production builds:

cmake -DPORT=WPE -DCMAKE_BUILD_TYPE=RelWithDebInfo -GNinja
ninja
sudo ninja install

For development builds:

Tools/wpe/install-dependencies
Tools/Scripts/update-webkitwpe-libs
Tools/Scripts/build-webkit --wpe --debug

Building Windows Port

For building WebKit on Windows, see the wiki page.

Running WebKit

With Safari and Other macOS Applications

Run the following command to launch Safari with your local build of WebKit:

Tools/Scripts/run-safari --debug

The run-safari script sets the DYLD_FRAMEWORK_PATH environment variable to point to your build products, and then launches /Applications/Safari.app. DYLD_FRAMEWORK_PATH tells the system loader to prefer your build products over the frameworks installed in /System/Library/Frameworks.

To run other applications with your local build of WebKit, run the following command:

Tools/Scripts/run-webkit-app <application-path>

iOS Simulator

Run the following command to launch iOS simulator with your local build of WebKit:

run-safari --debug --ios-simulator

In both cases, if you have built release builds instead, use --release instead of --debug.

Linux Ports

If you have a development build, you can use the run-minibrowser script, e.g.:

run-minibrowser --debug --wpe

Pass one of --gtk, --jsc-only, or --wpe to indicate the port to use.

Contribute

Congratulations! You’re up and running. Now you can begin coding in WebKit and contribute your fixes and new features to the project. For details on submitting your code to the project, read Contributing Code.