Closed Bug 1523942 Opened 5 years ago Closed 5 years ago

Optimize ThreadActor._mapSourceToAddon

Categories

(DevTools :: Debugger, enhancement, P2)

enhancement

Tracking

(firefox67 fixed)

RESOLVED FIXED
Firefox 67
Tracking Status
firefox67 --- fixed

People

(Reporter: ochameau, Assigned: ochameau)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

SourceActor._mapSourceToAddon:
https://searchfox.org/mozilla-central/rev/c07aaf12f13037c1f5a343d31f8291549e57373f/devtools/server/actors/source.js#243-290

This function is called for all sources on SourceActor instantiation:
https://searchfox.org/mozilla-central/rev/c07aaf12f13037c1f5a343d31f8291549e57373f/devtools/server/actors/source.js#153

But it is:

  • only useful for add-ons
  • slow to execute

We should:

  • bail out the earliest/fastest when we know it isn't an addon resource
  • even if this is an add-on resource, optimize this computation

We can surely optimize it if we merge SourceActor._mapSourceToAddon with mapURIToAddonId:
https://searchfox.org/mozilla-central/source/devtools/server/actors/utils/map-uri-to-addon-id.js#34-42
And adapt this code to the fact that we only support WebExtension add-ons.
The possible URL scheme for WebExtension is most likely much simplier and probably restricted to only one kind.
Also WebExtensionPolicy.getByURI may be faster than the original platform method we used to call when we orignaly wrote this helper method.

Oh wait, it is even much more simple. We aren't using "addonPath". We return it in the form, but never use it elsewhere.

https://searchfox.org/mozilla-central/search?q=addonPath&case=false&regexp=false&path=devtools%2F

It looks like we can remove a lot of code.

Assignee: nobody → poirot.alex
Priority: -- → P2
Pushed by apoirot@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/bfdfbd4fa2ce
Remove unused addonID/addonPath from SourceActor. r=jlast
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 67
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: