1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/devtools/server/tests/unit/test_objectgrips-09.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,65 @@ 1.4 +/* Any copyright is dedicated to the Public Domain. 1.5 + http://creativecommons.org/publicdomain/zero/1.0/ */ 1.6 +/** 1.7 + * This tests exercises getProtypesAndProperties message accepted 1.8 + * by a thread actor. 1.9 + */ 1.10 + 1.11 +var gDebuggee; 1.12 +var gClient; 1.13 +var gThreadClient; 1.14 + 1.15 +function run_test() 1.16 +{ 1.17 + initTestDebuggerServer(); 1.18 + gDebuggee = addTestGlobal("test-grips"); 1.19 + gDebuggee.eval(function stopMe(arg1, arg2) { 1.20 + debugger; 1.21 + }.toString()); 1.22 + 1.23 + gClient = new DebuggerClient(DebuggerServer.connectPipe()); 1.24 + gClient.connect(function() { 1.25 + attachTestTabAndResume(gClient, "test-grips", function(aResponse, aTabClient, aThreadClient) { 1.26 + gThreadClient = aThreadClient; 1.27 + test_object_grip(); 1.28 + }); 1.29 + }); 1.30 + do_test_pending(); 1.31 +} 1.32 + 1.33 +function test_object_grip() 1.34 +{ 1.35 + gThreadClient.addOneTimeListener("paused", function(aEvent, aPacket) { 1.36 + let args = aPacket.frame.arguments; 1.37 + 1.38 + gThreadClient.getPrototypesAndProperties([args[0].actor, args[1].actor], function(aResponse) { 1.39 + let obj1 = aResponse.actors[args[0].actor]; 1.40 + let obj2 = aResponse.actors[args[1].actor]; 1.41 + do_check_eq(obj1.ownProperties.x.configurable, true); 1.42 + do_check_eq(obj1.ownProperties.x.enumerable, true); 1.43 + do_check_eq(obj1.ownProperties.x.writable, true); 1.44 + do_check_eq(obj1.ownProperties.x.value, 10); 1.45 + 1.46 + do_check_eq(obj1.ownProperties.y.configurable, true); 1.47 + do_check_eq(obj1.ownProperties.y.enumerable, true); 1.48 + do_check_eq(obj1.ownProperties.y.writable, true); 1.49 + do_check_eq(obj1.ownProperties.y.value, "kaiju"); 1.50 + 1.51 + do_check_eq(obj2.ownProperties.z.configurable, true); 1.52 + do_check_eq(obj2.ownProperties.z.enumerable, true); 1.53 + do_check_eq(obj2.ownProperties.z.writable, true); 1.54 + do_check_eq(obj2.ownProperties.z.value, 123); 1.55 + 1.56 + do_check_true(obj1.prototype != undefined); 1.57 + do_check_true(obj2.prototype != undefined); 1.58 + 1.59 + gThreadClient.resume(function() { 1.60 + finishClient(gClient); 1.61 + }); 1.62 + }); 1.63 + 1.64 + }); 1.65 + 1.66 + gDebuggee.eval("stopMe({ x: 10, y: 'kaiju'}, { z: 123 })"); 1.67 +} 1.68 +