@@ -34,12 +34,12 @@ use jsapi::{ForOfIterator, ForOfIterator_NonIterableBehavior};
34
34
use jsapi:: { Heap , JS_DefineElement , JS_GetLatin1StringCharsAndLength } ;
35
35
use jsapi:: { JS_GetTwoByteStringCharsAndLength , JS_NewArrayObject1 } ;
36
36
use jsapi:: { JS_NewUCStringCopyN , JSPROP_ENUMERATE , JS_StringHasLatin1Chars } ;
37
- use jsapi:: { JSContext , JSObject , JSString , MutableHandleValue , RootedObject } ;
37
+ use jsapi:: { JSContext , JSObject , JSString , RootedObject } ;
38
38
use jsval:: { BooleanValue , Int32Value , NullValue , UInt32Value , UndefinedValue } ;
39
39
use jsval:: { JSVal , ObjectValue , ObjectOrNullValue , StringValue } ;
40
40
use rust:: { ToBoolean , ToInt32 , ToInt64 , ToNumber , ToUint16 , ToUint32 , ToUint64 } ;
41
41
use rust:: { ToString , maybe_wrap_object_or_null_value, maybe_wrap_object_value} ;
42
- use rust:: { HandleValue } ;
42
+ use rust:: { HandleValue , MutableHandleValue } ;
43
43
use rust:: maybe_wrap_value;
44
44
use libc;
45
45
use num_traits:: { Bounded , Zero } ;
@@ -181,7 +181,7 @@ fn clamp_to<D>(d: f64) -> D
181
181
// https://heycam.github.io/webidl/#es-void
182
182
impl ToJSValConvertible for ( ) {
183
183
#[ inline]
184
- unsafe fn to_jsval ( & self , _cx : * mut JSContext , rval : MutableHandleValue ) {
184
+ unsafe fn to_jsval ( & self , _cx : * mut JSContext , mut rval : MutableHandleValue ) {
185
185
rval. set ( UndefinedValue ( ) ) ;
186
186
}
187
187
}
@@ -208,23 +208,23 @@ impl FromJSValConvertible for Heap<JSVal> {
208
208
209
209
impl ToJSValConvertible for JSVal {
210
210
#[ inline]
211
- unsafe fn to_jsval ( & self , cx : * mut JSContext , rval : MutableHandleValue ) {
211
+ unsafe fn to_jsval ( & self , cx : * mut JSContext , mut rval : MutableHandleValue ) {
212
212
rval. set ( * self ) ;
213
213
maybe_wrap_value ( cx, rval) ;
214
214
}
215
215
}
216
216
217
217
impl < ' a > ToJSValConvertible for HandleValue < ' a > {
218
218
#[ inline]
219
- unsafe fn to_jsval ( & self , cx : * mut JSContext , rval : MutableHandleValue ) {
219
+ unsafe fn to_jsval ( & self , cx : * mut JSContext , mut rval : MutableHandleValue ) {
220
220
rval. set ( self . get ( ) ) ;
221
221
maybe_wrap_value ( cx, rval) ;
222
222
}
223
223
}
224
224
225
225
impl ToJSValConvertible for Heap < JSVal > {
226
226
#[ inline]
227
- unsafe fn to_jsval ( & self , cx : * mut JSContext , rval : MutableHandleValue ) {
227
+ unsafe fn to_jsval ( & self , cx : * mut JSContext , mut rval : MutableHandleValue ) {
228
228
rval. set ( self . get ( ) ) ;
229
229
maybe_wrap_value ( cx, rval) ;
230
230
}
@@ -249,7 +249,7 @@ unsafe fn convert_int_from_jsval<T, M>(cx: *mut JSContext, value: HandleValue,
249
249
// https://heycam.github.io/webidl/#es-boolean
250
250
impl ToJSValConvertible for bool {
251
251
#[ inline]
252
- unsafe fn to_jsval ( & self , _cx : * mut JSContext , rval : MutableHandleValue ) {
252
+ unsafe fn to_jsval ( & self , _cx : * mut JSContext , mut rval : MutableHandleValue ) {
253
253
rval. set ( BooleanValue ( * self ) ) ;
254
254
}
255
255
}
@@ -265,7 +265,7 @@ impl FromJSValConvertible for bool {
265
265
// https://heycam.github.io/webidl/#es-byte
266
266
impl ToJSValConvertible for i8 {
267
267
#[ inline]
268
- unsafe fn to_jsval ( & self , _cx : * mut JSContext , rval : MutableHandleValue ) {
268
+ unsafe fn to_jsval ( & self , _cx : * mut JSContext , mut rval : MutableHandleValue ) {
269
269
rval. set ( Int32Value ( * self as i32 ) ) ;
270
270
}
271
271
}
@@ -284,7 +284,7 @@ impl FromJSValConvertible for i8 {
284
284
// https://heycam.github.io/webidl/#es-octet
285
285
impl ToJSValConvertible for u8 {
286
286
#[ inline]
287
- unsafe fn to_jsval ( & self , _cx : * mut JSContext , rval : MutableHandleValue ) {
287
+ unsafe fn to_jsval ( & self , _cx : * mut JSContext , mut rval : MutableHandleValue ) {
288
288
rval. set ( Int32Value ( * self as i32 ) ) ;
289
289
}
290
290
}
@@ -303,7 +303,7 @@ impl FromJSValConvertible for u8 {
303
303
// https://heycam.github.io/webidl/#es-short
304
304
impl ToJSValConvertible for i16 {
305
305
#[ inline]
306
- unsafe fn to_jsval ( & self , _cx : * mut JSContext , rval : MutableHandleValue ) {
306
+ unsafe fn to_jsval ( & self , _cx : * mut JSContext , mut rval : MutableHandleValue ) {
307
307
rval. set ( Int32Value ( * self as i32 ) ) ;
308
308
}
309
309
}
@@ -322,7 +322,7 @@ impl FromJSValConvertible for i16 {
322
322
// https://heycam.github.io/webidl/#es-unsigned-short
323
323
impl ToJSValConvertible for u16 {
324
324
#[ inline]
325
- unsafe fn to_jsval ( & self , _cx : * mut JSContext , rval : MutableHandleValue ) {
325
+ unsafe fn to_jsval ( & self , _cx : * mut JSContext , mut rval : MutableHandleValue ) {
326
326
rval. set ( Int32Value ( * self as i32 ) ) ;
327
327
}
328
328
}
@@ -341,7 +341,7 @@ impl FromJSValConvertible for u16 {
341
341
// https://heycam.github.io/webidl/#es-long
342
342
impl ToJSValConvertible for i32 {
343
343
#[ inline]
344
- unsafe fn to_jsval ( & self , _cx : * mut JSContext , rval : MutableHandleValue ) {
344
+ unsafe fn to_jsval ( & self , _cx : * mut JSContext , mut rval : MutableHandleValue ) {
345
345
rval. set ( Int32Value ( * self ) ) ;
346
346
}
347
347
}
@@ -360,7 +360,7 @@ impl FromJSValConvertible for i32 {
360
360
// https://heycam.github.io/webidl/#es-unsigned-long
361
361
impl ToJSValConvertible for u32 {
362
362
#[ inline]
363
- unsafe fn to_jsval ( & self , _cx : * mut JSContext , rval : MutableHandleValue ) {
363
+ unsafe fn to_jsval ( & self , _cx : * mut JSContext , mut rval : MutableHandleValue ) {
364
364
rval. set ( UInt32Value ( * self ) ) ;
365
365
}
366
366
}
@@ -379,7 +379,7 @@ impl FromJSValConvertible for u32 {
379
379
// https://heycam.github.io/webidl/#es-long-long
380
380
impl ToJSValConvertible for i64 {
381
381
#[ inline]
382
- unsafe fn to_jsval ( & self , _cx : * mut JSContext , rval : MutableHandleValue ) {
382
+ unsafe fn to_jsval ( & self , _cx : * mut JSContext , mut rval : MutableHandleValue ) {
383
383
rval. set ( RUST_JS_NumberValue ( * self as f64 ) ) ;
384
384
}
385
385
}
@@ -398,7 +398,7 @@ impl FromJSValConvertible for i64 {
398
398
// https://heycam.github.io/webidl/#es-unsigned-long-long
399
399
impl ToJSValConvertible for u64 {
400
400
#[ inline]
401
- unsafe fn to_jsval ( & self , _cx : * mut JSContext , rval : MutableHandleValue ) {
401
+ unsafe fn to_jsval ( & self , _cx : * mut JSContext , mut rval : MutableHandleValue ) {
402
402
rval. set ( RUST_JS_NumberValue ( * self as f64 ) ) ;
403
403
}
404
404
}
@@ -417,7 +417,7 @@ impl FromJSValConvertible for u64 {
417
417
// https://heycam.github.io/webidl/#es-float
418
418
impl ToJSValConvertible for f32 {
419
419
#[ inline]
420
- unsafe fn to_jsval ( & self , _cx : * mut JSContext , rval : MutableHandleValue ) {
420
+ unsafe fn to_jsval ( & self , _cx : * mut JSContext , mut rval : MutableHandleValue ) {
421
421
rval. set ( RUST_JS_NumberValue ( * self as f64 ) ) ;
422
422
}
423
423
}
@@ -434,7 +434,7 @@ impl FromJSValConvertible for f32 {
434
434
// https://heycam.github.io/webidl/#es-double
435
435
impl ToJSValConvertible for f64 {
436
436
#[ inline]
437
- unsafe fn to_jsval ( & self , _cx : * mut JSContext , rval : MutableHandleValue ) {
437
+ unsafe fn to_jsval ( & self , _cx : * mut JSContext , mut rval : MutableHandleValue ) {
438
438
rval. set ( RUST_JS_NumberValue ( * self ) ) ;
439
439
}
440
440
}
@@ -478,7 +478,7 @@ pub unsafe fn jsstr_to_string(cx: *mut JSContext, jsstr: *mut JSString) -> Strin
478
478
// https://heycam.github.io/webidl/#es-USVString
479
479
impl ToJSValConvertible for str {
480
480
#[ inline]
481
- unsafe fn to_jsval ( & self , cx : * mut JSContext , rval : MutableHandleValue ) {
481
+ unsafe fn to_jsval ( & self , cx : * mut JSContext , mut rval : MutableHandleValue ) {
482
482
let mut string_utf16: Vec < u16 > = Vec :: with_capacity ( self . len ( ) ) ;
483
483
string_utf16. extend ( self . encode_utf16 ( ) ) ;
484
484
let jsstr = JS_NewUCStringCopyN ( cx,
@@ -514,7 +514,7 @@ impl FromJSValConvertible for String {
514
514
515
515
impl < T : ToJSValConvertible > ToJSValConvertible for Option < T > {
516
516
#[ inline]
517
- unsafe fn to_jsval ( & self , cx : * mut JSContext , rval : MutableHandleValue ) {
517
+ unsafe fn to_jsval ( & self , cx : * mut JSContext , mut rval : MutableHandleValue ) {
518
518
match self {
519
519
& Some ( ref value) => value. to_jsval ( cx, rval) ,
520
520
& None => rval. set ( NullValue ( ) ) ,
@@ -549,7 +549,7 @@ impl<T: FromJSValConvertible> FromJSValConvertible for Option<T> {
549
549
// https://heycam.github.io/webidl/#es-sequence
550
550
impl < T : ToJSValConvertible > ToJSValConvertible for Vec < T > {
551
551
#[ inline]
552
- unsafe fn to_jsval ( & self , cx : * mut JSContext , rval : MutableHandleValue ) {
552
+ unsafe fn to_jsval ( & self , cx : * mut JSContext , mut rval : MutableHandleValue ) {
553
553
rooted ! ( in( cx) let js_array = JS_NewArrayObject1 ( cx, self . len( ) as libc:: size_t) ) ;
554
554
assert ! ( !js_array. handle( ) . is_null( ) ) ;
555
555
@@ -620,7 +620,7 @@ impl<C: Clone, T: FromJSValConvertible<Config=C>> FromJSValConvertible for Vec<T
620
620
loop {
621
621
let mut done = false ;
622
622
rooted ! ( in( cx) let mut val = UndefinedValue ( ) ) ;
623
- if !iterator. next ( val. handle_mut ( ) , & mut done) {
623
+ if !iterator. next ( val. handle_mut ( ) . into ( ) , & mut done) {
624
624
return Err ( ( ) )
625
625
}
626
626
@@ -641,7 +641,7 @@ impl<C: Clone, T: FromJSValConvertible<Config=C>> FromJSValConvertible for Vec<T
641
641
// https://heycam.github.io/webidl/#es-object
642
642
impl ToJSValConvertible for * mut JSObject {
643
643
#[ inline]
644
- unsafe fn to_jsval ( & self , cx : * mut JSContext , rval : MutableHandleValue ) {
644
+ unsafe fn to_jsval ( & self , cx : * mut JSContext , mut rval : MutableHandleValue ) {
645
645
rval. set ( ObjectOrNullValue ( * self ) ) ;
646
646
maybe_wrap_object_or_null_value ( cx, rval) ;
647
647
}
@@ -650,7 +650,7 @@ impl ToJSValConvertible for *mut JSObject {
650
650
// https://heycam.github.io/webidl/#es-object
651
651
impl ToJSValConvertible for ptr:: NonNull < JSObject > {
652
652
#[ inline]
653
- unsafe fn to_jsval ( & self , cx : * mut JSContext , rval : MutableHandleValue ) {
653
+ unsafe fn to_jsval ( & self , cx : * mut JSContext , mut rval : MutableHandleValue ) {
654
654
rval. set ( ObjectValue ( self . as_ptr ( ) ) ) ;
655
655
maybe_wrap_object_value ( cx, rval) ;
656
656
}
@@ -659,7 +659,7 @@ impl ToJSValConvertible for ptr::NonNull<JSObject> {
659
659
// https://heycam.github.io/webidl/#es-object
660
660
impl ToJSValConvertible for Heap < * mut JSObject > {
661
661
#[ inline]
662
- unsafe fn to_jsval ( & self , cx : * mut JSContext , rval : MutableHandleValue ) {
662
+ unsafe fn to_jsval ( & self , cx : * mut JSContext , mut rval : MutableHandleValue ) {
663
663
rval. set ( ObjectOrNullValue ( self . get ( ) ) ) ;
664
664
maybe_wrap_object_or_null_value ( cx, rval) ;
665
665
}
0 commit comments