Chrome Headless Runtime.evaluate not returning JSON objects.

407 views
Skip to first unread message

Brian Cardarella

unread,
Nov 2, 2017, 7:28:29 AM11/2/17
to Chromium-dev
In headless API when using Runtime.evalue({returnByValue: true, expression: "{a: 1}"}) I get back: {"result" => {"description" => "1", "type" => "number", "value" => 1}}

I would have expected to get back the JSON literal instead of the internal value. Is something wrong with my expectations or how this is being executed?

Brian Cardarella

unread,
Nov 2, 2017, 8:17:02 AM11/2/17
to Chromium-dev
The websocket command being sent is: {"params":{"returnByValue":true,"expression":"{a:1}"},"method":"Runtime.evaluate","id":8}

Eric Seckler

unread,
Nov 3, 2017, 5:45:37 AM11/3/17
to br...@dockyard.com, Chromium-dev, headless-dev, devtoo...@chromium.org
Sounds like a bug, I'd also have expected the object, rather than 1.

Does this only happen in headless mode? Do you see the same problem when you connect a DevTools frontend to the target and use the JS console?

Also, please file a bug if the issue persists.

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/a91f028c-a7f0-42f7-96a0-0fb13eaa47fd%40chromium.org.

Sami Kyostila

unread,
Nov 3, 2017, 1:52:54 PM11/3/17
to Eric Seckler, br...@dockyard.com, Chromium-dev, headless-dev, devtoo...@chromium.org
For the record this isn't a bug but a feature of JavaScript. Try adding parentheses around the expression.

- Sami

You received this message because you are subscribed to the Google Groups "headless-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to headless-dev...@chromium.org.
To post to this group, send email to headle...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/headless-dev/CAHZJZiFFn_nLdTs5qZybZKadRg0EvLxfvpi4w%2B%3DUk%2Bhw0T1oxg%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages