1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
//! Platform-neutral browser-fact mirror for the wasm adapter (R3.2, F5).
//!
//! This module is the adapter's entire conversion layer: it maps the four
//! browser socket callbacks (`open`, `message`, `close`, `error`) onto the
//! driver's closed [`SocketEvent`] set, and maps emitted [`SocketCommand`]s
//! onto the closed [`BrowserSocketAction`] set the `web-sys` shim executes.
//!
//! F5 mirror-not-implementor: every function here is pure and stateless. The
//! mirror never validates frames, never correlates exchanges, never decides a
//! fate, and never retries — those judgments belong exclusively to the
//! transport-neutral driver core. Because no platform type appears here, the
//! whole layer compiles natively and is pinned by the deterministic
//! `ws_browser_mirror_trace` suite without a browser.
use Vec;
use ;
/// Classified payload of one browser `message` event, as the `web-sys` shim
/// observes it after F4 pinned `binaryType = "arraybuffer"` at construction.
/// Converts one classified browser `message` event into the driver's event.
///
/// Text surfaces as the core's typed
/// [`SocketFailure::UnsupportedTextMessage`]; `Blob` and unrecognized data
/// are typed transport failures (F4). The mirror performs no frame
/// validation: canonical-frame judgment on `ArrayBuffer` bytes is the core's
/// alone (F5).
/// Converts the browser `open` event, checking the F1 extension posture.
///
/// `negotiated_extensions` is the socket's `extensions` attribute at `open`
/// time. The landed acceptor declines every extension offer
/// (decline-never-negotiate), so extension-free operation is guaranteed by
/// the server's F1 posture — the browser cannot be configured to withhold
/// its offers. A non-empty negotiated string therefore proves the peer is
/// not honoring the liminal transport contract: the mirror reports a typed
/// transport failure and the driver mints the fate and closes the socket.
pub const
/// Converts the browser `close` event with close-code fidelity.
///
/// A clean close (`wasClean == true`) is the orderly close fact,
/// [`SocketEvent::Closed`]. An abnormal close (`wasClean == false`) is a
/// loss fact, not a clean peer close: it converts to a typed transport
/// failure so a lone abnormal close can never misrepresent itself as
/// orderly. In F3's browser shape abnormal loss fires `error` first, so this
/// abnormal conversion normally lands post-terminal and stays a typed no-op.
/// The numeric close code and reason string carry no additional decision
/// weight; the shim retains them as diagnostics only.
pub const
/// Converts the browser `error` event.
///
/// Browser error events are opaque by specification — they deliberately
/// carry no failure detail. The conversion therefore states only the typed
/// class, [`SocketFailure::Transport`], and invents nothing beyond it.
pub const
/// Closed browser socket actions the `web-sys` shim executes.
/// Typed refusal for a driver command with no runtime browser action.
/// Maps one driver command onto the browser action that executes it.
///
/// # Errors
///
/// Returns [`BrowserCommandRefusal::OpenIsConstruction`] for
/// [`SocketCommand::Open`]: construction of the browser socket is the one
/// execution of that command.