Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

feat(webkit): roll to r1944 (#28148)

Playwright Servicebb241abaff5f
diff --git a/packages/playwright-core/browsers.json b/packages/playwright-core/browsers.json
index 26426381ed..ea205cd268 100644
--- a/packages/playwright-core/browsers.json
+++ b/packages/playwright-core/browsers.json
@@ -39,7 +39,7 @@
},
{
"name": "webkit",
- "revision": "1943",
+ "revision": "1944",
"installByDefault": true,
"revisionOverrides": {
"mac10.14": "1446",
diff --git a/packages/playwright-core/src/server/injected/domUtils.ts b/packages/playwright-core/src/server/injected/domUtils.ts
index 1b4922c913..b20de88754 100644
--- a/packages/playwright-core/src/server/injected/domUtils.ts
+++ b/packages/playwright-core/src/server/injected/domUtils.ts
@@ -14,6 +14,11 @@
* limitations under the License.
*/
+let browserNameForWorkarounds = '';
+export function setBrowserName(name: string) {
+ browserNameForWorkarounds = name;
+}
+
export function isInsideScope(scope: Node, element: Element | undefined): boolean {
while (element) {
if (scope.contains(element))
@@ -75,9 +80,9 @@ export function isElementStyleVisibilityVisible(element: Element, style?: CSSSty
// Element.checkVisibility checks for content-visibility and also looks at
// styles up the flat tree including user-agent ShadowRoots, such as the
// details element for example.
- // @ts-ignore Typescript doesn't know that checkVisibility exists yet.
- if (Element.prototype.checkVisibility) {
- // @ts-ignore Typescript doesn't know that checkVisibility exists yet.
+ // All the browser implement it, but WebKit has a bug which prevents us from using it:
+ // https://bugs.webkit.org/show_bug.cgi?id=264733
+ if (browserNameForWorkarounds !== 'webkit') {
if (!element.checkVisibility({ checkOpacity: false, checkVisibilityCSS: false }))
return false;
} else {
diff --git a/packages/playwright-core/src/server/injected/injectedScript.ts b/packages/playwright-core/src/server/injected/injectedScript.ts
index fe0affdab4..1c87f8bf42 100644
--- a/packages/playwright-core/src/server/injected/injectedScript.ts
+++ b/packages/playwright-core/src/server/injected/injectedScript.ts
@@ -24,7 +24,7 @@ import type { NestedSelectorBody, ParsedSelector, ParsedSelectorPart } from '../
import { visitAllSelectorParts, parseSelector, stringifySelector } from '../../utils/isomorphic/selectorParser';
import { type TextMatcher, elementMatchesText, elementText, type ElementText, getElementLabels } from './selectorUtils';
import { SelectorEvaluatorImpl, sortInDOMOrder } from './selectorEvaluator';
-import { enclosingShadowRootOrDocument, isElementVisible, parentElementOrShadowHost } from './domUtils';
+import { enclosingShadowRootOrDocument, isElementVisible, parentElementOrShadowHost, setBrowserName } from './domUtils';
import type { CSSComplexSelectorList } from '../../utils/isomorphic/cssParser';
import { generateSelector, type GenerateSelectorOptions } from './selectorGenerator';
import type * as channels from '@protocol/channels';
@@ -137,6 +137,7 @@ export class InjectedScript {
this._stableRafCount = stableRafCount;
this._browserName = browserName;
+ setBrowserName(browserName);
this._setupGlobalListenersRemovalDetection();
this._setupHitTargetInterceptors();