зеркало из https://github.com/mozilla/gecko-dev.git
Bug #236774 --> port thunderbird change to the compose window to make it handle mailto url arguments.
r=neil sr=bienvenu
This commit is contained in:
Родитель
b36d2ce97c
Коммит
6e8a3b475e
|
@ -1135,6 +1135,23 @@ function ComposeFieldsReady(msgType)
|
|||
AdjustFocus();
|
||||
}
|
||||
|
||||
// checks if the passed in string is a mailto url, if it is, generates nsIMsgComposeParams
|
||||
// for the url and returns them.
|
||||
function handleMailtoArgs(mailtoUrl)
|
||||
{
|
||||
// see if the string is a mailto url....do this by checking the first 7 characters of the string
|
||||
if (/^mailto:/i.test(mailtoUrl))
|
||||
{
|
||||
// if it is a mailto url, turn the mailto url into a MsgComposeParams object....
|
||||
var uri = gIOService.newURI(mailtoUrl, null, null);
|
||||
|
||||
if (uri)
|
||||
return sMsgComposeService.getParamsForMailto(uri);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function ComposeStartup(recycled, aParams)
|
||||
{
|
||||
var params = null; // New way to pass parameters to the compose window as a nsIMsgComposeParameters object
|
||||
|
@ -1148,12 +1165,20 @@ function ComposeStartup(recycled, aParams)
|
|||
else
|
||||
if (window.arguments && window.arguments[0]) {
|
||||
try {
|
||||
params = window.arguments[0].QueryInterface(Components.interfaces.nsIMsgComposeParams);
|
||||
if (window.arguments[0] instanceof Components.interfaces.nsIMsgComposeParams)
|
||||
params = window.arguments[0];
|
||||
else
|
||||
params = handleMailtoArgs(window.arguments[0]);
|
||||
}
|
||||
catch(ex) { dump("ERROR with parameters: " + ex + "\n"); }
|
||||
|
||||
// if still no dice, try and see if the params is an old fashioned list of string attributes
|
||||
// XXX can we get rid of this yet?
|
||||
if (!params)
|
||||
{
|
||||
args = GetArgs(window.arguments[0]);
|
||||
}
|
||||
}
|
||||
|
||||
var identityList = document.getElementById("msgIdentity");
|
||||
var identityListPopup = document.getElementById("msgIdentityPopup");
|
||||
|
|
Загрузка…
Ссылка в новой задаче