--- a/devtools/client/definitions.js
+++ b/devtools/client/definitions.js
@@ -273,17 +273,17 @@ Tools.performance = {
get tooltip() {
return l10n("performance.tooltip", "Shift+" +
functionkey(l10n("performance.commandkey")));
},
accesskey: l10n("performance.accesskey"),
inMenu: true,
isTargetSupported: function (target) {
- return target.hasActor("profiler");
+ return target.hasActor("performance");
},
build: function (frame, target) {
return new PerformancePanel(frame, target);
}
};
Tools.memory = {
--- a/devtools/client/framework/toolbox.js
+++ b/devtools/client/framework/toolbox.js
@@ -2663,19 +2663,19 @@ Toolbox.prototype = {
this.textBoxContextMenuPopup.openPopupAtScreen(x, y, true);
},
/**
* Connects to the Gecko Profiler when the developer tools are open. This is
* necessary because of the WebConsole's `profile` and `profileEnd` methods.
*/
initPerformance: Task.async(function* () {
- // If target does not have profiler actor (addons), do not
+ // If target does not have performance actor (addons), do not
// even register the shared performance connection.
- if (!this.target.hasActor("profiler")) {
+ if (!this.target.hasActor("performance")) {
return promise.resolve();
}
if (this._performanceFrontConnection) {
return this._performanceFrontConnection.promise;
}
this._performanceFrontConnection = defer();
--- a/devtools/docs/backend/backward-compatibility.md
+++ b/devtools/docs/backend/backward-compatibility.md
@@ -28,17 +28,17 @@ The easiest way to test this is to check
## Feature Detection
Starting with Firefox 36 (thanks to [bug 1069673](https://bugzilla.mozilla.org/show_bug.cgi?id=1069673)), you can use actor feature detection to determine which actors exist and what methods they expose.
1. Detecting if the server has an actor: all you need is access to the `Toolbox` instance, which all panels do, when they get instantiated. Then you can do:
```js
-let hasProfilerActor = toolbox.target.hasActor("profiler");
+let hasPerformanceActor = toolbox.target.hasActor("performance");
```
The `hasActor` method returns a boolean synchronously.
2. Detecting if an actor has a given method: same thing here, you need access to the toolbox:
```js
toolbox.target.actorHasMethod("domwalker", "duplicateNode").then(hasMethod => {
--- a/devtools/server/actors/moz.build
+++ b/devtools/server/actors/moz.build
@@ -42,17 +42,16 @@ DevToolsModules(
'monitor.js',
'object.js',
'performance-entries.js',
'performance-recording.js',
'performance.js',
'preference.js',
'pretty-print-worker.js',
'process.js',
- 'profiler.js',
'promises.js',
'reflow.js',
'root.js',
'script.js',
'source.js',
'storage.js',
'string.js',
'styleeditor.js',
@@ -91,19 +90,16 @@ with Files('memory.js'):
BUG_COMPONENT = ('Firefox', 'Developer Tools: Memory')
with Files('monitor.js'):
BUG_COMPONENT = ('Firefox', 'Developer Tools')
with Files('performance*'):
BUG_COMPONENT = ('Firefox', 'Developer Tools: Performance Tools (Profiler/Timeline)')
-with Files('profiler.js'):
- BUG_COMPONENT = ('Firefox', 'Developer Tools: Performance Tools (Profiler/Timeline)')
-
with Files('source.js'):
BUG_COMPONENT = ('Firefox', 'Developer Tools: Debugger')
with Files('storage.js'):
BUG_COMPONENT = ('Firefox', 'Developer Tools: Storage Inspector')
with Files('styleeditor.js'):
BUG_COMPONENT = ('Firefox', 'Developer Tools: Style Editor')
deleted file mode 100644
--- a/devtools/server/actors/profiler.js
+++ /dev/null
@@ -1,50 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-"use strict";
-
-const { Actor, ActorClassWithSpec } = require("devtools/shared/protocol");
-const { Profiler } = require("devtools/server/performance/profiler");
-const { actorBridgeWithSpec } = require("devtools/server/actors/common");
-const { profilerSpec } = require("devtools/shared/specs/profiler");
-
-/**
- * This actor wraps the Profiler module at devtools/server/performance/profiler.js
- * and provides RDP definitions.
- *
- * @see devtools/server/performance/profiler.js for documentation.
- */
-exports.ProfilerActor = ActorClassWithSpec(profilerSpec, {
- initialize: function (conn) {
- Actor.prototype.initialize.call(this, conn);
- this._onProfilerEvent = this._onProfilerEvent.bind(this);
-
- this.bridge = new Profiler();
- this.bridge.on("*", this._onProfilerEvent);
- },
-
- destroy: function () {
- this.bridge.off("*", this._onProfilerEvent);
- this.bridge.destroy();
- Actor.prototype.destroy.call(this);
- },
-
- startProfiler: actorBridgeWithSpec("start"),
- stopProfiler: actorBridgeWithSpec("stop"),
- getProfile: actorBridgeWithSpec("getProfile"),
- getFeatures: actorBridgeWithSpec("getFeatures"),
- getBufferInfo: actorBridgeWithSpec("getBufferInfo"),
- getStartOptions: actorBridgeWithSpec("getStartOptions"),
- isActive: actorBridgeWithSpec("isActive"),
- sharedLibraries: actorBridgeWithSpec("sharedLibraries"),
- registerEventNotifications: actorBridgeWithSpec("registerEventNotifications"),
- unregisterEventNotifications: actorBridgeWithSpec("unregisterEventNotifications"),
- setProfilerStatusInterval: actorBridgeWithSpec("setProfilerStatusInterval"),
-
- /**
- * Pipe events from Profiler module to this actor.
- */
- _onProfilerEvent: function (eventName, ...data) {
- this.emit(eventName, ...data);
- },
-});
--- a/devtools/server/main.js
+++ b/devtools/server/main.js
@@ -544,21 +544,16 @@ var DebuggerServer = {
type: { tab: true }
});
this.registerModule("devtools/server/actors/timeline", {
prefix: "timeline",
constructor: "TimelineActor",
type: { tab: true }
});
if ("nsIProfiler" in Ci) {
- this.registerModule("devtools/server/actors/profiler", {
- prefix: "profiler",
- constructor: "ProfilerActor",
- type: { tab: true }
- });
this.registerModule("devtools/server/actors/performance", {
prefix: "performance",
constructor: "PerformanceActor",
type: { tab: true }
});
}
this.registerModule("devtools/server/actors/animation", {
prefix: "animations",
deleted file mode 100644
--- a/devtools/server/tests/unit/test_profiler_activation-01.js
+++ /dev/null
@@ -1,90 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-/* eslint-disable no-shadow */
-
-"use strict";
-
-/**
- * Tests whether the profiler module and actor have the correct state on
- * initialization, activation, and when a clients' connection closes.
- */
-
-const Profiler = Cc["@mozilla.org/tools/profiler;1"].getService(Ci.nsIProfiler);
-const MAX_PROFILER_ENTRIES = 10000000;
-
-function run_test() {
- // Ensure the profiler is not running when the test starts (it could
- // happen if the MOZ_PROFILER_STARTUP environment variable is set).
- Profiler.StopProfiler();
-
- get_chrome_actors((client1, form1) => {
- let actor1 = form1.profilerActor;
- get_chrome_actors((client2, form2) => {
- let actor2 = form2.profilerActor;
- test_activate(client1, actor1, client2, actor2, () => {
- do_test_finished();
- });
- });
- });
-
- do_test_pending();
-}
-
-function test_activate(client1, actor1, client2, actor2, callback) {
- // Profiler should be inactive at this point.
- client1.request({ to: actor1, type: "isActive" }, response => {
- do_check_false(Profiler.IsActive());
- do_check_false(response.isActive);
- do_check_eq(response.currentTime, undefined);
- do_check_true(typeof response.position === "number");
- do_check_true(typeof response.totalSize === "number");
- do_check_true(typeof response.generation === "number");
-
- // Start the profiler on the first connection....
- client1.request(
- { to: actor1, type: "startProfiler", entries: MAX_PROFILER_ENTRIES }, response => {
- do_check_true(Profiler.IsActive());
- do_check_true(response.started);
- do_check_true(typeof response.position === "number");
- do_check_true(typeof response.totalSize === "number");
- do_check_true(typeof response.generation === "number");
- do_check_true(response.position >= 0 && response.position < response.totalSize);
- do_check_true(response.totalSize === MAX_PROFILER_ENTRIES);
-
- // On the next connection just make sure the actor has been instantiated.
- client2.request({ to: actor2, type: "isActive" }, response => {
- do_check_true(Profiler.IsActive());
- do_check_true(response.isActive);
- do_check_true(response.currentTime > 0);
- do_check_true(typeof response.position === "number");
- do_check_true(typeof response.totalSize === "number");
- do_check_true(typeof response.generation === "number");
- do_check_true(response.position >= 0 && response.position < response.totalSize);
- do_check_true(response.totalSize === MAX_PROFILER_ENTRIES);
-
- let origConnectionClosed = DebuggerServer._connectionClosed;
-
- DebuggerServer._connectionClosed = function (conn) {
- origConnectionClosed.call(this, conn);
-
- // The first client is the only actor that started the profiler,
- // however the second client can request the accumulated profile data
- // at any moment, so the profiler module shouldn't have deactivated.
- do_check_true(Profiler.IsActive());
-
- DebuggerServer._connectionClosed = function (conn) {
- origConnectionClosed.call(this, conn);
-
- // Now there are no open clients at all, it should *definitely*
- // be deactivated by now.
- do_check_false(Profiler.IsActive());
-
- callback();
- };
- client2.close();
- };
- client1.close();
- });
- });
- });
-}
deleted file mode 100644
--- a/devtools/server/tests/unit/test_profiler_activation-02.js
+++ /dev/null
@@ -1,44 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-/**
- * Tests whether the profiler actor correctly handles the case where the
- * built-in module was already started.
- */
-
-const Profiler = Cc["@mozilla.org/tools/profiler;1"].getService(Ci.nsIProfiler);
-const WAIT_TIME = 1000; // ms
-
-function run_test() {
- // Ensure the profiler is already running when the test starts.
- Profiler.StartProfiler(1000000, 1, ["js"], 1);
-
- DevToolsUtils.waitForTime(WAIT_TIME).then(() => {
- get_chrome_actors((client, form) => {
- let actor = form.profilerActor;
- test_start_time(client, actor, () => {
- client.close().then(do_test_finished);
- });
- });
- });
-
- do_test_pending();
-}
-
-function test_start_time(client, actor, callback) {
- // Profiler should already be active at this point.
- client.request({ to: actor, type: "isActive" }, firstResponse => {
- do_check_true(Profiler.IsActive());
- do_check_true(firstResponse.isActive);
- do_check_true(firstResponse.currentTime > 0);
-
- client.request({ to: actor, type: "getProfile" }, secondResponse => {
- do_check_true("profile" in secondResponse);
- do_check_true(secondResponse.currentTime > firstResponse.currentTime);
-
- callback();
- });
- });
-}
deleted file mode 100644
--- a/devtools/server/tests/unit/test_profiler_bufferstatus.js
+++ /dev/null
@@ -1,122 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-/* eslint-disable no-shadow, max-nested-callbacks */
-
-"use strict";
-
-/**
- * Tests if the profiler actor returns its buffer status via getBufferInfo.
- */
-
-const Profiler = Cc["@mozilla.org/tools/profiler;1"].getService(Ci.nsIProfiler);
-const INITIAL_WAIT_TIME = 100; // ms
-const MAX_WAIT_TIME = 20000; // ms
-const MAX_PROFILER_ENTRIES = 10000000;
-
-// eslint-disable-next-line no-unused-vars
-function run_test() {
- // Ensure the profiler is not running when the test starts (it could
- // happen if the MOZ_PROFILER_STARTUP environment variable is set).
- Profiler.StopProfiler();
-
- get_chrome_actors((client, form) => {
- let actor = form.profilerActor;
- check_empty_buffer(client, actor, () => {
- activate_profiler(client, actor, startTime => {
- wait_for_samples(client, actor, () => {
- check_buffer(client, actor, () => {
- deactivate_profiler(client, actor, () => {
- client.close().then(do_test_finished);
- });
- });
- });
- });
- });
- });
-
- do_test_pending();
-}
-
-function check_buffer(client, actor, callback) {
- client.request({ to: actor, type: "isActive" }, response => {
- do_check_true(typeof response.position === "number");
- do_check_true(typeof response.totalSize === "number");
- do_check_true(typeof response.generation === "number");
- do_check_true(response.position > 0 && response.position < response.totalSize);
- do_check_true(response.totalSize === MAX_PROFILER_ENTRIES);
- // There's no way we'll fill the buffer in this test.
- do_check_true(response.generation === 0);
-
- callback();
- });
-}
-
-function check_empty_buffer(client, actor, callback) {
- client.request({ to: actor, type: "isActive" }, response => {
- do_check_false(Profiler.IsActive());
- do_check_false(response.isActive);
- do_check_true(response.position === void 0);
- do_check_true(response.totalSize === void 0);
- do_check_true(response.generation === void 0);
- do_check_false(response.isActive);
- do_check_eq(response.currentTime, undefined);
- calback();
- });
-}
-
-function activate_profiler(client, actor, callback) {
- client.request(
- { to: actor, type: "startProfiler", entries: MAX_PROFILER_ENTRIES }, response => {
- do_check_true(response.started);
- client.request({ to: actor, type: "isActive" }, response => {
- do_check_true(response.isActive);
- callback(response.currentTime);
- });
- });
-}
-
-function deactivate_profiler(client, actor, callback) {
- client.request({ to: actor, type: "stopProfiler" }, response => {
- do_check_false(response.started);
- client.request({ to: actor, type: "isActive" }, response => {
- do_check_false(response.isActive);
- callback();
- });
- });
-}
-
-function wait_for_samples(client, actor, callback) {
- function attempt(delay) {
- // Spin for the requested time, then take a sample.
- let start = Date.now();
-
- do_print("Attempt: delay = " + delay);
- while (Date.now() - start < delay) {
- /* Empty */
- }
- do_print("Attempt: finished waiting.");
-
- client.request({ to: actor, type: "getProfile" }, response => {
- // At this point, we may or may not have samples, depending on
- // whether the spin loop above has given the profiler enough time
- // to get started.
- if (response.profile.threads[0].samples.length == 0) {
- if (delay < MAX_WAIT_TIME) {
- // Double the spin-wait time and try again.
- do_print("Attempt: no samples, going around again.");
- attempt(delay * 2);
- } else {
- // We've waited long enough, so just fail.
- do_print("Attempt: waited a long time, but no samples were collected.");
- do_print("Giving up.");
- do_check_true(false);
- }
- return;
- }
- callback();
- });
- }
-
- // Start off with a 100 millisecond delay.
- attempt(INITIAL_WAIT_TIME);
-}
deleted file mode 100644
--- a/devtools/server/tests/unit/test_profiler_close.js
+++ /dev/null
@@ -1,66 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-/* eslint-disable no-shadow, max-nested-callbacks */
-
-"use strict";
-
-/**
- * Tests whether the profiler module is kept active when there are multiple
- * client consumers and one requests deactivation.
- */
-
-const Profiler = Cc["@mozilla.org/tools/profiler;1"].getService(Ci.nsIProfiler);
-
-function run_test() {
- get_chrome_actors((client1, form1) => {
- let actor1 = form1.profilerActor;
- get_chrome_actors((client2, form2) => {
- let actor2 = form2.profilerActor;
- test_close(client1, actor1, client2, actor2, () => {
- client1.close(() => {
- client2.close(() => {
- do_test_finished();
- });
- });
- });
- });
- });
-
- do_test_pending();
-}
-
-function activate_profiler(client, actor, callback) {
- client.request({ to: actor, type: "startProfiler" }, response => {
- do_check_true(response.started);
- do_check_true(Profiler.IsActive());
-
- client.request({ to: actor, type: "isActive" }, response => {
- do_check_true(response.isActive);
- callback();
- });
- });
-}
-
-function deactivate_profiler(client, actor, callback) {
- client.request({ to: actor, type: "stopProfiler" }, response => {
- do_check_false(response.started);
- do_check_true(Profiler.IsActive());
-
- client.request({ to: actor, type: "isActive" }, response => {
- do_check_true(response.isActive);
- callback();
- });
- });
-}
-
-function test_close(client1, actor1, client2, actor2, callback) {
- activate_profiler(client1, actor1, () => {
- activate_profiler(client2, actor2, () => {
- deactivate_profiler(client1, actor1, () => {
- deactivate_profiler(client2, actor2, () => {
- callback();
- });
- });
- });
- });
-}
deleted file mode 100644
--- a/devtools/server/tests/unit/test_profiler_data.js
+++ /dev/null
@@ -1,107 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-/* eslint-disable no-shadow, max-nested-callbacks */
-
-"use strict";
-
-/**
- * Tests if the profiler actor can correctly retrieve a profile after
- * it is activated.
- */
-
-const INITIAL_WAIT_TIME = 100; // ms
-const MAX_WAIT_TIME = 20000; // ms
-
-function run_test() {
- get_chrome_actors((client, form) => {
- let actor = form.profilerActor;
- activate_profiler(client, actor, startTime => {
- test_data(client, actor, startTime, () => {
- deactivate_profiler(client, actor, () => {
- client.close().then(do_test_finished);
- });
- });
- });
- });
-
- do_test_pending();
-}
-
-function activate_profiler(client, actor, callback) {
- client.request({ to: actor, type: "startProfiler" }, response => {
- do_check_true(response.started);
- client.request({ to: actor, type: "isActive" }, response => {
- do_check_true(response.isActive);
- callback(response.currentTime);
- });
- });
-}
-
-function deactivate_profiler(client, actor, callback) {
- client.request({ to: actor, type: "stopProfiler" }, response => {
- do_check_false(response.started);
- client.request({ to: actor, type: "isActive" }, response => {
- do_check_false(response.isActive);
- callback();
- });
- });
-}
-
-function test_data(client, actor, startTime, callback) {
- function attempt(delay) {
- // No idea why, but Components.stack.sourceLine returns null.
- let funcLine = Components.stack.lineNumber - 2;
-
- // Spin for the requested time, then take a sample.
- let start = Date.now();
- let stack;
- do_print("Attempt: delay = " + delay);
- while (Date.now() - start < delay) {
- stack = Components.stack;
- }
- do_print("Attempt: finished waiting.");
-
- client.request({ to: actor, type: "getProfile", startTime }, response => {
- // Any valid getProfile response should have the following top
- // level structure.
- do_check_eq(typeof response.profile, "object");
- do_check_eq(typeof response.profile.meta, "object");
- do_check_eq(typeof response.profile.meta.platform, "string");
- do_check_eq(typeof response.profile.threads, "object");
- do_check_eq(typeof response.profile.threads[0], "object");
- do_check_eq(typeof response.profile.threads[0].samples, "object");
-
- // At this point, we may or may not have samples, depending on
- // whether the spin loop above has given the profiler enough time
- // to get started.
- if (response.profile.threads[0].samples.length == 0) {
- if (delay < MAX_WAIT_TIME) {
- // Double the spin-wait time and try again.
- do_print("Attempt: no samples, going around again.");
- attempt(delay * 2);
- } else {
- // We've waited long enough, so just fail.
- do_print("Attempt: waited a long time, but no samples were collected.");
- do_print("Giving up.");
- do_check_true(false);
- }
- return;
- }
-
- // Now check the samples. At least one sample is expected to
- // have been in the busy wait above.
- let loc = stack.name + " (" + stack.filename + ":" + funcLine + ")";
- let thread0 = response.profile.threads[0];
- do_check_true(thread0.samples.data.some(sample => {
- let frames = getInflatedStackLocations(thread0, sample);
- return frames.length != 0 &&
- frames.some(location => (location == loc));
- }));
-
- callback();
- });
- }
-
- // Start off with a 100 millisecond delay.
- attempt(INITIAL_WAIT_TIME);
-}
deleted file mode 100644
--- a/devtools/server/tests/unit/test_profiler_events-01.js
+++ /dev/null
@@ -1,59 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-/**
- * Tests the event notification service for the profiler actor.
- */
-
-const { ProfilerFront } = require("devtools/shared/fronts/profiler");
-
-add_task(function* () {
- let [client, form] = yield getChromeActors();
- let front = new ProfilerFront(client, form);
-
- let events = [0, 0, 0, 0];
- front.on("console-api-profiler", () => events[0]++);
- front.on("profiler-started", () => events[1]++);
- front.on("profiler-stopped", () => events[2]++);
- client.addListener("eventNotification", (type, response) => {
- do_check_true(type === "eventNotification");
- events[3]++;
- });
-
- yield front.startProfiler();
- yield front.stopProfiler();
-
- // All should be empty without binding events
- do_check_true(events[0] === 0);
- do_check_true(events[1] === 0);
- do_check_true(events[2] === 0);
- do_check_true(events[3] === 0);
-
- let ret = yield front.registerEventNotifications(
- { events: ["console-api-profiler", "profiler-started", "profiler-stopped"] });
- do_check_true(ret.registered.length === 3);
-
- yield front.startProfiler();
- do_check_true(events[0] === 0);
- do_check_true(events[1] === 1);
- do_check_true(events[2] === 0);
- do_check_true(events[3] === 1, "compatibility events supported for eventNotifications");
-
- yield front.stopProfiler();
- do_check_true(events[0] === 0);
- do_check_true(events[1] === 1);
- do_check_true(events[2] === 1);
- do_check_true(events[3] === 2, "compatibility events supported for eventNotifications");
-
- ret = yield front.unregisterEventNotifications(
- { events: ["console-api-profiler", "profiler-started", "profiler-stopped"] });
- do_check_true(ret.registered.length === 3);
-});
-
-function getChromeActors() {
- let deferred = defer();
- get_chrome_actors((client, form) => deferred.resolve([client, form]));
- return deferred.promise;
-}
deleted file mode 100644
--- a/devtools/server/tests/unit/test_profiler_events-02.js
+++ /dev/null
@@ -1,69 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-/**
- * Tests the event notification service for the profiler actor.
- */
-
-const Profiler = Cc["@mozilla.org/tools/profiler;1"].getService(Ci.nsIProfiler);
-const MAX_PROFILER_ENTRIES = 10000000;
-const { ProfilerFront } = require("devtools/shared/fronts/profiler");
-const { waitForTime } = DevToolsUtils;
-
-add_task(function* () {
- let [client, form] = yield getChromeActors();
- let front = new ProfilerFront(client, form);
-
- // Ensure the profiler is not running when the test starts (it could
- // happen if the MOZ_PROFILER_STARTUP environment variable is set).
- Profiler.StopProfiler();
- let eventsCalled = 0;
- let handledThreeTimes = defer();
-
- front.on("profiler-status", (response) => {
- dump("'profiler-status' fired\n");
- do_check_true(typeof response.position === "number");
- do_check_true(typeof response.totalSize === "number");
- do_check_true(typeof response.generation === "number");
- do_check_true(response.position > 0 && response.position < response.totalSize);
- do_check_true(response.totalSize === MAX_PROFILER_ENTRIES);
- // There's no way we'll fill the buffer in this test.
- do_check_true(response.generation === 0);
-
- eventsCalled++;
- if (eventsCalled > 2) {
- handledThreeTimes.resolve();
- }
- });
-
- yield front.setProfilerStatusInterval(1);
- dump("Set the profiler-status event interval to 1\n");
- yield front.startProfiler();
- yield waitForTime(500);
- yield front.stopProfiler();
-
- do_check_true(eventsCalled === 0,
- "No 'profiler-status' events should be fired before registering.");
-
- let ret = yield front.registerEventNotifications({ events: ["profiler-status"] });
- do_check_true(ret.registered.length === 1);
-
- yield front.startProfiler();
- yield handledThreeTimes.promise;
- yield front.stopProfiler();
- do_check_true(eventsCalled >= 3,
- "profiler-status fired atleast three times while recording");
-
- let totalEvents = eventsCalled;
- yield waitForTime(50);
- do_check_true(totalEvents === eventsCalled,
- "No more profiler-status events after recording.");
-});
-
-function getChromeActors() {
- let deferred = defer();
- get_chrome_actors((client, form) => deferred.resolve([client, form]));
- return deferred.promise;
-}
deleted file mode 100644
--- a/devtools/server/tests/unit/test_profiler_getbufferinfo.js
+++ /dev/null
@@ -1,116 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-/* eslint-disable no-shadow, max-nested-callbacks */
-
-"use strict";
-
-/**
- * Tests if the profiler actor returns its buffer status via getBufferInfo.
- */
-
-const Profiler = Cc["@mozilla.org/tools/profiler;1"].getService(Ci.nsIProfiler);
-const INITIAL_WAIT_TIME = 100; // ms
-const MAX_WAIT_TIME = 20000; // ms
-const MAX_PROFILER_ENTRIES = 10000000;
-
-function run_test() {
- // Ensure the profiler is not running when the test starts (it could
- // happen if the MOZ_PROFILER_STARTUP environment variable is set).
- Profiler.StopProfiler();
-
- get_chrome_actors((client, form) => {
- let actor = form.profilerActor;
- check_empty_buffer(client, actor, () => {
- activate_profiler(client, actor, startTime => {
- wait_for_samples(client, actor, () => {
- check_buffer(client, actor, () => {
- deactivate_profiler(client, actor, () => {
- client.close().then(do_test_finished);
- });
- });
- });
- });
- });
- });
-
- do_test_pending();
-}
-
-function check_empty_buffer(client, actor, callback) {
- client.request({ to: actor, type: "getBufferInfo" }, response => {
- do_check_true(response.position === 0);
- do_check_true(response.totalSize === 0);
- do_check_true(response.generation === 0);
- callback();
- });
-}
-
-function check_buffer(client, actor, callback) {
- client.request({ to: actor, type: "getBufferInfo" }, response => {
- do_check_true(typeof response.position === "number");
- do_check_true(typeof response.totalSize === "number");
- do_check_true(typeof response.generation === "number");
- do_check_true(response.position > 0 && response.position < response.totalSize);
- do_check_true(response.totalSize === MAX_PROFILER_ENTRIES);
- // There's no way we'll fill the buffer in this test.
- do_check_true(response.generation === 0);
-
- callback();
- });
-}
-
-function activate_profiler(client, actor, callback) {
- client.request(
- { to: actor, type: "startProfiler", entries: MAX_PROFILER_ENTRIES }, response => {
- do_check_true(response.started);
- client.request({ to: actor, type: "isActive" }, response => {
- do_check_true(response.isActive);
- callback(response.currentTime);
- });
- });
-}
-
-function deactivate_profiler(client, actor, callback) {
- client.request({ to: actor, type: "stopProfiler" }, response => {
- do_check_false(response.started);
- client.request({ to: actor, type: "isActive" }, response => {
- do_check_false(response.isActive);
- callback();
- });
- });
-}
-
-function wait_for_samples(client, actor, callback) {
- function attempt(delay) {
- // Spin for the requested time, then take a sample.
- let start = Date.now();
-
- do_print("Attempt: delay = " + delay);
- /* eslint-disable no-empty */
- while (Date.now() - start < delay) {}
- do_print("Attempt: finished waiting.");
-
- client.request({ to: actor, type: "getProfile" }, response => {
- // At this point, we may or may not have samples, depending on
- // whether the spin loop above has given the profiler enough time
- // to get started.
- if (response.profile.threads[0].samples.length == 0) {
- if (delay < MAX_WAIT_TIME) {
- // Double the spin-wait time and try again.
- do_print("Attempt: no samples, going around again.");
- attempt(delay * 2);
- } else {
- // We've waited long enough, so just fail.
- do_print("Attempt: waited a long time, but no samples were collected.");
- do_print("Giving up.");
- do_check_true(false);
- }
- return;
- }
- callback();
- });
- }
-
- // Start off with a 100 millisecond delay.
- attempt(INITIAL_WAIT_TIME);
-}
deleted file mode 100644
--- a/devtools/server/tests/unit/test_profiler_getfeatures.js
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-/**
- * Tests whether the profiler responds to "getFeatures" adequately.
- */
-
-function run_test() {
- get_chrome_actors((client, form) => {
- let actor = form.profilerActor;
- test_getfeatures(client, actor, () => {
- client.close().then(() => {
- do_test_finished();
- });
- });
- });
-
- do_test_pending();
-}
-
-function test_getfeatures(client, actor, callback) {
- client.request({ to: actor, type: "getFeatures" }, response => {
- do_check_eq(typeof response.features, "object");
- do_check_true(response.features.length >= 1);
- do_check_eq(typeof response.features[0], "string");
- do_check_true(response.features.indexOf("js") != -1);
- callback();
- });
-}
deleted file mode 100644
--- a/devtools/server/tests/unit/test_profiler_sharedlibraries.js
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-/**
- * Tests whether the profiler responds to "sharedLibraries" adequately.
- */
-
-function run_test() {
- get_chrome_actors((client, form) => {
- let actor = form.profilerActor;
- test_sharedlibraries(client, actor, () => {
- client.close().then(() => {
- do_test_finished();
- });
- });
- });
-
- do_test_pending();
-}
-
-function test_sharedlibraries(client, actor, callback) {
- client.request({ to: actor, type: "sharedLibraries" }, response => {
- const libs = response.sharedLibraries;
- 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);
- callback();
- });
-}
--- a/devtools/server/tests/unit/xpcshell.ini
+++ b/devtools/server/tests/unit/xpcshell.ini
@@ -195,25 +195,16 @@ reason = only ran on B2G
[test_pause_exceptions-01.js]
[test_pause_exceptions-02.js]
[test_longstringactor.js]
[test_longstringgrips-01.js]
[test_longstringgrips-02.js]
[test_source-01.js]
[test_wasm_source-01.js]
[test_breakpoint-actor-map.js]
-[test_profiler_activation-01.js]
-[test_profiler_activation-02.js]
-[test_profiler_close.js]
-[test_profiler_data.js]
-[test_profiler_events-01.js]
-[test_profiler_events-02.js]
-[test_profiler_getbufferinfo.js]
-[test_profiler_getfeatures.js]
-[test_profiler_sharedlibraries.js]
[test_unsafeDereference.js]
[test_add_actors.js]
[test_ignore_caught_exceptions.js]
[test_ignore_no_interface_exceptions.js]
[test_requestTypes.js]
reason = bug 937197
[test_layout-reflows-observer.js]
[test_protocolSpec.js]
--- a/devtools/shared/fronts/moz.build
+++ b/devtools/shared/fronts/moz.build
@@ -21,17 +21,16 @@ DevToolsModules(
'highlighters.js',
'inspector.js',
'layout.js',
'memory.js',
'performance-entries.js',
'performance-recording.js',
'performance.js',
'preference.js',
- 'profiler.js',
'promises.js',
'reflow.js',
'storage.js',
'string.js',
'styles.js',
'stylesheets.js',
'timeline.js',
'webaudio.js',
deleted file mode 100644
--- a/devtools/shared/fronts/profiler.js
+++ /dev/null
@@ -1,77 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-"use strict";
-
-const { Cu } = require("chrome");
-const {
- Front,
- FrontClassWithSpec,
- custom
-} = require("devtools/shared/protocol");
-const { profilerSpec } = require("devtools/shared/specs/profiler");
-
-/**
- * This can be used on older Profiler implementations, but the methods cannot
- * be changed -- you must introduce a new method, and detect the server.
- */
-exports.ProfilerFront = FrontClassWithSpec(profilerSpec, {
- initialize: function (client, form) {
- Front.prototype.initialize.call(this, client, form);
- this.actorID = form.profilerActor;
- this.manage(this);
-
- this._onProfilerEvent = this._onProfilerEvent.bind(this);
- this.on("*", this._onProfilerEvent);
- },
-
- destroy: function () {
- this.off("*", this._onProfilerEvent);
- Front.prototype.destroy.call(this);
- },
-
- /**
- * If using the protocol.js Fronts, then make stringify default,
- * since the read/write mechanisms will expose it as an object anyway, but
- * this lets other consumers who connect directly (xpcshell tests, Gecko Profiler) to
- * have unchanged behaviour.
- */
- getProfile: custom(function (options) {
- return this._getProfile(Object.assign({ stringify: true }, options));
- }, {
- impl: "_getProfile"
- }),
-
- /**
- * Also emit an old `eventNotification` for older consumers of the profiler.
- */
- _onProfilerEvent: function (eventName, data) {
- // If this event already passed through once, don't repropagate
- if (data.relayed) {
- return;
- }
- data.relayed = true;
-
- if (eventName === "eventNotification") {
- // If this is `eventNotification`, this is coming from an older Gecko (<Fx42)
- // that doesn't use protocol.js style events. Massage it to emit a protocol.js
- // style event as well.
- this.emit(data.topic, data);
- } else {
- // Otherwise if a modern protocol.js event, emit it also as `eventNotification`
- // for compatibility reasons on the client (like for any add-ons/Gecko Profiler
- // using this event) and log a deprecation message if there is a listener.
- this.conn.emit("eventNotification", {
- subject: data.subject,
- topic: data.topic,
- data: data.data,
- details: data.details
- });
- if (this.conn._getListeners("eventNotification").length) {
- Cu.reportError(`
- ProfilerActor's "eventNotification" on the DebuggerClient has been deprecated.
- Use the ProfilerFront found in "devtools/server/actors/profiler".`);
- }
- }
- },
-});
--- a/devtools/shared/specs/moz.build
+++ b/devtools/shared/specs/moz.build
@@ -26,17 +26,16 @@ DevToolsModules(
'inspector.js',
'layout.js',
'memory.js',
'node.js',
'performance-entries.js',
'performance-recording.js',
'performance.js',
'preference.js',
- 'profiler.js',
'promises.js',
'reflow.js',
'script.js',
'source.js',
'storage.js',
'string.js',
'styleeditor.js',
'styles.js',
deleted file mode 100644
--- a/devtools/shared/specs/profiler.js
+++ /dev/null
@@ -1,121 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-"use strict";
-
-const {
- Arg,
- Option,
- RetVal,
- generateActorSpec,
- types
-} = require("devtools/shared/protocol");
-
-types.addType("profiler-data", {
- // On Fx42+, the profile is only deserialized on the front; older
- // servers will get the profiler data as an object from nsIProfiler,
- // causing one parse/stringify cycle, then again implicitly in a packet.
- read: (v) => {
- if (typeof v.profile === "string") {
- // Create a new response object since `profile` is read only.
- let newValue = Object.create(null);
- newValue.profile = JSON.parse(v.profile);
- newValue.currentTime = v.currentTime;
- return newValue;
- }
- return v;
- }
-});
-
-const profilerSpec = generateActorSpec({
- typeName: "profiler",
-
- /**
- * The set of events the ProfilerActor emits over RDP.
- */
- events: {
- "console-api-profiler": {
- data: Arg(0, "json"),
- },
- "profiler-started": {
- data: Arg(0, "json"),
- },
- "profiler-stopped": {
- data: Arg(0, "json"),
- },
- "profiler-status": {
- data: Arg(0, "json"),
- },
-
- // Only for older geckos, pre-protocol.js ProfilerActor (<Fx42).
- // Emitted on other events as a transition from older profiler events
- // to newer ones.
- "eventNotification": {
- subject: Option(0, "json"),
- topic: Option(0, "string"),
- details: Option(0, "json")
- }
- },
-
- methods: {
- startProfiler: {
- // Write out every property in the request, since we want all these options to be
- // on the packet's top-level for backwards compatibility, when the profiler actor
- // was not using protocol.js (<Fx42)
- request: {
- entries: Option(0, "nullable:number"),
- interval: Option(0, "nullable:number"),
- features: Option(0, "nullable:array:string"),
- threadFilters: Option(0, "nullable:array:string"),
- },
- response: RetVal("json"),
- },
- stopProfiler: {
- response: RetVal("json"),
- },
- getProfile: {
- request: {
- startTime: Option(0, "nullable:number"),
- stringify: Option(0, "nullable:boolean")
- },
- response: RetVal("profiler-data")
- },
- getFeatures: {
- response: RetVal("json")
- },
- getBufferInfo: {
- response: RetVal("json")
- },
- getStartOptions: {
- response: RetVal("json")
- },
- isActive: {
- response: RetVal("json")
- },
- sharedLibraries: {
- response: RetVal("json")
- },
- registerEventNotifications: {
- // Explicitly enumerate the arguments
- // @see ProfilerActor#startProfiler
- request: {
- events: Option(0, "nullable:array:string"),
- },
- response: RetVal("json")
- },
- unregisterEventNotifications: {
- // Explicitly enumerate the arguments
- // @see ProfilerActor#startProfiler
- request: {
- events: Option(0, "nullable:array:string"),
- },
- response: RetVal("json")
- },
- setProfilerStatusInterval: {
- request: { interval: Arg(0, "number") },
- oneway: true
- }
- }
-});
-
-exports.profilerSpec = profilerSpec;