Open
Bug 1252818
Opened 8 years ago
Updated 2 years ago
Expose fetch to the worker debugger
Categories
(DevTools :: Debugger, defect, P3)
DevTools
Debugger
Tracking
(Not tracked)
NEW
People
(Reporter: ejpbruel, Unassigned)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
11.51 KB,
patch
|
Details | Diff | Splinter Review |
The worker debugger needs a way to fetch URLs, but at the moment doesn't have an API available for this. To work around this, we use a rpc mechanism to request the main thread to fetch the URL on our behalf. As it turns out, the fetch API is available in workers, and provides exactly the same functionality, so we should use that instead of duplicating it on the JS side. The only thing that was preventing us from using it in the worker debugger was that DOM promises did not work together well with nested event loops, but this looks like it will be fixed soon: https://bugzilla.mozilla.org/show_bug.cgi?id=1229769
Reporter | ||
Comment 1•8 years ago
|
||
Here's a work in progress patch that exposes fetch to the worker debugger. I just have one problem: I can't figure out how to turn WorkerDebuggerGlobalScope.fetch_text.txt into a valid URL. Apparently using a relative URL doesn't work, and I obviously can't use a chrome URL either. I can never remember what's the correct way to do this in a mochitest. Kyle, any help?
Attachment #8725634 -
Flags: feedback?(khuey)
(In reply to Eddy Bruel [:ejpbruel] from comment #1) > Created attachment 8725634 [details] [diff] [review] > WIP > > Here's a work in progress patch that exposes fetch to the worker debugger. I > just have one problem: I can't figure out how to turn > WorkerDebuggerGlobalScope.fetch_text.txt into a valid URL. Apparently using > a relative URL doesn't work, and I obviously can't use a chrome URL either. > > I can never remember what's the correct way to do this in a mochitest. Kyle, > any help? Can you just fetch the current script with "#"?
Comment on attachment 8725634 [details] [diff] [review] WIP Review of attachment 8725634 [details] [diff] [review]: ----------------------------------------------------------------- Does this actually work? I would expect Fetch events to go in the regular runnable queue, not the debugger queue, and thus not work ...
Attachment #8725634 -
Flags: feedback?(khuey)
Flags: needinfo?(ejpbruel)
Reporter | ||
Comment 4•8 years ago
|
||
(In reply to Kyle Huey [:khuey] (khuey@mozilla.com) from comment #3) > Comment on attachment 8725634 [details] [diff] [review] > WIP > > Review of attachment 8725634 [details] [diff] [review]: > ----------------------------------------------------------------- > > Does this actually work? I would expect Fetch events to go in the regular > runnable queue, not the debugger queue, and thus not work ... I could be wrong, but as far as I can tell, the actual fetch happens on the main thread, and we use a promise proxy in the worker to make sure that the promise returned by the call to fetch in the worker is resolved when the fetch completes on the main thread. Assuming that promise is the only runnable involved, this *should* work, provided bug 1229769 lands. It's very possible that I'm missing something though, since I'm not intimately familiar with the internals of fetch. This definitely needs tests.
Flags: needinfo?(ejpbruel)
Reporter | ||
Updated•7 years ago
|
Assignee: ejpbruel → nobody
Updated•6 years ago
|
Product: Firefox → DevTools
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•