mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
f6c774eb5e
--HG-- rename : toolkit/devtools/debugger/Makefile.in => toolkit/devtools/client/Makefile.in rename : toolkit/devtools/debugger/dbg-client.jsm => toolkit/devtools/client/dbg-client.jsm rename : toolkit/devtools/debugger/moz.build => toolkit/devtools/client/moz.build rename : toolkit/devtools/debugger/Makefile.in => toolkit/devtools/server/Makefile.in rename : toolkit/devtools/gcli/dbg-gcli-actors.js => toolkit/devtools/server/actors/gcli.js rename : toolkit/devtools/debugger/server/dbg-profiler-actors.js => toolkit/devtools/server/actors/profiler.js rename : toolkit/devtools/debugger/server/dbg-script-actors.js => toolkit/devtools/server/actors/script.js rename : toolkit/devtools/styleeditor/dbg-styleeditor-actors.js => toolkit/devtools/server/actors/styleeditor.js rename : toolkit/devtools/debugger/server/dbg-browser-actors.js => toolkit/devtools/server/actors/webbrowser.js rename : toolkit/devtools/webconsole/dbg-webconsole-actors.js => toolkit/devtools/server/actors/webconsole.js rename : toolkit/devtools/debugger/server/dbg-server.jsm => toolkit/devtools/server/dbg-server.jsm rename : toolkit/devtools/debugger/server/dbg-server.js => toolkit/devtools/server/main.js rename : toolkit/devtools/debugger/moz.build => toolkit/devtools/server/moz.build rename : toolkit/devtools/debugger/nsIJSInspector.idl => toolkit/devtools/server/nsIJSInspector.idl rename : toolkit/devtools/debugger/nsJSInspector.cpp => toolkit/devtools/server/nsJSInspector.cpp rename : toolkit/devtools/debugger/nsJSInspector.h => toolkit/devtools/server/nsJSInspector.h rename : toolkit/devtools/debugger/tests/mochitest/Makefile.in => toolkit/devtools/server/tests/mochitest/Makefile.in rename : toolkit/devtools/debugger/tests/mochitest/moz.build => toolkit/devtools/server/tests/mochitest/moz.build rename : toolkit/devtools/debugger/tests/mochitest/nonchrome_unsafeDereference.html => toolkit/devtools/server/tests/mochitest/nonchrome_unsafeDereference.html rename : toolkit/devtools/debugger/tests/mochitest/test_unsafeDereference.html => toolkit/devtools/server/tests/mochitest/test_unsafeDereference.html rename : toolkit/devtools/debugger/tests/moz.build => toolkit/devtools/server/tests/moz.build rename : toolkit/devtools/debugger/tests/unit/head_dbg.js => toolkit/devtools/server/tests/unit/head_dbg.js rename : toolkit/devtools/debugger/tests/unit/post_init_global_actors.js => toolkit/devtools/server/tests/unit/post_init_global_actors.js rename : toolkit/devtools/debugger/tests/unit/post_init_tab_actors.js => toolkit/devtools/server/tests/unit/post_init_tab_actors.js rename : toolkit/devtools/debugger/tests/unit/pre_init_global_actors.js => toolkit/devtools/server/tests/unit/pre_init_global_actors.js rename : toolkit/devtools/debugger/tests/unit/pre_init_tab_actors.js => toolkit/devtools/server/tests/unit/pre_init_tab_actors.js rename : toolkit/devtools/debugger/tests/unit/source-map-data/sourcemapped.coffee => toolkit/devtools/server/tests/unit/source-map-data/sourcemapped.coffee rename : toolkit/devtools/debugger/tests/unit/source-map-data/sourcemapped.map => toolkit/devtools/server/tests/unit/source-map-data/sourcemapped.map rename : toolkit/devtools/debugger/tests/unit/sourcemapped.js => toolkit/devtools/server/tests/unit/sourcemapped.js rename : toolkit/devtools/debugger/tests/unit/test_add_actors.js => toolkit/devtools/server/tests/unit/test_add_actors.js rename : toolkit/devtools/debugger/tests/unit/test_attach.js => toolkit/devtools/server/tests/unit/test_attach.js rename : toolkit/devtools/debugger/tests/unit/test_breakpoint-01.js => toolkit/devtools/server/tests/unit/test_breakpoint-01.js rename : toolkit/devtools/debugger/tests/unit/test_breakpoint-02.js => toolkit/devtools/server/tests/unit/test_breakpoint-02.js rename : toolkit/devtools/debugger/tests/unit/test_breakpoint-03.js => toolkit/devtools/server/tests/unit/test_breakpoint-03.js rename : toolkit/devtools/debugger/tests/unit/test_breakpoint-04.js => toolkit/devtools/server/tests/unit/test_breakpoint-04.js rename : toolkit/devtools/debugger/tests/unit/test_breakpoint-05.js => toolkit/devtools/server/tests/unit/test_breakpoint-05.js rename : toolkit/devtools/debugger/tests/unit/test_breakpoint-06.js => toolkit/devtools/server/tests/unit/test_breakpoint-06.js rename : toolkit/devtools/debugger/tests/unit/test_breakpoint-07.js => toolkit/devtools/server/tests/unit/test_breakpoint-07.js rename : toolkit/devtools/debugger/tests/unit/test_breakpoint-08.js => toolkit/devtools/server/tests/unit/test_breakpoint-08.js rename : toolkit/devtools/debugger/tests/unit/test_breakpoint-09.js => toolkit/devtools/server/tests/unit/test_breakpoint-09.js rename : toolkit/devtools/debugger/tests/unit/test_breakpoint-10.js => toolkit/devtools/server/tests/unit/test_breakpoint-10.js rename : toolkit/devtools/debugger/tests/unit/test_breakpoint-11.js => toolkit/devtools/server/tests/unit/test_breakpoint-11.js rename : toolkit/devtools/debugger/tests/unit/test_breakpoint-12.js => toolkit/devtools/server/tests/unit/test_breakpoint-12.js rename : toolkit/devtools/debugger/tests/unit/test_breakpointstore.js => toolkit/devtools/server/tests/unit/test_breakpointstore.js rename : toolkit/devtools/debugger/tests/unit/test_dbgactor.js => toolkit/devtools/server/tests/unit/test_dbgactor.js rename : toolkit/devtools/debugger/tests/unit/test_dbgclient_debuggerstatement.js => toolkit/devtools/server/tests/unit/test_dbgclient_debuggerstatement.js rename : toolkit/devtools/debugger/tests/unit/test_dbgglobal.js => toolkit/devtools/server/tests/unit/test_dbgglobal.js rename : toolkit/devtools/debugger/tests/unit/test_dbgsocket.js => toolkit/devtools/server/tests/unit/test_dbgsocket.js rename : toolkit/devtools/debugger/tests/unit/test_eval-01.js => toolkit/devtools/server/tests/unit/test_eval-01.js rename : toolkit/devtools/debugger/tests/unit/test_eval-02.js => toolkit/devtools/server/tests/unit/test_eval-02.js rename : toolkit/devtools/debugger/tests/unit/test_eval-03.js => toolkit/devtools/server/tests/unit/test_eval-03.js rename : toolkit/devtools/debugger/tests/unit/test_eval-04.js => toolkit/devtools/server/tests/unit/test_eval-04.js rename : toolkit/devtools/debugger/tests/unit/test_eval-05.js => toolkit/devtools/server/tests/unit/test_eval-05.js rename : toolkit/devtools/debugger/tests/unit/test_frameactor-01.js => toolkit/devtools/server/tests/unit/test_frameactor-01.js rename : toolkit/devtools/debugger/tests/unit/test_frameactor-02.js => toolkit/devtools/server/tests/unit/test_frameactor-02.js rename : toolkit/devtools/debugger/tests/unit/test_frameactor-03.js => toolkit/devtools/server/tests/unit/test_frameactor-03.js rename : toolkit/devtools/debugger/tests/unit/test_frameactor-04.js => toolkit/devtools/server/tests/unit/test_frameactor-04.js rename : toolkit/devtools/debugger/tests/unit/test_frameactor-05.js => toolkit/devtools/server/tests/unit/test_frameactor-05.js rename : toolkit/devtools/debugger/tests/unit/test_framearguments-01.js => toolkit/devtools/server/tests/unit/test_framearguments-01.js rename : toolkit/devtools/debugger/tests/unit/test_framebindings-01.js => toolkit/devtools/server/tests/unit/test_framebindings-01.js rename : toolkit/devtools/debugger/tests/unit/test_framebindings-02.js => toolkit/devtools/server/tests/unit/test_framebindings-02.js rename : toolkit/devtools/debugger/tests/unit/test_framebindings-03.js => toolkit/devtools/server/tests/unit/test_framebindings-03.js rename : toolkit/devtools/debugger/tests/unit/test_framebindings-04.js => toolkit/devtools/server/tests/unit/test_framebindings-04.js rename : toolkit/devtools/debugger/tests/unit/test_framebindings-05.js => toolkit/devtools/server/tests/unit/test_framebindings-05.js rename : toolkit/devtools/debugger/tests/unit/test_framebindings-06.js => toolkit/devtools/server/tests/unit/test_framebindings-06.js rename : toolkit/devtools/debugger/tests/unit/test_frameclient-01.js => toolkit/devtools/server/tests/unit/test_frameclient-01.js rename : toolkit/devtools/debugger/tests/unit/test_frameclient-02.js => toolkit/devtools/server/tests/unit/test_frameclient-02.js rename : toolkit/devtools/debugger/tests/unit/test_functiongrips-01.js => toolkit/devtools/server/tests/unit/test_functiongrips-01.js rename : toolkit/devtools/debugger/tests/unit/test_getyoungestframe.js => toolkit/devtools/server/tests/unit/test_getyoungestframe.js rename : toolkit/devtools/debugger/tests/unit/test_interrupt.js => toolkit/devtools/server/tests/unit/test_interrupt.js rename : toolkit/devtools/debugger/tests/unit/test_listsources-01.js => toolkit/devtools/server/tests/unit/test_listsources-01.js rename : toolkit/devtools/debugger/tests/unit/test_listsources-02.js => toolkit/devtools/server/tests/unit/test_listsources-02.js rename : toolkit/devtools/debugger/tests/unit/test_listsources-03.js => toolkit/devtools/server/tests/unit/test_listsources-03.js rename : toolkit/devtools/debugger/tests/unit/test_longstringactor.js => toolkit/devtools/server/tests/unit/test_longstringactor.js rename : toolkit/devtools/debugger/tests/unit/test_longstringgrips-01.js => toolkit/devtools/server/tests/unit/test_longstringgrips-01.js rename : toolkit/devtools/debugger/tests/unit/test_longstringgrips-02.js => toolkit/devtools/server/tests/unit/test_longstringgrips-02.js rename : toolkit/devtools/debugger/tests/unit/test_nativewrappers.js => toolkit/devtools/server/tests/unit/test_nativewrappers.js rename : toolkit/devtools/debugger/tests/unit/test_new_source-01.js => toolkit/devtools/server/tests/unit/test_new_source-01.js rename : toolkit/devtools/debugger/tests/unit/test_nsjsinspector.js => toolkit/devtools/server/tests/unit/test_nsjsinspector.js rename : toolkit/devtools/debugger/tests/unit/test_objectgrips-01.js => toolkit/devtools/server/tests/unit/test_objectgrips-01.js rename : toolkit/devtools/debugger/tests/unit/test_objectgrips-02.js => toolkit/devtools/server/tests/unit/test_objectgrips-02.js rename : toolkit/devtools/debugger/tests/unit/test_objectgrips-03.js => toolkit/devtools/server/tests/unit/test_objectgrips-03.js rename : toolkit/devtools/debugger/tests/unit/test_objectgrips-04.js => toolkit/devtools/server/tests/unit/test_objectgrips-04.js rename : toolkit/devtools/debugger/tests/unit/test_pause_exceptions-01.js => toolkit/devtools/server/tests/unit/test_pause_exceptions-01.js rename : toolkit/devtools/debugger/tests/unit/test_pause_exceptions-02.js => toolkit/devtools/server/tests/unit/test_pause_exceptions-02.js rename : toolkit/devtools/debugger/tests/unit/test_pauselifetime-01.js => toolkit/devtools/server/tests/unit/test_pauselifetime-01.js rename : toolkit/devtools/debugger/tests/unit/test_pauselifetime-02.js => toolkit/devtools/server/tests/unit/test_pauselifetime-02.js rename : toolkit/devtools/debugger/tests/unit/test_pauselifetime-03.js => toolkit/devtools/server/tests/unit/test_pauselifetime-03.js rename : toolkit/devtools/debugger/tests/unit/test_pauselifetime-04.js => toolkit/devtools/server/tests/unit/test_pauselifetime-04.js rename : toolkit/devtools/debugger/tests/unit/test_profiler_actor.js => toolkit/devtools/server/tests/unit/test_profiler_actor.js rename : toolkit/devtools/debugger/tests/unit/test_source-01.js => toolkit/devtools/server/tests/unit/test_source-01.js rename : toolkit/devtools/debugger/tests/unit/test_sourcemaps-01.js => toolkit/devtools/server/tests/unit/test_sourcemaps-01.js rename : toolkit/devtools/debugger/tests/unit/test_sourcemaps-02.js => toolkit/devtools/server/tests/unit/test_sourcemaps-02.js rename : toolkit/devtools/debugger/tests/unit/test_sourcemaps-03.js => toolkit/devtools/server/tests/unit/test_sourcemaps-03.js rename : toolkit/devtools/debugger/tests/unit/test_sourcemaps-04.js => toolkit/devtools/server/tests/unit/test_sourcemaps-04.js rename : toolkit/devtools/debugger/tests/unit/test_sourcemaps-05.js => toolkit/devtools/server/tests/unit/test_sourcemaps-05.js rename : toolkit/devtools/debugger/tests/unit/test_sourcemaps-06.js => toolkit/devtools/server/tests/unit/test_sourcemaps-06.js rename : toolkit/devtools/debugger/tests/unit/test_sourcemaps-07.js => toolkit/devtools/server/tests/unit/test_sourcemaps-07.js rename : toolkit/devtools/debugger/tests/unit/test_sources_backwards_compat-01.js => toolkit/devtools/server/tests/unit/test_sources_backwards_compat-01.js rename : toolkit/devtools/debugger/tests/unit/test_sources_backwards_compat-02.js => toolkit/devtools/server/tests/unit/test_sources_backwards_compat-02.js rename : toolkit/devtools/debugger/tests/unit/test_stepping-01.js => toolkit/devtools/server/tests/unit/test_stepping-01.js rename : toolkit/devtools/debugger/tests/unit/test_stepping-02.js => toolkit/devtools/server/tests/unit/test_stepping-02.js rename : toolkit/devtools/debugger/tests/unit/test_stepping-03.js => toolkit/devtools/server/tests/unit/test_stepping-03.js rename : toolkit/devtools/debugger/tests/unit/test_stepping-04.js => toolkit/devtools/server/tests/unit/test_stepping-04.js rename : toolkit/devtools/debugger/tests/unit/test_stepping-05.js => toolkit/devtools/server/tests/unit/test_stepping-05.js rename : toolkit/devtools/debugger/tests/unit/test_threadlifetime-01.js => toolkit/devtools/server/tests/unit/test_threadlifetime-01.js rename : toolkit/devtools/debugger/tests/unit/test_threadlifetime-02.js => toolkit/devtools/server/tests/unit/test_threadlifetime-02.js rename : toolkit/devtools/debugger/tests/unit/test_threadlifetime-03.js => toolkit/devtools/server/tests/unit/test_threadlifetime-03.js rename : toolkit/devtools/debugger/tests/unit/test_threadlifetime-04.js => toolkit/devtools/server/tests/unit/test_threadlifetime-04.js rename : toolkit/devtools/debugger/tests/unit/test_threadlifetime-05.js => toolkit/devtools/server/tests/unit/test_threadlifetime-05.js rename : toolkit/devtools/debugger/tests/unit/test_threadlifetime-06.js => toolkit/devtools/server/tests/unit/test_threadlifetime-06.js rename : toolkit/devtools/debugger/tests/unit/test_unsafeDereference.js => toolkit/devtools/server/tests/unit/test_unsafeDereference.js rename : toolkit/devtools/debugger/tests/unit/testactors.js => toolkit/devtools/server/tests/unit/testactors.js rename : toolkit/devtools/debugger/tests/unit/testcompatactors.js => toolkit/devtools/server/tests/unit/testcompatactors.js rename : toolkit/devtools/debugger/tests/unit/xpcshell.ini => toolkit/devtools/server/tests/unit/xpcshell.ini rename : toolkit/devtools/debugger/dbg-transport.js => toolkit/devtools/server/transport.js
169 lines
6.3 KiB
JavaScript
169 lines
6.3 KiB
JavaScript
/* Any copyright is dedicated to the Public Domain.
|
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
|
|
"use strict";
|
|
|
|
const Profiler = Cc["@mozilla.org/tools/profiler;1"].getService(Ci.nsIProfiler);
|
|
|
|
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();
|
|
DebuggerServer.init(function () { return true; });
|
|
DebuggerServer.addBrowserActors();
|
|
var client = new DebuggerClient(DebuggerServer.connectPipe());
|
|
client.connect(function () {
|
|
client.listTabs(function(aResponse) {
|
|
test_profiler_actor(client, aResponse.profilerActor);
|
|
});
|
|
});
|
|
do_test_pending();
|
|
}
|
|
|
|
function test_profiler_actor(aClient, aProfiler)
|
|
{
|
|
aClient.request({ to: aProfiler, type: "isActive" }, function (aResponse) {
|
|
do_check_false(aResponse.isActive);
|
|
|
|
aClient.request({ to: aProfiler, type: "getFeatures" }, function (aResponse) {
|
|
var features = Profiler.GetFeatures([]);
|
|
do_check_eq(aResponse.features.length, features.length);
|
|
for (var i = 0; i < features.length; i++)
|
|
do_check_eq(aResponse.features[i], features[i]);
|
|
|
|
aClient.request({ to: aProfiler, type: "startProfiler", features: ['jank', 'js'] }, function (aResponse) {
|
|
do_check_eq(typeof aResponse.msg, "string");
|
|
aClient.request({ to: aProfiler, type: "isActive" }, function (aResponse) {
|
|
do_check_true(aResponse.isActive);
|
|
|
|
aClient.request({ to: aProfiler, type: "getResponsivenessTimes" }, function (aResponse) {
|
|
do_check_eq(typeof aResponse.responsivenessTimes, "object");
|
|
|
|
aClient.request({ to: aProfiler, type: "getSharedLibraryInformation" }, function (aResponse) {
|
|
do_check_eq(typeof aResponse.sharedLibraryInformation, "string");
|
|
try {
|
|
JSON.parse(aResponse.sharedLibraryInformation);
|
|
} catch(e) {
|
|
do_throw(e.toString(), Components.stack.caller);
|
|
}
|
|
|
|
test_event_notifications(aClient, aProfiler);
|
|
});
|
|
});
|
|
});
|
|
});
|
|
});
|
|
});
|
|
}
|
|
|
|
function test_event_notifications(aClient, aProfiler)
|
|
{
|
|
aClient.request({ to: aProfiler, type: "registerEventNotifications", events: ["foo", "bar"] }, function (aResponse) {
|
|
do_check_eq(typeof aResponse.registered, "object");
|
|
do_check_eq(aResponse.registered.length, 2);
|
|
do_check_eq(aResponse.registered[0], "foo");
|
|
do_check_eq(aResponse.registered[1], "bar");
|
|
|
|
aClient.request({ to: aProfiler, type: "registerEventNotifications", events: ["foo"] }, function (aResponse) {
|
|
do_check_eq(typeof aResponse.registered, "object");
|
|
do_check_eq(aResponse.registered.length, 0);
|
|
|
|
aClient.addListener("eventNotification", function (aType, aData) {
|
|
do_check_eq(aType, "eventNotification");
|
|
do_check_eq(aData.event, "foo");
|
|
do_check_eq(typeof aData.subject, "object");
|
|
do_check_eq(aData.subject.foo, "foo");
|
|
do_check_eq(aData.data, "foo");
|
|
});
|
|
var subject = { foo: "foo" };
|
|
subject.wrappedJSObject = subject;
|
|
Services.obs.notifyObservers(subject, "foo", "foo");
|
|
|
|
aClient.request({ to: aProfiler, type: "unregisterEventNotifications", events: ["foo", "bar", "qux"] }, function (aResponse) {
|
|
do_check_eq(typeof aResponse.unregistered, "object");
|
|
do_check_eq(aResponse.unregistered.length, 2);
|
|
do_check_eq(aResponse.unregistered[0], "foo");
|
|
do_check_eq(aResponse.unregistered[1], "bar");
|
|
|
|
// All events being now unregistered, sending an event shouldn't
|
|
// do anything. If it does, the eventNotification listener above
|
|
// will catch the event and fail on the aData.event test.
|
|
Services.obs.notifyObservers(null, "bar", null);
|
|
|
|
test_profile(aClient, aProfiler);
|
|
});
|
|
});
|
|
});
|
|
}
|
|
|
|
function test_profile(aClient, aProfiler)
|
|
{
|
|
// No idea why, but Components.stack.sourceLine returns null.
|
|
var funcLine = Components.stack.lineNumber - 3;
|
|
// Busy wait a few milliseconds
|
|
var start = Date.now();
|
|
var stack;
|
|
while (Date.now() - start < 200) { stack = Components.stack; }
|
|
aClient.request({ to: aProfiler, type: "getProfile" }, function (aResponse) {
|
|
do_check_eq(typeof aResponse.profile, "object");
|
|
do_check_eq(typeof aResponse.profile.meta, "object");
|
|
do_check_eq(typeof aResponse.profile.meta.platform, "string");
|
|
do_check_eq(typeof aResponse.profile.threads, "object");
|
|
do_check_eq(typeof aResponse.profile.threads[0], "object");
|
|
do_check_eq(typeof aResponse.profile.threads[0].samples, "object");
|
|
do_check_neq(aResponse.profile.threads[0].samples.length, 0);
|
|
|
|
let location = stack.name + " (" + stack.filename + ":" + funcLine + ")";
|
|
// At least one sample is expected to have been in the busy wait above.
|
|
do_check_true(aResponse.profile.threads[0].samples.some(function(sample) {
|
|
return sample.name == "(root)" &&
|
|
typeof sample.frames == "object" &&
|
|
sample.frames.length != 0 &&
|
|
sample.frames.some(function(f) {
|
|
return (f.line == stack.lineNumber) &&
|
|
(f.location == location);
|
|
});
|
|
}));
|
|
|
|
aClient.request({ to: aProfiler, type: "stopProfiler" }, function (aResponse) {
|
|
do_check_eq(typeof aResponse.msg, "string");
|
|
aClient.request({ to: aProfiler, type: "isActive" }, function (aResponse) {
|
|
do_check_false(aResponse.isActive);
|
|
aClient.close(function() {
|
|
test_profiler_status();
|
|
});
|
|
});
|
|
});
|
|
});
|
|
}
|
|
|
|
function test_profiler_status()
|
|
{
|
|
var connectionClosed = DebuggerServer._connectionClosed;
|
|
var client = new DebuggerClient(DebuggerServer.connectPipe());
|
|
|
|
client.connect(() => {
|
|
client.listTabs((aResponse) => {
|
|
DebuggerServer._connectionClosed = function (conn) {
|
|
connectionClosed.call(this, conn);
|
|
|
|
// Check that closing the last (only?) connection stops the profiler.
|
|
do_check_false(Profiler.IsActive());
|
|
do_test_finished();
|
|
}
|
|
|
|
var profiler = aResponse.profilerActor;
|
|
do_check_false(Profiler.IsActive());
|
|
client.request({
|
|
to: profiler,
|
|
type: "startProfiler",
|
|
features: []
|
|
}, function (aResponse) {
|
|
do_check_true(Profiler.IsActive());
|
|
client.close();
|
|
});
|
|
});
|
|
});
|
|
}
|