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

Delta Between Two Patch Sets: lib/child/actor.js

Issue 29362609: Issue 2879 - Restructure existing process script, split it up into multiple modules (Closed) Base URL: https://hg.adblockplus.org/elemhidehelper
Left Patch Set: Created Nov. 17, 2016, 8:36 a.m.
Right Patch Set: Fixed line length Created Dec. 1, 2016, 9:39 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | lib/child/bootstrap.js » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /* 1 /*
2 * This Source Code is subject to the terms of the Mozilla Public License 2 * This Source Code is subject to the terms of the Mozilla Public License
3 * version 2.0 (the "License"). You can obtain a copy of the License at 3 * version 2.0 (the "License"). You can obtain a copy of the License at
4 * http://mozilla.org/MPL/2.0/. 4 * http://mozilla.org/MPL/2.0/.
5 */ 5 */
6 6
7 "use strict"; 7 "use strict";
8 8
9 let console; 9 let console;
saroyanm 2016/11/22 14:58:31 Why do we load console ? Are we outputing/planing
Wladimir Palant 2016/11/24 14:16:29 We are not, this is a debugging helper. In fact, I
saroyanm 2016/11/24 17:46:10 Acknowledged.
10 try 10 try
11 { 11 {
12 // Gecko 44+ 12 // Gecko 44+
13 ({console} = Cu.import("resource://gre/modules/Console.jsm", {})); 13 ({console} = Cu.import("resource://gre/modules/Console.jsm", {}));
14 } 14 }
15 catch (e) 15 catch (e)
16 { 16 {
17 ({console} = Cu.import("resource://gre/modules/devtools/Console.jsm", {})); 17 ({console} = Cu.import("resource://gre/modules/devtools/Console.jsm", {}));
18 } 18 }
19 19
20 let DebuggerServer; 20 let DebuggerServer;
21 try 21 try
22 { 22 {
23 // Firefox 44+ 23 // Firefox 44+
24 let {require} = Cu.import("resource://devtools/shared/Loader.jsm", {}); 24 let {require} = Cu.import("resource://devtools/shared/Loader.jsm", {});
25 ({DebuggerServer} = require("devtools/server/main")); 25 ({DebuggerServer} = require("devtools/server/main"));
26 } 26 }
27 catch (e) 27 catch (e)
28 { 28 {
29 ({DebuggerServer} = Cu.import("resource://gre/modules/devtools/dbg-server.jsm" , {})); 29 ({DebuggerServer} = Cu.import("resource://gre/modules/devtools/dbg-server.jsm" , {}));
30 } 30 }
31 31
32 let {getNodeInfo} = require("./nodeInfo"); 32 let {getNodeInfo} = require("./nodeInfo");
33 33
34 function Actor(connection, tabActor)
35 {
36 }
37
38 Actor.prototype = {
39 requestTypes: {
40 nodeinfo: function(request, connection)
41 {
42 let nodeActor = connection.getActor(request.nodeActor);
43 return getNodeInfo(nodeActor ? nodeActor.rawNode : null);
44 }
45 }
46 };
47
34 let name = "elemhidehelper"; 48 let name = "elemhidehelper";
35 let actor = { 49 let actor = {
36 constructorFun: Actor, 50 constructorFun: Actor,
37 constructorName: name, 51 constructorName: name,
38 name: name 52 name: name
39 }; 53 };
40 54
41 DebuggerServer.addTabActor(actor, name); 55 DebuggerServer.addTabActor(actor, name);
42 onShutdown.add(() => 56 onShutdown.add(() =>
43 { 57 {
44 try 58 try
45 { 59 {
46 DebuggerServer.removeTabActor(actor); 60 DebuggerServer.removeTabActor(actor);
47 } 61 }
48 catch (e) 62 catch (e)
49 { 63 {
50 // The call above will throw in the content process despite succeeding, 64 // The call above will throw in the content process despite succeeding,
51 // see https://bugzilla.mozilla.org/show_bug.cgi?id=1189780. 65 // see https://bugzilla.mozilla.org/show_bug.cgi?id=1189780.
52 Cu.reportError(e); 66 Cu.reportError(e);
53 } 67 }
54 }); 68 });
55
56 function Actor(connection, tabActor)
saroyanm 2016/11/22 14:58:31 Detail: Why do we need this empty constructor ? At
saroyanm 2016/11/22 14:58:31 Detail: Maybe it's personal preference, but what a
Wladimir Palant 2016/11/24 14:16:29 Well, DebuggerServer.addTabActor() requires a cons
saroyanm 2016/11/24 17:46:10 Acknowledged.
57 {
58 }
59
60 Actor.prototype = {
61 requestTypes: {
62 nodeinfo: function(request, connection)
63 {
64 let nodeActor = connection.getActor(request.nodeActor);
65 return getNodeInfo(nodeActor ? nodeActor.rawNode: null);
saroyanm 2016/11/22 14:58:31 Detail: missing space after first expression.
Wladimir Palant 2016/11/24 14:16:29 Done.
66 }
67 }
68 };
LEFTRIGHT

Powered by Google App Engine
This is Rietveld