Skip to content

Commit

Permalink
use SafeJSContext
Browse files Browse the repository at this point in the history
  • Loading branch information
saschanaz committed Jul 25, 2019
1 parent caf7a24 commit 87cc409
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
8 changes: 4 additions & 4 deletions components/script/dom/bindings/codegen/CodegenRust.py
Expand Up @@ -2887,7 +2887,7 @@ class CGCollectJSONAttributesMethod(CGAbstractMethod):
Generate the CollectJSONAttributes method for an interface descriptor
"""
def __init__(self, descriptor, toJSONMethod):
args = [Argument('*mut JSContext', 'cx'),
args = [Argument('SafeJSContext', 'cx'),
Argument('HandleObject', 'obj'),
Argument('*const %s' % descriptor.concreteType, 'this'),
Argument('&RootedGuard<*mut JSObject>', 'result')]
Expand All @@ -2903,11 +2903,11 @@ def definition_body(self):
name = m.identifier.name
getAndDefine = fill(
"""
rooted!(in(cx) let mut temp = UndefinedValue());
rooted!(in(*cx) let mut temp = UndefinedValue());
if !get_${name}(cx, obj, this, JSJitGetterCallArgs { _base: temp.handle_mut().into() }) {
return false;
}
if !JS_DefineProperty(cx, result.handle().into(),
if !JS_DefineProperty(*cx, result.handle().into(),
${nameAsArray} as *const u8 as *const libc::c_char,
temp.handle(), JSPROP_ENUMERATE as u32) {
return false;
Expand Down Expand Up @@ -3667,7 +3667,7 @@ def __init__(self, descriptor, method):

def definition_body(self):
ret = dedent("""
rooted!(in(cx) let result = JS_NewPlainObject(cx));
rooted!(in(*cx) let result = JS_NewPlainObject(*cx));
if result.is_null() {
return false;
}
Expand Down
1 change: 0 additions & 1 deletion components/script/dom/rtcsessiondescription.rs
Expand Up @@ -14,7 +14,6 @@ use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::DOMString;
use crate::dom::globalscope::GlobalScope;
use crate::dom::window::Window;
use crate::script_runtime::JSContext;
use dom_struct::dom_struct;

#[dom_struct]
Expand Down

0 comments on commit 87cc409

Please sign in to comment.