diff --git a/.github/workflows/roll_stable_test_runner.yml b/.github/workflows/roll_stable_test_runner.yml new file mode 100644 index 0000000000..2c90852044 --- /dev/null +++ b/.github/workflows/roll_stable_test_runner.yml @@ -0,0 +1,58 @@ +name: "PR: bump stable-test-runner" +on: + workflow_dispatch: + schedule: + # At 10:00am UTC (3AM PST) every Monday + - cron: "0 10 * * 1" +jobs: + trigger-roll: + name: Trigger Roll + runs-on: ubuntu-24.04 + if: github.repository == 'microsoft/playwright' + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 22 + - run: | + npm install @playwright/test@next + VERSION=$(node -e "console.log(require('./package.json').dependencies['@playwright/test'].replace('^', ''))") + echo "VERSION=$VERSION" >> $GITHUB_OUTPUT + working-directory: tests/playwright-test/stable-test-runner/ + id: bump + - name: Prepare branch + id: prepare-branch + run: | + if [[ "$(git status --porcelain)" == "" ]]; then + echo "there are no changes"; + exit 0; + fi + echo "HAS_CHANGES=1" >> $GITHUB_OUTPUT + BRANCH_NAME="roll-stable-test-runner/$(date +%Y-%b-%d)" + echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_OUTPUT + git config --global user.name microsoft-playwright-automation[bot] + git config --global user.email 203992400+microsoft-playwright-automation[bot]@users.noreply.github.com + git checkout -b "$BRANCH_NAME" + git add . + git commit -m "test: roll stable-test-runner to ${{ steps.bump.outputs.VERSION }}" + git push origin $BRANCH_NAME + - uses: actions/create-github-app-token@v2 + id: app-token + with: + app-id: ${{ vars.PLAYWRIGHT_APP_ID }} + private-key: ${{ secrets.PLAYWRIGHT_PRIVATE_KEY }} + - name: Create Pull Request + if: ${{ steps.prepare-branch.outputs.HAS_CHANGES == '1' }} + uses: actions/github-script@v7 + with: + github-token: ${{ steps.app-token.outputs.token }} + script: | + await github.rest.pulls.create({ + owner: 'microsoft', + repo: 'playwright', + head: 'microsoft:${{ steps.prepare-branch.outputs.BRANCH_NAME }}', + base: 'main', + title: 'test: roll stable-test-runner to ${{ steps.bump.outputs.VERSION }}', + }); diff --git a/.github/workflows/tests_others.yml b/.github/workflows/tests_others.yml index ed18e1541c..b35a61d3b2 100644 --- a/.github/workflows/tests_others.yml +++ b/.github/workflows/tests_others.yml @@ -134,6 +134,27 @@ jobs: env: PW_CLOCK: ${{ matrix.clock }} + test_legacy_progress_timeouts: + name: legacy progress timeouts + environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }} + permissions: + id-token: write # This is required for OIDC login (azure/login) to succeed + contents: read # This is required for actions/checkout to succeed + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/run-test + with: + node-version: 20 + browsers-to-install: chromium + command: npm run test -- --project=chromium-* + bot-name: "legacy-progress-timeouts-linux" + flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }} + flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }} + flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }} + env: + PLAYWRIGHT_LEGACY_TIMEOUTS: 1 + test_electron: name: Electron - ${{ matrix.os }} environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }} diff --git a/.github/workflows/tests_primary.yml b/.github/workflows/tests_primary.yml index cae05b22f3..ec575d808e 100644 --- a/.github/workflows/tests_primary.yml +++ b/.github/workflows/tests_primary.yml @@ -42,6 +42,9 @@ jobs: - os: ubuntu-22.04 node-version: 22 browser: chromium + - os: ubuntu-22.04 + node-version: 24 + browser: chromium runs-on: ${{ matrix.os }} permissions: id-token: write # This is required for OIDC login (azure/login) to succeed @@ -109,6 +112,14 @@ jobs: node-version: 22 shardIndex: 2 shardTotal: 2 + - os: ubuntu-latest + node-version: 24 + shardIndex: 1 + shardTotal: 2 + - os: ubuntu-latest + node-version: 24 + shardIndex: 2 + shardTotal: 2 runs-on: ${{ matrix.os }} permissions: id-token: write # This is required for OIDC login (azure/login) to succeed diff --git a/.github/workflows/tests_secondary.yml b/.github/workflows/tests_secondary.yml index c01be04b96..eafe68cd60 100644 --- a/.github/workflows/tests_secondary.yml +++ b/.github/workflows/tests_secondary.yml @@ -102,6 +102,8 @@ jobs: node_version: 20 - os: ubuntu-latest node_version: 22 + - os: ubuntu-latest + node_version: 24 timeout-minutes: 30 steps: - uses: actions/checkout@v4 @@ -176,11 +178,16 @@ jobs: matrix: include: - browser: chromium + runs-on: ubuntu-22.04 - browser: firefox + runs-on: ubuntu-22.04 + # See https://github.com/microsoft/playwright/issues/35586 - browser: webkit + runs-on: ubuntu-24.04 - browser: chromium + runs-on: ubuntu-22.04 channel: chromium-tip-of-tree - runs-on: ubuntu-22.04 + runs-on: ${{ matrix.runs-on }} steps: - uses: actions/checkout@v4 - uses: ./.github/actions/run-test diff --git a/browser_patches/firefox/UPSTREAM_CONFIG.sh b/browser_patches/firefox/UPSTREAM_CONFIG.sh index db9424fcf3..0513b89208 100644 --- a/browser_patches/firefox/UPSTREAM_CONFIG.sh +++ b/browser_patches/firefox/UPSTREAM_CONFIG.sh @@ -1,3 +1,3 @@ -REMOTE_URL="https://github.com/mozilla/gecko-dev" +REMOTE_URL="https://github.com/mozilla-firefox/firefox" BASE_BRANCH="release" -BASE_REVISION="9cbfae27052e4aaeb064d2d08e7e869f31ee4288" +BASE_REVISION="00656c9425c51ee035578ca6ebebe13c755b0375" diff --git a/browser_patches/firefox/juggler/NetworkObserver.js b/browser_patches/firefox/juggler/NetworkObserver.js index e3df3b15b7..c063e0484d 100644 --- a/browser_patches/firefox/juggler/NetworkObserver.js +++ b/browser_patches/firefox/juggler/NetworkObserver.js @@ -533,6 +533,8 @@ class NetworkRequest { }; const { status, statusText, headers } = responseHead(this.httpChannel, opt_statusCode, opt_statusText); + if (redirectStatus.includes(status) && this._overriddenHeadersForRedirect) + this._overriddenHeadersForRedirect = filterHeadersForRedirect(this._overriddenHeadersForRedirect, this.httpChannel.requestMethod, status); let remoteIPAddress = undefined; let remotePort = undefined; try { @@ -808,6 +810,18 @@ function overrideRequestHeaders(httpChannel, headers) { appendExtraHTTPHeaders(httpChannel, headers); } +const redirectStatus = [301, 302, 303, 307, 308]; + +function filterHeadersForRedirect(headers, requestMethod, status) { + // HTTP-redirect fetch step 13 (https://fetch.spec.whatwg.org/#http-redirect-fetch) + if ((status === 301 || status === 302) && requestMethod === 'POST' || + status === 303 && !['GET', 'HEAD'].includes(requestMethod)) { + const requestBodyHeaders = ['content-encoding', 'content-language', 'content-length', 'content-location', 'content-type']; + return headers.filter(header => !requestBodyHeaders.includes(header.name.toLowerCase())); + } + return headers; +} + function causeTypeToString(causeType) { for (let key in Ci.nsIContentPolicy) { if (Ci.nsIContentPolicy[key] === causeType) diff --git a/browser_patches/firefox/patches/bootstrap.diff b/browser_patches/firefox/patches/bootstrap.diff index 8cb0e71d92..6f70b0342c 100644 --- a/browser_patches/firefox/patches/bootstrap.diff +++ b/browser_patches/firefox/patches/bootstrap.diff @@ -2543,6 +2543,130 @@ index 704404c9f094640ad63b685d64bd5a396e733e4b..92bdc21b4d6a015cc2f2bb22781ec675 /** * InterceptionTimeStamps is used to record the time stamps of the * interception. +diff --git a/netwerk/protocol/http/nsHttpChannel.cpp b/netwerk/protocol/http/nsHttpChannel.cpp +index e4479400a4c574f652befbee7d83bd664aa2b840..2761dce9477f7f1622a82fe1da6472597ae82534 100644 +--- a/netwerk/protocol/http/nsHttpChannel.cpp ++++ b/netwerk/protocol/http/nsHttpChannel.cpp +@@ -688,11 +688,9 @@ nsresult nsHttpChannel::OnBeforeConnect() { + // SecurityInfo.sys.mjs + mLoadInfo->SetHstsStatus(isSecureURI); + +- RefPtr bc; +- mLoadInfo->GetBrowsingContext(getter_AddRefs(bc)); + // If bypassing the cache and we're forced offline + // we can just return the error here. +- if (bc && bc->Top()->GetForceOffline() && ++ if (IsForcedOffline() && + BYPASS_LOCAL_CACHE(mLoadFlags, LoadPreferCacheLoadOverBypass())) { + return NS_ERROR_OFFLINE; + } +@@ -805,9 +803,7 @@ nsresult nsHttpChannel::MaybeUseHTTPSRRForUpgrade(bool aShouldUpgrade, + return aStatus; + } + +- RefPtr bc; +- mLoadInfo->GetBrowsingContext(getter_AddRefs(bc)); +- bool forceOffline = bc && bc->Top()->GetForceOffline(); ++ bool forceOffline = IsForcedOffline(); + + if (mURI->SchemeIs("https") || aShouldUpgrade || !LoadUseHTTPSSVC() || + forceOffline) { +@@ -1266,15 +1262,14 @@ nsresult nsHttpChannel::ContinueConnect() { + "CORS preflight must have been finished by the time we " + "do the rest of ContinueConnect"); + +- RefPtr bc; +- mLoadInfo->GetBrowsingContext(getter_AddRefs(bc)); ++ bool isForcedOffline = IsForcedOffline(); + + // we may or may not have a cache entry at this point + if (mCacheEntry) { + // read straight from the cache if possible... + if (CachedContentIsValid()) { + // If we're forced offline, and set to bypass the cache, return offline. +- if (bc && bc->Top()->GetForceOffline() && ++ if (isForcedOffline && + BYPASS_LOCAL_CACHE(mLoadFlags, LoadPreferCacheLoadOverBypass())) { + return NS_ERROR_OFFLINE; + } +@@ -1316,7 +1311,7 @@ nsresult nsHttpChannel::ContinueConnect() { + } + + // We're about to hit the network. Don't if we're forced offline. +- if (bc && bc->Top()->GetForceOffline()) { ++ if (isForcedOffline) { + return NS_ERROR_OFFLINE; + } + +@@ -1421,12 +1416,9 @@ void nsHttpChannel::SpeculativeConnect() { + // don't speculate if we are offline, when doing http upgrade (i.e. + // websockets bootstrap), or if we can't do keep-alive (because then we + // couldn't reuse the speculative connection anyhow). +- RefPtr bc; +- mLoadInfo->GetBrowsingContext(getter_AddRefs(bc)); +- + if (gIOService->IsOffline() || mUpgradeProtocolCallback || + !(mCaps & NS_HTTP_ALLOW_KEEPALIVE) || +- (bc && bc->Top()->GetForceOffline())) { ++ IsForcedOffline()) { + return; + } + +@@ -4214,9 +4206,6 @@ nsresult nsHttpChannel::OpenCacheEntryInternal(bool isHttps) { + uint32_t cacheEntryOpenFlags; + bool offline = gIOService->IsOffline(); + +- RefPtr bc; +- mLoadInfo->GetBrowsingContext(getter_AddRefs(bc)); +- + bool maybeRCWN = false; + + nsAutoCString cacheControlRequestHeader; +@@ -4227,7 +4216,7 @@ nsresult nsHttpChannel::OpenCacheEntryInternal(bool isHttps) { + return NS_OK; + } + +- bool forceOffline = bc && bc->Top()->GetForceOffline(); ++ bool forceOffline = IsForcedOffline(); + if (offline || (mLoadFlags & INHIBIT_CACHING) || forceOffline) { + if (BYPASS_LOCAL_CACHE(mLoadFlags, LoadPreferCacheLoadOverBypass()) && + !offline && !forceOffline) { +@@ -7300,6 +7289,20 @@ void nsHttpChannel::MaybeStartDNSPrefetch() { + } + } + ++bool nsHttpChannel::IsForcedOffline() { ++ RefPtr bc; ++ mLoadInfo->GetBrowsingContext(getter_AddRefs(bc)); ++ if (bc && bc->Top()->GetForceOffline()) ++ return true; ++ ++ RefPtr wbc; ++ mLoadInfo->GetWorkerAssociatedBrowsingContext(getter_AddRefs(wbc)); ++ if (wbc && wbc->Top()->GetForceOffline()) ++ return true; ++ ++ return false; ++} ++ + NS_IMETHODIMP + nsHttpChannel::GetEncodedBodySize(uint64_t* aEncodedBodySize) { + if (mCacheEntry && !LoadCacheEntryIsWriteOnly()) { +diff --git a/netwerk/protocol/http/nsHttpChannel.h b/netwerk/protocol/http/nsHttpChannel.h +index cb8b8b7406411edceb30aa53c9b9007a38058f84..ebdc5384ca20feda399b70532a3036174f1a7431 100644 +--- a/netwerk/protocol/http/nsHttpChannel.h ++++ b/netwerk/protocol/http/nsHttpChannel.h +@@ -307,6 +307,10 @@ class nsHttpChannel final : public HttpBaseChannel, + void MaybeResolveProxyAndBeginConnect(); + void MaybeStartDNSPrefetch(); + ++ // ---- Playwright begin ++ bool IsForcedOffline(); ++ // ---- Playwright end ++ + // Based on the proxy configuration determine the strategy for resolving the + // end server host name. + ProxyDNSStrategy GetProxyDNSStrategy(); diff --git a/parser/html/nsHtml5TreeOpExecutor.cpp b/parser/html/nsHtml5TreeOpExecutor.cpp index d3b44cc62d3df49bbf842356cbdb153c82c3163c..23cf9bc83fb1faaf1c7406331b78e522b307cbf0 100644 --- a/parser/html/nsHtml5TreeOpExecutor.cpp @@ -2669,22 +2793,40 @@ index 75555352b8a15a50e4a21e34fc8ede4e9246c7cc..72855a404effa42b6c55cd0c2fcb8bdd // ignored for Linux. const unsigned long CHROME_SUPPRESS_ANIMATION = 1 << 24; diff --git a/toolkit/components/enterprisepolicies/EnterprisePoliciesParent.sys.mjs b/toolkit/components/enterprisepolicies/EnterprisePoliciesParent.sys.mjs -index 76fb919603e8d2b7864d351eb47be2a38e40e31e..cdfef96e20bea13799751154f4076bbcc2f827d4 100644 +index 76fb919603e8d2b7864d351eb47be2a38e40e31e..9f1e880fe9027d1a2540ffeaa11fc0c4e1a36133 100644 --- a/toolkit/components/enterprisepolicies/EnterprisePoliciesParent.sys.mjs +++ b/toolkit/components/enterprisepolicies/EnterprisePoliciesParent.sys.mjs -@@ -108,6 +108,12 @@ EnterprisePoliciesManager.prototype = { +@@ -108,7 +108,9 @@ EnterprisePoliciesManager.prototype = { Services.prefs.clearUserPref(PREF_POLICIES_APPLIED); } -+ // Playwright: Disable enterprise policies -+ if (true) { -+ this.status = Ci.nsIEnterprisePolicies.INACTIVE; -+ return; -+ } -+ - let provider = this._chooseProvider(); +- let provider = this._chooseProvider(); ++ // --- Playwright begin --- ++ let provider = new PlaywrightPoliciesProvider(); ++ // --- Playwright end --- if (provider.failed) { + this.status = Ci.nsIEnterprisePolicies.FAILED; +@@ -631,6 +633,19 @@ class JSONPoliciesProvider { + } + } + ++class PlaywrightPoliciesProvider extends JSONPoliciesProvider { ++ _getConfigurationFile() { ++ let prefPath = Services.prefs.getStringPref(PREF_ALTERNATE_PATH, ""); ++ if (!prefPath) ++ return null; ++ ++ dump(`Playwright: loading enterprise policies from ${prefPath}\n`); ++ let configFile = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile); ++ configFile.initWithPath(prefPath); ++ return configFile; ++ } ++} ++ + class WindowsGPOPoliciesProvider { + constructor() { + this._policies = null; diff --git a/toolkit/components/resistfingerprinting/nsUserCharacteristics.cpp b/toolkit/components/resistfingerprinting/nsUserCharacteristics.cpp index 253171bed4dea54fc28bb4ddc9920823dbd9351c..6dc0e620b399ed9ee6b53f97bc080ec17ee4e1b5 100644 --- a/toolkit/components/resistfingerprinting/nsUserCharacteristics.cpp diff --git a/browser_patches/firefox/preferences/playwright.cfg b/browser_patches/firefox/preferences/playwright.cfg index 8c0404cbe7..5dc8986c19 100644 --- a/browser_patches/firefox/preferences/playwright.cfg +++ b/browser_patches/firefox/preferences/playwright.cfg @@ -8,6 +8,9 @@ pref("dom.input_events.security.minTimeElapsedInMS", 0); pref("dom.iframe_lazy_loading.enabled", false); +// Allows a custom "policies.json" file. +pref("browser.policies.alternatePath", getenv("PLAYWRIGHT_FIREFOX_POLICIES_JSON") || ""); + // This setting is experimental and is only enabled on early betas. // Disable it unconditionally since it breaks proxy tests. pref("dom.security.https_first", false); diff --git a/browser_patches/webkit/UPSTREAM_CONFIG.sh b/browser_patches/webkit/UPSTREAM_CONFIG.sh index a5ab8feea5..574e1f310a 100644 --- a/browser_patches/webkit/UPSTREAM_CONFIG.sh +++ b/browser_patches/webkit/UPSTREAM_CONFIG.sh @@ -1,3 +1,3 @@ REMOTE_URL="https://github.com/WebKit/WebKit.git" BASE_BRANCH="main" -BASE_REVISION="4dd862e5ce1c10d77f72be94260164c5f13aafbd" +BASE_REVISION="153da00a252619799ba4b32cd0ac6c5b8faf6a35" diff --git a/browser_patches/webkit/embedder/Playwright/win/Common.cpp b/browser_patches/webkit/embedder/Playwright/win/Common.cpp index 66dee5b68b..01a10f7be9 100644 --- a/browser_patches/webkit/embedder/Playwright/win/Common.cpp +++ b/browser_patches/webkit/embedder/Playwright/win/Common.cpp @@ -44,6 +44,8 @@ HINSTANCE hInst; POINT s_windowPosition = { 100, 100 }; SIZE s_windowSize = { 500, 200 }; +bool s_headless; + namespace WebCore { float deviceScaleFactorForWindow(HWND); } diff --git a/browser_patches/webkit/embedder/Playwright/win/Common.h b/browser_patches/webkit/embedder/Playwright/win/Common.h index 3c534fd370..29edbe39da 100644 --- a/browser_patches/webkit/embedder/Playwright/win/Common.h +++ b/browser_patches/webkit/embedder/Playwright/win/Common.h @@ -64,6 +64,7 @@ std::wstring replaceString(std::wstring src, const std::wstring& oldValue, const extern HINSTANCE hInst; extern POINT s_windowPosition; extern SIZE s_windowSize; +extern bool s_headless; std::wstring createString(WKStringRef wkString); std::wstring createString(WKURLRef wkURL); diff --git a/browser_patches/webkit/embedder/Playwright/win/MainWindow.cpp b/browser_patches/webkit/embedder/Playwright/win/MainWindow.cpp index f8430a601d..ca65ccb022 100644 --- a/browser_patches/webkit/embedder/Playwright/win/MainWindow.cpp +++ b/browser_patches/webkit/embedder/Playwright/win/MainWindow.cpp @@ -48,12 +48,10 @@ static INT_PTR CALLBACK About(HWND, UINT, WPARAM, LPARAM); std::wstring MainWindow::s_windowClass; size_t MainWindow::s_numInstances; -bool MainWindow::s_headless = false; bool MainWindow::s_controlledRemotely = false; bool MainWindow::s_disableAcceleratedCompositing = false; -void MainWindow::configure(bool headless, bool controlledRemotely, bool disableAcceleratedCompositing) { - s_headless = headless; +void MainWindow::configure(bool controlledRemotely, bool disableAcceleratedCompositing) { s_controlledRemotely = controlledRemotely; s_disableAcceleratedCompositing = disableAcceleratedCompositing; } diff --git a/browser_patches/webkit/embedder/Playwright/win/MainWindow.h b/browser_patches/webkit/embedder/Playwright/win/MainWindow.h index c34241fb1d..e0af565f4b 100644 --- a/browser_patches/webkit/embedder/Playwright/win/MainWindow.h +++ b/browser_patches/webkit/embedder/Playwright/win/MainWindow.h @@ -35,7 +35,7 @@ class MainWindow : public BrowserWindowClient { public: - static void configure(bool headless, bool controlledRemotely, bool disableAcceleratedCompositing); + static void configure(bool controlledRemotely, bool disableAcceleratedCompositing); MainWindow(); @@ -55,7 +55,6 @@ class MainWindow : public BrowserWindowClient { static void registerClass(HINSTANCE hInstance); static std::wstring s_windowClass; static size_t s_numInstances; - static bool s_headless; static bool s_controlledRemotely; static bool s_disableAcceleratedCompositing; diff --git a/browser_patches/webkit/embedder/Playwright/win/WebKitBrowserWindow.cpp b/browser_patches/webkit/embedder/Playwright/win/WebKitBrowserWindow.cpp index ee4ea065a7..c850d82076 100644 --- a/browser_patches/webkit/embedder/Playwright/win/WebKitBrowserWindow.cpp +++ b/browser_patches/webkit/embedder/Playwright/win/WebKitBrowserWindow.cpp @@ -41,16 +41,18 @@ #include #include -std::wstring createPEMString(WKCertificateInfoRef certificateInfo) +std::wstring createPEMString(WKProtectionSpaceRef protectionSpace) { - auto chainSize = WKCertificateInfoGetCertificateChainSize(certificateInfo); + auto chain = adoptWK(WKProtectionSpaceCopyCertificateChain(protectionSpace)); std::wstring pems; - for (auto i = 0; i < chainSize; i++) { - auto certificate = adoptWK(WKCertificateInfoCopyCertificateAtIndex(certificateInfo, i)); - auto size = WKDataGetSize(certificate.get()); - auto data = WKDataGetBytes(certificate.get()); + for (size_t i = 0; i < WKArrayGetSize(chain.get()); i++) { + auto item = WKArrayGetItemAtIndex(chain.get(), i); + assert(WKGetTypeID(item) == WKDataGetTypeID()); + auto certificate = static_cast(item); + auto size = WKDataGetSize(certificate); + auto data = WKDataGetBytes(certificate); for (size_t i = 0; i < size; i++) pems.push_back(data[i]); @@ -241,7 +243,7 @@ void WebKitBrowserWindow::didReceiveAuthenticationChallenge(WKPageRef page, WKAu WKAuthenticationDecisionListenerUseCredential(decisionListener, wkCredential.get()); return; } - } else { + } else if (!s_headless) { WKRetainPtr realm(WKProtectionSpaceCopyRealm(protectionSpace)); if (auto credential = askCredential(thisWindow.hwnd(), createString(realm.get()))) { @@ -259,10 +261,9 @@ void WebKitBrowserWindow::didReceiveAuthenticationChallenge(WKPageRef page, WKAu bool WebKitBrowserWindow::canTrustServerCertificate(WKProtectionSpaceRef protectionSpace) { auto host = createString(adoptWK(WKProtectionSpaceCopyHost(protectionSpace)).get()); - auto certificateInfo = adoptWK(WKProtectionSpaceCopyCertificateInfo(protectionSpace)); - auto verificationError = WKCertificateInfoGetVerificationError(certificateInfo.get()); - auto description = createString(adoptWK(WKCertificateInfoCopyVerificationErrorDescription(certificateInfo.get())).get()); - auto pem = createPEMString(certificateInfo.get()); + auto verificationError = WKProtectionSpaceGetCertificateVerificationError(protectionSpace); + auto description = createString(adoptWK(WKProtectionSpaceCopyCertificateVerificationErrorDescription(protectionSpace)).get()); + auto pem = createPEMString(protectionSpace); auto it = m_acceptedServerTrustCerts.find(host); if (it != m_acceptedServerTrustCerts.end() && it->second == pem) @@ -273,6 +274,9 @@ bool WebKitBrowserWindow::canTrustServerCertificate(WKProtectionSpaceRef protect textString.append(L"[DESCRIPTION] " + description + L"\r\n"); textString.append(pem); + if (s_headless) + return false; + if (askServerTrustEvaluation(hwnd(), textString)) { m_acceptedServerTrustCerts.emplace(host, pem); return true; diff --git a/browser_patches/webkit/embedder/Playwright/win/WinMain.cpp b/browser_patches/webkit/embedder/Playwright/win/WinMain.cpp index d80ba9f7bd..2261c2b810 100644 --- a/browser_patches/webkit/embedder/Playwright/win/WinMain.cpp +++ b/browser_patches/webkit/embedder/Playwright/win/WinMain.cpp @@ -102,7 +102,8 @@ int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, if (SetProcessDpiAwarenessContextPtr()) SetProcessDpiAwarenessContextPtr()(DPI_AWARENESS_CONTEXT_UNAWARE); - MainWindow::configure(g_options.headless, g_options.inspectorPipe, g_options.disableAcceleratedCompositing); + s_headless = g_options.headless; + MainWindow::configure(g_options.inspectorPipe, g_options.disableAcceleratedCompositing); if (!g_options.noStartupWindow) { auto configuration = adoptWK(WKWebsiteDataStoreConfigurationCreate()); diff --git a/browser_patches/webkit/patches/bootstrap.diff b/browser_patches/webkit/patches/bootstrap.diff index 573fbebe44..9d644885f0 100644 --- a/browser_patches/webkit/patches/bootstrap.diff +++ b/browser_patches/webkit/patches/bootstrap.diff @@ -1,8 +1,8 @@ diff --git a/Source/JavaScriptCore/CMakeLists.txt b/Source/JavaScriptCore/CMakeLists.txt -index 27178e3306f1a1957516fbf90e101d1da144a8bd..ed99032196ff06fbe32cc3d88cdca110d0a29d30 100644 +index 458e1d4118805169ee6f9139af942cc5c3f88f8e..238f2a33ba150fae735915244910eaa66f5fd267 100644 --- a/Source/JavaScriptCore/CMakeLists.txt +++ b/Source/JavaScriptCore/CMakeLists.txt -@@ -1405,21 +1405,26 @@ set(JavaScriptCore_INSPECTOR_DOMAINS +@@ -1411,21 +1411,26 @@ set(JavaScriptCore_INSPECTOR_DOMAINS ${JAVASCRIPTCORE_DIR}/inspector/protocol/CSS.json ${JAVASCRIPTCORE_DIR}/inspector/protocol/Canvas.json ${JAVASCRIPTCORE_DIR}/inspector/protocol/Console.json @@ -30,10 +30,10 @@ index 27178e3306f1a1957516fbf90e101d1da144a8bd..ed99032196ff06fbe32cc3d88cdca110 ${JAVASCRIPTCORE_DIR}/inspector/protocol/ServiceWorker.json ${JAVASCRIPTCORE_DIR}/inspector/protocol/Target.json diff --git a/Source/JavaScriptCore/DerivedSources-input.xcfilelist b/Source/JavaScriptCore/DerivedSources-input.xcfilelist -index 4ebffbf7b080143afc4d9da6c516174cd08ffb5c..ddf59a7c8f336d9ee13b052c3ff685f1cadacd30 100644 +index 9fd3a4e6a53eb3339ced1e87f0b4cacd16f73167..a77d72ab052625c7b5a4d7c56a71befbad884871 100644 --- a/Source/JavaScriptCore/DerivedSources-input.xcfilelist +++ b/Source/JavaScriptCore/DerivedSources-input.xcfilelist -@@ -97,20 +97,25 @@ $(PROJECT_DIR)/inspector/protocol/CPUProfiler.json +@@ -98,20 +98,25 @@ $(PROJECT_DIR)/inspector/protocol/CPUProfiler.json $(PROJECT_DIR)/inspector/protocol/CSS.json $(PROJECT_DIR)/inspector/protocol/Canvas.json $(PROJECT_DIR)/inspector/protocol/Console.json @@ -60,10 +60,10 @@ index 4ebffbf7b080143afc4d9da6c516174cd08ffb5c..ddf59a7c8f336d9ee13b052c3ff685f1 $(PROJECT_DIR)/inspector/protocol/Security.json $(PROJECT_DIR)/inspector/protocol/ServiceWorker.json diff --git a/Source/JavaScriptCore/DerivedSources.make b/Source/JavaScriptCore/DerivedSources.make -index a37d9dfd55e0d0e20db0c984e594b685fbb96a9e..11e68adc7db68a30be854177a93984d074dbac85 100644 +index 3db6c2e250371dedc6a9f88bf1688112d467434a..a3832759ea36fb50bdbea6809b9fd13e6f66e46b 100644 --- a/Source/JavaScriptCore/DerivedSources.make +++ b/Source/JavaScriptCore/DerivedSources.make -@@ -300,21 +300,26 @@ INSPECTOR_DOMAINS := \ +@@ -301,21 +301,26 @@ INSPECTOR_DOMAINS := \ $(JavaScriptCore)/inspector/protocol/CSS.json \ $(JavaScriptCore)/inspector/protocol/Canvas.json \ $(JavaScriptCore)/inspector/protocol/Console.json \ @@ -237,7 +237,7 @@ index b555c2e5a071d0a6a016061cc60755449557556d..d019346f0932296d15212c76a4a9b56b bool m_isPaused { false }; }; diff --git a/Source/JavaScriptCore/inspector/JSGlobalObjectConsoleClient.cpp b/Source/JavaScriptCore/inspector/JSGlobalObjectConsoleClient.cpp -index c33e236f5228e21c6d5e0ea9bd97d07cdcb70640..7f160aec0f13e8c936aa7dea769d4e160d716452 100644 +index 13eb84b3cba851e14eae8894f8f7aeb242b6f9d4..30bfdf65a7b891420a25bbc54bfe7f03db694273 100644 --- a/Source/JavaScriptCore/inspector/JSGlobalObjectConsoleClient.cpp +++ b/Source/JavaScriptCore/inspector/JSGlobalObjectConsoleClient.cpp @@ -222,6 +222,14 @@ void JSGlobalObjectConsoleClient::screenshot(JSGlobalObject*, RefdeveloperExtrasEnabled())) ++ if (!m_consoleAgent->developerExtrasEnabled()) + return; + + warnUnimplemented("console.bindingCalled"_s); @@ -391,7 +391,7 @@ index 04377b714a6ccb5294c65d592e74350621d470ba..b6de937bfa3e6185ce29f4e432d327a3 // FrontendChannel FrontendChannel::ConnectionType connectionType() const; diff --git a/Source/JavaScriptCore/inspector/protocol/DOM.json b/Source/JavaScriptCore/inspector/protocol/DOM.json -index 3fbb38e3ce2676cc569dc706d74b3fc7431eb3fb..e1dec7287ce55077bfeaa1a601c7ffdea0a61008 100644 +index 25711ac1aa269d7e0231a6169be1bc495f2c8dc0..bcb4d83e58a51458de6e070ef7cb859ee333bdbc 100644 --- a/Source/JavaScriptCore/inspector/protocol/DOM.json +++ b/Source/JavaScriptCore/inspector/protocol/DOM.json @@ -80,6 +80,16 @@ @@ -411,7 +411,7 @@ index 3fbb38e3ce2676cc569dc706d74b3fc7431eb3fb..e1dec7287ce55077bfeaa1a601c7ffde { "id": "EventListener", "type": "object", -@@ -717,7 +727,10 @@ +@@ -745,7 +755,10 @@ "description": "Resolves JavaScript node object for given node id.", "targetTypes": ["page"], "parameters": [ @@ -423,7 +423,7 @@ index 3fbb38e3ce2676cc569dc706d74b3fc7431eb3fb..e1dec7287ce55077bfeaa1a601c7ffde { "name": "objectGroup", "type": "string", "optional": true, "description": "Symbolic group name that can be used to release multiple objects." } ], "returns": [ -@@ -794,6 +807,46 @@ +@@ -822,6 +835,46 @@ "returns": [ { "name": "mediaStats", "$ref": "MediaStats", "description": "An interleaved array of node attribute names and values." } ] @@ -1720,13 +1720,13 @@ index 0c5c8e689bdddec766f9de5bffd4444a5e068d77..330dd1f585e530722178c65c883641a2 // FIXME: Set WEBRTC_USE_BUILTIN_ISAC_FIX and WEBRTC_USE_BUILTIN_ISAC_FLOAT for iOS and Mac diff --git a/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.exp b/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.exp -index f7995f8f8b7af9fb6b28fe81b371a16700549cdf..c372447fbe21912803997876f95b5ca263cb47b5 100644 +index 13c5b5ea562fe808a3251c3ae789f8106632cd25..36b77e7d6bc78ba2e982cad5a2b4792775d3280d 100644 --- a/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.exp +++ b/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.exp -@@ -425,3 +425,16 @@ __ZN6webrtc21SdpSerializeCandidateERKN7cricket9CandidateE - __ZNK6webrtc18VideoFrameMetadata8GetCsrcsEv - __ZN6webrtc15CloneAudioFrameEPNS_32TransformableAudioFrameInterfaceE - __ZN6webrtc15CloneVideoFrameEPNS_32TransformableVideoFrameInterfaceE +@@ -434,3 +434,16 @@ __ZN6webrtc18VideoFrameMetadata7SetSsrcEj + __ZN6webrtc18VideoFrameMetadata8SetCsrcsENSt3__16vectorIjNS1_9allocatorIjEEEE + __ZN6webrtc18VideoFrameMetadata8SetWidthEt + __ZN6webrtc18VideoFrameMetadata9SetHeightEt +__ZN8mkvmuxer11SegmentInfo4InitEv +__ZN8mkvmuxer9MkvWriterC1EP7__sFILE +_ARGBToI420 @@ -1910,10 +1910,10 @@ index 525cfcb862ae96bf8573d00b67dc9e5e23c10d22..f2debc0444cb8f5b80a0e99a2214bcea #endif diff --git a/Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml b/Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml -index e6e1af5d1973c991229948e0b1eb0d5c456f846f..7fb6e2455bd489c5b5f9f2169fea5a2f9865bf91 100644 +index 3437d1ccf6e9a78bb9a42158e54ba99f4d9d25f9..b67f7d77bdf4090ec9c29abd221562cd7bf5a80f 100644 --- a/Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml +++ b/Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml -@@ -602,6 +602,7 @@ ApplePayEnabled: +@@ -588,6 +588,7 @@ ApplePayEnabled: richJavaScript: true # FIXME: This is on by default in WebKit2 PLATFORM(COCOA). Perhaps we should consider turning it on for WebKitLegacy as well. @@ -1921,16 +1921,16 @@ index e6e1af5d1973c991229948e0b1eb0d5c456f846f..7fb6e2455bd489c5b5f9f2169fea5a2f AsyncClipboardAPIEnabled: type: bool status: mature -@@ -612,7 +613,7 @@ AsyncClipboardAPIEnabled: +@@ -598,7 +599,7 @@ AsyncClipboardAPIEnabled: default: false WebKit: - "PLATFORM(COCOA) || PLATFORM(GTK)" : true + "PLATFORM(COCOA) || PLATFORM(GTK) || PLATFORM(WPE)" : true - default: false + default: true WebCore: default: false -@@ -871,13 +872,10 @@ BlobFileAccessEnforcementEnabled: +@@ -857,13 +858,10 @@ BlobFileAccessEnforcementEnabled: sharedPreferenceForWebProcess: true defaultValue: WebKitLegacy: @@ -1943,8 +1943,8 @@ index e6e1af5d1973c991229948e0b1eb0d5c456f846f..7fb6e2455bd489c5b5f9f2169fea5a2f - "PLATFORM(COCOA)": true default: false - BlobRegistryTopOriginPartitioningEnabled: -@@ -2312,6 +2310,7 @@ CrossOriginEmbedderPolicyEnabled: + BlockFontServiceInWebContentSandbox: +@@ -2143,6 +2141,7 @@ CrossOriginEmbedderPolicyEnabled: WebCore: default: false @@ -1952,16 +1952,7 @@ index e6e1af5d1973c991229948e0b1eb0d5c456f846f..7fb6e2455bd489c5b5f9f2169fea5a2f CrossOriginOpenerPolicyEnabled: type: bool status: stable -@@ -2352,7 +2351,7 @@ CustomPasteboardDataEnabled: - WebKitLegacy: - default: false - WebKit: -- "PLATFORM(COCOA) || PLATFORM(GTK) || PLATFORM(WIN)": true -+ "PLATFORM(COCOA) || PLATFORM(GTK) || PLATFORM(WPE) || PLATFORM(WIN)": true - default: false - - DOMAudioSessionEnabled: -@@ -2385,6 +2384,7 @@ DOMAudioSessionFullEnabled: +@@ -2216,6 +2215,7 @@ DOMAudioSessionFullEnabled: WebCore: default: false @@ -1969,16 +1960,16 @@ index e6e1af5d1973c991229948e0b1eb0d5c456f846f..7fb6e2455bd489c5b5f9f2169fea5a2f DOMPasteAccessRequestsEnabled: type: bool status: internal -@@ -2396,7 +2396,7 @@ DOMPasteAccessRequestsEnabled: +@@ -2227,7 +2227,7 @@ DOMPasteAccessRequestsEnabled: default: false WebKit: - "PLATFORM(IOS) || PLATFORM(MAC) || PLATFORM(GTK) || PLATFORM(VISION)": true + "PLATFORM(IOS) || PLATFORM(MAC) || PLATFORM(GTK) || PLATFORM(WPE) || PLATFORM(VISION)": true - default: false + default: true WebCore: default: false -@@ -2462,10 +2462,10 @@ DataListElementEnabled: +@@ -2293,10 +2293,10 @@ DataListElementEnabled: WebKitLegacy: default: false WebKit: @@ -1991,7 +1982,7 @@ index e6e1af5d1973c991229948e0b1eb0d5c456f846f..7fb6e2455bd489c5b5f9f2169fea5a2f default: false sharedPreferenceForWebProcess: true -@@ -2478,7 +2478,7 @@ DataTransferItemsEnabled: +@@ -2309,7 +2309,7 @@ DataTransferItemsEnabled: WebKitLegacy: default: true WebKit: @@ -2000,7 +1991,7 @@ index e6e1af5d1973c991229948e0b1eb0d5c456f846f..7fb6e2455bd489c5b5f9f2169fea5a2f default: false WebCore: default: false -@@ -2734,7 +2734,7 @@ DirectoryUploadEnabled: +@@ -2537,7 +2537,7 @@ DirectoryUploadEnabled: WebKitLegacy: default: false WebKit: @@ -2009,7 +2000,7 @@ index e6e1af5d1973c991229948e0b1eb0d5c456f846f..7fb6e2455bd489c5b5f9f2169fea5a2f default: false WebCore: default: false -@@ -3202,10 +3202,10 @@ FullScreenEnabled: +@@ -3020,10 +3020,10 @@ FullScreenEnabled: WebKitLegacy: default: false WebKit: @@ -2022,7 +2013,7 @@ index e6e1af5d1973c991229948e0b1eb0d5c456f846f..7fb6e2455bd489c5b5f9f2169fea5a2f default: false sharedPreferenceForWebProcess: true -@@ -3811,7 +3811,7 @@ InputTypeColorEnabled: +@@ -3614,7 +3614,7 @@ InputTypeColorEnabled: WebKitLegacy: default: false WebKit: @@ -2031,7 +2022,7 @@ index e6e1af5d1973c991229948e0b1eb0d5c456f846f..7fb6e2455bd489c5b5f9f2169fea5a2f default: false WebCore: default: false -@@ -3844,7 +3844,7 @@ InputTypeDateEnabled: +@@ -3647,7 +3647,7 @@ InputTypeDateEnabled: "PLATFORM(IOS_FAMILY)": true default: false WebKit: @@ -2040,7 +2031,7 @@ index e6e1af5d1973c991229948e0b1eb0d5c456f846f..7fb6e2455bd489c5b5f9f2169fea5a2f default: false WebCore: default: false -@@ -3860,7 +3860,7 @@ InputTypeDateTimeLocalEnabled: +@@ -3663,7 +3663,7 @@ InputTypeDateTimeLocalEnabled: "PLATFORM(IOS_FAMILY)": true default: false WebKit: @@ -2049,7 +2040,7 @@ index e6e1af5d1973c991229948e0b1eb0d5c456f846f..7fb6e2455bd489c5b5f9f2169fea5a2f default: false WebCore: default: false -@@ -3892,7 +3892,7 @@ InputTypeTimeEnabled: +@@ -3695,7 +3695,7 @@ InputTypeTimeEnabled: "PLATFORM(IOS_FAMILY)": true default: false WebKit: @@ -2058,7 +2049,7 @@ index e6e1af5d1973c991229948e0b1eb0d5c456f846f..7fb6e2455bd489c5b5f9f2169fea5a2f default: false WebCore: default: false -@@ -3953,6 +3953,7 @@ InspectorMaximumResourcesContentSize: +@@ -3756,6 +3756,7 @@ InspectorMaximumResourcesContentSize: "PLATFORM(WPE)": 50 default: 200 @@ -2066,7 +2057,7 @@ index e6e1af5d1973c991229948e0b1eb0d5c456f846f..7fb6e2455bd489c5b5f9f2169fea5a2f InspectorStartsAttached: type: bool status: embedder -@@ -3960,7 +3961,7 @@ InspectorStartsAttached: +@@ -3763,7 +3764,7 @@ InspectorStartsAttached: exposed: [ WebKit ] defaultValue: WebKit: @@ -2075,7 +2066,7 @@ index e6e1af5d1973c991229948e0b1eb0d5c456f846f..7fb6e2455bd489c5b5f9f2169fea5a2f InspectorSupportsShowingCertificate: type: bool -@@ -5911,7 +5912,7 @@ PermissionsAPIEnabled: +@@ -5683,7 +5684,7 @@ PermissionsAPIEnabled: WebKitLegacy: default: false WebKit: @@ -2084,7 +2075,7 @@ index e6e1af5d1973c991229948e0b1eb0d5c456f846f..7fb6e2455bd489c5b5f9f2169fea5a2f default: false WebCore: default: false -@@ -5990,6 +5991,19 @@ PitchCorrectionAlgorithm: +@@ -5762,6 +5763,19 @@ PitchCorrectionAlgorithm: WebCore: default: MediaPlayerEnums::PitchCorrectionAlgorithm::BestAllAround @@ -2104,7 +2095,7 @@ index e6e1af5d1973c991229948e0b1eb0d5c456f846f..7fb6e2455bd489c5b5f9f2169fea5a2f PointerLockOptionsEnabled: type: bool status: stable -@@ -6586,7 +6600,7 @@ ScreenOrientationAPIEnabled: +@@ -6344,7 +6358,7 @@ ScreenOrientationAPIEnabled: WebKitLegacy: default: false WebKit: @@ -2113,7 +2104,7 @@ index e6e1af5d1973c991229948e0b1eb0d5c456f846f..7fb6e2455bd489c5b5f9f2169fea5a2f WebCore: default: false sharedPreferenceForWebProcess: true -@@ -8063,6 +8077,7 @@ UseCGDisplayListsForDOMRendering: +@@ -7806,6 +7820,7 @@ UseCGDisplayListsForDOMRendering: default: true sharedPreferenceForWebProcess: true @@ -2121,7 +2112,7 @@ index e6e1af5d1973c991229948e0b1eb0d5c456f846f..7fb6e2455bd489c5b5f9f2169fea5a2f UseGPUProcessForCanvasRenderingEnabled: type: bool status: stable -@@ -8075,7 +8090,7 @@ UseGPUProcessForCanvasRenderingEnabled: +@@ -7818,7 +7833,7 @@ UseGPUProcessForCanvasRenderingEnabled: defaultValue: WebKit: "ENABLE(GPU_PROCESS_BY_DEFAULT)": true @@ -2130,7 +2121,7 @@ index e6e1af5d1973c991229948e0b1eb0d5c456f846f..7fb6e2455bd489c5b5f9f2169fea5a2f default: false UseGPUProcessForDOMRenderingEnabled: -@@ -8120,6 +8135,7 @@ UseGPUProcessForMediaEnabled: +@@ -7863,6 +7878,7 @@ UseGPUProcessForMediaEnabled: sharedPreferenceForWebProcess: true mediaPlaybackRelated: true @@ -2138,7 +2129,7 @@ index e6e1af5d1973c991229948e0b1eb0d5c456f846f..7fb6e2455bd489c5b5f9f2169fea5a2f UseGPUProcessForWebGLEnabled: type: bool status: internal -@@ -8131,7 +8147,7 @@ UseGPUProcessForWebGLEnabled: +@@ -7874,7 +7890,7 @@ UseGPUProcessForWebGLEnabled: default: false WebKit: "ENABLE(GPU_PROCESS_BY_DEFAULT) && ENABLE(GPU_PROCESS_WEBGL_BY_DEFAULT)": true @@ -2148,10 +2139,10 @@ index e6e1af5d1973c991229948e0b1eb0d5c456f846f..7fb6e2455bd489c5b5f9f2169fea5a2f WebCore: "ENABLE(GPU_PROCESS_BY_DEFAULT) && ENABLE(GPU_PROCESS_WEBGL_BY_DEFAULT)": true diff --git a/Source/WTF/wtf/PlatformEnable.h b/Source/WTF/wtf/PlatformEnable.h -index 0652dc379f7322cd7af4078cf1b6c54588565aea..51ce8260d8889c6e3dbef09bfff48177b9cf9f0a 100644 +index a36395e83c53617c2f894695846f8798fc277624..f0b8dd0fd12b4cde24975c20015cee30292abf9d 100644 --- a/Source/WTF/wtf/PlatformEnable.h +++ b/Source/WTF/wtf/PlatformEnable.h -@@ -387,7 +387,7 @@ +@@ -385,7 +385,7 @@ // ORIENTATION_EVENTS should never get enabled on Desktop, only Mobile. #if !defined(ENABLE_ORIENTATION_EVENTS) @@ -2160,7 +2151,7 @@ index 0652dc379f7322cd7af4078cf1b6c54588565aea..51ce8260d8889c6e3dbef09bfff48177 #endif #if !defined(ENABLE_OVERFLOW_SCROLLING_TOUCH) -@@ -504,7 +504,7 @@ +@@ -502,7 +502,7 @@ #endif #if !defined(ENABLE_TOUCH_EVENTS) @@ -2170,10 +2161,10 @@ index 0652dc379f7322cd7af4078cf1b6c54588565aea..51ce8260d8889c6e3dbef09bfff48177 #if !defined(ENABLE_TOUCH_ACTION_REGIONS) diff --git a/Source/WTF/wtf/PlatformEnableCocoa.h b/Source/WTF/wtf/PlatformEnableCocoa.h -index e416fc014aa5731d77f7a3a440b762a9814f6ef5..00a67ad2516627e982763f4684fb951741517817 100644 +index 8304147ff102789180b2682eb64d599791528c93..af8cb85981bda7b91edfa21b6cc321849d93b909 100644 --- a/Source/WTF/wtf/PlatformEnableCocoa.h +++ b/Source/WTF/wtf/PlatformEnableCocoa.h -@@ -817,7 +817,7 @@ +@@ -808,7 +808,7 @@ #endif #if !defined(ENABLE_SEC_ITEM_SHIM) @@ -2183,10 +2174,10 @@ index e416fc014aa5731d77f7a3a440b762a9814f6ef5..00a67ad2516627e982763f4684fb9517 #if !defined(ENABLE_SERVER_PRECONNECT) diff --git a/Source/WTF/wtf/PlatformHave.h b/Source/WTF/wtf/PlatformHave.h -index e4a8591c4a4e0d682cdf3d4232e25e6af963ba16..96a65e06d788995714bafc95bde3ad8bf21bc2e8 100644 +index 9e91a26aac61faea9634328f9a46421a4b4b7c38..b70776d97be4025435dc3c0364105cb17c429f6a 100644 --- a/Source/WTF/wtf/PlatformHave.h +++ b/Source/WTF/wtf/PlatformHave.h -@@ -1198,7 +1198,8 @@ +@@ -1189,7 +1189,8 @@ #endif #if PLATFORM(MAC) @@ -2213,7 +2204,7 @@ index 007b8fe3292f326504013be8198ae020f7aacf35..1c722c473732ffe05fdb61010fa4417e namespace Unicode { diff --git a/Source/WebCore/DerivedSources.make b/Source/WebCore/DerivedSources.make -index d0e3444bd9699dfe2bc1c85dde2ad5543d71b0df..b624441883bfa4ea04ee22fef2c38ad0daabe479 100644 +index 0f0341624503ae9744b71d3675dc96545371456a..cc73c79374f07fbf1f83e7075e53a3d99da0705c 100644 --- a/Source/WebCore/DerivedSources.make +++ b/Source/WebCore/DerivedSources.make @@ -1229,6 +1229,10 @@ JS_BINDING_IDLS := \ @@ -2238,10 +2229,10 @@ index d0e3444bd9699dfe2bc1c85dde2ad5543d71b0df..b624441883bfa4ea04ee22fef2c38ad0 vpath %.in $(WEBKITADDITIONS_HEADER_SEARCH_PATHS) diff --git a/Source/WebCore/Modules/geolocation/Geolocation.cpp b/Source/WebCore/Modules/geolocation/Geolocation.cpp -index 05091a46212f00333ed97939a6ec18d8656657e9..3fb779a3eba806cf416d0dd7586be871d4782651 100644 +index 7d0ca9a308e7aeaf132dccfddeae129fc8c9e093..0eeac0eec23fbc8c3df6c56d63603acc46e8590c 100644 --- a/Source/WebCore/Modules/geolocation/Geolocation.cpp +++ b/Source/WebCore/Modules/geolocation/Geolocation.cpp -@@ -361,8 +361,9 @@ bool Geolocation::shouldBlockGeolocationRequests() +@@ -362,8 +362,9 @@ bool Geolocation::shouldBlockGeolocationRequests() bool isSecure = SecurityOrigin::isSecure(document->url()) || document->isSecureContext(); bool hasMixedContent = !document->foundMixedContent().isEmpty(); bool isLocalOrigin = securityOrigin()->isLocal(); @@ -2288,19 +2279,6 @@ index b2b0391c120d527a9ab4bc6daf8bff7ea5d03cf7..d490a95f89f21536fce4f403b8639916 ASSERT(isMainThread()); [self sendSpeechEndIfNeeded]; -diff --git a/Source/WebCore/PlatformWPE.cmake b/Source/WebCore/PlatformWPE.cmake -index 7bbcd501126a7b83986f5d1f5a077779441dc1fe..13e68ac853603d8e7da1b42f5c8073ebdab83264 100644 ---- a/Source/WebCore/PlatformWPE.cmake -+++ b/Source/WebCore/PlatformWPE.cmake -@@ -60,6 +60,8 @@ list(APPEND WebCore_PRIVATE_FRAMEWORK_HEADERS - platform/graphics/gbm/PlatformDisplayGBM.h - - platform/graphics/libwpe/PlatformDisplayLibWPE.h -+ -+ platform/wpe/SelectionData.h - ) - - set(WebCore_USER_AGENT_SCRIPTS_DEPENDENCIES ${WEBCORE_DIR}/platform/wpe/RenderThemeWPE.cpp) diff --git a/Source/WebCore/SourcesCocoa.txt b/Source/WebCore/SourcesCocoa.txt index 06a9accfc8e6c46493733663b5d76b07fc80db22..4946d012d166c84b25d4d954266c4dc528f7d8ad 100644 --- a/Source/WebCore/SourcesCocoa.txt @@ -2316,7 +2294,7 @@ index 06a9accfc8e6c46493733663b5d76b07fc80db22..4946d012d166c84b25d4d954266c4dc5 +JSTouchList.cpp +// Playwright end diff --git a/Source/WebCore/SourcesGTK.txt b/Source/WebCore/SourcesGTK.txt -index 9cc9f51e48b3058ea29da389629c021bcf05e202..978ac405073534ba6fa79f483d885643a4722fd8 100644 +index 2b22eb2071e32741cb1383601466e537dca917f2..4da3cb8c1f1247bbc9886b060cd2d53047ca6572 100644 --- a/Source/WebCore/SourcesGTK.txt +++ b/Source/WebCore/SourcesGTK.txt @@ -112,3 +112,10 @@ platform/unix/LoggingUnix.cpp @@ -2331,10 +2309,10 @@ index 9cc9f51e48b3058ea29da389629c021bcf05e202..978ac405073534ba6fa79f483d885643 +JSSpeechSynthesisEventInit.cpp +// Playwright: end. diff --git a/Source/WebCore/SourcesWPE.txt b/Source/WebCore/SourcesWPE.txt -index 5fd26e859ef215fccd597ca475a320abcad83b98..f422c4023eb1c9f101d989ce56e4b4b42e203c83 100644 +index ce3cf51287e5891289bd23580084b8137ee4276b..c46e4e0c6faaca888e3ea62afd0e16d6f4cfda35 100644 --- a/Source/WebCore/SourcesWPE.txt +++ b/Source/WebCore/SourcesWPE.txt -@@ -46,6 +46,8 @@ editing/libwpe/EditorLibWPE.cpp +@@ -48,6 +48,8 @@ editing/glib/WebContentReaderGLib.cpp loader/soup/ResourceLoaderSoup.cpp @@ -2343,18 +2321,14 @@ index 5fd26e859ef215fccd597ca475a320abcad83b98..f422c4023eb1c9f101d989ce56e4b4b4 page/linux/ResourceUsageOverlayLinux.cpp page/linux/ResourceUsageThreadLinux.cpp -@@ -91,6 +93,17 @@ platform/android/SharedMemoryAndroid.cpp - platform/unix/LoggingUnix.cpp - platform/unix/SharedMemoryUnix.cpp - -+platform/wpe/DragDataWPE.cpp -+platform/wpe/DragImageWPE.cpp +@@ -97,3 +99,13 @@ platform/wpe/PasteboardWPE.cpp platform/wpe/PlatformScreenWPE.cpp platform/xdg/MIMETypeRegistryXdg.cpp + +// Playwright: begin. -+platform/wpe/SelectionData.cpp ++platform/wpe/DragDataWPE.cpp ++platform/wpe/DragImageWPE.cpp + +JSSpeechSynthesisErrorCode.cpp +JSSpeechSynthesisErrorEvent.cpp @@ -2362,10 +2336,10 @@ index 5fd26e859ef215fccd597ca475a320abcad83b98..f422c4023eb1c9f101d989ce56e4b4b4 +JSSpeechSynthesisEventInit.cpp +// Playwright: end. diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj -index 656e474f969c44c344c87d53aca6981071b39ef5..c8cf5ab6da2a5d2a2c2a723e52a32e2bee261846 100644 +index e522afd2d6f038d2a2c9804313d1d8e75c63e914..03f521d898bd7d80a94e7e3c0fc4c904d279a0ba 100644 --- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj +++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj -@@ -6432,6 +6432,13 @@ +@@ -6452,6 +6452,13 @@ EE0C7E042CE845CB0043DAF8 /* CSSPositionTryRule.h in Headers */ = {isa = PBXBuildFile; fileRef = EE0C7E002CE845CB0043DAF8 /* CSSPositionTryRule.h */; }; EE0D3C492D2F4B4C00072978 /* StageModeOperations.h in Headers */ = {isa = PBXBuildFile; fileRef = EE0D3C482D2F4AE600072978 /* StageModeOperations.h */; settings = {ATTRIBUTES = (Private, ); }; }; EFCC6C8F20FE914400A2321B /* CanvasActivityRecord.h in Headers */ = {isa = PBXBuildFile; fileRef = EFCC6C8D20FE914000A2321B /* CanvasActivityRecord.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -2379,7 +2353,7 @@ index 656e474f969c44c344c87d53aca6981071b39ef5..c8cf5ab6da2a5d2a2c2a723e52a32e2b F12171F616A8CF0B000053CA /* WebVTTElement.h in Headers */ = {isa = PBXBuildFile; fileRef = F12171F416A8BC63000053CA /* WebVTTElement.h */; }; F32BDCD92363AACA0073B6AE /* UserGestureEmulationScope.h in Headers */ = {isa = PBXBuildFile; fileRef = F32BDCD72363AACA0073B6AE /* UserGestureEmulationScope.h */; }; F344C7141125B82C00F26EEE /* InspectorFrontendClient.h in Headers */ = {isa = PBXBuildFile; fileRef = F344C7121125B82C00F26EEE /* InspectorFrontendClient.h */; settings = {ATTRIBUTES = (Private, ); }; }; -@@ -21095,6 +21102,14 @@ +@@ -21141,6 +21148,14 @@ EE7A169F2C607BFA0057B563 /* StartViewTransitionOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = StartViewTransitionOptions.h; sourceTree = ""; }; EFB7287B2124C73D005C2558 /* CanvasActivityRecord.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CanvasActivityRecord.cpp; sourceTree = ""; }; EFCC6C8D20FE914000A2321B /* CanvasActivityRecord.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CanvasActivityRecord.h; sourceTree = ""; }; @@ -2394,7 +2368,7 @@ index 656e474f969c44c344c87d53aca6981071b39ef5..c8cf5ab6da2a5d2a2c2a723e52a32e2b F12171F316A8BC63000053CA /* WebVTTElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebVTTElement.cpp; sourceTree = ""; }; F12171F416A8BC63000053CA /* WebVTTElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebVTTElement.h; sourceTree = ""; }; F32BDCD52363AAC90073B6AE /* UserGestureEmulationScope.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UserGestureEmulationScope.cpp; sourceTree = ""; }; -@@ -28876,6 +28891,11 @@ +@@ -28928,6 +28943,11 @@ BC4A5324256055590028C592 /* TextDirectionSubmenuInclusionBehavior.h */, 2D4F96F11A1ECC240098BF88 /* TextIndicator.cpp */, 2D4F96F21A1ECC240098BF88 /* TextIndicator.h */, @@ -2406,7 +2380,7 @@ index 656e474f969c44c344c87d53aca6981071b39ef5..c8cf5ab6da2a5d2a2c2a723e52a32e2b F48570A42644C76D00C05F71 /* TranslationContextMenuInfo.h */, F4E1965F21F26E4E00285078 /* UndoItem.cpp */, 2ECDBAD521D8906300F00ECD /* UndoItem.h */, -@@ -35855,6 +35875,8 @@ +@@ -35916,6 +35936,8 @@ 29E4D8DF16B0940F00C84704 /* PlatformSpeechSynthesizer.h */, 1AD8F81A11CAB9E900E93E54 /* PlatformStrategies.cpp */, 1AD8F81911CAB9E900E93E54 /* PlatformStrategies.h */, @@ -2415,7 +2389,7 @@ index 656e474f969c44c344c87d53aca6981071b39ef5..c8cf5ab6da2a5d2a2c2a723e52a32e2b FE3DC9932D0C063C0021B6FC /* PlatformTZoneImpls.cpp */, 0FD7C21D23CE41E30096D102 /* PlatformWheelEvent.cpp */, 935C476A09AC4D4F00A6AAB4 /* PlatformWheelEvent.h */, -@@ -38674,6 +38696,7 @@ +@@ -38777,6 +38799,7 @@ AD6E71AB1668899D00320C13 /* DocumentSharedObjectPool.h */, 6BDB5DC1227BD3B800919770 /* DocumentStorageAccess.cpp */, 6BDB5DC0227BD3B800919770 /* DocumentStorageAccess.h */, @@ -2423,7 +2397,7 @@ index 656e474f969c44c344c87d53aca6981071b39ef5..c8cf5ab6da2a5d2a2c2a723e52a32e2b 7CE7FA5B1EF882300060C9D6 /* DocumentTouch.cpp */, 7CE7FA591EF882300060C9D6 /* DocumentTouch.h */, A8185F3209765765005826D9 /* DocumentType.cpp */, -@@ -43613,6 +43636,8 @@ +@@ -43729,6 +43752,8 @@ F4E90A3C2B52038E002DA469 /* PlatformTextAlternatives.h in Headers */, 0F7D07331884C56C00B4AF86 /* PlatformTextTrack.h in Headers */, 074E82BB18A69F0E007EF54C /* PlatformTimeRanges.h in Headers */, @@ -2432,7 +2406,7 @@ index 656e474f969c44c344c87d53aca6981071b39ef5..c8cf5ab6da2a5d2a2c2a723e52a32e2b CDD08ABD277E542600EA3755 /* PlatformTrackConfiguration.h in Headers */, CD1F9B022700323D00617EB6 /* PlatformVideoColorPrimaries.h in Headers */, CD1F9B01270020B700617EB6 /* PlatformVideoColorSpace.h in Headers */, -@@ -44969,6 +44994,7 @@ +@@ -45097,6 +45122,7 @@ 0F54DD081881D5F5003EEDBB /* Touch.h in Headers */, 71B7EE0D21B5C6870031C1EF /* TouchAction.h in Headers */, 0F54DD091881D5F5003EEDBB /* TouchEvent.h in Headers */, @@ -2440,7 +2414,7 @@ index 656e474f969c44c344c87d53aca6981071b39ef5..c8cf5ab6da2a5d2a2c2a723e52a32e2b 0F54DD0A1881D5F5003EEDBB /* TouchList.h in Headers */, 070334D71459FFD5008D8D45 /* TrackBase.h in Headers */, BE88E0C21715CE2600658D98 /* TrackListBase.h in Headers */, -@@ -46169,6 +46195,8 @@ +@@ -46300,6 +46326,8 @@ 2D22830323A8470700364B7E /* CursorMac.mm in Sources */, 5CBD59592280E926002B22AA /* CustomHeaderFields.cpp in Sources */, 07E4BDBF2A3A5FAB000D5509 /* DictationCaretAnimator.cpp in Sources */, @@ -2449,7 +2423,7 @@ index 656e474f969c44c344c87d53aca6981071b39ef5..c8cf5ab6da2a5d2a2c2a723e52a32e2b 7CE6CBFD187F394900D46BF5 /* FormatConverter.cpp in Sources */, 4667EA3E2968D9DA00BAB1E2 /* GameControllerHapticEffect.mm in Sources */, 46FE73D32968E52000B8064C /* GameControllerHapticEngines.mm in Sources */, -@@ -46260,6 +46288,9 @@ +@@ -46390,6 +46418,9 @@ CE88EE262414467B007F29C2 /* TextAlternativeWithRange.mm in Sources */, BE39137129B267F500FA5D4F /* TextTransformCocoa.cpp in Sources */, 51DF6D800B92A18E00C2DC85 /* ThreadCheck.mm in Sources */, @@ -2460,10 +2434,10 @@ index 656e474f969c44c344c87d53aca6981071b39ef5..c8cf5ab6da2a5d2a2c2a723e52a32e2b 538EC8021F96AF81004D22A8 /* UnifiedSource1.cpp in Sources */, 538EC8051F96AF81004D22A8 /* UnifiedSource2-mm.mm in Sources */, diff --git a/Source/WebCore/accessibility/AccessibilityObject.cpp b/Source/WebCore/accessibility/AccessibilityObject.cpp -index a38a54553f430b96fa7744a442676d6136f5eda9..4ff2eaeab053a186e5e6bacab94a6b3b129eb7ab 100644 +index 3f19caf891dfa1cc70aa630f4e82c405825ab40c..62b2978c8d5e8af5e337d8b27c1d2ad938b773fe 100644 --- a/Source/WebCore/accessibility/AccessibilityObject.cpp +++ b/Source/WebCore/accessibility/AccessibilityObject.cpp -@@ -71,6 +71,7 @@ +@@ -72,6 +72,7 @@ #include "HTMLTableSectionElement.h" #include "HTMLTextAreaElement.h" #include "HitTestResult.h" @@ -2471,7 +2445,7 @@ index a38a54553f430b96fa7744a442676d6136f5eda9..4ff2eaeab053a186e5e6bacab94a6b3b #include "LocalFrame.h" #include "LocalizedStrings.h" #include "MathMLNames.h" -@@ -3910,7 +3911,12 @@ AccessibilityObjectInclusion AccessibilityObject::defaultObjectInclusion() const +@@ -3931,7 +3932,12 @@ AccessibilityObjectInclusion AccessibilityObject::defaultObjectInclusion() const if (roleValue() == AccessibilityRole::ApplicationDialog) return AccessibilityObjectInclusion::IncludeObject; @@ -2486,10 +2460,10 @@ index a38a54553f430b96fa7744a442676d6136f5eda9..4ff2eaeab053a186e5e6bacab94a6b3b bool AccessibilityObject::isWithinHiddenWebArea() const diff --git a/Source/WebCore/bindings/js/WebCoreBuiltinNames.h b/Source/WebCore/bindings/js/WebCoreBuiltinNames.h -index a9d9ee8f0cb26fd47f9fea85e0856d2849362e6c..e2c58e571f41da4f65388fd36a9de56c92a404a8 100644 +index 158dc6af1464896ac4c4727c52581729ac132352..b8bd22a7d80d08d6dd56ea1bc10addbe3f839b6d 100644 --- a/Source/WebCore/bindings/js/WebCoreBuiltinNames.h +++ b/Source/WebCore/bindings/js/WebCoreBuiltinNames.h -@@ -189,6 +189,8 @@ namespace WebCore { +@@ -190,6 +190,8 @@ namespace WebCore { macro(DelayNode) \ macro(DeprecationReportBody) \ macro(DigitalCredential) \ @@ -2619,10 +2593,10 @@ index 9b344003de17b96d8b9ca8c7f32143a27543b1ea..2208a3f2b7d930bcd291e65b474d4c30 ] partial interface Element { // Returns Promise if PointerLockOptionsEnabled Runtime Flag is set, otherwise returns undefined. diff --git a/Source/WebCore/dom/PointerEvent.cpp b/Source/WebCore/dom/PointerEvent.cpp -index e0a0916f197cd80b728b89f95fb240374acdb78a..54eb987c3b53784263de9bdc2ee05c6ca8d68f53 100644 +index 6b0390aba75731707ce48ea206b87974ffb15857..8c634c0748f0d447476d460ee2800f82d232d7ff 100644 --- a/Source/WebCore/dom/PointerEvent.cpp +++ b/Source/WebCore/dom/PointerEvent.cpp -@@ -28,9 +28,12 @@ +@@ -28,10 +28,13 @@ #include "EventNames.h" #include "MouseEventTypes.h" @@ -2630,12 +2604,13 @@ index e0a0916f197cd80b728b89f95fb240374acdb78a..54eb987c3b53784263de9bdc2ee05c6c #include "Node.h" +#include "PlatformTouchEvent.h" #include "PointerEventTypeNames.h" + #include #include +#include namespace WebCore { -@@ -292,4 +295,59 @@ void PointerEvent::receivedTarget() +@@ -293,4 +296,59 @@ void PointerEvent::receivedTarget() predictedEvent->setTarget(this->target()); } @@ -2727,18 +2702,18 @@ index b034595d01bb63f3d72183c427fcc14695339ae2..1886e4bbba04c6177fad1562c891f2ae #endif diff --git a/Source/WebCore/editing/libwpe/EditorLibWPE.cpp b/Source/WebCore/editing/libwpe/EditorLibWPE.cpp -index 7813532cc52d582c42aebc979a1ecd1137765f08..c01cbd53ad2430a6ffab9a80fc73e74a8523800a 100644 +index d0a3d5c048647b07772e1581c76c4eb60ecf41b0..bec324636991079264e620c0dfdaf9842ff585cd 100644 --- a/Source/WebCore/editing/libwpe/EditorLibWPE.cpp +++ b/Source/WebCore/editing/libwpe/EditorLibWPE.cpp -@@ -34,6 +34,7 @@ - #include "NotImplemented.h" +@@ -35,6 +35,7 @@ #include "Pasteboard.h" #include "Settings.h" + #include "SimpleRange.h" +#include "WebContentReader.h" #include "markup.h" namespace WebCore { -@@ -99,6 +100,14 @@ void Editor::platformPasteFont() +@@ -100,6 +101,14 @@ void Editor::platformPasteFont() { } @@ -2754,10 +2729,10 @@ index 7813532cc52d582c42aebc979a1ecd1137765f08..c01cbd53ad2430a6ffab9a80fc73e74a #endif // USE(LIBWPE) diff --git a/Source/WebCore/html/FileInputType.cpp b/Source/WebCore/html/FileInputType.cpp -index 75de5d5611953b830cf07d940ca1eedb789d2a9c..6adabe7a8250e02bc6b1e9fa28b0575d6a5e4dd7 100644 +index d5234a678a77e24ce0a95fe08740416ab8acbadb..c9a42fd354e88c5a8c3ee53974442ec9d4cb1224 100644 --- a/Source/WebCore/html/FileInputType.cpp +++ b/Source/WebCore/html/FileInputType.cpp -@@ -37,6 +37,7 @@ +@@ -38,6 +38,7 @@ #include "HTMLNames.h" #include "Icon.h" #include "InputTypeNames.h" @@ -2765,7 +2740,7 @@ index 75de5d5611953b830cf07d940ca1eedb789d2a9c..6adabe7a8250e02bc6b1e9fa28b0575d #include "LocalFrame.h" #include "LocalizedStrings.h" #include "MIMETypeRegistry.h" -@@ -160,6 +161,11 @@ void FileInputType::handleDOMActivateEvent(Event& event) +@@ -161,6 +162,11 @@ void FileInputType::handleDOMActivateEvent(Event& event) if (protectedElement()->isDisabledFormControl()) return; @@ -2778,10 +2753,10 @@ index 75de5d5611953b830cf07d940ca1eedb789d2a9c..6adabe7a8250e02bc6b1e9fa28b0575d return; diff --git a/Source/WebCore/inspector/InspectorController.cpp b/Source/WebCore/inspector/InspectorController.cpp -index dac15af852ff335ffba6b4bff717682a99b52b48..29bceeebb5a3e1c6c5d9d782dd62530d75b57d9a 100644 +index 48efc5356601313e907846283f753e44d6a0f983..f153fd7da52da98d033e4070d79c64d4a38ff197 100644 --- a/Source/WebCore/inspector/InspectorController.cpp +++ b/Source/WebCore/inspector/InspectorController.cpp -@@ -295,6 +295,8 @@ void InspectorController::disconnectFrontend(FrontendChannel& frontendChannel) +@@ -296,6 +296,8 @@ void InspectorController::disconnectFrontend(FrontendChannel& frontendChannel) // Unplug all instrumentations since they aren't needed now. InspectorInstrumentation::unregisterInstrumentingAgents(m_instrumentingAgents.get()); @@ -2790,7 +2765,7 @@ index dac15af852ff335ffba6b4bff717682a99b52b48..29bceeebb5a3e1c6c5d9d782dd62530d } m_inspectorClient->frontendCountChanged(m_frontendRouter->frontendCount()); -@@ -314,6 +316,8 @@ void InspectorController::disconnectAllFrontends() +@@ -315,6 +317,8 @@ void InspectorController::disconnectAllFrontends() // The frontend should call setInspectorFrontendClient(nullptr) under closeWindow(). ASSERT(!m_inspectorFrontendClient); @@ -2799,7 +2774,7 @@ index dac15af852ff335ffba6b4bff717682a99b52b48..29bceeebb5a3e1c6c5d9d782dd62530d if (!m_frontendRouter->hasFrontends()) return; -@@ -397,8 +401,8 @@ void InspectorController::inspect(Node* node) +@@ -398,8 +402,8 @@ void InspectorController::inspect(Node* node) if (!enabled()) return; @@ -2810,7 +2785,7 @@ index dac15af852ff335ffba6b4bff717682a99b52b48..29bceeebb5a3e1c6c5d9d782dd62530d ensureDOMAgent().inspect(node); } -@@ -541,4 +545,34 @@ void InspectorController::didComposite(LocalFrame& frame) +@@ -542,4 +546,34 @@ void InspectorController::didComposite(LocalFrame& frame) InspectorInstrumentation::didComposite(frame); } @@ -2879,7 +2854,7 @@ index 4f5c1e836876710a554455ec53733f72db63de58..774c4a66af84664a7a83ba0790d147f7 } // namespace WebCore diff --git a/Source/WebCore/inspector/InspectorInstrumentation.cpp b/Source/WebCore/inspector/InspectorInstrumentation.cpp -index 3d97cbaf887e52fe5c269cd4bc8cf750de41ddcb..46dc1872991560e41cff9c8b1ede2b73708c3736 100644 +index 1c660f381ad7e9a9201aeced2906f39135e810f6..6c47abc2f32b39fd5c0bf9048b9c1224959ba08c 100644 --- a/Source/WebCore/inspector/InspectorInstrumentation.cpp +++ b/Source/WebCore/inspector/InspectorInstrumentation.cpp @@ -595,6 +595,12 @@ void InspectorInstrumentation::applyUserAgentOverrideImpl(InstrumentingAgents& i @@ -3049,7 +3024,7 @@ index 3d97cbaf887e52fe5c269cd4bc8cf750de41ddcb..46dc1872991560e41cff9c8b1ede2b73 { // Using RefPtr makes us hit the m_inRemovedLastRefFunction assert. diff --git a/Source/WebCore/inspector/InspectorInstrumentation.h b/Source/WebCore/inspector/InspectorInstrumentation.h -index 0fb5a57841daca73bbc452b6bbe97d8bbb25500e..7aac51c58d0fc3640fcaf7f9cdf0776367020f9e 100644 +index ed15dcc0dd1eb8d22dc48d8c6515b2258db574c5..c297c2d0e61b8ca1f881bb7942c463626bf0118f 100644 --- a/Source/WebCore/inspector/InspectorInstrumentation.h +++ b/Source/WebCore/inspector/InspectorInstrumentation.h @@ -31,6 +31,7 @@ @@ -3060,7 +3035,7 @@ index 0fb5a57841daca73bbc452b6bbe97d8bbb25500e..7aac51c58d0fc3640fcaf7f9cdf07763 #include "CSSSelector.h" #include "CanvasBase.h" #include "CanvasRenderingContext.h" -@@ -44,6 +45,7 @@ +@@ -45,6 +46,7 @@ #include "LocalFrame.h" #include "LocalFrameView.h" #include "Page.h" @@ -3068,7 +3043,7 @@ index 0fb5a57841daca73bbc452b6bbe97d8bbb25500e..7aac51c58d0fc3640fcaf7f9cdf07763 #include "ResourceLoader.h" #include "ResourceLoaderIdentifier.h" #include "StorageArea.h" -@@ -77,6 +79,7 @@ class DOMWrapperWorld; +@@ -78,6 +80,7 @@ class DOMWrapperWorld; class Document; class DocumentLoader; class EventListener; @@ -3076,7 +3051,7 @@ index 0fb5a57841daca73bbc452b6bbe97d8bbb25500e..7aac51c58d0fc3640fcaf7f9cdf07763 class HTTPHeaderMap; class InspectorTimelineAgent; class InstrumentingAgents; -@@ -196,6 +199,7 @@ public: +@@ -197,6 +200,7 @@ public: static void didRecalculateStyle(Document&); static void didScheduleStyleRecalculation(Document&); static void applyUserAgentOverride(LocalFrame&, String&); @@ -3084,7 +3059,7 @@ index 0fb5a57841daca73bbc452b6bbe97d8bbb25500e..7aac51c58d0fc3640fcaf7f9cdf07763 static void applyEmulatedMedia(LocalFrame&, AtomString&); static void flexibleBoxRendererBeganLayout(const RenderObject&); -@@ -208,6 +212,7 @@ public: +@@ -209,6 +213,7 @@ public: static void didReceiveData(LocalFrame*, ResourceLoaderIdentifier, const SharedBuffer*, int encodedDataLength); static void didFinishLoading(LocalFrame*, DocumentLoader*, ResourceLoaderIdentifier, const NetworkLoadMetrics&, ResourceLoader*); static void didFailLoading(LocalFrame*, DocumentLoader*, ResourceLoaderIdentifier, const ResourceError&); @@ -3092,7 +3067,7 @@ index 0fb5a57841daca73bbc452b6bbe97d8bbb25500e..7aac51c58d0fc3640fcaf7f9cdf07763 static void willSendRequest(ServiceWorkerGlobalScope&, ResourceLoaderIdentifier, ResourceRequest&); static void didReceiveResourceResponse(ServiceWorkerGlobalScope&, ResourceLoaderIdentifier, const ResourceResponse&); -@@ -234,13 +239,13 @@ public: +@@ -235,13 +240,13 @@ public: static void frameDetachedFromParent(LocalFrame&); static void didCommitLoad(LocalFrame&, DocumentLoader*); static void frameDocumentUpdated(LocalFrame&); @@ -3108,7 +3083,7 @@ index 0fb5a57841daca73bbc452b6bbe97d8bbb25500e..7aac51c58d0fc3640fcaf7f9cdf07763 #if ENABLE(DARK_MODE_CSS) static void defaultAppearanceDidChange(Page&); #endif -@@ -251,6 +256,7 @@ public: +@@ -252,6 +257,7 @@ public: static bool shouldInterceptResponse(const LocalFrame&, const ResourceResponse&); static void interceptRequest(ResourceLoader&, Function&&); static void interceptResponse(const LocalFrame&, const ResourceResponse&, ResourceLoaderIdentifier, CompletionHandler)>&&); @@ -3116,15 +3091,15 @@ index 0fb5a57841daca73bbc452b6bbe97d8bbb25500e..7aac51c58d0fc3640fcaf7f9cdf07763 static void addMessageToConsole(Page&, std::unique_ptr); static void addMessageToConsole(WorkerOrWorkletGlobalScope&, std::unique_ptr); -@@ -272,6 +278,7 @@ public: - static void stopProfiling(Page&, const String& title); +@@ -277,6 +283,7 @@ public: + static void stopProfiling(WorkerOrWorkletGlobalScope&, const String& title); static void consoleStartRecordingCanvas(CanvasRenderingContext&, JSC::JSGlobalObject&, JSC::JSObject* options); static void consoleStopRecordingCanvas(CanvasRenderingContext&); + static void bindingCalled(Page& , JSC::JSGlobalObject*, const String& name, const String& arg); static void performanceMark(ScriptExecutionContext&, const String&, std::optional); -@@ -325,6 +332,12 @@ public: +@@ -330,6 +337,12 @@ public: static void layerTreeDidChange(Page*); static void renderLayerDestroyed(Page*, const RenderLayer&); @@ -3137,7 +3112,7 @@ index 0fb5a57841daca73bbc452b6bbe97d8bbb25500e..7aac51c58d0fc3640fcaf7f9cdf07763 static void frontendCreated(); static void frontendDeleted(); static bool hasFrontends() { return InspectorInstrumentationPublic::hasFrontends(); } -@@ -341,6 +354,8 @@ public: +@@ -346,6 +359,8 @@ public: static void registerInstrumentingAgents(InstrumentingAgents&); static void unregisterInstrumentingAgents(InstrumentingAgents&); @@ -3146,7 +3121,7 @@ index 0fb5a57841daca73bbc452b6bbe97d8bbb25500e..7aac51c58d0fc3640fcaf7f9cdf07763 private: static void didClearWindowObjectInWorldImpl(InstrumentingAgents&, LocalFrame&, DOMWrapperWorld&); static bool isDebuggerPausedImpl(InstrumentingAgents&); -@@ -422,6 +437,7 @@ private: +@@ -427,6 +442,7 @@ private: static void didRecalculateStyleImpl(InstrumentingAgents&); static void didScheduleStyleRecalculationImpl(InstrumentingAgents&, Document&); static void applyUserAgentOverrideImpl(InstrumentingAgents&, String&); @@ -3154,7 +3129,7 @@ index 0fb5a57841daca73bbc452b6bbe97d8bbb25500e..7aac51c58d0fc3640fcaf7f9cdf07763 static void applyEmulatedMediaImpl(InstrumentingAgents&, AtomString&); static void flexibleBoxRendererBeganLayoutImpl(InstrumentingAgents&, const RenderObject&); -@@ -436,6 +452,7 @@ private: +@@ -441,6 +457,7 @@ private: static void didReceiveDataImpl(InstrumentingAgents&, ResourceLoaderIdentifier, const SharedBuffer*, int encodedDataLength); static void didFinishLoadingImpl(InstrumentingAgents&, ResourceLoaderIdentifier, DocumentLoader*, const NetworkLoadMetrics&, ResourceLoader*); static void didFailLoadingImpl(InstrumentingAgents&, ResourceLoaderIdentifier, DocumentLoader*, const ResourceError&); @@ -3162,7 +3137,7 @@ index 0fb5a57841daca73bbc452b6bbe97d8bbb25500e..7aac51c58d0fc3640fcaf7f9cdf07763 static void willLoadXHRSynchronouslyImpl(InstrumentingAgents&); static void didLoadXHRSynchronouslyImpl(InstrumentingAgents&); static void scriptImportedImpl(InstrumentingAgents&, ResourceLoaderIdentifier, const String& sourceString); -@@ -446,13 +463,13 @@ private: +@@ -451,13 +468,13 @@ private: static void frameDetachedFromParentImpl(InstrumentingAgents&, LocalFrame&); static void didCommitLoadImpl(InstrumentingAgents&, LocalFrame&, DocumentLoader*); static void frameDocumentUpdatedImpl(InstrumentingAgents&, LocalFrame&); @@ -3178,7 +3153,7 @@ index 0fb5a57841daca73bbc452b6bbe97d8bbb25500e..7aac51c58d0fc3640fcaf7f9cdf07763 #if ENABLE(DARK_MODE_CSS) static void defaultAppearanceDidChangeImpl(InstrumentingAgents&); #endif -@@ -463,6 +480,7 @@ private: +@@ -468,6 +485,7 @@ private: static bool shouldInterceptResponseImpl(InstrumentingAgents&, const ResourceResponse&); static void interceptRequestImpl(InstrumentingAgents&, ResourceLoader&, Function&&); static void interceptResponseImpl(InstrumentingAgents&, const ResourceResponse&, ResourceLoaderIdentifier, CompletionHandler)>&&); @@ -3186,7 +3161,7 @@ index 0fb5a57841daca73bbc452b6bbe97d8bbb25500e..7aac51c58d0fc3640fcaf7f9cdf07763 static void addMessageToConsoleImpl(InstrumentingAgents&, std::unique_ptr); -@@ -477,6 +495,7 @@ private: +@@ -482,6 +500,7 @@ private: static void stopProfilingImpl(InstrumentingAgents&, const String& title); static void consoleStartRecordingCanvasImpl(InstrumentingAgents&, CanvasRenderingContext&, JSC::JSGlobalObject&, JSC::JSObject* options); static void consoleStopRecordingCanvasImpl(InstrumentingAgents&, CanvasRenderingContext&); @@ -3194,7 +3169,7 @@ index 0fb5a57841daca73bbc452b6bbe97d8bbb25500e..7aac51c58d0fc3640fcaf7f9cdf07763 static void performanceMarkImpl(InstrumentingAgents&, const String& label, std::optional); -@@ -530,6 +549,12 @@ private: +@@ -535,6 +554,12 @@ private: static void layerTreeDidChangeImpl(InstrumentingAgents&); static void renderLayerDestroyedImpl(InstrumentingAgents&, const RenderLayer&); @@ -3207,7 +3182,7 @@ index 0fb5a57841daca73bbc452b6bbe97d8bbb25500e..7aac51c58d0fc3640fcaf7f9cdf07763 static InstrumentingAgents& instrumentingAgents(Page&); static InstrumentingAgents& instrumentingAgents(WorkerOrWorkletGlobalScope&); static InstrumentingAgents& instrumentingAgents(ServiceWorkerGlobalScope&); -@@ -1089,6 +1114,13 @@ inline void InspectorInstrumentation::applyUserAgentOverride(LocalFrame& frame, +@@ -1094,6 +1119,13 @@ inline void InspectorInstrumentation::applyUserAgentOverride(LocalFrame& frame, applyUserAgentOverrideImpl(*agents, userAgent); } @@ -3221,7 +3196,7 @@ index 0fb5a57841daca73bbc452b6bbe97d8bbb25500e..7aac51c58d0fc3640fcaf7f9cdf07763 inline void InspectorInstrumentation::applyEmulatedMedia(LocalFrame& frame, AtomString& media) { FAST_RETURN_IF_NO_FRONTENDS(void()); -@@ -1191,6 +1223,13 @@ inline void InspectorInstrumentation::didFailLoading(ServiceWorkerGlobalScope& g +@@ -1196,6 +1228,13 @@ inline void InspectorInstrumentation::didFailLoading(ServiceWorkerGlobalScope& g didFailLoadingImpl(instrumentingAgents(globalScope), identifier, nullptr, error); } @@ -3235,7 +3210,7 @@ index 0fb5a57841daca73bbc452b6bbe97d8bbb25500e..7aac51c58d0fc3640fcaf7f9cdf07763 inline void InspectorInstrumentation::continueAfterXFrameOptionsDenied(LocalFrame& frame, ResourceLoaderIdentifier identifier, DocumentLoader& loader, const ResourceResponse& response) { // Treat the same as didReceiveResponse. -@@ -1281,13 +1320,6 @@ inline void InspectorInstrumentation::frameDocumentUpdated(LocalFrame& frame) +@@ -1286,13 +1325,6 @@ inline void InspectorInstrumentation::frameDocumentUpdated(LocalFrame& frame) frameDocumentUpdatedImpl(*agents, frame); } @@ -3249,7 +3224,7 @@ index 0fb5a57841daca73bbc452b6bbe97d8bbb25500e..7aac51c58d0fc3640fcaf7f9cdf07763 inline void InspectorInstrumentation::frameStartedLoading(LocalFrame& frame) { FAST_RETURN_IF_NO_FRONTENDS(void()); -@@ -1309,11 +1341,11 @@ inline void InspectorInstrumentation::frameStoppedLoading(LocalFrame& frame) +@@ -1314,11 +1346,11 @@ inline void InspectorInstrumentation::frameStoppedLoading(LocalFrame& frame) frameStoppedLoadingImpl(*agents, frame); } @@ -3263,7 +3238,7 @@ index 0fb5a57841daca73bbc452b6bbe97d8bbb25500e..7aac51c58d0fc3640fcaf7f9cdf07763 } inline void InspectorInstrumentation::frameClearedScheduledNavigation(Frame& frame) -@@ -1329,6 +1361,13 @@ inline void InspectorInstrumentation::accessibilitySettingsDidChange(Page& page) +@@ -1334,6 +1366,13 @@ inline void InspectorInstrumentation::accessibilitySettingsDidChange(Page& page) accessibilitySettingsDidChangeImpl(instrumentingAgents(page)); } @@ -3277,7 +3252,7 @@ index 0fb5a57841daca73bbc452b6bbe97d8bbb25500e..7aac51c58d0fc3640fcaf7f9cdf07763 #if ENABLE(DARK_MODE_CSS) inline void InspectorInstrumentation::defaultAppearanceDidChange(Page& page) { -@@ -1381,6 +1420,13 @@ inline void InspectorInstrumentation::interceptResponse(const LocalFrame& frame, +@@ -1386,6 +1425,13 @@ inline void InspectorInstrumentation::interceptResponse(const LocalFrame& frame, interceptResponseImpl(*agents, response, identifier, WTFMove(handler)); } @@ -3291,7 +3266,7 @@ index 0fb5a57841daca73bbc452b6bbe97d8bbb25500e..7aac51c58d0fc3640fcaf7f9cdf07763 inline void InspectorInstrumentation::didDispatchDOMStorageEvent(Page& page, const String& key, const String& oldValue, const String& newValue, StorageType storageType, const SecurityOrigin& securityOrigin) { FAST_RETURN_IF_NO_FRONTENDS(void()); -@@ -1697,6 +1743,11 @@ inline void InspectorInstrumentation::performanceMark(ScriptExecutionContext& co +@@ -1726,6 +1772,11 @@ inline void InspectorInstrumentation::performanceMark(ScriptExecutionContext& co performanceMarkImpl(*agents, label, WTFMove(startTime)); } @@ -3303,7 +3278,7 @@ index 0fb5a57841daca73bbc452b6bbe97d8bbb25500e..7aac51c58d0fc3640fcaf7f9cdf07763 inline void InspectorInstrumentation::didRequestAnimationFrame(ScriptExecutionContext& scriptExecutionContext, int callbackId) { FAST_RETURN_IF_NO_FRONTENDS(void()); -@@ -1753,6 +1804,42 @@ inline void InspectorInstrumentation::renderLayerDestroyed(Page* page, const Ren +@@ -1782,6 +1833,42 @@ inline void InspectorInstrumentation::renderLayerDestroyed(Page* page, const Ren renderLayerDestroyedImpl(*agents, renderLayer); } @@ -3399,10 +3374,10 @@ index c028341e84e59a6b1b16107fd74feb21f70b12ab..d385418ac34e8f315f201801a2c65226 + } diff --git a/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp b/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp -index 5bd7a42c19fd11234eea0520ebf61f7f820f765e..a70339c639682820de7ff09d62e8cfd42a7d7060 100644 +index 94492280fc724f299655a5df34492f929d82c57c..af0aafa701a9c697650aad2d86ddcf6b3022dcc5 100644 --- a/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp +++ b/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp -@@ -56,6 +56,7 @@ +@@ -54,6 +54,7 @@ #include "Cookie.h" #include "CookieJar.h" #include "CustomElementRegistry.h" @@ -3410,7 +3385,7 @@ index 5bd7a42c19fd11234eea0520ebf61f7f820f765e..a70339c639682820de7ff09d62e8cfd4 #include "DOMEditor.h" #include "DOMException.h" #include "DOMPatchSupport.h" -@@ -67,9 +68,14 @@ +@@ -65,9 +66,14 @@ #include "Event.h" #include "EventListener.h" #include "EventNames.h" @@ -3425,7 +3400,7 @@ index 5bd7a42c19fd11234eea0520ebf61f7f820f765e..a70339c639682820de7ff09d62e8cfd4 #include "HTMLMediaElement.h" #include "HTMLNames.h" #include "HTMLScriptElement.h" -@@ -104,12 +110,14 @@ +@@ -102,12 +108,14 @@ #include "Pasteboard.h" #include "PseudoElement.h" #include "RenderGrid.h" @@ -3440,7 +3415,7 @@ index 5bd7a42c19fd11234eea0520ebf61f7f820f765e..a70339c639682820de7ff09d62e8cfd4 #include "StaticNodeList.h" #include "StyleProperties.h" #include "StyleResolver.h" -@@ -151,7 +159,8 @@ using namespace HTMLNames; +@@ -149,7 +157,8 @@ using namespace HTMLNames; static const size_t maxTextSize = 10000; static const UChar horizontalEllipsisUChar[] = { horizontalEllipsis, 0 }; @@ -3450,7 +3425,7 @@ index 5bd7a42c19fd11234eea0520ebf61f7f820f765e..a70339c639682820de7ff09d62e8cfd4 { if (!colorObject) return std::nullopt; -@@ -170,7 +179,7 @@ static std::optional parseColor(RefPtr&& colorObject) +@@ -168,7 +177,7 @@ static std::optional parseColor(RefPtr&& colorObject) static std::optional parseRequiredConfigColor(const String& fieldName, JSON::Object& configObject) { @@ -3459,7 +3434,7 @@ index 5bd7a42c19fd11234eea0520ebf61f7f820f765e..a70339c639682820de7ff09d62e8cfd4 } static Color parseOptionalConfigColor(const String& fieldName, JSON::Object& configObject) -@@ -197,6 +206,20 @@ static bool parseQuad(Ref&& quadArray, FloatQuad* quad) +@@ -195,6 +204,20 @@ static bool parseQuad(Ref&& quadArray, FloatQuad* quad) return true; } @@ -3480,7 +3455,7 @@ index 5bd7a42c19fd11234eea0520ebf61f7f820f765e..a70339c639682820de7ff09d62e8cfd4 class RevalidateStyleAttributeTask final : public CanMakeCheckedPtr { WTF_MAKE_TZONE_ALLOCATED(RevalidateStyleAttributeTask); WTF_OVERRIDE_DELETE_FOR_CHECKED_PTR(RevalidateStyleAttributeTask); -@@ -477,6 +500,20 @@ Node* InspectorDOMAgent::assertNode(Inspector::Protocol::ErrorString& errorStrin +@@ -475,6 +498,20 @@ Node* InspectorDOMAgent::assertNode(Inspector::Protocol::ErrorString& errorStrin return node.get(); } @@ -3501,7 +3476,7 @@ index 5bd7a42c19fd11234eea0520ebf61f7f820f765e..a70339c639682820de7ff09d62e8cfd4 Document* InspectorDOMAgent::assertDocument(Inspector::Protocol::ErrorString& errorString, Inspector::Protocol::DOM::NodeId nodeId) { RefPtr node = assertNode(errorString, nodeId); -@@ -1595,16 +1632,7 @@ Inspector::Protocol::ErrorStringOr InspectorDOMAgent::highlightNode(std::o +@@ -1593,16 +1630,7 @@ Inspector::Protocol::ErrorStringOr InspectorDOMAgent::highlightNode(std::o Inspector::Protocol::ErrorStringOr InspectorDOMAgent::highlightNode(std::optional&& nodeId, const Inspector::Protocol::Runtime::RemoteObjectId& objectId, Ref&& highlightInspectorObject, RefPtr&& gridOverlayInspectorObject, RefPtr&& flexOverlayInspectorObject, std::optional&& showRulers) { Inspector::Protocol::ErrorString errorString; @@ -3519,7 +3494,7 @@ index 5bd7a42c19fd11234eea0520ebf61f7f820f765e..a70339c639682820de7ff09d62e8cfd4 if (!node) return makeUnexpected(errorString); -@@ -1859,15 +1887,159 @@ Inspector::Protocol::ErrorStringOr InspectorDOMAgent::setInspectedNode(Ins +@@ -1857,15 +1885,159 @@ Inspector::Protocol::ErrorStringOr InspectorDOMAgent::setInspectedNode(Ins return { }; } @@ -3682,7 +3657,7 @@ index 5bd7a42c19fd11234eea0520ebf61f7f820f765e..a70339c639682820de7ff09d62e8cfd4 if (!object) return makeUnexpected("Missing injected script for given nodeId"_s); -@@ -3133,7 +3305,7 @@ Inspector::Protocol::ErrorStringOr InspectorDO +@@ -3131,7 +3303,7 @@ Inspector::Protocol::ErrorStringOr InspectorDO return makeUnexpected("Missing node for given path"_s); } @@ -3691,7 +3666,7 @@ index 5bd7a42c19fd11234eea0520ebf61f7f820f765e..a70339c639682820de7ff09d62e8cfd4 { Document* document = &node->document(); if (auto* templateHost = document->templateDocumentHost()) -@@ -3142,12 +3314,18 @@ RefPtr InspectorDOMAgent::resolveNod +@@ -3140,12 +3312,18 @@ RefPtr InspectorDOMAgent::resolveNod if (!frame) return nullptr; @@ -3713,7 +3688,7 @@ index 5bd7a42c19fd11234eea0520ebf61f7f820f765e..a70339c639682820de7ff09d62e8cfd4 } Node* InspectorDOMAgent::scriptValueAsNode(JSC::JSValue value) -@@ -3255,4 +3433,53 @@ Inspector::Protocol::ErrorStringOr> In +@@ -3291,4 +3469,53 @@ Inspector::Protocol::ErrorStringOr> In #endif } @@ -3768,7 +3743,7 @@ index 5bd7a42c19fd11234eea0520ebf61f7f820f765e..a70339c639682820de7ff09d62e8cfd4 + } // namespace WebCore diff --git a/Source/WebCore/inspector/agents/InspectorDOMAgent.h b/Source/WebCore/inspector/agents/InspectorDOMAgent.h -index c8602dd6236d299df04b28b456b4d4ab6348c6eb..15128978fa8d64b6413b82ce9991dd708d50271b 100644 +index 3496e0037572430b993ea91704501a742dd15627..9eb0ce0094fdb2ab9ca94bb5cddb082f201bf4cf 100644 --- a/Source/WebCore/inspector/agents/InspectorDOMAgent.h +++ b/Source/WebCore/inspector/agents/InspectorDOMAgent.h @@ -59,6 +59,7 @@ namespace WebCore { @@ -3779,7 +3754,7 @@ index c8602dd6236d299df04b28b456b4d4ab6348c6eb..15128978fa8d64b6413b82ce9991dd70 class DOMEditor; class Document; class Element; -@@ -94,6 +95,7 @@ public: +@@ -95,6 +96,7 @@ public: static String toErrorString(Exception&&); static String documentURLString(Document*); @@ -3787,7 +3762,7 @@ index c8602dd6236d299df04b28b456b4d4ab6348c6eb..15128978fa8d64b6413b82ce9991dd70 // We represent embedded doms as a part of the same hierarchy. Hence we treat children of frame owners differently. // We also skip whitespace text nodes conditionally. Following methods encapsulate these specifics. -@@ -139,7 +141,7 @@ public: +@@ -140,7 +142,7 @@ public: Inspector::Protocol::ErrorStringOr> performSearch(const String& query, RefPtr&& nodeIds, std::optional&& caseSensitive); Inspector::Protocol::ErrorStringOr>> getSearchResults(const String& searchId, int fromIndex, int toIndex); Inspector::Protocol::ErrorStringOr discardSearchResults(const String& searchId); @@ -3796,7 +3771,7 @@ index c8602dd6236d299df04b28b456b4d4ab6348c6eb..15128978fa8d64b6413b82ce9991dd70 Inspector::Protocol::ErrorStringOr>> getAttributes(Inspector::Protocol::DOM::NodeId); #if PLATFORM(IOS_FAMILY) Inspector::Protocol::ErrorStringOr setInspectModeEnabled(bool, RefPtr&& highlightConfig, RefPtr&& gridOverlayConfig, RefPtr&& flexOverlayConfig); -@@ -176,6 +178,10 @@ public: +@@ -177,6 +179,10 @@ public: Inspector::Protocol::ErrorStringOr setInspectedNode(Inspector::Protocol::DOM::NodeId); Inspector::Protocol::ErrorStringOr setAllowEditingUserAgentShadowTrees(bool); Inspector::Protocol::ErrorStringOr> getMediaStats(Inspector::Protocol::DOM::NodeId); @@ -3807,7 +3782,7 @@ index c8602dd6236d299df04b28b456b4d4ab6348c6eb..15128978fa8d64b6413b82ce9991dd70 // InspectorInstrumentation Inspector::Protocol::DOM::NodeId identifierForNode(Node&); -@@ -217,7 +223,7 @@ public: +@@ -218,7 +224,7 @@ public: Node* nodeForId(Inspector::Protocol::DOM::NodeId); Inspector::Protocol::DOM::NodeId boundNodeId(const Node*); @@ -3816,7 +3791,7 @@ index c8602dd6236d299df04b28b456b4d4ab6348c6eb..15128978fa8d64b6413b82ce9991dd70 bool handleMousePress(); void mouseDidMoveOverElement(const HitTestResult&, OptionSet); void inspect(Node*); -@@ -229,12 +235,15 @@ public: +@@ -230,12 +236,15 @@ public: void reset(); Node* assertNode(Inspector::Protocol::ErrorString&, Inspector::Protocol::DOM::NodeId); @@ -3832,7 +3807,7 @@ index c8602dd6236d299df04b28b456b4d4ab6348c6eb..15128978fa8d64b6413b82ce9991dd70 private: #if ENABLE(VIDEO) void mediaMetricsTimerFired(); -@@ -264,7 +273,6 @@ private: +@@ -265,7 +274,6 @@ private: void processAccessibilityChildren(AXCoreObject&, JSON::ArrayOf&); Node* nodeForPath(const String& path); @@ -3841,7 +3816,7 @@ index c8602dd6236d299df04b28b456b4d4ab6348c6eb..15128978fa8d64b6413b82ce9991dd70 void discardBindings(); diff --git a/Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp b/Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp -index 263890779b1a012b1ae1fe9145f4a7af494a581c..dc83cf514b03a80ceff036248147203898a4e113 100644 +index f3a0bdf189aed455ceb84f4023c2dbfda8e5dc16..25d54fc33be2ccd42565cb7ddf879344ab8aa3f2 100644 --- a/Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp +++ b/Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp @@ -58,6 +58,7 @@ @@ -3852,7 +3827,7 @@ index 263890779b1a012b1ae1fe9145f4a7af494a581c..dc83cf514b03a80ceff0362481472038 #include "Page.h" #include "PlatformStrategies.h" #include "ProgressTracker.h" -@@ -343,8 +344,8 @@ static Ref buildObjectForResourceRequest( +@@ -344,8 +345,8 @@ static Ref buildObjectForResourceRequest( .release(); if (request.httpBody() && !request.httpBody()->isEmpty()) { @@ -3863,7 +3838,7 @@ index 263890779b1a012b1ae1fe9145f4a7af494a581c..dc83cf514b03a80ceff0362481472038 } if (resourceLoader) { -@@ -397,6 +398,8 @@ RefPtr InspectorNetworkAgent::buildObjec +@@ -398,6 +399,8 @@ RefPtr InspectorNetworkAgent::buildObjec .setSource(responseSource(response.source())) .release(); @@ -3872,7 +3847,7 @@ index 263890779b1a012b1ae1fe9145f4a7af494a581c..dc83cf514b03a80ceff0362481472038 if (resourceLoader) { auto* metrics = response.deprecatedNetworkLoadMetricsOrNull(); responseObject->setTiming(buildObjectForTiming(metrics ? *metrics : NetworkLoadMetrics::emptyMetrics(), *resourceLoader)); -@@ -683,6 +686,9 @@ void InspectorNetworkAgent::didFailLoading(ResourceLoaderIdentifier identifier, +@@ -684,6 +687,9 @@ void InspectorNetworkAgent::didFailLoading(ResourceLoaderIdentifier identifier, String requestId = IdentifiersFactory::requestId(identifier.toUInt64()); if (loader && m_resourcesData->resourceType(requestId) == InspectorPageAgent::DocumentResource) { @@ -3882,7 +3857,7 @@ index 263890779b1a012b1ae1fe9145f4a7af494a581c..dc83cf514b03a80ceff0362481472038 auto* frame = loader->frame(); if (frame && frame->loader().documentLoader() && frame->document()) { m_resourcesData->addResourceSharedBuffer(requestId, -@@ -912,6 +918,7 @@ Inspector::Protocol::ErrorStringOr InspectorNetworkAgent::disable() +@@ -913,6 +919,7 @@ Inspector::Protocol::ErrorStringOr InspectorNetworkAgent::disable() m_instrumentingAgents.setEnabledNetworkAgent(nullptr); m_resourcesData->clear(); m_extraRequestHeaders.clear(); @@ -3890,7 +3865,7 @@ index 263890779b1a012b1ae1fe9145f4a7af494a581c..dc83cf514b03a80ceff0362481472038 continuePendingRequests(); continuePendingResponses(); -@@ -957,6 +964,7 @@ void InspectorNetworkAgent::continuePendingResponses() +@@ -958,6 +965,7 @@ void InspectorNetworkAgent::continuePendingResponses() Inspector::Protocol::ErrorStringOr InspectorNetworkAgent::setExtraHTTPHeaders(Ref&& headers) { @@ -3898,7 +3873,7 @@ index 263890779b1a012b1ae1fe9145f4a7af494a581c..dc83cf514b03a80ceff0362481472038 for (auto& entry : headers.get()) { auto stringValue = entry.value->asString(); if (!!stringValue) -@@ -1206,6 +1214,11 @@ void InspectorNetworkAgent::interceptResponse(const ResourceResponse& response, +@@ -1207,6 +1215,11 @@ void InspectorNetworkAgent::interceptResponse(const ResourceResponse& response, m_frontendDispatcher->responseIntercepted(requestId, resourceResponse.releaseNonNull()); } @@ -3910,7 +3885,7 @@ index 263890779b1a012b1ae1fe9145f4a7af494a581c..dc83cf514b03a80ceff0362481472038 Inspector::Protocol::ErrorStringOr InspectorNetworkAgent::interceptContinue(const Inspector::Protocol::Network::RequestId& requestId, Inspector::Protocol::Network::NetworkStage networkStage) { switch (networkStage) { -@@ -1235,6 +1248,9 @@ Inspector::Protocol::ErrorStringOr InspectorNetworkAgent::interceptWithReq +@@ -1236,6 +1249,9 @@ Inspector::Protocol::ErrorStringOr InspectorNetworkAgent::interceptWithReq return makeUnexpected("Missing pending intercept request for given requestId"_s); auto& loader = *pendingRequest->m_loader; @@ -3920,7 +3895,7 @@ index 263890779b1a012b1ae1fe9145f4a7af494a581c..dc83cf514b03a80ceff0362481472038 ResourceRequest request = loader.request(); if (!!url) request.setURL(URL({ }, url)); -@@ -1330,14 +1346,23 @@ Inspector::Protocol::ErrorStringOr InspectorNetworkAgent::interceptRequest +@@ -1331,13 +1347,22 @@ Inspector::Protocol::ErrorStringOr InspectorNetworkAgent::interceptRequest response.setHTTPStatusCode(status); response.setHTTPStatusText(String { statusText }); HTTPHeaderMap explicitHeaders; @@ -3936,17 +3911,15 @@ index 263890779b1a012b1ae1fe9145f4a7af494a581c..dc83cf514b03a80ceff0362481472038 } response.setHTTPHeaderFields(WTFMove(explicitHeaders)); response.setHTTPHeaderField(HTTPHeaderName::ContentType, response.mimeType()); -- loader->didReceiveResponse(response, [loader, buffer = data.releaseNonNull()]() { + + auto* frame = loader->frame(); + if (!setCookieValue.isEmpty() && frame && frame->page()) + frame->page()->cookieJar().setCookieFromResponse(*loader.get(), setCookieValue); + -+ loader->didReceiveResponse(response, [loader, buffer = data.releaseNonNull()]() mutable { + loader->didReceiveResponse(WTFMove(response), [loader, buffer = data.releaseNonNull()]() { if (loader->reachedTerminalState()) return; - -@@ -1400,6 +1425,12 @@ Inspector::Protocol::ErrorStringOr InspectorNetworkAgent::setEmulatedCondi +@@ -1401,6 +1426,12 @@ Inspector::Protocol::ErrorStringOr InspectorNetworkAgent::setEmulatedCondi #endif // ENABLE(INSPECTOR_NETWORK_THROTTLING) @@ -3997,7 +3970,7 @@ index de6b2dd844943074c5a383c7b9b8ccba1c96419a..7a3404f2380b5e62f1c0523a70f8ef44 } // namespace WebCore diff --git a/Source/WebCore/inspector/agents/InspectorPageAgent.cpp b/Source/WebCore/inspector/agents/InspectorPageAgent.cpp -index c7c930db458419ffdf3d10b9a7db0d3c2b9615a1..6253804039ea38105bb7647082752cafdd08d895 100644 +index cc649f41559f905102d7a8785190f3157d3e6dea..ee7fee8a4ac224d27dd40d04be0803ff89720232 100644 --- a/Source/WebCore/inspector/agents/InspectorPageAgent.cpp +++ b/Source/WebCore/inspector/agents/InspectorPageAgent.cpp @@ -32,19 +32,27 @@ @@ -4034,7 +4007,7 @@ index c7c930db458419ffdf3d10b9a7db0d3c2b9615a1..6253804039ea38105bb7647082752caf #include "Page.h" +#include "PageRuntimeAgent.h" +#include "PlatformScreen.h" - #include "RenderObject.h" + #include "RenderObjectInlines.h" #include "RenderTheme.h" +#include "DeprecatedGlobalSettings.h" +#include "SimpleRange.h" @@ -5312,7 +5285,7 @@ index 8fb27c1045b8073d1487d5b61ccdec23a395bfd1..5008052f587ca4ba90da973c539188de protected: static SameSiteInfo sameSiteInfo(const Document&, IsForDOMCookieAccess = IsForDOMCookieAccess::No); diff --git a/Source/WebCore/loader/DocumentLoader.cpp b/Source/WebCore/loader/DocumentLoader.cpp -index 0ed08d14f259f4c9ca92447222bb7bc5344f335b..8f04196baa58d2c9b627f59d5e2c0126bd2b4e01 100644 +index 541963eb00a1e5700da683be152543ac57f177a1..bd0debb9cdf2fac02bcf0243571a4a668be9decc 100644 --- a/Source/WebCore/loader/DocumentLoader.cpp +++ b/Source/WebCore/loader/DocumentLoader.cpp @@ -774,8 +774,10 @@ void DocumentLoader::willSendRequest(ResourceRequest&& newRequest, const Resourc @@ -5326,7 +5299,7 @@ index 0ed08d14f259f4c9ca92447222bb7bc5344f335b..8f04196baa58d2c9b627f59d5e2c0126 switch (navigationPolicyDecision) { case NavigationPolicyDecision::IgnoreLoad: case NavigationPolicyDecision::LoadWillContinueInAnotherProcess: -@@ -1574,11 +1576,17 @@ void DocumentLoader::detachFromFrame(LoadWillContinueInAnotherProcess loadWillCo +@@ -1572,11 +1574,17 @@ void DocumentLoader::detachFromFrame(LoadWillContinueInAnotherProcess loadWillCo if (auto navigationID = std::exchange(m_navigationID, { })) frame->loader().client().documentLoaderDetached(*navigationID, loadWillContinueInAnotherProcess); @@ -5347,10 +5320,10 @@ index 0ed08d14f259f4c9ca92447222bb7bc5344f335b..8f04196baa58d2c9b627f59d5e2c0126 { m_navigationID = navigationID; diff --git a/Source/WebCore/loader/DocumentLoader.h b/Source/WebCore/loader/DocumentLoader.h -index 3b8896bcc5661929a7f96fb7a01de99b36109dbf..8c3421c5e6a0c36f82c0d7a82f796ca90ba61be7 100644 +index a3e5891cc44903ec74da16164904c12673498d97..9f8566a8c1cc20c1d2a495c9765f1c522890e993 100644 --- a/Source/WebCore/loader/DocumentLoader.h +++ b/Source/WebCore/loader/DocumentLoader.h -@@ -224,6 +224,8 @@ public: +@@ -218,6 +218,8 @@ public: WEBCORE_EXPORT virtual void detachFromFrame(LoadWillContinueInAnotherProcess); @@ -5360,10 +5333,10 @@ index 3b8896bcc5661929a7f96fb7a01de99b36109dbf..8c3421c5e6a0c36f82c0d7a82f796ca9 WEBCORE_EXPORT RefPtr protectedFrameLoader() const; WEBCORE_EXPORT SubresourceLoader* mainResourceLoader() const; diff --git a/Source/WebCore/loader/FrameLoader.cpp b/Source/WebCore/loader/FrameLoader.cpp -index 0a408b9d3b2c4daa271691041eb1f4fd897d3e93..650180483ace8b8d031d1d022e847409e948a9a4 100644 +index 0974e98f02b59150df7054af753a3c3bb1d3b0e9..559a8532162d4c9e106c1059dfbf50fc63ee9326 100644 --- a/Source/WebCore/loader/FrameLoader.cpp +++ b/Source/WebCore/loader/FrameLoader.cpp -@@ -1323,6 +1323,7 @@ void FrameLoader::loadInSameDocument(URL url, RefPtr stat +@@ -1325,6 +1325,7 @@ void FrameLoader::loadInSameDocument(URL url, RefPtr stat } m_client->dispatchDidNavigateWithinPage(); @@ -5371,7 +5344,7 @@ index 0a408b9d3b2c4daa271691041eb1f4fd897d3e93..650180483ace8b8d031d1d022e847409 document->statePopped(stateObject ? stateObject.releaseNonNull() : SerializedScriptValue::nullValue()); m_client->dispatchDidPopStateWithinPage(); -@@ -1861,6 +1862,7 @@ void FrameLoader::loadWithDocumentLoader(DocumentLoader* loader, FrameLoadType t +@@ -1867,6 +1868,7 @@ void FrameLoader::loadWithDocumentLoader(DocumentLoader* loader, FrameLoadType t const String& httpMethod = loader->request().httpMethod(); if (shouldPerformFragmentNavigation(isFormSubmission, httpMethod, policyChecker().loadType(), newURL)) { @@ -5379,7 +5352,7 @@ index 0a408b9d3b2c4daa271691041eb1f4fd897d3e93..650180483ace8b8d031d1d022e847409 RefPtr oldDocumentLoader = m_documentLoader; NavigationAction action { frame->protectedDocument().releaseNonNull(), loader->request(), InitiatedByMainFrame::Unknown, loader->isRequestFromClientOrUserInput(), policyChecker().loadType(), isFormSubmission }; -@@ -1898,7 +1900,9 @@ void FrameLoader::loadWithDocumentLoader(DocumentLoader* loader, FrameLoadType t +@@ -1905,7 +1907,9 @@ void FrameLoader::loadWithDocumentLoader(DocumentLoader* loader, FrameLoadType t auto policyDecisionMode = loader->triggeringAction().isFromNavigationAPI() ? PolicyDecisionMode::Synchronous : PolicyDecisionMode::Asynchronous; RELEASE_ASSERT(!isBackForwardLoadType(policyChecker().loadType()) || history().provisionalItem()); @@ -5389,7 +5362,7 @@ index 0a408b9d3b2c4daa271691041eb1f4fd897d3e93..650180483ace8b8d031d1d022e847409 continueLoadAfterNavigationPolicy(request, RefPtr { weakFormState.get() }.get(), navigationPolicyDecision, allowNavigationToInvalidURL); completionHandler(); }, policyDecisionMode); -@@ -3210,10 +3214,15 @@ String FrameLoader::userAgent(const URL& url) const +@@ -3219,10 +3223,15 @@ String FrameLoader::userAgent(const URL& url) const String FrameLoader::navigatorPlatform() const { @@ -5407,7 +5380,7 @@ index 0a408b9d3b2c4daa271691041eb1f4fd897d3e93..650180483ace8b8d031d1d022e847409 } void FrameLoader::dispatchOnloadEvents() -@@ -3672,6 +3681,8 @@ void FrameLoader::receivedMainResourceError(const ResourceError& error, LoadWill +@@ -3682,6 +3691,8 @@ void FrameLoader::receivedMainResourceError(const ResourceError& error, LoadWill checkCompleted(); if (frame->page()) checkLoadComplete(loadWillContinueInAnotherProcess); @@ -5416,7 +5389,7 @@ index 0a408b9d3b2c4daa271691041eb1f4fd897d3e93..650180483ace8b8d031d1d022e847409 } void FrameLoader::continueFragmentScrollAfterNavigationPolicy(const ResourceRequest& request, const SecurityOrigin* requesterOrigin, bool shouldContinue, NavigationHistoryBehavior historyHandling) -@@ -4566,9 +4577,6 @@ String FrameLoader::referrer() const +@@ -4576,9 +4587,6 @@ String FrameLoader::referrer() const void FrameLoader::dispatchDidClearWindowObjectsInAllWorlds() { @@ -5426,7 +5399,7 @@ index 0a408b9d3b2c4daa271691041eb1f4fd897d3e93..650180483ace8b8d031d1d022e847409 Vector> worlds; ScriptController::getAllWorlds(worlds); for (auto& world : worlds) -@@ -4578,13 +4586,12 @@ void FrameLoader::dispatchDidClearWindowObjectsInAllWorlds() +@@ -4588,13 +4596,12 @@ void FrameLoader::dispatchDidClearWindowObjectsInAllWorlds() void FrameLoader::dispatchDidClearWindowObjectInWorld(DOMWrapperWorld& world) { Ref frame = m_frame.get(); @@ -5459,7 +5432,7 @@ index 1b34dfdd2a8e56beab49591a3517aba02c510ee6..768b895c132b73d935198cbfc2126a22 virtual bool shouldPerformSecurityChecks() const { return false; } virtual bool havePerformedSecurityChecks(const ResourceResponse&) const { return false; } diff --git a/Source/WebCore/loader/NavigationScheduler.cpp b/Source/WebCore/loader/NavigationScheduler.cpp -index 5f70f737d06ced029e3b86a4dc93fd49e8ff4cae..15e6c42cbd4733b526493c3c7dfbea62e70ddb0c 100644 +index d1d57f421c8570468b8c1ad2dc3c081b50cc4f0a..17a75616518d81eb3ce1e8107ee1f3546b477e30 100644 --- a/Source/WebCore/loader/NavigationScheduler.cpp +++ b/Source/WebCore/loader/NavigationScheduler.cpp @@ -806,7 +806,7 @@ void NavigationScheduler::startTimer() @@ -5494,7 +5467,7 @@ index a1554c16a0b836bcf87fea0f4e7831d9e0d7baf0..354e4fef6de9c77b7cad96cc428056ae } diff --git a/Source/WebCore/loader/cache/CachedResourceLoader.cpp b/Source/WebCore/loader/cache/CachedResourceLoader.cpp -index fb3e38627c8c3491f4994a74c6785cc9767fea2c..000de0c2f725d894cbdfa000d79ed48290eba00a 100644 +index c6a8c86e12ba98ad8b9aab74430523c3dd8cb42e..61c73db33d4c629803d14f243862acea15e762cb 100644 --- a/Source/WebCore/loader/cache/CachedResourceLoader.cpp +++ b/Source/WebCore/loader/cache/CachedResourceLoader.cpp @@ -1173,8 +1173,11 @@ ResourceErrorOr> CachedResourceLoader::requ @@ -5511,7 +5484,7 @@ index fb3e38627c8c3491f4994a74c6785cc9767fea2c..000de0c2f725d894cbdfa000d79ed482 if (RefPtr documentLoader = m_documentLoader.get()) { bool madeHTTPS { request.resourceRequest().wasSchemeOptimisticallyUpgraded() }; -@@ -1811,8 +1814,9 @@ Vector> CachedResourceLoader::allCachedSVGImages() const +@@ -1810,8 +1813,9 @@ Vector> CachedResourceLoader::allCachedSVGImages() const ResourceErrorOr> CachedResourceLoader::preload(CachedResource::Type type, CachedResourceRequest&& request) { @@ -5524,10 +5497,10 @@ index fb3e38627c8c3491f4994a74c6785cc9767fea2c..000de0c2f725d894cbdfa000d79ed482 RefPtr document = m_document.get(); ASSERT(document); diff --git a/Source/WebCore/page/ChromeClient.h b/Source/WebCore/page/ChromeClient.h -index 51ac3768b20683f26e3a568f390bfe8eba7e1fb5..f6f285ddbe261ccb807e1a57f93f202296f100d2 100644 +index 60ba4d0aaa365301aa80d144f2d07e842a71a6b8..a962ce78e3ad912886a9d3328d64cf0faec3177d 100644 --- a/Source/WebCore/page/ChromeClient.h +++ b/Source/WebCore/page/ChromeClient.h -@@ -364,7 +364,7 @@ public: +@@ -379,7 +379,7 @@ public: #endif #if ENABLE(ORIENTATION_EVENTS) @@ -5537,10 +5510,10 @@ index 51ac3768b20683f26e3a568f390bfe8eba7e1fb5..f6f285ddbe261ccb807e1a57f93f2022 virtual RefPtr createColorChooser(ColorChooserClient&, const Color&) = 0; diff --git a/Source/WebCore/page/EventHandler.cpp b/Source/WebCore/page/EventHandler.cpp -index 47392ed5c5888954373a1916f757ee9ccf1edbbd..8fb82ad84ea589efaf6074e79ca5a0c2a4df14ca 100644 +index 04fce4219bdfc1c4a78eb2d849045280416b6f2d..9e44a302b10ba3bc18496f5678262171e8b30b2c 100644 --- a/Source/WebCore/page/EventHandler.cpp +++ b/Source/WebCore/page/EventHandler.cpp -@@ -4460,6 +4460,12 @@ bool EventHandler::handleDrag(const MouseEventWithHitTestResults& event, CheckDr +@@ -4483,6 +4483,12 @@ bool EventHandler::handleDrag(const MouseEventWithHitTestResults& event, CheckDr if (!document) return false; @@ -5553,15 +5526,15 @@ index 47392ed5c5888954373a1916f757ee9ccf1edbbd..8fb82ad84ea589efaf6074e79ca5a0c2 dragState().dataTransfer = DataTransfer::createForDrag(*document); auto hasNonDefaultPasteboardData = HasNonDefaultPasteboardData::No; -@@ -5054,6 +5060,7 @@ static HitTestResult hitTestResultInFrame(LocalFrame* frame, const LayoutPoint& +@@ -5077,6 +5083,7 @@ static HitTestResult hitTestResultInFrame(LocalFrame* frame, const LayoutPoint& return result; } +WTF_ALLOW_UNSAFE_BUFFER_USAGE_BEGIN - HandleUserInputEventResult EventHandler::handleTouchEvent(const PlatformTouchEvent& event) + Expected EventHandler::handleTouchEvent(const PlatformTouchEvent& event) { Ref frame = m_frame.get(); -@@ -5127,7 +5134,7 @@ HandleUserInputEventResult EventHandler::handleTouchEvent(const PlatformTouchEve +@@ -5150,7 +5157,7 @@ Expected EventHandler::handleTouchEvent(co // Increment the platform touch id by 1 to avoid storing a key of 0 in the hashmap. unsigned touchPointTargetKey = point.id() + 1; @@ -5570,7 +5543,7 @@ index 47392ed5c5888954373a1916f757ee9ccf1edbbd..8fb82ad84ea589efaf6074e79ca5a0c2 bool pointerCancelled = false; #endif RefPtr touchTarget; -@@ -5174,7 +5181,7 @@ HandleUserInputEventResult EventHandler::handleTouchEvent(const PlatformTouchEve +@@ -5197,7 +5204,7 @@ Expected EventHandler::handleTouchEvent(co // we also remove it from the map. touchTarget = m_originatingTouchPointTargets.take(touchPointTargetKey); @@ -5579,7 +5552,7 @@ index 47392ed5c5888954373a1916f757ee9ccf1edbbd..8fb82ad84ea589efaf6074e79ca5a0c2 HitTestResult result = hitTestResultAtPoint(pagePoint, hitType | HitTestRequest::Type::AllowChildFrameContent); pointerTarget = result.targetElement(); pointerCancelled = (pointerTarget != touchTarget); -@@ -5197,7 +5204,7 @@ HandleUserInputEventResult EventHandler::handleTouchEvent(const PlatformTouchEve +@@ -5220,7 +5227,7 @@ Expected EventHandler::handleTouchEvent(co if (!targetFrame) continue; @@ -5588,7 +5561,7 @@ index 47392ed5c5888954373a1916f757ee9ccf1edbbd..8fb82ad84ea589efaf6074e79ca5a0c2 // FIXME: WPE currently does not send touch stationary events, so create a naive TouchReleased PlatformTouchPoint // on release if the hit test result changed since the previous TouchPressed or TouchMoved if (pointState == PlatformTouchPoint::TouchReleased && pointerCancelled) { -@@ -5287,6 +5294,7 @@ HandleUserInputEventResult EventHandler::handleTouchEvent(const PlatformTouchEve +@@ -5310,6 +5317,7 @@ Expected EventHandler::handleTouchEvent(co return swallowedEvent; } @@ -5597,10 +5570,10 @@ index 47392ed5c5888954373a1916f757ee9ccf1edbbd..8fb82ad84ea589efaf6074e79ca5a0c2 #if ENABLE(TOUCH_EVENTS) diff --git a/Source/WebCore/page/FocusController.cpp b/Source/WebCore/page/FocusController.cpp -index f4a1e3408623e2b338149d1a129dc8075c764f59..571c4c6e9a873167bbc78b0708ffac44b7a8e641 100644 +index 1b183750e1c51e96fcca727bed3c2eb1d30e77e9..e1d00211b5051387bd4495d88cef637704cf1704 100644 --- a/Source/WebCore/page/FocusController.cpp +++ b/Source/WebCore/page/FocusController.cpp -@@ -586,13 +586,14 @@ bool FocusController::relinquishFocusToChrome(FocusDirection direction) +@@ -580,13 +580,14 @@ bool FocusController::relinquishFocusToChrome(FocusDirection direction) return false; Ref page = m_page.get(); @@ -5685,10 +5658,10 @@ index adc6185687b6fcee3a49819d0149cde24a4485bf..a33e5db46933c514abce86e3f264de9b } diff --git a/Source/WebCore/page/LocalFrame.cpp b/Source/WebCore/page/LocalFrame.cpp -index 54cab8376adfb6dd1e5ca32e170219290e4f0508..d212eece82066ba788d049e9aff212ff3493a6c3 100644 +index f6e26519619d560b5edddb30170f166ac76bd57f..51019ccda3f5953c4a154c271690f3923c1a530a 100644 --- a/Source/WebCore/page/LocalFrame.cpp +++ b/Source/WebCore/page/LocalFrame.cpp -@@ -41,6 +41,7 @@ +@@ -42,6 +42,7 @@ #include "CachedResourceLoader.h" #include "Chrome.h" #include "ChromeClient.h" @@ -5696,7 +5669,7 @@ index 54cab8376adfb6dd1e5ca32e170219290e4f0508..d212eece82066ba788d049e9aff212ff #include "DiagnosticLoggingClient.h" #include "DiagnosticLoggingKeys.h" #include "DocumentLoader.h" -@@ -59,6 +60,7 @@ +@@ -60,6 +61,7 @@ #include "FrameSelection.h" #include "GraphicsContext.h" #include "GraphicsLayer.h" @@ -5704,7 +5677,7 @@ index 54cab8376adfb6dd1e5ca32e170219290e4f0508..d212eece82066ba788d049e9aff212ff #include "HTMLAttachmentElement.h" #include "HTMLFormControlElement.h" #include "HTMLFormElement.h" -@@ -81,6 +83,7 @@ +@@ -82,6 +84,7 @@ #include "Logging.h" #include "Navigator.h" #include "NodeList.h" @@ -5712,7 +5685,7 @@ index 54cab8376adfb6dd1e5ca32e170219290e4f0508..d212eece82066ba788d049e9aff212ff #include "NodeTraversal.h" #include "Page.h" #include "PaymentSession.h" -@@ -205,6 +208,7 @@ LocalFrame::LocalFrame(Page& page, ClientCreator&& clientCreator, FrameIdentifie +@@ -217,6 +220,7 @@ LocalFrame::LocalFrame(Page& page, ClientCreator&& clientCreator, FrameIdentifie void LocalFrame::init() { @@ -5720,7 +5693,7 @@ index 54cab8376adfb6dd1e5ca32e170219290e4f0508..d212eece82066ba788d049e9aff212ff protectedLoader()->init(); } -@@ -442,7 +446,7 @@ void LocalFrame::orientationChanged() +@@ -444,7 +448,7 @@ void LocalFrame::orientationChanged() IntDegrees LocalFrame::orientation() const { if (RefPtr page = this->page()) @@ -5729,7 +5702,7 @@ index 54cab8376adfb6dd1e5ca32e170219290e4f0508..d212eece82066ba788d049e9aff212ff return 0; } #endif // ENABLE(ORIENTATION_EVENTS) -@@ -1549,6 +1553,364 @@ RefPtr LocalFrame::frameDocumentSecurityOrigin() const +@@ -1599,6 +1603,364 @@ RefPtr LocalFrame::frameDocumentSecurityOrigin() const return nullptr; } @@ -6095,21 +6068,18 @@ index 54cab8376adfb6dd1e5ca32e170219290e4f0508..d212eece82066ba788d049e9aff212ff #undef FRAME_RELEASE_LOG_ERROR diff --git a/Source/WebCore/page/LocalFrame.h b/Source/WebCore/page/LocalFrame.h -index b46fd5f993569302c23b7302a493a37fd8c1f440..2d9bbfc639deba681ecb7465d87981a787901dac 100644 +index 7e8505e025af3f52a0adbd5e6b98d6a22f449d9c..667a9578f073c216231ca8834354c1d5ce49370d 100644 --- a/Source/WebCore/page/LocalFrame.h +++ b/Source/WebCore/page/LocalFrame.h -@@ -28,8 +28,10 @@ - #pragma once +@@ -29,6 +29,7 @@ - #include "AdjustViewSizeOrNot.h" -+#include "DOMPasteAccess.h" - #include "Document.h" + #include "DOMPasteAccess.h" #include "Frame.h" +#include "IntDegrees.h" - #include "ScrollTypes.h" - #include "UserScriptTypes.h" + #include "ScrollbarMode.h" #include -@@ -116,8 +118,8 @@ enum { + #include +@@ -122,8 +123,8 @@ enum { }; enum OverflowScrollAction { DoNotPerformOverflowScroll, PerformOverflowScroll }; @@ -6119,7 +6089,7 @@ index b46fd5f993569302c23b7302a493a37fd8c1f440..2d9bbfc639deba681ecb7465d87981a7 class LocalFrame final : public Frame { public: -@@ -227,10 +229,6 @@ public: +@@ -233,10 +234,6 @@ public: WEBCORE_EXPORT DataDetectionResultsStorage& dataDetectionResults(); #endif @@ -6130,7 +6100,7 @@ index b46fd5f993569302c23b7302a493a37fd8c1f440..2d9bbfc639deba681ecb7465d87981a7 WEBCORE_EXPORT Node* deepestNodeAtLocation(const FloatPoint& viewportLocation); WEBCORE_EXPORT Node* nodeRespondingToClickEvents(const FloatPoint& viewportLocation, FloatPoint& adjustedViewportLocation, SecurityOrigin* = nullptr); WEBCORE_EXPORT Node* nodeRespondingToDoubleClickEvent(const FloatPoint& viewportLocation, FloatPoint& adjustedViewportLocation); -@@ -238,6 +236,10 @@ public: +@@ -244,6 +241,10 @@ public: WEBCORE_EXPORT Node* nodeRespondingToScrollWheelEvents(const FloatPoint& viewportLocation); WEBCORE_EXPORT Node* approximateNodeAtViewportLocationLegacy(const FloatPoint& viewportLocation, FloatPoint& adjustedViewportLocation); @@ -6141,15 +6111,15 @@ index b46fd5f993569302c23b7302a493a37fd8c1f440..2d9bbfc639deba681ecb7465d87981a7 WEBCORE_EXPORT NSArray *wordsInCurrentParagraph() const; WEBCORE_EXPORT CGRect renderRectForPoint(CGPoint, bool* isReplaced, float* fontSize) const; -@@ -305,6 +307,7 @@ public: +@@ -311,6 +312,7 @@ public: WEBCORE_EXPORT FloatSize screenSize() const; void setOverrideScreenSize(FloatSize&&); -+ bool hasScreenSizeOverride() const { return !m_overrideScreenSize.isEmpty(); } ++ bool hasScreenSizeOverride() const { return !!m_overrideScreenSize; } void selfOnlyRef(); void selfOnlyDeref(); -@@ -373,7 +376,6 @@ private: +@@ -382,7 +384,6 @@ private: #if ENABLE(DATA_DETECTION) std::unique_ptr m_dataDetectionResults; #endif @@ -6157,19 +6127,19 @@ index b46fd5f993569302c23b7302a493a37fd8c1f440..2d9bbfc639deba681ecb7465d87981a7 void betterApproximateNode(const IntPoint& testPoint, const NodeQualifier&, Node*& best, Node* failedNode, IntPoint& bestPoint, IntRect& bestRect, const IntRect& testRect); bool hitTestResultAtViewportLocation(const FloatPoint& viewportLocation, HitTestResult&, IntPoint& center); -@@ -381,6 +383,7 @@ private: +@@ -390,6 +391,7 @@ private: enum class ShouldFindRootEditableElement : bool { No, Yes }; Node* qualifyingNodeAtViewportLocation(const FloatPoint& viewportLocation, FloatPoint& adjustedViewportLocation, const NodeQualifier&, ShouldApproximate, ShouldFindRootEditableElement = ShouldFindRootEditableElement::Yes); +#if PLATFORM(IOS_FAMILY) void setTimersPausedInternal(bool); - ViewportArguments m_viewportArguments; + UniqueRef m_viewportArguments; diff --git a/Source/WebCore/page/Page.cpp b/Source/WebCore/page/Page.cpp -index a9369054928a0c9c1f3aef0252c2da3d33d4ce7c..2b151666e718fb037471ab7005c62623c4ee332d 100644 +index 08315ed1fb551d8ad9f9a7dcdc4fea487cd9a8fb..44cf9866c35e309cb90138b73c3d35e5409aa7eb 100644 --- a/Source/WebCore/page/Page.cpp +++ b/Source/WebCore/page/Page.cpp -@@ -655,6 +655,45 @@ void Page::setOverrideViewportArguments(const std::optional& +@@ -663,6 +663,45 @@ void Page::setOverrideViewportArguments(const std::optional& localTopDocument->updateViewportArguments(); } @@ -6215,7 +6185,7 @@ index a9369054928a0c9c1f3aef0252c2da3d33d4ce7c..2b151666e718fb037471ab7005c62623 ScrollingCoordinator* Page::scrollingCoordinator() { if (!m_scrollingCoordinator && m_settings->scrollingCoordinatorEnabled()) { -@@ -4214,6 +4253,26 @@ void Page::setUseDarkAppearanceOverride(std::optional valueOverride) +@@ -4242,6 +4281,26 @@ void Page::setUseDarkAppearanceOverride(std::optional valueOverride) appearanceDidChange(); } @@ -6243,10 +6213,10 @@ index a9369054928a0c9c1f3aef0252c2da3d33d4ce7c..2b151666e718fb037471ab7005c62623 { if (insets == m_fullscreenInsets) diff --git a/Source/WebCore/page/Page.h b/Source/WebCore/page/Page.h -index 4e33885a4771eb8260c8cebb14991d780f95be3d..e413dde6db076f587cbf520f17bfa5078320f8cc 100644 +index 9f107570fbb2195211ad46358369acb791e0376b..8c753ef756e9fe64ffdca36683ec486edb758f6b 100644 --- a/Source/WebCore/page/Page.h +++ b/Source/WebCore/page/Page.h -@@ -366,6 +366,9 @@ public: +@@ -389,6 +389,9 @@ public: const ViewportArguments* overrideViewportArguments() const { return m_overrideViewportArguments.get(); } WEBCORE_EXPORT void setOverrideViewportArguments(const std::optional&); @@ -6256,7 +6226,7 @@ index 4e33885a4771eb8260c8cebb14991d780f95be3d..e413dde6db076f587cbf520f17bfa507 static void refreshPlugins(bool reload); WEBCORE_EXPORT PluginData& pluginData(); WEBCORE_EXPORT Ref protectedPluginData(); -@@ -463,6 +466,10 @@ public: +@@ -486,6 +489,10 @@ public: #if ENABLE(DRAG_SUPPORT) DragController& dragController() { return m_dragController.get(); } const DragController& dragController() const { return m_dragController.get(); } @@ -6267,7 +6237,7 @@ index 4e33885a4771eb8260c8cebb14991d780f95be3d..e413dde6db076f587cbf520f17bfa507 #endif FocusController& focusController() const { return *m_focusController; } WEBCORE_EXPORT CheckedRef checkedFocusController() const; -@@ -648,6 +655,10 @@ public: +@@ -671,6 +678,10 @@ public: WEBCORE_EXPORT void setUseColorAppearance(bool useDarkAppearance, bool useElevatedUserInterfaceLevel); bool defaultUseDarkAppearance() const { return m_useDarkAppearance; } void setUseDarkAppearanceOverride(std::optional); @@ -6278,7 +6248,7 @@ index 4e33885a4771eb8260c8cebb14991d780f95be3d..e413dde6db076f587cbf520f17bfa507 #if ENABLE(TEXT_AUTOSIZING) float textAutosizingWidth() const { return m_textAutosizingWidth; } -@@ -1116,6 +1127,11 @@ public: +@@ -1143,6 +1154,11 @@ public: WEBCORE_EXPORT void setInteractionRegionsEnabled(bool); #endif @@ -6290,7 +6260,7 @@ index 4e33885a4771eb8260c8cebb14991d780f95be3d..e413dde6db076f587cbf520f17bfa507 #if ENABLE(DEVICE_ORIENTATION) && PLATFORM(IOS_FAMILY) DeviceOrientationUpdateProvider* deviceOrientationUpdateProvider() const { return m_deviceOrientationUpdateProvider.get(); } #endif -@@ -1389,6 +1405,9 @@ private: +@@ -1424,6 +1440,9 @@ private: #if ENABLE(DRAG_SUPPORT) const UniqueRef m_dragController; @@ -6300,7 +6270,7 @@ index 4e33885a4771eb8260c8cebb14991d780f95be3d..e413dde6db076f587cbf520f17bfa507 #endif std::unique_ptr m_focusController; #if ENABLE(CONTEXT_MENUS) -@@ -1467,6 +1486,8 @@ private: +@@ -1502,6 +1521,8 @@ private: bool m_useElevatedUserInterfaceLevel { false }; bool m_useDarkAppearance { false }; std::optional m_useDarkAppearanceOverride; @@ -6309,7 +6279,7 @@ index 4e33885a4771eb8260c8cebb14991d780f95be3d..e413dde6db076f587cbf520f17bfa507 #if ENABLE(TEXT_AUTOSIZING) float m_textAutosizingWidth { 0 }; -@@ -1649,6 +1670,11 @@ private: +@@ -1683,6 +1704,11 @@ private: #endif std::unique_ptr m_overrideViewportArguments; @@ -6322,7 +6292,7 @@ index 4e33885a4771eb8260c8cebb14991d780f95be3d..e413dde6db076f587cbf520f17bfa507 #if ENABLE(DEVICE_ORIENTATION) && PLATFORM(IOS_FAMILY) RefPtr m_deviceOrientationUpdateProvider; diff --git a/Source/WebCore/page/PageConsoleClient.cpp b/Source/WebCore/page/PageConsoleClient.cpp -index ad70f3c37261ab24afc23f7136ae3feb1fcbe154..ecf31d4aaf2080e705e9caec75596104bdfce786 100644 +index e3f5517e30956f17aea53324fc3c5ce11238254c..278ddea00b98d979797e1e82a5cb3f97239b63bc 100644 --- a/Source/WebCore/page/PageConsoleClient.cpp +++ b/Source/WebCore/page/PageConsoleClient.cpp @@ -456,4 +456,9 @@ Ref PageConsoleClient::protectedPage() const @@ -6348,10 +6318,10 @@ index 153fc36199f26adbfb61cbef6744ffe31a68b951..cc667e06700013fd5e994467e19536d2 Ref protectedPage() const; diff --git a/Source/WebCore/page/PointerCaptureController.cpp b/Source/WebCore/page/PointerCaptureController.cpp -index ad7f92bf398348be7823247931ce71d5a1c2296e..accabfd4f44199f026ca7bb9ea058bfe3d0ad8f8 100644 +index 7f0fe2766310d43552d12b85d1484cc095a752a4..1ab97c02215826ad9210489b64573145755a1b4f 100644 --- a/Source/WebCore/page/PointerCaptureController.cpp +++ b/Source/WebCore/page/PointerCaptureController.cpp -@@ -205,7 +205,7 @@ bool PointerCaptureController::preventsCompatibilityMouseEventsForIdentifier(Poi +@@ -207,7 +207,7 @@ bool PointerCaptureController::preventsCompatibilityMouseEventsForIdentifier(Poi return capturingData && capturingData->preventsCompatibilityMouseEvents; } @@ -6360,7 +6330,7 @@ index ad7f92bf398348be7823247931ce71d5a1c2296e..accabfd4f44199f026ca7bb9ea058bfe static bool hierarchyHasCapturingEventListeners(Element* target, const AtomString& eventName) { for (RefPtr currentNode = target; currentNode; currentNode = currentNode->parentInComposedTree()) { -@@ -555,7 +555,7 @@ void PointerCaptureController::cancelPointer(PointerID pointerId, const IntPoint +@@ -557,7 +557,7 @@ void PointerCaptureController::cancelPointer(PointerID pointerId, const IntPoint capturingData->pendingTargetOverride = nullptr; capturingData->state = CapturingData::State::Cancelled; @@ -6370,7 +6340,7 @@ index ad7f92bf398348be7823247931ce71d5a1c2296e..accabfd4f44199f026ca7bb9ea058bfe #endif diff --git a/Source/WebCore/page/PointerCaptureController.h b/Source/WebCore/page/PointerCaptureController.h -index b7e3f7cbd54e6ba9419de1bbf70594f3c2771d41..abb08ab5f5a979d7a40af30a27fddfe163db2b12 100644 +index e50f38c2c45f665b4b88fe1aa4f99d1a51328d63..8144be1724ef71a93b8870f64ec5abcb98eaa27f 100644 --- a/Source/WebCore/page/PointerCaptureController.h +++ b/Source/WebCore/page/PointerCaptureController.h @@ -60,7 +60,7 @@ public: @@ -6442,19 +6412,19 @@ index 24ed7c019bea4df52f2883db0e40bdbc2dc74ebd..a788f534d9e0e8124153c7f380b4fdb2 } diff --git a/Source/WebCore/page/csp/ContentSecurityPolicy.cpp b/Source/WebCore/page/csp/ContentSecurityPolicy.cpp -index 4861e2276c172ea347cd31f68029b49df9350fe1..91c6eb5e3031f863d7b2483d9ba8be75c8718ea0 100644 +index e8cf919fd1d0147fce390aa5750843a6bce40190..fb2d56e3a3b6901f993544e297ad678c469a9cc1 100644 --- a/Source/WebCore/page/csp/ContentSecurityPolicy.cpp +++ b/Source/WebCore/page/csp/ContentSecurityPolicy.cpp -@@ -372,6 +372,8 @@ bool ContentSecurityPolicy::allowContentSecurityPolicySourceStarToMatchAnyProtoc - template - typename std::enable_if::value, bool>::type ContentSecurityPolicy::allPoliciesWithDispositionAllow(Disposition disposition, Predicate&& predicate, Args&&... args) const +@@ -374,6 +374,8 @@ template + bool ContentSecurityPolicy::allPoliciesWithDispositionAllow(Disposition disposition, Predicate&& predicate, Args&&... args) const + requires (!std::is_convertible_v) { + if (InspectorInstrumentation::shouldBypassCSP(m_scriptExecutionContext.get())) + return true; bool isReportOnly = disposition == ContentSecurityPolicy::Disposition::ReportOnly; for (auto& policy : m_policies) { if (policy->isReportOnly() != isReportOnly) -@@ -385,6 +387,8 @@ typename std::enable_if bool ContentSecurityPolicy::allPoliciesWithDispositionAllow(Disposition disposition, ViolatedDirectiveCallback&& callback, Predicate&& predicate, Args&&... args) const { @@ -6463,7 +6433,7 @@ index 4861e2276c172ea347cd31f68029b49df9350fe1..91c6eb5e3031f863d7b2483d9ba8be75 bool isReportOnly = disposition == ContentSecurityPolicy::Disposition::ReportOnly; bool isAllowed = true; for (auto& policy : m_policies) { -@@ -401,6 +405,8 @@ bool ContentSecurityPolicy::allPoliciesWithDispositionAllow(Disposition disposit +@@ -403,6 +407,8 @@ bool ContentSecurityPolicy::allPoliciesWithDispositionAllow(Disposition disposit template bool ContentSecurityPolicy::allPoliciesAllow(NOESCAPE const ViolatedDirectiveCallback& callback, Predicate&& predicate, Args&&... args) const { @@ -6558,18 +6528,6 @@ index 0000000000000000000000000000000000000000..803239911006cfb3b03ea911c003f2d2 +} + +} -diff --git a/Source/WebCore/platform/Cairo.cmake b/Source/WebCore/platform/Cairo.cmake -index 96baa501801c5952d4b5b203dff278adb54aaa54..34c498f6050388d30e4190604e7af6f68b33fab9 100644 ---- a/Source/WebCore/platform/Cairo.cmake -+++ b/Source/WebCore/platform/Cairo.cmake -@@ -15,6 +15,7 @@ list(APPEND WebCore_PRIVATE_FRAMEWORK_HEADERS - platform/graphics/cairo/ImageBufferCairoBackend.h - platform/graphics/cairo/ImageBufferCairoImageSurfaceBackend.h - platform/graphics/cairo/ImageBufferCairoSurfaceBackend.h -+ platform/graphics/cairo/ImageBufferUtilitiesCairo.h - platform/graphics/cairo/RefPtrCairo.h - ) - diff --git a/Source/WebCore/platform/DragData.h b/Source/WebCore/platform/DragData.h index 2ebb3221cb3818f20abc7b7c3307ea7644f49d49..e0bffb6f5adee0b0a202340f633c2def1955b384 100644 --- a/Source/WebCore/platform/DragData.h @@ -6604,7 +6562,7 @@ index 2ebb3221cb3818f20abc7b7c3307ea7644f49d49..e0bffb6f5adee0b0a202340f633c2def bool m_disallowFileAccess { false }; }; diff --git a/Source/WebCore/platform/DragImage.cpp b/Source/WebCore/platform/DragImage.cpp -index 2f4e02e783ac512aeb76e0abe7e253b57bfda937..94e0c9335720324a746f300a26b17a28eedf2197 100644 +index 41b4b3ca89d0df2ccba562d83c33097539b5ae1c..071bee507b730b89796420222b9787bd411a19ad 100644 --- a/Source/WebCore/platform/DragImage.cpp +++ b/Source/WebCore/platform/DragImage.cpp @@ -280,7 +280,7 @@ DragImage::~DragImage() @@ -6630,7 +6588,7 @@ index 77286d8e715825c9c7c0d329480fc0fc497fe561..5ea53eb8b7e53dd5a5950c65a38c1d23 #elif USE(CAIRO) typedef RefPtr DragImageRef; diff --git a/Source/WebCore/platform/Pasteboard.h b/Source/WebCore/platform/Pasteboard.h -index 1b1a1147d4948e9281a114281e95d57d3b0ccf27..e21ccb98542cc582ad2489d301cb29c2b0c03f4b 100644 +index f8de8815d483bd3ac684c018159c593798c0495a..e84ce8eec7424fbc3456623289588b1832d9fb7f 100644 --- a/Source/WebCore/platform/Pasteboard.h +++ b/Source/WebCore/platform/Pasteboard.h @@ -46,7 +46,7 @@ OBJC_CLASS NSString; @@ -6642,17 +6600,8 @@ index 1b1a1147d4948e9281a114281e95d57d3b0ccf27..e21ccb98542cc582ad2489d301cb29c2 #include "SelectionData.h" #endif -@@ -108,7 +108,7 @@ struct PasteboardURL { - #if PLATFORM(MAC) - String userVisibleForm; - #endif --#if PLATFORM(GTK) -+#if PLATFORM(GTK) || PLATFORM(WPE) - String markup; - #endif - }; -@@ -197,6 +197,11 @@ public: - #endif +@@ -200,6 +200,11 @@ public: + explicit Pasteboard(std::unique_ptr&&, const String& name); #endif +#if PLATFORM(WPE) && ENABLE(DRAG_SUPPORT) @@ -6663,8 +6612,8 @@ index 1b1a1147d4948e9281a114281e95d57d3b0ccf27..e21ccb98542cc582ad2489d301cb29c2 #if PLATFORM(WIN) explicit Pasteboard(std::unique_ptr&&, IDataObject*); explicit Pasteboard(std::unique_ptr&&, WCDataObject*); -@@ -264,6 +269,12 @@ public: - int64_t changeCount() const; +@@ -266,6 +271,12 @@ public: + static std::unique_ptr createForGlobalSelection(std::unique_ptr&&); #endif +#if PLATFORM(WPE) @@ -6676,7 +6625,7 @@ index 1b1a1147d4948e9281a114281e95d57d3b0ccf27..e21ccb98542cc582ad2489d301cb29c2 #if PLATFORM(IOS_FAMILY) explicit Pasteboard(std::unique_ptr&&, int64_t changeCount); explicit Pasteboard(std::unique_ptr&&, const String& pasteboardName); -@@ -306,6 +317,7 @@ public: +@@ -311,6 +322,7 @@ public: COMPtr dataObject() const { return m_dataObject; } WEBCORE_EXPORT void setExternalDataObject(IDataObject*); const DragDataMap& dragDataMap() const { return m_dragDataMap; } @@ -6684,7 +6633,7 @@ index 1b1a1147d4948e9281a114281e95d57d3b0ccf27..e21ccb98542cc582ad2489d301cb29c2 void writeURLToWritableDataObject(const URL&, const String&); COMPtr writableDataObject() const { return m_writableDataObject; } void writeImageToDataObject(Element&, const URL&); // FIXME: Layering violation. -@@ -358,6 +370,10 @@ private: +@@ -366,6 +378,10 @@ private: int64_t m_changeCount { 0 }; #endif @@ -6695,7 +6644,7 @@ index 1b1a1147d4948e9281a114281e95d57d3b0ccf27..e21ccb98542cc582ad2489d301cb29c2 #if PLATFORM(COCOA) String m_pasteboardName; int64_t m_changeCount; -@@ -373,6 +389,7 @@ private: +@@ -381,6 +397,7 @@ private: COMPtr m_dataObject; COMPtr m_writableDataObject; DragDataMap m_dragDataMap; @@ -6824,101 +6773,6 @@ index 492c5e76290c2379cda40b9663f5f67ff8f66360..096752985edf39960eb4be6eb733ebe3 static const unsigned scrollbarBorderSize = 1; static const unsigned thumbBorderSize = 1; static const unsigned overlayThumbSize = 3; -diff --git a/Source/WebCore/platform/graphics/cairo/ImageBufferUtilitiesCairo.cpp b/Source/WebCore/platform/graphics/cairo/ImageBufferUtilitiesCairo.cpp -index d137ffd1a8ed0b788bd28197c6d7e9f7d14e852f..dcf8bf3f7ee6b037a370712e2ac36b6e2e4bbebc 100644 ---- a/Source/WebCore/platform/graphics/cairo/ImageBufferUtilitiesCairo.cpp -+++ b/Source/WebCore/platform/graphics/cairo/ImageBufferUtilitiesCairo.cpp -@@ -48,6 +48,13 @@ - #include - #endif - -+#if PLATFORM(WPE) || PLATFORM(WIN) -+#include // Needed by jpeglib.h for FILE. -+extern "C" { -+#include "jpeglib.h" -+} -+#endif -+ - namespace WebCore { - - #if !PLATFORM(GTK) -@@ -65,8 +72,75 @@ static bool encodeImage(cairo_surface_t* image, const String& mimeType, Vector encodeData(cairo_surface_t* image, const String& mimeType, std::optional) -+static Vector encodeJpeg(cairo_surface_t* image, int quality) -+{ -+ if (cairo_surface_get_type(image) != CAIRO_SURFACE_TYPE_IMAGE) { -+ fprintf(stderr, "Unexpected cairo surface type: %d\n", cairo_surface_get_type(image)); -+ return { }; -+ } -+ -+ if (cairo_image_surface_get_format(image) != CAIRO_FORMAT_ARGB32) { -+ fprintf(stderr, "Unexpected surface image format: %d\n", cairo_image_surface_get_format(image)); -+ return { }; -+ } -+ -+ struct jpeg_compress_struct info; -+ struct jpeg_error_mgr error; -+ info.err = jpeg_std_error(&error); -+ jpeg_create_compress(&info); -+ -+ unsigned char* bufferPtr = nullptr; -+ unsigned long bufferSize; -+ jpeg_mem_dest(&info, &bufferPtr, &bufferSize); -+ info.image_width = cairo_image_surface_get_width(image); -+ info.image_height = cairo_image_surface_get_height(image); -+ -+#ifndef LIBJPEG_TURBO_VERSION -+ COMPILE_ASSERT(false, only_libjpeg_turbo_is_supported); -+#endif -+ -+#if CPU(LITTLE_ENDIAN) -+ info.in_color_space = JCS_EXT_BGRA; -+#else -+ info.in_color_space = JCS_EXT_ARGB; -+#endif -+ // # of color components in input image -+ info.input_components = 4; -+ -+ jpeg_set_defaults(&info); -+ jpeg_set_quality(&info, quality, true); -+ -+ jpeg_start_compress(&info, true); -+ -+ while (info.next_scanline < info.image_height) -+ { -+ JSAMPROW row = cairo_image_surface_get_data(image) + (info.next_scanline * cairo_image_surface_get_stride(image)); -+ if (jpeg_write_scanlines(&info, &row, 1) != 1) { -+ fprintf(stderr, "JPEG library failed to encode line\n"); -+ break; -+ } -+ } -+ -+ jpeg_finish_compress(&info); -+ jpeg_destroy_compress(&info); -+ -+ Vector output; -+ output.append(std::span { bufferPtr, bufferSize }); -+ // Cannot use unique_ptr as bufferPtr changes during compression. GUniquePtr would work -+ // but it's under GLib and won't work on Windows. -+ free(bufferPtr); -+ return output; -+} -+ -+Vector encodeData(cairo_surface_t* image, const String& mimeType, std::optional quality) - { -+ if (mimeType == "image/jpeg"_s) { -+ int qualityPercent = 100; -+ if (quality) -+ qualityPercent = static_cast(*quality * 100.0 + 0.5); -+ return encodeJpeg(image, qualityPercent); -+ } -+ - Vector encodedImage; - if (!image || !encodeImage(image, mimeType, &encodedImage)) - return { }; diff --git a/Source/WebCore/platform/graphics/cg/ImageBufferUtilitiesCG.h b/Source/WebCore/platform/graphics/cg/ImageBufferUtilitiesCG.h index 5b659c763b9754b025a63f89522954cc39915b9a..448b50a2b131361a75d3f816cdcbb6a102551280 100644 --- a/Source/WebCore/platform/graphics/cg/ImageBufferUtilitiesCG.h @@ -6933,7 +6787,7 @@ index 5b659c763b9754b025a63f89522954cc39915b9a..448b50a2b131361a75d3f816cdcbb6a1 Vector encodeData(std::span, const String& mimeType, std::optional quality); diff --git a/Source/WebCore/platform/graphics/filters/software/FEComponentTransferSoftwareApplier.h b/Source/WebCore/platform/graphics/filters/software/FEComponentTransferSoftwareApplier.h -index 3d0ab7eceaf2a6321685bc362eb9b25600fd98fd..2d7e9a399bf2e9dc3f373d5fa3db99fa0908bd9d 100644 +index c7542b821af8c87660e10b0c07b360cfcc8e28a2..a3cc131ff0410ae31df30c115dd9fd26aec5adf8 100644 --- a/Source/WebCore/platform/graphics/filters/software/FEComponentTransferSoftwareApplier.h +++ b/Source/WebCore/platform/graphics/filters/software/FEComponentTransferSoftwareApplier.h @@ -23,6 +23,7 @@ @@ -7266,213 +7120,6 @@ index 1339241aae69b657ffa40b603eea992c45db0e65..9194ff5f8308e5cf22fb250723ae4161 { return getScreenProperties().screenHasTouchDevice; } -diff --git a/Source/WebCore/platform/libwpe/PasteboardLibWPE.cpp b/Source/WebCore/platform/libwpe/PasteboardLibWPE.cpp -index ae439e30f1fb239d18e1164e8896dfb272c75673..4cf29eda13d1f2dc2f03750c0ef8985b17de7f50 100644 ---- a/Source/WebCore/platform/libwpe/PasteboardLibWPE.cpp -+++ b/Source/WebCore/platform/libwpe/PasteboardLibWPE.cpp -@@ -32,6 +32,10 @@ - #include "PasteboardStrategy.h" - #include "PlatformStrategies.h" - -+#if ENABLE(DRAG_SUPPORT) -+#include "DragData.h" -+#endif -+ - namespace WebCore { - - std::unique_ptr Pasteboard::createForCopyAndPaste(std::unique_ptr&& context) -@@ -52,9 +56,28 @@ bool Pasteboard::hasData() - return !types.isEmpty(); - } - --Vector Pasteboard::typesSafeForBindings(const String&) -+Vector Pasteboard::typesSafeForBindings(const String& origin) - { -- notImplemented(); -+ if (m_selectionData) { -+ ListHashSet types; -+ if (auto& buffer = m_selectionData->customData()) { -+ auto customData = PasteboardCustomData::fromSharedBuffer(*buffer); -+ if (customData.origin() == origin) { -+ for (auto& type : customData.orderedTypes()) -+ types.add(type); -+ } -+ } -+ -+ if (m_selectionData->hasText()) -+ types.add("text/plain"_s); -+ if (m_selectionData->hasMarkup()) -+ types.add("text/html"_s); -+ if (m_selectionData->hasURIList()) -+ types.add("text/uri-list"_s); -+ -+ return copyToVector(types); -+ } -+ - return { }; - } - -@@ -67,23 +90,55 @@ Vector Pasteboard::typesForLegacyUnsafeBindings() - - String Pasteboard::readOrigin() - { -- notImplemented(); // webkit.org/b/177633: [GTK] Move to new Pasteboard API -+ if (m_selectionData) { -+ if (auto& buffer = m_selectionData->customData()) -+ return PasteboardCustomData::fromSharedBuffer(*buffer).origin(); -+ -+ return { }; -+ } -+ - return { }; - } - - String Pasteboard::readString(const String& type) - { -+ if (m_selectionData) { -+ if (type == "text/plain"_s) -+ return m_selectionData->text();; -+ if (type == "text/html"_s) -+ return m_selectionData->markup(); -+ if (type == "Files"_s || type == "text/uri-list"_s) -+ return m_selectionData->uriList(); -+ return { }; -+ } -+ - return platformStrategies()->pasteboardStrategy()->readStringFromPasteboard(0, type, name(), context()); - } - --String Pasteboard::readStringInCustomData(const String&) -+String Pasteboard::readStringInCustomData(const String& type) - { -+ if (m_selectionData) { -+ if (auto& buffer = m_selectionData->customData()) -+ return PasteboardCustomData::fromSharedBuffer(*buffer).readStringInCustomData(type); -+ -+ return { }; -+ } -+ - notImplemented(); - return { }; - } - - void Pasteboard::writeString(const String& type, const String& text) - { -+ if (m_selectionData) { -+ if (type == "Files"_s || type == "text/uri-list"_s) -+ m_selectionData->setURIList(text); -+ else if (type == "text/html"_s) -+ m_selectionData->setMarkup(text); -+ else if (type == "text/plain"_s) -+ m_selectionData->setText(text); -+ return; -+ } - platformStrategies()->pasteboardStrategy()->writeToPasteboard(type, text); - } - -@@ -111,7 +166,12 @@ void Pasteboard::read(PasteboardFileReader&, std::optional) - - void Pasteboard::write(const PasteboardURL& url) - { -- platformStrategies()->pasteboardStrategy()->writeToPasteboard("text/plain;charset=utf-8"_s, url.url.string()); -+ if (m_selectionData) { -+ m_selectionData->clearAll(); -+ m_selectionData->setURL(url.url, url.title); -+ } else { -+ platformStrategies()->pasteboardStrategy()->writeToPasteboard("text/plain;charset=utf-8"_s, url.url.string()); -+ } - } - - void Pasteboard::writeTrustworthyWebURLsPboardType(const PasteboardURL&) -@@ -119,8 +179,16 @@ void Pasteboard::writeTrustworthyWebURLsPboardType(const PasteboardURL&) - notImplemented(); - } - --void Pasteboard::write(const PasteboardImage&) -+void Pasteboard::write(const PasteboardImage& pasteboardImage) - { -+ if (m_selectionData) { -+ m_selectionData->clearAll(); -+ if (!pasteboardImage.url.url.isEmpty()) { -+ m_selectionData->setURL(pasteboardImage.url.url, pasteboardImage.url.title); -+ m_selectionData->setMarkup(pasteboardImage.url.markup); -+ } -+ m_selectionData->setImage(pasteboardImage.image.get()); -+ } - } - - void Pasteboard::write(const PasteboardBuffer&) -@@ -129,7 +197,13 @@ void Pasteboard::write(const PasteboardBuffer&) - - void Pasteboard::write(const PasteboardWebContent& content) - { -- platformStrategies()->pasteboardStrategy()->writeToPasteboard(content); -+ if (m_selectionData) { -+ m_selectionData->clearAll(); -+ m_selectionData->setText(content.text); -+ m_selectionData->setMarkup(content.markup); -+ } else { -+ platformStrategies()->pasteboardStrategy()->writeToPasteboard(content); -+ } - } - - Pasteboard::FileContentState Pasteboard::fileContentState() -@@ -152,14 +226,54 @@ void Pasteboard::writePlainText(const String& text, SmartReplaceOption) - writeString("text/plain;charset=utf-8"_s, text); - } - --void Pasteboard::writeCustomData(const Vector&) -+void Pasteboard::writeCustomData(const Vector& data) - { -+ if (m_selectionData) { -+ if (!data.isEmpty()) { -+ const auto& customData = data[0]; -+ customData.forEachPlatformString([this] (auto& type, auto& string) { -+ writeString(type, string); -+ }); -+ if (customData.hasSameOriginCustomData() || !customData.origin().isEmpty()) -+ m_selectionData->setCustomData(customData.createSharedBuffer()); -+ } -+ return; -+ } - } - - void Pasteboard::write(const Color&) - { - } - -+#if ENABLE(DRAG_SUPPORT) -+ -+Pasteboard::Pasteboard(std::unique_ptr&& context, SelectionData&& selectionData) -+ : m_context(WTFMove(context)) -+ , m_selectionData(WTFMove(selectionData)) -+{ -+} -+ -+Pasteboard::Pasteboard(std::unique_ptr&& context, SelectionData& selectionData) -+ : m_context(WTFMove(context)) -+ , m_selectionData(selectionData) -+{ -+} -+ -+std::unique_ptr Pasteboard::createForDragAndDrop(std::unique_ptr&& context) -+{ -+ return makeUnique(WTFMove(context), SelectionData()); -+} -+ -+std::unique_ptr Pasteboard::create(const DragData& dragData) -+{ -+ RELEASE_ASSERT(dragData.platformData()); -+ return makeUnique(dragData.createPasteboardContext(), *dragData.platformData()); -+} -+void Pasteboard::setDragImage(DragImage, const IntPoint&) -+{ -+} -+#endif -+ - } // namespace WebCore - - #endif // USE(LIBWPE) diff --git a/Source/WebCore/platform/libwpe/PlatformKeyboardEventLibWPE.cpp b/Source/WebCore/platform/libwpe/PlatformKeyboardEventLibWPE.cpp index a8674916429908cabb86bd95dc5b3da217e1556b..6a464e2b0c1c45cd4e8effba678b8dde9dd870da 100644 --- a/Source/WebCore/platform/libwpe/PlatformKeyboardEventLibWPE.cpp @@ -7737,7 +7384,7 @@ index a8674916429908cabb86bd95dc5b3da217e1556b..6a464e2b0c1c45cd4e8effba678b8dde { switch (val) { diff --git a/Source/WebCore/platform/libwpe/PlatformPasteboardLibWPE.cpp b/Source/WebCore/platform/libwpe/PlatformPasteboardLibWPE.cpp -index 16b45d9d3f3787a348d2d26427ca2b03fd5cf3d5..448321a8388b7075173061caf8c9b272997e02fd 100644 +index f21f7d66c5dd661c289a453994597ae166c8f3d0..c293b72154e2cb8f4f1ad3cc222a05f29888891d 100644 --- a/Source/WebCore/platform/libwpe/PlatformPasteboardLibWPE.cpp +++ b/Source/WebCore/platform/libwpe/PlatformPasteboardLibWPE.cpp @@ -31,10 +31,18 @@ @@ -7759,7 +7406,7 @@ index 16b45d9d3f3787a348d2d26427ca2b03fd5cf3d5..448321a8388b7075173061caf8c9b272 PlatformPasteboard::PlatformPasteboard(const String&) : m_pasteboard(wpe_pasteboard_get_singleton()) { -@@ -54,72 +62,26 @@ void PlatformPasteboard::performAsDataOwner(DataOwnerType, NOESCAPE Function& types) const { @@ -7793,7 +7440,7 @@ index 16b45d9d3f3787a348d2d26427ca2b03fd5cf3d5..448321a8388b7075173061caf8c9b272 void PlatformPasteboard::write(const PasteboardWebContent& content) { - static constexpr auto plainText = "text/plain;charset=utf-8"_s; -- static constexpr auto htmlText = "text/html;charset=utf-8"_s; +- static constexpr auto htmlText = "text/html"_s; - - CString textString = content.text.utf8(); - CString markupString = content.markup.utf8(); @@ -7809,6 +7456,7 @@ index 16b45d9d3f3787a348d2d26427ca2b03fd5cf3d5..448321a8388b7075173061caf8c9b272 - struct wpe_pasteboard_string_map map = { pairs.data(), pairs.size() }; - - wpe_pasteboard_write(m_pasteboard, &map); +- m_changeCount++; - - wpe_pasteboard_string_free(&pairs[0].type); - wpe_pasteboard_string_free(&pairs[0].string); @@ -7833,6 +7481,7 @@ index 16b45d9d3f3787a348d2d26427ca2b03fd5cf3d5..448321a8388b7075173061caf8c9b272 - struct wpe_pasteboard_string_map map = { pairs, 1 }; - - wpe_pasteboard_write(m_pasteboard, &map); +- m_changeCount++; - - wpe_pasteboard_string_free(&pairs[0].type); - wpe_pasteboard_string_free(&pairs[0].string); @@ -7840,6 +7489,19 @@ index 16b45d9d3f3787a348d2d26427ca2b03fd5cf3d5..448321a8388b7075173061caf8c9b272 } Vector PlatformPasteboard::typesSafeForDOMToReadAndWrite(const String&) const +diff --git a/Source/WebCore/platform/mediastream/libwebrtc/gstreamer/GStreamerVideoFrameLibWebRTC.cpp b/Source/WebCore/platform/mediastream/libwebrtc/gstreamer/GStreamerVideoFrameLibWebRTC.cpp +index 80c20938d5ec8282485fb0152b96304c83124354..22975b7c1b99357a7689747251410f306bfb3dcc 100644 +--- a/Source/WebCore/platform/mediastream/libwebrtc/gstreamer/GStreamerVideoFrameLibWebRTC.cpp ++++ b/Source/WebCore/platform/mediastream/libwebrtc/gstreamer/GStreamerVideoFrameLibWebRTC.cpp +@@ -23,6 +23,8 @@ + + #include + #include ++#include ++#include + #include + #include + #include diff --git a/Source/WebCore/platform/network/HTTPHeaderMap.cpp b/Source/WebCore/platform/network/HTTPHeaderMap.cpp index 1178c8fb001994bc9e6166376a367d9bc148913c..fcc6534568cad6b42a819a435f84ba2b9baae6f8 100644 --- a/Source/WebCore/platform/network/HTTPHeaderMap.cpp @@ -7858,10 +7520,10 @@ index 1178c8fb001994bc9e6166376a367d9bc148913c..fcc6534568cad6b42a819a435f84ba2b m_commonHeaders.append(CommonHeader { name, value }); } diff --git a/Source/WebCore/platform/network/NetworkStorageSession.h b/Source/WebCore/platform/network/NetworkStorageSession.h -index 18e1d04c6f984c1c3502542399ab1b8eeba1f239..2ec3ed7e28cdf802c017ca705bab3bf769f69a21 100644 +index c1e50549e674e1620ad0515a061376ba728e75df..7e6e323436d9b1a87dbf4d6fa275629f531e3ce8 100644 --- a/Source/WebCore/platform/network/NetworkStorageSession.h +++ b/Source/WebCore/platform/network/NetworkStorageSession.h -@@ -202,6 +202,7 @@ public: +@@ -198,6 +198,7 @@ public: NetworkingContext* context() const; #endif @@ -7870,16 +7532,16 @@ index 18e1d04c6f984c1c3502542399ab1b8eeba1f239..2ec3ed7e28cdf802c017ca705bab3bf7 WEBCORE_EXPORT HTTPCookieAcceptPolicy cookieAcceptPolicy() const; WEBCORE_EXPORT void setCookie(const Cookie&); diff --git a/Source/WebCore/platform/network/ResourceResponseBase.cpp b/Source/WebCore/platform/network/ResourceResponseBase.cpp -index bc4d0a6059710f349685b9782079e17f19e289fa..f15d5944bf4259248c1dcc11bd536e5398cb7f03 100644 +index a4ed6a5f1182b43432f6082ffc10b62473c248e5..05113dbf615171a0b18f8998411e603076bdc15b 100644 --- a/Source/WebCore/platform/network/ResourceResponseBase.cpp +++ b/Source/WebCore/platform/network/ResourceResponseBase.cpp -@@ -78,6 +78,7 @@ ResourceResponseBase::ResourceResponseBase(std::optional d - , m_httpStatusText(data ? data->httpStatusText : String { }) - , m_httpVersion(data ? data->httpVersion : String { }) - , m_httpHeaderFields(data ? data->httpHeaderFields : HTTPHeaderMap { }) +@@ -78,6 +78,7 @@ ResourceResponseBase::ResourceResponseBase(std::optional&& + , m_httpStatusText(data ? WTFMove(data->httpStatusText) : String { }) + , m_httpVersion(data ? WTFMove(data->httpVersion) : String { }) + , m_httpHeaderFields(data ? WTFMove(data->httpHeaderFields) : HTTPHeaderMap { }) + , m_httpRequestHeaderFields(data ? data->httpRequestHeaderFields : HTTPHeaderMap { }) - , m_networkLoadMetrics(data && data->networkLoadMetrics ? Box::create(*data->networkLoadMetrics) : Box { }) - , m_certificateInfo(data ? data->certificateInfo : std::nullopt) + , m_networkLoadMetrics(data && data->networkLoadMetrics ? Box::create(WTFMove(*data->networkLoadMetrics)) : Box { }) + , m_certificateInfo(data ? WTFMove(data->certificateInfo) : std::nullopt) , m_httpStatusCode(data ? data->httpStatusCode : 0) @@ -904,6 +905,7 @@ std::optional ResourceResponseBase::getResponseData() cons String { m_httpStatusText }, @@ -7910,7 +7572,7 @@ index bc4d0a6059710f349685b9782079e17f19e289fa..f15d5944bf4259248c1dcc11bd536e53 *source, *type, diff --git a/Source/WebCore/platform/network/ResourceResponseBase.h b/Source/WebCore/platform/network/ResourceResponseBase.h -index be9d60dc24eec83f9b7fad5c9bbcdffc2cbd3bb4..9fe86dc133adb69e21a1e9067ea0b2a130f3def6 100644 +index 9e2bc7f05c5700c5f86bfaf03f13e2308ed097ed..01bae357d25b8dfef4c0d2cdb87cbc7a3895b416 100644 --- a/Source/WebCore/platform/network/ResourceResponseBase.h +++ b/Source/WebCore/platform/network/ResourceResponseBase.h @@ -256,6 +256,11 @@ protected: @@ -7951,10 +7613,10 @@ index be9d60dc24eec83f9b7fad5c9bbcdffc2cbd3bb4..9fe86dc133adb69e21a1e9067ea0b2a1 ResourceResponseBase::Source source; ResourceResponseBase::Type type; diff --git a/Source/WebCore/platform/network/cocoa/NetworkStorageSessionCocoa.mm b/Source/WebCore/platform/network/cocoa/NetworkStorageSessionCocoa.mm -index d938386a2a7bb9a338b781706434fbee753a5ad4..96b8e6d3b7fc65fb6f04162e4975467b3cbd3cf4 100644 +index 4a6533db6aff0620e7122e684f1ef6c723bf7942..395f275722b93a7ab08429588fbc1fdc1ebac4f3 100644 --- a/Source/WebCore/platform/network/cocoa/NetworkStorageSessionCocoa.mm +++ b/Source/WebCore/platform/network/cocoa/NetworkStorageSessionCocoa.mm -@@ -552,6 +552,22 @@ bool NetworkStorageSession::setCookieFromDOM(const URL& firstParty, const SameSi +@@ -553,6 +553,22 @@ bool NetworkStorageSession::setCookieFromDOM(const URL& firstParty, const SameSi return false; } @@ -7990,92 +7652,12 @@ index 37e129136c69b27d509acc01f10be42a8a1fe35a..9df0babc8f82372925fddf2211a7c8c9 String m_databasePath; bool m_detectedDatabaseCorruption { false }; -diff --git a/Source/WebCore/platform/network/curl/CurlStream.cpp b/Source/WebCore/platform/network/curl/CurlStream.cpp -index d07f26d77447d05fa2b086d04e6aa105c3d6b4b1..52b09365fff63fa4099320d0eebc1d498e0c068e 100644 ---- a/Source/WebCore/platform/network/curl/CurlStream.cpp -+++ b/Source/WebCore/platform/network/curl/CurlStream.cpp -@@ -37,7 +37,7 @@ namespace WebCore { - - WTF_MAKE_TZONE_ALLOCATED_IMPL(CurlStream); - --CurlStream::CurlStream(CurlStreamScheduler& scheduler, CurlStreamID streamID, URL&& url, ServerTrustEvaluation serverTrustEvaluation, LocalhostAlias localhostAlias) -+CurlStream::CurlStream(CurlStreamScheduler& scheduler, CurlStreamID streamID, bool ignoreCertificateErrors, URL&& url, ServerTrustEvaluation serverTrustEvaluation, LocalhostAlias localhostAlias) - : m_scheduler(scheduler) - , m_streamID(streamID) - { -@@ -52,6 +52,9 @@ CurlStream::CurlStream(CurlStreamScheduler& scheduler, CurlStreamID streamID, UR - m_curlHandle->disableServerTrustEvaluation(); - - m_curlHandle->enableConnectionOnly(); -+ if (ignoreCertificateErrors) -+ m_curlHandle->disableServerTrustEvaluation(); -+ - - auto errorCode = m_curlHandle->perform(); - if (errorCode != CURLE_OK) { -diff --git a/Source/WebCore/platform/network/curl/CurlStream.h b/Source/WebCore/platform/network/curl/CurlStream.h -index 96c3d2c216d522cf5c8b53b06a87eb849d159618..b595a1cfe961ad98364d8893014ab5c2fc1007f5 100644 ---- a/Source/WebCore/platform/network/curl/CurlStream.h -+++ b/Source/WebCore/platform/network/curl/CurlStream.h -@@ -56,12 +56,12 @@ public: - virtual void didFail(CurlStreamID, CURLcode, CertificateInfo&&) = 0; - }; - -- static std::unique_ptr create(CurlStreamScheduler& scheduler, CurlStreamID streamID, URL&& url, ServerTrustEvaluation serverTrustEvaluation, LocalhostAlias localhostAlias) -+ static std::unique_ptr create(CurlStreamScheduler& scheduler, CurlStreamID streamID, bool ignoreCertificateErrors, URL&& url, ServerTrustEvaluation serverTrustEvaluation, LocalhostAlias localhostAlias) - { -- return makeUnique(scheduler, streamID, WTFMove(url), serverTrustEvaluation, localhostAlias); -+ return makeUnique(scheduler, streamID, ignoreCertificateErrors, WTFMove(url), serverTrustEvaluation, localhostAlias); - } - -- CurlStream(CurlStreamScheduler&, CurlStreamID, URL&&, ServerTrustEvaluation, LocalhostAlias); -+ CurlStream(CurlStreamScheduler&, CurlStreamID, bool ignoreCertificateErrors, URL&&, ServerTrustEvaluation, LocalhostAlias); - virtual ~CurlStream(); - - void send(UniqueArray&&, size_t); -diff --git a/Source/WebCore/platform/network/curl/CurlStreamScheduler.cpp b/Source/WebCore/platform/network/curl/CurlStreamScheduler.cpp -index 83c4ca7871e536077f2d0a1a8ba6e2b4adb584da..12a49c124283fbe50ac17ecaa0c1e6fee32741d6 100644 ---- a/Source/WebCore/platform/network/curl/CurlStreamScheduler.cpp -+++ b/Source/WebCore/platform/network/curl/CurlStreamScheduler.cpp -@@ -43,7 +43,7 @@ CurlStreamScheduler::~CurlStreamScheduler() - ASSERT(isMainThread()); - } - --CurlStreamID CurlStreamScheduler::createStream(const URL& url, CurlStream::Client& client, CurlStream::ServerTrustEvaluation serverTrustEvaluation, CurlStream::LocalhostAlias localhostAlias) -+CurlStreamID CurlStreamScheduler::createStream(const URL& url, bool ignoreCertificateErrors, CurlStream::Client& client, CurlStream::ServerTrustEvaluation serverTrustEvaluation, CurlStream::LocalhostAlias localhostAlias) - { - ASSERT(isMainThread()); - -@@ -54,8 +54,8 @@ CurlStreamID CurlStreamScheduler::createStream(const URL& url, CurlStream::Clien - auto streamID = m_currentStreamID; - m_clientList.add(streamID, &client); - -- callOnWorkerThread([this, streamID, url = url.isolatedCopy(), serverTrustEvaluation, localhostAlias]() mutable { -- m_streamList.add(streamID, CurlStream::create(*this, streamID, WTFMove(url), serverTrustEvaluation, localhostAlias)); -+ callOnWorkerThread([this, streamID, ignoreCertificateErrors, url = url.isolatedCopy(), serverTrustEvaluation, localhostAlias]() mutable { -+ m_streamList.add(streamID, CurlStream::create(*this, streamID, ignoreCertificateErrors, WTFMove(url), serverTrustEvaluation, localhostAlias)); - }); - - return streamID; -diff --git a/Source/WebCore/platform/network/curl/CurlStreamScheduler.h b/Source/WebCore/platform/network/curl/CurlStreamScheduler.h -index 2d7a77d759aaea9a541030af5e6015a8ed9c97a4..a0c947d325c984045dbbdf2580d19a32eea86ada 100644 ---- a/Source/WebCore/platform/network/curl/CurlStreamScheduler.h -+++ b/Source/WebCore/platform/network/curl/CurlStreamScheduler.h -@@ -39,7 +39,7 @@ public: - CurlStreamScheduler(); - virtual ~CurlStreamScheduler(); - -- WEBCORE_EXPORT CurlStreamID createStream(const URL&, CurlStream::Client&, CurlStream::ServerTrustEvaluation, CurlStream::LocalhostAlias); -+ WEBCORE_EXPORT CurlStreamID createStream(const URL&, bool ignoreCertificateErrors, CurlStream::Client&, CurlStream::ServerTrustEvaluation, CurlStream::LocalhostAlias); - WEBCORE_EXPORT void destroyStream(CurlStreamID); - WEBCORE_EXPORT void send(CurlStreamID, UniqueArray&&, size_t); - -diff --git a/Source/WebCore/platform/network/curl/NetworkStorageSessionCurl.cpp b/Source/WebCore/platform/network/curl/NetworkStorageSessionCurl.cpp -index 96289d8ae2e4feb60a91fab3f5cf1fc27b9e7c87..8c0b62c44a18571d1f3ea1ed81d59a0aae28d3f1 100644 ---- a/Source/WebCore/platform/network/curl/NetworkStorageSessionCurl.cpp -+++ b/Source/WebCore/platform/network/curl/NetworkStorageSessionCurl.cpp -@@ -136,6 +136,12 @@ void NetworkStorageSession::setCookieAcceptPolicy(CookieAcceptPolicy policy) con - cookieDatabase().setAcceptPolicy(policy); +diff --git a/Source/WebCore/platform/network/curl/NetworkStorageSessionCurl.cpp b/Source/WebCore/platform/network/curl/NetworkStorageSessionCurl.cpp +index 96289d8ae2e4feb60a91fab3f5cf1fc27b9e7c87..8c0b62c44a18571d1f3ea1ed81d59a0aae28d3f1 100644 +--- a/Source/WebCore/platform/network/curl/NetworkStorageSessionCurl.cpp ++++ b/Source/WebCore/platform/network/curl/NetworkStorageSessionCurl.cpp +@@ -136,6 +136,12 @@ void NetworkStorageSession::setCookieAcceptPolicy(CookieAcceptPolicy policy) con + cookieDatabase().setAcceptPolicy(policy); } +void NetworkStorageSession::setCookiesFromResponse(const URL& firstParty, const SameSiteInfo&, const URL& url, const String& setCookieValue) @@ -8088,7 +7670,7 @@ index 96289d8ae2e4feb60a91fab3f5cf1fc27b9e7c87..8c0b62c44a18571d1f3ea1ed81d59a0a { switch (cookieDatabase().acceptPolicy()) { diff --git a/Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp b/Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp -index 8750fc6d3ad81889da3d60685fc9a107bf4760c1..7a35cf7516b837084fafbfceae84147ab17bd161 100644 +index 274d671614fdca8f425adecb405d5f2402e92f8b..1b19e79e10f0768cfdd66b0fc1b1855388c9f559 100644 --- a/Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp +++ b/Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp @@ -551,6 +551,26 @@ void NetworkStorageSession::replaceCookies(const Vector& cookies) @@ -8270,10 +7852,10 @@ index d450bf9d0fd1f0bf8f28db483ac9d3d60fa9d114..72a59403a0b5493aea4a8e28eb15eac2 OptionSet PlatformKeyboardEvent::currentStateOfModifierKeys() diff --git a/Source/WebCore/platform/win/PasteboardWin.cpp b/Source/WebCore/platform/win/PasteboardWin.cpp -index 8aab5ddd1dc749ecdd02ac59eb81f16294d67235..31cfdfb8dd2e174f39470421c59d9e520ddf84de 100644 +index 7987d1cd71b05ba4cf09eaf0a8b0d55da6bcffb0..5edaa06c1a648402dc0c3224e69c4721a234aa06 100644 --- a/Source/WebCore/platform/win/PasteboardWin.cpp +++ b/Source/WebCore/platform/win/PasteboardWin.cpp -@@ -1142,7 +1142,21 @@ void Pasteboard::writeCustomData(const Vector& data) +@@ -1144,7 +1144,21 @@ void Pasteboard::writeCustomData(const Vector& data) } clear(); @@ -8295,7 +7877,7 @@ index 8aab5ddd1dc749ecdd02ac59eb81f16294d67235..31cfdfb8dd2e174f39470421c59d9e52 if (::OpenClipboard(m_owner)) { const auto& customData = data.first(); customData.forEachPlatformStringOrBuffer([](auto& type, auto& stringOrBuffer) { -@@ -1181,4 +1195,25 @@ void Pasteboard::write(const Color&) +@@ -1183,4 +1197,25 @@ void Pasteboard::write(const Color&) { } @@ -8421,10 +8003,10 @@ index 0000000000000000000000000000000000000000..fbd32d390129129fd5b213f7f9c3e96b +} diff --git a/Source/WebCore/platform/wpe/DragImageWPE.cpp b/Source/WebCore/platform/wpe/DragImageWPE.cpp new file mode 100644 -index 0000000000000000000000000000000000000000..5a20bfaacd42d27bee5f843483d6b60d9dee9dbd +index 0000000000000000000000000000000000000000..4383ede4974fb2b938aa01f2f19eb5e0c47f208c --- /dev/null +++ b/Source/WebCore/platform/wpe/DragImageWPE.cpp -@@ -0,0 +1,73 @@ +@@ -0,0 +1,74 @@ +/* + * Copyright (C) 2010,2017 Igalia S.L. + * @@ -8445,6 +8027,7 @@ index 0000000000000000000000000000000000000000..5a20bfaacd42d27bee5f843483d6b60d + +#include "config.h" +#include "DragImage.h" ++#include "NativeImage.h" +#include "NotImplemented.h" + +#include "Image.h" @@ -8498,259 +8081,209 @@ index 0000000000000000000000000000000000000000..5a20bfaacd42d27bee5f843483d6b60d +} + +} -diff --git a/Source/WebCore/platform/wpe/SelectionData.cpp b/Source/WebCore/platform/wpe/SelectionData.cpp -new file mode 100644 -index 0000000000000000000000000000000000000000..947bfe6576780038ecb87ea9bda116adb19dfd71 ---- /dev/null -+++ b/Source/WebCore/platform/wpe/SelectionData.cpp -@@ -0,0 +1,151 @@ -+/* -+ * Copyright (C) 2009, Martin Robinson -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2 of the License, or (at your option) any later version. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ */ -+ -+#include "config.h" -+#include "SelectionData.h" -+ -+#include -+#include -+#include -+ -+namespace WebCore { -+ -+SelectionData::SelectionData(const String& text, const String& markup, const URL& url, const String& uriList, RefPtr&& image, RefPtr&& buffer, bool canSmartReplace) -+{ -+ if (!text.isEmpty()) -+ setText(text); -+ if (!markup.isEmpty()) -+ setMarkup(markup); -+ if (!url.isEmpty()) -+ setURL(url, String()); -+ if (!uriList.isEmpty()) -+ setURIList(uriList); -+ if (image) -+ setImage(WTFMove(image)); -+ if (buffer) -+ setCustomData(buffer.releaseNonNull()); -+ setCanSmartReplace(canSmartReplace); -+} +diff --git a/Source/WebCore/platform/wpe/PasteboardWPE.cpp b/Source/WebCore/platform/wpe/PasteboardWPE.cpp +index c0847a84e4aeba3dac78a8ffe9826d906d33a387..c1c60572473dad33e436ab4f52e5cac5bc2d2f76 100644 +--- a/Source/WebCore/platform/wpe/PasteboardWPE.cpp ++++ b/Source/WebCore/platform/wpe/PasteboardWPE.cpp +@@ -36,6 +36,10 @@ + #include "SharedBuffer.h" + #include + ++#if ENABLE(DRAG_SUPPORT) ++#include "DragData.h" ++#endif + -+static void replaceNonBreakingSpaceWithSpace(String& str) -+{ -+ static const UChar NonBreakingSpaceCharacter = 0xA0; -+ static const UChar SpaceCharacter = ' '; -+ str = makeStringByReplacingAll(str, NonBreakingSpaceCharacter, SpaceCharacter); -+} + namespace WebCore { + + std::unique_ptr Pasteboard::createForCopyAndPaste(std::unique_ptr&& context) +@@ -55,8 +59,17 @@ Pasteboard::Pasteboard(std::unique_ptr&& context) + { + } + +-void Pasteboard::writeString(const String&, const String&) ++void Pasteboard::writeString(const String& type, const String& text) + { ++ if (m_selectionData) { ++ if (type == "Files"_s || type == "text/uri-list"_s) ++ m_selectionData->setURIList(text); ++ else if (type == "text/html"_s) ++ m_selectionData->setMarkup(text); ++ else if (type == "text/plain"_s) ++ m_selectionData->setText(text); ++ return; ++ } + notImplemented(); + } + +@@ -69,6 +82,11 @@ void Pasteboard::writePlainText(const String& text, SmartReplaceOption) + + void Pasteboard::write(const PasteboardURL& pasteboardURL) + { ++ if (m_selectionData) { ++ m_selectionData->clearAll(); ++ m_selectionData->setURL(pasteboardURL.url, pasteboardURL.title); ++ return; ++ } + ASSERT(!pasteboardURL.url.isEmpty()); + SelectionData data; + data.setURL(pasteboardURL.url, pasteboardURL.title); +@@ -82,6 +100,15 @@ void Pasteboard::writeTrustworthyWebURLsPboardType(const PasteboardURL&) + + void Pasteboard::write(const PasteboardImage& pasteboardImage) + { ++ if (m_selectionData) { ++ m_selectionData->clearAll(); ++ if (!pasteboardImage.url.url.isEmpty()) { ++ m_selectionData->setURL(pasteboardImage.url.url, pasteboardImage.url.title); ++ m_selectionData->setMarkup(pasteboardImage.url.markup); ++ } ++ m_selectionData->setImage(pasteboardImage.image.get()); ++ return; ++ } + SelectionData data; + if (!pasteboardImage.url.url.isEmpty()) { + data.setURL(pasteboardImage.url.url, pasteboardImage.url.title); +@@ -98,6 +125,12 @@ void Pasteboard::write(const PasteboardBuffer&) + + void Pasteboard::write(const PasteboardWebContent& pasteboardContent) + { ++ if (m_selectionData) { ++ m_selectionData->clearAll(); ++ m_selectionData->setText(pasteboardContent.text); ++ m_selectionData->setMarkup(pasteboardContent.markup); ++ return; ++ } + SelectionData data; + data.setText(pasteboardContent.text); + data.setMarkup(pasteboardContent.markup); +@@ -191,6 +224,26 @@ bool Pasteboard::hasData() + + Vector Pasteboard::typesSafeForBindings(const String& origin) + { ++ if (m_selectionData) { ++ ListHashSet types; ++ if (auto& buffer = m_selectionData->customData()) { ++ auto customData = PasteboardCustomData::fromSharedBuffer(*buffer); ++ if (customData.origin() == origin) { ++ for (auto& type : customData.orderedTypes()) ++ types.add(type); ++ } ++ } + -+void SelectionData::setText(const String& newText) -+{ -+ m_text = newText; -+ replaceNonBreakingSpaceWithSpace(m_text); -+} ++ if (m_selectionData->hasText()) ++ types.add("text/plain"_s); ++ if (m_selectionData->hasMarkup()) ++ types.add("text/html"_s); ++ if (m_selectionData->hasURIList()) ++ types.add("text/uri-list"_s); + -+void SelectionData::setURIList(const String& uriListString) -+{ -+ m_uriList = uriListString; ++ return copyToVector(types); ++ } + -+ // This code is originally from: platform/chromium/ChromiumDataObject.cpp. -+ // FIXME: We should make this code cross-platform eventually. + return platformStrategies()->pasteboardStrategy()->typesSafeForDOMToReadAndWrite(m_name, origin, context()); + } + +@@ -201,6 +254,13 @@ Vector Pasteboard::typesForLegacyUnsafeBindings() + + String Pasteboard::readOrigin() + { ++ if (m_selectionData) { ++ if (auto& buffer = m_selectionData->customData()) ++ return PasteboardCustomData::fromSharedBuffer(*buffer).origin(); + -+ // Line separator is \r\n per RFC 2483 - however, for compatibility -+ // reasons we also allow just \n here. ++ return { }; ++ } + -+ // Process the input and copy the first valid URL into the url member. -+ // In case no URLs can be found, subsequent calls to getData("URL") -+ // will get an empty string. This is in line with the HTML5 spec (see -+ // "The DragEvent and DataTransfer interfaces"). Also extract all filenames -+ // from the URI list. -+ bool setURL = hasURL(); -+ for (auto& line : uriListString.split('\n')) { -+ line = line.trim(deprecatedIsSpaceOrNewline); -+ if (line.isEmpty()) -+ continue; -+ if (line[0] == '#') -+ continue; + // FIXME: cache custom data? + if (auto buffer = platformStrategies()->pasteboardStrategy()->readBufferFromClipboard(m_name, PasteboardCustomData::wpeType())) + return PasteboardCustomData::fromSharedBuffer(*buffer).origin(); +@@ -210,11 +270,27 @@ String Pasteboard::readOrigin() + + String Pasteboard::readString(const String& type) + { ++ if (m_selectionData) { ++ if (type == "text/plain"_s) ++ return m_selectionData->text();; ++ if (type == "text/html"_s) ++ return m_selectionData->markup(); ++ if (type == "Files"_s || type == "text/uri-list"_s) ++ return m_selectionData->uriList(); ++ return { }; ++ } + -+ URL url = URL(URL(), line); -+ if (url.isValid()) { -+ if (!setURL) { -+ m_url = url; -+ setURL = true; -+ } + return platformStrategies()->pasteboardStrategy()->readTextFromClipboard(m_name, type); + } + + String Pasteboard::readStringInCustomData(const String& type) + { ++ if (m_selectionData) { ++ if (auto& buffer = m_selectionData->customData()) ++ return PasteboardCustomData::fromSharedBuffer(*buffer).readStringInCustomData(type); + -+ GUniqueOutPtr error; -+ GUniquePtr filename(g_filename_from_uri(line.utf8().data(), 0, &error.outPtr())); -+ if (!error && filename) -+ m_filenames.append(String::fromUTF8(filename.get())); ++ return { }; ++ } + // FIXME: cache custom data? + if (auto buffer = platformStrategies()->pasteboardStrategy()->readBufferFromClipboard(m_name, PasteboardCustomData::wpeType())) + return PasteboardCustomData::fromSharedBuffer(*buffer).readStringInCustomData(type); +@@ -244,6 +320,17 @@ void Pasteboard::writeMarkup(const String&) + + void Pasteboard::writeCustomData(const Vector& data) + { ++ if (m_selectionData) { ++ if (!data.isEmpty()) { ++ const auto& customData = data[0]; ++ customData.forEachPlatformString([this] (auto& type, auto& string) { ++ writeString(type, string); ++ }); ++ if (customData.hasSameOriginCustomData() || !customData.origin().isEmpty()) ++ m_selectionData->setCustomData(customData.createSharedBuffer()); + } ++ return; + } + m_changeCount = platformStrategies()->pasteboardStrategy()->writeCustomData(data, m_name, context()); + } + +@@ -257,6 +344,35 @@ int64_t Pasteboard::changeCount() const + return platformStrategies()->pasteboardStrategy()->changeCount(m_name); + } + ++#if ENABLE(DRAG_SUPPORT) ++Pasteboard::Pasteboard(std::unique_ptr&& context, SelectionData&& selectionData) ++ : m_context(WTFMove(context)) ++ , m_selectionData(WTFMove(selectionData)) ++{ +} + -+void SelectionData::setURL(const URL& url, const String& label) ++Pasteboard::Pasteboard(std::unique_ptr&& context, SelectionData& selectionData) ++ : m_context(WTFMove(context)) ++ , m_selectionData(selectionData) +{ -+ m_url = url; -+ if (m_uriList.isEmpty()) -+ m_uriList = url.string(); -+ -+ if (!hasText()) -+ setText(url.string()); -+ -+ if (hasMarkup()) -+ return; -+ -+ String actualLabel(label); -+ if (actualLabel.isEmpty()) -+ actualLabel = url.string(); -+ -+ StringBuilder markup; -+ markup.append(""_s); -+ GUniquePtr escaped(g_markup_escape_text(actualLabel.utf8().data(), -1)); -+ markup.append(String::fromUTF8(escaped.get())); -+ markup.append(""_s); -+ setMarkup(markup.toString()); +} + -+const String& SelectionData::urlLabel() const ++std::unique_ptr Pasteboard::createForDragAndDrop(std::unique_ptr&& context) +{ -+ if (hasText()) -+ return text(); -+ -+ if (hasURL()) -+ return url().string(); -+ -+ return emptyString(); ++ return makeUnique(WTFMove(context), SelectionData()); +} + -+void SelectionData::clearAllExceptFilenames() ++std::unique_ptr Pasteboard::create(const DragData& dragData) +{ -+ clearText(); -+ clearMarkup(); -+ clearURIList(); -+ clearURL(); -+ clearImage(); -+ clearCustomData(); -+ -+ m_canSmartReplace = false; ++ RELEASE_ASSERT(dragData.platformData()); ++ return makeUnique(dragData.createPasteboardContext(), *dragData.platformData()); +} + -+void SelectionData::clearAll() ++void Pasteboard::setDragImage(DragImage, const IntPoint&) +{ -+ clearAllExceptFilenames(); -+ m_filenames.clear(); +} ++#endif + -+} // namespace WebCore -diff --git a/Source/WebCore/platform/wpe/SelectionData.h b/Source/WebCore/platform/wpe/SelectionData.h -new file mode 100644 -index 0000000000000000000000000000000000000000..a76b583a1e65cd6999fab4784c22dd9cb48d6aeb ---- /dev/null -+++ b/Source/WebCore/platform/wpe/SelectionData.h -@@ -0,0 +1,85 @@ -+/* -+ * Copyright (C) 2009, Martin Robinson -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2 of the License, or (at your option) any later version. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ */ -+ -+#pragma once -+ -+#include "Image.h" -+#include "SharedBuffer.h" -+#include -+#include -+#include -+ -+namespace WebCore { -+ -+class SelectionData { -+ WTF_MAKE_FAST_ALLOCATED; -+public: -+ void setText(const String&); -+ const String& text() const { return m_text; } -+ bool hasText() const { return !m_text.isEmpty(); } -+ void clearText() { m_text = emptyString(); } -+ -+ void setMarkup(const String& newMarkup) { m_markup = newMarkup; } -+ const String& markup() const { return m_markup; } -+ bool hasMarkup() const { return !m_markup.isEmpty(); } -+ void clearMarkup() { m_markup = emptyString(); } -+ -+ void setURL(const URL&, const String&); -+ const URL& url() const { return m_url; } -+ const String& urlLabel() const; -+ bool hasURL() const { return !m_url.isEmpty() && m_url.isValid(); } -+ void clearURL() { m_url = URL(); } -+ -+ void setURIList(const String&); -+ const String& uriList() const { return m_uriList; } -+ const Vector& filenames() const { return m_filenames; } -+ bool hasURIList() const { return !m_uriList.isEmpty(); } -+ bool hasFilenames() const { return !m_filenames.isEmpty(); } -+ void clearURIList() { m_uriList = emptyString(); } -+ -+ void setImage(RefPtr&& newImage) { m_image = WTFMove(newImage); } -+ const RefPtr& image() const { return m_image; } -+ bool hasImage() const { return m_image; } -+ void clearImage() { m_image = nullptr; } -+ -+ void setCanSmartReplace(bool canSmartReplace) { m_canSmartReplace = canSmartReplace; } -+ bool canSmartReplace() const { return m_canSmartReplace; } -+ -+ void setCustomData(Ref&& buffer) { m_customData = WTFMove(buffer); } -+ const RefPtr& customData() const { return m_customData; } -+ bool hasCustomData() const { return !!m_customData; } -+ void clearCustomData() { m_customData = nullptr; } -+ -+ void clearAll(); -+ void clearAllExceptFilenames(); -+ -+ SelectionData(const String& text, const String& markup, const URL&, const String& uriList, RefPtr&&, RefPtr&&, bool); -+ SelectionData() = default; -+ -+private: -+ String m_text; -+ String m_markup; -+ URL m_url; -+ String m_uriList; -+ Vector m_filenames; -+ RefPtr m_image; -+ bool m_canSmartReplace { false }; -+ RefPtr m_customData; -+}; -+ -+} // namespace WebCore + } // namespace WebCore + + #endif // PLATFORM(WPE) diff --git a/Source/WebCore/rendering/RenderTextControl.cpp b/Source/WebCore/rendering/RenderTextControl.cpp -index 015f1d0d829c0a1ef2c0cc137eb4967fa7bfe67a..25a6d41d2e08d50004749298f9555024a895b61c 100644 +index f8240cb9f855d0c35268d8c0c8fc2a0b985f4be0..3586db4ccf16a4a6bd174c09fc75915730c45ae2 100644 --- a/Source/WebCore/rendering/RenderTextControl.cpp +++ b/Source/WebCore/rendering/RenderTextControl.cpp -@@ -228,13 +228,13 @@ void RenderTextControl::layoutExcludedChildren(RelayoutChildren relayoutChildren +@@ -230,13 +230,13 @@ void RenderTextControl::layoutExcludedChildren(RelayoutChildren relayoutChildren } } @@ -8781,10 +8314,10 @@ index faf34133df0bf205072145ffbab8163b93d3c874..fdc4554952e0e33f8827bb3d00c827de int innerLineHeight() const override; #endif diff --git a/Source/WebCore/workers/WorkerConsoleClient.cpp b/Source/WebCore/workers/WorkerConsoleClient.cpp -index 5b64d59511778572142eae5e48b16cfaa1040d49..7082cd677870f4c359130bc065bdee097c82feda 100644 +index 7546c0266801803c9f73179e7a370a4f42a4f05e..05bb106972e648f6fe98aaa1f471390e3a98c674 100644 --- a/Source/WebCore/workers/WorkerConsoleClient.cpp +++ b/Source/WebCore/workers/WorkerConsoleClient.cpp -@@ -104,4 +104,6 @@ void WorkerConsoleClient::recordEnd(JSC::JSGlobalObject*, Ref&& +@@ -124,4 +124,6 @@ void WorkerConsoleClient::recordEnd(JSC::JSGlobalObject*, Ref&& // FIXME: Web Inspector: support console screenshots in a Worker void WorkerConsoleClient::screenshot(JSC::JSGlobalObject*, Ref&&) { } @@ -8804,7 +8337,7 @@ index db95c8273bd0deb3f903a45d02fc07bbbd8ab305..bf88228b4c838b90d11d430cc9429d51 WorkerOrWorkletGlobalScope& m_globalScope; }; diff --git a/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp b/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp -index eb1ee28ea9a6bee86f68b4d0d4e16ae6dea32772..1968c70c80c1529ada0e76f1a5f45981924fa629 100644 +index 23a9f5b5afdb7aba0efdc6a1db7898abc641b0fa..220ed1f59582562268f02262ea2f7ed3388aab1f 100644 --- a/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp +++ b/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp @@ -97,6 +97,8 @@ @@ -8816,7 +8349,7 @@ index eb1ee28ea9a6bee86f68b4d0d4e16ae6dea32772..1968c70c80c1529ada0e76f1a5f45981 #endif #if ENABLE(APPLE_PAY_REMOTE_UI) -@@ -1231,6 +1233,14 @@ void NetworkConnectionToWebProcess::clearPageSpecificData(PageIdentifier pageID) +@@ -1237,6 +1239,14 @@ void NetworkConnectionToWebProcess::clearPageSpecificData(PageIdentifier pageID) storageSession->clearPageSpecificDataForResourceLoadStatistics(pageID); } @@ -8857,94 +8390,11 @@ index b10706aafd037a2b92a68b0d2c474ec2e42cd2fe..f80792c02d880dbd61849233fdbc348f RemoveStorageAccessForFrame(WebCore::FrameIdentifier frameID, WebCore::PageIdentifier pageID); LogUserInteraction(WebCore::RegistrableDomain domain) ResourceLoadStatisticsUpdated(Vector statistics) -> () -diff --git a/Source/WebKit/NetworkProcess/NetworkProcess.cpp b/Source/WebKit/NetworkProcess/NetworkProcess.cpp -index be181729d818871958a51ad54b95424be796cbd1..759be2137d58cfbc088e1e459fdfca5d329c3ff4 100644 ---- a/Source/WebKit/NetworkProcess/NetworkProcess.cpp -+++ b/Source/WebKit/NetworkProcess/NetworkProcess.cpp -@@ -670,6 +670,12 @@ void NetworkProcess::registrableDomainsExemptFromWebsiteDataDeletion(PAL::Sessio - completionHandler({ }); - } - -+void NetworkProcess::setIgnoreCertificateErrors(PAL::SessionID sessionID, bool ignore) -+{ -+ if (auto* networkSession = this->networkSession(sessionID)) -+ networkSession->setIgnoreCertificateErrors(ignore); -+} -+ - void NetworkProcess::dumpResourceLoadStatistics(PAL::SessionID sessionID, CompletionHandler&& completionHandler) - { - if (auto* session = networkSession(sessionID)) { -diff --git a/Source/WebKit/NetworkProcess/NetworkProcess.h b/Source/WebKit/NetworkProcess/NetworkProcess.h -index aad6d1ad7d9735935f7d55d56ae8f3e8d0c5b852..a7421b51a4e8bbf9c695d2aca3ec6cfc98d14bf5 100644 ---- a/Source/WebKit/NetworkProcess/NetworkProcess.h -+++ b/Source/WebKit/NetworkProcess/NetworkProcess.h -@@ -84,6 +84,7 @@ class SessionID; - - namespace WebCore { - class CertificateInfo; -+struct Cookie; - class CurlProxySettings; - class ProtectionSpace; - class NetworkStorageSession; -@@ -235,6 +236,9 @@ public: - - void registrableDomainsWithLastAccessedTime(PAL::SessionID, CompletionHandler>)>&&); - void registrableDomainsExemptFromWebsiteDataDeletion(PAL::SessionID, CompletionHandler)>&&); -+ -+ void setIgnoreCertificateErrors(PAL::SessionID, bool); -+ - void clearPrevalentResource(PAL::SessionID, RegistrableDomain&&, CompletionHandler&&); - void clearUserInteraction(PAL::SessionID, RegistrableDomain&&, CompletionHandler&&); - void deleteAndRestrictWebsiteDataForRegistrableDomains(PAL::SessionID, OptionSet, RegistrableDomainsToDeleteOrRestrictWebsiteDataFor&&, CompletionHandler&&)>&&); -diff --git a/Source/WebKit/NetworkProcess/NetworkProcess.messages.in b/Source/WebKit/NetworkProcess/NetworkProcess.messages.in -index 64312176007bfc3c06ae2d624dbbabc4007e0fdf..8dfd79c77f27f13aa23927c9b2c6610cd40885d5 100644 ---- a/Source/WebKit/NetworkProcess/NetworkProcess.messages.in -+++ b/Source/WebKit/NetworkProcess/NetworkProcess.messages.in -@@ -91,6 +91,8 @@ messages -> NetworkProcess : AuxiliaryProcess WantsAsyncDispatchMessage { - - SetInspectionForServiceWorkersAllowed(PAL::SessionID sessionID, bool inspectable) - -+ SetIgnoreCertificateErrors(PAL::SessionID sessionID, bool ignoreTLSErrors) -+ - ClearPrevalentResource(PAL::SessionID sessionID, WebCore::RegistrableDomain resourceDomain) -> () - ClearUserInteraction(PAL::SessionID sessionID, WebCore::RegistrableDomain resourceDomain) -> () - DumpResourceLoadStatistics(PAL::SessionID sessionID) -> (String dumpedStatistics) -diff --git a/Source/WebKit/NetworkProcess/NetworkSession.h b/Source/WebKit/NetworkProcess/NetworkSession.h -index 2a48fae7bd8cce5ee360df66e5bc49cb4d2b9c54..5fdec3ff3fb706a426717c95831ece36c43543ce 100644 ---- a/Source/WebKit/NetworkProcess/NetworkSession.h -+++ b/Source/WebKit/NetworkProcess/NetworkSession.h -@@ -207,6 +207,9 @@ public: - - void lowMemoryHandler(WTF::Critical); - -+ void setIgnoreCertificateErrors(bool ignore) { m_ignoreCertificateErrors = ignore; } -+ bool ignoreCertificateErrors() { return m_ignoreCertificateErrors; } -+ - void removeSoftUpdateLoader(ServiceWorkerSoftUpdateLoader* loader) { m_softUpdateLoaders.remove(loader); } - void addNavigationPreloaderTask(ServiceWorkerFetchTask&); - ServiceWorkerFetchTask* navigationPreloaderTaskFromFetchIdentifier(WebCore::FetchIdentifier); -@@ -345,6 +348,7 @@ protected: - bool m_privateClickMeasurementDebugModeEnabled { false }; - std::optional m_ephemeralMeasurement; - bool m_isRunningEphemeralMeasurementTest { false }; -+ bool m_ignoreCertificateErrors { false }; - - HashSet> m_keptAliveLoads; - diff --git a/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm b/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm -index 846603d498fa5f0cfe8829340ed810558df54b41..6edf57edc6d0c2d7ba79319ddb2765b856a8cddc 100644 +index 00a6ce04cae578c8ac9d934e6c4e38041e4a4aee..ab587ef45e27bddf3e31d28882794f7fb11dea0d 100644 --- a/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm +++ b/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm -@@ -805,6 +805,8 @@ - (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didRece - - if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) { - sessionCocoa->setClientAuditToken(challenge); -+ if (sessionCocoa->ignoreCertificateErrors()) -+ return completionHandler(NSURLSessionAuthChallengeUseCredential, [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]); - - negotiatedLegacyTLS = checkForLegacyTLS(task._incompleteTaskMetrics.transactionMetrics.lastObject); - if (negotiatedLegacyTLS == NegotiatedLegacyTLS::Yes && task._preconnect) -@@ -1148,6 +1150,14 @@ - (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)data +@@ -1148,6 +1148,14 @@ - (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)data resourceResponse.setDeprecatedNetworkLoadMetrics(WebCore::copyTimingData(taskMetrics.get(), networkDataTask->networkLoadMetrics())); resourceResponse.setProxyName(WTFMove(proxyName)); @@ -8960,33 +8410,10 @@ index 846603d498fa5f0cfe8829340ed810558df54b41..6edf57edc6d0c2d7ba79319ddb2765b8 #if !LOG_DISABLED LOG(NetworkSession, "%llu didReceiveResponse completionHandler (%s)", taskIdentifier, toString(policyAction).characters()); diff --git a/Source/WebKit/NetworkProcess/curl/NetworkDataTaskCurl.cpp b/Source/WebKit/NetworkProcess/curl/NetworkDataTaskCurl.cpp -index 1aa46419c05ba688a2ca79bfa48f4c7a9164375e..9b90036b16c587cd509bb35f067c9a9fddd8cfc2 100644 +index 975e4097fb5b9cb610ce67c70ea85e6434ec7a9d..6e2676cd751883e2eae26e38ffaefa873857b604 100644 --- a/Source/WebKit/NetworkProcess/curl/NetworkDataTaskCurl.cpp +++ b/Source/WebKit/NetworkProcess/curl/NetworkDataTaskCurl.cpp -@@ -80,10 +80,18 @@ NetworkDataTaskCurl::NetworkDataTaskCurl(NetworkSession& session, NetworkDataTas - blockCookies(); - restrictRequestReferrerToOriginIfNeeded(request); - -- m_curlRequest = createCurlRequest(WTFMove(request)); -- if (!m_initialCredential.isEmpty()) { -- m_curlRequest->setUserPass(m_initialCredential.user(), m_initialCredential.password()); -- m_curlRequest->setAuthenticationScheme(ProtectionSpace::AuthenticationScheme::HTTPBasic); -+ if (request.url().protocolIsData()) { -+ DataURLDecoder::decode(request.url(), { }, DataURLDecoder::ShouldValidatePadding::Yes, [this, protectedThis = Ref { *this }](auto decodeResult) mutable { -+ didReadDataURL(WTFMove(decodeResult)); -+ }); -+ } else { -+ m_curlRequest = createCurlRequest(WTFMove(request)); -+ if (!m_initialCredential.isEmpty()) { -+ m_curlRequest->setUserPass(m_initialCredential.user(), m_initialCredential.password()); -+ m_curlRequest->setAuthenticationScheme(ProtectionSpace::AuthenticationScheme::HTTPBasic); -+ } -+ if (m_session->ignoreCertificateErrors()) -+ m_curlRequest->disableServerTrustEvaluation(); - } - } - -@@ -166,6 +174,7 @@ void NetworkDataTaskCurl::curlDidReceiveResponse(CurlRequest& request, CurlRespo +@@ -166,6 +166,7 @@ void NetworkDataTaskCurl::curlDidReceiveResponse(CurlRequest& request, CurlRespo updateNetworkLoadMetrics(receivedResponse.networkLoadMetrics); m_response.setDeprecatedNetworkLoadMetrics(Box::create(WTFMove(receivedResponse.networkLoadMetrics))); @@ -8994,173 +8421,8 @@ index 1aa46419c05ba688a2ca79bfa48f4c7a9164375e..9b90036b16c587cd509bb35f067c9a9f handleCookieHeaders(request.resourceRequest(), receivedResponse); -@@ -293,6 +302,35 @@ bool NetworkDataTaskCurl::shouldRedirectAsGET(const ResourceRequest& request, bo - return false; - } - -+void NetworkDataTaskCurl::didReadDataURL(std::optional&& result) -+{ -+ if (state() == State::Canceling || state() == State::Completed) -+ return; -+ -+ m_dataURLResult = WTFMove(result); -+ m_response = ResourceResponse::dataURLResponse(firstRequest().url(), m_dataURLResult.value()); -+ invokeDidReceiveResponse(); -+} -+ -+void NetworkDataTaskCurl::downloadDataURL(Download& download) -+{ -+ if (!m_dataURLResult) { -+ deleteDownloadFile(); -+ download.didFail(internalError(firstRequest().url()), std::span()); -+ return; -+ } -+ -+ if (!m_downloadDestinationFile.write(std::span(m_dataURLResult.value().data.data(), m_dataURLResult.value().data.size()))) { -+ deleteDownloadFile(); -+ download.didFail(ResourceError(CURLE_WRITE_ERROR, m_response.url()), std::span()); -+ return; -+ } -+ -+ download.didReceiveData(m_dataURLResult.value().data.size(), 0, 0); -+ m_downloadDestinationFile = { }; -+ download.didFinish(); -+} -+ - void NetworkDataTaskCurl::invokeDidReceiveResponse() - { - didReceiveResponse(ResourceResponse(m_response), NegotiatedLegacyTLS::No, PrivateRelayed::No, std::nullopt, [this, protectedThis = Ref { *this }](PolicyAction policyAction) { -@@ -322,6 +360,8 @@ void NetworkDataTaskCurl::invokeDidReceiveResponse() - download->didCreateDestination(m_pendingDownloadLocation); - if (m_curlRequest) - m_curlRequest->completeDidReceiveResponse(); -+ else if (firstRequest().url().protocolIsData()) -+ downloadDataURL(download); - break; - } - default: -@@ -410,6 +450,8 @@ void NetworkDataTaskCurl::willPerformHTTPRedirection() - m_curlRequest->setUserPass(m_initialCredential.user(), m_initialCredential.password()); - m_curlRequest->setAuthenticationScheme(ProtectionSpace::AuthenticationScheme::HTTPBasic); - } -+ if (m_session->ignoreCertificateErrors()) -+ m_curlRequest->disableServerTrustEvaluation(); - - if (m_state != State::Suspended) { - m_state = State::Suspended; -diff --git a/Source/WebKit/NetworkProcess/curl/NetworkDataTaskCurl.h b/Source/WebKit/NetworkProcess/curl/NetworkDataTaskCurl.h -index 7babe41b8351f8adbffcf194310d4df41637b192..2d6f0055cfcb0ec8a4629ce41b19cecd17ab4fdc 100644 ---- a/Source/WebKit/NetworkProcess/curl/NetworkDataTaskCurl.h -+++ b/Source/WebKit/NetworkProcess/curl/NetworkDataTaskCurl.h -@@ -28,6 +28,7 @@ - #include "NetworkDataTask.h" - #include "NetworkLoadParameters.h" - #include -+#include - #include - #include - #include -@@ -43,6 +44,8 @@ class SharedBuffer; - - namespace WebKit { - -+class Download; -+ - class NetworkDataTaskCurl final : public NetworkDataTask, public WebCore::CurlRequestClient { - public: - static Ref create(NetworkSession& session, NetworkDataTaskClient& client, const NetworkLoadParameters& parameters) -@@ -76,6 +79,9 @@ private: - void curlDidComplete(WebCore::CurlRequest&, WebCore::NetworkLoadMetrics&&) override; - void curlDidFailWithError(WebCore::CurlRequest&, WebCore::ResourceError&&, WebCore::CertificateInfo&&) override; - -+ void didReadDataURL(std::optional&&); -+ void downloadDataURL(Download&); -+ - void invokeDidReceiveResponse(); - - bool shouldStartHTTPRedirection(); -@@ -114,6 +120,9 @@ private: - unsigned m_authFailureCount { 0 }; - - bool m_allowOverwriteDownload { false }; -+ -+ std::optional m_dataURLResult; -+ - FileSystem::FileHandle m_downloadDestinationFile; - - bool m_blockingCookies { false }; -diff --git a/Source/WebKit/NetworkProcess/curl/NetworkSessionCurl.cpp b/Source/WebKit/NetworkProcess/curl/NetworkSessionCurl.cpp -index a6f84189b7163563874a148c9bf1c8afb42bb446..8b5db0010c4be8e24efd121e4ccba0568e6f4bed 100644 ---- a/Source/WebKit/NetworkProcess/curl/NetworkSessionCurl.cpp -+++ b/Source/WebKit/NetworkProcess/curl/NetworkSessionCurl.cpp -@@ -68,7 +68,7 @@ void NetworkSessionCurl::clearAlternativeServices(WallTime) - - std::unique_ptr NetworkSessionCurl::createWebSocketTask(WebPageProxyIdentifier webPageProxyID, std::optional, std::optional, NetworkSocketChannel& channel, const WebCore::ResourceRequest& request, const String& protocol, const WebCore::ClientOrigin& clientOrigin, bool, bool, OptionSet, StoredCredentialsPolicy) - { -- return makeUnique(channel, webPageProxyID, request, protocol, clientOrigin); -+ return makeUnique(channel, webPageProxyID, request, protocol, ignoreCertificateErrors(), clientOrigin); - } - - void NetworkSessionCurl::didReceiveChallenge(WebSocketTask& webSocketTask, WebCore::AuthenticationChallenge&& challenge, CompletionHandler&& challengeCompletionHandler) -diff --git a/Source/WebKit/NetworkProcess/curl/WebSocketTaskCurl.cpp b/Source/WebKit/NetworkProcess/curl/WebSocketTaskCurl.cpp -index 1853b717d021c5ec5c79abb61bec684460646a7a..625b921890a75c521bdf6fc3a5fd4bf3e9d74006 100644 ---- a/Source/WebKit/NetworkProcess/curl/WebSocketTaskCurl.cpp -+++ b/Source/WebKit/NetworkProcess/curl/WebSocketTaskCurl.cpp -@@ -39,11 +39,12 @@ - namespace WebKit { - WTF_MAKE_TZONE_ALLOCATED_IMPL(WebSocketTask); - --WebSocketTask::WebSocketTask(NetworkSocketChannel& channel, WebPageProxyIdentifier webProxyPageID, const WebCore::ResourceRequest& request, const String& protocol, const WebCore::ClientOrigin& clientOrigin) -+WebSocketTask::WebSocketTask(NetworkSocketChannel& channel, WebPageProxyIdentifier webProxyPageID, const WebCore::ResourceRequest& request, const String& protocol, bool ignoreCertificateErrors, const WebCore::ClientOrigin& clientOrigin) - : m_channel(channel) - , m_webProxyPageID(webProxyPageID) - , m_request(request.isolatedCopy()) - , m_protocol(protocol) -+ , m_ignoreCertificateErrors(ignoreCertificateErrors) - , m_scheduler(WebCore::CurlContext::singleton().streamScheduler()) - { - // We use topOrigin in case of service worker websocket connections, for which pageID does not link to a real page. -@@ -55,7 +56,7 @@ WebSocketTask::WebSocketTask(NetworkSocketChannel& channel, WebPageProxyIdentifi - if (networkSession() && networkSession()->networkProcess().localhostAliasesForTesting().contains(m_request.url().host())) - localhostAlias = WebCore::CurlStream::LocalhostAlias::Enable; - -- m_streamID = m_scheduler.createStream(request.url(), *this, WebCore::CurlStream::ServerTrustEvaluation::Enable, localhostAlias); -+ m_streamID = m_scheduler.createStream(request.url(), ignoreCertificateErrors, *this, WebCore::CurlStream::ServerTrustEvaluation::Enable, localhostAlias); - channel.didSendHandshakeRequest(WebCore::ResourceRequest(m_request)); - } - -@@ -265,7 +266,7 @@ void WebSocketTask::tryServerTrustEvaluation(WebCore::AuthenticationChallenge&& - if (networkSession() && networkSession()->networkProcess().localhostAliasesForTesting().contains(m_request.url().host())) - localhostAlias = WebCore::CurlStream::LocalhostAlias::Enable; - -- m_streamID = m_scheduler.createStream(m_request.url(), *this, WebCore::CurlStream::ServerTrustEvaluation::Disable, localhostAlias); -+ m_streamID = m_scheduler.createStream(m_request.url(), m_ignoreCertificateErrors, *this, WebCore::CurlStream::ServerTrustEvaluation::Disable, localhostAlias); - } else - didFail(WTFMove(errorReason)); - }); -diff --git a/Source/WebKit/NetworkProcess/curl/WebSocketTaskCurl.h b/Source/WebKit/NetworkProcess/curl/WebSocketTaskCurl.h -index 0ef9f38c7662f922b7a8e4da81613799b0fddc68..45704b96df02cead2f21fd948455502793a1508c 100644 ---- a/Source/WebKit/NetworkProcess/curl/WebSocketTaskCurl.h -+++ b/Source/WebKit/NetworkProcess/curl/WebSocketTaskCurl.h -@@ -55,7 +55,7 @@ class WebSocketTask : public CanMakeWeakPtr, public CanMakeChecke - WTF_MAKE_TZONE_ALLOCATED(WebSocketTask); - WTF_OVERRIDE_DELETE_FOR_CHECKED_PTR(WebSocketTask); - public: -- WebSocketTask(NetworkSocketChannel&, WebPageProxyIdentifier, const WebCore::ResourceRequest&, const String& protocol, const WebCore::ClientOrigin&); -+ WebSocketTask(NetworkSocketChannel&, WebPageProxyIdentifier, const WebCore::ResourceRequest&, const String& protocol, bool ignoreCertificateErrors, const WebCore::ClientOrigin&); - virtual ~WebSocketTask(); - - void sendString(std::span, CompletionHandler&&); -@@ -110,6 +110,7 @@ private: - WebPageProxyIdentifier m_webProxyPageID; - WebCore::ResourceRequest m_request; - String m_protocol; -+ bool m_ignoreCertificateErrors { false }; - WebCore::SecurityOriginData m_topOrigin; - - WebCore::CurlStreamScheduler& m_scheduler; diff --git a/Source/WebKit/NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in b/Source/WebKit/NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in -index 9ecb3e28299aa54a8ac309e74afb6944833e8eae..383bdd7533fad2fd58b4d0cceee4e68962aa8455 100644 +index aebce13abcf8f93c8fa48936120c2065f0a664b1..7b003cf0d65d0179b165fcbce775cfd5b6a19374 100644 --- a/Source/WebKit/NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in +++ b/Source/WebKit/NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in @@ -451,9 +451,11 @@ @@ -9179,7 +8441,7 @@ index 9ecb3e28299aa54a8ac309e74afb6944833e8eae..383bdd7533fad2fd58b4d0cceee4e689 ;; Except deny access to new-style iOS Keychain folders which are UUIDs. (deny file-read* file-write* diff --git a/Source/WebKit/NetworkProcess/soup/NetworkDataTaskSoup.cpp b/Source/WebKit/NetworkProcess/soup/NetworkDataTaskSoup.cpp -index 4fd4b7c714f0c6364f7c239b9e25af3428ffd1fd..56d6e55721c077a34dee36ea7043395331d453bb 100644 +index 983947a9ad3abf138c1a6052807c4e86beb5c1d1..c5de2e1f1c74317ee00b9558e0e5c3093496c386 100644 --- a/Source/WebKit/NetworkProcess/soup/NetworkDataTaskSoup.cpp +++ b/Source/WebKit/NetworkProcess/soup/NetworkDataTaskSoup.cpp @@ -461,6 +461,8 @@ void NetworkDataTaskSoup::didSendRequest(GRefPtr&& inputStream) @@ -9191,59 +8453,11 @@ index 4fd4b7c714f0c6364f7c239b9e25af3428ffd1fd..56d6e55721c077a34dee36ea70433953 dispatchDidReceiveResponse(); } -@@ -563,6 +565,8 @@ bool NetworkDataTaskSoup::acceptCertificate(GTlsCertificate* certificate, GTlsCe - { - ASSERT(m_soupMessage); - URL url = soupURIToURL(soup_message_get_uri(m_soupMessage.get())); -+ if (m_session->ignoreCertificateErrors()) -+ return true; - auto error = static_cast(*m_session).soupNetworkSession().checkTLSErrors(url, certificate, tlsErrors); - if (!error) - return true; -diff --git a/Source/WebKit/NetworkProcess/soup/NetworkSessionSoup.cpp b/Source/WebKit/NetworkProcess/soup/NetworkSessionSoup.cpp -index c0c9bf6f4f1879efb8dfdd24951ef67ae373fa2f..48aeb8ac1324a58dc59bdb125c8ec4e317e24fd2 100644 ---- a/Source/WebKit/NetworkProcess/soup/NetworkSessionSoup.cpp -+++ b/Source/WebKit/NetworkProcess/soup/NetworkSessionSoup.cpp -@@ -100,6 +100,11 @@ void NetworkSessionSoup::clearCredentials(WallTime) - #endif - } - -+static gboolean webSocketAcceptCertificateCallbackIgnoreTLSErrors(GTlsConnection* connection, GTlsCertificate* certificate, GTlsCertificateFlags errors, NetworkSessionSoup* session) -+{ -+ return TRUE; -+} -+ - #if USE(SOUP2) - static gboolean webSocketAcceptCertificateCallback(GTlsConnection* connection, GTlsCertificate* certificate, GTlsCertificateFlags errors, NetworkSessionSoup* session) - { -@@ -130,12 +135,16 @@ std::unique_ptr NetworkSessionSoup::createWebSocketTask(WebPagePr - #if USE(SOUP2) - g_signal_connect(soupMessage.get(), "network-event", G_CALLBACK(webSocketMessageNetworkEventCallback), this); - #else -- g_signal_connect(soupMessage.get(), "accept-certificate", G_CALLBACK(+[](SoupMessage* message, GTlsCertificate* certificate, GTlsCertificateFlags errors, NetworkSessionSoup* session) -> gboolean { -- if (DeprecatedGlobalSettings::allowsAnySSLCertificate()) -- return TRUE; -- -- return !session->soupNetworkSession().checkTLSErrors(soup_message_get_uri(message), certificate, errors); -- }), this); -+ if (ignoreCertificateErrors()) { -+ g_signal_connect(soupMessage.get(), "accept-certificate", G_CALLBACK(webSocketAcceptCertificateCallbackIgnoreTLSErrors), this); -+ } else { -+ g_signal_connect(soupMessage.get(), "accept-certificate", G_CALLBACK(+[](SoupMessage* message, GTlsCertificate* certificate, GTlsCertificateFlags errors, NetworkSessionSoup* session) -> gboolean { -+ if (DeprecatedGlobalSettings::allowsAnySSLCertificate()) -+ return TRUE; -+ -+ return !session->soupNetworkSession().checkTLSErrors(soup_message_get_uri(message), certificate, errors); -+ }), this); -+ } - #endif - } - diff --git a/Source/WebKit/PlatformGTK.cmake b/Source/WebKit/PlatformGTK.cmake -index 2990740be0d39d16ebbc625639c57200cdd700a8..78d25fe109ac96343d4aeedbc1e6b0087b34299a 100644 +index 1f0116517d88a3a0fffade7288a4909bd848df88..83b9598353ad6dd9192b0c8827bba25d1cb069ad 100644 --- a/Source/WebKit/PlatformGTK.cmake +++ b/Source/WebKit/PlatformGTK.cmake -@@ -321,6 +321,9 @@ list(APPEND WebKit_SYSTEM_INCLUDE_DIRECTORIES +@@ -320,6 +320,9 @@ list(APPEND WebKit_SYSTEM_INCLUDE_DIRECTORIES ${GSTREAMER_PBUTILS_INCLUDE_DIRS} ${GTK_INCLUDE_DIRS} ${LIBSOUP_INCLUDE_DIRS} @@ -9253,7 +8467,7 @@ index 2990740be0d39d16ebbc625639c57200cdd700a8..78d25fe109ac96343d4aeedbc1e6b008 ) list(APPEND WebKit_INTERFACE_INCLUDE_DIRECTORIES -@@ -360,6 +363,9 @@ if (USE_LIBWEBRTC) +@@ -359,6 +362,9 @@ if (USE_LIBWEBRTC) list(APPEND WebKit_SYSTEM_INCLUDE_DIRECTORIES "${THIRDPARTY_DIR}/libwebrtc/Source/" "${THIRDPARTY_DIR}/libwebrtc/Source/webrtc" @@ -9263,7 +8477,7 @@ index 2990740be0d39d16ebbc625639c57200cdd700a8..78d25fe109ac96343d4aeedbc1e6b008 ) endif () -@@ -411,6 +417,12 @@ else () +@@ -410,6 +416,12 @@ else () set(WebKitGTK_ENUM_HEADER_TEMPLATE ${WEBKIT_DIR}/UIProcess/API/gtk/WebKitEnumTypesGtk3.h.in) endif () @@ -9277,19 +8491,10 @@ index 2990740be0d39d16ebbc625639c57200cdd700a8..78d25fe109ac96343d4aeedbc1e6b008 set(WebKitGTK_ENUM_GENERATION_HEADERS ${WebKitGTK_INSTALLED_HEADERS}) list(REMOVE_ITEM WebKitGTK_ENUM_GENERATION_HEADERS ${WebKitGTK_DERIVED_SOURCES_DIR}/webkit/WebKitEnumTypes.h) diff --git a/Source/WebKit/PlatformWPE.cmake b/Source/WebKit/PlatformWPE.cmake -index d55e9837af868c774cadcd6791ec07ccee1a97a0..649c0668818d6f2d70036bb18ff108060318d0fb 100644 +index 56b8ece0181ad1dacd3e33ee1463ac1cc4b2ac20..fb0b4169f860e9064397216b176024760a3503cd 100644 --- a/Source/WebKit/PlatformWPE.cmake +++ b/Source/WebKit/PlatformWPE.cmake -@@ -121,6 +121,8 @@ list(APPEND WebKit_SERIALIZATION_IN_FILES - Shared/glib/UserMessage.serialization.in - - Shared/soup/WebCoreArgumentCodersSoup.serialization.in -+ -+ Shared/libwpe/ArgumentCodersWPE.serialization.in - ) - - list(APPEND WebKit_DERIVED_SOURCES -@@ -220,6 +222,7 @@ set(WPE_API_HEADER_TEMPLATES +@@ -221,6 +221,7 @@ set(WPE_API_HEADER_TEMPLATES ${WEBKIT_DIR}/UIProcess/API/glib/WebKitWindowProperties.h.in ${WEBKIT_DIR}/UIProcess/API/glib/WebKitWebsitePolicies.h.in ${WEBKIT_DIR}/UIProcess/API/glib/webkit.h.in @@ -9297,25 +8502,26 @@ index d55e9837af868c774cadcd6791ec07ccee1a97a0..649c0668818d6f2d70036bb18ff10806 ) if (ENABLE_2022_GLIB_API) -@@ -430,7 +433,16 @@ list(APPEND WebKit_SYSTEM_INCLUDE_DIRECTORIES +@@ -432,8 +433,17 @@ list(APPEND WebKit_SYSTEM_INCLUDE_DIRECTORIES ${GIO_UNIX_INCLUDE_DIRS} ${GLIB_INCLUDE_DIRS} ${LIBSOUP_INCLUDE_DIRS} +# Playwright begin + "${THIRDPARTY_DIR}/libwebrtc/Source/third_party/libyuv/include" +# Playwright end -+) -+ + ) + +# Playwright begin +list(APPEND WebKit_PRIVATE_INCLUDE_DIRECTORIES + "${THIRDPARTY_DIR}/libwebrtc/Source/third_party/libwebm" - ) ++) +# Playwright end - ++ list(APPEND WebKit_LIBRARIES WPE::libwpe + ${GLIB_LIBRARIES} diff --git a/Source/WebKit/PlatformWin.cmake b/Source/WebKit/PlatformWin.cmake -index 8429fc8b2e3721830edf197b3369f4f21bb70a9a..bb6779326529bfe16f47dd1b941f4e3d364cb4df 100644 +index 8429fc8b2e3721830edf197b3369f4f21bb70a9a..35e99519b9a23ac19757a8b67fe477ce26c06cd0 100644 --- a/Source/WebKit/PlatformWin.cmake +++ b/Source/WebKit/PlatformWin.cmake @@ -54,8 +54,13 @@ list(APPEND WebKit_SOURCES @@ -9340,13 +8546,10 @@ index 8429fc8b2e3721830edf197b3369f4f21bb70a9a..bb6779326529bfe16f47dd1b941f4e3d WebProcess/WebPage/AcceleratedSurface.cpp -@@ -119,8 +125,81 @@ list(APPEND WebKit_PUBLIC_FRAMEWORK_HEADERS - - list(APPEND WebKit_PRIVATE_LIBRARIES +@@ -121,6 +127,36 @@ list(APPEND WebKit_PRIVATE_LIBRARIES comctl32 -+ ${LIBVPX_CUSTOM_LIBRARY} -+) -+ + ) + +# Playwright begin +list(APPEND WebKit_SYSTEM_INCLUDE_DIRECTORIES + "${THIRDPARTY_DIR}/libwebrtc/Source/third_party/libyuv/include" @@ -9355,75 +8558,33 @@ index 8429fc8b2e3721830edf197b3369f4f21bb70a9a..bb6779326529bfe16f47dd1b941f4e3d + +list(APPEND WebKit_PRIVATE_INCLUDE_DIRECTORIES + "${THIRDPARTY_DIR}/libwebrtc/Source/third_party/libwebm" - ) - -+set(vpxutils_SOURCES ++) ++ ++add_library(mkvmuxer STATIC + "${THIRDPARTY_DIR}/libwebrtc/Source/third_party/libwebm/mkvmuxer/mkvmuxer.cc" + "${THIRDPARTY_DIR}/libwebrtc/Source/third_party/libwebm/mkvmuxer/mkvmuxerutil.cc" + "${THIRDPARTY_DIR}/libwebrtc/Source/third_party/libwebm/mkvmuxer/mkvwriter.cc" -+ "${THIRDPARTY_DIR}/libwebrtc/Source/third_party/libyuv/source/compare.cc" -+ "${THIRDPARTY_DIR}/libwebrtc/Source/third_party/libyuv/source/compare_common.cc" -+ "${THIRDPARTY_DIR}/libwebrtc/Source/third_party/libyuv/source/compare_gcc.cc" -+ "${THIRDPARTY_DIR}/libwebrtc/Source/third_party/libyuv/source/compare_msa.cc" -+ "${THIRDPARTY_DIR}/libwebrtc/Source/third_party/libyuv/source/compare_neon64.cc" -+ "${THIRDPARTY_DIR}/libwebrtc/Source/third_party/libyuv/source/compare_neon.cc" -+ "${THIRDPARTY_DIR}/libwebrtc/Source/third_party/libyuv/source/compare_win.cc" -+ "${THIRDPARTY_DIR}/libwebrtc/Source/third_party/libyuv/source/convert_argb.cc" -+ "${THIRDPARTY_DIR}/libwebrtc/Source/third_party/libyuv/source/convert.cc" -+ "${THIRDPARTY_DIR}/libwebrtc/Source/third_party/libyuv/source/convert_from_argb.cc" -+ "${THIRDPARTY_DIR}/libwebrtc/Source/third_party/libyuv/source/convert_from.cc" -+ "${THIRDPARTY_DIR}/libwebrtc/Source/third_party/libyuv/source/convert_jpeg.cc" -+ "${THIRDPARTY_DIR}/libwebrtc/Source/third_party/libyuv/source/convert_to_argb.cc" -+ "${THIRDPARTY_DIR}/libwebrtc/Source/third_party/libyuv/source/convert_to_i420.cc" -+ "${THIRDPARTY_DIR}/libwebrtc/Source/third_party/libyuv/source/cpu_id.cc" -+ "${THIRDPARTY_DIR}/libwebrtc/Source/third_party/libyuv/source/mjpeg_decoder.cc" -+ "${THIRDPARTY_DIR}/libwebrtc/Source/third_party/libyuv/source/mjpeg_validate.cc" -+ "${THIRDPARTY_DIR}/libwebrtc/Source/third_party/libyuv/source/planar_functions.cc" -+ "${THIRDPARTY_DIR}/libwebrtc/Source/third_party/libyuv/source/rotate_any.cc" -+ "${THIRDPARTY_DIR}/libwebrtc/Source/third_party/libyuv/source/rotate_argb.cc" -+ "${THIRDPARTY_DIR}/libwebrtc/Source/third_party/libyuv/source/rotate.cc" -+ "${THIRDPARTY_DIR}/libwebrtc/Source/third_party/libyuv/source/rotate_common.cc" -+ "${THIRDPARTY_DIR}/libwebrtc/Source/third_party/libyuv/source/rotate_gcc.cc" -+ "${THIRDPARTY_DIR}/libwebrtc/Source/third_party/libyuv/source/rotate_msa.cc" -+ "${THIRDPARTY_DIR}/libwebrtc/Source/third_party/libyuv/source/rotate_neon64.cc" -+ "${THIRDPARTY_DIR}/libwebrtc/Source/third_party/libyuv/source/rotate_neon.cc" -+ "${THIRDPARTY_DIR}/libwebrtc/Source/third_party/libyuv/source/rotate_win.cc" -+ "${THIRDPARTY_DIR}/libwebrtc/Source/third_party/libyuv/source/row_any.cc" -+ "${THIRDPARTY_DIR}/libwebrtc/Source/third_party/libyuv/source/row_common.cc" -+ "${THIRDPARTY_DIR}/libwebrtc/Source/third_party/libyuv/source/row_gcc.cc" -+ "${THIRDPARTY_DIR}/libwebrtc/Source/third_party/libyuv/source/row_msa.cc" -+ "${THIRDPARTY_DIR}/libwebrtc/Source/third_party/libyuv/source/row_neon64.cc" -+ "${THIRDPARTY_DIR}/libwebrtc/Source/third_party/libyuv/source/row_neon.cc" -+ "${THIRDPARTY_DIR}/libwebrtc/Source/third_party/libyuv/source/row_win.cc" -+ "${THIRDPARTY_DIR}/libwebrtc/Source/third_party/libyuv/source/scale_any.cc" -+ "${THIRDPARTY_DIR}/libwebrtc/Source/third_party/libyuv/source/scale_argb.cc" -+ "${THIRDPARTY_DIR}/libwebrtc/Source/third_party/libyuv/source/scale.cc" -+ "${THIRDPARTY_DIR}/libwebrtc/Source/third_party/libyuv/source/scale_common.cc" -+ "${THIRDPARTY_DIR}/libwebrtc/Source/third_party/libyuv/source/scale_gcc.cc" -+ "${THIRDPARTY_DIR}/libwebrtc/Source/third_party/libyuv/source/scale_msa.cc" -+ "${THIRDPARTY_DIR}/libwebrtc/Source/third_party/libyuv/source/scale_neon64.cc" -+ "${THIRDPARTY_DIR}/libwebrtc/Source/third_party/libyuv/source/scale_neon.cc" -+ "${THIRDPARTY_DIR}/libwebrtc/Source/third_party/libyuv/source/scale_rvv.cc" -+ "${THIRDPARTY_DIR}/libwebrtc/Source/third_party/libyuv/source/scale_uv.cc" -+ "${THIRDPARTY_DIR}/libwebrtc/Source/third_party/libyuv/source/scale_win.cc" -+ "${THIRDPARTY_DIR}/libwebrtc/Source/third_party/libyuv/source/video_common.cc" +) -+ -+add_library(vpxutils STATIC ${vpxutils_SOURCES}) -+ -+target_include_directories(vpxutils PRIVATE -+ "${THIRDPARTY_DIR}/libwebrtc/Source/third_party/libyuv/include" ++target_include_directories(mkvmuxer PRIVATE + "${THIRDPARTY_DIR}/libwebrtc/Source/third_party/libwebm" +) ++target_link_libraries(WebKit PRIVATE mkvmuxer) ++ ++add_subdirectory( ++ "${THIRDPARTY_DIR}/libwebrtc/Source/third_party/libyuv" ++ "${CMAKE_BINARY_DIR}/libyuv" ++ EXCLUDE_FROM_ALL ++) ++target_link_libraries(WebKit PRIVATE yuv) ++target_link_libraries(WebKit PRIVATE ${LIBVPX_LIBRARIES}) + -+target_link_libraries(WebKit PRIVATE vpxutils) +# Playwright end + list(APPEND WebProcess_SOURCES WebProcess/EntryPoint/win/WebProcessMain.cpp diff --git a/Source/WebKit/Shared/AuxiliaryProcess.h b/Source/WebKit/Shared/AuxiliaryProcess.h -index c36aaf218982ee54d433b023485ac36e7c45cb2b..1f07f8ebad02fd11a4d23a69ec5092122df73aa0 100644 +index 35fd0f0397cd92c5bf025d89d7f7c8139c03c69d..b1559f1bb2d2d7a74d0b534f81352e366498bfc8 100644 --- a/Source/WebKit/Shared/AuxiliaryProcess.h +++ b/Source/WebKit/Shared/AuxiliaryProcess.h @@ -216,6 +216,11 @@ struct AuxiliaryProcessInitializationParameters { @@ -9520,24 +8681,11 @@ index f8e96218fd2671d1c0aca5e549efe0d8b94ef0f9..6cebd61bceb39c08e916fe991e4c3fc6 #if USE(APPKIT) NSEvent* nativeEvent() const { return m_nativeEvent.get(); } #elif PLATFORM(GTK) -diff --git a/Source/WebKit/Shared/Pasteboard.serialization.in b/Source/WebKit/Shared/Pasteboard.serialization.in -index ea1eb9f00feaaecf73bdddc37c904e88f43bfa85..8a631e5293a11abd650958baad4e967840a9a526 100644 ---- a/Source/WebKit/Shared/Pasteboard.serialization.in -+++ b/Source/WebKit/Shared/Pasteboard.serialization.in -@@ -73,7 +73,7 @@ header: - #if PLATFORM(MAC) - String userVisibleForm - #endif --#if PLATFORM(GTK) -+#if PLATFORM(GTK) || PLATFORM(WPE) - String markup - #endif - }; diff --git a/Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in b/Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in -index c0ba2034b3d6a9fd9d807f1d67a62284c311c3dc..d688da2d022ded01cf9828fd6d56d0570fcc5735 100644 +index e59ca0120c0a684ea1fbdb2262a6a89ccc848828..4fcb529af731becaf446538be42075bfc19bbf90 100644 --- a/Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in +++ b/Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in -@@ -2826,6 +2826,9 @@ class WebCore::AuthenticationChallenge { +@@ -2827,6 +2827,9 @@ class WebCore::AuthenticationChallenge { class WebCore::DragData { #if PLATFORM(COCOA) String pasteboardName(); @@ -9547,7 +8695,7 @@ index c0ba2034b3d6a9fd9d807f1d67a62284c311c3dc..d688da2d022ded01cf9828fd6d56d057 #endif WebCore::IntPoint clientPosition(); WebCore::IntPoint globalPosition(); -@@ -3624,6 +3627,7 @@ enum class WebCore::WasPrivateRelayed : bool; +@@ -3625,6 +3628,7 @@ enum class WebCore::WasPrivateRelayed : bool; String httpStatusText; String httpVersion; WebCore::HTTPHeaderMap httpHeaderFields; @@ -9673,7 +8821,7 @@ index 20a6e465457151b02daa22e6bc059cf0e117ece5..ef4b1f737aaa683bc13c447aa4ca77e5 void setPosition(const WebCore::IntPoint& position) { m_position = position; } const WebCore::IntPoint& globalPosition() const { return m_globalPosition; } diff --git a/Source/WebKit/Shared/WebPageCreationParameters.h b/Source/WebKit/Shared/WebPageCreationParameters.h -index 40b760ec89270bb9a8c586d05cab205c8bd9e7cf..db59f464cc96f9db4800034509e048a1f4d237ac 100644 +index 36e44162c6f211876bf86b20e186f3da7e895536..68fe668470fef43c7a3af7a5c45ca4bac1fbbb28 100644 --- a/Source/WebKit/Shared/WebPageCreationParameters.h +++ b/Source/WebKit/Shared/WebPageCreationParameters.h @@ -301,6 +301,8 @@ struct WebPageCreationParameters { @@ -9686,7 +8834,7 @@ index 40b760ec89270bb9a8c586d05cab205c8bd9e7cf..db59f464cc96f9db4800034509e048a1 #if ENABLE(APP_HIGHLIGHTS) WebCore::HighlightVisibility appHighlightsVisible { WebCore::HighlightVisibility::Hidden }; diff --git a/Source/WebKit/Shared/WebPageCreationParameters.serialization.in b/Source/WebKit/Shared/WebPageCreationParameters.serialization.in -index d137231cfb0f9d9632e788f8e08968ad514f2227..6647f08415b1f0b213e4162ca93697e39280c888 100644 +index 6df2cea7d9ba7328456822475ed765e33966d4b8..39c08e228a2346b18915bc90e76965e0586d006b 100644 --- a/Source/WebKit/Shared/WebPageCreationParameters.serialization.in +++ b/Source/WebKit/Shared/WebPageCreationParameters.serialization.in @@ -223,6 +223,8 @@ enum class WebCore::UserInterfaceLayoutDirection : bool; @@ -9752,44 +8900,6 @@ index 9a1c3f09c756ea368ac2d68e183a13e2eb47ead7..01c738376230f83376d80d6d225543a3 , m_nativeEvent(event.nativeEvent() ? constructNativeEvent(const_cast(event.nativeEvent())) : nullptr) { } -diff --git a/Source/WebKit/Shared/libwpe/ArgumentCodersWPE.serialization.in b/Source/WebKit/Shared/libwpe/ArgumentCodersWPE.serialization.in -new file mode 100644 -index 0000000000000000000000000000000000000000..f4f09d171ebf9774b3f8744751d220d35941fcb5 ---- /dev/null -+++ b/Source/WebKit/Shared/libwpe/ArgumentCodersWPE.serialization.in -@@ -0,0 +1,32 @@ -+# Copyright (C) 2024 Igalia, S.L. All rights reserved. -+# -+# Redistribution and use in source and binary forms, with or without -+# modification, are permitted provided that the following conditions -+# are met: -+# 1. Redistributions of source code must retain the above copyright -+# notice, this list of conditions and the following disclaimer. -+# 2. Redistributions in binary form must reproduce the above copyright -+# notice, this list of conditions and the following disclaimer in the -+# documentation and/or other materials provided with the distribution. -+# -+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND -+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -+# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR -+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ -+header: -+class WebCore::SelectionData { -+ String text() -+ String markup() -+ URL url() -+ String uriList() -+ RefPtr image() -+ RefPtr customData() -+ bool canSmartReplace() -+} diff --git a/Source/WebKit/Shared/unix/AuxiliaryProcessMain.cpp b/Source/WebKit/Shared/unix/AuxiliaryProcessMain.cpp index 7fcd22cd2172cd7fa77aee12ad5cfcf7a435abba..bc822b40eea889fb0499dd4e78f89f04d87c64a1 100644 --- a/Source/WebKit/Shared/unix/AuxiliaryProcessMain.cpp @@ -9837,10 +8947,10 @@ index 053e9336017d8818b3cbea79ce7c145fd5c46274..5632498d6ef875df80fc68ec206a9d08 JSC::Config::configureForTesting(); else if (!strcmp(argv[i], "-disable-jit")) diff --git a/Source/WebKit/Sources.txt b/Source/WebKit/Sources.txt -index 8580135604e6c41c0d2adc22b37ce50366069788..dcbca0904ab9acff6bfcc5cffd6f821af682ecb5 100644 +index bd7ec1f455c83cb4d24185099b6c7f569e612a33..cf4183ca9b2bb85b00bb58a4bc0c4d6b6f44af76 100644 --- a/Source/WebKit/Sources.txt +++ b/Source/WebKit/Sources.txt -@@ -391,6 +391,7 @@ UIProcess/AboutSchemeHandler.cpp +@@ -392,6 +392,7 @@ UIProcess/AboutSchemeHandler.cpp UIProcess/AuxiliaryProcessProxy.cpp UIProcess/BackgroundProcessResponsivenessTimer.cpp UIProcess/BrowsingContextGroup.cpp @@ -9848,7 +8958,7 @@ index 8580135604e6c41c0d2adc22b37ce50366069788..dcbca0904ab9acff6bfcc5cffd6f821a UIProcess/DeviceIdHashSaltStorage.cpp UIProcess/DisplayLink.cpp UIProcess/DisplayLinkProcessProxyClient.cpp -@@ -400,16 +401,20 @@ UIProcess/FrameLoadState.cpp +@@ -401,16 +402,20 @@ UIProcess/FrameLoadState.cpp UIProcess/FrameProcess.cpp UIProcess/GeolocationPermissionRequestManagerProxy.cpp UIProcess/GeolocationPermissionRequestProxy.cpp @@ -9869,7 +8979,7 @@ index 8580135604e6c41c0d2adc22b37ce50366069788..dcbca0904ab9acff6bfcc5cffd6f821a UIProcess/RemotePageDrawingAreaProxy.cpp UIProcess/RemotePageFullscreenManagerProxy.cpp UIProcess/RemotePageProxy.cpp -@@ -452,6 +457,8 @@ UIProcess/WebOpenPanelResultListenerProxy.cpp +@@ -453,6 +458,8 @@ UIProcess/WebOpenPanelResultListenerProxy.cpp UIProcess/WebPageDiagnosticLoggingClient.cpp UIProcess/WebPageGroup.cpp UIProcess/WebPageInjectedBundleClient.cpp @@ -9878,11 +8988,9 @@ index 8580135604e6c41c0d2adc22b37ce50366069788..dcbca0904ab9acff6bfcc5cffd6f821a UIProcess/WebPageProxy.cpp UIProcess/WebPageProxyMessageReceiverRegistration.cpp UIProcess/WebPageProxyTesting.cpp -@@ -598,7 +605,11 @@ UIProcess/Inspector/WebInspectorUtilities.cpp - UIProcess/Inspector/WebPageDebuggable.cpp +@@ -604,6 +611,9 @@ UIProcess/Inspector/WebPageDebuggable.cpp UIProcess/Inspector/WebPageInspectorController.cpp -+UIProcess/Inspector/Agents/CairoJpegEncoder.cpp UIProcess/Inspector/Agents/InspectorBrowserAgent.cpp +UIProcess/Inspector/Agents/InspectorScreencastAgent.cpp +UIProcess/Inspector/Agents/ScreencastEncoder.cpp @@ -9891,7 +8999,7 @@ index 8580135604e6c41c0d2adc22b37ce50366069788..dcbca0904ab9acff6bfcc5cffd6f821a UIProcess/Media/AudioSessionRoutingArbitratorProxy.cpp UIProcess/Media/MediaUsageManager.cpp diff --git a/Source/WebKit/SourcesCocoa.txt b/Source/WebKit/SourcesCocoa.txt -index 768e618630ca0090790320007cbcadad8e0d6452..536e02dc95c2adff1be74a1c2116ab8e8e98196c 100644 +index c146d8baabb0bc80396dc07d7cde88207ef02efa..b13cb0a6e8e10dcf3a068a4bde97536d490f3b52 100644 --- a/Source/WebKit/SourcesCocoa.txt +++ b/Source/WebKit/SourcesCocoa.txt @@ -272,6 +272,7 @@ UIProcess/API/Cocoa/_WKArchiveExclusionRule.mm @@ -9902,7 +9010,7 @@ index 768e618630ca0090790320007cbcadad8e0d6452..536e02dc95c2adff1be74a1c2116ab8e UIProcess/API/Cocoa/_WKContentRuleListAction.mm UIProcess/API/Cocoa/_WKContextMenuElementInfo.mm UIProcess/API/Cocoa/_WKCustomHeaderFields.mm @no-unify -@@ -468,6 +469,7 @@ UIProcess/Inspector/ios/WKInspectorHighlightView.mm +@@ -469,6 +470,7 @@ UIProcess/Inspector/ios/WKInspectorHighlightView.mm UIProcess/Inspector/ios/WKInspectorNodeSearchGestureRecognizer.mm UIProcess/Inspector/mac/RemoteWebInspectorUIProxyMac.mm @@ -9911,7 +9019,7 @@ index 768e618630ca0090790320007cbcadad8e0d6452..536e02dc95c2adff1be74a1c2116ab8e UIProcess/Inspector/mac/WKInspectorResourceURLSchemeHandler.mm UIProcess/Inspector/mac/WKInspectorViewController.mm diff --git a/Source/WebKit/SourcesGTK.txt b/Source/WebKit/SourcesGTK.txt -index 3c8d209cba714f7df7c1e78d951886692ca58b09..2d893bdc430f9e81a3369a9470d21134aa63c9a1 100644 +index 5bf7f2a0c8d6e6d32a2845885b943064618fe951..9d8bfa3d2cf0920dcfdae5b95563c5cab5e755f4 100644 --- a/Source/WebKit/SourcesGTK.txt +++ b/Source/WebKit/SourcesGTK.txt @@ -122,6 +122,7 @@ UIProcess/API/glib/WebKitAutomationSession.cpp @no-unify @@ -9922,7 +9030,7 @@ index 3c8d209cba714f7df7c1e78d951886692ca58b09..2d893bdc430f9e81a3369a9470d21134 UIProcess/API/glib/WebKitContextMenuClient.cpp @no-unify UIProcess/API/glib/WebKitCookieManager.cpp @no-unify UIProcess/API/glib/WebKitCredential.cpp @no-unify -@@ -252,6 +253,7 @@ UIProcess/glib/DisplayVBlankMonitor.cpp +@@ -253,6 +254,7 @@ UIProcess/glib/DisplayVBlankMonitor.cpp UIProcess/glib/DisplayVBlankMonitorDRM.cpp UIProcess/glib/DisplayVBlankMonitorTimer.cpp UIProcess/glib/FenceMonitor.cpp @@ -9930,7 +9038,7 @@ index 3c8d209cba714f7df7c1e78d951886692ca58b09..2d893bdc430f9e81a3369a9470d21134 UIProcess/glib/ScreenManager.cpp UIProcess/glib/SystemSettingsManagerProxy.cpp UIProcess/glib/WebPageProxyGLib.cpp -@@ -270,6 +272,7 @@ UIProcess/gtk/DisplayX11.cpp @no-unify +@@ -271,6 +273,7 @@ UIProcess/gtk/DisplayX11.cpp @no-unify UIProcess/gtk/DisplayWayland.cpp @no-unify UIProcess/gtk/WebDateTimePickerGtk.cpp UIProcess/gtk/HardwareAccelerationManager.cpp @@ -9938,7 +9046,7 @@ index 3c8d209cba714f7df7c1e78d951886692ca58b09..2d893bdc430f9e81a3369a9470d21134 UIProcess/gtk/KeyBindingTranslator.cpp UIProcess/gtk/PointerLockManager.cpp @no-unify UIProcess/gtk/PointerLockManagerWayland.cpp @no-unify -@@ -283,6 +286,8 @@ UIProcess/gtk/ViewGestureControllerGtk.cpp +@@ -284,6 +287,8 @@ UIProcess/gtk/ViewGestureControllerGtk.cpp UIProcess/gtk/WebColorPickerGtk.cpp UIProcess/gtk/WebContextMenuProxyGtk.cpp UIProcess/gtk/WebDataListSuggestionsDropdownGtk.cpp @@ -9948,7 +9056,7 @@ index 3c8d209cba714f7df7c1e78d951886692ca58b09..2d893bdc430f9e81a3369a9470d21134 UIProcess/gtk/WebPasteboardProxyGtk.cpp UIProcess/gtk/WebPopupMenuProxyGtk.cpp diff --git a/Source/WebKit/SourcesWPE.txt b/Source/WebKit/SourcesWPE.txt -index 42931a643d8ff85469b5e162a42e9a09a8bdca3f..f962949675b8de7b79e6d56bb8bb3f342b39dfe8 100644 +index 8569ab98ebf37a8e25c9e79f99a26c76b175d2c8..48c634968f8dcf42ca2690c07aa1b2c4c83d5884 100644 --- a/Source/WebKit/SourcesWPE.txt +++ b/Source/WebKit/SourcesWPE.txt @@ -124,6 +124,7 @@ UIProcess/API/glib/WebKitAuthenticationRequest.cpp @no-unify @@ -9967,7 +9075,7 @@ index 42931a643d8ff85469b5e162a42e9a09a8bdca3f..f962949675b8de7b79e6d56bb8bb3f34 UIProcess/API/glib/WebKitPolicyDecision.cpp @no-unify UIProcess/API/glib/WebKitPrivate.cpp @no-unify UIProcess/API/glib/WebKitProtocolHandler.cpp @no-unify -@@ -221,6 +223,7 @@ UIProcess/glib/DisplayVBlankMonitor.cpp +@@ -225,6 +227,7 @@ UIProcess/glib/DisplayVBlankMonitor.cpp UIProcess/glib/DisplayVBlankMonitorDRM.cpp UIProcess/glib/DisplayVBlankMonitorTimer.cpp UIProcess/glib/FenceMonitor.cpp @@ -9975,7 +9083,7 @@ index 42931a643d8ff85469b5e162a42e9a09a8bdca3f..f962949675b8de7b79e6d56bb8bb3f34 UIProcess/glib/ScreenManager.cpp UIProcess/glib/SystemSettingsManagerProxy.cpp UIProcess/glib/WebPageProxyGLib.cpp -@@ -254,8 +257,14 @@ UIProcess/linux/MemoryPressureMonitor.cpp +@@ -256,8 +259,14 @@ UIProcess/linux/MemoryPressureMonitor.cpp UIProcess/soup/WebProcessPoolSoup.cpp UIProcess/wpe/AcceleratedBackingStoreDMABuf.cpp @@ -9988,9 +9096,9 @@ index 42931a643d8ff85469b5e162a42e9a09a8bdca3f..f962949675b8de7b79e6d56bb8bb3f34 +UIProcess/wpe/WebPageInspectorEmulationAgentWPE.cpp +UIProcess/wpe/WebPageInspectorInputAgentWPE.cpp UIProcess/wpe/WebPageProxyWPE.cpp + UIProcess/wpe/WebPasteboardProxyWPE.cpp UIProcess/wpe/WebPreferencesWPE.cpp - -@@ -282,6 +291,8 @@ WebProcess/WebCoreSupport/glib/WebEditorClientGLib.cpp +@@ -285,6 +294,8 @@ WebProcess/WebCoreSupport/glib/WebEditorClientGLib.cpp WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp @@ -10000,10 +9108,10 @@ index 42931a643d8ff85469b5e162a42e9a09a8bdca3f..f962949675b8de7b79e6d56bb8bb3f34 WebProcess/WebPage/AcceleratedSurface.cpp diff --git a/Source/WebKit/UIProcess/API/APIPageConfiguration.cpp b/Source/WebKit/UIProcess/API/APIPageConfiguration.cpp -index a9d9e1ecd35d4f3b55fa27ff913d054513d423a6..d7f083485598a5b458c09c278a7c0181272d0e93 100644 +index 64952ccd02d9db28c2e1388ce7713703430c8212..c616408e2d09f6d5d98dfd609a51ad080ebb990c 100644 --- a/Source/WebKit/UIProcess/API/APIPageConfiguration.cpp +++ b/Source/WebKit/UIProcess/API/APIPageConfiguration.cpp -@@ -275,6 +275,11 @@ WebPageProxy* PageConfiguration::relatedPage() const +@@ -268,6 +268,11 @@ WebPageProxy* PageConfiguration::relatedPage() const return m_data.relatedPage.get(); } @@ -10016,10 +9124,10 @@ index a9d9e1ecd35d4f3b55fa27ff913d054513d423a6..d7f083485598a5b458c09c278a7c0181 { return m_data.pageToCloneSessionStorageFrom.get(); diff --git a/Source/WebKit/UIProcess/API/APIPageConfiguration.h b/Source/WebKit/UIProcess/API/APIPageConfiguration.h -index ceb054aec4899fa74d160c08e1009dba052488e7..e4c817a32510d006b95d0039d9dc763351831978 100644 +index ade928c03e6e504dc485e75427c56edfb0b1a4a4..1eef15db8aaecea65be8ec3be5d9be903055e840 100644 --- a/Source/WebKit/UIProcess/API/APIPageConfiguration.h +++ b/Source/WebKit/UIProcess/API/APIPageConfiguration.h -@@ -160,6 +160,10 @@ public: +@@ -159,6 +159,10 @@ public: WebKit::WebPageProxy* relatedPage() const; void setRelatedPage(WeakPtr&& relatedPage) { m_data.relatedPage = WTFMove(relatedPage); } @@ -10030,12 +9138,12 @@ index ceb054aec4899fa74d160c08e1009dba052488e7..e4c817a32510d006b95d0039d9dc7633 WebKit::WebPageProxy* pageToCloneSessionStorageFrom() const; void setPageToCloneSessionStorageFrom(WeakPtr&&); -@@ -518,6 +522,7 @@ private: +@@ -515,6 +519,7 @@ private: #endif RefPtr pageGroup; WeakPtr relatedPage; + WeakPtr openerPageForInspector; - std::optional openerInfo; + Box> openerInfo; WebCore::Site openedSite; WTF::String openedMainFrameName; diff --git a/Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.cpp b/Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.cpp @@ -10086,7 +9194,7 @@ index af4944e5a5d373bc51995b50d1ea7c70f64ef1b3..403cfdeda26db2b648e32aa0e5f3ef6e bool m_shouldTakeUIBackgroundAssertion { true }; bool m_shouldCaptureDisplayInUIProcess { DEFAULT_CAPTURE_DISPLAY_IN_UI_PROCESS }; diff --git a/Source/WebKit/UIProcess/API/APIUIClient.h b/Source/WebKit/UIProcess/API/APIUIClient.h -index 4d3564df93fcad126ddd9b3ca851618976cd7571..826aad7a5675b4daf90d83d36a6f352751932f03 100644 +index b0450278b8949985df9f39c7d7a5adbaecb55afe..ac80a31058249d467d21e64f5a053cf0f0012fe1 100644 --- a/Source/WebKit/UIProcess/API/APIUIClient.h +++ b/Source/WebKit/UIProcess/API/APIUIClient.h @@ -114,6 +114,7 @@ public: @@ -10098,7 +9206,7 @@ index 4d3564df93fcad126ddd9b3ca851618976cd7571..826aad7a5675b4daf90d83d36a6f3527 virtual void setStatusText(WebKit::WebPageProxy*, const WTF::String&) { } virtual void mouseDidMoveOverElement(WebKit::WebPageProxy&, const WebKit::WebHitTestResultData&, OptionSet, Object*) { } diff --git a/Source/WebKit/UIProcess/API/C/WKInspector.cpp b/Source/WebKit/UIProcess/API/C/WKInspector.cpp -index 8ecba5bacfa39f9f5309a127e2c0aed527373a04..0873b91211c89b9cddab9ed74120c0b77e4c6aec 100644 +index bba39f6228ae9cc67c68526c75676648cf3917ef..f1c6f6f14ef0d599bd05410edbe9360e75d6d77a 100644 --- a/Source/WebKit/UIProcess/API/C/WKInspector.cpp +++ b/Source/WebKit/UIProcess/API/C/WKInspector.cpp @@ -28,6 +28,11 @@ @@ -10141,7 +9249,7 @@ index 026121d114c5fcad84c1396be8d692625beaa3bd..edd6e5cae033124c589959a42522fde0 } #endif diff --git a/Source/WebKit/UIProcess/API/C/WKPage.cpp b/Source/WebKit/UIProcess/API/C/WKPage.cpp -index 55aeb95735a56d285d7faeb21e9cec6e4ce6762e..9ecc7e8b24a3550659e62e01e704ea0064a985aa 100644 +index 908163888f737cb72569f6ff36dae276a51118eb..636ccf3834aaa47328388a008dbc2bf755ecdf70 100644 --- a/Source/WebKit/UIProcess/API/C/WKPage.cpp +++ b/Source/WebKit/UIProcess/API/C/WKPage.cpp @@ -1935,6 +1935,13 @@ void WKPageSetPageUIClient(WKPageRef pageRef, const WKPageUIClientBase* wkClient @@ -10228,7 +9336,7 @@ index fc43c44a85a0fc6bf5f8c643bd120a16ce762914..ee86fd213d25682f9b6553ec7da99bc8 // Version 15. WKPageDecidePolicyForSpeechRecognitionPermissionRequestCallback decidePolicyForSpeechRecognitionPermissionRequest; diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm b/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm -index 3298711f75bd5be68290738a21de99c927e2d925..6943df0b1f4ee684db0b52f336b5d7f8922c2707 100644 +index f2ee51f3f5dc9c55bcfe96d5bd52268957cc5e1a..472eb2530e812d50ecc38d9bfaa5bbe9948bad68 100644 --- a/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm +++ b/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm @@ -712,6 +712,16 @@ - (void)_setMediaCaptureRequiresSecureConnection:(BOOL)requiresSecureConnection @@ -10261,10 +9369,10 @@ index 41525c8980f698aa4326e7d4d232311cee2c43d5..1f1745431c6cc7af66b47dd5d015c523 @property (nonatomic, setter=_setICECandidateFilteringEnabled:) BOOL _iceCandidateFilteringEnabled WK_API_AVAILABLE(macos(10.13.4), ios(11.3)); @property (nonatomic, setter=_setInactiveMediaCaptureStreamRepromptIntervalInMinutes:) double _inactiveMediaCaptureStreamRepromptIntervalInMinutes WK_API_AVAILABLE(macos(10.13.4), ios(11.3)); diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegate.h b/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegate.h -index 5f4e98c6ab6bb3cce607b96600cac66c70753224..1c2af77331d0da8d9ba232ba508b96e4f7276fe8 100644 +index 2ce017d213d7875eee965e554af6befb5a3c3908..79b11310d358d3edc49e30420728e1eb905309cb 100644 --- a/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegate.h +++ b/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegate.h -@@ -149,6 +149,12 @@ WK_SWIFT_UI_ACTOR +@@ -153,6 +153,12 @@ WK_SWIFT_UI_ACTOR */ - (void)webView:(WKWebView *)webView runJavaScriptTextInputPanelWithPrompt:(NSString *)prompt defaultText:(nullable NSString *)defaultText initiatedByFrame:(WKFrameInfo *)frame completionHandler:(WK_SWIFT_UI_ACTOR void (^)(NSString * _Nullable result))completionHandler; @@ -10291,7 +9399,7 @@ index 930357ac3469195e9f33d5ffce92777018bb0b13..f62555ec562f8416976d31692e8fb175 NS_ASSUME_NONNULL_END diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm b/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm -index 5b6b451a4ab86b3c280c107e5f7bec822155ccde..99eeb8633ab25d8f4f174440e328ba5287e3a2b8 100644 +index 7e793fe01f479b9135c54253af2114ce61924fa0..d22dc512f73af0e4152b4503866ba2a4cf5c3e5e 100644 --- a/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm +++ b/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm @@ -55,6 +55,7 @@ @@ -10703,7 +9811,7 @@ index 0000000000000000000000000000000000000000..e0b1da48465c850f541532ed961d1b77 +WebKit::WebPageProxy* webkitBrowserInspectorCreateNewPageInContext(WebKitWebContext*); +void webkitBrowserInspectorQuitApplication(); diff --git a/Source/WebKit/UIProcess/API/glib/WebKitUIClient.cpp b/Source/WebKit/UIProcess/API/glib/WebKitUIClient.cpp -index 1080e5d6a44b4d7ec649913c39af89aa702d2ee4..2ef7037a1778982275f4b1a5190a089295c8e59c 100644 +index ef24e41f2c62e77e701a6e2b698c60004eaf0789..fd332a5b07f1dea7792eeee3bd9b5efb48afc0c5 100644 --- a/Source/WebKit/UIProcess/API/glib/WebKitUIClient.cpp +++ b/Source/WebKit/UIProcess/API/glib/WebKitUIClient.cpp @@ -101,6 +101,10 @@ private: @@ -10787,7 +9895,7 @@ index c1945fbe717a42afc1f51d64a80c7de3fa9009ba..ab63fe19b00ecbd64c9421e6eecad3e2 #endif +int webkitWebContextExistingCount(); diff --git a/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp b/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp -index df1381b577be94114401e1faaf1979183d82614f..7739fac45b41e07d39a6ac1568641b44f67d5f56 100644 +index df1381b577be94114401e1faaf1979183d82614f..fb8bb4c7676154bb284a06fc3f05d3b45805e938 100644 --- a/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp +++ b/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp @@ -39,6 +39,7 @@ @@ -10806,7 +9914,7 @@ index df1381b577be94114401e1faaf1979183d82614f..7739fac45b41e07d39a6ac1568641b44 DECIDE_POLICY, PERMISSION_REQUEST, -@@ -520,6 +522,16 @@ GRefPtr WebKitWebViewClient::showOptionMenu(WebKitPopupMenu& p +@@ -520,6 +522,13 @@ GRefPtr WebKitWebViewClient::showOptionMenu(WebKitPopupMenu& p void WebKitWebViewClient::frameDisplayed(WKWPE::View&) { @@ -10815,15 +9923,12 @@ index df1381b577be94114401e1faaf1979183d82614f..7739fac45b41e07d39a6ac1568641b44 + sk_sp surface(webkitWebViewBackendTakeScreenshot(m_webView->priv->backend.get())); + if (surface) + getPage(m_webView).inspectorController().didPaint(WTFMove(surface)); -+#elif USE(CAIRO) -+ if (RefPtr surface = adoptRef(webkitWebViewBackendTakeScreenshot(m_webView->priv->backend.get()))) -+ getPage(m_webView).inspectorController().didPaint(surface.get()); +#endif + { SetForScope inFrameDisplayedGuard(m_webView->priv->inFrameDisplayed, true); for (const auto& callback : m_webView->priv->frameDisplayedCallbacks) { -@@ -536,6 +548,18 @@ void WebKitWebViewClient::frameDisplayed(WKWPE::View&) +@@ -536,6 +545,13 @@ void WebKitWebViewClient::frameDisplayed(WKWPE::View&) } } @@ -10832,17 +9937,12 @@ index df1381b577be94114401e1faaf1979183d82614f..7739fac45b41e07d39a6ac1568641b44 +{ + return sk_sp(webkitWebViewBackendTakeScreenshot(m_webView->priv->backend.get())); +} -+#elif USE(CAIRO) -+cairo_surface_t* WebKitWebViewClient::takeViewScreenshot() -+{ -+ return webkitWebViewBackendTakeScreenshot(m_webView->priv->backend.get()); -+} +#endif + void WebKitWebViewClient::willStartLoad(WKWPE::View&) { webkitWebViewWillStartLoad(m_webView); -@@ -622,7 +646,7 @@ static gboolean webkitWebViewDecidePolicy(WebKitWebView*, WebKitPolicyDecision* +@@ -622,7 +638,7 @@ static gboolean webkitWebViewDecidePolicy(WebKitWebView*, WebKitPolicyDecision* static gboolean webkitWebViewPermissionRequest(WebKitWebView*, WebKitPermissionRequest* request) { @@ -10851,7 +9951,7 @@ index df1381b577be94114401e1faaf1979183d82614f..7739fac45b41e07d39a6ac1568641b44 if (WEBKIT_IS_POINTER_LOCK_PERMISSION_REQUEST(request)) { webkit_permission_request_allow(request); return TRUE; -@@ -945,6 +969,10 @@ static void webkitWebViewConstructed(GObject* object) +@@ -945,6 +961,10 @@ static void webkitWebViewConstructed(GObject* object) priv->websitePolicies = adoptGRef(webkit_website_policies_new()); Ref configuration = priv->relatedView && priv->relatedView->priv->configurationForNextRelatedView ? priv->relatedView->priv->configurationForNextRelatedView.releaseNonNull() : webkitWebViewCreatePageConfiguration(webView); @@ -10862,7 +9962,7 @@ index df1381b577be94114401e1faaf1979183d82614f..7739fac45b41e07d39a6ac1568641b44 webkitWebViewCreatePage(webView, WTFMove(configuration)); webkitWebContextWebViewCreated(priv->context.get(), webView); -@@ -1984,6 +2012,15 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass) +@@ -1984,6 +2004,15 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass) G_TYPE_BOOLEAN, 1, WEBKIT_TYPE_SCRIPT_DIALOG); @@ -10878,7 +9978,7 @@ index df1381b577be94114401e1faaf1979183d82614f..7739fac45b41e07d39a6ac1568641b44 /** * WebKitWebView::decide-policy: * @web_view: the #WebKitWebView on which the signal is emitted -@@ -2769,6 +2806,23 @@ void webkitWebViewRunJavaScriptBeforeUnloadConfirm(WebKitWebView* webView, const +@@ -2769,6 +2798,23 @@ void webkitWebViewRunJavaScriptBeforeUnloadConfirm(WebKitWebView* webView, const webkit_script_dialog_unref(webView->priv->currentScriptDialog); } @@ -10927,7 +10027,7 @@ index 763cd55f7abca011ac8bc4fef7f233bf52854cda..bd43917b274bf19ff9f3d96b7e80e207 #include <@API_INCLUDE_PREFIX@/WebKitClipboardPermissionRequest.h> #include <@API_INCLUDE_PREFIX@/WebKitColorChooserRequest.h> diff --git a/Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp b/Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp -index 986edbe2d0b6ff2ed5717a14a71f26c973604f0c..c688cc026456686a54916857ba0396702ebf4a1e 100644 +index 12efcb801d9d63d159a7f7d2e733cda141dc4e55..54f6703d64d5bcfd1d0f42be444492f9cd923bb0 100644 --- a/Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp +++ b/Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp @@ -270,6 +270,8 @@ void PageClientImpl::doneWithKeyEvent(const NativeWebKeyboardEvent& event, bool @@ -10952,12 +10052,12 @@ index 986edbe2d0b6ff2ed5717a14a71f26c973604f0c..c688cc026456686a54916857ba039670 void PageClientImpl::didChangeContentSize(const IntSize& size) diff --git a/Source/WebKit/UIProcess/API/gtk/PageClientImpl.h b/Source/WebKit/UIProcess/API/gtk/PageClientImpl.h -index bd11269e156a92ce0e44cab3da4e4adde5142f64..1761d7541f226232b16ba8da3a6d609280037389 100644 +index c20bdf245d4e6d2a215615cf573cbbdefdb574c0..8c9f3f8e2e111bd3d19314e33a394c371944d358 100644 --- a/Source/WebKit/UIProcess/API/gtk/PageClientImpl.h +++ b/Source/WebKit/UIProcess/API/gtk/PageClientImpl.h @@ -104,7 +104,7 @@ private: RefPtr createDataListSuggestionsDropdown(WebPageProxy&) override; - Ref createValidationBubble(const String& message, const WebCore::ValidationBubble::Settings&) final; + Ref createValidationBubble(String&& message, const WebCore::ValidationBubble::Settings&) final; void selectionDidChange() override; - RefPtr takeViewSnapshot(std::optional&&) override; + RefPtr takeViewSnapshot(std::optional&&, bool nominalResolution = false) override; @@ -11065,10 +10165,10 @@ index 496079da90993ac37689b060b69ecd4a67c2b6a8..af30181ca922f16c0f6e245c70e5ce7d G_BEGIN_DECLS diff --git a/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp b/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp -index 2add5ab84105ad5e79635524b385fb5cb1de1a1b..0585e8474fc8cf42db262be75b514ea68fd5274b 100644 +index 3bbacbe1dbe27e9743f608322f06abb1adc75173..be721a26127ffff7904072aa2d9e7d72050ca514 100644 --- a/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp +++ b/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp -@@ -2873,6 +2873,11 @@ void webkitWebViewBaseResetClickCounter(WebKitWebViewBase* webkitWebViewBase) +@@ -2875,6 +2875,11 @@ void webkitWebViewBaseResetClickCounter(WebKitWebViewBase* webkitWebViewBase) #endif } @@ -11080,7 +10180,7 @@ index 2add5ab84105ad5e79635524b385fb5cb1de1a1b..0585e8474fc8cf42db262be75b514ea6 void webkitWebViewBaseEnterAcceleratedCompositingMode(WebKitWebViewBase* webkitWebViewBase, const LayerTreeContext& layerTreeContext) { ASSERT(webkitWebViewBase->priv->acceleratedBackingStore); -@@ -2929,12 +2934,12 @@ void webkitWebViewBasePageClosed(WebKitWebViewBase* webkitWebViewBase) +@@ -2931,12 +2936,12 @@ void webkitWebViewBasePageClosed(WebKitWebViewBase* webkitWebViewBase) webkitWebViewBase->priv->acceleratedBackingStore->update({ }); } @@ -11123,30 +10223,25 @@ index 3b8ca9470bab69dc26313111a79f954b10b30bf4..5c056dd6734f42d24bc168b4f5ba4365 + +WebKit::AcceleratedBackingStore* webkitWebViewBaseGetAcceleratedBackingStore(WebKitWebViewBase*); diff --git a/Source/WebKit/UIProcess/API/wpe/APIViewClient.h b/Source/WebKit/UIProcess/API/wpe/APIViewClient.h -index 7636ad733e7be66a74f8fede966b0acb905a5842..cf54287353d1e529c6765e3caf8d283abe1e3472 100644 +index 7636ad733e7be66a74f8fede966b0acb905a5842..777d86d6e160a7cfba6dd50d416ed1881f448de4 100644 --- a/Source/WebKit/UIProcess/API/wpe/APIViewClient.h +++ b/Source/WebKit/UIProcess/API/wpe/APIViewClient.h -@@ -26,6 +26,12 @@ +@@ -26,6 +26,9 @@ #pragma once #include "UserMessage.h" -+#if USE(CAIRO) -+#include -+#endif +#if USE(SKIA) +#include +#endif #include #include -@@ -50,6 +56,13 @@ public: +@@ -50,6 +53,11 @@ public: virtual bool isGLibBasedAPI() { return false; } virtual void frameDisplayed(WKWPE::View&) { } +// Playwright begin -+#if USE(CAIRO) -+ virtual cairo_surface_t* takeViewScreenshot() { return nullptr; } -+#elif USE(SKIA) ++#if USE(SKIA) + virtual sk_sp takeViewScreenshot() { return nullptr; } +#endif +// Playwright end @@ -11154,7 +10249,7 @@ index 7636ad733e7be66a74f8fede966b0acb905a5842..cf54287353d1e529c6765e3caf8d283a virtual void didChangePageID(WKWPE::View&) { } virtual void didReceiveUserMessage(WKWPE::View&, WebKit::UserMessage&&, CompletionHandler&& completionHandler) { completionHandler(WebKit::UserMessage()); } diff --git a/Source/WebKit/UIProcess/API/wpe/PageClientImpl.cpp b/Source/WebKit/UIProcess/API/wpe/PageClientImpl.cpp -index aec5bdaa6d2ceea13ad61e3996fd69f9f6a2dc55..ca51881ce7783979f9d36035093b571db93a9253 100644 +index bbbdaf4b823048adcb1e77756560b3dfd525297d..d4f873d6778bae8150817968b992d91dd2428518 100644 --- a/Source/WebKit/UIProcess/API/wpe/PageClientImpl.cpp +++ b/Source/WebKit/UIProcess/API/wpe/PageClientImpl.cpp @@ -35,9 +35,12 @@ @@ -11170,7 +10265,7 @@ index aec5bdaa6d2ceea13ad61e3996fd69f9f6a2dc55..ca51881ce7783979f9d36035093b571d #include "WebDateTimePicker.h" #include "WebKitPopupMenu.h" #include -@@ -55,6 +58,12 @@ +@@ -58,6 +61,12 @@ #include #endif @@ -11183,7 +10278,7 @@ index aec5bdaa6d2ceea13ad61e3996fd69f9f6a2dc55..ca51881ce7783979f9d36035093b571d namespace WebKit { WTF_MAKE_TZONE_ALLOCATED_IMPL(PageClientImpl); -@@ -299,14 +308,14 @@ Ref PageClientImpl::createContextMenuProxy(WebPageProxy& pa +@@ -302,14 +311,14 @@ Ref PageClientImpl::createContextMenuProxy(WebPageProxy& pa } #endif @@ -11202,7 +10297,7 @@ index aec5bdaa6d2ceea13ad61e3996fd69f9f6a2dc55..ca51881ce7783979f9d36035093b571d } RefPtr PageClientImpl::createDateTimePicker(WebPageProxy& page) -@@ -523,6 +532,64 @@ void PageClientImpl::selectionDidChange() +@@ -546,6 +555,37 @@ void PageClientImpl::selectionDidChange() m_view.selectionDidChange(); } @@ -11234,40 +10329,13 @@ index aec5bdaa6d2ceea13ad61e3996fd69f9f6a2dc55..ca51881ce7783979f9d36035093b571d + canvas.drawImage(fullScreenshot, 0, 0); + return bitmap.asImage(); +} -+#elif USE(CAIRO) -+RefPtr PageClientImpl::takeViewSnapshot(std::optional&& clipRect, bool nominalResolution) -+{ -+ RefPtr fullScreenshot = adoptRef(m_view.client().takeViewScreenshot()); -+ float deviceScale = m_view.page().deviceScaleFactor(); -+ if (!clipRect && (!nominalResolution || deviceScale == 1)) -+ return fullScreenshot; -+ -+ WebCore::IntSize size = clipRect ? clipRect->size() : m_view.page().viewSize(); -+ if (!nominalResolution) { -+ size.scale(deviceScale); -+ if (clipRect) -+ clipRect->scale(deviceScale); -+ } -+ RefPtr surface = adoptRef(cairo_image_surface_create(CAIRO_FORMAT_RGB24, size.width(), size.height())); -+ RefPtr cr = adoptRef(cairo_create(surface.get())); -+ if (clipRect) { -+ cairo_translate(cr.get(), -clipRect->x(), -clipRect->y()); -+ cairo_rectangle(cr.get(), clipRect->x(), clipRect->y(), clipRect->width(), clipRect->height()); -+ cairo_clip(cr.get()); -+ } -+ if (nominalResolution) -+ cairo_scale(cr.get(), 1/deviceScale, 1/deviceScale); -+ cairo_set_source_surface(cr.get(), fullScreenshot.get(), 0, 0); -+ cairo_paint(cr.get()); -+ return surface; -+} +#endif + + WebKitWebResourceLoadManager* PageClientImpl::webResourceLoadManager() { return m_view.webResourceLoadManager(); -@@ -533,4 +600,11 @@ void PageClientImpl::callAfterNextPresentationUpdate(CompletionHandler&& +@@ -556,4 +596,11 @@ void PageClientImpl::callAfterNextPresentationUpdate(CompletionHandler&& m_view.callAfterNextPresentationUpdate(WTFMove(callback)); } @@ -11280,18 +10348,16 @@ index aec5bdaa6d2ceea13ad61e3996fd69f9f6a2dc55..ca51881ce7783979f9d36035093b571d + } // namespace WebKit diff --git a/Source/WebKit/UIProcess/API/wpe/PageClientImpl.h b/Source/WebKit/UIProcess/API/wpe/PageClientImpl.h -index c9b5db9dc3005f78212b295ecbf1eac95b24f2dd..c15b6879d6167ec8b4bbe4b1deeb12eb38fe2e10 100644 +index 8809d3fbeeae0387bf683f6154e6db741c3ecc4a..4f1671804b06c82ba221ad74b2b30d0f47ee8718 100644 --- a/Source/WebKit/UIProcess/API/wpe/PageClientImpl.h +++ b/Source/WebKit/UIProcess/API/wpe/PageClientImpl.h -@@ -181,9 +181,17 @@ private: +@@ -183,9 +183,15 @@ private: void didChangeWebPageID() const override; void selectionDidChange() override; - +#if USE(SKIA) + sk_sp takeViewSnapshot(std::optional&&, bool nominalResolution) override; -+#elif USE(CAIRO) -+ RefPtr takeViewSnapshot(std::optional&&, bool nominalResolution) override; +#endif WebKitWebResourceLoadManager* webResourceLoadManager() override; @@ -11422,17 +10488,13 @@ index 763bda5b29304f7ed7133c0a8158e6c8b94c5ea1..8ed962e8c1af62b9b73a68348d0d8876 template <> WebKitWebViewBackend* refGPtr(WebKitWebViewBackend* ptr) diff --git a/Source/WebKit/UIProcess/API/wpe/WebKitWebViewBackend.h b/Source/WebKit/UIProcess/API/wpe/WebKitWebViewBackend.h -index 16dcc1f69c38cd8ad630bc49d6d69feaa3aa811e..efa3814a8e896e02b955dea0be70bdc5828e3d82 100644 +index 16dcc1f69c38cd8ad630bc49d6d69feaa3aa811e..98677028c19c12c3b6d513bb5e45375a1528fe8a 100644 --- a/Source/WebKit/UIProcess/API/wpe/WebKitWebViewBackend.h +++ b/Source/WebKit/UIProcess/API/wpe/WebKitWebViewBackend.h -@@ -28,6 +28,15 @@ +@@ -28,6 +28,11 @@ #include #include -+#if defined(USE_CAIRO) && USE_CAIRO -+#include -+using PlatformImage = cairo_surface_t*; -+#endif +#if defined(USE_SKIA) && USE_SKIA +#include +using PlatformImage = SkImage*; @@ -11441,7 +10503,7 @@ index 16dcc1f69c38cd8ad630bc49d6d69feaa3aa811e..efa3814a8e896e02b955dea0be70bdc5 G_BEGIN_DECLS #define WEBKIT_TYPE_WEB_VIEW_BACKEND (webkit_web_view_backend_get_type()) -@@ -44,6 +53,12 @@ webkit_web_view_backend_new (struct wpe_view_backend *backend, +@@ -44,6 +49,12 @@ webkit_web_view_backend_new (struct wpe_view_backend *backend, WEBKIT_API struct wpe_view_backend * webkit_web_view_backend_get_wpe_backend (WebKitWebViewBackend *view_backend); @@ -11465,17 +10527,15 @@ index e4b92ace1531090ae38a7aec3d3d4febf19aee84..b66b573f9148c39c5ce2738add6cd01a + +PlatformImage webkitWebViewBackendTakeScreenshot(WebKitWebViewBackend*); diff --git a/Source/WebKit/UIProcess/API/wpe/WebKitWebViewClient.h b/Source/WebKit/UIProcess/API/wpe/WebKitWebViewClient.h -index 2f1182cb91a00353eace0b71612df096391c2450..d71d7fc724b046fab41285bb8f390cb6af6520ca 100644 +index 2f1182cb91a00353eace0b71612df096391c2450..f2d09ba39f7d3c1b76ed705a0d945b869823c03e 100644 --- a/Source/WebKit/UIProcess/API/wpe/WebKitWebViewClient.h +++ b/Source/WebKit/UIProcess/API/wpe/WebKitWebViewClient.h -@@ -51,6 +51,13 @@ private: +@@ -51,6 +51,11 @@ private: bool isGLibBasedAPI() override { return true; } void frameDisplayed(WKWPE::View&) override; +// Playwright begin -+#if USE(CAIRO) -+ cairo_surface_t* takeViewScreenshot() override; -+#elif USE(SKIA) ++#if USE(SKIA) + sk_sp takeViewScreenshot() override; +#endif +// Playwright end @@ -11483,20 +10543,19 @@ index 2f1182cb91a00353eace0b71612df096391c2450..d71d7fc724b046fab41285bb8f390cb6 void didChangePageID(WKWPE::View&) override; void didReceiveUserMessage(WKWPE::View&, WebKit::UserMessage&&, CompletionHandler&&) override; diff --git a/Source/WebKit/UIProcess/Automation/WebAutomationSession.h b/Source/WebKit/UIProcess/Automation/WebAutomationSession.h -index 6ae7054c30026bbaca91936c46ffff0760039d5a..5e97a1247dc43118c901b548f8dafa377e3f98ae 100644 +index b351f11524a994ac6136daf9c277419fce44df0f..31679e63462cfaceeac00ebf31985c118ff1e4e4 100644 --- a/Source/WebKit/UIProcess/Automation/WebAutomationSession.h +++ b/Source/WebKit/UIProcess/Automation/WebAutomationSession.h -@@ -285,6 +285,9 @@ public: +@@ -287,6 +287,8 @@ public: void didDestroyFrame(WebCore::FrameIdentifier); + static std::optional platformGetBase64EncodedPNGData(const ViewSnapshot&); + -+private: RefPtr webPageProxyForHandle(const String&); String handleForWebPageProxy(const WebPageProxy&); -@@ -336,7 +339,6 @@ private: +@@ -338,7 +340,6 @@ private: // Get base64-encoded PNG data from a bitmap. static std::optional platformGetBase64EncodedPNGData(WebCore::ShareableBitmap::Handle&&); @@ -11505,10 +10564,10 @@ index 6ae7054c30026bbaca91936c46ffff0760039d5a..5e97a1247dc43118c901b548f8dafa37 // Save base64-encoded file contents to a local file path and return the path. // This reuses the basename of the remote file path so that the filename exposed to DOM API remains the same. diff --git a/Source/WebKit/UIProcess/AuxiliaryProcessProxy.cpp b/Source/WebKit/UIProcess/AuxiliaryProcessProxy.cpp -index a4d1f15cd80b95ec8c82ac07cac3b8dfdae5916c..5182ffa031fd7278ea3bce5bb56e0a648f9223e2 100644 +index d5186484fee73b83dbcd611a9695d92a0a6f9579..e26cea229aeb1f6aad23f1265baccfe67e508a13 100644 --- a/Source/WebKit/UIProcess/AuxiliaryProcessProxy.cpp +++ b/Source/WebKit/UIProcess/AuxiliaryProcessProxy.cpp -@@ -172,7 +172,11 @@ void AuxiliaryProcessProxy::getLaunchOptions(ProcessLauncher::LaunchOptions& lau +@@ -173,7 +173,11 @@ void AuxiliaryProcessProxy::getLaunchOptions(ProcessLauncher::LaunchOptions& lau launchOptions.processCmdPrefix = String::fromUTF8(processCmdPrefix); #endif // ENABLE(DEVELOPER_MODE) && (PLATFORM(GTK) || PLATFORM(WPE)) @@ -11521,10 +10580,10 @@ index a4d1f15cd80b95ec8c82ac07cac3b8dfdae5916c..5182ffa031fd7278ea3bce5bb56e0a64 platformGetLaunchOptions(launchOptions); } diff --git a/Source/WebKit/UIProcess/AuxiliaryProcessProxy.h b/Source/WebKit/UIProcess/AuxiliaryProcessProxy.h -index 1bca45f83bccfd8f917fc8a49b39414d9a8b6548..bcf8c5e5acb0652d04201aa8a8a840537e17e66f 100644 +index 53b4c647c013643d45d845154dd640e8c21c3fd4..d7cc83ec06678945d6e71cdebf3227f86f7661e6 100644 --- a/Source/WebKit/UIProcess/AuxiliaryProcessProxy.h +++ b/Source/WebKit/UIProcess/AuxiliaryProcessProxy.h -@@ -296,13 +296,16 @@ protected: +@@ -298,13 +298,16 @@ protected: InitializationActivityAndGrant initializationActivityAndGrant(); @@ -11543,14 +10602,14 @@ index 1bca45f83bccfd8f917fc8a49b39414d9a8b6548..bcf8c5e5acb0652d04201aa8a8a84053 // Connection::Client diff --git a/Source/WebKit/UIProcess/BackingStore.h b/Source/WebKit/UIProcess/BackingStore.h -index 945c62704e0b25f04e9ee4be88b21f88aeda8bd9..ff9a8ee47e2669260743ae2174801b1cc3c4c413 100644 +index 945c62704e0b25f04e9ee4be88b21f88aeda8bd9..b57ea0f359ab586c88a7d463f2be437b780c267c 100644 --- a/Source/WebKit/UIProcess/BackingStore.h +++ b/Source/WebKit/UIProcess/BackingStore.h @@ -67,6 +67,11 @@ public: float deviceScaleFactor() const { return m_deviceScaleFactor; } void paint(PlatformPaintContextPtr, const WebCore::IntRect&); -+#if PLATFORM(GTK) || USE(CAIRO) ++#if PLATFORM(GTK) + RefPtr surface() const { return m_surface; } +#elif USE(SKIA) + sk_sp surface() const { return m_surface; } @@ -11682,7 +10741,7 @@ index 89d125f7742f81ead8c50f218ecb1771b8000636..baa6cf58ad502c6c033ee6293a6cc8d4 namespace WebKit { diff --git a/Source/WebKit/UIProcess/Cocoa/UIDelegate.h b/Source/WebKit/UIProcess/Cocoa/UIDelegate.h -index 505b934da3a86e218d11e2db1406b0a0a4c7ec36..2e800a8f78fb6209de7f2950fbf84ae062633a4d 100644 +index 554009ae0e083f7721f97a3952f0f17b7d8d7d9d..fbf643cc61caab6389e4bc727adb897ebbb6a109 100644 --- a/Source/WebKit/UIProcess/Cocoa/UIDelegate.h +++ b/Source/WebKit/UIProcess/Cocoa/UIDelegate.h @@ -103,6 +103,7 @@ private: @@ -11702,10 +10761,10 @@ index 505b934da3a86e218d11e2db1406b0a0a4c7ec36..2e800a8f78fb6209de7f2950fbf84ae0 bool webViewRequestStorageAccessPanelForDomainUnderCurrentDomainForQuirkDomainsCompletionHandler : 1; bool webViewRunBeforeUnloadConfirmPanelWithMessageInitiatedByFrameCompletionHandler : 1; diff --git a/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm b/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm -index 54b225795a14877140396f612330d5212bbf5fea..9c006877aa2a9d4804c71ad34766750fe74539b9 100644 +index 30de92c390b49a383369fb59397810187f752c8a..0752cc7cefcc4c3579eafca4fa1cc6e4045d5d84 100644 --- a/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm +++ b/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm -@@ -134,6 +134,7 @@ void UIDelegate::setDelegate(id delegate) +@@ -135,6 +135,7 @@ void UIDelegate::setDelegate(id delegate) m_delegateMethods.webViewRunJavaScriptAlertPanelWithMessageInitiatedByFrameCompletionHandler = [delegate respondsToSelector:@selector(webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame:completionHandler:)]; m_delegateMethods.webViewRunJavaScriptConfirmPanelWithMessageInitiatedByFrameCompletionHandler = [delegate respondsToSelector:@selector(webView:runJavaScriptConfirmPanelWithMessage:initiatedByFrame:completionHandler:)]; m_delegateMethods.webViewRunJavaScriptTextInputPanelWithPromptDefaultTextInitiatedByFrameCompletionHandler = [delegate respondsToSelector:@selector(webView:runJavaScriptTextInputPanelWithPrompt:defaultText:initiatedByFrame:completionHandler:)]; @@ -11713,7 +10772,7 @@ index 54b225795a14877140396f612330d5212bbf5fea..9c006877aa2a9d4804c71ad34766750f m_delegateMethods.webViewRequestStorageAccessPanelUnderFirstPartyCompletionHandler = [delegate respondsToSelector:@selector(_webView:requestStorageAccessPanelForDomain:underCurrentDomain:completionHandler:)]; m_delegateMethods.webViewRequestStorageAccessPanelForDomainUnderCurrentDomainForQuirkDomainsCompletionHandler = [delegate respondsToSelector:@selector(_webView:requestStorageAccessPanelForDomain:underCurrentDomain:forQuirkDomains:completionHandler:)]; m_delegateMethods.webViewRunBeforeUnloadConfirmPanelWithMessageInitiatedByFrameCompletionHandler = [delegate respondsToSelector:@selector(_webView:runBeforeUnloadConfirmPanelWithMessage:initiatedByFrame:completionHandler:)]; -@@ -494,6 +495,15 @@ void UIDelegate::UIClient::runJavaScriptPrompt(WebPageProxy& page, const WTF::St +@@ -495,6 +496,15 @@ void UIDelegate::UIClient::runJavaScriptPrompt(WebPageProxy& page, const WTF::St }).get()]; } @@ -11730,10 +10789,10 @@ index 54b225795a14877140396f612330d5212bbf5fea..9c006877aa2a9d4804c71ad34766750f { RefPtr uiDelegate = m_uiDelegate.get(); diff --git a/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm b/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm -index 1f2f95479d04ad49499db7dae7954c1c54db6d3e..4aee549a4b5a371b35ce012bcdc258147ddeba8c 100644 +index 0eaba44d278da255e3035a4f71ddffb276ad2164..23838dad0c6f4a150ec99ecc1105163db1140a0a 100644 --- a/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm +++ b/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm -@@ -42,7 +42,9 @@ +@@ -43,7 +43,9 @@ #import "NativeWebKeyboardEvent.h" #import "NativeWebMouseEvent.h" #import "NavigationState.h" @@ -11743,9 +10802,9 @@ index 1f2f95479d04ad49499db7dae7954c1c54db6d3e..4aee549a4b5a371b35ce012bcdc25814 #import "PlatformXRSystem.h" #import "PlaybackSessionManagerProxy.h" #import "RemoteLayerTreeTransaction.h" -@@ -336,11 +338,86 @@ bool WebPageProxy::scrollingUpdatesDisabledForTesting() +@@ -347,11 +349,86 @@ bool WebPageProxy::scrollingUpdatesDisabledForTesting() - void WebPageProxy::startDrag(const DragItem& dragItem, ShareableBitmap::Handle&& dragImageHandle) + void WebPageProxy::startDrag(const DragItem& dragItem, ShareableBitmap::Handle&& dragImageHandle, const std::optional& elementID) { + if (m_interceptDrags) { + NSPasteboard *pasteboard = [NSPasteboard pasteboardWithName: m_overrideDragPasteboardName.createNSString().get()]; @@ -11779,7 +10838,7 @@ index 1f2f95479d04ad49499db7dae7954c1c54db6d3e..4aee549a4b5a371b35ce012bcdc25814 + } + if (RefPtr pageClient = this->pageClient()) - pageClient->startDrag(dragItem, WTFMove(dragImageHandle)); + pageClient->startDrag(dragItem, WTFMove(dragImageHandle), elementID); } -#endif @@ -11832,10 +10891,10 @@ index 1f2f95479d04ad49499db7dae7954c1c54db6d3e..4aee549a4b5a371b35ce012bcdc25814 #if ENABLE(ATTACHMENT_ELEMENT) diff --git a/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm b/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm -index c20de41306158d48f4a761e93618acad0f2ae130..0bc1c2e90f4c80c9b506de3cfaf17ae06c173406 100644 +index 7f9f0ecf631ab772460603adb4d0426e1d468085..a98a1388e589d5f079fe29f5b6091aa022b6ecfc 100644 --- a/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm +++ b/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm -@@ -434,7 +434,7 @@ ALLOW_DEPRECATED_DECLARATIONS_END +@@ -436,7 +436,7 @@ ALLOW_DEPRECATED_DECLARATIONS_END auto screenProperties = WebCore::collectScreenProperties(); parameters.screenProperties = WTFMove(screenProperties); #if PLATFORM(MAC) @@ -11844,7 +10903,7 @@ index c20de41306158d48f4a761e93618acad0f2ae130..0bc1c2e90f4c80c9b506de3cfaf17ae0 #endif #if PLATFORM(VISION) -@@ -833,8 +833,8 @@ void WebProcessPool::registerNotificationObservers() +@@ -835,8 +835,8 @@ void WebProcessPool::registerNotificationObservers() }]; m_scrollerStyleNotificationObserver = [[NSNotificationCenter defaultCenter] addObserverForName:NSPreferredScrollerStyleDidChangeNotification object:nil queue:[NSOperationQueue currentQueue] usingBlock:^(NSNotification *notification) { @@ -11856,7 +10915,7 @@ index c20de41306158d48f4a761e93618acad0f2ae130..0bc1c2e90f4c80c9b506de3cfaf17ae0 m_activationObserver = [[NSNotificationCenter defaultCenter] addObserverForName:NSApplicationDidBecomeActiveNotification object:NSApp queue:[NSOperationQueue currentQueue] usingBlock:^(NSNotification *notification) { diff --git a/Source/WebKit/UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp b/Source/WebKit/UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp -index 183a2dc44f4d2921e68a6ff5fd2fb0fb815753af..a17d0ed7d287694516305ba57a849ad8042e9287 100644 +index 183a2dc44f4d2921e68a6ff5fd2fb0fb815753af..f9e80d965f5b7cd64049d85e57e668d6f2a73d87 100644 --- a/Source/WebKit/UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp +++ b/Source/WebKit/UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp @@ -33,6 +33,7 @@ @@ -11867,7 +10926,7 @@ index 183a2dc44f4d2921e68a6ff5fd2fb0fb815753af..a17d0ed7d287694516305ba57a849ad8 #include "WebPageProxy.h" #include "WebPreferences.h" #include "WebProcessPool.h" -@@ -40,8 +41,10 @@ +@@ -40,15 +41,26 @@ #include #include #include @@ -11876,9 +10935,13 @@ index 183a2dc44f4d2921e68a6ff5fd2fb0fb815753af..a17d0ed7d287694516305ba57a849ad8 #if PLATFORM(GTK) +#include "WebKitWebViewBasePrivate.h" #include ++#include ++#include ++#include ++#include #endif -@@ -49,6 +52,11 @@ + #if USE(GLIB_EVENT_LOOP) #include #endif @@ -11890,7 +10953,7 @@ index 183a2dc44f4d2921e68a6ff5fd2fb0fb815753af..a17d0ed7d287694516305ba57a849ad8 namespace WebKit { using namespace WebCore; -@@ -182,6 +190,11 @@ void DrawingAreaProxyCoordinatedGraphics::deviceScaleFactorDidChange(CompletionH +@@ -182,6 +194,11 @@ void DrawingAreaProxyCoordinatedGraphics::deviceScaleFactorDidChange(CompletionH sendWithAsyncReply(Messages::DrawingArea::SetDeviceScaleFactor(m_webPageProxy->deviceScaleFactor()), WTFMove(completionHandler)); } @@ -11902,7 +10965,7 @@ index 183a2dc44f4d2921e68a6ff5fd2fb0fb815753af..a17d0ed7d287694516305ba57a849ad8 void DrawingAreaProxyCoordinatedGraphics::setBackingStoreIsDiscardable(bool isBackingStoreDiscardable) { #if !PLATFORM(WPE) -@@ -243,6 +256,42 @@ void DrawingAreaProxyCoordinatedGraphics::updateAcceleratedCompositingMode(uint6 +@@ -243,6 +260,59 @@ void DrawingAreaProxyCoordinatedGraphics::updateAcceleratedCompositingMode(uint6 updateAcceleratedCompositingMode(layerTreeContext); } @@ -11923,7 +10986,24 @@ index 183a2dc44f4d2921e68a6ff5fd2fb0fb815753af..a17d0ed7d287694516305ba57a849ad8 + if (!surface) + return; + -+ protectedWebPageProxy()->inspectorController().didPaint(surface.get()); ++ if (cairo_surface_get_type(surface.get()) != CAIRO_SURFACE_TYPE_IMAGE) ++ return; ++ ++ unsigned char* data = cairo_image_surface_get_data(surface.get()); ++ int width = cairo_image_surface_get_width(surface.get()); ++ int height = cairo_image_surface_get_height(surface.get()); ++ int stride = cairo_image_surface_get_stride(surface.get()); ++ ++ SkImageInfo info = SkImageInfo::Make( ++ width, height, ++ kBGRA_8888_SkColorType, // matches CAIRO_FORMAT_ARGB32 on LE ++ kPremul_SkAlphaType ++ ); ++ sk_sp skImage = SkImages::RasterFromData(info, SkData::MakeWithCopy(data, height * stride), stride); ++ if (!skImage) ++ return; ++ ++ protectedWebPageProxy()->inspectorController().didPaint(WTFMove(skImage)); +} +#endif // PLATFORM(GTK) + @@ -11945,7 +11025,7 @@ index 183a2dc44f4d2921e68a6ff5fd2fb0fb815753af..a17d0ed7d287694516305ba57a849ad8 bool DrawingAreaProxyCoordinatedGraphics::alwaysUseCompositing() const { if (!m_webPageProxy) -@@ -310,6 +359,12 @@ void DrawingAreaProxyCoordinatedGraphics::didUpdateGeometry() +@@ -310,6 +380,12 @@ void DrawingAreaProxyCoordinatedGraphics::didUpdateGeometry() // we need to resend the new size here. if (m_lastSentSize != m_size) sendUpdateGeometry(); @@ -11990,7 +11070,7 @@ index 9c2bde0db0e4032a32e6ae02dc45af335df92f7a..3f3a58ee9b0f5c0ddad84f41cf3acd61 #if !PLATFORM(WPE) bool m_isBackingStoreDiscardable { true }; diff --git a/Source/WebKit/UIProcess/Downloads/DownloadProxy.cpp b/Source/WebKit/UIProcess/Downloads/DownloadProxy.cpp -index 248a3bc1d03be7bca3c4324b93f13b452d91cc42..1ebb98bea247b882335569560d9fe8678f5d4793 100644 +index bdc3efe299296ef6ef10d32672e22fba05ca230c..a24e9c7e4b0da65099326b6921ed03b4deb4cc86 100644 --- a/Source/WebKit/UIProcess/Downloads/DownloadProxy.cpp +++ b/Source/WebKit/UIProcess/Downloads/DownloadProxy.cpp @@ -41,8 +41,10 @@ @@ -12108,300 +11188,12 @@ index e1f55b4a7fbc452ca1f2eb025b0c88ec9f4b845f..beb3c7a6619b554bb3186a0de917f497 virtual void minimumSizeForAutoLayoutDidChange() { } virtual void sizeToContentAutoSizeMaximumSizeDidChange() { } -diff --git a/Source/WebKit/UIProcess/Inspector/Agents/CairoJpegEncoder.cpp b/Source/WebKit/UIProcess/Inspector/Agents/CairoJpegEncoder.cpp -new file mode 100644 -index 0000000000000000000000000000000000000000..8d20e2aa36ba0f7996c20a6a02792c7f151bbed5 ---- /dev/null -+++ b/Source/WebKit/UIProcess/Inspector/Agents/CairoJpegEncoder.cpp -@@ -0,0 +1,246 @@ -+/* Copyright 2018 Bernhard R. Fischer, 4096R/8E24F29D -+ * -+ * This file is part of Cairo_JPG. -+ * -+ * Cairo_JPG is free software: you can redistribute it and/or modify -+ * it under the terms of the GNU Lesser General Public License as published by -+ * the Free Software Foundation, either version 3 of the License, or -+ * (at your option) any later version. -+ * -+ * Cairo_JPG is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with Cairo_JPG. If not, see . -+ */ -+ -+/*! \file cairo_jpg.c -+ * This file contains two functions for reading and writing JPEG files from -+ * and to Cairo image surfaces. It uses the functions from the libjpeg. -+ * Most of the code is directly derived from the online example at -+ * http://libjpeg-turbo.virtualgl.org/Documentation/Documentation -+ * -+ * All prototypes are defined in cairo_jpg.h All functions and their parameters -+ * and return values are described below directly at the functions. You may -+ * also have a look at the preprocessor macros defined below. -+ * -+ * To compile this code you need to have installed the packages libcairo2-dev -+ * and libjpeg-dev. Compile with the following to create an object file to link -+ * with your code: -+ * gcc -std=c99 -Wall -c `pkg-config cairo libjpeg --cflags --libs` cairo_jpg.c -+ * Use the following command to include the main() function and create an -+ * executable for testing of this code: -+ * gcc -std=c99 -Wall -o cairo_jpg -DCAIRO_JPEG_MAIN `pkg-config cairo libjpeg --cflags --libs` cairo_jpg.c -+ * -+ * @author Bernhard R. Fischer, 4096R/8E24F29D bf@abenteuerland.at -+ * @version 2020/01/18 -+ * @license LGPL3. -+ */ -+ -+#include "config.h" -+ -+#if USE(CAIRO) || PLATFORM(GTK) -+ -+#include "CairoJpegEncoder.h" -+ -+#include -+#include -+#include -+#include -+#include -+#include -+extern "C" { -+#include "jpeglib.h" -+} -+ -+/*! Macro to activate main() function. This is only used for testing. Comment -+ * it out (#undef) if you link this file to your own program. -+ */ -+//#define CAIRO_JPEG_MAIN -+// -+/*! Define this to use an alternate implementation of -+ * cairo_image_surface_create_from_jpeg() which fstat(3)s the file before -+ * reading (see below). For huge files this /may/ be slightly faster. -+ */ -+#undef CAIRO_JPEG_USE_FSTAT -+ -+/*! This is the read block size for the stream reader -+ * cairo_image_surface_create_from_jpeg_stream(). -+ */ -+#ifdef USE_CAIRO_READ_FUNC_LEN_T -+#define CAIRO_JPEG_IO_BLOCK_SIZE 4096 -+#else -+/*! Block size has to be one if cairo_read_func_t is in use because of the lack -+ * to detect EOF (truncated reads). -+ */ -+#define CAIRO_JPEG_IO_BLOCK_SIZE 1 -+/*! In case of original cairo_read_func_t is used fstat() should be used for -+ * performance reasons (see CAIRO_JPEG_USE_FSTAT above). -+ */ -+#define CAIRO_JPEG_USE_FSTAT -+#endif -+ -+/*! Define this to test jpeg creation with non-image surfaces. This is only for -+ * testing and is to be used together with CAIRO_JPEG_MAIN. -+ */ -+#undef CAIRO_JPEG_TEST_SIMILAR -+#if defined(CAIRO_JPEG_TEST_SIMILAR) && defined(CAIRO_JPEG_MAIN) -+#include -+#endif -+ -+ -+#ifndef LIBJPEG_TURBO_VERSION -+/*! This function makes a covnersion for "odd" pixel sizes which typically is a -+ * conversion from a 3-byte to a 4-byte (or more) pixel size or vice versa. -+ * The conversion is done from the source buffer src to the destination buffer -+ * dst. The caller MUST ensure that src and dst have the correct memory size. -+ * This is dw * num for dst and sw * num for src. src and dst may point to the -+ * same memory address. -+ * @param dst Pointer to destination buffer. -+ * @param dw Pixel width (in bytes) of pixels in destination buffer, dw >= 3. -+ * @param src Pointer to source buffer. -+ * @param sw Pixel width (in bytes) of pixels in source buffer, sw >= 3. -+ * @param num Number of pixels to convert, num >= 1; -+ */ -+static void pix_conv(unsigned char *dst, int dw, const unsigned char *src, int sw, int num) -+{ -+ int si, di; -+ -+ // safety check -+ if (dw < 3 || sw < 3 || dst == NULL || src == NULL) -+ return; -+ -+ num--; -+ for (si = num * sw, di = num * dw; si >= 0; si -= sw, di -= dw) -+ { -+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ -+ dst[di + 2] = src[si ]; -+ dst[di + 1] = src[si + 1]; -+ dst[di + 0] = src[si + 2]; -+#else -+ // FIXME: This is untested, it may be wrong. -+ dst[di - 3] = src[si - 3]; -+ dst[di - 2] = src[si - 2]; -+ dst[di - 1] = src[si - 1]; -+#endif -+ } -+} -+#endif -+ -+ -+/*! This function creates a JPEG file in memory from a Cairo image surface. -+ * @param sfc Pointer to a Cairo surface. It should be an image surface of -+ * either CAIRO_FORMAT_ARGB32 or CAIRO_FORMAT_RGB24. Other formats are -+ * converted to CAIRO_FORMAT_RGB24 before compression. -+ * Please note that this may give unexpected results because JPEG does not -+ * support transparency. Thus, default background color is used to replace -+ * transparent regions. The default background color is black if not specified -+ * explicitly. Thus converting e.g. PDF surfaces without having any specific -+ * background color set will apear with black background and not white as you -+ * might expect. In such cases it is suggested to manually convert the surface -+ * to RGB24 before calling this function. -+ * @param data Pointer to a memory pointer. This parameter receives a pointer -+ * to the memory area where the final JPEG data is found in memory. This -+ * function reserves the memory properly and it has to be freed by the caller -+ * with free(3). -+ * @param len Pointer to a variable of type size_t which will receive the final -+ * lenght of the memory buffer. -+ * @param quality Compression quality, 0-100. -+ * @return On success the function returns CAIRO_STATUS_SUCCESS. In case of -+ * error CAIRO_STATUS_INVALID_FORMAT is returned. -+ */ -+cairo_status_t cairo_image_surface_write_to_jpeg_mem(cairo_surface_t *sfc, unsigned char **data, size_t *len, int quality) -+{ -+ struct jpeg_compress_struct cinfo; -+ struct jpeg_error_mgr jerr; -+ JSAMPROW row_pointer[1]; -+ cairo_surface_t *other = NULL; -+ -+ // check valid input format (must be IMAGE_SURFACE && (ARGB32 || RGB24)) -+ if (cairo_surface_get_type(sfc) != CAIRO_SURFACE_TYPE_IMAGE || -+ (cairo_image_surface_get_format(sfc) != CAIRO_FORMAT_ARGB32 && -+ cairo_image_surface_get_format(sfc) != CAIRO_FORMAT_RGB24)) -+ { -+ // create a similar surface with a proper format if supplied input format -+ // does not fulfill the requirements -+ double x1, y1, x2, y2; -+ other = sfc; -+ cairo_t *ctx = cairo_create(other); -+ // get extents of original surface -+ cairo_clip_extents(ctx, &x1, &y1, &x2, &y2); -+ cairo_destroy(ctx); -+ -+ // create new image surface -+ sfc = cairo_surface_create_similar_image(other, CAIRO_FORMAT_RGB24, x2 - x1, y2 - y1); -+ if (cairo_surface_status(sfc) != CAIRO_STATUS_SUCCESS) -+ return CAIRO_STATUS_INVALID_FORMAT; -+ -+ // paint original surface to new surface -+ ctx = cairo_create(sfc); -+ cairo_set_source_surface(ctx, other, 0, 0); -+ cairo_paint(ctx); -+ cairo_destroy(ctx); -+ } -+ -+ // finish queued drawing operations -+ cairo_surface_flush(sfc); -+ -+ // init jpeg compression structures -+ cinfo.err = jpeg_std_error(&jerr); -+ jpeg_create_compress(&cinfo); -+ -+ // set compression parameters -+ unsigned long targetSize; -+ jpeg_mem_dest(&cinfo, data, &targetSize); -+ -+ cinfo.image_width = cairo_image_surface_get_width(sfc); -+ cinfo.image_height = cairo_image_surface_get_height(sfc); -+#ifdef LIBJPEG_TURBO_VERSION -+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ -+ //cinfo.in_color_space = JCS_EXT_BGRX; -+ cinfo.in_color_space = cairo_image_surface_get_format(sfc) == CAIRO_FORMAT_ARGB32 ? JCS_EXT_BGRA : JCS_EXT_BGRX; -+#else -+ //cinfo.in_color_space = JCS_EXT_XRGB; -+ cinfo.in_color_space = cairo_image_surface_get_format(sfc) == CAIRO_FORMAT_ARGB32 ? JCS_EXT_ARGB : JCS_EXT_XRGB; -+#endif -+ cinfo.input_components = 4; -+#else -+ cinfo.in_color_space = JCS_RGB; -+ cinfo.input_components = 3; -+#endif -+ jpeg_set_defaults(&cinfo); -+ jpeg_set_quality(&cinfo, quality, TRUE); -+ -+ // start compressor -+ jpeg_start_compress(&cinfo, TRUE); -+ -+ // loop over all lines and compress -+ while (cinfo.next_scanline < cinfo.image_height) -+ { -+#ifdef LIBJPEG_TURBO_VERSION -+ row_pointer[0] = cairo_image_surface_get_data(sfc) + (cinfo.next_scanline -+ * cairo_image_surface_get_stride(sfc)); -+#else -+ unsigned char row_buf[3 * cinfo.image_width]; -+ pix_conv(row_buf, 3, cairo_image_surface_get_data(sfc) + -+ (cinfo.next_scanline * cairo_image_surface_get_stride(sfc)), 4, cinfo.image_width); -+ row_pointer[0] = row_buf; -+#endif -+ (void) jpeg_write_scanlines(&cinfo, row_pointer, 1); -+ } -+ -+ // finalize and close everything -+ jpeg_finish_compress(&cinfo); -+ jpeg_destroy_compress(&cinfo); -+ -+ // destroy temporary image surface (if available) -+ if (other != NULL) -+ cairo_surface_destroy(sfc); -+ -+ *len = targetSize; -+ return CAIRO_STATUS_SUCCESS; -+} -+ -+#endif -diff --git a/Source/WebKit/UIProcess/Inspector/Agents/CairoJpegEncoder.h b/Source/WebKit/UIProcess/Inspector/Agents/CairoJpegEncoder.h -new file mode 100644 -index 0000000000000000000000000000000000000000..4ec8b96bbbddf8a7b042f53a8068754a384fc7ad ---- /dev/null -+++ b/Source/WebKit/UIProcess/Inspector/Agents/CairoJpegEncoder.h -@@ -0,0 +1,30 @@ -+/* -+ * Copyright (C) Microsoft. All rights reserved. -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions -+ * are met: -+ * 1. Redistributions of source code must retain the above copyright -+ * notice, this list of conditions and the following disclaimer. -+ * 2. Redistributions in binary form must reproduce the above copyright -+ * notice, this list of conditions and the following disclaimer in the -+ * documentation and/or other materials provided with the distribution. -+ * -+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS -+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF -+ * THE POSSIBILITY OF SUCH DAMAGE. -+ */ -+ -+#pragma once -+ -+#include -+ -+cairo_status_t cairo_image_surface_write_to_jpeg_mem(cairo_surface_t *sfc, unsigned char **data, size_t *len, int quality); diff --git a/Source/WebKit/UIProcess/Inspector/Agents/InspectorScreencastAgent.cpp b/Source/WebKit/UIProcess/Inspector/Agents/InspectorScreencastAgent.cpp new file mode 100644 -index 0000000000000000000000000000000000000000..55a0cf8cd5be1cdd33165fe904a8f0ffd815f6d4 +index 0000000000000000000000000000000000000000..0615d7de9494901c53131b45018ee48612e7cfca --- /dev/null +++ b/Source/WebKit/UIProcess/Inspector/Agents/InspectorScreencastAgent.cpp -@@ -0,0 +1,392 @@ +@@ -0,0 +1,326 @@ +/* + * Copyright (C) 2020 Microsoft Corporation. + * @@ -12455,12 +11247,6 @@ index 0000000000000000000000000000000000000000..55a0cf8cd5be1cdd33165fe904a8f0ff +#include +#endif + -+#if USE(CAIRO) || PLATFORM(GTK) -+#include "CairoJpegEncoder.h" -+#include "DrawingAreaProxyCoordinatedGraphics.h" -+#include "DrawingAreaProxy.h" -+#endif -+ +#if PLATFORM(MAC) +#include +#endif @@ -12503,7 +11289,7 @@ index 0000000000000000000000000000000000000000..55a0cf8cd5be1cdd33165fe904a8f0ff + m_encoder = nullptr; +} + -+#if USE(SKIA) && !PLATFORM(GTK) ++#if USE(SKIA) +void InspectorScreencastAgent::didPaint(sk_sp&& surface) +{ + sk_sp image(surface); @@ -12573,66 +11359,6 @@ index 0000000000000000000000000000000000000000..55a0cf8cd5be1cdd33165fe904a8f0ff +} +#endif + -+#if USE(CAIRO) || PLATFORM(GTK) -+void InspectorScreencastAgent::didPaint(cairo_surface_t* surface) -+{ -+#if PLATFORM(WPE) -+ // Get actual image size (in device pixels). -+ WebCore::IntSize displaySize(cairo_image_surface_get_width(surface), cairo_image_surface_get_height(surface)); -+ -+ WebCore::IntSize drawingAreaSize = m_page.drawingArea()->size(); -+ drawingAreaSize.scale(m_page.deviceScaleFactor()); -+ if (drawingAreaSize != displaySize) { -+ return; -+ } -+ -+#else -+ WebCore::IntSize displaySize = m_page.drawingArea()->size(); -+#endif -+ if (m_encoder) -+ m_encoder->encodeFrame(surface, displaySize); -+ if (m_screencast) { -+ -+ { -+ // Do not send the same frame over and over. -+ unsigned char *data = cairo_image_surface_get_data(surface); -+ int stride = cairo_image_surface_get_stride(surface); -+ int height = cairo_image_surface_get_height(surface); -+ auto cryptoDigest = PAL::CryptoDigest::create(PAL::CryptoDigest::Algorithm::SHA_1); -+ cryptoDigest->addBytes(std::span(data, stride * height)); -+ auto digest = cryptoDigest->computeHash(); -+ if (m_lastFrameDigest == digest) -+ return; -+ m_lastFrameDigest = digest; -+ } -+ -+ if (m_screencastFramesInFlight > kMaxFramesInFlight) -+ return; -+ // Scale image to fit width / height -+ double scale = std::min(m_screencastWidth / displaySize.width(), m_screencastHeight / displaySize.height()); -+ RefPtr scaledSurface; -+ if (scale < 1) { -+ WebCore::IntSize scaledSize = displaySize; -+ scaledSize.scale(scale); -+ cairo_matrix_t transform; -+ cairo_matrix_init_scale(&transform, scale, scale); -+ scaledSurface = adoptRef(cairo_image_surface_create(CAIRO_FORMAT_ARGB32, scaledSize.width(), scaledSize.height())); -+ RefPtr cr = adoptRef(cairo_create(scaledSurface.get())); -+ cairo_transform(cr.get(), &transform); -+ cairo_set_source_surface(cr.get(), surface, 0, 0); -+ cairo_paint(cr.get()); -+ surface = scaledSurface.get(); -+ } -+ unsigned char *data = nullptr; -+ size_t len = 0; -+ cairo_image_surface_write_to_jpeg_mem(surface, &data, &len, m_screencastQuality); -+ String result = base64EncodeToString(std::span(data, len)); -+ ++m_screencastFramesInFlight; -+ m_frontendDispatcher->screencastFrame(result, displaySize.width(), displaySize.height()); -+ } -+} -+#endif -+ +Inspector::Protocol::ErrorStringOr InspectorScreencastAgent::startVideo(const String& file, int width, int height, int toolbarHeight) +{ + if (m_encoder) @@ -12796,10 +11522,10 @@ index 0000000000000000000000000000000000000000..55a0cf8cd5be1cdd33165fe904a8f0ff +WTF_ALLOW_UNSAFE_BUFFER_USAGE_END diff --git a/Source/WebKit/UIProcess/Inspector/Agents/InspectorScreencastAgent.h b/Source/WebKit/UIProcess/Inspector/Agents/InspectorScreencastAgent.h new file mode 100644 -index 0000000000000000000000000000000000000000..f53bb59c65a4ced0360e473fb9ed9a36d1179310 +index 0000000000000000000000000000000000000000..6e031f61b132176587643bc79b23202009c4aca4 --- /dev/null +++ b/Source/WebKit/UIProcess/Inspector/Agents/InspectorScreencastAgent.h -@@ -0,0 +1,109 @@ +@@ -0,0 +1,102 @@ +/* + * Copyright (C) 2020 Microsoft Corporation. + * @@ -12831,10 +11557,6 @@ index 0000000000000000000000000000000000000000..f53bb59c65a4ced0360e473fb9ed9a36 +#include +#include + -+#if USE(CAIRO) || PLATFORM(GTK) -+#include -+#endif -+ +#include +#include +#include @@ -12870,12 +11592,9 @@ index 0000000000000000000000000000000000000000..f53bb59c65a4ced0360e473fb9ed9a36 + void didCreateFrontendAndBackend(Inspector::FrontendRouter*, Inspector::BackendDispatcher*) override; + void willDestroyFrontendAndBackend(Inspector::DisconnectReason) override; + -+#if USE(SKIA) && !PLATFORM(GTK) ++#if USE(SKIA) + void didPaint(sk_sp&& surface); +#endif -+#if USE(CAIRO) || PLATFORM(GTK) -+ void didPaint(cairo_surface_t*); -+#endif + + Inspector::Protocol::ErrorStringOr startVideo(const String& file, int width, int height, int toolbarHeight) override; + void stopVideo(Ref&&) override; @@ -12911,10 +11630,10 @@ index 0000000000000000000000000000000000000000..f53bb59c65a4ced0360e473fb9ed9a36 +} // namespace WebKit diff --git a/Source/WebKit/UIProcess/Inspector/Agents/ScreencastEncoder.cpp b/Source/WebKit/UIProcess/Inspector/Agents/ScreencastEncoder.cpp new file mode 100644 -index 0000000000000000000000000000000000000000..bec42378013c93ee6bd37f62a1d6a1c68d167fa3 +index 0000000000000000000000000000000000000000..203cedeea9cbec6964fd297884e03ef791632fe5 --- /dev/null +++ b/Source/WebKit/UIProcess/Inspector/Agents/ScreencastEncoder.cpp -@@ -0,0 +1,443 @@ +@@ -0,0 +1,398 @@ +/* + * Copyright (c) 2010, The WebM Project authors. All rights reserved. + * Copyright (c) 2013 The Chromium Authors. All rights reserved. @@ -12958,17 +11677,13 @@ index 0000000000000000000000000000000000000000..bec42378013c93ee6bd37f62a1d6a1c6 +#include +#include + -+#if USE(SKIA) && !PLATFORM(GTK) ++#if USE(SKIA) +#include +#include +#include +#include +#endif + -+#if USE(CAIRO) || PLATFORM(GTK) -+#include -+#endif -+ +WTF_ALLOW_UNSAFE_BUFFER_USAGE_BEGIN + +using namespace WebCore; @@ -13055,14 +11770,10 @@ index 0000000000000000000000000000000000000000..bec42378013c93ee6bd37f62a1d6a1c6 + WTF_MAKE_NONCOPYABLE(VPXFrame); + WTF_MAKE_FAST_ALLOCATED; +public: -+#if USE(SKIA) && !PLATFORM(GTK) ++#if USE(SKIA) + explicit VPXFrame(sk_sp&& surface) + : m_surface(WTFMove(surface)) + { } -+#elif USE(CAIRO) || PLATFORM(GTK) -+ explicit VPXFrame(RefPtr&& surface) -+ : m_surface(WTFMove(surface)) -+ { } +#elif PLATFORM(MAC) + VPXFrame(RetainPtr windowImage, int offsetTop) + : m_windowImage(WTFMove(windowImage)) @@ -13075,7 +11786,7 @@ index 0000000000000000000000000000000000000000..bec42378013c93ee6bd37f62a1d6a1c6 + + void convertToVpxImage(vpx_image_t* image) + { -+#if USE(SKIA) && !PLATFORM(GTK) ++#if USE(SKIA) + // Convert the updated region to YUV ready for encoding. + SkImageInfo info = SkImageInfo::Make(m_surface->width(), m_surface->height(), kN32_SkColorType, kPremul_SkAlphaType); + int argb_stride = info.minRowBytes(); @@ -13084,10 +11795,6 @@ index 0000000000000000000000000000000000000000..bec42378013c93ee6bd37f62a1d6a1c6 + uint8_t* argb_data = buffer.get(); + if (!m_surface->readPixels(info, argb_data, argb_stride, 0, 0)) + fprintf(stderr, "Read SkImage to ARGB buffer\n"); -+#elif USE(CAIRO) || PLATFORM(GTK) -+ // Convert the updated region to YUV ready for encoding. -+ const uint8_t* argb_data = cairo_image_surface_get_data(m_surface.get()); -+ int argb_stride = cairo_image_surface_get_stride(m_surface.get()); +#elif PLATFORM(MAC) + int argb_stride = image->w * 4; + UniqueArray buffer = makeUniqueArray(argb_stride * image->h); @@ -13110,10 +11817,8 @@ index 0000000000000000000000000000000000000000..bec42378013c93ee6bd37f62a1d6a1c6 + } + +private: -+#if USE(SKIA) && !PLATFORM(GTK) ++#if USE(SKIA) + sk_sp m_surface; -+#elif USE(CAIRO) || PLATFORM(GTK) -+ RefPtr m_surface; +#elif PLATFORM(MAC) + RetainPtr m_windowImage; + int m_offsetTop { 0 }; @@ -13275,7 +11980,7 @@ index 0000000000000000000000000000000000000000..bec42378013c93ee6bd37f62a1d6a1c6 + m_lastFrameTimestamp = now; +} + -+#if USE(SKIA) && !PLATFORM(GTK) ++#if USE(SKIA) +void ScreencastEncoder::encodeFrame(sk_sp&& image, IntSize size) +{ + flushLastFrame(); @@ -13299,37 +12004,6 @@ index 0000000000000000000000000000000000000000..bec42378013c93ee6bd37f62a1d6a1c6 + canvas.drawImage(image, 0, 0); + m_lastFrame = makeUnique(surface.asImage()); +} -+#elif USE(CAIRO) || PLATFORM(GTK) -+void ScreencastEncoder::encodeFrame(cairo_surface_t* drawingAreaSurface, IntSize size) -+{ -+ flushLastFrame(); -+ // Note that in WPE drawing area size is updated asynchronously and may differ from acutal -+ // size of the surface. -+ if (size.isZero()) { -+ return; -+ } -+ -+ RefPtr surface = adoptRef(cairo_image_surface_create(CAIRO_FORMAT_ARGB32, m_size.width(), m_size.height())); -+ { -+ RefPtr cr = adoptRef(cairo_create(surface.get())); -+ -+ cairo_matrix_t transform; -+ if (size.width() > m_size.width() || size.height() > m_size.height()) { -+ // If no scale is specified shrink to fit the frame. -+ double scale = std::min(static_cast(m_size.width()) / size.width(), -+ static_cast(m_size.height()) / size.height()); -+ cairo_matrix_init_scale(&transform, scale, scale); -+ cairo_transform(cr.get(), &transform); -+ } -+ -+ // Record top left part of the drawing area that fits into the frame. -+ cairo_set_source_surface(cr.get(), drawingAreaSurface, 0, 0); -+ cairo_paint(cr.get()); -+ } -+ cairo_surface_flush(surface.get()); -+ -+ m_lastFrame = makeUnique(WTFMove(surface)); -+} +#elif PLATFORM(MAC) +void ScreencastEncoder::encodeFrame(RetainPtr&& windowImage) +{ @@ -13360,10 +12034,10 @@ index 0000000000000000000000000000000000000000..bec42378013c93ee6bd37f62a1d6a1c6 +WTF_ALLOW_UNSAFE_BUFFER_USAGE_END diff --git a/Source/WebKit/UIProcess/Inspector/Agents/ScreencastEncoder.h b/Source/WebKit/UIProcess/Inspector/Agents/ScreencastEncoder.h new file mode 100644 -index 0000000000000000000000000000000000000000..caf0474267c1bda6346f7b025b6646bb4f1b56d9 +index 0000000000000000000000000000000000000000..433af017b68b71cfb68c3ebcc0bd2aeb9efc40f7 --- /dev/null +++ b/Source/WebKit/UIProcess/Inspector/Agents/ScreencastEncoder.h -@@ -0,0 +1,82 @@ +@@ -0,0 +1,80 @@ +/* + * Copyright (C) 2020 Microsoft Corporation. + * @@ -13398,8 +12072,8 @@ index 0000000000000000000000000000000000000000..caf0474267c1bda6346f7b025b6646bb +#include +#include + -+#if USE(CAIRO) || PLATFORM(GTK) -+#include ++#if USE(SKIA) ++#include +#endif + +namespace WebKit { @@ -13418,10 +12092,8 @@ index 0000000000000000000000000000000000000000..caf0474267c1bda6346f7b025b6646bb + ScreencastEncoder(std::unique_ptr&&, WebCore::IntSize); + ~ScreencastEncoder(); + -+#if USE(SKIA) && !PLATFORM(GTK) ++#if USE(SKIA) + void encodeFrame(sk_sp&&, WebCore::IntSize); -+#elif USE(CAIRO) || PLATFORM(GTK) -+ void encodeFrame(cairo_surface_t*, WebCore::IntSize); +#elif PLATFORM(MAC) + void encodeFrame(RetainPtr&&); + void setOffsetTop(int offset) { m_offsetTop = offset;} @@ -13675,10 +12347,10 @@ index edd6e7f1799279ed3d0eb81b6c2eef9f5b375134..d4231f84f3c52641f4d9e88559e8e1a4 String m_identifier; Inspector::InspectorTargetType m_type; diff --git a/Source/WebKit/UIProcess/Inspector/WebPageInspectorController.cpp b/Source/WebKit/UIProcess/Inspector/WebPageInspectorController.cpp -index 45eb87344ce4249eea90dc0a73a2c717f69f55fa..b79c9ce9e9fd3ceb41fe6f34861536ab0bdf2e54 100644 +index 45eb87344ce4249eea90dc0a73a2c717f69f55fa..c070e869819c36e60a5c64bf4c762a50915d8a5e 100644 --- a/Source/WebKit/UIProcess/Inspector/WebPageInspectorController.cpp +++ b/Source/WebKit/UIProcess/Inspector/WebPageInspectorController.cpp -@@ -26,13 +26,22 @@ +@@ -26,13 +26,23 @@ #include "config.h" #include "WebPageInspectorController.h" @@ -13697,11 +12369,12 @@ index 45eb87344ce4249eea90dc0a73a2c717f69f55fa..b79c9ce9e9fd3ceb41fe6f34861536ab #include "WebPageProxy.h" +#include "WebPreferences.h" +#include ++#include +#include #include #include #include -@@ -52,34 +61,115 @@ static String getTargetID(const ProvisionalPageProxy& provisionalPage) +@@ -52,34 +62,115 @@ static String getTargetID(const ProvisionalPageProxy& provisionalPage) WTF_MAKE_TZONE_ALLOCATED_IMPL(WebPageInspectorController); @@ -13824,7 +12497,7 @@ index 45eb87344ce4249eea90dc0a73a2c717f69f55fa..b79c9ce9e9fd3ceb41fe6f34861536ab } bool WebPageInspectorController::hasLocalFrontend() const -@@ -93,6 +183,17 @@ void WebPageInspectorController::connectFrontend(Inspector::FrontendChannel& fro +@@ -93,6 +184,17 @@ void WebPageInspectorController::connectFrontend(Inspector::FrontendChannel& fro bool connectingFirstFrontend = !m_frontendRouter->hasFrontends(); @@ -13842,7 +12515,7 @@ index 45eb87344ce4249eea90dc0a73a2c717f69f55fa..b79c9ce9e9fd3ceb41fe6f34861536ab m_frontendRouter->connectFrontend(frontendChannel); if (connectingFirstFrontend) -@@ -112,8 +213,10 @@ void WebPageInspectorController::disconnectFrontend(FrontendChannel& frontendCha +@@ -112,8 +214,10 @@ void WebPageInspectorController::disconnectFrontend(FrontendChannel& frontendCha m_frontendRouter->disconnectFrontend(frontendChannel); bool disconnectingLastFrontend = !m_frontendRouter->hasFrontends(); @@ -13854,7 +12527,7 @@ index 45eb87344ce4249eea90dc0a73a2c717f69f55fa..b79c9ce9e9fd3ceb41fe6f34861536ab auto inspectedPage = protectedInspectedPage(); inspectedPage->didChangeInspectorFrontendCount(m_frontendRouter->frontendCount()); -@@ -137,6 +240,8 @@ void WebPageInspectorController::disconnectAllFrontends() +@@ -137,6 +241,8 @@ void WebPageInspectorController::disconnectAllFrontends() // Disconnect any remaining remote frontends. m_frontendRouter->disconnectAllFrontends(); @@ -13863,11 +12536,11 @@ index 45eb87344ce4249eea90dc0a73a2c717f69f55fa..b79c9ce9e9fd3ceb41fe6f34861536ab auto inspectedPage = protectedInspectedPage(); inspectedPage->didChangeInspectorFrontendCount(m_frontendRouter->frontendCount()); -@@ -165,6 +270,75 @@ void WebPageInspectorController::setIndicating(bool indicating) +@@ -165,6 +271,66 @@ void WebPageInspectorController::setIndicating(bool indicating) } #endif -+#if USE(SKIA) && !PLATFORM(GTK) ++#if USE(SKIA) +void WebPageInspectorController::didPaint(sk_sp&& surface) +{ + if (!m_frontendRouter->hasFrontends()) @@ -13876,15 +12549,6 @@ index 45eb87344ce4249eea90dc0a73a2c717f69f55fa..b79c9ce9e9fd3ceb41fe6f34861536ab + m_screecastAgent->didPaint(WTFMove(surface)); +} +#endif -+#if USE(CAIRO) || PLATFORM(GTK) -+void WebPageInspectorController::didPaint(cairo_surface_t* surface) -+{ -+ if (!m_frontendRouter->hasFrontends()) -+ return; -+ -+ m_screecastAgent->didPaint(surface); -+} -+#endif + + +void WebPageInspectorController::navigate(WebCore::ResourceRequest&& request, WebFrameProxy* frame, NavigationHandler&& completionHandler) @@ -13939,7 +12603,7 @@ index 45eb87344ce4249eea90dc0a73a2c717f69f55fa..b79c9ce9e9fd3ceb41fe6f34861536ab void WebPageInspectorController::createInspectorTarget(const String& targetId, Inspector::InspectorTargetType type) { addTarget(InspectorTargetProxy::create(protectedInspectedPage(), targetId, type)); -@@ -184,6 +358,52 @@ void WebPageInspectorController::sendMessageToInspectorFrontend(const String& ta +@@ -184,6 +350,52 @@ void WebPageInspectorController::sendMessageToInspectorFrontend(const String& ta m_targetAgent->sendMessageFromTargetToFrontend(targetId, message); } @@ -13992,7 +12656,7 @@ index 45eb87344ce4249eea90dc0a73a2c717f69f55fa..b79c9ce9e9fd3ceb41fe6f34861536ab bool WebPageInspectorController::shouldPauseLoading(const ProvisionalPageProxy& provisionalPage) const { if (!m_frontendRouter->hasFrontends()) -@@ -203,7 +423,7 @@ void WebPageInspectorController::setContinueLoadingCallback(const ProvisionalPag +@@ -203,7 +415,7 @@ void WebPageInspectorController::setContinueLoadingCallback(const ProvisionalPag void WebPageInspectorController::didCreateProvisionalPage(ProvisionalPageProxy& provisionalPage) { @@ -14001,7 +12665,7 @@ index 45eb87344ce4249eea90dc0a73a2c717f69f55fa..b79c9ce9e9fd3ceb41fe6f34861536ab } void WebPageInspectorController::willDestroyProvisionalPage(const ProvisionalPageProxy& provisionalPage) -@@ -287,4 +507,29 @@ void WebPageInspectorController::browserExtensionsDisabled(HashSet&& ext +@@ -287,4 +499,29 @@ void WebPageInspectorController::browserExtensionsDisabled(HashSet&& ext m_enabledBrowserAgent->extensionsDisabled(WTFMove(extensionIDs)); } @@ -14032,10 +12696,10 @@ index 45eb87344ce4249eea90dc0a73a2c717f69f55fa..b79c9ce9e9fd3ceb41fe6f34861536ab + } // namespace WebKit diff --git a/Source/WebKit/UIProcess/Inspector/WebPageInspectorController.h b/Source/WebKit/UIProcess/Inspector/WebPageInspectorController.h -index c219e0a072057a8d40d8a30a1d404851d6c12d43..42e40b5ff6bd1b49d7662a1c7d60bfd4b8d61e29 100644 +index c219e0a072057a8d40d8a30a1d404851d6c12d43..aff66705b9acadb9d811f2da439a59dbf5e6ea06 100644 --- a/Source/WebKit/UIProcess/Inspector/WebPageInspectorController.h +++ b/Source/WebKit/UIProcess/Inspector/WebPageInspectorController.h -@@ -26,19 +26,43 @@ +@@ -26,19 +26,39 @@ #pragma once #include "InspectorTargetProxy.h" @@ -14054,10 +12718,6 @@ index c219e0a072057a8d40d8a30a1d404851d6c12d43..42e40b5ff6bd1b49d7662a1c7d60bfd4 +#if USE(SKIA) +#include +#include -+#endif -+ -+#if USE(CAIRO) || PLATFORM(GTK) -+#include +#endif namespace Inspector { @@ -14079,7 +12739,7 @@ index c219e0a072057a8d40d8a30a1d404851d6c12d43..42e40b5ff6bd1b49d7662a1c7d60bfd4 } namespace WebKit { -@@ -46,6 +70,23 @@ namespace WebKit { +@@ -46,6 +66,23 @@ namespace WebKit { class InspectorBrowserAgent; struct WebPageAgentContext; @@ -14103,7 +12763,7 @@ index c219e0a072057a8d40d8a30a1d404851d6c12d43..42e40b5ff6bd1b49d7662a1c7d60bfd4 class WebPageInspectorController { WTF_MAKE_TZONE_ALLOCATED(WebPageInspectorController); WTF_MAKE_NONCOPYABLE(WebPageInspectorController); -@@ -54,7 +95,21 @@ public: +@@ -54,7 +91,21 @@ public: ~WebPageInspectorController(); void init(); @@ -14125,16 +12785,13 @@ index c219e0a072057a8d40d8a30a1d404851d6c12d43..42e40b5ff6bd1b49d7662a1c7d60bfd4 bool hasLocalFrontend() const; -@@ -67,11 +122,30 @@ public: +@@ -67,11 +118,27 @@ public: #if ENABLE(REMOTE_INSPECTOR) void setIndicating(bool); #endif -+#if USE(SKIA) && !PLATFORM(GTK) ++#if USE(SKIA) + void didPaint(sk_sp&&); +#endif -+#if USE(CAIRO) || PLATFORM(GTK) -+ void didPaint(cairo_surface_t*); -+#endif + using NavigationHandler = Function)>; + void navigate(WebCore::ResourceRequest&&, WebFrameProxy*, NavigationHandler&&); + void didReceivePolicyDecision(WebCore::PolicyAction action, std::optional navigationID); @@ -14156,7 +12813,7 @@ index c219e0a072057a8d40d8a30a1d404851d6c12d43..42e40b5ff6bd1b49d7662a1c7d60bfd4 bool shouldPauseLoading(const ProvisionalPageProxy&) const; void setContinueLoadingCallback(const ProvisionalPageProxy&, WTF::Function&&); -@@ -86,11 +160,12 @@ public: +@@ -86,11 +153,12 @@ public: void browserExtensionsDisabled(HashSet&&); private: @@ -14170,7 +12827,7 @@ index c219e0a072057a8d40d8a30a1d404851d6c12d43..42e40b5ff6bd1b49d7662a1c7d60bfd4 const Ref m_frontendRouter; const Ref m_backendDispatcher; -@@ -101,9 +176,16 @@ private: +@@ -101,9 +169,16 @@ private: CheckedPtr m_targetAgent; HashMap> m_targets; @@ -14420,10 +13077,10 @@ index 0000000000000000000000000000000000000000..d0e11ed81a6257c011df23d5870da740 +} // namespace WebKit diff --git a/Source/WebKit/UIProcess/InspectorPlaywrightAgent.cpp b/Source/WebKit/UIProcess/InspectorPlaywrightAgent.cpp new file mode 100644 -index 0000000000000000000000000000000000000000..59827ffa02a8a3c7890ab0b5a8f54244f6a0680b +index 0000000000000000000000000000000000000000..8026d3e9aaca3434fc1d7316a19cd92827566a67 --- /dev/null +++ b/Source/WebKit/UIProcess/InspectorPlaywrightAgent.cpp -@@ -0,0 +1,1011 @@ +@@ -0,0 +1,1009 @@ +/* + * Copyright (C) 2019 Microsoft Corporation. + * @@ -15083,7 +13740,7 @@ index 0000000000000000000000000000000000000000..59827ffa02a8a3c7890ab0b5a8f54244 + return; + } + -+ WebCore::ResourceRequest resourceRequest { url }; ++ auto resourceRequest = WebCore::ResourceRequest(URL { url }); + + if (!!referrer) + resourceRequest.setHTTPReferrer(referrer); @@ -15173,9 +13830,7 @@ index 0000000000000000000000000000000000000000..59827ffa02a8a3c7890ab0b5a8f54244 + if (!errorString.isEmpty()) + return makeUnexpected(errorString); + -+ PAL::SessionID sessionID = browserContext->dataStore->sessionID(); -+ NetworkProcessProxy& networkProcess = browserContext->dataStore->networkProcess(); -+ networkProcess.send(Messages::NetworkProcess::SetIgnoreCertificateErrors(sessionID, ignore), 0); ++ browserContext->dataStore->setIgnoreTLSErrors(ignore); + return { }; +} + @@ -15718,7 +14373,7 @@ index a108acd8a4503a07309fe8c54afc80b0f4175eae..1421d9a761042c31a6ecf3cc78ce3f0e BOOL result = ::CreateProcess(0, commandLine.data(), 0, 0, true, 0, 0, 0, &startupInfo, &processInformation); diff --git a/Source/WebKit/UIProcess/PageClient.h b/Source/WebKit/UIProcess/PageClient.h -index 0cffbf89f6b402b9aaa65bf9edd7387f0aff65da..baa97c9400538243f96af3bde2482dbd3542b38d 100644 +index 1e06e94f26fc73c323605da1afb0474559b35c33..1ac2f393d3dc0a7812c1b9a1bdaa6cea4f150bf4 100644 --- a/Source/WebKit/UIProcess/PageClient.h +++ b/Source/WebKit/UIProcess/PageClient.h @@ -74,6 +74,11 @@ @@ -15733,20 +14388,7 @@ index 0cffbf89f6b402b9aaa65bf9edd7387f0aff65da..baa97c9400538243f96af3bde2482dbd OBJC_CLASS AVPlayerViewController; OBJC_CLASS CALayer; OBJC_CLASS NSFileWrapper; -@@ -95,6 +100,12 @@ OBJC_CLASS WKView; - #endif - #endif - -+#if PLATFORM(GTK) || PLATFORM(WPE) -+#if USE(CAIRO) -+#include -+#endif -+#endif -+ - namespace API { - class Attachment; - class HitTestResult; -@@ -380,7 +391,20 @@ public: +@@ -381,7 +386,16 @@ public: virtual void selectionDidChange() = 0; #endif @@ -15755,11 +14397,7 @@ index 0cffbf89f6b402b9aaa65bf9edd7387f0aff65da..baa97c9400538243f96af3bde2482dbd +#if PLATFORM(COCOA) + virtual RetainPtr takeSnapshotForAutomation() = 0; +#elif PLATFORM(WPE) -+#if USE(SKIA) + virtual sk_sp takeViewSnapshot(std::optional&&, bool nominalResolution = false) = 0; -+#elif USE(CAIRO) -+ virtual RefPtr takeViewSnapshot(std::optional&&, bool nominalResolution = false) = 0; -+#endif +#elif PLATFORM(GTK) + virtual RefPtr takeViewSnapshot(std::optional&&, bool nominalResolution = false) = 0; +#endif @@ -15901,7 +14539,7 @@ index 0000000000000000000000000000000000000000..a8a92a6c5f4b03724decc97828291f6f + +#endif // ENABLE(FULLSCREEN_API) diff --git a/Source/WebKit/UIProcess/ProvisionalFrameProxy.cpp b/Source/WebKit/UIProcess/ProvisionalFrameProxy.cpp -index 6a324ab3945475beed2774ab596645c72a6f658e..9045758645d48123c574a2ba7529a433c1a99f57 100644 +index 493bde430bef5c064ff6807296ad088d8dee1a72..9b6dbc259e150fba3ba5fb4b488d91e3fb16be7e 100644 --- a/Source/WebKit/UIProcess/ProvisionalFrameProxy.cpp +++ b/Source/WebKit/UIProcess/ProvisionalFrameProxy.cpp @@ -25,6 +25,7 @@ @@ -16233,7 +14871,7 @@ index 697a350812e1bf73dd44cc3d723a6a291f9d59d1..a8e1edd710d88f48632d51fd05aa9647 RefPtr protectedPage() const; diff --git a/Source/WebKit/UIProcess/WebPageInspectorEmulationAgent.cpp b/Source/WebKit/UIProcess/WebPageInspectorEmulationAgent.cpp new file mode 100644 -index 0000000000000000000000000000000000000000..0a8d10ae990997684766df46719c65aa8dd77f28 +index 0000000000000000000000000000000000000000..653b3550dda624df82de679315711fd1dd4ed0b6 --- /dev/null +++ b/Source/WebKit/UIProcess/WebPageInspectorEmulationAgent.cpp @@ -0,0 +1,159 @@ @@ -16341,10 +14979,10 @@ index 0000000000000000000000000000000000000000..0a8d10ae990997684766df46719c65aa + +Inspector::Protocol::ErrorStringOr WebPageInspectorEmulationAgent::setAuthCredentials(const String& username, const String& password, const String& origin) +{ -+ if (!!username && !!password) -+ m_page.setAuthCredentialsForAutomation(WebCore::Credential(username, password, WebCore::CredentialPersistence::Permanent), URL(origin)); ++ if (username.isNull() && password.isNull()) ++ m_page.setAuthCredentialsForAutomation(std::nullopt, std::nullopt); + else -+ m_page.setAuthCredentialsForAutomation(std::optional(), std::optional()); ++ m_page.setAuthCredentialsForAutomation(WebCore::Credential(username, password, WebCore::CredentialPersistence::Permanent), URL(origin)); + return { }; +} + @@ -16972,10 +15610,10 @@ index 0000000000000000000000000000000000000000..26a2a3c0791c334f811ec99a630314f8 + +} // namespace WebKit diff --git a/Source/WebKit/UIProcess/WebPageProxy.cpp b/Source/WebKit/UIProcess/WebPageProxy.cpp -index 8596e12ab413647f88507c1bbfebcd5ca441a190..11ce2408b8358bc2ebe3abfc79c47662e991d7c0 100644 +index 7c380219c6ff83938d0b7425b62932521cdb1edb..7439ed4314cd66866e0eb570e46744cad3254e10 100644 --- a/Source/WebKit/UIProcess/WebPageProxy.cpp +++ b/Source/WebKit/UIProcess/WebPageProxy.cpp -@@ -203,6 +203,7 @@ +@@ -205,6 +205,7 @@ #include #include #include @@ -16983,15 +15621,15 @@ index 8596e12ab413647f88507c1bbfebcd5ca441a190..11ce2408b8358bc2ebe3abfc79c47662 #include #include #include -@@ -214,6 +215,7 @@ - #include +@@ -217,6 +218,7 @@ + #include #include #include +#include #include #include #include -@@ -238,6 +240,7 @@ +@@ -242,6 +244,7 @@ #include #include #include @@ -16999,7 +15637,7 @@ index 8596e12ab413647f88507c1bbfebcd5ca441a190..11ce2408b8358bc2ebe3abfc79c47662 #include #include #include -@@ -245,10 +248,13 @@ +@@ -250,10 +253,13 @@ #include #include #include @@ -17013,7 +15651,7 @@ index 8596e12ab413647f88507c1bbfebcd5ca441a190..11ce2408b8358bc2ebe3abfc79c47662 #include #include #include -@@ -336,6 +342,9 @@ +@@ -349,6 +355,9 @@ #if USE(GBM) #include "AcceleratedBackingStoreDMABuf.h" #endif @@ -17023,7 +15661,7 @@ index 8596e12ab413647f88507c1bbfebcd5ca441a190..11ce2408b8358bc2ebe3abfc79c47662 #include #endif -@@ -461,6 +470,8 @@ static constexpr Seconds tryCloseTimeoutDelay = 50_ms; +@@ -474,6 +483,8 @@ static constexpr Seconds tryCloseTimeoutDelay = 50_ms; static constexpr Seconds audibleActivityClearDelay = 10_s; #endif @@ -17032,7 +15670,7 @@ index 8596e12ab413647f88507c1bbfebcd5ca441a190..11ce2408b8358bc2ebe3abfc79c47662 DEFINE_DEBUG_ONLY_GLOBAL(WTF::RefCountedLeakCounter, webPageProxyCounter, ("WebPageProxy")); #if PLATFORM(COCOA) -@@ -983,6 +994,10 @@ WebPageProxy::~WebPageProxy() +@@ -1007,6 +1018,10 @@ WebPageProxy::~WebPageProxy() #endif internals().updatePlayingMediaDidChangeTimer.stop(); @@ -17043,7 +15681,7 @@ index 8596e12ab413647f88507c1bbfebcd5ca441a190..11ce2408b8358bc2ebe3abfc79c47662 } Ref WebPageProxy::Internals::protectedPage() const -@@ -1556,7 +1571,7 @@ void WebPageProxy::didAttachToRunningProcess() +@@ -1580,7 +1595,7 @@ void WebPageProxy::didAttachToRunningProcess() #if ENABLE(FULLSCREEN_API) ASSERT(!m_fullScreenManager); @@ -17052,7 +15690,7 @@ index 8596e12ab413647f88507c1bbfebcd5ca441a190..11ce2408b8358bc2ebe3abfc79c47662 #endif #if ENABLE(VIDEO_PRESENTATION_MODE) ASSERT(!m_playbackSessionManager); -@@ -1722,6 +1737,7 @@ void WebPageProxy::initializeWebPage(const Site& site, WebCore::SandboxFlags eff +@@ -1739,6 +1754,7 @@ void WebPageProxy::initializeWebPage(const Site& site, WebCore::SandboxFlags eff if (preferences->siteIsolationEnabled()) browsingContextGroup->addPage(*this); process->send(Messages::WebProcess::CreateWebPage(m_webPageID, creationParameters(process, *m_drawingArea, m_mainFrame->frameID(), std::nullopt)), 0); @@ -17060,7 +15698,7 @@ index 8596e12ab413647f88507c1bbfebcd5ca441a190..11ce2408b8358bc2ebe3abfc79c47662 #if ENABLE(WINDOW_PROXY_PROPERTY_ACCESS_NOTIFICATION) internals().frameLoadStateObserver = makeUniqueWithoutRefCountedCheck(*this); -@@ -1988,6 +2004,21 @@ Ref WebPageProxy::ensureProtectedRunningProcess() +@@ -2021,6 +2037,21 @@ Ref WebPageProxy::ensureProtectedRunningProcess() return ensureRunningProcess(); } @@ -17082,7 +15720,7 @@ index 8596e12ab413647f88507c1bbfebcd5ca441a190..11ce2408b8358bc2ebe3abfc79c47662 RefPtr WebPageProxy::loadRequest(WebCore::ResourceRequest&& request, ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy, IsPerformingHTTPFallback isPerformingHTTPFallback, std::unique_ptr&& lastNavigationAction, API::Object* userData) { if (m_isClosed) -@@ -2103,11 +2134,29 @@ void WebPageProxy::loadRequestWithNavigationShared(Ref&& proces +@@ -2136,11 +2167,29 @@ void WebPageProxy::loadRequestWithNavigationShared(Ref&& proces navigation->setIsLoadedWithNavigationShared(true); protectedProcess->markProcessAsRecentlyUsed(); @@ -17116,7 +15754,7 @@ index 8596e12ab413647f88507c1bbfebcd5ca441a190..11ce2408b8358bc2ebe3abfc79c47662 }); } -@@ -2661,6 +2710,63 @@ void WebPageProxy::setControlledByAutomation(bool controlled) +@@ -2696,6 +2745,63 @@ void WebPageProxy::setControlledByAutomation(bool controlled) protectedWebsiteDataStore()->protectedNetworkProcess()->send(Messages::NetworkProcess::SetSessionIsControlledByAutomation(m_websiteDataStore->sessionID(), m_controlledByAutomation), 0); } @@ -17180,7 +15818,7 @@ index 8596e12ab413647f88507c1bbfebcd5ca441a190..11ce2408b8358bc2ebe3abfc79c47662 void WebPageProxy::createInspectorTarget(IPC::Connection& connection, const String& targetId, Inspector::InspectorTargetType type) { MESSAGE_CHECK_BASE(!targetId.isEmpty(), connection); -@@ -2920,6 +3026,24 @@ void WebPageProxy::updateActivityState(OptionSet flagsToUpdate) +@@ -2955,6 +3061,24 @@ void WebPageProxy::updateActivityState(OptionSet flagsToUpdate) bool wasVisible = isViewVisible(); RefPtr pageClient = this->pageClient(); internals().activityState.remove(flagsToUpdate); @@ -17205,7 +15843,7 @@ index 8596e12ab413647f88507c1bbfebcd5ca441a190..11ce2408b8358bc2ebe3abfc79c47662 if (flagsToUpdate & ActivityState::IsFocused && pageClient->isViewFocused()) internals().activityState.add(ActivityState::IsFocused); if (flagsToUpdate & ActivityState::WindowIsActive && pageClient->isViewWindowActive()) -@@ -3683,7 +3807,7 @@ void WebPageProxy::performDragOperation(DragData& dragData, const String& dragSt +@@ -3718,7 +3842,7 @@ void WebPageProxy::performDragOperation(DragData& dragData, const String& dragSt if (!hasRunningProcess()) return; @@ -17214,7 +15852,7 @@ index 8596e12ab413647f88507c1bbfebcd5ca441a190..11ce2408b8358bc2ebe3abfc79c47662 URL url { dragData.asURL() }; if (url.protocolIsFile()) protectedLegacyMainFrameProcess()->assumeReadAccessToBaseURL(*this, url.string(), [] { }); -@@ -3711,6 +3835,8 @@ void WebPageProxy::performDragControllerAction(DragControllerAction action, Drag +@@ -3746,6 +3870,8 @@ void WebPageProxy::performDragControllerAction(DragControllerAction action, Drag if (!hasRunningProcess()) return; @@ -17223,7 +15861,7 @@ index 8596e12ab413647f88507c1bbfebcd5ca441a190..11ce2408b8358bc2ebe3abfc79c47662 auto completionHandler = [this, protectedThis = Ref { *this }, action, dragData] (std::optional dragOperation, WebCore::DragHandlingMethod dragHandlingMethod, bool mouseIsOverFileInput, unsigned numberOfItemsToBeAccepted, const IntRect& insertionRect, const IntRect& editableElementRect, std::optional remoteUserInputEventData) mutable { if (!m_pageClient) return; -@@ -3722,7 +3848,7 @@ void WebPageProxy::performDragControllerAction(DragControllerAction action, Drag +@@ -3757,7 +3883,7 @@ void WebPageProxy::performDragControllerAction(DragControllerAction action, Drag dragData.setClientPosition(remoteUserInputEventData->transformedPoint); performDragControllerAction(action, dragData, remoteUserInputEventData->targetFrameID); }; @@ -17232,7 +15870,7 @@ index 8596e12ab413647f88507c1bbfebcd5ca441a190..11ce2408b8358bc2ebe3abfc79c47662 ASSERT(dragData.platformData()); sendWithAsyncReplyToProcessContainingFrame(frameID, Messages::WebPage::PerformDragControllerAction(action, dragData.clientPosition(), dragData.globalPosition(), dragData.draggingSourceOperationMask(), *dragData.platformData(), dragData.flags()), WTFMove(completionHandler)); #else -@@ -3757,14 +3883,35 @@ void WebPageProxy::didPerformDragControllerAction(std::optionalpageClient()) pageClient->didPerformDragControllerAction(); @@ -17272,7 +15910,7 @@ index 8596e12ab413647f88507c1bbfebcd5ca441a190..11ce2408b8358bc2ebe3abfc79c47662 } didStartDrag(); } -@@ -3786,6 +3933,24 @@ void WebPageProxy::dragEnded(const IntPoint& clientPosition, const IntPoint& glo +@@ -3821,6 +3968,24 @@ void WebPageProxy::dragEnded(const IntPoint& clientPosition, const IntPoint& glo setDragCaretRect({ }); } @@ -17297,7 +15935,7 @@ index 8596e12ab413647f88507c1bbfebcd5ca441a190..11ce2408b8358bc2ebe3abfc79c47662 void WebPageProxy::didStartDrag() { if (!hasRunningProcess()) -@@ -3793,6 +3958,26 @@ void WebPageProxy::didStartDrag() +@@ -3828,6 +3993,26 @@ void WebPageProxy::didStartDrag() discardQueuedMouseEvents(); send(Messages::WebPage::DidStartDrag()); @@ -17324,7 +15962,7 @@ index 8596e12ab413647f88507c1bbfebcd5ca441a190..11ce2408b8358bc2ebe3abfc79c47662 } void WebPageProxy::dragCancelled() -@@ -3958,26 +4143,47 @@ void WebPageProxy::processNextQueuedMouseEvent() +@@ -3999,26 +4184,47 @@ void WebPageProxy::processNextQueuedMouseEvent() process->startResponsivenessTimer(); } @@ -17384,7 +16022,7 @@ index 8596e12ab413647f88507c1bbfebcd5ca441a190..11ce2408b8358bc2ebe3abfc79c47662 } void WebPageProxy::doAfterProcessingAllPendingMouseEvents(WTF::Function&& action) -@@ -4174,6 +4380,8 @@ void WebPageProxy::wheelEventHandlingCompleted(bool wasHandled) +@@ -4215,6 +4421,8 @@ void WebPageProxy::wheelEventHandlingCompleted(bool wasHandled) if (RefPtr automationSession = m_configuration->processPool().automationSession()) automationSession->wheelEventsFlushedForPage(*this); @@ -17393,7 +16031,7 @@ index 8596e12ab413647f88507c1bbfebcd5ca441a190..11ce2408b8358bc2ebe3abfc79c47662 } void WebPageProxy::cacheWheelEventScrollingAccelerationCurve(const NativeWebWheelEvent& nativeWheelEvent) -@@ -4310,7 +4518,7 @@ static TrackingType mergeTrackingTypes(TrackingType a, TrackingType b) +@@ -4351,7 +4559,7 @@ static TrackingType mergeTrackingTypes(TrackingType a, TrackingType b) void WebPageProxy::updateTouchEventTracking(const WebTouchEvent& touchStartEvent) { @@ -17402,7 +16040,7 @@ index 8596e12ab413647f88507c1bbfebcd5ca441a190..11ce2408b8358bc2ebe3abfc79c47662 for (auto& touchPoint : touchStartEvent.touchPoints()) { auto location = touchPoint.locationInRootView(); auto update = [this, location](TrackingType& trackingType, EventTrackingRegions::EventType eventType) { -@@ -4972,6 +5180,7 @@ void WebPageProxy::receivedNavigationActionPolicyDecision(WebProcessProxy& proce +@@ -5012,6 +5220,7 @@ void WebPageProxy::receivedNavigationActionPolicyDecision(WebProcessProxy& proce void WebPageProxy::receivedPolicyDecision(PolicyAction action, API::Navigation* navigation, RefPtr&& websitePolicies, Ref&& navigationAction, WillContinueLoadInNewProcess willContinueLoadInNewProcess, std::optional sandboxExtensionHandle, std::optional&& consoleMessage, CompletionHandler&& completionHandler) { @@ -17410,7 +16048,7 @@ index 8596e12ab413647f88507c1bbfebcd5ca441a190..11ce2408b8358bc2ebe3abfc79c47662 if (!hasRunningProcess()) return completionHandler(PolicyDecision { }); -@@ -5969,6 +6178,7 @@ void WebPageProxy::viewScaleFactorDidChange(IPC::Connection& connection, double +@@ -6013,6 +6222,7 @@ void WebPageProxy::viewScaleFactorDidChange(IPC::Connection& connection, double MESSAGE_CHECK_BASE(scaleFactorIsValid(scaleFactor), connection); if (!legacyMainFrameProcess().hasConnection(connection)) return; @@ -17418,7 +16056,7 @@ index 8596e12ab413647f88507c1bbfebcd5ca441a190..11ce2408b8358bc2ebe3abfc79c47662 forEachWebContentProcess([&] (auto& process, auto pageID) { if (&process == &legacyMainFrameProcess()) -@@ -6606,6 +6816,7 @@ void WebPageProxy::didDestroyNavigationShared(Ref&& process, We +@@ -6664,6 +6874,7 @@ void WebPageProxy::didDestroyNavigationShared(Ref&& process, We RefPtr protectedPageClient { pageClient() }; protectedNavigationState()->didDestroyNavigation(process->coreProcessIdentifier(), navigationID); @@ -17426,7 +16064,7 @@ index 8596e12ab413647f88507c1bbfebcd5ca441a190..11ce2408b8358bc2ebe3abfc79c47662 } void WebPageProxy::didStartProvisionalLoadForFrame(IPC::Connection& connection, FrameIdentifier frameID, FrameInfoData&& frameInfo, ResourceRequest&& request, std::optional navigationID, URL&& url, URL&& unreachableURL, const UserData& userData, WallTime timestamp) -@@ -6947,6 +7158,8 @@ void WebPageProxy::didFailProvisionalLoadForFrameShared(Ref&& p +@@ -7008,6 +7219,8 @@ void WebPageProxy::didFailProvisionalLoadForFrameShared(Ref&& p m_failingProvisionalLoadURL = { }; @@ -17435,7 +16073,7 @@ index 8596e12ab413647f88507c1bbfebcd5ca441a190..11ce2408b8358bc2ebe3abfc79c47662 // If the provisional page's load fails then we destroy the provisional page. if (m_provisionalPage && m_provisionalPage->mainFrame() == &frame && willContinueLoading == WillContinueLoading::No) m_provisionalPage = nullptr; -@@ -8405,8 +8618,9 @@ void WebPageProxy::createNewPage(IPC::Connection& connection, WindowFeatures&& w +@@ -8536,8 +8749,9 @@ void WebPageProxy::createNewPage(IPC::Connection& connection, WindowFeatures&& w if (RefPtr page = originatingFrameInfo->page()) openerAppInitiatedState = page->lastNavigationWasAppInitiated(); @@ -17446,7 +16084,7 @@ index 8596e12ab413647f88507c1bbfebcd5ca441a190..11ce2408b8358bc2ebe3abfc79c47662 auto completionHandler = [ this, protectedThis = Ref { *this }, -@@ -8486,6 +8700,7 @@ void WebPageProxy::createNewPage(IPC::Connection& connection, WindowFeatures&& w +@@ -8617,6 +8831,7 @@ void WebPageProxy::createNewPage(IPC::Connection& connection, WindowFeatures&& w configuration->setOpenedMainFrameName(openedMainFrameName); if (!protectedPreferences()->siteIsolationEnabled()) configuration->setRelatedPage(*this); @@ -17454,7 +16092,7 @@ index 8596e12ab413647f88507c1bbfebcd5ca441a190..11ce2408b8358bc2ebe3abfc79c47662 if (RefPtr openerFrame = WebFrameProxy::webFrame(originatingFrameInfoData.frameID); navigationActionData.hasOpener && openerFrame) { configuration->setOpenerInfo({ { -@@ -8514,6 +8729,7 @@ void WebPageProxy::createNewPage(IPC::Connection& connection, WindowFeatures&& w +@@ -8644,6 +8859,7 @@ void WebPageProxy::createNewPage(IPC::Connection& connection, WindowFeatures&& w void WebPageProxy::showPage() { m_uiClient->showPage(this); @@ -17462,7 +16100,7 @@ index 8596e12ab413647f88507c1bbfebcd5ca441a190..11ce2408b8358bc2ebe3abfc79c47662 } bool WebPageProxy::hasOpenedPage() const -@@ -8645,6 +8861,10 @@ void WebPageProxy::closePage() +@@ -8775,6 +8991,10 @@ void WebPageProxy::closePage() if (isClosed()) return; @@ -17473,34 +16111,34 @@ index 8596e12ab413647f88507c1bbfebcd5ca441a190..11ce2408b8358bc2ebe3abfc79c47662 WEBPAGEPROXY_RELEASE_LOG(Process, "closePage:"); if (RefPtr pageClient = this->pageClient()) pageClient->clearAllEditCommands(); -@@ -8683,6 +8903,8 @@ void WebPageProxy::runJavaScriptAlert(IPC::Connection& connection, FrameIdentifi +@@ -8813,6 +9033,8 @@ void WebPageProxy::runJavaScriptAlert(IPC::Connection& connection, FrameIdentifi } - runModalJavaScriptDialog(WTFMove(frame), WTFMove(frameInfo), message, [reply = WTFMove(reply)](WebPageProxy& page, WebFrameProxy* frame, FrameInfoData&& frameInfo, const String& message, CompletionHandler&& completion) mutable { + runModalJavaScriptDialog(WTFMove(frame), WTFMove(frameInfo), WTFMove(message), [reply = WTFMove(reply)](WebPageProxy& page, WebFrameProxy* frame, FrameInfoData&& frameInfo, String&& message, CompletionHandler&& completion) mutable { + if (page.m_inspectorDialogAgent) + page.m_inspectorDialogAgent->javascriptDialogOpening("alert"_s, message); - page.m_uiClient->runJavaScriptAlert(page, message, frame, WTFMove(frameInfo), [reply = WTFMove(reply), completion = WTFMove(completion)]() mutable { + page.m_uiClient->runJavaScriptAlert(page, WTFMove(message), frame, WTFMove(frameInfo), [reply = WTFMove(reply), completion = WTFMove(completion)]() mutable { reply(); completion(); -@@ -8705,6 +8927,8 @@ void WebPageProxy::runJavaScriptConfirm(IPC::Connection& connection, FrameIdenti +@@ -8835,6 +9057,8 @@ void WebPageProxy::runJavaScriptConfirm(IPC::Connection& connection, FrameIdenti if (RefPtr automationSession = configuration().processPool().automationSession()) - automationSession->willShowJavaScriptDialog(*this); + automationSession->willShowJavaScriptDialog(*this, message, std::nullopt); } + if (m_inspectorDialogAgent) + m_inspectorDialogAgent->javascriptDialogOpening("confirm"_s, message); - runModalJavaScriptDialog(WTFMove(frame), WTFMove(frameInfo), message, [reply = WTFMove(reply)](WebPageProxy& page, WebFrameProxy* frame, FrameInfoData&& frameInfo, const String& message, CompletionHandler&& completion) mutable { - page.m_uiClient->runJavaScriptConfirm(page, message, frame, WTFMove(frameInfo), [reply = WTFMove(reply), completion = WTFMove(completion)](bool result) mutable { -@@ -8729,6 +8953,8 @@ void WebPageProxy::runJavaScriptPrompt(IPC::Connection& connection, FrameIdentif + runModalJavaScriptDialog(WTFMove(frame), WTFMove(frameInfo), WTFMove(message), [reply = WTFMove(reply)](WebPageProxy& page, WebFrameProxy* frame, FrameInfoData&& frameInfo, String&& message, CompletionHandler&& completion) mutable { + page.m_uiClient->runJavaScriptConfirm(page, WTFMove(message), frame, WTFMove(frameInfo), [reply = WTFMove(reply), completion = WTFMove(completion)](bool result) mutable { +@@ -8859,6 +9083,8 @@ void WebPageProxy::runJavaScriptPrompt(IPC::Connection& connection, FrameIdentif if (RefPtr automationSession = configuration().processPool().automationSession()) - automationSession->willShowJavaScriptDialog(*this); + automationSession->willShowJavaScriptDialog(*this, message, defaultValue); } + if (m_inspectorDialogAgent) + m_inspectorDialogAgent->javascriptDialogOpening("prompt"_s, message, defaultValue); - runModalJavaScriptDialog(WTFMove(frame), WTFMove(frameInfo), message, [reply = WTFMove(reply), defaultValue](WebPageProxy& page, WebFrameProxy* frame, FrameInfoData&& frameInfo, const String& message, CompletionHandler&& completion) mutable { - page.m_uiClient->runJavaScriptPrompt(page, message, defaultValue, frame, WTFMove(frameInfo), [reply = WTFMove(reply), completion = WTFMove(completion)](auto& result) mutable { -@@ -8864,6 +9090,8 @@ void WebPageProxy::runBeforeUnloadConfirmPanel(IPC::Connection& connection, Fram + runModalJavaScriptDialog(WTFMove(frame), WTFMove(frameInfo), WTFMove(message), [reply = WTFMove(reply), defaultValue= WTFMove(defaultValue)](WebPageProxy& page, WebFrameProxy* frame, FrameInfoData&& frameInfo, String&& message, CompletionHandler&& completion) mutable { + page.m_uiClient->runJavaScriptPrompt(page, WTFMove(message), WTFMove(defaultValue), frame, WTFMove(frameInfo), [reply = WTFMove(reply), completion = WTFMove(completion)](auto& result) mutable { +@@ -9000,6 +9226,8 @@ void WebPageProxy::runBeforeUnloadConfirmPanel(IPC::Connection& connection, Fram return; } } @@ -17508,8 +16146,8 @@ index 8596e12ab413647f88507c1bbfebcd5ca441a190..11ce2408b8358bc2ebe3abfc79c47662 + m_inspectorDialogAgent->javascriptDialogOpening("beforeunload"_s, message); // Since runBeforeUnloadConfirmPanel() can spin a nested run loop we need to turn off the responsiveness timer and the tryClose timer. - WebProcessProxy::fromConnection(connection)->stopResponsivenessTimer(); -@@ -9481,6 +9709,11 @@ void WebPageProxy::resourceLoadDidCompleteWithError(ResourceLoadInfo&& loadInfo, + webProcess->stopResponsivenessTimer(); +@@ -9626,6 +9854,11 @@ void WebPageProxy::resourceLoadDidCompleteWithError(ResourceLoadInfo&& loadInfo, } #if ENABLE(FULLSCREEN_API) @@ -17521,7 +16159,7 @@ index 8596e12ab413647f88507c1bbfebcd5ca441a190..11ce2408b8358bc2ebe3abfc79c47662 WebFullScreenManagerProxy* WebPageProxy::fullScreenManager() { return m_fullScreenManager.get(); -@@ -9608,6 +9841,17 @@ void WebPageProxy::requestDOMPasteAccess(IPC::Connection& connection, DOMPasteAc +@@ -9753,6 +9986,17 @@ void WebPageProxy::requestDOMPasteAccess(IPC::Connection& connection, DOMPasteAc } } @@ -17539,7 +16177,7 @@ index 8596e12ab413647f88507c1bbfebcd5ca441a190..11ce2408b8358bc2ebe3abfc79c47662 protectedPageClient()->requestDOMPasteAccess(pasteAccessCategory, requiresInteraction, elementRect, originIdentifier, WTFMove(completionHandler)); } -@@ -10634,6 +10878,8 @@ void WebPageProxy::mouseEventHandlingCompleted(std::optional event +@@ -10795,6 +11039,8 @@ void WebPageProxy::mouseEventHandlingCompleted(std::optional event if (RefPtr automationSession = configuration().processPool().automationSession()) automationSession->mouseEventsFlushedForPage(*this); didFinishProcessingAllPendingMouseEvents(); @@ -17548,7 +16186,7 @@ index 8596e12ab413647f88507c1bbfebcd5ca441a190..11ce2408b8358bc2ebe3abfc79c47662 } } -@@ -10669,6 +10915,7 @@ void WebPageProxy::keyEventHandlingCompleted(std::optional eventTy +@@ -10830,6 +11076,7 @@ void WebPageProxy::keyEventHandlingCompleted(std::optional eventTy if (!canProcessMoreKeyEvents) { if (RefPtr automationSession = configuration().processPool().automationSession()) automationSession->keyboardEventsFlushedForPage(*this); @@ -17556,7 +16194,7 @@ index 8596e12ab413647f88507c1bbfebcd5ca441a190..11ce2408b8358bc2ebe3abfc79c47662 } } -@@ -11101,7 +11348,10 @@ void WebPageProxy::dispatchProcessDidTerminate(WebProcessProxy& process, Process +@@ -11262,7 +11509,10 @@ void WebPageProxy::dispatchProcessDidTerminate(WebProcessProxy& process, Process if (protectedPreferences()->siteIsolationEnabled()) protectedBrowsingContextGroup()->processDidTerminate(*this, process); @@ -17568,7 +16206,7 @@ index 8596e12ab413647f88507c1bbfebcd5ca441a190..11ce2408b8358bc2ebe3abfc79c47662 if (m_loaderClient) handledByClient = reason != ProcessTerminationReason::RequestedByClient && m_loaderClient->processDidCrash(*this); else -@@ -11752,6 +12002,8 @@ WebPageCreationParameters WebPageProxy::creationParameters(WebProcessProxy& proc +@@ -11913,6 +12163,8 @@ WebPageCreationParameters WebPageProxy::creationParameters(WebProcessProxy& proc parameters.canUseCredentialStorage = m_canUseCredentialStorage; parameters.httpsUpgradeEnabled = preferences->upgradeKnownHostsToHTTPSEnabled() ? m_configuration->httpsUpgradeEnabled() : false; @@ -17577,7 +16215,7 @@ index 8596e12ab413647f88507c1bbfebcd5ca441a190..11ce2408b8358bc2ebe3abfc79c47662 #if ENABLE(APP_HIGHLIGHTS) parameters.appHighlightsVisible = appHighlightsVisibility() ? HighlightVisibility::Visible : HighlightVisibility::Hidden; -@@ -11917,8 +12169,42 @@ void WebPageProxy::allowGamepadAccess() +@@ -12081,8 +12333,47 @@ void WebPageProxy::allowGamepadAccess() #endif // ENABLE(GAMEPAD) @@ -17608,6 +16246,11 @@ index 8596e12ab413647f88507c1bbfebcd5ca441a190..11ce2408b8358bc2ebe3abfc79c47662 + void WebPageProxy::didReceiveAuthenticationChallengeProxy(Ref&& authenticationChallenge, NegotiatedLegacyTLS negotiatedLegacyTLS) { ++ if (authenticationChallenge->core().protectionSpace().authenticationScheme() == WebCore::ProtectionSpaceBaseAuthenticationScheme::ServerTrustEvaluationRequested && websiteDataStore().ignoreTLSErrors()) { ++ authenticationChallenge->listener().completeChallenge(AuthenticationChallengeDisposition::UseCredential, WebCore::Credential("accept server trust"_s, ""_s, WebCore::CredentialPersistence::None)); ++ return; ++ } ++ + if (m_credentialsForAutomation.has_value()) { + if (m_credentialsForAutomation->isEmpty() || authenticationChallenge->core().previousFailureCount() || + !shouldSendAutomationCredentialsForProtectionSpace(*authenticationChallenge->protectionSpace())) { @@ -17620,7 +16263,7 @@ index 8596e12ab413647f88507c1bbfebcd5ca441a190..11ce2408b8358bc2ebe3abfc79c47662 if (negotiatedLegacyTLS == NegotiatedLegacyTLS::Yes) { m_navigationClient->shouldAllowLegacyTLS(*this, authenticationChallenge.get(), [this, protectedThis = Ref { *this }, authenticationChallenge] (bool shouldAllowLegacyTLS) { if (shouldAllowLegacyTLS) -@@ -12014,6 +12300,12 @@ void WebPageProxy::requestGeolocationPermissionForFrame(IPC::Connection& connect +@@ -12178,6 +12469,12 @@ void WebPageProxy::requestGeolocationPermissionForFrame(IPC::Connection& connect request->deny(); }; @@ -17633,7 +16276,7 @@ index 8596e12ab413647f88507c1bbfebcd5ca441a190..11ce2408b8358bc2ebe3abfc79c47662 // FIXME: Once iOS migrates to the new WKUIDelegate SPI, clean this up // and make it one UIClient call that calls the completionHandler with false // if there is no delegate instead of returning the completionHandler -@@ -12078,6 +12370,12 @@ void WebPageProxy::queryPermission(const ClientOrigin& clientOrigin, const Permi +@@ -12244,6 +12541,12 @@ void WebPageProxy::queryPermission(const ClientOrigin& clientOrigin, const Permi shouldChangeDeniedToPrompt = false; if (sessionID().isEphemeral()) { @@ -17646,7 +16289,7 @@ index 8596e12ab413647f88507c1bbfebcd5ca441a190..11ce2408b8358bc2ebe3abfc79c47662 completionHandler(shouldChangeDeniedToPrompt ? PermissionState::Prompt : PermissionState::Denied); return; } -@@ -12092,6 +12390,12 @@ void WebPageProxy::queryPermission(const ClientOrigin& clientOrigin, const Permi +@@ -12258,6 +12561,12 @@ void WebPageProxy::queryPermission(const ClientOrigin& clientOrigin, const Permi return; } @@ -17660,7 +16303,7 @@ index 8596e12ab413647f88507c1bbfebcd5ca441a190..11ce2408b8358bc2ebe3abfc79c47662 completionHandler(shouldChangeDeniedToPrompt ? PermissionState::Prompt : PermissionState::Denied); return; diff --git a/Source/WebKit/UIProcess/WebPageProxy.h b/Source/WebKit/UIProcess/WebPageProxy.h -index de568bc247847234de4bd8a34d80726a4fa22a53..85881e1a1a695907016c0924e3df38f072455f61 100644 +index c220a17ba9d98b37e16bea6ef2c37ffd4599c906..d5e57548822361620b9a18c283e5e5e6821de584 100644 --- a/Source/WebKit/UIProcess/WebPageProxy.h +++ b/Source/WebKit/UIProcess/WebPageProxy.h @@ -26,6 +26,7 @@ @@ -17671,7 +16314,7 @@ index de568bc247847234de4bd8a34d80726a4fa22a53..85881e1a1a695907016c0924e3df38f0 #include "MessageReceiver.h" #include #include -@@ -44,6 +45,20 @@ +@@ -46,6 +47,20 @@ #include #include #include @@ -17692,7 +16335,7 @@ index de568bc247847234de4bd8a34d80726a4fa22a53..85881e1a1a695907016c0924e3df38f0 #if USE(DICTATION_ALTERNATIVES) #include -@@ -128,6 +143,7 @@ class DragData; +@@ -130,6 +145,7 @@ class DragData; class Exception; class FloatPoint; class FloatQuad; @@ -17700,7 +16343,7 @@ index de568bc247847234de4bd8a34d80726a4fa22a53..85881e1a1a695907016c0924e3df38f0 class FloatRect; class FloatSize; class FontAttributeChanges; -@@ -734,6 +750,8 @@ public: +@@ -735,6 +751,8 @@ public: void setControlledByAutomation(bool); WebPageInspectorController& inspectorController() { return *m_inspectorController; } @@ -17709,7 +16352,7 @@ index de568bc247847234de4bd8a34d80726a4fa22a53..85881e1a1a695907016c0924e3df38f0 #if PLATFORM(IOS_FAMILY) void showInspectorIndication(); -@@ -767,6 +785,7 @@ public: +@@ -768,6 +786,7 @@ public: bool hasSleepDisabler() const; #if ENABLE(FULLSCREEN_API) @@ -17717,7 +16360,7 @@ index de568bc247847234de4bd8a34d80726a4fa22a53..85881e1a1a695907016c0924e3df38f0 WebFullScreenManagerProxy* fullScreenManager(); RefPtr protectedFullScreenManager(); void setFullScreenClientForTesting(std::unique_ptr&&); -@@ -858,6 +877,12 @@ public: +@@ -859,6 +878,12 @@ public: void setPageLoadStateObserver(RefPtr&&); @@ -17730,7 +16373,7 @@ index de568bc247847234de4bd8a34d80726a4fa22a53..85881e1a1a695907016c0924e3df38f0 void initializeWebPage(const WebCore::Site&, WebCore::SandboxFlags); void setDrawingArea(RefPtr&&); -@@ -889,6 +914,8 @@ public: +@@ -890,6 +915,8 @@ public: RefPtr loadRequest(WebCore::ResourceRequest&&, WebCore::ShouldOpenExternalURLsPolicy, WebCore::IsPerformingHTTPFallback); RefPtr loadRequest(WebCore::ResourceRequest&&, WebCore::ShouldOpenExternalURLsPolicy, WebCore::IsPerformingHTTPFallback, std::unique_ptr&&, API::Object* userData = nullptr); @@ -17739,7 +16382,7 @@ index de568bc247847234de4bd8a34d80726a4fa22a53..85881e1a1a695907016c0924e3df38f0 RefPtr loadFile(const String& fileURL, const String& resourceDirectoryURL, bool isAppInitiated = true, API::Object* userData = nullptr); RefPtr loadData(Ref&&, const String& MIMEType, const String& encoding, const String& baseURL, API::Object* userData = nullptr); RefPtr loadData(Ref&&, const String& MIMEType, const String& encoding, const String& baseURL, API::Object* userData, WebCore::ShouldOpenExternalURLsPolicy); -@@ -977,6 +1004,7 @@ public: +@@ -978,6 +1005,7 @@ public: PageClient* pageClient() const; RefPtr protectedPageClient() const; @@ -17747,14 +16390,14 @@ index de568bc247847234de4bd8a34d80726a4fa22a53..85881e1a1a695907016c0924e3df38f0 void setViewNeedsDisplay(const WebCore::Region&); void requestScroll(const WebCore::FloatPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin, WebCore::ScrollIsAnimated); -@@ -1617,14 +1645,20 @@ public: +@@ -1620,17 +1648,23 @@ public: void didStartDrag(); void dragCancelled(); void setDragCaretRect(const WebCore::IntRect&); + void setInterceptDrags(bool shouldIntercept); + bool cancelDragIfNeeded(); #if PLATFORM(COCOA) - void startDrag(const WebCore::DragItem&, WebCore::ShareableBitmapHandle&& dragImageHandle); + void startDrag(const WebCore::DragItem&, WebCore::ShareableBitmapHandle&& dragImageHandle, const std::optional&); void setPromisedDataForImage(IPC::Connection&, const String& pasteboardName, WebCore::SharedMemoryHandle&& imageHandle, const String& filename, const String& extension, const String& title, const String& url, const String& visibleURL, WebCore::SharedMemoryHandle&& archiveHandle, const String& originIdentifier); + void releaseInspectorDragPasteboard(); @@ -17763,13 +16406,16 @@ index de568bc247847234de4bd8a34d80726a4fa22a53..85881e1a1a695907016c0924e3df38f0 +#if PLATFORM(GTK) || PLATFORM(WPE) void startDrag(WebCore::SelectionData&&, OptionSet, std::optional&& dragImage, WebCore::IntPoint&& dragImageHotspot); #endif + #if ENABLE(MODEL_PROCESS) + void modelDragEnded(const WebCore::ElementIdentifier); + #endif +#if PLATFORM(WIN) + void startDrag(WebCore::DragDataMap&& dragDataMap); +#endif #endif void processDidBecomeUnresponsive(); -@@ -1877,6 +1911,7 @@ public: +@@ -1883,6 +1917,7 @@ public: void setViewportSizeForCSSViewportUnits(const WebCore::FloatSize&); WebCore::FloatSize viewportSizeForCSSViewportUnits() const; @@ -17777,7 +16423,7 @@ index de568bc247847234de4bd8a34d80726a4fa22a53..85881e1a1a695907016c0924e3df38f0 void didReceiveAuthenticationChallengeProxy(Ref&&, NegotiatedLegacyTLS); void negotiatedLegacyTLS(); void didNegotiateModernTLS(const URL&); -@@ -1910,6 +1945,8 @@ public: +@@ -1916,6 +1951,8 @@ public: #if PLATFORM(COCOA) || PLATFORM(GTK) RefPtr takeViewSnapshot(std::optional&&); RefPtr takeViewSnapshot(std::optional&&, ForceSoftwareCapturingViewportSnapshot); @@ -17786,7 +16432,7 @@ index de568bc247847234de4bd8a34d80726a4fa22a53..85881e1a1a695907016c0924e3df38f0 #endif void serializeAndWrapCryptoKey(IPC::Connection&, WebCore::CryptoKeyData&&, CompletionHandler>&&)>&&); -@@ -2919,6 +2956,7 @@ private: +@@ -2931,6 +2968,7 @@ private: RefPtr launchProcessForReload(); void requestNotificationPermission(const String& originString, CompletionHandler&&); @@ -17794,7 +16440,7 @@ index de568bc247847234de4bd8a34d80726a4fa22a53..85881e1a1a695907016c0924e3df38f0 void didChangeContentSize(const WebCore::IntSize&); void didChangeIntrinsicContentSize(const WebCore::IntSize&); -@@ -3436,8 +3474,10 @@ private: +@@ -3450,8 +3488,10 @@ private: String m_openedMainFrameName; RefPtr m_inspector; @@ -17805,7 +16451,7 @@ index de568bc247847234de4bd8a34d80726a4fa22a53..85881e1a1a695907016c0924e3df38f0 RefPtr m_fullScreenManager; std::unique_ptr m_fullscreenClient; #endif -@@ -3636,6 +3676,22 @@ private: +@@ -3650,6 +3690,22 @@ private: std::optional m_currentDragOperation; bool m_currentDragIsOverFileInput { false }; unsigned m_currentDragNumberOfFilesToBeAccepted { 0 }; @@ -17828,7 +16474,7 @@ index de568bc247847234de4bd8a34d80726a4fa22a53..85881e1a1a695907016c0924e3df38f0 #endif bool m_mainFrameHasHorizontalScrollbar { false }; -@@ -3807,6 +3863,10 @@ private: +@@ -3821,6 +3877,10 @@ private: RefPtr messageBody; }; Vector m_pendingInjectedBundleMessages; @@ -17840,7 +16486,7 @@ index de568bc247847234de4bd8a34d80726a4fa22a53..85881e1a1a695907016c0924e3df38f0 #if PLATFORM(IOS_FAMILY) && ENABLE(DEVICE_ORIENTATION) RefPtr m_webDeviceOrientationUpdateProviderProxy; diff --git a/Source/WebKit/UIProcess/WebPageProxy.messages.in b/Source/WebKit/UIProcess/WebPageProxy.messages.in -index 0310e26fe8eb09a68db493035b108aa472dc573d..0182474dd3cb70bc87f239718ad52db972cc44ae 100644 +index acdb79859685a55f3cda48014621340177f30e3d..36aca25956f9b073eefa5a68a013cde6017df39a 100644 --- a/Source/WebKit/UIProcess/WebPageProxy.messages.in +++ b/Source/WebKit/UIProcess/WebPageProxy.messages.in @@ -35,6 +35,7 @@ messages -> WebPageProxy { @@ -17852,7 +16498,7 @@ index 0310e26fe8eb09a68db493035b108aa472dc573d..0182474dd3cb70bc87f239718ad52db9 DidReceiveEventIPC(enum:uint8_t WebKit::WebEventType eventType, bool handled, struct std::optional remoteUserInputEventData) SetCursor(WebCore::Cursor cursor) @@ -333,10 +334,14 @@ messages -> WebPageProxy { - StartDrag(struct WebCore::DragItem dragItem, WebCore::ShareableBitmapHandle dragImage) + StartDrag(struct WebCore::DragItem dragItem, WebCore::ShareableBitmapHandle dragImage, std::optional elementID) SetPromisedDataForImage(String pasteboardName, WebCore::SharedMemory::Handle imageHandle, String filename, String extension, String title, String url, String visibleURL, WebCore::SharedMemory::Handle archiveHandle, String originIdentifier) #endif -#if PLATFORM(GTK) && ENABLE(DRAG_SUPPORT) @@ -17865,8 +16511,8 @@ index 0310e26fe8eb09a68db493035b108aa472dc573d..0182474dd3cb70bc87f239718ad52db9 +#endif + #if PLATFORM(IOS_FAMILY) && ENABLE(DRAG_SUPPORT) - DidHandleDragStartRequest(bool started) - DidHandleAdditionalDragItemsRequest(bool added) + WillReceiveEditDragSnapshot() + DidReceiveEditDragSnapshot(struct std::optional textIndicator) diff --git a/Source/WebKit/UIProcess/WebProcessCache.cpp b/Source/WebKit/UIProcess/WebProcessCache.cpp index dc6f440403cccc5cd93f75806cffbf05cc56041c..e880beba2034cc2b87dcfb3e1e8bacf1bed78cf3 100644 --- a/Source/WebKit/UIProcess/WebProcessCache.cpp @@ -17883,10 +16529,10 @@ index dc6f440403cccc5cd93f75806cffbf05cc56041c..e880beba2034cc2b87dcfb3e1e8bacf1 } diff --git a/Source/WebKit/UIProcess/WebProcessPool.cpp b/Source/WebKit/UIProcess/WebProcessPool.cpp -index 4be8b8ead49ba2ab0ce16af74aa92fab01352358..8e310f0e3bcada1ec9383161b979660e29c50724 100644 +index 794f1e40dea081e818326f1d4123ebdf33569f86..35b0c4cdda0257c4844d4390d5901e71809c23f8 100644 --- a/Source/WebKit/UIProcess/WebProcessPool.cpp +++ b/Source/WebKit/UIProcess/WebProcessPool.cpp -@@ -445,10 +445,10 @@ void WebProcessPool::setAutomationClient(std::unique_ptr& +@@ -447,10 +447,10 @@ void WebProcessPool::setAutomationClient(std::unique_ptr& void WebProcessPool::setOverrideLanguages(Vector&& languages) { @@ -17899,7 +16545,7 @@ index 4be8b8ead49ba2ab0ce16af74aa92fab01352358..8e310f0e3bcada1ec9383161b979660e #if ENABLE(GPU_PROCESS) if (RefPtr gpuProcess = GPUProcessProxy::singletonIfCreated()) -@@ -456,9 +456,10 @@ void WebProcessPool::setOverrideLanguages(Vector&& languages) +@@ -458,9 +458,10 @@ void WebProcessPool::setOverrideLanguages(Vector&& languages) #endif #if USE(SOUP) for (Ref networkProcess : NetworkProcessProxy::allNetworkProcesses()) @@ -17911,7 +16557,7 @@ index 4be8b8ead49ba2ab0ce16af74aa92fab01352358..8e310f0e3bcada1ec9383161b979660e void WebProcessPool::fullKeyboardAccessModeChanged(bool fullKeyboardAccessEnabled) { -@@ -939,7 +940,7 @@ void WebProcessPool::initializeNewWebProcess(WebProcessProxy& process, WebsiteDa +@@ -945,7 +946,7 @@ void WebProcessPool::initializeNewWebProcess(WebProcessProxy& process, WebsiteDa #endif parameters.cacheModel = LegacyGlobalSettings::singleton().cacheModel(); @@ -17921,10 +16567,10 @@ index 4be8b8ead49ba2ab0ce16af74aa92fab01352358..8e310f0e3bcada1ec9383161b979660e parameters.urlSchemesRegisteredAsEmptyDocument = copyToVector(m_schemesToRegisterAsEmptyDocument); diff --git a/Source/WebKit/UIProcess/WebProcessProxy.cpp b/Source/WebKit/UIProcess/WebProcessProxy.cpp -index 45a11c271082cd40635c6b21ee01c75bea749a4b..4ba89b3eafebfa67d8518ec99db6f23ae968df29 100644 +index f1074d1138c9e6f2a76c1ce76807c775b16c657c..b7386197a24a689a5b0cae6772abefb17819dbe9 100644 --- a/Source/WebKit/UIProcess/WebProcessProxy.cpp +++ b/Source/WebKit/UIProcess/WebProcessProxy.cpp -@@ -203,6 +203,11 @@ Vector> WebProcessProxy::allProcesses() +@@ -208,6 +208,11 @@ Vector> WebProcessProxy::allProcesses() }); } @@ -17936,7 +16582,7 @@ index 45a11c271082cd40635c6b21ee01c75bea749a4b..4ba89b3eafebfa67d8518ec99db6f23a RefPtr WebProcessProxy::processForIdentifier(ProcessIdentifier identifier) { return allProcessMap().get(identifier); -@@ -572,6 +577,26 @@ void WebProcessProxy::getLaunchOptions(ProcessLauncher::LaunchOptions& launchOpt +@@ -577,6 +582,26 @@ void WebProcessProxy::getLaunchOptions(ProcessLauncher::LaunchOptions& launchOpt if (WebKit::isInspectorProcessPool(protectedProcessPool())) launchOptions.extraInitializationData.add("inspector-process"_s, "1"_s); @@ -17976,20 +16622,26 @@ index 4471fdf4a46180f78cea1cf035671bfe3c83b8e2..0858fe7f56eb3d8648467f5b82c2d77d void initializeWebProcess(WebProcessCreationParameters&&); diff --git a/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp b/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp -index ef4db4e5e75286a260646226dd48108810b1607e..bf1111ed48e9d3cb74b59d4258faefb814028540 100644 +index c13d50e1828843714be1f49d2b1d5ea45e9c85aa..d7c76f184e77f1d828cde263ddf01f262c6c8f3a 100644 --- a/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp +++ b/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp -@@ -319,7 +319,8 @@ SOAuthorizationCoordinator& WebsiteDataStore::soAuthorizationCoordinator(const W +@@ -2061,6 +2061,15 @@ void WebsiteDataStore::setCacheModelSynchronouslyForTesting(CacheModel cacheMode + processPool->setCacheModelSynchronouslyForTesting(cacheModel); + } - static Ref networkProcessForSession(PAL::SessionID sessionID) ++// Playwright begin ++#if !USE(SOUP) ++void WebsiteDataStore::setIgnoreTLSErrors(bool ignoreTLSErrors) ++{ ++ m_ignoreTLSErrors = ignoreTLSErrors; ++} ++#endif ++// Playwright begin ++ + Vector WebsiteDataStore::parametersFromEachWebsiteDataStore() { --#if ((PLATFORM(GTK) || PLATFORM(WPE)) && !ENABLE(2022_GLIB_API)) -+// Playwright wants to isolate per BrowserContext. -+#if ((PLATFORM(GTK) || PLATFORM(WPE))) - if (sessionID.isEphemeral()) { - // Reuse a previous persistent session network process for ephemeral sessions. - for (auto& dataStore : allDataStores().values()) { -@@ -2511,6 +2512,12 @@ void WebsiteDataStore::originDirectoryForTesting(WebCore::ClientOrigin&& origin, + return WTF::map(allDataStores(), [](auto& entry) { +@@ -2509,6 +2518,12 @@ void WebsiteDataStore::originDirectoryForTesting(WebCore::ClientOrigin&& origin, protectedNetworkProcess()->websiteDataOriginDirectoryForTesting(m_sessionID, WTFMove(origin), type, WTFMove(completionHandler)); } @@ -18003,7 +16655,7 @@ index ef4db4e5e75286a260646226dd48108810b1607e..bf1111ed48e9d3cb74b59d4258faefb8 void WebsiteDataStore::hasAppBoundSession(CompletionHandler&& completionHandler) const { diff --git a/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h b/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h -index f1a113cc08f6543ab22be75a03823f49a3f52017..3d98a33003ae86f2ac5982ba2deb5eb3238b1385 100644 +index f1a113cc08f6543ab22be75a03823f49a3f52017..ef6dc1b450e2f4b0bcd374135a4cbc3d626a89d9 100644 --- a/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h +++ b/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h @@ -98,6 +98,7 @@ class DeviceIdHashSaltStorage; @@ -18037,17 +16689,13 @@ index f1a113cc08f6543ab22be75a03823f49a3f52017..3d98a33003ae86f2ac5982ba2deb5eb3 class WebsiteDataStore : public API::ObjectImpl, public CanMakeWeakPtr { public: static Ref defaultDataStore(); -@@ -318,11 +328,13 @@ public: - const WebCore::CurlProxySettings& networkProxySettings() const { return m_proxySettings; } - #endif - --#if USE(SOUP) -+#if USE(SOUP) || PLATFORM(COCOA) || PLATFORM(WIN) +@@ -321,8 +331,10 @@ public: + #if USE(SOUP) void setPersistentCredentialStorageEnabled(bool); bool persistentCredentialStorageEnabled() const { return m_persistentCredentialStorageEnabled && isPersistent(); } ++#endif void setIgnoreTLSErrors(bool); bool ignoreTLSErrors() const { return m_ignoreTLSErrors; } -+#endif +#if USE(SOUP) void setNetworkProxySettings(WebCore::SoupNetworkProxySettings&&); const WebCore::SoupNetworkProxySettings& networkProxySettings() const { return m_networkProxySettings; } @@ -18065,15 +16713,13 @@ index f1a113cc08f6543ab22be75a03823f49a3f52017..3d98a33003ae86f2ac5982ba2deb5eb3 void resetQuota(CompletionHandler&&); void resetStoragePersistedState(CompletionHandler&&); #if PLATFORM(IOS_FAMILY) -@@ -616,9 +634,11 @@ private: - WebCore::CurlProxySettings m_proxySettings; - #endif +@@ -618,7 +636,9 @@ private: --#if USE(SOUP) -+#if USE(SOUP) || PLATFORM(COCOA) || PLATFORM(WIN) + #if USE(SOUP) bool m_persistentCredentialStorageEnabled { true }; - bool m_ignoreTLSErrors { true }; +- bool m_ignoreTLSErrors { true }; +#endif ++ bool m_ignoreTLSErrors { false }; +#if USE(SOUP) WebCore::SoupNetworkProxySettings m_networkProxySettings; String m_cookiePersistentStoragePath; @@ -18133,10 +16779,10 @@ index 96bf77411e2e1f4c835f56b409dc179977d197ee..512af5ffce511711b502248e34e49e45 RunLoop::Timer m_destroyLaterTimer; diff --git a/Source/WebKit/UIProcess/glib/InspectorPlaywrightAgentClientGLib.cpp b/Source/WebKit/UIProcess/glib/InspectorPlaywrightAgentClientGLib.cpp new file mode 100644 -index 0000000000000000000000000000000000000000..ac01ad1653b22a0f22c45a196659e68fc22d7f32 +index 0000000000000000000000000000000000000000..5185677fc67a418fac7a09c69246f4406a74c706 --- /dev/null +++ b/Source/WebKit/UIProcess/glib/InspectorPlaywrightAgentClientGLib.cpp -@@ -0,0 +1,201 @@ +@@ -0,0 +1,192 @@ +/* + * Copyright (C) 2019 Microsoft Corporation. + * @@ -18176,18 +16822,15 @@ index 0000000000000000000000000000000000000000..ac01ad1653b22a0f22c45a196659e68f +#include "WebKitWebsiteDataManagerPrivate.h" +#include "WebKitWebViewPrivate.h" +#include "WebPageProxy.h" -+#if USE(CAIRO) -+#include -+#endif -+#if USE(SKIA) -+#include -+#endif +#include +#include +#include +#include +#include + ++#if USE(SKIA) ++#include ++#endif + +namespace WebKit { + @@ -18317,14 +16960,8 @@ index 0000000000000000000000000000000000000000..ac01ad1653b22a0f22c45a196659e68f + } + } +#elif PLATFORM(WPE) -+#if USE(SKIA) + sk_sp protectPtr = protectedPage->pageClient()->takeViewSnapshot(WTFMove(clip), nominalResolution); + SkImage* surface = protectPtr.get(); -+#elif USE(CAIRO) -+ cairo_surface_t* surface = nullptr; -+ RefPtr protectPtr = protectedPage->pageClient()->takeViewSnapshot(WTFMove(clip), nominalResolution); -+ surface = protectPtr.get(); -+#endif + if (surface) { + Vector encodeData = WebCore::encodeData(surface, "image/png"_s, std::nullopt); + completionHandler(emptyString(), makeString("data:image/png;base64,"_s, base64Encoded(encodeData))); @@ -18405,18 +17042,6 @@ index 0000000000000000000000000000000000000000..441442d899e4088f5c24ae9f70c3e4ff +} // namespace API + +#endif // ENABLE(REMOTE_INSPECTOR) -diff --git a/Source/WebKit/UIProcess/glib/SystemSettingsManagerProxy.cpp b/Source/WebKit/UIProcess/glib/SystemSettingsManagerProxy.cpp -index c6e25e57892c2a0e1350b207ce53b6d2c3d6258a..bd91f75db5a05ba0a6f5a982c03980ecc57479ca 100644 ---- a/Source/WebKit/UIProcess/glib/SystemSettingsManagerProxy.cpp -+++ b/Source/WebKit/UIProcess/glib/SystemSettingsManagerProxy.cpp -@@ -27,6 +27,7 @@ - #include "config.h" - #include "SystemSettingsManagerProxy.h" - -+#include "SystemSettingsManager.h" - #include "SystemSettingsManagerMessages.h" - #include "WebProcessPool.h" - #include diff --git a/Source/WebKit/UIProcess/glib/WebProcessPoolGLib.cpp b/Source/WebKit/UIProcess/glib/WebProcessPoolGLib.cpp index 51ba8b585ca37a2eed54bce5218e1c92c2844cc6..dc04a2ca0b0ac2333036b897dd18d5303c5237c6 100644 --- a/Source/WebKit/UIProcess/glib/WebProcessPoolGLib.cpp @@ -18781,10 +17406,10 @@ index 0000000000000000000000000000000000000000..36ab6e9aec9f8d79fb13a8a49beadaaf + +} // namespace WebKit diff --git a/Source/WebKit/UIProcess/gtk/WebPasteboardProxyGtk.cpp b/Source/WebKit/UIProcess/gtk/WebPasteboardProxyGtk.cpp -index cedf117035055756084863d1e8db8594e4a8b8d2..bae8c9d90d1f34324bbb98a52815af98d23e5257 100644 +index c7db5171b505ea9656f409c95c422dce9f0fa1ae..1992a112468e03840be3696245eecd8452ca51ed 100644 --- a/Source/WebKit/UIProcess/gtk/WebPasteboardProxyGtk.cpp +++ b/Source/WebKit/UIProcess/gtk/WebPasteboardProxyGtk.cpp -@@ -78,8 +78,10 @@ void WebPasteboardProxy::setPrimarySelectionOwner(WebFrameProxy* frame) +@@ -85,8 +85,10 @@ void WebPasteboardProxy::setPrimarySelectionOwner(WebFrameProxy* frame) if (m_primarySelectionOwner == frame) return; @@ -19007,7 +17632,7 @@ index 0000000000000000000000000000000000000000..8adbd51bfecad2a273117588bf50f8f7 + +#endif diff --git a/Source/WebKit/UIProcess/mac/PageClientImplMac.h b/Source/WebKit/UIProcess/mac/PageClientImplMac.h -index 8fc87c386fd82cdedc06ad1601d76919c6c27467..b5b2833b603e6996cf18c3416fde156940378f31 100644 +index 27627ddb817e90c92ff5e533618ded9d017d36d9..9169b380a79d57201a7d3dceab04a1d16d987865 100644 --- a/Source/WebKit/UIProcess/mac/PageClientImplMac.h +++ b/Source/WebKit/UIProcess/mac/PageClientImplMac.h @@ -61,6 +61,8 @@ class PageClientImpl final : public PageClientImplCocoa @@ -19029,22 +17654,22 @@ index 8fc87c386fd82cdedc06ad1601d76919c6c27467..b5b2833b603e6996cf18c3416fde1569 RefPtr takeViewSnapshot(std::optional&&) override; RefPtr takeViewSnapshot(std::optional&&, ForceSoftwareCapturingViewportSnapshot) override; void wheelEventWasNotHandledByWebCore(const NativeWebWheelEvent&) override; -@@ -229,6 +234,10 @@ private: +@@ -227,6 +232,10 @@ private: void beganExitFullScreen(const WebCore::IntRect& initialFrame, const WebCore::IntRect& finalFrame, CompletionHandler&&) override; #endif +#if ENABLE(TOUCH_EVENTS) -+ void doneWithTouchEvent(const NativeWebTouchEvent&, bool wasEventHandled) override; ++ void doneWithTouchEvent(const WebTouchEvent&, bool wasEventHandled) override; +#endif + void navigationGestureDidBegin() override; void navigationGestureWillEnd(bool willNavigate, WebBackForwardListItem&) override; void navigationGestureDidEnd(bool willNavigate, WebBackForwardListItem&) override; diff --git a/Source/WebKit/UIProcess/mac/PageClientImplMac.mm b/Source/WebKit/UIProcess/mac/PageClientImplMac.mm -index 5a5366f3f439d4727ca7dab149e0a523ccc27ce2..e02ab71cdf13af0d9b7b1aa04667c1dce54ed340 100644 +index 22f6f6f08ba1601647898ca0f350672c3cac3816..6fad8bc05d1b458e25f8ddb9515ec8e1dcd896d6 100644 --- a/Source/WebKit/UIProcess/mac/PageClientImplMac.mm +++ b/Source/WebKit/UIProcess/mac/PageClientImplMac.mm -@@ -110,6 +110,13 @@ namespace WebKit { +@@ -108,6 +108,13 @@ namespace WebKit { using namespace WebCore; @@ -19058,7 +17683,7 @@ index 5a5366f3f439d4727ca7dab149e0a523ccc27ce2..e02ab71cdf13af0d9b7b1aa04667c1dc PageClientImpl::PageClientImpl(NSView *view, WKWebView *webView) : PageClientImplCocoa(webView) , m_view(view) -@@ -163,6 +170,9 @@ NSWindow *PageClientImpl::activeWindow() const +@@ -161,6 +168,9 @@ NSWindow *PageClientImpl::activeWindow() const bool PageClientImpl::isViewWindowActive() { @@ -19068,7 +17693,7 @@ index 5a5366f3f439d4727ca7dab149e0a523ccc27ce2..e02ab71cdf13af0d9b7b1aa04667c1dc ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer)); RetainPtr activeViewWindow = activeWindow(); return activeViewWindow.get().isKeyWindow || (activeViewWindow && [NSApp keyWindow] == activeViewWindow.get()); -@@ -170,6 +180,9 @@ bool PageClientImpl::isViewWindowActive() +@@ -168,6 +178,9 @@ bool PageClientImpl::isViewWindowActive() bool PageClientImpl::isViewFocused() { @@ -19078,7 +17703,7 @@ index 5a5366f3f439d4727ca7dab149e0a523ccc27ce2..e02ab71cdf13af0d9b7b1aa04667c1dc // FIXME: This is called from the WebPageProxy constructor before we have a WebViewImpl. // Once WebViewImpl and PageClient merge, this won't be a problem. if (!m_impl) -@@ -193,6 +206,9 @@ void PageClientImpl::makeFirstResponder() +@@ -191,6 +204,9 @@ void PageClientImpl::makeFirstResponder() bool PageClientImpl::isViewVisible() { @@ -19088,7 +17713,7 @@ index 5a5366f3f439d4727ca7dab149e0a523ccc27ce2..e02ab71cdf13af0d9b7b1aa04667c1dc RetainPtr activeView = this->activeView(); RetainPtr activeViewWindow = activeWindow(); -@@ -267,7 +283,8 @@ void PageClientImpl::didRelaunchProcess() +@@ -265,7 +281,8 @@ void PageClientImpl::didRelaunchProcess() void PageClientImpl::preferencesDidChange() { @@ -19098,7 +17723,7 @@ index 5a5366f3f439d4727ca7dab149e0a523ccc27ce2..e02ab71cdf13af0d9b7b1aa04667c1dc } void PageClientImpl::toolTipChanged(const String& oldToolTip, const String& newToolTip) -@@ -475,6 +492,8 @@ IntRect PageClientImpl::rootViewToAccessibilityScreen(const IntRect& rect) +@@ -474,6 +491,8 @@ IntRect PageClientImpl::rootViewToAccessibilityScreen(const IntRect& rect) void PageClientImpl::doneWithKeyEvent(const NativeWebKeyboardEvent& event, bool eventWasHandled) { @@ -19107,7 +17732,7 @@ index 5a5366f3f439d4727ca7dab149e0a523ccc27ce2..e02ab71cdf13af0d9b7b1aa04667c1dc m_impl->doneWithKeyEvent(event.nativeEvent(), eventWasHandled); } -@@ -494,6 +513,8 @@ void PageClientImpl::computeHasVisualSearchResults(const URL& imageURL, Shareabl +@@ -493,6 +512,8 @@ void PageClientImpl::computeHasVisualSearchResults(const URL& imageURL, Shareabl RefPtr PageClientImpl::createPopupMenuProxy(WebPageProxy& page) { @@ -19116,7 +17741,7 @@ index 5a5366f3f439d4727ca7dab149e0a523ccc27ce2..e02ab71cdf13af0d9b7b1aa04667c1dc return WebPopupMenuProxyMac::create(m_view.get().get(), page.popupMenuClient()); } -@@ -634,6 +655,12 @@ CALayer *PageClientImpl::footerBannerLayer() const +@@ -633,6 +654,12 @@ CALayer *PageClientImpl::footerBannerLayer() const return m_impl->footerBannerLayer(); } @@ -19129,12 +17754,12 @@ index 5a5366f3f439d4727ca7dab149e0a523ccc27ce2..e02ab71cdf13af0d9b7b1aa04667c1dc RefPtr PageClientImpl::takeViewSnapshot(std::optional&&) { return m_impl->takeViewSnapshot(); -@@ -850,6 +877,13 @@ void PageClientImpl::beganExitFullScreen(const IntRect& initialFrame, const IntR +@@ -844,6 +871,13 @@ void PageClientImpl::beganExitFullScreen(const IntRect& initialFrame, const IntR #endif // ENABLE(FULLSCREEN_API) +#if ENABLE(TOUCH_EVENTS) -+void PageClientImpl::doneWithTouchEvent(const NativeWebTouchEvent& event, bool wasEventHandled) ++void PageClientImpl::doneWithTouchEvent(const WebTouchEvent& event, bool wasEventHandled) +{ + notImplemented(); +} @@ -19143,7 +17768,7 @@ index 5a5366f3f439d4727ca7dab149e0a523ccc27ce2..e02ab71cdf13af0d9b7b1aa04667c1dc void PageClientImpl::navigationGestureDidBegin() { m_impl->dismissContentRelativeChildWindowsWithAnimation(true); -@@ -1030,6 +1064,9 @@ void PageClientImpl::requestScrollToRect(const WebCore::FloatRect& targetRect, c +@@ -1024,6 +1058,9 @@ void PageClientImpl::requestScrollToRect(const WebCore::FloatRect& targetRect, c bool PageClientImpl::windowIsFrontWindowUnderMouse(const NativeWebMouseEvent& event) { @@ -19189,10 +17814,10 @@ index a3c53c0bf913385d4d2d92900360d5f7d75927f8..e5570ef599ff1b59224648c353f8ab16 bool showAfterPostProcessingContextData(); diff --git a/Source/WebKit/UIProcess/mac/WebContextMenuProxyMac.mm b/Source/WebKit/UIProcess/mac/WebContextMenuProxyMac.mm -index 4cee7041f9b93d553b452447b33459832a5e4e36..2d5d79246c57be84ebf86f3935cd4583bf0cecdc 100644 +index c8d9a4ae3fb5ef85afa837a1743c119ae34e1f7b..486a774cd1c98d9985c9d3c92418f835a9be2de1 100644 --- a/Source/WebKit/UIProcess/mac/WebContextMenuProxyMac.mm +++ b/Source/WebKit/UIProcess/mac/WebContextMenuProxyMac.mm -@@ -540,6 +540,12 @@ RetainPtr WebContextMenuProxyMac::createShareMenuItem(ShareMenuItemT +@@ -530,6 +530,12 @@ RetainPtr WebContextMenuProxyMac::createShareMenuItem(ShareMenuItemT } #endif @@ -19397,7 +18022,7 @@ index 0000000000000000000000000000000000000000..dd52991f936aa1c046b404801ee97237 + +} // namespace WebKit diff --git a/Source/WebKit/UIProcess/mac/WebViewImpl.h b/Source/WebKit/UIProcess/mac/WebViewImpl.h -index a0e1fc432a9b4b8938051d39725a1ec36ebd7a1b..f2a331f460879e43e9b069f50a099f10bbf8b8d8 100644 +index 85f0df23b0b5c1e76f2c9e12ad43b9802c23f579..9202e7923ded8b543dcee636166c100e739a094f 100644 --- a/Source/WebKit/UIProcess/mac/WebViewImpl.h +++ b/Source/WebKit/UIProcess/mac/WebViewImpl.h @@ -35,6 +35,7 @@ @@ -19408,7 +18033,7 @@ index a0e1fc432a9b4b8938051d39725a1ec36ebd7a1b..f2a331f460879e43e9b069f50a099f10 #include #include #include -@@ -569,6 +570,9 @@ public: +@@ -570,6 +571,9 @@ public: void provideDataForPasteboard(NSPasteboard *, NSString *type); NSArray *namesOfPromisedFilesDroppedAtDestination(NSURL *dropDestination); @@ -19419,10 +18044,10 @@ index a0e1fc432a9b4b8938051d39725a1ec36ebd7a1b..f2a331f460879e43e9b069f50a099f10 RefPtr takeViewSnapshot(ForceSoftwareCapturingViewportSnapshot); void saveBackForwardSnapshotForCurrentItem(); diff --git a/Source/WebKit/UIProcess/mac/WebViewImpl.mm b/Source/WebKit/UIProcess/mac/WebViewImpl.mm -index 1b42ae3cb6cdabee9830a1fb2ff55b9ae2325eb4..6998642cf147ec1af6e3feeb66d8688381791214 100644 +index fa8aba243a8808dc781d40f1daf1480e6b655656..85f02dbfa3cfe47ee2adceee2714104445cdb7ba 100644 --- a/Source/WebKit/UIProcess/mac/WebViewImpl.mm +++ b/Source/WebKit/UIProcess/mac/WebViewImpl.mm -@@ -2462,6 +2462,11 @@ WebCore::DestinationColorSpace WebViewImpl::colorSpace() +@@ -2444,6 +2444,11 @@ WebCore::DestinationColorSpace WebViewImpl::colorSpace() if (!m_colorSpace) m_colorSpace = [NSColorSpace sRGBColorSpace]; } @@ -19434,7 +18059,7 @@ index 1b42ae3cb6cdabee9830a1fb2ff55b9ae2325eb4..6998642cf147ec1af6e3feeb66d86883 ASSERT(m_colorSpace); return WebCore::DestinationColorSpace { [m_colorSpace CGColorSpace] }; -@@ -4707,6 +4712,17 @@ static RetainPtr takeWindowSnapshot(CGSWindowID windowID, bool captu +@@ -4724,6 +4729,17 @@ static RetainPtr takeWindowSnapshot(CGSWindowID windowID, bool captu return WebCore::cgWindowListCreateImage(CGRectNull, kCGWindowListOptionIncludingWindow, windowID, imageOptions); } @@ -20362,10 +18987,10 @@ index 9b688ad328317fea4fd96ce66e9714bad8f0f937..402a36a9c565e13ec298aa7f014f0d92 } // namespace WebKit diff --git a/Source/WebKit/WebKit.xcodeproj/project.pbxproj b/Source/WebKit/WebKit.xcodeproj/project.pbxproj -index 07fb026a2a1ee93222d022a603b0057efbf848de..bedb13e953248741f32c61f8476e021233ce7e40 100644 +index 7504d2cdd6d31bdfb1892dab8e1716253ce54ccc..c1ecef732f88cbf5c6277a0aa5c0d48806565ac2 100644 --- a/Source/WebKit/WebKit.xcodeproj/project.pbxproj +++ b/Source/WebKit/WebKit.xcodeproj/project.pbxproj -@@ -1546,6 +1546,7 @@ +@@ -1560,6 +1560,7 @@ 5CABDC8722C40FED001EDE8E /* APIMessageListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CABDC8322C40FA7001EDE8E /* APIMessageListener.h */; }; 5CADDE05215046BD0067D309 /* WKWebProcess.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C74300E21500492004BFA17 /* WKWebProcess.h */; settings = {ATTRIBUTES = (Private, ); }; }; 5CAECB6627465AE400AB78D0 /* UnifiedSource115.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5CAECB5E27465AE300AB78D0 /* UnifiedSource115.cpp */; }; @@ -20373,7 +18998,7 @@ index 07fb026a2a1ee93222d022a603b0057efbf848de..bedb13e953248741f32c61f8476e0212 5CAF7AA726F93AB00003F19E /* adattributiond.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5CAF7AA526F93A950003F19E /* adattributiond.cpp */; }; 5CAFDE452130846300B1F7E1 /* _WKInspector.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CAFDE422130843500B1F7E1 /* _WKInspector.h */; settings = {ATTRIBUTES = (Private, ); }; }; 5CAFDE472130846A00B1F7E1 /* _WKInspectorInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CAFDE442130843600B1F7E1 /* _WKInspectorInternal.h */; }; -@@ -2328,6 +2329,18 @@ +@@ -2346,6 +2347,18 @@ DF0C5F28252ECB8E00D921DB /* WKDownload.h in Headers */ = {isa = PBXBuildFile; fileRef = DF0C5F24252ECB8D00D921DB /* WKDownload.h */; settings = {ATTRIBUTES = (Public, ); }; }; DF0C5F2A252ECB8E00D921DB /* WKDownloadDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = DF0C5F26252ECB8E00D921DB /* WKDownloadDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; DF0C5F2B252ED44000D921DB /* WKDownloadInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = DF0C5F25252ECB8E00D921DB /* WKDownloadInternal.h */; }; @@ -20392,7 +19017,7 @@ index 07fb026a2a1ee93222d022a603b0057efbf848de..bedb13e953248741f32c61f8476e0212 DF462E0F23F22F5500EFF35F /* WKHTTPCookieStorePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = DF462E0E23F22F5300EFF35F /* WKHTTPCookieStorePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; DF462E1223F338BE00EFF35F /* WKContentWorldPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = DF462E1123F338AD00EFF35F /* WKContentWorldPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; DF7A231C291B088D00B98DF3 /* WKSnapshotConfigurationPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = DF7A231B291B088D00B98DF3 /* WKSnapshotConfigurationPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; -@@ -2427,6 +2440,8 @@ +@@ -2447,6 +2460,8 @@ E5BEF6822130C48000F31111 /* WebDataListSuggestionsDropdownIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = E5BEF6802130C47F00F31111 /* WebDataListSuggestionsDropdownIOS.h */; }; E5CB07DC20E1678F0022C183 /* WKFormColorControl.h in Headers */ = {isa = PBXBuildFile; fileRef = E5CB07DA20E1678F0022C183 /* WKFormColorControl.h */; }; E5CBA76427A318E100DF7858 /* UnifiedSource120.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E5CBA75F27A3187800DF7858 /* UnifiedSource120.cpp */; }; @@ -20401,9 +19026,9 @@ index 07fb026a2a1ee93222d022a603b0057efbf848de..bedb13e953248741f32c61f8476e0212 E5CBA76527A318E100DF7858 /* UnifiedSource118.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E5CBA76127A3187900DF7858 /* UnifiedSource118.cpp */; }; E5CBA76627A318E100DF7858 /* UnifiedSource116.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E5CBA76327A3187B00DF7858 /* UnifiedSource116.cpp */; }; E5CBA76727A318E100DF7858 /* UnifiedSource119.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E5CBA76027A3187900DF7858 /* UnifiedSource119.cpp */; }; -@@ -2456,6 +2471,9 @@ - EEA52F492D7055A700D578B5 /* WKStageMode.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE0D3CDC2D3709BE00072978 /* WKStageMode.swift */; }; - EEFE72792D64FE5600DC6214 /* StageModeInteractionState.h in Headers */ = {isa = PBXBuildFile; fileRef = EEFE72782D64FE5600DC6214 /* StageModeInteractionState.h */; }; +@@ -2485,6 +2500,9 @@ + F3EEEE592DB318270038CC1D /* BidiBrowserAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = F3EEEE572DB318270038CC1D /* BidiBrowserAgent.h */; }; + F3EEEE5A2DB318270038CC1D /* BidiBrowserAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F3EEEE582DB318270038CC1D /* BidiBrowserAgent.cpp */; }; F404455C2D5CFB56000E587E /* AppKitSoftLink.h in Headers */ = {isa = PBXBuildFile; fileRef = F404455A2D5CFB56000E587E /* AppKitSoftLink.h */; }; + F303B849249A8D640031DE5C /* ScreencastEncoder.h in Headers */ = {isa = PBXBuildFile; fileRef = F303B848249A8D3A0031DE5C /* ScreencastEncoder.h */; }; + F33C7AC7249AD79C0018BE41 /* libwebrtc.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = F33C7AC6249AD79C0018BE41 /* libwebrtc.dylib */; }; @@ -20411,7 +19036,7 @@ index 07fb026a2a1ee93222d022a603b0057efbf848de..bedb13e953248741f32c61f8476e0212 F409BA181E6E64BC009DA28E /* WKDragDestinationAction.h in Headers */ = {isa = PBXBuildFile; fileRef = F409BA171E6E64B3009DA28E /* WKDragDestinationAction.h */; settings = {ATTRIBUTES = (Private, ); }; }; F40C3B712AB401C5007A3567 /* WKDatePickerPopoverController.h in Headers */ = {isa = PBXBuildFile; fileRef = F40C3B6F2AB40167007A3567 /* WKDatePickerPopoverController.h */; }; F41145682CD939E0004CDBD1 /* _WKTouchEventGenerator.h in Headers */ = {isa = PBXBuildFile; fileRef = F41145652CD939E0004CDBD1 /* _WKTouchEventGenerator.h */; settings = {ATTRIBUTES = (Private, ); }; }; -@@ -6365,6 +6383,7 @@ +@@ -6443,6 +6461,7 @@ 5CABDC8522C40FCC001EDE8E /* WKMessageListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKMessageListener.h; sourceTree = ""; }; 5CABE07A28F60E8A00D83FD9 /* WebPushMessage.serialization.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebPushMessage.serialization.in; sourceTree = ""; }; 5CADDE0D2151AA010067D309 /* AuthenticationChallengeDisposition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AuthenticationChallengeDisposition.h; sourceTree = ""; }; @@ -20419,7 +19044,7 @@ index 07fb026a2a1ee93222d022a603b0057efbf848de..bedb13e953248741f32c61f8476e0212 5CAECB5E27465AE300AB78D0 /* UnifiedSource115.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = UnifiedSource115.cpp; sourceTree = ""; }; 5CAF7AA426F93A750003F19E /* adattributiond */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = adattributiond; sourceTree = BUILT_PRODUCTS_DIR; }; 5CAF7AA526F93A950003F19E /* adattributiond.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = adattributiond.cpp; sourceTree = ""; }; -@@ -8090,6 +8109,19 @@ +@@ -8171,6 +8190,19 @@ DF0C5F24252ECB8D00D921DB /* WKDownload.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKDownload.h; sourceTree = ""; }; DF0C5F25252ECB8E00D921DB /* WKDownloadInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKDownloadInternal.h; sourceTree = ""; }; DF0C5F26252ECB8E00D921DB /* WKDownloadDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKDownloadDelegate.h; sourceTree = ""; }; @@ -20439,16 +19064,16 @@ index 07fb026a2a1ee93222d022a603b0057efbf848de..bedb13e953248741f32c61f8476e0212 DF462E0E23F22F5300EFF35F /* WKHTTPCookieStorePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKHTTPCookieStorePrivate.h; sourceTree = ""; }; DF462E1123F338AD00EFF35F /* WKContentWorldPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKContentWorldPrivate.h; sourceTree = ""; }; DF58C6311371AC5800F9A37C /* NativeWebWheelEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NativeWebWheelEvent.h; sourceTree = ""; }; -@@ -8263,6 +8295,8 @@ +@@ -8346,6 +8378,8 @@ E5CBA76127A3187900DF7858 /* UnifiedSource118.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = UnifiedSource118.cpp; sourceTree = ""; }; E5CBA76227A3187900DF7858 /* UnifiedSource117.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = UnifiedSource117.cpp; sourceTree = ""; }; E5CBA76327A3187B00DF7858 /* UnifiedSource116.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = UnifiedSource116.cpp; sourceTree = ""; }; + E5CBA76F27A3187800DF7858 /* UnifiedSource121.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = UnifiedSource121.cpp; sourceTree = ""; }; + E5CBA77F27A3187800DF7858 /* UnifiedSource122.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = UnifiedSource122.cpp; sourceTree = ""; }; E5DEFA6726F8F42600AB68DB /* PhotosUISPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PhotosUISPI.h; sourceTree = ""; }; - EB0D312D275AE13300863D8F /* com.apple.webkit.webpushd.mac.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = com.apple.webkit.webpushd.mac.plist; sourceTree = ""; }; - EB0D312E275AE13300863D8F /* com.apple.webkit.webpushd.ios.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = com.apple.webkit.webpushd.ios.plist; sourceTree = ""; }; -@@ -8305,6 +8339,14 @@ + E88885662DC914C400C572B8 /* WKISO18013Request.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WKISO18013Request.h; sourceTree = ""; }; + E890313A2D96411E00AB0B09 /* DigitalCredentialsCoordinator.messages.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = DigitalCredentialsCoordinator.messages.in; sourceTree = ""; }; +@@ -8398,6 +8432,14 @@ F404455A2D5CFB56000E587E /* AppKitSoftLink.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppKitSoftLink.h; sourceTree = ""; }; F404455B2D5CFB56000E587E /* AppKitSoftLink.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = AppKitSoftLink.mm; sourceTree = ""; }; F4063DDE2D71481E00F3FE6E /* LLVMProfiling.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LLVMProfiling.h; sourceTree = ""; }; @@ -20463,7 +19088,7 @@ index 07fb026a2a1ee93222d022a603b0057efbf848de..bedb13e953248741f32c61f8476e0212 F409BA171E6E64B3009DA28E /* WKDragDestinationAction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKDragDestinationAction.h; sourceTree = ""; }; F40C3B6F2AB40167007A3567 /* WKDatePickerPopoverController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = WKDatePickerPopoverController.h; path = ios/forms/WKDatePickerPopoverController.h; sourceTree = ""; }; F40C3B702AB40167007A3567 /* WKDatePickerPopoverController.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = WKDatePickerPopoverController.mm; path = ios/forms/WKDatePickerPopoverController.mm; sourceTree = ""; }; -@@ -8710,6 +8752,7 @@ +@@ -8825,6 +8867,7 @@ 3766F9EE189A1241003CF19B /* JavaScriptCore.framework in Frameworks */, 3766F9F1189A1254003CF19B /* libicucore.dylib in Frameworks */, 7B9FC5BB28A5233B007570E7 /* libWebKitPlatform.a in Frameworks */, @@ -20471,7 +19096,7 @@ index 07fb026a2a1ee93222d022a603b0057efbf848de..bedb13e953248741f32c61f8476e0212 3766F9EF189A1244003CF19B /* QuartzCore.framework in Frameworks */, 37694525184FC6B600CDE21F /* Security.framework in Frameworks */, 37BEC4DD1948FC6A008B4286 /* WebCore.framework in Frameworks */, -@@ -11841,6 +11884,7 @@ +@@ -12013,6 +12056,7 @@ 99788ACA1F421DCA00C08000 /* _WKAutomationSessionConfiguration.mm */, 990D28A81C6404B000986977 /* _WKAutomationSessionDelegate.h */, 990D28AF1C65203900986977 /* _WKAutomationSessionInternal.h */, @@ -20479,7 +19104,7 @@ index 07fb026a2a1ee93222d022a603b0057efbf848de..bedb13e953248741f32c61f8476e0212 5C4609E222430E4C009943C2 /* _WKContentRuleListAction.h */, 5C4609E322430E4D009943C2 /* _WKContentRuleListAction.mm */, 5C4609E422430E4D009943C2 /* _WKContentRuleListActionInternal.h */, -@@ -13218,6 +13262,7 @@ +@@ -13392,6 +13436,7 @@ E34B110C27C46BC6006D2F2E /* libWebCoreTestShim.dylib */, E34B110F27C46D09006D2F2E /* libWebCoreTestSupport.dylib */, DDE992F4278D06D900F60D26 /* libWebKitAdditions.a */, @@ -20487,7 +19112,7 @@ index 07fb026a2a1ee93222d022a603b0057efbf848de..bedb13e953248741f32c61f8476e0212 57A9FF15252C6AEF006A2040 /* libWTF.a */, 5750F32A2032D4E500389347 /* LocalAuthentication.framework */, 570DAAB0230273D200E8FC04 /* NearField.framework */, -@@ -13799,6 +13844,12 @@ +@@ -13974,6 +14019,12 @@ children = ( 9197940423DBC4BB00257892 /* InspectorBrowserAgent.cpp */, 9197940323DBC4BB00257892 /* InspectorBrowserAgent.h */, @@ -20500,7 +19125,7 @@ index 07fb026a2a1ee93222d022a603b0057efbf848de..bedb13e953248741f32c61f8476e0212 ); path = Agents; sourceTree = ""; -@@ -13807,6 +13858,7 @@ +@@ -13982,6 +14033,7 @@ isa = PBXGroup; children = ( A5D3504D1D78F0D2005124A9 /* RemoteWebInspectorUIProxyMac.mm */, @@ -20508,7 +19133,7 @@ index 07fb026a2a1ee93222d022a603b0057efbf848de..bedb13e953248741f32c61f8476e0212 1CA8B935127C774E00576C2B /* WebInspectorUIProxyMac.mm */, 99A7ACE326012919006D57FD /* WKInspectorResourceURLSchemeHandler.h */, 99A7ACE42601291A006D57FD /* WKInspectorResourceURLSchemeHandler.mm */, -@@ -14560,6 +14612,7 @@ +@@ -14736,6 +14788,7 @@ E1513C65166EABB200149FCB /* AuxiliaryProcessProxy.h */, 46A2B6061E5675A200C3DEDA /* BackgroundProcessResponsivenessTimer.cpp */, 46A2B6071E5675A200C3DEDA /* BackgroundProcessResponsivenessTimer.h */, @@ -20516,7 +19141,7 @@ index 07fb026a2a1ee93222d022a603b0057efbf848de..bedb13e953248741f32c61f8476e0212 5C6D69352AC3935D0099BDAF /* BrowsingContextGroup.cpp */, 5C6D69362AC3935D0099BDAF /* BrowsingContextGroup.h */, 5CA98549210BEB5A0057EB6B /* BrowsingWarning.h */, -@@ -14584,6 +14637,8 @@ +@@ -14760,6 +14813,8 @@ BC06F43912DBCCFB002D78DE /* GeolocationPermissionRequestProxy.cpp */, BC06F43812DBCCFB002D78DE /* GeolocationPermissionRequestProxy.h */, 2DD5A72A1EBF09A7009BA597 /* HiddenPageThrottlingAutoIncreasesCounter.h */, @@ -20525,7 +19150,7 @@ index 07fb026a2a1ee93222d022a603b0057efbf848de..bedb13e953248741f32c61f8476e0212 5CEABA2B2333251400797797 /* LegacyGlobalSettings.cpp */, 5CEABA2A2333247700797797 /* LegacyGlobalSettings.h */, 31607F3819627002009B87DA /* LegacySessionStateCoding.h */, -@@ -14613,6 +14668,7 @@ +@@ -14789,6 +14844,7 @@ 4683569B21E81CC7006E27A3 /* ProvisionalPageProxy.cpp */, 4683569A21E81CC7006E27A3 /* ProvisionalPageProxy.h */, 411B89CB27B2B89600F9EBD3 /* QueryPermissionResultCallback.h */, @@ -20533,7 +19158,7 @@ index 07fb026a2a1ee93222d022a603b0057efbf848de..bedb13e953248741f32c61f8476e0212 5CCB54DC2A4FEA6A0005FAA8 /* RemotePageDrawingAreaProxy.cpp */, 5CCB54DB2A4FEA6A0005FAA8 /* RemotePageDrawingAreaProxy.h */, FABBBC802D35AC6800820017 /* RemotePageFullscreenManagerProxy.cpp */, -@@ -14716,6 +14772,8 @@ +@@ -14892,6 +14948,8 @@ BC7B6204129A0A6700D174A4 /* WebPageGroup.h */, 2D9EA3101A96D9EB002D2807 /* WebPageInjectedBundleClient.cpp */, 2D9EA30E1A96CBFF002D2807 /* WebPageInjectedBundleClient.h */, @@ -20542,7 +19167,7 @@ index 07fb026a2a1ee93222d022a603b0057efbf848de..bedb13e953248741f32c61f8476e0212 9B7F8A502C785725000057F3 /* WebPageLoadTiming.h */, BC111B0B112F5E4F00337BAB /* WebPageProxy.cpp */, BC032DCB10F4389F0058C15A /* WebPageProxy.h */, -@@ -14894,6 +14952,7 @@ +@@ -15070,6 +15128,7 @@ BC646C1911DD399F006455B0 /* WKBackForwardListItemRef.h */, BC646C1611DD399F006455B0 /* WKBackForwardListRef.cpp */, BC646C1711DD399F006455B0 /* WKBackForwardListRef.h */, @@ -20550,7 +19175,7 @@ index 07fb026a2a1ee93222d022a603b0057efbf848de..bedb13e953248741f32c61f8476e0212 BCB9E24A1120E15C00A137E0 /* WKContext.cpp */, BCB9E2491120E15C00A137E0 /* WKContext.h */, 1AE52F9319201F6B00A1FA37 /* WKContextConfigurationRef.cpp */, -@@ -15468,6 +15527,9 @@ +@@ -15646,6 +15705,9 @@ 07EF07592745A8160066EA04 /* DisplayCaptureSessionManager.h */, 07EF07582745A8160066EA04 /* DisplayCaptureSessionManager.mm */, 7AFA6F682A9F57C50055322A /* DisplayLinkMac.cpp */, @@ -20560,7 +19185,7 @@ index 07fb026a2a1ee93222d022a603b0057efbf848de..bedb13e953248741f32c61f8476e0212 1AFDE65B1954E8D500C48FFA /* LegacySessionStateCoding.cpp */, 0FCB4E5818BBE3D9000FCFC9 /* PageClientImplMac.h */, 0FCB4E5918BBE3D9000FCFC9 /* PageClientImplMac.mm */, -@@ -15491,6 +15553,8 @@ +@@ -15669,6 +15731,8 @@ E568B92120A3AC6A00E3C856 /* WebDataListSuggestionsDropdownMac.mm */, E55CD20124D09F1F0042DB9C /* WebDateTimePickerMac.h */, E55CD20224D09F1F0042DB9C /* WebDateTimePickerMac.mm */, @@ -20569,7 +19194,7 @@ index 07fb026a2a1ee93222d022a603b0057efbf848de..bedb13e953248741f32c61f8476e0212 BC857E8512B71EBB00EDEB2E /* WebPageProxyMac.mm */, BC5750951268F3C6006F0F12 /* WebPopupMenuProxyMac.h */, BC5750961268F3C6006F0F12 /* WebPopupMenuProxyMac.mm */, -@@ -16577,6 +16641,7 @@ +@@ -16775,6 +16839,7 @@ 99788ACB1F421DDA00C08000 /* _WKAutomationSessionConfiguration.h in Headers */, 990D28AC1C6420CF00986977 /* _WKAutomationSessionDelegate.h in Headers */, 990D28B11C65208D00986977 /* _WKAutomationSessionInternal.h in Headers */, @@ -20577,7 +19202,7 @@ index 07fb026a2a1ee93222d022a603b0057efbf848de..bedb13e953248741f32c61f8476e0212 5C4609E7224317B4009943C2 /* _WKContentRuleListAction.h in Headers */, 5C4609E8224317BB009943C2 /* _WKContentRuleListActionInternal.h in Headers */, 9B4CE9512CD99B7C00351173 /* _WKContentWorldConfiguration.h in Headers */, -@@ -16885,6 +16950,7 @@ +@@ -17087,6 +17152,7 @@ E170876C16D6CA6900F99226 /* BlobRegistryProxy.h in Headers */, 4F601432155C5AA2001FBDE0 /* BlockingResponseMap.h in Headers */, 1A5705111BE410E600874AF1 /* BlockSPI.h in Headers */, @@ -20585,7 +19210,7 @@ index 07fb026a2a1ee93222d022a603b0057efbf848de..bedb13e953248741f32c61f8476e0212 5CA9854A210BEB640057EB6B /* BrowsingWarning.h in Headers */, A7E69BCC2B2117A100D43D3F /* BufferAndBackendInfo.h in Headers */, BC3065FA1259344E00E71278 /* CacheModel.h in Headers */, -@@ -17067,7 +17133,11 @@ +@@ -17270,7 +17336,11 @@ BC14DF77120B5B7900826C0C /* InjectedBundleScriptWorld.h in Headers */, CE550E152283752200D28791 /* InsertTextOptions.h in Headers */, 9197940523DBC4BB00257892 /* InspectorBrowserAgent.h in Headers */, @@ -20597,7 +19222,7 @@ index 07fb026a2a1ee93222d022a603b0057efbf848de..bedb13e953248741f32c61f8476e0212 A5E391FD2183C1F800C8FB31 /* InspectorTargetProxy.h in Headers */, C5BCE5DF1C50766A00CDE3FA /* InteractionInformationAtPosition.h in Headers */, 2D4D2C811DF60BF3002EB10C /* InteractionInformationRequest.h in Headers */, -@@ -17328,6 +17398,7 @@ +@@ -17531,6 +17601,7 @@ 0F6E7C532C4C386800F1DB85 /* RemoteDisplayListRecorderMessages.h in Headers */, F451C0FE2703B263002BA03B /* RemoteDisplayListRecorderProxy.h in Headers */, A78A5FE42B0EB39E005036D3 /* RemoteImageBufferSetIdentifier.h in Headers */, @@ -20605,7 +19230,7 @@ index 07fb026a2a1ee93222d022a603b0057efbf848de..bedb13e953248741f32c61f8476e0212 2D47B56D1810714E003A3AEE /* RemoteLayerBackingStore.h in Headers */, 2DDF731518E95060004F5A66 /* RemoteLayerBackingStoreCollection.h in Headers */, 1AB16AEA164B3A8800290D62 /* RemoteLayerTreeContext.h in Headers */, -@@ -17384,6 +17455,7 @@ +@@ -17588,6 +17659,7 @@ E1E552C516AE065F004ED653 /* SandboxInitializationParameters.h in Headers */, E36FF00327F36FBD004BE21A /* SandboxStateVariables.h in Headers */, 7BAB111025DD02B3008FC479 /* ScopedActiveMessageReceiveQueue.h in Headers */, @@ -20613,7 +19238,7 @@ index 07fb026a2a1ee93222d022a603b0057efbf848de..bedb13e953248741f32c61f8476e0212 6D4DF20C2D824242001F964C /* ScreenTimeWebsiteDataSupport.h in Headers */, 463BB93A2B9D08D80098C5C3 /* ScriptMessageHandlerIdentifier.h in Headers */, F4E28A362C923814008120DD /* ScriptTelemetry.h in Headers */, -@@ -17745,6 +17817,8 @@ +@@ -17950,6 +18022,8 @@ 939EF87029D112EE00F23AEE /* WebPageInlines.h in Headers */, 9197940823DBC4CB00257892 /* WebPageInspectorAgentBase.h in Headers */, A513F5402154A5D700662841 /* WebPageInspectorController.h in Headers */, @@ -20622,7 +19247,7 @@ index 07fb026a2a1ee93222d022a603b0057efbf848de..bedb13e953248741f32c61f8476e0212 A543E30C215C8A8D00279CD9 /* WebPageInspectorTarget.h in Headers */, A543E30D215C8A9000279CD9 /* WebPageInspectorTargetController.h in Headers */, A543E307215AD13700279CD9 /* WebPageInspectorTargetFrontendChannel.h in Headers */, -@@ -20348,7 +20422,43 @@ +@@ -20613,7 +20687,43 @@ 522F792928D50EBB0069B45B /* HidService.mm in Sources */, 2749F6442146561B008380BF /* InjectedBundleNodeHandle.cpp in Sources */, 2749F6452146561E008380BF /* InjectedBundleRangeHandle.cpp in Sources */, @@ -20666,7 +19291,7 @@ index 07fb026a2a1ee93222d022a603b0057efbf848de..bedb13e953248741f32c61f8476e0212 1C5DC45F2909B05A0061EC62 /* JSWebExtensionWrapperCocoa.mm in Sources */, C14D37FE24ACE086007FF014 /* LaunchServicesDatabaseManager.mm in Sources */, C1710CF724AA643200D7C112 /* LaunchServicesDatabaseObserver.mm in Sources */, -@@ -20746,6 +20856,8 @@ +@@ -21013,6 +21123,8 @@ 074E87E12CF8EA3D0059E469 /* WebPage+NavigationDeciding.swift in Sources */, 078B04A02CF18EAB00B453A6 /* WebPage+NavigationPreferences.swift in Sources */, 07CB79962CE9435700199C49 /* WebPage.swift in Sources */, @@ -20674,12 +19299,12 @@ index 07fb026a2a1ee93222d022a603b0057efbf848de..bedb13e953248741f32c61f8476e0212 + D79902B3236E9404005D6F7E /* WebPageInspectorInputAgentMac.mm in Sources */, 7CE9CE101FA0767A000177DE /* WebPageUpdatePreferences.cpp in Sources */, 079A4DA12D72CC0D00CA387F /* WebPageWebView.swift in Sources */, - 7CEB00DD1FA69ABE0065473B /* WebPreferencesFeatures.cpp in Sources */, + CA2506A82DD65327001D1954 /* WebPageWebViewAdditions.swift in Sources */, diff --git a/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp b/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp -index ae80809efafab3264b06e7bac45771c72d4408b8..849694aea1738dac5e2a0741f31def13c34c8608 100644 +index bd3aaaf9309aec01820d0950d3b6f14a23c6076c..8cdb9a0c339c0499034fa801395367dd62346268 100644 --- a/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp +++ b/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp -@@ -269,6 +269,11 @@ void WebLoaderStrategy::scheduleLoad(ResourceLoader& resourceLoader, CachedResou +@@ -271,6 +271,11 @@ void WebLoaderStrategy::scheduleLoad(ResourceLoader& resourceLoader, CachedResou } #endif @@ -20691,7 +19316,7 @@ index ae80809efafab3264b06e7bac45771c72d4408b8..849694aea1738dac5e2a0741f31def13 #if ENABLE(PDFJS) if (tryLoadingUsingPDFJSHandler(resourceLoader, trackingParameters)) return; -@@ -283,12 +288,16 @@ void WebLoaderStrategy::scheduleLoad(ResourceLoader& resourceLoader, CachedResou +@@ -285,12 +290,16 @@ void WebLoaderStrategy::scheduleLoad(ResourceLoader& resourceLoader, CachedResou } if (InspectorInstrumentationWebKit::shouldInterceptRequest(resourceLoader)) { @@ -20714,7 +19339,7 @@ index ae80809efafab3264b06e7bac45771c72d4408b8..849694aea1738dac5e2a0741f31def13 } WEBLOADERSTRATEGY_RELEASE_LOG_FORWARDABLE(WEBLOADERSTRATEGY_SCHEDULELOAD); -@@ -413,7 +422,7 @@ static void addParametersShared(const LocalFrame* frame, NetworkResourceLoadPara +@@ -415,7 +424,7 @@ static void addParametersShared(const LocalFrame* frame, NetworkResourceLoadPara parameters.linkPreconnectEarlyHintsEnabled = mainFrame->settings().linkPreconnectEarlyHintsEnabled(); } @@ -20723,7 +19348,7 @@ index ae80809efafab3264b06e7bac45771c72d4408b8..849694aea1738dac5e2a0741f31def13 { auto identifier = *resourceLoader.identifier(); -@@ -425,10 +434,10 @@ void WebLoaderStrategy::scheduleLoadFromNetworkProcess(ResourceLoader& resourceL +@@ -427,10 +436,10 @@ void WebLoaderStrategy::scheduleLoadFromNetworkProcess(ResourceLoader& resourceL && resourceLoader.frameLoader()->notifier().isInitialRequestIdentifier(identifier) ? MainFrameMainResource::Yes : MainFrameMainResource::No; if (!page->allowsLoadFromURL(request.url(), mainFrameMainResource)) { @@ -20736,7 +19361,7 @@ index ae80809efafab3264b06e7bac45771c72d4408b8..849694aea1738dac5e2a0741f31def13 } } -@@ -438,14 +447,6 @@ void WebLoaderStrategy::scheduleLoadFromNetworkProcess(ResourceLoader& resourceL +@@ -440,14 +449,6 @@ void WebLoaderStrategy::scheduleLoadFromNetworkProcess(ResourceLoader& resourceL LOG(NetworkScheduling, "(WebProcess) WebLoaderStrategy::scheduleLoad, url '%s' will be scheduled with the NetworkProcess with priority %d, storedCredentialsPolicy %i", resourceLoader.url().string().latin1().data(), static_cast(resourceLoader.request().priority()), (int)storedCredentialsPolicy); @@ -20751,7 +19376,7 @@ index ae80809efafab3264b06e7bac45771c72d4408b8..849694aea1738dac5e2a0741f31def13 loadParameters.identifier = identifier; loadParameters.parentPID = legacyPresentingApplicationPID(); loadParameters.contentSniffingPolicy = contentSniffingPolicy; -@@ -529,14 +530,11 @@ void WebLoaderStrategy::scheduleLoadFromNetworkProcess(ResourceLoader& resourceL +@@ -531,14 +532,11 @@ void WebLoaderStrategy::scheduleLoadFromNetworkProcess(ResourceLoader& resourceL if (loadParameters.options.mode != FetchOptions::Mode::Navigate) { ASSERT(loadParameters.sourceOrigin); @@ -20769,7 +19394,7 @@ index ae80809efafab3264b06e7bac45771c72d4408b8..849694aea1738dac5e2a0741f31def13 loadParameters.isMainFrameNavigation = isMainFrameNavigation; if (loadParameters.isMainFrameNavigation && document) -@@ -583,6 +581,25 @@ void WebLoaderStrategy::scheduleLoadFromNetworkProcess(ResourceLoader& resourceL +@@ -585,6 +583,25 @@ void WebLoaderStrategy::scheduleLoadFromNetworkProcess(ResourceLoader& resourceL if (RefPtr frameLoader = resourceLoader.frameLoader()) loadParameters.requiredCookiesVersion = frameLoader->requiredCookiesVersion(); @@ -20795,7 +19420,7 @@ index ae80809efafab3264b06e7bac45771c72d4408b8..849694aea1738dac5e2a0741f31def13 std::optional existingNetworkResourceLoadIdentifierToResume; if (loadParameters.isMainFrameNavigation) existingNetworkResourceLoadIdentifierToResume = std::exchange(m_existingNetworkResourceLoadIdentifierToResume, std::nullopt); -@@ -597,7 +614,7 @@ void WebLoaderStrategy::scheduleLoadFromNetworkProcess(ResourceLoader& resourceL +@@ -599,7 +616,7 @@ void WebLoaderStrategy::scheduleLoadFromNetworkProcess(ResourceLoader& resourceL } auto loader = WebResourceLoader::create(resourceLoader, trackingParameters); @@ -20804,7 +19429,7 @@ index ae80809efafab3264b06e7bac45771c72d4408b8..849694aea1738dac5e2a0741f31def13 } void WebLoaderStrategy::scheduleInternallyFailedLoad(WebCore::ResourceLoader& resourceLoader) -@@ -1015,7 +1032,7 @@ void WebLoaderStrategy::didFinishPreconnection(WebCore::ResourceLoaderIdentifier +@@ -1017,7 +1034,7 @@ void WebLoaderStrategy::didFinishPreconnection(WebCore::ResourceLoaderIdentifier bool WebLoaderStrategy::isOnLine() const { @@ -20813,7 +19438,7 @@ index ae80809efafab3264b06e7bac45771c72d4408b8..849694aea1738dac5e2a0741f31def13 } void WebLoaderStrategy::addOnlineStateChangeListener(Function&& listener) -@@ -1042,6 +1059,11 @@ void WebLoaderStrategy::isResourceLoadFinished(CachedResource& resource, Complet +@@ -1044,6 +1061,11 @@ void WebLoaderStrategy::isResourceLoadFinished(CachedResource& resource, Complet void WebLoaderStrategy::setOnLineState(bool isOnLine) { @@ -20825,7 +19450,7 @@ index ae80809efafab3264b06e7bac45771c72d4408b8..849694aea1738dac5e2a0741f31def13 if (m_isOnLine == isOnLine) return; -@@ -1050,6 +1072,12 @@ void WebLoaderStrategy::setOnLineState(bool isOnLine) +@@ -1052,6 +1074,12 @@ void WebLoaderStrategy::setOnLineState(bool isOnLine) listener(isOnLine); } @@ -20869,12 +19494,12 @@ index 6492031de6ed6effab3f28e5321419f3390f7651..678139fc26f26e2224a70b0087ddb849 } // namespace WebKit diff --git a/Source/WebKit/WebProcess/Network/WebResourceLoader.cpp b/Source/WebKit/WebProcess/Network/WebResourceLoader.cpp -index 9add95853b90e6cae9dd4627ab8bf9a9006bc7a8..f3af1c6680d1dc6d8f6db951a26a526d7079cd95 100644 +index ce50de02306dfe542299fbb9e534a6db929b8052..5c0a3215a78f3fdcf19fd8bb56c2a9c5596240ed 100644 --- a/Source/WebKit/WebProcess/Network/WebResourceLoader.cpp +++ b/Source/WebKit/WebProcess/Network/WebResourceLoader.cpp @@ -202,9 +202,6 @@ void WebResourceLoader::didReceiveResponse(ResourceResponse&& response, PrivateR - coreLoader->didReceiveResponse(inspectorResponse, [this, protectedThis = Ref { *this }, interceptedRequestIdentifier, policyDecisionCompletionHandler = WTFMove(policyDecisionCompletionHandler), overrideData = WTFMove(overrideData)]() mutable { + coreLoader->didReceiveResponse(ResourceResponse { inspectorResponse }, [this, protectedThis = Ref { *this }, interceptedRequestIdentifier, policyDecisionCompletionHandler = WTFMove(policyDecisionCompletionHandler), overrideData = WTFMove(overrideData)]() mutable { RefPtr coreLoader = m_coreLoader; - if (policyDecisionCompletionHandler) - policyDecisionCompletionHandler(); @@ -20892,20 +19517,21 @@ index 9add95853b90e6cae9dd4627ab8bf9a9006bc7a8..f3af1c6680d1dc6d8f6db951a26a526d } diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp -index e532ffcbe13d86fa0de4fbb2c63214615539ba2d..77cf20de73c57756eea1c10349fa666ce733b304 100644 +index 78e75b9ebfa13611e7f2f9df4395a586ed9db55e..ad6db691640a56bba7fb153bd4a71eb6b618bb50 100644 --- a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp +++ b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp -@@ -491,6 +491,8 @@ void WebChromeClient::addMessageToConsole(MessageSource source, MessageLevel lev - { - // Notify the bundle client. - auto page = protectedPage(); +@@ -532,6 +532,9 @@ void WebChromeClient::addMessageToConsole(MessageSource source, MessageLevel lev + if (!page) + return; + + if (level == MessageLevel::Error) + page->send(Messages::WebPageProxy::LogToStderr(message)); ++ // FIXME: Remove this after rdar://143399667 is fixed. - page->injectedBundleUIClient().willAddMessageToConsole(page.ptr(), source, level, message, lineNumber, columnNumber, sourceID); + page->injectedBundleUIClient().willAddMessageToConsole(page.get(), source, level, message, lineNumber, columnNumber, sourceID); diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebDragClient.cpp b/Source/WebKit/WebProcess/WebCoreSupport/WebDragClient.cpp -index dd03326b1ad54e1d363d722cfe86bb779fbeead1..f54d631dc4034c995cbd74ec6b545c3c7dd25990 100644 +index 2f5b6d189eae2e153847cbf8496805a2660d1105..837f71ee8d9e0b0fb8ae1841f6820431f592dfd8 100644 --- a/Source/WebKit/WebProcess/WebCoreSupport/WebDragClient.cpp +++ b/Source/WebKit/WebProcess/WebCoreSupport/WebDragClient.cpp @@ -53,7 +53,7 @@ OptionSet WebDragClient::dragSourceActionMaskForPoint(const In @@ -20914,11 +19540,11 @@ index dd03326b1ad54e1d363d722cfe86bb779fbeead1..f54d631dc4034c995cbd74ec6b545c3c -#if !PLATFORM(COCOA) && !PLATFORM(GTK) +#if !PLATFORM(COCOA) && !PLATFORM(GTK) && !PLATFORM(WPE) && !PLATFORM(WIN) - void WebDragClient::startDrag(DragItem, DataTransfer&, Frame&) + void WebDragClient::startDrag(DragItem, DataTransfer&, Frame&, const std::optional&) { } diff --git a/Source/WebKit/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm b/Source/WebKit/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm -index 6bd8b7c5de08a061c0a155f4783affe9050b8103..610f2b7870588de14f6b658967a9f9acb1a01baa 100644 +index cf8aa32077a57057649722d73358ac91b7130551..b555eb998bab677a452c37e78935ea9bad2196fc 100644 --- a/Source/WebKit/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm +++ b/Source/WebKit/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm @@ -128,7 +128,8 @@ static WebCore::CachedImage* cachedImage(Element& element) @@ -20933,7 +19559,7 @@ index 6bd8b7c5de08a061c0a155f4783affe9050b8103..610f2b7870588de14f6b658967a9f9ac diff --git a/Source/WebKit/WebProcess/WebCoreSupport/win/WebDragClientWin.cpp b/Source/WebKit/WebProcess/WebCoreSupport/win/WebDragClientWin.cpp new file mode 100644 -index 0000000000000000000000000000000000000000..66972b66094050b2429a927861ff7d0d30925ef0 +index 0000000000000000000000000000000000000000..2d2ab369bfc1b42695dbc207e1d6e05deb16990f --- /dev/null +++ b/Source/WebKit/WebProcess/WebCoreSupport/win/WebDragClientWin.cpp @@ -0,0 +1,58 @@ @@ -20967,17 +19593,17 @@ index 0000000000000000000000000000000000000000..66972b66094050b2429a927861ff7d0d + +#if ENABLE(DRAG_SUPPORT) + -+//#include "ArgumentCodersWPE.h" +#include "MessageSenderInlines.h" +#include "WebPage.h" +#include "WebPageProxyMessages.h" +#include +#include ++#include +#include +#include +#include + -+//#include ++#include + +namespace WebKit { +using namespace WebCore; @@ -20986,7 +19612,7 @@ index 0000000000000000000000000000000000000000..66972b66094050b2429a927861ff7d0d +{ +} + -+void WebDragClient::startDrag(DragItem, DataTransfer& dataTransfer, Frame& frame) ++void WebDragClient::startDrag(DragItem, DataTransfer& dataTransfer, Frame& frame, const std::optional&) +{ + m_page->willStartDrag(); + m_page->send(Messages::WebPageProxy::StartDrag(dataTransfer.pasteboard().createDragDataMap())); @@ -20997,10 +19623,10 @@ index 0000000000000000000000000000000000000000..66972b66094050b2429a927861ff7d0d +#endif // ENABLE(DRAG_SUPPORT) diff --git a/Source/WebKit/WebProcess/WebCoreSupport/wpe/WebDragClientWPE.cpp b/Source/WebKit/WebProcess/WebCoreSupport/wpe/WebDragClientWPE.cpp new file mode 100644 -index 0000000000000000000000000000000000000000..226b3bf6bd83d2606a0aeb627ae9302fd3bcf874 +index 0000000000000000000000000000000000000000..d069b5eba1a64add1a2c370f8d519826ec7be213 --- /dev/null +++ b/Source/WebKit/WebProcess/WebCoreSupport/wpe/WebDragClientWPE.cpp -@@ -0,0 +1,56 @@ +@@ -0,0 +1,59 @@ +/* + * Copyright (C) 2011 Igalia S.L. + * @@ -21035,10 +19661,13 @@ index 0000000000000000000000000000000000000000..226b3bf6bd83d2606a0aeb627ae9302f +#include "WebPageProxyMessages.h" +#include +#include ++#include +#include +#include +#include + ++#include ++ +namespace WebKit { +using namespace WebCore; + @@ -21046,7 +19675,7 @@ index 0000000000000000000000000000000000000000..226b3bf6bd83d2606a0aeb627ae9302f +{ +} + -+void WebDragClient::startDrag(DragItem, DataTransfer& dataTransfer, Frame&) ++void WebDragClient::startDrag(DragItem, DataTransfer& dataTransfer, Frame&, const std::optional&) +{ + m_page->willStartDrag(); + @@ -21058,7 +19687,7 @@ index 0000000000000000000000000000000000000000..226b3bf6bd83d2606a0aeb627ae9302f + +#endif // ENABLE(DRAG_SUPPORT) diff --git a/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp b/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp -index ac7fa01ba9a3828cf4c48cacc862aab95145093e..89414a407a49d30b937f26cd9cd570c59c51aab3 100644 +index 5fed15fd5dbbfbaff305ce26a8bcf5ba3d0435d9..fec04b9a4d640dcf47e0a2312d8b71234bf10d09 100644 --- a/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp +++ b/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp @@ -39,6 +39,7 @@ @@ -21070,10 +19699,10 @@ index ac7fa01ba9a3828cf4c48cacc862aab95145093e..89414a407a49d30b937f26cd9cd570c5 #include #include diff --git a/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h b/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h -index 2b955369c53a76ca65613a549bff0d490db48a4c..f67651d2cc64a7f164ff91ad5f613a661976bdbb 100644 +index 31af5390779e2ec5f3bc3dc0bbddf56f2617657a..df7af98f4d38f380ee5c0b607570659260a955e0 100644 --- a/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h +++ b/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h -@@ -138,6 +138,7 @@ public: +@@ -145,6 +145,7 @@ public: #if PLATFORM(WPE) && USE(GBM) && ENABLE(WPE_PLATFORM) void preferredBufferFormatsDidChange(); #endif @@ -21094,7 +19723,7 @@ index c07ca9e847d03c27877cf650b67b96b3c3f7bddb..b966edc8778d4a68c6e5bae0c0883ab3 #include "WebPage.h" #include "WebPageCreationParameters.h" diff --git a/Source/WebKit/WebProcess/WebPage/WebCookieJar.cpp b/Source/WebKit/WebProcess/WebPage/WebCookieJar.cpp -index 70a6c3c9ed0fcf42393df2c0fb66eb50d290030d..06fb88ca78db70de4bd4ed9cdf33172bee1a958e 100644 +index 412dd3c46cb61ec5f3de076de61c34b6a32c6281..77c02eedfb60a7f816788452e20aaf3fbc434164 100644 --- a/Source/WebKit/WebProcess/WebPage/WebCookieJar.cpp +++ b/Source/WebKit/WebProcess/WebPage/WebCookieJar.cpp @@ -44,6 +44,7 @@ @@ -21105,7 +19734,7 @@ index 70a6c3c9ed0fcf42393df2c0fb66eb50d290030d..06fb88ca78db70de4bd4ed9cdf33172b #include #include #include -@@ -445,6 +446,12 @@ void WebCookieJar::setOptInCookiePartitioningEnabled(bool enabled) +@@ -447,6 +448,12 @@ void WebCookieJar::setOptInCookiePartitioningEnabled(bool enabled) } #endif @@ -21119,7 +19748,7 @@ index 70a6c3c9ed0fcf42393df2c0fb66eb50d290030d..06fb88ca78db70de4bd4ed9cdf33172b String WebCookieJar::cookiesInPartitionedCookieStorage(const WebCore::Document&, const URL&, const WebCore::SameSiteInfo&) const diff --git a/Source/WebKit/WebProcess/WebPage/WebCookieJar.h b/Source/WebKit/WebProcess/WebPage/WebCookieJar.h -index f9c1d07d4e1f4b5421a627a179ed4f86cf1a1b92..9a8089ed85eebbfb8af0804dfbc0698bcb5993d6 100644 +index d5bac4fe6d5103b4e752a7219d7870d4cddcaf27..033effbb445f5da6db5798594e2dbef34afec363 100644 --- a/Source/WebKit/WebProcess/WebPage/WebCookieJar.h +++ b/Source/WebKit/WebProcess/WebPage/WebCookieJar.h @@ -77,6 +77,8 @@ public: @@ -21132,10 +19761,10 @@ index f9c1d07d4e1f4b5421a627a179ed4f86cf1a1b92..9a8089ed85eebbfb8af0804dfbc0698b void setOptInCookiePartitioningEnabled(bool); #endif diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.cpp b/Source/WebKit/WebProcess/WebPage/WebPage.cpp -index 4f0c774675bcc9adc7fddd608953bde8840e30dd..224289ffe67a7e16f93d8373eb573849dfb38b06 100644 +index eebb80386522babc1ae192dbc470facea0b76e6b..02da88a1fd0d655faf69c7d3bd348009da32851c 100644 --- a/Source/WebKit/WebProcess/WebPage/WebPage.cpp +++ b/Source/WebKit/WebProcess/WebPage/WebPage.cpp -@@ -243,6 +243,7 @@ +@@ -244,6 +244,7 @@ #include #include #include @@ -21143,7 +19772,7 @@ index 4f0c774675bcc9adc7fddd608953bde8840e30dd..224289ffe67a7e16f93d8373eb573849 #include #include #include -@@ -1152,6 +1153,12 @@ WebPage::WebPage(PageIdentifier pageID, WebPageCreationParameters&& parameters) +@@ -1165,6 +1166,12 @@ WebPage::WebPage(PageIdentifier pageID, WebPageCreationParameters&& parameters) setLinkDecorationFilteringData(WTFMove(parameters.linkDecorationFilteringData)); setAllowedQueryParametersForAdvancedPrivacyProtections(WTFMove(parameters.allowedQueryParametersForAdvancedPrivacyProtections)); #endif @@ -21156,7 +19785,7 @@ index 4f0c774675bcc9adc7fddd608953bde8840e30dd..224289ffe67a7e16f93d8373eb573849 if (parameters.windowFeatures) { page->applyWindowFeatures(*parameters.windowFeatures); page->chrome().show(); -@@ -2094,6 +2101,22 @@ void WebPage::loadDidCommitInAnotherProcess(WebCore::FrameIdentifier frameID, st +@@ -2098,6 +2105,22 @@ void WebPage::loadDidCommitInAnotherProcess(WebCore::FrameIdentifier frameID, st frame->loadDidCommitInAnotherProcess(layerHostingContextIdentifier); } @@ -21171,7 +19800,7 @@ index 4f0c774675bcc9adc7fddd608953bde8840e30dd..224289ffe67a7e16f93d8373eb573849 + // FIXME: use m_pendingNavigationID instead? + m_pendingFrameNavigationID = loadParameters.navigationID; + -+ FrameLoadRequest frameLoadRequest { *frame->coreLocalFrame(), loadParameters.request }; ++ FrameLoadRequest frameLoadRequest { *frame->coreLocalFrame(), WTFMove(loadParameters.request) }; + frame->coreLocalFrame()->loader().load(WTFMove(frameLoadRequest)); + ASSERT(!m_pendingFrameNavigationID); +} @@ -21179,7 +19808,7 @@ index 4f0c774675bcc9adc7fddd608953bde8840e30dd..224289ffe67a7e16f93d8373eb573849 void WebPage::loadRequest(LoadParameters&& loadParameters) { WEBPAGE_RELEASE_LOG_FORWARDABLE(Loading, WEBPAGE_LOADREQUEST, loadParameters.navigationID ? loadParameters.navigationID->toUInt64() : 0, static_cast(loadParameters.shouldTreatAsContinuingLoad), loadParameters.request.isAppInitiated(), loadParameters.existingNetworkResourceLoadIdentifierToResume ? loadParameters.existingNetworkResourceLoadIdentifierToResume->toUInt64() : 0); -@@ -2290,7 +2313,9 @@ void WebPage::stopLoading() +@@ -2295,7 +2318,9 @@ void WebPage::stopLoading() void WebPage::stopLoadingDueToProcessSwap() { SetForScope isStoppingLoadingDueToProcessSwap(m_isStoppingLoadingDueToProcessSwap, true); @@ -21189,7 +19818,7 @@ index 4f0c774675bcc9adc7fddd608953bde8840e30dd..224289ffe67a7e16f93d8373eb573849 } bool WebPage::defersLoading() const -@@ -2866,7 +2891,7 @@ void WebPage::viewportPropertiesDidChange(const ViewportArguments& viewportArgum +@@ -2871,7 +2896,7 @@ void WebPage::viewportPropertiesDidChange(const ViewportArguments& viewportArgum #if PLATFORM(IOS_FAMILY) if (m_viewportConfiguration.setViewportArguments(viewportArguments)) viewportConfigurationChanged(); @@ -21198,7 +19827,7 @@ index 4f0c774675bcc9adc7fddd608953bde8840e30dd..224289ffe67a7e16f93d8373eb573849 // Adjust view dimensions when using fixed layout. RefPtr localMainFrame = this->localMainFrame(); RefPtr view = localMainFrame ? localMainFrame->view() : nullptr; -@@ -3623,6 +3648,13 @@ void WebPage::flushDeferredScrollEvents() +@@ -3628,6 +3653,13 @@ void WebPage::flushDeferredScrollEvents() protectedCorePage()->flushDeferredScrollEvents(); } @@ -21212,7 +19841,7 @@ index 4f0c774675bcc9adc7fddd608953bde8840e30dd..224289ffe67a7e16f93d8373eb573849 void WebPage::flushDeferredDidReceiveMouseEvent() { if (auto info = std::exchange(m_deferredDidReceiveMouseEvent, std::nullopt)) -@@ -3884,6 +3916,97 @@ void WebPage::touchEvent(const WebTouchEvent& touchEvent, CompletionHandlermainFrame().frameID(), touchEvent, m_page.get()).wasHandled(); ++ handled = handleTouchEvent(m_page->mainFrame().frameID(), touchEvent, m_page.get()).value_or(false); + } + { + Vector touchPoints; @@ -21251,7 +19880,7 @@ index 4f0c774675bcc9adc7fddd608953bde8840e30dd..224289ffe67a7e16f93d8373eb573849 + WebTouchEvent touchEvent({WebEventType::TouchEnd, eventModifiers, WallTime::now()}, WTFMove(touchPoints), {}, {}); + + CurrentEvent currentEvent(touchEvent); -+ handled = handleTouchEvent(m_page->mainFrame().frameID(), touchEvent, m_page.get()).wasHandled() || handled; ++ handled = handleTouchEvent(m_page->mainFrame().frameID(), touchEvent, m_page.get()).value_or(false) || handled; + } + if (!handled) { + FloatPoint adjustedPoint; @@ -21310,7 +19939,7 @@ index 4f0c774675bcc9adc7fddd608953bde8840e30dd..224289ffe67a7e16f93d8373eb573849 #endif void WebPage::cancelPointer(WebCore::PointerID pointerId, const WebCore::IntPoint& documentPoint) -@@ -3972,6 +4095,16 @@ void WebPage::sendMessageToTargetBackend(const String& targetId, const String& m +@@ -3990,6 +4113,16 @@ void WebPage::sendMessageToTargetBackend(const String& targetId, const String& m m_inspectorTargetController->sendMessageToTargetBackend(targetId, message); } @@ -21327,7 +19956,7 @@ index 4f0c774675bcc9adc7fddd608953bde8840e30dd..224289ffe67a7e16f93d8373eb573849 void WebPage::insertNewlineInQuotedContent() { RefPtr frame = protectedCorePage()->checkedFocusController()->focusedOrMainFrame(); -@@ -4215,6 +4348,7 @@ void WebPage::setMainFrameDocumentVisualUpdatesAllowed(bool allowed) +@@ -4233,6 +4366,7 @@ void WebPage::setMainFrameDocumentVisualUpdatesAllowed(bool allowed) void WebPage::show() { send(Messages::WebPageProxy::ShowPage()); @@ -21335,7 +19964,7 @@ index 4f0c774675bcc9adc7fddd608953bde8840e30dd..224289ffe67a7e16f93d8373eb573849 } void WebPage::setIsTakingSnapshotsForApplicationSuspension(bool isTakingSnapshotsForApplicationSuspension) -@@ -5426,7 +5560,7 @@ RefPtr WebPage::protectedNotificationPermi +@@ -5448,7 +5582,7 @@ RefPtr WebPage::protectedNotificationPermi #if ENABLE(DRAG_SUPPORT) @@ -21344,7 +19973,7 @@ index 4f0c774675bcc9adc7fddd608953bde8840e30dd..224289ffe67a7e16f93d8373eb573849 void WebPage::performDragControllerAction(DragControllerAction action, const IntPoint& clientPosition, const IntPoint& globalPosition, OptionSet draggingSourceOperationMask, SelectionData&& selectionData, OptionSet flags, CompletionHandler, DragHandlingMethod, bool, unsigned, IntRect, IntRect, std::optional)>&& completionHandler) { if (!m_page) -@@ -7913,6 +8047,10 @@ void WebPage::didCommitLoad(WebFrame* frame) +@@ -7961,6 +8095,10 @@ void WebPage::didCommitLoad(WebFrame* frame) m_needsFixedContainerEdgesUpdate = true; flushDeferredDidReceiveMouseEvent(); @@ -21355,7 +19984,7 @@ index 4f0c774675bcc9adc7fddd608953bde8840e30dd..224289ffe67a7e16f93d8373eb573849 } void WebPage::didFinishDocumentLoad(WebFrame& frame) -@@ -8222,6 +8360,9 @@ Ref WebPage::createDocumentLoader(LocalFrame& frame, const Resou +@@ -8270,6 +8408,9 @@ Ref WebPage::createDocumentLoader(LocalFrame& frame, ResourceReq m_allowsContentJavaScriptFromMostRecentNavigation = m_internals->pendingWebsitePolicies->allowsContentJavaScript; WebsitePoliciesData::applyToDocumentLoader(*std::exchange(m_internals->pendingWebsitePolicies, std::nullopt), documentLoader); } @@ -21366,10 +19995,10 @@ index 4f0c774675bcc9adc7fddd608953bde8840e30dd..224289ffe67a7e16f93d8373eb573849 return documentLoader; diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.h b/Source/WebKit/WebProcess/WebPage/WebPage.h -index 8bd2bc55df904c4d23bf47d38981581faf89b2af..c0f2d51469875510b65b252b2ba4c15ef252b9c6 100644 +index 360c7068495346fa326a3409afe64c03ff11506e..263acb1412dd593a45a264c7fbd3fc16582db710 100644 --- a/Source/WebKit/WebProcess/WebPage/WebPage.h +++ b/Source/WebKit/WebProcess/WebPage/WebPage.h -@@ -45,6 +45,7 @@ +@@ -47,6 +47,7 @@ #include #include #include @@ -21377,7 +20006,7 @@ index 8bd2bc55df904c4d23bf47d38981581faf89b2af..c0f2d51469875510b65b252b2ba4c15e #include #include #include -@@ -1272,11 +1273,11 @@ public: +@@ -1286,11 +1287,11 @@ public: void clearSelection(); void restoreSelectionInFocusedEditableElement(); @@ -21391,17 +20020,17 @@ index 8bd2bc55df904c4d23bf47d38981581faf89b2af..c0f2d51469875510b65b252b2ba4c15e void performDragControllerAction(std::optional, DragControllerAction, WebCore::DragData&&, CompletionHandler, WebCore::DragHandlingMethod, bool, unsigned, WebCore::IntRect, WebCore::IntRect, std::optional)>&&); void performDragOperation(WebCore::DragData&&, SandboxExtensionHandle&&, Vector&&, CompletionHandler&&); #endif -@@ -1291,6 +1292,9 @@ public: - void didStartDrag(); - void dragCancelled(); - OptionSet allowedDragSourceActions() const { return m_allowedDragSourceActions; } +@@ -1308,6 +1309,9 @@ public: + #if ENABLE(MODEL_PROCESS) + void modelDragEnded(WebCore::ElementIdentifier); + #endif +#if PLATFORM(MAC) + void setDragPasteboardName(const String& pasteboardName) { m_page->setDragPasteboardName(pasteboardName); } +#endif #endif #if ENABLE(MODEL_PROCESS) -@@ -1377,8 +1381,11 @@ public: +@@ -1394,8 +1398,11 @@ public: void gestureEvent(WebCore::FrameIdentifier, const WebGestureEvent&, CompletionHandler, bool, std::optional)>&&); #endif @@ -21414,7 +20043,7 @@ index 8bd2bc55df904c4d23bf47d38981581faf89b2af..c0f2d51469875510b65b252b2ba4c15e void dynamicViewportSizeUpdate(const DynamicViewportSizeUpdate&); bool scaleWasSetByUIProcess() const { return m_scaleWasSetByUIProcess; } void willStartUserTriggeredZooming(); -@@ -1531,6 +1538,8 @@ public: +@@ -1548,6 +1555,8 @@ public: void connectInspector(const String& targetId, Inspector::FrontendChannel::ConnectionType); void disconnectInspector(const String& targetId); void sendMessageToTargetBackend(const String& targetId, const String& message); @@ -21423,7 +20052,7 @@ index 8bd2bc55df904c4d23bf47d38981581faf89b2af..c0f2d51469875510b65b252b2ba4c15e void insertNewlineInQuotedContent(); -@@ -1949,6 +1958,7 @@ public: +@@ -1969,6 +1978,7 @@ public: void showContextMenuFromFrame(const FrameInfoData&, const ContextMenuContextData&, const UserData&); #endif void loadRequest(LoadParameters&&); @@ -21431,7 +20060,7 @@ index 8bd2bc55df904c4d23bf47d38981581faf89b2af..c0f2d51469875510b65b252b2ba4c15e void setObscuredContentInsets(const WebCore::FloatBoxExtent&); -@@ -2145,6 +2155,7 @@ private: +@@ -2171,6 +2181,7 @@ private: void updatePotentialTapSecurityOrigin(const WebTouchEvent&, bool wasHandled); #elif ENABLE(TOUCH_EVENTS) void touchEvent(const WebTouchEvent&, CompletionHandler, bool)>&&); @@ -21439,8 +20068,8 @@ index 8bd2bc55df904c4d23bf47d38981581faf89b2af..c0f2d51469875510b65b252b2ba4c15e #endif void cancelPointer(WebCore::PointerID, const WebCore::IntPoint&); -@@ -2913,6 +2924,7 @@ private: - UserActivity m_userActivity; +@@ -2941,6 +2952,7 @@ private: + bool m_isAppNapEnabled { true }; Markable m_pendingNavigationID; + Markable m_pendingFrameNavigationID; @@ -21448,7 +20077,7 @@ index 8bd2bc55df904c4d23bf47d38981581faf89b2af..c0f2d51469875510b65b252b2ba4c15e bool m_mainFrameProgressCompleted { false }; bool m_shouldDispatchFakeMouseMoveEvents { true }; diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.messages.in b/Source/WebKit/WebProcess/WebPage/WebPage.messages.in -index 16e97e9e8d9158d290c98231e2a2a9c3b3d2f567..49d4d7eaaba21b3460dd84583a48501deb337664 100644 +index c4ae18f9803e00d09a3f479c03ec858dd98c9045..9b1cbcf627f104e97a7ca46b560cdb9d99dc0ffc 100644 --- a/Source/WebKit/WebProcess/WebPage/WebPage.messages.in +++ b/Source/WebKit/WebProcess/WebPage/WebPage.messages.in @@ -58,10 +58,13 @@ messages -> WebPage WantsAsyncDispatchMessage { @@ -21482,15 +20111,15 @@ index 16e97e9e8d9158d290c98231e2a2a9c3b3d2f567..49d4d7eaaba21b3460dd84583a48501d #endif CancelPointer(WebCore::PointerID pointerId, WebCore::IntPoint documentPoint) -@@ -190,6 +195,7 @@ messages -> WebPage WantsAsyncDispatchMessage { - CreateProvisionalFrame(struct WebKit::ProvisionalFrameCreationParameters creationParameters) - DestroyProvisionalFrame(WebCore::FrameIdentifier frameID); +@@ -188,6 +193,7 @@ messages -> WebPage WantsAsyncDispatchMessage { + LoadDataInFrame(std::span data, String MIMEType, String encodingName, URL baseURL, WebCore::FrameIdentifier frameID) + LoadRequest(struct WebKit::LoadParameters loadParameters) LoadDidCommitInAnotherProcess(WebCore::FrameIdentifier frameID, std::optional layerHostingContextIdentifier) + LoadRequestInFrameForInspector(struct WebKit::LoadParameters loadParameters, WebCore::FrameIdentifier frameID) LoadRequestWaitingForProcessLaunch(struct WebKit::LoadParameters loadParameters, URL resourceDirectoryURL, WebKit::WebPageProxyIdentifier pageID, bool checkAssumedReadAccessToResourceURL) LoadData(struct WebKit::LoadParameters loadParameters) LoadSimulatedRequestAndResponse(struct WebKit::LoadParameters loadParameters, WebCore::ResourceResponse simulatedResponse) -@@ -351,10 +357,10 @@ messages -> WebPage WantsAsyncDispatchMessage { +@@ -352,10 +358,10 @@ messages -> WebPage WantsAsyncDispatchMessage { RemoveLayerForFindOverlay() -> () # Drag and drop. @@ -21503,8 +20132,8 @@ index 16e97e9e8d9158d290c98231e2a2a9c3b3d2f567..49d4d7eaaba21b3460dd84583a48501d PerformDragControllerAction(std::optional frameID, enum:uint8_t WebKit::DragControllerAction action, WebCore::DragData dragData) -> (enum:uint8_t std::optional dragOperation, enum:uint8_t WebCore::DragHandlingMethod dragHandlingMethod, bool mouseIsOverFileInput, unsigned numberOfItemsToBeAccepted, WebCore::IntRect insertionRect, WebCore::IntRect editableElementRect, struct std::optional remoteUserInputEventData) PerformDragOperation(WebCore::DragData dragData, WebKit::SandboxExtensionHandle sandboxExtensionHandle, Vector sandboxExtensionsForUpload) -> (bool handled) #endif -@@ -370,6 +376,10 @@ messages -> WebPage WantsAsyncDispatchMessage { - StageModeSessionDidEnd(std::optional elementID) +@@ -375,6 +381,10 @@ messages -> WebPage WantsAsyncDispatchMessage { + ModelDragEnded(WebCore::ElementIdentifier elementID) #endif +#if PLATFORM(MAC) && ENABLE(DRAG_SUPPORT) @@ -21512,8 +20141,8 @@ index 16e97e9e8d9158d290c98231e2a2a9c3b3d2f567..49d4d7eaaba21b3460dd84583a48501d +#endif + #if PLATFORM(IOS_FAMILY) && ENABLE(DRAG_SUPPORT) - RequestDragStart(WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, OptionSet allowedActionsMask) - RequestAdditionalItemsForDragSession(WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, OptionSet allowedActionsMask) + RequestDragStart(std::optional remoteFrameID, WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, OptionSet allowedActionsMask) -> (struct WebKit::DragInitiationResult result) + RequestAdditionalItemsForDragSession(std::optional rootFrameID, WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, OptionSet allowedActionsMask) -> (struct WebKit::DragInitiationResult result) diff --git a/Source/WebKit/WebProcess/WebPage/glib/WebPageGLib.cpp b/Source/WebKit/WebProcess/WebPage/glib/WebPageGLib.cpp index 40ec42bb4f998774a2ce4a19e82f68512ad2ebb8..080794e14bfbb3a336d8a89791baee0e1aec3c75 100644 --- a/Source/WebKit/WebProcess/WebPage/glib/WebPageGLib.cpp @@ -21553,10 +20182,10 @@ index 40ec42bb4f998774a2ce4a19e82f68512ad2ebb8..080794e14bfbb3a336d8a89791baee0e const auto& availableInputs = WebProcess::singleton().availableInputDevices(); if (availableInputs.contains(AvailableInputDevices::Mouse)) diff --git a/Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm b/Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm -index 932e27ac30ca12459321e4bc1386e7489f647831..ae8dafebd63dbc78c4000dad9f86f3f2208b69b9 100644 +index e9dc2250f0f5e68db6ae61f5f734e2e2cf24cf9b..3dc31fc41d8efd990f94a713c0490abf1f1d9f60 100644 --- a/Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm +++ b/Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm -@@ -703,21 +703,37 @@ String WebPage::platformUserAgent(const URL&) const +@@ -705,21 +705,37 @@ String WebPage::platformUserAgent(const URL&) const bool WebPage::hoverSupportedByPrimaryPointingDevice() const { @@ -21595,10 +20224,10 @@ index 932e27ac30ca12459321e4bc1386e7489f647831..ae8dafebd63dbc78c4000dad9f86f3f2 } diff --git a/Source/WebKit/WebProcess/WebPage/win/WebPageWin.cpp b/Source/WebKit/WebProcess/WebPage/win/WebPageWin.cpp -index f17f5d719d892309ed9c7093384945866b5117b9..adffe0aa4440c626879e3f5701dd5fea4b2d1a0f 100644 +index ea3a03b5ee6d4ecadd771314c6059268db917087..91be6f4c687157afcfdaa431d7a1a6ff712b551c 100644 --- a/Source/WebKit/WebProcess/WebPage/win/WebPageWin.cpp +++ b/Source/WebKit/WebProcess/WebPage/win/WebPageWin.cpp -@@ -43,6 +43,7 @@ +@@ -45,6 +45,7 @@ #include #include #include @@ -21606,7 +20235,7 @@ index f17f5d719d892309ed9c7093384945866b5117b9..adffe0aa4440c626879e3f5701dd5fea #include #include #include -@@ -81,21 +82,37 @@ String WebPage::platformUserAgent(const URL&) const +@@ -83,21 +84,37 @@ String WebPage::platformUserAgent(const URL&) const bool WebPage::hoverSupportedByPrimaryPointingDevice() const { @@ -21645,7 +20274,7 @@ index f17f5d719d892309ed9c7093384945866b5117b9..adffe0aa4440c626879e3f5701dd5fea } diff --git a/Source/WebKit/WebProcess/WebProcess.cpp b/Source/WebKit/WebProcess/WebProcess.cpp -index 757208df2beb144defe64fe4181d972f823ec89a..5c1bc069b031a5787515e787ed9abe441c124971 100644 +index 230b9bb1f8b1f218f94c10f18f4d672286ce5a9d..c9741c132685eb27737d21c7c840edb9447ec596 100644 --- a/Source/WebKit/WebProcess/WebProcess.cpp +++ b/Source/WebKit/WebProcess/WebProcess.cpp @@ -93,6 +93,7 @@ @@ -21690,10 +20319,10 @@ index 757208df2beb144defe64fe4181d972f823ec89a..5c1bc069b031a5787515e787ed9abe44 void WebProcess::removeWebPage(PageIdentifier pageID) diff --git a/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm b/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm -index c0fa99b99c2d0464f976bed096ee774db8a7e3c9..7b9fb12ef6198e8a052efe0e6d37768ad161d3aa 100644 +index 9dd01c8ef00f00d49d54a16996142681d1486852..51a02893b48bc930ebca7dd4b76dc874beecb157 100644 --- a/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm +++ b/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm -@@ -4223,7 +4223,7 @@ ALLOW_DEPRECATED_DECLARATIONS_END +@@ -4225,7 +4225,7 @@ ALLOW_DEPRECATED_DECLARATIONS_END _private->handlingMouseDownEvent = NO; } @@ -21703,10 +20332,10 @@ index c0fa99b99c2d0464f976bed096ee774db8a7e3c9..7b9fb12ef6198e8a052efe0e6d37768a - (void)touch:(WebEvent *)event { diff --git a/Source/WebKitLegacy/mac/WebView/WebView.mm b/Source/WebKitLegacy/mac/WebView/WebView.mm -index e7d231ff9a7a975d442f9b790a0aad2d666e9972..263d30a59c67e4bd930a1961941a9742760df4d3 100644 +index 222de8db3d8475b7a68b017dc88994d4ca7e08fd..ed3460c7b59772410af898d4fb107cc88c3b40a6 100644 --- a/Source/WebKitLegacy/mac/WebView/WebView.mm +++ b/Source/WebKitLegacy/mac/WebView/WebView.mm -@@ -3992,7 +3992,7 @@ + (void)_doNotStartObservingNetworkReachability +@@ -4002,7 +4002,7 @@ + (void)_doNotStartObservingNetworkReachability } #endif // PLATFORM(IOS_FAMILY) @@ -21715,7 +20344,7 @@ index e7d231ff9a7a975d442f9b790a0aad2d666e9972..263d30a59c67e4bd930a1961941a9742 - (NSArray *)_touchEventRegions { -@@ -4034,7 +4034,7 @@ - (NSArray *)_touchEventRegions +@@ -4044,7 +4044,7 @@ - (NSArray *)_touchEventRegions }).autorelease(); } @@ -21726,14 +20355,16 @@ index e7d231ff9a7a975d442f9b790a0aad2d666e9972..263d30a59c67e4bd930a1961941a9742 // a per-WebView and a per-preferences setting for whether to use the back/forward cache. diff --git a/Source/cmake/FindLibVPX.cmake b/Source/cmake/FindLibVPX.cmake new file mode 100644 -index 0000000000000000000000000000000000000000..dd6a53e2d57318489b7e49dd7373706d5d9dc387 +index 0000000000000000000000000000000000000000..a9db9ec38d05e36517414248237e885b25109647 --- /dev/null +++ b/Source/cmake/FindLibVPX.cmake -@@ -0,0 +1,25 @@ +@@ -0,0 +1,27 @@ +# Find LibVPX + +find_package(PkgConfig QUIET) -+pkg_check_modules(PC_LIBVPX REQUIRED vpx) ++if (PkgConfig_FOUND) ++ pkg_check_modules(PC_LIBVPX REQUIRED vpx) ++endif () + +find_path(LIBVPX_INCLUDE_DIRS + NAMES vpx/vp8.h @@ -21756,7 +20387,7 @@ index 0000000000000000000000000000000000000000..dd6a53e2d57318489b7e49dd7373706d + LIBVPX_LIBRARIES +) diff --git a/Source/cmake/OptionsGTK.cmake b/Source/cmake/OptionsGTK.cmake -index dc6bd15038f36e65b47974960a414b0d7c170e63..da2dba81c6cb4617cc2b946f24060ec8fcf46c87 100644 +index 303550b9618e8c621e246e8c95b9e7542585f1fc..efdb66ef47e46e83287350933047295e6dc0c268 100644 --- a/Source/cmake/OptionsGTK.cmake +++ b/Source/cmake/OptionsGTK.cmake @@ -9,6 +9,10 @@ set(USER_AGENT_BRANDING "" CACHE STRING "Branding to add to user agent string") @@ -21792,7 +20423,7 @@ index dc6bd15038f36e65b47974960a414b0d7c170e63..da2dba81c6cb4617cc2b946f24060ec8 SET_AND_EXPOSE_TO_BUILD(ENABLE_DEVELOPER_MODE ${DEVELOPER_MODE}) if (DEVELOPER_MODE) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_API_TESTS PRIVATE ON) -@@ -149,6 +161,20 @@ endif () +@@ -147,6 +159,20 @@ endif () WEBKIT_OPTION_DEPEND(ENABLE_GPU_PROCESS USE_GBM) @@ -21814,7 +20445,7 @@ index dc6bd15038f36e65b47974960a414b0d7c170e63..da2dba81c6cb4617cc2b946f24060ec8 # Finalize the value for all options. Do not attempt to use an option before diff --git a/Source/cmake/OptionsWPE.cmake b/Source/cmake/OptionsWPE.cmake -index 8c12c0a16e14d3d537704114afc15f6935e17dcd..0c70ff37d45230597a5210e166d242a78bfb8730 100644 +index 45b4da4575d41bdf1b829ddf68947f30bc57734f..378b9114ae03c18f0caead71750c1169b2c45b27 100644 --- a/Source/cmake/OptionsWPE.cmake +++ b/Source/cmake/OptionsWPE.cmake @@ -23,6 +23,9 @@ find_package(WebP REQUIRED COMPONENTS demux) @@ -21827,8 +20458,8 @@ index 8c12c0a16e14d3d537704114afc15f6935e17dcd..0c70ff37d45230597a5210e166d242a7 WEBKIT_OPTION_BEGIN() SET_AND_EXPOSE_TO_BUILD(ENABLE_DEVELOPER_MODE ${DEVELOPER_MODE}) -@@ -85,6 +88,21 @@ if (WPE_VERSION VERSION_GREATER_EQUAL 1.13.90) - WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_GAMEPAD PUBLIC ON) +@@ -81,6 +84,21 @@ else () + WEBKIT_OPTION_DEFAULT_PORT_VALUE(USE_SKIA PRIVATE OFF) endif () +# Playwright begin. @@ -21849,7 +20480,7 @@ index 8c12c0a16e14d3d537704114afc15f6935e17dcd..0c70ff37d45230597a5210e166d242a7 # Public options specific to the WPE port. Do not add any options here unless # there is a strong reason we should support changing the value of the option, # and the option is not relevant to other WebKit ports. -@@ -120,6 +138,11 @@ WEBKIT_OPTION_DEPEND(USE_QT6 ENABLE_WPE_PLATFORM) +@@ -116,6 +134,11 @@ WEBKIT_OPTION_DEPEND(USE_QT6 ENABLE_WPE_PLATFORM) WEBKIT_OPTION_DEPEND(USE_SKIA_OPENTYPE_SVG USE_SKIA) WEBKIT_OPTION_DEPEND(USE_SYSTEM_SYSPROF_CAPTURE USE_SYSPROF_CAPTURE) @@ -21862,38 +20493,21 @@ index 8c12c0a16e14d3d537704114afc15f6935e17dcd..0c70ff37d45230597a5210e166d242a7 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_BUBBLEWRAP_SANDBOX PUBLIC ON) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MEMORY_SAMPLER PRIVATE ON) diff --git a/Source/cmake/OptionsWin.cmake b/Source/cmake/OptionsWin.cmake -index ee7c004624e7da8e0a7af18356fc9a378f82020a..9fcabed645095932d997ed5a69a9a5534ac3cb35 100644 +index 95393f0a6063615b417eb3249d3838ad0e3024d8..beedf862d572718b8f0f5e6daa0f8d029a96ea77 100644 --- a/Source/cmake/OptionsWin.cmake +++ b/Source/cmake/OptionsWin.cmake -@@ -73,6 +73,27 @@ find_package(ZLIB 1.2.11 REQUIRED) +@@ -55,6 +55,10 @@ find_package(ZLIB 1.2.11 REQUIRED) find_package(LibPSL 0.20.2 REQUIRED) find_package(WebP REQUIRED COMPONENTS demux) +# Playwright begin -+set(LIBVPX_PACKAGE_PATH "C:\\vcpkg\\packages\\libvpx_x64-windows") -+file(TO_CMAKE_PATH "${LIBVPX_PACKAGE_PATH}" LIBVPX_PACKAGE_PATH) -+message(STATUS "Using LIBVPX_PACKAGE_PATH = ${LIBVPX_PACKAGE_PATH}") -+ -+find_library(LIBVPX_CUSTOM_LIBRARY vpx.lib -+ HINTS ${LIBVPX_PACKAGE_PATH}/lib -+ REQUIRED -+ NO_DEFAULT_PATH -+) -+message(STATUS "Found LIBVPX_CUSTOM_LIBRARY = ${LIBVPX_CUSTOM_LIBRARY}") -+ -+find_path(LIBVPX_CUSTOM_INCLUDE_DIR -+ NAMES vpx/vp8.h -+ HINTS ${LIBVPX_PACKAGE_PATH}/include -+ REQUIRED -+ NO_DEFAULT_PATH -+) -+message(STATUS "Found LIBVPX_CUSTOM_INCLUDE_DIR = ${LIBVPX_CUSTOM_INCLUDE_DIR}") ++find_package(LibVPX REQUIRED) +# Playwright end + WEBKIT_OPTION_BEGIN() # FIXME: Most of these options should not be public. -@@ -131,6 +152,14 @@ WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_FTPDIR PRIVATE OFF) +@@ -113,6 +117,14 @@ WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_FTPDIR PRIVATE OFF) SET_AND_EXPOSE_TO_BUILD(ENABLE_WEBDRIVER_KEYBOARD_INTERACTIONS ON) SET_AND_EXPOSE_TO_BUILD(ENABLE_WEBDRIVER_MOUSE_INTERACTIONS ON) @@ -21909,7 +20523,7 @@ index ee7c004624e7da8e0a7af18356fc9a378f82020a..9fcabed645095932d997ed5a69a9a553 set(USE_ANGLE_EGL ON) diff --git a/Source/cmake/WebKitCompilerFlags.cmake b/Source/cmake/WebKitCompilerFlags.cmake -index de1cb6c496ccce806010ec1da8f6a4d6d731e0c1..17ea31b9623d939fc2db0249b04caeb8f78fd725 100644 +index d8fe5503609122c55c2c675934b3678cfe709cf0..2e706bb436d6c01689bec8cc7b7de3c125ca258a 100644 --- a/Source/cmake/WebKitCompilerFlags.cmake +++ b/Source/cmake/WebKitCompilerFlags.cmake @@ -122,7 +122,7 @@ macro(WEBKIT_ADD_TARGET_CXX_FLAGS _target) @@ -22124,10 +20738,10 @@ index 1fd07efb828b85b6d8def6c6cd92a0c11debfe1b..da9fac7975d477857ead2adb1d67108d typedef struct _BrowserWindow BrowserWindow; diff --git a/Tools/MiniBrowser/gtk/main.c b/Tools/MiniBrowser/gtk/main.c -index 8433f5360dc4a5f43b68b67192fb3d9bf5064cf1..9fa8f53e90fe5a32be1c8e7a9daa64047640e9f6 100644 +index d3fbb968ee463f86c64fecb855b46c8634b4b72d..01dbbfbb93f2cfa6eb6440cce9794ec99b097c30 100644 --- a/Tools/MiniBrowser/gtk/main.c +++ b/Tools/MiniBrowser/gtk/main.c -@@ -75,9 +75,14 @@ static char* timeZone; +@@ -65,9 +65,14 @@ static char* timeZone; static gboolean enableITP; static gboolean exitAfterLoad; static gboolean webProcessCrashed; @@ -22142,7 +20756,7 @@ index 8433f5360dc4a5f43b68b67192fb3d9bf5064cf1..9fa8f53e90fe5a32be1c8e7a9daa6404 #if !GTK_CHECK_VERSION(3, 98, 0) static gboolean enableSandbox; -@@ -182,6 +187,10 @@ static const GOptionEntry commandLineOptions[] = +@@ -172,6 +177,10 @@ static const GOptionEntry commandLineOptions[] = { "time-zone", 't', 0, G_OPTION_ARG_STRING, &timeZone, "Set time zone", "TIMEZONE" }, { "version", 'v', 0, G_OPTION_ARG_NONE, &printVersion, "Print the WebKitGTK version", NULL }, { "config", 'C', 0, G_OPTION_ARG_FILENAME, &configFile, "Path to a configuration file", "PATH" }, @@ -22153,7 +20767,7 @@ index 8433f5360dc4a5f43b68b67192fb3d9bf5064cf1..9fa8f53e90fe5a32be1c8e7a9daa6404 { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &uriArguments, 0, "[URL…]" }, { 0, 0, 0, 0, 0, 0, 0 } }; -@@ -739,6 +748,70 @@ static void filterSavedCallback(WebKitUserContentFilterStore *store, GAsyncResul +@@ -729,6 +738,70 @@ static void filterSavedCallback(WebKitUserContentFilterStore *store, GAsyncResul g_main_loop_quit(data->mainLoop); } @@ -22224,7 +20838,7 @@ index 8433f5360dc4a5f43b68b67192fb3d9bf5064cf1..9fa8f53e90fe5a32be1c8e7a9daa6404 static void startup(GApplication *application) { const char *actionAccels[] = { -@@ -797,17 +870,30 @@ static void setupDarkMode(GtkSettings *settings) +@@ -787,17 +860,30 @@ static void setupDarkMode(GtkSettings *settings) static void activate(GApplication *application, WebKitSettings *webkitSettings) { @@ -22259,7 +20873,7 @@ index 8433f5360dc4a5f43b68b67192fb3d9bf5064cf1..9fa8f53e90fe5a32be1c8e7a9daa6404 char *dataDirectory = g_build_filename(g_get_user_data_dir(), "webkitgtk-" WEBKITGTK_API_VERSION, "MiniBrowser", NULL); char *cacheDirectory = g_build_filename(g_get_user_cache_dir(), "webkitgtk-" WEBKITGTK_API_VERSION, "MiniBrowser", NULL); networkSession = webkit_network_session_new(dataDirectory, cacheDirectory); -@@ -815,6 +901,8 @@ static void activate(GApplication *application, WebKitSettings *webkitSettings) +@@ -805,6 +891,8 @@ static void activate(GApplication *application, WebKitSettings *webkitSettings) g_free(cacheDirectory); } @@ -22268,7 +20882,7 @@ index 8433f5360dc4a5f43b68b67192fb3d9bf5064cf1..9fa8f53e90fe5a32be1c8e7a9daa6404 webkit_network_session_set_itp_enabled(networkSession, enableITP); if (!automationMode) { -@@ -849,9 +937,12 @@ static void activate(GApplication *application, WebKitSettings *webkitSettings) +@@ -839,9 +927,12 @@ static void activate(GApplication *application, WebKitSettings *webkitSettings) } #else WebKitWebsiteDataManager *manager; @@ -22283,7 +20897,7 @@ index 8433f5360dc4a5f43b68b67192fb3d9bf5064cf1..9fa8f53e90fe5a32be1c8e7a9daa6404 char *dataDirectory = g_build_filename(g_get_user_data_dir(), "webkitgtk-" WEBKITGTK_API_VERSION, "MiniBrowser", NULL); char *cacheDirectory = g_build_filename(g_get_user_cache_dir(), "webkitgtk-" WEBKITGTK_API_VERSION, "MiniBrowser", NULL); manager = webkit_website_data_manager_new("base-data-directory", dataDirectory, "base-cache-directory", cacheDirectory, NULL); -@@ -901,6 +992,7 @@ static void activate(GApplication *application, WebKitSettings *webkitSettings) +@@ -891,6 +982,7 @@ static void activate(GApplication *application, WebKitSettings *webkitSettings) // Enable the favicon database. webkit_web_context_set_favicon_database_directory(webContext, NULL); #endif @@ -22291,7 +20905,7 @@ index 8433f5360dc4a5f43b68b67192fb3d9bf5064cf1..9fa8f53e90fe5a32be1c8e7a9daa6404 webkit_web_context_register_uri_scheme(webContext, BROWSER_ABOUT_SCHEME, (WebKitURISchemeRequestCallback)aboutURISchemeRequestCallback, NULL, NULL); -@@ -965,9 +1057,7 @@ static void activate(GApplication *application, WebKitSettings *webkitSettings) +@@ -955,9 +1047,7 @@ static void activate(GApplication *application, WebKitSettings *webkitSettings) if (exitAfterLoad) exitAfterWebViewLoadFinishes(webView, application); } @@ -22302,7 +20916,7 @@ index 8433f5360dc4a5f43b68b67192fb3d9bf5064cf1..9fa8f53e90fe5a32be1c8e7a9daa6404 } } else { WebKitWebView *webView = createBrowserTab(mainWindow, webkitSettings, userContentManager, defaultWebsitePolicies); -@@ -1017,7 +1107,7 @@ int main(int argc, char *argv[]) +@@ -1007,7 +1097,7 @@ int main(int argc, char *argv[]) g_option_context_add_group(context, gst_init_get_option_group()); #endif @@ -22311,7 +20925,7 @@ index 8433f5360dc4a5f43b68b67192fb3d9bf5064cf1..9fa8f53e90fe5a32be1c8e7a9daa6404 webkit_settings_set_enable_developer_extras(webkitSettings, TRUE); webkit_settings_set_enable_webgl(webkitSettings, TRUE); webkit_settings_set_enable_media_stream(webkitSettings, TRUE); -@@ -1069,9 +1159,11 @@ int main(int argc, char *argv[]) +@@ -1059,9 +1149,11 @@ int main(int argc, char *argv[]) } GtkApplication *application = gtk_application_new("org.webkitgtk.MiniBrowser", G_APPLICATION_NON_UNIQUE); @@ -22659,10 +21273,10 @@ index 1067b31bc989748dfcc5502209d36d001b9b239e..7629263fb8bc93dca6dfc01c75eed8d2 + add_subdirectory(Playwright/win) +endif () diff --git a/Tools/Scripts/build-webkit b/Tools/Scripts/build-webkit -index df483701f5b9c69718669fff32bb35475c7bf0c9..5cff91cb4618417691586a5771291eec9f89bee3 100755 +index fcbf4620e66e0a49396fb650f2da1fad43e8a6fc..7c38c04e082313cbd7513ba8b5626f377f6850d4 100755 --- a/Tools/Scripts/build-webkit +++ b/Tools/Scripts/build-webkit -@@ -274,7 +274,7 @@ if (isAppleCocoaWebKit()) { +@@ -278,7 +278,7 @@ if (isAppleCocoaWebKit()) { push @projects, ("Source/WebKit"); if (!isEmbeddedWebKit()) { @@ -22687,10 +21301,10 @@ index 9e53f459e444b9c10fc5248f0e8059df6c1e0041..c17c875a7dd3ca05c4489578ab32378b "${WebKitTestRunner_DIR}/InjectedBundle/Bindings/AccessibilityController.idl" "${WebKitTestRunner_DIR}/InjectedBundle/Bindings/AccessibilityTextMarker.idl" diff --git a/Tools/WebKitTestRunner/TestController.cpp b/Tools/WebKitTestRunner/TestController.cpp -index ce8aa4f20d8e0f14a51ae27d8d9440b55e0ea433..cf93f834e135f932ffba7e7101052fcbd9e6b4b2 100644 +index ee6c2488fd655c40d250b405a82358e81e2661f6..5b9baf3c2ee0e9bb28fd765c7fdacb3a70f9ef36 100644 --- a/Tools/WebKitTestRunner/TestController.cpp +++ b/Tools/WebKitTestRunner/TestController.cpp -@@ -711,6 +711,7 @@ PlatformWebView* TestController::createOtherPlatformWebView(PlatformWebView* par +@@ -713,6 +713,7 @@ PlatformWebView* TestController::createOtherPlatformWebView(PlatformWebView* par nullptr, // requestStorageAccessConfirm nullptr, // shouldAllowDeviceOrientationAndMotionAccess nullptr, // runWebAuthenticationPanel @@ -22698,7 +21312,7 @@ index ce8aa4f20d8e0f14a51ae27d8d9440b55e0ea433..cf93f834e135f932ffba7e7101052fcb nullptr, // decidePolicyForSpeechRecognitionPermissionRequest nullptr, // decidePolicyForMediaKeySystemPermissionRequest nullptr, // queryPermission -@@ -1186,6 +1187,7 @@ void TestController::createWebViewWithOptions(const TestOptions& options) +@@ -1188,6 +1189,7 @@ void TestController::createWebViewWithOptions(const TestOptions& options) nullptr, // requestStorageAccessConfirm shouldAllowDeviceOrientationAndMotionAccess, runWebAuthenticationPanel, @@ -22908,3 +21522,32 @@ index ded307890926eaf0ca169aaef39ea08bd982a47a..2db0c0abdda702fdff9314ba341b63c5 Optional. - `secure` ?<[boolean]> Optional. - `sameSite` ?<[SameSiteAttribute]<"Strict"|"Lax"|"None">> Optional. + - `partitionKey` ?<[string]> For partitioned third-party cookies (aka [CHIPS](https://developer.mozilla.org/en-US/docs/Web/Privacy/Guides/Privacy_sandbox/Partitioned_cookies)), the partition key. Optional. ## async method: BrowserContext.addInitScript * since: v1.8 @@ -467,7 +468,7 @@ All existing background pages in the context. * since: v1.8 - returns: <[null]|[Browser]> -Returns the browser instance of the context. If it was launched as a persistent context null gets returned. +Gets the browser instance that owns the context. Returns `null` if the context is created outside of normal browser, e.g. Android or Electron. ## async method: BrowserContext.clearCookies * since: v1.8 @@ -602,6 +603,7 @@ The default browser context cannot be closed. - `httpOnly` <[boolean]> - `secure` <[boolean]> - `sameSite` <[SameSiteAttribute]<"Strict"|"Lax"|"None">> + - `partitionKey` ?<[string]> If no URLs are specified, this method returns all cookies. If URLs are specified, only cookies that affect those URLs are returned. @@ -985,6 +987,7 @@ Here are some permissions that may be supported by some browsers: * `'notifications'` * `'payment-handler'` * `'storage-access'` +* `'local-fonts'` ### option: BrowserContext.grantPermissions.origin * since: v1.8 diff --git a/docs/src/api/class-consolemessage.md b/docs/src/api/class-consolemessage.md index 347838ae42..f856dffe55 100644 --- a/docs/src/api/class-consolemessage.md +++ b/docs/src/api/class-consolemessage.md @@ -139,6 +139,12 @@ The text of the console message. ## method: ConsoleMessage.type * since: v1.8 +* langs: js, python +- returns: <[ConsoleMessageType]<"log"|"debug"|"info"|"error"|"warning"|"dir"|"dirxml"|"table"|"trace"|"clear"|"startGroup"|"startGroupCollapsed"|"endGroup"|"assert"|"profile"|"profileEnd"|"count"|"timeEnd">> + +## method: ConsoleMessage.type +* since: v1.8 +* langs: csharp, java - returns: <[string]> One of the following values: `'log'`, `'debug'`, `'info'`, `'error'`, `'warning'`, `'dir'`, `'dirxml'`, `'table'`, diff --git a/docs/src/api/class-mouse.md b/docs/src/api/class-mouse.md index 08eb74a072..1897482bac 100644 --- a/docs/src/api/class-mouse.md +++ b/docs/src/api/class-mouse.md @@ -3,6 +3,10 @@ The Mouse class operates in main-frame CSS pixels relative to the top-left corner of the viewport. +:::tip +If you want to debug where the mouse moved, you can use the [Trace viewer](../trace-viewer-intro.md) or [Playwright Inspector](../running-tests.md). A red dot showing the location of the mouse will be shown for every mouse action. +::: + Every `page` object has its own Mouse, accessible with [`property: Page.mouse`]. ```js diff --git a/docs/src/chrome-extensions-js-python.md b/docs/src/chrome-extensions-js-python.md index 5cabc1c864..53e9cae0ac 100644 --- a/docs/src/chrome-extensions-js-python.md +++ b/docs/src/chrome-extensions-js-python.md @@ -9,7 +9,7 @@ title: "Chrome extensions" Extensions only work in Chrome / Chromium launched with a persistent context. Use custom browser args at your own risk, as some of them may break Playwright functionality. ::: -The snippet below retrieves the [background page](https://developer.chrome.com/extensions/background_pages) of a [Manifest v2](https://developer.chrome.com/docs/extensions/mv2/) extension whose source is located in `./my-extension`. +The snippet below retrieves the [service worker](https://developer.chrome.com/docs/extensions/develop/concepts/service-workers) of a [Manifest v3](https://developer.chrome.com/docs/extensions/develop/migrate) extension whose source is located in `./my-extension`. Note the use of the `chromium` channel that allows to run extensions in headless mode. Alternatively, you can launch the browser in headed mode. @@ -26,11 +26,11 @@ const { chromium } = require('playwright'); `--load-extension=${pathToExtension}` ] }); - let [backgroundPage] = browserContext.backgroundPages(); - if (!backgroundPage) - backgroundPage = await browserContext.waitForEvent('backgroundpage'); + let [serviceWorker] = browserContext.serviceWorkers(); + if (!serviceWorker) + serviceWorker = await browserContext.waitForEvent('serviceworker'); - // Test the background page as you would any other page. + // Test the service worker as you would any other worker. await browserContext.close(); })(); ``` @@ -53,12 +53,12 @@ async def run(playwright: Playwright): ], ) - if len(context.background_pages) == 0: - background_page = await context.wait_for_event('backgroundpage') + if len(context.service_workers) == 0: + service_worker = await context.wait_for_event('serviceworker') else: - background_page = context.background_pages[0] + service_worker = context.service_workers[0] - # Test the background page as you would any other page. + # Test the service worker as you would any other worker. await context.close() @@ -86,12 +86,12 @@ def run(playwright: Playwright): f"--load-extension={path_to_extension}", ], ) - if len(context.background_pages) == 0: - background_page = context.wait_for_event('backgroundpage') + if len(context.service_workers) == 0: + service_worker = context.wait_for_event('serviceworker') else: - background_page = context.background_pages[0] + service_worker = context.service_workers[0] - # Test the background page as you would any other page. + # Test the service worker as you would any other worker. context.close() @@ -128,19 +128,12 @@ export const test = base.extend<{ await context.close(); }, extensionId: async ({ context }, use) => { - /* - // for manifest v2: - let [background] = context.backgroundPages() - if (!background) - background = await context.waitForEvent('backgroundpage') - */ - // for manifest v3: - let [background] = context.serviceWorkers(); - if (!background) - background = await context.waitForEvent('serviceworker'); + let [serviceWorker] = context.serviceWorkers(); + if (!serviceWorker) + serviceWorker = await context.waitForEvent('serviceworker'); - const extensionId = background.url().split('/')[2]; + const extensionId = serviceWorker.url().split('/')[2]; await use(extensionId); }, }); @@ -171,17 +164,12 @@ def context(playwright: Playwright) -> Generator[BrowserContext, None, None]: @pytest.fixture() def extension_id(context) -> Generator[str, None, None]: - # for manifest v2: - # background = context.background_pages[0] - # if not background: - # background = context.wait_for_event("backgroundpage") - # for manifest v3: - background = context.service_workers[0] - if not background: - background = context.wait_for_event("serviceworker") + service_worker = context.service_workers[0] + if not service_worker: + service_worker = context.wait_for_event("serviceworker") - extension_id = background.url.split("/")[2] + extension_id = service_worker.url.split("/")[2] yield extension_id ``` diff --git a/docs/src/clock.md b/docs/src/clock.md index 44582f450b..e898899b18 100644 --- a/docs/src/clock.md +++ b/docs/src/clock.md @@ -64,6 +64,47 @@ await page.clock.setFixedTime(new Date('2024-02-02T10:30:00')); await expect(page.getByTestId('current-time')).toHaveText('2/2/2024, 10:30:00 AM'); ``` +```python async +await page.clock.set_fixed_time(datetime.datetime(2024, 2, 2, 10, 0, 0)) +await page.goto("http://localhost:3333") +await expect(page.get_by_test_id("current-time")).to_have_text("2/2/2024, 10:00:00 AM") + +await page.clock.set_fixed_time(datetime.datetime(2024, 2, 2, 10, 30, 0)) +# We know that the page has a timer that updates the time every second. +await expect(page.get_by_test_id("current-time")).to_have_text("2/2/2024, 10:30:00 AM") +``` + +```python sync +page.clock.set_fixed_time(datetime.datetime(2024, 2, 2, 10, 0, 0)) +page.goto("http://localhost:3333") +expect(page.get_by_test_id("current-time")).to_have_text("2/2/2024, 10:00:00 AM") +page.clock.set_fixed_time(datetime.datetime(2024, 2, 2, 10, 30, 0)) +# We know that the page has a timer that updates the time every second. +expect(page.get_by_test_id("current-time")).to_have_text("2/2/2024, 10:30:00 AM") +``` + +```java +SimpleDateFormat format = new SimpleDateFormat("yyy-MM-dd'T'HH:mm:ss"); +page.clock().setFixedTime(format.parse("2024-02-02T10:00:00")); +page.navigate("http://localhost:3333"); +Locator locator = page.getByTestId("current-time"); +assertThat(locator).hasText("2/2/2024, 10:00:00 AM"); +page.clock().setFixedTime(format.parse("2024-02-02T10:30:00")); +// We know that the page has a timer that updates the time every second. +assertThat(locator).hasText("2/2/2024, 10:30:00 AM"); +``` + +```csharp +// Set the fixed time for the clock. +await Page.Clock.SetFixedTimeAsync(new DateTime(2024, 2, 2, 10, 0, 0)); +await Page.GotoAsync("http://localhost:3333"); +await Expect(Page.GetByTestId("current-time")).ToHaveTextAsync("2/2/2024, 10:00:00 AM"); +// Set the fixed time for the clock. +await Page.Clock.SetFixedTimeAsync(new DateTime(2024, 2, 2, 10, 30, 0)); +// We know that the page has a timer that updates the time every second. +await Expect(Page.GetByTestId("current-time")).ToHaveTextAsync("2/2/2024, 10:30:00 AM"); +``` + ## Consistent time and timers Sometimes your timers depend on `Date.now` and are confused when the `Date.now` value does not change over time. diff --git a/docs/src/codegen.md b/docs/src/codegen.md index 641383d7b4..7f2358bdaa 100644 --- a/docs/src/codegen.md +++ b/docs/src/codegen.md @@ -414,6 +414,30 @@ pwsh bin/Debug/netX/playwright.ps1 codegen --load-storage=auth.json github.com/m github signed in showing use of load storage scharp +#### Use existing userDataDir + +Run `codegen` with `--user-data-dir` to set a fixed [user data directory](https://playwright.dev/docs/api/class-browsertype#browser-type-launch-persistent-context-option-user-data-dir) for the browser session. If you create a custom browser user data directory, codegen will use this existing browser profile and have access to any authentication state present in that profile. + +:::warning +[As of Chrome 136, the default user data directory cannot be accessed via automated tooling](https://developer.chrome.com/blog/remote-debugging-port), such as Playwright. You must create a separate user data directory for use in testing. +::: + +```bash js +npx playwright codegen --user-data-dir=/path/to/your/browser/data/ github.com/microsoft/playwright +``` + +```bash java +mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="codegen --user-data-dir=/path/to/your/browser/data/ github.com/microsoft/playwright" +``` + +```bash python +playwright codegen --user-data-dir=/path/to/your/browser/data/ github.com/microsoft/playwright +``` + +```bash csharp +pwsh bin/Debug/netX/playwright.ps1 codegen --user-data-dir=/path/to/your/browser/data/ github.com/microsoft/playwright +``` + ## Record using custom setup If you would like to use codegen in some non-standard setup (for example, use [`method: BrowserContext.route`]), it is possible to call [`method: Page.pause`] that will open a separate window with codegen controls. diff --git a/docs/src/intro-js.md b/docs/src/intro-js.md index 9cf7614902..62d9190bf5 100644 --- a/docs/src/intro-js.md +++ b/docs/src/intro-js.md @@ -17,7 +17,11 @@ Playwright Test was created specifically to accommodate the needs of end-to-end ## Installing Playwright -Get started by installing Playwright using npm, yarn or pnpm. Alternatively you can also get started and run your tests using the [VS Code Extension](./getting-started-vscode.md). +Get started by installing Playwright using one of the following methods. + +### Using npm, yarn or pnpm + +The command below either initializes a new project with Playwright, or adds Playwright setup to your current project. - Run the install command and select the following to get started: - Choose between TypeScript or JavaScript (default is TypeScript) - - Name of your Tests folder (default is tests or e2e if you already have a tests folder in your project) + - Name of your Tests folder (default is `tests`, or `e2e` if you already have a `tests` folder in your project) - Add a GitHub Actions workflow to easily run tests on CI - Install Playwright browsers (default is true) +### Using the VS Code Extension + +Alternatively you can also get started and run your tests using the [VS Code Extension](./getting-started-vscode.md). + ## What's Installed Playwright will download the browsers needed as well as create the following files. @@ -292,7 +299,7 @@ pnpm exec playwright --version ## System requirements -- Latest version of Node.js 18, 20 or 22. +- Latest version of Node.js 20, 22 or 24. - Windows 10+, Windows Server 2016+ or Windows Subsystem for Linux (WSL). - macOS 14 Ventura, or later. - Debian 12, Ubuntu 22.04, Ubuntu 24.04, on x86-64 and arm64 architecture. diff --git a/docs/src/release-notes-csharp.md b/docs/src/release-notes-csharp.md index 2bb499a597..967d75a070 100644 --- a/docs/src/release-notes-csharp.md +++ b/docs/src/release-notes-csharp.md @@ -4,11 +4,33 @@ title: "Release notes" toc_max_heading_level: 2 --- +## Version 1.54 + +- New cookie property `PartitionKey` in [`method: BrowserContext.cookies`] and [`method: BrowserContext.addCookies`]. This property allows to save and restore partitioned cookies. See [CHIPS MDN article](https://developer.mozilla.org/en-US/docs/Web/Privacy/Guides/Privacy_sandbox/Partitioned_cookies) for more information. Note that browsers have different support and defaults for cookie partitioning. + +- New option `--user-data-dir` in multiple commands. You can specify the same user data dir to reuse browsing state, like authentication, between sessions. + ```bash + pwsh bin/Debug/netX/playwright.ps1 codegen --user-data-dir=./user-data + ``` + +- `pwsh bin/Debug/netX/playwright.ps1 open` does not open the test recorder anymore. Use `pwsh bin/Debug/netX/playwright.ps1 codegen` instead. + +### Browser Versions + +- Chromium 139.0.7258.5 +- Mozilla Firefox 140.0.2 +- WebKit 26.0 + +This version was also tested against the following stable channels: + +- Google Chrome 140 +- Microsoft Edge 140 + ## Version 1.53 ### Miscellaneous -- New Steps in Trace Viewer: +- New Steps in Trace Viewer: ![New Trace Viewer Steps](https://github.com/user-attachments/assets/1963ff7d-4070-41be-a79b-4333176921a2) - New method [`method: Locator.describe`] to describe a locator. Used for trace viewer. ```csharp @@ -31,7 +53,7 @@ This version was also tested against the following stable channels: ## Version 1.52 ### Highlights - + - New method [`method: LocatorAssertions.toContainClass`] to ergonomically assert individual class names on the element. ```csharp diff --git a/docs/src/release-notes-java.md b/docs/src/release-notes-java.md index f0ec4db107..0f699a5a85 100644 --- a/docs/src/release-notes-java.md +++ b/docs/src/release-notes-java.md @@ -4,11 +4,33 @@ title: "Release notes" toc_max_heading_level: 2 --- +## Version 1.54 + +- New cookie property `partitionKey` in [`method: BrowserContext.cookies`] and [`method: BrowserContext.addCookies`]. This property allows to save and restore partitioned cookies. See [CHIPS MDN article](https://developer.mozilla.org/en-US/docs/Web/Privacy/Guides/Privacy_sandbox/Partitioned_cookies) for more information. Note that browsers have different support and defaults for cookie partitioning. + +- New option `--user-data-dir` in multiple commands. You can specify the same user data dir to reuse browsing state, like authentication, between sessions. + ```bash + mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="codegen --user-data-dir=./user-data" + ``` + +- `open` command does not open the test recorder anymore. Use `codegen` instead. + +### Browser Versions + +- Chromium 139.0.7258.5 +- Mozilla Firefox 140.0.2 +- WebKit 26.0 + +This version was also tested against the following stable channels: + +- Google Chrome 140 +- Microsoft Edge 140 + ## Version 1.53 ### Miscellaneous -- New Steps in Trace Viewer: +- New Steps in Trace Viewer: ![New Trace Viewer Steps](https://github.com/user-attachments/assets/1963ff7d-4070-41be-a79b-4333176921a2) - New method [`method: Locator.describe`] to describe a locator. Used for trace viewer. ```java @@ -31,7 +53,7 @@ This version was also tested against the following stable channels: ## Version 1.52 ### Highlights - + - New method [`method: LocatorAssertions.toContainClass`] to ergonomically assert individual class names on the element. ```java diff --git a/docs/src/release-notes-js.md b/docs/src/release-notes-js.md index ed2911636c..92bf9edc36 100644 --- a/docs/src/release-notes-js.md +++ b/docs/src/release-notes-js.md @@ -6,11 +6,56 @@ toc_max_heading_level: 2 import LiteYouTube from '@site/src/components/LiteYouTube'; +## Version 1.54 + +### Highlights + +- New cookie property `partitionKey` in [`method: BrowserContext.cookies`] and [`method: BrowserContext.addCookies`]. This property allows to save and restore partitioned cookies. See [CHIPS MDN article](https://developer.mozilla.org/en-US/docs/Web/Privacy/Guides/Privacy_sandbox/Partitioned_cookies) for more information. Note that browsers have different support and defaults for cookie partitioning. + +- New option `noSnippets` to disable code snippets in the html report. + ```js + import { defineConfig } from '@playwright/test'; + + export default defineConfig({ + reporter: [['html', { noSnippets: true }]] + }); + ``` + +- New property `location` in test annotations, for example in [`property: TestResult.annotations`] and [`property: TestInfo.annotations`]. It shows where the annotation like `test.skip` or `test.fixme` was added. + +### Command Line + +- New option `--user-data-dir` in multiple commands. You can specify the same user data dir to reuse browsing state, like authentication, between sessions. + ```bash + npx playwright codegen --user-data-dir=./user-data + ``` + +- Option `-gv` has been removed from the `npx playwright test` command. Use `--grep-invert` instead. + +- `npx playwright open` does not open the test recorder anymore. Use `npx playwright codegen` instead. + +### Miscellaneous + +- Support for Node.js 16 has been removed. + +- Support for Node.js 18 has been deprecated, and will be removed in the future. + +### Browser Versions + +- Chromium 139.0.7258.5 +- Mozilla Firefox 140.0.2 +- WebKit 26.0 + +This version was also tested against the following stable channels: + +- Google Chrome 140 +- Microsoft Edge 140 + ## Version 1.53 ### Trace Viewer and HTML Reporter Updates -- New Steps in Trace Viewer and HTML reporter: +- New Steps in Trace Viewer and HTML reporter: ![New Trace Viewer Steps](https://github.com/user-attachments/assets/1963ff7d-4070-41be-a79b-4333176921a2) - New option in `'html'` reporter to set the title of a specific test run: ```js @@ -45,7 +90,7 @@ This version was also tested against the following stable channels: ## Version 1.52 ### Highlights - + - New method [`method: LocatorAssertions.toContainClass`] to ergonomically assert individual class names on the element. ```ts diff --git a/docs/src/release-notes-python.md b/docs/src/release-notes-python.md index ca38750f76..beeee57291 100644 --- a/docs/src/release-notes-python.md +++ b/docs/src/release-notes-python.md @@ -4,11 +4,33 @@ title: "Release notes" toc_max_heading_level: 2 --- +## Version 1.54 + +- New cookie property `partition_key` in [`method: BrowserContext.cookies`] and [`method: BrowserContext.addCookies`]. This property allows to save and restore partitioned cookies. See [CHIPS MDN article](https://developer.mozilla.org/en-US/docs/Web/Privacy/Guides/Privacy_sandbox/Partitioned_cookies) for more information. Note that browsers have different support and defaults for cookie partitioning. + +- New option `--user-data-dir` in multiple commands. You can specify the same user data dir to reuse browsing state, like authentication, between sessions. + ```bash + playwright codegen --user-data-dir=./user-data + ``` + +- `playwright open` does not open the test recorder anymore. Use `playwright codegen` instead. + +### Browser Versions + +- Chromium 139.0.7258.5 +- Mozilla Firefox 140.0.2 +- WebKit 26.0 + +This version was also tested against the following stable channels: + +- Google Chrome 140 +- Microsoft Edge 140 + ## Version 1.53 ### Miscellaneous -- New Steps in Trace Viewer: +- New Steps in Trace Viewer: ![New Trace Viewer Steps](https://github.com/user-attachments/assets/1963ff7d-4070-41be-a79b-4333176921a2) - New method [`method: Locator.describe`] to describe a locator. Used for trace viewer. ```python @@ -31,7 +53,7 @@ This version was also tested against the following stable channels: ## Version 1.52 ### Highlights - + - New method [`method: LocatorAssertions.toContainClass`] to ergonomically assert individual class names on the element. ```python diff --git a/docs/src/test-api/class-test.md b/docs/src/test-api/class-test.md index 2511f412d2..d976058aef 100644 --- a/docs/src/test-api/class-test.md +++ b/docs/src/test-api/class-test.md @@ -1425,7 +1425,7 @@ Timeout in milliseconds. Skip a test. Playwright will not run the test past the `test.skip()` call. -Skipped tests are not supposed to be ever run. If you intent to fix the test, use [`method: Test.fixme`] instead. +Skipped tests are not supposed to be ever run. If you intend to fix the test, use [`method: Test.fixme`] instead. To declare a skipped test: * `test.skip(title, body)` diff --git a/docs/src/test-api/class-testinfo.md b/docs/src/test-api/class-testinfo.md index 541a547bc1..9f577cad9c 100644 --- a/docs/src/test-api/class-testinfo.md +++ b/docs/src/test-api/class-testinfo.md @@ -19,6 +19,7 @@ test('basic test', async ({ page }, testInfo) => { - type: <[Array]<[Object]>> - `type` <[string]> Annotation type, for example `'skip'` or `'fail'`. - `description` ?<[string]> Optional description. + - `location` ?<[Location]> Optional location in the source where the annotation is added. The list of annotations applicable to the current test. Includes annotations from the test, annotations from all [`method: Test.describe`] groups the test belongs to and file-level annotations for the test file. diff --git a/docs/src/test-reporter-api/class-testcase.md b/docs/src/test-reporter-api/class-testcase.md index a3c9c2db99..22a8588fb0 100644 --- a/docs/src/test-reporter-api/class-testcase.md +++ b/docs/src/test-reporter-api/class-testcase.md @@ -9,6 +9,7 @@ - type: <[Array]<[Object]>> - `type` <[string]> Annotation type, for example `'skip'` or `'fail'`. - `description` ?<[string]> Optional description. + - `location` ?<[Location]> Optional location in the source where the annotation is added. [`property: TestResult.annotations`] of the last test run. diff --git a/docs/src/test-reporter-api/class-testresult.md b/docs/src/test-reporter-api/class-testresult.md index 263b299c49..ef41200b40 100644 --- a/docs/src/test-reporter-api/class-testresult.md +++ b/docs/src/test-reporter-api/class-testresult.md @@ -19,6 +19,7 @@ The list of files or buffers attached during the test execution through [`proper - type: <[Array]<[Object]>> - `type` <[string]> Annotation type, for example `'skip'` or `'fail'`. - `description` ?<[string]> Optional description. + - `location` ?<[Location]> Optional location in the source where the annotation is added. The list of annotations applicable to the current test. Includes: * annotations defined on the test or suite via [`method: Test.(call)`] and [`method: Test.describe`]; diff --git a/docs/src/test-reporter-api/class-teststep.md b/docs/src/test-reporter-api/class-teststep.md index a8d1c12110..84ba3abbda 100644 --- a/docs/src/test-reporter-api/class-teststep.md +++ b/docs/src/test-reporter-api/class-teststep.md @@ -58,6 +58,7 @@ List of steps inside this step. - type: <[Array]<[Object]>> - `type` <[string]> Annotation type, for example `'skip'`. - `description` ?<[string]> Optional description. + - `location` ?<[Location]> Optional location in the source where the annotation is added. The list of annotations applicable to the current test step. diff --git a/docs/src/test-reporters-js.md b/docs/src/test-reporters-js.md index 294f0466dd..f3393c6a25 100644 --- a/docs/src/test-reporters-js.md +++ b/docs/src/test-reporters-js.md @@ -102,7 +102,7 @@ List report supports the following configuration options and environment variabl | Environment Variable Name | Reporter Config Option| Description | Default |---|---|---|---| | `PLAYWRIGHT_LIST_PRINT_STEPS` | `printSteps` | Whether to print each step on its own line. | `false` -| `PLAYWRIGHT_FORCE_TTY` | | Whether to produce output suitable for a live terminal. If a number is specified, it will also be used as the terminal width. | `true` when terminal is in TTY mode, `false` otherwise. +| `PLAYWRIGHT_FORCE_TTY` | | Whether to produce output suitable for a live terminal. Supports `true`, `1`, `false`, `0`, `[WIDTH]`, and `[WIDTH]x[HEIGHT]`. `[WIDTH]` and `[WIDTH]x[HEIGHT]` specifies the TTY dimensions. | `true` when terminal is in TTY mode, `false` otherwise. | `FORCE_COLOR` | | Whether to produce colored output. | `true` when terminal is in TTY mode, `false` otherwise. @@ -140,7 +140,7 @@ Line report supports the following configuration options and environment variabl | Environment Variable Name | Reporter Config Option| Description | Default |---|---|---|---| -| `PLAYWRIGHT_FORCE_TTY` | | Whether to produce output suitable for a live terminal. If a number is specified, it will also be used as the terminal width. | `true` when terminal is in TTY mode, `false` otherwise. +| `PLAYWRIGHT_FORCE_TTY` | | Whether to produce output suitable for a live terminal. Supports `true`, `1`, `false`, `0`, `[WIDTH]`, and `[WIDTH]x[HEIGHT]`. `[WIDTH]` and `[WIDTH]x[HEIGHT]` specifies the TTY dimensions. | `true` when terminal is in TTY mode, `false` otherwise. | `FORCE_COLOR` | | Whether to produce colored output. | `true` when terminal is in TTY mode, `false` otherwise. @@ -182,7 +182,7 @@ Dot report supports the following configuration options and environment variable | Environment Variable Name | Reporter Config Option| Description | Default |---|---|---|---| -| `PLAYWRIGHT_FORCE_TTY` | | Whether to produce output suitable for a live terminal. If a number is specified, it will also be used as the terminal width. | `true` when terminal is in TTY mode, `false` otherwise. +| `PLAYWRIGHT_FORCE_TTY` | | Whether to produce output suitable for a live terminal. Supports `true`, `1`, `false`, `0`, `[WIDTH]`, and `[WIDTH]x[HEIGHT]`. `[WIDTH]` and `[WIDTH]x[HEIGHT]` specifies the TTY dimensions. | `true` when terminal is in TTY mode, `false` otherwise. | `FORCE_COLOR` | | Whether to produce colored output. | `true` when terminal is in TTY mode, `false` otherwise. ### HTML reporter @@ -252,6 +252,7 @@ HTML report supports the following configuration options and environment variabl | `PLAYWRIGHT_HTML_HOST` | `host` | When report opens in the browser, it will be served bound to this hostname. | `localhost` | `PLAYWRIGHT_HTML_PORT` | `port` | When report opens in the browser, it will be served on this port. | `9323` or any available port when `9323` is not available. | `PLAYWRIGHT_HTML_ATTACHMENTS_BASE_URL` | `attachmentsBaseURL` | A separate location where attachments from the `data` subdirectory are uploaded. Only needed when you upload report and `data` separately to different locations. | `data/` +| `PLAYWRIGHT_HTML_NO_SNIPPETS` | `noSnippets` | If true, disable rendering code snippets in the action log. If there is a top level error, that report section with code snippet will still render. Supports `true`, `1`, `false`, and `0`. | `false` ### Blob reporter diff --git a/docs/src/test-snapshots-js.md b/docs/src/test-snapshots-js.md index 6a8d42e886..5c64eccfbb 100644 --- a/docs/src/test-snapshots-js.md +++ b/docs/src/test-snapshots-js.md @@ -50,6 +50,9 @@ The snapshot name `example-test-1-chromium-darwin.png` consists of a few parts: The snapshot name and path can be configured with [`property: TestConfig.snapshotPathTemplate`] in the playwright config. +> Note that `toHaveScreenshot()` also accepts an array of path segments to the snapshot file such as `expect().toHaveScreenshot(['relative', 'path', 'to', 'snapshot.png'])`. +> However, this path must stay within the snapshots directory for each test file (i.e. `a.spec.js-snapshots`), otherwise it will throw. + ## Updating screenshots Sometimes you need to update the reference screenshot, for example when the page has changed. Do this with the `--update-snapshots` flag. @@ -58,9 +61,6 @@ Sometimes you need to update the reference screenshot, for example when the page npx playwright test --update-snapshots ``` -> Note that `snapshotName` also accepts an array of path segments to the snapshot file such as `expect().toHaveScreenshot(['relative', 'path', 'to', 'snapshot.png'])`. -> However, this path must stay within the snapshots directory for each test file (i.e. `a.spec.js-snapshots`), otherwise it will throw. - ## Options ### maxDiffPixels diff --git a/package-lock.json b/package-lock.json index 43e04e58be..285bad7b25 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "playwright-internal", - "version": "1.53.0", + "version": "1.54.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "playwright-internal", - "version": "1.53.0", + "version": "1.54.1", "license": "Apache-2.0", "workspaces": [ "packages/*" @@ -1915,6 +1915,10 @@ "resolved": "packages/playwright-ct-vue", "link": true }, + "node_modules/@playwright/mdd": { + "resolved": "packages/playwright-mdd", + "link": true + }, "node_modules/@playwright/test": { "resolved": "packages/playwright-test", "link": true @@ -2296,6 +2300,16 @@ "@types/tern": "*" } }, + "node_modules/@types/debug": { + "version": "4.1.12", + "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.12.tgz", + "integrity": "sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/ms": "*" + } + }, "node_modules/@types/estree": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.7.tgz", @@ -2354,6 +2368,13 @@ "@types/node": "*" } }, + "node_modules/@types/ms": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@types/ms/-/ms-2.1.0.tgz", + "integrity": "sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/node": { "version": "18.19.76", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.76.tgz", @@ -3572,6 +3593,15 @@ "node": ">=0.1.90" } }, + "node_modules/commander": { + "version": "13.1.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-13.1.0.tgz", + "integrity": "sha512-/rFeCpNJQbhSZjGVwO9RFV3xPqbnERS8MmIQzCtD/zl6gpJuV/bMLuN92oG3F7d8oDEHHRrujSXNUr8fpjntKw==", + "license": "MIT", + "engines": { + "node": ">=18" + } + }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -3750,9 +3780,9 @@ } }, "node_modules/debug": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", - "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.1.tgz", + "integrity": "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ==", "license": "MIT", "dependencies": { "ms": "^2.1.3" @@ -3933,10 +3963,9 @@ } }, "node_modules/dotenv": { - "version": "16.4.7", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.7.tgz", - "integrity": "sha512-47qPchRCykZC03FhkYAhrvwU4xDBFIj1QPqaarj6mdM/hgUzfPHcpkHJOn3mJAufFeeAxAzeGsr5X0M4k6fLZQ==", - "dev": true, + "version": "16.5.0", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.5.0.tgz", + "integrity": "sha512-m/C+AwOAr9/W1UOIZUo232ejMNnJAJtYQjUbHoNTBNTJSvqzzDh7vnrei3o3r3m9blf6ZoDkvcw0VmozNRFJxg==", "license": "BSD-2-Clause", "engines": { "node": ">=12" @@ -6340,6 +6369,28 @@ "node": ">=18.0.0" } }, + "node_modules/miniflare/node_modules/ws": { + "version": "8.18.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz", + "integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, "node_modules/miniflare/node_modules/zod": { "version": "3.22.3", "resolved": "https://registry.npmjs.org/zod/-/zod-3.22.3.tgz", @@ -6660,6 +6711,27 @@ "wrappy": "1" } }, + "node_modules/openai": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/openai/-/openai-5.7.0.tgz", + "integrity": "sha512-zXWawZl6J/P5Wz57/nKzVT3kJQZvogfuyuNVCdEp4/XU2UNrjL7SsuNpWAyLZbo6HVymwmnfno9toVzBhelygA==", + "license": "Apache-2.0", + "bin": { + "openai": "bin/cli" + }, + "peerDependencies": { + "ws": "^8.18.0", + "zod": "^3.23.8" + }, + "peerDependenciesMeta": { + "ws": { + "optional": true + }, + "zod": { + "optional": true + } + } + }, "node_modules/optionator": { "version": "0.9.4", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", @@ -8729,10 +8801,10 @@ "license": "ISC" }, "node_modules/ws": { - "version": "8.18.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz", - "integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==", - "dev": true, + "version": "8.18.2", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.2.tgz", + "integrity": "sha512-DMricUmwGZUVr++AEAe2uiVM7UoO9MAVZMDu05UQOaUII0lp+zOzLLU4Xqh/JvTqklB1T4uELaaPBKyjE1r4fQ==", + "devOptional": true, "license": "MIT", "engines": { "node": ">=10.0.0" @@ -8888,20 +8960,28 @@ "version": "3.24.2", "resolved": "https://registry.npmjs.org/zod/-/zod-3.24.2.tgz", "integrity": "sha512-lY7CDW43ECgW9u1TcT3IoXHflywfVqDYze4waEz812jR/bZ8FHDsl7pFQoSZTz5N+2NqRXs8GBwnAwo3ZNxqhQ==", - "dev": true, "license": "MIT", "funding": { "url": "https://github.com/sponsors/colinhacks" } }, + "node_modules/zod-to-json-schema": { + "version": "3.24.5", + "resolved": "https://registry.npmjs.org/zod-to-json-schema/-/zod-to-json-schema-3.24.5.tgz", + "integrity": "sha512-/AuWwMP+YqiPbsJx5D6TfgRTc4kTLjsh5SOcd4bLsfUg2RcEXrFMJl1DGgdHy2aCfsIA/cr/1JM0xcB2GZji8g==", + "license": "ISC", + "peerDependencies": { + "zod": "^3.24.1" + } + }, "packages/html-reporter": { "version": "0.0.0" }, "packages/playwright": { - "version": "1.53.0", + "version": "1.54.1", "license": "Apache-2.0", "dependencies": { - "playwright-core": "1.53.0" + "playwright-core": "1.54.1" }, "bin": { "playwright": "cli.js" @@ -8915,11 +8995,11 @@ }, "packages/playwright-browser-chromium": { "name": "@playwright/browser-chromium", - "version": "1.53.0", + "version": "1.54.1", "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { - "playwright-core": "1.53.0" + "playwright-core": "1.54.1" }, "engines": { "node": ">=18" @@ -8927,11 +9007,11 @@ }, "packages/playwright-browser-firefox": { "name": "@playwright/browser-firefox", - "version": "1.53.0", + "version": "1.54.1", "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { - "playwright-core": "1.53.0" + "playwright-core": "1.54.1" }, "engines": { "node": ">=18" @@ -8939,22 +9019,22 @@ }, "packages/playwright-browser-webkit": { "name": "@playwright/browser-webkit", - "version": "1.53.0", + "version": "1.54.1", "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { - "playwright-core": "1.53.0" + "playwright-core": "1.54.1" }, "engines": { "node": ">=18" } }, "packages/playwright-chromium": { - "version": "1.53.0", + "version": "1.54.1", "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { - "playwright-core": "1.53.0" + "playwright-core": "1.54.1" }, "bin": { "playwright": "cli.js" @@ -8968,7 +9048,7 @@ "version": "0.0.0", "license": "Apache-2.0", "dependencies": { - "playwright-core": "1.53.0" + "playwright-core": "1.54.1" }, "engines": { "node": ">=18" @@ -8983,7 +9063,7 @@ } }, "packages/playwright-core": { - "version": "1.53.0", + "version": "1.54.1", "license": "Apache-2.0", "bin": { "playwright-core": "cli.js" @@ -8994,11 +9074,11 @@ }, "packages/playwright-ct-core": { "name": "@playwright/experimental-ct-core", - "version": "1.53.0", + "version": "1.54.1", "license": "Apache-2.0", "dependencies": { - "playwright": "1.53.0", - "playwright-core": "1.53.0", + "playwright": "1.54.1", + "playwright-core": "1.54.1", "vite": "^6.3.4" }, "engines": { @@ -9007,10 +9087,10 @@ }, "packages/playwright-ct-react": { "name": "@playwright/experimental-ct-react", - "version": "1.53.0", + "version": "1.54.1", "license": "Apache-2.0", "dependencies": { - "@playwright/experimental-ct-core": "1.53.0", + "@playwright/experimental-ct-core": "1.54.1", "@vitejs/plugin-react": "^4.2.1" }, "bin": { @@ -9022,10 +9102,10 @@ }, "packages/playwright-ct-react17": { "name": "@playwright/experimental-ct-react17", - "version": "1.53.0", + "version": "1.54.1", "license": "Apache-2.0", "dependencies": { - "@playwright/experimental-ct-core": "1.53.0", + "@playwright/experimental-ct-core": "1.54.1", "@vitejs/plugin-react": "^4.2.1" }, "bin": { @@ -9037,10 +9117,10 @@ }, "packages/playwright-ct-svelte": { "name": "@playwright/experimental-ct-svelte", - "version": "1.53.0", + "version": "1.54.1", "license": "Apache-2.0", "dependencies": { - "@playwright/experimental-ct-core": "1.53.0", + "@playwright/experimental-ct-core": "1.54.1", "@sveltejs/vite-plugin-svelte": "^3.0.1" }, "bin": { @@ -9598,10 +9678,10 @@ }, "packages/playwright-ct-vue": { "name": "@playwright/experimental-ct-vue", - "version": "1.53.0", + "version": "1.54.1", "license": "Apache-2.0", "dependencies": { - "@playwright/experimental-ct-core": "1.53.0", + "@playwright/experimental-ct-core": "1.54.1", "@vitejs/plugin-vue": "^5.2.0" }, "bin": { @@ -9612,11 +9692,11 @@ } }, "packages/playwright-firefox": { - "version": "1.53.0", + "version": "1.54.1", "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { - "playwright-core": "1.53.0" + "playwright-core": "1.54.1" }, "bin": { "playwright": "cli.js" @@ -9646,12 +9726,50 @@ "node": ">=18" } }, + "packages/playwright-mdd": { + "name": "@playwright/mdd", + "version": "0.0.1", + "license": "Apache-2.0", + "dependencies": { + "commander": "^13.1.0", + "debug": "^4.4.1", + "dotenv": "^16.5.0", + "mime": "^4.0.7", + "openai": "^5.7.0", + "playwright-core": "1.54.1", + "zod-to-json-schema": "^3.24.4" + }, + "bin": { + "playwright-mdd": "cli.js" + }, + "devDependencies": { + "@types/debug": "^4.1.7" + }, + "engines": { + "node": ">=18" + } + }, + "packages/playwright-mdd/node_modules/mime": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/mime/-/mime-4.0.7.tgz", + "integrity": "sha512-2OfDPL+e03E0LrXaGYOtTFIYhiuzep94NSsuhrNULq+stylcJedcHdzHtz0atMUuGwJfFYs0YL5xeC/Ca2x0eQ==", + "funding": [ + "https://github.com/sponsors/broofa" + ], + "license": "MIT", + "bin": { + "mime": "bin/cli.js" + }, + "engines": { + "node": ">=16" + } + }, "packages/playwright-test": { "name": "@playwright/test", - "version": "1.53.0", + "version": "1.54.1", "license": "Apache-2.0", "dependencies": { - "playwright": "1.53.0" + "playwright": "1.54.1" }, "bin": { "playwright": "cli.js" @@ -9678,11 +9796,11 @@ } }, "packages/playwright-webkit": { - "version": "1.53.0", + "version": "1.54.1", "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { - "playwright-core": "1.53.0" + "playwright-core": "1.54.1" }, "bin": { "playwright": "cli.js" diff --git a/package.json b/package.json index 450a864cf5..206ad71235 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "playwright-internal", "private": true, - "version": "1.53.0", + "version": "1.54.1", "description": "A high-level API to automate web browsers", "repository": { "type": "git", @@ -44,7 +44,8 @@ "roll": "node utils/roll_browser.js", "check-deps": "node utils/check_deps.js", "build-android-driver": "./utils/build_android_driver.sh", - "innerloop": "playwright run-server --reuse-browser" + "innerloop": "playwright run-server --reuse-browser", + "mdd": "playwright-mdd run packages/playwright-mdd/specs/integration.spec.md -o packages/playwright-mdd/tests/integration.spec.ts" }, "workspaces": [ "packages/*" diff --git a/packages/html-reporter/src/filter.ts b/packages/html-reporter/src/filter.ts index 135336e869..7e54c98d4d 100644 --- a/packages/html-reporter/src/filter.ts +++ b/packages/html-reporter/src/filter.ts @@ -29,7 +29,10 @@ export class Filter { annotations: FilterToken[] = []; empty(): boolean { - return this.project.length + this.status.length + this.text.length === 0; + return ( + this.project.length + this.status.length + this.text.length + + this.labels.length + this.annotations.length + ) === 0; } static parse(expression: string): Filter { @@ -207,12 +210,16 @@ function cacheSearchValues(test: TestCaseSummary & { [searchValuesSymbol]?: Sear return searchValues; } -export function filterWithToken(tokens: string[], token: string, append: boolean): string { - if (append) { - if (!tokens.includes(token)) - return '#?q=' + [...tokens, token].join(' ').trim(); - return '#?q=' + tokens.filter(t => t !== token).join(' ').trim(); - } +// Extract quoted groups of search params, or tokens separated by whitespace +const SEARCH_PARAM_GROUP_REGEX = /("[^"]*"|"[^"]*$|\S+)/g; + +export function filterWithQuery(existingQuery: string, token: string, append: boolean): string { + const tokens = [...existingQuery.matchAll(SEARCH_PARAM_GROUP_REGEX)].map(m => { + const rawValue = m[0]; + return rawValue.startsWith('"') && rawValue.endsWith('"') && rawValue.length > 1 ? rawValue.slice(1, rawValue.length - 1) : rawValue; + }); + if (append) + return '#?q=' + joinTokens(!tokens.includes(token) ? [...tokens, token] : tokens.filter(t => t !== token)); // if metaKey or ctrlKey is not pressed, replace existing token with new token let prefix: 's:' | 'p:' | '@'; @@ -225,5 +232,9 @@ export function filterWithToken(tokens: string[], token: string, append: boolean const newTokens = tokens.filter(t => !t.startsWith(prefix)); newTokens.push(token); - return '#?q=' + newTokens.join(' ').trim(); + return '#?q=' + joinTokens(newTokens); +} + +function joinTokens(tokens: string[]): string { + return tokens.map(token => /\s/.test(token) ? `"${token}"` : token).join(' ').trim(); } diff --git a/packages/html-reporter/src/headerView.tsx b/packages/html-reporter/src/headerView.tsx index bd4e178b55..c0804a6681 100644 --- a/packages/html-reporter/src/headerView.tsx +++ b/packages/html-reporter/src/headerView.tsx @@ -22,7 +22,8 @@ import './headerView.css'; import * as icons from './icons'; import { Link, navigate, SearchParamsContext } from './links'; import { statusIcon } from './statusIcon'; -import { filterWithToken } from './filter'; +import { filterWithQuery } from './filter'; +import { linkifyText } from '@web/renderUtils'; export const HeaderView: React.FC<{ title: string | undefined, @@ -35,7 +36,7 @@ export const HeaderView: React.FC<{
{rightSuperHeader} - {title &&
{title}
} + {title &&
{linkifyText(title)}
} ; }; @@ -82,21 +83,20 @@ const StatsNavView: React.FC<{ }> = ({ stats }) => { const searchParams = React.useContext(SearchParamsContext); const q = searchParams.get('q')?.toString() || ''; - const tokens = q.split(' '); return ; diff --git a/packages/html-reporter/src/links.css b/packages/html-reporter/src/links.css index 4abe8a6caa..29dc2fc0c6 100644 --- a/packages/html-reporter/src/links.css +++ b/packages/html-reporter/src/links.css @@ -110,3 +110,39 @@ right: 5px; top: 5px; } + +.link-badge { + flex: none; + background-color: transparent; + border-color: transparent; +} + +.link-badge-dim span { + color: var(--color-fg-muted); +} + +.link-badge:hover { + cursor: pointer; +} + +.link-badge svg { + fill: var(--color-fg-default); +} + +.link-badge-dim svg { + fill: var(--color-fg-muted); +} + +.link-badge-dim:hover svg { + fill: var(--color-fg-muted); +} + +.trace-link { + /* Trace link button has 1px border and 4px padding, so we need 3px right margin to match content on the other side of divider */ + margin-right: 3px; +} + +.trace-link-separator { + color: var(--color-fg-muted); + user-select: none; +} diff --git a/packages/html-reporter/src/links.tsx b/packages/html-reporter/src/links.tsx index f0054fb501..4614a22da8 100644 --- a/packages/html-reporter/src/links.tsx +++ b/packages/html-reporter/src/links.tsx @@ -22,6 +22,7 @@ import { CopyToClipboard } from './copyToClipboard'; import './links.css'; import { linkifyText } from '@web/renderUtils'; import { clsx, useFlash } from '@web/uiUtils'; +import { trace } from './icons'; export function navigate(href: string | URL) { window.history.pushState({}, '', href); @@ -37,14 +38,15 @@ export const Route: React.FunctionComponent<{ return predicate(searchParams) ? children : null; }; -export const Link: React.FunctionComponent<{ +type LinkProps = React.PropsWithChildren<{ href?: string, click?: string, ctrlClick?: string, className?: string, title?: string, - children: any, -}> = ({ click, ctrlClick, children, ...rest }) => { +}>; + +export const Link: React.FunctionComponent = ({ click, ctrlClick, children, ...rest }) => { return { if (click) { e.preventDefault(); @@ -53,6 +55,8 @@ export const Link: React.FunctionComponent<{ }}>{children}; }; +export const LinkBadge: React.FunctionComponent = ({ className, ...props }) => ; + export const ProjectLink: React.FunctionComponent<{ projectNames: string[], projectName: string, @@ -100,6 +104,26 @@ export const AttachmentLink: React.FunctionComponent<{ } : undefined} depth={0} style={{ lineHeight: '32px' }} flash={flash}>; }; +export const TraceLink: React.FC<{ test: TestCaseSummary, trailingSeparator?: boolean, dim?: boolean }> = ({ test, trailingSeparator, dim }) => { + const firstTraces = test.results.map(result => result.attachments.filter(attachment => attachment.name === 'trace')).filter(traces => traces.length > 0)[0]; + if (!firstTraces) + return undefined; + + return ( + <> + + {trace()} + View Trace + + {trailingSeparator &&
|
} + + ); +}; + export const SearchParamsContext = React.createContext(new URLSearchParams(window.location.hash.slice(1))); export const SearchParamsProvider: React.FunctionComponent = ({ children }) => { diff --git a/packages/html-reporter/src/testCaseView.css b/packages/html-reporter/src/testCaseView.css index b070503668..6ee692d6fd 100644 --- a/packages/html-reporter/src/testCaseView.css +++ b/packages/html-reporter/src/testCaseView.css @@ -39,7 +39,6 @@ flex: none; align-items: center; padding: 0 8px 8px; - line-height: 24px; } .test-case-run-duration { diff --git a/packages/html-reporter/src/testCaseView.tsx b/packages/html-reporter/src/testCaseView.tsx index d80049ca33..68125e19f9 100644 --- a/packages/html-reporter/src/testCaseView.tsx +++ b/packages/html-reporter/src/testCaseView.tsx @@ -20,7 +20,7 @@ import * as React from 'react'; import { TabbedPane } from './tabbedPane'; import { AutoChip } from './chip'; import './common.css'; -import { Link, ProjectLink, SearchParamsContext, testResultHref } from './links'; +import { Link, ProjectLink, SearchParamsContext, testResultHref, TraceLink } from './links'; import { statusIcon } from './statusIcon'; import './testCaseView.css'; import { TestResultView } from './testResultView'; @@ -56,13 +56,14 @@ export const TestCaseView: React.FC<{
next »
} /> -
+
{test.location.file}:{test.location.line}
+
{msToString(test.duration)}
{(!!test.projectName || labels) &&
diff --git a/packages/html-reporter/src/testErrorView.tsx b/packages/html-reporter/src/testErrorView.tsx index 7639e3577b..6fa7bc50ec 100644 --- a/packages/html-reporter/src/testErrorView.tsx +++ b/packages/html-reporter/src/testErrorView.tsx @@ -47,16 +47,10 @@ export const PromptButton: React.FC<{ prompt: string }> = ({ prompt }) => { }; export const TestScreenshotErrorView: React.FC<{ - errorPrefix?: string, diff: ImageDiff, - errorSuffix?: string, -}> = ({ errorPrefix, diff, errorSuffix }) => { - const prefixHtml = React.useMemo(() => ansiErrorToHtml(errorPrefix), [errorPrefix]); - const suffixHtml = React.useMemo(() => ansiErrorToHtml(errorSuffix), [errorSuffix]); +}> = ({ diff }) => { return
-
-
; }; diff --git a/packages/html-reporter/src/testFileView.css b/packages/html-reporter/src/testFileView.css index 489cce61ba..c071781ce1 100644 --- a/packages/html-reporter/src/testFileView.css +++ b/packages/html-reporter/src/testFileView.css @@ -51,28 +51,6 @@ margin-right: 10px; } -.test-file-badge { - flex: none; - background-color: transparent; - border-color: transparent; -} - -.test-file-badge span { - color: var(--color-fg-muted); -} - -.test-file-badge:hover { - cursor: pointer; -} - -.test-file-badge svg { - fill: var(--color-fg-muted); -} - -.test-file-badge:hover svg { - fill: var(--color-fg-muted); -} - .test-file-test-outcome-skipped { color: var(--color-fg-muted); } diff --git a/packages/html-reporter/src/testFileView.tsx b/packages/html-reporter/src/testFileView.tsx index 24e9011219..ed26b1fc5f 100644 --- a/packages/html-reporter/src/testFileView.tsx +++ b/packages/html-reporter/src/testFileView.tsx @@ -18,11 +18,11 @@ import type { TestCaseSummary, TestFileSummary } from './types'; import * as React from 'react'; import { hashStringToInt, msToString } from './utils'; import { Chip } from './chip'; -import { filterWithToken } from './filter'; -import { generateTraceUrl, Link, navigate, ProjectLink, SearchParamsContext, testResultHref } from './links'; +import { filterWithQuery } from './filter'; +import { Link, LinkBadge, navigate, ProjectLink, SearchParamsContext, testResultHref, TraceLink } from './links'; import { statusIcon } from './statusIcon'; import './testFileView.css'; -import { video, image, trace } from './icons'; +import { video, image } from './icons'; import { clsx } from '@web/uiUtils'; export const TestFileView: React.FC {imageDiffBadge(test)} {videoBadge(test)} - {traceBadge(test)} +
)} @@ -75,28 +75,14 @@ function imageDiffBadge(test: TestCaseSummary): JSX.Element | undefined { for (const result of test.results) { for (const attachment of result.attachments) { if (attachment.contentType.startsWith('image/') && !!attachment.name.match(/-(expected|actual|diff)/)) - return {image()}; + return {image()}; } } } function videoBadge(test: TestCaseSummary): JSX.Element | undefined { const resultWithVideo = test.results.find(result => result.attachments.some(attachment => attachment.name === 'video')); - return resultWithVideo ? {video()} : undefined; -} - -function traceBadge(test: TestCaseSummary): JSX.Element | undefined { - const firstTraces = test.results.map(result => result.attachments.filter(attachment => attachment.name === 'trace')).filter(traces => traces.length > 0)[0]; - if (!firstTraces) - return undefined; - - return - {trace()} - View Trace - ; + return resultWithVideo ? {video()} : undefined; } const LabelsClickView: React.FC { e.preventDefault(); const q = searchParams.get('q')?.toString() || ''; - const tokens = q.split(' '); - navigate(filterWithToken(tokens, label, e.metaKey || e.ctrlKey)); + navigate(filterWithQuery(q, label, e.metaKey || e.ctrlKey)); }; return labels.length > 0 ? ( diff --git a/packages/html-reporter/src/testResultView.tsx b/packages/html-reporter/src/testResultView.tsx index b023c27981..c8f8f04029 100644 --- a/packages/html-reporter/src/testResultView.tsx +++ b/packages/html-reporter/src/testResultView.tsx @@ -86,7 +86,7 @@ export const TestResultView: React.FC<{ [...screenshots, ...videos, ...traces].forEach(a => otherAttachments.delete(a)); const otherAttachmentAnchors = [...otherAttachments].map(a => `attachment-${attachments.indexOf(a)}`); const diffs = groupImageDiffs(screenshots, result); - const errors = classifyErrors(result.errors.map(e => e.message), diffs); + const errors = result.errors.map(e => e.message); return { screenshots: [...screenshots], videos, traces, otherAttachments, diffs, errors, otherAttachmentAnchors, screenshotAnchors, errorContext }; }, [result]); @@ -111,9 +111,11 @@ export const TestResultView: React.FC<{ )} {errors.map((error, index) => { - if (error.type === 'screenshot') - return ; - return ; + const diff = pickDiffForError(error, diffs); + return <> + + {diff && } + ; })} } {!!result.steps.length && @@ -167,29 +169,11 @@ export const TestResultView: React.FC<{ ; }; -function classifyErrors(testErrors: string[], diffs: ImageDiff[]) { - return testErrors.map(error => { - const firstLine = error.split('\n')[0]; - if (firstLine.includes('toHaveScreenshot') || firstLine.includes('toMatchSnapshot')) { - const matchingDiff = diffs.find(diff => { - const attachmentName = diff.actual?.attachment.name; - return attachmentName && error.includes(attachmentName); - }); - - if (matchingDiff) { - const lines = error.split('\n'); - const index = lines.findIndex(line => /Expected:|Previous:|Received:/.test(line)); - const errorPrefix = index !== -1 ? lines.slice(0, index).join('\n') : lines[0]; - - const diffIndex = lines.findIndex(line => / +Diff:/.test(line)); - const errorSuffix = diffIndex !== -1 ? lines.slice(diffIndex + 2).join('\n') : lines.slice(1).join('\n'); - - return { type: 'screenshot', diff: matchingDiff, errorPrefix, errorSuffix }; - } - } - - return { type: 'regular', error }; - }); +function pickDiffForError(error: string, diffs: ImageDiff[]): ImageDiff | undefined { + const firstLine = error.split('\n')[0]; + if (!firstLine.includes('toHaveScreenshot') && !firstLine.includes('toMatchSnapshot')) + return undefined; + return diffs.find(diff => error.includes(diff.name)); } const StepTreeItem: React.FC<{ diff --git a/packages/injected/src/ariaSnapshot.ts b/packages/injected/src/ariaSnapshot.ts index a75a5cd185..2088b81cdc 100644 --- a/packages/injected/src/ariaSnapshot.ts +++ b/packages/injected/src/ariaSnapshot.ts @@ -16,7 +16,7 @@ import { escapeRegExp, longestCommonSubstring, normalizeWhiteSpace } from '@isomorphic/stringUtils'; -import { box, getElementComputedStyle, getGlobalOptions, isElementVisible } from './domUtils'; +import { box, getElementComputedStyle, isElementVisible } from './domUtils'; import * as roleUtils from './roleUtils'; import { yamlEscapeKeyIfNeeded, yamlEscapeValueIfNeeded } from './yaml'; @@ -37,6 +37,7 @@ export type AriaNode = AriaProps & { export type AriaSnapshot = { root: AriaNode; elements: Map; + refs: Map; }; type AriaRef = { @@ -53,14 +54,18 @@ export function generateAriaTree(rootElement: Element, options?: { forAI?: boole const snapshot: AriaSnapshot = { root: { role: 'fragment', name: '', children: [], element: rootElement, props: {}, box: box(rootElement), receivesPointerEvents: true }, elements: new Map(), + refs: new Map(), }; - const visit = (ariaNode: AriaNode, node: Node) => { + const visit = (ariaNode: AriaNode, node: Node, parentElementVisible: boolean) => { if (visited.has(node)) return; visited.add(node); if (node.nodeType === Node.TEXT_NODE && node.nodeValue) { + if (!parentElementVisible) + return; + const text = node.nodeValue; // should not report AAA as a child of the textarea. if (ariaNode.role !== 'textbox' && text) @@ -72,10 +77,8 @@ export function generateAriaTree(rootElement: Element, options?: { forAI?: boole return; const element = node as Element; - let isVisible = !roleUtils.isElementHiddenForAria(element); - if (options?.forAI) - isVisible = isVisible || isElementVisible(element); - if (!isVisible) + const isElementHiddenForAria = roleUtils.isElementHiddenForAria(element); + if (isElementHiddenForAria && !options?.forAI) return; const ariaChildren: Element[] = []; @@ -88,16 +91,19 @@ export function generateAriaTree(rootElement: Element, options?: { forAI?: boole } } - const childAriaNode = toAriaNode(element, options); + const visible = !isElementHiddenForAria || isElementVisible(element); + const childAriaNode = visible ? toAriaNode(element, options) : null; if (childAriaNode) { - if (childAriaNode.ref) + if (childAriaNode.ref) { snapshot.elements.set(childAriaNode.ref, element); + snapshot.refs.set(element, childAriaNode.ref); + } ariaNode.children.push(childAriaNode); } - processElement(childAriaNode || ariaNode, element, ariaChildren); + processElement(childAriaNode || ariaNode, element, ariaChildren, visible); }; - function processElement(ariaNode: AriaNode, element: Element, ariaChildren: Element[] = []) { + function processElement(ariaNode: AriaNode, element: Element, ariaChildren: Element[], parentElementVisible: boolean) { // Surround every element with spaces for the sake of concatenated text nodes. const display = getElementComputedStyle(element)?.display || 'inline'; const treatAsBlock = (display !== 'inline' || element.nodeName === 'BR') ? ' ' : ''; @@ -108,20 +114,20 @@ export function generateAriaTree(rootElement: Element, options?: { forAI?: boole const assignedNodes = element.nodeName === 'SLOT' ? (element as HTMLSlotElement).assignedNodes() : []; if (assignedNodes.length) { for (const child of assignedNodes) - visit(ariaNode, child); + visit(ariaNode, child, parentElementVisible); } else { for (let child = element.firstChild; child; child = child.nextSibling) { if (!(child as Element | Text).assignedSlot) - visit(ariaNode, child); + visit(ariaNode, child, parentElementVisible); } if (element.shadowRoot) { for (let child = element.shadowRoot.firstChild; child; child = child.nextSibling) - visit(ariaNode, child); + visit(ariaNode, child, parentElementVisible); } } for (const child of ariaChildren) - visit(ariaNode, child); + visit(ariaNode, child, parentElementVisible); ariaNode.children.push(roleUtils.getCSSContent(element, '::after') || ''); @@ -139,7 +145,7 @@ export function generateAriaTree(rootElement: Element, options?: { forAI?: boole roleUtils.beginAriaCaches(); try { - visit(snapshot.root, rootElement); + visit(snapshot.root, rootElement, true); } finally { roleUtils.endAriaCaches(); } @@ -163,6 +169,7 @@ function ariaRef(element: Element, role: string, name: string, options?: { forAI } function toAriaNode(element: Element, options?: { forAI?: boolean, refPrefix?: string }): AriaNode | null { + const active = element.ownerDocument.activeElement === element; if (element.nodeName === 'IFRAME') { return { role: 'iframe', @@ -172,7 +179,8 @@ function toAriaNode(element: Element, options?: { forAI?: boolean, refPrefix?: s props: {}, element, box: box(element), - receivesPointerEvents: true + receivesPointerEvents: true, + active }; } @@ -192,7 +200,8 @@ function toAriaNode(element: Element, options?: { forAI?: boolean, refPrefix?: s props: {}, element, box: box(element), - receivesPointerEvents + receivesPointerEvents, + active }; if (roleUtils.kAriaCheckedRoles.includes(role)) @@ -214,7 +223,7 @@ function toAriaNode(element: Element, options?: { forAI?: boolean, refPrefix?: s result.selected = roleUtils.getAriaSelected(element); if (element instanceof HTMLInputElement || element instanceof HTMLTextAreaElement) { - if (element.type !== 'checkbox' && element.type !== 'radio' && (element.type !== 'file' || getGlobalOptions().inputFileRoleTextbox)) + if (element.type !== 'checkbox' && element.type !== 'radio' && element.type !== 'file') result.children = [element.value]; } @@ -431,6 +440,8 @@ export function renderAriaTree(ariaSnapshot: AriaSnapshot, options?: { mode?: 'r key += ` [disabled]`; if (ariaNode.expanded) key += ` [expanded]`; + if (ariaNode.active && options?.forAI) + key += ` [active]`; if (ariaNode.level) key += ` [level=${ariaNode.level}]`; if (ariaNode.pressed === 'mixed') diff --git a/packages/injected/src/domUtils.ts b/packages/injected/src/domUtils.ts index eb97e04a8b..e11d647694 100644 --- a/packages/injected/src/domUtils.ts +++ b/packages/injected/src/domUtils.ts @@ -16,7 +16,6 @@ type GlobalOptions = { browserNameForWorkarounds?: string; - inputFileRoleTextbox?: boolean; }; let globalOptions: GlobalOptions = {}; export function setGlobalOptions(options: GlobalOptions) { diff --git a/packages/injected/src/highlight.ts b/packages/injected/src/highlight.ts index 1bc011f357..3a442a51b5 100644 --- a/packages/injected/src/highlight.ts +++ b/packages/injected/src/highlight.ts @@ -61,7 +61,7 @@ export class Highlight { this._glassPaneElement.style.right = '0'; this._glassPaneElement.style.bottom = '0'; this._glassPaneElement.style.left = '0'; - this._glassPaneElement.style.zIndex = '2147483646'; + this._glassPaneElement.style.zIndex = '2147483647'; this._glassPaneElement.style.pointerEvents = 'none'; this._glassPaneElement.style.display = 'flex'; this._glassPaneElement.style.backgroundColor = 'transparent'; @@ -90,7 +90,9 @@ export class Highlight { install() { // NOTE: document.documentElement can be null: https://github.com/microsoft/TypeScript/issues/50078 - if (this._injectedScript.document.documentElement && !this._injectedScript.document.documentElement.contains(this._glassPaneElement)) + if (!this._injectedScript.document.documentElement) + return; + if (!this._injectedScript.document.documentElement.contains(this._glassPaneElement) || this._glassPaneElement.nextElementSibling) this._injectedScript.document.documentElement.appendChild(this._glassPaneElement); } diff --git a/packages/injected/src/injectedScript.ts b/packages/injected/src/injectedScript.ts index 05a1c9eb97..e315b9d324 100644 --- a/packages/injected/src/injectedScript.ts +++ b/packages/injected/src/injectedScript.ts @@ -47,15 +47,14 @@ import type { ElementText, TextMatcher } from './selectorUtils'; import type { Builtins } from './utilityScript'; -export type FrameExpectParams = Omit & { expectedValue?: any }; +export type FrameExpectParams = Omit & { expectedValue?: any }; export type ElementState = 'visible' | 'hidden' | 'enabled' | 'disabled' | 'editable' | 'checked' | 'unchecked' | 'indeterminate' | 'stable'; export type ElementStateWithoutStable = Exclude; export type ElementStateQueryResult = { matches: boolean, received?: string | 'error:notconnected' }; -export type HitTargetError = { hitTargetDescription: string, hasPositionStickyOrFixed: boolean }; export type HitTargetInterceptionResult = { - stop: () => 'done' | HitTargetError; + stop: () => 'done' | { hitTargetDescription: string }; }; interface WebKitLegacyDeviceOrientationEvent extends DeviceOrientationEvent { @@ -73,7 +72,6 @@ export type InjectedScriptOptions = { testIdAttributeName: string; stableRafCount: number; browserName: string; - inputFileRoleTextbox: boolean; customEngines: { name: string, source: string }[]; }; @@ -236,7 +234,7 @@ export class InjectedScript { this._stableRafCount = options.stableRafCount; this._browserName = options.browserName; - setGlobalOptions({ browserNameForWorkarounds: options.browserName, inputFileRoleTextbox: options.inputFileRoleTextbox }); + setGlobalOptions({ browserNameForWorkarounds: options.browserName }); this._setupGlobalListenersRemovalDetection(); this._setupHitTargetInterceptors(); @@ -306,6 +304,12 @@ export class InjectedScript { return renderAriaTree(this._lastAriaSnapshot, options); } + ariaSnapshotForRecorder(): { ariaSnapshot: string, refs: Map } { + const tree = generateAriaTree(this.document.body, { forAI: true }); + const ariaSnapshot = renderAriaTree(tree, { forAI: true }); + return { ariaSnapshot, refs: tree.refs }; + } + getAllByAria(document: Document, template: AriaTemplateNode): Element[] { return getAllByAria(document.documentElement, template); } @@ -750,7 +754,7 @@ export class InjectedScript { throw this.createStacklessError(`Unexpected element state "${state}"`); } - selectOptions(node: Node, optionsToSelect: (Node | { valueOrLabel?: string, value?: string, label?: string, index?: number })[]): string[] | 'error:notconnected' | 'error:optionsnotfound' { + selectOptions(node: Node, optionsToSelect: (Node | { valueOrLabel?: string, value?: string, label?: string, index?: number })[]): string[] | 'error:notconnected' | 'error:optionsnotfound' | 'error:optionnotenabled' { const element = this.retarget(node, 'follow-label'); if (!element) return 'error:notconnected'; @@ -778,6 +782,8 @@ export class InjectedScript { }; if (!remainingOptionsToSelect.some(filter)) continue; + if (!this.elementState(option, 'enabled').matches) + return 'error:optionnotenabled'; selectedOptions.push(option); if (select.multiple) { remainingOptionsToSelect = remainingOptionsToSelect.filter(o => !filter(o)); @@ -924,7 +930,7 @@ export class InjectedScript { input.dispatchEvent(new Event('change', { bubbles: true })); } - expectHitTarget(hitPoint: { x: number, y: number }, targetElement: Element): 'done' | HitTargetError { + expectHitTarget(hitPoint: { x: number, y: number }, targetElement: Element) { const roots: (Document | ShadowRoot)[] = []; // Get all component roots leading to the target element. @@ -977,21 +983,14 @@ export class InjectedScript { // Check whether hit target is the target or its descendant. const hitParents: Element[] = []; - const isHitParentPositionStickyOrFixed: boolean[] = []; while (hitElement && hitElement !== targetElement) { hitParents.push(hitElement); - isHitParentPositionStickyOrFixed.push(['sticky', 'fixed'].includes(this.window.getComputedStyle(hitElement).position)); hitElement = parentElementOrShadowHost(hitElement); } if (hitElement === targetElement) return 'done'; - // The description of the element that was hit instead of the target element. const hitTargetDescription = this.previewNode(hitParents[0] || this.document.documentElement); - // Whether any ancestor of the hit target has position: static. In this case, it could be - // beneficial to scroll the target element into different positions to reveal it. - let hasPositionStickyOrFixed = isHitParentPositionStickyOrFixed.some(x => x); - // Root is the topmost element in the hitTarget's chain that is not in the // element's chain. For example, it might be a dialog element that overlays // the target. @@ -1002,14 +1001,13 @@ export class InjectedScript { if (index !== -1) { if (index > 1) rootHitTargetDescription = this.previewNode(hitParents[index - 1]); - hasPositionStickyOrFixed = isHitParentPositionStickyOrFixed.slice(0, index).some(x => x); break; } element = parentElementOrShadowHost(element); } if (rootHitTargetDescription) - return { hitTargetDescription: `${hitTargetDescription} from ${rootHitTargetDescription} subtree`, hasPositionStickyOrFixed }; - return { hitTargetDescription, hasPositionStickyOrFixed }; + return { hitTargetDescription: `${hitTargetDescription} from ${rootHitTargetDescription} subtree` }; + return { hitTargetDescription }; } // Life of a pointer action, for example click. @@ -1042,7 +1040,7 @@ export class InjectedScript { // 2k. (injected) Event interceptor is removed. // 2l. All navigations triggered between 2g-2k are awaited to be either committed or canceled. // 2m. If failed, wait for increasing amount of time before the next retry. - setupHitTargetInterceptor(node: Node, action: 'hover' | 'tap' | 'mouse' | 'drag', hitPoint: { x: number, y: number } | undefined, blockAllEvents: boolean): HitTargetInterceptionResult | 'error:notconnected' | string /* JSON.stringify(hitTargetDescription) */ { + setupHitTargetInterceptor(node: Node, action: 'hover' | 'tap' | 'mouse' | 'drag', hitPoint: { x: number, y: number } | undefined, blockAllEvents: boolean): HitTargetInterceptionResult | 'error:notconnected' | string /* hitTargetDescription */ { const element = this.retarget(node, 'button-link'); if (!element || !element.isConnected) return 'error:notconnected'; @@ -1052,7 +1050,7 @@ export class InjectedScript { // intercepting the action. const preliminaryResult = this.expectHitTarget(hitPoint, element); if (preliminaryResult !== 'done') - return JSON.stringify(preliminaryResult); + return preliminaryResult.hitTargetDescription; } // When dropping, the "element that is being dragged" often stays under the cursor, @@ -1067,7 +1065,7 @@ export class InjectedScript { 'tap': this._tapHitTargetInterceptorEvents, 'mouse': this._mouseHitTargetInterceptorEvents, }[action]; - let result: 'done' | HitTargetError | undefined; + let result: 'done' | { hitTargetDescription: string } | undefined; const listener = (event: PointerEvent | MouseEvent | TouchEvent) => { // Ignore events that we do not expect to intercept. @@ -1349,6 +1347,16 @@ export class InjectedScript { // expect(locator).not.toBeInViewport() passes when there is no element. if (options.isNot && options.expression === 'to.be.in.viewport') return { matches: false }; + if (options.expression === 'to.have.title' && options?.expectedText?.[0]) { + const matcher = new ExpectedTextMatcher(options.expectedText[0]); + const received = this.document.title; + return { received, matches: matcher.matches(received) }; + } + if (options.expression === 'to.have.url' && options?.expectedText?.[0]) { + const matcher = new ExpectedTextMatcher(options.expectedText[0]); + const received = this.document.location.href; + return { received, matches: matcher.matches(received) }; + } // When none of the above applies, expect does not match. return { matches: options.isNot, missingReceived: true }; } @@ -1498,10 +1506,6 @@ export class InjectedScript { received = getElementAccessibleErrorMessage(element); } else if (expression === 'to.have.role') { received = getAriaRole(element) || ''; - } else if (expression === 'to.have.title') { - received = this.document.title; - } else if (expression === 'to.have.url') { - received = this.document.location.href; } else if (expression === 'to.have.value') { element = this.retarget(element, 'follow-label')!; if (element.nodeName !== 'INPUT' && element.nodeName !== 'TEXTAREA' && element.nodeName !== 'SELECT') diff --git a/packages/injected/src/recorder/pollingRecorder.ts b/packages/injected/src/recorder/pollingRecorder.ts index c9e824951a..dc567b37c0 100644 --- a/packages/injected/src/recorder/pollingRecorder.ts +++ b/packages/injected/src/recorder/pollingRecorder.ts @@ -37,8 +37,8 @@ export class PollingRecorder implements RecorderDelegate { private _pollRecorderModeTimer: number | undefined; private _lastStateJSON: string | undefined; - constructor(injectedScript: InjectedScript) { - this._recorder = new Recorder(injectedScript); + constructor(injectedScript: InjectedScript, options?: { recorderMode?: 'default' | 'api' }) { + this._recorder = new Recorder(injectedScript, options); this._embedder = injectedScript.window as any; injectedScript.onGlobalListenersRemoved.add(() => this._recorder.installListeners()); diff --git a/packages/injected/src/recorder/recorder.ts b/packages/injected/src/recorder/recorder.ts index 68ba74fdb1..fb3044bffc 100644 --- a/packages/injected/src/recorder/recorder.ts +++ b/packages/injected/src/recorder/recorder.ts @@ -42,7 +42,8 @@ export interface RecorderDelegate { interface RecorderTool { cursor(): string; - cleanup?(): void; + install?(): void; + uninstall?(): void; onClick?(event: MouseEvent): void; onDblClick?(event: MouseEvent): void; onContextMenu?(event: MouseEvent): void; @@ -82,7 +83,7 @@ class InspectTool implements RecorderTool { return 'pointer'; } - cleanup() { + uninstall() { this._hoveredModel = null; this._hoveredElement = null; } @@ -194,6 +195,7 @@ class RecordActionTool implements RecorderTool { private _activeModel: HighlightModelWithSelector | null = null; private _expectProgrammaticKeyUp = false; private _pendingClickAction: { action: actions.ClickAction, timeout: number } | undefined; + private _observer: MutationObserver | null = null; constructor(recorder: Recorder) { this._recorder = recorder; @@ -204,7 +206,27 @@ class RecordActionTool implements RecorderTool { return 'pointer'; } - cleanup() { + private _installObserverIfNeeded() { + if (this._observer) + return; + if (!this._recorder.injectedScript.document?.body) + return; + this._observer = new MutationObserver(mutations => { + if (!this._hoveredElement) + return; + for (const mutation of mutations) { + for (const node of mutation.removedNodes) { + if (node === this._hoveredElement || node.contains(this._hoveredElement)) + this._resetHoveredModel(); + } + } + }); + this._observer.observe(this._recorder.injectedScript.document.body, { childList: true, subtree: true }); + } + + uninstall() { + this._observer?.disconnect(); + this._observer = null; this._hoveredModel = null; this._hoveredElement = null; this._activeModel = null; @@ -227,7 +249,7 @@ class RecordActionTool implements RecorderTool { return; const checkbox = asCheckbox(this._recorder.deepEventTarget(event)); - if (checkbox) { + if (checkbox && event.detail === 1) { // Interestingly, inputElement.checked is reversed inside this event handler. this._performAction({ name: checkbox.checked ? 'check' : 'uncheck', @@ -317,30 +339,26 @@ class RecordActionTool implements RecorderTool { onPointerDown(event: PointerEvent) { if (this._shouldIgnoreMouseEvent(event)) return; - if (!this._performingActions.size) - consumeEvent(event); + this._consumeWhenAboutToPerform(event); } onPointerUp(event: PointerEvent) { if (this._shouldIgnoreMouseEvent(event)) return; - if (!this._performingActions.size) - consumeEvent(event); + this._consumeWhenAboutToPerform(event); } onMouseDown(event: MouseEvent) { if (this._shouldIgnoreMouseEvent(event)) return; - if (!this._performingActions.size) - consumeEvent(event); + this._consumeWhenAboutToPerform(event); this._activeModel = this._hoveredModel; } onMouseUp(event: MouseEvent) { if (this._shouldIgnoreMouseEvent(event)) return; - if (!this._performingActions.size) - consumeEvent(event); + this._consumeWhenAboutToPerform(event); } onMouseMove(event: MouseEvent) { @@ -430,7 +448,7 @@ class RecordActionTool implements RecorderTool { // Similarly to click, trigger checkbox on key event, not input. if (event.key === ' ') { const checkbox = asCheckbox(this._recorder.deepEventTarget(event)); - if (checkbox) { + if (checkbox && event.detail === 0) { this._performAction({ name: checkbox.checked ? 'uncheck' : 'check', selector: this._activeModel!.selector, @@ -462,9 +480,13 @@ class RecordActionTool implements RecorderTool { } onScroll(event: Event) { + this._resetHoveredModel(); + } + + private _resetHoveredModel() { this._hoveredModel = null; this._hoveredElement = null; - this._recorder.updateHighlight(null, false); + this._updateHighlight(false); } private _onFocus(userGesture: boolean) { @@ -521,26 +543,32 @@ class RecordActionTool implements RecorderTool { return true; } + private _consumeWhenAboutToPerform(event: Event) { + if (!this._performingActions.size) + consumeEvent(event); + } + private _performAction(action: actions.PerformOnRecordAction) { - this._hoveredElement = null; - this._hoveredModel = null; - this._activeModel = null; this._recorder.updateHighlight(null, false); + this._performingActions.add(action); - void this._recorder.performAction(action).then(() => { - this._performingActions.delete(action); + const promise = this._recorder.performAction(action).then(() => { + this._performingActions.delete(action); // If that was a keyboard action, it similarly requires new selectors for active model. this._onFocus(false); + }); - if (this._recorder.injectedScript.isUnderTest) { - // Serialize all to string as we cannot attribute console message to isolated world - // in Firefox. - console.error('Action performed for test: ' + JSON.stringify({ // eslint-disable-line no-console - hovered: this._hoveredModel ? (this._hoveredModel as any).selector : null, - active: this._activeModel ? (this._activeModel as any).selector : null, - })); - } + if (!this._recorder.injectedScript.isUnderTest) + return; + + void promise.then(() => { + // Serialize all to string as we cannot attribute console message to isolated world + // in Firefox. + console.error('Action performed for test: ' + JSON.stringify({ // eslint-disable-line no-console + hovered: this._hoveredModel ? (this._hoveredModel as any).selector : null, + active: this._activeModel ? (this._activeModel as any).selector : null, + })); }); } @@ -577,19 +605,226 @@ class RecordActionTool implements RecorderTool { } private _updateModelForHoveredElement() { + this._installObserverIfNeeded(); if (this._performingActions.size) return; if (!this._hoveredElement || !this._hoveredElement.isConnected) { this._hoveredModel = null; this._hoveredElement = null; - this._recorder.updateHighlight(null, true); + this._updateHighlight(true); return; } const { selector, elements } = this._recorder.injectedScript.generateSelector(this._hoveredElement, { testIdAttributeName: this._recorder.state.testIdAttributeName }); if (this._hoveredModel && this._hoveredModel.selector === selector) return; this._hoveredModel = selector ? { selector, elements, color: HighlightColors.action } : null; - this._recorder.updateHighlight(this._hoveredModel, true); + this._updateHighlight(true); + } + + private _updateHighlight(userGesture: boolean) { + this._recorder.updateHighlight(this._hoveredModel, userGesture); + } +} + +class JsonRecordActionTool implements RecorderTool { + private _recorder: Recorder; + + constructor(recorder: Recorder) { + this._recorder = recorder; + } + + cursor() { + return 'pointer'; + } + + onClick(event: MouseEvent) { + // in webkit, sliding a range element may trigger a click event with a different target if the mouse is released outside the element bounding box. + // So we check the hovered element instead, and if it is a range input, we skip click handling + const element = this._recorder.deepEventTarget(event); + if (isRangeInput(element)) + return; + // Right clicks are handled by 'contextmenu' event if its auxclick + if (event.button === 2 && event.type === 'auxclick') + return; + if (this._shouldIgnoreMouseEvent(event)) + return; + + const checkbox = asCheckbox(element); + const { ariaSnapshot, selector } = this._ariaSnapshot(element); + if (checkbox && event.detail === 1) { + // Interestingly, inputElement.checked is reversed inside this event handler. + this._recorder.recordAction({ + name: checkbox.checked ? 'check' : 'uncheck', + selector, + signals: [], + ariaSnapshot, + }); + return; + } + + this._recorder.recordAction({ + name: 'click', + selector, + ariaSnapshot, + position: positionForEvent(event), + signals: [], + button: buttonForEvent(event), + modifiers: modifiersForEvent(event), + clickCount: event.detail, + }); + } + + onDblClick(event: MouseEvent) { + const element = this._recorder.deepEventTarget(event); + if (isRangeInput(element)) + return; + if (this._shouldIgnoreMouseEvent(event)) + return; + + const { ariaSnapshot, selector } = this._ariaSnapshot(element); + this._recorder.recordAction({ + name: 'click', + selector, + ariaSnapshot, + position: positionForEvent(event), + signals: [], + button: buttonForEvent(event), + modifiers: modifiersForEvent(event), + clickCount: event.detail + }); + } + + onInput(event: Event) { + const element = this._recorder.deepEventTarget(event); + + const { ariaSnapshot, selector } = this._ariaSnapshot(element); + if (isRangeInput(element)) { + this._recorder.recordAction({ + name: 'fill', + selector, + ariaSnapshot, + signals: [], + text: element.value, + }); + return; + } + + if (['INPUT', 'TEXTAREA'].includes(element.nodeName) || element.isContentEditable) { + if (element.nodeName === 'INPUT' && ['checkbox', 'radio'].includes((element as HTMLInputElement).type.toLowerCase())) { + // Checkbox is handled in click, we can't let input trigger on checkbox - that would mean we dispatched click events while recording. + return; + } + + this._recorder.recordAction({ + name: 'fill', + selector, + ariaSnapshot, + signals: [], + text: element.isContentEditable ? element.innerText : (element as HTMLInputElement).value, + }); + return; + } + + if (element.nodeName === 'SELECT') { + const selectElement = element as HTMLSelectElement; + this._recorder.recordAction({ + name: 'select', + selector, + ariaSnapshot, + options: [...selectElement.selectedOptions].map(option => option.value), + signals: [] + }); + return; + } + } + + onKeyDown(event: KeyboardEvent) { + if (!this._shouldGenerateKeyPressFor(event)) + return; + + const element = this._recorder.deepEventTarget(event); + const { ariaSnapshot, selector } = this._ariaSnapshot(element); + + // Similarly to click, trigger checkbox on key event, not input. + if (event.key === ' ') { + const checkbox = asCheckbox(element); + if (checkbox && event.detail === 0) { + this._recorder.recordAction({ + name: checkbox.checked ? 'uncheck' : 'check', + selector, + ariaSnapshot, + signals: [], + }); + return; + } + } + + this._recorder.recordAction({ + name: 'press', + selector, + ariaSnapshot, + signals: [], + key: event.key, + modifiers: modifiersForEvent(event), + }); + } + + private _shouldIgnoreMouseEvent(event: MouseEvent): boolean { + const target = this._recorder.deepEventTarget(event); + const nodeName = target.nodeName; + if (nodeName === 'SELECT' || nodeName === 'OPTION') + return true; + if (nodeName === 'INPUT' && ['date', 'range'].includes((target as HTMLInputElement).type)) + return true; + return false; + } + + private _shouldGenerateKeyPressFor(event: KeyboardEvent): boolean { + // IME can generate keyboard events that don't provide a value for the key property (e.g. chrome autofill) + if (typeof event.key !== 'string') + return false; + + // Enter aka. new line is handled in input event. + if (event.key === 'Enter' && (this._recorder.deepEventTarget(event).nodeName === 'TEXTAREA' || this._recorder.deepEventTarget(event).isContentEditable)) + return false; + // Backspace, Delete, AltGraph are changing input, will handle it there. + if (['Backspace', 'Delete', 'AltGraph'].includes(event.key)) + return false; + // Ignore the QWERTZ shortcut for creating a at sign on MacOS + if (event.key === '@' && event.code === 'KeyL') + return false; + // Allow and ignore common used shortcut for pasting. + if (navigator.platform.includes('Mac')) { + if (event.key === 'v' && event.metaKey) + return false; + } else { + if (event.key === 'v' && event.ctrlKey) + return false; + if (event.key === 'Insert' && event.shiftKey) + return false; + } + if (['Shift', 'Control', 'Meta', 'Alt', 'Process'].includes(event.key)) + return false; + const hasModifier = event.ctrlKey || event.altKey || event.metaKey; + if (event.key.length === 1 && !hasModifier) + return !this._isEditable(this._recorder.deepEventTarget(event)); + return true; + } + + private _isEditable(element: HTMLElement) { + if (element.nodeName === 'TEXTAREA' || element.nodeName === 'INPUT') + return true; + if (element.isContentEditable) + return true; + return false; + } + + private _ariaSnapshot(element: HTMLElement): { ariaSnapshot: string, selector: string }; + private _ariaSnapshot(element: HTMLElement | undefined): { ariaSnapshot: string, selector?: string } { + const { ariaSnapshot, refs } = this._recorder.injectedScript.ariaSnapshotForRecorder(); + const ref = element ? refs.get(element) : undefined; + const selector = ref ? `aria-ref=${ref}` : undefined; + return { ariaSnapshot, selector }; } } @@ -612,7 +847,7 @@ class TextAssertionTool implements RecorderTool { return 'pointer'; } - cleanup() { + uninstall() { this._dialog.close(); this._hoverHighlight = null; } @@ -708,7 +943,7 @@ class TextAssertionTool implements RecorderTool { name: 'assertSnapshot', selector: this._hoverHighlight.selector, signals: [], - snapshot: this._recorder.injectedScript.ariaSnapshot(target, { mode: 'regex' }), + ariaSnapshot: this._recorder.injectedScript.ariaSnapshot(target, { mode: 'regex' }), }; } else { const generated = this._recorder.injectedScript.generateSelector(target, { testIdAttributeName: this._recorder.state.testIdAttributeName, forTextExpect: true }); @@ -734,7 +969,7 @@ class TextAssertionTool implements RecorderTool { if (action?.name === 'assertValue') return action.value; if (action?.name === 'assertSnapshot') - return action.snapshot; + return action.ariaSnapshot; return ''; } @@ -1029,7 +1264,7 @@ export class Recorder { readonly document: Document; private _delegate: RecorderDelegate = {}; - constructor(injectedScript: InjectedScript) { + constructor(injectedScript: InjectedScript, options?: { recorderMode?: 'default' | 'api' }) { this.document = injectedScript.document; this.injectedScript = injectedScript; this.highlight = injectedScript.createHighlight(); @@ -1037,7 +1272,7 @@ export class Recorder { 'none': new NoneTool(), 'standby': new NoneTool(), 'inspecting': new InspectTool(this, false), - 'recording': new RecordActionTool(this), + 'recording': options?.recorderMode === 'api' ? new JsonRecordActionTool(this) : new RecordActionTool(this), 'recording-inspecting': new InspectTool(this, false), 'assertingText': new TextAssertionTool(this, 'text'), 'assertingVisibility': new InspectTool(this, true), @@ -1045,6 +1280,7 @@ export class Recorder { 'assertingSnapshot': new TextAssertionTool(this, 'snapshot'), }; this._currentTool = this._tools.none; + this._currentTool.install?.(); if (injectedScript.window.top === injectedScript.window) { this.overlay = new Overlay(this); this.overlay.setUIState(this.state); @@ -1095,6 +1331,7 @@ export class Recorder { this.highlight.appendChild(createSvgElement(this.document, clipPaths)); this.overlay?.install(); + this._currentTool?.install?.(); this.document.adoptedStyleSheets.push(this._stylesheet); } @@ -1102,9 +1339,10 @@ export class Recorder { const newTool = this._tools[this.state.mode]; if (newTool === this._currentTool) return; - this._currentTool.cleanup?.(); + this._currentTool.uninstall?.(); this.clearHighlight(); this._currentTool = newTool; + this._currentTool.install?.(); this.injectedScript.document.body?.setAttribute('data-pw-cursor', newTool.cursor()); } diff --git a/packages/injected/src/roleUtils.ts b/packages/injected/src/roleUtils.ts index b9bdd333a0..e652ee8c15 100644 --- a/packages/injected/src/roleUtils.ts +++ b/packages/injected/src/roleUtils.ts @@ -16,7 +16,7 @@ import * as css from '@isomorphic/cssTokenizer'; -import { getGlobalOptions, closestCrossShadow, elementSafeTagName, enclosingShadowRootOrDocument, getElementComputedStyle, isElementStyleVisibilityVisible, isVisibleTextNode, parentElementOrShadowHost } from './domUtils'; +import { closestCrossShadow, elementSafeTagName, enclosingShadowRootOrDocument, getElementComputedStyle, isElementStyleVisibilityVisible, isVisibleTextNode, parentElementOrShadowHost } from './domUtils'; import type { AriaRole } from '@isomorphic/ariaSnapshot'; @@ -135,7 +135,7 @@ const kImplicitRoleByTagName: { [tagName: string]: (e: Element) => AriaRole | nu // File inputs do not have a role by the spec: https://www.w3.org/TR/html-aam-1.0/#el-input-file. // However, there are open issues about fixing it: https://github.com/w3c/aria/issues/1926. // All browsers report it as a button, and it is rendered as a button, so we do "button". - if (type === 'file' && !getGlobalOptions().inputFileRoleTextbox) + if (type === 'file') return 'button'; return inputTypeToRole[type] || 'textbox'; }, @@ -153,6 +153,7 @@ const kImplicitRoleByTagName: { [tagName: string]: (e: Element) => AriaRole | nu 'OUTPUT': () => 'status', 'P': () => 'paragraph', 'PROGRESS': () => 'progressbar', + 'SEARCH': () => 'search', 'SECTION': (e: Element) => hasExplicitAccessibleName(e) ? 'region' : null, 'SELECT': (e: Element) => e.hasAttribute('multiple') || (e as HTMLSelectElement).size > 1 ? 'listbox' : 'combobox', 'STRONG': () => 'strong', @@ -707,7 +708,7 @@ function getTextAlternativeInternal(element: Element, options: AccessibleNameOpt // There is no spec for this, but Chromium/WebKit do "Choose File" so we follow that. // All browsers respect labels, aria-labelledby and aria-label. // No browsers respect the title attribute, although w3c accname tests disagree. We follow browsers. - if (!getGlobalOptions().inputFileRoleTextbox && tagName === 'INPUT' && (element as HTMLInputElement).type === 'file') { + if (tagName === 'INPUT' && (element as HTMLInputElement).type === 'file') { options.visitedElements.add(element); const labels = (element as HTMLInputElement).labels || []; if (labels.length && !options.embeddedInLabelledBy) @@ -1060,8 +1061,12 @@ export function getAriaDisabled(element: Element): boolean { function isNativelyDisabled(element: Element) { // https://www.w3.org/TR/html-aam-1.0/#html-attribute-state-and-property-mappings - const isNativeFormControl = ['BUTTON', 'INPUT', 'SELECT', 'TEXTAREA', 'OPTION', 'OPTGROUP'].includes(element.tagName); - return isNativeFormControl && (element.hasAttribute('disabled') || belongsToDisabledFieldSet(element)); + const isNativeFormControl = ['BUTTON', 'INPUT', 'SELECT', 'TEXTAREA', 'OPTION', 'OPTGROUP'].includes(elementSafeTagName(element)); + return isNativeFormControl && (element.hasAttribute('disabled') || belongsToDisabledOptGroup(element) || belongsToDisabledFieldSet(element)); +} + +function belongsToDisabledOptGroup(element: Element): boolean { + return elementSafeTagName(element) === 'OPTION' && !!element.closest('OPTGROUP[DISABLED]'); } function belongsToDisabledFieldSet(element: Element): boolean { diff --git a/packages/playwright-browser-chromium/package.json b/packages/playwright-browser-chromium/package.json index 6432dca159..e90755e255 100644 --- a/packages/playwright-browser-chromium/package.json +++ b/packages/playwright-browser-chromium/package.json @@ -1,6 +1,6 @@ { "name": "@playwright/browser-chromium", - "version": "1.53.0", + "version": "1.54.1", "description": "Playwright package that automatically installs Chromium", "repository": { "type": "git", @@ -27,6 +27,6 @@ "install": "node install.js" }, "dependencies": { - "playwright-core": "1.53.0" + "playwright-core": "1.54.1" } } diff --git a/packages/playwright-browser-firefox/package.json b/packages/playwright-browser-firefox/package.json index 3cdd0c6ac2..9fe1735514 100644 --- a/packages/playwright-browser-firefox/package.json +++ b/packages/playwright-browser-firefox/package.json @@ -1,6 +1,6 @@ { "name": "@playwright/browser-firefox", - "version": "1.53.0", + "version": "1.54.1", "description": "Playwright package that automatically installs Firefox", "repository": { "type": "git", @@ -27,6 +27,6 @@ "install": "node install.js" }, "dependencies": { - "playwright-core": "1.53.0" + "playwright-core": "1.54.1" } } diff --git a/packages/playwright-browser-webkit/package.json b/packages/playwright-browser-webkit/package.json index 0a9fb6a8ea..7748436e3e 100644 --- a/packages/playwright-browser-webkit/package.json +++ b/packages/playwright-browser-webkit/package.json @@ -1,6 +1,6 @@ { "name": "@playwright/browser-webkit", - "version": "1.53.0", + "version": "1.54.1", "description": "Playwright package that automatically installs WebKit", "repository": { "type": "git", @@ -27,6 +27,6 @@ "install": "node install.js" }, "dependencies": { - "playwright-core": "1.53.0" + "playwright-core": "1.54.1" } } diff --git a/packages/playwright-chromium/package.json b/packages/playwright-chromium/package.json index 5858fceba7..e1bed4b63a 100644 --- a/packages/playwright-chromium/package.json +++ b/packages/playwright-chromium/package.json @@ -1,6 +1,6 @@ { "name": "playwright-chromium", - "version": "1.53.0", + "version": "1.54.1", "description": "A high-level API to automate Chromium", "repository": { "type": "git", @@ -30,6 +30,6 @@ "install": "node install.js" }, "dependencies": { - "playwright-core": "1.53.0" + "playwright-core": "1.54.1" } } diff --git a/packages/playwright-client/package.json b/packages/playwright-client/package.json index 7bce26e651..72abe107d6 100644 --- a/packages/playwright-client/package.json +++ b/packages/playwright-client/package.json @@ -30,6 +30,6 @@ "watch": "npm run esbuild -- --watch" }, "dependencies": { - "playwright-core": "1.53.0" + "playwright-core": "1.54.1" } } diff --git a/packages/playwright-client/types/types.d.ts b/packages/playwright-client/types/types.d.ts index efe7626b23..e840adc980 100644 --- a/packages/playwright-client/types/types.d.ts +++ b/packages/playwright-client/types/types.d.ts @@ -8830,6 +8830,13 @@ export interface BrowserContext { * Optional. */ sameSite?: "Strict"|"Lax"|"None"; + + /** + * For partitioned third-party cookies (aka + * [CHIPS](https://developer.mozilla.org/en-US/docs/Web/Privacy/Guides/Privacy_sandbox/Partitioned_cookies)), the + * partition key. Optional. + */ + partitionKey?: string; }>): Promise; /** @@ -8840,7 +8847,8 @@ export interface BrowserContext { backgroundPages(): Array; /** - * Returns the browser instance of the context. If it was launched as a persistent context null gets returned. + * Gets the browser instance that owns the context. Returns `null` if the context is created outside of normal + * browser, e.g. Android or Electron. */ browser(): null|Browser; @@ -8985,6 +8993,7 @@ export interface BrowserContext { * - `'notifications'` * - `'payment-handler'` * - `'storage-access'` + * - `'local-fonts'` * @param options */ grantPermissions(permissions: ReadonlyArray, options?: { @@ -18841,12 +18850,7 @@ export interface ConsoleMessage { */ text(): string; - /** - * One of the following values: `'log'`, `'debug'`, `'info'`, `'error'`, `'warning'`, `'dir'`, `'dirxml'`, `'table'`, - * `'trace'`, `'clear'`, `'startGroup'`, `'startGroupCollapsed'`, `'endGroup'`, `'assert'`, `'profile'`, - * `'profileEnd'`, `'count'`, `'timeEnd'`. - */ - type(): string; + type(): "log"|"debug"|"info"|"error"|"warning"|"dir"|"dirxml"|"table"|"trace"|"clear"|"startGroup"|"startGroupCollapsed"|"endGroup"|"assert"|"profile"|"profileEnd"|"count"|"timeEnd"; } /** @@ -20151,6 +20155,10 @@ export interface Logger { /** * The Mouse class operates in main-frame CSS pixels relative to the top-left corner of the viewport. * + * **NOTE** If you want to debug where the mouse moved, you can use the [Trace viewer](https://playwright.dev/docs/trace-viewer-intro) or + * [Playwright Inspector](https://playwright.dev/docs/running-tests). A red dot showing the location of the mouse will be shown for every + * mouse action. + * * Every `page` object has its own Mouse, accessible with * [page.mouse](https://playwright.dev/docs/api/class-page#page-mouse). * @@ -22501,6 +22509,8 @@ export interface Cookie { secure: boolean; sameSite: "Strict"|"Lax"|"None"; + + partitionKey?: string; } interface PageWaitForSelectorOptions { diff --git a/packages/playwright-cloudflare/src/index.ts b/packages/playwright-cloudflare/src/index.ts index a972491cfd..ebeea4ef1b 100644 --- a/packages/playwright-cloudflare/src/index.ts +++ b/packages/playwright-cloudflare/src/index.ts @@ -82,7 +82,7 @@ async function createBrowser(transport: WebSocketTransport, options?: { persiste const url = new URL(WS_FAKE_HOST); if (options?.persistent) url.searchParams.set('persistent', 'true'); - const browser = await originalConnectOverCDP.call(playwright.chromium, url.toString()) as Browser; + const browser = await originalConnectOverCDP.call(playwright.chromium, url.toString(), {}) as Browser; browser.sessionId = () => transport.sessionId; return browser; }); diff --git a/packages/playwright-cloudflare/tests/package-lock.json b/packages/playwright-cloudflare/tests/package-lock.json index ca7392b587..40d3a0ee71 100644 --- a/packages/playwright-cloudflare/tests/package-lock.json +++ b/packages/playwright-cloudflare/tests/package-lock.json @@ -10,7 +10,7 @@ "license": "ISC", "devDependencies": { "@cloudflare/playwright": "file:..", - "@playwright/test": "^1.51.1", + "@playwright/test": "^1.54.1", "wrangler": "^4.19.1" } }, @@ -1012,13 +1012,13 @@ } }, "node_modules/@playwright/test": { - "version": "1.51.1", - "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.51.1.tgz", - "integrity": "sha512-nM+kEaTSAoVlXmMPH10017vn3FSiFqr/bh4fKg9vmAdMfd9SDqRZNvPSiAHADc/itWak+qPvMPZQOPwCBW7k7Q==", + "version": "1.54.1", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.54.1.tgz", + "integrity": "sha512-FS8hQ12acieG2dYSksmLOF7BNxnVf2afRJdCuM1eMSxj6QTSE6G4InGF7oApGgDb65MX7AwMVlIkpru0yZA4Xw==", "dev": true, "license": "Apache-2.0", "dependencies": { - "playwright": "1.51.1" + "playwright": "1.54.1" }, "bin": { "playwright": "cli.js" @@ -1319,13 +1319,13 @@ "license": "MIT" }, "node_modules/playwright": { - "version": "1.51.1", - "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.51.1.tgz", - "integrity": "sha512-kkx+MB2KQRkyxjYPc3a0wLZZoDczmppyGJIvQ43l+aZihkaVvmu/21kiyaHeHjiFxjxNNFnUncKmcGIyOojsaw==", + "version": "1.54.1", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.54.1.tgz", + "integrity": "sha512-peWpSwIBmSLi6aW2auvrUtf2DqY16YYcCMO8rTVx486jKmDTJg7UAhyrraP98GB8BoPURZP8+nxO7TSd4cPr5g==", "dev": true, "license": "Apache-2.0", "dependencies": { - "playwright-core": "1.51.1" + "playwright-core": "1.54.1" }, "bin": { "playwright": "cli.js" @@ -1338,9 +1338,9 @@ } }, "node_modules/playwright-core": { - "version": "1.51.1", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.51.1.tgz", - "integrity": "sha512-/crRMj8+j/Nq5s8QcvegseuyeZPxpQCZb6HNk3Sos3BlZyAknRjoyJPFWkpNn8v0+P3WiwqFF8P+zQo4eqiNuw==", + "version": "1.54.1", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.54.1.tgz", + "integrity": "sha512-Nbjs2zjj0htNhzgiy5wu+3w09YetDx5pkrpI/kZotDlDUaYk0HVA5xrBVPdow4SAUIlhgKcJeJg4GRKW6xHusA==", "dev": true, "license": "Apache-2.0", "bin": { diff --git a/packages/playwright-cloudflare/tests/package.json b/packages/playwright-cloudflare/tests/package.json index 6eb697428a..159b6998d5 100644 --- a/packages/playwright-cloudflare/tests/package.json +++ b/packages/playwright-cloudflare/tests/package.json @@ -7,7 +7,7 @@ "description": "", "devDependencies": { "@cloudflare/playwright": "file:..", - "@playwright/test": "^1.51.1", + "@playwright/test": "^1.54.1", "wrangler": "^4.19.1" } } diff --git a/packages/playwright-cloudflare/tests/src/server/workerFixtures.ts b/packages/playwright-cloudflare/tests/src/server/workerFixtures.ts index 6b335e528c..a8f499a59f 100644 --- a/packages/playwright-cloudflare/tests/src/server/workerFixtures.ts +++ b/packages/playwright-cloudflare/tests/src/server/workerFixtures.ts @@ -361,6 +361,19 @@ export function roundBox(box: BoundingBox): BoundingBox { }; } +export function unshift(snapshot: string): string { + const lines = snapshot.split('\n'); + let whitespacePrefixLength = 100; + for (const line of lines) { + if (!line.trim()) + continue; + const match = line.match(/^(\s*)/); + if (match && match[1].length < whitespacePrefixLength) + whitespacePrefixLength = match[1].length; + } + return lines.filter(t => t.trim()).map(line => line.substring(whitespacePrefixLength)).join('\n'); +} + export const expect = baseExpect.extend({ toContainYaml(received: string, expected: string) { const trimmed = expected.split('\n').filter(a => !!a.trim()); diff --git a/packages/playwright-cloudflare/utils/build_bundles.js b/packages/playwright-cloudflare/utils/build_bundles.js index dd19fa6403..64b3e9109f 100644 --- a/packages/playwright-cloudflare/utils/build_bundles.js +++ b/packages/playwright-cloudflare/utils/build_bundles.js @@ -42,8 +42,16 @@ const basedir = path.dirname(fileURLToPath(import.meta.url)); await build({ root, resolve: { - alias: name === 'pngjs' ? { 'zlib': 'browserify-zlib' } : - { 'pngjs': path.join(basedir, `../src/bundles/pngjs.js` ) }, + alias: { + 'node:events': 'events', + 'node:child_process': 'child_process', + 'node:path': 'path', + 'node:fs': 'fs', + 'node:process': 'process', + + ...(name === 'pngjs' ? { 'zlib': 'browserify-zlib' } : + { 'pngjs': path.join(basedir, `../src/bundles/pngjs.js` ) }), + }, }, build: { emptyOutDir: false, @@ -56,9 +64,14 @@ const basedir = path.dirname(fileURLToPath(import.meta.url)); formats: ['es'], }, rollupOptions: { - external: name === 'fs' ? [...external, 'zlib'] - : name === 'pngjs' ? [...external, 'fs'] - : [...external, 'fs', 'zlib', 'pngjs'], + external: [ + 'formidable', + 'ansi-styles', + + ...(name === 'fs' ? [...external, 'zlib'] + : name === 'pngjs' ? [...external, 'fs'] + : [...external, 'fs', 'zlib', 'pngjs']) + ], output: { dir: path.join(basedir, '../src/bundles'), entryFileNames: `${name}.js`, diff --git a/packages/playwright-cloudflare/utils/generate_worker_tests.js b/packages/playwright-cloudflare/utils/generate_worker_tests.js index e6ea01e7b1..7ec32903e6 100644 --- a/packages/playwright-cloudflare/utils/generate_worker_tests.js +++ b/packages/playwright-cloudflare/utils/generate_worker_tests.js @@ -22,6 +22,7 @@ const excludedFiles = [ 'library/snapshotter.spec.ts', 'library/trace-viewer.spec.ts', 'library/video.spec.ts', + 'library/web-socket.spec.ts', ]; const sourceTestsDir = path.join(basedir, '..', '..', '..', 'tests'); diff --git a/packages/playwright-core/ThirdPartyNotices.txt b/packages/playwright-core/ThirdPartyNotices.txt index 744720e00d..57cf609a1c 100644 --- a/packages/playwright-core/ThirdPartyNotices.txt +++ b/packages/playwright-core/ThirdPartyNotices.txt @@ -6,11 +6,11 @@ This project incorporates components from the projects listed below. The origina - agent-base@6.0.2 (https://github.com/TooTallNate/node-agent-base) - balanced-match@1.0.2 (https://github.com/juliangruber/balanced-match) -- brace-expansion@1.1.11 (https://github.com/juliangruber/brace-expansion) +- brace-expansion@1.1.12 (https://github.com/juliangruber/brace-expansion) - buffer-crc32@0.2.13 (https://github.com/brianloveswords/buffer-crc32) - codemirror@5.65.18 (https://github.com/codemirror/CodeMirror) - colors@1.4.0 (https://github.com/Marak/colors.js) -- commander@8.3.0 (https://github.com/tj/commander.js) +- commander@13.1.0 (https://github.com/tj/commander.js) - concat-map@0.0.1 (https://github.com/substack/node-concat-map) - debug@4.3.4 (https://github.com/debug-js/debug) - debug@4.4.0 (https://github.com/debug-js/debug) @@ -225,7 +225,7 @@ SOFTWARE. ========================================= END OF balanced-match@1.0.2 AND INFORMATION -%% brace-expansion@1.1.11 NOTICES AND INFORMATION BEGIN HERE +%% brace-expansion@1.1.12 NOTICES AND INFORMATION BEGIN HERE ========================================= MIT License @@ -249,7 +249,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ========================================= -END OF brace-expansion@1.1.11 AND INFORMATION +END OF brace-expansion@1.1.12 AND INFORMATION %% buffer-crc32@0.2.13 NOTICES AND INFORMATION BEGIN HERE ========================================= @@ -331,7 +331,7 @@ THE SOFTWARE. ========================================= END OF colors@1.4.0 AND INFORMATION -%% commander@8.3.0 NOTICES AND INFORMATION BEGIN HERE +%% commander@13.1.0 NOTICES AND INFORMATION BEGIN HERE ========================================= (The MIT License) @@ -356,7 +356,7 @@ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ========================================= -END OF commander@8.3.0 AND INFORMATION +END OF commander@13.1.0 AND INFORMATION %% concat-map@0.0.1 NOTICES AND INFORMATION BEGIN HERE ========================================= diff --git a/packages/playwright-core/browsers.json b/packages/playwright-core/browsers.json index 2e1a0d5e2c..7d373b027a 100644 --- a/packages/playwright-core/browsers.json +++ b/packages/playwright-core/browsers.json @@ -3,43 +3,43 @@ "browsers": [ { "name": "chromium", - "revision": "1178", + "revision": "1181", "installByDefault": true, - "browserVersion": "138.0.7204.15" + "browserVersion": "139.0.7258.5" }, { "name": "chromium-headless-shell", - "revision": "1178", + "revision": "1181", "installByDefault": true, - "browserVersion": "138.0.7204.15" + "browserVersion": "139.0.7258.5" }, { "name": "chromium-tip-of-tree", - "revision": "1337", + "revision": "1345", "installByDefault": false, - "browserVersion": "139.0.7216.0" + "browserVersion": "140.0.7271.0" }, { "name": "chromium-tip-of-tree-headless-shell", - "revision": "1337", + "revision": "1345", "installByDefault": false, - "browserVersion": "139.0.7216.0" + "browserVersion": "140.0.7271.0" }, { "name": "firefox", - "revision": "1487", + "revision": "1489", "installByDefault": true, - "browserVersion": "139.0" + "browserVersion": "140.0.2" }, { "name": "firefox-beta", - "revision": "1482", + "revision": "1484", "installByDefault": false, - "browserVersion": "138.0b10" + "browserVersion": "140.0b7" }, { "name": "webkit", - "revision": "2182", + "revision": "2191", "installByDefault": true, "revisionOverrides": { "debian11-x64": "2105", @@ -55,7 +55,7 @@ "ubuntu20.04-x64": "2092", "ubuntu20.04-arm64": "2092" }, - "browserVersion": "18.5" + "browserVersion": "26.0" }, { "name": "ffmpeg", diff --git a/packages/playwright-core/bundles/utils/package-lock.json b/packages/playwright-core/bundles/utils/package-lock.json index bc58353c99..7900f7c098 100644 --- a/packages/playwright-core/bundles/utils/package-lock.json +++ b/packages/playwright-core/bundles/utils/package-lock.json @@ -9,7 +9,7 @@ "version": "0.0.1", "dependencies": { "colors": "1.4.0", - "commander": "8.3.0", + "commander": "^13.0.0", "debug": "^4.3.4", "diff": "^7.0.0", "dotenv": "^16.4.5", @@ -155,9 +155,9 @@ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" }, "node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -173,11 +173,12 @@ } }, "node_modules/commander": { - "version": "8.3.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz", - "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==", + "version": "13.1.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-13.1.0.tgz", + "integrity": "sha512-/rFeCpNJQbhSZjGVwO9RFV3xPqbnERS8MmIQzCtD/zl6gpJuV/bMLuN92oG3F7d8oDEHHRrujSXNUr8fpjntKw==", + "license": "MIT", "engines": { - "node": ">= 12" + "node": ">=18" } }, "node_modules/concat-map": { diff --git a/packages/playwright-core/bundles/utils/package.json b/packages/playwright-core/bundles/utils/package.json index 7e7ff502ba..c0559de57d 100644 --- a/packages/playwright-core/bundles/utils/package.json +++ b/packages/playwright-core/bundles/utils/package.json @@ -4,7 +4,7 @@ "private": true, "dependencies": { "colors": "1.4.0", - "commander": "8.3.0", + "commander": "^13.0.0", "debug": "^4.3.4", "diff": "^7.0.0", "dotenv": "^16.4.5", diff --git a/packages/playwright-core/index.js b/packages/playwright-core/index.js index f8fc62fb7c..d4991d0ed2 100644 --- a/packages/playwright-core/index.js +++ b/packages/playwright-core/index.js @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -const minimumMajorNodeVersion = 14; +const minimumMajorNodeVersion = 18; const currentNodeVersion = process.versions.node; const semver = currentNodeVersion.split('.'); const [major] = [+semver[0]]; diff --git a/packages/playwright-core/package.json b/packages/playwright-core/package.json index 6d456509cd..d58d252c37 100644 --- a/packages/playwright-core/package.json +++ b/packages/playwright-core/package.json @@ -1,6 +1,6 @@ { "name": "playwright-core", - "version": "1.53.0", + "version": "1.54.1", "description": "A high-level API to automate web browsers", "repository": { "type": "git", diff --git a/packages/playwright-core/src/DEPS.list b/packages/playwright-core/src/DEPS.list index d21eb103c4..c4f50cb22e 100644 --- a/packages/playwright-core/src/DEPS.list +++ b/packages/playwright-core/src/DEPS.list @@ -4,6 +4,8 @@ server/ server/utils utils/isomorphic/ utilsBundle.ts +protocol/validator.ts +protocol/validatorPrimitives.ts [androidServerImpl.ts] remote/ diff --git a/packages/playwright-core/src/androidServerImpl.ts b/packages/playwright-core/src/androidServerImpl.ts index 5f3758119a..dc04473511 100644 --- a/packages/playwright-core/src/androidServerImpl.ts +++ b/packages/playwright-core/src/androidServerImpl.ts @@ -18,6 +18,8 @@ import { PlaywrightServer } from './remote/playwrightServer'; import { createPlaywright } from './server/playwright'; import { createGuid } from './server/utils/crypto'; import { ws } from './utilsBundle'; +import { ProgressController } from './server/progress'; +import { serverSideCallMetadata } from './server'; import type { BrowserServer } from './client/browserType'; import type { LaunchAndroidServerOptions } from './client/types'; @@ -27,11 +29,12 @@ export class AndroidServerLauncherImpl { async launchServer(options: LaunchAndroidServerOptions = {}): Promise { const playwright = createPlaywright({ sdkLanguage: 'javascript', isServer: true }); // 1. Pre-connect to the device - let devices = await playwright.android.devices({ + const controller = new ProgressController(serverSideCallMetadata(), playwright); + let devices = await controller.run(progress => playwright.android.devices(progress, { host: options.adbHost, port: options.adbPort, omitDriverInstall: options.omitDriverInstall, - }); + })); if (devices.length === 0) throw new Error('No devices found'); diff --git a/packages/playwright-core/src/browserServerImpl.ts b/packages/playwright-core/src/browserServerImpl.ts index d8bcda0e79..d8c36f7174 100644 --- a/packages/playwright-core/src/browserServerImpl.ts +++ b/packages/playwright-core/src/browserServerImpl.ts @@ -14,52 +14,75 @@ * limitations under the License. */ -import { SocksProxy } from './server/utils/socksProxy'; import { PlaywrightServer } from './remote/playwrightServer'; import { helper } from './server/helper'; import { serverSideCallMetadata } from './server/instrumentation'; import { createPlaywright } from './server/playwright'; import { createGuid } from './server/utils/crypto'; +import { isUnderTest } from './server/utils/debug'; import { rewriteErrorMessage } from './utils/isomorphic/stackTrace'; import { DEFAULT_PLAYWRIGHT_LAUNCH_TIMEOUT } from './utils/isomorphic/time'; import { ws } from './utilsBundle'; +import * as validatorPrimitives from './protocol/validatorPrimitives'; +import { ProgressController } from './server/progress'; import type { BrowserServer, BrowserServerLauncher } from './client/browserType'; import type { LaunchServerOptions, Logger, Env } from './client/types'; import type { ProtocolLogger } from './server/types'; import type { WebSocketEventEmitter } from './utilsBundle'; +import type { Browser } from './server/browser'; export class BrowserServerLauncherImpl implements BrowserServerLauncher { - private _browserName: 'chromium' | 'firefox' | 'webkit' | 'bidiFirefox' | 'bidiChromium'; + private _browserName: 'chromium' | 'firefox' | 'webkit' | '_bidiFirefox' | '_bidiChromium'; - constructor(browserName: 'chromium' | 'firefox' | 'webkit' | 'bidiFirefox' | 'bidiChromium') { + constructor(browserName: 'chromium' | 'firefox' | 'webkit' | '_bidiFirefox' | '_bidiChromium') { this._browserName = browserName; } - async launchServer(options: LaunchServerOptions & { _sharedBrowser?: boolean } = {}): Promise { + async launchServer(options: LaunchServerOptions & { _sharedBrowser?: boolean, _userDataDir?: string } = {}): Promise { const playwright = createPlaywright({ sdkLanguage: 'javascript', isServer: true }); - // TODO: enable socks proxy once ipv6 is supported. - const socksProxy = false ? new SocksProxy() : undefined; - playwright.options.socksProxyPort = await socksProxy?.listen(0); - // 1. Pre-launch the browser const metadata = serverSideCallMetadata(); - const browser = await playwright[this._browserName].launch(metadata, { + const validatorContext = { + tChannelImpl: (names: '*' | string[], arg: any, path: string) => { + throw new validatorPrimitives.ValidationError(`${path}: channels are not expected in launchServer`); + }, + binary: 'buffer', + isUnderTest, + } satisfies validatorPrimitives.ValidatorContext; + let launchOptions = { ...options, ignoreDefaultArgs: Array.isArray(options.ignoreDefaultArgs) ? options.ignoreDefaultArgs : undefined, ignoreAllDefaultArgs: !!options.ignoreDefaultArgs && !Array.isArray(options.ignoreDefaultArgs), env: options.env ? envObjectToArray(options.env) : undefined, timeout: options.timeout ?? DEFAULT_PLAYWRIGHT_LAUNCH_TIMEOUT, - }, toProtocolLogger(options.logger)).catch(e => { + }; + + let browser: Browser; + try { + const controller = new ProgressController(metadata, playwright[this._browserName]); + browser = await controller.run(async progress => { + if (options._userDataDir !== undefined) { + const validator = validatorPrimitives.scheme['BrowserTypeLaunchPersistentContextParams']; + launchOptions = validator({ ...launchOptions, userDataDir: options._userDataDir }, '', validatorContext); + const context = await playwright[this._browserName].launchPersistentContext(progress, options._userDataDir, launchOptions); + return context._browser; + } else { + const validator = validatorPrimitives.scheme['BrowserTypeLaunchParams']; + launchOptions = validator(launchOptions, '', validatorContext); + return await playwright[this._browserName].launch(progress, launchOptions, toProtocolLogger(options.logger)); + } + }); + } catch (e) { const log = helper.formatBrowserLogs(metadata.log); rewriteErrorMessage(e, `${e.message} Failed to launch browser.${log}`); throw e; - }); + } const path = options.wsPath ? (options.wsPath.startsWith('/') ? options.wsPath : `/${options.wsPath}`) : `/${createGuid()}`; // 2. Start the server - const server = new PlaywrightServer({ mode: options._sharedBrowser ? 'launchServerShared' : 'launchServer', path, maxConnections: Infinity, preLaunchedBrowser: browser, preLaunchedSocksProxy: socksProxy }); + const server = new PlaywrightServer({ mode: options._sharedBrowser ? 'launchServerShared' : 'launchServer', path, maxConnections: Infinity, preLaunchedBrowser: browser }); const wsEndpoint = await server.listen(options.port, options.host); // 3. Return the BrowserServer interface @@ -72,7 +95,6 @@ export class BrowserServerLauncherImpl implements BrowserServerLauncher { (browserServer as any)._disconnectForTest = () => server.close(); (browserServer as any)._userDataDirForTest = (browser as any)._userDataDirForTest; browser.options.browserProcess.onclose = (exitCode, signal) => { - socksProxy?.close().catch(() => {}); server.close(); browserServer.emit('close', exitCode, signal); }; diff --git a/packages/playwright-core/src/cli/program.ts b/packages/playwright-core/src/cli/program.ts index a1927b912d..a2655a1334 100644 --- a/packages/playwright-core/src/cli/program.ts +++ b/packages/playwright-core/src/cli/program.ts @@ -57,7 +57,7 @@ program commandWithOpenOptions('open [url]', 'open page in browser specified via -b, --browser', []) .action(function(url, options) { - open(options, url, codegenId()).catch(logErrorAndExit); + open(options, url).catch(logErrorAndExit); }) .addHelpText('afterAll', ` Examples: @@ -71,7 +71,14 @@ commandWithOpenOptions('codegen [url]', 'open page and generate code for user ac ['--target ', `language to generate, one of javascript, playwright-test, python, python-async, python-pytest, csharp, csharp-mstest, csharp-nunit, java, java-junit`, codegenId()], ['--test-id-attribute ', 'use the specified attribute to generate data test ID selectors'], ]).action(function(url, options) { - codegen(options, url).catch(logErrorAndExit); + codegen(options, url).catch(error => { + if (process.env.PWTEST_CLI_AUTO_EXIT_WHEN) { + // Tests with PWTEST_CLI_AUTO_EXIT_WHEN might close page too fast, resulting + // in a stray navigation aborted error. We should ignore it. + } else { + throw error; + } + }); }).addHelpText('afterAll', ` Examples: @@ -306,7 +313,7 @@ const browsers = [ for (const { alias, name, type } of browsers) { commandWithOpenOptions(`${alias} [url]`, `open page in ${name}`, []) .action(function(url, options) { - open({ ...options, browser: type }, url, options.target).catch(logErrorAndExit); + open({ ...options, browser: type }, url).catch(logErrorAndExit); }).addHelpText('afterAll', ` Examples: @@ -423,6 +430,7 @@ type Options = { timezone?: string; viewportSize?: string; userAgent?: string; + userDataDir?: string; }; type CaptureOptions = { @@ -472,33 +480,6 @@ async function launchContext(options: Options, extraOptions: LaunchOptions): Pro launchOptions.proxy.bypass = options.proxyBypass; } - const browser = await browserType.launch(launchOptions); - - if (process.env.PWTEST_CLI_IS_UNDER_TEST) { - (process as any)._didSetSourcesForTest = (text: string) => { - process.stdout.write('\n-------------8<-------------\n'); - process.stdout.write(text); - process.stdout.write('\n-------------8<-------------\n'); - const autoExitCondition = process.env.PWTEST_CLI_AUTO_EXIT_WHEN; - if (autoExitCondition && text.includes(autoExitCondition)) - closeBrowser(); - }; - // Make sure we exit abnormally when browser crashes. - const logs: string[] = []; - require('playwright-core/lib/utilsBundle').debug.log = (...args: any[]) => { - const line = require('util').format(...args) + '\n'; - logs.push(line); - process.stderr.write(line); - }; - browser.on('disconnected', () => { - const hasCrashLine = logs.some(line => line.includes('process did exit:') && !line.includes('process did exit: exitCode=0, signal=null')); - if (hasCrashLine) { - process.stderr.write('Detected browser crash.\n'); - gracefullyProcessExitDoNotHang(1); - } - }); - } - // Viewport size if (options.viewportSize) { try { @@ -563,9 +544,41 @@ async function launchContext(options: Options, extraOptions: LaunchOptions): Pro contextOptions.serviceWorkers = 'block'; } - // Close app when the last window closes. + let browser: Browser; + let context: BrowserContext; - const context = await browser.newContext(contextOptions); + if (options.userDataDir) { + context = await browserType.launchPersistentContext(options.userDataDir, { ...launchOptions, ...contextOptions }); + browser = context.browser()!; + } else { + browser = await browserType.launch(launchOptions); + context = await browser.newContext(contextOptions); + } + + if (process.env.PWTEST_CLI_IS_UNDER_TEST) { + (process as any)._didSetSourcesForTest = (text: string) => { + process.stdout.write('\n-------------8<-------------\n'); + process.stdout.write(text); + process.stdout.write('\n-------------8<-------------\n'); + const autoExitCondition = process.env.PWTEST_CLI_AUTO_EXIT_WHEN; + if (autoExitCondition && text.includes(autoExitCondition)) + closeBrowser(); + }; + // Make sure we exit abnormally when browser crashes. + const logs: string[] = []; + require('playwright-core/lib/utilsBundle').debug.log = (...args: any[]) => { + const line = require('util').format(...args) + '\n'; + logs.push(line); + process.stderr.write(line); + }; + browser.on('disconnected', () => { + const hasCrashLine = logs.some(line => line.includes('process did exit:') && !line.includes('process did exit: exitCode=0, signal=null')); + if (hasCrashLine) { + process.stderr.write('Detected browser crash.\n'); + gracefullyProcessExitDoNotHang(1); + } + }); + } let closingBrowser = false; async function closeBrowser() { @@ -609,34 +622,21 @@ async function launchContext(options: Options, extraOptions: LaunchOptions): Pro } async function openPage(context: BrowserContext, url: string | undefined): Promise { - const page = await context.newPage(); + let page = context.pages()[0]; + if (!page) + page = await context.newPage(); if (url) { if (fs.existsSync(url)) url = 'file://' + path.resolve(url); else if (!url.startsWith('http') && !url.startsWith('file://') && !url.startsWith('about:') && !url.startsWith('data:')) url = 'http://' + url; - await page.goto(url).catch(error => { - if (process.env.PWTEST_CLI_AUTO_EXIT_WHEN) { - // Tests with PWTEST_CLI_AUTO_EXIT_WHEN might close page too fast, resulting - // in a stray navigation aborted error. We should ignore it. - } else { - throw error; - } - }); + await page.goto(url); } return page; } -async function open(options: Options, url: string | undefined, language: string) { - const { context, launchOptions, contextOptions } = await launchContext(options, { headless: !!process.env.PWTEST_CLI_HEADLESS, executablePath: process.env.PWTEST_CLI_EXECUTABLE_PATH }); - await context._enableRecorder({ - language, - launchOptions, - contextOptions, - device: options.device, - saveStorage: options.saveStorage, - handleSIGINT: false, - }); +async function open(options: Options, url: string | undefined) { + const { context } = await launchContext(options, { headless: !!process.env.PWTEST_CLI_HEADLESS, executablePath: process.env.PWTEST_CLI_EXECUTABLE_PATH }); await openPage(context, url); } @@ -763,6 +763,7 @@ function commandWithOpenOptions(command: string, description: string, options: a .option('--timezone