mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Throw type error when calling DOM constructor without new.
This commit is contained in:
parent
43f5b4899b
commit
56a8237ef4
3 changed files with 45 additions and 15 deletions
|
@ -312,6 +312,12 @@ pub unsafe fn throw_invalid_this(cx: *mut JSContext, proto_id: u16) {
|
|||
throw_type_error(cx, &error);
|
||||
}
|
||||
|
||||
pub unsafe fn throw_constructor_without_new(cx: *mut JSContext, name: &str) {
|
||||
debug_assert!(!JS_IsExceptionPending(cx));
|
||||
let error = format!("{} constructor: 'new' is required", name);
|
||||
throw_type_error(cx, &error);
|
||||
}
|
||||
|
||||
impl Error {
|
||||
/// Convert this error value to a JS value, consuming it in the process.
|
||||
pub unsafe fn to_jsval(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue