Bug 484621
authorJustin Wood <Callek@gmail.com>
Sun, 22 Mar 2009 12:11:38 -0400
changeset 2263 248a69832af6b4a9ec78e172fb880c734388238a
parent 2262 ff3012bc70bfced6f7fb868d01c5711998329870
child 2264 00ef42e8b45837d58213c35ae35907302a2bb013
push idunknown
push userunknown
push dateunknown
bugs484621
Bug 484621
suite/common/contentAreaUtils.js
--- a/suite/common/contentAreaUtils.js
+++ b/suite/common/contentAreaUtils.js
@@ -384,17 +384,17 @@ function internalSave(aURL, aDocument, a
   // If we're just saving the HTML (second option in the list), send only the URI.
   var source = useSaveDocument ? aDocument : fileInfo.uri;
   var persistArgs = {
     source      : source,
     contentType : (!aChosenData && useSaveDocument &&
                    saveAsType == kSaveAsType_Text) ?
                   "text/plain" : null,
     target      : fileURL,
-    postData    : isDocument ? getPostData() : null,
+    postData    : isDocument ? getPostData(aDocument) : null,
     bypassCache : aShouldBypassCache
   };
 
   var persist = makeWebBrowserPersist();
 
   // Calculate persist flags.
   const nsIWBP = Components.interfaces.nsIWebBrowserPersist;
   const flags = nsIWBP.PERSIST_FLAGS_REPLACE_EXISTING_FILES;
@@ -695,20 +695,23 @@ function appendFiltersForContentType(aFi
 
   if (aSaveMode & SAVEMODE_COMPLETE_TEXT)
     aFilePicker.appendFilters(Components.interfaces.nsIFilePicker.filterText);
 
   // Always append the all files (*) filter
   aFilePicker.appendFilters(Components.interfaces.nsIFilePicker.filterAll);
 }
 
-function getPostData()
+function getPostData(aDocument)
 {
   try {
-    var sessionHistory = getWebNavigation().sessionHistory;
+    var sessionHistory = aDocument.defaultView
+                                  .QueryInterface(Components.interfaces.nsIInterfaceRequestor)
+                                  .getInterface(Components.interfaces.nsIWebNavigation)
+                                  .sessionHistory;
     return sessionHistory.getEntryAtIndex(sessionHistory.index, false)
                          .QueryInterface(Components.interfaces.nsISHEntry)
                          .postData;
   }
   catch (e) {
   }
   return null;
 }