Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: messageResponder.js

Issue 6432313504169984: Issue 1663 - Various Firefox-related changes of the first-run page (Closed)
Patch Set: Created Jan. 6, 2015, 10:19 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « i18n.js ('k') | utils.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: messageResponder.js
===================================================================
--- a/messageResponder.js
+++ b/messageResponder.js
@@ -12,16 +12,31 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
*/
(function(global)
{
+ if (typeof ext == "undefined")
+ global.ext = require("ext_background");
+
+ var Utils = require("utils").Utils;
+ var FilterStorage = require("filterStorage").FilterStorage;
+ var FilterNotifier = require("filterNotifier").FilterNotifier;
+ var defaultMatcher = require("matcher").defaultMatcher;
+ var BlockingFilter = require("filterClasses").BlockingFilter;
+ var Synchronizer = require("synchronizer").Synchronizer;
+
+ var subscriptionClasses = require("subscriptionClasses");
+ var Subscription = subscriptionClasses.Subscription;
+ var DownloadableSubscription = subscriptionClasses.DownloadableSubscription;
+ var SpecialSubscription = subscriptionClasses.SpecialSubscription;
+
var subscriptionKeys = ["disabled", "homepage", "lastSuccess", "title", "url", "downloadStatus"];
function convertSubscription(subscription)
{
var result = {};
for (var i = 0; i < subscriptionKeys.length; i++)
result[subscriptionKeys[i]] = subscription[subscriptionKeys[i]]
return result;
}
@@ -69,17 +84,17 @@
type: messageTypes[type],
action: action,
args: args
});
}
}
};
- ext.onMessage.addListener(function(message, sender, callback)
+ global.ext.onMessage.addListener(function(message, sender, callback)
{
switch (message.type)
{
case "app.get":
if (message.what == "issues")
{
var info = require("info");
callback({
@@ -88,26 +103,33 @@
legacySafariVersion: (info.platform == "safari" && (
Services.vc.compare(info.platformVersion, "6.0") < 0 || // beforeload breaks websites in Safari 5
Services.vc.compare(info.platformVersion, "6.1") == 0 || // extensions are broken in 6.1 and 7.0
Services.vc.compare(info.platformVersion, "7.0") == 0))
});
}
else if (message.what == "doclink")
callback(Utils.getDocLink(message.link));
+ else if (message.what == "localeInfo")
+ {
+ callback({
+ locale: Utils.appLocale,
+ isRTL: Utils.chromeRegistry.isLocaleRTL("adblockplus")
+ });
+ }
else
callback(null);
break;
case "app.open":
if (message.what == "options")
{
- if (typeof UI != "undefined")
- UI.openFiltersDialog();
+ if (typeof global.openOptions == "function")
+ global.openOptions();
else
- global.openOptions();
+ require("ui").UI.openFiltersDialog();
}
break;
case "subscriptions.get":
var subscriptions = FilterStorage.subscriptions.filter(function(s)
{
if (message.ignoreDisabled && s.disabled)
return false;
if (s instanceof DownloadableSubscription && message.downloadable)
« no previous file with comments | « i18n.js ('k') | utils.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld