2012-02-07 09:22:30 -08:00
|
|
|
/* Any copyright is dedicated to the Public Domain.
|
|
|
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Check that thread-lifetime grips last past a resume.
|
|
|
|
*/
|
|
|
|
|
|
|
|
var gDebuggee;
|
|
|
|
var gClient;
|
|
|
|
var gThreadClient;
|
|
|
|
|
|
|
|
function run_test()
|
|
|
|
{
|
|
|
|
initTestDebuggerServer();
|
|
|
|
gDebuggee = addTestGlobal("test-grips");
|
|
|
|
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
2012-01-23 00:29:15 -08:00
|
|
|
gClient.connect(function() {
|
2013-05-07 10:20:34 -07:00
|
|
|
attachTestTabAndResume(gClient, "test-grips", function(aResponse, aTabClient, aThreadClient) {
|
2012-02-07 09:22:30 -08:00
|
|
|
gThreadClient = aThreadClient;
|
|
|
|
test_thread_lifetime();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
do_test_pending();
|
|
|
|
}
|
|
|
|
|
|
|
|
function test_thread_lifetime()
|
|
|
|
{
|
|
|
|
gThreadClient.addOneTimeListener("paused", function(aEvent, aPacket) {
|
2012-03-13 00:13:02 -07:00
|
|
|
let pauseGrip = aPacket.frame.arguments[0];
|
2012-02-07 09:22:30 -08:00
|
|
|
|
2012-10-12 01:26:49 -07:00
|
|
|
// Create a thread-lifetime actor for this object.
|
2012-02-07 09:22:30 -08:00
|
|
|
gClient.request({ to: pauseGrip.actor, type: "threadGrip" }, function(aResponse) {
|
2012-10-12 01:26:49 -07:00
|
|
|
// Successful promotion won't return an error.
|
|
|
|
do_check_eq(aResponse.error, undefined);
|
2012-02-07 09:22:30 -08:00
|
|
|
gThreadClient.addOneTimeListener("paused", function(aEvent, aPacket) {
|
2012-11-14 00:00:57 -08:00
|
|
|
// Verify that the promoted actor is returned again.
|
|
|
|
do_check_eq(pauseGrip.actor, aPacket.frame.arguments[0].actor);
|
2012-02-07 09:22:30 -08:00
|
|
|
// Now that we've resumed, release the thread-lifetime grip.
|
2012-10-12 01:26:49 -07:00
|
|
|
gClient.release(pauseGrip.actor, function(aResponse) {
|
|
|
|
gClient.request({ to: pauseGrip.actor, type: "bogusRequest" }, function(aResponse) {
|
2012-02-07 09:22:30 -08:00
|
|
|
do_check_eq(aResponse.error, "noSuchActor");
|
|
|
|
gThreadClient.resume(function(aResponse) {
|
|
|
|
finishClient(gClient);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
gThreadClient.resume();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
gDebuggee.eval("(" + function() {
|
|
|
|
function stopMe(arg1) {
|
|
|
|
debugger;
|
|
|
|
debugger;
|
|
|
|
};
|
|
|
|
stopMe({obj: true});
|
|
|
|
} + ")()");
|
2012-01-23 00:29:15 -08:00
|
|
|
}
|