Bug 898472 - Give Browser Debugger window a title. r=vp
authorSunny <indiasuny000@gmail.com>
Fri, 11 Oct 2013 15:09:00 -0700
changeset 150519 f22b6a8bc244d4f19fb07b07b74e8148384ae043
parent 150518 c5235838989731c07bc4781507cafda90c6a8b1a
child 150520 27a7bb8d83271ea7a77fa223f8203eb1908f7088
push id3004
push userbbenvie@mozilla.com
push dateFri, 11 Oct 2013 22:09:20 +0000
treeherderfx-team@f22b6a8bc244 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvp
bugs898472
milestone27.0a1
Bug 898472 - Give Browser Debugger window a title. r=vp
browser/devtools/debugger/debugger-panes.js
browser/devtools/debugger/debugger-view.js
browser/devtools/debugger/test/browser_dbg_scripts-switching-01.js
browser/locales/en-US/chrome/browser/devtools/debugger.properties
--- a/browser/devtools/debugger/debugger-panes.js
+++ b/browser/devtools/debugger/debugger-panes.js
@@ -680,16 +680,21 @@ SourcesView.prototype = Heritage.extend(
    * The select listener for the sources container.
    */
   _onSourceSelect: function({ detail: sourceItem }) {
     if (!sourceItem) {
       return;
     }
     // The container is not empty and an actual item was selected.
     DebuggerView.setEditorLocation(sourceItem.value);
+
+    // Set window title.
+    let script = sourceItem.value.split(" -> ").pop();
+    document.title = L10N.getFormatStr("DebuggerWindowScriptTitle", script);
+
     this.maybeShowBlackBoxMessage();
   },
 
   /**
    * Show or hide the black box message vs. source editor depending on if the
    * selected source is black boxed or not.
    */
   maybeShowBlackBoxMessage: function() {
--- a/browser/devtools/debugger/debugger-view.js
+++ b/browser/devtools/debugger/debugger-view.js
@@ -63,16 +63,17 @@ let DebuggerView = {
     this.ChromeGlobals.initialize();
     this.StackFrames.initialize();
     this.Sources.initialize();
     this.WatchExpressions.initialize();
     this.EventListeners.initialize();
     this.GlobalSearch.initialize();
     this._initializeVariablesView();
     this._initializeEditor(deferred.resolve);
+    document.title = L10N.getStr("DebuggerWindowTitle");
 
     return deferred.promise;
   },
 
   /**
    * Destroys the debugger view.
    *
    * @return object
--- a/browser/devtools/debugger/test/browser_dbg_scripts-switching-01.js
+++ b/browser/devtools/debugger/test/browser_dbg_scripts-switching-01.js
@@ -14,16 +14,19 @@ function test() {
   initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
     gTab = aTab;
     gDebuggee = aDebuggee;
     gPanel = aPanel;
     gDebugger = gPanel.panelWin;
     gEditor = gDebugger.DebuggerView.editor;
     gSources = gDebugger.DebuggerView.Sources;
 
+    ok(gDebugger.document.title.endsWith(EXAMPLE_URL + gLabel1),
+      "Title with first source is correct.");
+
     waitForSourceAndCaretAndScopes(gPanel, "-02.js", 6)
       .then(testSourcesDisplay)
       .then(testSwitchPaused1)
       .then(testSwitchPaused2)
       .then(testSwitchRunning)
       .then(() => resumeDebuggerThenCloseAndFinish(gPanel))
       .then(null, aError => {
         ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
@@ -59,16 +62,19 @@ function testSourcesDisplay() {
   is(gSources.selectedValue, EXAMPLE_URL + gLabel2,
     "The selected value is the sources pane is incorrect.");
 
   is(gEditor.getText().search(/firstCall/), -1,
     "The first source is not displayed.");
   is(gEditor.getText().search(/debugger/), 172,
     "The second source is displayed.");
 
+  ok(gDebugger.document.title.endsWith(EXAMPLE_URL + gLabel2),
+    "Title with second source is correct.");
+
   ok(isCaretPos(gPanel, 6),
     "Editor caret location is correct.");
 
   // The editor's debug location takes a tick to update.
   executeSoon(() => {
     is(gEditor.getDebugLocation(), 5,
       "Editor debugger location is correct.");
 
--- a/browser/locales/en-US/chrome/browser/devtools/debugger.properties
+++ b/browser/locales/en-US/chrome/browser/devtools/debugger.properties
@@ -10,16 +10,24 @@
 # A good criteria is the language in which you'd find the best
 # documentation on web development on the web.
 
 # LOCALIZATION NOTE (ToolboxDebugger.label):
 # This string is displayed in the title of the tab when the debugger is
 # displayed inside the developer tools window and in the Developer Tools Menu.
 ToolboxDebugger.label=Debugger
 
+# LOCALIZATION NOTE (DebuggerWindowTitle):
+# The title displayed for the debugger window.
+DebuggerWindowTitle=Browser Debugger
+
+# LOCALIZATION NOTE (DebuggerWindowScriptTitle):
+# The title displayed for the debugger window when a script is selected.
+DebuggerWindowScriptTitle=Browser Debugger - %S
+
 # LOCALIZATION NOTE (ToolboxDebugger.tooltip):
 # This string is displayed in the tooltip of the tab when the debugger is
 # displayed inside the developer tools window..
 ToolboxDebugger.tooltip=JavaScript Debugger
 
 # LOCALIZATION NOTE (debuggerMenu.commandkey, debuggerMenu.accesskey)
 # Used for the menuitem in the tool menu
 debuggerMenu.commandkey=S