Closed Bug 1643540 Opened 28 days ago Closed 26 days ago

Finding the type of a Debugger.Source loaded from a <script> is too hard

Categories

(DevTools :: Debugger, enhancement)

enhancement

Tracking

(firefox79 fixed)

RESOLVED FIXED
Firefox 79
Tracking Status
firefox79 --- fixed

People

(Reporter: loganfsmyth, Assigned: loganfsmyth)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

The debugger exposes "introductionType" as a field to know what generic type a source is. Currently "scriptElement" is used for anything loaded via <script> directly. What that means is that we have to jump through a bunch of hoops to differentiate:

  • JS scripts loaded from <script src="file.js"></script>
  • JS scripts inlined directly into HTML <script>code;</script>
  • JS scripts injected into HTML via document.write, or doc.createElement

We currently jump through hoops to differentiate these using source.element and source.introductionScript, but there's essentially no reason for us to do that in a perfect world, and it allows for much more reliable behavior.

The lack of specificity for script intro type has lead the debugger to need
to make use of 'source.introductionType' and 'source.element' in order to
determine whether a given script was injected, or inline or fetched, which
is entirely unnecessary of the loader itself clearly tells us what type
of script we are working with. It also allows us to cleanly handle the case
of XUL, which previously was "scriptElement" but has no ".element" passed
in, so we were unable to know whether a given source was inline or not.

Assignee: nobody → loganfsmyth
Status: NEW → ASSIGNED
Attachment #9154433 - Attachment description: Bug 1643540 - Provide separate introductionTypes for different types of sources. r=jlast! → Bug 1643540 - Split scriptElement type into three types for clarity. r=jlast!
Pushed by loganfsmyth@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/0f1069d946b1
Split scriptElement type into three types for clarity. r=jlast,smaug
Status: ASSIGNED → RESOLVED
Closed: 26 days ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 79
Regressions: 1644075
See Also: → 1644075
You need to log in before you can comment on or make changes to this bug.