bug 239472: Page Info -> media -> Save As... doesn't work

r=db48x, sr=jag
This commit is contained in:
db48x%yahoo.com 2004-10-26 06:59:57 +00:00
Родитель b2cb31e2e6
Коммит 0592129ac1
5 изменённых файлов: 17 добавлений и 33 удалений

Просмотреть файл

@ -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);
}
}

Просмотреть файл

@ -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()

Просмотреть файл

@ -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()

Просмотреть файл

@ -66,6 +66,7 @@
<script type="application/x-javascript" src="chrome://communicator/content/contentAreaUtils.js"/>
<script type="application/x-javascript" src="chrome://communicator/content/utilityOverlay.js"/>
<script type="application/x-javascript" src="chrome://navigator/content/pageInfo.js"/>
<script type="application/x-javascript" src="chrome://global/content/XPCNativeWrapper.js"/>
<script type="application/x-javascript" src="chrome://help/content/contextHelp.js"/>
<keyset>

Просмотреть файл

@ -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);
}