Preview support for URLSearchParams objects.
Categories
(DevTools :: Object Inspector, enhancement)
Tracking
(firefox104 fixed)
Tracking | Status | |
---|---|---|
firefox104 | --- | fixed |
People
(Reporter: evilpies, Assigned: nchevobbe)
References
Details
Attachments
(2 files)
I started working on something that will show URLSearchParams
similar to Maps. I did get some simple ones without duplicate keys working. For duplicate keys I am trying to return an array of values for every duplicate key, but that just shows as "Restricted".
The inline preview like map Map { a -> 1 }
also doesn't work. Just <entries>.
If someone would like to just take this over that would be fine too.
Maybe it would be better to show new URLSearchParams("?a=1&a=2");
as
<entries>
0: a -> 1
1: a -> 2
after all.
Assignee | ||
Comment 3•3 years ago
|
||
Thanks Tom, I definitely hit that in the past and I agree it would be nice to have a way to inspect this
I'll have a quick look at your WIP
(In reply to Tom Schuster [:evilpie] from comment #2)
Maybe it would be better to show
new URLSearchParams("?a=1&a=2");
as<entries> 0: a -> 1 1: a -> 2
after all.
yeah, I think it would be better to reflect what URLSearchParams#entries
returns
Assignee | ||
Comment 4•3 years ago
|
||
So I have something working locally, I need to do further testing and add tests.
Here I'm showing entries with same name as different items, prefixed with the entry index. I think it's nice to match the behavior of URLSearchParams.prototype.entries
If you're curious evilpie:
- as you saw,
URLSearchParams
wasn't available by default, I made it available adding it in https://searchfox.org/mozilla-central/rev/287583a4a605eee8cd2d41381ffaea7a93d7b987/devtools/shared/loader/builtin-modules.js#53-100 URLSearchParams
entries will always be strings, so we don't have the same complexity as for Maps where both keys and values can be complex objects; this makes the implementation much easier (getting the entries fits in one line:const entries = [...waiveXrays(URLSearchParams.prototype.entries.call(raw))];
)
Oh that looks great. I think in my testing properties with the same name under <entries> were being de-duplicated, but it seems like you are already solved that issue or I made some other mistake.
Updated•3 years ago
|
Updated•3 years ago
|
Comment 7•3 years ago
|
||
bugherder |
Description
•