feat(firefox-beta): roll to r1310 (#10954)

This commit is contained in:
Andrey Lushnikov 2021-12-15 17:33:09 -08:00 committed by GitHub
parent fcccac0c08
commit 2957b7b013
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 33 additions and 24 deletions

View file

@ -18,7 +18,7 @@
}, },
{ {
"name": "firefox-beta", "name": "firefox-beta",
"revision": "1309", "revision": "1310",
"installByDefault": false "installByDefault": false
}, },
{ {

View file

@ -0,0 +1 @@
<!DOCTYPE html>

View file

@ -1,4 +1,4 @@
<script> <!DOCTYPE html> <script>
console.error('Not a JS error'); console.error('Not a JS error');
a(); a();

View file

@ -353,7 +353,7 @@ it('should set cookies for a frame', async ({ context, page, server }) => {
expect(await page.frames()[1].evaluate('document.cookie')).toBe('frame-cookie=value'); expect(await page.frames()[1].evaluate('document.cookie')).toBe('frame-cookie=value');
}); });
it('should(not) block third party cookies', async ({ context, page, server, browserName }) => { it('should(not) block third party cookies', async ({ context, page, server, browserName, browserMajorVersion }) => {
await page.goto(server.EMPTY_PAGE); await page.goto(server.EMPTY_PAGE);
await page.evaluate(src => { await page.evaluate(src => {
let fulfill; let fulfill;
@ -366,7 +366,7 @@ it('should(not) block third party cookies', async ({ context, page, server, brow
}, server.CROSS_PROCESS_PREFIX + '/grid.html'); }, server.CROSS_PROCESS_PREFIX + '/grid.html');
await page.frames()[1].evaluate(`document.cookie = 'username=John Doe'`); await page.frames()[1].evaluate(`document.cookie = 'username=John Doe'`);
await page.waitForTimeout(2000); await page.waitForTimeout(2000);
const allowsThirdParty = browserName === 'firefox'; const allowsThirdParty = browserName === 'firefox' && browserMajorVersion < 96;
const cookies = await context.cookies(server.CROSS_PROCESS_PREFIX + '/grid.html'); const cookies = await context.cookies(server.CROSS_PROCESS_PREFIX + '/grid.html');
if (allowsThirdParty) { if (allowsThirdParty) {
expect(cookies).toEqual([ expect(cookies).toEqual([

View file

@ -21,13 +21,14 @@ it('should return no cookies in pristine browser context', async ({ context, pag
expect(await context.cookies()).toEqual([]); expect(await context.cookies()).toEqual([]);
}); });
it('should get a cookie', async ({ context, page, server, browserName }) => { it('should get a cookie', async ({ context, page, server, browserName, browserMajorVersion }) => {
await page.goto(server.EMPTY_PAGE); await page.goto(server.EMPTY_PAGE);
const documentCookie = await page.evaluate(() => { const documentCookie = await page.evaluate(() => {
document.cookie = 'username=John Doe'; document.cookie = 'username=John Doe';
return document.cookie; return document.cookie;
}); });
expect(documentCookie).toBe('username=John Doe'); expect(documentCookie).toBe('username=John Doe');
const defaultSameSiteCookieValue = browserName === 'chromium' || (browserName === 'firefox' && browserMajorVersion >= 96) ? 'Lax' : 'None';
expect(await context.cookies()).toEqual([{ expect(await context.cookies()).toEqual([{
name: 'username', name: 'username',
value: 'John Doe', value: 'John Doe',
@ -36,11 +37,11 @@ it('should get a cookie', async ({ context, page, server, browserName }) => {
expires: -1, expires: -1,
httpOnly: false, httpOnly: false,
secure: false, secure: false,
sameSite: browserName === 'chromium' ? 'Lax' : 'None', sameSite: defaultSameSiteCookieValue,
}]); }]);
}); });
it('should get a non-session cookie', async ({ context, page, server, browserName }) => { it('should get a non-session cookie', async ({ context, page, server, browserName, browserMajorVersion }) => {
await page.goto(server.EMPTY_PAGE); await page.goto(server.EMPTY_PAGE);
// @see https://en.wikipedia.org/wiki/Year_2038_problem // @see https://en.wikipedia.org/wiki/Year_2038_problem
const date = +(new Date('1/1/2038')); const date = +(new Date('1/1/2038'));
@ -50,6 +51,7 @@ it('should get a non-session cookie', async ({ context, page, server, browserNam
return document.cookie; return document.cookie;
}, date); }, date);
expect(documentCookie).toBe('username=John Doe'); expect(documentCookie).toBe('username=John Doe');
const defaultSameSiteCookieValue = browserName === 'chromium' || (browserName === 'firefox' && browserMajorVersion >= 96) ? 'Lax' : 'None';
expect(await context.cookies()).toEqual([{ expect(await context.cookies()).toEqual([{
name: 'username', name: 'username',
value: 'John Doe', value: 'John Doe',
@ -58,7 +60,7 @@ it('should get a non-session cookie', async ({ context, page, server, browserNam
expires: date / 1000, expires: date / 1000,
httpOnly: false, httpOnly: false,
secure: false, secure: false,
sameSite: browserName === 'chromium' ? 'Lax' : 'None', sameSite: defaultSameSiteCookieValue,
}]); }]);
}); });
@ -99,7 +101,7 @@ it('should properly report "Lax" sameSite cookie', async ({ context, page, serve
expect(cookies[0].sameSite).toBe('Lax'); expect(cookies[0].sameSite).toBe('Lax');
}); });
it('should get multiple cookies', async ({ context, page, server, browserName }) => { it('should get multiple cookies', async ({ context, page, server, browserName, browserMajorVersion }) => {
await page.goto(server.EMPTY_PAGE); await page.goto(server.EMPTY_PAGE);
const documentCookie = await page.evaluate(() => { const documentCookie = await page.evaluate(() => {
document.cookie = 'username=John Doe'; document.cookie = 'username=John Doe';
@ -107,6 +109,7 @@ it('should get multiple cookies', async ({ context, page, server, browserName })
return document.cookie.split('; ').sort().join('; '); return document.cookie.split('; ').sort().join('; ');
}); });
const cookies = new Set(await context.cookies()); const cookies = new Set(await context.cookies());
const defaultSameSiteCookieValue = browserName === 'chromium' || (browserName === 'firefox' && browserMajorVersion >= 96) ? 'Lax' : 'None';
expect(documentCookie).toBe('password=1234; username=John Doe'); expect(documentCookie).toBe('password=1234; username=John Doe');
expect(cookies).toEqual(new Set([ expect(cookies).toEqual(new Set([
{ {
@ -117,7 +120,7 @@ it('should get multiple cookies', async ({ context, page, server, browserName })
expires: -1, expires: -1,
httpOnly: false, httpOnly: false,
secure: false, secure: false,
sameSite: browserName === 'chromium' ? 'Lax' : 'None', sameSite: defaultSameSiteCookieValue,
}, },
{ {
name: 'username', name: 'username',
@ -127,7 +130,7 @@ it('should get multiple cookies', async ({ context, page, server, browserName })
expires: -1, expires: -1,
httpOnly: false, httpOnly: false,
secure: false, secure: false,
sameSite: browserName === 'chromium' ? 'Lax' : 'None', sameSite: defaultSameSiteCookieValue,
}, },
])); ]));
}); });

View file

@ -108,7 +108,7 @@ it('should fall back to context.route', async ({ browser, server }) => {
await context.close(); await context.close();
}); });
it('should support Set-Cookie header', async ({ contextFactory, server, browserName }) => { it('should support Set-Cookie header', async ({ contextFactory, server, browserName, browserMajorVersion }) => {
it.fixme(browserName === 'webkit'); it.fixme(browserName === 'webkit');
const context = await contextFactory(); const context = await contextFactory();
@ -123,8 +123,9 @@ it('should support Set-Cookie header', async ({ contextFactory, server, browserN
}); });
}); });
await page.goto('https://example.com'); await page.goto('https://example.com');
const defaultSameSiteCookieValue = browserName === 'chromium' || (browserName === 'firefox' && browserMajorVersion >= 96) ? 'Lax' : 'None';
expect(await context.cookies()).toEqual([{ expect(await context.cookies()).toEqual([{
sameSite: browserName === 'chromium' ? 'Lax' : 'None', sameSite: defaultSameSiteCookieValue,
name: 'name', name: 'name',
value: 'value', value: 'value',
domain: '.example.com', domain: '.example.com',
@ -153,7 +154,7 @@ it('should ignore secure Set-Cookie header for insecure requests', async ({ cont
expect(await context.cookies()).toEqual([]); expect(await context.cookies()).toEqual([]);
}); });
it('should use Set-Cookie header in future requests', async ({ contextFactory, server, browserName }) => { it('should use Set-Cookie header in future requests', async ({ contextFactory, server, browserName, browserMajorVersion }) => {
it.fixme(browserName === 'webkit'); it.fixme(browserName === 'webkit');
const context = await contextFactory(); const context = await contextFactory();
@ -169,8 +170,9 @@ it('should use Set-Cookie header in future requests', async ({ contextFactory, s
}); });
}); });
await page.goto(server.EMPTY_PAGE); await page.goto(server.EMPTY_PAGE);
const defaultSameSiteCookieValue = browserName === 'chromium' || (browserName === 'firefox' && browserMajorVersion >= 96) ? 'Lax' : 'None';
expect(await context.cookies()).toEqual([{ expect(await context.cookies()).toEqual([{
sameSite: browserName === 'chromium' ? 'Lax' : 'None', sameSite: defaultSameSiteCookieValue,
name: 'name', name: 'name',
value: 'value', value: 'value',
domain: 'localhost', domain: 'localhost',

View file

@ -47,7 +47,9 @@ it('should scope context handles', async ({ browserType, server }) => {
const context = await browser.newContext(); const context = await browser.newContext();
const page = await context.newPage(); const page = await context.newPage();
await page.goto(server.EMPTY_PAGE); // Firefox Beta 96 yields a console warning for the pages that
// don't use `<!DOCTYPE HTML> tag.
await page.goto(server.PREFIX + '/empty-standard-mode.html');
await expectScopeState(browser, { await expectScopeState(browser, {
_guid: '', _guid: '',
objects: [ objects: [

View file

@ -19,7 +19,7 @@ import { playwrightTest as it, expect } from './config/browserTest';
import { verifyViewport } from './config/utils'; import { verifyViewport } from './config/utils';
import fs from 'fs'; import fs from 'fs';
it('context.cookies() should work', async ({ server, launchPersistent, browserName }) => { it('context.cookies() should work', async ({ server, launchPersistent, browserName, browserMajorVersion }) => {
const { page } = await launchPersistent(); const { page } = await launchPersistent();
await page.goto(server.EMPTY_PAGE); await page.goto(server.EMPTY_PAGE);
const documentCookie = await page.evaluate(() => { const documentCookie = await page.evaluate(() => {
@ -27,6 +27,7 @@ it('context.cookies() should work', async ({ server, launchPersistent, browserNa
return document.cookie; return document.cookie;
}); });
expect(documentCookie).toBe('username=John Doe'); expect(documentCookie).toBe('username=John Doe');
const defaultSameSiteCookieValue = browserName === 'chromium' || (browserName === 'firefox' && browserMajorVersion >= 96) ? 'Lax' : 'None';
expect(await page.context().cookies()).toEqual([{ expect(await page.context().cookies()).toEqual([{
name: 'username', name: 'username',
value: 'John Doe', value: 'John Doe',
@ -35,7 +36,7 @@ it('context.cookies() should work', async ({ server, launchPersistent, browserNa
expires: -1, expires: -1,
httpOnly: false, httpOnly: false,
secure: false, secure: false,
sameSite: browserName === 'chromium' ? 'Lax' : 'None', sameSite: defaultSameSiteCookieValue,
}]); }]);
}); });
@ -80,7 +81,7 @@ it('context.clearCookies() should work', async ({ server, launchPersistent }) =>
expect(await page.evaluate('document.cookie')).toBe(''); expect(await page.evaluate('document.cookie')).toBe('');
}); });
it('should(not) block third party cookies', async ({ server, launchPersistent, browserName }) => { it('should(not) block third party cookies', async ({ server, launchPersistent, browserName, browserMajorVersion }) => {
const { page, context } = await launchPersistent(); const { page, context } = await launchPersistent();
await page.goto(server.EMPTY_PAGE); await page.goto(server.EMPTY_PAGE);
await page.evaluate(src => { await page.evaluate(src => {
@ -97,7 +98,7 @@ it('should(not) block third party cookies', async ({ server, launchPersistent, b
return document.cookie; return document.cookie;
}); });
await page.waitForTimeout(2000); await page.waitForTimeout(2000);
const allowsThirdParty = browserName === 'firefox'; const allowsThirdParty = browserName === 'firefox' && browserMajorVersion <= 95;
expect(documentCookie).toBe(allowsThirdParty ? 'username=John Doe' : ''); expect(documentCookie).toBe(allowsThirdParty ? 'username=John Doe' : '');
const cookies = await context.cookies(server.CROSS_PROCESS_PREFIX + '/grid.html'); const cookies = await context.cookies(server.CROSS_PROCESS_PREFIX + '/grid.html');
if (allowsThirdParty) { if (allowsThirdParty) {

View file

@ -67,7 +67,7 @@ it('should close browser after context menu was triggered', async ({ browserType
await browser.close(); await browser.close();
}); });
it('should(not) block third party cookies', async ({ browserType, server, browserName }) => { it('should(not) block third party cookies', async ({ browserType, server, browserName, browserMajorVersion }) => {
const browser = await browserType.launch({ headless: false }); const browser = await browserType.launch({ headless: false });
const page = await browser.newPage(); const page = await browser.newPage();
await page.goto(server.EMPTY_PAGE); await page.goto(server.EMPTY_PAGE);
@ -85,7 +85,7 @@ it('should(not) block third party cookies', async ({ browserType, server, browse
return document.cookie; return document.cookie;
}); });
await page.waitForTimeout(2000); await page.waitForTimeout(2000);
const allowsThirdParty = browserName === 'firefox'; const allowsThirdParty = browserName === 'firefox' && browserMajorVersion <= 95;
expect(documentCookie).toBe(allowsThirdParty ? 'username=John Doe' : ''); expect(documentCookie).toBe(allowsThirdParty ? 'username=John Doe' : '');
const cookies = await page.context().cookies(server.CROSS_PROCESS_PREFIX + '/grid.html'); const cookies = await page.context().cookies(server.CROSS_PROCESS_PREFIX + '/grid.html');
if (allowsThirdParty) { if (allowsThirdParty) {

View file

@ -104,9 +104,9 @@ it('should work when the event is canceled', async ({ page }) => {
altKey: false, altKey: false,
metaKey: false, metaKey: false,
}); });
// give the page a chacne to scroll // Give the page a chance to scroll.
await page.waitForTimeout(100); await page.waitForTimeout(100);
// ensure that it did not. // Ensure that it did not.
expect(await page.evaluate('window.scrollY')).toBe(0); expect(await page.evaluate('window.scrollY')).toBe(0);
}); });