Index: adblockplus/Api.jsm |
diff --git a/adblockplus/Api.jsm b/adblockplus/Api.jsm |
index 73a832f84b01831af6f649e760a465f46e9ac477..4d0de801f630c90cb78a8bd25ecbfcbac01bf5eb 100644 |
--- a/adblockplus/Api.jsm |
+++ b/adblockplus/Api.jsm |
@@ -94,7 +94,8 @@ var AdblockPlusApi = |
addSubscription: function(url, title) |
{ |
let subscription = Subscription.fromURL(url); |
- subscription.title = title; |
+ if (title) |
+ subscription.title = title; |
FilterStorage.addSubscription(subscription); |
if (!subscription.lastDownload) |
{ |
@@ -106,6 +107,16 @@ var AdblockPlusApi = |
FilterStorage.removeSubscription( |
FilterStorage.knownSubscriptions[url]); |
}, |
+ getActiveSubscriptions: function() |
+ { |
+ let subscriptions = []; |
+ for (let i = 0; i < FilterStorage.subscriptions.length; i++) |
+ { |
+ let subscription = FilterStorage.subscriptions[i]; |
+ subscriptions.push({"title": subscription.title, "url": subscription.url}); |
+ } |
+ return subscriptions; |
+ }, |
isLocal: function(url) |
{ |
let uriObject = Services.io.newURI(url, null, null); |
@@ -169,6 +180,8 @@ var AdblockPlusApi = |
break; |
case "getSubscriptionsXml": |
return {"success": true, "value": this.subscriptionsXml}; |
+ case "getActiveSubscriptions": |
+ return {"success": true, "value": this.getActiveSubscriptions()}; |
case "isSubscriptionListed": |
if ("url" in data) |
{ |
@@ -177,7 +190,7 @@ var AdblockPlusApi = |
} |
break; |
case "addSubscription": |
- if ("url" in data && "title" in data) |
+ if ("url" in data) |
{ |
this.addSubscription(data["url"], data["title"]); |
return {"success": true}; |