feat(webkit): roll to r1059 (#360)

This commit is contained in:
Pavel Feldman 2020-01-03 08:10:36 -08:00 committed by GitHub
parent 1e3140e845
commit a09235a6e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 12 deletions

View File

@ -10,7 +10,7 @@
"playwright": {
"chromium_revision": "724623",
"firefox_revision": "1009",
"webkit_revision": "1055"
"webkit_revision": "1059"
},
"scripts": {
"unit": "node test/test.js",

View File

@ -30,7 +30,7 @@ export class WKExecutionContext implements js.ExecutionContextDelegate {
_contextId: number;
private _contextDestroyedCallback: () => void;
private _executionContextDestroyedPromise: Promise<unknown>;
_jsonObjectId: Protocol.Runtime.RemoteObjectId | undefined;
_jsonStringifyObjectId: Protocol.Runtime.RemoteObjectId | undefined;
constructor(client: WKTargetSession, contextPayload: Protocol.Runtime.ExecutionContextDescription) {
this._session = client;
@ -219,9 +219,9 @@ export class WKExecutionContext implements js.ExecutionContextDelegate {
}
private _returnObjectByValue(objectId: Protocol.Runtime.RemoteObjectId) {
const serializeFunction = function(JSON: { stringify: (o: any) => string }) {
const serializeFunction = function(stringify: (o: any) => string) {
try {
return JSON.stringify(this);
return stringify(this);
} catch (e) {
if (e instanceof TypeError)
return void 0;
@ -232,7 +232,7 @@ export class WKExecutionContext implements js.ExecutionContextDelegate {
// Serialize object using standard JSON implementation to correctly pass 'undefined'.
functionDeclaration: serializeFunction + '\n' + suffix + '\n',
objectId: objectId,
arguments: [ { objectId: this._jsonObjectId } ],
arguments: [ { objectId: this._jsonStringifyObjectId } ],
returnByValue: true
}).catch(e => {
if (isSwappedOutError(e))

View File

@ -37,7 +37,7 @@ import { PNG } from 'pngjs';
const UTILITY_WORLD_NAME = '__playwright_utility_world__';
const BINDING_CALL_MESSAGE = '__playwright_binding_call__';
const JSON_CALL_MESSAGE = '__playwright_json_call__';
const JSON_SAVE_SCRIPT = `console.debug('${JSON_CALL_MESSAGE}', JSON)`;
const JSON_SAVE_SCRIPT = `console.debug('${JSON_CALL_MESSAGE}', JSON.stringify.bind(JSON))`;
export class WKPage implements PageDelegate {
readonly rawMouse: RawMouseImpl;
@ -101,7 +101,7 @@ export class WKPage implements PageDelegate {
promises.push(this._setEmulateMedia(session, this._page._state.mediaType, this._page._state.colorScheme));
if (contextOptions.javaScriptEnabled === false)
promises.push(session.send('Emulation.setJavaScriptEnabled', { enabled: false }));
if (this._setBootstrapScripts.length && session.isProvisional())
if (session.isProvisional())
promises.push(this._setBootstrapScripts(session));
if (contextOptions.bypassCSP)
promises.push(session.send('Page.setBypassCSP', { enabled: true }));
@ -109,9 +109,8 @@ export class WKPage implements PageDelegate {
promises.push(this._setExtraHTTPHeaders(session, this._page._state.extraHTTPHeaders));
if (this._page._state.viewport)
promises.push(WKPage._setViewport(session, this._page._state.viewport));
if (contextOptions.javaScriptEnabled !== false)
promises.push(session.send('Page.setBootstrapScript', { source: JSON_SAVE_SCRIPT }));
await Promise.all(promises);
await this._page.evaluate(JSON_SAVE_SCRIPT);
}
didClose() {
@ -224,7 +223,7 @@ export class WKPage implements PageDelegate {
if (level === 'debug' && parameters && parameters[0].value === JSON_CALL_MESSAGE) {
const parsedObjectId = JSON.parse(parameters[1].objectId);
const context = this._contextIdToContext.get(parsedObjectId.injectedScriptId);
(context._delegate as WKExecutionContext)._jsonObjectId = parameters[1].objectId;
(context._delegate as WKExecutionContext)._jsonStringifyObjectId = parameters[1].objectId;
return;
}
let derivedType: string = type;
@ -308,7 +307,7 @@ export class WKPage implements PageDelegate {
throw new Error('Not implemented');
const width = viewport.width;
const height = viewport.height;
await session.send('Emulation.setDeviceMetricsOverride', { width, height, deviceScaleFactor: viewport.deviceScaleFactor || 1 });
await session.send('Emulation.setDeviceMetricsOverride', { width, height, fixedLayout: false, deviceScaleFactor: viewport.deviceScaleFactor || 1 });
}
setCacheEnabled(enabled: boolean): Promise<void> {
@ -392,7 +391,7 @@ export class WKPage implements PageDelegate {
}
async resetViewport(oldSize: types.Size): Promise<void> {
await this._session.send('Emulation.setDeviceMetricsOverride', { ...oldSize, deviceScaleFactor: 0 });
await this._session.send('Emulation.setDeviceMetricsOverride', { ...oldSize, fixedLayout: false, deviceScaleFactor: 0 });
}
async getContentFrame(handle: dom.ElementHandle): Promise<frames.Frame | null> {