@@ -12,19 +12,34 @@ use crate::dom::bindings::error::{Error, Fallible};
12
12
13
13
/// The shared part of `TextDecoder` and `TextDecoderStream`
14
14
///
15
- /// Note that this does NOT correspond to the `TextDecoderCommon`
16
- /// interface defined in the WebIDL
15
+ /// Note that other than the three attributes defined in the `TextDecoderCommon`
16
+ /// interface in the WebIDL, this also performs decoding.
17
+ ///
18
+ /// <https://encoding.spec.whatwg.org/#textdecodercommon>
17
19
#[ allow( non_snake_case) ]
18
20
#[ derive( JSTraceable , MallocSizeOf ) ]
19
21
pub ( crate ) struct TextDecoderCommon {
22
+ /// <https://encoding.spec.whatwg.org/#dom-textdecoder-encoding>
20
23
#[ no_trace]
21
24
encoding : & ' static Encoding ,
25
+
26
+ /// <https://encoding.spec.whatwg.org/#dom-textdecoder-fatal>
22
27
fatal : bool ,
28
+
29
+ /// <https://encoding.spec.whatwg.org/#dom-textdecoder-ignorebom>
23
30
ignoreBOM : bool ,
31
+
32
+ /// The native decoder that is used to perform decoding
33
+ ///
34
+ /// <https://encoding.spec.whatwg.org/#textdecodercommon-decoder>
24
35
#[ ignore_malloc_size_of = "defined in encoding_rs" ]
25
36
#[ no_trace]
26
37
decoder : RefCell < Decoder > ,
38
+
39
+ /// <https://encoding.spec.whatwg.org/#textdecodercommon-i-o-queue>
27
40
in_stream : RefCell < Vec < u8 > > ,
41
+
42
+ /// <https://encoding.spec.whatwg.org/#textdecoder-do-not-flush-flag>
28
43
do_not_flush : Cell < bool > ,
29
44
}
30
45
@@ -63,6 +78,7 @@ impl TextDecoderCommon {
63
78
self . ignoreBOM
64
79
}
65
80
81
+ /// <https://encoding.spec.whatwg.org/#dom-textdecoder-decode>
66
82
#[ allow( unsafe_code) ]
67
83
pub ( crate ) fn decode (
68
84
& self ,
0 commit comments