WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
174006
Web Inspector: Add Runtime.await to run an await expression (like Runtime.evaluate)
https://bugs.webkit.org/show_bug.cgi?id=174006
Summary
Web Inspector: Add Runtime.await to run an await expression (like Runtime.eva...
Joseph Pecoraro
Reported
2017-06-29 19:32:01 PDT
We have an `await` convenience in the console that will allow you to await an asynchronous result. Currently it works like: > await fetch("data.json") < undefined [Info] Response {type: "basic", url: "data.json", redirected: false, status: 200, ok: true, …} It would be nicer to: - Not output the `undefined`, instead include a "Awaiting..." message - Replace the message with the result - Save results with a $n value as expected So you would get: > await fetch("data.json") [Icon] Running... And later: > await fetch("data.json") < Response {type: "basic", url: "data.json", redirected: false, status: 200, ok: true, …} = $1 I propose we have a `Runtime.await` which is just an async version of `Runtime.evaluate`.
Attachments
[PATCH] Work in Progress (Needs Test and Async UI tweaks)
(37.62 KB, patch)
2017-06-29 19:41 PDT
,
Joseph Pecoraro
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Joseph Pecoraro
Comment 1
2017-06-29 19:41:26 PDT
Created
attachment 314210
[details]
[PATCH] Work in Progress (Needs Test and Async UI tweaks) This is the idea I have. It works in practice. I have to move onto other things at the moment though. This would need tests and the UI tweaks during an async evaluation. I did implement an awaitOnCallFrame but currently when paused we don't seem to run the promise microtasks. So effectively you don't get the result until you resume / continue. So I left that out of this given the pre-existing issues.
Joseph Pecoraro
Comment 2
2017-06-29 19:46:36 PDT
Comment on
attachment 314210
[details]
[PATCH] Work in Progress (Needs Test and Async UI tweaks) View in context:
https://bugs.webkit.org/attachment.cgi?id=314210&action=review
> Source/JavaScriptCore/inspector/JSInjectedScriptCallback.h:41 > +class JSInjectedScriptCallback : public JSC::InternalFunction { > +public: > + typedef InternalFunction Base; > + > + static JSInjectedScriptCallback* create(JSC::VM&, JSC::JSGlobalObject*, WTF::Function<void(JSC::ExecState*)>&&);
@Saam / Mark: Is this a bad idea? I'm basically making a Function that wraps a lambda. So we can: auto callback = JSInjectedScriptCallback(vm, globalObject, [](ExecState *exec) { JSValue a = exec->argument(0); JSValue b = exec->argument(1); JSValue c = exec->argument(2); ... }); We pass this off to Inspector JavaScript so that when it invokes `callback(a, b, c)` the lambda can deal with it. With this approach we need to be worried about object lifetimes (if `this` is used by the lamba) but maybe there is an easier way to do the same thing as this?
Radar WebKit Bug Importer
Comment 3
2017-07-04 04:31:23 PDT
<
rdar://problem/33122054
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug