зеркало из https://github.com/mozilla/gecko-dev.git
Add ConversionError and make it work for undefined.foo.
This commit is contained in:
Родитель
54e442adf3
Коммит
0912f3ec41
|
@ -79,7 +79,8 @@ public class NativeGlobal {
|
|||
global.defineProperty("undefined", Undefined.instance,
|
||||
ScriptableObject.DONTENUM);
|
||||
|
||||
String[] errorMethods = { "EvalError",
|
||||
String[] errorMethods = { "ConversionError",
|
||||
"EvalError",
|
||||
"RangeError",
|
||||
"ReferenceError",
|
||||
"SyntaxError",
|
||||
|
|
|
@ -766,10 +766,12 @@ public class ScriptRuntime {
|
|||
catch (ClassCastException e) {
|
||||
start = toObject(scope, obj);
|
||||
}
|
||||
if (start == null) {
|
||||
if (start == null || start == Undefined.instance) {
|
||||
String msg = start == null ? "msg.null.to.object"
|
||||
: "msg.undefined";
|
||||
throw NativeGlobal.constructError(
|
||||
Context.getContext(), "TypeError",
|
||||
ScriptRuntime.getMessage("msg.null.to.object", null),
|
||||
Context.getContext(), "ConversionError",
|
||||
ScriptRuntime.getMessage(msg, null),
|
||||
scope);
|
||||
}
|
||||
Scriptable m = start;
|
||||
|
|
|
@ -79,7 +79,8 @@ public class NativeGlobal {
|
|||
global.defineProperty("undefined", Undefined.instance,
|
||||
ScriptableObject.DONTENUM);
|
||||
|
||||
String[] errorMethods = { "EvalError",
|
||||
String[] errorMethods = { "ConversionError",
|
||||
"EvalError",
|
||||
"RangeError",
|
||||
"ReferenceError",
|
||||
"SyntaxError",
|
||||
|
|
|
@ -766,10 +766,12 @@ public class ScriptRuntime {
|
|||
catch (ClassCastException e) {
|
||||
start = toObject(scope, obj);
|
||||
}
|
||||
if (start == null) {
|
||||
if (start == null || start == Undefined.instance) {
|
||||
String msg = start == null ? "msg.null.to.object"
|
||||
: "msg.undefined";
|
||||
throw NativeGlobal.constructError(
|
||||
Context.getContext(), "TypeError",
|
||||
ScriptRuntime.getMessage("msg.null.to.object", null),
|
||||
Context.getContext(), "ConversionError",
|
||||
ScriptRuntime.getMessage(msg, null),
|
||||
scope);
|
||||
}
|
||||
Scriptable m = start;
|
||||
|
|
Загрузка…
Ссылка в новой задаче