Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: auto-detect expression/function in js server #5284

Merged
merged 1 commit into from
Feb 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
49 changes: 26 additions & 23 deletions src/protocol/channels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1261,23 +1261,23 @@ export type FrameNavigatedEvent = {
export type FrameEvalOnSelectorParams = {
selector: string,
expression: string,
isFunction: boolean,
isFunction?: boolean,
arg: SerializedArgument,
};
export type FrameEvalOnSelectorOptions = {

isFunction?: boolean,
};
export type FrameEvalOnSelectorResult = {
value: SerializedValue,
};
export type FrameEvalOnSelectorAllParams = {
selector: string,
expression: string,
isFunction: boolean,
isFunction?: boolean,
arg: SerializedArgument,
};
export type FrameEvalOnSelectorAllOptions = {

isFunction?: boolean,
};
export type FrameEvalOnSelectorAllResult = {
value: SerializedValue,
Expand Down Expand Up @@ -1377,23 +1377,25 @@ export type FrameDispatchEventOptions = {
export type FrameDispatchEventResult = void;
export type FrameEvaluateExpressionParams = {
expression: string,
isFunction: boolean,
isFunction?: boolean,
arg: SerializedArgument,
world?: 'main' | 'utility',
};
export type FrameEvaluateExpressionOptions = {
isFunction?: boolean,
world?: 'main' | 'utility',
};
export type FrameEvaluateExpressionResult = {
value: SerializedValue,
};
export type FrameEvaluateExpressionHandleParams = {
expression: string,
isFunction: boolean,
isFunction?: boolean,
arg: SerializedArgument,
world?: 'main' | 'utility',
};
export type FrameEvaluateExpressionHandleOptions = {
isFunction?: boolean,
world?: 'main' | 'utility',
};
export type FrameEvaluateExpressionHandleResult = {
Expand Down Expand Up @@ -1680,12 +1682,13 @@ export type FrameUncheckOptions = {
export type FrameUncheckResult = void;
export type FrameWaitForFunctionParams = {
expression: string,
isFunction: boolean,
isFunction?: boolean,
arg: SerializedArgument,
timeout?: number,
pollingInterval?: number,
};
export type FrameWaitForFunctionOptions = {
isFunction?: boolean,
timeout?: number,
pollingInterval?: number,
};
Expand Down Expand Up @@ -1717,22 +1720,22 @@ export interface WorkerChannel extends Channel {
export type WorkerCloseEvent = {};
export type WorkerEvaluateExpressionParams = {
expression: string,
isFunction: boolean,
isFunction?: boolean,
arg: SerializedArgument,
};
export type WorkerEvaluateExpressionOptions = {

isFunction?: boolean,
};
export type WorkerEvaluateExpressionResult = {
value: SerializedValue,
};
export type WorkerEvaluateExpressionHandleParams = {
expression: string,
isFunction: boolean,
isFunction?: boolean,
arg: SerializedArgument,
};
export type WorkerEvaluateExpressionHandleOptions = {

isFunction?: boolean,
};
export type WorkerEvaluateExpressionHandleResult = {
handle: JSHandleChannel,
Expand All @@ -1759,22 +1762,22 @@ export type JSHandleDisposeOptions = {};
export type JSHandleDisposeResult = void;
export type JSHandleEvaluateExpressionParams = {
expression: string,
isFunction: boolean,
isFunction?: boolean,
arg: SerializedArgument,
};
export type JSHandleEvaluateExpressionOptions = {

isFunction?: boolean,
};
export type JSHandleEvaluateExpressionResult = {
value: SerializedValue,
};
export type JSHandleEvaluateExpressionHandleParams = {
expression: string,
isFunction: boolean,
isFunction?: boolean,
arg: SerializedArgument,
};
export type JSHandleEvaluateExpressionHandleOptions = {

isFunction?: boolean,
};
export type JSHandleEvaluateExpressionHandleResult = {
handle: JSHandleChannel,
Expand Down Expand Up @@ -1844,23 +1847,23 @@ export interface ElementHandleChannel extends JSHandleChannel {
export type ElementHandleEvalOnSelectorParams = {
selector: string,
expression: string,
isFunction: boolean,
isFunction?: boolean,
arg: SerializedArgument,
};
export type ElementHandleEvalOnSelectorOptions = {

isFunction?: boolean,
};
export type ElementHandleEvalOnSelectorResult = {
value: SerializedValue,
};
export type ElementHandleEvalOnSelectorAllParams = {
selector: string,
expression: string,
isFunction: boolean,
isFunction?: boolean,
arg: SerializedArgument,
};
export type ElementHandleEvalOnSelectorAllOptions = {

isFunction?: boolean,
};
export type ElementHandleEvalOnSelectorAllResult = {
value: SerializedValue,
Expand Down Expand Up @@ -2499,22 +2502,22 @@ export type ElectronApplicationWindowEvent = {
};
export type ElectronApplicationEvaluateExpressionParams = {
expression: string,
isFunction: boolean,
isFunction?: boolean,
arg: SerializedArgument,
};
export type ElectronApplicationEvaluateExpressionOptions = {

isFunction?: boolean,
};
export type ElectronApplicationEvaluateExpressionResult = {
value: SerializedValue,
};
export type ElectronApplicationEvaluateExpressionHandleParams = {
expression: string,
isFunction: boolean,
isFunction?: boolean,
arg: SerializedArgument,
};
export type ElectronApplicationEvaluateExpressionHandleOptions = {

isFunction?: boolean,
};
export type ElectronApplicationEvaluateExpressionHandleResult = {
handle: JSHandleChannel,
Expand Down
26 changes: 13 additions & 13 deletions src/protocol/protocol.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1050,7 +1050,7 @@ Frame:
parameters:
selector: string
expression: string
isFunction: boolean
isFunction: boolean?
arg: SerializedArgument
returns:
value: SerializedValue
Expand All @@ -1059,7 +1059,7 @@ Frame:
parameters:
selector: string
expression: string
isFunction: boolean
isFunction: boolean?
arg: SerializedArgument
returns:
value: SerializedValue
Expand Down Expand Up @@ -1149,7 +1149,7 @@ Frame:
evaluateExpression:
parameters:
expression: string
isFunction: boolean
isFunction: boolean?
arg: SerializedArgument
world:
type: enum?
Expand All @@ -1162,7 +1162,7 @@ Frame:
evaluateExpressionHandle:
parameters:
expression: string
isFunction: boolean
isFunction: boolean?
arg: SerializedArgument
world:
type: enum?
Expand Down Expand Up @@ -1396,7 +1396,7 @@ Frame:
waitForFunction:
parameters:
expression: string
isFunction: boolean
isFunction: boolean?
arg: SerializedArgument
timeout: number?
# When present, polls on interval. Otherwise, polls on raf.
Expand Down Expand Up @@ -1458,15 +1458,15 @@ Worker:
evaluateExpression:
parameters:
expression: string
isFunction: boolean
isFunction: boolean?
arg: SerializedArgument
returns:
value: SerializedValue

evaluateExpressionHandle:
parameters:
expression: string
isFunction: boolean
isFunction: boolean?
arg: SerializedArgument
returns:
handle: JSHandle
Expand All @@ -1489,15 +1489,15 @@ JSHandle:
evaluateExpression:
parameters:
expression: string
isFunction: boolean
isFunction: boolean?
arg: SerializedArgument
returns:
value: SerializedValue

evaluateExpressionHandle:
parameters:
expression: string
isFunction: boolean
isFunction: boolean?
arg: SerializedArgument
returns:
handle: JSHandle
Expand Down Expand Up @@ -1541,7 +1541,7 @@ ElementHandle:
parameters:
selector: string
expression: string
isFunction: boolean
isFunction: boolean?
arg: SerializedArgument
returns:
value: SerializedValue
Expand All @@ -1550,7 +1550,7 @@ ElementHandle:
parameters:
selector: string
expression: string
isFunction: boolean
isFunction: boolean?
arg: SerializedArgument
returns:
value: SerializedValue
Expand Down Expand Up @@ -2113,15 +2113,15 @@ ElectronApplication:
evaluateExpression:
parameters:
expression: string
isFunction: boolean
isFunction: boolean?
arg: SerializedArgument
returns:
value: SerializedValue

evaluateExpressionHandle:
parameters:
expression: string
isFunction: boolean
isFunction: boolean?
arg: SerializedArgument
returns:
handle: JSHandle
Expand Down
26 changes: 13 additions & 13 deletions src/protocol/validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -488,13 +488,13 @@ export function createScheme(tChannel: (name: string) => Validator): Scheme {
scheme.FrameEvalOnSelectorParams = tObject({
selector: tString,
expression: tString,
isFunction: tBoolean,
isFunction: tOptional(tBoolean),
arg: tType('SerializedArgument'),
});
scheme.FrameEvalOnSelectorAllParams = tObject({
selector: tString,
expression: tString,
isFunction: tBoolean,
isFunction: tOptional(tBoolean),
arg: tType('SerializedArgument'),
});
scheme.FrameAddScriptTagParams = tObject({
Expand Down Expand Up @@ -542,13 +542,13 @@ export function createScheme(tChannel: (name: string) => Validator): Scheme {
});
scheme.FrameEvaluateExpressionParams = tObject({
expression: tString,
isFunction: tBoolean,
isFunction: tOptional(tBoolean),
arg: tType('SerializedArgument'),
world: tOptional(tEnum(['main', 'utility'])),
});
scheme.FrameEvaluateExpressionHandleParams = tObject({
expression: tString,
isFunction: tBoolean,
isFunction: tOptional(tBoolean),
arg: tType('SerializedArgument'),
world: tOptional(tEnum(['main', 'utility'])),
});
Expand Down Expand Up @@ -680,7 +680,7 @@ export function createScheme(tChannel: (name: string) => Validator): Scheme {
});
scheme.FrameWaitForFunctionParams = tObject({
expression: tString,
isFunction: tBoolean,
isFunction: tOptional(tBoolean),
arg: tType('SerializedArgument'),
timeout: tOptional(tNumber),
pollingInterval: tOptional(tNumber),
Expand All @@ -692,25 +692,25 @@ export function createScheme(tChannel: (name: string) => Validator): Scheme {
});
scheme.WorkerEvaluateExpressionParams = tObject({
expression: tString,
isFunction: tBoolean,
isFunction: tOptional(tBoolean),
arg: tType('SerializedArgument'),
});
scheme.WorkerEvaluateExpressionHandleParams = tObject({
expression: tString,
isFunction: tBoolean,
isFunction: tOptional(tBoolean),
arg: tType('SerializedArgument'),
});
scheme.JSHandleDisposeParams = tOptional(tObject({}));
scheme.ElementHandleDisposeParams = tType('JSHandleDisposeParams');
scheme.JSHandleEvaluateExpressionParams = tObject({
expression: tString,
isFunction: tBoolean,
isFunction: tOptional(tBoolean),
arg: tType('SerializedArgument'),
});
scheme.ElementHandleEvaluateExpressionParams = tType('JSHandleEvaluateExpressionParams');
scheme.JSHandleEvaluateExpressionHandleParams = tObject({
expression: tString,
isFunction: tBoolean,
isFunction: tOptional(tBoolean),
arg: tType('SerializedArgument'),
});
scheme.ElementHandleEvaluateExpressionHandleParams = tType('JSHandleEvaluateExpressionHandleParams');
Expand All @@ -725,13 +725,13 @@ export function createScheme(tChannel: (name: string) => Validator): Scheme {
scheme.ElementHandleEvalOnSelectorParams = tObject({
selector: tString,
expression: tString,
isFunction: tBoolean,
isFunction: tOptional(tBoolean),
arg: tType('SerializedArgument'),
});
scheme.ElementHandleEvalOnSelectorAllParams = tObject({
selector: tString,
expression: tString,
isFunction: tBoolean,
isFunction: tOptional(tBoolean),
arg: tType('SerializedArgument'),
});
scheme.ElementHandleBoundingBoxParams = tOptional(tObject({}));
Expand Down Expand Up @@ -923,12 +923,12 @@ export function createScheme(tChannel: (name: string) => Validator): Scheme {
});
scheme.ElectronApplicationEvaluateExpressionParams = tObject({
expression: tString,
isFunction: tBoolean,
isFunction: tOptional(tBoolean),
arg: tType('SerializedArgument'),
});
scheme.ElectronApplicationEvaluateExpressionHandleParams = tObject({
expression: tString,
isFunction: tBoolean,
isFunction: tOptional(tBoolean),
arg: tType('SerializedArgument'),
});
scheme.ElectronApplicationCloseParams = tOptional(tObject({}));
Expand Down