Closed Bug 791323 Opened 9 years ago Closed 9 years ago

Need a mechanism to select a script programmatically in the debugger

Categories

(DevTools :: Debugger, defect, P2)

x86_64
Windows 7
defect

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 20

People

(Reporter: Optimizer, Assigned: vporof)

References

Details

(Whiteboard: [fixed-in-fx-team])

Attachments

(1 file)

By using JS, just after loading the Debugger, it starts loading the first script in the list (alphabetically sorted), then I change the script to the desired script, it gets changed, but as soon as the previously started loading of the first script finishes, the source-editor is filled with text of that script, without even changing the name of the script in the menu list. And after that the Debugger behaves as the content loaded in the source editor belongs to the second script that I switched to.

Here is the code that use to do the same:

function openScript(aSourceURL) {
  let scriptsView = dbg.DebuggerView.Scripts;
  let scriptLocations = scriptsView.scriptLocations;
  if (scriptLocations.indexOf(aSourceURL) === -1) {
    return;
  }
  scriptsView.selectScript(aSourceURL);
}

let dbg = null, debuggerOpenedByThis = false;
if (this.chromeWindow.DebuggerUI.getDebugger() == null) {
  this.chromeWindow.DebuggerUI.toggleDebugger();
  dbg = this.chromeWindow.DebuggerUI.getDebugger().contentWindow;
  let self = this;
  dbg.addEventListener("Debugger:Connecting", function onConnecting() {
    dbg.removeEventListener("Debugger:Connecting", onConnecting);
    dbg.addEventListener("Debugger:AfterScriptsAdded", function onScriptsAdded() {
      dbg.removeEventListener("Debugger:AfterScriptsAdded", onScriptsAdded);
      openScript.call(self, <url of script that is not the first script in the menu list>);
    });
  });
}
Blocks: 766001
ignoring the above example, we need a way to select a script programmatically in the debugger. The above example illustrates why we need this.
Summary: Debugger loads the wrong script's text into the source-editor. → Need a mechanism to select a script programmatically in the debugger
we should implement this following Nick's work in bug 755661.
Depends on: 755661
This bug blocks 766001 very badly.
I already have a simple solution for this bug to make bug 766001 possible.
Should I stop on it then ?
Priority: -- → P2
FILTER ON PUMPKINS.
Assignee: nobody → vporof
Status: NEW → ASSIGNED
Depends on: 791325
Attached patch v1Splinter Review
Attachment #685124 - Flags: review?(rcampbell)
Comment on attachment 685124 [details] [diff] [review]
v1

Review of attachment 685124 [details] [diff] [review]:
-----------------------------------------------------------------

yup.
Attachment #685124 - Flags: review?(rcampbell) → review+
Whiteboard: [land-in-fx-team]
https://hg.mozilla.org/integration/fx-team/rev/be8f10c9dfa4
Whiteboard: [land-in-fx-team] → [fixed-in-fx-team]
https://hg.mozilla.org/mozilla-central/rev/be8f10c9dfa4
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 20
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.