Bug 1058251 - Make "Save As" work in e10s without "Web Page, complete" mode. r=mconley f=paolo

--HG--
extra : amend_source : 6185bb1dd3e503c46ee2b452b36b64813fd2dc3a
This commit is contained in:
Jed Davis 2014-11-18 11:35:47 -08:00
Родитель 8743b6bd68
Коммит e137fa09a7
4 изменённых файлов: 30 добавлений и 28 удалений

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

@ -22,7 +22,7 @@
<command id="cmd_newNavigatorTab" oncommand="BrowserOpenNewTabOrWindow(event);"/>
<command id="Browser:OpenFile" oncommand="BrowserOpenFileWindow();"/>
<command id="Browser:SavePage" oncommand="saveDocument(window.content.document);"/>
<command id="Browser:SavePage" oncommand="saveDocument(gBrowser.selectedBrowser.contentDocumentAsCPOW);"/>
<command id="Browser:SendLink"
oncommand="MailIntegration.sendLinkForWindow(window.content);"/>

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

@ -1743,7 +1743,7 @@ function HandleAppCommandEvent(evt) {
gBrowser.selectedBrowser);
break;
case "Save":
saveDocument(window.content.document);
saveDocument(gBrowser.selectedBrowser.contentDocumentAsCPOW);
break;
case "SendMail":
MailIntegration.sendLinkForWindow(window.content);

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

@ -308,7 +308,7 @@ const CustomizableWidgets = [
aEvent.target.ownerDocument &&
aEvent.target.ownerDocument.defaultView;
if (win && typeof win.saveDocument == "function") {
win.saveDocument(win.content.document);
win.saveDocument(win.gBrowser.selectedBrowser.contentDocumentAsCPOW);
}
}
}, {

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

@ -713,31 +713,34 @@ function appendFiltersForContentType(aFilePicker, aContentType, aFileExtension,
// The corresponding filter string for a specific content type.
var filterString;
// XXX all the cases that are handled explicitly here MUST be handled
// in GetSaveModeForContentType to return a non-fileonly filter.
switch (aContentType) {
case "text/html":
bundleName = "WebPageHTMLOnlyFilter";
filterString = "*.htm; *.html";
break;
// Every case where GetSaveModeForContentType can return non-FILEONLY
// modes must be handled here.
if (aSaveMode != SAVEMODE_FILEONLY) {
switch (aContentType) {
case "text/html":
bundleName = "WebPageHTMLOnlyFilter";
filterString = "*.htm; *.html";
break;
case "application/xhtml+xml":
bundleName = "WebPageXHTMLOnlyFilter";
filterString = "*.xht; *.xhtml";
break;
case "application/xhtml+xml":
bundleName = "WebPageXHTMLOnlyFilter";
filterString = "*.xht; *.xhtml";
break;
case "image/svg+xml":
bundleName = "WebPageSVGOnlyFilter";
filterString = "*.svg; *.svgz";
break;
case "image/svg+xml":
bundleName = "WebPageSVGOnlyFilter";
filterString = "*.svg; *.svgz";
break;
case "text/xml":
case "application/xml":
bundleName = "WebPageXMLOnlyFilter";
filterString = "*.xml";
break;
case "text/xml":
case "application/xml":
bundleName = "WebPageXMLOnlyFilter";
filterString = "*.xml";
break;
}
}
default:
if (!bundleName) {
if (aSaveMode != SAVEMODE_FILEONLY)
throw "Invalid save mode for type '" + aContentType + "'";
@ -758,8 +761,6 @@ function appendFiltersForContentType(aFilePicker, aContentType, aFileExtension,
if (extString)
aFilePicker.appendFilter(mimeInfo.description, extString);
}
break;
}
if (aSaveMode & SAVEMODE_COMPLETE_DOM) {
@ -1063,8 +1064,9 @@ function getDefaultExtension(aFilename, aURI, aContentType)
function GetSaveModeForContentType(aContentType, aDocument)
{
// We can only save a complete page if we have a loaded document
if (!aDocument)
// We can only save a complete page if we have a loaded document,
// and it's not a CPOW -- nsWebBrowserPersist needs a real document.
if (!aDocument || Components.utils.isCrossProcessWrapper(aDocument))
return SAVEMODE_FILEONLY;
// Find the possible save modes using the provided content type