mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Move various reflector types and traits to script_bindings (#35279)
* script: Move Reflector to script_bindings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Extract global() helper from DomObject into new trait. Move DomObject and related traits to script_bindings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
parent
0d51578cc3
commit
c94ac5bccb
212 changed files with 357 additions and 319 deletions
|
@ -12,10 +12,11 @@ use js::jsapi::{
|
|||
JSContext, JSString, JS_DeprecatedStringHasLatin1Chars, JS_GetLatin1StringCharsAndLength,
|
||||
JS_GetTwoByteStringCharsAndLength, JS_NewStringCopyN,
|
||||
};
|
||||
use js::jsval::StringValue;
|
||||
use js::rust::{HandleValue, MutableHandleValue, ToString};
|
||||
use js::jsval::{ObjectValue, StringValue};
|
||||
use js::rust::{maybe_wrap_value, HandleValue, MutableHandleValue, ToString};
|
||||
use servo_config::opts;
|
||||
|
||||
use crate::reflector::Reflector;
|
||||
use crate::str::{ByteString, DOMString, USVString};
|
||||
|
||||
// http://heycam.github.io/webidl/#es-USVString
|
||||
|
@ -191,3 +192,12 @@ impl FromJSValConvertible for ByteString {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ToJSValConvertible for Reflector {
|
||||
unsafe fn to_jsval(&self, cx: *mut JSContext, mut rval: MutableHandleValue) {
|
||||
let obj = self.get_jsobject().get();
|
||||
assert!(!obj.is_null());
|
||||
rval.set(ObjectValue(obj));
|
||||
maybe_wrap_value(cx, rval);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue