mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1096294 - Display pseudo-arrays like arrays in the console; r=pbrosset
This commit is contained in:
parent
ad415cdbfc
commit
1d6ee5de01
@ -58,7 +58,7 @@ function initialChecks() {
|
||||
|
||||
is(objectVar.target.querySelector(".name").getAttribute("value"), "largeObject",
|
||||
"Should have the right property name for 'largeObject'.");
|
||||
is(objectVar.target.querySelector(".value").getAttribute("value"), "Object",
|
||||
is(objectVar.target.querySelector(".value").getAttribute("value"), "Object[10000]",
|
||||
"Should have the right property value for 'largeObject'.");
|
||||
ok(objectVar.target.querySelector(".value").className.contains("token-other"),
|
||||
"Should have the right token class for 'largeObject'.");
|
||||
|
@ -109,7 +109,41 @@ let inputTests = [
|
||||
inspectable: false,
|
||||
printOutput: "SHOW\nALL\nOF\nTHIS\nON\nA\nSINGLE\nLINE ONLY. ESCAPE ALL NEWLINE,SHOW\nALL\nOF\nTHIS\nON\nA\nSINGLE\nLINE ONLY. ESCAPE ALL NEWLINE,SHOW\nALL\nOF\nTHIS\nON\nA\nSINGLE\nLINE ONLY. ESCAPE ALL NEWLINE",
|
||||
variablesViewLabel: "Array[3]"
|
||||
}
|
||||
},
|
||||
|
||||
// 13
|
||||
{
|
||||
input: '({0: "a", 1: "b"})',
|
||||
output: 'Object [ "a", "b" ]',
|
||||
printOutput: "[object Object]",
|
||||
inspectable: false,
|
||||
},
|
||||
|
||||
// 14
|
||||
{
|
||||
input: '({0: "a", 42: "b"})',
|
||||
output: 'Object { 0: "a", 42: "b" }',
|
||||
printOutput: "[object Object]",
|
||||
inspectable: false,
|
||||
},
|
||||
|
||||
// 15
|
||||
{
|
||||
input: '({0: "a", 1: "b", 2: "c", 3: "d", 4: "e", 5: "f", 6: "g", 7: "h", 8: "i", 9: "j", 10: "k", 11: "l"})',
|
||||
output: 'Object [ "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", 2 more\u2026 ]',
|
||||
printOutput: "[object Object]",
|
||||
inspectable: true,
|
||||
variablesViewLabel: "Object[12]",
|
||||
},
|
||||
|
||||
// 16
|
||||
{
|
||||
input: '({0: "a", 1: "b", 2: "c", 3: "d", 4: "e", 5: "f", 6: "g", 7: "h", 8: "i", 9: "j", 10: "k", 11: "l", m: "n"})',
|
||||
output: 'Object { 0: "a", 1: "b", 2: "c", 3: "d", 4: "e", 5: "f", 6: "g", 7: "h", 8: "i", 9: "j", 3 more\u2026 }',
|
||||
printOutput: "[object Object]",
|
||||
inspectable: true,
|
||||
variablesViewLabel: "Object",
|
||||
},
|
||||
];
|
||||
|
||||
function test() {
|
||||
|
@ -4325,6 +4325,43 @@ DebuggerServer.ObjectActorPreviewers.Object = [
|
||||
return true;
|
||||
},
|
||||
|
||||
function PseudoArray({obj, threadActor}, aGrip, aRawObj) {
|
||||
let length = 0;
|
||||
|
||||
// Making sure all keys are numbers from 0 to length-1
|
||||
let keys = obj.getOwnPropertyNames();
|
||||
if (keys.length == 0) {
|
||||
return false;
|
||||
}
|
||||
for (let key of keys) {
|
||||
if (isNaN(key) || key != length++) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
aGrip.preview = {
|
||||
kind: "ArrayLike",
|
||||
length: length,
|
||||
};
|
||||
|
||||
// Avoid recursive object grips.
|
||||
if (threadActor._gripDepth > 1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
let items = aGrip.preview.items = [];
|
||||
|
||||
let i = 0;
|
||||
for (let key of keys) {
|
||||
if (aRawObj.hasOwnProperty(key) && i++ < OBJECT_PREVIEW_MAX_ITEMS) {
|
||||
let value = makeDebuggeeValueIfNeeded(obj, aRawObj[key]);
|
||||
items.push(threadActor.createValueGrip(value));
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}, // PseudoArray
|
||||
|
||||
function GenericObject(aObjectActor, aGrip) {
|
||||
let {obj, threadActor} = aObjectActor;
|
||||
if (aGrip.preview || aGrip.displayString || threadActor._gripDepth > 1) {
|
||||
|
Loading…
Reference in New Issue
Block a user