feat(webkit): roll to r1658 (#14709)

Language override behavior changed upstream in WebKit/WebKit@039ebd9
New logic is closer to the actual behavior of WebKit on macOS, meaning that when the user changes system language the actual locale changes according to some weird OS rules:
ru-RU => navigator.language === 'ru'
fr-CH => navigator.language === 'fr-FR'
es-MX => navigator.language === 'es-MX'
Our locale emulation is aligned with that, so setting locale to fr-CH will result in fr-FR etc.
This commit is contained in:
Yury Semikhatsky 2022-06-08 10:16:49 -07:00 committed by GitHub
parent f7f44d4fd8
commit 7f026dd64c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 15 deletions

View file

@ -33,7 +33,7 @@
}, },
{ {
"name": "webkit", "name": "webkit",
"revision": "1648", "revision": "1658",
"installByDefault": true, "installByDefault": true,
"revisionOverrides": { "revisionOverrides": {
"mac10.14": "1446", "mac10.14": "1446",

View file

@ -1559,6 +1559,10 @@ export module Protocol {
* Identifier of the network request associated with this message. * Identifier of the network request associated with this message.
*/ */
networkRequestId?: Network.RequestId; networkRequestId?: Network.RequestId;
/**
* Time when this message was added. Currently only used when an expensive operation happens to make sure that the frontend can account for it.
*/
timestamp?: number;
} }
/** /**
* Stack entry for console errors and assertions. * Stack entry for console errors and assertions.
@ -2384,7 +2388,7 @@ export module Protocol {
/** /**
* Query selector result. * Query selector result.
*/ */
nodeId: NodeId; nodeId?: NodeId;
} }
/** /**
* Executes <code>querySelectorAll</code> on a given node. * Executes <code>querySelectorAll</code> on a given node.
@ -8564,11 +8568,11 @@ the top of the viewport and Y increases as it proceeds towards the bottom of the
/** /**
* Timeline record type. * Timeline record type.
*/ */
export type EventType = "EventDispatch"|"ScheduleStyleRecalculation"|"RecalculateStyles"|"InvalidateLayout"|"Layout"|"Paint"|"Composite"|"RenderingFrame"|"TimerInstall"|"TimerRemove"|"TimerFire"|"EvaluateScript"|"TimeStamp"|"Time"|"TimeEnd"|"FunctionCall"|"ProbeSample"|"ConsoleProfile"|"RequestAnimationFrame"|"CancelAnimationFrame"|"FireAnimationFrame"|"ObserverCallback"; export type EventType = "EventDispatch"|"ScheduleStyleRecalculation"|"RecalculateStyles"|"InvalidateLayout"|"Layout"|"Paint"|"Composite"|"RenderingFrame"|"TimerInstall"|"TimerRemove"|"TimerFire"|"EvaluateScript"|"TimeStamp"|"Time"|"TimeEnd"|"FunctionCall"|"ProbeSample"|"ConsoleProfile"|"RequestAnimationFrame"|"CancelAnimationFrame"|"FireAnimationFrame"|"ObserverCallback"|"Screenshot";
/** /**
* Instrument types. * Instrument types.
*/ */
export type Instrument = "ScriptProfiler"|"Timeline"|"CPU"|"Memory"|"Heap"|"Animation"; export type Instrument = "ScriptProfiler"|"Timeline"|"CPU"|"Memory"|"Heap"|"Animation"|"Screenshot";
/** /**
* Timeline record contains information about the recorded activity. * Timeline record contains information about the recorded activity.
*/ */

View file

@ -28,10 +28,10 @@ it('should affect accept-language header @smoke', async ({ browser, server }) =>
await context.close(); await context.close();
}); });
it('should affect navigator.language', async ({ browser, server }) => { it('should affect navigator.language', async ({ browser }) => {
const context = await browser.newContext({ locale: 'fr-CH' }); const context = await browser.newContext({ locale: 'fr-FR' });
const page = await context.newPage(); const page = await context.newPage();
expect(await page.evaluate(() => navigator.language)).toBe('fr-CH'); expect(await page.evaluate(() => navigator.language)).toBe('fr-FR');
await context.close(); await context.close();
}); });
@ -87,7 +87,7 @@ it('should format number in popups', async ({ browser, server }) => {
}); });
it('should affect navigator.language in popups', async ({ browser, server }) => { it('should affect navigator.language in popups', async ({ browser, server }) => {
const context = await browser.newContext({ locale: 'fr-CH' }); const context = await browser.newContext({ locale: 'fr-FR' });
const page = await context.newPage(); const page = await context.newPage();
await page.goto(server.EMPTY_PAGE); await page.goto(server.EMPTY_PAGE);
const [popup] = await Promise.all([ const [popup] = await Promise.all([
@ -96,7 +96,7 @@ it('should affect navigator.language in popups', async ({ browser, server }) =>
]); ]);
await popup.waitForLoadState('domcontentloaded'); await popup.waitForLoadState('domcontentloaded');
const result = await popup.evaluate('window.initialNavigatorLanguage'); const result = await popup.evaluate('window.initialNavigatorLanguage');
expect(result).toBe('fr-CH'); expect(result).toBe('fr-FR');
await context.close(); await context.close();
}); });
@ -138,7 +138,7 @@ it('should be isolated between contexts', async ({ browser, server }) => {
]); ]);
}); });
it('should not change default locale in another context', async ({ browser, server }) => { it('should not change default locale in another context', async ({ browser }) => {
async function getContextLocale(context) { async function getContextLocale(context) {
const page = await context.newPage(); const page = await context.newPage();
return await page.evaluate(() => (new Intl.NumberFormat()).resolvedOptions().locale); return await page.evaluate(() => (new Intl.NumberFormat()).resolvedOptions().locale);
@ -150,7 +150,7 @@ it('should not change default locale in another context', async ({ browser, serv
defaultLocale = await getContextLocale(context); defaultLocale = await getContextLocale(context);
await context.close(); await context.close();
} }
const localeOverride = defaultLocale === 'ru-RU' ? 'de-DE' : 'ru-RU'; const localeOverride = defaultLocale === 'es-MX' ? 'de-DE' : 'es-MX';
{ {
const context = await browser.newContext({ locale: localeOverride }); const context = await browser.newContext({ locale: localeOverride });
expect(await getContextLocale(context)).toBe(localeOverride); expect(await getContextLocale(context)).toBe(localeOverride);
@ -164,13 +164,13 @@ it('should not change default locale in another context', async ({ browser, serv
}); });
it('should format number in workers', async ({ browser, server }) => { it('should format number in workers', async ({ browser, server }) => {
const context = await browser.newContext({ locale: 'ru-RU' }); const context = await browser.newContext({ locale: 'es-MX' });
const page = await context.newPage(); const page = await context.newPage();
await page.goto(server.EMPTY_PAGE); await page.goto(server.EMPTY_PAGE);
const [worker] = await Promise.all([ const [worker] = await Promise.all([
page.waitForEvent('worker'), page.waitForEvent('worker'),
page.evaluate(() => new Worker(URL.createObjectURL(new Blob(['console.log(1)'], { type: 'application/javascript' })))), page.evaluate(() => new Worker(URL.createObjectURL(new Blob(['console.log(1)'], { type: 'application/javascript' })))),
]); ]);
expect(await worker.evaluate(() => (10000.20).toLocaleString())).toBe('10\u00A0000,2'); expect(await worker.evaluate(() => (10000.20).toLocaleString())).toBe('10,000.2');
await context.close(); await context.close();
}); });

View file

@ -58,8 +58,8 @@ it('should support timezoneId option', async ({ launchPersistent, browserName })
}); });
it('should support locale option', async ({ launchPersistent }) => { it('should support locale option', async ({ launchPersistent }) => {
const { page } = await launchPersistent({ locale: 'fr-CH' }); const { page } = await launchPersistent({ locale: 'fr-FR' });
expect(await page.evaluate(() => navigator.language)).toBe('fr-CH'); expect(await page.evaluate(() => navigator.language)).toBe('fr-FR');
}); });
it('should support geolocation and permissions options', async ({ server, launchPersistent }) => { it('should support geolocation and permissions options', async ({ server, launchPersistent }) => {