Bug 1020730 - If there's no title to show in undo close tab toast, just say "Closed tab". r=bnicholson
authorMargaret Leibovic <margaret.leibovic@gmail.com>
Fri, 06 Jun 2014 11:52:46 -0700
changeset 206417 7bb8f92028d92b160a8798f4a70e29c3eacedc25
parent 206416 8dc8a55ea0592ea994414665ff67c15a9674d2f5
child 206418 a33f76e3ff8afcf920fdff4b7cfbf06ce58db647
push id3741
push userasasaki@mozilla.com
push dateMon, 21 Jul 2014 20:25:18 +0000
treeherdermozilla-beta@4d6f46f5af68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbnicholson
bugs1020730
milestone32.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1020730 - If there's no title to show in undo close tab toast, just say "Closed tab". r=bnicholson
mobile/android/chrome/content/browser.js
mobile/android/locales/en-US/chrome/browser.properties
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -986,20 +986,25 @@ var BrowserApp = {
     aTab.destroy();
     this._tabs.splice(tabIndex, 1);
 
     if (aShowUndoToast) {
       // Get a title for the undo close toast. Fall back to the URL if there is no title.
       let ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
       let closedTabData = ss.getClosedTabs(window)[0];
 
-      let historyEntry = closedTabData.entries[closedTabData.index - 1];
-      let title = historyEntry.title || historyEntry.url;
-
-      let message = Strings.browser.formatStringFromName("undoCloseToast.message", [title], 1);
+      let message;
+      let title = closedTabData.entries[closedTabData.index - 1].title;
+
+      if (title) {
+        message = Strings.browser.formatStringFromName("undoCloseToast.message", [title], 1);
+      } else {
+        message = Strings.browser.GetStringFromName("undoCloseToast.messageDefault");
+      }
+
       NativeWindow.toast.show(message, "short", {
         button: {
           icon: "drawable://undo_button_icon",
           label: Strings.browser.GetStringFromName("undoCloseToast.action2"),
           callback: function() {
             UITelemetry.addEvent("undo.1", "toast", null, "closetab");
             ss.undoCloseTab(window, 0);
           }
--- a/mobile/android/locales/en-US/chrome/browser.properties
+++ b/mobile/android/locales/en-US/chrome/browser.properties
@@ -127,16 +127,20 @@ newprivatetabpopup.opened=New private ta
 # button label) and upper-case, to match Google and Android's convention.
 newtabpopup.switch=SWITCH
 
 # Undo close tab toast
 # LOCALIZATION NOTE (undoCloseToast.message): This message appears in a toast
 # when the user closes a tab. %S is the title of the tab that was closed.
 undoCloseToast.message=Closed %S
 
+# LOCALIZATION NOTE (undoCloseToast.messageDefault): This message appears in a
+# toast when the user closes a tab if there is no title to display.
+undoCloseToast.messageDefault=Closed tab
+
 # LOCALIZATION NOTE (undoCloseToast.action2): Ideally, this string is short (it's a
 # button label) and upper-case, to match Google and Android's convention.
 undoCloseToast.action2=UNDO
 
 # Offline web applications
 offlineApps.ask=Allow %S to store data on your device for offline use?
 offlineApps.dontAskAgain=Don't ask again for this site
 offlineApps.allow=Allow