Issue #2026 - Part 3b - Add BigInt Devtools support. (legacy frontend)

This commit is contained in:
Martok 2023-07-28 23:35:59 +02:00 • committed by roytam1
commit 61efc86b21
2 changed files with 20 additions and 9 deletions

View file

@ -3236,14 +3236,6 @@ VariablesView.prototype.isOverridden = function (aItem) {
* The variable's descriptor. * The variable's descriptor.
*/ */
VariablesView.isPrimitive = function (aDescriptor) { VariablesView.isPrimitive = function (aDescriptor) {
// For accessor property descriptors, the getter and setter need to be
// contained in 'get' and 'set' properties.
let getter = aDescriptor.get;
let setter = aDescriptor.set;
if (getter || setter) {
return false;
}
// As described in the remote debugger protocol, the value grip // As described in the remote debugger protocol, the value grip
// must be contained in a 'value' property. // must be contained in a 'value' property.
let grip = aDescriptor.value; let grip = aDescriptor.value;
@ -3261,7 +3253,8 @@ VariablesView.isPrimitive = function (aDescriptor) {
type == "NaN" || type == "NaN" ||
type == "-0" || type == "-0" ||
type == "symbol" || type == "symbol" ||
type == "longString") { type == "longString" ||
type == "BigInt") {
return true; return true;
} }
@ -3354,6 +3347,10 @@ VariablesView.getGrip = function (aValue) {
return { type: "-0" }; return { type: "-0" };
} }
return aValue; return aValue;
case "bigint":
return { type: "BigInt",
text: aValue.toString(),
};
case "undefined": case "undefined":
// document.all is also "undefined" // document.all is also "undefined"
if (aValue === undefined) { if (aValue === undefined) {
@ -3496,6 +3493,10 @@ VariablesView.stringifiers.byType = {
return keyString + " \u2192 " + valueString; return keyString + " \u2192 " + valueString;
}, },
BigInt: function (aGrip, aOptions) {
return aGrip.text + "n";
},
}; // VariablesView.stringifiers.byType }; // VariablesView.stringifiers.byType
VariablesView.stringifiers.byObjectClass = { VariablesView.stringifiers.byObjectClass = {

View file

@ -1293,6 +1293,7 @@ Messages.Extended.prototype = extend(Messages.Simple.prototype, {
{ {
let map = { let map = {
"number": "cm-number", "number": "cm-number",
"bigint": "cm-number",
"longstring": "console-string", "longstring": "console-string",
"string": "console-string", "string": "console-string",
"regexp": "cm-string-2", "regexp": "cm-string-2",
@ -3364,6 +3365,15 @@ Widgets.ObjectRenderers.add({
render: WrappedPrimitiveRenderer, render: WrappedPrimitiveRenderer,
}); });
/**
* The widget used for displaying BigInt previews.
*/
Widgets.ObjectRenderers.add({
byClass: "BigInt",
render: WrappedPrimitiveRenderer,
});
/** /**
* The widget used for displaying String previews. * The widget used for displaying String previews.
*/ */