mirror of
https://github.com/servo/servo.git
synced 2025-08-04 05:00:08 +01:00
Make Error::to_jsval take a &GlobalScope
This commit is contained in:
parent
e036579ea0
commit
ac5c4c2194
2 changed files with 4 additions and 4 deletions
|
@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::DOMExceptionBinding::DOMExceptionMethods;
|
||||||
use dom::bindings::codegen::PrototypeList::proto_id_to_name;
|
use dom::bindings::codegen::PrototypeList::proto_id_to_name;
|
||||||
use dom::bindings::conversions::{ConversionResult, FromJSValConvertible, ToJSValConvertible};
|
use dom::bindings::conversions::{ConversionResult, FromJSValConvertible, ToJSValConvertible};
|
||||||
use dom::bindings::conversions::root_from_object;
|
use dom::bindings::conversions::root_from_object;
|
||||||
use dom::bindings::global::{GlobalRef, global_root_from_context};
|
use dom::bindings::global::global_root_from_context;
|
||||||
use dom::bindings::str::USVString;
|
use dom::bindings::str::USVString;
|
||||||
use dom::domexception::{DOMErrorName, DOMException};
|
use dom::domexception::{DOMErrorName, DOMException};
|
||||||
use dom::globalscope::GlobalScope;
|
use dom::globalscope::GlobalScope;
|
||||||
|
@ -271,9 +271,9 @@ pub unsafe fn throw_invalid_this(cx: *mut JSContext, proto_id: u16) {
|
||||||
|
|
||||||
impl Error {
|
impl Error {
|
||||||
/// Convert this error value to a JS value, consuming it in the process.
|
/// Convert this error value to a JS value, consuming it in the process.
|
||||||
pub unsafe fn to_jsval(self, cx: *mut JSContext, global: GlobalRef, rval: MutableHandleValue) {
|
pub unsafe fn to_jsval(self, cx: *mut JSContext, global: &GlobalScope, rval: MutableHandleValue) {
|
||||||
assert!(!JS_IsExceptionPending(cx));
|
assert!(!JS_IsExceptionPending(cx));
|
||||||
throw_dom_exception(cx, global.as_global_scope(), self);
|
throw_dom_exception(cx, global, self);
|
||||||
assert!(JS_IsExceptionPending(cx));
|
assert!(JS_IsExceptionPending(cx));
|
||||||
assert!(JS_GetPendingException(cx, rval));
|
assert!(JS_GetPendingException(cx, rval));
|
||||||
JS_ClearPendingException(cx);
|
JS_ClearPendingException(cx);
|
||||||
|
|
|
@ -167,7 +167,7 @@ impl Promise {
|
||||||
pub fn reject_error(&self, cx: *mut JSContext, error: Error) {
|
pub fn reject_error(&self, cx: *mut JSContext, error: Error) {
|
||||||
rooted!(in(cx) let mut v = UndefinedValue());
|
rooted!(in(cx) let mut v = UndefinedValue());
|
||||||
unsafe {
|
unsafe {
|
||||||
error.to_jsval(cx, self.global().r(), v.handle_mut());
|
error.to_jsval(cx, &self.global_scope(), v.handle_mut());
|
||||||
}
|
}
|
||||||
self.reject(cx, v.handle());
|
self.reject(cx, v.handle());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue