Bug 1329111 - Update devtools users of nsIProfiler.getSharedLibraryInformation. r=gregtatum

This actor message is not used by the devtools themselves, it's only exposed so that
the add-on can use it. See bug 1131397.

MozReview-Commit-ID: F1dm0U4rkEd

--HG--
rename : devtools/server/tests/unit/test_profiler_getsharedlibraryinformation.js => devtools/server/tests/unit/test_profiler_sharedlibraries.js
extra : rebase_source : 52f8836da36b09a8d2091c18817cbc3d8ed51da0
This commit is contained in:
Markus Stange 2017-03-14 19:20:21 -04:00
Родитель 35e98006bd
Коммит 67727faeea
5 изменённых файлов: 19 добавлений и 24 удалений

Просмотреть файл

@ -38,7 +38,7 @@ exports.ProfilerActor = ActorClassWithSpec(profilerSpec, {
getBufferInfo: actorBridgeWithSpec("getBufferInfo"),
getStartOptions: actorBridgeWithSpec("getStartOptions"),
isActive: actorBridgeWithSpec("isActive"),
getSharedLibraryInformation: actorBridgeWithSpec("getSharedLibraryInformation"),
sharedLibraries: actorBridgeWithSpec("sharedLibraries"),
registerEventNotifications: actorBridgeWithSpec("registerEventNotifications"),
unregisterEventNotifications: actorBridgeWithSpec("unregisterEventNotifications"),
setProfilerStatusInterval: actorBridgeWithSpec("setProfilerStatusInterval"),

Просмотреть файл

@ -248,14 +248,12 @@ const ProfilerManager = (function () {
},
/**
* Returns a stringified JSON object that describes the shared libraries
* Returns an array of objects that describes the shared libraries
* which are currently loaded into our process. Can be called while the
* profiler is stopped.
*/
getSharedLibraryInformation: function () {
return {
sharedLibraryInformation: nsIProfilerModule.getSharedLibraryInformation()
};
get sharedLibraries() {
return nsIProfilerModule.sharedLibraries;
},
/**
@ -471,10 +469,10 @@ var Profiler = exports.Profiler = Class({
},
/**
* @see ProfilerManager.isActive
* @see ProfilerManager.sharedLibraries
*/
getSharedLibraryInformation: function () {
return ProfilerManager.getSharedLibraryInformation();
sharedLibraries: function () {
return ProfilerManager.sharedLibraries;
},
/**

Просмотреть файл

@ -4,16 +4,14 @@
"use strict";
/**
* Tests whether the profiler responds to "getSharedLibraryInformation" adequately.
* Tests whether the profiler responds to "sharedLibraries" adequately.
*/
const Profiler = Cc["@mozilla.org/tools/profiler;1"].getService(Ci.nsIProfiler);
function run_test()
{
get_chrome_actors((client, form) => {
let actor = form.profilerActor;
test_getsharedlibraryinformation(client, actor, () => {
test_sharedlibraries(client, actor, () => {
client.close().then(() => {
do_test_finished();
});
@ -23,20 +21,19 @@ function run_test()
do_test_pending();
}
function test_getsharedlibraryinformation(client, actor, callback)
function test_sharedlibraries(client, actor, callback)
{
client.request({ to: actor, type: "getSharedLibraryInformation" }, response => {
do_check_eq(typeof response.sharedLibraryInformation, "string");
let libs = [];
try {
libs = JSON.parse(response.sharedLibraryInformation);
} catch (e) {
do_check_true(false);
}
client.request({ to: actor, type: "sharedLibraries" }, libs => {
do_check_eq(typeof libs, "object");
do_check_true(Array.isArray(libs));
do_check_eq(typeof libs, "object");
do_check_true(libs.length >= 1);
do_check_eq(typeof libs[0], "object");
do_check_eq(typeof libs[0].name, "string");
do_check_eq(typeof libs[0].path, "string");
do_check_eq(typeof libs[0].debugName, "string");
do_check_eq(typeof libs[0].debugPath, "string");
do_check_eq(typeof libs[0].arch, "string");
do_check_eq(typeof libs[0].start, "number");
do_check_eq(typeof libs[0].end, "number");
do_check_true(libs[0].start <= libs[0].end);

Просмотреть файл

@ -203,7 +203,7 @@ reason = only ran on B2G
[test_profiler_events-02.js]
[test_profiler_getbufferinfo.js]
[test_profiler_getfeatures.js]
[test_profiler_getsharedlibraryinformation.js]
[test_profiler_sharedlibraries.js]
[test_unsafeDereference.js]
[test_add_actors.js]
[test_ignore_caught_exceptions.js]

Просмотреть файл

@ -92,7 +92,7 @@ const profilerSpec = generateActorSpec({
isActive: {
response: RetVal("json")
},
getSharedLibraryInformation: {
sharedLibraries: {
response: RetVal("json")
},
registerEventNotifications: {