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