Register/unregister the protocol handlers automatically based on the preferences (can be tested in about:config).

Added handlers for the protocols that the phone understands.
This commit is contained in:
amla70
2010-08-01 18:33:04 +00:00
parent b829d718ea
commit 7f3f413fcb
7 changed files with 160 additions and 99 deletions

View File

@@ -153,18 +153,16 @@ var sendtophoneCore = {
this.init();
// Send the protocols that aren't currently whitelisted through a proxy server
if ((/^(market|tel|sms|ftp):/i).test( url ))
{
var encodedUri = encodeURIComponent( url);
if (!(/^(https?):/i).test( url ))
{
var prefs = Cc["@mozilla.org/preferences-service;1"]
.getService(Ci.nsIPrefService)
.getBranch("extensions.sendtophone.") ;
// Rewrite the URI so it's send first to the proxy
var proxyUrl = prefs.getCharPref( "proxyUrl" ) ;
// rewrite the URI so it's send first to the proxy
url = proxyUrl + encodedUri;
if (proxyUrl)
url = proxyUrl + encodeURIComponent( url);
}
var data = 'title=' + encodeURIComponent(title) +