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

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

Issue 29863604: Issue 6865 - Update ABP dependency to version 3.2 (Closed)
Patch Set: Adjusting code style Created Jan. 16, 2019, 1:45 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 "use strict"; 1 "use strict";
2 2
3 Components.utils.import("resource://gre/modules/Messaging.jsm");
4
3 this.runtime = class extends ExtensionAPI { 5 this.runtime = class extends ExtensionAPI {
4 getAPI(context) { 6 getAPI(context) {
5 let {extension} = context; 7 let {extension} = context;
6 8
7 return { 9 return {
8 runtime: { 10 runtime: {
11
12 // Added functions in order to make possible the communication between
13 // the Android part and the extension.
14 // See https://issues.adblockplus.org/ticket/6865
15 registerAbbMessageListener: function(listener) {
16 EventDispatcher.instance.registerListener((event, data, callback) =>
17 {
18 let result = context.runSafe(listener, data);
19 if (result["success"]) {
20 callback.onSuccess(result);
21 } else {
22 let errorMsg = result["error"] ? result["error"] : "An error has o curred";
23 callback.onError(errorMsg);
24 }
25 }, "Abb:Api");
26 },
27 sendAbbMessage: function(type) {
28 EventDispatcher.instance.sendRequest({"type": "Abb:" + type});
29 },
30
9 onConnect: context.messenger.onConnect("runtime.onConnect"), 31 onConnect: context.messenger.onConnect("runtime.onConnect"),
10 32
11 onMessage: context.messenger.onMessage("runtime.onMessage"), 33 onMessage: context.messenger.onMessage("runtime.onMessage"),
12 34
13 onConnectExternal: context.messenger.onConnectExternal("runtime.onConnec tExternal"), 35 onConnectExternal: context.messenger.onConnectExternal("runtime.onConnec tExternal"),
14 36
15 onMessageExternal: context.messenger.onMessageExternal("runtime.onMessag eExternal"), 37 onMessageExternal: context.messenger.onMessageExternal("runtime.onMessag eExternal"),
16 38
17 connect: function(extensionId, connectInfo) { 39 connect: function(extensionId, connectInfo) {
18 let name = (connectInfo !== null && connectInfo.name) || ""; 40 let name = (connectInfo !== null && connectInfo.name) || "";
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 142
121 id: extension.id, 143 id: extension.id,
122 144
123 getURL: function(url) { 145 getURL: function(url) {
124 return extension.baseURI.resolve(url); 146 return extension.baseURI.resolve(url);
125 }, 147 },
126 }, 148 },
127 }; 149 };
128 } 150 }
129 }; 151 };
OLDNEW
« no previous file with comments | « mobile/android/chrome/content/browser.js ('k') | toolkit/components/extensions/schemas/runtime.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld