diff --git a/browser/base/content/contentAreaUtils.js b/browser/base/content/contentAreaUtils.js
index 46c9d032e96..9ac3264983a 100644
--- a/browser/base/content/contentAreaUtils.js
+++ b/browser/base/content/contentAreaUtils.js
@@ -155,9 +155,9 @@ const kSaveAsType_Text = 2; // Save document, converting to plain text.
// - A linked document using Save Link As...
// - A linked document using Alt-click Save Link As...
//
-function saveURL(aURL, aFileName, aFilePickerTitleKey, aShouldBypassCache, aSkipPrompt)
+function saveURL(aURL, aFileName, aFilePickerTitleKey, aShouldBypassCache, aSkipPrompt, aReferrer)
{
- saveInternal(aURL, null, aFileName, aFilePickerTitleKey, aShouldBypassCache, aSkipPrompt);
+ saveInternal(aURL, null, aFileName, aFilePickerTitleKey, aShouldBypassCache, aSkipPrompt, aReferrer);
}
function saveDocument(aDocument, aSkipPrompt)
@@ -172,7 +172,8 @@ function saveDocument(aDocument, aSkipPrompt)
function saveInternal(aURL, aDocument,
aFileName, aFilePickerTitleKey,
- aShouldBypassCache, aSkipPrompt)
+ aShouldBypassCache, aSkipPrompt,
+ aReferrer)
{
if (aSkipPrompt == undefined)
aSkipPrompt = false;
@@ -183,7 +184,8 @@ function saveInternal(aURL, aDocument,
filePickerTitle: aFilePickerTitleKey,
document: aDocument,
bypassCache: aShouldBypassCache,
- window: window
+ window: window,
+ referrer: aReferrer
};
var sniffer = new nsHeaderSniffer(aURL, foundHeaderInfo, data, aSkipPrompt);
}
@@ -292,7 +294,8 @@ function foundHeaderInfo(aSniffer, aData, aSkipPrompt)
persistArgs.contentType, encodingFlags, kWrapColumn);
} else {
dl.init(source, persistArgs.target, null, null, null, persist);
- persist.saveURI(source, null, getReferrer(document), persistArgs.postData, null, persistArgs.target);
+ var referrer = aData.referrer || getReferrer(document)
+ persist.saveURI(source, null, referrer, persistArgs.postData, null, persistArgs.target);
}
}
diff --git a/browser/base/content/pageInfo.js b/browser/base/content/pageInfo.js
index 1b5e6d810a7..b33b98d7085 100644
--- a/browser/base/content/pageInfo.js
+++ b/browser/base/content/pageInfo.js
@@ -706,16 +706,6 @@ function onBeginLinkDrag(event,urlField,descField)
}
//******** Image Stuff
-function getSource(item)
-{
- // Return the correct source without strict warnings
- if ("href" in item && item.href)
- return item.href;
- if ("src" in item && item.src)
- return item.src;
- return null;
-}
-
function getSelectedImage(tree)
{
if (!imageView.rowCount) return null;
@@ -730,10 +720,10 @@ function saveMedia()
{
var tree = document.getElementById("imagetree");
var item = getSelectedImage(tree);
- var url = getAbsoluteURL(getSource(item), item);
+ var url = imageView.data[tree.currentIndex][0];
if (url)
- saveURL(url, null, 'SaveImageTitle', false );
+ saveURL(url, null, 'SaveImageTitle', false, false, makeURL(item.baseURI));
}
function onImageSelect()
diff --git a/xpfe/browser/resources/content/pageInfo.js b/xpfe/browser/resources/content/pageInfo.js
index 523492a8bd1..9c6e34c55b1 100644
--- a/xpfe/browser/resources/content/pageInfo.js
+++ b/xpfe/browser/resources/content/pageInfo.js
@@ -715,16 +715,6 @@ function onBeginLinkDrag(event,urlField,descField)
}
//******** Image Stuff
-function getSource(item)
-{
- // Return the correct source without strict warnings
- if ("href" in item && item.href)
- return item.href;
- if ("src" in item && item.src)
- return item.src;
- return null;
-}
-
function getSelectedImage(tree)
{
if (!imageView.rowCount) return null;
@@ -739,10 +729,10 @@ function saveMedia()
{
var tree = document.getElementById("imagetree");
var item = getSelectedImage(tree);
- var url = getAbsoluteURL(getSource(item), item);
+ var url = imageView.data[tree.currentIndex][0];
if (url)
- saveURL(url, null, 'SaveImageTitle', false );
+ saveURL(url, null, 'SaveImageTitle', false, makeURI(item.baseURI));
}
function onImageSelect()
diff --git a/xpfe/browser/resources/content/pageInfo.xul b/xpfe/browser/resources/content/pageInfo.xul
index 1aa217c4908..252b929d018 100644
--- a/xpfe/browser/resources/content/pageInfo.xul
+++ b/xpfe/browser/resources/content/pageInfo.xul
@@ -66,6 +66,7 @@
+
diff --git a/xpfe/communicator/resources/content/contentAreaUtils.js b/xpfe/communicator/resources/content/contentAreaUtils.js
index b8006dada3b..d26de59afa4 100644
--- a/xpfe/communicator/resources/content/contentAreaUtils.js
+++ b/xpfe/communicator/resources/content/contentAreaUtils.js
@@ -217,10 +217,10 @@ function findParentNode(node, parentNode)
// - A linked document using Save Link As...
// - A linked document using shift-click Save Link As...
//
-function saveURL(aURL, aFileName, aFilePickerTitleKey, aShouldBypassCache)
+function saveURL(aURL, aFileName, aFilePickerTitleKey, aShouldBypassCache, aReferrer)
{
internalSave(aURL, null, aFileName, aShouldBypassCache,
- aFilePickerTitleKey, null);
+ aFilePickerTitleKey, null, aReferrer);
}
function saveFrameDocument()
@@ -264,7 +264,7 @@ function saveDocument(aDocument)
* need to be prompted for a target filename.
*/
function internalSave(aURL, aDocument, aDefaultFileName, aShouldBypassCache,
- aFilePickerTitleKey, aChosenData)
+ aFilePickerTitleKey, aChosenData, aReferrer)
{
// Note: aDocument == null when this code is used by save-link-as...
var contentType = (aDocument ? aDocument.contentType : null);
@@ -368,7 +368,7 @@ function internalSave(aURL, aDocument, aDefaultFileName, aShouldBypassCache,
} else {
dl.init((aChosenData ? aChosenData.uri : source),
persistArgs.target, null, null, null, persist);
- var referer = getReferrer(document);
+ var referer = aReferrer || getReferrer(document);
persist.saveURI((aChosenData ? aChosenData.uri : source),
null, referer, persistArgs.postData, null, persistArgs.target);
}