Bug 561719 - Port Bug 551285 [Drop backwards compatibility for Firefox 2/3] to SeaMonkey. r=Neil, sr=Neil
authorMisak Khachatryan <misak.bugzilla@gmail.com>
Mon, 26 Apr 2010 15:38:56 +0500
changeset 5540 b2b86be4f4f2b583b51cb875f016584396ff3580
parent 5539 d11b2ddd9cb9e488018f7c56223b00e2c09145ac
child 5541 c0df81ab60c414712e94863fe3034291c0ef2a04
push idunknown
push userunknown
push dateunknown
reviewersNeil, Neil
bugs561719, 551285
Bug 561719 - Port Bug 551285 [Drop backwards compatibility for Firefox 2/3] to SeaMonkey. r=Neil, sr=Neil
suite/common/src/nsSessionStore.js
--- a/suite/common/src/nsSessionStore.js
+++ b/suite/common/src/nsSessionStore.js
@@ -1942,24 +1942,16 @@ SessionStoreService.prototype = {
     // make sure to reset the capabilities and attributes, in case this tab gets reused
     var disallow = (tabData.disallow)?tabData.disallow.split(","):[];
     CAPABILITIES.forEach(function(aCapability) {
       browser.docShell["allow" + aCapability] = disallow.indexOf(aCapability) == -1;
     });
     Array.filter(tab.attributes, function(aAttr) {
       return (_this.xulAttributes.indexOf(aAttr.name) > -1);
     }).forEach(tab.removeAttribute, tab);
-    if (tabData.xultab) {
-      // restore attributes from the legacy format
-      tabData.xultab.split(" ").forEach(function(aAttr) {
-        if (/^([^\s=]+)=(.*)/.test(aAttr)) {
-          tab.setAttribute(RegExp.$1, decodeURI(RegExp.$2));
-        }
-      });
-    }
     for (let name in tabData.attributes)
       tab.setAttribute(name, tabData.attributes[name]);
 
     if (tabData.storage && browser.docShell instanceof Components.interfaces.nsIDocShell)
       this._deserializeSessionStorage(tabData.storage, browser.docShell);
 
     // notify the tabbrowser that the tab chrome has been restored
     var event = aWindow.document.createEvent("Events");
@@ -1978,17 +1970,16 @@ SessionStoreService.prototype = {
       tab.removeAttribute("busy");
     }
 
     if (tabData.entries.length > 0) {
       // restore those aspects of the currently active documents
       // which are not preserved in the plain history entries
       // (mainly scroll state and text data)
       browser.__SS_restore_data = tabData.entries[activeIndex] || {};
-      browser.__SS_restore_text = tabData.text || "";
       browser.__SS_restore_pageStyle = tabData.pageStyle || "";
       browser.__SS_restore_tab = tab;
       browser.__SS_restore = this.restoreDocument_proxy;
       browser.addEventListener("load", browser.__SS_restore, true);
     }
 
     aWindow.setTimeout(function() {
       _this.restoreHistory(aWindow, aTabs, aTabData, aIdMap, aDocIdentMap);
@@ -2043,24 +2034,18 @@ SessionStoreService.prototype = {
     }
 
     if (aEntry.scroll) {
       var scrollPos = (aEntry.scroll || "0,0").split(",");
       scrollPos = [parseInt(scrollPos[0]) || 0, parseInt(scrollPos[1]) || 0];
       shEntry.setScrollPosition(scrollPos[0], scrollPos[1]);
     }
 
-    var postdata;
-    if (aEntry.postdata_b64) {  // Firefox 3
-      postdata = atob(aEntry.postdata_b64);
-    } else if (aEntry.postdata) { // Firefox 2
-      postdata = aEntry.postdata;
-    }
-
-    if (postdata) {
+    if (aEntry.postdata_b64) {
+      var postdata = atob(aEntry.postdata_b64);
       var stream = Components.classes["@mozilla.org/io/string-input-stream;1"]
                              .createInstance(Components.interfaces.nsIStringInputStream);
       stream.setData(postdata, postdata.length);
       shEntry.postData = stream;
     }
 
     if (aEntry.docIdentifier) {
       // Get a new document identifier for this entry to ensure that history
@@ -2222,17 +2207,16 @@ SessionStoreService.prototype = {
       // notify the tabbrowser that this document has been completely restored
       var event = this.ownerDocument.createEvent("Events");
       event.initEvent("SSTabRestored", true, false);
       this.__SS_restore_tab.dispatchEvent(event);
     }
 
     this.removeEventListener("load", this.__SS_restore, true);
     delete this.__SS_restore_data;
-    delete this.__SS_restore_text;
     delete this.__SS_restore_pageStyle;
     delete this.__SS_restore_tab;
     delete this.__SS_restore;
   },
 
   /**
    * Restore visibility and dimension features to a window
    * @param aWindow
@@ -2309,36 +2293,21 @@ SessionStoreService.prototype = {
     // since resizing/moving a window brings it to the foreground,
     // we might want to re-focus the last focused window
     if (this.windowToFocus && this.windowToFocus.content) {
       this.windowToFocus.content.focus();
     }
   },
 
   /**
-   * Restores cookies (accepting both Firefox 2.0 and current format)
+   * Restores cookies
    * @param aCookies
    *        Array of cookie objects
    */
   restoreCookies: function sss_restoreCookies(aCookies) {
-    if (aCookies.count && aCookies.domain1) {
-      // convert to the new cookie serialization format
-      var converted = [];
-      for (var i = 1; i <= aCookies.count; i++) {
-        // for simplicity we only accept the format we produced ourselves
-        var parsed = aCookies["value" + i].match(/^([^=;]+)=([^;]*);(?:domain=[^;]+;)?(?:path=([^;]*);)?(secure;)?(httponly;)?/);
-        if (parsed && /^https?:\/\/([^\/]+)/.test(aCookies["domain" + i]))
-          converted.push({
-            host: RegExp.$1, path: parsed[3], name: parsed[1], value: parsed[2],
-            secure: parsed[4], httponly: parsed[5]
-          });
-      }
-      aCookies = converted;
-    }
-
     // MAX_EXPIRY should be 2^63-1, but JavaScript can't handle that precision
     var MAX_EXPIRY = Math.pow(2, 62);
     for (i = 0; i < aCookies.length; i++) {
       var cookie = aCookies[i];
       try {
         cm.add(cookie.host, cookie.path || "", cookie.name || "",
                       cookie.value, !!cookie.secure, !!cookie.httponly, true,
                       "expiry" in cookie ? cookie.expiry : MAX_EXPIRY);