Open Bug 842937 Opened 12 years ago Updated 2 years ago

Display scripts that no longer exist in the debugger when accessed via the console

Categories

(DevTools :: Debugger, enhancement, P5)

enhancement

Tracking

(Not tracked)

People

(Reporter: past, Unassigned)

References

(Blocks 1 open bug)

Details

Bug 766001 will provide the ability to click on script links in the web console and open them in the debugger if present in the page, or view source, if not.

Since view source is only necessary for files that the debugger can't see (scripts that were scavenged, or scripts from previous pages in the same tab), and considering the fact that in the remote debugging case view source won't be able to have access to the right source anyway, I believe we could even do what Chrome seems to be doing. That would be to treat these scripts as ephemeral "files" and open them in the debugger (in a separate tab in Chrome's case), the same way Sublime Text uses a "scratchpad-like" tab when you open a file with a single click on the folder view.

In Sublime's case it is a reusable container that hosts the last single-clicked file. In our case it would be a script that doesn't have an entry in the script list, or maybe we could even add it to the list (especially after bug 812083), but mark it somehow differently (italics, special group, etc.). The implementation would copy SA__loadSource back to the frontend and add a new openScript method in DebuggerController (pseudo-code):

DebuggerController.openScript = function (aUrl, aLine) {
  if (DebuggerView.Sources.containsValue(aUrl) {
    DebuggerView.Sources.selectedValue = aUrl;
    DebuggerView.Sources.updateLine(aLine);
  } else {
    this._loadSource(aUrl).then(function() {
      DebuggerView.Sources.updateLine(aLine);
    });
  }
}

A better, but perhaps more controversial, option would be to add a protocol request to have the script fetched in the backend as usual:

{ to: "conn0.context2", type: "loadSource", url: "..." }

The benefit from this solution is that in remote debugging cases we would avoid hitting bug 755661 again. If Jim disagrees with this, the first solution should be straightforward.
(In reply to Panos Astithas [:past] from comment #0)

I don't think Sublime's behavior is incredibly pertinent due to the fact that the logical connection between a source's url and text contents is broken. Or, to put it differently, it confuses me, especially since the url appears selected :)

I would vote for these types of sources be added in a special group and displayed in italics, with the aid of bug 812083 (the group should not necessarily be named "Ephemeral", although it's a good name for a post-rock album).
it's an API thing with a UI/UX enhancement property. Calling it P3.
Priority: -- → P3
Summary: The debugger should be able to display scripts that don't exist in the page → Display scripts that no longer exist in the debugger when accessed via the console
Product: Firefox → DevTools
Priority: P3 → P5
Type: defect → enhancement
Blocks: 1565711
Blocks: 1565713
No longer blocks: 1565711
No longer blocks: 1565713
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.