Skip to content

Commit 7717a8a

Browse files
committed
Merge pull request #58 from rpl/tweaks/firebug-sdk-issue-9
mark RDPi internals rdp packages using the customAttributes
2 parents 63d89b7 + a17919b commit 7717a8a

File tree

6 files changed

+66
-16
lines changed

6 files changed

+66
-16
lines changed

data/inspector/packets-store.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ PacketsStore.prototype =
190190

191191
if (packet.type == "send") {
192192
// filter sent RDP packets needed to register the RDPi actorInspector actor
193-
if (packet.packet.rdpInspectorInternals == true) {
193+
if (packet.packet.rdpInspectorInternals) {
194194
filterFrom[packet.packet.to] = filterFrom[packet.packet.to] || 0;
195195
filterFrom[packet.packet.to] += 1;
196196

lib/inspector-service.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,9 @@ const InspectorService =
9191
moduleUrl: actorModuleUrl,
9292
// NOTE: the following option asks firebug.sdk to mark custom actors registering RDP packets
9393
// as rdpInspectorInternals (which helps to filter out them from the packet list)
94-
rdpInspectorInternals: true
94+
customAttributes: {
95+
rdpInspectorInternals: true
96+
}
9597
};
9698

9799
let deferred = defer();

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"watch-karma-tests": "karma start --no-single-run --reporters spec --auto-watch",
2727
"watch-karma-coverage": "CODE_COVERAGE=true npm run watch-karma-tests",
2828
"jpm-tests": "jpm test",
29-
"travis-ci": "npm run karma-coverage && npm run lint",
29+
"travis-ci": "npm run karma-coverage && npm run jpm-tests && npm run lint",
3030
"lint-content": "eslint data/inspector && eslint karma-tests/",
3131
"lint-addon": "eslint lib",
3232
"lint": "npm run lint-content && npm run lint-addon"
@@ -73,7 +73,7 @@
7373
}
7474
],
7575
"dependencies": {
76-
"firebug.sdk": "~0.5.5"
76+
"firebug.sdk": "~0.6.3"
7777
},
7878
"devDependencies": {
7979
"eslint": "^0.21.0",

test/.eslintrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// extends common eslintrc config with addon-sdk specific configs
2+
{
3+
"extends": "../lib/.eslintrc"
4+
}

test/test-inspector-service.js

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
"use strict";
2+
3+
const { InspectorService } = require("../lib/inspector-service");
4+
5+
const { Cu } = require("chrome");
6+
const { getMostRecentBrowserWindow } = require("sdk/window/utils");
7+
8+
// DevTools
9+
const { gDevTools } = Cu.import("resource:///modules/devtools/gDevTools.jsm", {});
10+
const { devtools } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
11+
12+
function showToolbox(toolId) {
13+
let browser = getMostRecentBrowserWindow();
14+
let tab = browser.gBrowser.mCurrentTab;
15+
let target = devtools.TargetFactory.forTab(tab);
16+
return gDevTools.showToolbox(target, toolId);
17+
}
18+
19+
function formatException(e) {
20+
return `\n\t${e.fileName}:${e.lineNumber}\n\t${e}`;
21+
}
22+
23+
exports["test InspectorService"] = function(assert, done) {
24+
showToolbox("webconsole").then((toolbox) => {
25+
assert.ok(toolbox, "toolbox should be defined");
26+
27+
InspectorService.getInspectorClients(toolbox).then((inspectorClients) => {
28+
assert.ok(inspectorClients, "inspectorClients should be defined");
29+
assert.deepEqual(Object.keys(inspectorClients), ["global", "tab"],
30+
"global and tab keys should be defined");
31+
let { global, tab } = inspectorClients;
32+
assert.equal(typeof global.getActors, "function", "global.getActors function is defined");
33+
assert.equal(typeof tab.getActors, "function", "tab.getActors function is defined");
34+
35+
Promise.all([global.getActors(), tab.getActors()]).then(([tabActors, globalActors]) => {
36+
const EXPECTED_ACTOR_KEYS = ["actorPool", "extraPools", "factories", "from"];
37+
38+
assert.deepEqual(Object.keys(globalActors), EXPECTED_ACTOR_KEYS, "globalActors should have the expected attributes");
39+
assert.deepEqual(Object.keys(tabActors), EXPECTED_ACTOR_KEYS, "tabActors should have the expected attributes");
40+
41+
done();
42+
}).catch((e) => {
43+
assert.fail(`Exception catched during getActors: ${formatException(e)}`);
44+
done();
45+
});
46+
}).catch((e) => {
47+
assert.fail(`Exception catched during getInspectorClients: ${formatException(e)}`);
48+
done();
49+
});
50+
}).catch((e) => {
51+
assert.fail(`Exception catched during showToolbox: ${formatException(e)}`);
52+
done();
53+
});
54+
};
55+
56+
require("sdk/test").run(exports);

test/test-main.js

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)