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

Unified Diff: toolkit/components/extensions/ext-c-runtime.js

Issue 29863604: Issue 6865 - Update ABP dependency to version 3.2 (Closed)
Patch Set: Adjusting build script and removing extension first run page Created Jan. 8, 2019, 2:54 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
Index: toolkit/components/extensions/ext-c-runtime.js
===================================================================
--- a/toolkit/components/extensions/ext-c-runtime.js
+++ b/toolkit/components/extensions/ext-c-runtime.js
@@ -1,16 +1,38 @@
"use strict";
+Components.utils.import("resource://gre/modules/Messaging.jsm");
+
this.runtime = class extends ExtensionAPI {
getAPI(context) {
let {extension} = context;
return {
runtime: {
+
+ // Added functions in order to make possible the communication between
+ // the Android part and the extension.
+ // See https://issues.adblockplus.org/ticket/6865
+ registerAbbMessageListener: function(listener) {
+ EventDispatcher.instance.registerListener((event, data, callback) =>
+ {
+ let result = context.runSafe(listener, data);
+ if (result["success"]) {
+ callback.onSuccess(result);
+ } else {
+ let errorMsg = result["error"] ? result["error"] : "An error has ocurred";
+ callback.onError(errorMsg);
+ }
+ }, "Abb:Api");
+ },
+ sendAbbMessage: function(type) {
+ EventDispatcher.instance.sendRequest({"type": "Abb:" + type});
+ },
+
onConnect: context.messenger.onConnect("runtime.onConnect"),
onMessage: context.messenger.onMessage("runtime.onMessage"),
onConnectExternal: context.messenger.onConnectExternal("runtime.onConnectExternal"),
onMessageExternal: context.messenger.onMessageExternal("runtime.onMessageExternal"),

Powered by Google App Engine
This is Rietveld