Bug 941287 - Show optimized out and other missing variables in the debugger variables view with the appropriate message. r=victorporof

This commit is contained in:
James Long 2015-01-14 13:51:00 -05:00
Родитель 2b2b3cc32e
Коммит e055a70943
4 изменённых файлов: 46 добавлений и 22 удалений

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

@ -27,10 +27,10 @@ function test() {
outerScope.expand();
let upvarVar = outerScope.get("upvar");
ok(!upvarVar, "upvar was optimized out.");
if (upvarVar) {
ok(false, "upvar = " + upvarVar.target.querySelector(".value").getAttribute("value"));
}
ok(upvarVar, "The variable `upvar` is shown.");
is(upvarVar.target.querySelector(".value").getAttribute("value"),
gDebugger.L10N.getStr('variablesViewOptimizedOut'),
"Should show the optimized out message for upvar.");
let argVar = outerScope.get("arg");
is(argVar.target.querySelector(".name").getAttribute("value"), "arg",

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

@ -2426,10 +2426,27 @@ Variable.prototype = Heritage.extend(Scope.prototype, {
this._valueLabel.classList.remove(VariablesView.getClass(prevGrip));
}
this._valueGrip = aGrip;
this._valueString = VariablesView.getString(aGrip, {
concise: true,
noEllipsis: true,
});
if(aGrip && (aGrip.optimizedOut || aGrip.uninitialized || aGrip.missingArguments)) {
if(aGrip.optimizedOut) {
this._valueString = STR.GetStringFromName("variablesViewOptimizedOut")
}
else if(aGrip.uninitialized) {
this._valueString = STR.GetStringFromName("variablesViewUninitialized")
}
else if(aGrip.missingArguments) {
this._valueString = STR.GetStringFromName("variablesViewMissingArgs")
}
this.eval = null;
}
else {
this._valueString = VariablesView.getString(aGrip, {
concise: true,
noEllipsis: true,
});
this.eval = this.ownerView.eval;
}
this._valueClassName = VariablesView.getClass(aGrip);
this._valueLabel.classList.add(this._valueClassName);

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

@ -316,4 +316,8 @@ functionSearchSeparatorLabel=←
# resumed first.
resumptionOrderPanelTitle=There are one or more paused debuggers. Please resume the most-recently paused debugger first at: %S
variablesViewOptimizedOut=(optimized away)
variablesViewUninitialized=(uninitialized)
variablesViewMissingArgs=(unavailable)
evalGroupLabel=Evaluated Sources

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

@ -1701,6 +1701,18 @@ ThreadActor.prototype = {
if (aValue === null) {
return { type: "null" };
}
else if(aValue.optimizedOut ||
aValue.uninitialized ||
aValue.missingArguments) {
// The slot is optimized out, an uninitialized binding, or
// arguments on a dead scope
return {
type: "null",
optimizedOut: aValue.optimizedOut,
uninitialized: aValue.uninitialized,
missingArguments: aValue.missingArguments
};
}
return this.objectGrip(aValue, aPool);
case "symbol":
@ -4864,20 +4876,14 @@ EnvironmentActor.prototype = {
}
for each (let name in parameterNames) {
let arg = {};
let value = this.obj.getVariable(name);
// The slot is optimized out.
// FIXME: Need actual UI, bug 941287.
if (value && value.optimizedOut) {
continue;
}
// TODO: this part should be removed in favor of the commented-out part
// below when getVariableDescriptor lands (bug 725815).
let desc = {
value: value,
configurable: false,
writable: true,
writable: !(value && value.optimizedOut),
enumerable: true
};
@ -4905,19 +4911,16 @@ EnvironmentActor.prototype = {
}
let value = this.obj.getVariable(name);
// The slot is optimized out, arguments on a dead scope, or an
// uninitialized binding.
// FIXME: Need actual UI, bug 941287.
if (value && (value.optimizedOut || value.missingArguments || value.uninitialized)) {
continue;
}
// TODO: this part should be removed in favor of the commented-out part
// below when getVariableDescriptor lands.
let desc = {
value: value,
configurable: false,
writable: true,
writable: !(value &&
(value.optimizedOut ||
value.uninitialized ||
value.missingArguments)),
enumerable: true
};