зеркало из https://github.com/mozilla/gecko-dev.git
Fixing publishing to FTP URL, bug 177589
This commit is contained in:
Родитель
6865d45b89
Коммит
e6935a1f84
|
@ -45,8 +45,7 @@ var gPublishHandler = null;
|
||||||
|
|
||||||
/* Create an instance of the given ContractID, with given interface */
|
/* Create an instance of the given ContractID, with given interface */
|
||||||
function createInstance(contractId, intf) {
|
function createInstance(contractId, intf) {
|
||||||
return Components.classes[contractId]
|
return Components.classes[contractId].createInstance(Components.interfaces[intf]);
|
||||||
.createInstance(Components.interfaces[intf]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -88,25 +87,26 @@ function calendarPublish(aDataString, newLocation, fileName, login, password, co
|
||||||
// XXX WARNING: I DIDN'T TEST THIS!!!!!
|
// XXX WARNING: I DIDN'T TEST THIS!!!!!
|
||||||
function calendarUploadFile(aSourceFilename, newLocation, fileName, login, password, contentType)
|
function calendarUploadFile(aSourceFilename, newLocation, fileName, login, password, contentType)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var protocolChannel = get_destination_channel(newLocation, fileName, login, password);
|
var protocolChannel = get_destination_channel(newLocation, fileName, login, password);
|
||||||
if (!protocolChannel)
|
|
||||||
{
|
if (!protocolChannel)
|
||||||
dump("failed to get a destination channel\n");
|
{
|
||||||
return;
|
dump("failed to get a destination channel\n");
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//void setUploadFile(in nsIFile file, in string contentType, in long contentLength);
|
//void setUploadFile(in nsIFile file, in string contentType, in long contentLength);
|
||||||
|
|
||||||
output_file_to_channel(protocolChannel, aSourceFilename, contentType);
|
output_file_to_channel(protocolChannel, aSourceFilename, contentType);
|
||||||
protocolChannel.asyncOpen(gPublishingListener, null);
|
protocolChannel.asyncOpen(gPublishingListener, null);
|
||||||
dump("done\n");
|
dump("done\n");
|
||||||
}
|
}
|
||||||
catch (e)
|
catch (e)
|
||||||
{
|
{
|
||||||
alert("an error occurred: " + e + "\n");
|
alert("an error occurred: " + e + "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ function get_destination_channel(destinationDirectoryLocation, fileName, login,
|
||||||
}
|
}
|
||||||
catch( e )
|
catch( e )
|
||||||
{
|
{
|
||||||
alert( e );
|
//alert( e );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (httpChannel)
|
if (httpChannel)
|
||||||
|
@ -169,7 +169,7 @@ function get_destination_channel(destinationDirectoryLocation, fileName, login,
|
||||||
dump("http channel found\n");
|
dump("http channel found\n");
|
||||||
return httpChannel;
|
return httpChannel;
|
||||||
}
|
}
|
||||||
var ftpChannel = destChannel.QueryInterface(Components.interfaces.nsIFtpChannel);
|
var ftpChannel = destChannel.QueryInterface(Components.interfaces.nsIFTPChannel);
|
||||||
if (ftpChannel) dump("ftp channel found\n");
|
if (ftpChannel) dump("ftp channel found\n");
|
||||||
if (ftpChannel)
|
if (ftpChannel)
|
||||||
return ftpChannel;
|
return ftpChannel;
|
||||||
|
|
|
@ -45,8 +45,7 @@ var gPublishHandler = null;
|
||||||
|
|
||||||
/* Create an instance of the given ContractID, with given interface */
|
/* Create an instance of the given ContractID, with given interface */
|
||||||
function createInstance(contractId, intf) {
|
function createInstance(contractId, intf) {
|
||||||
return Components.classes[contractId]
|
return Components.classes[contractId].createInstance(Components.interfaces[intf]);
|
||||||
.createInstance(Components.interfaces[intf]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -88,25 +87,26 @@ function calendarPublish(aDataString, newLocation, fileName, login, password, co
|
||||||
// XXX WARNING: I DIDN'T TEST THIS!!!!!
|
// XXX WARNING: I DIDN'T TEST THIS!!!!!
|
||||||
function calendarUploadFile(aSourceFilename, newLocation, fileName, login, password, contentType)
|
function calendarUploadFile(aSourceFilename, newLocation, fileName, login, password, contentType)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var protocolChannel = get_destination_channel(newLocation, fileName, login, password);
|
var protocolChannel = get_destination_channel(newLocation, fileName, login, password);
|
||||||
if (!protocolChannel)
|
|
||||||
{
|
if (!protocolChannel)
|
||||||
dump("failed to get a destination channel\n");
|
{
|
||||||
return;
|
dump("failed to get a destination channel\n");
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//void setUploadFile(in nsIFile file, in string contentType, in long contentLength);
|
//void setUploadFile(in nsIFile file, in string contentType, in long contentLength);
|
||||||
|
|
||||||
output_file_to_channel(protocolChannel, aSourceFilename, contentType);
|
output_file_to_channel(protocolChannel, aSourceFilename, contentType);
|
||||||
protocolChannel.asyncOpen(gPublishingListener, null);
|
protocolChannel.asyncOpen(gPublishingListener, null);
|
||||||
dump("done\n");
|
dump("done\n");
|
||||||
}
|
}
|
||||||
catch (e)
|
catch (e)
|
||||||
{
|
{
|
||||||
alert("an error occurred: " + e + "\n");
|
alert("an error occurred: " + e + "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ function get_destination_channel(destinationDirectoryLocation, fileName, login,
|
||||||
}
|
}
|
||||||
catch( e )
|
catch( e )
|
||||||
{
|
{
|
||||||
alert( e );
|
//alert( e );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (httpChannel)
|
if (httpChannel)
|
||||||
|
@ -169,7 +169,7 @@ function get_destination_channel(destinationDirectoryLocation, fileName, login,
|
||||||
dump("http channel found\n");
|
dump("http channel found\n");
|
||||||
return httpChannel;
|
return httpChannel;
|
||||||
}
|
}
|
||||||
var ftpChannel = destChannel.QueryInterface(Components.interfaces.nsIFtpChannel);
|
var ftpChannel = destChannel.QueryInterface(Components.interfaces.nsIFTPChannel);
|
||||||
if (ftpChannel) dump("ftp channel found\n");
|
if (ftpChannel) dump("ftp channel found\n");
|
||||||
if (ftpChannel)
|
if (ftpChannel)
|
||||||
return ftpChannel;
|
return ftpChannel;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче