Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Web Inspector: backend command promises are not rejected when a proto…
…col error occurs https://bugs.webkit.org/show_bug.cgi?id=141403 Reviewed by Joseph Pecoraro. Source/WebInspectorUI: Fix a few corner cases for how InspectorBackend delivers command failures. * UserInterface/Protocol/InspectorBackend.js: (InspectorBackend.Command.prototype.deliverFailure): Added. (InspectorBackend.Command.prototype._invokeWithArguments): If argument-checking fails, return a rejected promise or invoke the supplied callback on a zero-delay setTimeout to ensure that the reply is asynchronous. LayoutTests: Expand coverage of an existing protocol layer test to cover success and failure modes. * inspector/protocol/inspector-backend-invocation-return-value-expected.txt: * inspector/protocol/inspector-backend-invocation-return-value.html: Canonical link: https://commits.webkit.org/167244@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@189761 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
5 changed files
with
212 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 38 additions & 2 deletions
40
LayoutTests/inspector/protocol/inspector-backend-invocation-return-value-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,41 @@ | ||
Testing the inspector backend's return values when invoking a protocol command in various ways. | ||
|
||
PASS: RuntimeAgent.evaluate should not return a promise when invoked with a function as the last parameter. | ||
PASS: RuntimeAgent.evaluate should return a Promise when invoked without a callback. | ||
|
||
== Running test suite: Protocol.BackendInvocationReturnValues | ||
-- Running test case: ResolveCommandPromiseOnSuccess | ||
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 | ||
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 | ||
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: ReturnNothingIfCallback | ||
PASS: A backend command should not have a return value when invoked with a callback. | ||
|
||
-- Running test case: InvokeCallbackWithResultOnSuccess | ||
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 | ||
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 | ||
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. | ||
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. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters