Web Inspector: add protocol test for existing error handling performed by the backend
authorbburg@apple.com <bburg@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 24 Aug 2015 23:58:31 +0000 (23:58 +0000)
committerbburg@apple.com <bburg@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 24 Aug 2015 23:58:31 +0000 (23:58 +0000)
commit0548aadd1bc10fa644ff4a2eec8f913f055fc3e6
treec250986356e3d496fe4fdd7b3b2c6cbae0d71d57
parent397c4aac39520df9bf941dbfdf2f79890b0ea0bd
Web Inspector: add protocol test for existing error handling performed by the backend
https://bugs.webkit.org/show_bug.cgi?id=147097

Reviewed by Joseph Pecoraro.

Source/JavaScriptCore:

A new test revealed that the protocol "method" parameter was being parsed in a naive way.
Rewrite it to use String::split and improve error checking to avoid failing later.

* inspector/InspectorBackendDispatcher.cpp:
(Inspector::BackendDispatcher::dispatch):

Source/WebInspectorUI:

Add a way to send raw messages to the backend while still awaiting on responses.
This is necessary to test protocol error handling in the inspector backend.

* UserInterface/Test/InspectorProtocol.js:
(InspectorProtocol.sendCommand):
(InspectorProtocol.awaitCommand): Use awaitMessage internally.
(InspectorProtocol.awaitMessage): Added. Use a dummy requestId if none is supplied.
(InspectorProtocol._sendMessage): Added.
(InspectorProtocol.dispatchMessageFromBackend):
Reject with the error object instead of the error message, so error code/data can be checked.
(InspectorProtocol.sendMessage): Deleted, it is now a private method.

LayoutTests:

Add a bunch of test cases to cover existing error handling by the backend dispatcher.

* inspector/protocol/backend-dispatcher-argument-errors-expected.txt: Added.
* inspector/protocol/backend-dispatcher-argument-errors.html: Added.
* inspector/protocol/backend-dispatcher-malformed-message-errors-expected.txt: Added.
* inspector/protocol/backend-dispatcher-malformed-message-errors.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@188897 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/inspector/protocol/backend-dispatcher-argument-errors-expected.txt [new file with mode: 0644]
LayoutTests/inspector/protocol/backend-dispatcher-argument-errors.html [new file with mode: 0644]
LayoutTests/inspector/protocol/backend-dispatcher-malformed-message-errors-expected.txt [new file with mode: 0644]
LayoutTests/inspector/protocol/backend-dispatcher-malformed-message-errors.html [new file with mode: 0644]
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/inspector/InspectorBackendDispatcher.cpp
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Test/InspectorProtocol.js