From 6d63773965f54f6a05b2eb1edd98fa0a27f057d4 Mon Sep 17 00:00:00 2001 From: Playwright Service <89237858+playwrightmachine@users.noreply.github.com> Date: Wed, 18 Jan 2023 12:24:12 -0800 Subject: [PATCH] feat(webkit): roll to r1760 (#20197) --- packages/playwright-core/browsers.json | 2 +- .../src/server/webkit/protocol.d.ts | 69 +++++++++++++------ .../src/server/webkit/wkPage.ts | 4 +- 3 files changed, 50 insertions(+), 25 deletions(-) diff --git a/packages/playwright-core/browsers.json b/packages/playwright-core/browsers.json index e5c330288a..02739644c5 100644 --- a/packages/playwright-core/browsers.json +++ b/packages/playwright-core/browsers.json @@ -33,7 +33,7 @@ }, { "name": "webkit", - "revision": "1751", + "revision": "1760", "installByDefault": true, "revisionOverrides": { "mac10.14": "1446", diff --git a/packages/playwright-core/src/server/webkit/protocol.d.ts b/packages/playwright-core/src/server/webkit/protocol.d.ts index 9d933b5552..0618df6708 100644 --- a/packages/playwright-core/src/server/webkit/protocol.d.ts +++ b/packages/playwright-core/src/server/webkit/protocol.d.ts @@ -857,11 +857,11 @@ export module Protocol { */ export interface Grouping { /** - * Source of the media query: "media-rule" if specified by a @media rule, "media-import-rule" if specified by an @import rule, "media-link-node" if specified by a "media" attribute in a linked style sheet's LINK tag, "media-style-node" if specified by a "media" attribute in an inline style sheet's STYLE tag, "supports-rule" if specified by an @supports rule, "layer-rule" if specified by an @layer rule, "container-rule" if specified by an @container rule. + * Source of the media query: "media-rule" if specified by a @media rule, "media-import-rule" if specified by an @import rule, "media-link-node" if specified by a "media" attribute in a linked style sheet's LINK tag, "media-style-node" if specified by a "media" attribute in an inline style sheet's STYLE tag, "supports-rule" if specified by an @supports rule, "layer-rule" if specified by an @layer rule, "container-rule" if specified by an @container rule, "style-rule" if specified by a CSSStyleRule containing the rule inside this grouping. */ - type: "media-rule"|"media-import-rule"|"media-link-node"|"media-style-node"|"supports-rule"|"layer-rule"|"layer-import-rule"|"container-rule"; + type: "media-rule"|"media-import-rule"|"media-link-node"|"media-style-node"|"supports-rule"|"layer-rule"|"layer-import-rule"|"container-rule"|"style-rule"; /** - * The CSS rule identifier for the `@rule` (absent for non-editable grouping rules). In CSSOM terms, this is the parent rule of either the previous Grouping for a CSSRule, or of a CSSRule itself. + * The CSS rule identifier for the `@rule` (absent for non-editable grouping rules) or the nesting parent style rule's selector. In CSSOM terms, this is the parent rule of either the previous Grouping for a CSSRule, or of a CSSRule itself. */ ruleId?: CSSRuleId; /** @@ -1658,6 +1658,10 @@ export module Protocol { * New repeat count value. */ count: number; + /** + * Timestamp of the latest message. + */ + timestamp?: number; } /** * Issued when console is cleared. This happens either upon clearMessages command or after page navigation. @@ -6208,6 +6212,27 @@ the top of the viewport and Y increases as it proceeds towards the bottom of the * List of settings able to be overridden by WebInspector. */ export type Setting = "PrivateClickMeasurementDebugModeEnabled"|"AuthorAndUserStylesEnabled"|"ICECandidateFilteringEnabled"|"ITPDebugModeEnabled"|"ImagesEnabled"|"MediaCaptureRequiresSecureConnection"|"MockCaptureDevicesEnabled"|"NeedsSiteSpecificQuirks"|"ScriptEnabled"|"ShowDebugBorders"|"ShowRepaintCounter"|"WebRTCEncryptionEnabled"|"WebSecurityEnabled"|"DeviceOrientationEventEnabled"|"SpeechRecognitionEnabled"|"PointerLockEnabled"|"NotificationsEnabled"|"FullScreenEnabled"|"InputTypeMonthEnabled"|"InputTypeWeekEnabled"; + /** + * A user preference that can be overriden by Web Inspector, like an accessibility preference. + */ + export interface UserPreference { + /** + * Preference name. + */ + name: UserPreferenceName; + /** + * Preference value. + */ + value: UserPreferenceValue; + } + /** + * User preference name. + */ + export type UserPreferenceName = "PrefersReducedMotion"|"PrefersContrast"|"PrefersColorScheme"; + /** + * User preference value. + */ + export type UserPreferenceValue = "NoPreference"|"Reduce"|"More"|"Light"|"Dark"; /** * Resource type as it was perceived by the rendering engine. */ @@ -6220,10 +6245,6 @@ the top of the viewport and Y increases as it proceeds towards the bottom of the * Same-Site policy of a cookie. */ export type CookieSameSitePolicy = "None"|"Lax"|"Strict"; - /** - * Page appearance name. - */ - export type Appearance = "Light"|"Dark"; /** * Page reduced-motion media query override. */ @@ -6597,13 +6618,13 @@ the top of the viewport and Y increases as it proceeds towards the bottom of the url: string; } /** - * Fired when page's default appearance changes, even if there is a forced appearance. + * Fired when the default value of a user preference changes at the system level. */ - export type defaultAppearanceDidChangePayload = { + export type defaultUserPreferencesDidChangePayload = { /** - * Name of the appearance that is active (not considering any forced appearance.) + * List of user preferences that can be overriden and their new system (default) values. */ - appearance: Appearance; + preferences: UserPreference[]; } /** * Fired when page is about to check policy for newly triggered navigation. @@ -6729,6 +6750,18 @@ the top of the viewport and Y increases as it proceeds towards the bottom of the } export type overrideSettingReturnValue = { } + /** + * Allows the frontend to override the user's preferences on the inspected page. + */ + export type overrideUserPreferenceParameters = { + name: UserPreferenceName; + /** + * Value to override the user preference with. If this value is not provided, the override is removed. Overrides are removed when Web Inspector closes/disconnects. + */ + value?: UserPreferenceValue; + } + export type overrideUserPreferenceReturnValue = { + } /** * Returns all browser cookies. Depending on the backend support, will return detailed cookie information in the cookies field. */ @@ -6900,14 +6933,6 @@ the top of the viewport and Y increases as it proceeds towards the bottom of the } export type setEmulatedMediaReturnValue = { } - /** - * Forces the given appearance for the page. - */ - export type setForcedAppearanceParameters = { - appearance?: Appearance; - } - export type setForcedAppearanceReturnValue = { - } /** * Forces the reduced-motion media query for the page. */ @@ -9022,7 +9047,7 @@ the top of the viewport and Y increases as it proceeds towards the bottom of the "Page.frameScheduledNavigation": Page.frameScheduledNavigationPayload; "Page.frameClearedScheduledNavigation": Page.frameClearedScheduledNavigationPayload; "Page.navigatedWithinDocument": Page.navigatedWithinDocumentPayload; - "Page.defaultAppearanceDidChange": Page.defaultAppearanceDidChangePayload; + "Page.defaultUserPreferencesDidChange": Page.defaultUserPreferencesDidChangePayload; "Page.willCheckNavigationPolicy": Page.willCheckNavigationPolicyPayload; "Page.didCheckNavigationPolicy": Page.didCheckNavigationPolicyPayload; "Page.fileChooserOpened": Page.fileChooserOpenedPayload; @@ -9269,6 +9294,7 @@ the top of the viewport and Y increases as it proceeds towards the bottom of the "Page.overrideUserAgent": Page.overrideUserAgentParameters; "Page.overridePlatform": Page.overridePlatformParameters; "Page.overrideSetting": Page.overrideSettingParameters; + "Page.overrideUserPreference": Page.overrideUserPreferenceParameters; "Page.getCookies": Page.getCookiesParameters; "Page.setCookie": Page.setCookieParameters; "Page.deleteCookie": Page.deleteCookieParameters; @@ -9280,7 +9306,6 @@ the top of the viewport and Y increases as it proceeds towards the bottom of the "Page.setShowRulers": Page.setShowRulersParameters; "Page.setShowPaintRects": Page.setShowPaintRectsParameters; "Page.setEmulatedMedia": Page.setEmulatedMediaParameters; - "Page.setForcedAppearance": Page.setForcedAppearanceParameters; "Page.setForcedReducedMotion": Page.setForcedReducedMotionParameters; "Page.setForcedColors": Page.setForcedColorsParameters; "Page.setTimeZone": Page.setTimeZoneParameters; @@ -9578,6 +9603,7 @@ the top of the viewport and Y increases as it proceeds towards the bottom of the "Page.overrideUserAgent": Page.overrideUserAgentReturnValue; "Page.overridePlatform": Page.overridePlatformReturnValue; "Page.overrideSetting": Page.overrideSettingReturnValue; + "Page.overrideUserPreference": Page.overrideUserPreferenceReturnValue; "Page.getCookies": Page.getCookiesReturnValue; "Page.setCookie": Page.setCookieReturnValue; "Page.deleteCookie": Page.deleteCookieReturnValue; @@ -9589,7 +9615,6 @@ the top of the viewport and Y increases as it proceeds towards the bottom of the "Page.setShowRulers": Page.setShowRulersReturnValue; "Page.setShowPaintRects": Page.setShowPaintRectsReturnValue; "Page.setEmulatedMedia": Page.setEmulatedMediaReturnValue; - "Page.setForcedAppearance": Page.setForcedAppearanceReturnValue; "Page.setForcedReducedMotion": Page.setForcedReducedMotionReturnValue; "Page.setForcedColors": Page.setForcedColorsReturnValue; "Page.setTimeZone": Page.setTimeZoneReturnValue; diff --git a/packages/playwright-core/src/server/webkit/wkPage.ts b/packages/playwright-core/src/server/webkit/wkPage.ts index edbee1d87c..cfb3506dc9 100644 --- a/packages/playwright-core/src/server/webkit/wkPage.ts +++ b/packages/playwright-core/src/server/webkit/wkPage.ts @@ -636,14 +636,14 @@ export class WKPage implements PageDelegate { case 'dark': appearance = 'Dark'; break; case 'no-override': appearance = undefined; break; } - promises.push(session.send('Page.setForcedAppearance', { appearance })); + promises.push(session.send('Page.overrideUserPreference', { name: 'PrefersColorScheme', value: appearance })); let reducedMotionWk: any = undefined; switch (reducedMotion) { case 'reduce': reducedMotionWk = 'Reduce'; break; case 'no-preference': reducedMotionWk = 'NoPreference'; break; case 'no-override': reducedMotionWk = undefined; break; } - promises.push(session.send('Page.setForcedReducedMotion', { reducedMotion: reducedMotionWk })); + promises.push(session.send('Page.overrideUserPreference', { name: 'PrefersReducedMotion', value: reducedMotionWk })); let forcedColorsWk: any = undefined; switch (forcedColors) { case 'active': forcedColorsWk = 'Active'; break;