зеркало из https://github.com/mozilla/gecko-dev.git
Bug 853716 - Let the SMS protocol handler deal with sms: url without numbers r=baku
This commit is contained in:
Родитель
04b7882c04
Коммит
d07a1aacd7
|
@ -42,11 +42,24 @@ SmsProtocolHandler.prototype = {
|
|||
|
||||
newChannel: function Proto_newChannel(aURI) {
|
||||
let number = TelURIParser.parseURI('sms', aURI.spec);
|
||||
let body = "";
|
||||
let query = aURI.spec.split("?")[1];
|
||||
|
||||
if (number) {
|
||||
if (query) {
|
||||
let params = query.split("&");
|
||||
params.forEach(function(aParam) {
|
||||
let [name, value] = aParam.split("=");
|
||||
if (name === "body") {
|
||||
body = decodeURIComponent(value);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if (number || body) {
|
||||
cpmm.sendAsyncMessage("sms-handler", {
|
||||
number: number,
|
||||
type: "websms/sms" });
|
||||
number: number || "",
|
||||
type: "websms/sms",
|
||||
body: body });
|
||||
}
|
||||
|
||||
throw Components.results.NS_ERROR_ILLEGAL_VALUE;
|
||||
|
|
Загрузка…
Ссылка в новой задаче