Web Inspector: add RemoteObject.fetchProperties and some basic tests for RemoteObject API
authorbburg@apple.com <bburg@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 4 Jan 2018 21:29:13 +0000 (21:29 +0000)
committerbburg@apple.com <bburg@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 4 Jan 2018 21:29:13 +0000 (21:29 +0000)
commit57004c652af0c20ffde14c6056bfbe077234b853
tree858191e2fec01641e62cd05a714caaf552161275
parent71c444bd446bc5e7e8fee9782dcef7b9fa07784f
Web Inspector: add RemoteObject.fetchProperties and some basic tests for RemoteObject API
https://bugs.webkit.org/show_bug.cgi?id=180945

Reviewed by Joseph Pecoraro.

Source/WebInspectorUI:

Add a new method, fetchProperties, which async fetches an arbitrary list of properties
from a RemoteObject. This is intended for writing tests and other quick evaluations,
so it has some behaviors that are suitable in these situations:
- If the evaluation throws an exception, the result will reject with that exception.
- If there is a protocol error for some reason, the result will reject with an exception.
- Non-string and non-number keys cause an exception, as this is probably not intended.
- Does not accept a callback, returns a promise only. New code should use async.

For full fidelity introspection of property descriptors, clients should use the existing
getOwnPropertyDescriptor[s] class of methods.

* UserInterface/Protocol/RemoteObject.js:
(WI.RemoteObject.prototype.async.fetchProperties): Added.
- Validate specified keys and remove duplicates.
- Request properties one-by-one to avoid fetching all descriptors and dealing with previews.
- Unwrap returned primitive values to avoid unnecessary munging in tests.

(WI.RemoteObject.prototype.getProperty):
- Rework this to return a promise if no callback was supplied.
- Introduce stricter property type checking to avoid unintended mistakes.

(WI.RemoteObject.prototype.callFunction):
- Rework this to return a promise if no callback was supplied.
- Turn thrown exceptions and protocol errors into rejected promises.

LayoutTests:

Add new test coverage for existing RemoteObject.prototype.getProperty.
Add new test coverage for new method RemoteObject.prototype.fetchProperties.
I didn't add test coverage for callFunction, as I had to stop somewhere.

* inspector/model/remote-object-api-expected.txt: Added.
* inspector/model/remote-object-api.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@226417 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/inspector/model/remote-object-api-expected.txt [new file with mode: 0644]
LayoutTests/inspector/model/remote-object-api.html [new file with mode: 0644]
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Protocol/RemoteObject.js