|
|
|
|
|
by chrismorgan
953 days ago
|
|
I think it’ll be because for architectural reasons it can’t return a value synchronously, combined with historical ergonomic reasons. I don’t know when it was introduced, it’s possible that originally it could be synchronous and only subsequent V8 changes prevented that. Probably it landed before you could use `await` in the console, and they decided that made the ergonomics of Promising it too bad for the typical use case (though now you could write `await queryObjects(Function)` if it worked that way). All I know is that the documentation at https://developer.chrome.com/docs/devtools/console/utilities... says it returns an array of objects, which is patently false. I can’t see any reason for preventing assigning the output programmatically. |
|
The reason is absolutely security concerns. You don't want to leak a function that can expose a list of all objects on the JS heap.