mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-03 02:25:34 +00:00
Bug 1024054 - Create a previewer for ES6 Symbol. r=past
This commit is contained in:
parent
d625777813
commit
152c74b8e9
@ -3209,6 +3209,7 @@ VariablesView.isPrimitive = function(aDescriptor) {
|
||||
type == "-Infinity" ||
|
||||
type == "NaN" ||
|
||||
type == "-0" ||
|
||||
type == "symbol" ||
|
||||
type == "longString") {
|
||||
return true;
|
||||
}
|
||||
@ -3426,6 +3427,11 @@ VariablesView.stringifiers.byType = {
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
||||
symbol: function(aGrip, aOptions) {
|
||||
const name = aGrip.name || "";
|
||||
return "Symbol(" + name + ")";
|
||||
},
|
||||
}; // VariablesView.stringifiers.byType
|
||||
|
||||
VariablesView.stringifiers.byObjectClass = {
|
||||
|
@ -1129,6 +1129,7 @@ Messages.Extended.prototype = Heritage.extend(Messages.Simple.prototype,
|
||||
"infinity": "cm-atom",
|
||||
"null": "cm-atom",
|
||||
"undefined": "cm-comment",
|
||||
"symbol": "cm-atom"
|
||||
};
|
||||
|
||||
let className = map[typeof grip];
|
||||
|
@ -75,6 +75,24 @@ let inputTests = [
|
||||
output: "/foobar/",
|
||||
inspectable: true,
|
||||
},
|
||||
|
||||
// 9
|
||||
{
|
||||
input: "Symbol()",
|
||||
output: "Symbol()"
|
||||
},
|
||||
|
||||
// 10
|
||||
{
|
||||
input: "Symbol('foo')",
|
||||
output: "Symbol(foo)"
|
||||
},
|
||||
|
||||
// 11
|
||||
{
|
||||
input: "Symbol.iterator",
|
||||
output: "Symbol(Symbol.iterator)"
|
||||
},
|
||||
];
|
||||
|
||||
longString = initialString = null;
|
||||
|
@ -1743,6 +1743,9 @@ function JSTermHelpers(aOwner)
|
||||
aOwner.sandbox.print = function JSTH_print(aValue)
|
||||
{
|
||||
aOwner.helperResult = { rawOutput: true };
|
||||
if (typeof aValue === "symbol") {
|
||||
return Symbol.prototype.toString.call(aValue);
|
||||
}
|
||||
// Waiving Xrays here allows us to see a closer representation of the
|
||||
// underlying object. This may execute arbitrary content code, but that
|
||||
// code will run with content privileges, and the result will be rendered
|
||||
|
Loading…
Reference in New Issue
Block a user