Bug 1163745 - TabAttributes.set() should ignore internal attributes r=billm
☠☠ backed out by c827dc4915ba ☠ ☠
authorTim Taubert <ttaubert@mozilla.com>
Mon, 15 Jun 2015 10:57:00 +0200
changeset 249150 bcec28b467183305febab7de6ddbec7905d1b5aa
parent 249149 b148ba60f686d8981604e02c85d292720d6e5eda
child 249151 c827dc4915baecf397673c443b9f7791a775aae3
push id13590
push userttaubert@mozilla.com
push dateTue, 16 Jun 2015 20:06:23 +0000
treeherderfx-team@bcec28b46718 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbillm
bugs1163745
milestone41.0a1
Bug 1163745 - TabAttributes.set() should ignore internal attributes r=billm
browser/components/sessionstore/TabAttributes.jsm
browser/components/sessionstore/test/browser_attributes.js
--- a/browser/components/sessionstore/TabAttributes.jsm
+++ b/browser/components/sessionstore/TabAttributes.jsm
@@ -56,13 +56,15 @@ let TabAttributesInternal = {
   set: function (tab, data = {}) {
     // Clear attributes.
     for (let name of this._attrs) {
       tab.removeAttribute(name);
     }
 
     // Set attributes.
     for (let name in data) {
-      tab.setAttribute(name, data[name]);
+      if (!this._skipAttrs.has(name)) {
+        tab.setAttribute(name, data[name]);
+      }
     }
   }
 };
 
--- a/browser/components/sessionstore/test/browser_attributes.js
+++ b/browser/components/sessionstore/test/browser_attributes.js
@@ -31,26 +31,28 @@ add_task(function* test() {
   ss.persistTabAttribute("custom");
 
   ({attributes} = JSON.parse(ss.getTabState(tab)));
   is(attributes.custom, "foobar", "'custom' attribute is correct");
 
   // Make sure we're backwards compatible and restore old 'image' attributes.
   let state = {
     entries: [{url: "about:mozilla"}],
-    attributes: {custom: "foobaz", image: gBrowser.getIcon(tab)}
+    attributes: {custom: "foobaz"},
+    image: gBrowser.getIcon(tab)
   };
 
   // Prepare a pending tab waiting to be restored.
   let promise = promiseTabRestoring(tab);
   ss.setTabState(tab, JSON.stringify(state));
   yield promise;
 
   ok(tab.hasAttribute("pending"), "tab is pending");
-  is(gBrowser.getIcon(tab), state.attributes.image, "tab has correct icon");
+  is(gBrowser.getIcon(tab), state.image, "tab has correct icon");
+  ok(!state.attributes.image, "'image' attribute not saved");
 
   // Let the pending tab load.
   gBrowser.selectedTab = tab;
   yield promiseTabRestored(tab);
 
   // Ensure no 'image' or 'pending' attributes are stored.
   ({attributes} = JSON.parse(ss.getTabState(tab)));
   ok(!("image" in attributes), "'image' attribute not saved");