Use same logic between SourceTree and Tabs regarding query params and hash in source url being hidden
Categories
(DevTools :: Debugger, enhancement)
Tracking
(Not tracked)
People
(Reporter: ochameau, Assigned: ochameau)
References
(Blocks 1 open bug)
Details
Attachments
(1 obsolete file)
The SourceTree and Tabs components are using slightly different logic when it comes on how to hide the query parameters and/or hash string of source's URL.
Tabs is based on "plain URL", where we remove both query and hash:
https://searchfox.org/mozilla-central/rev/2398ab33adcea896838b3da678ff6480dbb98b9a/devtools/client/debugger/src/components/Editor/Tab.js#215
https://searchfox.org/mozilla-central/rev/2398ab33adcea896838b3da678ff6480dbb98b9a/devtools/client/debugger/src/selectors/sources.js#130-146
https://searchfox.org/mozilla-central/rev/2398ab33adcea896838b3da678ff6480dbb98b9a/devtools/client/debugger/src/utils/source.js#589-592
while SourceTree is based on "stripQuery", where we remove only query.
https://searchfox.org/mozilla-central/rev/2398ab33adcea896838b3da678ff6480dbb98b9a/devtools/client/debugger/src/selectors/sources.js#292-307
https://searchfox.org/mozilla-central/rev/2398ab33adcea896838b3da678ff6480dbb98b9a/devtools/client/debugger/src/utils/url.js#23-48
This can be really confusing as, at the end we are displaying different source name in SourceTree and Tabs...
On the following page:
http://techno-barje.fr/fission/query-params/
source3.js and source5.js behave differently:
<!-- distinct query, distinct hash -->
<script src="source3.js?query=1#foo"></script>
<script src="source3.js?query=2#bar"></script>
<!-- same query, distinct hash -->
<script src="source5.js?query=1#foo"></script>
<script src="source5.js?query=1#bar"></script>
Assignee | ||
Comment 1•3 years ago
|
||
This will help converge the SourceTree and Tabs.
Tabs relies on getHasSiblingOfSameName
selectors, itself relying on plain URLs,
to know if a given source is having another source with the same file name.
But while plain URL strips both query and hash,
stripQuery was only striping the query.
This led to discrepencies between the two components.
When two sources with the same query but distinct hash were loaded,
the SourceTree would hide the query (via getDisplayedSources logic, based on stripQuery),
while Tabs would keep displaying the query (via getHasSiblingOfSameName in the React component, based on plain URL).
Note that there is another breakage in SourceTree preventing to display two distinct sources
in the SourceTree...
Updated•3 years ago
|
Assignee | ||
Comment 2•3 years ago
|
||
Bug 1774601 will remove this code.
Updated•3 years ago
|
Description
•