Bug 1228980 - Display favicons of tab entries in aboutSessionRestore-based pages. r=ttaubert
authorLuis Miguel [:quicksaver] <quicksaver@gmail.com>
Tue, 08 Dec 2015 12:35:28 +0000
changeset 276192 5f2d518835e2aba575100bf9c7ffcff0bf503f86
parent 276095 df507dc13e43a63fd2cf4870e703f31bbde6dde8
child 276193 74f815f997bb2443ab39c403afce33c5cbbae58f
push id29785
push userphilringnalda@gmail.com
push dateSat, 12 Dec 2015 05:18:28 +0000
treeherdermozilla-central@d8ce27c85590 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersttaubert
bugs1228980
milestone45.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 1228980 - Display favicons of tab entries in aboutSessionRestore-based pages. r=ttaubert
browser/components/sessionstore/content/aboutSessionRestore.js
browser/components/sessionstore/test/browser_aboutSessionRestore.js
--- a/browser/components/sessionstore/content/aboutSessionRestore.js
+++ b/browser/components/sessionstore/content/aboutSessionRestore.js
@@ -72,17 +72,17 @@ function initTreeView() {
     var winState = {
       label: aWinData.tabGroupsMigrationTitle || winLabel.replace("%S", (aIx + 1)),
       open: true,
       checked: true,
       ix: aIx
     };
     winState.tabs = aWinData.tabs.map(function(aTabData) {
       var entry = aTabData.entries[aTabData.index - 1] || { url: "about:blank" };
-      var iconURL = aTabData.attributes && aTabData.attributes.image || null;
+      var iconURL = aTabData.image || null;
       // don't initiate a connection just to fetch a favicon (see bug 462863)
       if (/^https?:/.test(iconURL))
         iconURL = "moz-anno:favicon:" + iconURL;
       return {
         label: entry.title || entry.url,
         checked: true,
         src: iconURL,
         parent: winState
--- a/browser/components/sessionstore/test/browser_aboutSessionRestore.js
+++ b/browser/components/sessionstore/test/browser_aboutSessionRestore.js
@@ -1,15 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
-const CRASH_SHENTRY = {url: "about:mozilla"};
-const CRASH_TAB = {entries: [CRASH_SHENTRY]};
+const CRASH_URL = "about:mozilla";
+const CRASH_FAVICON = "chrome://branding/content/icon32.png";
+const CRASH_SHENTRY = {url: CRASH_URL};
+const CRASH_TAB = {entries: [CRASH_SHENTRY], image: CRASH_FAVICON};
 const CRASH_STATE = {windows: [{tabs: [CRASH_TAB]}]};
 
 const TAB_URL = "about:sessionrestore";
 const TAB_FORMDATA = {url: TAB_URL, id: {sessionData: CRASH_STATE}};
 const TAB_SHENTRY = {url: TAB_URL};
 const TAB_STATE = {entries: [TAB_SHENTRY], formdata: TAB_FORMDATA};
 
 const FRAME_SCRIPT = "data:," +
@@ -21,24 +23,30 @@ add_task(function* () {
   let browser = tab.linkedBrowser;
   yield promiseBrowserLoaded(browser);
 
   // Fake a post-crash tab.
   ss.setTabState(tab, JSON.stringify(TAB_STATE));
   yield promiseTabRestored(tab);
 
   ok(gBrowser.tabs.length > 1, "we have more than one tab");
+
+  let view = browser.contentDocument.getElementById("tabList").view;
+  ok(view.isContainer(0), "first entry is the window");
+  is(view.getCellProperties(1, { id: "title" }), "icon",
+    "second entry is the tab and has a favicon");
+
   browser.messageManager.loadFrameScript(FRAME_SCRIPT, true);
 
   // Wait until the new window was restored.
   let win = yield waitForNewWindow();
   yield BrowserTestUtils.closeWindow(win);
 
   let [{tabs: [{entries: [{url}]}]}] = JSON.parse(ss.getClosedWindowData());
-  is(url, "about:mozilla", "session was restored correctly");
+  is(url, CRASH_URL, "session was restored correctly");
   ss.forgetClosedWindow(0);
 });
 
 function waitForNewWindow() {
   return new Promise(resolve => {
     Services.obs.addObserver(function observe(win, topic) {
       Services.obs.removeObserver(observe, topic);
       resolve(win);