Closed Bug 982539 Opened 11 years ago Closed 4 years ago

Debugger.Script should not use document fragment from URL

Categories

(DevTools :: Debugger, defect)

x86_64
Windows 7
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: Honza, Unassigned)

References

(Blocks 2 open bugs)

Details

(Whiteboard: [firebug-p1])

If document fragment (e.g. #id) is presented in page URL, it should not be used by Debugger.Script objects. The fragment can arbitrary change (it's often used to represent state of single page web applications) and it doesn't cause page reload. Currently, all the existing scripts use the original URL with fragment and don not reflect it's changes. This is also a problem for breakpoints that needs to use the fragment too. Honza
Whiteboard: [firebug-p1]
Summary: Debugger.Script object URL should not use document fragment → Debugger.Script object URL should not use fragment
I certainly agree that the fragment should be ignored by the debugger server, shouldn't appear in the protocol, shouldn't affect breakpoint placement, and so on. However, Debugger.Source is simply returning the filename that SpiderMonkey has recorded. For example, here's Error().stack in my toy "debugme.html" page, when I visit it as debugme.html#foon; here Debugger is not involved at all: @file:///home/jimb/JSTools/debugme.js line 21 > eval:1:1 updateExpression@file:///home/jimb/JSTools/debugme.js:21:5 onclick@file:///home/jimb/JSTools/debugme.html#foon:1:38 Note that last frame, for an 'onclick' handler appearing in the HTML file. That said, it sure would be irritating to have to check for and remove the fragment every time we fetch a script's URL property. Would it make sense for the browser to strip the fragment before it passes the URL to SpiderMonkey when it compiles event handlers and <script> elements? It seems to me that the browser is the only entity here that really knows for sure that it's dealing with an HTTP URI. SpiderMonkey has no idea what these strings are, and it certainly shouldn't be parsing them.
(In reply to Jim Blandy :jimb from comment #1) > Would it make sense for the browser to strip the fragment before it passes > the URL to SpiderMonkey when it compiles event handlers and <script> > elements? It seems to me that the browser is the only entity here that > really knows for sure that it's dealing with an HTTP URI. SpiderMonkey has > no idea what these strings are, and it certainly shouldn't be parsing them. That make sense to me. Honza
Summary: Debugger.Script object URL should not use fragment → Debugger.Script should not use document fragment from URL
Blocks: dbg-server
Product: Firefox → DevTools

Honza, Jim is this still relevant?

Flags: needinfo?(odvarko)
Flags: needinfo?(jimb)
Blocks: dbg-api

Definitely not relevant from Firebug perspective.
Honza

Flags: needinfo?(odvarko)

It seems like the real question here is, do we want the fragment showing up in things like new Error().stack;. The debugger server can always trivially trim off the fragment internally so that things behave as if there is no fragment.

I can see the argument either way for this one, so I'm not sure what direction we'd want to go in with this.

Flags: needinfo?(jimb)

Doesn't seem to be relevant anymore and no activity here for 7 years.

Honza

Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.