nsIAdblockPlus
General notes
This interface can be used from other extensions that wish to integrate with Adblock Plus. It allows to manage external subscriptions for example. You can check whether this interface is available with the following code:
if ("@mozilla.org/adblockplus;1" in Components.classes) {
...
}
To get an instance of this interface, use the following:
abp = Components.classes["@mozilla.org/adblockplus;1"]
.createInstance().wrappedJSObject;
Methods and properties
- void addPatterns ( arrayof wstring patterns, PRUInt32 length )
- void allowOnce ( wstring address )
- AString getInstalledVersion ( )
- nsIAdblockPlusSubscription getSubscription ( AString id )
- nsIAdblockPlusSubscription getSubscriptionAt ( PRInt32 index )
- boolean removeExternalSubscription ( AString id )
- AString removePatterns ( arrayof wstring patterns, PRUInt32 length )
- readonly PRInt32 subscriptionCount
- boolean updateExternalSubscription ( AString id, AUTF8String title, arrayof wstring patterns, PRUInt32 length )
![]()
readonly PRInt32 subscriptionCount
Number of subscriptions in the list (including special subscriptions)
![]()
nsIAdblockPlusSubscription getSubscription ( AString id )
Retrieves a subscription by its identifier
- Arguments:
- id: subscription’s identifier (this is subscription’s URL for regular subscriptions)
- Returns:
- the requested subscription or null if no subscription with the given identifier exists
![]()
nsIAdblockPlusSubscription getSubscriptionAt ( PRInt32 index )
Retrieves a subscription by its position in the list
- Arguments:
- index: subscription’s position in the list, zero-based
- Returns:
- the requested subscription or null if the index provided is invalid
![]()
boolean updateExternalSubscription ( AString id, AUTF8String title, arrayof wstring patterns, PRUInt32 length )
Updates an external subscription (or creates it if no such subscription currently exists)
- Arguments:
- id: subscription’s identifier (for external subscriptions this can be any string)
- title: subscription title to be used if a new subscription is created. This parameter will be ignored if the subscription already exists.
- patterns: list of filter patterns that the subscription should contain
- length: length of the patterns list
- Returns:
- true if the subscription has been successfully created/updates, false if the subscription already exists but it isn’t managed externally
![]()
boolean removeExternalSubscription ( AString id )
Removes an external subscription
- Arguments:
- id: subscription’s identifier (for external subscriptions this can be any string)
- Returns:
- true if the subscription has been successfully removed, false if no such subscription exists or the subscription isn’t managed externally
![]()
void addPatterns ( arrayof wstring patterns, PRUInt32 length )
Adds patterns to the list of user-defined filters
- Version:
- 0.7.2.3 and higher
- Arguments:
- patterns: list of filter patterns to be added
- length: length of the patterns list
![]()
void removePatterns ( arrayof wstring patterns, PRUInt32 length )
Removes patterns from the list of user-defined filters
- Version:
- 0.7.2.3 and higher
- Arguments:
- patterns: list of filter patterns to be removed
- length: length of the patterns list
![]()
void allowOnce ( wstring address )
Signal the content policy that the next request for the given address should be allowed regardless the filters. No processing of the request will be done, and it won’t be registered for the list of blockable items. Next request for the same address will be processed in the usual way.
Note that the request should follow immediately because the next allowOnce() call will override the setting.
- Version:
- 0.7.2.4 and higher
- Arguments:
- address: address of the request to be permitted (instead of jar:, view-source: and wyciwyg: URLs the address of the actual file should be used – as shown in the list of blockable items)
![]()
AString getInstalledVersion ( )
Retrieves the version of the installed Adblock Plus extension. Note that this is the version number as reported by the extension manager or InstallTrigger and it might be incorrect if the latter is used (in Mozilla Suite or SeaMonkey).
- Returns:
- Adblock Plus version, for example 0.7.0.1
