Bug 1246956 - Add originURI to Sessionstore. r=bz a=ritu
authorDragana Damjanovic <dd.mozilla@gmail.com>
Wed, 02 Mar 2016 15:51:35 -0800
changeset 260974 15873a924eac11350a4bf33d79c46aa9572d9dd9
parent 260973 dfea8f0ec4b7ed4ece4f0457c3cbf915ffa1d6cd
child 260975 dd4b90de8fd31fddc2562530e9dbe01325a305da
push id294
push userkwierso@gmail.com
push dateWed, 02 Mar 2016 23:55:05 +0000
treeherdermozilla-esr38@dd4b90de8fd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz, ritu
bugs1246956
milestone38.6.0
Bug 1246956 - Add originURI to Sessionstore. r=bz a=ritu MozReview-Commit-ID: K8UHlnD9R3p
browser/components/sessionstore/SessionHistory.jsm
mobile/android/components/SessionStore.js
--- a/browser/components/sessionstore/SessionHistory.jsm
+++ b/browser/components/sessionstore/SessionHistory.jsm
@@ -187,16 +187,23 @@ let SessionHistoryInternal = {
 
     // We will include the property only if it's truthy to save a couple of
     // bytes when the resulting object is stringified and saved to disk.
     if (shEntry.referrerURI) {
       entry.referrer = shEntry.referrerURI.spec;
       entry.referrerPolicy = shEntry.referrerPolicy;
     }
 
+    var shEntryESR38 = shEntry.QueryInterface(Ci.nsISHEntry_ESR38);
+    if (shEntryESR38) {
+      if (shEntryESR38.originalURI) {
+        entry.originalURI = shEntryESR38.originalURI.spec;
+      }
+    }
+
     if (shEntry.srcdocData)
       entry.srcdocData = shEntry.srcdocData;
 
     if (shEntry.isSrcdocEntry)
       entry.isSrcdocEntry = shEntry.isSrcdocEntry;
 
     if (shEntry.baseURI)
       entry.baseURI = shEntry.baseURI.spec;
@@ -328,29 +335,32 @@ let SessionHistoryInternal = {
    *        Hash for ensuring unique frame IDs
    * @param docIdentMap
    *        Hash to ensure reuse of BFCache entries
    * @returns nsISHEntry
    */
   deserializeEntry: function (entry, idMap, docIdentMap) {
 
     var shEntry = Cc["@mozilla.org/browser/session-history-entry;1"].
-                  createInstance(Ci.nsISHEntry);
+                  createInstance(Ci.nsISHEntry_ESR38);
 
     shEntry.setURI(Utils.makeURI(entry.url));
     shEntry.setTitle(entry.title || entry.url);
     if (entry.subframe)
       shEntry.setIsSubFrame(entry.subframe || false);
     shEntry.loadType = Ci.nsIDocShellLoadInfo.loadHistory;
     if (entry.contentType)
       shEntry.contentType = entry.contentType;
     if (entry.referrer) {
       shEntry.referrerURI = Utils.makeURI(entry.referrer);
       shEntry.referrerPolicy = entry.referrerPolicy;
     }
+    if (entry.originalURI) {
+      shEntry.originalURI = Utils.makeURI(entry.originalURI);
+    }
     if (entry.isSrcdocEntry)
       shEntry.srcdocData = entry.srcdocData;
     if (entry.baseURI)
       shEntry.baseURI = Utils.makeURI(entry.baseURI);
 
     if (entry.cacheKey) {
       var cacheKey = Cc["@mozilla.org/supports-PRUint32;1"].
                      createInstance(Ci.nsISupportsPRUint32);
--- a/mobile/android/components/SessionStore.js
+++ b/mobile/android/components/SessionStore.js
@@ -734,16 +734,23 @@ SessionStore.prototype = {
 
     entry.ID = aEntry.ID;
     entry.docshellID = aEntry.docshellID;
 
     if (aEntry.referrerURI) {
       entry.referrer = aEntry.referrerURI.spec;
     }
 
+    var entryESR38 = aEntry.QueryInterface(Ci.nsISHEntry_ESR38);
+    if (entryESR38) {
+      if (entryESR38.originalURI) {
+        entry.originalURI = entryESR38.originalURI.spec;
+      }
+    }
+
     if (aEntry.contentType) {
       entry.contentType = aEntry.contentType;
     }
 
     let x = {}, y = {};
     aEntry.getScrollPosition(x, y);
     if (x.value != 0 || y.value != 0) {
       entry.scroll = x.value + "," + y.value;
@@ -799,31 +806,35 @@ SessionStore.prototype = {
         entry.children = children;
       }
     }
 
     return entry;
   },
 
   _deserializeHistoryEntry: function _deserializeHistoryEntry(aEntry, aIdMap, aDocIdentMap) {
-    let shEntry = Cc["@mozilla.org/browser/session-history-entry;1"].createInstance(Ci.nsISHEntry);
+    let shEntry = Cc["@mozilla.org/browser/session-history-entry;1"].createInstance(Ci.nsISHEntry_ESR38);
 
     shEntry.setURI(Services.io.newURI(aEntry.url, null, null));
     shEntry.setTitle(aEntry.title || aEntry.url);
     if (aEntry.subframe) {
       shEntry.setIsSubFrame(aEntry.subframe || false);
     }
     shEntry.loadType = Ci.nsIDocShellLoadInfo.loadHistory;
     if (aEntry.contentType) {
       shEntry.contentType = aEntry.contentType;
     }
     if (aEntry.referrer) {
       shEntry.referrerURI = Services.io.newURI(aEntry.referrer, null, null);
     }
 
+    if (aEntry.originalURI) {
+      shEntry.originalURI =  Services.io.newURI(aEntry.originalURI, null, null);
+    }
+
     if (aEntry.cacheKey) {
       let cacheKey = Cc["@mozilla.org/supports-PRUint32;1"].createInstance(Ci.nsISupportsPRUint32);
       cacheKey.data = aEntry.cacheKey;
       shEntry.cacheKey = cacheKey;
     }
 
     if (aEntry.ID) {
       // get a new unique ID for this frame (since the one from the last