Log Message
Web Inspector: Protocol: add type checking when commands are called via invoke https://bugs.webkit.org/show_bug.cgi?id=195310 <rdar://problem/48588679>
Reviewed by Joseph Pecoraro. Source/WebInspectorUI: * UserInterface/Protocol/InspectorBackend.js: (InspectorBackend.Command.prototype.invoke.deliverFailure): Added. (InspectorBackend.Command.prototype.invoke): (InspectorBackend.Command.prototype._invokeWithArguments): LayoutTests: * inspector/protocol/inspector-backend-invocation-return-value.html: * inspector/protocol/inspector-backend-invocation-return-value-expected.txt:
Modified Paths
- trunk/LayoutTests/ChangeLog
- trunk/LayoutTests/inspector/protocol/inspector-backend-invocation-return-value-expected.txt
- trunk/LayoutTests/inspector/protocol/inspector-backend-invocation-return-value.html
- trunk/Source/WebInspectorUI/ChangeLog
- trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorBackend.js
Diff
Modified: trunk/LayoutTests/ChangeLog (242605 => 242606)
--- trunk/LayoutTests/ChangeLog 2019-03-07 19:43:43 UTC (rev 242605)
+++ trunk/LayoutTests/ChangeLog 2019-03-07 20:40:14 UTC (rev 242606)
@@ -1,3 +1,14 @@
+2019-03-07 Devin Rousso <[email protected]>
+
+ Web Inspector: Protocol: add type checking when commands are called via invoke
+ https://bugs.webkit.org/show_bug.cgi?id=195310
+ <rdar://problem/48588679>
+
+ Reviewed by Joseph Pecoraro.
+
+ * inspector/protocol/inspector-backend-invocation-return-value.html:
+ * inspector/protocol/inspector-backend-invocation-return-value-expected.txt:
+
2019-03-07 John Wilander <[email protected]>
Resource Load Statistics: Log first-party navigations with link decoration
Modified: trunk/LayoutTests/inspector/protocol/inspector-backend-invocation-return-value-expected.txt (242605 => 242606)
--- trunk/LayoutTests/inspector/protocol/inspector-backend-invocation-return-value-expected.txt 2019-03-07 19:43:43 UTC (rev 242605)
+++ trunk/LayoutTests/inspector/protocol/inspector-backend-invocation-return-value-expected.txt 2019-03-07 20:40:14 UTC (rev 242606)
@@ -2,35 +2,68 @@
== Running test suite: Protocol.BackendInvocationReturnValues
--- Running test case: ResolveCommandPromiseOnSuccess
+-- Running test case: ResolveCommandPromiseOnSuccess.call
PASS: A backend command should return a Promise when invoked without a callback.
PASS: A successful command invocation's promise should be resolved.
--- Running test case: RejectCommandPromiseWithInvalidArguments
+-- Running test case: ResolveCommandPromiseOnSuccess.invoke
+PASS: A backend command should return a Promise when invoked without a callback.
+PASS: A successful command invocation's promise should be resolved.
+
+-- Running test case: RejectCommandPromiseWithInvalidArguments.call
ERROR: Protocol Error: Invalid type of argument '_expression_' for command 'Runtime.evaluate' call. It must be 'string' but it is 'number'.
PASS: A backend command should return a Promise when invoked without a callback.
PASS: An invalid command invocation's promise should be rejected.
--- Running test case: RejectCommandPromiseWithMissingArguments
+-- Running test case: RejectCommandPromiseWithInvalidArguments.invoke
+ERROR: Protocol Error: Invalid type of argument '_expression_' for command 'Runtime.evaluate' call. It must be 'string' but it is 'number'.
+PASS: A backend command should return a Promise when invoked without a callback.
+PASS: An invalid command invocation's promise should be rejected.
+
+-- Running test case: RejectCommandPromiseWithMissingArguments.call
ERROR: Protocol Error: Invalid number of arguments for command 'Runtime.evaluate'.
PASS: A backend command should return a Promise when invoked without a callback.
PASS: An invalid command invocation's promise should be rejected.
--- Running test case: RejectCommandPromiseWithExtraArgumentThatIsNotCallback
+-- Running test case: RejectCommandPromiseWithMissingArguments.invoke.MissingObject
+ERROR: Protocol Error: invoke expects an object for command arguments but its type is 'undefined'.
+PASS: A backend command should return a Promise when invoked without a callback.
+PASS: An invalid command invocation's promise should be rejected.
+
+-- Running test case: RejectCommandPromiseWithMissingArguments.invoke.NonObject
+ERROR: Protocol Error: invoke expects an object for command arguments but its type is 'string'.
+PASS: A backend command should return a Promise when invoked without a callback.
+PASS: An invalid command invocation's promise should be rejected.
+
+-- Running test case: RejectCommandPromiseWithMissingArguments.invoke.EmptyObject
+ERROR: Protocol Error: Missing argument '_expression_' for command 'Runtime.evaluate'.
+PASS: A backend command should return a Promise when invoked without a callback.
+PASS: An invalid command invocation's promise should be rejected.
+
+-- Running test case: RejectCommandPromiseWithExtraArgumentThatIsNotCallback.call
ERROR: Protocol Error: Protocol Error: Optional callback argument for command 'Runtime.enable' call must be a function but its type is 'number'.
PASS: A backend command should return a Promise when invoked without a callback.
PASS: An invalid command invocation's promise should be rejected.
--- Running test case: ReturnNothingIfCallback
+-- Running test case: ReturnNothingIfCallback.call
PASS: A backend command should not have a return value when invoked with a callback.
--- Running test case: InvokeCallbackWithResultOnSuccess
+-- Running test case: ReturnNothingIfCallback.invoke
+PASS: A backend command should not have a return value when invoked with a callback.
+
+-- Running test case: InvokeCallbackWithResultOnSuccess.call
PASS: A backend command should not return anything when invoked with a callback.
PASS: A backend command should always invoke its callback asynchronously.
PASS: A successful command should invoke the callback with a 'null' first parameter.
PASS: A successful command should invoke the callback with one or more result parameters.
--- Running test case: InvokeCallbackWithErrorForInvalidArguments
+-- Running test case: InvokeCallbackWithResultOnSuccess.invoke
+PASS: A backend command should not return anything when invoked with a callback.
+PASS: A backend command should always invoke its callback asynchronously.
+PASS: A successful command should invoke the callback with a 'null' first parameter.
+PASS: A successful command should invoke the callback with one or more result parameters.
+
+-- Running test case: InvokeCallbackWithErrorForInvalidArguments.call
ERROR: Protocol Error: Invalid type of argument '_expression_' for command 'Runtime.evaluate' call. It must be 'string' but it is 'number'.
PASS: A backend command should not return anything when invoked with a callback.
PASS: A backend command should always invoke its callback asynchronously.
@@ -37,7 +70,14 @@
PASS: A failed command should invoke the callback with a string error message as its first parameter.
PASS: A failed command should invoke the callback with only an error parameter.
--- Running test case: InvokeCallbackWithErrorForMissingArguments
+-- Running test case: InvokeCallbackWithErrorForInvalidArguments.invoke
+ERROR: Protocol Error: Invalid type of argument '_expression_' for command 'Runtime.evaluate' call. It must be 'string' but it is 'number'.
+PASS: A backend command should not return anything when invoked with a callback.
+PASS: A backend command should always invoke its callback asynchronously.
+PASS: A failed command should invoke the callback with a string error message as its first parameter.
+PASS: A failed command should invoke the callback with only an error parameter.
+
+-- Running test case: InvokeCallbackWithErrorForMissingArguments.call
ERROR: Protocol Error: Invalid number of arguments for command 'Runtime.evaluate'.
PASS: A backend command should not return anything when invoked with a callback.
PASS: A backend command should always invoke its callback asynchronously.
@@ -44,3 +84,24 @@
PASS: A failed command should invoke the callback with a string error message as its first parameter.
PASS: A failed command should invoke the callback with only an error parameter.
+-- Running test case: InvokeCallbackWithErrorForMissingArguments.invoke.MissingObject
+ERROR: Protocol Error: invoke expects an object for command arguments but its type is 'undefined'.
+PASS: A backend command should not return anything when invoked with a callback.
+PASS: A backend command should always invoke its callback asynchronously.
+PASS: A failed command should invoke the callback with a string error message as its first parameter.
+PASS: A failed command should invoke the callback with only an error parameter.
+
+-- Running test case: InvokeCallbackWithErrorForMissingArguments.invoke.NonObject
+ERROR: Protocol Error: invoke expects an object for command arguments but its type is 'string'.
+PASS: A backend command should not return anything when invoked with a callback.
+PASS: A backend command should always invoke its callback asynchronously.
+PASS: A failed command should invoke the callback with a string error message as its first parameter.
+PASS: A failed command should invoke the callback with only an error parameter.
+
+-- Running test case: InvokeCallbackWithErrorForMissingArguments.invoke.EmptyObject
+ERROR: Protocol Error: Missing argument '_expression_' for command 'Runtime.evaluate'.
+PASS: A backend command should not return anything when invoked with a callback.
+PASS: A backend command should always invoke its callback asynchronously.
+PASS: A failed command should invoke the callback with a string error message as its first parameter.
+PASS: A failed command should invoke the callback with only an error parameter.
+
Modified: trunk/LayoutTests/inspector/protocol/inspector-backend-invocation-return-value.html (242605 => 242606)
--- trunk/LayoutTests/inspector/protocol/inspector-backend-invocation-return-value.html 2019-03-07 19:43:43 UTC (rev 242605)
+++ trunk/LayoutTests/inspector/protocol/inspector-backend-invocation-return-value.html 2019-03-07 20:40:14 UTC (rev 242606)
@@ -1,4 +1,4 @@
-<!doctype html>
+<!DOCTYPE html>
<html>
<head>
<script src=""
@@ -11,7 +11,7 @@
// Test behavior for promise-based callbacks.
suite.addTestCase({
- name: "ResolveCommandPromiseOnSuccess",
+ name: "ResolveCommandPromiseOnSuccess.call",
description: "Backend command's returned promise should be resolved if the command is successful.",
test(resolve, reject) {
let returnValue = RuntimeAgent.evaluate("42");
@@ -32,7 +32,28 @@
});
suite.addTestCase({
- name: "RejectCommandPromiseWithInvalidArguments",
+ name: "ResolveCommandPromiseOnSuccess.invoke",
+ description: "Backend command's returned promise should be resolved if the command is successful.",
+ test(resolve, reject) {
+ let returnValue = RuntimeAgent.evaluate.invoke({_expression_: "42"});
+
+ InspectorTest.expectThat(returnValue instanceof Promise, "A backend command should return a Promise when invoked without a callback.");
+ // If a promise wasn't returned, we can't test the rest so just die.
+ if (!(returnValue instanceof Promise))
+ reject();
+
+ returnValue.then(function resolved(result) {
+ InspectorTest.log("PASS: A successful command invocation's promise should be resolved.");
+ resolve();
+ }, function rejected(result) {
+ InspectorTest.log("FAIL: A successful command invocation's promise should be resolved.");
+ reject();
+ });
+ }
+ });
+
+ suite.addTestCase({
+ name: "RejectCommandPromiseWithInvalidArguments.call",
description: "Backend command's returned promise should be rejected if the command has invalid arguments.",
test(resolve, reject) {
let result = RuntimeAgent.evaluate(42);
@@ -53,7 +74,28 @@
});
suite.addTestCase({
- name: "RejectCommandPromiseWithMissingArguments",
+ name: "RejectCommandPromiseWithInvalidArguments.invoke",
+ description: "Backend command's returned promise should be rejected if the command has invalid arguments.",
+ test(resolve, reject) {
+ let result = RuntimeAgent.evaluate.invoke({_expression_: 42});
+
+ InspectorTest.expectThat(result instanceof Promise, "A backend command should return a Promise when invoked without a callback.");
+ // If a promise wasn't returned, we can't test the rest so just die.
+ if (!(result instanceof Promise))
+ reject();
+
+ result.then(function resolved(result) {
+ InspectorTest.log("FAIL: An invalid command invocation's promise should be rejected.");
+ reject();
+ }, function rejected(result) {
+ InspectorTest.log("PASS: An invalid command invocation's promise should be rejected.");
+ resolve();
+ });
+ }
+ });
+
+ suite.addTestCase({
+ name: "RejectCommandPromiseWithMissingArguments.call",
description: "Backend command's returned promise should be rejected if the command lacks required arguments.",
test(resolve, reject) {
let result = RuntimeAgent.evaluate();
@@ -74,7 +116,70 @@
});
suite.addTestCase({
- name: "RejectCommandPromiseWithExtraArgumentThatIsNotCallback",
+ name: "RejectCommandPromiseWithMissingArguments.invoke.MissingObject",
+ description: "Backend command's returned promise should be rejected if the command lacks required arguments.",
+ test(resolve, reject) {
+ let result = RuntimeAgent.evaluate.invoke();
+
+ InspectorTest.expectThat(result instanceof Promise, "A backend command should return a Promise when invoked without a callback.");
+ // If a promise wasn't returned, we can't test the rest so just die.
+ if (!(result instanceof Promise))
+ reject();
+
+ result.then(function resolved(result) {
+ InspectorTest.log("FAIL: An invalid command invocation's promise should be rejected.");
+ reject();
+ }, function rejected(result) {
+ InspectorTest.log("PASS: An invalid command invocation's promise should be rejected.");
+ resolve();
+ });
+ }
+ });
+
+ suite.addTestCase({
+ name: "RejectCommandPromiseWithMissingArguments.invoke.NonObject",
+ description: "Backend command's returned promise should be rejected if the command lacks required arguments.",
+ test(resolve, reject) {
+ let result = RuntimeAgent.evaluate.invoke("test");
+
+ InspectorTest.expectThat(result instanceof Promise, "A backend command should return a Promise when invoked without a callback.");
+ // If a promise wasn't returned, we can't test the rest so just die.
+ if (!(result instanceof Promise))
+ reject();
+
+ result.then(function resolved(result) {
+ InspectorTest.log("FAIL: An invalid command invocation's promise should be rejected.");
+ reject();
+ }, function rejected(result) {
+ InspectorTest.log("PASS: An invalid command invocation's promise should be rejected.");
+ resolve();
+ });
+ }
+ });
+
+ suite.addTestCase({
+ name: "RejectCommandPromiseWithMissingArguments.invoke.EmptyObject",
+ description: "Backend command's returned promise should be rejected if the command lacks required arguments.",
+ test(resolve, reject) {
+ let result = RuntimeAgent.evaluate.invoke({});
+
+ InspectorTest.expectThat(result instanceof Promise, "A backend command should return a Promise when invoked without a callback.");
+ // If a promise wasn't returned, we can't test the rest so just die.
+ if (!(result instanceof Promise))
+ reject();
+
+ result.then(function resolved(result) {
+ InspectorTest.log("FAIL: An invalid command invocation's promise should be rejected.");
+ reject();
+ }, function rejected(result) {
+ InspectorTest.log("PASS: An invalid command invocation's promise should be rejected.");
+ resolve();
+ });
+ }
+ });
+
+ suite.addTestCase({
+ name: "RejectCommandPromiseWithExtraArgumentThatIsNotCallback.call",
description: "Backend command's returned promise should be rejected if the command has an extra argument that is not a callback.",
test(resolve, reject) {
let result = RuntimeAgent.enable(1);
@@ -97,7 +202,7 @@
// Test behavior for function-based callbacks.
suite.addTestCase({
- name: "ReturnNothingIfCallback",
+ name: "ReturnNothingIfCallback.call",
description: "Backend commands should not return anything if a callback is supplied.",
test(resolve, reject) {
let returnValue = RuntimeAgent.evaluate("41", dummyCallback);
@@ -107,7 +212,17 @@
});
suite.addTestCase({
- name: "InvokeCallbackWithResultOnSuccess",
+ name: "ReturnNothingIfCallback.invoke",
+ description: "Backend commands should not return anything if a callback is supplied.",
+ test(resolve, reject) {
+ let returnValue = RuntimeAgent.evaluate.invoke({_expression_: "41"}, dummyCallback);
+ InspectorTest.expectThat(returnValue === undefined, "A backend command should not have a return value when invoked with a callback.");
+ resolve();
+ }
+ });
+
+ suite.addTestCase({
+ name: "InvokeCallbackWithResultOnSuccess.call",
description: "Backend command callback should be invoked with a result if the command is successful.",
test(resolve, reject) {
let initialState = 1;
@@ -124,7 +239,24 @@
});
suite.addTestCase({
- name: "InvokeCallbackWithErrorForInvalidArguments",
+ name: "InvokeCallbackWithResultOnSuccess.invoke",
+ description: "Backend command callback should be invoked with a result if the command is successful.",
+ test(resolve, reject) {
+ let initialState = 1;
+ let returnValue = RuntimeAgent.evaluate.invoke({_expression_: "42"}, function(error, result) {
+ InspectorTest.expectThat(error === null, "A successful command should invoke the callback with a 'null' first parameter.");
+ InspectorTest.expectThat(arguments.length > 1, "A successful command should invoke the callback with one or more result parameters.");
+ initialState++;
+ resolve();
+ });
+
+ InspectorTest.expectThat(returnValue === undefined, "A backend command should not return anything when invoked with a callback.");
+ InspectorTest.expectThat(initialState === 1, "A backend command should always invoke its callback asynchronously.");
+ }
+ });
+
+ suite.addTestCase({
+ name: "InvokeCallbackWithErrorForInvalidArguments.call",
description: "Backend command callback should be invoked with an error if the command has invalid arguments.",
test(resolve, reject) {
let initialState = 1;
@@ -141,7 +273,24 @@
});
suite.addTestCase({
- name: "InvokeCallbackWithErrorForMissingArguments",
+ name: "InvokeCallbackWithErrorForInvalidArguments.invoke",
+ description: "Backend command callback should be invoked with an error if the command has invalid arguments.",
+ test(resolve, reject) {
+ let initialState = 1;
+ let returnValue = RuntimeAgent.evaluate.invoke({_expression_: 42}, function callback(error) {
+ InspectorTest.expectThat(typeof error === "string", "A failed command should invoke the callback with a string error message as its first parameter.");
+ InspectorTest.expectThat(arguments.length === 1, "A failed command should invoke the callback with only an error parameter.");
+ initialState++;
+ resolve();
+ });
+
+ InspectorTest.expectThat(returnValue === undefined, "A backend command should not return anything when invoked with a callback.");
+ InspectorTest.expectThat(initialState === 1, "A backend command should always invoke its callback asynchronously.");
+ }
+ });
+
+ suite.addTestCase({
+ name: "InvokeCallbackWithErrorForMissingArguments.call",
description: "Backend command callback should be invoked with an error if the command lacks required arguments.",
test(resolve, reject) {
let initialState = 1;
@@ -158,6 +307,60 @@
}
});
+ suite.addTestCase({
+ name: "InvokeCallbackWithErrorForMissingArguments.invoke.MissingObject",
+ description: "Backend command callback should be invoked with an error if the command lacks required arguments.",
+ test(resolve, reject) {
+ let initialState = 1;
+ let returnValue = RuntimeAgent.evaluate.invoke(undefined, function callback(error) {
+ InspectorTest.expectThat(typeof error === "string", "A failed command should invoke the callback with a string error message as its first parameter.");
+ InspectorTest.expectThat(arguments.length === 1, "A failed command should invoke the callback with only an error parameter.");
+
+ initialState++;
+ resolve();
+ });
+
+ InspectorTest.expectThat(returnValue === undefined, "A backend command should not return anything when invoked with a callback.");
+ InspectorTest.expectThat(initialState === 1, "A backend command should always invoke its callback asynchronously.");
+ }
+ });
+
+ suite.addTestCase({
+ name: "InvokeCallbackWithErrorForMissingArguments.invoke.NonObject",
+ description: "Backend command callback should be invoked with an error if the command lacks required arguments.",
+ test(resolve, reject) {
+ let initialState = 1;
+ let returnValue = RuntimeAgent.evaluate.invoke("test", function callback(error) {
+ InspectorTest.expectThat(typeof error === "string", "A failed command should invoke the callback with a string error message as its first parameter.");
+ InspectorTest.expectThat(arguments.length === 1, "A failed command should invoke the callback with only an error parameter.");
+
+ initialState++;
+ resolve();
+ });
+
+ InspectorTest.expectThat(returnValue === undefined, "A backend command should not return anything when invoked with a callback.");
+ InspectorTest.expectThat(initialState === 1, "A backend command should always invoke its callback asynchronously.");
+ }
+ });
+
+ suite.addTestCase({
+ name: "InvokeCallbackWithErrorForMissingArguments.invoke.EmptyObject",
+ description: "Backend command callback should be invoked with an error if the command lacks required arguments.",
+ test(resolve, reject) {
+ let initialState = 1;
+ let returnValue = RuntimeAgent.evaluate.invoke({}, function callback(error) {
+ InspectorTest.expectThat(typeof error === "string", "A failed command should invoke the callback with a string error message as its first parameter.");
+ InspectorTest.expectThat(arguments.length === 1, "A failed command should invoke the callback with only an error parameter.");
+
+ initialState++;
+ resolve();
+ });
+
+ InspectorTest.expectThat(returnValue === undefined, "A backend command should not return anything when invoked with a callback.");
+ InspectorTest.expectThat(initialState === 1, "A backend command should always invoke its callback asynchronously.");
+ }
+ });
+
suite.runTestCasesAndFinish();
}
</script>
Modified: trunk/Source/WebInspectorUI/ChangeLog (242605 => 242606)
--- trunk/Source/WebInspectorUI/ChangeLog 2019-03-07 19:43:43 UTC (rev 242605)
+++ trunk/Source/WebInspectorUI/ChangeLog 2019-03-07 20:40:14 UTC (rev 242606)
@@ -1,5 +1,18 @@
2019-03-07 Devin Rousso <[email protected]>
+ Web Inspector: Protocol: add type checking when commands are called via invoke
+ https://bugs.webkit.org/show_bug.cgi?id=195310
+ <rdar://problem/48588679>
+
+ Reviewed by Joseph Pecoraro.
+
+ * UserInterface/Protocol/InspectorBackend.js:
+ (InspectorBackend.Command.prototype.invoke.deliverFailure): Added.
+ (InspectorBackend.Command.prototype.invoke):
+ (InspectorBackend.Command.prototype._invokeWithArguments):
+
+2019-03-07 Devin Rousso <[email protected]>
+
Web Inspector: REGRESSION(r242118): WI.ScopeBar missing background
https://bugs.webkit.org/show_bug.cgi?id=195299
Modified: trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorBackend.js (242605 => 242606)
--- trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorBackend.js 2019-03-07 19:43:43 UTC (rev 242605)
+++ trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorBackend.js 2019-03-07 20:40:14 UTC (rev 242606)
@@ -406,12 +406,39 @@
{
"use strict";
- agent = agent || this._instance._agent;
+ let instance = this._instance;
+ function deliverFailure(message) {
+ console.error(`Protocol Error: ${message}`);
+ if (callback)
+ setTimeout(callback.bind(null, message), 0);
+ else
+ return Promise.reject(new Error(message));
+ }
+
+ if (typeof commandArguments !== "object")
+ return deliverFailure(`invoke expects an object for command arguments but its type is '${typeof commandArguments}'.`);
+
+ let parameters = {};
+ for (let {name, type, optional} of instance.callSignature) {
+ if (!(name in commandArguments) && !optional)
+ return deliverFailure(`Missing argument '${name}' for command '${instance.qualifiedName}'.`);
+
+ let value = commandArguments[name];
+ if (optional && value === undefined)
+ continue;
+
+ if (typeof value !== type)
+ return deliverFailure(`Invalid type of argument '${name}' for command '${instance.qualifiedName}' call. It must be '${type}' but it is '${typeof value}'.`);
+
+ parameters[name] = value;
+ }
+
+ agent = agent || instance._agent;
if (typeof callback === "function")
- agent._connection._sendCommandToBackendWithCallback(this._instance, commandArguments, callback);
+ agent._connection._sendCommandToBackendWithCallback(instance, parameters, callback);
else
- return agent._connection._sendCommandToBackendExpectingPromise(this._instance, commandArguments);
+ return agent._connection._sendCommandToBackendExpectingPromise(instance, parameters);
},
supports(parameterName)
@@ -439,22 +466,18 @@
}
let parameters = {};
- for (let parameter of instance.callSignature) {
- let parameterName = parameter["name"];
- let typeName = parameter["type"];
- let optionalFlag = parameter["optional"];
-
- if (!commandArguments.length && !optionalFlag)
+ for (let {name, type, optional} of instance.callSignature) {
+ if (!commandArguments.length && !optional)
return deliverFailure(`Invalid number of arguments for command '${instance.qualifiedName}'.`);
let value = commandArguments.shift();
- if (optionalFlag && value === undefined)
+ if (optional && value === undefined)
continue;
- if (typeof value !== typeName)
- return deliverFailure(`Invalid type of argument '${parameterName}' for command '${instance.qualifiedName}' call. It must be '${typeName}' but it is '${typeof value}'.`);
+ if (typeof value !== type)
+ return deliverFailure(`Invalid type of argument '${name}' for command '${instance.qualifiedName}' call. It must be '${type}' but it is '${typeof value}'.`);
- parameters[parameterName] = value;
+ parameters[name] = value;
}
if (!callback && commandArguments.length === 1 && commandArguments[0] !== undefined)
_______________________________________________ webkit-changes mailing list [email protected] https://lists.webkit.org/mailman/listinfo/webkit-changes
