mirror of
https://github.com/servo/servo.git
synced 2025-06-25 01:24:37 +01:00
Improve jsid_to_str's name and documentation.
This commit is contained in:
parent
821797d6f7
commit
6023560863
2 changed files with 10 additions and 5 deletions
|
@ -4658,7 +4658,7 @@ class CGProxyNamedOperation(CGProxySpecialOperation):
|
|||
def define(self):
|
||||
# Our first argument is the id we're getting.
|
||||
argName = self.arguments[0].identifier.name
|
||||
return ("let %s = jsid_to_str(cx, id);\n"
|
||||
return ("let %s = string_jsid_to_string(cx, id);\n"
|
||||
"let this = UnwrapProxy(proxy);\n"
|
||||
"let this = &*this;\n" % argName +
|
||||
CGProxySpecialOperation.define(self))
|
||||
|
@ -5528,13 +5528,13 @@ def generate_imports(config, cgthings, descriptors, callbacks=None, dictionaries
|
|||
'dom::bindings::conversions::StringificationBehavior',
|
||||
'dom::bindings::conversions::ToJSValConvertible',
|
||||
'dom::bindings::conversions::is_array_like',
|
||||
'dom::bindings::conversions::jsid_to_str',
|
||||
'dom::bindings::conversions::native_from_handlevalue',
|
||||
'dom::bindings::conversions::native_from_object',
|
||||
'dom::bindings::conversions::private_from_object',
|
||||
'dom::bindings::conversions::root_from_handleobject',
|
||||
'dom::bindings::conversions::root_from_handlevalue',
|
||||
'dom::bindings::conversions::root_from_object',
|
||||
'dom::bindings::conversions::string_jsid_to_string',
|
||||
'dom::bindings::codegen::PrototypeList',
|
||||
'dom::bindings::codegen::RegisterBindings',
|
||||
'dom::bindings::codegen::UnionTypes',
|
||||
|
|
|
@ -115,9 +115,14 @@ impl <T: Reflectable + IDLInterface> FromJSValConvertible for Root<T> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Convert the given `jsid` to a `DOMString`. Fails if the `jsid` is not a
|
||||
/// string, or if the string does not contain valid UTF-16.
|
||||
pub fn jsid_to_str(cx: *mut JSContext, id: HandleId) -> DOMString {
|
||||
/// Convert `id` to a `DOMString`, assuming it is string-valued.
|
||||
///
|
||||
/// Handling of invalid UTF-16 in strings depends on the relevant option.
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics if `id` is not string-valued.
|
||||
pub fn string_jsid_to_string(cx: *mut JSContext, id: HandleId) -> DOMString {
|
||||
unsafe {
|
||||
assert!(RUST_JSID_IS_STRING(id));
|
||||
jsstring_to_str(cx, RUST_JSID_TO_STRING(id))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue