Closed Bug 1777280 Opened 2 years ago Closed 2 years ago

Compute displayURL for all reducer source object

Categories

(DevTools :: Debugger, enhancement)

enhancement

Tracking

(firefox104 fixed)

RESOLVED FIXED
104 Branch
Tracking Status
firefox104 --- fixed

People

(Reporter: ochameau, Assigned: ochameau)

References

Details

Attachments

(1 file)

For now, the debugger computes the displayURL object from the SourceTree reducer:
https://searchfox.org/mozilla-central/rev/0069a0cdc3cd136ea7411521219df6665f260be7/devtools/client/debugger/src/selectors/sources.js#243

      const displayURL = getDisplayURL(source.url, mainThreadHost);

      // Ignore source which have not been able to be sorted in a group by getDisplayURL
      // It should be only javascript: URLs and weird URLs without protocols.
      if (!displayURL.group) {
        continue;
      }

But this could be done right on the source reducer object.
This would prevent having to recompute this object anytime this selector is executed.
Also, we ignore source with no group, while getDisplayURL tries its best to set a group.
After having fixed bug 1777205, there is no more source (at least on try) which have a falsy displayURL.group.
Also, we currently pass mainThreadHost to have it become the default group.
But, again, no test on try are reporting such fallback:
https://treeherder.mozilla.org/jobs?repo=try&selectedTaskRun=bKQS1-gDQGuyqM8CMCJRkQ.0&revision=cb751ae88ec7e5d41b16a8b428dd84232f221041

So we could move displayURL computation to the source reducer, while getting rid of getDisplayURL in favor of getURL. And. Remove the check against group being null and always expect a group to be passed!

By moving the computation of displayURL from the SourceTree selector to the sources reducer,
we ensure computing it only once. We could also get rid of all the redundant getURL usages.

Note that we were never defaulting to mainThreadHost in getDisplayURL,
nor were we having any source with a false "group".

So we could simplify the logic a bit.

Assignee: nobody → poirot.alex
Status: NEW → ASSIGNED
Blocks: 1777459
Pushed by apoirot@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/cc98e1453316
[devtools] Compute displayURL for each source only once. r=bomsy
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 104 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: