feat(browser): roll WebKit to r1370 (#4257)

This commit is contained in:
Pavel Feldman 2020-10-28 13:46:05 -07:00 committed by GitHub
parent ece84eccd7
commit 7bedbb2d78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 33 additions and 29 deletions

View File

@ -13,7 +13,7 @@
},
{
"name": "webkit",
"revision": "1364",
"revision": "1370",
"download": true
}
]

View File

@ -136,7 +136,7 @@ export class CRNetworkManager {
_onRequestWillBeSentExtraInfo(event: Protocol.Network.requestWillBeSentExtraInfoPayload) {
const request = this._requestIdToRequest.get(event.requestId);
if (request) {
request.request._updateWithRawHeaders(headersObjectToArray(event.headers));
request.request.updateWithRawHeaders(headersObjectToArray(event.headers));
this._requestIdToExtraInfo.delete(event.requestId);
} else {
this._requestIdToExtraInfo.set(event.requestId, event);

View File

@ -178,7 +178,7 @@ export class Request {
return new Route(this, this._routeDelegate);
}
_updateWithRawHeaders(headers: types.HeadersArray) {
updateWithRawHeaders(headers: types.HeadersArray) {
this._headers = headers;
this._headersMap.clear();
for (const { name, value } of this._headers)

View File

@ -6564,6 +6564,21 @@ the top of the viewport and Y increases as it proceeds towards the bottom of the
*/
data: string;
}
/**
* Overrides screen size exposed to DOM and used in media queries for testing with provided values.
*/
export type setScreenSizeOverrideParameters = {
/**
* Screen width
*/
width?: number;
/**
* Screen height
*/
height?: number;
}
export type setScreenSizeOverrideReturnValue = {
}
/**
* Insert text into the current selection of the page.
*/
@ -6641,15 +6656,6 @@ the top of the viewport and Y increases as it proceeds towards the bottom of the
}
export type crashReturnValue = {
}
/**
* Overrides screen size with provided values.
*/
export type setScreenSizeOverrideParameters = {
width: number;
height: number;
}
export type setScreenSizeOverrideReturnValue = {
}
/**
* Overrides window.orientation with provided value.
*/
@ -8682,6 +8688,7 @@ the top of the viewport and Y increases as it proceeds towards the bottom of the
"Page.snapshotNode": Page.snapshotNodeParameters;
"Page.snapshotRect": Page.snapshotRectParameters;
"Page.archive": Page.archiveParameters;
"Page.setScreenSizeOverride": Page.setScreenSizeOverrideParameters;
"Page.insertText": Page.insertTextParameters;
"Page.accessibilitySnapshot": Page.accessibilitySnapshotParameters;
"Page.setInterceptFileChooserDialog": Page.setInterceptFileChooserDialogParameters;
@ -8689,7 +8696,6 @@ the top of the viewport and Y increases as it proceeds towards the bottom of the
"Page.createUserWorld": Page.createUserWorldParameters;
"Page.setBypassCSP": Page.setBypassCSPParameters;
"Page.crash": Page.crashParameters;
"Page.setScreenSizeOverride": Page.setScreenSizeOverrideParameters;
"Page.setOrientationOverride": Page.setOrientationOverrideParameters;
"Playwright.enable": Playwright.enableParameters;
"Playwright.disable": Playwright.disableParameters;
@ -8966,6 +8972,7 @@ the top of the viewport and Y increases as it proceeds towards the bottom of the
"Page.snapshotNode": Page.snapshotNodeReturnValue;
"Page.snapshotRect": Page.snapshotRectReturnValue;
"Page.archive": Page.archiveReturnValue;
"Page.setScreenSizeOverride": Page.setScreenSizeOverrideReturnValue;
"Page.insertText": Page.insertTextReturnValue;
"Page.accessibilitySnapshot": Page.accessibilitySnapshotReturnValue;
"Page.setInterceptFileChooserDialog": Page.setInterceptFileChooserDialogReturnValue;
@ -8973,7 +8980,6 @@ the top of the viewport and Y increases as it proceeds towards the bottom of the
"Page.createUserWorld": Page.createUserWorldReturnValue;
"Page.setBypassCSP": Page.setBypassCSPReturnValue;
"Page.crash": Page.crashReturnValue;
"Page.setScreenSizeOverride": Page.setScreenSizeOverrideReturnValue;
"Page.setOrientationOverride": Page.setOrientationOverrideReturnValue;
"Playwright.enable": Playwright.enableReturnValue;
"Playwright.disable": Playwright.disableReturnValue;

View File

@ -18,7 +18,7 @@
import * as jpeg from 'jpeg-js';
import * as path from 'path';
import * as png from 'pngjs';
import { assert, createGuid, debugAssert, headersArrayToObject } from '../../utils/utils';
import { assert, createGuid, debugAssert, headersArrayToObject, headersObjectToArray } from '../../utils/utils';
import * as accessibility from '../accessibility';
import * as dialog from '../dialog';
import * as dom from '../dom';
@ -927,6 +927,8 @@ export class WKPage implements PageDelegate {
if (!request)
return;
const response = request.createResponse(event.response);
if (event.response.requestHeaders && Object.keys(event.response.requestHeaders).length)
request.request.updateWithRawHeaders(headersObjectToArray(event.response.requestHeaders));
this._page._frameManager.requestReceivedResponse(response);
if (response.status() === 204) {

View File

@ -62,7 +62,6 @@ type HarOptions = {
class HarContextTracer {
private _options: HarOptions;
private _browserName: string;
private _log: har.Log;
private _pageEntries = new Map<Page, har.Page>();
private _entries = new Map<network.Request, har.Entry>();
@ -70,7 +69,6 @@ class HarContextTracer {
private _barrierPromises = new Map<Promise<void>, Page>();
constructor(context: BrowserContext, options: HarOptions) {
this._browserName = context._browser._options.name;
this._options = options;
this._log = {
version: '1.2',
@ -204,7 +202,7 @@ class HarContextTracer {
status: response.status(),
statusText: response.statusText(),
httpVersion: 'HTTP/1.1',
cookies: cookiesForHar(response.headerValue('set-cookie'), this._browserName === 'webkit' ? ',' : '\n'),
cookies: cookiesForHar(response.headerValue('set-cookie'), '\n'),
headers: response.headers().map(header => ({ name: header.name, value: header.value })),
content: {
size: -1,

View File

@ -164,9 +164,7 @@ it('should include form params', async ({ pageWithHar, server }) => {
});
});
it('should include cookies', (test, { browserName }) => {
test.fail(browserName === 'webkit', 'WebKit is lacking raw headers w/ cookies on WebCore side');
}, async ({ pageWithHar, server }) => {
it('should include cookies', async ({ pageWithHar, server }) => {
const { page, context } = pageWithHar;
await context.addCookies([
{ name: 'name1', value: '"value1"', domain: 'localhost', path: '/', httpOnly: true },
@ -184,7 +182,9 @@ it('should include cookies', (test, { browserName }) => {
]);
});
it('should include set-cookies', async ({ pageWithHar, server }) => {
it('should include set-cookies', (test, { browserName, platform }) => {
test.fail(browserName === 'webkit' && platform === 'darwin', 'Does not work yet');
}, async ({ pageWithHar, server }) => {
const { page } = pageWithHar;
server.setRoute('/empty.html', (req, res) => {
res.setHeader('Set-Cookie', [
@ -202,9 +202,7 @@ it('should include set-cookies', async ({ pageWithHar, server }) => {
expect(new Date(cookies[2].expires).valueOf()).toBeGreaterThan(Date.now());
});
it('should include set-cookies with comma', (test, { browserName }) => {
test.fail(browserName === 'webkit', 'WebKit concatenates headers poorly');
}, async ({ pageWithHar, server }) => {
it('should include set-cookies with comma', async ({ pageWithHar, server }) => {
const { page } = pageWithHar;
server.setRoute('/empty.html', (req, res) => {
res.setHeader('Set-Cookie', [

View File

@ -81,8 +81,8 @@ it('should return headers', async ({page, server, isChromium, isFirefox, isWebKi
expect(response.request().headers()['user-agent']).toContain('WebKit');
});
it('should get the same headers as the server', (test, { browserName }) => {
test.fail(browserName === 'webkit', 'Provisional headers differ from those in network stack');
it('should get the same headers as the server', (test, { browserName, platform }) => {
test.fail(browserName === 'webkit' && platform !== 'darwin', 'Provisional headers differ from those in network stack');
}, async ({ page, server }) => {
let serverRequest;
server.setRoute('/empty.html', (request, response) => {
@ -93,8 +93,8 @@ it('should get the same headers as the server', (test, { browserName }) => {
expect(response.request().headers()).toEqual(serverRequest.headers);
});
it('should get the same headers as the server CORP', (test, { browserName }) => {
test.fail(browserName === 'webkit', 'Provisional headers differ from those in network stack');
it('should get the same headers as the server CORP', (test, { browserName, platform }) => {
test.fail(browserName === 'webkit' && platform !== 'darwin', 'Provisional headers differ from those in network stack');
}, async ({page, server}) => {
await page.goto(server.PREFIX + '/empty.html');
let serverRequest;