Permalink
Browse files

abp: 1893, 1896: Make errors.html show Adblock Plus version and sourc…

…e code revision
  • Loading branch information...
lovelywcm committed Jun 15, 2010
1 parent 47e2d13 commit 59a494e90733975e9568da8608f20bed23ff0db9
Showing with 51 additions and 21 deletions.
  1. +24 −19 IAutoProxy.idl
  2. +7 −0 Packager.pm
  3. +12 −2 chrome/content/errors.html
  4. +8 −0 components/AutoProxy.js
View
@@ -29,61 +29,61 @@ interface IAutoProxySubscription: nsISupports
{
/**
* Subscription identifier, this is its URL unless the attribute external is set
*/
*/
readonly attribute AString url;
/**
* true for special "subscriptions" representing segments of the user patterns
* list (e.g. ~wl~ contains whitelisting patterns)
*/
*/
readonly attribute boolean special;
/**
* Subscription's title
*/
*/
readonly attribute AUTF8String title;
/**
* Defines whether the subscription is downloaded automatically
*/
*/
readonly attribute boolean autoDownload;
/**
* Defines whether the subscription's patterns are disabled
*/
*/
readonly attribute boolean disabled;
/**
* Defines whether the subscription is managed externally rather than
* downloaded by the built-in synchronizer
*/
*/
readonly attribute boolean external;
/**
* Time of the last download attempt in seconds since 1 January 1970 00:00:00
*/
*/
readonly attribute unsigned long lastDownload;
/**
* Code for the result of the last download attempt (one of "synchronize_ok",
* "synchronize_invalid_url", "synchronize_connection_error", "synchronize_invalid_data")
*/
*/
readonly attribute AString downloadStatus;
/**
* Value of the Last-Modified header for the last download
*/
*/
readonly attribute AString lastModified;
/**
* Expiration time of the subscription (value of the Expires header but no more than two weeks
* after the download) for the last download in seconds since 1 January 1970 00:00:00
*/
*/
readonly attribute unsigned long expires;
/**
* Retrieves a list of subscription's patterns
*/
*/
void getPatterns(out unsigned long length,
[retval, array, size_is(length)] out wstring patterns);
};
@@ -93,21 +93,21 @@ interface IAutoProxy : nsISupports
{
/**
* Number of subscriptions in the list
*/
*/
readonly attribute PRInt32 subscriptionCount;
/**
* Retrieves a subscription by its identifier.
*
* @param id subscription identifier
*/
*/
IAutoProxySubscription getSubscription(in AString id);
/**
* Retrieves a subscription by its position in the list.
*
* @param index index of the subscription in the list
*/
*/
IAutoProxySubscription getSubscriptionAt(in PRInt32 index);
/**
@@ -121,7 +121,7 @@ interface IAutoProxy : nsISupports
* @param length length of patterns array
* @return true if the subscription was updated or false if the
* update failed
*/
*/
boolean updateExternalSubscription(in AString id, in AUTF8String title,
[array, size_is(length), const] in wstring patterns,
in unsigned long length);
@@ -132,27 +132,32 @@ interface IAutoProxy : nsISupports
* @param id subscription identifier
* @return true if the subscription was removed or false if no
* external subscription with the given identifier was found
*/
*/
boolean removeExternalSubscription(in AString id);
/**
* Adds user-defined patterns to the filter list.
*
* @param patterns array of patterns to be added
* @param length length of the patterns array
*/
*/
void addPatterns([array, size_is(length)] in wstring patterns, in unsigned long length);
/**
* Removes user-defined patterns from the filter list.
*
* @param patterns array of patterns to be removed
* @param length length of the patterns array
*/
*/
void removePatterns([array, size_is(length)] in wstring patterns, in unsigned long length);
/**
* Returns the installed version of AutoProxy.
*/
*/
AString getInstalledVersion();
/**
* Returns source code revision this Adblock Plus build was created from (if available)
*/
AString getInstalledBuild();
};
View
@@ -7,6 +7,12 @@ sub new
{
my ($class, $params) = @_;
unless (exists($params->{build}))
{
$params->{build} = `hg id -i`;
$params->{build} =~ s/\W//gs;
}
my $self = bless($params, $class);
return $self;
@@ -88,6 +94,7 @@ sub cp
s/\r//g;
s/^((?: )+)/"\t" x (length($1)\/2)/e;
s/\{\{VERSION\}\}/$self->{version}/g if $extendedTextMode;
s/\{\{BUILD\}\}/$self->{build}/g if $extendedTextMode;
if ($extendedTextMode && /\{\{LOCALE\}\}/)
{
my $loc = "";
View
@@ -22,6 +22,16 @@
</head>
<body>
<script type="application/x-javascript;version=1.7">
try {
let aup = Components.classes["@mozilla.org/autoproxy;1"].createInstance().wrappedJSObject;
let text = "You are running AutoProxy " + aup.getInstalledVersion();
let build = aup.getInstalledBuild();
if (build)
text += ", build " + build;
text += ".";
document.write("<p>" + text + "</p>");
} catch (e) {}
let messages = {};
Components.classes["@mozilla.org/consoleservice;1"]
.getService(Components.interfaces.nsIConsoleService)
@@ -36,7 +46,7 @@
if (messages.length)
{
document.write("Errors related to AutoProxy:");
document.write("<p>Errors related to AutoProxy:</p>");
for each (let message in messages)
{
@@ -55,7 +65,7 @@
}
else
{
document.write("No errors found.");
document.write("<p>No errors found.</p>");
}
function encodeHTML(string)
View
@@ -279,6 +279,14 @@ const aup =
return "{{VERSION}}";
},
/**
* Returns source code revision this AutoProxy build was created from (if available)
*/
getInstalledBuild: function() /**String*/
{
return "{{BUILD}}";
},
//
// Custom methods
//

0 comments on commit 59a494e

Please sign in to comment.