diff --git a/.github/workflows/roll_stable_test_runner.yml b/.github/workflows/roll_stable_test_runner.yml new file mode 100644 index 0000000000000..2c908520444d8 --- /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 ed18e1541c635..b35a61d3b234d 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 cae05b22f343c..ec575d808e798 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 c01be04b96d82..eafe68cd60f3e 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/README.md b/README.md index fa3b3162cd0dd..d73d1ce3295cb 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # 🎭 Playwright -[![npm version](https://img.shields.io/npm/v/playwright.svg)](https://www.npmjs.com/package/playwright) [![Chromium version](https://img.shields.io/badge/chromium-138.0.7204.4-blue.svg?logo=google-chrome)](https://www.chromium.org/Home) [![Firefox version](https://img.shields.io/badge/firefox-139.0-blue.svg?logo=firefoxbrowser)](https://www.mozilla.org/en-US/firefox/new/) [![WebKit version](https://img.shields.io/badge/webkit-18.4-blue.svg?logo=safari)](https://webkit.org/) [![Join Discord](https://img.shields.io/badge/join-discord-infomational)](https://aka.ms/playwright/discord) +[![npm version](https://img.shields.io/npm/v/playwright.svg)](https://www.npmjs.com/package/playwright) [![Chromium version](https://img.shields.io/badge/chromium-139.0.7258.31-blue.svg?logo=google-chrome)](https://www.chromium.org/Home) [![Firefox version](https://img.shields.io/badge/firefox-140.0.2-blue.svg?logo=firefoxbrowser)](https://www.mozilla.org/en-US/firefox/new/) [![WebKit version](https://img.shields.io/badge/webkit-26.0-blue.svg?logo=safari)](https://webkit.org/) [![Join Discord](https://img.shields.io/badge/join-discord-informational)](https://aka.ms/playwright/discord) ## [Documentation](https://playwright.dev) | [API reference](https://playwright.dev/docs/api/class-playwright) @@ -8,9 +8,9 @@ Playwright is a framework for Web Testing and Automation. It allows testing [Chr | | Linux | macOS | Windows | | :--- | :---: | :---: | :---: | -| Chromium 138.0.7204.4 | :white_check_mark: | :white_check_mark: | :white_check_mark: | -| WebKit 18.4 | :white_check_mark: | :white_check_mark: | :white_check_mark: | -| Firefox 139.0 | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| Chromium 139.0.7258.31 | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| WebKit 26.0 | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| Firefox 140.0.2 | :white_check_mark: | :white_check_mark: | :white_check_mark: | Headless execution is supported for all browsers on all platforms. Check out [system requirements](https://playwright.dev/docs/intro#system-requirements) for details. diff --git a/browser_patches/firefox/UPSTREAM_CONFIG.sh b/browser_patches/firefox/UPSTREAM_CONFIG.sh index 5ae9758e38d0e..0513b8920832a 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="5e1efb776a56e399f6810204a2eca13f18a3eba6" +BASE_REVISION="00656c9425c51ee035578ca6ebebe13c755b0375" diff --git a/browser_patches/firefox/juggler/Helper.js b/browser_patches/firefox/juggler/Helper.js index f5a64d6c8bc33..875dd5ac2e8b3 100644 --- a/browser_patches/firefox/juggler/Helper.js +++ b/browser_patches/firefox/juggler/Helper.js @@ -4,9 +4,9 @@ const uuidGen = Cc["@mozilla.org/uuid-generator;1"].getService(Ci.nsIUUIDGenerator); -class Helper { +export class Helper { decorateAsEventEmitter(objectToDecorate) { - const { EventEmitter } = ChromeUtils.import('resource://gre/modules/EventEmitter.jsm'); + const { EventEmitter } = ChromeUtils.importESModule('resource://gre/modules/EventEmitter.sys.mjs'); const emitter = new EventEmitter(); objectToDecorate.on = emitter.on.bind(emitter); objectToDecorate.addEventListener = emitter.on.bind(emitter); @@ -172,7 +172,7 @@ class Helper { const helper = new Helper(); -class EventWatcher { +export class EventWatcher { constructor(receiver, eventNames, pendingEventWatchers = new Set()) { this._pendingEventWatchers = pendingEventWatchers; this._pendingEventWatchers.add(this); @@ -233,7 +233,3 @@ class EventWatcher { } } -var EXPORTED_SYMBOLS = [ "Helper", "EventWatcher" ]; -this.Helper = Helper; -this.EventWatcher = EventWatcher; - diff --git a/browser_patches/firefox/juggler/JugglerFrameParent.jsm b/browser_patches/firefox/juggler/JugglerFrameParent.jsm index e621fab240680..9c3b58898955e 100644 --- a/browser_patches/firefox/juggler/JugglerFrameParent.jsm +++ b/browser_patches/firefox/juggler/JugglerFrameParent.jsm @@ -1,13 +1,11 @@ "use strict"; -const { TargetRegistry } = ChromeUtils.import('chrome://juggler/content/TargetRegistry.js'); -const { Helper } = ChromeUtils.import('chrome://juggler/content/Helper.js'); +const { TargetRegistry } = ChromeUtils.importESModule('chrome://juggler/content/TargetRegistry.js'); +const { Helper } = ChromeUtils.importESModule('chrome://juggler/content/Helper.js'); const helper = new Helper(); -var EXPORTED_SYMBOLS = ['JugglerFrameParent']; - -class JugglerFrameParent extends JSWindowActorParent { +export class JugglerFrameParent extends JSWindowActorParent { constructor() { super(); } diff --git a/browser_patches/firefox/juggler/NetworkObserver.js b/browser_patches/firefox/juggler/NetworkObserver.js index 3fc9368d81c68..c063e0484d71b 100644 --- a/browser_patches/firefox/juggler/NetworkObserver.js +++ b/browser_patches/firefox/juggler/NetworkObserver.js @@ -4,9 +4,9 @@ "use strict"; -const {Helper} = ChromeUtils.import('chrome://juggler/content/Helper.js'); -const {NetUtil} = ChromeUtils.import('resource://gre/modules/NetUtil.jsm'); -const { ChannelEventSinkFactory } = ChromeUtils.import("chrome://remote/content/cdp/observers/ChannelEventSink.jsm"); +const {Helper} = ChromeUtils.importESModule('chrome://juggler/content/Helper.js'); +const {NetUtil} = ChromeUtils.importESModule('resource://gre/modules/NetUtil.sys.mjs'); +const { ChannelEventSinkFactory } = ChromeUtils.importESModule("chrome://remote/content/cdp/observers/ChannelEventSink.sys.mjs"); const Cc = Components.classes; @@ -28,7 +28,7 @@ const MAX_RESPONSE_STORAGE_SIZE = 100 * 1024 * 1024; const pageNetworkSymbol = Symbol('PageNetwork'); -class PageNetwork { +export class PageNetwork { static forPageTarget(target) { if (!target) return undefined; @@ -143,9 +143,10 @@ class NetworkRequest { const target = this._networkObserver._targetRegistry.targetForBrowserId(browsingContext.browserId); this._pageNetwork = PageNetwork.forPageTarget(target); } - this._expectingInterception = false; + this._shouldYieldInterceptionToServiceWorker = false; this._expectingResumedRequest = undefined; // { method, headers, postData } this._overriddenHeadersForRedirect = redirectedFrom?._overriddenHeadersForRedirect; + this._sentOnRequest = false; this._sentOnResponse = false; this._fulfilled = false; @@ -318,9 +319,8 @@ class NetworkRequest { const interceptController = this._fallThroughInterceptController(); if (interceptController && interceptController.shouldPrepareForIntercept(aURI, channel)) { // We assume that interceptController is a service worker if there is one, - // and yield interception to it. We are not going to intercept ourselves, - // so we send onRequest now. - this._sendOnRequest(false); + // and yield interception to it. + this._shouldYieldInterceptionToServiceWorker = true; return true; } @@ -329,12 +329,6 @@ class NetworkRequest { return false; } - // We do not want to intercept any redirects, because we are not able - // to intercept subresource redirects, and it's unreliable for main requests. - // We do not sendOnRequest here, because redirects do that in constructor. - if (this.redirectedFromId) - return false; - const shouldIntercept = this._shouldIntercept(); if (!shouldIntercept) { // We are not intercepting - ready to issue onRequest. @@ -342,21 +336,24 @@ class NetworkRequest { return false; } - this._expectingInterception = true; return true; } // nsINetworkInterceptController channelIntercepted(intercepted) { - if (!this._expectingInterception) { - // We are not intercepting, fall-through. - const interceptController = this._fallThroughInterceptController(); - if (interceptController) - interceptController.channelIntercepted(intercepted); + // Yield to a service worker if determined so in shouldPrepareForIntercept(). + const serviceWorker = this._shouldYieldInterceptionToServiceWorker ? this._fallThroughInterceptController() : undefined; + // Clear the flag to avoid an infinite loop. After service worker, we should intercept ourselves. + this._shouldYieldInterceptionToServiceWorker = false; + + if (serviceWorker) { + const interceptedChannel = intercepted.QueryInterface(Ci.nsIInterceptedChannel); + // If service worker will not actually intercept the request, we want to be called again. + interceptedChannel.interceptAfterServiceWorkerResets(); + serviceWorker.channelIntercepted(intercepted); return; } - this._expectingInterception = false; this._interceptedChannel = intercepted.QueryInterface(Ci.nsIInterceptedChannel); const pageNetwork = this._pageNetwork; @@ -410,6 +407,7 @@ class NetworkRequest { // See https://github.com/microsoft/playwright/issues/9418#issuecomment-944836244 if (aRequest !== this.httpChannel) return; + this._sendOnRequest(false); try { this._originalListener.onStartRequest(aRequest); } catch (e) { @@ -447,6 +445,10 @@ class NetworkRequest { } _shouldIntercept() { + // We do not want to intercept any redirects, because we are not able + // to intercept subresource redirects, and it's unreliable for main requests. + if (this.redirectedFromId) + return false; const pageNetwork = this._pageNetwork; if (!pageNetwork) return false; @@ -467,8 +469,15 @@ class NetworkRequest { } _sendOnRequest(isIntercepted) { - // Note: we call _sendOnRequest either after we intercepted the request, - // or at the first moment we know that we are not going to intercept. + if (this._sentOnRequest) { + // We can come here twice because: + // - Redirects call _sendOnRequest in the constructor and from inside interception. + // - All other requests might call _sendOnRequest from onStartRequest and from inside interception. + // - All requests call _sendOnRequest from _sendOnResponse to avoid responses without requests. + return; + } + this._sentOnRequest = true; + const pageNetwork = this._pageNetwork; if (!pageNetwork) return; @@ -491,11 +500,21 @@ class NetworkRequest { } _sendOnResponse(fromCache, opt_statusCode, opt_statusText) { + // For internal redirects, and perhaps something else that we lack test coverage for, + // we can arrive here before onStartRequest has fired. Make sure we + // notify about the request first. + this._sendOnRequest(false); + if (this._sentOnResponse) { - // We can come here twice because of internal redirects, e.g. service workers. + // We can come here twice because of an internal redirect, for example: + // - request was intercepted by a service worker; + // - HSTS redirect; + // - CORS preflight; + // - who knows what else? return; } this._sentOnResponse = true; + const pageNetwork = this._pageNetwork; if (!pageNetwork) return; @@ -514,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 { @@ -576,7 +597,7 @@ class NetworkRequest { } } -class NetworkObserver { +export class NetworkObserver { static instance() { return NetworkObserver._instance || null; } @@ -776,6 +797,10 @@ function clearRequestHeaders(httpChannel) { // We cannot remove the "host" header. if (header.name.toLowerCase() === 'host') continue; + // Keep the "cookie" header. If there is an override, it will be set anyway. + // Otherwise, we may delete a cookie that was set for a redirect. + if (header.name.toLowerCase() === 'cookie') + continue; httpChannel.setRequestHeader(header.name, '', false /* merge */); } } @@ -785,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) @@ -964,6 +1001,3 @@ PageNetwork.Events = { RequestFailed: Symbol('PageNetwork.Events.RequestFailed'), }; -var EXPORTED_SYMBOLS = ['NetworkObserver', 'PageNetwork']; -this.NetworkObserver = NetworkObserver; -this.PageNetwork = PageNetwork; diff --git a/browser_patches/firefox/juggler/SimpleChannel.js b/browser_patches/firefox/juggler/SimpleChannel.js index a4e1b19df4c6d..cc555451cdd49 100644 --- a/browser_patches/firefox/juggler/SimpleChannel.js +++ b/browser_patches/firefox/juggler/SimpleChannel.js @@ -79,7 +79,7 @@ class SimpleChannel { _setTimeout(cb, timeout) { // Lazy load on first call. - this._setTimeout = ChromeUtils.import('resource://gre/modules/Timer.jsm').setTimeout; + this._setTimeout = ChromeUtils.importESModule('resource://gre/modules/Timer.sys.mjs').setTimeout; this._setTimeout(cb, timeout); } @@ -251,6 +251,3 @@ class SimpleChannel { } } } - -var EXPORTED_SYMBOLS = ['SimpleChannel']; -this.SimpleChannel = SimpleChannel; diff --git a/browser_patches/firefox/juggler/TargetRegistry.js b/browser_patches/firefox/juggler/TargetRegistry.js index 2ffb53390d5a7..4bdf162ab64f7 100644 --- a/browser_patches/firefox/juggler/TargetRegistry.js +++ b/browser_patches/firefox/juggler/TargetRegistry.js @@ -2,12 +2,11 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -const {Helper} = ChromeUtils.import('chrome://juggler/content/Helper.js'); -const {SimpleChannel} = ChromeUtils.import('chrome://juggler/content/SimpleChannel.js'); -const {Preferences} = ChromeUtils.import("resource://gre/modules/Preferences.jsm"); -const {ContextualIdentityService} = ChromeUtils.import("resource://gre/modules/ContextualIdentityService.jsm"); -const {NetUtil} = ChromeUtils.import('resource://gre/modules/NetUtil.jsm'); -const {AppConstants} = ChromeUtils.import("resource://gre/modules/AppConstants.jsm"); +const {Helper} = ChromeUtils.importESModule('chrome://juggler/content/Helper.js'); +const {Preferences} = ChromeUtils.importESModule("resource://gre/modules/Preferences.sys.mjs"); +const {ContextualIdentityService} = ChromeUtils.importESModule("resource://gre/modules/ContextualIdentityService.sys.mjs"); +const {NetUtil} = ChromeUtils.importESModule('resource://gre/modules/NetUtil.sys.mjs'); +const {AppConstants} = ChromeUtils.importESModule("resource://gre/modules/AppConstants.sys.mjs"); const Cr = Components.results; @@ -23,6 +22,7 @@ const ALL_PERMISSIONS = [ let globalTabAndWindowActivationChain = Promise.resolve(); // This is a workaround for https://github.com/microsoft/playwright/issues/34586 +let didCreateFirstPage = false; let globalNewPageChain = Promise.resolve(); class DownloadInterceptor { @@ -104,7 +104,7 @@ class DownloadInterceptor { const screencastService = Cc['@mozilla.org/juggler/screencast;1'].getService(Ci.nsIScreencastService); -class TargetRegistry { +export class TargetRegistry { static instance() { return TargetRegistry._instance || null; } @@ -310,61 +310,68 @@ class TargetRegistry { } async newPage({browserContextId}) { - const result = globalNewPageChain.then(async () => { - const browserContext = this.browserContextForId(browserContextId); - const features = "chrome,dialog=no,all"; - // See _callWithURIToLoad in browser.js for the structure of window.arguments - // window.arguments[1]: unused (bug 871161) - // [2]: referrerInfo (nsIReferrerInfo) - // [3]: postData (nsIInputStream) - // [4]: allowThirdPartyFixup (bool) - // [5]: userContextId (int) - // [6]: originPrincipal (nsIPrincipal) - // [7]: originStoragePrincipal (nsIPrincipal) - // [8]: triggeringPrincipal (nsIPrincipal) - // [9]: allowInheritPrincipal (bool) - // [10]: csp (nsIContentSecurityPolicy) - // [11]: nsOpenWindowInfo - const args = Cc["@mozilla.org/array;1"].createInstance(Ci.nsIMutableArray); - const urlSupports = Cc["@mozilla.org/supports-string;1"].createInstance( - Ci.nsISupportsString - ); - urlSupports.data = 'about:blank'; - args.appendElement(urlSupports); // 0 - args.appendElement(undefined); // 1 - args.appendElement(undefined); // 2 - args.appendElement(undefined); // 3 - args.appendElement(undefined); // 4 - const userContextIdSupports = Cc[ - "@mozilla.org/supports-PRUint32;1" - ].createInstance(Ci.nsISupportsPRUint32); - userContextIdSupports.data = browserContext.userContextId; - args.appendElement(userContextIdSupports); // 5 - args.appendElement(undefined); // 6 - args.appendElement(undefined); // 7 - args.appendElement(Services.scriptSecurityManager.getSystemPrincipal()); // 8 - - const window = Services.ww.openWindow(null, AppConstants.BROWSER_CHROME_URL, '_blank', features, args); - await waitForWindowReady(window); - if (window.gBrowser.browsers.length !== 1) - throw new Error(`Unexpected number of tabs in the new window: ${window.gBrowser.browsers.length}`); - const browser = window.gBrowser.browsers[0]; - let target = this._browserToTarget.get(browser); - while (!target) { - await helper.awaitEvent(this, TargetRegistry.Events.TargetCreated); - target = this._browserToTarget.get(browser); - } - browser.focus(); - if (browserContext.crossProcessCookie.settings.timezoneId) { - if (await target.hasFailedToOverrideTimezone()) - throw new Error('Failed to override timezone'); - } - return target.id(); - }); + // When creating the very first page, we cannot create multiple in parallel. + // See https://github.com/microsoft/playwright/issues/34586. + if (didCreateFirstPage) + return this._newPageInternal({browserContextId}); + const result = globalNewPageChain.then(() => this._newPageInternal({browserContextId})); globalNewPageChain = result.catch(error => { /* swallow errors to keep chain running */ }); return result; } + async _newPageInternal({browserContextId}) { + const browserContext = this.browserContextForId(browserContextId); + const features = "chrome,dialog=no,all"; + // See _callWithURIToLoad in browser.js for the structure of window.arguments + // window.arguments[1]: unused (bug 871161) + // [2]: referrerInfo (nsIReferrerInfo) + // [3]: postData (nsIInputStream) + // [4]: allowThirdPartyFixup (bool) + // [5]: userContextId (int) + // [6]: originPrincipal (nsIPrincipal) + // [7]: originStoragePrincipal (nsIPrincipal) + // [8]: triggeringPrincipal (nsIPrincipal) + // [9]: allowInheritPrincipal (bool) + // [10]: csp (nsIContentSecurityPolicy) + // [11]: nsOpenWindowInfo + const args = Cc["@mozilla.org/array;1"].createInstance(Ci.nsIMutableArray); + const urlSupports = Cc["@mozilla.org/supports-string;1"].createInstance( + Ci.nsISupportsString + ); + urlSupports.data = 'about:blank'; + args.appendElement(urlSupports); // 0 + args.appendElement(undefined); // 1 + args.appendElement(undefined); // 2 + args.appendElement(undefined); // 3 + args.appendElement(undefined); // 4 + const userContextIdSupports = Cc[ + "@mozilla.org/supports-PRUint32;1" + ].createInstance(Ci.nsISupportsPRUint32); + userContextIdSupports.data = browserContext.userContextId; + args.appendElement(userContextIdSupports); // 5 + args.appendElement(undefined); // 6 + args.appendElement(undefined); // 7 + args.appendElement(Services.scriptSecurityManager.getSystemPrincipal()); // 8 + + const window = Services.ww.openWindow(null, AppConstants.BROWSER_CHROME_URL, '_blank', features, args); + await waitForWindowReady(window); + if (window.gBrowser.browsers.length !== 1) + throw new Error(`Unexpected number of tabs in the new window: ${window.gBrowser.browsers.length}`); + const browser = window.gBrowser.browsers[0]; + let target = this._browserToTarget.get(browser); + while (!target) { + await helper.awaitEvent(this, TargetRegistry.Events.TargetCreated); + target = this._browserToTarget.get(browser); + } + browser.focus(); + if (browserContext.crossProcessCookie.settings.timezoneId) { + if (await target.hasFailedToOverrideTimezone()) + throw new Error('Failed to override timezone'); + } + didCreateFirstPage = true; + return target.id(); + } + targets() { return Array.from(this._browserToTarget.values()); } @@ -378,7 +385,7 @@ class TargetRegistry { } } -class PageTarget { +export class PageTarget { constructor(registry, win, tab, browserContext, opener) { helper.decorateAsEventEmitter(this); @@ -1286,7 +1293,3 @@ TargetRegistry.Events = { DownloadFinished: Symbol('TargetRegistry.Events.DownloadFinished'), ScreencastStopped: Symbol('TargetRegistry.ScreencastStopped'), }; - -var EXPORTED_SYMBOLS = ['TargetRegistry', 'PageTarget']; -this.TargetRegistry = TargetRegistry; -this.PageTarget = PageTarget; diff --git a/browser_patches/firefox/juggler/components/Juggler.js b/browser_patches/firefox/juggler/components/Juggler.js index aa51a8887929f..6121c4d3928bc 100644 --- a/browser_patches/firefox/juggler/components/Juggler.js +++ b/browser_patches/firefox/juggler/components/Juggler.js @@ -2,16 +2,17 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -var EXPORTED_SYMBOLS = ["Juggler", "JugglerFactory"]; - -const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); -const {ComponentUtils} = ChromeUtils.import("resource://gre/modules/ComponentUtils.jsm"); -const {Dispatcher} = ChromeUtils.import("chrome://juggler/content/protocol/Dispatcher.js"); -const {BrowserHandler} = ChromeUtils.import("chrome://juggler/content/protocol/BrowserHandler.js"); -const {NetworkObserver} = ChromeUtils.import("chrome://juggler/content/NetworkObserver.js"); -const {TargetRegistry} = ChromeUtils.import("chrome://juggler/content/TargetRegistry.js"); -const {Helper} = ChromeUtils.import('chrome://juggler/content/Helper.js'); -const {ActorManagerParent} = ChromeUtils.import('resource://gre/modules/ActorManagerParent.jsm'); +// Load SimpleChannel in browser-process global. +Services.scriptloader.loadSubScript('chrome://juggler/content/SimpleChannel.js'); + +const {XPCOMUtils} = ChromeUtils.importESModule("resource://gre/modules/XPCOMUtils.sys.mjs"); +const {ComponentUtils} = ChromeUtils.importESModule("resource://gre/modules/ComponentUtils.sys.mjs"); +const {Dispatcher} = ChromeUtils.importESModule("chrome://juggler/content/protocol/Dispatcher.js"); +const {BrowserHandler} = ChromeUtils.importESModule("chrome://juggler/content/protocol/BrowserHandler.js"); +const {NetworkObserver} = ChromeUtils.importESModule("chrome://juggler/content/NetworkObserver.js"); +const {TargetRegistry} = ChromeUtils.importESModule("chrome://juggler/content/TargetRegistry.js"); +const {Helper} = ChromeUtils.importESModule('chrome://juggler/content/Helper.js'); +const {ActorManagerParent} = ChromeUtils.importESModule('resource://gre/modules/ActorManagerParent.sys.mjs'); const helper = new Helper(); const Cc = Components.classes; @@ -21,10 +22,10 @@ const Ci = Components.interfaces; ActorManagerParent.addJSWindowActors({ JugglerFrame: { parent: { - moduleURI: 'chrome://juggler/content/JugglerFrameParent.jsm', + esModuleURI: 'chrome://juggler/content/JugglerFrameParent.jsm', }, child: { - moduleURI: 'chrome://juggler/content/content/JugglerFrameChild.jsm', + esModuleURI: 'chrome://juggler/content/content/JugglerFrameChild.jsm', events: { // Normally, we instantiate an actor when a new window is created. DOMWindowCreated: {}, @@ -45,7 +46,7 @@ ActorManagerParent.addJSWindowActors({ let browserStartupFinishedCallback; let browserStartupFinishedPromise = new Promise(x => browserStartupFinishedCallback = x); -class Juggler { +export class Juggler { get classDescription() { return "Sample command-line handler"; } get classID() { return Components.ID('{f7a74a33-e2ab-422d-b022-4fb213dd2639}'); } get contractID() { return "@mozilla.org/remote/juggler;1" } @@ -154,7 +155,7 @@ class Juggler { const jugglerInstance = new Juggler(); // This is used by the XPCOM codepath which expects a constructor -var JugglerFactory = function() { +export var JugglerFactory = function() { return jugglerInstance; }; diff --git a/browser_patches/firefox/juggler/components/components.conf b/browser_patches/firefox/juggler/components/components.conf index e5bc6523b10cd..955b38ab9ccec 100644 --- a/browser_patches/firefox/juggler/components/components.conf +++ b/browser_patches/firefox/juggler/components/components.conf @@ -11,7 +11,7 @@ Classes = [ "command-line-handler": "m-remote", "profile-after-change": "Juggler", }, - "jsm": "chrome://juggler/content/components/Juggler.js", + "esModule": "chrome://juggler/content/components/Juggler.js", "constructor": "JugglerFactory", }, ] diff --git a/browser_patches/firefox/juggler/content/FrameTree.js b/browser_patches/firefox/juggler/content/FrameTree.js index 721f392b9bccb..09a95b3548df9 100644 --- a/browser_patches/firefox/juggler/content/FrameTree.js +++ b/browser_patches/firefox/juggler/content/FrameTree.js @@ -7,13 +7,11 @@ const Ci = Components.interfaces; const Cr = Components.results; const Cu = Components.utils; -const {Helper} = ChromeUtils.import('chrome://juggler/content/Helper.js'); -const {SimpleChannel} = ChromeUtils.import('chrome://juggler/content/SimpleChannel.js'); -const {Runtime} = ChromeUtils.import('chrome://juggler/content/content/Runtime.js'); +const {Helper} = ChromeUtils.importESModule('chrome://juggler/content/Helper.js'); const helper = new Helper(); -class FrameTree { +export class FrameTree { constructor(rootBrowsingContext) { helper.decorateAsEventEmitter(this); @@ -690,6 +688,3 @@ function channelId(channel) { } -var EXPORTED_SYMBOLS = ['FrameTree']; -this.FrameTree = FrameTree; - diff --git a/browser_patches/firefox/juggler/content/JugglerFrameChild.jsm b/browser_patches/firefox/juggler/content/JugglerFrameChild.jsm index 05d91473d3a8d..af060c57aac90 100644 --- a/browser_patches/firefox/juggler/content/JugglerFrameChild.jsm +++ b/browser_patches/firefox/juggler/content/JugglerFrameChild.jsm @@ -1,7 +1,7 @@ "use strict"; -const { Helper } = ChromeUtils.import('chrome://juggler/content/Helper.js'); -const { initialize } = ChromeUtils.import('chrome://juggler/content/content/main.js'); +const { Helper } = ChromeUtils.importESModule('chrome://juggler/content/Helper.js'); +const { initialize } = ChromeUtils.importESModule('chrome://juggler/content/content/main.js'); const Ci = Components.interfaces; const helper = new Helper(); @@ -10,7 +10,7 @@ let sameProcessInstanceNumber = 0; const topBrowingContextToAgents = new Map(); -class JugglerFrameChild extends JSWindowActorChild { +export class JugglerFrameChild extends JSWindowActorChild { constructor() { super(); @@ -83,4 +83,3 @@ class JugglerFrameChild extends JSWindowActorChild { receiveMessage() { } } -var EXPORTED_SYMBOLS = ['JugglerFrameChild']; diff --git a/browser_patches/firefox/juggler/content/PageAgent.js b/browser_patches/firefox/juggler/content/PageAgent.js index 255b84f726662..2ff5e6b922b55 100644 --- a/browser_patches/firefox/juggler/content/PageAgent.js +++ b/browser_patches/firefox/juggler/content/PageAgent.js @@ -8,9 +8,9 @@ const Ci = Components.interfaces; const Cr = Components.results; const Cu = Components.utils; -const {Helper} = ChromeUtils.import('chrome://juggler/content/Helper.js'); -const {NetUtil} = ChromeUtils.import('resource://gre/modules/NetUtil.jsm'); -const {setTimeout} = ChromeUtils.import('resource://gre/modules/Timer.jsm'); +const {Helper} = ChromeUtils.importESModule('chrome://juggler/content/Helper.js'); +const {NetUtil} = ChromeUtils.importESModule('resource://gre/modules/NetUtil.sys.mjs'); +const {setTimeout} = ChromeUtils.importESModule('resource://gre/modules/Timer.sys.mjs'); const dragService = Cc["@mozilla.org/widget/dragservice;1"].getService( Ci.nsIDragService @@ -51,7 +51,7 @@ class WorkerData { } } -class PageAgent { +export class PageAgent { constructor(browserChannel, frameTree) { this._browserChannel = browserChannel; this._browserPage = browserChannel.connect('page'); @@ -575,7 +575,7 @@ class PageAgent { // We crash by using js-ctypes and dereferencing // a bad pointer. The crash should happen immediately // upon loading this frame script. - const { ctypes } = ChromeUtils.import('resource://gre/modules/ctypes.jsm'); + const { ctypes } = ChromeUtils.importESModule('resource://gre/modules/ctypes.sys.mjs'); ChromeUtils.privateNoteIntentionalCrash(); const zero = new ctypes.intptr_t(8); const badptr = ctypes.cast(zero, ctypes.PointerType(ctypes.int32_t)); @@ -709,6 +709,3 @@ class PageAgent { } } -var EXPORTED_SYMBOLS = ['PageAgent']; -this.PageAgent = PageAgent; - diff --git a/browser_patches/firefox/juggler/content/Runtime.js b/browser_patches/firefox/juggler/content/Runtime.js index a5fa7a03dd343..ad8720a1d3e36 100644 --- a/browser_patches/firefox/juggler/content/Runtime.js +++ b/browser_patches/firefox/juggler/content/Runtime.js @@ -8,8 +8,8 @@ if (!this.Debugger) { // Worker has a Debugger defined already. - const {addDebuggerToGlobal} = ChromeUtils.import("resource://gre/modules/jsdebugger.jsm", {}); - addDebuggerToGlobal(Components.utils.getGlobalForObject(this)); + const {addDebuggerToGlobal} = ChromeUtils.importESModule("resource://gre/modules/jsdebugger.sys.mjs"); + addDebuggerToGlobal(Components.utils.getGlobalForObject(globalThis)); } let lastId = 0; @@ -596,5 +596,5 @@ function emitEvent(event, ...args) { listener.call(null, ...args); } -var EXPORTED_SYMBOLS = ['Runtime']; -this.Runtime = Runtime; +// Export Runtime to global. +globalThis.Runtime = Runtime; diff --git a/browser_patches/firefox/juggler/content/main.js b/browser_patches/firefox/juggler/content/main.js index 7eaa704059711..68fb364eadb4e 100644 --- a/browser_patches/firefox/juggler/content/main.js +++ b/browser_patches/firefox/juggler/content/main.js @@ -2,14 +2,20 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -const {Helper} = ChromeUtils.import('chrome://juggler/content/Helper.js'); -const {FrameTree} = ChromeUtils.import('chrome://juggler/content/content/FrameTree.js'); -const {SimpleChannel} = ChromeUtils.import('chrome://juggler/content/SimpleChannel.js'); -const {PageAgent} = ChromeUtils.import('chrome://juggler/content/content/PageAgent.js'); +// Load SimpleChannel and Runtime in content process's global. +// NOTE: since these have to exist in both Worker and main threads, and we do +// not know a way to load ES Modules in worker threads, we have to use the loadSubScript +// utility instead. +Services.scriptloader.loadSubScript('chrome://juggler/content/SimpleChannel.js'); +Services.scriptloader.loadSubScript('chrome://juggler/content/content/Runtime.js'); + +const {Helper} = ChromeUtils.importESModule('chrome://juggler/content/Helper.js'); +const {FrameTree} = ChromeUtils.importESModule('chrome://juggler/content/content/FrameTree.js'); +const {PageAgent} = ChromeUtils.importESModule('chrome://juggler/content/content/PageAgent.js'); const helper = new Helper(); -function initialize(browsingContext, docShell) { +export function initialize(browsingContext, docShell) { const data = { channel: undefined, pageAgent: undefined, frameTree: undefined, failedToOverrideTimezone: false }; const applySetting = { @@ -114,6 +120,3 @@ function initialize(browsingContext, docShell) { return data; } - -var EXPORTED_SYMBOLS = ['initialize']; -this.initialize = initialize; diff --git a/browser_patches/firefox/juggler/protocol/BrowserHandler.js b/browser_patches/firefox/juggler/protocol/BrowserHandler.js index e92b6dfefeb5b..035a53bb688c9 100644 --- a/browser_patches/firefox/juggler/protocol/BrowserHandler.js +++ b/browser_patches/firefox/juggler/protocol/BrowserHandler.js @@ -4,15 +4,15 @@ "use strict"; -const {AddonManager} = ChromeUtils.import("resource://gre/modules/AddonManager.jsm"); -const {TargetRegistry} = ChromeUtils.import("chrome://juggler/content/TargetRegistry.js"); -const {Helper} = ChromeUtils.import('chrome://juggler/content/Helper.js'); -const {PageHandler} = ChromeUtils.import("chrome://juggler/content/protocol/PageHandler.js"); -const {AppConstants} = ChromeUtils.import("resource://gre/modules/AppConstants.jsm"); +const {AddonManager} = ChromeUtils.importESModule("resource://gre/modules/AddonManager.sys.mjs"); +const {TargetRegistry} = ChromeUtils.importESModule("chrome://juggler/content/TargetRegistry.js"); +const {Helper} = ChromeUtils.importESModule('chrome://juggler/content/Helper.js'); +const {PageHandler} = ChromeUtils.importESModule("chrome://juggler/content/protocol/PageHandler.js"); +const {AppConstants} = ChromeUtils.importESModule("resource://gre/modules/AppConstants.sys.mjs"); const helper = new Helper(); -class BrowserHandler { +export class BrowserHandler { constructor(session, dispatcher, targetRegistry, startCompletePromise, onclose) { this._session = session; this._dispatcher = dispatcher; @@ -313,6 +313,3 @@ async function waitForWindowClosed(browserWindow) { function nullToUndefined(value) { return value === null ? undefined : value; } - -var EXPORTED_SYMBOLS = ['BrowserHandler']; -this.BrowserHandler = BrowserHandler; diff --git a/browser_patches/firefox/juggler/protocol/Dispatcher.js b/browser_patches/firefox/juggler/protocol/Dispatcher.js index 8542461d529eb..7a65d0a1170c1 100644 --- a/browser_patches/firefox/juggler/protocol/Dispatcher.js +++ b/browser_patches/firefox/juggler/protocol/Dispatcher.js @@ -2,12 +2,13 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -const {protocol, checkScheme} = ChromeUtils.import("chrome://juggler/content/protocol/Protocol.js"); -const {Helper} = ChromeUtils.import('chrome://juggler/content/Helper.js'); +const {protocol} = ChromeUtils.importESModule("chrome://juggler/content/protocol/Protocol.js"); +const {checkScheme} = ChromeUtils.importESModule("chrome://juggler/content/protocol/PrimitiveTypes.js"); +const {Helper} = ChromeUtils.importESModule('chrome://juggler/content/Helper.js'); const helper = new Helper(); -class Dispatcher { +export class Dispatcher { /** * @param {Connection} connection */ @@ -132,7 +133,3 @@ class ProtocolSession { return await this._handler[method](params); } } - -this.EXPORTED_SYMBOLS = ['Dispatcher']; -this.Dispatcher = Dispatcher; - diff --git a/browser_patches/firefox/juggler/protocol/PageHandler.js b/browser_patches/firefox/juggler/protocol/PageHandler.js index 5892c8860331f..1dab7d8803782 100644 --- a/browser_patches/firefox/juggler/protocol/PageHandler.js +++ b/browser_patches/firefox/juggler/protocol/PageHandler.js @@ -4,11 +4,11 @@ "use strict"; -const {Helper, EventWatcher} = ChromeUtils.import('chrome://juggler/content/Helper.js'); -const {NetUtil} = ChromeUtils.import('resource://gre/modules/NetUtil.jsm'); -const {NetworkObserver, PageNetwork} = ChromeUtils.import('chrome://juggler/content/NetworkObserver.js'); -const {PageTarget} = ChromeUtils.import('chrome://juggler/content/TargetRegistry.js'); -const {setTimeout} = ChromeUtils.import('resource://gre/modules/Timer.jsm'); +const {Helper, EventWatcher} = ChromeUtils.importESModule('chrome://juggler/content/Helper.js'); +const {NetUtil} = ChromeUtils.importESModule('resource://gre/modules/NetUtil.sys.mjs'); +const {NetworkObserver, PageNetwork} = ChromeUtils.importESModule('chrome://juggler/content/NetworkObserver.js'); +const {PageTarget} = ChromeUtils.importESModule('chrome://juggler/content/TargetRegistry.js'); +const {setTimeout} = ChromeUtils.importESModule('resource://gre/modules/Timer.sys.mjs'); const Cc = Components.classes; const Ci = Components.interfaces; @@ -65,7 +65,7 @@ class WorkerHandler { } } -class PageHandler { +export class PageHandler { constructor(target, session, contentChannel) { this._session = session; this._contentChannel = contentChannel; @@ -691,6 +691,3 @@ class PageHandler { return await worker.sendMessage(JSON.parse(message)); } } - -var EXPORTED_SYMBOLS = ['PageHandler']; -this.PageHandler = PageHandler; diff --git a/browser_patches/firefox/juggler/protocol/PrimitiveTypes.js b/browser_patches/firefox/juggler/protocol/PrimitiveTypes.js index 5799038f19cbc..ca6d1ec4f60f2 100644 --- a/browser_patches/firefox/juggler/protocol/PrimitiveTypes.js +++ b/browser_patches/firefox/juggler/protocol/PrimitiveTypes.js @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -const t = {}; +export const t = {}; t.String = function(x, details = {}, path = ['']) { if (typeof x === 'string' || typeof x === 'String') @@ -96,7 +96,7 @@ function beauty(path, obj) { return `property "${path.join('.')}" - ${JSON.stringify(obj, null, 2)}`; } -function checkScheme(scheme, x, details = {}, path = ['']) { +export function checkScheme(scheme, x, details = {}, path = ['']) { if (!scheme) throw new Error(`ILLDEFINED SCHEME: ${path.join('.')}`); if (typeof scheme === 'object') { @@ -142,6 +142,3 @@ test(t.Either(t.String, t.Number), {}); */ -this.t = t; -this.checkScheme = checkScheme; -this.EXPORTED_SYMBOLS = ['t', 'checkScheme']; diff --git a/browser_patches/firefox/juggler/protocol/Protocol.js b/browser_patches/firefox/juggler/protocol/Protocol.js index f18dff61bf17f..4cb44d679ce0b 100644 --- a/browser_patches/firefox/juggler/protocol/Protocol.js +++ b/browser_patches/firefox/juggler/protocol/Protocol.js @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -const {t, checkScheme} = ChromeUtils.import('chrome://juggler/content/protocol/PrimitiveTypes.js'); +const {t} = ChromeUtils.importESModule('chrome://juggler/content/protocol/PrimitiveTypes.js'); // Protocol-specific types. const browserTypes = {}; @@ -1018,8 +1018,6 @@ const Accessibility = { } } -this.protocol = { +export const protocol = { domains: {Browser, Heap, Page, Runtime, Network, Accessibility}, }; -this.checkScheme = checkScheme; -this.EXPORTED_SYMBOLS = ['protocol', 'checkScheme']; diff --git a/browser_patches/firefox/patches/bootstrap.diff b/browser_patches/firefox/patches/bootstrap.diff index 094a734019258..6f70b0342c8ec 100644 --- a/browser_patches/firefox/patches/bootstrap.diff +++ b/browser_patches/firefox/patches/bootstrap.diff @@ -89,7 +89,7 @@ index 8167d2b81c918e02ce757f7f448f22e07c29d140..3ae798880acfd8aa965ae08051f2f818 DWORD creationFlags = CREATE_SUSPENDED | CREATE_UNICODE_ENVIRONMENT; diff --git a/browser/installer/allowed-dupes.mn b/browser/installer/allowed-dupes.mn -index 213a99ed433d5219c2b9a64baad82d14cdbcd432..ee4f6484cdfe80899c28a1d9607494e520bfc93d 100644 +index a097c2c56a665204ff7b5593c7faf836366801cf..235a4e224e08c22870c6913e335f0b6020b3e7da 100644 --- a/browser/installer/allowed-dupes.mn +++ b/browser/installer/allowed-dupes.mn @@ -67,6 +67,12 @@ browser/features/webcompat@mozilla.org/shims/empty-shim.txt @@ -106,7 +106,7 @@ index 213a99ed433d5219c2b9a64baad82d14cdbcd432..ee4f6484cdfe80899c28a1d9607494e5 browser/chrome/browser/content/activity-stream/data/content/tippytop/favicons/allegro-pl.ico browser/defaults/settings/main/search-config-icons/96327a73-c433-5eb4-a16d-b090cadfb80b diff --git a/browser/installer/package-manifest.in b/browser/installer/package-manifest.in -index beae3018bb533529555496433b90403827ba07fc..3f3c750f4cef768b5429492c0077616505262cb9 100644 +index 89cff6b562a82bd3a9a5d268abd4373199b31fac..e58dbf0ab0b06e84f6dac64698d11c6268091204 100644 --- a/browser/installer/package-manifest.in +++ b/browser/installer/package-manifest.in @@ -196,6 +196,9 @@ @@ -167,10 +167,10 @@ index d49c6fbf1bf83b832795fa674f6b41f223eef812..7ea3540947ff5f61b15f27fbf4b95564 const transportProvider = { setListener(upgradeListener) { diff --git a/docshell/base/BrowsingContext.cpp b/docshell/base/BrowsingContext.cpp -index 28e9d14bd7979798025f9fc30d9a45527488c34c..d6abf1c3e7e2b2cdfd51351ced4aa6fb0d51327b 100644 +index 2425779a7767e9350ee2afc4aea111a090c7f909..393eb86bf2d9a8f778bfce560a9fb3bf528ba558 100644 --- a/docshell/base/BrowsingContext.cpp +++ b/docshell/base/BrowsingContext.cpp -@@ -106,8 +106,15 @@ struct ParamTraits +@@ -108,8 +108,15 @@ struct ParamTraits template <> struct ParamTraits @@ -188,7 +188,7 @@ index 28e9d14bd7979798025f9fc30d9a45527488c34c..d6abf1c3e7e2b2cdfd51351ced4aa6fb template <> struct ParamTraits -@@ -2887,6 +2894,32 @@ void BrowsingContext::DidSet(FieldIndex, +@@ -2891,6 +2898,32 @@ void BrowsingContext::DidSet(FieldIndex, PresContextAffectingFieldChanged(); } @@ -222,7 +222,7 @@ index 28e9d14bd7979798025f9fc30d9a45527488c34c..d6abf1c3e7e2b2cdfd51351ced4aa6fb nsString&& aOldValue) { MOZ_ASSERT(IsTop()); diff --git a/docshell/base/BrowsingContext.h b/docshell/base/BrowsingContext.h -index 13815ddf7e13825970cafda19ca24412a5150b53..71c7ae2fce1d92614a60b2aba85bbd70629f682f 100644 +index eb183cb5c0751e43ea674f9e52441a5a82f186e0..79c5d8110faa89779dd0c16ba00620e7e65d06f5 100644 --- a/docshell/base/BrowsingContext.h +++ b/docshell/base/BrowsingContext.h @@ -203,10 +203,10 @@ struct EmbedderColorSchemes { @@ -248,7 +248,7 @@ index 13815ddf7e13825970cafda19ca24412a5150b53..71c7ae2fce1d92614a60b2aba85bbd70 /* The number of entries added to the session history because of this \ * browsing context. */ \ FIELD(HistoryEntryCount, uint32_t) \ -@@ -948,6 +951,14 @@ class BrowsingContext : public nsILoadContext, public nsWrapperCache { +@@ -950,6 +953,14 @@ class BrowsingContext : public nsILoadContext, public nsWrapperCache { return GetForcedColorsOverride(); } @@ -263,7 +263,7 @@ index 13815ddf7e13825970cafda19ca24412a5150b53..71c7ae2fce1d92614a60b2aba85bbd70 bool IsInBFCache() const; bool AllowJavascript() const { return GetAllowJavascript(); } -@@ -1107,6 +1118,11 @@ class BrowsingContext : public nsILoadContext, public nsWrapperCache { +@@ -1112,6 +1123,11 @@ class BrowsingContext : public nsILoadContext, public nsWrapperCache { return IsTop(); } @@ -275,7 +275,7 @@ index 13815ddf7e13825970cafda19ca24412a5150b53..71c7ae2fce1d92614a60b2aba85bbd70 bool CanSet(FieldIndex, dom::ForcedColorsOverride, ContentParent*) { return IsTop(); -@@ -1125,10 +1141,22 @@ class BrowsingContext : public nsILoadContext, public nsWrapperCache { +@@ -1130,10 +1146,22 @@ class BrowsingContext : public nsILoadContext, public nsWrapperCache { void DidSet(FieldIndex, dom::ForcedColorsOverride aOldValue); @@ -299,10 +299,10 @@ index 13815ddf7e13825970cafda19ca24412a5150b53..71c7ae2fce1d92614a60b2aba85bbd70 bool CanSet(FieldIndex, bool, ContentParent*) { diff --git a/docshell/base/CanonicalBrowsingContext.cpp b/docshell/base/CanonicalBrowsingContext.cpp -index 671a12de84d3b01c4331dbbb2fac050ce061cda1..afcd95e77185e6d606503b7c01d6ab48cc236cc8 100644 +index bef42c91d6f88922c8c101f3675325d828872aaf..8eb68c441fbef8ecbe5e90c118ccc00813564577 100644 --- a/docshell/base/CanonicalBrowsingContext.cpp +++ b/docshell/base/CanonicalBrowsingContext.cpp -@@ -323,6 +323,8 @@ void CanonicalBrowsingContext::ReplacedBy( +@@ -324,6 +324,8 @@ void CanonicalBrowsingContext::ReplacedBy( txn.SetShouldDelayMediaFromStart(GetShouldDelayMediaFromStart()); txn.SetForceOffline(GetForceOffline()); txn.SetTopInnerSizeForRFP(GetTopInnerSizeForRFP()); @@ -311,7 +311,7 @@ index 671a12de84d3b01c4331dbbb2fac050ce061cda1..afcd95e77185e6d606503b7c01d6ab48 // Propagate some settings on BrowsingContext replacement so they're not lost // on bfcached navigations. These are important for GeckoView (see bug -@@ -1600,6 +1602,12 @@ void CanonicalBrowsingContext::LoadURI(nsIURI* aURI, +@@ -1635,6 +1637,12 @@ void CanonicalBrowsingContext::LoadURI(nsIURI* aURI, return; } @@ -325,7 +325,7 @@ index 671a12de84d3b01c4331dbbb2fac050ce061cda1..afcd95e77185e6d606503b7c01d6ab48 } diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp -index f3069febc1bd9f3ff6acbe162b5475963e004e6c..65ab560c9f13c837c9ed6af15704738700b0e14f 100644 +index 32c537d6be90247af8d778048c6d27f3800d4b02..b72196b0694828489f8ad27c209f49f0d41c43cb 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -15,6 +15,12 @@ @@ -348,16 +348,16 @@ index f3069febc1bd9f3ff6acbe162b5475963e004e6c..65ab560c9f13c837c9ed6af157047387 +#include "mozilla/dom/Geolocation.h" #include "mozilla/dom/HTMLAnchorElement.h" #include "mozilla/dom/HTMLIFrameElement.h" - #include "mozilla/dom/PerformanceNavigation.h" -@@ -90,6 +97,7 @@ - #include "mozilla/dom/JSWindowActorChild.h" + #include "mozilla/dom/Navigation.h" +@@ -94,6 +101,7 @@ #include "mozilla/dom/DocumentBinding.h" + #include "mozilla/glean/DocshellMetrics.h" #include "mozilla/ipc/ProtocolUtils.h" +#include "mozilla/dom/WorkerCommon.h" #include "mozilla/net/DocumentChannel.h" #include "mozilla/net/DocumentChannelChild.h" #include "mozilla/net/ParentChannelWrapper.h" -@@ -113,6 +121,7 @@ +@@ -117,6 +125,7 @@ #include "nsIDocumentViewer.h" #include "mozilla/dom/Document.h" #include "nsHTMLDocument.h" @@ -365,7 +365,7 @@ index f3069febc1bd9f3ff6acbe162b5475963e004e6c..65ab560c9f13c837c9ed6af157047387 #include "nsIDocumentLoaderFactory.h" #include "nsIDOMWindow.h" #include "nsIEditingSession.h" -@@ -207,6 +216,7 @@ +@@ -211,6 +220,7 @@ #include "nsGlobalWindowInner.h" #include "nsGlobalWindowOuter.h" #include "nsJSEnvironment.h" @@ -373,7 +373,7 @@ index f3069febc1bd9f3ff6acbe162b5475963e004e6c..65ab560c9f13c837c9ed6af157047387 #include "nsNetCID.h" #include "nsNetUtil.h" #include "nsObjectLoadingContent.h" -@@ -347,6 +357,14 @@ nsDocShell::nsDocShell(BrowsingContext* aBrowsingContext, +@@ -352,6 +362,14 @@ nsDocShell::nsDocShell(BrowsingContext* aBrowsingContext, mAllowDNSPrefetch(true), mAllowWindowControl(true), mCSSErrorReportingEnabled(false), @@ -388,7 +388,7 @@ index f3069febc1bd9f3ff6acbe162b5475963e004e6c..65ab560c9f13c837c9ed6af157047387 mAllowAuth(mItemType == typeContent), mAllowKeywordFixup(false), mDisableMetaRefreshWhenInactive(false), -@@ -3019,6 +3037,232 @@ nsDocShell::GetMessageManager(ContentFrameMessageManager** aMessageManager) { +@@ -3024,6 +3042,232 @@ nsDocShell::GetMessageManager(ContentFrameMessageManager** aMessageManager) { return NS_OK; } @@ -621,7 +621,7 @@ index f3069febc1bd9f3ff6acbe162b5475963e004e6c..65ab560c9f13c837c9ed6af157047387 NS_IMETHODIMP nsDocShell::GetIsNavigating(bool* aOut) { *aOut = mIsNavigating; -@@ -4715,7 +4959,7 @@ nsDocShell::GetVisibility(bool* aVisibility) { +@@ -4731,7 +4975,7 @@ nsDocShell::GetVisibility(bool* aVisibility) { } void nsDocShell::ActivenessMaybeChanged() { @@ -630,7 +630,7 @@ index f3069febc1bd9f3ff6acbe162b5475963e004e6c..65ab560c9f13c837c9ed6af157047387 if (RefPtr presShell = GetPresShell()) { presShell->ActivenessMaybeChanged(); } -@@ -6639,6 +6883,10 @@ bool nsDocShell::CanSavePresentation(uint32_t aLoadType, +@@ -6658,6 +6902,10 @@ bool nsDocShell::CanSavePresentation(uint32_t aLoadType, return false; // no entry to save into } @@ -641,7 +641,7 @@ index f3069febc1bd9f3ff6acbe162b5475963e004e6c..65ab560c9f13c837c9ed6af157047387 MOZ_ASSERT(!mozilla::SessionHistoryInParent(), "mOSHE cannot be non-null with SHIP"); nsCOMPtr viewer = mOSHE->GetDocumentViewer(); -@@ -8377,6 +8625,12 @@ nsresult nsDocShell::PerformRetargeting(nsDocShellLoadState* aLoadState) { +@@ -8399,6 +8647,12 @@ nsresult nsDocShell::PerformRetargeting(nsDocShellLoadState* aLoadState) { true, // aForceNoOpener getter_AddRefs(newBC)); MOZ_ASSERT(!newBC); @@ -654,7 +654,7 @@ index f3069febc1bd9f3ff6acbe162b5475963e004e6c..65ab560c9f13c837c9ed6af157047387 return rv; } -@@ -9531,6 +9785,16 @@ nsresult nsDocShell::InternalLoad(nsDocShellLoadState* aLoadState, +@@ -9572,6 +9826,16 @@ nsresult nsDocShell::InternalLoad(nsDocShellLoadState* aLoadState, nsINetworkPredictor::PREDICT_LOAD, attrs, nullptr); nsCOMPtr req; @@ -671,7 +671,7 @@ index f3069febc1bd9f3ff6acbe162b5475963e004e6c..65ab560c9f13c837c9ed6af157047387 rv = DoURILoad(aLoadState, aCacheKey, getter_AddRefs(req)); if (NS_SUCCEEDED(rv)) { -@@ -12733,6 +12997,9 @@ class OnLinkClickEvent : public Runnable { +@@ -12791,6 +13055,9 @@ class OnLinkClickEvent : public Runnable { mHandler->OnLinkClickSync(mContent, mLoadState, mNoOpenerImplied, mTriggeringPrincipal); } @@ -681,7 +681,7 @@ index f3069febc1bd9f3ff6acbe162b5475963e004e6c..65ab560c9f13c837c9ed6af157047387 return NS_OK; } -@@ -12819,6 +13086,8 @@ nsresult nsDocShell::OnLinkClick( +@@ -12877,6 +13144,8 @@ nsresult nsDocShell::OnLinkClick( nsCOMPtr ev = new OnLinkClickEvent( this, aContent, loadState, noOpenerImplied, aTriggeringPrincipal); @@ -691,7 +691,7 @@ index f3069febc1bd9f3ff6acbe162b5475963e004e6c..65ab560c9f13c837c9ed6af157047387 } diff --git a/docshell/base/nsDocShell.h b/docshell/base/nsDocShell.h -index 888741f8490d6f0e885ed0ce73115c16e7bbe821..9cb32a1ec61bc4cb67f5fc5bb1fa723055bb1eaa 100644 +index f22a333733322ad17f097d7edd46af21a687906c..6bcf8ca9f9cd64dc9f5695d00e0a3e6a97978f02 100644 --- a/docshell/base/nsDocShell.h +++ b/docshell/base/nsDocShell.h @@ -15,6 +15,7 @@ @@ -702,7 +702,7 @@ index 888741f8490d6f0e885ed0ce73115c16e7bbe821..9cb32a1ec61bc4cb67f5fc5bb1fa7230 #include "mozilla/dom/WindowProxyHolder.h" #include "nsCOMPtr.h" #include "nsCharsetSource.h" -@@ -76,6 +77,7 @@ class nsCommandManager; +@@ -77,6 +78,7 @@ class nsCommandManager; class nsDocShellEditorData; class nsDOMNavigationTiming; class nsDSURIContentListener; @@ -710,7 +710,7 @@ index 888741f8490d6f0e885ed0ce73115c16e7bbe821..9cb32a1ec61bc4cb67f5fc5bb1fa7230 class nsGlobalWindowOuter; class FramingChecker; -@@ -402,6 +404,15 @@ class nsDocShell final : public nsDocLoader, +@@ -403,6 +405,15 @@ class nsDocShell final : public nsDocLoader, void SetWillChangeProcess() { mWillChangeProcess = true; } bool WillChangeProcess() { return mWillChangeProcess; } @@ -726,7 +726,7 @@ index 888741f8490d6f0e885ed0ce73115c16e7bbe821..9cb32a1ec61bc4cb67f5fc5bb1fa7230 // Create a content viewer within this nsDocShell for the given // `WindowGlobalChild` actor. nsresult CreateDocumentViewerForActor( -@@ -1005,6 +1016,8 @@ class nsDocShell final : public nsDocLoader, +@@ -1006,6 +1017,8 @@ class nsDocShell final : public nsDocLoader, bool CSSErrorReportingEnabled() const { return mCSSErrorReportingEnabled; } @@ -735,7 +735,7 @@ index 888741f8490d6f0e885ed0ce73115c16e7bbe821..9cb32a1ec61bc4cb67f5fc5bb1fa7230 // Handles retrieval of subframe session history for nsDocShell::LoadURI. If a // load is requested in a subframe of the current DocShell, the subframe // loadType may need to reflect the loadType of the parent document, or in -@@ -1282,6 +1295,17 @@ class nsDocShell final : public nsDocLoader, +@@ -1285,6 +1298,17 @@ class nsDocShell final : public nsDocLoader, bool mAllowDNSPrefetch : 1; bool mAllowWindowControl : 1; bool mCSSErrorReportingEnabled : 1; @@ -812,10 +812,10 @@ index 84e821e33e8164829dfee4f05340784e189b90ee..aa690eb747cb73bc6bff40a62546037c * This attempts to save any applicable layout history state (like * scroll position) in the nsISHEntry. This is normally done diff --git a/dom/base/Document.cpp b/dom/base/Document.cpp -index 46de7024c0e148c5bc9b90553f0ab7c961acdaae..4ce29d24b940940ba7eefab60ac2be55bb888f78 100644 +index fd2d0be5f7755e64fc134515ea138c4ed0d28daf..ae48159ddbfb98d03e538d077a33260c639a74ac 100644 --- a/dom/base/Document.cpp +++ b/dom/base/Document.cpp -@@ -3765,6 +3765,9 @@ void Document::SendToConsole(nsCOMArray& aMessages) { +@@ -3752,6 +3752,9 @@ void Document::SendToConsole(nsCOMArray& aMessages) { } void Document::ApplySettingsFromCSP(bool aSpeculative) { @@ -825,7 +825,7 @@ index 46de7024c0e148c5bc9b90553f0ab7c961acdaae..4ce29d24b940940ba7eefab60ac2be55 nsresult rv = NS_OK; if (!aSpeculative) { // 1) apply settings from regular CSP -@@ -3822,6 +3825,11 @@ nsresult Document::InitCSP(nsIChannel* aChannel) { +@@ -3809,6 +3812,11 @@ nsresult Document::InitCSP(nsIChannel* aChannel) { MOZ_ASSERT(!mScriptGlobalObject, "CSP must be initialized before mScriptGlobalObject is set!"); @@ -837,7 +837,7 @@ index 46de7024c0e148c5bc9b90553f0ab7c961acdaae..4ce29d24b940940ba7eefab60ac2be55 // If this is a data document - no need to set CSP. if (mLoadedAsData) { return NS_OK; -@@ -4629,6 +4637,10 @@ bool Document::HasFocus(ErrorResult& rv) const { +@@ -4617,6 +4625,10 @@ bool Document::HasFocus(ErrorResult& rv) const { return false; } @@ -848,7 +848,7 @@ index 46de7024c0e148c5bc9b90553f0ab7c961acdaae..4ce29d24b940940ba7eefab60ac2be55 if (!fm->IsInActiveWindow(bc)) { return false; } -@@ -19580,6 +19592,35 @@ ColorScheme Document::PreferredColorScheme(IgnoreRFP aIgnoreRFP) const { +@@ -19688,6 +19700,35 @@ ColorScheme Document::PreferredColorScheme(IgnoreRFP aIgnoreRFP) const { return PreferenceSheet::PrefsFor(*this).mColorScheme; } @@ -885,10 +885,10 @@ index 46de7024c0e148c5bc9b90553f0ab7c961acdaae..4ce29d24b940940ba7eefab60ac2be55 if (!sLoadingForegroundTopLevelContentDocument) { return false; diff --git a/dom/base/Document.h b/dom/base/Document.h -index 7eb244d65eb55322fb16ed185be83cb731fc268c..3cfb3c17c1a769e4d0fc3fa76288c570822dc48f 100644 +index 622f54e369d324a4cc2800dd4b331bd628339bed..2ef6ed20cf35febeff75b22dfa5bb2fbb4e295fe 100644 --- a/dom/base/Document.h +++ b/dom/base/Document.h -@@ -4134,6 +4134,8 @@ class Document : public nsINode, +@@ -4140,6 +4140,8 @@ class Document : public nsINode, // color-scheme meta tag. ColorScheme DefaultColorScheme() const; @@ -898,7 +898,7 @@ index 7eb244d65eb55322fb16ed185be83cb731fc268c..3cfb3c17c1a769e4d0fc3fa76288c570 static bool AutomaticStorageAccessPermissionCanBeGranted( diff --git a/dom/base/Navigator.cpp b/dom/base/Navigator.cpp -index 0f159ad09a2a4b8962307b9f20abf30323377a36..e0cbb3f1f8af42825696d7152eb9993ab3802f90 100644 +index a13cae5b990fb2f750e62f5117ad63aa981d787f..bc0f2d674aadd8eba867f56e873595a8885d1798 100644 --- a/dom/base/Navigator.cpp +++ b/dom/base/Navigator.cpp @@ -344,14 +344,18 @@ void Navigator::GetAppName(nsAString& aAppName) const { @@ -961,20 +961,17 @@ index 6abf6cef230c97815f17f6b7abf9f1b1de274a6f..46ead1f32e0d710b5b32e61dff72a4f7 dom::MediaCapabilities* MediaCapabilities(); dom::MediaSession* MediaSession(); diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp -index 3793f9845d12dc6d88604c43baca744fe559ed21..6f2ec74a8613b72be0ed27cb566bfdbc388a692b 100644 +index f362a444a0f5ed247582646754dffd54d0b4540a..bbd72dab7ff4fbac8c247961e530764cb5c68d11 100644 --- a/dom/base/nsContentUtils.cpp +++ b/dom/base/nsContentUtils.cpp -@@ -8740,7 +8740,8 @@ nsresult nsContentUtils::SendMouseEvent( - bool aIgnoreRootScrollFrame, float aPressure, - unsigned short aInputSourceArg, uint32_t aIdentifier, bool aToWindow, - PreventDefaultResult* aPreventDefault, bool aIsDOMEventSynthesized, +@@ -9151,11 +9151,13 @@ nsresult nsContentUtils::SendMouseEvent( + int32_t aClickCount, int32_t aModifiers, bool aIgnoreRootScrollFrame, + float aPressure, unsigned short aInputSourceArg, uint32_t aIdentifier, + bool aToWindow, bool* aPreventDefault, bool aIsDOMEventSynthesized, - bool aIsWidgetEventSynthesized) { + bool aIsWidgetEventSynthesized, + bool convertToPointer, uint32_t aJugglerEventId) { - nsPoint offset; - nsCOMPtr widget = GetWidget(aPresShell, &offset); - if (!widget) return NS_ERROR_FAILURE; -@@ -8748,6 +8749,7 @@ nsresult nsContentUtils::SendMouseEvent( + MOZ_ASSERT(aWidget); EventMessage msg; Maybe exitFrom; bool contextMenuKey = false; @@ -982,7 +979,7 @@ index 3793f9845d12dc6d88604c43baca744fe559ed21..6f2ec74a8613b72be0ed27cb566bfdbc if (aType.EqualsLiteral("mousedown")) { msg = eMouseDown; } else if (aType.EqualsLiteral("mouseup")) { -@@ -8773,6 +8775,12 @@ nsresult nsContentUtils::SendMouseEvent( +@@ -9181,6 +9183,12 @@ nsresult nsContentUtils::SendMouseEvent( msg = eMouseHitTest; } else if (aType.EqualsLiteral("MozMouseExploreByTouch")) { msg = eMouseExploreByTouch; @@ -995,7 +992,7 @@ index 3793f9845d12dc6d88604c43baca744fe559ed21..6f2ec74a8613b72be0ed27cb566bfdbc } else { return NS_ERROR_FAILURE; } -@@ -8783,7 +8791,14 @@ nsresult nsContentUtils::SendMouseEvent( +@@ -9191,7 +9199,14 @@ nsresult nsContentUtils::SendMouseEvent( Maybe pointerEvent; Maybe mouseEvent; @@ -1003,7 +1000,7 @@ index 3793f9845d12dc6d88604c43baca744fe559ed21..6f2ec74a8613b72be0ed27cb566bfdbc + Maybe pwDragEvent; + + if (isPWDragEventMessage) { -+ pwDragEvent.emplace(true, msg, widget); ++ pwDragEvent.emplace(true, msg, aWidget); + pwDragEvent->mReason = aIsWidgetEventSynthesized + ? WidgetMouseEvent::eSynthesized + : WidgetMouseEvent::eReal; @@ -1011,7 +1008,7 @@ index 3793f9845d12dc6d88604c43baca744fe559ed21..6f2ec74a8613b72be0ed27cb566bfdbc MOZ_ASSERT(!aIsWidgetEventSynthesized, "The event shouldn't be dispatched as a synthesized event"); if (MOZ_UNLIKELY(aIsWidgetEventSynthesized)) { -@@ -8802,8 +8817,11 @@ nsresult nsContentUtils::SendMouseEvent( +@@ -9210,8 +9225,11 @@ nsresult nsContentUtils::SendMouseEvent( contextMenuKey ? WidgetMouseEvent::eContextMenuKey : WidgetMouseEvent::eNormal); } @@ -1023,7 +1020,7 @@ index 3793f9845d12dc6d88604c43baca744fe559ed21..6f2ec74a8613b72be0ed27cb566bfdbc mouseOrPointerEvent.pointerId = aIdentifier; mouseOrPointerEvent.mModifiers = GetWidgetModifiers(aModifiers); mouseOrPointerEvent.mButton = aButton; -@@ -8816,6 +8834,8 @@ nsresult nsContentUtils::SendMouseEvent( +@@ -9224,6 +9242,8 @@ nsresult nsContentUtils::SendMouseEvent( mouseOrPointerEvent.mClickCount = aClickCount; mouseOrPointerEvent.mFlags.mIsSynthesizedForTests = aIsDOMEventSynthesized; mouseOrPointerEvent.mExitFrom = exitFrom; @@ -1033,21 +1030,23 @@ index 3793f9845d12dc6d88604c43baca744fe559ed21..6f2ec74a8613b72be0ed27cb566bfdbc nsPresContext* presContext = aPresShell->GetPresContext(); if (!presContext) return NS_ERROR_FAILURE; diff --git a/dom/base/nsContentUtils.h b/dom/base/nsContentUtils.h -index ed822f10425272124dd33a74d1cdac5011b1ba6a..0f29ce787f9cebc068d2e5faa9907d52b177283a 100644 +index 779cd9e544bfb2d135f12c3558c0ca8164b37029..041eba4bcbf40f51fc40ce7609ea81408e6a788d 100644 --- a/dom/base/nsContentUtils.h +++ b/dom/base/nsContentUtils.h -@@ -3019,7 +3019,8 @@ class nsContentUtils { +@@ -3015,8 +3015,9 @@ class nsContentUtils { + int32_t aButton, int32_t aButtons, int32_t aClickCount, int32_t aModifiers, bool aIgnoreRootScrollFrame, float aPressure, unsigned short aInputSourceArg, uint32_t aIdentifier, bool aToWindow, - mozilla::PreventDefaultResult* aPreventDefault, -- bool aIsDOMEventSynthesized, bool aIsWidgetEventSynthesized); +- bool* aPreventDefault, bool aIsDOMEventSynthesized, +- bool aIsWidgetEventSynthesized); ++ bool* aPreventDefault, + bool aIsDOMEventSynthesized, bool aIsWidgetEventSynthesized, + bool convertToPointer = true, uint32_t aJugglerEventId = 0); static void FirePageShowEventForFrameLoaderSwap( nsIDocShellTreeItem* aItem, diff --git a/dom/base/nsDOMWindowUtils.cpp b/dom/base/nsDOMWindowUtils.cpp -index fe23028691d0d06f6b036fd9da2c466730f58cb7..40cfc256510cbddea50574b531ce4369462fd956 100644 +index 15fe1db8a28ed2592b61aaf2006ddaa656f12389..2642c18bebcdfdd467be557171ba4ee204fcabde 100644 --- a/dom/base/nsDOMWindowUtils.cpp +++ b/dom/base/nsDOMWindowUtils.cpp @@ -710,6 +710,26 @@ nsDOMWindowUtils::GetPresShellId(uint32_t* aPresShellId) { @@ -1095,27 +1094,29 @@ index fe23028691d0d06f6b036fd9da2c466730f58cb7..40cfc256510cbddea50574b531ce4369 } NS_IMETHODIMP -@@ -751,13 +771,13 @@ nsDOMWindowUtils::SendMouseEventCommon( +@@ -751,7 +771,7 @@ nsDOMWindowUtils::SendMouseEventCommon( int32_t aClickCount, int32_t aModifiers, bool aIgnoreRootScrollFrame, float aPressure, unsigned short aInputSourceArg, uint32_t aPointerId, bool aToWindow, bool* aPreventDefault, bool aIsDOMEventSynthesized, - bool aIsWidgetEventSynthesized, int32_t aButtons) { + bool aIsWidgetEventSynthesized, int32_t aButtons, bool aConvertToPointer, uint32_t aJugglerEventId) { RefPtr presShell = GetPresShell(); - PreventDefaultResult preventDefaultResult; - nsresult rv = nsContentUtils::SendMouseEvent( - presShell, aType, aX, aY, aButton, aButtons, aClickCount, aModifiers, - aIgnoreRootScrollFrame, aPressure, aInputSourceArg, aPointerId, aToWindow, -- &preventDefaultResult, aIsDOMEventSynthesized, aIsWidgetEventSynthesized); -+ &preventDefaultResult, aIsDOMEventSynthesized, aIsWidgetEventSynthesized, aConvertToPointer, aJugglerEventId); - - if (aPreventDefault) { - *aPreventDefault = preventDefaultResult != PreventDefaultResult::No; + if (!presShell) { + return NS_ERROR_FAILURE; +@@ -768,7 +788,7 @@ nsDOMWindowUtils::SendMouseEventCommon( + presShell, widget, aType, refPoint, aButton, aButtons, aClickCount, + aModifiers, aIgnoreRootScrollFrame, aPressure, aInputSourceArg, + aPointerId, aToWindow, aPreventDefault, aIsDOMEventSynthesized, +- aIsWidgetEventSynthesized); ++ aIsWidgetEventSynthesized, aConvertToPointer, aJugglerEventId); + } + + NS_IMETHODIMP diff --git a/dom/base/nsDOMWindowUtils.h b/dom/base/nsDOMWindowUtils.h -index 47ff326b202266b1d7d6af8bdfb72776df8a6a93..b8e084b0c788c46345b1455b8257f1719c851404 100644 +index a8a48d28fc4ef612f8234bc2490a41672f1704f5..f702b0c9a0783ec547a41bbefd68e18a27a239fe 100644 --- a/dom/base/nsDOMWindowUtils.h +++ b/dom/base/nsDOMWindowUtils.h -@@ -93,7 +93,7 @@ class nsDOMWindowUtils final : public nsIDOMWindowUtils, +@@ -94,7 +94,7 @@ class nsDOMWindowUtils final : public nsIDOMWindowUtils, int32_t aClickCount, int32_t aModifiers, bool aIgnoreRootScrollFrame, float aPressure, unsigned short aInputSourceArg, uint32_t aIdentifier, bool aToWindow, bool* aPreventDefault, bool aIsDOMEventSynthesized, @@ -1125,10 +1126,10 @@ index 47ff326b202266b1d7d6af8bdfb72776df8a6a93..b8e084b0c788c46345b1455b8257f171 MOZ_CAN_RUN_SCRIPT nsresult SendTouchEventCommon( diff --git a/dom/base/nsFocusManager.cpp b/dom/base/nsFocusManager.cpp -index a1d3ae3f3cb8d916a9a8bcca4cb515a2ab496ccb..72326b41064f6a86d76aba7b1902851e966365a8 100644 +index 555a08b4b3fcd0d0c7986014d2e3516c6e5991c0..74a39e000b0e68042f1f51f6fafbc39ac9b42e51 100644 --- a/dom/base/nsFocusManager.cpp +++ b/dom/base/nsFocusManager.cpp -@@ -1719,6 +1719,10 @@ Maybe nsFocusManager::SetFocusInner(Element* aNewContent, +@@ -1720,6 +1720,10 @@ Maybe nsFocusManager::SetFocusInner(Element* aNewContent, (GetActiveBrowsingContext() == newRootBrowsingContext); } @@ -1139,7 +1140,7 @@ index a1d3ae3f3cb8d916a9a8bcca4cb515a2ab496ccb..72326b41064f6a86d76aba7b1902851e // Exit fullscreen if a website focuses another window if (StaticPrefs::full_screen_api_exit_on_windowRaise() && !isElementInActiveWindow && (aFlags & FLAG_RAISE)) { -@@ -2304,6 +2308,7 @@ bool nsFocusManager::BlurImpl(BrowsingContext* aBrowsingContextToClear, +@@ -2306,6 +2310,7 @@ bool nsFocusManager::BlurImpl(BrowsingContext* aBrowsingContextToClear, bool aIsLeavingDocument, bool aAdjustWidget, bool aRemainActive, Element* aElementToFocus, uint64_t aActionId) { @@ -1147,7 +1148,7 @@ index a1d3ae3f3cb8d916a9a8bcca4cb515a2ab496ccb..72326b41064f6a86d76aba7b1902851e LOGFOCUS(("<>", aActionId)); // hold a reference to the focused content, which may be null -@@ -2350,6 +2355,11 @@ bool nsFocusManager::BlurImpl(BrowsingContext* aBrowsingContextToClear, +@@ -2352,6 +2357,11 @@ bool nsFocusManager::BlurImpl(BrowsingContext* aBrowsingContextToClear, return true; } @@ -1159,7 +1160,7 @@ index a1d3ae3f3cb8d916a9a8bcca4cb515a2ab496ccb..72326b41064f6a86d76aba7b1902851e // Keep a ref to presShell since dispatching the DOM event may cause // the document to be destroyed. RefPtr presShell = docShell->GetPresShell(); -@@ -3064,7 +3074,9 @@ void nsFocusManager::RaiseWindow(nsPIDOMWindowOuter* aWindow, +@@ -3066,7 +3076,9 @@ void nsFocusManager::RaiseWindow(nsPIDOMWindowOuter* aWindow, } } @@ -1171,10 +1172,10 @@ index a1d3ae3f3cb8d916a9a8bcca4cb515a2ab496ccb..72326b41064f6a86d76aba7b1902851e // care of lowering the present active window. This happens in // a separate runnable to avoid touching multiple windows in diff --git a/dom/base/nsGlobalWindowOuter.cpp b/dom/base/nsGlobalWindowOuter.cpp -index 4d0483fb6cc4b7ed6cc9633c72413017e7b49249..9eb60397c94f567cc76fcbeec4585bf92b2fd0f7 100644 +index 99a5049a3aff2efb208895d60622fd9c8d7f337a..9a9b039a46f1294a8b4af0613fb4f4173ac6a8a0 100644 --- a/dom/base/nsGlobalWindowOuter.cpp +++ b/dom/base/nsGlobalWindowOuter.cpp -@@ -2516,10 +2516,16 @@ nsresult nsGlobalWindowOuter::SetNewDocument(Document* aDocument, +@@ -2512,10 +2512,16 @@ nsresult nsGlobalWindowOuter::SetNewDocument(Document* aDocument, }(); if (!isContentAboutBlankInChromeDocshell) { @@ -1195,7 +1196,7 @@ index 4d0483fb6cc4b7ed6cc9633c72413017e7b49249..9eb60397c94f567cc76fcbeec4585bf9 } } -@@ -2639,6 +2645,19 @@ void nsGlobalWindowOuter::DispatchDOMWindowCreated() { +@@ -2635,6 +2641,19 @@ void nsGlobalWindowOuter::DispatchDOMWindowCreated() { } } @@ -1216,10 +1217,10 @@ index 4d0483fb6cc4b7ed6cc9633c72413017e7b49249..9eb60397c94f567cc76fcbeec4585bf9 void nsGlobalWindowOuter::SetDocShell(nsDocShell* aDocShell) { diff --git a/dom/base/nsGlobalWindowOuter.h b/dom/base/nsGlobalWindowOuter.h -index d4347e7a508742986f634e97394a9e3dd435d170..5088520537c8c5c6cc79c1dffd91a68de09f27eb 100644 +index 0453a18ec10c1434d1692f10b1b4acee754e6b7e..ee7bad691515bb51f6b4345e88944b02ad173180 100644 --- a/dom/base/nsGlobalWindowOuter.h +++ b/dom/base/nsGlobalWindowOuter.h -@@ -317,6 +317,7 @@ class nsGlobalWindowOuter final : public mozilla::dom::EventTarget, +@@ -320,6 +320,7 @@ class nsGlobalWindowOuter final : public mozilla::dom::EventTarget, // Outer windows only. void DispatchDOMWindowCreated(); @@ -1228,10 +1229,10 @@ index d4347e7a508742986f634e97394a9e3dd435d170..5088520537c8c5c6cc79c1dffd91a68d // Outer windows only. virtual void EnsureSizeAndPositionUpToDate() override; diff --git a/dom/base/nsINode.cpp b/dom/base/nsINode.cpp -index 4c1efbb1edf0e7d34a333e2724baf055eefa7e6e..c5d64fba742187c8ebaad8f45e868ab65722d07a 100644 +index 8e2bbed21c13f23745e2eaad4ded831106ebd930..a17b0c7b9730737f178c05703b08d0f5f6d9ecd1 100644 --- a/dom/base/nsINode.cpp +++ b/dom/base/nsINode.cpp -@@ -1437,6 +1437,61 @@ void nsINode::GetBoxQuadsFromWindowOrigin(const BoxQuadOptions& aOptions, +@@ -1449,6 +1449,61 @@ void nsINode::GetBoxQuadsFromWindowOrigin(const BoxQuadOptions& aOptions, mozilla::GetBoxQuadsFromWindowOrigin(this, aOptions, aResult, aRv); } @@ -1294,10 +1295,10 @@ index 4c1efbb1edf0e7d34a333e2724baf055eefa7e6e..c5d64fba742187c8ebaad8f45e868ab6 DOMQuad& aQuad, const GeometryNode& aFrom, const ConvertCoordinateOptions& aOptions, CallerType aCallerType, diff --git a/dom/base/nsINode.h b/dom/base/nsINode.h -index e1fb6c2aeb67ab600b668b342bee0c716427d116..55e573dce8ad4d34542f89b9179a1da14f45d1bc 100644 +index eb75f281630f8ca1b901686207c9fc97336d675f..e607f0ae454d52fc2bfe19046b492352a84b4ebd 100644 --- a/dom/base/nsINode.h +++ b/dom/base/nsINode.h -@@ -2356,6 +2356,10 @@ class nsINode : public mozilla::dom::EventTarget { +@@ -2397,6 +2397,10 @@ class nsINode : public mozilla::dom::EventTarget { nsTArray>& aResult, ErrorResult& aRv); @@ -1337,7 +1338,7 @@ index f32e21752d5013bf143eb45391ab9218debab08e..83763d2354dade2f8d2b7930ba18ae91 static bool DumpEnabled(); diff --git a/dom/chrome-webidl/BrowsingContext.webidl b/dom/chrome-webidl/BrowsingContext.webidl -index 28e8d8cb9c61ff8362b2d191d47c3630d2cb0b34..58c12d597978100507dbc21e88c49c5642a3ba1f 100644 +index 6ec88536141126c97c9b599e3237bb5670d42ce8..41c6cc56738bdaf711adf2cf5b00c7fad5d71ba8 100644 --- a/dom/chrome-webidl/BrowsingContext.webidl +++ b/dom/chrome-webidl/BrowsingContext.webidl @@ -61,6 +61,26 @@ enum ForcedColorsOverride { @@ -1381,10 +1382,10 @@ index 28e8d8cb9c61ff8362b2d191d47c3630d2cb0b34..58c12d597978100507dbc21e88c49c56 * A unique identifier for the browser element that is hosting this * BrowsingContext tree. Every BrowsingContext in the element's tree will diff --git a/dom/fetch/Fetch.cpp b/dom/fetch/Fetch.cpp -index a030f3f07b9f4a676f87ac482507056bc911edf5..68bd39affdbbe2e35fdac62b1e159ebc7ffd031c 100644 +index 0bd219694282347309680fc9b53b945e1fd0ad92..c5c2e2d32a380ec72379b05a8b84f187431f7309 100644 --- a/dom/fetch/Fetch.cpp +++ b/dom/fetch/Fetch.cpp -@@ -689,6 +689,12 @@ already_AddRefed FetchRequest(nsIGlobalObject* aGlobal, +@@ -701,6 +701,12 @@ already_AddRefed FetchRequest(nsIGlobalObject* aGlobal, ipcArgs.hasCSPEventListener() = false; ipcArgs.isWorkerRequest() = false; @@ -1398,10 +1399,10 @@ index a030f3f07b9f4a676f87ac482507056bc911edf5..68bd39affdbbe2e35fdac62b1e159ebc mozilla::glean::networking::fetch_keepalive_request_count.Get("main"_ns) diff --git a/dom/fetch/FetchService.cpp b/dom/fetch/FetchService.cpp -index 6fc05bf6cc8341e7cfac63789b79f610bdbe9641..112db3c2e6d2f854103ddacde896904018f5ea90 100644 +index b5e60bbd27fbb2f033d233e9ae2ebc728f442512..0adc568ece34d2c0f35eeacd81e2db9125b7c327 100644 --- a/dom/fetch/FetchService.cpp +++ b/dom/fetch/FetchService.cpp -@@ -265,6 +265,14 @@ RefPtr FetchService::FetchInstance::Fetch() { +@@ -268,6 +268,14 @@ RefPtr FetchService::FetchInstance::Fetch() { false // IsTrackingFetch ); @@ -1417,10 +1418,10 @@ index 6fc05bf6cc8341e7cfac63789b79f610bdbe9641..112db3c2e6d2f854103ddacde8969040 auto& args = mArgs.as(); mFetchDriver->SetWorkerScript(args.mWorkerScript); diff --git a/dom/geolocation/Geolocation.cpp b/dom/geolocation/Geolocation.cpp -index e67cb4efce43b42fa876c906f7f1927c65d34ea7..a42da20dc6aaa1915c611d4bc339a8db974c75eb 100644 +index 7c653fe131dc34d35ffdc030950071adb31a9fc9..b23442a42ba8ee270e8e38930e59ae15c2a29039 100644 --- a/dom/geolocation/Geolocation.cpp +++ b/dom/geolocation/Geolocation.cpp -@@ -29,6 +29,7 @@ +@@ -28,6 +28,7 @@ #include "nsComponentManagerUtils.h" #include "nsContentPermissionHelper.h" #include "nsContentUtils.h" @@ -1428,7 +1429,7 @@ index e67cb4efce43b42fa876c906f7f1927c65d34ea7..a42da20dc6aaa1915c611d4bc339a8db #include "nsGlobalWindowInner.h" #include "mozilla/dom/Document.h" #include "nsINamed.h" -@@ -429,10 +430,8 @@ nsGeolocationRequest::Allow(JS::Handle aChoices) { +@@ -428,10 +429,8 @@ nsGeolocationRequest::Allow(JS::Handle aChoices) { return NS_OK; } @@ -1441,7 +1442,7 @@ index e67cb4efce43b42fa876c906f7f1927c65d34ea7..a42da20dc6aaa1915c611d4bc339a8db CachedPositionAndAccuracy lastPosition = gs->GetCachedPosition(); if (lastPosition.position) { EpochTimeStamp cachedPositionTime_ms; -@@ -640,8 +639,7 @@ void nsGeolocationRequest::Shutdown() { +@@ -639,8 +638,7 @@ void nsGeolocationRequest::Shutdown() { // If there are no other high accuracy requests, the geolocation service will // notify the provider to switch to the default accuracy. if (mOptions && mOptions->mEnableHighAccuracy) { @@ -1451,7 +1452,7 @@ index e67cb4efce43b42fa876c906f7f1927c65d34ea7..a42da20dc6aaa1915c611d4bc339a8db if (gs) { gs->UpdateAccuracy(); } -@@ -958,8 +956,14 @@ void nsGeolocationService::StopDevice() { +@@ -957,8 +955,14 @@ void nsGeolocationService::StopDevice() { StaticRefPtr nsGeolocationService::sService; already_AddRefed @@ -1467,7 +1468,7 @@ index e67cb4efce43b42fa876c906f7f1927c65d34ea7..a42da20dc6aaa1915c611d4bc339a8db if (nsGeolocationService::sService) { result = nsGeolocationService::sService; -@@ -1051,7 +1055,9 @@ nsresult Geolocation::Init(nsPIDOMWindowInner* aContentDom) { +@@ -1050,7 +1054,9 @@ nsresult Geolocation::Init(nsPIDOMWindowInner* aContentDom) { // If no aContentDom was passed into us, we are being used // by chrome/c++ and have no mOwner, no mPrincipal, and no need // to prompt. @@ -1516,7 +1517,7 @@ index 992de29b5d2d09c19e55ebb2502215ec9d05a171..cdc20567b693283b0fd5a5923f7ea542 ~Geolocation(); diff --git a/dom/html/HTMLInputElement.cpp b/dom/html/HTMLInputElement.cpp -index 2e6ef116be73d0794683189c07afc8a629859154..33f4add0cb7736edd416d31d0feca4fd5afc4526 100644 +index c3e7de8f41e06e11155620b75c4d8a830d908b37..39eb9d31258693dce3a26c3227f28d92bccdb019 100644 --- a/dom/html/HTMLInputElement.cpp +++ b/dom/html/HTMLInputElement.cpp @@ -64,6 +64,7 @@ @@ -1527,7 +1528,7 @@ index 2e6ef116be73d0794683189c07afc8a629859154..33f4add0cb7736edd416d31d0feca4fd #include "nsIFrame.h" #include "nsRangeFrame.h" #include "nsError.h" -@@ -789,6 +790,13 @@ nsresult HTMLInputElement::InitFilePicker(FilePickerType aType) { +@@ -790,6 +791,13 @@ nsresult HTMLInputElement::InitFilePicker(FilePickerType aType) { return NS_ERROR_FAILURE; } @@ -1542,7 +1543,7 @@ index 2e6ef116be73d0794683189c07afc8a629859154..33f4add0cb7736edd416d31d0feca4fd return NS_OK; } diff --git a/dom/interfaces/base/nsIDOMWindowUtils.idl b/dom/interfaces/base/nsIDOMWindowUtils.idl -index 8ddde6e5de319142ce0898dc3667c08f1f24cce9..9e530a727f06b924e3d0bcf4ba52507231778257 100644 +index 5e417145c4f21d8f2aa65088611477b681c9c327..bc84c509659c7556077e69c652e5b19639eb88bb 100644 --- a/dom/interfaces/base/nsIDOMWindowUtils.idl +++ b/dom/interfaces/base/nsIDOMWindowUtils.idl @@ -374,6 +374,26 @@ interface nsIDOMWindowUtils : nsISupports { @@ -1846,7 +1847,7 @@ index 3b39538e51840cd9b1685b2efd2ff2e9ec83608a..c7bf4f2d53b58bbacb22b3ebebf6f3fc return aGlobalOrNull; diff --git a/dom/security/nsCSPUtils.cpp b/dom/security/nsCSPUtils.cpp -index 32a8d9496e674e752dd3ac41afc7f22ed534dce3..e57690654be4ae18f14d3171fa4eab9ec8aa991f 100644 +index 5ec21c1c7f975a372399748e8bab2b21ce347f20..ed16831e549afa3d6623398d35eb61e26ab5f2b0 100644 --- a/dom/security/nsCSPUtils.cpp +++ b/dom/security/nsCSPUtils.cpp @@ -23,6 +23,7 @@ @@ -1857,7 +1858,7 @@ index 32a8d9496e674e752dd3ac41afc7f22ed534dce3..e57690654be4ae18f14d3171fa4eab9e #include "mozilla/Assertions.h" #include "mozilla/Components.h" -@@ -134,6 +135,11 @@ void CSP_ApplyMetaCSPToDoc(mozilla::dom::Document& aDoc, +@@ -135,6 +136,11 @@ void CSP_ApplyMetaCSPToDoc(mozilla::dom::Document& aDoc, return; } @@ -1893,10 +1894,10 @@ index aee376e971ae01ac1e512c3920b115bfaf06afa8..1701311534bf77e6cd9bafc0e3a28361 * returned quads are further translated relative to the window * origin -- which is not the layout origin. Further translation diff --git a/dom/workers/RuntimeService.cpp b/dom/workers/RuntimeService.cpp -index f528bec20afef533e4c6b99c5e9d1680fd0b636e..a0d22d38657f672d865f35c02975e7b611571353 100644 +index a23637c4a887b66a1b4c709a648762b84151bf01..d8da9063261482f1da3257e3f95a8a49d94325f8 100644 --- a/dom/workers/RuntimeService.cpp +++ b/dom/workers/RuntimeService.cpp -@@ -1027,7 +1027,7 @@ void PrefLanguagesChanged(const char* /* aPrefName */, void* /* aClosure */) { +@@ -1026,7 +1026,7 @@ void PrefLanguagesChanged(const char* /* aPrefName */, void* /* aClosure */) { AssertIsOnMainThread(); nsTArray languages; @@ -1905,7 +1906,7 @@ index f528bec20afef533e4c6b99c5e9d1680fd0b636e..a0d22d38657f672d865f35c02975e7b6 RuntimeService* runtime = RuntimeService::GetService(); if (runtime) { -@@ -1215,8 +1215,7 @@ bool RuntimeService::RegisterWorker(WorkerPrivate& aWorkerPrivate) { +@@ -1214,8 +1214,7 @@ bool RuntimeService::RegisterWorker(WorkerPrivate& aWorkerPrivate) { } // The navigator overridden properties should have already been read. @@ -1915,7 +1916,7 @@ index f528bec20afef533e4c6b99c5e9d1680fd0b636e..a0d22d38657f672d865f35c02975e7b6 mNavigatorPropertiesLoaded = true; } -@@ -1837,6 +1836,13 @@ void RuntimeService::PropagateStorageAccessPermissionGranted( +@@ -1836,6 +1835,13 @@ void RuntimeService::PropagateStorageAccessPermissionGranted( } } @@ -1929,7 +1930,7 @@ index f528bec20afef533e4c6b99c5e9d1680fd0b636e..a0d22d38657f672d865f35c02975e7b6 template void RuntimeService::BroadcastAllWorkers(const Func& aFunc) { AssertIsOnMainThread(); -@@ -2362,6 +2368,14 @@ void PropagateStorageAccessPermissionGrantedToWorkers( +@@ -2361,6 +2367,14 @@ void PropagateStorageAccessPermissionGrantedToWorkers( } } @@ -1971,7 +1972,7 @@ index 58894a8361c7ef1dddd481ca5877a209a8b8ff5c..c481d40d79b6397b7f1d571bd9f6ae5c bool IsWorkerGlobal(JSObject* global); diff --git a/dom/workers/WorkerPrivate.cpp b/dom/workers/WorkerPrivate.cpp -index 0076a8463fa9ff05b32edfe21462987610432b5d..9f810c9728b7d7caf9fbeb3e24346c219326637d 100644 +index 5d918a82708a26125f7322e43f6436d7eafaa812..b230baead02e05d87a211c276066ec7939ea8251 100644 --- a/dom/workers/WorkerPrivate.cpp +++ b/dom/workers/WorkerPrivate.cpp @@ -736,6 +736,18 @@ class UpdateContextOptionsRunnable final : public WorkerControlRunnable { @@ -1993,7 +1994,7 @@ index 0076a8463fa9ff05b32edfe21462987610432b5d..9f810c9728b7d7caf9fbeb3e24346c21 class UpdateLanguagesRunnable final : public WorkerThreadRunnable { nsTArray mLanguages; -@@ -2149,6 +2161,16 @@ void WorkerPrivate::UpdateContextOptions( +@@ -2159,6 +2171,16 @@ void WorkerPrivate::UpdateContextOptions( } } @@ -2010,7 +2011,7 @@ index 0076a8463fa9ff05b32edfe21462987610432b5d..9f810c9728b7d7caf9fbeb3e24346c21 void WorkerPrivate::UpdateLanguages(const nsTArray& aLanguages) { AssertIsOnParentThread(); -@@ -5833,6 +5855,15 @@ void WorkerPrivate::UpdateContextOptionsInternal( +@@ -5946,6 +5968,15 @@ void WorkerPrivate::UpdateContextOptionsInternal( } } @@ -2027,7 +2028,7 @@ index 0076a8463fa9ff05b32edfe21462987610432b5d..9f810c9728b7d7caf9fbeb3e24346c21 const nsTArray& aLanguages) { WorkerGlobalScope* globalScope = GlobalScope(); diff --git a/dom/workers/WorkerPrivate.h b/dom/workers/WorkerPrivate.h -index c2ade467934d08587d4e3589b310c6302534d699..414814c03180b50d218ad84a0db262fff19f78a7 100644 +index 7bccdc8c0c2cd53f7aa7a6d9a74435344dd27980..86bba2128a7c0f4e5efa4bfbc939937aec146695 100644 --- a/dom/workers/WorkerPrivate.h +++ b/dom/workers/WorkerPrivate.h @@ -443,6 +443,8 @@ class WorkerPrivate final @@ -2039,7 +2040,7 @@ index c2ade467934d08587d4e3589b310c6302534d699..414814c03180b50d218ad84a0db262ff void UpdateLanguagesInternal(const nsTArray& aLanguages); void UpdateJSWorkerMemoryParameterInternal(JSContext* aCx, JSGCParamKey key, -@@ -1086,6 +1088,8 @@ class WorkerPrivate final +@@ -1091,6 +1093,8 @@ class WorkerPrivate final void UpdateContextOptions(const JS::ContextOptions& aContextOptions); @@ -2101,10 +2102,10 @@ index 523e84c8c93f4221701f90f2e8ee146ec8e1adbd..98d5b1176e5378431b859a2dbd4d4e77 inline ClippedTime TimeClip(double time); diff --git a/js/src/debugger/Object.cpp b/js/src/debugger/Object.cpp -index 880e716c24464c93283410417f8e69d6d233d105..6e046fbd2e643dace5ad7796740253df3ddf2cbe 100644 +index b7ea4b6f66d14db0324397cdc1b0ed8c5ea167e2..1c59e328079e7e43b65f7cb7bc31636a48a93263 100644 --- a/js/src/debugger/Object.cpp +++ b/js/src/debugger/Object.cpp -@@ -2474,7 +2474,11 @@ Maybe DebuggerObject::call(JSContext* cx, +@@ -2484,7 +2484,11 @@ Maybe DebuggerObject::call(JSContext* cx, invokeArgs[i].set(args2[i]); } @@ -2117,7 +2118,7 @@ index 880e716c24464c93283410417f8e69d6d233d105..6e046fbd2e643dace5ad7796740253df } diff --git a/js/src/vm/DateTime.cpp b/js/src/vm/DateTime.cpp -index cf63b124f39223a1a42c322dcc0ad108947d54f5..9e3a7b757cbad57ee6cfe2254d0355f62f7c8662 100644 +index a57b8fefa104f966393a99f5a81876b9a95f9743..adc42dd227e52643b06fb101170aeafb490c0acc 100644 --- a/js/src/vm/DateTime.cpp +++ b/js/src/vm/DateTime.cpp @@ -185,6 +185,11 @@ void js::DateTimeInfo::internalResetTimeZone(ResetTimeZoneMode mode) { @@ -2272,10 +2273,10 @@ index 4bfd336ddcbee8004ac538ca7b7d8216d04a61c3..cd22351c4aeacea8afc9828972222aca // No boxes to return return; diff --git a/layout/base/PresShell.cpp b/layout/base/PresShell.cpp -index ede24b9c7ac3569d6467ac88bc491d2987ac0bca..a45ebcdf3a3caaad15a8dff0b8ebbec971aac8a6 100644 +index e8fb3a8304b27814e6e84355f24410c820667f9d..211c86fe55b8b650e40275a427b30a1ee8a9a3d7 100644 --- a/layout/base/PresShell.cpp +++ b/layout/base/PresShell.cpp -@@ -11265,7 +11265,9 @@ bool PresShell::ComputeActiveness() const { +@@ -11512,7 +11512,9 @@ bool PresShell::ComputeActiveness() const { if (!browserChild->IsVisible()) { MOZ_LOG(gLog, LogLevel::Debug, (" > BrowserChild %p is not visible", browserChild)); @@ -2287,7 +2288,7 @@ index ede24b9c7ac3569d6467ac88bc491d2987ac0bca..a45ebcdf3a3caaad15a8dff0b8ebbec9 // If the browser is visible but just due to be preserving layers diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp -index b9f06daa19e5aecb976ad198990a315bc39f736d..1600435c406e2e652abdab72a7947add7266c75a 100644 +index 315d532eab56dab13b6c8bc2380a5cda2a17ffc1..7c4552137149e8c7fc9ac08a09bd4242952b53b6 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -708,6 +708,10 @@ bool nsLayoutUtils::AllowZoomingForDocument( @@ -2301,7 +2302,7 @@ index b9f06daa19e5aecb976ad198990a315bc39f736d..1600435c406e2e652abdab72a7947add // True if we allow zooming for all documents on this platform, or if we are // in RDM. BrowsingContext* bc = aDocument->GetBrowsingContext(); -@@ -9748,6 +9752,9 @@ void nsLayoutUtils::ComputeSystemFont(nsFont* aSystemFont, +@@ -9770,6 +9774,9 @@ void nsLayoutUtils::ComputeSystemFont(nsFont* aSystemFont, /* static */ bool nsLayoutUtils::ShouldHandleMetaViewport(const Document* aDocument) { @@ -2312,10 +2313,10 @@ index b9f06daa19e5aecb976ad198990a315bc39f736d..1600435c406e2e652abdab72a7947add return StaticPrefs::dom_meta_viewport_enabled() || (bc && bc->InRDMPane()); } diff --git a/layout/style/GeckoBindings.h b/layout/style/GeckoBindings.h -index 3f97c46ee5721c9f5bb9b86e2c0ece552ed00568..52f6c4d600baccc846503373af3476816f4c9fdc 100644 +index c7cf59c2661c7e203384c9b82789879f756b44b7..21e32dab4e60112c073bdd5070a308da2b4e0373 100644 --- a/layout/style/GeckoBindings.h +++ b/layout/style/GeckoBindings.h -@@ -595,6 +595,7 @@ float Gecko_MediaFeatures_GetResolution(const mozilla::dom::Document*); +@@ -596,6 +596,7 @@ float Gecko_MediaFeatures_GetResolution(const mozilla::dom::Document*); bool Gecko_MediaFeatures_PrefersReducedMotion(const mozilla::dom::Document*); bool Gecko_MediaFeatures_PrefersReducedTransparency( const mozilla::dom::Document*); @@ -2362,7 +2363,7 @@ index ca382a3cfba8ce5839890d6e4cb3cf9789287e3b..5800fc23dc77ee5764beddd6fa48a7fd return StylePrefersContrast::NoPreference; } diff --git a/netwerk/base/LoadInfo.cpp b/netwerk/base/LoadInfo.cpp -index 06acdc629c2b6ee0e29c50d8edc5a96d343b1ef2..6c263edf54117fd9cbf4a77abc396f1238730880 100644 +index 1ec2c64193206d31702e22e5c4783f084b1cff31..fb463eb12ee39cd1e448369f3b47fbcfbb2473b9 100644 --- a/netwerk/base/LoadInfo.cpp +++ b/netwerk/base/LoadInfo.cpp @@ -696,7 +696,8 @@ LoadInfo::LoadInfo(const LoadInfo& rhs) @@ -2375,7 +2376,7 @@ index 06acdc629c2b6ee0e29c50d8edc5a96d343b1ef2..6c263edf54117fd9cbf4a77abc396f12 } LoadInfo::LoadInfo( -@@ -2515,4 +2516,16 @@ LoadInfo::SetSkipHTTPSUpgrade(bool aSkipHTTPSUpgrade) { +@@ -2534,4 +2535,16 @@ LoadInfo::SetSkipHTTPSUpgrade(bool aSkipHTTPSUpgrade) { return NS_OK; } @@ -2393,10 +2394,10 @@ index 06acdc629c2b6ee0e29c50d8edc5a96d343b1ef2..6c263edf54117fd9cbf4a77abc396f12 + } // namespace mozilla::net diff --git a/netwerk/base/LoadInfo.h b/netwerk/base/LoadInfo.h -index c78602f6b46c983aa4d96c5727ebbaf7e2c7d984..e292766a0f34306ea1101be4ecd8848764726bad 100644 +index 93cc8d3630f7029303240555ae72d41b68047375..8a09863af399e25ba3f01caff2f6b3af1260e8b8 100644 --- a/netwerk/base/LoadInfo.h +++ b/netwerk/base/LoadInfo.h -@@ -423,6 +423,8 @@ class LoadInfo final : public nsILoadInfo { +@@ -426,6 +426,8 @@ class LoadInfo final : public nsILoadInfo { bool mIsNewWindowTarget = false; bool mSkipHTTPSUpgrade = false; @@ -2406,10 +2407,10 @@ index c78602f6b46c983aa4d96c5727ebbaf7e2c7d984..e292766a0f34306ea1101be4ecd88487 // This is exposed solely for testing purposes and should not be used outside of diff --git a/netwerk/base/TRRLoadInfo.cpp b/netwerk/base/TRRLoadInfo.cpp -index 5984a0a196615cca5544de052874cbb163a8233b..3617816a06651ae65c214ebd5f0affedc4d11390 100644 +index d1650595f8cf28a704f94a99c1f6bfe1deb9cc77..2072a3990ff6f4496626dcebb277291ad845cac3 100644 --- a/netwerk/base/TRRLoadInfo.cpp +++ b/netwerk/base/TRRLoadInfo.cpp -@@ -936,5 +936,15 @@ TRRLoadInfo::GetFetchDestination(nsACString& aDestination) { +@@ -950,5 +950,15 @@ TRRLoadInfo::GetFetchDestination(nsACString& aDestination) { return NS_ERROR_NOT_IMPLEMENTED; } @@ -2426,33 +2427,42 @@ index 5984a0a196615cca5544de052874cbb163a8233b..3617816a06651ae65c214ebd5f0affed } // namespace net } // namespace mozilla diff --git a/netwerk/base/nsILoadInfo.idl b/netwerk/base/nsILoadInfo.idl -index 2d77b8aa8799ec6bb7f38722e837d070f9057ea6..0261e58afd17c78a1484ec55e45bf34442929200 100644 +index 774ec045c0b18310e8cb86e8a9d6b1788d028435..cbf303a0ed872c27d580b4b6615f3dd9c76a8a19 100644 --- a/netwerk/base/nsILoadInfo.idl +++ b/netwerk/base/nsILoadInfo.idl -@@ -1609,4 +1609,6 @@ interface nsILoadInfo : nsISupports - * When true, this load will never be upgraded to HTTPS. - */ - [infallible] attribute boolean skipHTTPSUpgrade; +@@ -1626,4 +1626,6 @@ interface nsILoadInfo : nsISupports + return static_cast(userNavigationInvolvement); + } + %} + + [infallible] attribute unsigned long long jugglerLoadIdentifier; }; diff --git a/netwerk/base/nsINetworkInterceptController.idl b/netwerk/base/nsINetworkInterceptController.idl -index 7f91d2df6f8bb4020c75c132dc8f6bf26625fa1e..ba6569f4be8fc54ec96ee44d5de45a0904c077ba 100644 +index 7f91d2df6f8bb4020c75c132dc8f6bf26625fa1e..aaa5541a17039d6b13ad83ab176fdaaf79edb2a0 100644 --- a/netwerk/base/nsINetworkInterceptController.idl +++ b/netwerk/base/nsINetworkInterceptController.idl -@@ -59,6 +59,7 @@ interface nsIInterceptedChannel : nsISupports - * results in the resulting client not being controlled. +@@ -60,6 +60,16 @@ interface nsIInterceptedChannel : nsISupports */ void resetInterception(in boolean bypass); -+ void resetInterceptionWithURI(in nsIURI aURI); ++ // ----- Playwright begin ----- ++ ++ // Same as resetInterception, but updates the URI. ++ void resetInterceptionWithURI(in nsIURI aURI); ++ ++ // After resetInterception is called, this request will be intercepted again. ++ void interceptAfterServiceWorkerResets(); ++ ++ // ----- Playwright end ------- ++ /** * Set the status and reason for the forthcoming synthesized response. + * Multiple calls overwrite existing values. diff --git a/netwerk/ipc/DocumentLoadListener.cpp b/netwerk/ipc/DocumentLoadListener.cpp -index cdf9ad443ebf49eabc362fd555ae54c09502395c..8bca3d81fef7b59334b2ab0cdccdd80ef19c675d 100644 +index 771ae1fbe3d54aa25443eea675cf3abd26a21ce9..a916cb49c16dc6c7809ccbb7c8d4172446a5ac07 100644 --- a/netwerk/ipc/DocumentLoadListener.cpp +++ b/netwerk/ipc/DocumentLoadListener.cpp -@@ -175,6 +175,7 @@ static auto CreateDocumentLoadInfo(CanonicalBrowsingContext* aBrowsingContext, +@@ -177,6 +177,7 @@ static auto CreateDocumentLoadInfo(CanonicalBrowsingContext* aBrowsingContext, loadInfo->SetTextDirectiveUserActivation( aLoadState->GetTextDirectiveUserActivation()); loadInfo->SetIsMetaRefresh(aLoadState->IsMetaRefresh()); @@ -2461,13 +2471,19 @@ index cdf9ad443ebf49eabc362fd555ae54c09502395c..8bca3d81fef7b59334b2ab0cdccdd80e return loadInfo.forget(); } diff --git a/netwerk/protocol/http/InterceptedHttpChannel.cpp b/netwerk/protocol/http/InterceptedHttpChannel.cpp -index 6d8d65c9335583d28aa3be8c05c065fa5aede908..6ab815111954b53b4dc722a1babe6b49a78bbedc 100644 +index fbf4bdf1e24d1102df113984be6c8dc3a7d0d810..787bf014d3bf0b8537f99bf5eb4074e100c78c18 100644 --- a/netwerk/protocol/http/InterceptedHttpChannel.cpp +++ b/netwerk/protocol/http/InterceptedHttpChannel.cpp -@@ -727,6 +727,14 @@ NS_IMPL_ISUPPORTS(ResetInterceptionHeaderVisitor, nsIHttpHeaderVisitor) +@@ -728,10 +728,33 @@ NS_IMPL_ISUPPORTS(ResetInterceptionHeaderVisitor, nsIHttpHeaderVisitor) } // anonymous namespace ++NS_IMETHODIMP ++InterceptedHttpChannel::InterceptAfterServiceWorkerResets() { ++ mInterceptAfterServiceWorkerResets = true; ++ return NS_OK; ++} ++ +NS_IMETHODIMP +InterceptedHttpChannel::ResetInterceptionWithURI(nsIURI* aURI) { + if (aURI) { @@ -2479,7 +2495,20 @@ index 6d8d65c9335583d28aa3be8c05c065fa5aede908..6ab815111954b53b4dc722a1babe6b49 NS_IMETHODIMP InterceptedHttpChannel::ResetInterception(bool aBypass) { INTERCEPTED_LOG(("InterceptedHttpChannel::ResetInterception [%p] bypass: %s", -@@ -1140,11 +1148,18 @@ InterceptedHttpChannel::OnStartRequest(nsIRequest* aRequest) { + this, aBypass ? "true" : "false")); ++ if (mInterceptAfterServiceWorkerResets) { ++ mInterceptAfterServiceWorkerResets = false; ++ nsCOMPtr controller; ++ GetCallback(controller); ++ if (!controller) ++ return NS_ERROR_DOM_INVALID_STATE_ERR; ++ return controller->ChannelIntercepted(this); ++ } ++ + if (mCanceled) { + return mStatus; + } +@@ -1146,11 +1169,18 @@ InterceptedHttpChannel::OnStartRequest(nsIRequest* aRequest) { GetCallback(mProgressSink); } @@ -2498,11 +2527,151 @@ index 6d8d65c9335583d28aa3be8c05c065fa5aede908..6ab815111954b53b4dc722a1babe6b49 if (mPump && mLoadFlags & LOAD_CALL_CONTENT_SNIFFERS) { mPump->PeekStream(CallTypeSniffers, static_cast(this)); +diff --git a/netwerk/protocol/http/InterceptedHttpChannel.h b/netwerk/protocol/http/InterceptedHttpChannel.h +index 704404c9f094640ad63b685d64bd5a396e733e4b..92bdc21b4d6a015cc2f2bb22781ec6750c7789ec 100644 +--- a/netwerk/protocol/http/InterceptedHttpChannel.h ++++ b/netwerk/protocol/http/InterceptedHttpChannel.h +@@ -90,6 +90,11 @@ class InterceptedHttpChannel final + Atomic mCallingStatusAndProgress; + bool mInterceptionReset{false}; + ++ // ----- Playwright begin ----- ++ // After resetInterception is called, this request will call into interceptors again. ++ bool mInterceptAfterServiceWorkerResets{false}; ++ // ----- Playwright end ------- ++ + /** + * 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 d05b06c3f9ddba3b40d5969730474eaf0d843cb1..9b2cc35c504e1044ac681c62c107f8feb6c16938 100644 +index d3b44cc62d3df49bbf842356cbdb153c82c3163c..23cf9bc83fb1faaf1c7406331b78e522b307cbf0 100644 --- a/parser/html/nsHtml5TreeOpExecutor.cpp +++ b/parser/html/nsHtml5TreeOpExecutor.cpp -@@ -1334,6 +1334,10 @@ void nsHtml5TreeOpExecutor::UpdateReferrerInfoFromMeta( +@@ -1349,6 +1349,10 @@ void nsHtml5TreeOpExecutor::UpdateReferrerInfoFromMeta( void nsHtml5TreeOpExecutor::AddSpeculationCSP(const nsAString& aCSP) { NS_ASSERTION(NS_IsMainThread(), "Wrong thread!"); @@ -2514,7 +2683,7 @@ index d05b06c3f9ddba3b40d5969730474eaf0d843cb1..9b2cc35c504e1044ac681c62c107f8fe nsCOMPtr preloadCsp = mDocument->GetPreloadCsp(); if (!preloadCsp) { diff --git a/security/manager/ssl/nsCertOverrideService.cpp b/security/manager/ssl/nsCertOverrideService.cpp -index 1b9f32fc97bf3c5000db95567eaab85b518fe03a..3a39859d58b05b373e9db7ebb2b7ae37166d74e7 100644 +index 8413eb5916f1f857e18972a14292d14f32684aee..66a3c7b01fdc56c29d789ff786aa91d8b0f02cd6 100644 --- a/security/manager/ssl/nsCertOverrideService.cpp +++ b/security/manager/ssl/nsCertOverrideService.cpp @@ -433,7 +433,12 @@ nsCertOverrideService::HasMatchingOverride( @@ -2624,27 +2793,45 @@ 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 8b975a8b11bcf2eabbb7fa51a431ff99ff69a5bc..0eeb5924c43a21b8561dd4b68fa89228ddcbc708 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 cb235ed5b39fe5092a17b12976121ee3952d2062..649bba4c0faab1745f3040eba5925ef48b8f34f9 100644 +index 253171bed4dea54fc28bb4ddc9920823dbd9351c..6dc0e620b399ed9ee6b53f97bc080ec17ee4e1b5 100644 --- a/toolkit/components/resistfingerprinting/nsUserCharacteristics.cpp +++ b/toolkit/components/resistfingerprinting/nsUserCharacteristics.cpp -@@ -489,7 +489,7 @@ void PopulateLanguages() { +@@ -490,7 +490,7 @@ void PopulateLanguages() { // sufficient to only collect this information as the other properties are // just reformats of Navigator::GetAcceptLanguages. nsTArray languages; @@ -2682,10 +2869,10 @@ index 654903fadb709be976b72f36f155e23bc0622152..815b3dc24c9fda6b1db6c4666ac68904 int32_t aMaxSelfProgress, int32_t aCurTotalProgress, diff --git a/toolkit/components/windowwatcher/nsWindowWatcher.cpp b/toolkit/components/windowwatcher/nsWindowWatcher.cpp -index 585a957fd8a1467dc262bd1ca2058584fd8762c9..16ad38c3b7d753c386e091af700d1bebd4c59e3e 100644 +index 811fb16410e8cf900ad873797269e5fe715579a5..821f5b0c2af8e1dc8754cd023571d1d0ff09eeb6 100644 --- a/toolkit/components/windowwatcher/nsWindowWatcher.cpp +++ b/toolkit/components/windowwatcher/nsWindowWatcher.cpp -@@ -1875,7 +1875,11 @@ uint32_t nsWindowWatcher::CalculateChromeFlagsForContent( +@@ -1880,7 +1880,11 @@ uint32_t nsWindowWatcher::CalculateChromeFlagsForContent( // Open a minimal popup. *aIsPopupRequested = true; @@ -2699,10 +2886,10 @@ index 585a957fd8a1467dc262bd1ca2058584fd8762c9..16ad38c3b7d753c386e091af700d1beb /** diff --git a/toolkit/mozapps/update/UpdateService.sys.mjs b/toolkit/mozapps/update/UpdateService.sys.mjs -index b050236a46af8dc5f1b72559065c813db9343088..85873915d92d49fddff3b7c4330cbe2d39719f39 100644 +index 40f04aeace0efd701e9454bb8dc6260dec90807e..5b70f65f3e78fc0889b15651ff203bb82e79d202 100644 --- a/toolkit/mozapps/update/UpdateService.sys.mjs +++ b/toolkit/mozapps/update/UpdateService.sys.mjs -@@ -3752,6 +3752,8 @@ export class UpdateService { +@@ -3814,6 +3814,8 @@ export class UpdateService { } get disabledForTesting() { @@ -2723,22 +2910,6 @@ index c50b7f3932e18da9fad4b673e353974a001e78c4..708e0d75594ddcd62276d4e08c4bd5c6 "/toolkit/components/telemetry/tests/marionette", ] -diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp -index 7a16ea20770dd945e743871e15e5b02da4842c60..e608a81c3b069b4a020da2d7807556975f603d33 100644 ---- a/toolkit/xre/nsAppRunner.cpp -+++ b/toolkit/xre/nsAppRunner.cpp -@@ -5669,7 +5669,10 @@ nsresult XREMain::XRE_mainRun() { - - if (!AppShutdown::IsInOrBeyond(ShutdownPhase::AppShutdownConfirmed)) { - #ifdef XP_MACOSX -- if (!BackgroundTasks::IsBackgroundTaskMode()) { -+# if defined(MOZ_BACKGROUNDTASKS) -+ if (!BackgroundTasks::IsBackgroundTaskMode()) -+# endif // defined(MOZ_BACKGROUNDTASKS) -+ { - rv = appStartup->CreateHiddenWindow(); - NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE); - } diff --git a/toolkit/xre/nsWindowsWMain.cpp b/toolkit/xre/nsWindowsWMain.cpp index 7eb9e1104682d4eb47060654f43a1efa8b2a6bb2..a8315d6decf654b5302bea5beeea34140c300ded 100644 --- a/toolkit/xre/nsWindowsWMain.cpp @@ -2792,7 +2963,7 @@ index e5cc386651e192710b61858ab5625c97a02b92da..e560ad4fef232a26ce1e1b244f4ccea0 // nsDocumentViewer::LoadComplete that doesn't do various things // that are not relevant here because this wasn't an actual diff --git a/uriloader/exthandler/nsExternalHelperAppService.cpp b/uriloader/exthandler/nsExternalHelperAppService.cpp -index 418902fc1d00a2f0bc06bd68402e8bb342485c0a..101a7b63128743862d404c3fcadaa2aa886a7f8a 100644 +index e23df8e6f982ea71eb1f07dd677ed13109d2831b..d98f49d34a346113fd0ed5c242d5ef228ea0e0cd 100644 --- a/uriloader/exthandler/nsExternalHelperAppService.cpp +++ b/uriloader/exthandler/nsExternalHelperAppService.cpp @@ -112,6 +112,7 @@ @@ -3027,10 +3198,10 @@ index 5ca1a6fa13233b1bd00ee0467732c5875c51d343..0d3b8ebe127e59516802e8819f4bbed9 mIgnoreCapturingContent = aEvent.mIgnoreCapturingContent; mClickEventPrevented = aEvent.mClickEventPrevented; diff --git a/widget/cocoa/NativeKeyBindings.mm b/widget/cocoa/NativeKeyBindings.mm -index e4bdf715e2fb899e97a5bfeb2e147127460d6047..3554f919480278b7353617481c7ce8050630a1aa 100644 +index 24b70173c2e8bb9be9fd6255984a70efe3b14099..75ac367a1c4bb44d4b68b5f4ecc6adf56dbd408e 100644 --- a/widget/cocoa/NativeKeyBindings.mm +++ b/widget/cocoa/NativeKeyBindings.mm -@@ -528,6 +528,13 @@ +@@ -549,6 +549,13 @@ break; case KEY_NAME_INDEX_ArrowLeft: if (aEvent.IsAlt()) { @@ -3044,7 +3215,7 @@ index e4bdf715e2fb899e97a5bfeb2e147127460d6047..3554f919480278b7353617481c7ce805 break; } if (aEvent.IsMeta() || (aEvent.IsControl() && aEvent.IsShift())) { -@@ -550,6 +557,13 @@ +@@ -571,6 +578,13 @@ break; case KEY_NAME_INDEX_ArrowRight: if (aEvent.IsAlt()) { @@ -3058,7 +3229,7 @@ index e4bdf715e2fb899e97a5bfeb2e147127460d6047..3554f919480278b7353617481c7ce805 break; } if (aEvent.IsMeta() || (aEvent.IsControl() && aEvent.IsShift())) { -@@ -572,6 +586,10 @@ +@@ -593,6 +607,10 @@ break; case KEY_NAME_INDEX_ArrowUp: if (aEvent.IsControl()) { @@ -3069,7 +3240,7 @@ index e4bdf715e2fb899e97a5bfeb2e147127460d6047..3554f919480278b7353617481c7ce805 break; } if (aEvent.IsMeta()) { -@@ -582,7 +600,7 @@ +@@ -603,7 +621,7 @@ !aEvent.IsShift() ? ToObjcSelectorPtr(@selector(moveToBeginningOfDocument:)) : ToObjcSelectorPtr( @@ -3078,7 +3249,7 @@ index e4bdf715e2fb899e97a5bfeb2e147127460d6047..3554f919480278b7353617481c7ce805 aCommands); break; } -@@ -609,6 +627,10 @@ +@@ -630,6 +648,10 @@ break; case KEY_NAME_INDEX_ArrowDown: if (aEvent.IsControl()) { @@ -3293,7 +3464,7 @@ index 39833c28e40c61e354119cde429b8389056bafac..a638fb7520b857219ce58fcbf9ca0ed9 ~HeadlessWidget(); bool mEnabled; diff --git a/widget/nsGUIEventIPC.h b/widget/nsGUIEventIPC.h -index a1f48167403f5bfb30a66809ec3e64bea468fa05..eac7fccf3493e162629918462294456e6ee6b6e1 100644 +index f7262978239665cbe20470da0790d4d177d4c501..70d11aca3d5b509cf5b37d626299a23fede73ba3 100644 --- a/widget/nsGUIEventIPC.h +++ b/widget/nsGUIEventIPC.h @@ -244,6 +244,7 @@ struct ParamTraits { diff --git a/browser_patches/firefox/preferences/playwright.cfg b/browser_patches/firefox/preferences/playwright.cfg index b5c5e2254c182..5dc8986c19c4d 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); @@ -96,6 +99,14 @@ pref("geo.provider.testing", true); pref("media.getdisplaymedia.screencapturekit.enabled", false); pref("media.getdisplaymedia.screencapturekit.picker.enabled", false); +// Allow proxying loopback URLs; see https://phabricator.services.mozilla.com/D237187 +pref("network.proxy.allow_hijacking_localhost", true); +pref("network.proxy.testing_localhost_is_secure_when_hijacked", true); + +// Disable double-dispatching of "input" event for the text composition. +// See https://phabricator.services.mozilla.com/D234620 for details. +pref("dom.input_events.dispatch_before_compositionend", false); + // Enable software-backed webgl. See https://phabricator.services.mozilla.com/D164016 pref("webgl.forbid-software", false); diff --git a/browser_patches/webkit/UPSTREAM_CONFIG.sh b/browser_patches/webkit/UPSTREAM_CONFIG.sh index 2cb527289333b..574e1f310aa7f 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="ba8bcf39b0a89706b998447abba82590ad50fc36" +BASE_REVISION="153da00a252619799ba4b32cd0ac6c5b8faf6a35" diff --git a/browser_patches/webkit/embedder/Playwright/win/Common.cpp b/browser_patches/webkit/embedder/Playwright/win/Common.cpp index 66dee5b68ba49..01a10f7be9ced 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 3c534fd3701c3..29edbe39dad34 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 e74590c491860..ca65ccb0221fc 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; } @@ -140,7 +138,7 @@ void MainWindow::createToolbar(HINSTANCE hInstance) SendMessage(m_hToolbarWnd, TB_ADDBUTTONS, _countof(tbButtons), reinterpret_cast(&tbButtons)); ShowWindow(m_hToolbarWnd, true); - m_hURLBarWnd = CreateWindow(L"EDIT", 0, WS_CHILD | WS_VISIBLE | WS_BORDER | ES_LEFT | ES_AUTOVSCROLL, 0, 0, 0, 0, m_hToolbarWnd, 0, hInstance, 0); + m_hURLBarWnd = CreateWindow(L"EDIT", 0, WS_CHILD | WS_VISIBLE | WS_BORDER | ES_LEFT | ES_AUTOHSCROLL, 0, 0, 0, 0, m_hToolbarWnd, 0, hInstance, 0); DefEditProc = reinterpret_cast(GetWindowLongPtr(m_hURLBarWnd, GWLP_WNDPROC)); SetWindowLongPtr(m_hURLBarWnd, GWLP_WNDPROC, reinterpret_cast(EditProc)); @@ -210,7 +208,9 @@ bool MainWindow::init(HINSTANCE hInstance, WKPageConfigurationRef conf) resizeSubViews(); if (s_headless) { + auto menu = GetMenu(m_hMainWnd); SetMenu(m_hMainWnd, NULL); + DestroyMenu(menu); } else { SetFocus(m_hURLBarWnd); ShowWindow(m_hMainWnd, SW_SHOW); diff --git a/browser_patches/webkit/embedder/Playwright/win/MainWindow.h b/browser_patches/webkit/embedder/Playwright/win/MainWindow.h index c34241fb1df15..e0af565f4b98b 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/Playwright.ico b/browser_patches/webkit/embedder/Playwright/win/Playwright.ico index 0137fe83a54dd..cea0bdebc38b2 100644 Binary files a/browser_patches/webkit/embedder/Playwright/win/Playwright.ico and b/browser_patches/webkit/embedder/Playwright/win/Playwright.ico differ diff --git a/browser_patches/webkit/embedder/Playwright/win/WebKitBrowserWindow.cpp b/browser_patches/webkit/embedder/Playwright/win/WebKitBrowserWindow.cpp index ee4ea065a71b2..c850d820763a5 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 d80ba9f7bd28c..2261c2b810d2e 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 a94e5b5ffaf1b..9d644885f063b 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 b52d8892843f6b934081c0e0b9f93264626937b5..d076e8ad848680e0a0b7790ff4b11bb768c72523 100644 +index 458e1d4118805169ee6f9139af942cc5c3f88f8e..238f2a33ba150fae735915244910eaa66f5fd267 100644 --- a/Source/JavaScriptCore/CMakeLists.txt +++ b/Source/JavaScriptCore/CMakeLists.txt -@@ -1401,21 +1401,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 b52d8892843f6b934081c0e0b9f93264626937b5..d076e8ad848680e0a0b7790ff4b11bb7 ${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 a92c371597d3af93bc7dd936efb1046ad899eaec..dc94df080778cb9b38b6a9cc3213d922505ff323 100644 +index 9fd3a4e6a53eb3339ced1e87f0b4cacd16f73167..a77d72ab052625c7b5a4d7c56a71befbad884871 100644 --- a/Source/JavaScriptCore/DerivedSources-input.xcfilelist +++ b/Source/JavaScriptCore/DerivedSources-input.xcfilelist -@@ -99,20 +99,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 a92c371597d3af93bc7dd936efb1046ad899eaec..dc94df080778cb9b38b6a9cc3213d922 $(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 706f3548b9a40b323d49af7d61f5bc59692a0da6..c2b49f4b97f34e512442c1a790ba794df2ae26cd 100644 +index 3db6c2e250371dedc6a9f88bf1688112d467434a..a3832759ea36fb50bdbea6809b9fd13e6f66e46b 100644 --- a/Source/JavaScriptCore/DerivedSources.make +++ b/Source/JavaScriptCore/DerivedSources.make -@@ -302,21 +302,26 @@ INSPECTOR_DOMAINS := \ +@@ -301,21 +301,26 @@ INSPECTOR_DOMAINS := \ $(JavaScriptCore)/inspector/protocol/CSS.json \ $(JavaScriptCore)/inspector/protocol/Canvas.json \ $(JavaScriptCore)/inspector/protocol/Console.json \ @@ -169,10 +169,10 @@ index 1f5d0adbf624bd24ef1e525967e6e82e8c37b4e5..4fe0f364b4ccd11774bf29f772e0a568 // We could be called re-entrantly from a nested run loop, so restore the previous id. SetForScope scopedRequestId(m_currentRequestId, requestId); diff --git a/Source/JavaScriptCore/inspector/InspectorBackendDispatcher.h b/Source/JavaScriptCore/inspector/InspectorBackendDispatcher.h -index 2eba743177c016a3415d4a5deafc552e842dd0fa..939d14be7a2703777652467f0f60e67ef1c5e0f8 100644 +index 28f4cdacf6ebd7037a42a75872618436332d90ec..463f014be2bd29a75bee7b2113b6f929da13aca5 100644 --- a/Source/JavaScriptCore/inspector/InspectorBackendDispatcher.h +++ b/Source/JavaScriptCore/inspector/InspectorBackendDispatcher.h -@@ -83,8 +83,11 @@ public: +@@ -95,8 +95,11 @@ public: ServerError }; @@ -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 27c65fbda226f1cd5bfd68944fe87fb9b2a688a6..b036f050859ee88004a7bf6daa4bb73835360615 100644 +index 25711ac1aa269d7e0231a6169be1bc495f2c8dc0..bcb4d83e58a51458de6e070ef7cb859ee333bdbc 100644 --- a/Source/JavaScriptCore/inspector/protocol/DOM.json +++ b/Source/JavaScriptCore/inspector/protocol/DOM.json @@ -80,6 +80,16 @@ @@ -411,24 +411,7 @@ index 27c65fbda226f1cd5bfd68944fe87fb9b2a688a6..b036f050859ee88004a7bf6daa4bb738 { "id": "EventListener", "type": "object", -@@ -268,6 +278,16 @@ - { "name": "width", "type": "number" }, - { "name": "height", "type": "number" } - ] -+ }, -+ { -+ "id": "FilePayload", -+ "type": "object", -+ "description": "Data to construct File object.", -+ "properties": [ -+ { "name": "name", "type": "string", "description": "File name." }, -+ { "name": "type", "type": "string", "description": "File type." }, -+ { "name": "data", "type": "string", "description": "Base64-encoded file data." } -+ ] - } - ], - "commands": [ -@@ -697,7 +717,10 @@ +@@ -745,7 +755,10 @@ "description": "Resolves JavaScript node object for given node id.", "targetTypes": ["page"], "parameters": [ @@ -440,7 +423,7 @@ index 27c65fbda226f1cd5bfd68944fe87fb9b2a688a6..b036f050859ee88004a7bf6daa4bb738 { "name": "objectGroup", "type": "string", "optional": true, "description": "Symbolic group name that can be used to release multiple objects." } ], "returns": [ -@@ -774,6 +797,47 @@ +@@ -822,6 +835,46 @@ "returns": [ { "name": "mediaStats", "$ref": "MediaStats", "description": "An interleaved array of node attribute names and values." } ] @@ -481,8 +464,7 @@ index 27c65fbda226f1cd5bfd68944fe87fb9b2a688a6..b036f050859ee88004a7bf6daa4bb738 + "description": "Sets input files for given ", + "parameters": [ + { "name": "objectId", "$ref": "Runtime.RemoteObjectId", "description": "Input element handle." }, -+ { "name": "files", "type": "array", "items": { "$ref": "FilePayload" }, "optional": true, "description": "Files to set" }, -+ { "name": "paths", "type": "array", "items": { "type": "string" }, "optional": true, "description": "File paths to set" } ++ { "name": "paths", "type": "array", "items": { "type": "string" }, "description": "File paths to set" } + ], + "async": true } @@ -1697,7 +1679,7 @@ index 24891ad836086fd23024fcb4d08ca63f6974c812..29f4b6b1923383fec7a99d28a4e815dc private: enum ArgumentRequirement { ArgumentRequired, ArgumentNotRequired }; diff --git a/Source/ThirdParty/libwebrtc/CMakeLists.txt b/Source/ThirdParty/libwebrtc/CMakeLists.txt -index 2ccb951b0cf57707b68ce5e971c5e191b91f2bd0..6ff141b41f4b6c279c367ad66d5c2b6adede8646 100644 +index ca4f3508a44e3c6677a72fbe3d7c853714b4f2c6..ae117f5f402a7eb259e376ca9440e00062e22d9f 100644 --- a/Source/ThirdParty/libwebrtc/CMakeLists.txt +++ b/Source/ThirdParty/libwebrtc/CMakeLists.txt @@ -532,6 +532,11 @@ set(webrtc_SOURCES @@ -1712,15 +1694,7 @@ index 2ccb951b0cf57707b68ce5e971c5e191b91f2bd0..6ff141b41f4b6c279c367ad66d5c2b6a Source/third_party/libyuv/source/compare.cc Source/third_party/libyuv/source/compare_common.cc Source/third_party/libyuv/source/compare_gcc.cc -@@ -695,7 +700,6 @@ set(webrtc_SOURCES - Source/webrtc/api/video_codecs/builtin_video_encoder_factory.cc - Source/webrtc/api/video_codecs/h264_profile_level_id.cc - Source/webrtc/api/video_codecs/h265_profile_tier_level.cc -- Source/webrtc/api/video_codecs/libaom_av1_encoder_factory.cc - Source/webrtc/api/video_codecs/scalability_mode.cc - Source/webrtc/api/video_codecs/scalability_mode_helper.cc - Source/webrtc/api/video_codecs/sdp_video_format.cc -@@ -2350,6 +2354,11 @@ set(webrtc_INCLUDE_DIRECTORIES PRIVATE +@@ -2348,6 +2353,11 @@ set(webrtc_INCLUDE_DIRECTORIES PRIVATE Source/third_party/libsrtp/config Source/third_party/libsrtp/crypto/include Source/third_party/libsrtp/include @@ -1746,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 6c754858a3ea883a65ad022ce16b6c45ae65ee35..15f968472712e1a2a88672ed290b103cf9d620ec 100644 +index 13c5b5ea562fe808a3251c3ae789f8106632cd25..36b77e7d6bc78ba2e982cad5a2b4792775d3280d 100644 --- a/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.exp +++ b/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.exp -@@ -421,3 +421,16 @@ __ZNK8mkvmuxer7Segment16GetTrackByNumberEy - __ZN8mkvmuxer6Tracks11kAv1CodecIdE - __ZN8mkvmuxer6Tracks11kVp8CodecIdE - __ZN8mkvmuxer6Tracks11kVp9CodecIdE +@@ -434,3 +434,16 @@ __ZN6webrtc18VideoFrameMetadata7SetSsrcEj + __ZN6webrtc18VideoFrameMetadata8SetCsrcsENSt3__16vectorIjNS1_9allocatorIjEEEE + __ZN6webrtc18VideoFrameMetadata8SetWidthEt + __ZN6webrtc18VideoFrameMetadata9SetHeightEt +__ZN8mkvmuxer11SegmentInfo4InitEv +__ZN8mkvmuxer9MkvWriterC1EP7__sFILE +_ARGBToI420 @@ -1767,10 +1741,10 @@ index 6c754858a3ea883a65ad022ce16b6c45ae65ee35..15f968472712e1a2a88672ed290b103c +_vpx_codec_version_str +_vpx_codec_vp8_cx diff --git a/Source/ThirdParty/libwebrtc/libwebrtc.xcodeproj/project.pbxproj b/Source/ThirdParty/libwebrtc/libwebrtc.xcodeproj/project.pbxproj -index 2c30b5b08d589c82def812fb881a63cb6e49e7b4..c76a8a2963923bf54c3d134aa2594150c43a4b3c 100644 +index 7585b2e5e9bffdc8cabd888dd822313d53b30141..5909d33b9726cdc7d2d53b538f7da18bc221e30b 100644 --- a/Source/ThirdParty/libwebrtc/libwebrtc.xcodeproj/project.pbxproj +++ b/Source/ThirdParty/libwebrtc/libwebrtc.xcodeproj/project.pbxproj -@@ -55,6 +55,20 @@ +@@ -56,6 +56,20 @@ }; /* End PBXAggregateTarget section */ @@ -1791,7 +1765,7 @@ index 2c30b5b08d589c82def812fb881a63cb6e49e7b4..c76a8a2963923bf54c3d134aa2594150 /* Begin PBXBuildFile section */ 2D6BFF60280A93DF00A1A74F /* video_coding.h in Headers */ = {isa = PBXBuildFile; fileRef = 4131C45B234C81710028A615 /* video_coding.h */; settings = {ATTRIBUTES = (Public, ); }; }; 2D6BFF61280A93EC00A1A74F /* video_codec_initializer.h in Headers */ = {isa = PBXBuildFile; fileRef = 4131C45E234C81720028A615 /* video_codec_initializer.h */; settings = {ATTRIBUTES = (Public, ); }; }; -@@ -5772,6 +5786,13 @@ +@@ -5786,6 +5800,13 @@ remoteGlobalIDString = DDF30D0527C5C003006A526F; remoteInfo = absl; }; @@ -1805,7 +1779,7 @@ index 2c30b5b08d589c82def812fb881a63cb6e49e7b4..c76a8a2963923bf54c3d134aa2594150 /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ -@@ -24241,6 +24262,7 @@ +@@ -24271,6 +24292,7 @@ ); dependencies = ( 410B3827292B73E90003E515 /* PBXTargetDependency */, @@ -1813,7 +1787,7 @@ index 2c30b5b08d589c82def812fb881a63cb6e49e7b4..c76a8a2963923bf54c3d134aa2594150 DD2E76E827C6B69A00F2A74C /* PBXTargetDependency */, CDEBB4CC24C01AB400ADBD44 /* PBXTargetDependency */, 411ED040212E0811004320BA /* PBXTargetDependency */, -@@ -24334,6 +24356,7 @@ +@@ -24364,6 +24386,7 @@ 4460B8B92B155B6A00392062 /* vp9_qp_parser_fuzzer */, 444A6EF02AEADFC9005FE121 /* vp9_replay_fuzzer */, 44945C512B9BA1C300447FFD /* webm_fuzzer */, @@ -1821,7 +1795,7 @@ index 2c30b5b08d589c82def812fb881a63cb6e49e7b4..c76a8a2963923bf54c3d134aa2594150 ); }; /* End PBXProject section */ -@@ -24437,6 +24460,23 @@ +@@ -24467,6 +24490,23 @@ shellPath = /bin/sh; shellScript = "[ -z \"${WK_DERIVED_SDK_HEADERS_DIR}\" -o -d \"${WK_DERIVED_SDK_HEADERS_DIR}\" ] && touch \"${SCRIPT_OUTPUT_FILE_0}\"\n"; }; @@ -1845,7 +1819,7 @@ index 2c30b5b08d589c82def812fb881a63cb6e49e7b4..c76a8a2963923bf54c3d134aa2594150 /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ -@@ -27400,6 +27440,11 @@ +@@ -27437,6 +27477,11 @@ target = DDF30D0527C5C003006A526F /* absl */; targetProxy = DD2E76E727C6B69A00F2A74C /* PBXContainerItemProxy */; }; @@ -1857,7 +1831,7 @@ index 2c30b5b08d589c82def812fb881a63cb6e49e7b4..c76a8a2963923bf54c3d134aa2594150 /* End PBXTargetDependency section */ /* Begin XCBuildConfiguration section */ -@@ -28167,6 +28212,27 @@ +@@ -28204,6 +28249,27 @@ }; name = Production; }; @@ -1885,7 +1859,7 @@ index 2c30b5b08d589c82def812fb881a63cb6e49e7b4..c76a8a2963923bf54c3d134aa2594150 FB39D0711200ED9200088E69 /* Debug */ = { isa = XCBuildConfiguration; baseConfigurationReference = 5D7C59C71208C68B001C873E /* DebugRelease.xcconfig */; -@@ -28549,6 +28615,16 @@ +@@ -28586,6 +28652,16 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Production; }; @@ -1903,7 +1877,7 @@ index 2c30b5b08d589c82def812fb881a63cb6e49e7b4..c76a8a2963923bf54c3d134aa2594150 isa = XCConfigurationList; buildConfigurations = ( diff --git a/Source/ThirdParty/skia/CMakeLists.txt b/Source/ThirdParty/skia/CMakeLists.txt -index 74b12c3ccae8b65ad3a35063bece92a9ecb27cbe..1656508a1c5a2103b2bab3068305c6bdba7f0208 100644 +index 6bfc5cba986488f3d808ebd0583c476cd93da70e..f4c4222d17bce640355ba52e00152069d5b14432 100644 --- a/Source/ThirdParty/skia/CMakeLists.txt +++ b/Source/ThirdParty/skia/CMakeLists.txt @@ -10,6 +10,8 @@ if (USE_SKIA_ENCODERS) @@ -1915,7 +1889,7 @@ index 74b12c3ccae8b65ad3a35063bece92a9ecb27cbe..1656508a1c5a2103b2bab3068305c6bd if (ANDROID) find_package(EXPAT REQUIRED) endif () -@@ -947,6 +949,7 @@ endif () +@@ -948,6 +950,7 @@ endif () target_link_libraries(Skia PRIVATE JPEG::JPEG PNG::PNG @@ -1923,11 +1897,23 @@ index 74b12c3ccae8b65ad3a35063bece92a9ecb27cbe..1656508a1c5a2103b2bab3068305c6bd ) WEBKIT_ADD_TARGET_CXX_FLAGS(Skia +diff --git a/Source/ThirdParty/skia/src/opts/SkOpts_SetTarget.h b/Source/ThirdParty/skia/src/opts/SkOpts_SetTarget.h +index 525cfcb862ae96bf8573d00b67dc9e5e23c10d22..f2debc0444cb8f5b80a0e99a2214bceaab3960c1 100644 +--- a/Source/ThirdParty/skia/src/opts/SkOpts_SetTarget.h ++++ b/Source/ThirdParty/skia/src/opts/SkOpts_SetTarget.h +@@ -65,6 +65,7 @@ + // Each of the specific intrinsic headers also checks to ensure that immintrin.h has been + // included, so do that here, first. + #if defined(__clang__) && defined(_MSC_VER) ++ #define __RTMINTRIN_H // Workaround for https://github.com/llvm/llvm-project/issues/95133 + #include + #endif + diff --git a/Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml b/Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml -index 02d962ba310f7e231c84657823766c834ae5b6a6..44587b824e07c1d8a9fa99b32a02da0ddd2ca52c 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. @@ -1935,16 +1921,16 @@ index 02d962ba310f7e231c84657823766c834ae5b6a6..44587b824e07c1d8a9fa99b32a02da0d 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: @@ -1957,8 +1943,8 @@ index 02d962ba310f7e231c84657823766c834ae5b6a6..44587b824e07c1d8a9fa99b32a02da0d - "PLATFORM(COCOA)": true default: false - BlobRegistryTopOriginPartitioningEnabled: -@@ -2270,6 +2268,7 @@ CrossOriginEmbedderPolicyEnabled: + BlockFontServiceInWebContentSandbox: +@@ -2143,6 +2141,7 @@ CrossOriginEmbedderPolicyEnabled: WebCore: default: false @@ -1966,16 +1952,7 @@ index 02d962ba310f7e231c84657823766c834ae5b6a6..44587b824e07c1d8a9fa99b32a02da0d CrossOriginOpenerPolicyEnabled: type: bool status: stable -@@ -2310,7 +2309,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: -@@ -2343,6 +2342,7 @@ DOMAudioSessionFullEnabled: +@@ -2216,6 +2215,7 @@ DOMAudioSessionFullEnabled: WebCore: default: false @@ -1983,16 +1960,16 @@ index 02d962ba310f7e231c84657823766c834ae5b6a6..44587b824e07c1d8a9fa99b32a02da0d DOMPasteAccessRequestsEnabled: type: bool status: internal -@@ -2354,7 +2354,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 -@@ -2420,10 +2420,10 @@ DataListElementEnabled: +@@ -2293,10 +2293,10 @@ DataListElementEnabled: WebKitLegacy: default: false WebKit: @@ -2005,7 +1982,7 @@ index 02d962ba310f7e231c84657823766c834ae5b6a6..44587b824e07c1d8a9fa99b32a02da0d default: false sharedPreferenceForWebProcess: true -@@ -2436,7 +2436,7 @@ DataTransferItemsEnabled: +@@ -2309,7 +2309,7 @@ DataTransferItemsEnabled: WebKitLegacy: default: true WebKit: @@ -2014,7 +1991,7 @@ index 02d962ba310f7e231c84657823766c834ae5b6a6..44587b824e07c1d8a9fa99b32a02da0d default: false WebCore: default: false -@@ -2691,7 +2691,7 @@ DirectoryUploadEnabled: +@@ -2537,7 +2537,7 @@ DirectoryUploadEnabled: WebKitLegacy: default: false WebKit: @@ -2023,7 +2000,7 @@ index 02d962ba310f7e231c84657823766c834ae5b6a6..44587b824e07c1d8a9fa99b32a02da0d default: false WebCore: default: false -@@ -3143,10 +3143,10 @@ FullScreenEnabled: +@@ -3020,10 +3020,10 @@ FullScreenEnabled: WebKitLegacy: default: false WebKit: @@ -2036,7 +2013,7 @@ index 02d962ba310f7e231c84657823766c834ae5b6a6..44587b824e07c1d8a9fa99b32a02da0d default: false sharedPreferenceForWebProcess: true -@@ -3707,7 +3707,7 @@ InputTypeColorEnabled: +@@ -3614,7 +3614,7 @@ InputTypeColorEnabled: WebKitLegacy: default: false WebKit: @@ -2045,7 +2022,7 @@ index 02d962ba310f7e231c84657823766c834ae5b6a6..44587b824e07c1d8a9fa99b32a02da0d default: false WebCore: default: false -@@ -3740,7 +3740,7 @@ InputTypeDateEnabled: +@@ -3647,7 +3647,7 @@ InputTypeDateEnabled: "PLATFORM(IOS_FAMILY)": true default: false WebKit: @@ -2054,7 +2031,7 @@ index 02d962ba310f7e231c84657823766c834ae5b6a6..44587b824e07c1d8a9fa99b32a02da0d default: false WebCore: default: false -@@ -3756,7 +3756,7 @@ InputTypeDateTimeLocalEnabled: +@@ -3663,7 +3663,7 @@ InputTypeDateTimeLocalEnabled: "PLATFORM(IOS_FAMILY)": true default: false WebKit: @@ -2063,7 +2040,7 @@ index 02d962ba310f7e231c84657823766c834ae5b6a6..44587b824e07c1d8a9fa99b32a02da0d default: false WebCore: default: false -@@ -3788,7 +3788,7 @@ InputTypeTimeEnabled: +@@ -3695,7 +3695,7 @@ InputTypeTimeEnabled: "PLATFORM(IOS_FAMILY)": true default: false WebKit: @@ -2072,24 +2049,24 @@ index 02d962ba310f7e231c84657823766c834ae5b6a6..44587b824e07c1d8a9fa99b32a02da0d default: false WebCore: default: false -@@ -3836,6 +3836,7 @@ InspectorAttachmentSide: - WebKit: - default: 0 +@@ -3756,6 +3756,7 @@ InspectorMaximumResourcesContentSize: + "PLATFORM(WPE)": 50 + default: 200 +# Playwright: disable setting. InspectorStartsAttached: type: bool status: embedder -@@ -3843,7 +3844,7 @@ InspectorStartsAttached: +@@ -3763,7 +3764,7 @@ InspectorStartsAttached: exposed: [ WebKit ] defaultValue: WebKit: - default: true + default: false - InspectorWindowFrame: - type: String -@@ -5778,7 +5779,7 @@ PermissionsAPIEnabled: + InspectorSupportsShowingCertificate: + type: bool +@@ -5683,7 +5684,7 @@ PermissionsAPIEnabled: WebKitLegacy: default: false WebKit: @@ -2098,7 +2075,7 @@ index 02d962ba310f7e231c84657823766c834ae5b6a6..44587b824e07c1d8a9fa99b32a02da0d default: false WebCore: default: false -@@ -5841,6 +5842,19 @@ PitchCorrectionAlgorithm: +@@ -5762,6 +5763,19 @@ PitchCorrectionAlgorithm: WebCore: default: MediaPlayerEnums::PitchCorrectionAlgorithm::BestAllAround @@ -2118,7 +2095,7 @@ index 02d962ba310f7e231c84657823766c834ae5b6a6..44587b824e07c1d8a9fa99b32a02da0d PointerLockOptionsEnabled: type: bool status: stable -@@ -6420,7 +6434,7 @@ ScreenOrientationAPIEnabled: +@@ -6344,7 +6358,7 @@ ScreenOrientationAPIEnabled: WebKitLegacy: default: false WebKit: @@ -2127,7 +2104,7 @@ index 02d962ba310f7e231c84657823766c834ae5b6a6..44587b824e07c1d8a9fa99b32a02da0d WebCore: default: false sharedPreferenceForWebProcess: true -@@ -7879,6 +7893,7 @@ UseCGDisplayListsForDOMRendering: +@@ -7806,6 +7820,7 @@ UseCGDisplayListsForDOMRendering: default: true sharedPreferenceForWebProcess: true @@ -2135,7 +2112,7 @@ index 02d962ba310f7e231c84657823766c834ae5b6a6..44587b824e07c1d8a9fa99b32a02da0d UseGPUProcessForCanvasRenderingEnabled: type: bool status: stable -@@ -7891,7 +7906,7 @@ UseGPUProcessForCanvasRenderingEnabled: +@@ -7818,7 +7833,7 @@ UseGPUProcessForCanvasRenderingEnabled: defaultValue: WebKit: "ENABLE(GPU_PROCESS_BY_DEFAULT)": true @@ -2144,7 +2121,7 @@ index 02d962ba310f7e231c84657823766c834ae5b6a6..44587b824e07c1d8a9fa99b32a02da0d default: false UseGPUProcessForDOMRenderingEnabled: -@@ -7936,6 +7951,7 @@ UseGPUProcessForMediaEnabled: +@@ -7863,6 +7878,7 @@ UseGPUProcessForMediaEnabled: sharedPreferenceForWebProcess: true mediaPlaybackRelated: true @@ -2152,7 +2129,7 @@ index 02d962ba310f7e231c84657823766c834ae5b6a6..44587b824e07c1d8a9fa99b32a02da0d UseGPUProcessForWebGLEnabled: type: bool status: internal -@@ -7947,7 +7963,7 @@ UseGPUProcessForWebGLEnabled: +@@ -7874,7 +7890,7 @@ UseGPUProcessForWebGLEnabled: default: false WebKit: "ENABLE(GPU_PROCESS_BY_DEFAULT) && ENABLE(GPU_PROCESS_WEBGL_BY_DEFAULT)": true @@ -2162,7 +2139,7 @@ index 02d962ba310f7e231c84657823766c834ae5b6a6..44587b824e07c1d8a9fa99b32a02da0d 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 d86540738b2e5e66811b67dd07889c6188126dd7..128f697e7a46b2c6af7716933ee8845228eaba0e 100644 +index a36395e83c53617c2f894695846f8798fc277624..f0b8dd0fd12b4cde24975c20015cee30292abf9d 100644 --- a/Source/WTF/wtf/PlatformEnable.h +++ b/Source/WTF/wtf/PlatformEnable.h @@ -385,7 +385,7 @@ @@ -2184,10 +2161,10 @@ index d86540738b2e5e66811b67dd07889c6188126dd7..128f697e7a46b2c6af7716933ee88452 #if !defined(ENABLE_TOUCH_ACTION_REGIONS) diff --git a/Source/WTF/wtf/PlatformEnableCocoa.h b/Source/WTF/wtf/PlatformEnableCocoa.h -index bacd225fea9dc695e021649fc6d74012e300be27..9e5497d6f0ecca35bbb5fc2a53f36ee8a3b39435 100644 +index 8304147ff102789180b2682eb64d599791528c93..af8cb85981bda7b91edfa21b6cc321849d93b909 100644 --- a/Source/WTF/wtf/PlatformEnableCocoa.h +++ b/Source/WTF/wtf/PlatformEnableCocoa.h -@@ -813,7 +813,7 @@ +@@ -808,7 +808,7 @@ #endif #if !defined(ENABLE_SEC_ITEM_SHIM) @@ -2197,10 +2174,10 @@ index bacd225fea9dc695e021649fc6d74012e300be27..9e5497d6f0ecca35bbb5fc2a53f36ee8 #if !defined(ENABLE_SERVER_PRECONNECT) diff --git a/Source/WTF/wtf/PlatformHave.h b/Source/WTF/wtf/PlatformHave.h -index 93e12dd54312a4c8479687b9f175c948250339f8..b39779453f1d51c302e5c5a39d58594a63eb22a2 100644 +index 9e91a26aac61faea9634328f9a46421a4b4b7c38..b70776d97be4025435dc3c0364105cb17c429f6a 100644 --- a/Source/WTF/wtf/PlatformHave.h +++ b/Source/WTF/wtf/PlatformHave.h -@@ -1220,7 +1220,8 @@ +@@ -1189,7 +1189,8 @@ #endif #if PLATFORM(MAC) @@ -2227,10 +2204,10 @@ index 007b8fe3292f326504013be8198ae020f7aacf35..1c722c473732ffe05fdb61010fa4417e namespace Unicode { diff --git a/Source/WebCore/DerivedSources.make b/Source/WebCore/DerivedSources.make -index 6b62ff89947f5a393ee50381af9f6ddfecc91037..202376ddb4a475a23e0379e26f866451c6e184ba 100644 +index 0f0341624503ae9744b71d3675dc96545371456a..cc73c79374f07fbf1f83e7075e53a3d99da0705c 100644 --- a/Source/WebCore/DerivedSources.make +++ b/Source/WebCore/DerivedSources.make -@@ -1221,6 +1221,10 @@ JS_BINDING_IDLS := \ +@@ -1229,6 +1229,10 @@ JS_BINDING_IDLS := \ $(WebCore)/dom/SubscriberCallback.idl \ $(WebCore)/dom/SubscriptionObserver.idl \ $(WebCore)/dom/SubscriptionObserverCallback.idl \ @@ -2241,7 +2218,7 @@ index 6b62ff89947f5a393ee50381af9f6ddfecc91037..202376ddb4a475a23e0379e26f866451 $(WebCore)/dom/Text.idl \ $(WebCore)/dom/TextDecoder.idl \ $(WebCore)/dom/TextDecoderStream.idl \ -@@ -1821,9 +1825,6 @@ JS_BINDING_IDLS := \ +@@ -1829,9 +1833,6 @@ JS_BINDING_IDLS := \ ADDITIONAL_BINDING_IDLS = \ DocumentTouch.idl \ GestureEvent.idl \ @@ -2252,10 +2229,10 @@ index 6b62ff89947f5a393ee50381af9f6ddfecc91037..202376ddb4a475a23e0379e26f866451 vpath %.in $(WEBKITADDITIONS_HEADER_SEARCH_PATHS) diff --git a/Source/WebCore/Modules/geolocation/Geolocation.cpp b/Source/WebCore/Modules/geolocation/Geolocation.cpp -index d66eb4a0c175ab495ef10bd393115165b5545fc2..cd89bd44bd2a8b3036c3446c01475bf726a3a18a 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(); @@ -2302,24 +2279,11 @@ 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 7cd931c48dd3c7c4cc6136c91692054ca98e6ddf..e32cfb28521033f1713bd963ba9825a9500f4fc9 100644 +index 06a9accfc8e6c46493733663b5d76b07fc80db22..4946d012d166c84b25d4d954266c4dc528f7d8ad 100644 --- a/Source/WebCore/SourcesCocoa.txt +++ b/Source/WebCore/SourcesCocoa.txt -@@ -733,3 +733,9 @@ testing/cocoa/WebViewVisualIdentificationOverlay.mm +@@ -734,3 +734,9 @@ testing/cocoa/WebViewVisualIdentificationOverlay.mm platform/graphics/angle/GraphicsContextGLANGLE.cpp @no-unify platform/graphics/cocoa/GraphicsContextGLCocoa.mm @no-unify platform/graphics/cv/GraphicsContextGLCVCocoa.mm @no-unify @@ -2330,7 +2294,7 @@ index 7cd931c48dd3c7c4cc6136c91692054ca98e6ddf..e32cfb28521033f1713bd963ba9825a9 +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 @@ -2345,10 +2309,10 @@ index 9cc9f51e48b3058ea29da389629c021bcf05e202..978ac405073534ba6fa79f483d885643 +JSSpeechSynthesisEventInit.cpp +// Playwright: end. diff --git a/Source/WebCore/SourcesWPE.txt b/Source/WebCore/SourcesWPE.txt -index f785335022a20f31c8941c0aabd8895a17f71a3e..a3516d2db0cef38b3257b4b8653711f90f24c257 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 @@ -2357,18 +2321,14 @@ index f785335022a20f31c8941c0aabd8895a17f71a3e..a3516d2db0cef38b3257b4b8653711f9 page/linux/ResourceUsageOverlayLinux.cpp page/linux/ResourceUsageThreadLinux.cpp -@@ -89,6 +91,17 @@ platform/text/LocaleICU.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 @@ -2376,10 +2336,10 @@ index f785335022a20f31c8941c0aabd8895a17f71a3e..a3516d2db0cef38b3257b4b8653711f9 +JSSpeechSynthesisEventInit.cpp +// Playwright: end. diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj -index d58402bdd7423c3274088b4e35a22922a107062a..4dc6b7adcaf5a34ffbe0b4aad5552a17daa926e7 100644 +index e522afd2d6f038d2a2c9804313d1d8e75c63e914..03f521d898bd7d80a94e7e3c0fc4c904d279a0ba 100644 --- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj +++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj -@@ -6404,6 +6404,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, ); }; }; @@ -2393,7 +2353,7 @@ index d58402bdd7423c3274088b4e35a22922a107062a..4dc6b7adcaf5a34ffbe0b4aad5552a17 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, ); }; }; -@@ -21038,6 +21045,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 = ""; }; @@ -2408,7 +2368,7 @@ index d58402bdd7423c3274088b4e35a22922a107062a..4dc6b7adcaf5a34ffbe0b4aad5552a17 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 = ""; }; -@@ -28800,6 +28815,11 @@ +@@ -28928,6 +28943,11 @@ BC4A5324256055590028C592 /* TextDirectionSubmenuInclusionBehavior.h */, 2D4F96F11A1ECC240098BF88 /* TextIndicator.cpp */, 2D4F96F21A1ECC240098BF88 /* TextIndicator.h */, @@ -2420,7 +2380,7 @@ index d58402bdd7423c3274088b4e35a22922a107062a..4dc6b7adcaf5a34ffbe0b4aad5552a17 F48570A42644C76D00C05F71 /* TranslationContextMenuInfo.h */, F4E1965F21F26E4E00285078 /* UndoItem.cpp */, 2ECDBAD521D8906300F00ECD /* UndoItem.h */, -@@ -35771,6 +35791,8 @@ +@@ -35916,6 +35936,8 @@ 29E4D8DF16B0940F00C84704 /* PlatformSpeechSynthesizer.h */, 1AD8F81A11CAB9E900E93E54 /* PlatformStrategies.cpp */, 1AD8F81911CAB9E900E93E54 /* PlatformStrategies.h */, @@ -2429,7 +2389,7 @@ index d58402bdd7423c3274088b4e35a22922a107062a..4dc6b7adcaf5a34ffbe0b4aad5552a17 FE3DC9932D0C063C0021B6FC /* PlatformTZoneImpls.cpp */, 0FD7C21D23CE41E30096D102 /* PlatformWheelEvent.cpp */, 935C476A09AC4D4F00A6AAB4 /* PlatformWheelEvent.h */, -@@ -38569,6 +38591,7 @@ +@@ -38777,6 +38799,7 @@ AD6E71AB1668899D00320C13 /* DocumentSharedObjectPool.h */, 6BDB5DC1227BD3B800919770 /* DocumentStorageAccess.cpp */, 6BDB5DC0227BD3B800919770 /* DocumentStorageAccess.h */, @@ -2437,7 +2397,7 @@ index d58402bdd7423c3274088b4e35a22922a107062a..4dc6b7adcaf5a34ffbe0b4aad5552a17 7CE7FA5B1EF882300060C9D6 /* DocumentTouch.cpp */, 7CE7FA591EF882300060C9D6 /* DocumentTouch.h */, A8185F3209765765005826D9 /* DocumentType.cpp */, -@@ -43482,6 +43505,8 @@ +@@ -43729,6 +43752,8 @@ F4E90A3C2B52038E002DA469 /* PlatformTextAlternatives.h in Headers */, 0F7D07331884C56C00B4AF86 /* PlatformTextTrack.h in Headers */, 074E82BB18A69F0E007EF54C /* PlatformTimeRanges.h in Headers */, @@ -2446,7 +2406,7 @@ index d58402bdd7423c3274088b4e35a22922a107062a..4dc6b7adcaf5a34ffbe0b4aad5552a17 CDD08ABD277E542600EA3755 /* PlatformTrackConfiguration.h in Headers */, CD1F9B022700323D00617EB6 /* PlatformVideoColorPrimaries.h in Headers */, CD1F9B01270020B700617EB6 /* PlatformVideoColorSpace.h in Headers */, -@@ -44827,6 +44852,7 @@ +@@ -45097,6 +45122,7 @@ 0F54DD081881D5F5003EEDBB /* Touch.h in Headers */, 71B7EE0D21B5C6870031C1EF /* TouchAction.h in Headers */, 0F54DD091881D5F5003EEDBB /* TouchEvent.h in Headers */, @@ -2454,7 +2414,7 @@ index d58402bdd7423c3274088b4e35a22922a107062a..4dc6b7adcaf5a34ffbe0b4aad5552a17 0F54DD0A1881D5F5003EEDBB /* TouchList.h in Headers */, 070334D71459FFD5008D8D45 /* TrackBase.h in Headers */, BE88E0C21715CE2600658D98 /* TrackListBase.h in Headers */, -@@ -46007,6 +46033,8 @@ +@@ -46300,6 +46326,8 @@ 2D22830323A8470700364B7E /* CursorMac.mm in Sources */, 5CBD59592280E926002B22AA /* CustomHeaderFields.cpp in Sources */, 07E4BDBF2A3A5FAB000D5509 /* DictationCaretAnimator.cpp in Sources */, @@ -2463,7 +2423,7 @@ index d58402bdd7423c3274088b4e35a22922a107062a..4dc6b7adcaf5a34ffbe0b4aad5552a17 7CE6CBFD187F394900D46BF5 /* FormatConverter.cpp in Sources */, 4667EA3E2968D9DA00BAB1E2 /* GameControllerHapticEffect.mm in Sources */, 46FE73D32968E52000B8064C /* GameControllerHapticEngines.mm in Sources */, -@@ -46098,6 +46126,9 @@ +@@ -46390,6 +46418,9 @@ CE88EE262414467B007F29C2 /* TextAlternativeWithRange.mm in Sources */, BE39137129B267F500FA5D4F /* TextTransformCocoa.cpp in Sources */, 51DF6D800B92A18E00C2DC85 /* ThreadCheck.mm in Sources */, @@ -2474,10 +2434,10 @@ index d58402bdd7423c3274088b4e35a22922a107062a..4dc6b7adcaf5a34ffbe0b4aad5552a17 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 c6efab7897b328d46bfbca84f84fca8ad39bff48..bc5826d14817244396ddae91e57dde1312a4407e 100644 +index 3f19caf891dfa1cc70aa630f4e82c405825ab40c..62b2978c8d5e8af5e337d8b27c1d2ad938b773fe 100644 --- a/Source/WebCore/accessibility/AccessibilityObject.cpp +++ b/Source/WebCore/accessibility/AccessibilityObject.cpp -@@ -70,6 +70,7 @@ +@@ -72,6 +72,7 @@ #include "HTMLTableSectionElement.h" #include "HTMLTextAreaElement.h" #include "HitTestResult.h" @@ -2485,7 +2445,7 @@ index c6efab7897b328d46bfbca84f84fca8ad39bff48..bc5826d14817244396ddae91e57dde13 #include "LocalFrame.h" #include "LocalizedStrings.h" #include "MathMLNames.h" -@@ -3987,7 +3988,12 @@ AccessibilityObjectInclusion AccessibilityObject::defaultObjectInclusion() const +@@ -3931,7 +3932,12 @@ AccessibilityObjectInclusion AccessibilityObject::defaultObjectInclusion() const if (roleValue() == AccessibilityRole::ApplicationDialog) return AccessibilityObjectInclusion::IncludeObject; @@ -2500,10 +2460,10 @@ index c6efab7897b328d46bfbca84f84fca8ad39bff48..bc5826d14817244396ddae91e57dde13 bool AccessibilityObject::isWithinHiddenWebArea() const diff --git a/Source/WebCore/bindings/js/WebCoreBuiltinNames.h b/Source/WebCore/bindings/js/WebCoreBuiltinNames.h -index 0a0523ff37b7a51dc2152f074fb57b17883bd80f..715881ff75557f4e9165b521061e4b7a35286eba 100644 +index 158dc6af1464896ac4c4727c52581729ac132352..b8bd22a7d80d08d6dd56ea1bc10addbe3f839b6d 100644 --- a/Source/WebCore/bindings/js/WebCoreBuiltinNames.h +++ b/Source/WebCore/bindings/js/WebCoreBuiltinNames.h -@@ -187,6 +187,8 @@ namespace WebCore { +@@ -190,6 +190,8 @@ namespace WebCore { macro(DelayNode) \ macro(DeprecationReportBody) \ macro(DigitalCredential) \ @@ -2513,10 +2473,10 @@ index 0a0523ff37b7a51dc2152f074fb57b17883bd80f..715881ff75557f4e9165b521061e4b7a macro(DynamicsCompressorNode) \ macro(ElementInternals) \ diff --git a/Source/WebCore/css/query/MediaQueryFeatures.cpp b/Source/WebCore/css/query/MediaQueryFeatures.cpp -index 83e2a42d3f09289d61217f63a121611a92aae85d..f4dfda8e9dc1dd9ad221272f09e1bd7f49afa1e0 100644 +index aec43490053f95341ef979385b5e6c1daf03a090..4e44b7e341c8247f916f8597092248d8ec884518 100644 --- a/Source/WebCore/css/query/MediaQueryFeatures.cpp +++ b/Source/WebCore/css/query/MediaQueryFeatures.cpp -@@ -496,7 +496,11 @@ static const IdentifierSchema& forcedColorsFeatureSchema() +@@ -498,7 +498,11 @@ static const IdentifierSchema& forcedColorsFeatureSchema() "forced-colors"_s, FixedVector { CSSValueNone, CSSValueActive }, OptionSet(), @@ -2529,7 +2489,7 @@ index 83e2a42d3f09289d61217f63a121611a92aae85d..f4dfda8e9dc1dd9ad221272f09e1bd7f return MatchingIdentifiers { CSSValueNone }; } }; -@@ -682,6 +686,9 @@ static const IdentifierSchema& prefersReducedMotionFeatureSchema() +@@ -686,6 +690,9 @@ static const IdentifierSchema& prefersReducedMotionFeatureSchema() [](auto& context) { bool userPrefersReducedMotion = [&] { Ref frame = *context.document->frame(); @@ -2633,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" @@ -2644,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()); } @@ -2741,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() { } @@ -2768,10 +2729,10 @@ index 7813532cc52d582c42aebc979a1ecd1137765f08..c01cbd53ad2430a6ffab9a80fc73e74a #endif // USE(LIBWPE) diff --git a/Source/WebCore/html/FileInputType.cpp b/Source/WebCore/html/FileInputType.cpp -index 28d2a4af93da12474d1b699f6f0c46522514e3bb..0f20c78e509cce10e4179a1be91173b3de16db10 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" @@ -2779,34 +2740,23 @@ index 28d2a4af93da12474d1b699f6f0c46522514e3bb..0f20c78e509cce10e4179a1be91173b3 #include "LocalFrame.h" #include "LocalizedStrings.h" #include "MIMETypeRegistry.h" -@@ -160,6 +161,11 @@ void FileInputType::handleDOMActivateEvent(Event& event) - if (input.isDisabledFormControl()) +@@ -161,6 +162,11 @@ void FileInputType::handleDOMActivateEvent(Event& event) + if (protectedElement()->isDisabledFormControl()) return; + bool intercept = false; -+ InspectorInstrumentation::runOpenPanel(input.document().frame(), element(), &intercept); ++ InspectorInstrumentation::runOpenPanel(element()->document().frame(), element(), &intercept); + if (intercept) + return; + if (!UserGestureIndicator::processingUserGesture()) return; -@@ -345,7 +351,9 @@ void FileInputType::setFiles(RefPtr&& files, RequestIcon shouldRequest - pathsChanged = true; - else { - for (unsigned i = 0; i < length; ++i) { -- if (files->file(i).path() != m_fileList->file(i).path() || !FileSystem::fileIDsAreEqual(files->file(i).fileID(), m_fileList->file(i).fileID())) { -+ if (files->file(i).path() != m_fileList->file(i).path() || !FileSystem::fileIDsAreEqual(files->file(i).fileID(), m_fileList->file(i).fileID()) || -+ // Files created from Blob have empty path. -+ (files->file(i).path().isEmpty() && files->file(i).name() != m_fileList->file(i).name())) { - pathsChanged = true; - break; - } diff --git a/Source/WebCore/inspector/InspectorController.cpp b/Source/WebCore/inspector/InspectorController.cpp -index 79d7f4b39f4bc4ec2535bb355e567e39bc1f9ffa..6d1c4513780476767b4c51c8dcd3afd30088176d 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()); @@ -2815,7 +2765,7 @@ index 79d7f4b39f4bc4ec2535bb355e567e39bc1f9ffa..6d1c4513780476767b4c51c8dcd3afd3 } 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); @@ -2824,7 +2774,7 @@ index 79d7f4b39f4bc4ec2535bb355e567e39bc1f9ffa..6d1c4513780476767b4c51c8dcd3afd3 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; @@ -2835,7 +2785,7 @@ index 79d7f4b39f4bc4ec2535bb355e567e39bc1f9ffa..6d1c4513780476767b4c51c8dcd3afd3 ensureDOMAgent().inspect(node); } -@@ -541,4 +545,34 @@ void InspectorController::didComposite(LocalFrame& frame) +@@ -542,4 +546,34 @@ void InspectorController::didComposite(LocalFrame& frame) InspectorInstrumentation::didComposite(frame); } @@ -2904,10 +2854,10 @@ index 4f5c1e836876710a554455ec53733f72db63de58..774c4a66af84664a7a83ba0790d147f7 } // namespace WebCore diff --git a/Source/WebCore/inspector/InspectorInstrumentation.cpp b/Source/WebCore/inspector/InspectorInstrumentation.cpp -index 7e789f4b0704d574b3bf180b2417822d9ee33994..80e6b4bc7810af19265d24e0de861c8ea2728999 100644 +index 1c660f381ad7e9a9201aeced2906f39135e810f6..6c47abc2f32b39fd5c0bf9048b9c1224959ba08c 100644 --- a/Source/WebCore/inspector/InspectorInstrumentation.cpp +++ b/Source/WebCore/inspector/InspectorInstrumentation.cpp -@@ -583,6 +583,12 @@ void InspectorInstrumentation::applyUserAgentOverrideImpl(InstrumentingAgents& i +@@ -595,6 +595,12 @@ void InspectorInstrumentation::applyUserAgentOverrideImpl(InstrumentingAgents& i pageAgent->applyUserAgentOverride(userAgent); } @@ -2920,7 +2870,7 @@ index 7e789f4b0704d574b3bf180b2417822d9ee33994..80e6b4bc7810af19265d24e0de861c8e void InspectorInstrumentation::applyEmulatedMediaImpl(InstrumentingAgents& instrumentingAgents, AtomString& media) { if (auto* pageAgent = instrumentingAgents.enabledPageAgent()) -@@ -666,6 +672,12 @@ void InspectorInstrumentation::didFailLoadingImpl(InstrumentingAgents& instrumen +@@ -678,6 +684,12 @@ void InspectorInstrumentation::didFailLoadingImpl(InstrumentingAgents& instrumen consoleAgent->didFailLoading(identifier, error); // This should come AFTER resource notification, front-end relies on this. } @@ -2933,7 +2883,7 @@ index 7e789f4b0704d574b3bf180b2417822d9ee33994..80e6b4bc7810af19265d24e0de861c8e void InspectorInstrumentation::willLoadXHRSynchronouslyImpl(InstrumentingAgents& instrumentingAgents) { if (auto* networkAgent = instrumentingAgents.enabledNetworkAgent()) -@@ -698,20 +710,17 @@ void InspectorInstrumentation::didReceiveScriptResponseImpl(InstrumentingAgents& +@@ -710,20 +722,17 @@ void InspectorInstrumentation::didReceiveScriptResponseImpl(InstrumentingAgents& void InspectorInstrumentation::domContentLoadedEventFiredImpl(InstrumentingAgents& instrumentingAgents, LocalFrame& frame) { @@ -2957,7 +2907,7 @@ index 7e789f4b0704d574b3bf180b2417822d9ee33994..80e6b4bc7810af19265d24e0de861c8e } void InspectorInstrumentation::frameDetachedFromParentImpl(InstrumentingAgents& instrumentingAgents, LocalFrame& frame) -@@ -791,12 +800,6 @@ void InspectorInstrumentation::frameDocumentUpdatedImpl(InstrumentingAgents& ins +@@ -803,12 +812,6 @@ void InspectorInstrumentation::frameDocumentUpdatedImpl(InstrumentingAgents& ins pageDOMDebuggerAgent->frameDocumentUpdated(frame); } @@ -2970,7 +2920,7 @@ index 7e789f4b0704d574b3bf180b2417822d9ee33994..80e6b4bc7810af19265d24e0de861c8e void InspectorInstrumentation::frameStartedLoadingImpl(InstrumentingAgents& instrumentingAgents, LocalFrame& frame) { if (frame.isMainFrame()) { -@@ -827,10 +830,10 @@ void InspectorInstrumentation::frameStoppedLoadingImpl(InstrumentingAgents& inst +@@ -839,10 +842,10 @@ void InspectorInstrumentation::frameStoppedLoadingImpl(InstrumentingAgents& inst inspectorPageAgent->frameStoppedLoading(frame); } @@ -2983,7 +2933,7 @@ index 7e789f4b0704d574b3bf180b2417822d9ee33994..80e6b4bc7810af19265d24e0de861c8e } void InspectorInstrumentation::frameClearedScheduledNavigationImpl(InstrumentingAgents& instrumentingAgents, Frame& frame) -@@ -845,6 +848,12 @@ void InspectorInstrumentation::accessibilitySettingsDidChangeImpl(InstrumentingA +@@ -857,6 +860,12 @@ void InspectorInstrumentation::accessibilitySettingsDidChangeImpl(InstrumentingA inspectorPageAgent->accessibilitySettingsDidChange(); } @@ -2996,7 +2946,7 @@ index 7e789f4b0704d574b3bf180b2417822d9ee33994..80e6b4bc7810af19265d24e0de861c8e #if ENABLE(DARK_MODE_CSS) void InspectorInstrumentation::defaultAppearanceDidChangeImpl(InstrumentingAgents& instrumentingAgents) { -@@ -897,6 +906,12 @@ void InspectorInstrumentation::interceptResponseImpl(InstrumentingAgents& instru +@@ -909,6 +918,12 @@ void InspectorInstrumentation::interceptResponseImpl(InstrumentingAgents& instru networkAgent->interceptResponse(response, identifier, WTFMove(handler)); } @@ -3009,7 +2959,7 @@ index 7e789f4b0704d574b3bf180b2417822d9ee33994..80e6b4bc7810af19265d24e0de861c8e // JavaScriptCore InspectorDebuggerAgent should know Console MessageTypes. static bool isConsoleAssertMessage(MessageSource source, MessageType type) { -@@ -1015,6 +1030,12 @@ void InspectorInstrumentation::consoleStopRecordingCanvasImpl(InstrumentingAgent +@@ -1027,6 +1042,12 @@ void InspectorInstrumentation::consoleStopRecordingCanvasImpl(InstrumentingAgent canvasAgent->consoleStopRecordingCanvas(context); } @@ -3022,7 +2972,7 @@ index 7e789f4b0704d574b3bf180b2417822d9ee33994..80e6b4bc7810af19265d24e0de861c8e void InspectorInstrumentation::didDispatchDOMStorageEventImpl(InstrumentingAgents& instrumentingAgents, const String& key, const String& oldValue, const String& newValue, StorageType storageType, const SecurityOrigin& securityOrigin) { if (auto* domStorageAgent = instrumentingAgents.enabledDOMStorageAgent()) -@@ -1305,6 +1326,36 @@ void InspectorInstrumentation::renderLayerDestroyedImpl(InstrumentingAgents& ins +@@ -1317,6 +1338,36 @@ void InspectorInstrumentation::renderLayerDestroyedImpl(InstrumentingAgents& ins layerTreeAgent->renderLayerDestroyed(renderLayer); } @@ -3059,7 +3009,7 @@ index 7e789f4b0704d574b3bf180b2417822d9ee33994..80e6b4bc7810af19265d24e0de861c8e InstrumentingAgents& InspectorInstrumentation::instrumentingAgents(WorkerOrWorkletGlobalScope& globalScope) { return globalScope.inspectorController().m_instrumentingAgents; -@@ -1321,6 +1372,13 @@ InstrumentingAgents& InspectorInstrumentation::instrumentingAgents(Page& page) +@@ -1333,6 +1384,13 @@ InstrumentingAgents& InspectorInstrumentation::instrumentingAgents(Page& page) return page.inspectorController().m_instrumentingAgents.get(); } @@ -3074,7 +3024,7 @@ index 7e789f4b0704d574b3bf180b2417822d9ee33994..80e6b4bc7810af19265d24e0de861c8e { // Using RefPtr makes us hit the m_inRemovedLastRefFunction assert. diff --git a/Source/WebCore/inspector/InspectorInstrumentation.h b/Source/WebCore/inspector/InspectorInstrumentation.h -index c338ad466f69c4b03121e0b17fbc9a4729654aff..6139fb2b5e0364bce1a5720200943f3005f541c3 100644 +index ed15dcc0dd1eb8d22dc48d8c6515b2258db574c5..c297c2d0e61b8ca1f881bb7942c463626bf0118f 100644 --- a/Source/WebCore/inspector/InspectorInstrumentation.h +++ b/Source/WebCore/inspector/InspectorInstrumentation.h @@ -31,6 +31,7 @@ @@ -3085,7 +3035,7 @@ index c338ad466f69c4b03121e0b17fbc9a4729654aff..6139fb2b5e0364bce1a5720200943f30 #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" @@ -3093,7 +3043,7 @@ index c338ad466f69c4b03121e0b17fbc9a4729654aff..6139fb2b5e0364bce1a5720200943f30 #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; @@ -3101,7 +3051,7 @@ index c338ad466f69c4b03121e0b17fbc9a4729654aff..6139fb2b5e0364bce1a5720200943f30 class HTTPHeaderMap; class InspectorTimelineAgent; class InstrumentingAgents; -@@ -194,6 +197,7 @@ public: +@@ -197,6 +200,7 @@ public: static void didRecalculateStyle(Document&); static void didScheduleStyleRecalculation(Document&); static void applyUserAgentOverride(LocalFrame&, String&); @@ -3109,7 +3059,7 @@ index c338ad466f69c4b03121e0b17fbc9a4729654aff..6139fb2b5e0364bce1a5720200943f30 static void applyEmulatedMedia(LocalFrame&, AtomString&); static void flexibleBoxRendererBeganLayout(const RenderObject&); -@@ -206,6 +210,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&); @@ -3117,7 +3067,7 @@ index c338ad466f69c4b03121e0b17fbc9a4729654aff..6139fb2b5e0364bce1a5720200943f30 static void willSendRequest(ServiceWorkerGlobalScope&, ResourceLoaderIdentifier, ResourceRequest&); static void didReceiveResourceResponse(ServiceWorkerGlobalScope&, ResourceLoaderIdentifier, const ResourceResponse&); -@@ -232,13 +237,13 @@ public: +@@ -235,13 +240,13 @@ public: static void frameDetachedFromParent(LocalFrame&); static void didCommitLoad(LocalFrame&, DocumentLoader*); static void frameDocumentUpdated(LocalFrame&); @@ -3133,7 +3083,7 @@ index c338ad466f69c4b03121e0b17fbc9a4729654aff..6139fb2b5e0364bce1a5720200943f30 #if ENABLE(DARK_MODE_CSS) static void defaultAppearanceDidChange(Page&); #endif -@@ -249,6 +254,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)>&&); @@ -3141,15 +3091,15 @@ index c338ad466f69c4b03121e0b17fbc9a4729654aff..6139fb2b5e0364bce1a5720200943f30 static void addMessageToConsole(Page&, std::unique_ptr); static void addMessageToConsole(WorkerOrWorkletGlobalScope&, std::unique_ptr); -@@ -270,6 +276,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); -@@ -323,6 +330,12 @@ public: +@@ -330,6 +337,12 @@ public: static void layerTreeDidChange(Page*); static void renderLayerDestroyed(Page*, const RenderLayer&); @@ -3162,7 +3112,7 @@ index c338ad466f69c4b03121e0b17fbc9a4729654aff..6139fb2b5e0364bce1a5720200943f30 static void frontendCreated(); static void frontendDeleted(); static bool hasFrontends() { return InspectorInstrumentationPublic::hasFrontends(); } -@@ -339,6 +352,8 @@ public: +@@ -346,6 +359,8 @@ public: static void registerInstrumentingAgents(InstrumentingAgents&); static void unregisterInstrumentingAgents(InstrumentingAgents&); @@ -3171,7 +3121,7 @@ index c338ad466f69c4b03121e0b17fbc9a4729654aff..6139fb2b5e0364bce1a5720200943f30 private: static void didClearWindowObjectInWorldImpl(InstrumentingAgents&, LocalFrame&, DOMWrapperWorld&); static bool isDebuggerPausedImpl(InstrumentingAgents&); -@@ -418,6 +433,7 @@ private: +@@ -427,6 +442,7 @@ private: static void didRecalculateStyleImpl(InstrumentingAgents&); static void didScheduleStyleRecalculationImpl(InstrumentingAgents&, Document&); static void applyUserAgentOverrideImpl(InstrumentingAgents&, String&); @@ -3179,7 +3129,7 @@ index c338ad466f69c4b03121e0b17fbc9a4729654aff..6139fb2b5e0364bce1a5720200943f30 static void applyEmulatedMediaImpl(InstrumentingAgents&, AtomString&); static void flexibleBoxRendererBeganLayoutImpl(InstrumentingAgents&, const RenderObject&); -@@ -432,6 +448,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&); @@ -3187,7 +3137,7 @@ index c338ad466f69c4b03121e0b17fbc9a4729654aff..6139fb2b5e0364bce1a5720200943f30 static void willLoadXHRSynchronouslyImpl(InstrumentingAgents&); static void didLoadXHRSynchronouslyImpl(InstrumentingAgents&); static void scriptImportedImpl(InstrumentingAgents&, ResourceLoaderIdentifier, const String& sourceString); -@@ -442,13 +459,13 @@ private: +@@ -451,13 +468,13 @@ private: static void frameDetachedFromParentImpl(InstrumentingAgents&, LocalFrame&); static void didCommitLoadImpl(InstrumentingAgents&, LocalFrame&, DocumentLoader*); static void frameDocumentUpdatedImpl(InstrumentingAgents&, LocalFrame&); @@ -3203,7 +3153,7 @@ index c338ad466f69c4b03121e0b17fbc9a4729654aff..6139fb2b5e0364bce1a5720200943f30 #if ENABLE(DARK_MODE_CSS) static void defaultAppearanceDidChangeImpl(InstrumentingAgents&); #endif -@@ -459,6 +476,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)>&&); @@ -3211,7 +3161,7 @@ index c338ad466f69c4b03121e0b17fbc9a4729654aff..6139fb2b5e0364bce1a5720200943f30 static void addMessageToConsoleImpl(InstrumentingAgents&, std::unique_ptr); -@@ -473,6 +491,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&); @@ -3219,7 +3169,7 @@ index c338ad466f69c4b03121e0b17fbc9a4729654aff..6139fb2b5e0364bce1a5720200943f30 static void performanceMarkImpl(InstrumentingAgents&, const String& label, std::optional); -@@ -526,6 +545,12 @@ private: +@@ -535,6 +554,12 @@ private: static void layerTreeDidChangeImpl(InstrumentingAgents&); static void renderLayerDestroyedImpl(InstrumentingAgents&, const RenderLayer&); @@ -3232,7 +3182,7 @@ index c338ad466f69c4b03121e0b17fbc9a4729654aff..6139fb2b5e0364bce1a5720200943f30 static InstrumentingAgents& instrumentingAgents(Page&); static InstrumentingAgents& instrumentingAgents(WorkerOrWorkletGlobalScope&); static InstrumentingAgents& instrumentingAgents(ServiceWorkerGlobalScope&); -@@ -1071,6 +1096,13 @@ inline void InspectorInstrumentation::applyUserAgentOverride(LocalFrame& frame, +@@ -1094,6 +1119,13 @@ inline void InspectorInstrumentation::applyUserAgentOverride(LocalFrame& frame, applyUserAgentOverrideImpl(*agents, userAgent); } @@ -3246,7 +3196,7 @@ index c338ad466f69c4b03121e0b17fbc9a4729654aff..6139fb2b5e0364bce1a5720200943f30 inline void InspectorInstrumentation::applyEmulatedMedia(LocalFrame& frame, AtomString& media) { FAST_RETURN_IF_NO_FRONTENDS(void()); -@@ -1173,6 +1205,13 @@ inline void InspectorInstrumentation::didFailLoading(ServiceWorkerGlobalScope& g +@@ -1196,6 +1228,13 @@ inline void InspectorInstrumentation::didFailLoading(ServiceWorkerGlobalScope& g didFailLoadingImpl(instrumentingAgents(globalScope), identifier, nullptr, error); } @@ -3260,7 +3210,7 @@ index c338ad466f69c4b03121e0b17fbc9a4729654aff..6139fb2b5e0364bce1a5720200943f30 inline void InspectorInstrumentation::continueAfterXFrameOptionsDenied(LocalFrame& frame, ResourceLoaderIdentifier identifier, DocumentLoader& loader, const ResourceResponse& response) { // Treat the same as didReceiveResponse. -@@ -1263,13 +1302,6 @@ inline void InspectorInstrumentation::frameDocumentUpdated(LocalFrame& frame) +@@ -1286,13 +1325,6 @@ inline void InspectorInstrumentation::frameDocumentUpdated(LocalFrame& frame) frameDocumentUpdatedImpl(*agents, frame); } @@ -3274,7 +3224,7 @@ index c338ad466f69c4b03121e0b17fbc9a4729654aff..6139fb2b5e0364bce1a5720200943f30 inline void InspectorInstrumentation::frameStartedLoading(LocalFrame& frame) { FAST_RETURN_IF_NO_FRONTENDS(void()); -@@ -1291,11 +1323,11 @@ inline void InspectorInstrumentation::frameStoppedLoading(LocalFrame& frame) +@@ -1314,11 +1346,11 @@ inline void InspectorInstrumentation::frameStoppedLoading(LocalFrame& frame) frameStoppedLoadingImpl(*agents, frame); } @@ -3288,7 +3238,7 @@ index c338ad466f69c4b03121e0b17fbc9a4729654aff..6139fb2b5e0364bce1a5720200943f30 } inline void InspectorInstrumentation::frameClearedScheduledNavigation(Frame& frame) -@@ -1311,6 +1343,13 @@ inline void InspectorInstrumentation::accessibilitySettingsDidChange(Page& page) +@@ -1334,6 +1366,13 @@ inline void InspectorInstrumentation::accessibilitySettingsDidChange(Page& page) accessibilitySettingsDidChangeImpl(instrumentingAgents(page)); } @@ -3302,7 +3252,7 @@ index c338ad466f69c4b03121e0b17fbc9a4729654aff..6139fb2b5e0364bce1a5720200943f30 #if ENABLE(DARK_MODE_CSS) inline void InspectorInstrumentation::defaultAppearanceDidChange(Page& page) { -@@ -1363,6 +1402,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)); } @@ -3316,7 +3266,7 @@ index c338ad466f69c4b03121e0b17fbc9a4729654aff..6139fb2b5e0364bce1a5720200943f30 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()); -@@ -1679,6 +1725,11 @@ inline void InspectorInstrumentation::performanceMark(ScriptExecutionContext& co +@@ -1726,6 +1772,11 @@ inline void InspectorInstrumentation::performanceMark(ScriptExecutionContext& co performanceMarkImpl(*agents, label, WTFMove(startTime)); } @@ -3328,7 +3278,7 @@ index c338ad466f69c4b03121e0b17fbc9a4729654aff..6139fb2b5e0364bce1a5720200943f30 inline void InspectorInstrumentation::didRequestAnimationFrame(ScriptExecutionContext& scriptExecutionContext, int callbackId) { FAST_RETURN_IF_NO_FRONTENDS(void()); -@@ -1735,6 +1786,42 @@ inline void InspectorInstrumentation::renderLayerDestroyed(Page* page, const Ren +@@ -1782,6 +1833,42 @@ inline void InspectorInstrumentation::renderLayerDestroyed(Page* page, const Ren renderLayerDestroyedImpl(*agents, renderLayer); } @@ -3424,10 +3374,10 @@ index c028341e84e59a6b1b16107fd74feb21f70b12ab..d385418ac34e8f315f201801a2c65226 + } diff --git a/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp b/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp -index a477bad0c14c9304b9c2f03aa4e690e8b27a7756..fcb712a41223ec4698337a8b17999e0ca049ae40 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" @@ -3435,7 +3385,7 @@ index a477bad0c14c9304b9c2f03aa4e690e8b27a7756..fcb712a41223ec4698337a8b17999e0c #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" @@ -3450,7 +3400,7 @@ index a477bad0c14c9304b9c2f03aa4e690e8b27a7756..fcb712a41223ec4698337a8b17999e0c #include "HTMLMediaElement.h" #include "HTMLNames.h" #include "HTMLScriptElement.h" -@@ -103,12 +109,14 @@ +@@ -102,12 +108,14 @@ #include "Pasteboard.h" #include "PseudoElement.h" #include "RenderGrid.h" @@ -3465,7 +3415,7 @@ index a477bad0c14c9304b9c2f03aa4e690e8b27a7756..fcb712a41223ec4698337a8b17999e0c #include "StaticNodeList.h" #include "StyleProperties.h" #include "StyleResolver.h" -@@ -150,7 +158,8 @@ using namespace HTMLNames; +@@ -149,7 +157,8 @@ using namespace HTMLNames; static const size_t maxTextSize = 10000; static const UChar horizontalEllipsisUChar[] = { horizontalEllipsis, 0 }; @@ -3475,7 +3425,7 @@ index a477bad0c14c9304b9c2f03aa4e690e8b27a7756..fcb712a41223ec4698337a8b17999e0c { if (!colorObject) return std::nullopt; -@@ -169,7 +178,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) { @@ -3484,7 +3434,7 @@ index a477bad0c14c9304b9c2f03aa4e690e8b27a7756..fcb712a41223ec4698337a8b17999e0c } static Color parseOptionalConfigColor(const String& fieldName, JSON::Object& configObject) -@@ -196,6 +205,20 @@ static bool parseQuad(Ref&& quadArray, FloatQuad* quad) +@@ -195,6 +204,20 @@ static bool parseQuad(Ref&& quadArray, FloatQuad* quad) return true; } @@ -3505,7 +3455,7 @@ index a477bad0c14c9304b9c2f03aa4e690e8b27a7756..fcb712a41223ec4698337a8b17999e0c class RevalidateStyleAttributeTask final : public CanMakeCheckedPtr { WTF_MAKE_TZONE_ALLOCATED(RevalidateStyleAttributeTask); WTF_OVERRIDE_DELETE_FOR_CHECKED_PTR(RevalidateStyleAttributeTask); -@@ -476,6 +499,20 @@ Node* InspectorDOMAgent::assertNode(Inspector::Protocol::ErrorString& errorStrin +@@ -475,6 +498,20 @@ Node* InspectorDOMAgent::assertNode(Inspector::Protocol::ErrorString& errorStrin return node.get(); } @@ -3526,7 +3476,7 @@ index a477bad0c14c9304b9c2f03aa4e690e8b27a7756..fcb712a41223ec4698337a8b17999e0c Document* InspectorDOMAgent::assertDocument(Inspector::Protocol::ErrorString& errorString, Inspector::Protocol::DOM::NodeId nodeId) { RefPtr node = assertNode(errorString, nodeId); -@@ -1550,16 +1587,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; @@ -3544,7 +3494,7 @@ index a477bad0c14c9304b9c2f03aa4e690e8b27a7756..fcb712a41223ec4698337a8b17999e0c if (!node) return makeUnexpected(errorString); -@@ -1814,15 +1842,159 @@ Inspector::Protocol::ErrorStringOr InspectorDOMAgent::setInspectedNode(Ins +@@ -1857,15 +1885,159 @@ Inspector::Protocol::ErrorStringOr InspectorDOMAgent::setInspectedNode(Ins return { }; } @@ -3707,7 +3657,7 @@ index a477bad0c14c9304b9c2f03aa4e690e8b27a7756..fcb712a41223ec4698337a8b17999e0c if (!object) return makeUnexpected("Missing injected script for given nodeId"_s); -@@ -3088,7 +3260,7 @@ Inspector::Protocol::ErrorStringOr InspectorDO +@@ -3131,7 +3303,7 @@ Inspector::Protocol::ErrorStringOr InspectorDO return makeUnexpected("Missing node for given path"_s); } @@ -3716,7 +3666,7 @@ index a477bad0c14c9304b9c2f03aa4e690e8b27a7756..fcb712a41223ec4698337a8b17999e0c { Document* document = &node->document(); if (auto* templateHost = document->templateDocumentHost()) -@@ -3097,12 +3269,18 @@ RefPtr InspectorDOMAgent::resolveNod +@@ -3140,12 +3312,18 @@ RefPtr InspectorDOMAgent::resolveNod if (!frame) return nullptr; @@ -3738,11 +3688,11 @@ index a477bad0c14c9304b9c2f03aa4e690e8b27a7756..fcb712a41223ec4698337a8b17999e0c } Node* InspectorDOMAgent::scriptValueAsNode(JSC::JSValue value) -@@ -3210,4 +3388,89 @@ Inspector::Protocol::ErrorStringOr> In +@@ -3291,4 +3469,53 @@ Inspector::Protocol::ErrorStringOr> In #endif } -+void InspectorDOMAgent::setInputFiles(const String& objectId, RefPtr&& files, RefPtr&& paths, Ref&& callback) { ++void InspectorDOMAgent::setInputFiles(const String& objectId, Ref&& paths, Ref&& callback) { + InjectedScript injectedScript = m_injectedScriptManager.injectedScriptForObjectId(objectId); + if (injectedScript.hasNoValue()) { + callback->sendFailure("Can not find element's context for given id"_s); @@ -3760,76 +3710,40 @@ index a477bad0c14c9304b9c2f03aa4e690e8b27a7756..fcb712a41223ec4698337a8b17999e0c + return; + } + -+ if (!(bool(files) ^ bool(paths))) { -+ callback->sendFailure("Exactly one of files and paths should be specified"_s); -+ return; -+ } -+ + HTMLInputElement* element = static_cast(node); + Vector> fileObjects; -+ if (files) { -+ for (unsigned i = 0; i < files->length(); ++i) { -+ RefPtr item = files->get(i); -+ RefPtr obj = item->asObject(); -+ if (!obj) { -+ callback->sendFailure("Invalid file payload format"_s); -+ return; -+ } -+ -+ String name; -+ String type; -+ String data; -+ if (!obj->getString("name"_s, name) || !obj->getString("type"_s, type) || !obj->getString("data"_s, data)) { -+ callback->sendFailure("Invalid file payload format"_s); -+ return; -+ } -+ -+ std::optional> buffer = base64Decode(data); -+ if (!buffer) { -+ callback->sendFailure("Unable to decode given content"_s); ++ if (element->hasAttributeWithoutSynchronization(webkitdirectoryAttr)) { ++ auto directoryFileListCreator = DirectoryFileListCreator::create([element = RefPtr { element }, callback = WTFMove(callback)](Ref&& fileList) mutable { ++ ASSERT(isMainThread()); ++ element->setFiles(WTFMove(fileList)); ++ callback->sendSuccess(); ++ }); ++ Vector fileChooserFiles; ++ for (size_t i = 0; i < paths->length(); ++i) { ++ fileChooserFiles.append(FileChooserFileInfo { paths->get(i)->asString(), nullString(), { } }); ++ } ++ directoryFileListCreator->start(m_document.get(), fileChooserFiles); ++ } else { ++ for (unsigned i = 0; i < paths->length(); ++i) { ++ RefPtr item = paths->get(i); ++ String path = item->asString(); ++ if (path.isEmpty()) { ++ callback->sendFailure("Invalid file path"_s); + return; + } + + ScriptExecutionContext* context = element->scriptExecutionContext(); -+ fileObjects.append(File::create(context, Blob::create(context, WTFMove(*buffer), type), name)); ++ fileObjects.append(File::create(context, path)); + } + RefPtr fileList = FileList::create(WTFMove(fileObjects)); + element->setFiles(WTFMove(fileList)); + callback->sendSuccess(); -+ } else { -+ if (element->hasAttributeWithoutSynchronization(webkitdirectoryAttr)) { -+ auto directoryFileListCreator = DirectoryFileListCreator::create([element = RefPtr { element }, callback = WTFMove(callback)](Ref&& fileList) mutable { -+ ASSERT(isMainThread()); -+ element->setFiles(WTFMove(fileList)); -+ callback->sendSuccess(); -+ }); -+ Vector fileChooserFiles; -+ for (size_t i = 0; i < paths->length(); ++i) { -+ fileChooserFiles.append(FileChooserFileInfo { paths->get(i)->asString(), nullString(), { } }); -+ } -+ directoryFileListCreator->start(m_document.get(), fileChooserFiles); -+ } else { -+ for (unsigned i = 0; i < paths->length(); ++i) { -+ RefPtr item = paths->get(i); -+ String path = item->asString(); -+ if (path.isEmpty()) { -+ callback->sendFailure("Invalid file path"_s); -+ return; -+ } -+ -+ ScriptExecutionContext* context = element->scriptExecutionContext(); -+ fileObjects.append(File::create(context, path)); -+ } -+ RefPtr fileList = FileList::create(WTFMove(fileObjects)); -+ element->setFiles(WTFMove(fileList)); -+ callback->sendSuccess(); -+ } + } +} + } // namespace WebCore diff --git a/Source/WebCore/inspector/agents/InspectorDOMAgent.h b/Source/WebCore/inspector/agents/InspectorDOMAgent.h -index 0d1406e0a1d061e2336bbd49c56328ce93351f14..4187fb453adebfd98f91ebbf99e38a072ef8942b 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 { @@ -3840,7 +3754,7 @@ index 0d1406e0a1d061e2336bbd49c56328ce93351f14..4187fb453adebfd98f91ebbf99e38a07 class DOMEditor; class Document; class Element; -@@ -94,6 +95,7 @@ public: +@@ -95,6 +96,7 @@ public: static String toErrorString(Exception&&); static String documentURLString(Document*); @@ -3848,7 +3762,7 @@ index 0d1406e0a1d061e2336bbd49c56328ce93351f14..4187fb453adebfd98f91ebbf99e38a07 // 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. -@@ -137,7 +139,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); @@ -3857,18 +3771,18 @@ index 0d1406e0a1d061e2336bbd49c56328ce93351f14..4187fb453adebfd98f91ebbf99e38a07 Inspector::Protocol::ErrorStringOr>> getAttributes(Inspector::Protocol::DOM::NodeId); #if PLATFORM(IOS_FAMILY) Inspector::Protocol::ErrorStringOr setInspectModeEnabled(bool, RefPtr&& highlightConfig, RefPtr&& gridOverlayConfig, RefPtr&& flexOverlayConfig); -@@ -174,6 +176,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); + Inspector::Protocol::ErrorStringOr> describeNode(const String& objectId); + Inspector::Protocol::ErrorStringOr scrollIntoViewIfNeeded(const String& objectId, RefPtr&& rect); + Inspector::Protocol::ErrorStringOr>> getContentQuads(const String& objectId); -+ void setInputFiles(const String& objectId, RefPtr&& files, RefPtr&& paths, Ref&& callback); ++ void setInputFiles(const String& objectId, Ref&& paths, Ref&& callback); // InspectorInstrumentation Inspector::Protocol::DOM::NodeId identifierForNode(Node&); -@@ -215,7 +221,7 @@ public: +@@ -218,7 +224,7 @@ public: Node* nodeForId(Inspector::Protocol::DOM::NodeId); Inspector::Protocol::DOM::NodeId boundNodeId(const Node*); @@ -3877,7 +3791,7 @@ index 0d1406e0a1d061e2336bbd49c56328ce93351f14..4187fb453adebfd98f91ebbf99e38a07 bool handleMousePress(); void mouseDidMoveOverElement(const HitTestResult&, OptionSet); void inspect(Node*); -@@ -227,12 +233,15 @@ public: +@@ -230,12 +236,15 @@ public: void reset(); Node* assertNode(Inspector::Protocol::ErrorString&, Inspector::Protocol::DOM::NodeId); @@ -3893,7 +3807,7 @@ index 0d1406e0a1d061e2336bbd49c56328ce93351f14..4187fb453adebfd98f91ebbf99e38a07 private: #if ENABLE(VIDEO) void mediaMetricsTimerFired(); -@@ -262,7 +271,6 @@ private: +@@ -265,7 +274,6 @@ private: void processAccessibilityChildren(AXCoreObject&, JSON::ArrayOf&); Node* nodeForPath(const String& path); @@ -3902,18 +3816,18 @@ index 0d1406e0a1d061e2336bbd49c56328ce93351f14..4187fb453adebfd98f91ebbf99e38a07 void discardBindings(); diff --git a/Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp b/Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp -index 6db0a3c6a46a4be5cb6f9f0e6fcbc61ac552e438..cae87102e8228cb944cec4a6ebe83b7d3a0e29bc 100644 +index f3a0bdf189aed455ceb84f4023c2dbfda8e5dc16..25d54fc33be2ccd42565cb7ddf879344ab8aa3f2 100644 --- a/Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp +++ b/Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp -@@ -59,6 +59,7 @@ +@@ -58,6 +58,7 @@ + #include "LocalFrame.h" #include "MIMETypeRegistry.h" #include "MemoryCache.h" - #include "NetworkResourcesData.h" +#include "NetworkStateNotifier.h" #include "Page.h" #include "PlatformStrategies.h" #include "ProgressTracker.h" -@@ -345,8 +346,8 @@ static Ref buildObjectForResourceRequest( +@@ -344,8 +345,8 @@ static Ref buildObjectForResourceRequest( .release(); if (request.httpBody() && !request.httpBody()->isEmpty()) { @@ -3924,7 +3838,7 @@ index 6db0a3c6a46a4be5cb6f9f0e6fcbc61ac552e438..cae87102e8228cb944cec4a6ebe83b7d } if (resourceLoader) { -@@ -399,6 +400,8 @@ RefPtr InspectorNetworkAgent::buildObjec +@@ -398,6 +399,8 @@ RefPtr InspectorNetworkAgent::buildObjec .setSource(responseSource(response.source())) .release(); @@ -3933,7 +3847,7 @@ index 6db0a3c6a46a4be5cb6f9f0e6fcbc61ac552e438..cae87102e8228cb944cec4a6ebe83b7d if (resourceLoader) { auto* metrics = response.deprecatedNetworkLoadMetricsOrNull(); responseObject->setTiming(buildObjectForTiming(metrics ? *metrics : NetworkLoadMetrics::emptyMetrics(), *resourceLoader)); -@@ -685,6 +688,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) { @@ -3943,7 +3857,7 @@ index 6db0a3c6a46a4be5cb6f9f0e6fcbc61ac552e438..cae87102e8228cb944cec4a6ebe83b7d auto* frame = loader->frame(); if (frame && frame->loader().documentLoader() && frame->document()) { m_resourcesData->addResourceSharedBuffer(requestId, -@@ -914,6 +920,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(); @@ -3951,7 +3865,7 @@ index 6db0a3c6a46a4be5cb6f9f0e6fcbc61ac552e438..cae87102e8228cb944cec4a6ebe83b7d continuePendingRequests(); continuePendingResponses(); -@@ -966,6 +973,7 @@ void InspectorNetworkAgent::continuePendingResponses() +@@ -958,6 +965,7 @@ void InspectorNetworkAgent::continuePendingResponses() Inspector::Protocol::ErrorStringOr InspectorNetworkAgent::setExtraHTTPHeaders(Ref&& headers) { @@ -3959,7 +3873,7 @@ index 6db0a3c6a46a4be5cb6f9f0e6fcbc61ac552e438..cae87102e8228cb944cec4a6ebe83b7d for (auto& entry : headers.get()) { auto stringValue = entry.value->asString(); if (!!stringValue) -@@ -1215,6 +1223,11 @@ void InspectorNetworkAgent::interceptResponse(const ResourceResponse& response, +@@ -1207,6 +1215,11 @@ void InspectorNetworkAgent::interceptResponse(const ResourceResponse& response, m_frontendDispatcher->responseIntercepted(requestId, resourceResponse.releaseNonNull()); } @@ -3971,7 +3885,7 @@ index 6db0a3c6a46a4be5cb6f9f0e6fcbc61ac552e438..cae87102e8228cb944cec4a6ebe83b7d Inspector::Protocol::ErrorStringOr InspectorNetworkAgent::interceptContinue(const Inspector::Protocol::Network::RequestId& requestId, Inspector::Protocol::Network::NetworkStage networkStage) { switch (networkStage) { -@@ -1244,6 +1257,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; @@ -3981,7 +3895,7 @@ index 6db0a3c6a46a4be5cb6f9f0e6fcbc61ac552e438..cae87102e8228cb944cec4a6ebe83b7d ResourceRequest request = loader.request(); if (!!url) request.setURL(URL({ }, url)); -@@ -1339,14 +1355,23 @@ Inspector::Protocol::ErrorStringOr InspectorNetworkAgent::interceptRequest +@@ -1331,13 +1347,22 @@ Inspector::Protocol::ErrorStringOr InspectorNetworkAgent::interceptRequest response.setHTTPStatusCode(status); response.setHTTPStatusText(String { statusText }); HTTPHeaderMap explicitHeaders; @@ -3997,17 +3911,15 @@ index 6db0a3c6a46a4be5cb6f9f0e6fcbc61ac552e438..cae87102e8228cb944cec4a6ebe83b7d } 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; - -@@ -1409,6 +1434,12 @@ Inspector::Protocol::ErrorStringOr InspectorNetworkAgent::setEmulatedCondi +@@ -1401,6 +1426,12 @@ Inspector::Protocol::ErrorStringOr InspectorNetworkAgent::setEmulatedCondi #endif // ENABLE(INSPECTOR_NETWORK_THROTTLING) @@ -4021,19 +3933,19 @@ index 6db0a3c6a46a4be5cb6f9f0e6fcbc61ac552e438..cae87102e8228cb944cec4a6ebe83b7d { return startsWithLettersIgnoringASCIICase(mimeType, "text/"_s) diff --git a/Source/WebCore/inspector/agents/InspectorNetworkAgent.h b/Source/WebCore/inspector/agents/InspectorNetworkAgent.h -index eda400879afb10b687fcbb317c9fdbb3be9c94cd..f3a382c44b53e6b1507fc046e22bff684abd55f9 100644 +index de6b2dd844943074c5a383c7b9b8ccba1c96419a..7a3404f2380b5e62f1c0523a70f8ef442014759d 100644 --- a/Source/WebCore/inspector/agents/InspectorNetworkAgent.h +++ b/Source/WebCore/inspector/agents/InspectorNetworkAgent.h -@@ -34,6 +34,8 @@ - #include "InspectorInstrumentation.h" +@@ -35,6 +35,8 @@ #include "InspectorPageAgent.h" #include "InspectorWebAgentBase.h" + #include "NetworkResourcesData.h" +#include "ResourceError.h" +#include "SharedBuffer.h" #include "WebSocket.h" + #include #include - #include -@@ -102,6 +104,7 @@ public: +@@ -104,6 +106,7 @@ public: #if ENABLE(INSPECTOR_NETWORK_THROTTLING) Inspector::Protocol::ErrorStringOr setEmulatedConditions(std::optional&& bytesPerSecondLimit) final; #endif @@ -4041,7 +3953,7 @@ index eda400879afb10b687fcbb317c9fdbb3be9c94cd..f3a382c44b53e6b1507fc046e22bff68 // InspectorInstrumentation void willRecalculateStyle(); -@@ -133,6 +136,7 @@ public: +@@ -135,6 +138,7 @@ public: bool shouldInterceptResponse(const ResourceResponse&); void interceptResponse(const ResourceResponse&, ResourceLoaderIdentifier, CompletionHandler)>&&); void interceptRequest(ResourceLoader&, Function&&); @@ -4049,7 +3961,7 @@ index eda400879afb10b687fcbb317c9fdbb3be9c94cd..f3a382c44b53e6b1507fc046e22bff68 void searchOtherRequests(const JSC::Yarr::RegularExpression&, Ref>&); void searchInRequest(Inspector::Protocol::ErrorString&, const Inspector::Protocol::Network::RequestId&, const String& query, bool caseSensitive, bool isRegex, RefPtr>&); -@@ -259,6 +263,7 @@ private: +@@ -275,6 +279,7 @@ private: bool m_enabled { false }; bool m_loadingXHRSynchronously { false }; bool m_interceptionEnabled { false }; @@ -4058,7 +3970,7 @@ index eda400879afb10b687fcbb317c9fdbb3be9c94cd..f3a382c44b53e6b1507fc046e22bff68 } // namespace WebCore diff --git a/Source/WebCore/inspector/agents/InspectorPageAgent.cpp b/Source/WebCore/inspector/agents/InspectorPageAgent.cpp -index 322ae350279461c5c213a760444580421cb89682..6fc187ab25a6c76c41880fdf63acda1f9bb132cc 100644 +index cc649f41559f905102d7a8785190f3157d3e6dea..ee7fee8a4ac224d27dd40d04be0803ff89720232 100644 --- a/Source/WebCore/inspector/agents/InspectorPageAgent.cpp +++ b/Source/WebCore/inspector/agents/InspectorPageAgent.cpp @@ -32,19 +32,27 @@ @@ -4095,7 +4007,7 @@ index 322ae350279461c5c213a760444580421cb89682..6fc187ab25a6c76c41880fdf63acda1f #include "Page.h" +#include "PageRuntimeAgent.h" +#include "PlatformScreen.h" - #include "RenderObject.h" + #include "RenderObjectInlines.h" #include "RenderTheme.h" +#include "DeprecatedGlobalSettings.h" +#include "SimpleRange.h" @@ -4272,7 +4184,7 @@ index 322ae350279461c5c213a760444580421cb89682..6fc187ab25a6c76c41880fdf63acda1f case Inspector::Protocol::Page::Setting::WebSecurityEnabled: inspectedPageSettings.setWebSecurityEnabledInspectorOverride(value); return { }; -@@ -919,15 +1023,16 @@ Inspector::Protocol::ErrorStringOr InspectorPageAgent::setShowPaintRects(b +@@ -920,15 +1024,16 @@ Inspector::Protocol::ErrorStringOr InspectorPageAgent::setShowPaintRects(b return { }; } @@ -4294,33 +4206,24 @@ index 322ae350279461c5c213a760444580421cb89682..6fc187ab25a6c76c41880fdf63acda1f } void InspectorPageAgent::frameNavigated(LocalFrame& frame) -@@ -935,13 +1040,38 @@ void InspectorPageAgent::frameNavigated(LocalFrame& frame) +@@ -936,13 +1041,29 @@ void InspectorPageAgent::frameNavigated(LocalFrame& frame) m_frontendDispatcher->frameNavigated(buildObjectForFrame(&frame)); } +String InspectorPageAgent::serializeFrameID(FrameIdentifier frameID) +{ -+ return makeString(frameID.processIdentifier().toUInt64(), '.', frameID.object().toUInt64()); ++ return makeString(frameID.toUInt64()); +} + +std::optional InspectorPageAgent::parseFrameID(String frameID) +{ -+ size_t dotPos = frameID.find("."_s); -+ if (dotPos == notFound) -+ return std::nullopt; -+ + if (!frameID.containsOnlyASCII()) + return std::nullopt; + -+ String processIDString = frameID.left(dotPos); -+ uint64_t pid = strtoull(processIDString.ascii().data(), 0, 10); -+ auto processID = ObjectIdentifier(pid); -+ String frameIDString = frameID.substring(dotPos + 1); -+ uint64_t frameIDNumber = strtoull(frameIDString.ascii().data(), 0, 10); -+ return WebCore::FrameIdentifier { -+ ObjectIdentifier(frameIDNumber), -+ processID -+ }; ++WTF_ALLOW_UNSAFE_BUFFER_USAGE_BEGIN ++ uint64_t frameIDNumber = strtoull(frameID.ascii().data(), 0, 10); ++WTF_ALLOW_UNSAFE_BUFFER_USAGE_END ++ return WebCore::FrameIdentifier(frameIDNumber); +} + void InspectorPageAgent::frameDetached(LocalFrame& frame) @@ -4336,7 +4239,7 @@ index 322ae350279461c5c213a760444580421cb89682..6fc187ab25a6c76c41880fdf63acda1f } Frame* InspectorPageAgent::frameForId(const Inspector::Protocol::Network::FrameId& frameId) -@@ -953,20 +1083,21 @@ String InspectorPageAgent::frameId(Frame* frame) +@@ -954,20 +1075,21 @@ String InspectorPageAgent::frameId(Frame* frame) { if (!frame) return emptyString(); @@ -4366,7 +4269,7 @@ index 322ae350279461c5c213a760444580421cb89682..6fc187ab25a6c76c41880fdf63acda1f } LocalFrame* InspectorPageAgent::assertFrame(Inspector::Protocol::ErrorString& errorString, const Inspector::Protocol::Network::FrameId& frameId) -@@ -977,11 +1108,6 @@ LocalFrame* InspectorPageAgent::assertFrame(Inspector::Protocol::ErrorString& er +@@ -978,11 +1100,6 @@ LocalFrame* InspectorPageAgent::assertFrame(Inspector::Protocol::ErrorString& er return frame; } @@ -4378,7 +4281,7 @@ index 322ae350279461c5c213a760444580421cb89682..6fc187ab25a6c76c41880fdf63acda1f void InspectorPageAgent::frameStartedLoading(LocalFrame& frame) { m_frontendDispatcher->frameStartedLoading(frameId(&frame)); -@@ -992,9 +1118,9 @@ void InspectorPageAgent::frameStoppedLoading(LocalFrame& frame) +@@ -993,9 +1110,9 @@ void InspectorPageAgent::frameStoppedLoading(LocalFrame& frame) m_frontendDispatcher->frameStoppedLoading(frameId(&frame)); } @@ -4390,7 +4293,7 @@ index 322ae350279461c5c213a760444580421cb89682..6fc187ab25a6c76c41880fdf63acda1f } void InspectorPageAgent::frameClearedScheduledNavigation(Frame& frame) -@@ -1041,6 +1167,12 @@ void InspectorPageAgent::defaultUserPreferencesDidChange() +@@ -1042,6 +1159,12 @@ void InspectorPageAgent::defaultUserPreferencesDidChange() m_frontendDispatcher->defaultUserPreferencesDidChange(WTFMove(defaultUserPreferences)); } @@ -4403,7 +4306,7 @@ index 322ae350279461c5c213a760444580421cb89682..6fc187ab25a6c76c41880fdf63acda1f #if ENABLE(DARK_MODE_CSS) void InspectorPageAgent::defaultAppearanceDidChange() { -@@ -1054,6 +1186,9 @@ void InspectorPageAgent::didClearWindowObjectInWorld(LocalFrame& frame, DOMWrapp +@@ -1055,6 +1178,9 @@ void InspectorPageAgent::didClearWindowObjectInWorld(LocalFrame& frame, DOMWrapp return; if (m_bootstrapScript.isEmpty()) @@ -4413,7 +4316,7 @@ index 322ae350279461c5c213a760444580421cb89682..6fc187ab25a6c76c41880fdf63acda1f return; frame.script().evaluateIgnoringException(ScriptSourceCode(m_bootstrapScript, JSC::SourceTaintedOrigin::Untainted, URL { "web-inspector://bootstrap.js"_str })); -@@ -1101,6 +1236,51 @@ void InspectorPageAgent::didRecalculateStyle() +@@ -1102,6 +1228,51 @@ void InspectorPageAgent::didRecalculateStyle() protectedOverlay()->update(); } @@ -4465,7 +4368,7 @@ index 322ae350279461c5c213a760444580421cb89682..6fc187ab25a6c76c41880fdf63acda1f Ref InspectorPageAgent::buildObjectForFrame(LocalFrame* frame) { ASSERT_ARG(frame, frame); -@@ -1194,6 +1374,12 @@ void InspectorPageAgent::applyUserAgentOverride(String& userAgent) +@@ -1195,6 +1366,12 @@ void InspectorPageAgent::applyUserAgentOverride(String& userAgent) userAgent = m_userAgentOverride; } @@ -4478,7 +4381,7 @@ index 322ae350279461c5c213a760444580421cb89682..6fc187ab25a6c76c41880fdf63acda1f void InspectorPageAgent::applyEmulatedMedia(AtomString& media) { if (!m_emulatedMedia.isEmpty()) -@@ -1221,11 +1407,13 @@ Inspector::Protocol::ErrorStringOr InspectorPageAgent::snapshotNode(Insp +@@ -1222,11 +1399,13 @@ Inspector::Protocol::ErrorStringOr InspectorPageAgent::snapshotNode(Insp return snapshot->toDataURL("image/png"_s, std::nullopt, PreserveResolution::Yes); } @@ -4493,7 +4396,7 @@ index 322ae350279461c5c213a760444580421cb89682..6fc187ab25a6c76c41880fdf63acda1f IntRect rectangle(x, y, width, height); RefPtr localMainFrame = m_inspectedPage->localMainFrame(); -@@ -1239,6 +1427,43 @@ Inspector::Protocol::ErrorStringOr InspectorPageAgent::snapshotRect(int +@@ -1240,6 +1419,43 @@ Inspector::Protocol::ErrorStringOr InspectorPageAgent::snapshotRect(int return snapshot->toDataURL("image/png"_s, std::nullopt, PreserveResolution::Yes); } @@ -4537,7 +4440,7 @@ index 322ae350279461c5c213a760444580421cb89682..6fc187ab25a6c76c41880fdf63acda1f #if ENABLE(WEB_ARCHIVE) && USE(CF) Inspector::Protocol::ErrorStringOr InspectorPageAgent::archive() { -@@ -1255,7 +1480,6 @@ Inspector::Protocol::ErrorStringOr InspectorPageAgent::archive() +@@ -1256,7 +1472,6 @@ Inspector::Protocol::ErrorStringOr InspectorPageAgent::archive() } #endif @@ -4545,7 +4448,7 @@ index 322ae350279461c5c213a760444580421cb89682..6fc187ab25a6c76c41880fdf63acda1f Inspector::Protocol::ErrorStringOr InspectorPageAgent::setScreenSizeOverride(std::optional&& width, std::optional&& height) { if (width.has_value() != height.has_value()) -@@ -1273,6 +1497,498 @@ Inspector::Protocol::ErrorStringOr InspectorPageAgent::setScreenSizeOverri +@@ -1274,6 +1489,496 @@ Inspector::Protocol::ErrorStringOr InspectorPageAgent::setScreenSizeOverri localMainFrame->setOverrideScreenSize(FloatSize(width.value_or(0), height.value_or(0))); return { }; } @@ -4676,8 +4579,6 @@ index 322ae350279461c5c213a760444580421cb89682..6fc187ab25a6c76c41880fdf63acda1f + return "Image"_s; + case AccessibilityRole::ImageMap: + return "ImageMap"_s; -+ case AccessibilityRole::ImageMapLink: -+ return "ImageMapLink"_s; + case AccessibilityRole::Insertion: + return "Insertion"_s; + case AccessibilityRole::Label: @@ -5384,10 +5285,10 @@ 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 858e5866d005b40ce61b79c607c4e5530f23f582..ec3d856897d821aeb4ba8616598932b19b1bcf3f 100644 +index 541963eb00a1e5700da683be152543ac57f177a1..bd0debb9cdf2fac02bcf0243571a4a668be9decc 100644 --- a/Source/WebCore/loader/DocumentLoader.cpp +++ b/Source/WebCore/loader/DocumentLoader.cpp -@@ -773,8 +773,10 @@ void DocumentLoader::willSendRequest(ResourceRequest&& newRequest, const Resourc +@@ -774,8 +774,10 @@ void DocumentLoader::willSendRequest(ResourceRequest&& newRequest, const Resourc if (!didReceiveRedirectResponse) return completionHandler(WTFMove(newRequest)); @@ -5398,7 +5299,7 @@ index 858e5866d005b40ce61b79c607c4e5530f23f582..ec3d856897d821aeb4ba8616598932b1 switch (navigationPolicyDecision) { case NavigationPolicyDecision::IgnoreLoad: case NavigationPolicyDecision::LoadWillContinueInAnotherProcess: -@@ -1573,11 +1575,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); @@ -5419,10 +5320,10 @@ index 858e5866d005b40ce61b79c607c4e5530f23f582..ec3d856897d821aeb4ba8616598932b1 { m_navigationID = navigationID; diff --git a/Source/WebCore/loader/DocumentLoader.h b/Source/WebCore/loader/DocumentLoader.h -index 564f944a63868ced85f3c412a4df6dce8d257929..b2228742433ef7f478c20328e62e159d6a051b10 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); @@ -5432,10 +5333,10 @@ index 564f944a63868ced85f3c412a4df6dce8d257929..b2228742433ef7f478c20328e62e159d 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 7073bb8cdc33fcffd7864505cc9dbeb96202e140..d7bf4bb0695d20eb8e479a703a331ba345fb213b 100644 +index 0974e98f02b59150df7054af753a3c3bb1d3b0e9..559a8532162d4c9e106c1059dfbf50fc63ee9326 100644 --- a/Source/WebCore/loader/FrameLoader.cpp +++ b/Source/WebCore/loader/FrameLoader.cpp -@@ -1319,6 +1319,7 @@ void FrameLoader::loadInSameDocument(URL url, RefPtr stat +@@ -1325,6 +1325,7 @@ void FrameLoader::loadInSameDocument(URL url, RefPtr stat } m_client->dispatchDidNavigateWithinPage(); @@ -5443,7 +5344,7 @@ index 7073bb8cdc33fcffd7864505cc9dbeb96202e140..d7bf4bb0695d20eb8e479a703a331ba3 document->statePopped(stateObject ? stateObject.releaseNonNull() : SerializedScriptValue::nullValue()); m_client->dispatchDidPopStateWithinPage(); -@@ -1850,6 +1851,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)) { @@ -5451,23 +5352,23 @@ index 7073bb8cdc33fcffd7864505cc9dbeb96202e140..d7bf4bb0695d20eb8e479a703a331ba3 RefPtr oldDocumentLoader = m_documentLoader; NavigationAction action { frame->protectedDocument().releaseNonNull(), loader->request(), InitiatedByMainFrame::Unknown, loader->isRequestFromClientOrUserInput(), policyChecker().loadType(), isFormSubmission }; -@@ -1887,7 +1889,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()); + InspectorInstrumentation::willCheckNavigationPolicy(m_frame); - policyChecker().checkNavigationPolicy(ResourceRequest(loader->request()), ResourceResponse { } /* redirectResponse */, loader, WTFMove(formState), [this, frame, allowNavigationToInvalidURL, completionHandler = completionHandlerCaller.release()] (const ResourceRequest& request, WeakPtr&& weakFormState, NavigationPolicyDecision navigationPolicyDecision) mutable { + policyChecker().checkNavigationPolicy(ResourceRequest(loader->request()), ResourceResponse { } /* redirectResponse */, loader, WTFMove(formState), [this, protectedThis = Ref { *this }, allowNavigationToInvalidURL, completionHandler = completionHandlerCaller.release()] (const ResourceRequest& request, WeakPtr&& weakFormState, NavigationPolicyDecision navigationPolicyDecision) mutable { + InspectorInstrumentation::didCheckNavigationPolicy(m_frame, navigationPolicyDecision != NavigationPolicyDecision::ContinueLoad); continueLoadAfterNavigationPolicy(request, RefPtr { weakFormState.get() }.get(), navigationPolicyDecision, allowNavigationToInvalidURL); completionHandler(); }, policyDecisionMode); -@@ -3178,10 +3182,15 @@ String FrameLoader::userAgent(const URL& url) const +@@ -3219,10 +3223,15 @@ String FrameLoader::userAgent(const URL& url) const String FrameLoader::navigatorPlatform() const { + String platform; + - auto customNavigatorPlatform = m_frame->mainFrame().customNavigatorPlatform(); + auto customNavigatorPlatform = m_frame->protectedMainFrame()->customNavigatorPlatform(); if (!customNavigatorPlatform.isEmpty()) - return customNavigatorPlatform; - return String(); @@ -5479,7 +5380,7 @@ index 7073bb8cdc33fcffd7864505cc9dbeb96202e140..d7bf4bb0695d20eb8e479a703a331ba3 } void FrameLoader::dispatchOnloadEvents() -@@ -3638,6 +3647,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); @@ -5488,7 +5389,7 @@ index 7073bb8cdc33fcffd7864505cc9dbeb96202e140..d7bf4bb0695d20eb8e479a703a331ba3 } void FrameLoader::continueFragmentScrollAfterNavigationPolicy(const ResourceRequest& request, const SecurityOrigin* requesterOrigin, bool shouldContinue, NavigationHistoryBehavior historyHandling) -@@ -4522,9 +4533,6 @@ String FrameLoader::referrer() const +@@ -4576,9 +4587,6 @@ String FrameLoader::referrer() const void FrameLoader::dispatchDidClearWindowObjectsInAllWorlds() { @@ -5498,11 +5399,11 @@ index 7073bb8cdc33fcffd7864505cc9dbeb96202e140..d7bf4bb0695d20eb8e479a703a331ba3 Vector> worlds; ScriptController::getAllWorlds(worlds); for (auto& world : worlds) -@@ -4534,13 +4542,12 @@ void FrameLoader::dispatchDidClearWindowObjectsInAllWorlds() +@@ -4588,13 +4596,12 @@ void FrameLoader::dispatchDidClearWindowObjectsInAllWorlds() void FrameLoader::dispatchDidClearWindowObjectInWorld(DOMWrapperWorld& world) { Ref frame = m_frame.get(); -- if (!frame->checkedScript()->canExecuteScripts(ReasonForCallingCanExecuteScripts::NotAboutToExecuteScript) || !frame->windowProxy().existingJSWindowProxy(world)) +- if (!frame->checkedScript()->canExecuteScripts(ReasonForCallingCanExecuteScripts::NotAboutToExecuteScript) || !frame->protectedWindowProxy()->existingJSWindowProxy(world)) - return; - - m_client->dispatchDidClearWindowObjectInWorld(world); @@ -5531,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() @@ -5544,7 +5445,7 @@ index 5f70f737d06ced029e3b86a4dc93fd49e8ff4cae..15e6c42cbd4733b526493c3c7dfbea62 } diff --git a/Source/WebCore/loader/ProgressTracker.cpp b/Source/WebCore/loader/ProgressTracker.cpp -index 171c80cd90bdc8cc16c5e037b25f07faef0dec4e..0869f1be1699dd1548a2e4df6612d7fff42e3093 100644 +index a1554c16a0b836bcf87fea0f4e7831d9e0d7baf0..354e4fef6de9c77b7cad96cc428056ae4e2ff067 100644 --- a/Source/WebCore/loader/ProgressTracker.cpp +++ b/Source/WebCore/loader/ProgressTracker.cpp @@ -163,6 +163,8 @@ void ProgressTracker::progressCompleted(LocalFrame& frame) @@ -5566,10 +5467,10 @@ index 171c80cd90bdc8cc16c5e037b25f07faef0dec4e..0869f1be1699dd1548a2e4df6612d7ff } diff --git a/Source/WebCore/loader/cache/CachedResourceLoader.cpp b/Source/WebCore/loader/cache/CachedResourceLoader.cpp -index 6fc201b47f8bb970faba58fa195cc2964b42e45c..f77592b2664d435e00bcf83820e4e8ccb110aeb6 100644 +index c6a8c86e12ba98ad8b9aab74430523c3dd8cb42e..61c73db33d4c629803d14f243862acea15e762cb 100644 --- a/Source/WebCore/loader/cache/CachedResourceLoader.cpp +++ b/Source/WebCore/loader/cache/CachedResourceLoader.cpp -@@ -1166,8 +1166,11 @@ ResourceErrorOr> CachedResourceLoader::requ +@@ -1173,8 +1173,11 @@ ResourceErrorOr> CachedResourceLoader::requ request.updateReferrerPolicy(document ? document->referrerPolicy() : ReferrerPolicy::Default); @@ -5583,7 +5484,7 @@ index 6fc201b47f8bb970faba58fa195cc2964b42e45c..f77592b2664d435e00bcf83820e4e8cc if (RefPtr documentLoader = m_documentLoader.get()) { bool madeHTTPS { request.resourceRequest().wasSchemeOptimisticallyUpgraded() }; -@@ -1801,8 +1804,9 @@ Vector> CachedResourceLoader::allCachedSVGImages() const +@@ -1810,8 +1813,9 @@ Vector> CachedResourceLoader::allCachedSVGImages() const ResourceErrorOr> CachedResourceLoader::preload(CachedResource::Type type, CachedResourceRequest&& request) { @@ -5596,10 +5497,10 @@ index 6fc201b47f8bb970faba58fa195cc2964b42e45c..f77592b2664d435e00bcf83820e4e8cc RefPtr document = m_document.get(); ASSERT(document); diff --git a/Source/WebCore/page/ChromeClient.h b/Source/WebCore/page/ChromeClient.h -index 5352cc44f68f9038f7bd64214853fae160f9ba9d..76a9c273cd758af99c2ed4645876b594c55b0ea1 100644 +index 60ba4d0aaa365301aa80d144f2d07e842a71a6b8..a962ce78e3ad912886a9d3328d64cf0faec3177d 100644 --- a/Source/WebCore/page/ChromeClient.h +++ b/Source/WebCore/page/ChromeClient.h -@@ -362,7 +362,7 @@ public: +@@ -379,7 +379,7 @@ public: #endif #if ENABLE(ORIENTATION_EVENTS) @@ -5609,10 +5510,10 @@ index 5352cc44f68f9038f7bd64214853fae160f9ba9d..76a9c273cd758af99c2ed4645876b594 virtual RefPtr createColorChooser(ColorChooserClient&, const Color&) = 0; diff --git a/Source/WebCore/page/EventHandler.cpp b/Source/WebCore/page/EventHandler.cpp -index 408ddc7c6541d80568d126ea5ecdb17caf7b10d3..d588b0c5003f8e39cb03cbf28258b7657d86a04f 100644 +index 04fce4219bdfc1c4a78eb2d849045280416b6f2d..9e44a302b10ba3bc18496f5678262171e8b30b2c 100644 --- a/Source/WebCore/page/EventHandler.cpp +++ b/Source/WebCore/page/EventHandler.cpp -@@ -4462,6 +4462,12 @@ bool EventHandler::handleDrag(const MouseEventWithHitTestResults& event, CheckDr +@@ -4483,6 +4483,12 @@ bool EventHandler::handleDrag(const MouseEventWithHitTestResults& event, CheckDr if (!document) return false; @@ -5625,15 +5526,15 @@ index 408ddc7c6541d80568d126ea5ecdb17caf7b10d3..d588b0c5003f8e39cb03cbf28258b765 dragState().dataTransfer = DataTransfer::createForDrag(*document); auto hasNonDefaultPasteboardData = HasNonDefaultPasteboardData::No; -@@ -5053,6 +5059,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(); -@@ -5126,7 +5133,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; @@ -5642,7 +5543,7 @@ index 408ddc7c6541d80568d126ea5ecdb17caf7b10d3..d588b0c5003f8e39cb03cbf28258b765 bool pointerCancelled = false; #endif RefPtr touchTarget; -@@ -5173,7 +5180,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); @@ -5651,7 +5552,7 @@ index 408ddc7c6541d80568d126ea5ecdb17caf7b10d3..d588b0c5003f8e39cb03cbf28258b765 HitTestResult result = hitTestResultAtPoint(pagePoint, hitType | HitTestRequest::Type::AllowChildFrameContent); pointerTarget = result.targetElement(); pointerCancelled = (pointerTarget != touchTarget); -@@ -5196,7 +5203,7 @@ HandleUserInputEventResult EventHandler::handleTouchEvent(const PlatformTouchEve +@@ -5220,7 +5227,7 @@ Expected EventHandler::handleTouchEvent(co if (!targetFrame) continue; @@ -5660,7 +5561,7 @@ index 408ddc7c6541d80568d126ea5ecdb17caf7b10d3..d588b0c5003f8e39cb03cbf28258b765 // 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) { -@@ -5286,6 +5293,7 @@ HandleUserInputEventResult EventHandler::handleTouchEvent(const PlatformTouchEve +@@ -5310,6 +5317,7 @@ Expected EventHandler::handleTouchEvent(co return swallowedEvent; } @@ -5669,10 +5570,10 @@ index 408ddc7c6541d80568d126ea5ecdb17caf7b10d3..d588b0c5003f8e39cb03cbf28258b765 #if ENABLE(TOUCH_EVENTS) diff --git a/Source/WebCore/page/FocusController.cpp b/Source/WebCore/page/FocusController.cpp -index 676ca3ed5df66159852331a1373cdef66295fd3f..ed0dbb2445822df19e3d013e1ebe2cbaaa8d20eb 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(); @@ -5690,10 +5591,10 @@ index 676ca3ed5df66159852331a1373cdef66295fd3f..ed0dbb2445822df19e3d013e1ebe2cba } diff --git a/Source/WebCore/page/FrameSnapshotting.cpp b/Source/WebCore/page/FrameSnapshotting.cpp -index 0c099f95827d6f9fe307704ef9d7754fbb3d24f7..8e36dd7dca078f2de0c1733c8d462d17b2a3d5c4 100644 +index 3474800864049dcbe6c84746c4216e72a68fa48f..8f5d536921eeb41c77fe689c036dcb77e625e431 100644 --- a/Source/WebCore/page/FrameSnapshotting.cpp +++ b/Source/WebCore/page/FrameSnapshotting.cpp -@@ -111,7 +111,7 @@ RefPtr snapshotFrameRectWithClip(LocalFrame& frame, const IntRect& +@@ -115,7 +115,7 @@ RefPtr snapshotFrameRectWithClip(LocalFrame& frame, const IntRect& // Other paint behaviors are set by paintContentsForSnapshot. frame.view()->setPaintBehavior(paintBehavior); @@ -5702,7 +5603,7 @@ index 0c099f95827d6f9fe307704ef9d7754fbb3d24f7..8e36dd7dca078f2de0c1733c8d462d17 if (options.flags.contains(SnapshotFlags::PaintWith3xBaseScale)) scaleFactor = 3; -@@ -130,6 +130,8 @@ RefPtr snapshotFrameRectWithClip(LocalFrame& frame, const IntRect& +@@ -134,6 +134,8 @@ RefPtr snapshotFrameRectWithClip(LocalFrame& frame, const IntRect& return nullptr; buffer->context().translate(-imageRect.location()); @@ -5711,7 +5612,7 @@ index 0c099f95827d6f9fe307704ef9d7754fbb3d24f7..8e36dd7dca078f2de0c1733c8d462d17 if (!clipRects.isEmpty()) { Path clipPath; -@@ -138,7 +140,10 @@ RefPtr snapshotFrameRectWithClip(LocalFrame& frame, const IntRect& +@@ -142,7 +144,10 @@ RefPtr snapshotFrameRectWithClip(LocalFrame& frame, const IntRect& buffer->context().clipPath(clipPath); } @@ -5724,14 +5625,14 @@ index 0c099f95827d6f9fe307704ef9d7754fbb3d24f7..8e36dd7dca078f2de0c1733c8d462d17 } diff --git a/Source/WebCore/page/FrameSnapshotting.h b/Source/WebCore/page/FrameSnapshotting.h -index 3ab70c27fef52f5d933cd2338a7c2f96e2debc88..39fc13df5ce132f8d028cd5039c607fe8963ddcf 100644 +index 713cb9c3c59bbad23ef0b821ab27b3d669a7dea8..12077ebf0978b6b52e6af4602767c09d9f3cd9de 100644 --- a/Source/WebCore/page/FrameSnapshotting.h +++ b/Source/WebCore/page/FrameSnapshotting.h -@@ -56,6 +56,7 @@ enum class SnapshotFlags : uint16_t { - Accelerated = 1 << 8, - ExcludeReplacedContent = 1 << 9, - PaintWith3xBaseScale = 1 << 10, -+ OmitDeviceScaleFactor = 1 << 11, +@@ -58,6 +58,7 @@ enum class SnapshotFlags : uint16_t { + PaintWith3xBaseScale = 1 << 10, + ExcludeText = 1 << 11, + FixedAndStickyLayersOnly = 1 << 12, ++ OmitDeviceScaleFactor = 1 << 13, }; struct SnapshotOptions { @@ -5757,18 +5658,18 @@ index adc6185687b6fcee3a49819d0149cde24a4485bf..a33e5db46933c514abce86e3f264de9b } diff --git a/Source/WebCore/page/LocalFrame.cpp b/Source/WebCore/page/LocalFrame.cpp -index 090657b2602a09708b6b859952b466fcca07f174..ce5df33671b65494c0d222ed9086d7fe828f3702 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" +#include "ComposedTreeIterator.h" + #include "DiagnosticLoggingClient.h" + #include "DiagnosticLoggingKeys.h" #include "DocumentLoader.h" - #include "DocumentType.h" - #include "Editing.h" -@@ -57,6 +58,7 @@ +@@ -60,6 +61,7 @@ #include "FrameSelection.h" #include "GraphicsContext.h" #include "GraphicsLayer.h" @@ -5776,15 +5677,15 @@ index 090657b2602a09708b6b859952b466fcca07f174..ce5df33671b65494c0d222ed9086d7fe #include "HTMLAttachmentElement.h" #include "HTMLFormControlElement.h" #include "HTMLFormElement.h" -@@ -79,6 +81,7 @@ +@@ -82,6 +84,7 @@ #include "Logging.h" #include "Navigator.h" #include "NodeList.h" +#include "NodeRenderStyle.h" #include "NodeTraversal.h" #include "Page.h" - #include "ProcessSyncClient.h" -@@ -202,6 +205,7 @@ LocalFrame::LocalFrame(Page& page, ClientCreator&& clientCreator, FrameIdentifie + #include "PaymentSession.h" +@@ -217,6 +220,7 @@ LocalFrame::LocalFrame(Page& page, ClientCreator&& clientCreator, FrameIdentifie void LocalFrame::init() { @@ -5792,7 +5693,7 @@ index 090657b2602a09708b6b859952b466fcca07f174..ce5df33671b65494c0d222ed9086d7fe protectedLoader()->init(); } -@@ -431,7 +435,7 @@ void LocalFrame::orientationChanged() +@@ -444,7 +448,7 @@ void LocalFrame::orientationChanged() IntDegrees LocalFrame::orientation() const { if (RefPtr page = this->page()) @@ -5801,9 +5702,9 @@ index 090657b2602a09708b6b859952b466fcca07f174..ce5df33671b65494c0d222ed9086d7fe return 0; } #endif // ENABLE(ORIENTATION_EVENTS) -@@ -1501,6 +1505,364 @@ void LocalFrame::reportResourceMonitoringWarning() - - #endif +@@ -1599,6 +1603,364 @@ RefPtr LocalFrame::frameDocumentSecurityOrigin() const + return nullptr; + } +#if !PLATFORM(IOS_FAMILY) + @@ -6167,21 +6068,18 @@ index 090657b2602a09708b6b859952b466fcca07f174..ce5df33671b65494c0d222ed9086d7fe #undef FRAME_RELEASE_LOG_ERROR diff --git a/Source/WebCore/page/LocalFrame.h b/Source/WebCore/page/LocalFrame.h -index 82f67e2e21e64b95800696a6bb22f15298866979..26a1bc0736e00964a5beb151bb53c430c36e029d 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 }; @@ -6191,7 +6089,7 @@ index 82f67e2e21e64b95800696a6bb22f15298866979..26a1bc0736e00964a5beb151bb53c430 class LocalFrame final : public Frame { public: -@@ -227,10 +229,6 @@ public: +@@ -233,10 +234,6 @@ public: WEBCORE_EXPORT DataDetectionResultsStorage& dataDetectionResults(); #endif @@ -6202,7 +6100,7 @@ index 82f67e2e21e64b95800696a6bb22f15298866979..26a1bc0736e00964a5beb151bb53c430 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); @@ -6213,15 +6111,15 @@ index 82f67e2e21e64b95800696a6bb22f15298866979..26a1bc0736e00964a5beb151bb53c430 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 @@ -6229,19 +6127,19 @@ index 82f67e2e21e64b95800696a6bb22f15298866979..26a1bc0736e00964a5beb151bb53c430 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 916d2cc402fb668d19143022b5e3c58838a8920d..0f389d033511bdc7ef92fb4bd8a7525f92a23daa 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(); } @@ -6287,7 +6185,7 @@ index 916d2cc402fb668d19143022b5e3c58838a8920d..0f389d033511bdc7ef92fb4bd8a7525f ScrollingCoordinator* Page::scrollingCoordinator() { if (!m_scrollingCoordinator && m_settings->scrollingCoordinatorEnabled()) { -@@ -4211,6 +4250,26 @@ void Page::setUseDarkAppearanceOverride(std::optional valueOverride) +@@ -4242,6 +4281,26 @@ void Page::setUseDarkAppearanceOverride(std::optional valueOverride) appearanceDidChange(); } @@ -6315,10 +6213,10 @@ index 916d2cc402fb668d19143022b5e3c58838a8920d..0f389d033511bdc7ef92fb4bd8a7525f { if (insets == m_fullscreenInsets) diff --git a/Source/WebCore/page/Page.h b/Source/WebCore/page/Page.h -index 11c3b26d33342999041fb464ad487cd7dc0e6891..41bfb065fe96f08c21f296e2565770dbf81d163e 100644 +index 9f107570fbb2195211ad46358369acb791e0376b..8c753ef756e9fe64ffdca36683ec486edb758f6b 100644 --- a/Source/WebCore/page/Page.h +++ b/Source/WebCore/page/Page.h -@@ -365,6 +365,9 @@ public: +@@ -389,6 +389,9 @@ public: const ViewportArguments* overrideViewportArguments() const { return m_overrideViewportArguments.get(); } WEBCORE_EXPORT void setOverrideViewportArguments(const std::optional&); @@ -6328,7 +6226,7 @@ index 11c3b26d33342999041fb464ad487cd7dc0e6891..41bfb065fe96f08c21f296e2565770db static void refreshPlugins(bool reload); WEBCORE_EXPORT PluginData& pluginData(); WEBCORE_EXPORT Ref protectedPluginData(); -@@ -462,6 +465,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(); } @@ -6339,7 +6237,7 @@ index 11c3b26d33342999041fb464ad487cd7dc0e6891..41bfb065fe96f08c21f296e2565770db #endif FocusController& focusController() const { return *m_focusController; } WEBCORE_EXPORT CheckedRef checkedFocusController() const; -@@ -647,6 +654,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); @@ -6350,7 +6248,7 @@ index 11c3b26d33342999041fb464ad487cd7dc0e6891..41bfb065fe96f08c21f296e2565770db #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 @@ -6362,7 +6260,7 @@ index 11c3b26d33342999041fb464ad487cd7dc0e6891..41bfb065fe96f08c21f296e2565770db #if ENABLE(DEVICE_ORIENTATION) && PLATFORM(IOS_FAMILY) DeviceOrientationUpdateProvider* deviceOrientationUpdateProvider() const { return m_deviceOrientationUpdateProvider.get(); } #endif -@@ -1392,6 +1408,9 @@ private: +@@ -1424,6 +1440,9 @@ private: #if ENABLE(DRAG_SUPPORT) const UniqueRef m_dragController; @@ -6372,7 +6270,7 @@ index 11c3b26d33342999041fb464ad487cd7dc0e6891..41bfb065fe96f08c21f296e2565770db #endif std::unique_ptr m_focusController; #if ENABLE(CONTEXT_MENUS) -@@ -1469,6 +1488,8 @@ private: +@@ -1502,6 +1521,8 @@ private: bool m_useElevatedUserInterfaceLevel { false }; bool m_useDarkAppearance { false }; std::optional m_useDarkAppearanceOverride; @@ -6381,7 +6279,7 @@ index 11c3b26d33342999041fb464ad487cd7dc0e6891..41bfb065fe96f08c21f296e2565770db #if ENABLE(TEXT_AUTOSIZING) float m_textAutosizingWidth { 0 }; -@@ -1651,6 +1672,11 @@ private: +@@ -1683,6 +1704,11 @@ private: #endif std::unique_ptr m_overrideViewportArguments; @@ -6394,7 +6292,7 @@ index 11c3b26d33342999041fb464ad487cd7dc0e6891..41bfb065fe96f08c21f296e2565770db #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 33ef23f456d389c876f7d66732a1ae9bb2ed7662..f0d38ba2208975e9a31f634096caf20ecb7340be 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 @@ -6420,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; } @@ -6432,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; @@ -6442,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: @@ -6514,19 +6412,19 @@ index 24ed7c019bea4df52f2883db0e40bdbc2dc74ebd..a788f534d9e0e8124153c7f380b4fdb2 } diff --git a/Source/WebCore/page/csp/ContentSecurityPolicy.cpp b/Source/WebCore/page/csp/ContentSecurityPolicy.cpp -index 51933cf69017936dfa08823d4a1a778d3d64db71..2101a8ab75fc7adf5ebcbf245e2083a2b750271b 100644 +index e8cf919fd1d0147fce390aa5750843a6bce40190..fb2d56e3a3b6901f993544e297ad678c469a9cc1 100644 --- a/Source/WebCore/page/csp/ContentSecurityPolicy.cpp +++ b/Source/WebCore/page/csp/ContentSecurityPolicy.cpp -@@ -348,6 +348,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) -@@ -361,6 +363,8 @@ typename std::enable_if bool ContentSecurityPolicy::allPoliciesWithDispositionAllow(Disposition disposition, ViolatedDirectiveCallback&& callback, Predicate&& predicate, Args&&... args) const { @@ -6535,7 +6433,7 @@ index 51933cf69017936dfa08823d4a1a778d3d64db71..2101a8ab75fc7adf5ebcbf245e2083a2 bool isReportOnly = disposition == ContentSecurityPolicy::Disposition::ReportOnly; bool isAllowed = true; for (auto& policy : m_policies) { -@@ -377,6 +381,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 { @@ -6630,18 +6528,6 @@ index 0000000000000000000000000000000000000000..803239911006cfb3b03ea911c003f2d2 +} + +} -diff --git a/Source/WebCore/platform/Cairo.cmake b/Source/WebCore/platform/Cairo.cmake -index 29492dd39b08db28aad2bf2439eb3e2bbcf25ad7..2b603cb8440b1b5057c87fcbd6909c61bae4ceb8 100644 ---- a/Source/WebCore/platform/Cairo.cmake -+++ b/Source/WebCore/platform/Cairo.cmake -@@ -14,6 +14,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 @@ -6676,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() @@ -6688,8 +6574,21 @@ index 2f4e02e783ac512aeb76e0abe7e253b57bfda937..94e0c9335720324a746f300a26b17a28 IntSize dragImageSize(DragImageRef) { +diff --git a/Source/WebCore/platform/DragImage.h b/Source/WebCore/platform/DragImage.h +index 77286d8e715825c9c7c0d329480fc0fc497fe561..5ea53eb8b7e53dd5a5950c65a38c1d23bfe46681 100644 +--- a/Source/WebCore/platform/DragImage.h ++++ b/Source/WebCore/platform/DragImage.h +@@ -60,7 +60,7 @@ class Node; + typedef RetainPtr DragImageRef; + #elif PLATFORM(MAC) + typedef RetainPtr DragImageRef; +-#elif PLATFORM(WIN) ++#elif PLATFORM(WIN) && USE(CAIRO) + typedef HBITMAP DragImageRef; + #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; @@ -6701,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) @@ -6722,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) @@ -6735,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; } @@ -6743,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 @@ -6754,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; @@ -6783,10 +6673,10 @@ index 63ffd6ca32c3baee03db2a9419c4f7e9de45388a..c60c7a8d1f110472117c8c4e969fd05f #endif diff --git a/Source/WebCore/platform/PlatformScreen.cpp b/Source/WebCore/platform/PlatformScreen.cpp -index ef0abc9a93e878897ffc9d2497a3da0fca5b37b7..8868e20e3720ce33d3148cea5c3bcdaf2ff2c4e5 100644 +index ef0abc9a93e878897ffc9d2497a3da0fca5b37b7..abd96c6d1a6c3ab9e0121c1e78f2f75a5f805b32 100644 --- a/Source/WebCore/platform/PlatformScreen.cpp +++ b/Source/WebCore/platform/PlatformScreen.cpp -@@ -85,3 +85,25 @@ OptionSet screenContentsFormatsForTesting() +@@ -85,3 +85,24 @@ OptionSet screenContentsFormatsForTesting() } // namespace WebCore #endif // PLATFORM(COCOA) || PLATFORM(GTK) || (PLATFORM(WPE) && ENABLE(WPE_PLATFORM)) @@ -6794,45 +6684,41 @@ index ef0abc9a93e878897ffc9d2497a3da0fca5b37b7..8868e20e3720ce33d3148cea5c3bcdaf +#if ENABLE(TOUCH_EVENTS) +namespace WebCore { + -+static std::optional screenHasTouchDeviceOverride = std::nullopt; ++static std::optional _screenHasTouchDeviceOverride = std::nullopt; ++ +void setScreenHasTouchDeviceOverride(bool value) { -+ screenHasTouchDeviceOverride = value; ++ _screenHasTouchDeviceOverride = value; ++} ++std::optional screenHasTouchDeviceOverride() { ++ return _screenHasTouchDeviceOverride; +} + +bool screenHasTouchDevice() { -+ if (screenHasTouchDeviceOverride) -+ return screenHasTouchDeviceOverride.value(); ++ if (screenHasTouchDeviceOverride()) ++ return screenHasTouchDeviceOverride().value(); + return platformScreenHasTouchDevice(); +} -+bool screenIsTouchPrimaryInputDevice() { -+ if (screenHasTouchDeviceOverride) -+ return screenHasTouchDeviceOverride.value(); -+ return platformScreenIsTouchPrimaryInputDevice(); -+} + +} // namespace WebCore +#endif diff --git a/Source/WebCore/platform/PlatformScreen.h b/Source/WebCore/platform/PlatformScreen.h -index dfef4ecbfb44cc985d1d26eaceae855cb427c002..665da262aeb6524f48b2de2418a474a65d0ef754 100644 +index 82a54ac2de2ddf4650e4b48db129fe25f6562264..d144ba15d18d2e892c25988dab27636135353a99 100644 --- a/Source/WebCore/platform/PlatformScreen.h +++ b/Source/WebCore/platform/PlatformScreen.h -@@ -160,12 +160,16 @@ WEBCORE_EXPORT float screenScaleFactor(UIScreen * = nullptr); +@@ -160,10 +160,14 @@ WEBCORE_EXPORT float screenScaleFactor(UIScreen * = nullptr); #endif #if ENABLE(TOUCH_EVENTS) --#if PLATFORM(GTK) || PLATFORM(WPE) +-#if PLATFORM(GTK) +WEBCORE_EXPORT void setScreenHasTouchDeviceOverride(bool); ++WEBCORE_EXPORT std::optional screenHasTouchDeviceOverride(); + WEBCORE_EXPORT bool screenHasTouchDevice(); - WEBCORE_EXPORT bool screenIsTouchPrimaryInputDevice(); -+#if PLATFORM(GTK) || PLATFORM(WPE) ++#if PLATFORM(GTK) +bool platformScreenHasTouchDevice(); -+bool platformScreenIsTouchPrimaryInputDevice(); #else -constexpr bool screenHasTouchDevice() { return true; } --constexpr bool screenIsTouchPrimaryInputDevice() { return true; } +constexpr bool platformScreenHasTouchDevice() { return true; } -+constexpr bool platformScreenIsTouchPrimaryInputDevice() { return true; } #endif #endif @@ -6863,11 +6749,11 @@ index 34715d27b529750fc866db87cd330b5184286771..3eefa218af075f76d98012cdeae7e4b3 // create a PlatformTouchPoint of type TouchCancelled artificially PlatformTouchPoint(unsigned id, State state, IntPoint screenPos, IntPoint pos) diff --git a/Source/WebCore/platform/Skia.cmake b/Source/WebCore/platform/Skia.cmake -index 31460a79014b0a8b21fdfe71759af14ff2da46d7..f2594d701502102fed89d711694b64e05a863aaa 100644 +index c39b57e01190b833be46452c3d964fe243c216d3..6e4af1509037697421cf0c80e2459da0bad79ba8 100644 --- a/Source/WebCore/platform/Skia.cmake +++ b/Source/WebCore/platform/Skia.cmake -@@ -13,6 +13,7 @@ list(APPEND WebCore_PRIVATE_FRAMEWORK_HEADERS - +@@ -14,6 +14,7 @@ list(APPEND WebCore_PRIVATE_FRAMEWORK_HEADERS + platform/graphics/skia/FontCascadeSkiaInlines.h platform/graphics/skia/GraphicsContextSkia.h platform/graphics/skia/ImageBufferSkiaBackend.h + platform/graphics/skia/ImageBufferUtilitiesSkia.h @@ -6887,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 @@ -6996,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 @@ @@ -7008,10 +6799,10 @@ index 3d0ab7eceaf2a6321685bc362eb9b25600fd98fd..2d7e9a399bf2e9dc3f373d5fa3db99fa namespace WebCore { diff --git a/Source/WebCore/platform/graphics/win/ComplexTextControllerUniscribe.cpp b/Source/WebCore/platform/graphics/win/ComplexTextControllerUniscribe.cpp -index 3f0b75a0702db1ed10334c80e4813094571f588c..ea5ff6b7e7bd4c3b8babebc294d7d7c94fc6afb6 100644 +index 78ea08023ebd5f1b41b06cd843b6dce4ee80dd50..55fed94b774f033b4f75e2dee85dc27cf2e2689e 100644 --- a/Source/WebCore/platform/graphics/win/ComplexTextControllerUniscribe.cpp +++ b/Source/WebCore/platform/graphics/win/ComplexTextControllerUniscribe.cpp -@@ -169,6 +169,33 @@ static Vector stringIndicesFromClusters(const Vector& clusters, +@@ -168,6 +168,33 @@ static Vector stringIndicesFromClusters(const Vector& clusters, return stringIndices; } @@ -7045,7 +6836,7 @@ index 3f0b75a0702db1ed10334c80e4813094571f588c..ea5ff6b7e7bd4c3b8babebc294d7d7c9 void ComplexTextController::collectComplexTextRunsForCharacters(std::span cp, unsigned stringLocation, const Font* font) { if (!font) { -@@ -198,6 +225,8 @@ void ComplexTextController::collectComplexTextRunsForCharacters(std::span ++#include + #include + #include + #include ++#include -+#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 -+++ b/Source/WebCore/platform/libwpe/PlatformKeyboardEventLibWPE.cpp -@@ -30,9 +30,11 @@ - - #include "WindowsKeyboardCodes.h" - #include -+#include - #include - #include - #include -+#include - - namespace WebCore { - -@@ -1303,6 +1305,246 @@ int PlatformKeyboardEvent::windowsKeyCodeForWPEKeyCode(unsigned keycode) - return 0; +@@ -1303,6 +1305,246 @@ int PlatformKeyboardEvent::windowsKeyCodeForWPEKeyCode(unsigned keycode) + return 0; } +static const UncheckedKeyHashMap& WPEToWindowsKeyCodeMap() @@ -7809,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 065c1b362537547bc732bd9ded7e801ddf938ef8..448321a8388b7075173061caf8c9b272997e02fd 100644 +index f21f7d66c5dd661c289a453994597ae166c8f3d0..c293b72154e2cb8f4f1ad3cc222a05f29888891d 100644 --- a/Source/WebCore/platform/libwpe/PlatformPasteboardLibWPE.cpp +++ b/Source/WebCore/platform/libwpe/PlatformPasteboardLibWPE.cpp @@ -31,10 +31,18 @@ @@ -7831,7 +7406,7 @@ index 065c1b362537547bc732bd9ded7e801ddf938ef8..448321a8388b7075173061caf8c9b272 PlatformPasteboard::PlatformPasteboard(const String&) : m_pasteboard(wpe_pasteboard_get_singleton()) { -@@ -54,72 +62,26 @@ void PlatformPasteboard::performAsDataOwner(DataOwnerType, NOESCAPE Function& types) const { @@ -7839,7 +7414,7 @@ index 065c1b362537547bc732bd9ded7e801ddf938ef8..448321a8388b7075173061caf8c9b272 - wpe_pasteboard_get_types(m_pasteboard, &pasteboardTypes); - for (auto& typeString : unsafeMakeSpan(pasteboardTypes.strings, pasteboardTypes.length)) { - const auto length = std::min(static_cast(typeString.length), std::numeric_limits::max()); -- types.append(String({ typeString.data, length })); +- types.append(String(unsafeMakeSpan(typeString.data, length))); - } - - wpe_pasteboard_string_vector_free(&pasteboardTypes); @@ -7855,7 +7430,7 @@ index 065c1b362537547bc732bd9ded7e801ddf938ef8..448321a8388b7075173061caf8c9b272 - return String(); - - const auto length = std::min(static_cast(string.length), std::numeric_limits::max()); -- String returnValue({ string.data, length }); +- String returnValue(unsafeMakeSpan(string.data, length)); - - wpe_pasteboard_string_free(&string); - return returnValue; @@ -7865,7 +7440,7 @@ index 065c1b362537547bc732bd9ded7e801ddf938ef8..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(); @@ -7881,6 +7456,7 @@ index 065c1b362537547bc732bd9ded7e801ddf938ef8..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); @@ -7905,6 +7481,7 @@ index 065c1b362537547bc732bd9ded7e801ddf938ef8..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); @@ -7912,6 +7489,19 @@ index 065c1b362537547bc732bd9ded7e801ddf938ef8..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 @@ -7930,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 8c57734966ccfaf38dbb7fd956e71f3d3f65a477..594e5031caba89142535a16c2fb132bb878aab21 100644 +index c1e50549e674e1620ad0515a061376ba728e75df..7e6e323436d9b1a87dbf4d6fa275629f531e3ce8 100644 --- a/Source/WebCore/platform/network/NetworkStorageSession.h +++ b/Source/WebCore/platform/network/NetworkStorageSession.h -@@ -200,6 +200,7 @@ public: +@@ -198,6 +198,7 @@ public: NetworkingContext* context() const; #endif @@ -7942,16 +7532,16 @@ index 8c57734966ccfaf38dbb7fd956e71f3d3f65a477..594e5031caba89142535a16c2fb132bb 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 }, @@ -7982,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: @@ -8023,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 ab7a9d832f0573bd402c5643d3eee3aa3e3b33c6..7dcb122411c4b6bf45c05e3a6edf7b133c5d9e9e 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; } @@ -8036,14 +7626,14 @@ index ab7a9d832f0573bd402c5643d3eee3aa3e3b33c6..7dcb122411c4b6bf45c05e3a6edf7b13 + size_t count = cookieValues.size(); + auto* cookies = [NSMutableArray arrayWithCapacity:count]; + for (const auto& cookieValue : cookieValues) { -+ NSString* cookieString = (NSString *)cookieValue; ++ NSString* cookieString = cookieValue.createNSString().autorelease(); + NSString* cookieKey = @"Set-Cookie"; + NSDictionary* headers = [NSDictionary dictionaryWithObjects:[NSArray arrayWithObject:cookieString] forKeys:[NSArray arrayWithObject:cookieKey]]; -+ NSArray* parsedCookies = [NSHTTPCookie cookiesWithResponseHeaderFields:headers forURL:(NSURL *)url]; ++ NSArray* parsedCookies = [NSHTTPCookie cookiesWithResponseHeaderFields:headers forURL:url.createNSURL().get()]; + [cookies addObject:parsedCookies[0]]; + } -+ NSURL *cookieURL = url; -+ setHTTPCookiesForURL(cookieStorage().get(), cookies, cookieURL, firstParty, sameSiteInfo); ++ NSURL *cookieURL = url.createNSURL().get(); ++ setHTTPCookiesForURL(cookieStorage().get(), cookies, cookieURL, firstParty.createNSURL().get(), sameSiteInfo); +} + static NSHTTPCookieAcceptPolicy httpCookieAcceptPolicy(CFHTTPCookieStorageRef cookieStorage) @@ -8062,91 +7652,11 @@ 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 b422dee5926a14aab7a20ea4de9d51080b2b3fea..d5735a2097e18f5c94fa0695fde6ff7a4ffda823 100644 +index 96289d8ae2e4feb60a91fab3f5cf1fc27b9e7c87..8c0b62c44a18571d1f3ea1ed81d59a0aae28d3f1 100644 --- a/Source/WebCore/platform/network/curl/NetworkStorageSessionCurl.cpp +++ b/Source/WebCore/platform/network/curl/NetworkStorageSessionCurl.cpp -@@ -135,6 +135,12 @@ void NetworkStorageSession::setCookieAcceptPolicy(CookieAcceptPolicy policy) con +@@ -136,6 +136,12 @@ void NetworkStorageSession::setCookieAcceptPolicy(CookieAcceptPolicy policy) con cookieDatabase().setAcceptPolicy(policy); } @@ -8160,10 +7670,10 @@ index b422dee5926a14aab7a20ea4de9d51080b2b3fea..d5735a2097e18f5c94fa0695fde6ff7a { switch (cookieDatabase().acceptPolicy()) { diff --git a/Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp b/Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp -index c191cdc193019db8efc2c597bb3c87b3a318bcd6..35ad719201c4505c43c20701dffce0adcfb241f6 100644 +index 274d671614fdca8f425adecb405d5f2402e92f8b..1b19e79e10f0768cfdd66b0fc1b1855388c9f559 100644 --- a/Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp +++ b/Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp -@@ -528,6 +528,26 @@ void NetworkStorageSession::replaceCookies(const Vector& cookies) +@@ -551,6 +551,26 @@ void NetworkStorageSession::replaceCookies(const Vector& cookies) g_signal_emit(jar, signalId, 0, nullptr, nullptr); } @@ -8254,6 +7764,69 @@ index 0379437d84807e4a8d3846afac5ec8a70e743e70..5b0461bf12535d4900ffaddc2a878262 { if (!m_dragDataMap.isEmpty() || !m_platformDragData) return m_dragDataMap; +diff --git a/Source/WebCore/platform/win/DragImageWin.cpp b/Source/WebCore/platform/win/DragImageWin.cpp +index dd24e15115aeff41f0f4452a9cac292d75bc0d5d..8df467c008bdb3de59d301b14c1c20b8bb0b6a41 100644 +--- a/Source/WebCore/platform/win/DragImageWin.cpp ++++ b/Source/WebCore/platform/win/DragImageWin.cpp +@@ -62,16 +62,22 @@ IntSize dragImageSize(DragImageRef image) + { + if (!image) + return IntSize(); +- BITMAP b; +- GetObject(image, sizeof(BITMAP), &b); +- return IntSize(b.bmWidth, b.bmHeight); ++ return { image->width(), image->height() }; + } + ++#if USE(CAIRO) + void deleteDragImage(DragImageRef image) + { + if (image) + ::DeleteObject(image); + } ++#else ++void deleteDragImage(DragImageRef) ++{ ++ // Since this is a RefPtr, there's nothing additional we need to do to ++ // delete it. It will be released when it falls out of scope. ++} ++#endif + + DragImageRef dissolveDragImageToFraction(DragImageRef image, float) + { +@@ -79,8 +85,9 @@ DragImageRef dissolveDragImageToFraction(DragImageRef image, float) + return image; + } + +-DragImageRef createDragImageIconForCachedImageFilename(const String& filename) ++DragImageRef createDragImageIconForCachedImageFilename(const String&) + { ++#if USE(CAIRO) + SHFILEINFO shfi { }; + auto fname = filename.wideCharacters(); + if (FAILED(SHGetFileInfo(fname.data(), FILE_ATTRIBUTE_NORMAL, &shfi, sizeof(shfi), SHGFI_ICON | SHGFI_USEFILEATTRIBUTES))) +@@ -96,6 +103,9 @@ DragImageRef createDragImageIconForCachedImageFilename(const String& filename) + DeleteObject(iconInfo.hbmMask); + + return iconInfo.hbmColor; ++#else ++ return nullptr; ++#endif + } + + #if USE(CAIRO) +@@ -221,9 +231,9 @@ DragImageRef createDragImageForColor(const Color&, const FloatRect&, float, Path + } + + #if USE(SKIA) +-DragImageRef createDragImageFromImage(Image*, ImageOrientation, GraphicsClient*, float) ++DragImageRef createDragImageFromImage(Image* image, ImageOrientation, GraphicsClient*, float) + { +- return nullptr; ++ return image->currentNativeImage()->platformImage(); + } + + DragImageRef scaleDragImage(DragImageRef, FloatSize) diff --git a/Source/WebCore/platform/win/KeyEventWin.cpp b/Source/WebCore/platform/win/KeyEventWin.cpp index d450bf9d0fd1f0bf8f28db483ac9d3d60fa9d114..72a59403a0b5493aea4a8e28eb15eac24b652b09 100644 --- a/Source/WebCore/platform/win/KeyEventWin.cpp @@ -8279,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(); @@ -8304,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&) { } @@ -8430,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. + * @@ -8454,6 +8027,7 @@ index 0000000000000000000000000000000000000000..5a20bfaacd42d27bee5f843483d6b60d + +#include "config.h" +#include "DragImage.h" ++#include "NativeImage.h" +#include "NotImplemented.h" + +#include "Image.h" @@ -8507,278 +8081,209 @@ index 0000000000000000000000000000000000000000..5a20bfaacd42d27bee5f843483d6b60d +} + +} -diff --git a/Source/WebCore/platform/wpe/PlatformScreenWPE.cpp b/Source/WebCore/platform/wpe/PlatformScreenWPE.cpp -index 77bdff686770e56f5445fa12216c6bff93bb5cfb..e16583ea6298864df9c8b82cb0686b2afb18ce95 100644 ---- a/Source/WebCore/platform/wpe/PlatformScreenWPE.cpp -+++ b/Source/WebCore/platform/wpe/PlatformScreenWPE.cpp -@@ -151,12 +151,12 @@ bool screenSupportsExtendedColor(Widget*) - } +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(TOUCH_EVENTS) --bool screenHasTouchDevice() -+bool platformScreenHasTouchDevice() ++#if ENABLE(DRAG_SUPPORT) ++#include "DragData.h" ++#endif ++ + namespace WebCore { + + std::unique_ptr Pasteboard::createForCopyAndPaste(std::unique_ptr&& context) +@@ -55,8 +59,17 @@ Pasteboard::Pasteboard(std::unique_ptr&& context) { - return true; } --bool screenIsTouchPrimaryInputDevice() -+bool platformScreenIsTouchPrimaryInputDevice() +-void Pasteboard::writeString(const String&, const String&) ++void Pasteboard::writeString(const String& type, const String& text) { - return true; ++ 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(); } -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); -+} -+ -+static void replaceNonBreakingSpaceWithSpace(String& str) -+{ -+ static const UChar NonBreakingSpaceCharacter = 0xA0; -+ static const UChar SpaceCharacter = ' '; -+ str = makeStringByReplacingAll(str, NonBreakingSpaceCharacter, SpaceCharacter); -+} + +@@ -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 } } @@ -8809,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&&) { } @@ -8832,10 +8337,10 @@ index db95c8273bd0deb3f903a45d02fc07bbbd8ab305..bf88228b4c838b90d11d430cc9429d51 WorkerOrWorkletGlobalScope& m_globalScope; }; diff --git a/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp b/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp -index e185fc809df730737ff85c349ad17dce10d246f0..b1ccbc16b185ac76ecffb753b6aed2ae1eb8e39a 100644 +index 23a9f5b5afdb7aba0efdc6a1db7898abc641b0fa..220ed1f59582562268f02262ea2f7ed3388aab1f 100644 --- a/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp +++ b/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp -@@ -96,6 +96,8 @@ +@@ -97,6 +97,8 @@ #if PLATFORM(COCOA) #include @@ -8844,7 +8349,7 @@ index e185fc809df730737ff85c349ad17dce10d246f0..b1ccbc16b185ac76ecffb753b6aed2ae #endif #if ENABLE(APPLE_PAY_REMOTE_UI) -@@ -1232,6 +1234,14 @@ void NetworkConnectionToWebProcess::clearPageSpecificData(PageIdentifier pageID) +@@ -1237,6 +1239,14 @@ void NetworkConnectionToWebProcess::clearPageSpecificData(PageIdentifier pageID) storageSession->clearPageSpecificDataForResourceLoadStatistics(pageID); } @@ -8860,10 +8365,10 @@ index e185fc809df730737ff85c349ad17dce10d246f0..b1ccbc16b185ac76ecffb753b6aed2ae { if (auto* storageSession = protectedNetworkProcess()->storageSession(m_sessionID)) diff --git a/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h b/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h -index 706ceb9edc7de45d731db75c656a7a9ad5780cbe..49a6735a5936a8b6daab556a7df89b254157e14f 100644 +index 3f1539237c6c8d1cd832cd3ece2ba20939e01a41..1259c36e38d46c0ebfdf98be20f217433f831ca5 100644 --- a/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h +++ b/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h -@@ -380,6 +380,8 @@ private: +@@ -388,6 +388,8 @@ private: void clearPageSpecificData(WebCore::PageIdentifier); @@ -8873,7 +8378,7 @@ index 706ceb9edc7de45d731db75c656a7a9ad5780cbe..49a6735a5936a8b6daab556a7df89b25 void logUserInteraction(RegistrableDomain&&); diff --git a/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in b/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in -index a8f2e3cd5cef58c0e390a9cc8c3d18c9d24ffbda..fdbc166682cd3ec9fdbba737757331e46fd93364 100644 +index b10706aafd037a2b92a68b0d2c474ec2e42cd2fe..f80792c02d880dbd61849233fdbc348f1eeffb33 100644 --- a/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in +++ b/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in @@ -80,6 +80,8 @@ messages -> NetworkConnectionToWebProcess WantsDispatchMessage { @@ -8885,311 +8390,39 @@ index a8f2e3cd5cef58c0e390a9cc8c3d18c9d24ffbda..fdbc166682cd3ec9fdbba737757331e4 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 40718b455299eb28978d999d2088579564b06fd4..9ada150a661beda8b4411c5b6e669c72e0895a75 100644 ---- a/Source/WebKit/NetworkProcess/NetworkProcess.cpp -+++ b/Source/WebKit/NetworkProcess/NetworkProcess.cpp -@@ -653,6 +653,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 c6b478b2564a0fb550118e43a9749101c2aa7361..2a45c0dc4e3947b84ed1da124c02ccfff7834cbb 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; -@@ -234,6 +235,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 24124fdb6ad7f5447345764a8481342557ceba8e..204e00738921f21e70af8398a9350cd49a4640ce 100644 ---- a/Source/WebKit/NetworkProcess/NetworkProcess.messages.in -+++ b/Source/WebKit/NetworkProcess/NetworkProcess.messages.in -@@ -90,6 +90,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 679cf1fc291f262f90d42f5d597361c67eb0f4c0..527015014b15f9efca45dd054f541b4be416eafe 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); -@@ -343,6 +346,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 0d2fcd76b91d7f9afa8c2378ab1109f12386a6c2..ff01afba3686fd8f81e1ad914f0171d3fd40e0fb 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]); +@@ -1148,6 +1148,14 @@ - (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)data - negotiatedLegacyTLS = checkForLegacyTLS(task._incompleteTaskMetrics.transactionMetrics.lastObject); - if (negotiatedLegacyTLS == NegotiatedLegacyTLS::Yes && task._preconnect) -@@ -1146,6 +1148,14 @@ - (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)data - - resourceResponse.setDeprecatedNetworkLoadMetrics(WebCore::copyTimingData(taskMetrics, networkDataTask->networkLoadMetrics())); + resourceResponse.setDeprecatedNetworkLoadMetrics(WebCore::copyTimingData(taskMetrics.get(), networkDataTask->networkLoadMetrics())); resourceResponse.setProxyName(WTFMove(proxyName)); + + __block WebCore::HTTPHeaderMap requestHeaders; + NSURLSessionTaskTransactionMetrics *m = dataTask._incompleteTaskMetrics.transactionMetrics.lastObject; -+ [m.request.allHTTPHeaderFields enumerateKeysAndObjectsUsingBlock:^(NSString *name, NSString *value, BOOL *) { -+ requestHeaders.set(String(name), String(value)); -+ }]; -+ resourceResponse.m_httpRequestHeaderFields = WTFMove(requestHeaders); -+ - networkDataTask->didReceiveResponse(WTFMove(resourceResponse), negotiatedLegacyTLS, privateRelayed, [completionHandler = makeBlockPtr(completionHandler), taskIdentifier](WebCore::PolicyAction policyAction) { - #if !LOG_DISABLED - LOG(NetworkSession, "%llu didReceiveResponse completionHandler (%d)", taskIdentifier, policyAction); -diff --git a/Source/WebKit/NetworkProcess/curl/NetworkDataTaskCurl.cpp b/Source/WebKit/NetworkProcess/curl/NetworkDataTaskCurl.cpp -index 50cd0b45a2fa5be6f217b686b2ff703b74c06078..c2d6b10762def97a222197d1e6f45d31d3b7a49b 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 - - updateNetworkLoadMetrics(receivedResponse.networkLoadMetrics); - m_response.setDeprecatedNetworkLoadMetrics(Box::create(WTFMove(receivedResponse.networkLoadMetrics))); -+ m_response.m_httpRequestHeaderFields = request.resourceRequest().httpHeaderFields(); - - handleCookieHeaders(request.resourceRequest(), receivedResponse); - -@@ -294,6 +303,36 @@ 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 (-1 == FileSystem::writeToFile(m_downloadDestinationFile, 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); -+ FileSystem::closeFile(m_downloadDestinationFile); -+ m_downloadDestinationFile = FileSystem::invalidPlatformFileHandle; -+ download.didFinish(); -+} -+ - void NetworkDataTaskCurl::invokeDidReceiveResponse() - { - didReceiveResponse(ResourceResponse(m_response), NegotiatedLegacyTLS::No, PrivateRelayed::No, std::nullopt, [this, protectedThis = Ref { *this }](PolicyAction policyAction) { -@@ -323,6 +362,8 @@ void NetworkDataTaskCurl::invokeDidReceiveResponse() - download->didCreateDestination(m_pendingDownloadLocation); - if (m_curlRequest) - m_curlRequest->completeDidReceiveResponse(); -+ else if (firstRequest().url().protocolIsData()) -+ downloadDataURL(download); - break; - } - default: -@@ -411,6 +452,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 fc4d15308fcb12b084a65d058aec9e67fcf6021f..b1a689989c68798e6308b1da7b3bd7c066497114 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::PlatformFileHandle m_downloadDestinationFile { FileSystem::invalidPlatformFileHandle }; - - 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.request.allHTTPHeaderFields enumerateKeysAndObjectsUsingBlock:^(NSString *name, NSString *value, BOOL *) { ++ requestHeaders.set(String(name), String(value)); ++ }]; ++ resourceResponse.m_httpRequestHeaderFields = WTFMove(requestHeaders); ++ + networkDataTask->didReceiveResponse(WTFMove(resourceResponse), negotiatedLegacyTLS, privateRelayed, [completionHandler = makeBlockPtr(completionHandler), taskIdentifier](WebCore::PolicyAction policyAction) { + #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 975e4097fb5b9cb610ce67c70ea85e6434ec7a9d..6e2676cd751883e2eae26e38ffaefa873857b604 100644 +--- a/Source/WebKit/NetworkProcess/curl/NetworkDataTaskCurl.cpp ++++ b/Source/WebKit/NetworkProcess/curl/NetworkDataTaskCurl.cpp +@@ -166,6 +166,7 @@ void NetworkDataTaskCurl::curlDidReceiveResponse(CurlRequest& request, CurlRespo -- 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)); - } + updateNetworkLoadMetrics(receivedResponse.networkLoadMetrics); + m_response.setDeprecatedNetworkLoadMetrics(Box::create(WTFMove(receivedResponse.networkLoadMetrics))); ++ m_response.m_httpRequestHeaderFields = request.resourceRequest().httpHeaderFields(); -@@ -265,7 +266,7 @@ void WebSocketTask::tryServerTrustEvaluation(WebCore::AuthenticationChallenge&& - if (networkSession() && networkSession()->networkProcess().localhostAliasesForTesting().contains(m_request.url().host())) - localhostAlias = WebCore::CurlStream::LocalhostAlias::Enable; + handleCookieHeaders(request.resourceRequest(), receivedResponse); -- 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 a6d86f1388e8cae7c3939d1ecffb2c46eb5054c5..9e11224335211908fe8bf14edc4c22e9e4934582 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 @@ @@ -9208,7 +8441,7 @@ index a6d86f1388e8cae7c3939d1ecffb2c46eb5054c5..9e11224335211908fe8bf14edc4c22e9 ;; 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) @@ -9220,56 +8453,8 @@ 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 2f33b1c02a7d0e352a5662c19b44cfa7a161b8f5..263d65ba51319116f161db5918439c081cde43fd 100644 +index 1f0116517d88a3a0fffade7288a4909bd848df88..83b9598353ad6dd9192b0c8827bba25d1cb069ad 100644 --- a/Source/WebKit/PlatformGTK.cmake +++ b/Source/WebKit/PlatformGTK.cmake @@ -320,6 +320,9 @@ list(APPEND WebKit_SYSTEM_INCLUDE_DIRECTORIES @@ -9282,7 +8467,7 @@ index 2f33b1c02a7d0e352a5662c19b44cfa7a161b8f5..263d65ba51319116f161db5918439c08 ) list(APPEND WebKit_INTERFACE_INCLUDE_DIRECTORIES -@@ -356,6 +359,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" @@ -9292,7 +8477,7 @@ index 2f33b1c02a7d0e352a5662c19b44cfa7a161b8f5..263d65ba51319116f161db5918439c08 ) endif () -@@ -407,6 +413,12 @@ else () +@@ -410,6 +416,12 @@ else () set(WebKitGTK_ENUM_HEADER_TEMPLATE ${WEBKIT_DIR}/UIProcess/API/gtk/WebKitEnumTypesGtk3.h.in) endif () @@ -9306,19 +8491,10 @@ index 2f33b1c02a7d0e352a5662c19b44cfa7a161b8f5..263d65ba51319116f161db5918439c08 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 8376382ba17ea308210e2a46a60a90a2da2d013c..7935f07612a7ce44cae17e4a8650dcee36ceb49b 100644 +index 56b8ece0181ad1dacd3e33ee1463ac1cc4b2ac20..fb0b4169f860e9064397216b176024760a3503cd 100644 --- a/Source/WebKit/PlatformWPE.cmake +++ b/Source/WebKit/PlatformWPE.cmake -@@ -114,6 +114,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 -@@ -213,6 +215,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 @@ -9326,31 +8502,32 @@ index 8376382ba17ea308210e2a46a60a90a2da2d013c..7935f07612a7ce44cae17e4a8650dcee ) if (ENABLE_2022_GLIB_API) -@@ -423,7 +426,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 e0e9b52c43ee0742f705159c1369f2938b9c4956..05fa7d93a721f200143e9d3ac45a75ce942afc88 100644 +index 8429fc8b2e3721830edf197b3369f4f21bb70a9a..35e99519b9a23ac19757a8b67fe477ce26c06cd0 100644 --- a/Source/WebKit/PlatformWin.cmake +++ b/Source/WebKit/PlatformWin.cmake @@ -54,8 +54,13 @@ list(APPEND WebKit_SOURCES - UIProcess/WebsiteData/win/WebsiteDataStoreWin.cpp UIProcess/win/AutomationClientWin.cpp + UIProcess/win/AutomationSessionClientWin.cpp + + UIProcess/win/InspectorTargetProxyWin.cpp + UIProcess/win/InspectorPlaywrightAgentClientWin.cpp @@ -9369,13 +8546,10 @@ index e0e9b52c43ee0742f705159c1369f2938b9c4956..05fa7d93a721f200143e9d3ac45a75ce WebProcess/WebPage/AcceleratedSurface.cpp -@@ -120,8 +126,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" @@ -9384,78 +8558,36 @@ index e0e9b52c43ee0742f705159c1369f2938b9c4956..05fa7d93a721f200143e9d3ac45a75ce + +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 4510beb0b7403138abef4c9b5e892271fe8beaab..dae8f31ef187d7b086dd84d7e356839dc2811154 100644 +index 35fd0f0397cd92c5bf025d89d7f7c8139c03c69d..b1559f1bb2d2d7a74d0b534f81352e366498bfc8 100644 --- a/Source/WebKit/Shared/AuxiliaryProcess.h +++ b/Source/WebKit/Shared/AuxiliaryProcess.h -@@ -212,6 +212,11 @@ struct AuxiliaryProcessInitializationParameters { +@@ -216,6 +216,11 @@ struct AuxiliaryProcessInitializationParameters { IPC::Connection::Identifier connectionIdentifier; HashMap extraInitializationData; WTF::AuxiliaryProcessType processType; @@ -9549,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 db25c4a2dbb7fd8f9e0885757655eed1ebf64d35..1c21752b0f3710d7dfb0c70421c17de740274439 100644 +index e59ca0120c0a684ea1fbdb2262a6a89ccc848828..4fcb529af731becaf446538be42075bfc19bbf90 100644 --- a/Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in +++ b/Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in -@@ -2814,6 +2814,9 @@ class WebCore::AuthenticationChallenge { +@@ -2827,6 +2827,9 @@ class WebCore::AuthenticationChallenge { class WebCore::DragData { #if PLATFORM(COCOA) String pasteboardName(); @@ -9576,7 +8695,7 @@ index db25c4a2dbb7fd8f9e0885757655eed1ebf64d35..1c21752b0f3710d7dfb0c70421c17de7 #endif WebCore::IntPoint clientPosition(); WebCore::IntPoint globalPosition(); -@@ -3621,6 +3624,7 @@ enum class WebCore::WasPrivateRelayed : bool; +@@ -3625,6 +3628,7 @@ enum class WebCore::WasPrivateRelayed : bool; String httpStatusText; String httpVersion; WebCore::HTTPHeaderMap httpHeaderFields; @@ -9690,7 +8809,7 @@ index 8e4e2d6d5ebb08fba210fe0a328d45290348dd11..32a43192ec1e918c33b1b046b71d2ec5 const String& text() const { return m_text; } diff --git a/Source/WebKit/Shared/WebMouseEvent.h b/Source/WebKit/Shared/WebMouseEvent.h -index fd4722dd38df74f259d8add02025549022a0a205..e1c33f6d766707170935b3e77e81098cc8e3786d 100644 +index 20a6e465457151b02daa22e6bc059cf0e117ece5..ef4b1f737aaa683bc13c447aa4ca77e5cf0d64d7 100644 --- a/Source/WebKit/Shared/WebMouseEvent.h +++ b/Source/WebKit/Shared/WebMouseEvent.h @@ -70,6 +70,7 @@ public: @@ -9702,10 +8821,10 @@ index fd4722dd38df74f259d8add02025549022a0a205..e1c33f6d766707170935b3e77e81098c 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 95aa13fdc5bd9d5ece8f3ff4279c0ebe03f3cdef..bde8a24fcce390b859f6241c9816eb6430376d6b 100644 +index 36e44162c6f211876bf86b20e186f3da7e895536..68fe668470fef43c7a3af7a5c45ca4bac1fbbb28 100644 --- a/Source/WebKit/Shared/WebPageCreationParameters.h +++ b/Source/WebKit/Shared/WebPageCreationParameters.h -@@ -309,6 +309,8 @@ struct WebPageCreationParameters { +@@ -301,6 +301,8 @@ struct WebPageCreationParameters { WebCore::ShouldRelaxThirdPartyCookieBlocking shouldRelaxThirdPartyCookieBlocking { WebCore::ShouldRelaxThirdPartyCookieBlocking::No }; bool httpsUpgradeEnabled { true }; @@ -9715,10 +8834,10 @@ index 95aa13fdc5bd9d5ece8f3ff4279c0ebe03f3cdef..bde8a24fcce390b859f6241c9816eb64 #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 0c9594c44a6f1962642835b221b1c27d15cc33d7..b6898b100be0fe64aba87305711846f066bf9459 100644 +index 6df2cea7d9ba7328456822475ed765e33966d4b8..39c08e228a2346b18915bc90e76965e0586d006b 100644 --- a/Source/WebKit/Shared/WebPageCreationParameters.serialization.in +++ b/Source/WebKit/Shared/WebPageCreationParameters.serialization.in -@@ -229,6 +229,8 @@ enum class WebCore::UserInterfaceLayoutDirection : bool; +@@ -223,6 +223,8 @@ enum class WebCore::UserInterfaceLayoutDirection : bool; bool httpsUpgradeEnabled; @@ -9728,7 +8847,7 @@ index 0c9594c44a6f1962642835b221b1c27d15cc33d7..b6898b100be0fe64aba87305711846f0 WebCore::HighlightVisibility appHighlightsVisible; #endif diff --git a/Source/WebKit/Shared/glib/ProcessExecutablePathGLib.cpp b/Source/WebKit/Shared/glib/ProcessExecutablePathGLib.cpp -index 40d482a1860598391363027e63b010b3ce32b014..e654ae5e7c54b788badd463b1f2b653160d0370e 100644 +index 9899d60864664d1abff2b71c1c01e564e5dfb08c..391e0e42ca6a39f82b5a12c6aede069d61095ee2 100644 --- a/Source/WebKit/Shared/glib/ProcessExecutablePathGLib.cpp +++ b/Source/WebKit/Shared/glib/ProcessExecutablePathGLib.cpp @@ -32,7 +32,7 @@ @@ -9781,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 @@ -9865,24 +8946,11 @@ index 053e9336017d8818b3cbea79ce7c145fd5c46274..5632498d6ef875df80fc68ec206a9d08 else if (!strcmp(argv[i], "-configure-jsc-for-testing")) JSC::Config::configureForTesting(); else if (!strcmp(argv[i], "-disable-jit")) -diff --git a/Source/WebKit/Shared/win/WebEventFactory.cpp b/Source/WebKit/Shared/win/WebEventFactory.cpp -index 23ec85c142892f8f9bee7d063c3ff0cafe6c53a5..4f0021ad12ded82b7ac958fc6c752410ce2ac764 100644 ---- a/Source/WebKit/Shared/win/WebEventFactory.cpp -+++ b/Source/WebKit/Shared/win/WebEventFactory.cpp -@@ -484,7 +484,7 @@ WebKeyboardEvent WebEventFactory::createWebKeyboardEvent(HWND hwnd, UINT message - #if ENABLE(TOUCH_EVENTS) - WebTouchEvent WebEventFactory::createWebTouchEvent() - { -- return WebTouchEvent(); -+ return WebTouchEvent({ WebEventType::TouchMove, OptionSet { }, WallTime::now()}, { }, { }, { }); - } - #endif // ENABLE(TOUCH_EVENTS) - diff --git a/Source/WebKit/Sources.txt b/Source/WebKit/Sources.txt -index 1a8bb4ce0d39f7d03264bb010be3158f3bd87000..34e2d4d603fae0acc8ace9afb8e3ff549e87bf07 100644 +index bd7ec1f455c83cb4d24185099b6c7f569e612a33..cf4183ca9b2bb85b00bb58a4bc0c4d6b6f44af76 100644 --- a/Source/WebKit/Sources.txt +++ b/Source/WebKit/Sources.txt -@@ -389,6 +389,7 @@ Shared/XR/XRDeviceProxy.cpp +@@ -392,6 +392,7 @@ UIProcess/AboutSchemeHandler.cpp UIProcess/AuxiliaryProcessProxy.cpp UIProcess/BackgroundProcessResponsivenessTimer.cpp UIProcess/BrowsingContextGroup.cpp @@ -9890,7 +8958,7 @@ index 1a8bb4ce0d39f7d03264bb010be3158f3bd87000..34e2d4d603fae0acc8ace9afb8e3ff54 UIProcess/DeviceIdHashSaltStorage.cpp UIProcess/DisplayLink.cpp UIProcess/DisplayLinkProcessProxyClient.cpp -@@ -398,16 +399,20 @@ UIProcess/FrameLoadState.cpp +@@ -401,16 +402,20 @@ UIProcess/FrameLoadState.cpp UIProcess/FrameProcess.cpp UIProcess/GeolocationPermissionRequestManagerProxy.cpp UIProcess/GeolocationPermissionRequestProxy.cpp @@ -9911,7 +8979,7 @@ index 1a8bb4ce0d39f7d03264bb010be3158f3bd87000..34e2d4d603fae0acc8ace9afb8e3ff54 UIProcess/RemotePageDrawingAreaProxy.cpp UIProcess/RemotePageFullscreenManagerProxy.cpp UIProcess/RemotePageProxy.cpp -@@ -450,6 +455,8 @@ UIProcess/WebOpenPanelResultListenerProxy.cpp +@@ -453,6 +458,8 @@ UIProcess/WebOpenPanelResultListenerProxy.cpp UIProcess/WebPageDiagnosticLoggingClient.cpp UIProcess/WebPageGroup.cpp UIProcess/WebPageInjectedBundleClient.cpp @@ -9920,11 +8988,9 @@ index 1a8bb4ce0d39f7d03264bb010be3158f3bd87000..34e2d4d603fae0acc8ace9afb8e3ff54 UIProcess/WebPageProxy.cpp UIProcess/WebPageProxyMessageReceiverRegistration.cpp UIProcess/WebPageProxyTesting.cpp -@@ -596,7 +603,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 @@ -9933,10 +8999,10 @@ index 1a8bb4ce0d39f7d03264bb010be3158f3bd87000..34e2d4d603fae0acc8ace9afb8e3ff54 UIProcess/Media/AudioSessionRoutingArbitratorProxy.cpp UIProcess/Media/MediaUsageManager.cpp diff --git a/Source/WebKit/SourcesCocoa.txt b/Source/WebKit/SourcesCocoa.txt -index 19e2664300bd081ae5124d6b08055c028f04ebb2..5b851c95b75262264dec59503b74c2548b9ee737 100644 +index c146d8baabb0bc80396dc07d7cde88207ef02efa..b13cb0a6e8e10dcf3a068a4bde97536d490f3b52 100644 --- a/Source/WebKit/SourcesCocoa.txt +++ b/Source/WebKit/SourcesCocoa.txt -@@ -270,6 +270,7 @@ UIProcess/API/Cocoa/_WKArchiveExclusionRule.mm +@@ -272,6 +272,7 @@ UIProcess/API/Cocoa/_WKArchiveExclusionRule.mm UIProcess/API/Cocoa/_WKAttachment.mm UIProcess/API/Cocoa/_WKAutomationSession.mm UIProcess/API/Cocoa/_WKAutomationSessionConfiguration.mm @@ -9944,7 +9010,7 @@ index 19e2664300bd081ae5124d6b08055c028f04ebb2..5b851c95b75262264dec59503b74c254 UIProcess/API/Cocoa/_WKContentRuleListAction.mm UIProcess/API/Cocoa/_WKContextMenuElementInfo.mm UIProcess/API/Cocoa/_WKCustomHeaderFields.mm @no-unify -@@ -467,6 +468,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 @@ -9953,7 +9019,7 @@ index 19e2664300bd081ae5124d6b08055c028f04ebb2..5b851c95b75262264dec59503b74c254 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 @@ -9964,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 @@ -9972,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 @@ -9980,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 @@ -9990,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 @@ -10009,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 @@ -10017,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 @@ -10030,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 @@ -10042,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 0f27d0e97c1039ad5c95086c0e7eb72f4fe85db1..9ca848d9e0c78bce8b77721debf18deba76f4b2c 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(); } @@ -10058,10 +9124,10 @@ index 0f27d0e97c1039ad5c95086c0e7eb72f4fe85db1..9ca848d9e0c78bce8b77721debf18deb { return m_data.pageToCloneSessionStorageFrom.get(); diff --git a/Source/WebKit/UIProcess/API/APIPageConfiguration.h b/Source/WebKit/UIProcess/API/APIPageConfiguration.h -index ba3fed377d5f2a799fbf7b38a5bc2f03efbe7535..e4c41d0a444d12f80d0402591dfa39e8e68e4fd0 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); } @@ -10072,12 +9138,12 @@ index ba3fed377d5f2a799fbf7b38a5bc2f03efbe7535..e4c41d0a444d12f80d0402591dfa39e8 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 @@ -10096,7 +9162,7 @@ index e256b905bf9727aa7c8a48012237a6a6bc9acdbc..4e855c441af6f235f0fd8dfdd57b9bd6 copy->m_shouldTakeUIBackgroundAssertion = this->m_shouldTakeUIBackgroundAssertion; copy->m_shouldCaptureDisplayInUIProcess = this->m_shouldCaptureDisplayInUIProcess; diff --git a/Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.h b/Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.h -index d2e8261c6db000aa41697b3bb50e2bea149edcdf..500c38b81d6804f64ff891e32b2c72ed98c9a629 100644 +index af4944e5a5d373bc51995b50d1ea7c70f64ef1b3..403cfdeda26db2b648e32aa0e5f3ef6e076634f6 100644 --- a/Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.h +++ b/Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.h @@ -96,6 +96,16 @@ public: @@ -10128,10 +9194,10 @@ index d2e8261c6db000aa41697b3bb50e2bea149edcdf..500c38b81d6804f64ff891e32b2c72ed 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 fdfb6489e3b5f8b70da8918e72612c74ada771f6..fe58191302f84065523d048463b0b6b2fe71c394 100644 +index b0450278b8949985df9f39c7d7a5adbaecb55afe..ac80a31058249d467d21e64f5a053cf0f0012fe1 100644 --- a/Source/WebKit/UIProcess/API/APIUIClient.h +++ b/Source/WebKit/UIProcess/API/APIUIClient.h -@@ -115,6 +115,7 @@ public: +@@ -114,6 +114,7 @@ public: virtual void runJavaScriptAlert(WebKit::WebPageProxy&, const WTF::String&, WebKit::WebFrameProxy*, WebKit::FrameInfoData&&, Function&& completionHandler) { completionHandler(); } virtual void runJavaScriptConfirm(WebKit::WebPageProxy&, const WTF::String&, WebKit::WebFrameProxy*, WebKit::FrameInfoData&&, Function&& completionHandler) { completionHandler(false); } virtual void runJavaScriptPrompt(WebKit::WebPageProxy&, const WTF::String&, const WTF::String&, WebKit::WebFrameProxy*, WebKit::FrameInfoData&&, Function&& completionHandler) { completionHandler(WTF::String()); } @@ -10140,7 +9206,7 @@ index fdfb6489e3b5f8b70da8918e72612c74ada771f6..fe58191302f84065523d048463b0b6b2 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 @@ @@ -10183,11 +9249,11 @@ index 026121d114c5fcad84c1396be8d692625beaa3bd..edd6e5cae033124c589959a42522fde0 } #endif diff --git a/Source/WebKit/UIProcess/API/C/WKPage.cpp b/Source/WebKit/UIProcess/API/C/WKPage.cpp -index 2e9502e5767eb93b7a2d6488a113e69f953f3e4a..56969ab93991ef77dc020e0d3f7b7e4e71324416 100644 +index 908163888f737cb72569f6ff36dae276a51118eb..636ccf3834aaa47328388a008dbc2bf755ecdf70 100644 --- a/Source/WebKit/UIProcess/API/C/WKPage.cpp +++ b/Source/WebKit/UIProcess/API/C/WKPage.cpp -@@ -1899,6 +1899,13 @@ void WKPageSetPageUIClient(WKPageRef pageRef, const WKPageUIClientBase* wkClient - completionHandler(String()); +@@ -1935,6 +1935,13 @@ void WKPageSetPageUIClient(WKPageRef pageRef, const WKPageUIClientBase* wkClient + m_client.addMessageToConsole(toAPI(&page), toAPI(message.impl()), m_client.base.clientInfo); } + void handleJavaScriptDialog(WebPageProxy& page, bool accept, const String& value) final { @@ -10200,7 +9266,7 @@ index 2e9502e5767eb93b7a2d6488a113e69f953f3e4a..56969ab93991ef77dc020e0d3f7b7e4e void setStatusText(WebPageProxy* page, const String& text) final { if (!m_client.setStatusText) -@@ -1928,6 +1935,8 @@ void WKPageSetPageUIClient(WKPageRef pageRef, const WKPageUIClientBase* wkClient +@@ -1964,6 +1971,8 @@ void WKPageSetPageUIClient(WKPageRef pageRef, const WKPageUIClientBase* wkClient { if (!m_client.didNotHandleKeyEvent) return; @@ -10210,7 +9276,7 @@ index 2e9502e5767eb93b7a2d6488a113e69f953f3e4a..56969ab93991ef77dc020e0d3f7b7e4e } diff --git a/Source/WebKit/UIProcess/API/C/WKPageUIClient.h b/Source/WebKit/UIProcess/API/C/WKPageUIClient.h -index 1484f064ec89ee8c25c35df9f0a4462896699415..0622f4d5fc9144b9059395d9d0730a4ae00b7497 100644 +index fc43c44a85a0fc6bf5f8c643bd120a16ce762914..ee86fd213d25682f9b6553ec7da99bc8a812212b 100644 --- a/Source/WebKit/UIProcess/API/C/WKPageUIClient.h +++ b/Source/WebKit/UIProcess/API/C/WKPageUIClient.h @@ -98,6 +98,7 @@ typedef void (*WKPageRunBeforeUnloadConfirmPanelCallback)(WKPageRef page, WKStri @@ -10221,7 +9287,7 @@ index 1484f064ec89ee8c25c35df9f0a4462896699415..0622f4d5fc9144b9059395d9d0730a4a typedef void (*WKPageRequestStorageAccessConfirmCallback)(WKPageRef page, WKFrameRef frame, WKStringRef requestingDomain, WKStringRef currentDomain, WKPageRequestStorageAccessConfirmResultListenerRef listener, const void *clientInfo); typedef void (*WKPageTakeFocusCallback)(WKPageRef page, WKFocusDirection direction, const void *clientInfo); typedef void (*WKPageFocusCallback)(WKPageRef page, const void *clientInfo); -@@ -1364,6 +1365,7 @@ typedef struct WKPageUIClientV14 { +@@ -1365,6 +1366,7 @@ typedef struct WKPageUIClientV14 { // Version 14. WKPageRunWebAuthenticationPanelCallback runWebAuthenticationPanel; @@ -10229,7 +9295,7 @@ index 1484f064ec89ee8c25c35df9f0a4462896699415..0622f4d5fc9144b9059395d9d0730a4a } WKPageUIClientV14; typedef struct WKPageUIClientV15 { -@@ -1471,6 +1473,7 @@ typedef struct WKPageUIClientV15 { +@@ -1472,6 +1474,7 @@ typedef struct WKPageUIClientV15 { // Version 14. WKPageRunWebAuthenticationPanelCallback runWebAuthenticationPanel; @@ -10237,7 +9303,7 @@ index 1484f064ec89ee8c25c35df9f0a4462896699415..0622f4d5fc9144b9059395d9d0730a4a // Version 15. WKPageDecidePolicyForSpeechRecognitionPermissionRequestCallback decidePolicyForSpeechRecognitionPermissionRequest; -@@ -1582,6 +1585,7 @@ typedef struct WKPageUIClientV16 { +@@ -1583,6 +1586,7 @@ typedef struct WKPageUIClientV16 { // Version 14. WKPageRunWebAuthenticationPanelCallback runWebAuthenticationPanel; @@ -10245,7 +9311,7 @@ index 1484f064ec89ee8c25c35df9f0a4462896699415..0622f4d5fc9144b9059395d9d0730a4a // Version 15. WKPageDecidePolicyForSpeechRecognitionPermissionRequestCallback decidePolicyForSpeechRecognitionPermissionRequest; -@@ -1696,6 +1700,7 @@ typedef struct WKPageUIClientV17 { +@@ -1697,6 +1701,7 @@ typedef struct WKPageUIClientV17 { // Version 14. WKPageRunWebAuthenticationPanelCallback runWebAuthenticationPanel; @@ -10253,7 +9319,7 @@ index 1484f064ec89ee8c25c35df9f0a4462896699415..0622f4d5fc9144b9059395d9d0730a4a // Version 15. WKPageDecidePolicyForSpeechRecognitionPermissionRequestCallback decidePolicyForSpeechRecognitionPermissionRequest; -@@ -1810,6 +1815,7 @@ typedef struct WKPageUIClientV18 { +@@ -1811,6 +1816,7 @@ typedef struct WKPageUIClientV18 { // Version 14. WKPageRunWebAuthenticationPanelCallback runWebAuthenticationPanel; @@ -10261,7 +9327,7 @@ index 1484f064ec89ee8c25c35df9f0a4462896699415..0622f4d5fc9144b9059395d9d0730a4a // Version 15. WKPageDecidePolicyForSpeechRecognitionPermissionRequestCallback decidePolicyForSpeechRecognitionPermissionRequest; -@@ -1926,6 +1932,7 @@ typedef struct WKPageUIClientV19 { +@@ -1927,6 +1933,7 @@ typedef struct WKPageUIClientV19 { // Version 14. WKPageRunWebAuthenticationPanelCallback runWebAuthenticationPanel; @@ -10270,7 +9336,7 @@ index 1484f064ec89ee8c25c35df9f0a4462896699415..0622f4d5fc9144b9059395d9d0730a4a // Version 15. WKPageDecidePolicyForSpeechRecognitionPermissionRequestCallback decidePolicyForSpeechRecognitionPermissionRequest; diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm b/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm -index 53350803b70ce91ba7d326b94435f7cbca375afa..4595ba4208f1a2e7864b2b0ed6e66db42c2d00a6 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 @@ -10291,7 +9357,7 @@ index 53350803b70ce91ba7d326b94435f7cbca375afa..4595ba4208f1a2e7864b2b0ed6e66db4 { return _preferences->inactiveMediaCaptureStreamRepromptIntervalInMinutes(); diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKPreferencesPrivate.h b/Source/WebKit/UIProcess/API/Cocoa/WKPreferencesPrivate.h -index 34d46d52f796ed9b06fafabd03864229cdd307ab..a74a1ea9f9a55421bd569d958d7c0baa8618ca6d 100644 +index 41525c8980f698aa4326e7d4d232311cee2c43d5..1f1745431c6cc7af66b47dd5d015c52389626e6f 100644 --- a/Source/WebKit/UIProcess/API/Cocoa/WKPreferencesPrivate.h +++ b/Source/WebKit/UIProcess/API/Cocoa/WKPreferencesPrivate.h @@ -119,6 +119,7 @@ typedef NS_ENUM(NSInteger, _WKPitchCorrectionAlgorithm) { @@ -10303,10 +9369,10 @@ index 34d46d52f796ed9b06fafabd03864229cdd307ab..a74a1ea9f9a55421bd569d958d7c0baa @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 ef512c7ba09298b2291d0248988574163ff2e7c8..d42e7f9f7b66840b68e61ce46b4bbd6254518ef7 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; @@ -10320,10 +9386,10 @@ index ef512c7ba09298b2291d0248988574163ff2e7c8..d42e7f9f7b66840b68e61ce46b4bbd62 /*! @abstract A delegate to request permission for microphone audio and camera video access. @param webView The web view invoking the delegate method. diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.h b/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.h -index eff4cf557033561ab20762d93a58c2d71f5505f0..9418e2c51e50190dee2b5d7c854eacea8c5a4b76 100644 +index 930357ac3469195e9f33d5ffce92777018bb0b13..f62555ec562f8416976d31692e8fb1751a04d458 100644 --- a/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.h +++ b/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.h -@@ -126,6 +126,8 @@ WK_CLASS_AVAILABLE(macos(10.11), ios(9.0)) +@@ -138,6 +138,8 @@ WK_CLASS_AVAILABLE(macos(10.11), ios(9.0)) #endif #endif @@ -10333,7 +9399,7 @@ index eff4cf557033561ab20762d93a58c2d71f5505f0..9418e2c51e50190dee2b5d7c854eacea NS_ASSUME_NONNULL_END diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm b/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm -index 97a87094e648a15e2501fb39a46bf0fbb4cb50d9..b08c212a0372175859645f7dba0c704fe865451c 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 @@ @@ -10344,7 +9410,7 @@ index 97a87094e648a15e2501fb39a46bf0fbb4cb50d9..b08c212a0372175859645f7dba0c704f #import #import #import -@@ -552,6 +553,11 @@ - (void)removeDataOfTypes:(NSSet *)dataTypes modifiedSince:(NSDate *)date comple +@@ -523,6 +524,11 @@ - (void)removeDataOfTypes:(NSSet *)dataTypes modifiedSince:(NSDate *)date comple }); } @@ -10496,7 +9562,7 @@ index 426c7cbc897e22fd2e962dd3744959975d6ae6a0..f7a52359d7d42f970ef424b6c702b0ec @property (nonatomic) BOOL processSwapsOnNavigationWithinSameNonHTTPFamilyProtocol WK_API_AVAILABLE(macos(12.0), ios(15.0)); @property (nonatomic) BOOL prewarmsProcessesAutomatically WK_API_AVAILABLE(macos(10.14.4), ios(12.2)); diff --git a/Source/WebKit/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm b/Source/WebKit/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm -index 38b516d32edc4038508c664e0c4dc804cd477787..891dd8b2451ab771e451ea8ef74906d364e76007 100644 +index 7ccfd9a46cd024c8f6644594b9d0cde8ae7e60db..921ec683dce77583f24d27a0b1b6f478242dfb42 100644 --- a/Source/WebKit/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm +++ b/Source/WebKit/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm @@ -241,6 +241,16 @@ - (BOOL)processSwapsOnNavigation @@ -10529,7 +9595,7 @@ index 4974e14214e2bb3e982325b885bab33e54f83998..cacdf8c71fab248d38d2faf03f7affdc typedef NS_ENUM(NSInteger, _WKUserStyleLevel) { _WKUserStyleUserLevel, diff --git a/Source/WebKit/UIProcess/API/Cocoa/_WKWebPushSubscriptionData.mm b/Source/WebKit/UIProcess/API/Cocoa/_WKWebPushSubscriptionData.mm -index 0a78daba00961bf10564a0b53067960b71d8b61d..696408b77c82e205a134edf2ee17ff971af226f3 100644 +index d139d35f09a999e2c85f48799a399d791d421ffd..f79c073291c6071c566220a40f7dd4bbc57192a1 100644 --- a/Source/WebKit/UIProcess/API/Cocoa/_WKWebPushSubscriptionData.mm +++ b/Source/WebKit/UIProcess/API/Cocoa/_WKWebPushSubscriptionData.mm @@ -28,6 +28,9 @@ @@ -10745,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 9b6d8db85df969e609de036fac67374226ecd48e..2b293d5f24e562f06859432580f2cdfe40f8b9a6 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: @@ -10829,10 +9895,10 @@ 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 7d8de31fc7e373871e89ab41fc8f3a63fceea1c6..7d2785ed1798bd661d0f98e5ab68037d3cd02c51 100644 +index df1381b577be94114401e1faaf1979183d82614f..fb8bb4c7676154bb284a06fc3f05d3b45805e938 100644 --- a/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp +++ b/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp -@@ -37,6 +37,7 @@ +@@ -39,6 +39,7 @@ #include "WebContextMenuItem.h" #include "WebContextMenuItemData.h" #include "WebFrameProxy.h" @@ -10840,7 +9906,7 @@ index 7d8de31fc7e373871e89ab41fc8f3a63fceea1c6..7d2785ed1798bd661d0f98e5ab68037d #include "WebKitAuthenticationRequestPrivate.h" #include "WebKitBackForwardListPrivate.h" #include "WebKitContextMenuClient.h" -@@ -150,6 +151,7 @@ enum { +@@ -152,6 +153,7 @@ enum { CLOSE, SCRIPT_DIALOG, @@ -10848,7 +9914,7 @@ index 7d8de31fc7e373871e89ab41fc8f3a63fceea1c6..7d2785ed1798bd661d0f98e5ab68037d DECIDE_POLICY, PERMISSION_REQUEST, -@@ -518,6 +520,16 @@ GRefPtr WebKitWebViewClient::showOptionMenu(WebKitPopupMenu& p +@@ -520,6 +522,13 @@ GRefPtr WebKitWebViewClient::showOptionMenu(WebKitPopupMenu& p void WebKitWebViewClient::frameDisplayed(WKWPE::View&) { @@ -10857,15 +9923,12 @@ index 7d8de31fc7e373871e89ab41fc8f3a63fceea1c6..7d2785ed1798bd661d0f98e5ab68037d + 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) { -@@ -534,6 +546,18 @@ void WebKitWebViewClient::frameDisplayed(WKWPE::View&) +@@ -536,6 +545,13 @@ void WebKitWebViewClient::frameDisplayed(WKWPE::View&) } } @@ -10874,17 +9937,12 @@ index 7d8de31fc7e373871e89ab41fc8f3a63fceea1c6..7d2785ed1798bd661d0f98e5ab68037d +{ + 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); -@@ -620,7 +644,7 @@ static gboolean webkitWebViewDecidePolicy(WebKitWebView*, WebKitPolicyDecision* +@@ -622,7 +638,7 @@ static gboolean webkitWebViewDecidePolicy(WebKitWebView*, WebKitPolicyDecision* static gboolean webkitWebViewPermissionRequest(WebKitWebView*, WebKitPermissionRequest* request) { @@ -10893,7 +9951,7 @@ index 7d8de31fc7e373871e89ab41fc8f3a63fceea1c6..7d2785ed1798bd661d0f98e5ab68037d if (WEBKIT_IS_POINTER_LOCK_PERMISSION_REQUEST(request)) { webkit_permission_request_allow(request); return TRUE; -@@ -943,6 +967,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); @@ -10904,7 +9962,7 @@ index 7d8de31fc7e373871e89ab41fc8f3a63fceea1c6..7d2785ed1798bd661d0f98e5ab68037d webkitWebViewCreatePage(webView, WTFMove(configuration)); webkitWebContextWebViewCreated(priv->context.get(), webView); -@@ -1982,6 +2010,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); @@ -10920,7 +9978,7 @@ index 7d8de31fc7e373871e89ab41fc8f3a63fceea1c6..7d2785ed1798bd661d0f98e5ab68037d /** * WebKitWebView::decide-policy: * @web_view: the #WebKitWebView on which the signal is emitted -@@ -2767,6 +2804,23 @@ void webkitWebViewRunJavaScriptBeforeUnloadConfirm(WebKitWebView* webView, const +@@ -2769,6 +2798,23 @@ void webkitWebViewRunJavaScriptBeforeUnloadConfirm(WebKitWebView* webView, const webkit_script_dialog_unref(webView->priv->currentScriptDialog); } @@ -10969,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 @@ -10994,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; @@ -11107,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 597dcdbd94e8899f60fc9a0566698fd142170926..8d7f77586e25d299c3043128536fd3801eccde4a 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 } @@ -11122,7 +10180,7 @@ index 597dcdbd94e8899f60fc9a0566698fd142170926..8d7f77586e25d299c3043128536fd380 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({ }); } @@ -11165,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 @@ -11196,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 76f77a9a50f721e2d71def6ca5c81ad68274653a..c9b583bd70d87586fd7ea727c20ada6f01dffb72 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 @@ @@ -11212,7 +10265,7 @@ index 76f77a9a50f721e2d71def6ca5c81ad68274653a..c9b583bd70d87586fd7ea727c20ada6f #include "WebDateTimePicker.h" #include "WebKitPopupMenu.h" #include -@@ -55,6 +58,12 @@ +@@ -58,6 +61,12 @@ #include #endif @@ -11225,7 +10278,7 @@ index 76f77a9a50f721e2d71def6ca5c81ad68274653a..c9b583bd70d87586fd7ea727c20ada6f 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 @@ -11244,7 +10297,7 @@ index 76f77a9a50f721e2d71def6ca5c81ad68274653a..c9b583bd70d87586fd7ea727c20ada6f } RefPtr PageClientImpl::createDateTimePicker(WebPageProxy& page) -@@ -518,6 +527,64 @@ void PageClientImpl::selectionDidChange() +@@ -546,6 +555,37 @@ void PageClientImpl::selectionDidChange() m_view.selectionDidChange(); } @@ -11276,40 +10329,13 @@ index 76f77a9a50f721e2d71def6ca5c81ad68274653a..c9b583bd70d87586fd7ea727c20ada6f + 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(); -@@ -528,4 +595,11 @@ void PageClientImpl::callAfterNextPresentationUpdate(CompletionHandler&& +@@ -556,4 +596,11 @@ void PageClientImpl::callAfterNextPresentationUpdate(CompletionHandler&& m_view.callAfterNextPresentationUpdate(WTFMove(callback)); } @@ -11322,18 +10348,16 @@ index 76f77a9a50f721e2d71def6ca5c81ad68274653a..c9b583bd70d87586fd7ea727c20ada6f + } // 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; @@ -11464,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*; @@ -11483,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); @@ -11507,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 @@ -11525,19 +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 8c97bd6e955005ba6246715aac63c4d675f5a713..1440dd5233d20ada05fee01a1916ad784a745214 100644 +index b351f11524a994ac6136daf9c277419fce44df0f..31679e63462cfaceeac00ebf31985c118ff1e4e4 100644 --- a/Source/WebKit/UIProcess/Automation/WebAutomationSession.h +++ b/Source/WebKit/UIProcess/Automation/WebAutomationSession.h -@@ -279,6 +279,8 @@ 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&); -@@ -329,7 +331,6 @@ private: + +@@ -338,7 +340,6 @@ private: // Get base64-encoded PNG data from a bitmap. static std::optional platformGetBase64EncodedPNGData(WebCore::ShareableBitmap::Handle&&); @@ -11546,10 +10564,10 @@ index 8c97bd6e955005ba6246715aac63c4d675f5a713..1440dd5233d20ada05fee01a1916ad78 // 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 601d3874b710ca87c18a2dbcfbfb7368ac61d602..26c9ae063679b6f97be8c6cce8432aad3e90b3a4 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)) @@ -11562,10 +10580,10 @@ index 601d3874b710ca87c18a2dbcfbfb7368ac61d602..26c9ae063679b6f97be8c6cce8432aad platformGetLaunchOptions(launchOptions); } diff --git a/Source/WebKit/UIProcess/AuxiliaryProcessProxy.h b/Source/WebKit/UIProcess/AuxiliaryProcessProxy.h -index eed9d40f00e29fd1e36a2c7893639544439e53ce..eeb0b85018d13f46279eb5b9d281fdc34de92e02 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(); @@ -11584,14 +10602,18 @@ index eed9d40f00e29fd1e36a2c7893639544439e53ce..eeb0b85018d13f46279eb5b9d281fdc3 // Connection::Client diff --git a/Source/WebKit/UIProcess/BackingStore.h b/Source/WebKit/UIProcess/BackingStore.h -index 945c62704e0b25f04e9ee4be88b21f88aeda8bd9..409c1c560b2462bf59f19dfee7941748b54fd22c 100644 +index 945c62704e0b25f04e9ee4be88b21f88aeda8bd9..b57ea0f359ab586c88a7d463f2be437b780c267c 100644 --- a/Source/WebKit/UIProcess/BackingStore.h +++ b/Source/WebKit/UIProcess/BackingStore.h -@@ -67,6 +67,7 @@ public: +@@ -67,6 +67,11 @@ public: float deviceScaleFactor() const { return m_deviceScaleFactor; } void paint(PlatformPaintContextPtr, const WebCore::IntRect&); ++#if PLATFORM(GTK) + RefPtr surface() const { return m_surface; } ++#elif USE(SKIA) ++ sk_sp surface() const { return m_surface; } ++#endif void incorporateUpdate(UpdateInfo&&); private: @@ -11719,10 +10741,10 @@ index 89d125f7742f81ead8c50f218ecb1771b8000636..baa6cf58ad502c6c033ee6293a6cc8d4 namespace WebKit { diff --git a/Source/WebKit/UIProcess/Cocoa/UIDelegate.h b/Source/WebKit/UIProcess/Cocoa/UIDelegate.h -index 8d9915d0802f215ea2a3e298b8653636338250b9..50e0ad091bcfc6356708ccfaf242787188e49a82 100644 +index 554009ae0e083f7721f97a3952f0f17b7d8d7d9d..fbf643cc61caab6389e4bc727adb897ebbb6a109 100644 --- a/Source/WebKit/UIProcess/Cocoa/UIDelegate.h +++ b/Source/WebKit/UIProcess/Cocoa/UIDelegate.h -@@ -102,6 +102,7 @@ private: +@@ -103,6 +103,7 @@ private: void runJavaScriptAlert(WebPageProxy&, const WTF::String&, WebFrameProxy*, FrameInfoData&&, Function&& completionHandler) final; void runJavaScriptConfirm(WebPageProxy&, const WTF::String&, WebFrameProxy*, FrameInfoData&&, Function&& completionHandler) final; void runJavaScriptPrompt(WebPageProxy&, const WTF::String&, const WTF::String&, WebFrameProxy*, FrameInfoData&&, Function&&) final; @@ -11730,7 +10752,7 @@ index 8d9915d0802f215ea2a3e298b8653636338250b9..50e0ad091bcfc6356708ccfaf2427871 void presentStorageAccessConfirmDialog(const WTF::String& requestingDomain, const WTF::String& currentDomain, CompletionHandler&&); void requestStorageAccessConfirm(WebPageProxy&, WebFrameProxy*, const WebCore::RegistrableDomain& requestingDomain, const WebCore::RegistrableDomain& currentDomain, std::optional&&, CompletionHandler&&) final; void decidePolicyForGeolocationPermissionRequest(WebPageProxy&, WebFrameProxy&, const FrameInfoData&, Function&) final; -@@ -220,6 +221,7 @@ private: +@@ -221,6 +222,7 @@ private: bool webViewRunJavaScriptAlertPanelWithMessageInitiatedByFrameCompletionHandler : 1; bool webViewRunJavaScriptConfirmPanelWithMessageInitiatedByFrameCompletionHandler : 1; bool webViewRunJavaScriptTextInputPanelWithPromptDefaultTextInitiatedByFrameCompletionHandler : 1; @@ -11739,10 +10761,10 @@ index 8d9915d0802f215ea2a3e298b8653636338250b9..50e0ad091bcfc6356708ccfaf2427871 bool webViewRequestStorageAccessPanelForDomainUnderCurrentDomainForQuirkDomainsCompletionHandler : 1; bool webViewRunBeforeUnloadConfirmPanelWithMessageInitiatedByFrameCompletionHandler : 1; diff --git a/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm b/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm -index da5818f79cb0f7a384af46f4d39eae4d2cf573df..44bf65e9a20428656d7eac39b9470c72e97987cf 100644 +index 30de92c390b49a383369fb59397810187f752c8a..0752cc7cefcc4c3579eafca4fa1cc6e4045d5d84 100644 --- a/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm +++ b/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm -@@ -135,6 +135,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:)]; @@ -11750,7 +10772,7 @@ index da5818f79cb0f7a384af46f4d39eae4d2cf573df..44bf65e9a20428656d7eac39b9470c72 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:)]; -@@ -466,6 +467,15 @@ void UIDelegate::UIClient::runJavaScriptPrompt(WebPageProxy& page, const WTF::St +@@ -495,6 +496,15 @@ void UIDelegate::UIClient::runJavaScriptPrompt(WebPageProxy& page, const WTF::St }).get()]; } @@ -11760,17 +10782,17 @@ index da5818f79cb0f7a384af46f4d39eae4d2cf573df..44bf65e9a20428656d7eac39b9470c72 + auto delegate = m_uiDelegate->m_delegate.get(); + if (!delegate) + return; -+ [delegate webView:m_uiDelegate->m_webView.get().get() handleJavaScriptDialog:accept value:value]; ++ [delegate webView:m_uiDelegate->m_webView.get().get() handleJavaScriptDialog:accept value:value.createNSString().get()]; +} + void UIDelegate::UIClient::requestStorageAccessConfirm(WebPageProxy& webPageProxy, WebFrameProxy*, const WebCore::RegistrableDomain& requestingDomain, const WebCore::RegistrableDomain& currentDomain, std::optional&& organizationStorageAccessPromptQuirk, CompletionHandler&& completionHandler) { RefPtr uiDelegate = m_uiDelegate.get(); diff --git a/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm b/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm -index c0c9d8098ce76a6c2f7860165f990a854fbcc0e9..082322d49bf84f3b15e66c9cb89125d64f16d80a 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" @@ -11779,13 +10801,13 @@ index c0c9d8098ce76a6c2f7860165f990a854fbcc0e9..082322d49bf84f3b15e66c9cb89125d6 +#import "PasteboardTypes.h" #import "PlatformXRSystem.h" #import "PlaybackSessionManagerProxy.h" - #import "QuickLookThumbnailLoader.h" -@@ -326,11 +328,86 @@ bool WebPageProxy::scrollingUpdatesDisabledForTesting() + #import "RemoteLayerTreeTransaction.h" +@@ -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]; ++ NSPasteboard *pasteboard = [NSPasteboard pasteboardWithName: m_overrideDragPasteboardName.createNSString().get()]; + + m_dragSelectionData = String([pasteboard name]); + if (auto replyID = grantAccessToCurrentPasteboardData(String([pasteboard name]), [] () { })) @@ -11798,7 +10820,7 @@ index c0c9d8098ce76a6c2f7860165f990a854fbcc0e9..082322d49bf84f3b15e66c9cb89125d6 + dragCancelled(); + return; + } -+ NSString *utiType = attachment->utiType(); ++ NSString *utiType = attachment->utiType().createNSString().get(); + if (!utiType.length) { + dragCancelled(); + return; @@ -11806,7 +10828,7 @@ index c0c9d8098ce76a6c2f7860165f990a854fbcc0e9..082322d49bf84f3b15e66c9cb89125d6 + + for (size_t index = 0; index < info.additionalTypesAndData.size(); ++index) { + auto nsData = info.additionalTypesAndData[index].second->createNSData(); -+ [pasteboard setData:nsData.get() forType:info.additionalTypesAndData[index].first]; ++ [pasteboard setData:nsData.get() forType:info.additionalTypesAndData[index].first.createNSString().get()]; + } + } else { + [pasteboard setString:@"" forType:PasteboardTypes::WebDummyPboardType]; @@ -11816,7 +10838,7 @@ index c0c9d8098ce76a6c2f7860165f990a854fbcc0e9..082322d49bf84f3b15e66c9cb89125d6 + } + if (RefPtr pageClient = this->pageClient()) - pageClient->startDrag(dragItem, WTFMove(dragImageHandle)); + pageClient->startDrag(dragItem, WTFMove(dragImageHandle), elementID); } -#endif @@ -11869,19 +10891,19 @@ index c0c9d8098ce76a6c2f7860165f990a854fbcc0e9..082322d49bf84f3b15e66c9cb89125d6 #if ENABLE(ATTACHMENT_ELEMENT) diff --git a/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm b/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm -index d14a7dfa79daabce7bd835aa76625937e6107aad..0907c8ac8e9407231df5661180d3766b5c263dfd 100644 +index 7f9f0ecf631ab772460603adb4d0426e1d468085..a98a1388e589d5f079fe29f5b6091aa022b6ecfc 100644 --- a/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm +++ b/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm -@@ -432,7 +432,7 @@ ALLOW_DEPRECATED_DECLARATIONS_END +@@ -436,7 +436,7 @@ ALLOW_DEPRECATED_DECLARATIONS_END auto screenProperties = WebCore::collectScreenProperties(); parameters.screenProperties = WTFMove(screenProperties); #if PLATFORM(MAC) - parameters.useOverlayScrollbars = ([NSScroller preferredScrollerStyle] == NSScrollerStyleOverlay); + parameters.useOverlayScrollbars = m_configuration->forceOverlayScrollbars() || ([NSScroller preferredScrollerStyle] == NSScrollerStyleOverlay); #endif - - #if (PLATFORM(IOS) || PLATFORM(VISION)) && HAVE(AGX_COMPILER_SERVICE) -@@ -841,8 +841,8 @@ void WebProcessPool::registerNotificationObservers() + + #if PLATFORM(VISION) +@@ -835,8 +835,8 @@ void WebProcessPool::registerNotificationObservers() }]; m_scrollerStyleNotificationObserver = [[NSNotificationCenter defaultCenter] addObserverForName:NSPreferredScrollerStyleDidChangeNotification object:nil queue:[NSOperationQueue currentQueue] usingBlock:^(NSNotification *notification) { @@ -11893,7 +10915,7 @@ index d14a7dfa79daabce7bd835aa76625937e6107aad..0907c8ac8e9407231df5661180d3766b 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 9b45c78e2fd36e825c4e67d8e824771128c8fe15..9f748e729fce8103278b3888552d5c374ed6bc67 100644 +index 183a2dc44f4d2921e68a6ff5fd2fb0fb815753af..f9e80d965f5b7cd64049d85e57e668d6f2a73d87 100644 --- a/Source/WebKit/UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp +++ b/Source/WebKit/UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp @@ -33,6 +33,7 @@ @@ -11904,7 +10926,7 @@ index 9b45c78e2fd36e825c4e67d8e824771128c8fe15..9f748e729fce8103278b3888552d5c37 #include "WebPageProxy.h" #include "WebPreferences.h" #include "WebProcessPool.h" -@@ -40,8 +41,10 @@ +@@ -40,15 +41,26 @@ #include #include #include @@ -11913,23 +10935,25 @@ index 9b45c78e2fd36e825c4e67d8e824771128c8fe15..9f748e729fce8103278b3888552d5c37 #if PLATFORM(GTK) +#include "WebKitWebViewBasePrivate.h" #include ++#include ++#include ++#include ++#include #endif -@@ -49,6 +52,13 @@ + #if USE(GLIB_EVENT_LOOP) #include #endif +#if PLATFORM(WIN) -+#include +#include +#include -+#include +#endif + namespace WebKit { using namespace WebCore; -@@ -182,6 +192,11 @@ void DrawingAreaProxyCoordinatedGraphics::deviceScaleFactorDidChange(CompletionH +@@ -182,6 +194,11 @@ void DrawingAreaProxyCoordinatedGraphics::deviceScaleFactorDidChange(CompletionH sendWithAsyncReply(Messages::DrawingArea::SetDeviceScaleFactor(m_webPageProxy->deviceScaleFactor()), WTFMove(completionHandler)); } @@ -11941,38 +10965,20 @@ index 9b45c78e2fd36e825c4e67d8e824771128c8fe15..9f748e729fce8103278b3888552d5c37 void DrawingAreaProxyCoordinatedGraphics::setBackingStoreIsDiscardable(bool isBackingStoreDiscardable) { #if !PLATFORM(WPE) -@@ -243,6 +258,45 @@ void DrawingAreaProxyCoordinatedGraphics::updateAcceleratedCompositingMode(uint6 +@@ -243,6 +260,59 @@ void DrawingAreaProxyCoordinatedGraphics::updateAcceleratedCompositingMode(uint6 updateAcceleratedCompositingMode(layerTreeContext); } -+#if PLATFORM(WIN) -+void DrawingAreaProxyCoordinatedGraphics::didChangeAcceleratedCompositingMode(bool enabled) -+{ -+ m_isInAcceleratedCompositingMode = enabled; -+} -+#endif -+ -+#if !PLATFORM(WPE) ++#if PLATFORM(GTK) +void DrawingAreaProxyCoordinatedGraphics::captureFrame() +{ + RefPtr surface; -+#if PLATFORM(WIN) -+ HWndDC dc; -+ if (m_isInAcceleratedCompositingMode) { -+ dc.setHWnd(reinterpret_cast(protectedWebPageProxy()->viewWidget())); -+ surface = adoptRef(cairo_win32_surface_create(dc)); -+#else + if (isInAcceleratedCompositingMode()) { -+# if PLATFORM(GTK) + AcceleratedBackingStore* backingStore = webkitWebViewBaseGetAcceleratedBackingStore(WEBKIT_WEB_VIEW_BASE(protectedWebPageProxy()->viewWidget())); + if (!backingStore) + return; + + surface = backingStore->surface(); -+# else -+ fprintf(stderr, "captureFrame() is not supported in accelerated compositing mode on this platform.\n"); -+# endif -+#endif + } else if (m_backingStore) { + surface = m_backingStore->surface(); + } @@ -11980,14 +10986,46 @@ index 9b45c78e2fd36e825c4e67d8e824771128c8fe15..9f748e729fce8103278b3888552d5c37 + 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 ++#endif // PLATFORM(GTK) ++ ++#if PLATFORM(WIN) ++void DrawingAreaProxyCoordinatedGraphics::captureFrame() ++{ ++ if (!m_backingStore) ++ return; ++ auto surface = m_backingStore->surface(); ++ if (!surface) ++ return; ++ auto image = surface->makeImageSnapshot(); ++ if (!image) ++ return; ++ protectedWebPageProxy()->inspectorController().didPaint(WTFMove(image)); ++} ++#endif // PLATFORM(WIN) + bool DrawingAreaProxyCoordinatedGraphics::alwaysUseCompositing() const { if (!m_webPageProxy) -@@ -310,6 +364,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(); @@ -12001,7 +11039,7 @@ index 9b45c78e2fd36e825c4e67d8e824771128c8fe15..9f748e729fce8103278b3888552d5c37 #if !PLATFORM(WPE) diff --git a/Source/WebKit/UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.h b/Source/WebKit/UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.h -index 9c2bde0db0e4032a32e6ae02dc45af335df92f7a..7ae72e6c791c264ea7e0db4c93a0422b5b699e19 100644 +index 9c2bde0db0e4032a32e6ae02dc45af335df92f7a..3f3a58ee9b0f5c0ddad84f41cf3acd6199d81c37 100644 --- a/Source/WebKit/UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.h +++ b/Source/WebKit/UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.h @@ -29,6 +29,7 @@ @@ -12023,17 +11061,7 @@ index 9c2bde0db0e4032a32e6ae02dc45af335df92f7a..7ae72e6c791c264ea7e0db4c93a0422b void dispatchAfterEnsuringDrawing(CompletionHandler&&); -@@ -86,6 +91,9 @@ private: - void exitAcceleratedCompositingMode(uint64_t backingStoreStateID, UpdateInfo&&) override; - void updateAcceleratedCompositingMode(uint64_t backingStoreStateID, const LayerTreeContext&) override; - void dispatchPresentationCallbacksAfterFlushingLayers(IPC::Connection&, Vector&&) override; -+#if PLATFORM(WIN) -+ void didChangeAcceleratedCompositingMode(bool enabled) override; -+#endif - - bool shouldSendWheelEventsToEventDispatcher() const override { return true; } - -@@ -129,6 +137,7 @@ private: +@@ -129,6 +134,7 @@ private: // The last size we sent to the web process. WebCore::IntSize m_lastSentSize; @@ -12041,19 +11069,8 @@ index 9c2bde0db0e4032a32e6ae02dc45af335df92f7a..7ae72e6c791c264ea7e0db4c93a0422b #if !PLATFORM(WPE) bool m_isBackingStoreDiscardable { true }; -@@ -137,6 +146,10 @@ private: - RunLoop::Timer m_discardBackingStoreTimer; - #endif - std::unique_ptr m_drawingMonitor; -+ -+#if PLATFORM(WIN) -+ bool m_isInAcceleratedCompositingMode { false }; -+#endif - }; - - } // namespace WebKit diff --git a/Source/WebKit/UIProcess/Downloads/DownloadProxy.cpp b/Source/WebKit/UIProcess/Downloads/DownloadProxy.cpp -index 5d0385c213e4951ca9bec3c17bd2135887348cb0..634193dc71e82245b5017709bb93cfb5fdfede83 100644 +index bdc3efe299296ef6ef10d32672e22fba05ca230c..a24e9c7e4b0da65099326b6921ed03b4deb4cc86 100644 --- a/Source/WebKit/UIProcess/Downloads/DownloadProxy.cpp +++ b/Source/WebKit/UIProcess/Downloads/DownloadProxy.cpp @@ -41,8 +41,10 @@ @@ -12067,7 +11084,7 @@ index 5d0385c213e4951ca9bec3c17bd2135887348cb0..634193dc71e82245b5017709bb93cfb5 #if PLATFORM(MAC) #include -@@ -89,7 +91,10 @@ DownloadProxy::DownloadProxy(DownloadProxyMap& downloadProxyMap, WebsiteDataStor +@@ -66,7 +68,10 @@ DownloadProxy::DownloadProxy(DownloadProxyMap& downloadProxyMap, WebsiteDataStor #if HAVE(MODERN_DOWNLOADPROGRESS) , m_assertion(ProcessAssertion::create(getCurrentProcessID(), "WebKit DownloadProxy DecideDestination"_s, ProcessAssertionType::FinishTaskInterruptable)) #endif @@ -12078,7 +11095,7 @@ index 5d0385c213e4951ca9bec3c17bd2135887348cb0..634193dc71e82245b5017709bb93cfb5 } DownloadProxy::~DownloadProxy() -@@ -109,12 +114,15 @@ void DownloadProxy::cancel(CompletionHandler&& completionHandl +@@ -86,12 +91,15 @@ void DownloadProxy::cancel(CompletionHandler&& completionHandl { m_downloadIsCancelled = true; if (m_dataStore) { @@ -12095,7 +11112,7 @@ index 5d0385c213e4951ca9bec3c17bd2135887348cb0..634193dc71e82245b5017709bb93cfb5 if (RefPtr downloadProxyMap = protectedThis->m_downloadProxyMap.get()) downloadProxyMap->downloadFinished(*protectedThis); }); -@@ -186,6 +194,33 @@ void DownloadProxy::decideDestinationWithSuggestedFilename(const WebCore::Resour +@@ -163,6 +171,33 @@ void DownloadProxy::decideDestinationWithSuggestedFilename(const WebCore::Resour suggestedFilename = m_suggestedFilename; suggestedFilename = MIMETypeRegistry::appendFileExtensionIfNecessary(suggestedFilename, response.mimeType()); @@ -12129,8 +11146,8 @@ index 5d0385c213e4951ca9bec3c17bd2135887348cb0..634193dc71e82245b5017709bb93cfb5 protectedClient()->decideDestinationWithSuggestedFilename(*this, response, ResourceResponseBase::sanitizeSuggestedFilename(suggestedFilename), [this, protectedThis = Ref { *this }, completionHandler = WTFMove(completionHandler)] (AllowOverwrite allowOverwrite, String destination) mutable { SandboxExtension::Handle sandboxExtensionHandle; if (!destination.isNull()) { -@@ -250,6 +285,8 @@ void DownloadProxy::didFinish() - m_client->didFinish(*this); +@@ -227,6 +262,8 @@ void DownloadProxy::didFinish() + protectedClient()->didFinish(*this); if (m_downloadIsCancelled) return; + if (auto* instrumentation = m_dataStore->downloadInstrumentation()) @@ -12138,17 +11155,17 @@ index 5d0385c213e4951ca9bec3c17bd2135887348cb0..634193dc71e82245b5017709bb93cfb5 // This can cause the DownloadProxy object to be deleted. if (RefPtr downloadProxyMap = m_downloadProxyMap.get()) -@@ -264,6 +301,8 @@ void DownloadProxy::didFail(const ResourceError& error, std::span +@@ -241,6 +278,8 @@ void DownloadProxy::didFail(const ResourceError& error, std::span m_legacyResumeData = createData(resumeData); - m_client->didFail(*this, error, m_legacyResumeData.get()); + protectedClient()->didFail(*this, error, m_legacyResumeData.get()); + if (auto* instrumentation = m_dataStore->downloadInstrumentation()) + instrumentation->downloadFinished(m_uuid, error.localizedDescription()); // This can cause the DownloadProxy object to be deleted. if (RefPtr downloadProxyMap = m_downloadProxyMap.get()) diff --git a/Source/WebKit/UIProcess/Downloads/DownloadProxy.h b/Source/WebKit/UIProcess/Downloads/DownloadProxy.h -index d82b401d7d58a34fadd38c61ef3b0f521ed432e4..9403574a7d238282998065729ec9e9d165c37f2f 100644 +index 9a92a8cde3b5d1da0fbbf5fe7c549cebb8a7f2f7..9ce201ca2d7aa002c7bd389f1fe03edfb306df5d 100644 --- a/Source/WebKit/UIProcess/Downloads/DownloadProxy.h +++ b/Source/WebKit/UIProcess/Downloads/DownloadProxy.h @@ -166,6 +166,7 @@ private: @@ -12160,334 +11177,23 @@ index d82b401d7d58a34fadd38c61ef3b0f521ed432e4..9403574a7d238282998065729ec9e9d1 } // namespace WebKit diff --git a/Source/WebKit/UIProcess/DrawingAreaProxy.h b/Source/WebKit/UIProcess/DrawingAreaProxy.h -index e1f55b4a7fbc452ca1f2eb025b0c88ec9f4b845f..4e4238f4f656208c0f11822406172ea13a21e2d4 100644 +index e1f55b4a7fbc452ca1f2eb025b0c88ec9f4b845f..beb3c7a6619b554bb3186a0de917f497ac0f47f8 100644 --- a/Source/WebKit/UIProcess/DrawingAreaProxy.h +++ b/Source/WebKit/UIProcess/DrawingAreaProxy.h @@ -94,6 +94,7 @@ public: const WebCore::IntSize& size() const { return m_size; } bool setSize(const WebCore::IntSize&, const WebCore::IntSize& scrollOffset = { }); -+ void waitForSizeUpdate(Function&&); - - virtual void minimumSizeForAutoLayoutDidChange() { } - virtual void sizeToContentAutoSizeMaximumSizeDidChange() { } -@@ -181,6 +182,10 @@ private: - virtual void update(uint64_t /* backingStoreStateID */, UpdateInfo&&) { } - virtual void exitAcceleratedCompositingMode(uint64_t /* backingStoreStateID */, UpdateInfo&&) { } - #endif -+ -+#if PLATFORM(WIN) -+ virtual void didChangeAcceleratedCompositingMode(bool) { } -+#endif - }; - - } // namespace WebKit -diff --git a/Source/WebKit/UIProcess/DrawingAreaProxy.messages.in b/Source/WebKit/UIProcess/DrawingAreaProxy.messages.in -index b03ac2dcf12c771da4a2347b81e5ba93fbd5f6a4..b69c5d3244306e1d1c10206d499d9a833a3efeec 100644 ---- a/Source/WebKit/UIProcess/DrawingAreaProxy.messages.in -+++ b/Source/WebKit/UIProcess/DrawingAreaProxy.messages.in -@@ -35,4 +35,7 @@ messages -> DrawingAreaProxy { - Update(uint64_t stateID, struct WebKit::UpdateInfo updateInfo) CanDispatchOutOfOrder - ExitAcceleratedCompositingMode(uint64_t backingStoreStateID, struct WebKit::UpdateInfo updateInfo) - #endif -+#if PLATFORM(WIN) -+ DidChangeAcceleratedCompositingMode(bool enabled) -+#endif - } -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); ++ void waitForSizeUpdate(Function&&); + + virtual void minimumSizeForAutoLayoutDidChange() { } + virtual void sizeToContentAutoSizeMaximumSizeDidChange() { } diff --git a/Source/WebKit/UIProcess/Inspector/Agents/InspectorScreencastAgent.cpp b/Source/WebKit/UIProcess/Inspector/Agents/InspectorScreencastAgent.cpp new file mode 100644 -index 0000000000000000000000000000000000000000..033bf77bca2de127e55cbf55a9e0b0c358fc81f9 +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. + * @@ -12541,12 +11247,6 @@ index 0000000000000000000000000000000000000000..033bf77bca2de127e55cbf55a9e0b0c3 +#include +#endif + -+#if USE(CAIRO) || PLATFORM(GTK) -+#include "CairoJpegEncoder.h" -+#include "DrawingAreaProxyCoordinatedGraphics.h" -+#include "DrawingAreaProxy.h" -+#endif -+ +#if PLATFORM(MAC) +#include +#endif @@ -12589,11 +11289,11 @@ index 0000000000000000000000000000000000000000..033bf77bca2de127e55cbf55a9e0b0c3 + m_encoder = nullptr; +} + -+#if USE(SKIA) && !PLATFORM(GTK) ++#if USE(SKIA) +void InspectorScreencastAgent::didPaint(sk_sp&& surface) +{ + sk_sp image(surface); -+#if PLATFORM(WPE) ++#if PLATFORM(WPE) || PLATFORM(WIN) + // Get actual image size (in device pixels). + WebCore::IntSize displaySize(image->width(), image->height()); + @@ -12659,66 +11359,6 @@ index 0000000000000000000000000000000000000000..033bf77bca2de127e55cbf55a9e0b0c3 +} +#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) @@ -12866,7 +11506,7 @@ index 0000000000000000000000000000000000000000..033bf77bca2de127e55cbf55a9e0b0c3 +} +#endif + -+#if (USE(CAIRO) && !PLATFORM(WPE)) || PLATFORM(GTK) ++#if PLATFORM(GTK) || PLATFORM(WIN) +void InspectorScreencastAgent::encodeFrame() +{ + if (!m_encoder && !m_screencast) @@ -12882,10 +11522,10 @@ index 0000000000000000000000000000000000000000..033bf77bca2de127e55cbf55a9e0b0c3 +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. + * @@ -12917,10 +11557,6 @@ index 0000000000000000000000000000000000000000..f53bb59c65a4ced0360e473fb9ed9a36 +#include +#include + -+#if USE(CAIRO) || PLATFORM(GTK) -+#include -+#endif -+ +#include +#include +#include @@ -12956,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; @@ -12997,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. @@ -13044,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; @@ -13141,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)) @@ -13161,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(); @@ -13170,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); @@ -13196,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 }; @@ -13361,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(); @@ -13385,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) +{ @@ -13446,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. + * @@ -13484,8 +12072,8 @@ index 0000000000000000000000000000000000000000..caf0474267c1bda6346f7b025b6646bb +#include +#include + -+#if USE(CAIRO) || PLATFORM(GTK) -+#include ++#if USE(SKIA) ++#include +#endif + +namespace WebKit { @@ -13504,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;} @@ -13667,7 +12253,7 @@ index 0000000000000000000000000000000000000000..e2ce910f3fd7f587add552275b7e7176 + +} // namespace WebKit diff --git a/Source/WebKit/UIProcess/Inspector/InspectorTargetProxy.cpp b/Source/WebKit/UIProcess/Inspector/InspectorTargetProxy.cpp -index 77bdb25abf77bc0f7f00d3dbd57b0eb751c99488..6d3a93a009cff0f70f2b1a1e674827c24a26a947 100644 +index 76cc869ca4d5fc311040a285d50a44f00273fd63..633f8323697f0c2f30311a35ac3876bf8e03b741 100644 --- a/Source/WebKit/UIProcess/Inspector/InspectorTargetProxy.cpp +++ b/Source/WebKit/UIProcess/Inspector/InspectorTargetProxy.cpp @@ -28,7 +28,7 @@ @@ -13695,7 +12281,7 @@ index 77bdb25abf77bc0f7f00d3dbd57b0eb751c99488..6d3a93a009cff0f70f2b1a1e674827c2 target->m_provisionalPage = provisionalPage; return target; } -@@ -105,6 +105,31 @@ void InspectorTargetProxy::didCommitProvisionalTarget() +@@ -108,6 +108,31 @@ void InspectorTargetProxy::didCommitProvisionalTarget() m_provisionalPage = nullptr; } @@ -13761,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 e4f2f719746ed69b1226be2d47b16666f2067772..96956711b594d80ea9cbdce11a6f62b2992530aa 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" @@ -13783,11 +12369,12 @@ index e4f2f719746ed69b1226be2d47b16666f2067772..96956711b594d80ea9cbdce11a6f62b2 #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); @@ -13910,7 +12497,7 @@ index e4f2f719746ed69b1226be2d47b16666f2067772..96956711b594d80ea9cbdce11a6f62b2 } 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(); @@ -13928,7 +12515,7 @@ index e4f2f719746ed69b1226be2d47b16666f2067772..96956711b594d80ea9cbdce11a6f62b2 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(); @@ -13940,7 +12527,7 @@ index e4f2f719746ed69b1226be2d47b16666f2067772..96956711b594d80ea9cbdce11a6f62b2 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(); @@ -13949,11 +12536,11 @@ index e4f2f719746ed69b1226be2d47b16666f2067772..96956711b594d80ea9cbdce11a6f62b2 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()) @@ -13962,15 +12549,6 @@ index e4f2f719746ed69b1226be2d47b16666f2067772..96956711b594d80ea9cbdce11a6f62b2 + 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) @@ -14025,7 +12603,7 @@ index e4f2f719746ed69b1226be2d47b16666f2067772..96956711b594d80ea9cbdce11a6f62b2 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); } @@ -14078,7 +12656,7 @@ index e4f2f719746ed69b1226be2d47b16666f2067772..96956711b594d80ea9cbdce11a6f62b2 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) { @@ -14087,7 +12665,7 @@ index e4f2f719746ed69b1226be2d47b16666f2067772..96956711b594d80ea9cbdce11a6f62b2 } 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)); } @@ -14118,10 +12696,10 @@ index e4f2f719746ed69b1226be2d47b16666f2067772..96956711b594d80ea9cbdce11a6f62b2 + } // namespace WebKit diff --git a/Source/WebKit/UIProcess/Inspector/WebPageInspectorController.h b/Source/WebKit/UIProcess/Inspector/WebPageInspectorController.h -index 29457fc3c76c963bf50b44c011f64398efbae676..3e098aae8cd02d26aa32a6e15ed16e95695afaf7 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" @@ -14140,10 +12718,6 @@ index 29457fc3c76c963bf50b44c011f64398efbae676..3e098aae8cd02d26aa32a6e15ed16e95 +#if USE(SKIA) +#include +#include -+#endif -+ -+#if USE(CAIRO) || PLATFORM(GTK) -+#include +#endif namespace Inspector { @@ -14165,7 +12739,7 @@ index 29457fc3c76c963bf50b44c011f64398efbae676..3e098aae8cd02d26aa32a6e15ed16e95 } namespace WebKit { -@@ -46,6 +70,23 @@ namespace WebKit { +@@ -46,6 +66,23 @@ namespace WebKit { class InspectorBrowserAgent; struct WebPageAgentContext; @@ -14189,7 +12763,7 @@ index 29457fc3c76c963bf50b44c011f64398efbae676..3e098aae8cd02d26aa32a6e15ed16e95 class WebPageInspectorController { WTF_MAKE_TZONE_ALLOCATED(WebPageInspectorController); WTF_MAKE_NONCOPYABLE(WebPageInspectorController); -@@ -54,7 +95,21 @@ public: +@@ -54,7 +91,21 @@ public: ~WebPageInspectorController(); void init(); @@ -14211,16 +12785,13 @@ index 29457fc3c76c963bf50b44c011f64398efbae676..3e098aae8cd02d26aa32a6e15ed16e95 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); @@ -14242,7 +12813,7 @@ index 29457fc3c76c963bf50b44c011f64398efbae676..3e098aae8cd02d26aa32a6e15ed16e95 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: @@ -14254,9 +12825,9 @@ index 29457fc3c76c963bf50b44c011f64398efbae676..3e098aae8cd02d26aa32a6e15ed16e95 void addTarget(std::unique_ptr&&); + void adjustPageSettings(); - Ref m_frontendRouter; - Ref m_backendDispatcher; -@@ -101,9 +176,16 @@ private: + const Ref m_frontendRouter; + const Ref m_backendDispatcher; +@@ -101,9 +169,16 @@ private: CheckedPtr m_targetAgent; HashMap> m_targets; @@ -14506,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..7535756c45428e307e27807d31884ae6c5216543 +index 0000000000000000000000000000000000000000..8026d3e9aaca3434fc1d7316a19cd92827566a67 --- /dev/null +++ b/Source/WebKit/UIProcess/InspectorPlaywrightAgent.cpp -@@ -0,0 +1,1011 @@ +@@ -0,0 +1,1009 @@ +/* + * Copyright (C) 2019 Microsoft Corporation. + * @@ -15169,7 +13740,7 @@ index 0000000000000000000000000000000000000000..7535756c45428e307e27807d31884ae6 + return; + } + -+ WebCore::ResourceRequest resourceRequest { url }; ++ auto resourceRequest = WebCore::ResourceRequest(URL { url }); + + if (!!referrer) + resourceRequest.setHTTPReferrer(referrer); @@ -15259,9 +13830,7 @@ index 0000000000000000000000000000000000000000..7535756c45428e307e27807d31884ae6 + 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 { }; +} + @@ -15443,7 +14012,7 @@ index 0000000000000000000000000000000000000000..7535756c45428e307e27807d31884ae6 +{ + if (!m_isEnabled) + return; -+ String frameID = WebCore::InspectorPageAgent::serializeFrameID(*frameInfoData.frameID); ++ String frameID = WebCore::InspectorPageAgent::serializeFrameID(frameInfoData.frameID); + m_downloads.set(uuid, download); + m_frontendDispatcher->downloadCreated( + toPageProxyIDProtocolString(*page), @@ -15748,7 +14317,7 @@ index 0000000000000000000000000000000000000000..e7a3dcc533294bb6e12f65d79b5b716b + +#endif // ENABLE(REMOTE_INSPECTOR) diff --git a/Source/WebKit/UIProcess/Launcher/glib/ProcessLauncherGLib.cpp b/Source/WebKit/UIProcess/Launcher/glib/ProcessLauncherGLib.cpp -index 9959b634faa60d620d4aac6635b31914bb063979..a8a38fe41b5fdc2836d068cc69940a5b21876e8d 100644 +index 272e0a6edea50acd35032a854d625b5af5a1472e..486c807ba879ecf534db1ffb593709d117e0c35a 100644 --- a/Source/WebKit/UIProcess/Launcher/glib/ProcessLauncherGLib.cpp +++ b/Source/WebKit/UIProcess/Launcher/glib/ProcessLauncherGLib.cpp @@ -168,6 +168,13 @@ void ProcessLauncher::launchProcess() @@ -15804,10 +14373,10 @@ 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 a5e7596eea86c6b7bdecf0a3adc906c3007a2f5d..2507c278685870936a6a26e9dd0d3474bcde51bc 100644 +index 1e06e94f26fc73c323605da1afb0474559b35c33..1ac2f393d3dc0a7812c1b9a1bdaa6cea4f150bf4 100644 --- a/Source/WebKit/UIProcess/PageClient.h +++ b/Source/WebKit/UIProcess/PageClient.h -@@ -75,6 +75,11 @@ +@@ -74,6 +74,11 @@ #include #endif @@ -15819,20 +14388,7 @@ index a5e7596eea86c6b7bdecf0a3adc906c3007a2f5d..2507c278685870936a6a26e9dd0d3474 OBJC_CLASS AVPlayerViewController; OBJC_CLASS CALayer; OBJC_CLASS NSFileWrapper; -@@ -96,6 +101,12 @@ OBJC_CLASS WKView; - #endif - #endif - -+#if PLATFORM(GTK) || PLATFORM(WPE) -+#if USE(CAIRO) -+#include -+#endif -+#endif -+ - namespace API { - class Attachment; - class HitTestResult; -@@ -376,7 +387,20 @@ public: +@@ -381,7 +386,16 @@ public: virtual void selectionDidChange() = 0; #endif @@ -15841,11 +14397,7 @@ index a5e7596eea86c6b7bdecf0a3adc906c3007a2f5d..2507c278685870936a6a26e9dd0d3474 +#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 @@ -15987,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 3399db4087c395fbc516cc90f20f70d535a31c65..ec217611aa4a5823567c5cde84a211a2dcfb26be 100644 +index 493bde430bef5c064ff6807296ad088d8dee1a72..9b6dbc259e150fba3ba5fb4b488d91e3fb16be7e 100644 --- a/Source/WebKit/UIProcess/ProvisionalFrameProxy.cpp +++ b/Source/WebKit/UIProcess/ProvisionalFrameProxy.cpp @@ -25,6 +25,7 @@ @@ -16306,7 +14858,7 @@ index 0000000000000000000000000000000000000000..6d04f9290135069359ce6bf872654648 + +#endif // ENABLE(REMOTE_INSPECTOR) diff --git a/Source/WebKit/UIProcess/WebContextMenuProxy.h b/Source/WebKit/UIProcess/WebContextMenuProxy.h -index c951d8577473371d8eb59ad651451737349c4389..b38cd0967ae45733a94594fd25900ddc1d49c3f6 100644 +index 697a350812e1bf73dd44cc3d723a6a291f9d59d1..a8e1edd710d88f48632d51fd05aa964732d727d3 100644 --- a/Source/WebKit/UIProcess/WebContextMenuProxy.h +++ b/Source/WebKit/UIProcess/WebContextMenuProxy.h @@ -49,6 +49,7 @@ public: @@ -16316,10 +14868,10 @@ index c951d8577473371d8eb59ad651451737349c4389..b38cd0967ae45733a94594fd25900ddc + virtual void hide() {} WebPageProxy* page() const { return m_page.get(); } - + 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 @@ @@ -16427,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 { }; +} + @@ -17058,26 +15610,26 @@ index 0000000000000000000000000000000000000000..26a2a3c0791c334f811ec99a630314f8 + +} // namespace WebKit diff --git a/Source/WebKit/UIProcess/WebPageProxy.cpp b/Source/WebKit/UIProcess/WebPageProxy.cpp -index 92eef3dd76340b6f1761c0bfbe6e7a0896f532f2..daae2e0dfdddf8d44b075b2ddc6c65861c1847e8 100644 +index 7c380219c6ff83938d0b7425b62932521cdb1edb..7439ed4314cd66866e0eb570e46744cad3254e10 100644 --- a/Source/WebKit/UIProcess/WebPageProxy.cpp +++ b/Source/WebKit/UIProcess/WebPageProxy.cpp -@@ -200,6 +200,7 @@ +@@ -205,6 +205,7 @@ #include #include #include +#include #include #include - #include -@@ -210,6 +211,7 @@ - #include + #include +@@ -217,6 +218,7 @@ + #include #include #include +#include #include #include #include -@@ -233,6 +235,7 @@ +@@ -242,6 +244,7 @@ #include #include #include @@ -17085,7 +15637,7 @@ index 92eef3dd76340b6f1761c0bfbe6e7a0896f532f2..daae2e0dfdddf8d44b075b2ddc6c6586 #include #include #include -@@ -240,10 +243,13 @@ +@@ -250,10 +253,13 @@ #include #include #include @@ -17099,7 +15651,7 @@ index 92eef3dd76340b6f1761c0bfbe6e7a0896f532f2..daae2e0dfdddf8d44b075b2ddc6c6586 #include #include #include -@@ -330,6 +336,9 @@ +@@ -349,6 +355,9 @@ #if USE(GBM) #include "AcceleratedBackingStoreDMABuf.h" #endif @@ -17109,7 +15661,7 @@ index 92eef3dd76340b6f1761c0bfbe6e7a0896f532f2..daae2e0dfdddf8d44b075b2ddc6c6586 #include #endif -@@ -455,6 +464,8 @@ static constexpr Seconds tryCloseTimeoutDelay = 50_ms; +@@ -474,6 +483,8 @@ static constexpr Seconds tryCloseTimeoutDelay = 50_ms; static constexpr Seconds audibleActivityClearDelay = 10_s; #endif @@ -17118,7 +15670,7 @@ index 92eef3dd76340b6f1761c0bfbe6e7a0896f532f2..daae2e0dfdddf8d44b075b2ddc6c6586 DEFINE_DEBUG_ONLY_GLOBAL(WTF::RefCountedLeakCounter, webPageProxyCounter, ("WebPageProxy")); #if PLATFORM(COCOA) -@@ -966,6 +977,10 @@ WebPageProxy::~WebPageProxy() +@@ -1007,6 +1018,10 @@ WebPageProxy::~WebPageProxy() #endif internals().updatePlayingMediaDidChangeTimer.stop(); @@ -17129,7 +15681,7 @@ index 92eef3dd76340b6f1761c0bfbe6e7a0896f532f2..daae2e0dfdddf8d44b075b2ddc6c6586 } Ref WebPageProxy::Internals::protectedPage() const -@@ -1548,7 +1563,7 @@ void WebPageProxy::didAttachToRunningProcess() +@@ -1580,7 +1595,7 @@ void WebPageProxy::didAttachToRunningProcess() #if ENABLE(FULLSCREEN_API) ASSERT(!m_fullScreenManager); @@ -17138,7 +15690,7 @@ index 92eef3dd76340b6f1761c0bfbe6e7a0896f532f2..daae2e0dfdddf8d44b075b2ddc6c6586 #endif #if ENABLE(VIDEO_PRESENTATION_MODE) ASSERT(!m_playbackSessionManager); -@@ -1714,6 +1729,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); @@ -17146,7 +15698,7 @@ index 92eef3dd76340b6f1761c0bfbe6e7a0896f532f2..daae2e0dfdddf8d44b075b2ddc6c6586 #if ENABLE(WINDOW_PROXY_PROPERTY_ACCESS_NOTIFICATION) internals().frameLoadStateObserver = makeUniqueWithoutRefCountedCheck(*this); -@@ -2006,6 +2022,21 @@ Ref WebPageProxy::ensureProtectedRunningProcess() +@@ -2021,6 +2037,21 @@ Ref WebPageProxy::ensureProtectedRunningProcess() return ensureRunningProcess(); } @@ -17168,18 +15720,7 @@ index 92eef3dd76340b6f1761c0bfbe6e7a0896f532f2..daae2e0dfdddf8d44b075b2ddc6c6586 RefPtr WebPageProxy::loadRequest(WebCore::ResourceRequest&& request, ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy, IsPerformingHTTPFallback isPerformingHTTPFallback, std::unique_ptr&& lastNavigationAction, API::Object* userData) { if (m_isClosed) -@@ -2062,8 +2093,8 @@ void WebPageProxy::loadRequestWithNavigationShared(Ref&& proces - - auto url = request.url(); - #if PLATFORM(COCOA) -- bool urlIsInvalidButNotNull = !url.isValid() && !url.isNull(); -- if (urlIsInvalidButNotNull && WTF::linkedOnOrAfterSDKWithBehavior(SDKAlignedBehavior::ConvertsInvalidURLsToNull)) { -+ bool urlIsInvalidButNotEmpty = !url.isValid() && !url.isEmpty(); -+ if (urlIsInvalidButNotEmpty && WTF::linkedOnOrAfterSDKWithBehavior(SDKAlignedBehavior::ConvertsInvalidURLsToNull)) { - RunLoop::protectedMain()->dispatch([weakThis = WeakPtr { *this }, request, navigation = Ref { navigation }] { - RefPtr protectedThis = weakThis.get(); - if (!protectedThis) -@@ -2116,11 +2147,29 @@ void WebPageProxy::loadRequestWithNavigationShared(Ref&& proces +@@ -2136,11 +2167,29 @@ void WebPageProxy::loadRequestWithNavigationShared(Ref&& proces navigation->setIsLoadedWithNavigationShared(true); protectedProcess->markProcessAsRecentlyUsed(); @@ -17213,7 +15754,7 @@ index 92eef3dd76340b6f1761c0bfbe6e7a0896f532f2..daae2e0dfdddf8d44b075b2ddc6c6586 }); } -@@ -2671,6 +2720,61 @@ 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); } @@ -17269,13 +15810,15 @@ index 92eef3dd76340b6f1761c0bfbe6e7a0896f532f2..daae2e0dfdddf8d44b075b2ddc6c6586 + +void WebPageProxy::logToStderr(const String& str) +{ ++WTF_ALLOW_UNSAFE_BUFFER_USAGE_BEGIN + fprintf(stderr, "RENDERER: %s\n", str.utf8().data()); ++WTF_ALLOW_UNSAFE_BUFFER_USAGE_END +} + void WebPageProxy::createInspectorTarget(IPC::Connection& connection, const String& targetId, Inspector::InspectorTargetType type) { MESSAGE_CHECK_BASE(!targetId.isEmpty(), connection); -@@ -2924,6 +3028,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); @@ -17300,7 +15843,7 @@ index 92eef3dd76340b6f1761c0bfbe6e7a0896f532f2..daae2e0dfdddf8d44b075b2ddc6c6586 if (flagsToUpdate & ActivityState::IsFocused && pageClient->isViewFocused()) internals().activityState.add(ActivityState::IsFocused); if (flagsToUpdate & ActivityState::WindowIsActive && pageClient->isViewWindowActive()) -@@ -3706,7 +3828,7 @@ void WebPageProxy::performDragOperation(DragData& dragData, const String& dragSt +@@ -3718,7 +3842,7 @@ void WebPageProxy::performDragOperation(DragData& dragData, const String& dragSt if (!hasRunningProcess()) return; @@ -17309,7 +15852,7 @@ index 92eef3dd76340b6f1761c0bfbe6e7a0896f532f2..daae2e0dfdddf8d44b075b2ddc6c6586 URL url { dragData.asURL() }; if (url.protocolIsFile()) protectedLegacyMainFrameProcess()->assumeReadAccessToBaseURL(*this, url.string(), [] { }); -@@ -3734,6 +3856,8 @@ void WebPageProxy::performDragControllerAction(DragControllerAction action, Drag +@@ -3746,6 +3870,8 @@ void WebPageProxy::performDragControllerAction(DragControllerAction action, Drag if (!hasRunningProcess()) return; @@ -17318,7 +15861,7 @@ index 92eef3dd76340b6f1761c0bfbe6e7a0896f532f2..daae2e0dfdddf8d44b075b2ddc6c6586 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; -@@ -3745,7 +3869,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); }; @@ -17327,7 +15870,7 @@ index 92eef3dd76340b6f1761c0bfbe6e7a0896f532f2..daae2e0dfdddf8d44b075b2ddc6c6586 ASSERT(dragData.platformData()); sendWithAsyncReplyToProcessContainingFrame(frameID, Messages::WebPage::PerformDragControllerAction(action, dragData.clientPosition(), dragData.globalPosition(), dragData.draggingSourceOperationMask(), *dragData.platformData(), dragData.flags()), WTFMove(completionHandler)); #else -@@ -3780,14 +3904,35 @@ void WebPageProxy::didPerformDragControllerAction(std::optionalpageClient()) pageClient->didPerformDragControllerAction(); @@ -17367,7 +15910,7 @@ index 92eef3dd76340b6f1761c0bfbe6e7a0896f532f2..daae2e0dfdddf8d44b075b2ddc6c6586 } didStartDrag(); } -@@ -3809,6 +3954,24 @@ void WebPageProxy::dragEnded(const IntPoint& clientPosition, const IntPoint& glo +@@ -3821,6 +3968,24 @@ void WebPageProxy::dragEnded(const IntPoint& clientPosition, const IntPoint& glo setDragCaretRect({ }); } @@ -17392,7 +15935,7 @@ index 92eef3dd76340b6f1761c0bfbe6e7a0896f532f2..daae2e0dfdddf8d44b075b2ddc6c6586 void WebPageProxy::didStartDrag() { if (!hasRunningProcess()) -@@ -3816,6 +3979,26 @@ void WebPageProxy::didStartDrag() +@@ -3828,6 +3993,26 @@ void WebPageProxy::didStartDrag() discardQueuedMouseEvents(); send(Messages::WebPage::DidStartDrag()); @@ -17419,7 +15962,7 @@ index 92eef3dd76340b6f1761c0bfbe6e7a0896f532f2..daae2e0dfdddf8d44b075b2ddc6c6586 } void WebPageProxy::dragCancelled() -@@ -3981,26 +4164,47 @@ void WebPageProxy::processNextQueuedMouseEvent() +@@ -3999,26 +4184,47 @@ void WebPageProxy::processNextQueuedMouseEvent() process->startResponsivenessTimer(); } @@ -17474,12 +16017,12 @@ index 92eef3dd76340b6f1761c0bfbe6e7a0896f532f2..daae2e0dfdddf8d44b075b2ddc6c6586 + m_dragSelectionData = std::nullopt; + dragEnded(event.position(), event.globalPosition(), m_dragSourceOperationMask); + } -+ didReceiveEvent(eventType, true, std::nullopt); ++ didReceiveEventIPC(process->connection(), eventType, true, std::nullopt); + } } void WebPageProxy::doAfterProcessingAllPendingMouseEvents(WTF::Function&& action) -@@ -4197,6 +4401,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); @@ -17488,7 +16031,7 @@ index 92eef3dd76340b6f1761c0bfbe6e7a0896f532f2..daae2e0dfdddf8d44b075b2ddc6c6586 } void WebPageProxy::cacheWheelEventScrollingAccelerationCurve(const NativeWebWheelEvent& nativeWheelEvent) -@@ -4332,7 +4538,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) { @@ -17497,7 +16040,7 @@ index 92eef3dd76340b6f1761c0bfbe6e7a0896f532f2..daae2e0dfdddf8d44b075b2ddc6c6586 for (auto& touchPoint : touchStartEvent.touchPoints()) { auto location = touchPoint.locationInRootView(); auto update = [this, location](TrackingType& trackingType, EventTrackingRegions::EventType eventType) { -@@ -4971,6 +5177,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) { @@ -17505,7 +16048,7 @@ index 92eef3dd76340b6f1761c0bfbe6e7a0896f532f2..daae2e0dfdddf8d44b075b2ddc6c6586 if (!hasRunningProcess()) return completionHandler(PolicyDecision { }); -@@ -5967,6 +6174,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; @@ -17513,15 +16056,15 @@ index 92eef3dd76340b6f1761c0bfbe6e7a0896f532f2..daae2e0dfdddf8d44b075b2ddc6c6586 forEachWebContentProcess([&] (auto& process, auto pageID) { if (&process == &legacyMainFrameProcess()) -@@ -6609,6 +6817,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); + m_inspectorController->didDestroyNavigation(navigationID); } - void WebPageProxy::didStartProvisionalLoadForFrame(FrameIdentifier frameID, FrameInfoData&& frameInfo, ResourceRequest&& request, std::optional navigationID, URL&& url, URL&& unreachableURL, const UserData& userData, WallTime timestamp) -@@ -6947,6 +7156,8 @@ void WebPageProxy::didFailProvisionalLoadForFrameShared(Ref&& p + void WebPageProxy::didStartProvisionalLoadForFrame(IPC::Connection& connection, FrameIdentifier frameID, FrameInfoData&& frameInfo, ResourceRequest&& request, std::optional navigationID, URL&& url, URL&& unreachableURL, const UserData& userData, WallTime timestamp) +@@ -7008,6 +7219,8 @@ void WebPageProxy::didFailProvisionalLoadForFrameShared(Ref&& p m_failingProvisionalLoadURL = { }; @@ -17530,7 +16073,7 @@ index 92eef3dd76340b6f1761c0bfbe6e7a0896f532f2..daae2e0dfdddf8d44b075b2ddc6c6586 // 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; -@@ -8395,8 +8606,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(); @@ -17541,7 +16084,7 @@ index 92eef3dd76340b6f1761c0bfbe6e7a0896f532f2..daae2e0dfdddf8d44b075b2ddc6c6586 auto completionHandler = [ this, protectedThis = Ref { *this }, -@@ -8469,6 +8681,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); @@ -17549,7 +16092,7 @@ index 92eef3dd76340b6f1761c0bfbe6e7a0896f532f2..daae2e0dfdddf8d44b075b2ddc6c6586 if (RefPtr openerFrame = WebFrameProxy::webFrame(originatingFrameInfoData.frameID); navigationActionData.hasOpener && openerFrame) { configuration->setOpenerInfo({ { -@@ -8491,6 +8704,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); @@ -17557,7 +16100,7 @@ index 92eef3dd76340b6f1761c0bfbe6e7a0896f532f2..daae2e0dfdddf8d44b075b2ddc6c6586 } bool WebPageProxy::hasOpenedPage() const -@@ -8622,6 +8836,10 @@ void WebPageProxy::closePage() +@@ -8775,6 +8991,10 @@ void WebPageProxy::closePage() if (isClosed()) return; @@ -17568,34 +16111,34 @@ index 92eef3dd76340b6f1761c0bfbe6e7a0896f532f2..daae2e0dfdddf8d44b075b2ddc6c6586 WEBPAGEPROXY_RELEASE_LOG(Process, "closePage:"); if (RefPtr pageClient = this->pageClient()) pageClient->clearAllEditCommands(); -@@ -8660,6 +8878,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(); -@@ -8682,6 +8902,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 { -@@ -8706,6 +8928,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 { -@@ -8841,6 +9065,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; } } @@ -17603,8 +16146,8 @@ index 92eef3dd76340b6f1761c0bfbe6e7a0896f532f2..daae2e0dfdddf8d44b075b2ddc6c6586 + 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. - protectedLegacyMainFrameProcess()->stopResponsivenessTimer(); -@@ -9454,6 +9680,11 @@ void WebPageProxy::resourceLoadDidCompleteWithError(ResourceLoadInfo&& loadInfo, + webProcess->stopResponsivenessTimer(); +@@ -9626,6 +9854,11 @@ void WebPageProxy::resourceLoadDidCompleteWithError(ResourceLoadInfo&& loadInfo, } #if ENABLE(FULLSCREEN_API) @@ -17616,7 +16159,7 @@ index 92eef3dd76340b6f1761c0bfbe6e7a0896f532f2..daae2e0dfdddf8d44b075b2ddc6c6586 WebFullScreenManagerProxy* WebPageProxy::fullScreenManager() { return m_fullScreenManager.get(); -@@ -9576,6 +9807,17 @@ void WebPageProxy::requestDOMPasteAccess(DOMPasteAccessCategory pasteAccessCateg +@@ -9753,6 +9986,17 @@ void WebPageProxy::requestDOMPasteAccess(IPC::Connection& connection, DOMPasteAc } } @@ -17634,7 +16177,7 @@ index 92eef3dd76340b6f1761c0bfbe6e7a0896f532f2..daae2e0dfdddf8d44b075b2ddc6c6586 protectedPageClient()->requestDOMPasteAccess(pasteAccessCategory, requiresInteraction, elementRect, originIdentifier, WTFMove(completionHandler)); } -@@ -10605,6 +10847,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(); @@ -17643,7 +16186,7 @@ index 92eef3dd76340b6f1761c0bfbe6e7a0896f532f2..daae2e0dfdddf8d44b075b2ddc6c6586 } } -@@ -10640,6 +10884,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); @@ -17651,7 +16194,7 @@ index 92eef3dd76340b6f1761c0bfbe6e7a0896f532f2..daae2e0dfdddf8d44b075b2ddc6c6586 } } -@@ -11064,7 +11309,10 @@ void WebPageProxy::dispatchProcessDidTerminate(WebProcessProxy& process, Process +@@ -11262,7 +11509,10 @@ void WebPageProxy::dispatchProcessDidTerminate(WebProcessProxy& process, Process if (protectedPreferences()->siteIsolationEnabled()) protectedBrowsingContextGroup()->processDidTerminate(*this, process); @@ -17663,7 +16206,7 @@ index 92eef3dd76340b6f1761c0bfbe6e7a0896f532f2..daae2e0dfdddf8d44b075b2ddc6c6586 if (m_loaderClient) handledByClient = reason != ProcessTerminationReason::RequestedByClient && m_loaderClient->processDidCrash(*this); else -@@ -11719,6 +11967,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; @@ -17672,7 +16215,7 @@ index 92eef3dd76340b6f1761c0bfbe6e7a0896f532f2..daae2e0dfdddf8d44b075b2ddc6c6586 #if ENABLE(APP_HIGHLIGHTS) parameters.appHighlightsVisible = appHighlightsVisibility() ? HighlightVisibility::Visible : HighlightVisibility::Hidden; -@@ -11882,8 +12132,42 @@ void WebPageProxy::allowGamepadAccess() +@@ -12081,8 +12333,47 @@ void WebPageProxy::allowGamepadAccess() #endif // ENABLE(GAMEPAD) @@ -17703,6 +16246,11 @@ index 92eef3dd76340b6f1761c0bfbe6e7a0896f532f2..daae2e0dfdddf8d44b075b2ddc6c6586 + 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())) { @@ -17715,7 +16263,7 @@ index 92eef3dd76340b6f1761c0bfbe6e7a0896f532f2..daae2e0dfdddf8d44b075b2ddc6c6586 if (negotiatedLegacyTLS == NegotiatedLegacyTLS::Yes) { m_navigationClient->shouldAllowLegacyTLS(*this, authenticationChallenge.get(), [this, protectedThis = Ref { *this }, authenticationChallenge] (bool shouldAllowLegacyTLS) { if (shouldAllowLegacyTLS) -@@ -11979,6 +12263,12 @@ void WebPageProxy::requestGeolocationPermissionForFrame(IPC::Connection& connect +@@ -12178,6 +12469,12 @@ void WebPageProxy::requestGeolocationPermissionForFrame(IPC::Connection& connect request->deny(); }; @@ -17728,7 +16276,7 @@ index 92eef3dd76340b6f1761c0bfbe6e7a0896f532f2..daae2e0dfdddf8d44b075b2ddc6c6586 // 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 -@@ -12043,6 +12333,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()) { @@ -17741,7 +16289,7 @@ index 92eef3dd76340b6f1761c0bfbe6e7a0896f532f2..daae2e0dfdddf8d44b075b2ddc6c6586 completionHandler(shouldChangeDeniedToPrompt ? PermissionState::Prompt : PermissionState::Denied); return; } -@@ -12057,6 +12353,12 @@ void WebPageProxy::queryPermission(const ClientOrigin& clientOrigin, const Permi +@@ -12258,6 +12561,12 @@ void WebPageProxy::queryPermission(const ClientOrigin& clientOrigin, const Permi return; } @@ -17755,7 +16303,7 @@ index 92eef3dd76340b6f1761c0bfbe6e7a0896f532f2..daae2e0dfdddf8d44b075b2ddc6c6586 completionHandler(shouldChangeDeniedToPrompt ? PermissionState::Prompt : PermissionState::Denied); return; diff --git a/Source/WebKit/UIProcess/WebPageProxy.h b/Source/WebKit/UIProcess/WebPageProxy.h -index 5eb0a3d277ecd9a0ea9c2e4f1223205bff9cb5a4..b770b73fb96af5dd106c8e66d02590c1650efbe6 100644 +index c220a17ba9d98b37e16bea6ef2c37ffd4599c906..d5e57548822361620b9a18c283e5e5e6821de584 100644 --- a/Source/WebKit/UIProcess/WebPageProxy.h +++ b/Source/WebKit/UIProcess/WebPageProxy.h @@ -26,6 +26,7 @@ @@ -17766,7 +16314,7 @@ index 5eb0a3d277ecd9a0ea9c2e4f1223205bff9cb5a4..b770b73fb96af5dd106c8e66d02590c1 #include "MessageReceiver.h" #include #include -@@ -44,6 +45,20 @@ +@@ -46,6 +47,20 @@ #include #include #include @@ -17787,7 +16335,7 @@ index 5eb0a3d277ecd9a0ea9c2e4f1223205bff9cb5a4..b770b73fb96af5dd106c8e66d02590c1 #if USE(DICTATION_ALTERNATIVES) #include -@@ -128,6 +143,7 @@ class DragData; +@@ -130,6 +145,7 @@ class DragData; class Exception; class FloatPoint; class FloatQuad; @@ -17795,7 +16343,7 @@ index 5eb0a3d277ecd9a0ea9c2e4f1223205bff9cb5a4..b770b73fb96af5dd106c8e66d02590c1 class FloatRect; class FloatSize; class FontAttributeChanges; -@@ -729,6 +745,8 @@ public: +@@ -735,6 +751,8 @@ public: void setControlledByAutomation(bool); WebPageInspectorController& inspectorController() { return *m_inspectorController; } @@ -17804,15 +16352,15 @@ index 5eb0a3d277ecd9a0ea9c2e4f1223205bff9cb5a4..b770b73fb96af5dd106c8e66d02590c1 #if PLATFORM(IOS_FAMILY) void showInspectorIndication(); -@@ -763,6 +781,7 @@ public: +@@ -768,6 +786,7 @@ public: bool hasSleepDisabler() const; #if ENABLE(FULLSCREEN_API) + void setFullScreenManagerClientOverride(std::unique_ptr&&); WebFullScreenManagerProxy* fullScreenManager(); + RefPtr protectedFullScreenManager(); void setFullScreenClientForTesting(std::unique_ptr&&); - -@@ -853,6 +872,12 @@ public: +@@ -859,6 +878,12 @@ public: void setPageLoadStateObserver(RefPtr&&); @@ -17825,7 +16373,7 @@ index 5eb0a3d277ecd9a0ea9c2e4f1223205bff9cb5a4..b770b73fb96af5dd106c8e66d02590c1 void initializeWebPage(const WebCore::Site&, WebCore::SandboxFlags); void setDrawingArea(RefPtr&&); -@@ -884,6 +909,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); @@ -17834,7 +16382,7 @@ index 5eb0a3d277ecd9a0ea9c2e4f1223205bff9cb5a4..b770b73fb96af5dd106c8e66d02590c1 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); -@@ -972,6 +999,7 @@ public: +@@ -978,6 +1005,7 @@ public: PageClient* pageClient() const; RefPtr protectedPageClient() const; @@ -17842,14 +16390,14 @@ index 5eb0a3d277ecd9a0ea9c2e4f1223205bff9cb5a4..b770b73fb96af5dd106c8e66d02590c1 void setViewNeedsDisplay(const WebCore::Region&); void requestScroll(const WebCore::FloatPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin, WebCore::ScrollIsAnimated); -@@ -1609,14 +1637,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(); @@ -17858,13 +16406,16 @@ index 5eb0a3d277ecd9a0ea9c2e4f1223205bff9cb5a4..b770b73fb96af5dd106c8e66d02590c1 +#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(); -@@ -1869,6 +1903,7 @@ public: +@@ -1883,6 +1917,7 @@ public: void setViewportSizeForCSSViewportUnits(const WebCore::FloatSize&); WebCore::FloatSize viewportSizeForCSSViewportUnits() const; @@ -17872,7 +16423,7 @@ index 5eb0a3d277ecd9a0ea9c2e4f1223205bff9cb5a4..b770b73fb96af5dd106c8e66d02590c1 void didReceiveAuthenticationChallengeProxy(Ref&&, NegotiatedLegacyTLS); void negotiatedLegacyTLS(); void didNegotiateModernTLS(const URL&); -@@ -1902,6 +1937,8 @@ public: +@@ -1916,6 +1951,8 @@ public: #if PLATFORM(COCOA) || PLATFORM(GTK) RefPtr takeViewSnapshot(std::optional&&); RefPtr takeViewSnapshot(std::optional&&, ForceSoftwareCapturingViewportSnapshot); @@ -17880,8 +16431,8 @@ index 5eb0a3d277ecd9a0ea9c2e4f1223205bff9cb5a4..b770b73fb96af5dd106c8e66d02590c1 + RefPtr takeViewSnapshot(std::optional&&) { return nullptr; } #endif - void wrapCryptoKey(Vector&&, CompletionHandler>&&)>&&); -@@ -2901,6 +2938,7 @@ private: + void serializeAndWrapCryptoKey(IPC::Connection&, WebCore::CryptoKeyData&&, CompletionHandler>&&)>&&); +@@ -2931,6 +2968,7 @@ private: RefPtr launchProcessForReload(); void requestNotificationPermission(const String& originString, CompletionHandler&&); @@ -17889,7 +16440,7 @@ index 5eb0a3d277ecd9a0ea9c2e4f1223205bff9cb5a4..b770b73fb96af5dd106c8e66d02590c1 void didChangeContentSize(const WebCore::IntSize&); void didChangeIntrinsicContentSize(const WebCore::IntSize&); -@@ -3424,8 +3462,10 @@ RefPtr protectedSpeechRecognitionPermissionM +@@ -3450,8 +3488,10 @@ private: String m_openedMainFrameName; RefPtr m_inspector; @@ -17900,7 +16451,7 @@ index 5eb0a3d277ecd9a0ea9c2e4f1223205bff9cb5a4..b770b73fb96af5dd106c8e66d02590c1 RefPtr m_fullScreenManager; std::unique_ptr m_fullscreenClient; #endif -@@ -3622,6 +3662,22 @@ RefPtr protectedSpeechRecognitionPermissionM +@@ -3650,6 +3690,22 @@ private: std::optional m_currentDragOperation; bool m_currentDragIsOverFileInput { false }; unsigned m_currentDragNumberOfFilesToBeAccepted { 0 }; @@ -17923,7 +16474,7 @@ index 5eb0a3d277ecd9a0ea9c2e4f1223205bff9cb5a4..b770b73fb96af5dd106c8e66d02590c1 #endif bool m_mainFrameHasHorizontalScrollbar { false }; -@@ -3795,6 +3851,10 @@ RefPtr protectedSpeechRecognitionPermissionM +@@ -3821,6 +3877,10 @@ private: RefPtr messageBody; }; Vector m_pendingInjectedBundleMessages; @@ -17935,7 +16486,7 @@ index 5eb0a3d277ecd9a0ea9c2e4f1223205bff9cb5a4..b770b73fb96af5dd106c8e66d02590c1 #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 d1b9a0bec55cf3c64792b6c0c527c973a6ef3cdd..4b132c98aabe3dffef13b01e6251bdb7305ce200 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 { @@ -17944,10 +16495,10 @@ index d1b9a0bec55cf3c64792b6c0c527c973a6ef3cdd..4b132c98aabe3dffef13b01e6251bdb7 MouseDidMoveOverElement(struct WebKit::WebHitTestResultData hitTestResultData, OptionSet modifiers, WebKit::UserData userData) + LogToStderr(String text) - DidReceiveEvent(enum:uint8_t WebKit::WebEventType eventType, bool handled, struct std::optional remoteUserInputEventData) + DidReceiveEventIPC(enum:uint8_t WebKit::WebEventType eventType, bool handled, struct std::optional remoteUserInputEventData) SetCursor(WebCore::Cursor cursor) -@@ -336,10 +337,14 @@ messages -> WebPageProxy { - StartDrag(struct WebCore::DragItem dragItem, WebCore::ShareableBitmapHandle dragImage) +@@ -333,10 +334,14 @@ messages -> WebPageProxy { + 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) @@ -17960,10 +16511,10 @@ index d1b9a0bec55cf3c64792b6c0c527c973a6ef3cdd..4b132c98aabe3dffef13b01e6251bdb7 +#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 9153b4da4d4f8de14f27e9ee2e8c89059e9573f5..035009bdcf5651aedd9604e47dc02fbfcccc62a9 100644 +index dc6f440403cccc5cd93f75806cffbf05cc56041c..e880beba2034cc2b87dcfb3e1e8bacf1bed78cf3 100644 --- a/Source/WebKit/UIProcess/WebProcessCache.cpp +++ b/Source/WebKit/UIProcess/WebProcessCache.cpp @@ -100,6 +100,10 @@ bool WebProcessCache::canCacheProcess(WebProcessProxy& process) const @@ -17978,10 +16529,10 @@ index 9153b4da4d4f8de14f27e9ee2e8c89059e9573f5..035009bdcf5651aedd9604e47dc02fbf } diff --git a/Source/WebKit/UIProcess/WebProcessPool.cpp b/Source/WebKit/UIProcess/WebProcessPool.cpp -index c035cc55b3810bef6d30b753ee325905d8fbc6ab..d129f7ebbf7a9a5e97e09fd7ce6e58040a960abc 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) { @@ -17994,7 +16545,7 @@ index c035cc55b3810bef6d30b753ee325905d8fbc6ab..d129f7ebbf7a9a5e97e09fd7ce6e5804 #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()) @@ -18006,7 +16557,7 @@ index c035cc55b3810bef6d30b753ee325905d8fbc6ab..d129f7ebbf7a9a5e97e09fd7ce6e5804 void WebProcessPool::fullKeyboardAccessModeChanged(bool fullKeyboardAccessEnabled) { -@@ -947,7 +948,7 @@ void WebProcessPool::initializeNewWebProcess(WebProcessProxy& process, WebsiteDa +@@ -945,7 +946,7 @@ void WebProcessPool::initializeNewWebProcess(WebProcessProxy& process, WebsiteDa #endif parameters.cacheModel = LegacyGlobalSettings::singleton().cacheModel(); @@ -18016,10 +16567,10 @@ index c035cc55b3810bef6d30b753ee325905d8fbc6ab..d129f7ebbf7a9a5e97e09fd7ce6e5804 parameters.urlSchemesRegisteredAsEmptyDocument = copyToVector(m_schemesToRegisterAsEmptyDocument); diff --git a/Source/WebKit/UIProcess/WebProcessProxy.cpp b/Source/WebKit/UIProcess/WebProcessProxy.cpp -index 1ac3aeb44691040950f6992d77e6489d9c58744f..3b4ebb055f9d9e7b3c64bfbf830239a7d1baf770 100644 +index f1074d1138c9e6f2a76c1ce76807c775b16c657c..b7386197a24a689a5b0cae6772abefb17819dbe9 100644 --- a/Source/WebKit/UIProcess/WebProcessProxy.cpp +++ b/Source/WebKit/UIProcess/WebProcessProxy.cpp -@@ -201,6 +201,11 @@ Vector> WebProcessProxy::allProcesses() +@@ -208,6 +208,11 @@ Vector> WebProcessProxy::allProcesses() }); } @@ -18031,7 +16582,7 @@ index 1ac3aeb44691040950f6992d77e6489d9c58744f..3b4ebb055f9d9e7b3c64bfbf830239a7 RefPtr WebProcessProxy::processForIdentifier(ProcessIdentifier identifier) { return allProcessMap().get(identifier); -@@ -568,6 +573,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); @@ -18059,10 +16610,10 @@ index 1ac3aeb44691040950f6992d77e6489d9c58744f..3b4ebb055f9d9e7b3c64bfbf830239a7 if (isPrewarmed()) diff --git a/Source/WebKit/UIProcess/WebProcessProxy.h b/Source/WebKit/UIProcess/WebProcessProxy.h -index b82965d62515b10373be40b28e4ba567821d5994..e05268412a251474c64fc4b3bafa25363bc87057 100644 +index 4471fdf4a46180f78cea1cf035671bfe3c83b8e2..0858fe7f56eb3d8648467f5b82c2d77d6c958b77 100644 --- a/Source/WebKit/UIProcess/WebProcessProxy.h +++ b/Source/WebKit/UIProcess/WebProcessProxy.h -@@ -184,6 +184,7 @@ public: +@@ -185,6 +185,7 @@ public: static void forWebPagesWithOrigin(PAL::SessionID, const WebCore::SecurityOriginData&, NOESCAPE const Function&); static Vector> allowedFirstPartiesForCookies(); @@ -18071,20 +16622,26 @@ index b82965d62515b10373be40b28e4ba567821d5994..e05268412a251474c64fc4b3bafa2536 void initializeWebProcess(WebProcessCreationParameters&&); diff --git a/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp b/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp -index 7b9780cb47d824cc47054333aad47754d6a0725c..34bb946afd3de5354e5a3759506537d2dd1af586 100644 +index c13d50e1828843714be1f49d2b1d5ea45e9c85aa..d7c76f184e77f1d828cde263ddf01f262c6c8f3a 100644 --- a/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp +++ b/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp -@@ -314,7 +314,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()) { -@@ -2507,6 +2508,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)); } @@ -18098,7 +16655,7 @@ index 7b9780cb47d824cc47054333aad47754d6a0725c..34bb946afd3de5354e5a3759506537d2 void WebsiteDataStore::hasAppBoundSession(CompletionHandler&& completionHandler) const { diff --git a/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h b/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h -index 0439774485211a729ccd8b0c041c41547ea28625..e09aff8b56357687de4a417b1bdd644907bb8c23 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; @@ -18132,17 +16689,13 @@ index 0439774485211a729ccd8b0c041c41547ea28625..e09aff8b56357687de4a417b1bdd6449 class WebsiteDataStore : public API::ObjectImpl, public CanMakeWeakPtr { public: static Ref defaultDataStore(); -@@ -319,11 +329,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; } @@ -18160,20 +16713,18 @@ index 0439774485211a729ccd8b0c041c41547ea28625..e09aff8b56357687de4a417b1bdd6449 void resetQuota(CompletionHandler&&); void resetStoragePersistedState(CompletionHandler&&); #if PLATFORM(IOS_FAMILY) -@@ -614,9 +632,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; SoupCookiePersistentStorageType m_cookiePersistentStorageType { SoupCookiePersistentStorageType::SQLite }; -@@ -643,6 +663,10 @@ private: +@@ -645,6 +665,10 @@ private: RefPtr m_cookieStore; RefPtr m_networkProcess; @@ -18185,7 +16736,7 @@ index 0439774485211a729ccd8b0c041c41547ea28625..e09aff8b56357687de4a417b1bdd6449 std::unique_ptr m_soAuthorizationCoordinator; #endif diff --git a/Source/WebKit/UIProcess/geoclue/GeoclueGeolocationProvider.cpp b/Source/WebKit/UIProcess/geoclue/GeoclueGeolocationProvider.cpp -index ac64c2a3cb5d1e8e46ba1835623a5c12825e3ea1..6ad7a5adc5198ae035c5cb815b6db8f033910f3a 100644 +index 19934de3173ecc0507c5e59956bcf6730a8a88b4..bc0e52f6f28caeca8b9b7aab14b7ff991d7e6b41 100644 --- a/Source/WebKit/UIProcess/geoclue/GeoclueGeolocationProvider.cpp +++ b/Source/WebKit/UIProcess/geoclue/GeoclueGeolocationProvider.cpp @@ -114,6 +114,14 @@ void GeoclueGeolocationProvider::stop() @@ -18228,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. + * @@ -18271,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 { + @@ -18412,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))); @@ -18500,6 +17042,19 @@ index 0000000000000000000000000000000000000000..441442d899e4088f5c24ae9f70c3e4ff +} // namespace API + +#endif // ENABLE(REMOTE_INSPECTOR) +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 ++++ b/Source/WebKit/UIProcess/glib/WebProcessPoolGLib.cpp +@@ -124,6 +124,8 @@ static OptionSet availableInputDevices() + return toAvailableInputDevices(gdk_seat_get_capabilities(seat)); + } + #endif ++ if (!WebCore::screenHasTouchDeviceOverride() || !WebCore::screenHasTouchDeviceOverride().value()) ++ return AvailableInputDevices::Mouse; + #if ENABLE(TOUCH_EVENTS) + return AvailableInputDevices::Touchscreen; + #else diff --git a/Source/WebKit/UIProcess/gtk/AcceleratedBackingStore.h b/Source/WebKit/UIProcess/gtk/AcceleratedBackingStore.h index 5529f52048b24290f424e877cd9dbfb890e02ffb..c2b76b6188dd9596c4a1f31c137daff7d7644c7f 100644 --- a/Source/WebKit/UIProcess/gtk/AcceleratedBackingStore.h @@ -18522,7 +17077,7 @@ index 5529f52048b24290f424e877cd9dbfb890e02ffb..c2b76b6188dd9596c4a1f31c137daff7 virtual void unrealize() { }; virtual int renderHostFileDescriptor() { return -1; } diff --git a/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreDMABuf.cpp b/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreDMABuf.cpp -index 461ce4fddb98edbf06be61d4b47f3256439f70a8..64b0c2e09a1ae8487bc8b2610f209a228a6988f6 100644 +index 395a409b6302d4146606fc0b45a15cff63c7f327..666d9629e0155e8c03b0672f7a9274de7f04d642 100644 --- a/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreDMABuf.cpp +++ b/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreDMABuf.cpp @@ -812,4 +812,30 @@ RefPtr AcceleratedBackingStoreDMABuf::bufferAsNativeImageF @@ -18557,7 +17112,7 @@ index 461ce4fddb98edbf06be61d4b47f3256439f70a8..64b0c2e09a1ae8487bc8b2610f209a22 + } // namespace WebKit diff --git a/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreDMABuf.h b/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreDMABuf.h -index aedb88b1031475a603b6d15eb4fc042153c9b8c1..e6aca4b0e577dd2c729d262ff9b3d4d8fb27ef23 100644 +index 63dfbed03bd898c822d426a5449141fec2841226..eaf141843da3f02c5ba6fd0322f3175248a7195b 100644 --- a/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreDMABuf.h +++ b/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreDMABuf.h @@ -98,6 +98,7 @@ private: @@ -18570,7 +17125,7 @@ index aedb88b1031475a603b6d15eb4fc042153c9b8c1..e6aca4b0e577dd2c729d262ff9b3d4d8 RendererBufferFormat bufferFormat() const override; @@ -253,6 +254,9 @@ private: RefPtr m_committedBuffer; - WebCore::Region m_pendingDamageRegion; + Rects m_pendingDamageRects; HashMap> m_buffers; +// Playwright begin + RefPtr m_flippedSurface; @@ -18633,10 +17188,10 @@ index 0000000000000000000000000000000000000000..bf78de1915940c2d3292514cf0fe4e68 + +} // namespace WebKit diff --git a/Source/WebKit/UIProcess/gtk/SystemSettingsManagerProxyGtk.cpp b/Source/WebKit/UIProcess/gtk/SystemSettingsManagerProxyGtk.cpp -index aa702b018d881739fb464246e7c7d7236adfe97b..f711e1608e6d8b988d2d0bc99893d5b0137a07ae 100644 +index 9ef483a6b0ab1558c059304d727311ea7984184d..f532d2d2dbe2d7cb66323b6ea5fe2daace15d7b8 100644 --- a/Source/WebKit/UIProcess/gtk/SystemSettingsManagerProxyGtk.cpp +++ b/Source/WebKit/UIProcess/gtk/SystemSettingsManagerProxyGtk.cpp -@@ -117,6 +117,8 @@ int SystemSettingsManagerProxy::xftDPI() const +@@ -126,6 +126,8 @@ int SystemSettingsManagerProxy::xftDPI() const bool SystemSettingsManagerProxy::followFontSystemSettings() const { @@ -18851,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; @@ -18928,7 +17483,7 @@ index 0000000000000000000000000000000000000000..2aabc02a4b5432f68a6e85fd96897756 +} // namespace API diff --git a/Source/WebKit/UIProcess/mac/InspectorPlaywrightAgentClientMac.mm b/Source/WebKit/UIProcess/mac/InspectorPlaywrightAgentClientMac.mm new file mode 100644 -index 0000000000000000000000000000000000000000..a5c8b963636b24d4bb8ad090e4a19aedecbf56c3 +index 0000000000000000000000000000000000000000..a4b23bf4cf7c4cb6ef9d25d4121b20a611809479 --- /dev/null +++ b/Source/WebKit/UIProcess/mac/InspectorPlaywrightAgentClientMac.mm @@ -0,0 +1,96 @@ @@ -18999,7 +17554,7 @@ index 0000000000000000000000000000000000000000..a5c8b963636b24d4bb8ad090e4a19aed + +std::unique_ptr InspectorPlaywrightAgentClientMac::createBrowserContext(WTF::String& error, const WTF::String& proxyServer, const WTF::String& proxyBypassList) +{ -+ _WKBrowserContext* wkBrowserContext = [[delegate_ createBrowserContext:proxyServer WithBypassList:proxyBypassList] autorelease]; ++ _WKBrowserContext* wkBrowserContext = [[delegate_ createBrowserContext:proxyServer.createNSString().get() WithBypassList:proxyBypassList.createNSString().get()] autorelease]; + auto browserContext = std::make_unique(); + browserContext->processPool = &static_cast([[wkBrowserContext processPool] _apiObject]); + browserContext->dataStore = &static_cast([[wkBrowserContext dataStore] _apiObject]); @@ -19077,10 +17632,10 @@ index 0000000000000000000000000000000000000000..8adbd51bfecad2a273117588bf50f8f7 + +#endif diff --git a/Source/WebKit/UIProcess/mac/PageClientImplMac.h b/Source/WebKit/UIProcess/mac/PageClientImplMac.h -index 51744982af6f55f269d407cfb82638a4eaba8a5c..3cb319ef5fd54de9397f8065a8b05ca7ff82ccee 100644 +index 27627ddb817e90c92ff5e533618ded9d017d36d9..9169b380a79d57201a7d3dceab04a1d16d987865 100644 --- a/Source/WebKit/UIProcess/mac/PageClientImplMac.h +++ b/Source/WebKit/UIProcess/mac/PageClientImplMac.h -@@ -60,6 +60,8 @@ class PageClientImpl final : public PageClientImplCocoa +@@ -61,6 +61,8 @@ class PageClientImpl final : public PageClientImplCocoa WTF_OVERRIDE_DELETE_FOR_CHECKED_PTR(PageClientImpl); #endif public: @@ -19089,7 +17644,7 @@ index 51744982af6f55f269d407cfb82638a4eaba8a5c..3cb319ef5fd54de9397f8065a8b05ca7 PageClientImpl(NSView *, WKWebView *); virtual ~PageClientImpl(); -@@ -175,6 +177,9 @@ private: +@@ -176,6 +178,9 @@ private: void updateAcceleratedCompositingMode(const LayerTreeContext&) override; void didFirstLayerFlush(const LayerTreeContext&) override; @@ -19099,22 +17654,22 @@ index 51744982af6f55f269d407cfb82638a4eaba8a5c..3cb319ef5fd54de9397f8065a8b05ca7 RefPtr takeViewSnapshot(std::optional&&) override; RefPtr takeViewSnapshot(std::optional&&, ForceSoftwareCapturingViewportSnapshot) override; void wheelEventWasNotHandledByWebCore(const NativeWebWheelEvent&) override; -@@ -228,6 +233,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 6f5fd6287d435161dd7a7269fccc32cada2aabd5..79f171aaba64bca6a6bc853edb5b77effbabf664 100644 +index 22f6f6f08ba1601647898ca0f350672c3cac3816..6fad8bc05d1b458e25f8ddb9515ec8e1dcd896d6 100644 --- a/Source/WebKit/UIProcess/mac/PageClientImplMac.mm +++ b/Source/WebKit/UIProcess/mac/PageClientImplMac.mm -@@ -116,6 +116,13 @@ namespace WebKit { +@@ -108,6 +108,13 @@ namespace WebKit { using namespace WebCore; @@ -19128,7 +17683,7 @@ index 6f5fd6287d435161dd7a7269fccc32cada2aabd5..79f171aaba64bca6a6bc853edb5b77ef PageClientImpl::PageClientImpl(NSView *view, WKWebView *webView) : PageClientImplCocoa(webView) , m_view(view) -@@ -169,6 +176,9 @@ NSWindow *PageClientImpl::activeWindow() const +@@ -161,6 +168,9 @@ NSWindow *PageClientImpl::activeWindow() const bool PageClientImpl::isViewWindowActive() { @@ -19136,9 +17691,9 @@ index 6f5fd6287d435161dd7a7269fccc32cada2aabd5..79f171aaba64bca6a6bc853edb5b77ef + return true; + ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer)); - NSWindow *activeViewWindow = activeWindow(); - return activeViewWindow.isKeyWindow || (activeViewWindow && [NSApp keyWindow] == activeViewWindow); -@@ -176,6 +186,9 @@ bool PageClientImpl::isViewWindowActive() + RetainPtr activeViewWindow = activeWindow(); + return activeViewWindow.get().isKeyWindow || (activeViewWindow && [NSApp keyWindow] == activeViewWindow.get()); +@@ -168,6 +178,9 @@ bool PageClientImpl::isViewWindowActive() bool PageClientImpl::isViewFocused() { @@ -19148,17 +17703,17 @@ index 6f5fd6287d435161dd7a7269fccc32cada2aabd5..79f171aaba64bca6a6bc853edb5b77ef // 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) -@@ -199,6 +212,9 @@ void PageClientImpl::makeFirstResponder() +@@ -191,6 +204,9 @@ void PageClientImpl::makeFirstResponder() bool PageClientImpl::isViewVisible() { + if (_headless) + return true; + - NSView *activeView = this->activeView(); - NSWindow *activeViewWindow = activeWindow(); + RetainPtr activeView = this->activeView(); + RetainPtr activeViewWindow = activeWindow(); -@@ -282,7 +298,8 @@ void PageClientImpl::didRelaunchProcess() +@@ -265,7 +281,8 @@ void PageClientImpl::didRelaunchProcess() void PageClientImpl::preferencesDidChange() { @@ -19168,7 +17723,7 @@ index 6f5fd6287d435161dd7a7269fccc32cada2aabd5..79f171aaba64bca6a6bc853edb5b77ef } void PageClientImpl::toolTipChanged(const String& oldToolTip, const String& newToolTip) -@@ -489,6 +506,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) { @@ -19177,16 +17732,16 @@ index 6f5fd6287d435161dd7a7269fccc32cada2aabd5..79f171aaba64bca6a6bc853edb5b77ef m_impl->doneWithKeyEvent(event.nativeEvent(), eventWasHandled); } -@@ -508,6 +527,8 @@ void PageClientImpl::computeHasVisualSearchResults(const URL& imageURL, Shareabl +@@ -493,6 +512,8 @@ void PageClientImpl::computeHasVisualSearchResults(const URL& imageURL, Shareabl RefPtr PageClientImpl::createPopupMenuProxy(WebPageProxy& page) { + if (_headless) + return nullptr; - return WebPopupMenuProxyMac::create(m_view, page.popupMenuClient()); + return WebPopupMenuProxyMac::create(m_view.get().get(), page.popupMenuClient()); } -@@ -643,6 +664,12 @@ CALayer *PageClientImpl::footerBannerLayer() const +@@ -633,6 +654,12 @@ CALayer *PageClientImpl::footerBannerLayer() const return m_impl->footerBannerLayer(); } @@ -19199,12 +17754,12 @@ index 6f5fd6287d435161dd7a7269fccc32cada2aabd5..79f171aaba64bca6a6bc853edb5b77ef RefPtr PageClientImpl::takeViewSnapshot(std::optional&&) { return m_impl->takeViewSnapshot(); -@@ -858,6 +885,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(); +} @@ -19213,7 +17768,7 @@ index 6f5fd6287d435161dd7a7269fccc32cada2aabd5..79f171aaba64bca6a6bc853edb5b77ef void PageClientImpl::navigationGestureDidBegin() { m_impl->dismissContentRelativeChildWindowsWithAnimation(true); -@@ -1036,6 +1070,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) { @@ -19247,7 +17802,7 @@ index f46895285dbc84c624537a194814c18f771a0c08..29ef9e5afa13b8d2b47b7f2dd4ce3784 } +#endif diff --git a/Source/WebKit/UIProcess/mac/WebContextMenuProxyMac.h b/Source/WebKit/UIProcess/mac/WebContextMenuProxyMac.h -index 1904f5ddedb75ee74aa84154fb9af248646c2fa2..af987387cc6537c225dd80515560c840319157f2 100644 +index a3c53c0bf913385d4d2d92900360d5f7d75927f8..e5570ef599ff1b59224648c353f8ab16f8fe7f88 100644 --- a/Source/WebKit/UIProcess/mac/WebContextMenuProxyMac.h +++ b/Source/WebKit/UIProcess/mac/WebContextMenuProxyMac.h @@ -81,6 +81,7 @@ private: @@ -19259,10 +17814,10 @@ index 1904f5ddedb75ee74aa84154fb9af248646c2fa2..af987387cc6537c225dd80515560c840 bool showAfterPostProcessingContextData(); diff --git a/Source/WebKit/UIProcess/mac/WebContextMenuProxyMac.mm b/Source/WebKit/UIProcess/mac/WebContextMenuProxyMac.mm -index c962b29e655a421e3199505d2aa8546a83dbd583..85dc988495ba9b4eef48ee501afb5f854b687678 100644 +index c8d9a4ae3fb5ef85afa837a1743c119ae34e1f7b..486a774cd1c98d9985c9d3c92418f835a9be2de1 100644 --- a/Source/WebKit/UIProcess/mac/WebContextMenuProxyMac.mm +++ b/Source/WebKit/UIProcess/mac/WebContextMenuProxyMac.mm -@@ -538,6 +538,12 @@ RetainPtr WebContextMenuProxyMac::createShareMenuItem(ShareMenuItemT +@@ -530,6 +530,12 @@ RetainPtr WebContextMenuProxyMac::createShareMenuItem(ShareMenuItemT } #endif @@ -19467,10 +18022,18 @@ index 0000000000000000000000000000000000000000..dd52991f936aa1c046b404801ee97237 + +} // namespace WebKit diff --git a/Source/WebKit/UIProcess/mac/WebViewImpl.h b/Source/WebKit/UIProcess/mac/WebViewImpl.h -index 13b4e79c748071d02fedd8bced9ef0304943c51d..5830a3a3145b103a041cd2ff6666f8eff7666e3b 100644 +index 85f0df23b0b5c1e76f2c9e12ad43b9802c23f579..9202e7923ded8b543dcee636166c100e739a094f 100644 --- a/Source/WebKit/UIProcess/mac/WebViewImpl.h +++ b/Source/WebKit/UIProcess/mac/WebViewImpl.h -@@ -566,6 +566,9 @@ public: +@@ -35,6 +35,7 @@ + #include "WKLayoutMode.h" + #include "WKTextAnimationType.h" + #include ++#include + #include + #include + #include +@@ -570,6 +571,9 @@ public: void provideDataForPasteboard(NSPasteboard *, NSString *type); NSArray *namesOfPromisedFilesDroppedAtDestination(NSURL *dropDestination); @@ -19481,10 +18044,10 @@ index 13b4e79c748071d02fedd8bced9ef0304943c51d..5830a3a3145b103a041cd2ff6666f8ef RefPtr takeViewSnapshot(ForceSoftwareCapturingViewportSnapshot); void saveBackForwardSnapshotForCurrentItem(); diff --git a/Source/WebKit/UIProcess/mac/WebViewImpl.mm b/Source/WebKit/UIProcess/mac/WebViewImpl.mm -index 9fe23e004a89f08ca6583181b01a72b5025c1d93..3028a0946be2d5fe51d92fd1de5bc0668bbb55c8 100644 +index fa8aba243a8808dc781d40f1daf1480e6b655656..85f02dbfa3cfe47ee2adceee2714104445cdb7ba 100644 --- a/Source/WebKit/UIProcess/mac/WebViewImpl.mm +++ b/Source/WebKit/UIProcess/mac/WebViewImpl.mm -@@ -2415,6 +2415,11 @@ WebCore::DestinationColorSpace WebViewImpl::colorSpace() +@@ -2444,6 +2444,11 @@ WebCore::DestinationColorSpace WebViewImpl::colorSpace() if (!m_colorSpace) m_colorSpace = [NSColorSpace sRGBColorSpace]; } @@ -19496,7 +18059,7 @@ index 9fe23e004a89f08ca6583181b01a72b5025c1d93..3028a0946be2d5fe51d92fd1de5bc066 ASSERT(m_colorSpace); return WebCore::DestinationColorSpace { [m_colorSpace CGColorSpace] }; -@@ -4587,6 +4592,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); } @@ -20424,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 53f900a15956048fd25f9b0d54d6b74580612abb..133eaf568fa054d93ebf3a41e8f78b02fb0a39f7 100644 +index 7504d2cdd6d31bdfb1892dab8e1716253ce54ccc..c1ecef732f88cbf5c6277a0aa5c0d48806565ac2 100644 --- a/Source/WebKit/WebKit.xcodeproj/project.pbxproj +++ b/Source/WebKit/WebKit.xcodeproj/project.pbxproj -@@ -1542,6 +1542,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 */; }; @@ -20435,7 +18998,7 @@ index 53f900a15956048fd25f9b0d54d6b74580612abb..133eaf568fa054d93ebf3a41e8f78b02 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 */; }; -@@ -2323,6 +2324,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 */; }; @@ -20454,7 +19017,7 @@ index 53f900a15956048fd25f9b0d54d6b74580612abb..133eaf568fa054d93ebf3a41e8f78b02 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, ); }; }; -@@ -2422,6 +2435,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 */; }; @@ -20463,9 +19026,9 @@ index 53f900a15956048fd25f9b0d54d6b74580612abb..133eaf568fa054d93ebf3a41e8f78b02 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 */; }; -@@ -2447,6 +2462,9 @@ - ED82A7F2128C6FAF004477B3 /* WKBundlePageOverlay.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A22F0FF1289FCD90085E74F /* WKBundlePageOverlay.h */; settings = {ATTRIBUTES = (Private, ); }; }; - 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 */; }; @@ -20473,7 +19036,7 @@ index 53f900a15956048fd25f9b0d54d6b74580612abb..133eaf568fa054d93ebf3a41e8f78b02 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, ); }; }; -@@ -6307,6 +6325,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 = ""; }; @@ -20481,7 +19044,7 @@ index 53f900a15956048fd25f9b0d54d6b74580612abb..133eaf568fa054d93ebf3a41e8f78b02 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 = ""; }; -@@ -8025,6 +8044,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 = ""; }; @@ -20501,19 +19064,19 @@ index 53f900a15956048fd25f9b0d54d6b74580612abb..133eaf568fa054d93ebf3a41e8f78b02 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 = ""; }; -@@ -8198,6 +8230,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 = ""; }; -@@ -8234,6 +8268,14 @@ - F036978715F4BF0500C3A80E /* WebColorPicker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebColorPicker.cpp; sourceTree = ""; }; + 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 = ""; }; + F303B847249A8D3A0031DE5C /* ScreencastEncoder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScreencastEncoder.cpp; sourceTree = ""; }; + F303B848249A8D3A0031DE5C /* ScreencastEncoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScreencastEncoder.h; sourceTree = ""; }; + F31E2DA424C76E4B004B2775 /* WebMFileWriter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebMFileWriter.cpp; sourceTree = ""; }; @@ -20525,7 +19088,7 @@ index 53f900a15956048fd25f9b0d54d6b74580612abb..133eaf568fa054d93ebf3a41e8f78b02 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 = ""; }; -@@ -8592,6 +8634,7 @@ +@@ -8825,6 +8867,7 @@ 3766F9EE189A1241003CF19B /* JavaScriptCore.framework in Frameworks */, 3766F9F1189A1254003CF19B /* libicucore.dylib in Frameworks */, 7B9FC5BB28A5233B007570E7 /* libWebKitPlatform.a in Frameworks */, @@ -20533,7 +19096,7 @@ index 53f900a15956048fd25f9b0d54d6b74580612abb..133eaf568fa054d93ebf3a41e8f78b02 3766F9EF189A1244003CF19B /* QuartzCore.framework in Frameworks */, 37694525184FC6B600CDE21F /* Security.framework in Frameworks */, 37BEC4DD1948FC6A008B4286 /* WebCore.framework in Frameworks */, -@@ -11661,6 +11704,7 @@ +@@ -12013,6 +12056,7 @@ 99788ACA1F421DCA00C08000 /* _WKAutomationSessionConfiguration.mm */, 990D28A81C6404B000986977 /* _WKAutomationSessionDelegate.h */, 990D28AF1C65203900986977 /* _WKAutomationSessionInternal.h */, @@ -20541,7 +19104,7 @@ index 53f900a15956048fd25f9b0d54d6b74580612abb..133eaf568fa054d93ebf3a41e8f78b02 5C4609E222430E4C009943C2 /* _WKContentRuleListAction.h */, 5C4609E322430E4D009943C2 /* _WKContentRuleListAction.mm */, 5C4609E422430E4D009943C2 /* _WKContentRuleListActionInternal.h */, -@@ -13028,6 +13072,7 @@ +@@ -13392,6 +13436,7 @@ E34B110C27C46BC6006D2F2E /* libWebCoreTestShim.dylib */, E34B110F27C46D09006D2F2E /* libWebCoreTestSupport.dylib */, DDE992F4278D06D900F60D26 /* libWebKitAdditions.a */, @@ -20549,7 +19112,7 @@ index 53f900a15956048fd25f9b0d54d6b74580612abb..133eaf568fa054d93ebf3a41e8f78b02 57A9FF15252C6AEF006A2040 /* libWTF.a */, 5750F32A2032D4E500389347 /* LocalAuthentication.framework */, 570DAAB0230273D200E8FC04 /* NearField.framework */, -@@ -13609,6 +13654,12 @@ +@@ -13974,6 +14019,12 @@ children = ( 9197940423DBC4BB00257892 /* InspectorBrowserAgent.cpp */, 9197940323DBC4BB00257892 /* InspectorBrowserAgent.h */, @@ -20562,7 +19125,7 @@ index 53f900a15956048fd25f9b0d54d6b74580612abb..133eaf568fa054d93ebf3a41e8f78b02 ); path = Agents; sourceTree = ""; -@@ -13617,6 +13668,7 @@ +@@ -13982,6 +14033,7 @@ isa = PBXGroup; children = ( A5D3504D1D78F0D2005124A9 /* RemoteWebInspectorUIProxyMac.mm */, @@ -20570,7 +19133,7 @@ index 53f900a15956048fd25f9b0d54d6b74580612abb..133eaf568fa054d93ebf3a41e8f78b02 1CA8B935127C774E00576C2B /* WebInspectorUIProxyMac.mm */, 99A7ACE326012919006D57FD /* WKInspectorResourceURLSchemeHandler.h */, 99A7ACE42601291A006D57FD /* WKInspectorResourceURLSchemeHandler.mm */, -@@ -14353,6 +14405,7 @@ +@@ -14736,6 +14788,7 @@ E1513C65166EABB200149FCB /* AuxiliaryProcessProxy.h */, 46A2B6061E5675A200C3DEDA /* BackgroundProcessResponsivenessTimer.cpp */, 46A2B6071E5675A200C3DEDA /* BackgroundProcessResponsivenessTimer.h */, @@ -20578,7 +19141,7 @@ index 53f900a15956048fd25f9b0d54d6b74580612abb..133eaf568fa054d93ebf3a41e8f78b02 5C6D69352AC3935D0099BDAF /* BrowsingContextGroup.cpp */, 5C6D69362AC3935D0099BDAF /* BrowsingContextGroup.h */, 5CA98549210BEB5A0057EB6B /* BrowsingWarning.h */, -@@ -14377,6 +14430,8 @@ +@@ -14760,6 +14813,8 @@ BC06F43912DBCCFB002D78DE /* GeolocationPermissionRequestProxy.cpp */, BC06F43812DBCCFB002D78DE /* GeolocationPermissionRequestProxy.h */, 2DD5A72A1EBF09A7009BA597 /* HiddenPageThrottlingAutoIncreasesCounter.h */, @@ -20587,15 +19150,15 @@ index 53f900a15956048fd25f9b0d54d6b74580612abb..133eaf568fa054d93ebf3a41e8f78b02 5CEABA2B2333251400797797 /* LegacyGlobalSettings.cpp */, 5CEABA2A2333247700797797 /* LegacyGlobalSettings.h */, 31607F3819627002009B87DA /* LegacySessionStateCoding.h */, -@@ -14410,6 +14465,7 @@ - 1A0C227D2451130A00ED614D /* QuickLookThumbnailingSoftLink.mm */, - 1AEE57232409F142002005D6 /* QuickLookThumbnailLoader.h */, - 1AEE57242409F142002005D6 /* QuickLookThumbnailLoader.mm */, +@@ -14789,6 +14844,7 @@ + 4683569B21E81CC7006E27A3 /* ProvisionalPageProxy.cpp */, + 4683569A21E81CC7006E27A3 /* ProvisionalPageProxy.h */, + 411B89CB27B2B89600F9EBD3 /* QueryPermissionResultCallback.h */, + D71A94392370F060002C4D9E /* RemoteInspectorPipe.h */, 5CCB54DC2A4FEA6A0005FAA8 /* RemotePageDrawingAreaProxy.cpp */, 5CCB54DB2A4FEA6A0005FAA8 /* RemotePageDrawingAreaProxy.h */, FABBBC802D35AC6800820017 /* RemotePageFullscreenManagerProxy.cpp */, -@@ -14512,6 +14568,8 @@ +@@ -14892,6 +14948,8 @@ BC7B6204129A0A6700D174A4 /* WebPageGroup.h */, 2D9EA3101A96D9EB002D2807 /* WebPageInjectedBundleClient.cpp */, 2D9EA30E1A96CBFF002D2807 /* WebPageInjectedBundleClient.h */, @@ -20604,7 +19167,7 @@ index 53f900a15956048fd25f9b0d54d6b74580612abb..133eaf568fa054d93ebf3a41e8f78b02 9B7F8A502C785725000057F3 /* WebPageLoadTiming.h */, BC111B0B112F5E4F00337BAB /* WebPageProxy.cpp */, BC032DCB10F4389F0058C15A /* WebPageProxy.h */, -@@ -14690,6 +14748,7 @@ +@@ -15070,6 +15128,7 @@ BC646C1911DD399F006455B0 /* WKBackForwardListItemRef.h */, BC646C1611DD399F006455B0 /* WKBackForwardListRef.cpp */, BC646C1711DD399F006455B0 /* WKBackForwardListRef.h */, @@ -20612,7 +19175,7 @@ index 53f900a15956048fd25f9b0d54d6b74580612abb..133eaf568fa054d93ebf3a41e8f78b02 BCB9E24A1120E15C00A137E0 /* WKContext.cpp */, BCB9E2491120E15C00A137E0 /* WKContext.h */, 1AE52F9319201F6B00A1FA37 /* WKContextConfigurationRef.cpp */, -@@ -15265,6 +15324,9 @@ +@@ -15646,6 +15705,9 @@ 07EF07592745A8160066EA04 /* DisplayCaptureSessionManager.h */, 07EF07582745A8160066EA04 /* DisplayCaptureSessionManager.mm */, 7AFA6F682A9F57C50055322A /* DisplayLinkMac.cpp */, @@ -20622,7 +19185,7 @@ index 53f900a15956048fd25f9b0d54d6b74580612abb..133eaf568fa054d93ebf3a41e8f78b02 1AFDE65B1954E8D500C48FFA /* LegacySessionStateCoding.cpp */, 0FCB4E5818BBE3D9000FCFC9 /* PageClientImplMac.h */, 0FCB4E5918BBE3D9000FCFC9 /* PageClientImplMac.mm */, -@@ -15288,6 +15350,8 @@ +@@ -15669,6 +15731,8 @@ E568B92120A3AC6A00E3C856 /* WebDataListSuggestionsDropdownMac.mm */, E55CD20124D09F1F0042DB9C /* WebDateTimePickerMac.h */, E55CD20224D09F1F0042DB9C /* WebDateTimePickerMac.mm */, @@ -20631,7 +19194,7 @@ index 53f900a15956048fd25f9b0d54d6b74580612abb..133eaf568fa054d93ebf3a41e8f78b02 BC857E8512B71EBB00EDEB2E /* WebPageProxyMac.mm */, BC5750951268F3C6006F0F12 /* WebPopupMenuProxyMac.h */, BC5750961268F3C6006F0F12 /* WebPopupMenuProxyMac.mm */, -@@ -16361,6 +16425,7 @@ +@@ -16775,6 +16839,7 @@ 99788ACB1F421DDA00C08000 /* _WKAutomationSessionConfiguration.h in Headers */, 990D28AC1C6420CF00986977 /* _WKAutomationSessionDelegate.h in Headers */, 990D28B11C65208D00986977 /* _WKAutomationSessionInternal.h in Headers */, @@ -20639,7 +19202,7 @@ index 53f900a15956048fd25f9b0d54d6b74580612abb..133eaf568fa054d93ebf3a41e8f78b02 5C4609E7224317B4009943C2 /* _WKContentRuleListAction.h in Headers */, 5C4609E8224317BB009943C2 /* _WKContentRuleListActionInternal.h in Headers */, 9B4CE9512CD99B7C00351173 /* _WKContentWorldConfiguration.h in Headers */, -@@ -16669,6 +16734,7 @@ +@@ -17087,6 +17152,7 @@ E170876C16D6CA6900F99226 /* BlobRegistryProxy.h in Headers */, 4F601432155C5AA2001FBDE0 /* BlockingResponseMap.h in Headers */, 1A5705111BE410E600874AF1 /* BlockSPI.h in Headers */, @@ -20647,7 +19210,7 @@ index 53f900a15956048fd25f9b0d54d6b74580612abb..133eaf568fa054d93ebf3a41e8f78b02 5CA9854A210BEB640057EB6B /* BrowsingWarning.h in Headers */, A7E69BCC2B2117A100D43D3F /* BufferAndBackendInfo.h in Headers */, BC3065FA1259344E00E71278 /* CacheModel.h in Headers */, -@@ -16853,7 +16919,11 @@ +@@ -17270,7 +17336,11 @@ BC14DF77120B5B7900826C0C /* InjectedBundleScriptWorld.h in Headers */, CE550E152283752200D28791 /* InsertTextOptions.h in Headers */, 9197940523DBC4BB00257892 /* InspectorBrowserAgent.h in Headers */, @@ -20659,7 +19222,7 @@ index 53f900a15956048fd25f9b0d54d6b74580612abb..133eaf568fa054d93ebf3a41e8f78b02 A5E391FD2183C1F800C8FB31 /* InspectorTargetProxy.h in Headers */, C5BCE5DF1C50766A00CDE3FA /* InteractionInformationAtPosition.h in Headers */, 2D4D2C811DF60BF3002EB10C /* InteractionInformationRequest.h in Headers */, -@@ -17115,6 +17185,7 @@ +@@ -17531,6 +17601,7 @@ 0F6E7C532C4C386800F1DB85 /* RemoteDisplayListRecorderMessages.h in Headers */, F451C0FE2703B263002BA03B /* RemoteDisplayListRecorderProxy.h in Headers */, A78A5FE42B0EB39E005036D3 /* RemoteImageBufferSetIdentifier.h in Headers */, @@ -20667,15 +19230,15 @@ index 53f900a15956048fd25f9b0d54d6b74580612abb..133eaf568fa054d93ebf3a41e8f78b02 2D47B56D1810714E003A3AEE /* RemoteLayerBackingStore.h in Headers */, 2DDF731518E95060004F5A66 /* RemoteLayerBackingStoreCollection.h in Headers */, 1AB16AEA164B3A8800290D62 /* RemoteLayerTreeContext.h in Headers */, -@@ -17170,6 +17241,7 @@ +@@ -17588,6 +17659,7 @@ E1E552C516AE065F004ED653 /* SandboxInitializationParameters.h in Headers */, E36FF00327F36FBD004BE21A /* SandboxStateVariables.h in Headers */, 7BAB111025DD02B3008FC479 /* ScopedActiveMessageReceiveQueue.h in Headers */, + F303B849249A8D640031DE5C /* ScreencastEncoder.h in Headers */, + 6D4DF20C2D824242001F964C /* ScreenTimeWebsiteDataSupport.h in Headers */, 463BB93A2B9D08D80098C5C3 /* ScriptMessageHandlerIdentifier.h in Headers */, F4E28A362C923814008120DD /* ScriptTelemetry.h in Headers */, - E4D54D0421F1D72D007E3C36 /* ScrollingTreeFrameScrollingNodeRemoteIOS.h in Headers */, -@@ -17530,6 +17602,8 @@ +@@ -17950,6 +18022,8 @@ 939EF87029D112EE00F23AEE /* WebPageInlines.h in Headers */, 9197940823DBC4CB00257892 /* WebPageInspectorAgentBase.h in Headers */, A513F5402154A5D700662841 /* WebPageInspectorController.h in Headers */, @@ -20684,7 +19247,7 @@ index 53f900a15956048fd25f9b0d54d6b74580612abb..133eaf568fa054d93ebf3a41e8f78b02 A543E30C215C8A8D00279CD9 /* WebPageInspectorTarget.h in Headers */, A543E30D215C8A9000279CD9 /* WebPageInspectorTargetController.h in Headers */, A543E307215AD13700279CD9 /* WebPageInspectorTargetFrontendChannel.h in Headers */, -@@ -20064,7 +20138,43 @@ +@@ -20613,7 +20687,43 @@ 522F792928D50EBB0069B45B /* HidService.mm in Sources */, 2749F6442146561B008380BF /* InjectedBundleNodeHandle.cpp in Sources */, 2749F6452146561E008380BF /* InjectedBundleRangeHandle.cpp in Sources */, @@ -20728,20 +19291,20 @@ index 53f900a15956048fd25f9b0d54d6b74580612abb..133eaf568fa054d93ebf3a41e8f78b02 1C5DC45F2909B05A0061EC62 /* JSWebExtensionWrapperCocoa.mm in Sources */, C14D37FE24ACE086007FF014 /* LaunchServicesDatabaseManager.mm in Sources */, C1710CF724AA643200D7C112 /* LaunchServicesDatabaseObserver.mm in Sources */, -@@ -20425,6 +20535,8 @@ +@@ -21013,6 +21123,8 @@ 074E87E12CF8EA3D0059E469 /* WebPage+NavigationDeciding.swift in Sources */, 078B04A02CF18EAB00B453A6 /* WebPage+NavigationPreferences.swift in Sources */, 07CB79962CE9435700199C49 /* WebPage.swift in Sources */, + D79902B1236E9404005D6F7E /* WebPageInspectorEmulationAgentMac.mm in Sources */, + D79902B3236E9404005D6F7E /* WebPageInspectorInputAgentMac.mm in Sources */, 7CE9CE101FA0767A000177DE /* WebPageUpdatePreferences.cpp in Sources */, - 7CEB00DD1FA69ABE0065473B /* WebPreferencesFeatures.cpp in Sources */, - 7CF1907125338F3800ABE183 /* WebPreferencesGetterSetters.cpp in Sources */, + 079A4DA12D72CC0D00CA387F /* WebPageWebView.swift in Sources */, + CA2506A82DD65327001D1954 /* WebPageWebViewAdditions.swift in Sources */, diff --git a/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp b/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp -index ac0032c3bf918b6dcadd21c18700f1adb74e9a78..4f55fe73551265aa22f743e7ec006e2c9b213463 100644 +index bd3aaaf9309aec01820d0950d3b6f14a23c6076c..8cdb9a0c339c0499034fa801395367dd62346268 100644 --- a/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp +++ b/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp -@@ -247,6 +247,11 @@ void WebLoaderStrategy::scheduleLoad(ResourceLoader& resourceLoader, CachedResou +@@ -271,6 +271,11 @@ void WebLoaderStrategy::scheduleLoad(ResourceLoader& resourceLoader, CachedResou } #endif @@ -20753,40 +19316,39 @@ index ac0032c3bf918b6dcadd21c18700f1adb74e9a78..4f55fe73551265aa22f743e7ec006e2c #if ENABLE(PDFJS) if (tryLoadingUsingPDFJSHandler(resourceLoader, trackingParameters)) return; -@@ -256,12 +261,16 @@ void WebLoaderStrategy::scheduleLoad(ResourceLoader& resourceLoader, CachedResou - return; +@@ -285,12 +290,16 @@ void WebLoaderStrategy::scheduleLoad(ResourceLoader& resourceLoader, CachedResou + } if (InspectorInstrumentationWebKit::shouldInterceptRequest(resourceLoader)) { -- InspectorInstrumentationWebKit::interceptRequest(resourceLoader, [this, protectedResourceLoader = Ref { resourceLoader }, trackingParameters, shouldClearReferrerOnHTTPSToHTTPRedirect, resource](const ResourceRequest& request) { +- InspectorInstrumentationWebKit::interceptRequest(resourceLoader, [this, protectedThis = Ref { *this }, protectedResourceLoader = Ref { resourceLoader }, trackingParameters, shouldClearReferrerOnHTTPSToHTTPRedirect, resource](const ResourceRequest& request) { - auto& resourceLoader = protectedResourceLoader.get(); - WEBLOADERSTRATEGY_RELEASE_LOG("scheduleLoad: intercepted URL will be scheduled with the NetworkProcess"); -- scheduleLoadFromNetworkProcess(resourceLoader, request, trackingParameters, shouldClearReferrerOnHTTPSToHTTPRedirect, maximumBufferingTime(resource)); +- scheduleLoadFromNetworkProcess(resourceLoader, request, *trackingParameters, shouldClearReferrerOnHTTPSToHTTPRedirect, maximumBufferingTime(resource)); - }); - return; + bool isMainFrameNavigation = resourceLoader.frame() && resourceLoader.frame()->isMainFrame() && resourceLoader.options().mode == FetchOptions::Mode::Navigate; + // Do not intercept navigation request which could already have been intercepted and resumed. + if (!(isMainFrameNavigation && m_existingNetworkResourceLoadIdentifierToResume)) { -+ InspectorInstrumentationWebKit::interceptRequest(resourceLoader, [this, protectedResourceLoader = Ref { resourceLoader }, trackingParameters, shouldClearReferrerOnHTTPSToHTTPRedirect, resource](const ResourceRequest& request) { ++ InspectorInstrumentationWebKit::interceptRequest(resourceLoader, [this, protectedThis = Ref { *this }, protectedResourceLoader = Ref { resourceLoader }, trackingParameters, shouldClearReferrerOnHTTPSToHTTPRedirect, resource](const ResourceRequest& request) { + auto& resourceLoader = protectedResourceLoader.get(); + WEBLOADERSTRATEGY_RELEASE_LOG("scheduleLoad: intercepted URL will be scheduled with the NetworkProcess"); -+ scheduleLoadFromNetworkProcess(resourceLoader, request, trackingParameters, shouldClearReferrerOnHTTPSToHTTPRedirect, maximumBufferingTime(resource)); ++ scheduleLoadFromNetworkProcess(resourceLoader, request, *trackingParameters, shouldClearReferrerOnHTTPSToHTTPRedirect, maximumBufferingTime(resource)); + }); + return; + } } WEBLOADERSTRATEGY_RELEASE_LOG_FORWARDABLE(WEBLOADERSTRATEGY_SCHEDULELOAD); -@@ -383,7 +392,8 @@ static void addParametersShared(const LocalFrame* frame, NetworkResourceLoadPara +@@ -415,7 +424,7 @@ static void addParametersShared(const LocalFrame* frame, NetworkResourceLoadPara parameters.linkPreconnectEarlyHintsEnabled = mainFrame->settings().linkPreconnectEarlyHintsEnabled(); } -void WebLoaderStrategy::scheduleLoadFromNetworkProcess(ResourceLoader& resourceLoader, const ResourceRequest& request, const WebResourceLoader::TrackingParameters& trackingParameters, bool shouldClearReferrerOnHTTPSToHTTPRedirect, Seconds maximumBufferingTime) -+// static +bool WebLoaderStrategy::fillParametersForNetworkProcessLoad(ResourceLoader& resourceLoader, const ResourceRequest& request, const WebResourceLoader::TrackingParameters& trackingParameters, bool shouldClearReferrerOnHTTPSToHTTPRedirect, Seconds maximumBufferingTime, NetworkResourceLoadParameters& loadParameters) { auto identifier = *resourceLoader.identifier(); -@@ -395,10 +405,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)) { @@ -20799,15 +19361,22 @@ index ac0032c3bf918b6dcadd21c18700f1adb74e9a78..4f55fe73551265aa22f743e7ec006e2c } } -@@ -408,7 +418,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); -- NetworkResourceLoadParameters loadParameters; +- NetworkResourceLoadParameters loadParameters { +- trackingParameters.webPageProxyID, +- trackingParameters.pageID, +- trackingParameters.frameID, +- request +- }; +- loadParameters.createSandboxExtensionHandlesIfNecessary(); +- loadParameters.identifier = identifier; - loadParameters.webPageProxyID = trackingParameters.webPageProxyID; - loadParameters.webPageID = trackingParameters.pageID; -@@ -499,14 +508,11 @@ void WebLoaderStrategy::scheduleLoadFromNetworkProcess(ResourceLoader& resourceL + loadParameters.parentPID = legacyPresentingApplicationPID(); + loadParameters.contentSniffingPolicy = contentSniffingPolicy; +@@ -531,14 +532,11 @@ void WebLoaderStrategy::scheduleLoadFromNetworkProcess(ResourceLoader& resourceL if (loadParameters.options.mode != FetchOptions::Mode::Navigate) { ASSERT(loadParameters.sourceOrigin); @@ -20825,25 +19394,33 @@ index ac0032c3bf918b6dcadd21c18700f1adb74e9a78..4f55fe73551265aa22f743e7ec006e2c loadParameters.isMainFrameNavigation = isMainFrameNavigation; if (loadParameters.isMainFrameNavigation && document) -@@ -547,6 +553,17 @@ void WebLoaderStrategy::scheduleLoadFromNetworkProcess(ResourceLoader& resourceL - } +@@ -585,6 +583,25 @@ void WebLoaderStrategy::scheduleLoadFromNetworkProcess(ResourceLoader& resourceL + if (RefPtr frameLoader = resourceLoader.frameLoader()) + loadParameters.requiredCookiesVersion = frameLoader->requiredCookiesVersion(); - ASSERT((loadParameters.webPageID && loadParameters.webFrameID) || loadParameters.clientCredentialPolicy == ClientCredentialPolicy::CannotAskClientForCredentials); + return true; +} + +void WebLoaderStrategy::scheduleLoadFromNetworkProcess(ResourceLoader& resourceLoader, const ResourceRequest& request, const WebResourceLoader::TrackingParameters& trackingParameters, bool shouldClearReferrerOnHTTPSToHTTPRedirect, Seconds maximumBufferingTime) +{ -+ NetworkResourceLoadParameters loadParameters; ++ NetworkResourceLoadParameters loadParameters { ++ trackingParameters.webPageProxyID, ++ trackingParameters.pageID, ++ trackingParameters.frameID, ++ request ++ }; ++ loadParameters.createSandboxExtensionHandlesIfNecessary(); ++ + if (!fillParametersForNetworkProcessLoad(resourceLoader, request, trackingParameters, shouldClearReferrerOnHTTPSToHTTPRedirect, maximumBufferingTime, loadParameters)) { + WEBLOADERSTRATEGY_RELEASE_LOG_ERROR("scheduleLoad: no sourceOrigin (priority=%d)", static_cast(resourceLoader.request().priority())); + scheduleInternallyFailedLoad(resourceLoader); + return; + } - ++ std::optional existingNetworkResourceLoadIdentifierToResume; if (loadParameters.isMainFrameNavigation) -@@ -562,7 +579,7 @@ void WebLoaderStrategy::scheduleLoadFromNetworkProcess(ResourceLoader& resourceL + existingNetworkResourceLoadIdentifierToResume = std::exchange(m_existingNetworkResourceLoadIdentifierToResume, std::nullopt); +@@ -599,7 +616,7 @@ void WebLoaderStrategy::scheduleLoadFromNetworkProcess(ResourceLoader& resourceL } auto loader = WebResourceLoader::create(resourceLoader, trackingParameters); @@ -20852,7 +19429,7 @@ index ac0032c3bf918b6dcadd21c18700f1adb74e9a78..4f55fe73551265aa22f743e7ec006e2c } void WebLoaderStrategy::scheduleInternallyFailedLoad(WebCore::ResourceLoader& resourceLoader) -@@ -966,7 +983,7 @@ void WebLoaderStrategy::didFinishPreconnection(WebCore::ResourceLoaderIdentifier +@@ -1017,7 +1034,7 @@ void WebLoaderStrategy::didFinishPreconnection(WebCore::ResourceLoaderIdentifier bool WebLoaderStrategy::isOnLine() const { @@ -20861,7 +19438,7 @@ index ac0032c3bf918b6dcadd21c18700f1adb74e9a78..4f55fe73551265aa22f743e7ec006e2c } void WebLoaderStrategy::addOnlineStateChangeListener(Function&& listener) -@@ -993,6 +1010,11 @@ void WebLoaderStrategy::isResourceLoadFinished(CachedResource& resource, Complet +@@ -1044,6 +1061,11 @@ void WebLoaderStrategy::isResourceLoadFinished(CachedResource& resource, Complet void WebLoaderStrategy::setOnLineState(bool isOnLine) { @@ -20873,7 +19450,7 @@ index ac0032c3bf918b6dcadd21c18700f1adb74e9a78..4f55fe73551265aa22f743e7ec006e2c if (m_isOnLine == isOnLine) return; -@@ -1001,6 +1023,12 @@ void WebLoaderStrategy::setOnLineState(bool isOnLine) +@@ -1052,6 +1074,12 @@ void WebLoaderStrategy::setOnLineState(bool isOnLine) listener(isOnLine); } @@ -20887,24 +19464,24 @@ index ac0032c3bf918b6dcadd21c18700f1adb74e9a78..4f55fe73551265aa22f743e7ec006e2c { WebProcess::singleton().ensureNetworkProcessConnection().connection().send(Messages::NetworkConnectionToWebProcess::SetCaptureExtraNetworkLoadMetricsEnabled(enabled), 0); diff --git a/Source/WebKit/WebProcess/Network/WebLoaderStrategy.h b/Source/WebKit/WebProcess/Network/WebLoaderStrategy.h -index dc88916914daebf7c421dc56c2be70fd47727a96..829fdad0490a5e4db8822fbc48c5f19a2c2e0703 100644 +index 6492031de6ed6effab3f28e5321419f3390f7651..678139fc26f26e2224a70b0087ddb849280b8ace 100644 --- a/Source/WebKit/WebProcess/Network/WebLoaderStrategy.h +++ b/Source/WebKit/WebProcess/Network/WebLoaderStrategy.h -@@ -44,6 +44,7 @@ struct FetchOptions; - namespace WebKit { +@@ -26,6 +26,7 @@ + #pragma once - class NetworkProcessConnection; -+class NetworkResourceLoadParameters; - class WebFrame; - class WebPage; - class WebProcess; + #include "NetworkResourceLoadIdentifier.h" ++#include "NetworkResourceLoadParameters.h" + #include "WebResourceLoader.h" + #include + #include @@ -96,6 +97,9 @@ public: bool isOnLine() const final; void addOnlineStateChangeListener(Function&&) final; void setOnLineState(bool); + void setEmulateOfflineState(bool) final; + -+ static bool fillParametersForNetworkProcessLoad(WebCore::ResourceLoader&, const WebCore::ResourceRequest&, const WebResourceLoader::TrackingParameters&, bool shouldClearReferrerOnHTTPSToHTTPRedirect, Seconds maximumBufferingTime, NetworkResourceLoadParameters&); ++ bool fillParametersForNetworkProcessLoad(WebCore::ResourceLoader&, const WebCore::ResourceRequest&, const WebResourceLoader::TrackingParameters&, bool shouldClearReferrerOnHTTPSToHTTPRedirect, Seconds maximumBufferingTime, NetworkResourceLoadParameters&); void setExistingNetworkResourceLoadIdentifierToResume(std::optional existingNetworkResourceLoadIdentifierToResume) { m_existingNetworkResourceLoadIdentifierToResume = existingNetworkResourceLoadIdentifierToResume; } @@ -20917,12 +19494,12 @@ index dc88916914daebf7c421dc56c2be70fd47727a96..829fdad0490a5e4db8822fbc48c5f19a } // namespace WebKit diff --git a/Source/WebKit/WebProcess/Network/WebResourceLoader.cpp b/Source/WebKit/WebProcess/Network/WebResourceLoader.cpp -index f0c21a35614b000e0a835ef4a4038feb0224842b..f9aecb9ed77192c00a3173521f72bd840ea6b571 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(); @@ -20940,20 +19517,21 @@ index f0c21a35614b000e0a835ef4a4038feb0224842b..f9aecb9ed77192c00a3173521f72bd84 } diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp -index 33b01034cea7fc023ba4bef55142ae2700d5e48c..0b0236832df43047a7808af0d422a4572231dc5e 100644 +index 78e75b9ebfa13611e7f2f9df4395a586ed9db55e..ad6db691640a56bba7fb153bd4a71eb6b618bb50 100644 --- a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp +++ b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp -@@ -490,6 +490,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)); - page->injectedBundleUIClient().willAddMessageToConsole(page.ptr(), source, level, message, lineNumber, columnNumber, sourceID); - } ++ + // FIXME: Remove this after rdar://143399667 is fixed. + 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 @@ -20962,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 2713e431893efd17c95d163f14aec45b27e0d6fc..b96b1d9cba20af611837915412fa4202667e800d 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) @@ -20981,7 +19559,7 @@ index 2713e431893efd17c95d163f14aec45b27e0d6fc..b96b1d9cba20af611837915412fa4202 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 @@ @@ -21015,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; @@ -21034,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())); @@ -21045,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. + * @@ -21083,10 +19661,13 @@ index 0000000000000000000000000000000000000000..226b3bf6bd83d2606a0aeb627ae9302f +#include "WebPageProxyMessages.h" +#include +#include ++#include +#include +#include +#include + ++#include ++ +namespace WebKit { +using namespace WebCore; + @@ -21094,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(); + @@ -21106,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..3246812f8ebb8833b2172f9f5f00dff6053387c9 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 @@ @@ -21117,35 +19698,11 @@ index ac7fa01ba9a3828cf4c48cacc862aab95145093e..3246812f8ebb8833b2172f9f5f00dff6 #include #include #include -@@ -562,6 +563,11 @@ void DrawingAreaCoordinatedGraphics::enterAcceleratedCompositingMode(GraphicsLay - m_scrollOffset = IntSize(); - m_displayTimer.stop(); - m_isWaitingForDidUpdate = false; -+// Playwright begin -+#if PLATFORM(WIN) -+ didChangeAcceleratedCompositingMode(true); -+#endif -+// Playwright end - } - - void DrawingAreaCoordinatedGraphics::sendEnterAcceleratedCompositingModeIfNeeded() -@@ -619,6 +625,11 @@ void DrawingAreaCoordinatedGraphics::exitAcceleratedCompositingMode() - // UI process, we still need to let it know about the new contents, so send an Update message. - send(Messages::DrawingAreaProxy::Update(0, WTFMove(updateInfo))); - } -+// Playwright begin -+#if PLATFORM(WIN) -+ didChangeAcceleratedCompositingMode(false); -+#endif -+// Playwright end - } - - void DrawingAreaCoordinatedGraphics::scheduleDisplay() diff --git a/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h b/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h -index f19473587ec9f1ce8fb2e249feaf1e45b0ec1b80..0908807628b0f96925d3b669b6962f3553f422ca 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 @@ -21154,7 +19711,7 @@ index f19473587ec9f1ce8fb2e249feaf1e45b0ec1b80..0908807628b0f96925d3b669b6962f35 void updateRootLayer(); WebCore::FloatRect visibleContentsRect() const; diff --git a/Source/WebKit/WebProcess/WebPage/DrawingArea.cpp b/Source/WebKit/WebProcess/WebPage/DrawingArea.cpp -index 5ba445d43ad37ff55f239660cddeada7abe2a6e8..ee3bfd8a34d4e7ea4d632cd8524457f5fb57ef15 100644 +index c07ca9e847d03c27877cf650b67b96b3c3f7bddb..b966edc8778d4a68c6e5bae0c0883ab3bfd0a387 100644 --- a/Source/WebKit/WebProcess/WebPage/DrawingArea.cpp +++ b/Source/WebKit/WebProcess/WebPage/DrawingArea.cpp @@ -27,6 +27,7 @@ @@ -21165,36 +19722,8 @@ index 5ba445d43ad37ff55f239660cddeada7abe2a6e8..ee3bfd8a34d4e7ea4d632cd8524457f5 #include "Logging.h" #include "WebPage.h" #include "WebPageCreationParameters.h" -@@ -115,6 +116,13 @@ void DrawingArea::tryMarkLayersVolatile(CompletionHandler&& completi - completionFunction(true); - } - -+#if PLATFORM(WIN) -+void DrawingArea::didChangeAcceleratedCompositingMode(bool enabled) -+{ -+ send(Messages::DrawingAreaProxy::DidChangeAcceleratedCompositingMode(enabled)); -+} -+#endif -+ - void DrawingArea::removeMessageReceiverIfNeeded() - { - if (m_hasRemovedMessageReceiver) -diff --git a/Source/WebKit/WebProcess/WebPage/DrawingArea.h b/Source/WebKit/WebProcess/WebPage/DrawingArea.h -index 6c61c9a0ee5b7a11408d5a0a06f37035e9601e25..a5ddf926e95182bd3575147aff2123f3e6a77109 100644 ---- a/Source/WebKit/WebProcess/WebPage/DrawingArea.h -+++ b/Source/WebKit/WebProcess/WebPage/DrawingArea.h -@@ -172,6 +172,9 @@ public: - virtual bool enterAcceleratedCompositingModeIfNeeded() = 0; - virtual void backgroundColorDidChange() { }; - #endif -+#if PLATFORM(WIN) -+ void didChangeAcceleratedCompositingMode(bool enabled); -+#endif - - #if PLATFORM(WPE) && USE(GBM) && ENABLE(WPE_PLATFORM) - virtual void preferredBufferFormatsDidChange() { } 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 @@ @@ -21205,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 @@ -21219,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: @@ -21232,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 a790490171adbb2bd153e84f37df524099d11496..6aa0bc62374ce01171b04d7025105ba155ecaf80 100644 +index eebb80386522babc1ae192dbc470facea0b76e6b..02da88a1fd0d655faf69c7d3bd348009da32851c 100644 --- a/Source/WebKit/WebProcess/WebPage/WebPage.cpp +++ b/Source/WebKit/WebProcess/WebPage/WebPage.cpp -@@ -241,6 +241,7 @@ +@@ -244,6 +244,7 @@ #include #include #include @@ -21243,7 +19772,7 @@ index a790490171adbb2bd153e84f37df524099d11496..6aa0bc62374ce01171b04d7025105ba1 #include #include #include -@@ -1156,6 +1157,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 @@ -21256,7 +19785,7 @@ index a790490171adbb2bd153e84f37df524099d11496..6aa0bc62374ce01171b04d7025105ba1 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); } @@ -21271,7 +19800,7 @@ index a790490171adbb2bd153e84f37df524099d11496..6aa0bc62374ce01171b04d7025105ba1 + // 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); +} @@ -21279,7 +19808,7 @@ index a790490171adbb2bd153e84f37df524099d11496..6aa0bc62374ce01171b04d7025105ba1 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); -@@ -2289,7 +2312,9 @@ void WebPage::stopLoading() +@@ -2295,7 +2318,9 @@ void WebPage::stopLoading() void WebPage::stopLoadingDueToProcessSwap() { SetForScope isStoppingLoadingDueToProcessSwap(m_isStoppingLoadingDueToProcessSwap, true); @@ -21289,7 +19818,7 @@ index a790490171adbb2bd153e84f37df524099d11496..6aa0bc62374ce01171b04d7025105ba1 } bool WebPage::defersLoading() const -@@ -2865,7 +2890,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(); @@ -21298,7 +19827,7 @@ index a790490171adbb2bd153e84f37df524099d11496..6aa0bc62374ce01171b04d7025105ba1 // Adjust view dimensions when using fixed layout. RefPtr localMainFrame = this->localMainFrame(); RefPtr view = localMainFrame ? localMainFrame->view() : nullptr; -@@ -3652,6 +3677,13 @@ void WebPage::flushDeferredScrollEvents() +@@ -3628,6 +3653,13 @@ void WebPage::flushDeferredScrollEvents() protectedCorePage()->flushDeferredScrollEvents(); } @@ -21312,7 +19841,7 @@ index a790490171adbb2bd153e84f37df524099d11496..6aa0bc62374ce01171b04d7025105ba1 void WebPage::flushDeferredDidReceiveMouseEvent() { if (auto info = std::exchange(m_deferredDidReceiveMouseEvent, std::nullopt)) -@@ -3913,6 +3945,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; @@ -21351,7 +19880,7 @@ index a790490171adbb2bd153e84f37df524099d11496..6aa0bc62374ce01171b04d7025105ba1 + 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; @@ -21410,7 +19939,7 @@ index a790490171adbb2bd153e84f37df524099d11496..6aa0bc62374ce01171b04d7025105ba1 #endif void WebPage::cancelPointer(WebCore::PointerID pointerId, const WebCore::IntPoint& documentPoint) -@@ -4001,6 +4124,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); } @@ -21427,7 +19956,7 @@ index a790490171adbb2bd153e84f37df524099d11496..6aa0bc62374ce01171b04d7025105ba1 void WebPage::insertNewlineInQuotedContent() { RefPtr frame = protectedCorePage()->checkedFocusController()->focusedOrMainFrame(); -@@ -4251,6 +4384,7 @@ void WebPage::setMainFrameDocumentVisualUpdatesAllowed(bool allowed) +@@ -4233,6 +4366,7 @@ void WebPage::setMainFrameDocumentVisualUpdatesAllowed(bool allowed) void WebPage::show() { send(Messages::WebPageProxy::ShowPage()); @@ -21435,7 +19964,7 @@ index a790490171adbb2bd153e84f37df524099d11496..6aa0bc62374ce01171b04d7025105ba1 } void WebPage::setIsTakingSnapshotsForApplicationSuspension(bool isTakingSnapshotsForApplicationSuspension) -@@ -5439,7 +5573,7 @@ NotificationPermissionRequestManager* WebPage::notificationPermissionRequestMana +@@ -5448,7 +5582,7 @@ RefPtr WebPage::protectedNotificationPermi #if ENABLE(DRAG_SUPPORT) @@ -21444,8 +19973,8 @@ index a790490171adbb2bd153e84f37df524099d11496..6aa0bc62374ce01171b04d7025105ba1 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) -@@ -7914,6 +8048,10 @@ void WebPage::didCommitLoad(WebFrame* frame) - #endif +@@ -7961,6 +8095,10 @@ void WebPage::didCommitLoad(WebFrame* frame) + m_needsFixedContainerEdgesUpdate = true; flushDeferredDidReceiveMouseEvent(); +// Playwright begin @@ -21455,9 +19984,9 @@ index a790490171adbb2bd153e84f37df524099d11496..6aa0bc62374ce01171b04d7025105ba1 } void WebPage::didFinishDocumentLoad(WebFrame& frame) -@@ -8233,6 +8371,9 @@ Ref WebPage::createDocumentLoader(LocalFrame& frame, const Resou - WebsitePoliciesData::applyToDocumentLoader(WTFMove(*m_internals->pendingWebsitePolicies), documentLoader); - m_internals->pendingWebsitePolicies = std::nullopt; +@@ -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); } + } else if (m_pendingFrameNavigationID) { + documentLoader->setNavigationID(*m_pendingFrameNavigationID); @@ -21466,10 +19995,10 @@ index a790490171adbb2bd153e84f37df524099d11496..6aa0bc62374ce01171b04d7025105ba1 return documentLoader; diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.h b/Source/WebKit/WebProcess/WebPage/WebPage.h -index 889f9a1c62a652c3de5e5edb14c9781932b8ef7b..1a708ef7835d63cdaf60db1eb4d5ade6808152b0 100644 +index 360c7068495346fa326a3409afe64c03ff11506e..263acb1412dd593a45a264c7fbd3fc16582db710 100644 --- a/Source/WebKit/WebProcess/WebPage/WebPage.h +++ b/Source/WebKit/WebProcess/WebPage/WebPage.h -@@ -43,6 +43,7 @@ +@@ -47,6 +47,7 @@ #include #include #include @@ -21477,7 +20006,7 @@ index 889f9a1c62a652c3de5e5edb14c9781932b8ef7b..1a708ef7835d63cdaf60db1eb4d5ade6 #include #include #include -@@ -1256,11 +1257,11 @@ public: +@@ -1286,11 +1287,11 @@ public: void clearSelection(); void restoreSelectionInFocusedEditableElement(); @@ -21491,17 +20020,17 @@ index 889f9a1c62a652c3de5e5edb14c9781932b8ef7b..1a708ef7835d63cdaf60db1eb4d5ade6 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 -@@ -1275,6 +1276,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) -@@ -1361,8 +1365,11 @@ public: +@@ -1394,8 +1398,11 @@ public: void gestureEvent(WebCore::FrameIdentifier, const WebGestureEvent&, CompletionHandler, bool, std::optional)>&&); #endif @@ -21514,7 +20043,7 @@ index 889f9a1c62a652c3de5e5edb14c9781932b8ef7b..1a708ef7835d63cdaf60db1eb4d5ade6 void dynamicViewportSizeUpdate(const DynamicViewportSizeUpdate&); bool scaleWasSetByUIProcess() const { return m_scaleWasSetByUIProcess; } void willStartUserTriggeredZooming(); -@@ -1513,6 +1520,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); @@ -21523,7 +20052,7 @@ index 889f9a1c62a652c3de5e5edb14c9781932b8ef7b..1a708ef7835d63cdaf60db1eb4d5ade6 void insertNewlineInQuotedContent(); -@@ -1930,6 +1939,7 @@ public: +@@ -1969,6 +1978,7 @@ public: void showContextMenuFromFrame(const FrameInfoData&, const ContextMenuContextData&, const UserData&); #endif void loadRequest(LoadParameters&&); @@ -21531,7 +20060,7 @@ index 889f9a1c62a652c3de5e5edb14c9781932b8ef7b..1a708ef7835d63cdaf60db1eb4d5ade6 void setObscuredContentInsets(const WebCore::FloatBoxExtent&); -@@ -2121,6 +2131,7 @@ private: +@@ -2171,6 +2181,7 @@ private: void updatePotentialTapSecurityOrigin(const WebTouchEvent&, bool wasHandled); #elif ENABLE(TOUCH_EVENTS) void touchEvent(const WebTouchEvent&, CompletionHandler, bool)>&&); @@ -21539,8 +20068,8 @@ index 889f9a1c62a652c3de5e5edb14c9781932b8ef7b..1a708ef7835d63cdaf60db1eb4d5ade6 #endif void cancelPointer(WebCore::PointerID, const WebCore::IntPoint&); -@@ -2884,6 +2895,7 @@ private: - UserActivity m_userActivity; +@@ -2941,6 +2952,7 @@ private: + bool m_isAppNapEnabled { true }; Markable m_pendingNavigationID; + Markable m_pendingFrameNavigationID; @@ -21548,10 +20077,10 @@ index 889f9a1c62a652c3de5e5edb14c9781932b8ef7b..1a708ef7835d63cdaf60db1eb4d5ade6 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 d38d0ecfb0e77838cc6d24b199c8be5d30d13953..1b6ddebd36f1a53a1d34a9157dffc9e8147dae19 100644 +index c4ae18f9803e00d09a3f479c03ec858dd98c9045..9b1cbcf627f104e97a7ca46b560cdb9d99dc0ffc 100644 --- a/Source/WebKit/WebProcess/WebPage/WebPage.messages.in +++ b/Source/WebKit/WebProcess/WebPage/WebPage.messages.in -@@ -57,10 +57,13 @@ messages -> WebPage WantsAsyncDispatchMessage { +@@ -58,10 +58,13 @@ messages -> WebPage WantsAsyncDispatchMessage { MouseEvent(WebCore::FrameIdentifier frameID, WebKit::WebMouseEvent event, std::optional> sandboxExtensions) SetLastKnownMousePosition(WebCore::FrameIdentifier frameID, WebCore::IntPoint eventPoint, WebCore::IntPoint globalPoint); @@ -21563,10 +20092,10 @@ index d38d0ecfb0e77838cc6d24b199c8be5d30d13953..1b6ddebd36f1a53a1d34a9157dffc9e8 SetSceneIdentifier(String sceneIdentifier) SetViewportConfigurationViewLayoutSize(WebCore::FloatSize size, double scaleFactor, double minimumEffectiveDeviceWidth) - SetDeviceOrientation(WebCore::IntDegrees deviceOrientation) - SetOverrideViewportArguments(std::optional arguments) + SetOverrideViewportArguments(struct std::optional arguments) DynamicViewportSizeUpdate(struct WebKit::DynamicViewportSizeUpdate target) -@@ -152,6 +155,7 @@ messages -> WebPage WantsAsyncDispatchMessage { +@@ -153,6 +156,7 @@ messages -> WebPage WantsAsyncDispatchMessage { ConnectInspector(String targetId, Inspector::FrontendChannel::ConnectionType connectionType) DisconnectInspector(String targetId) SendMessageToTargetBackend(String targetId, String message) @@ -21574,17 +20103,17 @@ index d38d0ecfb0e77838cc6d24b199c8be5d30d13953..1b6ddebd36f1a53a1d34a9157dffc9e8 #if ENABLE(REMOTE_INSPECTOR) SetIndicating(bool indicating); -@@ -162,6 +166,7 @@ messages -> WebPage WantsAsyncDispatchMessage { +@@ -163,6 +167,7 @@ messages -> WebPage WantsAsyncDispatchMessage { #endif #if !ENABLE(IOS_TOUCH_EVENTS) && ENABLE(TOUCH_EVENTS) - TouchEvent(WebKit::WebTouchEvent event) -> (std::optional eventType, bool handled) + TouchEvent(WebKit::WebTouchEvent event) -> (enum:uint8_t std::optional eventType, bool handled) + FakeTouchTap(WebCore::IntPoint position, uint8_t modifiers) -> () Async #endif CancelPointer(WebCore::PointerID pointerId, WebCore::IntPoint documentPoint) -@@ -189,6 +194,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) @@ -21596,15 +20125,15 @@ index d38d0ecfb0e77838cc6d24b199c8be5d30d13953..1b6ddebd36f1a53a1d34a9157dffc9e8 # Drag and drop. -#if PLATFORM(GTK) && ENABLE(DRAG_SUPPORT) +#if (PLATFORM(GTK) || PLATFORM(WPE)) && ENABLE(DRAG_SUPPORT) - PerformDragControllerAction(enum:uint8_t WebKit::DragControllerAction action, WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, OptionSet draggingSourceOperationMask, WebCore::SelectionData selection, OptionSet flags) -> (std::optional dragOperation, enum:uint8_t WebCore::DragHandlingMethod dragHandlingMethod, bool mouseIsOverFileInput, unsigned numberOfItemsToBeAccepted, WebCore::IntRect insertionRect, WebCore::IntRect editableElementRect, struct std::optional remoteUserInputEventData) + PerformDragControllerAction(enum:uint8_t WebKit::DragControllerAction action, WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, OptionSet draggingSourceOperationMask, WebCore::SelectionData selection, OptionSet flags) -> (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) #endif -#if !PLATFORM(GTK) && ENABLE(DRAG_SUPPORT) +#if !PLATFORM(GTK) && !PLATFORM(WPE) && ENABLE(DRAG_SUPPORT) - PerformDragControllerAction(std::optional frameID, enum:uint8_t WebKit::DragControllerAction action, WebCore::DragData dragData) -> (std::optional dragOperation, enum:uint8_t WebCore::DragHandlingMethod dragHandlingMethod, bool mouseIsOverFileInput, unsigned numberOfItemsToBeAccepted, WebCore::IntRect insertionRect, WebCore::IntRect editableElementRect, struct std::optional remoteUserInputEventData) + 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 -@@ -371,6 +377,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) @@ -21612,18 +20141,56 @@ index d38d0ecfb0e77838cc6d24b199c8be5d30d13953..1b6ddebd36f1a53a1d34a9157dffc9e8 +#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 ++++ b/Source/WebKit/WebProcess/WebPage/glib/WebPageGLib.cpp +@@ -210,16 +210,23 @@ String WebPage::platformUserAgent(const URL& url) const + + bool WebPage::hoverSupportedByPrimaryPointingDevice() const + { ++ if (screenHasTouchDeviceOverride()) ++ return !screenHasTouchDeviceOverride().value(); + return WebProcess::singleton().primaryPointingDevice() == AvailableInputDevices::Mouse; + } + + bool WebPage::hoverSupportedByAnyAvailablePointingDevice() const + { ++ if (screenHasTouchDeviceOverride()) ++ return !screenHasTouchDeviceOverride().value(); + return WebProcess::singleton().availableInputDevices().contains(AvailableInputDevices::Mouse); + } + + std::optional WebPage::pointerCharacteristicsOfPrimaryPointingDevice() const + { ++ if (screenHasTouchDeviceOverride() && screenHasTouchDeviceOverride().value()) ++ return PointerCharacteristics::Coarse; ++ + const auto& primaryPointingDevice = WebProcess::singleton().primaryPointingDevice(); + if (primaryPointingDevice == AvailableInputDevices::Mouse) + return PointerCharacteristics::Fine; +@@ -230,6 +237,9 @@ std::optional WebPage::pointerCharacteristicsOfPrimaryPo + + OptionSet WebPage::pointerCharacteristicsOfAllAvailablePointingDevices() const + { ++ if (screenHasTouchDeviceOverride() && screenHasTouchDeviceOverride().value()) ++ return PointerCharacteristics::Coarse; ++ + OptionSet pointerCharacteristics; + 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 740a118cfe40d803ecccbf2025efa7b813d9b918..c8acb88dd1f3b47332e3928035f74b8bd3c57049 100644 +index e9dc2250f0f5e68db6ae61f5f734e2e2cf24cf9b..3dc31fc41d8efd990f94a713c0490abf1f1d9f60 100644 --- a/Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm +++ b/Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm -@@ -696,21 +696,37 @@ String WebPage::platformUserAgent(const URL&) const +@@ -705,21 +705,37 @@ String WebPage::platformUserAgent(const URL&) const bool WebPage::hoverSupportedByPrimaryPointingDevice() const { +#if ENABLE(TOUCH_EVENTS) -+ return !screenIsTouchPrimaryInputDevice(); ++ return !screenHasTouchDevice(); +#else return true; +#endif @@ -21641,7 +20208,7 @@ index 740a118cfe40d803ecccbf2025efa7b813d9b918..c8acb88dd1f3b47332e3928035f74b8b std::optional WebPage::pointerCharacteristicsOfPrimaryPointingDevice() const { +#if ENABLE(TOUCH_EVENTS) -+ if (screenIsTouchPrimaryInputDevice()) ++ if (screenHasTouchDevice()) + return PointerCharacteristics::Coarse; +#endif return PointerCharacteristics::Fine; @@ -21657,10 +20224,10 @@ index 740a118cfe40d803ecccbf2025efa7b813d9b918..c8acb88dd1f3b47332e3928035f74b8b } diff --git a/Source/WebKit/WebProcess/WebPage/win/WebPageWin.cpp b/Source/WebKit/WebProcess/WebPage/win/WebPageWin.cpp -index f17f5d719d892309ed9c7093384945866b5117b9..1dba47bbf0dbd0362548423a74b380346dbea147 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 @@ -21668,12 +20235,12 @@ index f17f5d719d892309ed9c7093384945866b5117b9..1dba47bbf0dbd0362548423a74b38034 #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 { +#if ENABLE(TOUCH_EVENTS) -+ return !screenIsTouchPrimaryInputDevice(); ++ return !screenHasTouchDevice(); +#else return true; +#endif @@ -21691,7 +20258,7 @@ index f17f5d719d892309ed9c7093384945866b5117b9..1dba47bbf0dbd0362548423a74b38034 std::optional WebPage::pointerCharacteristicsOfPrimaryPointingDevice() const { +#if ENABLE(TOUCH_EVENTS) -+ if (screenIsTouchPrimaryInputDevice()) ++ if (screenHasTouchDevice()) + return PointerCharacteristics::Coarse; +#endif return PointerCharacteristics::Fine; @@ -21707,10 +20274,10 @@ index f17f5d719d892309ed9c7093384945866b5117b9..1dba47bbf0dbd0362548423a74b38034 } diff --git a/Source/WebKit/WebProcess/WebProcess.cpp b/Source/WebKit/WebProcess/WebProcess.cpp -index aeaaf015db254f2562085e003a84c29ea8636611..6779f7b116db8f9a0686bef70965cdf9a7d2d6f4 100644 +index 230b9bb1f8b1f218f94c10f18f4d672286ce5a9d..c9741c132685eb27737d21c7c840edb9447ec596 100644 --- a/Source/WebKit/WebProcess/WebProcess.cpp +++ b/Source/WebKit/WebProcess/WebProcess.cpp -@@ -91,6 +91,7 @@ +@@ -93,6 +93,7 @@ #include "WebsiteData.h" #include "WebsiteDataStoreParameters.h" #include "WebsiteDataType.h" @@ -21718,7 +20285,7 @@ index aeaaf015db254f2562085e003a84c29ea8636611..6779f7b116db8f9a0686bef70965cdf9 #include #include #include -@@ -378,6 +379,14 @@ void WebProcess::initializeProcess(const AuxiliaryProcessInitializationParameter +@@ -388,6 +389,14 @@ void WebProcess::initializeProcess(const AuxiliaryProcessInitializationParameter { JSC::Options::AllowUnfinalizedAccessScope scope; JSC::Options::allowNonSPTagging() = false; @@ -21733,7 +20300,7 @@ index aeaaf015db254f2562085e003a84c29ea8636611..6779f7b116db8f9a0686bef70965cdf9 JSC::Options::notifyOptionsChanged(); } -@@ -385,6 +394,8 @@ void WebProcess::initializeProcess(const AuxiliaryProcessInitializationParameter +@@ -395,6 +404,8 @@ void WebProcess::initializeProcess(const AuxiliaryProcessInitializationParameter platformInitializeProcess(parameters); updateCPULimit(); @@ -21742,19 +20309,20 @@ index aeaaf015db254f2562085e003a84c29ea8636611..6779f7b116db8f9a0686bef70965cdf9 } void WebProcess::initializeConnection(IPC::Connection* connection) -@@ -953,6 +964,7 @@ void WebProcess::createWebPage(PageIdentifier pageID, WebPageCreationParameters& +@@ -975,6 +986,8 @@ void WebProcess::createWebPage(PageIdentifier pageID, WebPageCreationParameters& accessibilityRelayProcessSuspended(false); } ASSERT(result.iterator->value); ++ + result.iterator->value->didAddWebPageToWebProcess(); } void WebProcess::removeWebPage(PageIdentifier pageID) diff --git a/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm b/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm -index 60dc8836dbd8ed1f3f4a2e476d91be6ca7ab0840..20dcdedb9e4eb742c213193eddaa947ac10ec219 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; } @@ -21764,10 +20332,10 @@ index 60dc8836dbd8ed1f3f4a2e476d91be6ca7ab0840..20dcdedb9e4eb742c213193eddaa947a - (void)touch:(WebEvent *)event { diff --git a/Source/WebKitLegacy/mac/WebView/WebView.mm b/Source/WebKitLegacy/mac/WebView/WebView.mm -index e3a23565b11b4dc4eafa3616e15d04e528de8f94..366cf2dd2348350b6dd133ce660ca5b1f73d88d3 100644 +index 222de8db3d8475b7a68b017dc88994d4ca7e08fd..ed3460c7b59772410af898d4fb107cc88c3b40a6 100644 --- a/Source/WebKitLegacy/mac/WebView/WebView.mm +++ b/Source/WebKitLegacy/mac/WebView/WebView.mm -@@ -3991,7 +3991,7 @@ + (void)_doNotStartObservingNetworkReachability +@@ -4002,7 +4002,7 @@ + (void)_doNotStartObservingNetworkReachability } #endif // PLATFORM(IOS_FAMILY) @@ -21776,7 +20344,7 @@ index e3a23565b11b4dc4eafa3616e15d04e528de8f94..366cf2dd2348350b6dd133ce660ca5b1 - (NSArray *)_touchEventRegions { -@@ -4033,7 +4033,7 @@ - (NSArray *)_touchEventRegions +@@ -4044,7 +4044,7 @@ - (NSArray *)_touchEventRegions }).autorelease(); } @@ -21787,14 +20355,16 @@ index e3a23565b11b4dc4eafa3616e15d04e528de8f94..366cf2dd2348350b6dd133ce660ca5b1 // 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 @@ -21817,12 +20387,12 @@ index 0000000000000000000000000000000000000000..dd6a53e2d57318489b7e49dd7373706d + LIBVPX_LIBRARIES +) diff --git a/Source/cmake/OptionsGTK.cmake b/Source/cmake/OptionsGTK.cmake -index d46ee01c5af78d95469d7cfdb7144e8863f00d5a..4a6d5d34007183f28853e6c5192f282b3925a7ae 100644 +index 303550b9618e8c621e246e8c95b9e7542585f1fc..efdb66ef47e46e83287350933047295e6dc0c268 100644 --- a/Source/cmake/OptionsGTK.cmake +++ b/Source/cmake/OptionsGTK.cmake -@@ -8,6 +8,10 @@ SET_PROJECT_VERSION(2 47 4) - set(USER_AGENT_BRANDING "" CACHE STRING "Branding to add to user agent string") +@@ -9,6 +9,10 @@ set(USER_AGENT_BRANDING "" CACHE STRING "Branding to add to user agent string") + # Update Source/WTF/wtf/Platform.h to match required GLib versions. find_package(GLIB 2.70.0 REQUIRED COMPONENTS gio gio-unix gobject gthread gmodule) + +set(CMAKE_THREAD_PREFER_PTHREAD TRUE) @@ -21831,7 +20401,7 @@ index d46ee01c5af78d95469d7cfdb7144e8863f00d5a..4a6d5d34007183f28853e6c5192f282b find_package(Cairo 1.16.0 REQUIRED) find_package(LibGcrypt 1.7.0 REQUIRED) find_package(Libtasn1 REQUIRED) -@@ -23,6 +27,10 @@ find_package(ZLIB REQUIRED) +@@ -24,6 +28,10 @@ find_package(ZLIB REQUIRED) find_package(WebP REQUIRED COMPONENTS demux) find_package(ATSPI 2.5.3) @@ -21842,7 +20412,7 @@ index d46ee01c5af78d95469d7cfdb7144e8863f00d5a..4a6d5d34007183f28853e6c5192f282b include(GStreamerDefinitions) include(FindGLibCompileResources) -@@ -70,6 +78,10 @@ WEBKIT_OPTION_DEFINE(USE_SYSTEM_UNIFDEF "Whether to use a system-provided unifde +@@ -71,6 +79,10 @@ WEBKIT_OPTION_DEFINE(USE_SYSTEM_UNIFDEF "Whether to use a system-provided unifde WEBKIT_OPTION_DEPEND(USE_SYSTEM_SYSPROF_CAPTURE USE_SYSPROF_CAPTURE) @@ -21853,7 +20423,7 @@ index d46ee01c5af78d95469d7cfdb7144e8863f00d5a..4a6d5d34007183f28853e6c5192f282b SET_AND_EXPOSE_TO_BUILD(ENABLE_DEVELOPER_MODE ${DEVELOPER_MODE}) if (DEVELOPER_MODE) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_API_TESTS PRIVATE ON) -@@ -148,6 +160,20 @@ endif () +@@ -147,6 +159,20 @@ endif () WEBKIT_OPTION_DEPEND(ENABLE_GPU_PROCESS USE_GBM) @@ -21875,10 +20445,10 @@ index d46ee01c5af78d95469d7cfdb7144e8863f00d5a..4a6d5d34007183f28853e6c5192f282b # 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 bb046a1110023fbd6641943d4b677d1fc68cdea5..d34028c618600a172225246db9286e2a7ab1b9eb 100644 +index 45b4da4575d41bdf1b829ddf68947f30bc57734f..378b9114ae03c18f0caead71750c1169b2c45b27 100644 --- a/Source/cmake/OptionsWPE.cmake +++ b/Source/cmake/OptionsWPE.cmake -@@ -22,6 +22,9 @@ find_package(WebP REQUIRED COMPONENTS demux) +@@ -23,6 +23,9 @@ find_package(WebP REQUIRED COMPONENTS demux) find_package(WPE REQUIRED) find_package(ZLIB REQUIRED) @@ -21888,8 +20458,8 @@ index bb046a1110023fbd6641943d4b677d1fc68cdea5..d34028c618600a172225246db9286e2a WEBKIT_OPTION_BEGIN() SET_AND_EXPOSE_TO_BUILD(ENABLE_DEVELOPER_MODE ${DEVELOPER_MODE}) -@@ -84,6 +87,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. @@ -21910,7 +20480,7 @@ index bb046a1110023fbd6641943d4b677d1fc68cdea5..d34028c618600a172225246db9286e2a # 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. -@@ -119,6 +137,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) @@ -21923,38 +20493,21 @@ index bb046a1110023fbd6641943d4b677d1fc68cdea5..d34028c618600a172225246db9286e2a 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 b43e68ea44419ed9ea7f539df747cff5d9e4bb36..f62b9a303ad3aba3f04220f1ca9dd208cf3380d4 100644 +index 95393f0a6063615b417eb3249d3838ad0e3024d8..beedf862d572718b8f0f5e6daa0f8d029a96ea77 100644 --- a/Source/cmake/OptionsWin.cmake +++ b/Source/cmake/OptionsWin.cmake -@@ -76,6 +76,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. -@@ -133,6 +154,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) @@ -21970,7 +20523,7 @@ index b43e68ea44419ed9ea7f539df747cff5d9e4bb36..f62b9a303ad3aba3f04220f1ca9dd208 set(USE_ANGLE_EGL ON) diff --git a/Source/cmake/WebKitCompilerFlags.cmake b/Source/cmake/WebKitCompilerFlags.cmake -index 4882f3de3d9cb011a666563f0bc0e142a705518f..d3f674bf78792088a60a631c245a1fa86dca4d53 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) @@ -22185,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; @@ -22203,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" }, @@ -22214,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); } @@ -22285,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) { @@ -22320,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); } @@ -22329,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; @@ -22344,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 @@ -22352,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); } @@ -22363,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 @@ -22372,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); @@ -22385,10 +20938,10 @@ index 8433f5360dc4a5f43b68b67192fb3d9bf5064cf1..9fa8f53e90fe5a32be1c8e7a9daa6404 g_clear_object(&interfaceSettings); diff --git a/Tools/MiniBrowser/wpe/main.cpp b/Tools/MiniBrowser/wpe/main.cpp -index f5403031c914d7fedeb4649c4891beb7d681007e..eb1fe97ebb4e55eb1d4443e5f66566471ad9733f 100644 +index 6a898a5bd79a4e6f2f26be7f63347cef7a5c0ab4..d895941dab0f7a0bdfafcf60f203aa82c46874a6 100644 --- a/Tools/MiniBrowser/wpe/main.cpp +++ b/Tools/MiniBrowser/wpe/main.cpp -@@ -49,6 +49,9 @@ static gboolean headlessMode; +@@ -52,6 +52,9 @@ static gboolean headlessMode; static gboolean privateMode; static gboolean automationMode; static gboolean ignoreTLSErrors; @@ -22398,7 +20951,7 @@ index f5403031c914d7fedeb4649c4891beb7d681007e..eb1fe97ebb4e55eb1d4443e5f6656647 static const char* contentFilter; static const char* cookiesFile; static const char* cookiesPolicy; -@@ -127,6 +130,9 @@ static const GOptionEntry commandLineOptions[] = +@@ -130,6 +133,9 @@ static const GOptionEntry commandLineOptions[] = #endif { "size", 's', 0, G_OPTION_ARG_CALLBACK, reinterpret_cast(parseWindowSize), "Specify the window size to use, e.g. --size=\"800x600\"", nullptr }, { "version", 'v', 0, G_OPTION_ARG_NONE, &printVersion, "Print the WPE version", nullptr }, @@ -22408,7 +20961,7 @@ index f5403031c914d7fedeb4649c4891beb7d681007e..eb1fe97ebb4e55eb1d4443e5f6656647 { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &uriArguments, nullptr, "[URL]" }, { nullptr, 0, 0, G_OPTION_ARG_NONE, nullptr, nullptr, nullptr } }; -@@ -285,15 +291,38 @@ static void filterSavedCallback(WebKitUserContentFilterStore *store, GAsyncResul +@@ -288,15 +294,38 @@ static void filterSavedCallback(WebKitUserContentFilterStore *store, GAsyncResul g_main_loop_quit(data->mainLoop); } @@ -22449,7 +21002,7 @@ index f5403031c914d7fedeb4649c4891beb7d681007e..eb1fe97ebb4e55eb1d4443e5f6656647 { auto backend = createViewBackend(defaultWindowWidthLegacyAPI, defaultWindowHeightLegacyAPI); WebKitWebViewBackend* viewBackend = nullptr; -@@ -308,12 +337,27 @@ static WebKitWebView* createWebView(WebKitWebView* webView, WebKitNavigationActi +@@ -311,12 +340,27 @@ static WebKitWebView* createWebView(WebKitWebView* webView, WebKitNavigationActi }, backend.release()); } @@ -22483,18 +21036,23 @@ index f5403031c914d7fedeb4649c4891beb7d681007e..eb1fe97ebb4e55eb1d4443e5f6656647 #if ENABLE_WPE_PLATFORM if (auto* wpeView = webkit_web_view_get_wpe_view(newWebView)) { -@@ -328,6 +372,10 @@ static WebKitWebView* createWebView(WebKitWebView* webView, WebKitNavigationActi - - g_hash_table_add(openViews, newWebView); +@@ -328,9 +372,13 @@ static WebKitWebView* createWebView(WebKitWebView* webView, WebKitNavigationActi + g_signal_connect(newWebView, "create", G_CALLBACK(createWebView), user_data); + g_signal_connect(newWebView, "close", G_CALLBACK(webViewClose), user_data); +- ++// Playwright begin + g_signal_connect(newWebView, "load-failed", G_CALLBACK(webViewLoadFailed), nullptr); + g_signal_connect(newWebView, "script-dialog", G_CALLBACK(scriptDialog), nullptr); + g_signal_connect(newWebView, "script-dialog-handled", G_CALLBACK(scriptDialogHandled), nullptr); + g_signal_connect(newWebView, "decide-policy", G_CALLBACK(webViewDecidePolicy), nullptr); ++// Playwright end + g_hash_table_add(openViews, newWebView); +- return newWebView; } -@@ -415,13 +463,105 @@ void loadConfigFile(WPESettings* settings) +@@ -418,13 +466,105 @@ void loadConfigFile(WPESettings* settings) } #endif @@ -22601,7 +21159,7 @@ index f5403031c914d7fedeb4649c4891beb7d681007e..eb1fe97ebb4e55eb1d4443e5f6656647 webkit_network_session_set_itp_enabled(networkSession, enableITP); if (proxy) { -@@ -448,10 +588,18 @@ static void activate(GApplication* application, WPEToolingBackends::ViewBackend* +@@ -451,10 +591,18 @@ static void activate(GApplication* application, WPEToolingBackends::ViewBackend* webkit_cookie_manager_set_persistent_storage(cookieManager, cookiesFile, storageType); } } @@ -22622,7 +21180,7 @@ index f5403031c914d7fedeb4649c4891beb7d681007e..eb1fe97ebb4e55eb1d4443e5f6656647 webkit_website_data_manager_set_itp_enabled(manager, enableITP); if (proxy) { -@@ -482,6 +630,7 @@ static void activate(GApplication* application, WPEToolingBackends::ViewBackend* +@@ -485,6 +633,7 @@ static void activate(GApplication* application, WPEToolingBackends::ViewBackend* } #endif @@ -22630,7 +21188,7 @@ index f5403031c914d7fedeb4649c4891beb7d681007e..eb1fe97ebb4e55eb1d4443e5f6656647 WebKitUserContentManager* userContentManager = nullptr; if (contentFilter) { GFile* contentFilterFile = g_file_new_for_commandline_arg(contentFilter); -@@ -560,6 +709,15 @@ static void activate(GApplication* application, WPEToolingBackends::ViewBackend* +@@ -563,6 +712,15 @@ static void activate(GApplication* application, WPEToolingBackends::ViewBackend* "autoplay", WEBKIT_AUTOPLAY_ALLOW, nullptr); @@ -22646,7 +21204,7 @@ index f5403031c914d7fedeb4649c4891beb7d681007e..eb1fe97ebb4e55eb1d4443e5f6656647 auto* webView = WEBKIT_WEB_VIEW(g_object_new(WEBKIT_TYPE_WEB_VIEW, "backend", viewBackend, "web-context", webContext, -@@ -606,8 +764,6 @@ static void activate(GApplication* application, WPEToolingBackends::ViewBackend* +@@ -609,12 +767,16 @@ static void activate(GApplication* application, WPEToolingBackends::ViewBackend* } #endif @@ -22655,7 +21213,17 @@ index f5403031c914d7fedeb4649c4891beb7d681007e..eb1fe97ebb4e55eb1d4443e5f6656647 g_signal_connect(webContext, "automation-started", G_CALLBACK(automationStartedCallback), webView); g_signal_connect(webView, "permission-request", G_CALLBACK(decidePermissionRequest), nullptr); g_signal_connect(webView, "create", G_CALLBACK(createWebView), application); -@@ -619,16 +775,11 @@ static void activate(GApplication* application, WPEToolingBackends::ViewBackend* + g_signal_connect(webView, "close", G_CALLBACK(webViewClose), application); ++// Playwright begin ++ g_signal_connect(webView, "load-failed", G_CALLBACK(webViewLoadFailed), nullptr); ++ g_signal_connect(webView, "script-dialog", G_CALLBACK(scriptDialog), nullptr); ++ g_signal_connect(webView, "script-dialog-handled", G_CALLBACK(scriptDialogHandled), nullptr); ++ g_signal_connect(webView, "decide-policy", G_CALLBACK(webViewDecidePolicy), nullptr); ++// Playwright end + g_hash_table_add(openViews, webView); + + WebKitColor color; +@@ -622,16 +784,11 @@ static void activate(GApplication* application, WPEToolingBackends::ViewBackend* webkit_web_view_set_background_color(webView, &color); if (uriArguments) { @@ -22677,7 +21245,7 @@ index f5403031c914d7fedeb4649c4891beb7d681007e..eb1fe97ebb4e55eb1d4443e5f6656647 webkit_web_view_load_uri(webView, "https://wpewebkit.org"); g_object_unref(webContext); -@@ -725,8 +876,14 @@ int main(int argc, char *argv[]) +@@ -728,8 +885,14 @@ int main(int argc, char *argv[]) } } @@ -22705,10 +21273,10 @@ index 1067b31bc989748dfcc5502209d36d001b9b239e..7629263fb8bc93dca6dfc01c75eed8d2 + add_subdirectory(Playwright/win) +endif () diff --git a/Tools/Scripts/build-webkit b/Tools/Scripts/build-webkit -index ad5ecfe242d13ef1b363215361ae15091a3ffd2a..417325f1742625caf6aff22c9d0b1f5ac061743b 100755 +index fcbf4620e66e0a49396fb650f2da1fad43e8a6fc..7c38c04e082313cbd7513ba8b5626f377f6850d4 100755 --- a/Tools/Scripts/build-webkit +++ b/Tools/Scripts/build-webkit -@@ -273,7 +273,7 @@ if (isAppleCocoaWebKit()) { +@@ -278,7 +278,7 @@ if (isAppleCocoaWebKit()) { push @projects, ("Source/WebKit"); if (!isEmbeddedWebKit()) { @@ -22733,19 +21301,27 @@ 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 ea8a7dc0d6b63e28ca39e8ecb77fa6c2c3889d32..b3c292fb5db977649e90fbc598626d27ab39a349 100644 +index ee6c2488fd655c40d250b405a82358e81e2661f6..5b9baf3c2ee0e9bb28fd765c7fdacb3a70f9ef36 100644 --- a/Tools/WebKitTestRunner/TestController.cpp +++ b/Tools/WebKitTestRunner/TestController.cpp -@@ -1087,6 +1087,7 @@ void TestController::createWebViewWithOptions(const TestOptions& options) - 0, // requestStorageAccessConfirm +@@ -713,6 +713,7 @@ PlatformWebView* TestController::createOtherPlatformWebView(PlatformWebView* par + nullptr, // requestStorageAccessConfirm + nullptr, // shouldAllowDeviceOrientationAndMotionAccess + nullptr, // runWebAuthenticationPanel ++ 0, // handleJavaScriptDialog + nullptr, // decidePolicyForSpeechRecognitionPermissionRequest + nullptr, // decidePolicyForMediaKeySystemPermissionRequest + nullptr, // queryPermission +@@ -1188,6 +1189,7 @@ void TestController::createWebViewWithOptions(const TestOptions& options) + nullptr, // requestStorageAccessConfirm shouldAllowDeviceOrientationAndMotionAccess, runWebAuthenticationPanel, + 0, // handleJavaScriptDialog - 0, + nullptr, // decidePolicyForSpeechRecognitionPermissionRequest decidePolicyForMediaKeySystemPermissionRequest, queryPermission, diff --git a/Tools/WebKitTestRunner/mac/EventSenderProxy.mm b/Tools/WebKitTestRunner/mac/EventSenderProxy.mm -index 0435d345aadde9eaa3a4b7e8625e0872db8c1840..856c36909fd15a178bf1e929aec3d391196f7d36 100644 +index 9419696018c076d0e5b4ef04ea7c58be9504cd96..06c537e3c022517449068a11ea59400413e8f4dc 100644 --- a/Tools/WebKitTestRunner/mac/EventSenderProxy.mm +++ b/Tools/WebKitTestRunner/mac/EventSenderProxy.mm @@ -961,4 +961,51 @@ void EventSenderProxy::waitForPendingMouseEvents() @@ -22801,7 +21377,7 @@ index 0435d345aadde9eaa3a4b7e8625e0872db8c1840..856c36909fd15a178bf1e929aec3d391 + } // namespace WTR diff --git a/Tools/jhbuild/jhbuild-minimal.modules b/Tools/jhbuild/jhbuild-minimal.modules -index 3a0b7425900b14ce2aa0d48aa914cd69bff1f332..22fb1ab2ea76e1e253c79ba1fa3fa448f7584b43 100644 +index 3a0b7425900b14ce2aa0d48aa914cd69bff1f332..0ce07cc1368c6f521b51d6300dca9c4d078beef3 100644 --- a/Tools/jhbuild/jhbuild-minimal.modules +++ b/Tools/jhbuild/jhbuild-minimal.modules @@ -67,8 +67,8 @@ @@ -22834,6 +21410,17 @@ index 3a0b7425900b14ce2aa0d48aa914cd69bff1f332..22fb1ab2ea76e1e253c79ba1fa3fa448 +@@ -194,8 +193,8 @@ + + + + diff --git a/Tools/wpe/backends/fdo/HeadlessViewBackendFdo.cpp b/Tools/wpe/backends/fdo/HeadlessViewBackendFdo.cpp index df22308266c6f69d24a60905f8d05e4e80f21b9b..2d0838070dc10793418cbb648b095a5ffa76f1b8 100644 --- a/Tools/wpe/backends/fdo/HeadlessViewBackendFdo.cpp @@ -22897,7 +21484,7 @@ index df22308266c6f69d24a60905f8d05e4e80f21b9b..2d0838070dc10793418cbb648b095a5f static cairo_user_data_key_t bufferKey; cairo_surface_set_user_data(m_snapshot, &bufferKey, buffer, diff --git a/WebKit.xcworkspace/contents.xcworkspacedata b/WebKit.xcworkspace/contents.xcworkspacedata -index a0f02e61be7e667c6ba164ca578109af36ac28d9..8f5af2e82c167ba6798fb7fde24a9f641f6554a5 100644 +index 3ad442a8691847c6921c5f66a805b7b0523b1e27..95407368a95d2f7d6fb697110912014cabe29afa 100644 --- a/WebKit.xcworkspace/contents.xcworkspacedata +++ b/WebKit.xcworkspace/contents.xcworkspacedata @@ -4,6 +4,9 @@ @@ -22935,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 347838ae42141..f856dffe55968 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-locator.md b/docs/src/api/class-locator.md index 5ab1c3989be39..0859289a7fe66 100644 --- a/docs/src/api/class-locator.md +++ b/docs/src/api/class-locator.md @@ -587,6 +587,33 @@ When all steps combined have not finished during the specified [`option: timeout Describes the locator, description is used in the trace viewer and reports. Returns the locator pointing to the same element. +**Usage** + +```js +const button = page.getByTestId('btn-sub').describe('Subscribe button'); +await button.click(); +``` + +```java +Locator button = page.getByTestId("btn-sub").describe("Subscribe button"); +button.click(); +``` + +```python async +button = page.get_by_test_id("btn-sub").describe("Subscribe button") +await button.click() +``` + +```python sync +button = page.get_by_test_id("btn-sub").describe("Subscribe button") +button.click() +``` + +```csharp +var button = Page.GetByTestId("btn-sub").Describe("Subscribe button"); +await button.ClickAsync(); +``` + ### param: Locator.describe.description * since: v1.53 - `description` <[string]> diff --git a/docs/src/api/class-mouse.md b/docs/src/api/class-mouse.md index 08eb74a072896..1897482bac506 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 5cabc1c864555..53e9cae0acb48 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 44582f450befb..e898899b18251 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 641383d7b4e0a..7f2358bdaaafd 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 9cf7614902c22..62d9190bf59cd 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/mock.md b/docs/src/mock.md index 24385d3497052..eab111fd3d91d 100644 --- a/docs/src/mock.md +++ b/docs/src/mock.md @@ -232,6 +232,16 @@ The options object can contain the URL so that only requests with the URL matchi Setting `update` option to true will create or update the HAR file with the actual network information instead of serving the requests from the HAR file. Use it when creating a test to populate the HAR with real data. +#### +* langs: js + +Alternatively, you can also record HAR files by using the [`option: Browser.newContext.recordHar`] option in [`method: Browser.newContext`] when creating a browser context. This allows you to capture all network traffic for the entire context until the context is closed. + +#### +* langs: csharp, java, python + +Alternatively, you can also record HAR files by using the [`option: Browser.newContext.recordHarPath`] option in [`method: Browser.newContext`] when creating a browser context. This allows you to capture all network traffic for the entire context until the context is closed. + ```js test('records or updates the HAR file', async ({ page }) => { // Get the response from the HAR file diff --git a/docs/src/release-notes-csharp.md b/docs/src/release-notes-csharp.md index 79fcfcde145a5..967d75a070353 100644 --- a/docs/src/release-notes-csharp.md +++ b/docs/src/release-notes-csharp.md @@ -4,10 +4,56 @@ 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 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 + var button = Page.GetByTestId("btn-sub").Describe("Subscribe button"); + await button.ClickAsync(); + ``` +- `pwsh bin/Debug/netX/playwright.ps1 install --list` will now list all installed browsers, versions and locations. + +### Browser Versions + +- Chromium 138.0.7204.4 +- Mozilla Firefox 139.0 +- WebKit 18.5 + +This version was also tested against the following stable channels: + +- Google Chrome 137 +- Microsoft Edge 137 + ## 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 0eda4863527fe..0f699a5a85f6a 100644 --- a/docs/src/release-notes-java.md +++ b/docs/src/release-notes-java.md @@ -4,10 +4,56 @@ 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 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 + Locator button = page.getByTestId("btn-sub").describe("Subscribe button"); + button.click(); + ``` +- `mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install --list"` will now list all installed browsers, versions and locations. + +### Browser Versions + +- Chromium 138.0.7204.4 +- Mozilla Firefox 139.0 +- WebKit 18.5 + +This version was also tested against the following stable channels: + +- Google Chrome 137 +- Microsoft Edge 137 + ## 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 890b9b86de884..92bf9edc363ea 100644 --- a/docs/src/release-notes-js.md +++ b/docs/src/release-notes-js.md @@ -6,10 +6,91 @@ 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 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 + import { defineConfig } from '@playwright/test'; + + export default defineConfig({ + reporter: [['html', { title: 'Custom test run #1028' }]] + }); + ``` + +### Miscellaneous + +- New option [`option: TestInfo.snapshotPath.kind`] in [`method: TestInfo.snapshotPath`] controls which snapshot path template is used. +- New method [`method: Locator.describe`] to describe a locator. Used for trace viewer and reports. + ```js + const button = page.getByTestId('btn-sub').describe('Subscribe button'); + await button.click(); + ``` +- `npx playwright install --list` will now list all installed browsers, versions and locations. + +### Browser Versions + +- Chromium 138.0.7204.4 +- Mozilla Firefox 139.0 +- WebKit 18.5 + +This version was also tested against the following stable channels: + +- Google Chrome 137 +- Microsoft Edge 137 + ## 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 24485c74a01e2..beeee57291c60 100644 --- a/docs/src/release-notes-python.md +++ b/docs/src/release-notes-python.md @@ -4,10 +4,56 @@ 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 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 + button = page.get_by_test_id("btn-sub").describe("Subscribe button") + button.click() + ``` +- `python -m playwright install --list` will now list all installed browsers, versions and locations. + +### Browser Versions + +- Chromium 138.0.7204.4 +- Mozilla Firefox 139.0 +- WebKit 18.5 + +This version was also tested against the following stable channels: + +- Google Chrome 137 +- Microsoft Edge 137 + ## 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 2511f412d2871..d976058aef18d 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 541a547bc157c..9f577cad9caf8 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 a3c9c2db995c6..22a8588fb0934 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 263b299c49ee1..ef41200b40c27 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 a8d1c12110bcc..84ba3abbda7f1 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 294f0466ddb79..f3393c6a25657 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 6a8d42e88656f..5c64eccfbb762 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 adc436378cf05..30fce9b178aeb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "playwright-internal", - "version": "1.53.0-next", + "version": "1.55.0-next", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "playwright-internal", - "version": "1.53.0-next", + "version": "1.55.0-next", "license": "Apache-2.0", "workspaces": [ "packages/*" @@ -3139,9 +3139,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" @@ -3305,9 +3305,9 @@ } }, "node_modules/dotenv": { - "version": "16.4.7", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.7.tgz", - "integrity": "sha512-47qPchRCykZC03FhkYAhrvwU4xDBFIj1QPqaarj6mdM/hgUzfPHcpkHJOn3mJAufFeeAxAzeGsr5X0M4k6fLZQ==", + "version": "16.5.0", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.5.0.tgz", + "integrity": "sha512-m/C+AwOAr9/W1UOIZUo232ejMNnJAJtYQjUbHoNTBNTJSvqzzDh7vnrei3o3r3m9blf6ZoDkvcw0VmozNRFJxg==", "dev": true, "license": "BSD-2-Clause", "engines": { @@ -7809,9 +7809,9 @@ "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==", + "version": "8.18.2", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.2.tgz", + "integrity": "sha512-DMricUmwGZUVr++AEAe2uiVM7UoO9MAVZMDu05UQOaUII0lp+zOzLLU4Xqh/JvTqklB1T4uELaaPBKyjE1r4fQ==", "dev": true, "license": "MIT", "engines": { @@ -7966,10 +7966,10 @@ "version": "0.0.0" }, "packages/playwright": { - "version": "1.53.0-next", + "version": "1.55.0-next", "license": "Apache-2.0", "dependencies": { - "playwright-core": "1.53.0-next" + "playwright-core": "1.55.0-next" }, "bin": { "playwright": "cli.js" @@ -7983,11 +7983,11 @@ }, "packages/playwright-browser-chromium": { "name": "@playwright/browser-chromium", - "version": "1.53.0-next", + "version": "1.55.0-next", "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { - "playwright-core": "1.53.0-next" + "playwright-core": "1.55.0-next" }, "engines": { "node": ">=18" @@ -7995,11 +7995,11 @@ }, "packages/playwright-browser-firefox": { "name": "@playwright/browser-firefox", - "version": "1.53.0-next", + "version": "1.55.0-next", "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { - "playwright-core": "1.53.0-next" + "playwright-core": "1.55.0-next" }, "engines": { "node": ">=18" @@ -8007,22 +8007,22 @@ }, "packages/playwright-browser-webkit": { "name": "@playwright/browser-webkit", - "version": "1.53.0-next", + "version": "1.55.0-next", "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { - "playwright-core": "1.53.0-next" + "playwright-core": "1.55.0-next" }, "engines": { "node": ">=18" } }, "packages/playwright-chromium": { - "version": "1.53.0-next", + "version": "1.55.0-next", "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { - "playwright-core": "1.53.0-next" + "playwright-core": "1.55.0-next" }, "bin": { "playwright": "cli.js" @@ -8036,14 +8036,14 @@ "version": "0.0.0", "license": "Apache-2.0", "dependencies": { - "playwright-core": "1.53.0-next" + "playwright-core": "1.55.0-next" }, "engines": { "node": ">=18" } }, "packages/playwright-core": { - "version": "1.53.0-next", + "version": "1.55.0-next", "license": "Apache-2.0", "bin": { "playwright-core": "cli.js" @@ -8054,11 +8054,11 @@ }, "packages/playwright-ct-core": { "name": "@playwright/experimental-ct-core", - "version": "1.53.0-next", + "version": "1.55.0-next", "license": "Apache-2.0", "dependencies": { - "playwright": "1.53.0-next", - "playwright-core": "1.53.0-next", + "playwright": "1.55.0-next", + "playwright-core": "1.55.0-next", "vite": "^6.3.4" }, "engines": { @@ -8067,10 +8067,10 @@ }, "packages/playwright-ct-react": { "name": "@playwright/experimental-ct-react", - "version": "1.53.0-next", + "version": "1.55.0-next", "license": "Apache-2.0", "dependencies": { - "@playwright/experimental-ct-core": "1.53.0-next", + "@playwright/experimental-ct-core": "1.55.0-next", "@vitejs/plugin-react": "^4.2.1" }, "bin": { @@ -8082,10 +8082,10 @@ }, "packages/playwright-ct-react17": { "name": "@playwright/experimental-ct-react17", - "version": "1.53.0-next", + "version": "1.55.0-next", "license": "Apache-2.0", "dependencies": { - "@playwright/experimental-ct-core": "1.53.0-next", + "@playwright/experimental-ct-core": "1.55.0-next", "@vitejs/plugin-react": "^4.2.1" }, "bin": { @@ -8097,10 +8097,10 @@ }, "packages/playwright-ct-svelte": { "name": "@playwright/experimental-ct-svelte", - "version": "1.53.0-next", + "version": "1.55.0-next", "license": "Apache-2.0", "dependencies": { - "@playwright/experimental-ct-core": "1.53.0-next", + "@playwright/experimental-ct-core": "1.55.0-next", "@sveltejs/vite-plugin-svelte": "^3.0.1" }, "bin": { @@ -8658,10 +8658,10 @@ }, "packages/playwright-ct-vue": { "name": "@playwright/experimental-ct-vue", - "version": "1.53.0-next", + "version": "1.55.0-next", "license": "Apache-2.0", "dependencies": { - "@playwright/experimental-ct-core": "1.53.0-next", + "@playwright/experimental-ct-core": "1.55.0-next", "@vitejs/plugin-vue": "^5.2.0" }, "bin": { @@ -8672,11 +8672,11 @@ } }, "packages/playwright-firefox": { - "version": "1.53.0-next", + "version": "1.55.0-next", "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { - "playwright-core": "1.53.0-next" + "playwright-core": "1.55.0-next" }, "bin": { "playwright": "cli.js" @@ -8706,12 +8706,36 @@ "node": ">=18" } }, + "packages/playwright-mdd": { + "name": "@playwright/mdd", + "version": "0.0.1", + "extraneous": true, + "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.55.0-next", + "zod-to-json-schema": "^3.24.4" + }, + "bin": { + "playwright-mdd": "cli.js" + }, + "devDependencies": { + "@types/debug": "^4.1.7" + }, + "engines": { + "node": ">=18" + } + }, "packages/playwright-test": { "name": "@playwright/test", - "version": "1.53.0-next", + "version": "1.55.0-next", "license": "Apache-2.0", "dependencies": { - "playwright": "1.53.0-next" + "playwright": "1.55.0-next" }, "bin": { "playwright": "cli.js" @@ -8738,11 +8762,11 @@ } }, "packages/playwright-webkit": { - "version": "1.53.0-next", + "version": "1.55.0-next", "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { - "playwright-core": "1.53.0-next" + "playwright-core": "1.55.0-next" }, "bin": { "playwright": "cli.js" diff --git a/package.json b/package.json index 421c657d2ed8f..6253fcdb90786 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "playwright-internal", "private": true, - "version": "1.53.0-next", + "version": "1.55.0-next", "description": "A high-level API to automate web browsers", "repository": { "type": "git", diff --git a/packages/html-reporter/src/filter.ts b/packages/html-reporter/src/filter.ts index 135336e869907..7e54c98d4d0dd 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 bea84bcdd0e43..c0804a6681762 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)}
} ; }; @@ -60,13 +61,16 @@ export const GlobalFilterView: React.FC<{ event => { event.preventDefault(); const url = new URL(window.location.href); - url.hash = filterText ? '?' + new URLSearchParams({ q: filterText }) : ''; + // If
onSubmit happens immediately after onChange, the filterText state is not updated yet. + // Using FormData here is a workaround to get the latest value. + const q = new FormData(event.target as HTMLFormElement).get('q') as string; + url.hash = q ? '?' + new URLSearchParams({ q }) : ''; navigate(url); } }> {icons.search()} {/* Use navigationId to reset defaultValue */} - { + { setFilterText(e.target.value); }}>
@@ -79,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 4abe8a6caa291..29dc2fc0c6892 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 f0054fb501ef9..4614a22da89e9 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/reportView.tsx b/packages/html-reporter/src/reportView.tsx index 31b3df975f491..c68e130a5b533 100644 --- a/packages/html-reporter/src/reportView.tsx +++ b/packages/html-reporter/src/reportView.tsx @@ -18,9 +18,9 @@ import type { FilteredStats, TestCase, TestCaseSummary, TestFile, TestFileSummar import * as React from 'react'; import './colors.css'; import './common.css'; -import { Filter } from './filter'; +import { Filter, filterWithQuery } from './filter'; import { HeaderView, GlobalFilterView } from './headerView'; -import { Route, SearchParamsContext } from './links'; +import { navigate, Route, SearchParamsContext, testResultHref } from './links'; import type { LoadedReport } from './loadedReport'; import './reportView.css'; import { TestCaseView } from './testCaseView'; @@ -49,6 +49,10 @@ export const ReportView: React.FC<{ const [expandedFiles, setExpandedFiles] = React.useState>(new Map()); const [filterText, setFilterText] = React.useState(searchParams.get('q') || ''); const [metadataVisible, setMetadataVisible] = React.useState(false); + const testId = searchParams.get('testId'); + const q = searchParams.get('q')?.toString() || ''; + const filterParam = q ? '&q=' + q : ''; + const reportTitle = report?.json()?.title; const testIdToFileIdMap = React.useMemo(() => { const map = new Map(); @@ -61,7 +65,7 @@ export const ReportView: React.FC<{ const filter = React.useMemo(() => Filter.parse(filterText), [filterText]); const filteredStats = React.useMemo(() => filter.empty() ? undefined : computeStats(report?.json().files || [], filter), [report, filter]); - const filteredTests = React.useMemo(() => { + const testModel = React.useMemo(() => { const result: TestModelSummary = { files: [], tests: [] }; for (const file of report?.json().files || []) { const tests = file.tests.filter(t => filter.matches(t)); @@ -72,7 +76,49 @@ export const ReportView: React.FC<{ return result; }, [report, filter]); - const reportTitle = report?.json()?.title; + const { prev, next } = React.useMemo(() => { + const index = testModel.tests.findIndex(t => t.testId === testId); + const prev = index > 0 ? testModel.tests[index - 1] : undefined; + const next = index < testModel.tests.length - 1 ? testModel.tests[index + 1] : undefined; + return { prev, next }; + }, [testId, testModel]); + + React.useEffect(() => { + const handleKeyDown = (event: KeyboardEvent) => { + if (event.target instanceof HTMLInputElement || event.target instanceof HTMLTextAreaElement || event.shiftKey || event.ctrlKey || event.metaKey || event.altKey) + return; + + switch (event.key) { + case 'a': + event.preventDefault(); + navigate('#?'); + break; + case 'p': + event.preventDefault(); + navigate(filterWithQuery(q, 's:passed', false)); + break; + case 'f': + event.preventDefault(); + navigate(filterWithQuery(q, 's:failed', false)); + break; + case 'ArrowLeft': + if (prev) { + event.preventDefault(); + navigate(testResultHref({ test: prev }) + filterParam); + } + break; + case 'ArrowRight': + if (next) { + event.preventDefault(); + navigate(testResultHref({ test: next }) + filterParam); + } + break; + } + }; + + document.addEventListener('keydown', handleKeyDown); + return () => document.removeEventListener('keydown', handleKeyDown); + }, [prev, next, filterParam, q]); React.useEffect(() => { if (reportTitle) @@ -87,14 +133,14 @@ export const ReportView: React.FC<{ setMetadataVisible(visible => !visible)}/> - {!!report && } + {!!report && } ; @@ -102,21 +148,15 @@ export const ReportView: React.FC<{ const TestCaseViewLoader: React.FC<{ report: LoadedReport, - tests: TestCaseSummary[], + testId: string | null, + next?: TestCaseSummary, + prev?: TestCaseSummary, testIdToFileIdMap: Map, -}> = ({ report, testIdToFileIdMap, tests }) => { +}> = ({ report, testIdToFileIdMap, next, prev, testId }) => { const searchParams = React.useContext(SearchParamsContext); const [test, setTest] = React.useState('loading'); - const testId = searchParams.get('testId'); const run = +(searchParams.get('run') || '0'); - const { prev, next } = React.useMemo(() => { - const index = tests.findIndex(t => t.testId === testId); - const prev = index > 0 ? tests[index - 1] : undefined; - const next = index < tests.length - 1 ? tests[index + 1] : undefined; - return { prev, next }; - }, [testId, tests]); - React.useEffect(() => { (async () => { if (!testId || (typeof test === 'object' && testId === test.testId)) diff --git a/packages/html-reporter/src/testCaseView.css b/packages/html-reporter/src/testCaseView.css index b070503668d32..6ee692d6fdb7c 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 d80049ca332c3..68125e19f91fc 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 7639e3577bd82..6fa7bc50ecb17 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 489cce61ba847..c071781ce17cd 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 24e9011219201..ed26b1fc5f984 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 b023c27981595..c8f8f0402940d 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 a75a5cd185d6c..2088b81cdc5b4 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 eb97e04a8b322..e11d6476949cb 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 1bc011f357780..3a442a51b5f36 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 05a1c9eb97f88..e315b9d324486 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 c9e824951a950..dc567b37c0558 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 68ba74fdb1234..fb3044bffce18 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 b9bdd333a01c8..e652ee8c1581a 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/injected/src/selectorGenerator.ts b/packages/injected/src/selectorGenerator.ts index 8410d7dc7d6c1..a7dad6644fb0b 100644 --- a/packages/injected/src/selectorGenerator.ts +++ b/packages/injected/src/selectorGenerator.ts @@ -578,6 +578,25 @@ function escapeNodeName(node: Node): string { } function escapeClassName(className: string): string { - // We are escaping it for document.querySelectorAll, not for usage in CSS file. - return className.replace(/[:\.]/g, char => '\\' + char); + // We are escaping class names for document.querySelectorAll by following CSS.escape() rules. + let result = ''; + for (let i = 0; i < className.length; i++) + result += cssEscapeCharacter(className, i); + return result; +} + +function cssEscapeCharacter(s: string, i: number): string { + // https://drafts.csswg.org/cssom/#serialize-an-identifier + const c = s.charCodeAt(i); + if (c === 0x0000) + return '\uFFFD'; + if ((c >= 0x0001 && c <= 0x001f) || + (c >= 0x0030 && c <= 0x0039 && (i === 0 || (i === 1 && s.charCodeAt(0) === 0x002d)))) + return '\\' + c.toString(16) + ' '; + if (i === 0 && c === 0x002d && s.length === 1) + return '\\' + s.charAt(i); + if (c >= 0x0080 || c === 0x002d || c === 0x005f || (c >= 0x0030 && c <= 0x0039) || + (c >= 0x0041 && c <= 0x005a) || (c >= 0x0061 && c <= 0x007a)) + return s.charAt(i); + return '\\' + s.charAt(i); } diff --git a/packages/playwright-browser-chromium/package.json b/packages/playwright-browser-chromium/package.json index 8f7270fc2febe..32b2f075a720c 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-next", + "version": "1.55.0-next", "description": "Playwright package that automatically installs Chromium", "repository": { "type": "git", @@ -27,6 +27,6 @@ "install": "node install.js" }, "dependencies": { - "playwright-core": "1.53.0-next" + "playwright-core": "1.55.0-next" } } diff --git a/packages/playwright-browser-firefox/package.json b/packages/playwright-browser-firefox/package.json index 5e2513ab3dbd1..df7b8fea635f6 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-next", + "version": "1.55.0-next", "description": "Playwright package that automatically installs Firefox", "repository": { "type": "git", @@ -27,6 +27,6 @@ "install": "node install.js" }, "dependencies": { - "playwright-core": "1.53.0-next" + "playwright-core": "1.55.0-next" } } diff --git a/packages/playwright-browser-webkit/package.json b/packages/playwright-browser-webkit/package.json index 459a431949677..bb35606e27006 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-next", + "version": "1.55.0-next", "description": "Playwright package that automatically installs WebKit", "repository": { "type": "git", @@ -27,6 +27,6 @@ "install": "node install.js" }, "dependencies": { - "playwright-core": "1.53.0-next" + "playwright-core": "1.55.0-next" } } diff --git a/packages/playwright-chromium/package.json b/packages/playwright-chromium/package.json index 72fa5b6c242ec..5290fcfbd247a 100644 --- a/packages/playwright-chromium/package.json +++ b/packages/playwright-chromium/package.json @@ -1,6 +1,6 @@ { "name": "playwright-chromium", - "version": "1.53.0-next", + "version": "1.55.0-next", "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-next" + "playwright-core": "1.55.0-next" } } diff --git a/packages/playwright-client/package.json b/packages/playwright-client/package.json index f2a834e2fa346..854df0d17903f 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-next" + "playwright-core": "1.55.0-next" } } diff --git a/packages/playwright-client/types/types.d.ts b/packages/playwright-client/types/types.d.ts index 2f58435db7828..e840adc980d49 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?: { @@ -12913,6 +12922,14 @@ export interface Locator { /** * Describes the locator, description is used in the trace viewer and reports. Returns the locator pointing to the * same element. + * + * **Usage** + * + * ```js + * const button = page.getByTestId('btn-sub').describe('Subscribe button'); + * await button.click(); + * ``` + * * @param description Locator description. */ describe(description: string): Locator; @@ -18833,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"; } /** @@ -20143,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). * @@ -22493,6 +22509,8 @@ export interface Cookie { secure: boolean; sameSite: "Strict"|"Lax"|"None"; + + partitionKey?: string; } interface PageWaitForSelectorOptions { diff --git a/packages/playwright-core/ThirdPartyNotices.txt b/packages/playwright-core/ThirdPartyNotices.txt index 744720e00d113..57cf609a1ce6a 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 5944a13af7512..9d0dc9fc647d3 100644 --- a/packages/playwright-core/browsers.json +++ b/packages/playwright-core/browsers.json @@ -3,43 +3,43 @@ "browsers": [ { "name": "chromium", - "revision": "1177", + "revision": "1182", "installByDefault": true, - "browserVersion": "138.0.7204.4" + "browserVersion": "139.0.7258.31" }, { "name": "chromium-headless-shell", - "revision": "1177", + "revision": "1182", "installByDefault": true, - "browserVersion": "138.0.7204.4" + "browserVersion": "139.0.7258.31" }, { "name": "chromium-tip-of-tree", - "revision": "1337", + "revision": "1348", "installByDefault": false, - "browserVersion": "139.0.7216.0" + "browserVersion": "140.0.7287.0" }, { "name": "chromium-tip-of-tree-headless-shell", - "revision": "1337", + "revision": "1348", "installByDefault": false, - "browserVersion": "139.0.7216.0" + "browserVersion": "140.0.7287.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": "2181", + "revision": "2193", "installByDefault": true, "revisionOverrides": { "debian11-x64": "2105", @@ -55,7 +55,7 @@ "ubuntu20.04-x64": "2092", "ubuntu20.04-arm64": "2092" }, - "browserVersion": "18.4" + "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 bc58353c99f08..7900f7c098660 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 7e7ff502ba7bc..c0559de57d1dd 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 f8fc62fb7cf13..d4991d0ed26c8 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 807957237e3f3..9e62d8396ffc7 100644 --- a/packages/playwright-core/package.json +++ b/packages/playwright-core/package.json @@ -1,6 +1,6 @@ { "name": "playwright-core", - "version": "1.53.0-next", + "version": "1.55.0-next", "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 d21eb103c4ad9..c4f50cb22e158 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 5f3758119a2b6..dc044735114ae 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 d8bcda0e79e5f..d8c36f71747b0 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 a1927b912de50..a2655a1334e86 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