Bug 883345 - Undefined values aren't properly displayed in the debugger's variables view, r=past

This commit is contained in:
Victor Porof 2013-06-21 17:33:57 +03:00
Родитель 337208eb02
Коммит 19edc00bbb
6 изменённых файлов: 141 добавлений и 54 удалений

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

@ -104,7 +104,7 @@ function test()
checkWatchExpressions("ReferenceError: a is not defined",
{ type: "object", class: "Object" },
{ type: "object", class: "String" },
undefined,
{ type: "undefined" },
26);
callback();
});
@ -116,9 +116,9 @@ function test()
function test2(callback) {
waitForWatchExpressions(function() {
info("Performing test2");
checkWatchExpressions(undefined,
checkWatchExpressions({ type: "undefined" },
{ type: "object", class: "Window" },
undefined,
{ type: "undefined" },
"sensational",
26);
callback();
@ -133,7 +133,7 @@ function test()
info("Performing test3");
checkWatchExpressions({ type: "object", class: "Object" },
{ type: "object", class: "Window" },
undefined,
{ type: "undefined" },
"sensational",
26);
callback();
@ -148,7 +148,7 @@ function test()
info("Performing test4");
checkWatchExpressions(5,
{ type: "object", class: "Window" },
undefined,
{ type: "undefined" },
"sensational",
27);
callback();
@ -164,7 +164,7 @@ function test()
info("Performing test5");
checkWatchExpressions(5,
{ type: "object", class: "Window" },
undefined,
{ type: "undefined" },
"sensational",
27);
callback();
@ -180,7 +180,7 @@ function test()
info("Performing test6");
checkWatchExpressions(5,
{ type: "object", class: "Window" },
undefined,
{ type: "undefined" },
"sensational",
27);
callback();
@ -196,7 +196,7 @@ function test()
info("Performing test7");
checkWatchExpressions(5,
{ type: "object", class: "Window" },
undefined,
{ type: "undefined" },
"sensational",
27);
callback();
@ -212,7 +212,7 @@ function test()
info("Performing test8");
checkWatchExpressions(5,
{ type: "object", class: "Window" },
undefined,
{ type: "undefined" },
"sensational",
27);
callback();
@ -355,13 +355,24 @@ function test()
is(w12.value.type, "object", "The eleventh value type is correct");
is(w12.value.class, "Array", "The twelfth value class is correct");
is(w13.value, false, "The 13th value is correct");
is(w14.value, expected_arguments, "The 14th value is correct");
if (typeof expected_arguments == "object") {
is(w14.value.type, expected_arguments.type, "The 14th value type is correct");
is(w14.value.class, expected_arguments.class, "The 14th value class is correct");
} else {
is(w14.value, expected_arguments, "The 14th value is correct");
}
is(w15.value, "SyntaxError: unterminated string literal", "The 15th value is correct");
is(w16.value, "SyntaxError: unterminated string literal", "The 16th value is correct");
is(w17.value, "URIError: malformed URI sequence", "The 17th value is correct");
is(w18.value, undefined, "The 18th value is correct");
is(w19.value, undefined, "The 19th value is correct");
is(w18.value.type, "undefined", "The 18th value type is correct");
is(w18.value.class, undefined, "The 18th value class is correct");
is(w19.value.type, "undefined", "The 19th value type is correct");
is(w19.value.class, undefined, "The 19th value class is correct");
is(w20.value, "SyntaxError: syntax error", "The 20th value is correct");
is(w21.value, "SyntaxError: syntax error", "The 21th value is correct");
is(w22.value, "TypeError: (intermediate value).foo is not a function", "The 22th value is correct");

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

@ -29,6 +29,7 @@ function testSimpleCall() {
let windowVar = globalScope.addItem("window");
let documentVar = globalScope.addItem("document");
let localVar0 = localScope.addItem("localVariable");
let localVar1 = localScope.addItem("localVar1");
let localVar2 = localScope.addItem("localVar2");
let localVar3 = localScope.addItem("localVar3");
@ -43,36 +44,62 @@ function testSimpleCall() {
localVar4.setGrip({ "type": "null" });
localVar5.setGrip({ "type": "object", "class": "Object" });
localVar5.addItems({ "someProp0": { "value": 42, "enumerable": true },
"someProp1": { "value": true , "enumerable": true},
"someProp2": { "value": "nasu", "enumerable": true},
"someProp3": { "value": { "type": "undefined" }, "enumerable": true},
"someProp4": { "value": { "type": "null" }, "enumerable": true },
"someProp5": {
"value": { "type": "object", "class": "Object" },
"enumerable": true
}
});
localVar5.addItems({
"someProp0": { "value": 42, "enumerable": true },
"someProp1": { "value": true , "enumerable": true},
"someProp2": { "value": "nasu", "enumerable": true},
"someProp3": { "value": { "type": "undefined" }, "enumerable": true},
"someProp4": { "value": { "type": "null" }, "enumerable": true },
"someProp5": {
"value": { "type": "object", "class": "Object" },
"enumerable": true
},
"someUndefined": {
"value": { "type": "undefined" },
"enumerable": true
},
"someAccessor": {
"get": { "type": "object", "class": "Function" },
"set": { "type": "undefined" },
"enumerable": true
}
});
localVar5.get("someProp5").addItems({ "someProp0": { "value": 42, "enumerable": true },
"someProp1": { "value": true, "enumerable": true },
"someProp2": { "value": "nasu", "enumerable": true },
"someProp3": { "value": { "type": "undefined" }, "enumerable": true },
"someProp4": { "value": { "type": "null" }, "enumerable": true },
"someAccessor": { "get": { "type": "object", "class": "Function" },
"set": { "type": "undefined" }, "enumerable": true }
});
localVar5.get("someProp5").addItems({
"someProp0": { "value": 42, "enumerable": true },
"someProp1": { "value": true, "enumerable": true },
"someProp2": { "value": "nasu", "enumerable": true },
"someProp3": { "value": { "type": "undefined" }, "enumerable": true },
"someProp4": { "value": { "type": "null" }, "enumerable": true },
"someProp5": {
"value": { "type": "object", "class": "Object" },
"enumerable": true
},
"someUndefined": {
"value": { "type": "undefined" },
"enumerable": true
},
"someAccessor": {
"get": { "type": "object", "class": "Function" },
"set": { "type": "undefined" },
"enumerable": true
}
});
windowVar.setGrip({ "type": "object", "class": "Window" });
windowVar.addItems({ "helloWorld": { "value": "hello world" } });
windowVar.addItems({
"helloWorld": { "value": "hello world" }
});
documentVar.setGrip({ "type": "object", "class": "HTMLDocument" });
documentVar.addItems({ "onload": { "value": { "type": "null" } },
"onunload": { "value": { "type": "null" } },
"onfocus": { "value": { "type": "null" } },
"onblur": { "value": { "type": "null" } },
"onclick": { "value": { "type": "null" } },
"onkeypress": { "value": { "type": "null" } } });
documentVar.addItems({
"onload": { "value": { "type": "null" } },
"onunload": { "value": { "type": "null" } },
"onfocus": { "value": { "type": "null" } },
"onblur": { "value": { "type": "null" } },
"onclick": { "value": { "type": "null" } },
"onkeypress": { "value": { "type": "null" } }
});
ok(windowVar, "The windowVar hasn't been created correctly.");
@ -84,7 +111,6 @@ function testSimpleCall() {
ok(localVar4, "The localVar4 hasn't been created correctly.");
ok(localVar5, "The localVar5 hasn't been created correctly.");
for each (let elt in globalScope.target.querySelector(".nonenum").childNodes) {
info("globalScope :: " + { id: elt.id, className: elt.className }.toSource());
}
@ -97,38 +123,63 @@ function testSimpleCall() {
is(localScope.target.querySelector(".nonenum").childNodes.length, 6,
"The localScope doesn't contain all the created variable elements.");
is(localVar5.target.querySelector(".variables-view-element-details").childNodes.length, 6,
is(localVar5.target.querySelector(".variables-view-element-details").childNodes.length, 8,
"The localVar5 doesn't contain all the created properties.");
is(localVar5.get("someProp5").target.querySelector(".variables-view-element-details").childNodes.length, 6,
is(localVar5.get("someProp5").target.querySelector(".variables-view-element-details").childNodes.length, 8,
"The localVar5.someProp5 doesn't contain all the created properties.");
is(windowVar.target.querySelector(".value").getAttribute("value"), "[object Window]",
"The grip information for the windowVar wasn't set correctly.");
is(documentVar.target.querySelector(".value").getAttribute("value"), "[object HTMLDocument]",
"The grip information for the documentVar wasn't set correctly.");
is(localVar0.target.querySelector(".value").getAttribute("value"), "42",
"The grip information for the localVar0 wasn't set correctly.");
is(localVar1.target.querySelector(".value").getAttribute("value"), "true",
"The grip information for the localVar1 wasn't set correctly.");
is(localVar2.target.querySelector(".value").getAttribute("value"), "\"nasu\"",
"The grip information for the localVar2 wasn't set correctly.");
is(localVar3.target.querySelector(".value").getAttribute("value"), "undefined",
"The grip information for the localVar3 wasn't set correctly.");
is(localVar4.target.querySelector(".value").getAttribute("value"), "null",
"The grip information for the localVar4 wasn't set correctly.");
is(localVar5.target.querySelector(".value").getAttribute("value"), "[object Object]",
"The grip information for the localVar5 wasn't set correctly.");
is(localVar5.get("someProp0").target.querySelector(".value").getAttribute("value"), "42",
"The grip information for the localVar0 wasn't set correctly.");
is(localVar5.get("someProp1").target.querySelector(".value").getAttribute("value"), "true",
"The grip information for the localVar1 wasn't set correctly.");
is(localVar5.get("someProp2").target.querySelector(".value").getAttribute("value"), "\"nasu\"",
"The grip information for the localVar2 wasn't set correctly.");
is(localVar5.get("someProp3").target.querySelector(".value").getAttribute("value"), "undefined",
"The grip information for the localVar3 wasn't set correctly.");
is(localVar5.get("someProp4").target.querySelector(".value").getAttribute("value"), "null",
"The grip information for the localVar4 wasn't set correctly.");
is(localVar5.get("someProp5").target.querySelector(".value").getAttribute("value"), "[object Object]",
"The grip information for the localVar5 wasn't set correctly.");
is(localVar5.get("someUndefined").target.querySelector(".value").getAttribute("value"), "undefined",
"The grip information for the someUndefined wasn't set correctly.");
is(localVar5.get("someAccessor").target.querySelector(".value").getAttribute("value"), "",
"The grip information for the someAccessor wasn't set correctly.");
is(localVar5.get("someProp5").get("someProp0").target.querySelector(".value").getAttribute("value"), "42",
"The grip information for the sub-localVar0 wasn't set correctly.");
is(localVar5.get("someProp5").get("someProp1").target.querySelector(".value").getAttribute("value"), "true",
"The grip information for the sub-localVar1 wasn't set correctly.");
is(localVar5.get("someProp5").get("someProp2").target.querySelector(".value").getAttribute("value"), "\"nasu\"",
"The grip information for the sub-localVar2 wasn't set correctly.");
is(localVar5.get("someProp5").get("someProp3").target.querySelector(".value").getAttribute("value"), "undefined",
"The grip information for the sub-localVar3 wasn't set correctly.");
is(localVar5.get("someProp5").get("someProp4").target.querySelector(".value").getAttribute("value"), "null",
"The grip information for the sub-localVar4 wasn't set correctly.");
is(localVar5.get("someProp5").get("someProp5").target.querySelector(".value").getAttribute("value"), "[object Object]",
"The grip information for the sub-localVar5 wasn't set correctly.");
is(localVar5.get("someProp5").get("someUndefined").target.querySelector(".value").getAttribute("value"), "undefined",
"The grip information for the sub-someUndefined wasn't set correctly.");
is(localVar5.get("someProp5").get("someAccessor").target.querySelector(".value").getAttribute("value"), "",
"The grip information for the sub-someAccessor wasn't set correctly.");
gDebugger.DebuggerController.activeThread.resume(function() {
closeDebuggerAndFinish();
});

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

@ -248,6 +248,9 @@ function testEdit(what, string, callback, expected)
if (isNaN(expected[w1.name]) && typeof expected[w1.name] == "number") {
ok(isNaN(w1.value),
"The first expression value is correct after the edit (NaN).");
} else if (expected[w1.name] === undefined) {
is(w1.value.type, "undefined",
"The first expression value is correct after the edit (undefined).");
} else {
is(w1.value, expected[w1.name],
"The first expression value is correct after the edit.");
@ -258,6 +261,9 @@ function testEdit(what, string, callback, expected)
if (isNaN(expected[w2.name]) && typeof expected[w2.name] == "number") {
ok(isNaN(w2.value),
"The second expression value is correct after the edit (NaN).");
} else if (expected[w2.name] === undefined) {
is(w2.value.type, "undefined",
"The second expression value is correct after the edit (undefined).");
} else {
is(w2.value, expected[w2.name],
"The second expression value is correct after the edit.");
@ -268,6 +274,9 @@ function testEdit(what, string, callback, expected)
if (isNaN(expected[w3.name]) && typeof expected[w3.name] == "number") {
ok(isNaN(w3.value),
"The third expression value is correct after the edit (NaN).");
} else if (expected[w3.name] === undefined) {
is(w3.value.type, "undefined",
"The third expression value is correct after the edit (undefined).");
} else {
is(w3.value, expected[w3.name],
"The third expression value is correct after the edit.");

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

@ -96,7 +96,9 @@ function testFrameEval() {
"Should have the one close button visible for 'aArg'.");
is(scope.get("aArg").name, "aArg",
"Should have the right name for 'aArg'.");
is(scope.get("aArg").value, undefined,
is(scope.get("aArg").value.type, "undefined",
"Should have the right value for 'aArg'.");
is(scope.get("aArg").value.class, undefined,
"Should have the right value for 'aArg'.");
is(scope.get("document.title")._isContentVisible, true,

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

@ -1790,7 +1790,7 @@ ObjectActor.prototype = {
enumerable: desc.enumerable
};
if (desc.value !== undefined) {
if ("value" in desc) {
retval.writable = desc.writable;
retval.value = this.threadActor.createValueGrip(desc.value);
} else {

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

@ -46,8 +46,22 @@ function test_pause_frame()
do_check_eq(vars.c.value.class, "Object");
do_check_true(!!vars.c.value.actor);
gThreadClient.resume(function() {
finishClient(gClient);
let objClient = gThreadClient.pauseGrip(vars.c.value);
objClient.getPrototypeAndProperties(function(aResponse) {
do_check_eq(aResponse.ownProperties.a.configurable, true);
do_check_eq(aResponse.ownProperties.a.enumerable, true);
do_check_eq(aResponse.ownProperties.a.writable, true);
do_check_eq(aResponse.ownProperties.a.value, "a");
do_check_eq(aResponse.ownProperties.b.configurable, true);
do_check_eq(aResponse.ownProperties.b.enumerable, true);
do_check_eq(aResponse.ownProperties.b.writable, true);
do_check_eq(aResponse.ownProperties.b.value.type, "undefined");
do_check_false("class" in aResponse.ownProperties.b.value);
gThreadClient.resume(function() {
finishClient(gClient);
});
});
});
@ -55,7 +69,7 @@ function test_pause_frame()
function stopMe(aNumber, aBool, aString, aNull, aUndefined, aObject) {
var a = 1;
var b = true;
var c = { a: "a" };
var c = { a: "a", b: undefined };
debugger;
};
stopMe(42, true, "nasu", null, undefined, { foo: "bar" });