mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Auto merge of #25272 - pshaughn:domexception_inherits_tostring, r=Manishearth
DOMException now inherits its Javascript toString from Error <!-- Please describe your changes on the following line: --> stringifier is out of the DOMException IDL, and Stringifier(&self) is moved into the main body of DOMException where it can continue to be called internally. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #25042 <!-- Either: --> - [X] There are tests for these changes <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
This commit is contained in:
commit
e8d6ed09c4
4 changed files with 6 additions and 26 deletions
|
@ -6,7 +6,6 @@
|
|||
|
||||
#[cfg(feature = "js_backtrace")]
|
||||
use crate::dom::bindings::cell::DomRefCell;
|
||||
use crate::dom::bindings::codegen::Bindings::DOMExceptionBinding::DOMExceptionMethods;
|
||||
use crate::dom::bindings::codegen::PrototypeList::proto_id_to_name;
|
||||
use crate::dom::bindings::conversions::root_from_object;
|
||||
use crate::dom::bindings::conversions::{
|
||||
|
@ -221,7 +220,7 @@ impl ErrorInfo {
|
|||
|
||||
Some(ErrorInfo {
|
||||
filename: "".to_string(),
|
||||
message: exception.Stringifier().into(),
|
||||
message: exception.stringifier().into(),
|
||||
lineno: 0,
|
||||
column: 0,
|
||||
})
|
||||
|
|
|
@ -149,6 +149,11 @@ impl DOMException {
|
|||
DOMExceptionBinding::Wrap,
|
||||
))
|
||||
}
|
||||
|
||||
// not an IDL stringifier, used internally
|
||||
pub fn stringifier(&self) -> DOMString {
|
||||
DOMString::from(format!("{}: {}", self.name, self.message))
|
||||
}
|
||||
}
|
||||
|
||||
impl DOMExceptionMethods for DOMException {
|
||||
|
@ -169,9 +174,4 @@ impl DOMExceptionMethods for DOMException {
|
|||
fn Message(&self) -> DOMString {
|
||||
self.message.clone()
|
||||
}
|
||||
|
||||
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-error.prototype.tostring
|
||||
fn Stringifier(&self) -> DOMString {
|
||||
DOMString::from(format!("{}: {}", self.name, self.message))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,6 +47,4 @@ interface DOMException {
|
|||
|
||||
// A custom message set by the thrower.
|
||||
readonly attribute DOMString message;
|
||||
|
||||
stringifier;
|
||||
};
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
[DOMException-custom-bindings.any.worker.html]
|
||||
type: testharness
|
||||
[Inherits its toString() from Error.prototype]
|
||||
expected: FAIL
|
||||
|
||||
[toString() behavior from Error.prototype applies as expected]
|
||||
expected: FAIL
|
||||
|
||||
|
||||
[DOMException-custom-bindings.any.html]
|
||||
type: testharness
|
||||
[Inherits its toString() from Error.prototype]
|
||||
expected: FAIL
|
||||
|
||||
[toString() behavior from Error.prototype applies as expected]
|
||||
expected: FAIL
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue