avm2: Implement `Error.prototype.toString`
And remove `ErrorObject::to_string` implementation. This fixes a few avmplus tests.
This commit is contained in:
parent
88f8020e54
commit
2057417824
|
@ -20,5 +20,10 @@ package {
|
|||
public native function getStackTrace():String;
|
||||
|
||||
public static const length:int = 1;
|
||||
|
||||
prototype.toString = function():String {
|
||||
var self:Error = this;
|
||||
return self.message.length == 0 ? self.name : self.name + ": " + self.message;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@ use crate::avm2::activation::Activation;
|
|||
use crate::avm2::call_stack::CallStack;
|
||||
use crate::avm2::object::script_object::ScriptObjectData;
|
||||
use crate::avm2::object::{ClassObject, Object, ObjectPtr, TObject};
|
||||
use crate::avm2::string::AvmString;
|
||||
use crate::avm2::value::Value;
|
||||
use crate::avm2::Error;
|
||||
use crate::string::WString;
|
||||
|
@ -139,10 +138,6 @@ impl<'gc> TObject<'gc> for ErrorObject<'gc> {
|
|||
Ok(Value::Object(Object::from(*self)))
|
||||
}
|
||||
|
||||
fn to_string(&self, activation: &mut Activation<'_, 'gc>) -> Result<Value<'gc>, Error<'gc>> {
|
||||
Ok(AvmString::new(activation.context.gc_context, self.display()?).into())
|
||||
}
|
||||
|
||||
fn as_error_object(&self) -> Option<ErrorObject<'gc>> {
|
||||
Some(*self)
|
||||
}
|
||||
|
|
|
@ -1,2 +1 @@
|
|||
num_ticks = 1
|
||||
known_failure = true
|
||||
|
|
|
@ -1,2 +1 @@
|
|||
num_ticks = 1
|
||||
known_failure = true
|
||||
|
|
|
@ -1,2 +1 @@
|
|||
num_ticks = 1
|
||||
known_failure = true
|
||||
|
|
Loading…
Reference in New Issue