react-native-windows 0.75.15 → 0.75.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Libraries/Core/ReactNativeVersion.js +1 -1
- package/Libraries/Network/FormData.js +11 -3
- package/Microsoft.ReactNative/packages.lock.json +70 -42
- package/PropertySheets/Generated/PackageVersion.g.props +3 -3
- package/Shared/Networking/WinRTWebSocketResource.cpp +82 -96
- package/Shared/Networking/WinRTWebSocketResource.h +91 -7
- package/package.json +12 -12
|
@@ -28,6 +28,15 @@ type FormDataPart =
|
|
|
28
28
|
...
|
|
29
29
|
};
|
|
30
30
|
|
|
31
|
+
/**
|
|
32
|
+
* Encode a FormData filename compliant with RFC 2183
|
|
33
|
+
*
|
|
34
|
+
* https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition#directives
|
|
35
|
+
*/
|
|
36
|
+
function encodeFilename(filename: string): string {
|
|
37
|
+
return encodeURIComponent(filename.replace(/\//g, '_'));
|
|
38
|
+
}
|
|
39
|
+
|
|
31
40
|
/**
|
|
32
41
|
* Polyfill for XMLHttpRequest2 FormData API, allowing multipart POST requests
|
|
33
42
|
* with mixed data (string, native files) to be submitted via XMLHttpRequest.
|
|
@@ -82,9 +91,8 @@ class FormData {
|
|
|
82
91
|
// content type (cf. web Blob interface.)
|
|
83
92
|
if (typeof value === 'object' && !Array.isArray(value) && value) {
|
|
84
93
|
if (typeof value.name === 'string') {
|
|
85
|
-
headers['content-disposition'] +=
|
|
86
|
-
value.name
|
|
87
|
-
}"; filename*=utf-8''${encodeURI(value.name)}`;
|
|
94
|
+
headers['content-disposition'] +=
|
|
95
|
+
`; filename="${encodeFilename(value.name)}"`;
|
|
88
96
|
}
|
|
89
97
|
if (typeof value.type === 'string') {
|
|
90
98
|
headers['content-type'] = value.type;
|
|
@@ -24,21 +24,21 @@
|
|
|
24
24
|
"Microsoft.SourceLink.Common": "1.1.1"
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
|
-
"Microsoft.UI.Xaml": {
|
|
28
|
-
"type": "Direct",
|
|
29
|
-
"requested": "[2.8.0, )",
|
|
30
|
-
"resolved": "2.8.0",
|
|
31
|
-
"contentHash": "vxdHxTr63s5KVtNddMFpgvjBjUH50z7seq/5jLWmmSuf8poxg+sXrywkofUdE8ZstbpO9y3FL/IXXUcPYbeesA==",
|
|
32
|
-
"dependencies": {
|
|
33
|
-
"Microsoft.Web.WebView2": "1.0.1264.42"
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
27
|
"Microsoft.Windows.CppWinRT": {
|
|
37
28
|
"type": "Direct",
|
|
38
29
|
"requested": "[2.0.230706.1, )",
|
|
39
30
|
"resolved": "2.0.230706.1",
|
|
40
31
|
"contentHash": "l0D7oCw/5X+xIKHqZTi62TtV+1qeSz7KVluNFdrJ9hXsst4ghvqQ/Yhura7JqRdZWBXAuDS0G0KwALptdoxweQ=="
|
|
41
32
|
},
|
|
33
|
+
"Microsoft.WindowsAppSDK": {
|
|
34
|
+
"type": "Direct",
|
|
35
|
+
"requested": "[1.5.240227000, )",
|
|
36
|
+
"resolved": "1.5.240227000",
|
|
37
|
+
"contentHash": "6rESOsREi8534J7IDpNfFYPvxQaSleXKt4A7ZYPeQyckNMQ0o1W0jZ420bJbEMz9Cw/S/8IbpPftLLZ9w/GTCQ==",
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"Microsoft.Windows.SDK.BuildTools": "10.0.22621.756"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
42
|
"Microsoft.Build.Tasks.Git": {
|
|
43
43
|
"type": "Transitive",
|
|
44
44
|
"resolved": "1.1.1",
|
|
@@ -49,10 +49,10 @@
|
|
|
49
49
|
"resolved": "1.1.1",
|
|
50
50
|
"contentHash": "WMcGpWKrmJmzrNeuaEb23bEMnbtR/vLmvZtkAP5qWu7vQsY59GqfRJd65sFpBszbd2k/bQ8cs8eWawQKAabkVg=="
|
|
51
51
|
},
|
|
52
|
-
"Microsoft.
|
|
52
|
+
"Microsoft.Windows.SDK.BuildTools": {
|
|
53
53
|
"type": "Transitive",
|
|
54
|
-
"resolved": "
|
|
55
|
-
"contentHash": "
|
|
54
|
+
"resolved": "10.0.22621.756",
|
|
55
|
+
"contentHash": "7ZL2sFSioYm1Ry067Kw1hg0SCcW5kuVezC2SwjGbcPE61Nn+gTbH86T73G3LcEOVj0S3IZzNuE/29gZvOLS7VA=="
|
|
56
56
|
},
|
|
57
57
|
"common": {
|
|
58
58
|
"type": "Project",
|
|
@@ -66,8 +66,8 @@
|
|
|
66
66
|
"folly": {
|
|
67
67
|
"type": "Project",
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"
|
|
70
|
-
"
|
|
69
|
+
"Fmt": "[1.0.0, )",
|
|
70
|
+
"boost": "[1.83.0, )"
|
|
71
71
|
}
|
|
72
72
|
},
|
|
73
73
|
"reactcommon": {
|
|
@@ -79,52 +79,80 @@
|
|
|
79
79
|
}
|
|
80
80
|
},
|
|
81
81
|
"native,Version=v0.0/win10-arm": {
|
|
82
|
-
"Microsoft.
|
|
83
|
-
"type": "
|
|
84
|
-
"
|
|
85
|
-
"
|
|
82
|
+
"Microsoft.WindowsAppSDK": {
|
|
83
|
+
"type": "Direct",
|
|
84
|
+
"requested": "[1.5.240227000, )",
|
|
85
|
+
"resolved": "1.5.240227000",
|
|
86
|
+
"contentHash": "6rESOsREi8534J7IDpNfFYPvxQaSleXKt4A7ZYPeQyckNMQ0o1W0jZ420bJbEMz9Cw/S/8IbpPftLLZ9w/GTCQ==",
|
|
87
|
+
"dependencies": {
|
|
88
|
+
"Microsoft.Windows.SDK.BuildTools": "10.0.22621.756"
|
|
89
|
+
}
|
|
86
90
|
}
|
|
87
91
|
},
|
|
88
92
|
"native,Version=v0.0/win10-arm-aot": {
|
|
89
|
-
"Microsoft.
|
|
90
|
-
"type": "
|
|
91
|
-
"
|
|
92
|
-
"
|
|
93
|
+
"Microsoft.WindowsAppSDK": {
|
|
94
|
+
"type": "Direct",
|
|
95
|
+
"requested": "[1.5.240227000, )",
|
|
96
|
+
"resolved": "1.5.240227000",
|
|
97
|
+
"contentHash": "6rESOsREi8534J7IDpNfFYPvxQaSleXKt4A7ZYPeQyckNMQ0o1W0jZ420bJbEMz9Cw/S/8IbpPftLLZ9w/GTCQ==",
|
|
98
|
+
"dependencies": {
|
|
99
|
+
"Microsoft.Windows.SDK.BuildTools": "10.0.22621.756"
|
|
100
|
+
}
|
|
93
101
|
}
|
|
94
102
|
},
|
|
95
103
|
"native,Version=v0.0/win10-arm64-aot": {
|
|
96
|
-
"Microsoft.
|
|
97
|
-
"type": "
|
|
98
|
-
"
|
|
99
|
-
"
|
|
104
|
+
"Microsoft.WindowsAppSDK": {
|
|
105
|
+
"type": "Direct",
|
|
106
|
+
"requested": "[1.5.240227000, )",
|
|
107
|
+
"resolved": "1.5.240227000",
|
|
108
|
+
"contentHash": "6rESOsREi8534J7IDpNfFYPvxQaSleXKt4A7ZYPeQyckNMQ0o1W0jZ420bJbEMz9Cw/S/8IbpPftLLZ9w/GTCQ==",
|
|
109
|
+
"dependencies": {
|
|
110
|
+
"Microsoft.Windows.SDK.BuildTools": "10.0.22621.756"
|
|
111
|
+
}
|
|
100
112
|
}
|
|
101
113
|
},
|
|
102
114
|
"native,Version=v0.0/win10-x64": {
|
|
103
|
-
"Microsoft.
|
|
104
|
-
"type": "
|
|
105
|
-
"
|
|
106
|
-
"
|
|
115
|
+
"Microsoft.WindowsAppSDK": {
|
|
116
|
+
"type": "Direct",
|
|
117
|
+
"requested": "[1.5.240227000, )",
|
|
118
|
+
"resolved": "1.5.240227000",
|
|
119
|
+
"contentHash": "6rESOsREi8534J7IDpNfFYPvxQaSleXKt4A7ZYPeQyckNMQ0o1W0jZ420bJbEMz9Cw/S/8IbpPftLLZ9w/GTCQ==",
|
|
120
|
+
"dependencies": {
|
|
121
|
+
"Microsoft.Windows.SDK.BuildTools": "10.0.22621.756"
|
|
122
|
+
}
|
|
107
123
|
}
|
|
108
124
|
},
|
|
109
125
|
"native,Version=v0.0/win10-x64-aot": {
|
|
110
|
-
"Microsoft.
|
|
111
|
-
"type": "
|
|
112
|
-
"
|
|
113
|
-
"
|
|
126
|
+
"Microsoft.WindowsAppSDK": {
|
|
127
|
+
"type": "Direct",
|
|
128
|
+
"requested": "[1.5.240227000, )",
|
|
129
|
+
"resolved": "1.5.240227000",
|
|
130
|
+
"contentHash": "6rESOsREi8534J7IDpNfFYPvxQaSleXKt4A7ZYPeQyckNMQ0o1W0jZ420bJbEMz9Cw/S/8IbpPftLLZ9w/GTCQ==",
|
|
131
|
+
"dependencies": {
|
|
132
|
+
"Microsoft.Windows.SDK.BuildTools": "10.0.22621.756"
|
|
133
|
+
}
|
|
114
134
|
}
|
|
115
135
|
},
|
|
116
136
|
"native,Version=v0.0/win10-x86": {
|
|
117
|
-
"Microsoft.
|
|
118
|
-
"type": "
|
|
119
|
-
"
|
|
120
|
-
"
|
|
137
|
+
"Microsoft.WindowsAppSDK": {
|
|
138
|
+
"type": "Direct",
|
|
139
|
+
"requested": "[1.5.240227000, )",
|
|
140
|
+
"resolved": "1.5.240227000",
|
|
141
|
+
"contentHash": "6rESOsREi8534J7IDpNfFYPvxQaSleXKt4A7ZYPeQyckNMQ0o1W0jZ420bJbEMz9Cw/S/8IbpPftLLZ9w/GTCQ==",
|
|
142
|
+
"dependencies": {
|
|
143
|
+
"Microsoft.Windows.SDK.BuildTools": "10.0.22621.756"
|
|
144
|
+
}
|
|
121
145
|
}
|
|
122
146
|
},
|
|
123
147
|
"native,Version=v0.0/win10-x86-aot": {
|
|
124
|
-
"Microsoft.
|
|
125
|
-
"type": "
|
|
126
|
-
"
|
|
127
|
-
"
|
|
148
|
+
"Microsoft.WindowsAppSDK": {
|
|
149
|
+
"type": "Direct",
|
|
150
|
+
"requested": "[1.5.240227000, )",
|
|
151
|
+
"resolved": "1.5.240227000",
|
|
152
|
+
"contentHash": "6rESOsREi8534J7IDpNfFYPvxQaSleXKt4A7ZYPeQyckNMQ0o1W0jZ420bJbEMz9Cw/S/8IbpPftLLZ9w/GTCQ==",
|
|
153
|
+
"dependencies": {
|
|
154
|
+
"Microsoft.Windows.SDK.BuildTools": "10.0.22621.756"
|
|
155
|
+
}
|
|
128
156
|
}
|
|
129
157
|
}
|
|
130
158
|
}
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
-->
|
|
11
11
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
12
12
|
<PropertyGroup>
|
|
13
|
-
<ReactNativeWindowsVersion>0.75.
|
|
13
|
+
<ReactNativeWindowsVersion>0.75.17</ReactNativeWindowsVersion>
|
|
14
14
|
<ReactNativeWindowsMajor>0</ReactNativeWindowsMajor>
|
|
15
15
|
<ReactNativeWindowsMinor>75</ReactNativeWindowsMinor>
|
|
16
|
-
<ReactNativeWindowsPatch>
|
|
16
|
+
<ReactNativeWindowsPatch>17</ReactNativeWindowsPatch>
|
|
17
17
|
<ReactNativeWindowsCanary>false</ReactNativeWindowsCanary>
|
|
18
|
-
<ReactNativeWindowsCommitId>
|
|
18
|
+
<ReactNativeWindowsCommitId>a70e22673d68cb41141dceee72b2f6d1541d0e3e</ReactNativeWindowsCommitId>
|
|
19
19
|
</PropertyGroup>
|
|
20
20
|
</Project>
|
|
@@ -89,7 +89,6 @@ DispatchQueue GetCurrentOrSerialQueue() noexcept {
|
|
|
89
89
|
|
|
90
90
|
return queue;
|
|
91
91
|
}
|
|
92
|
-
|
|
93
92
|
} // namespace
|
|
94
93
|
|
|
95
94
|
namespace Microsoft::React::Networking {
|
|
@@ -104,7 +103,6 @@ WinRTWebSocketResource2::WinRTWebSocketResource2(
|
|
|
104
103
|
: m_socket{std::move(socket)},
|
|
105
104
|
m_writer(std::move(writer)),
|
|
106
105
|
m_readyState{ReadyState::Connecting},
|
|
107
|
-
m_connectPerformed{CreateEvent(/*attributes*/ nullptr, /*manual reset*/ true, /*state*/ false, /*name*/ nullptr)},
|
|
108
106
|
m_callingQueue{callingQueue} {
|
|
109
107
|
for (const auto &certException : certExceptions) {
|
|
110
108
|
m_socket.Control().IgnorableServerCertificateErrors().Append(certException);
|
|
@@ -221,120 +219,112 @@ void WinRTWebSocketResource2::OnClosed(IWebSocket const &sender, IWebSocketClose
|
|
|
221
219
|
|
|
222
220
|
fire_and_forget WinRTWebSocketResource2::PerformConnect(Uri &&uri) noexcept {
|
|
223
221
|
auto self = shared_from_this();
|
|
224
|
-
auto
|
|
222
|
+
auto movedUri = std::move(uri);
|
|
225
223
|
|
|
226
224
|
co_await resume_in_queue(self->m_backgroundQueue);
|
|
227
225
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
SetEvent(self->m_connectPerformed.get());
|
|
226
|
+
co_await self->m_sequencer.QueueTaskAsync(
|
|
227
|
+
[self = self->shared_from_this(), coUri = std::move(movedUri)]() -> IAsyncAction {
|
|
228
|
+
auto coSelf = self->shared_from_this();
|
|
229
|
+
|
|
230
|
+
auto async = coSelf->m_socket.ConnectAsync(coUri);
|
|
231
|
+
co_await lessthrow_await_adapter<IAsyncAction>{async};
|
|
232
|
+
|
|
233
|
+
auto result = async.ErrorCode();
|
|
234
|
+
try {
|
|
235
|
+
if (result >= 0) { // Non-failing HRESULT
|
|
236
|
+
coSelf->m_readyState = ReadyState::Open;
|
|
237
|
+
|
|
238
|
+
co_await resume_in_queue(coSelf->m_callingQueue);
|
|
239
|
+
if (coSelf->m_connectHandler) {
|
|
240
|
+
coSelf->m_connectHandler();
|
|
241
|
+
}
|
|
242
|
+
} else {
|
|
243
|
+
coSelf->Fail(std::move(result), ErrorType::Connection);
|
|
244
|
+
}
|
|
245
|
+
} catch (hresult_error const &e) {
|
|
246
|
+
coSelf->Fail(e, ErrorType::Connection);
|
|
247
|
+
} catch (std::exception const &e) {
|
|
248
|
+
coSelf->Fail(e.what(), ErrorType::Connection);
|
|
249
|
+
}
|
|
250
|
+
});
|
|
254
251
|
}
|
|
255
252
|
|
|
256
253
|
fire_and_forget WinRTWebSocketResource2::PerformClose() noexcept {
|
|
257
254
|
auto self = shared_from_this();
|
|
258
255
|
|
|
259
|
-
co_await resume_on_signal(self->m_connectPerformed.get());
|
|
260
|
-
|
|
261
256
|
co_await resume_in_queue(self->m_backgroundQueue);
|
|
262
257
|
|
|
263
|
-
|
|
264
|
-
|
|
258
|
+
co_await self->m_sequencer.QueueTaskAsync([self = self->shared_from_this()]() -> IAsyncAction {
|
|
259
|
+
auto coSelf = self->shared_from_this();
|
|
265
260
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
261
|
+
try {
|
|
262
|
+
coSelf->m_socket.Close(static_cast<uint16_t>(coSelf->m_closeCode), winrt::to_hstring(coSelf->m_closeReason));
|
|
263
|
+
coSelf->m_readyState = ReadyState::Closing;
|
|
264
|
+
} catch (winrt::hresult_invalid_argument const &e) {
|
|
265
|
+
coSelf->Fail(e, ErrorType::Close);
|
|
266
|
+
} catch (hresult_error const &e) {
|
|
267
|
+
coSelf->Fail(e, ErrorType::Close);
|
|
268
|
+
} catch (const std::exception &e) {
|
|
269
|
+
coSelf->Fail(e.what(), ErrorType::Close);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
co_return;
|
|
273
|
+
});
|
|
276
274
|
}
|
|
277
275
|
|
|
278
|
-
fire_and_forget WinRTWebSocketResource2::
|
|
276
|
+
fire_and_forget WinRTWebSocketResource2::EnqueueWrite(string &&message, bool isBinary) noexcept {
|
|
279
277
|
auto self = shared_from_this();
|
|
280
278
|
string coMessage = std::move(message);
|
|
281
279
|
|
|
282
|
-
co_await resume_in_queue(self->m_backgroundQueue); // Ensure writes happen sequentially
|
|
283
|
-
self->m_outgoingMessages.emplace(std::move(coMessage), isBinary);
|
|
284
|
-
|
|
285
|
-
co_await resume_on_signal(self->m_connectPerformed.get());
|
|
286
|
-
|
|
287
280
|
co_await resume_in_queue(self->m_backgroundQueue);
|
|
288
281
|
|
|
289
|
-
co_await self->
|
|
282
|
+
co_await self->m_sequencer.QueueTaskAsync(
|
|
283
|
+
[self = self->shared_from_this(), message = std::move(coMessage), isBinary]() -> IAsyncAction {
|
|
284
|
+
auto coSelf = self->shared_from_this();
|
|
285
|
+
auto coMessage = std::move(message);
|
|
286
|
+
|
|
287
|
+
co_await coSelf->PerformWrite(std::move(coMessage), isBinary);
|
|
288
|
+
});
|
|
290
289
|
}
|
|
291
290
|
|
|
292
|
-
IAsyncAction WinRTWebSocketResource2::
|
|
291
|
+
IAsyncAction WinRTWebSocketResource2::PerformWrite(string &&message, bool isBinary) noexcept {
|
|
293
292
|
auto self = shared_from_this();
|
|
294
293
|
|
|
295
|
-
|
|
296
|
-
if (
|
|
297
|
-
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
size_t length = 0;
|
|
301
|
-
string messageLocal;
|
|
302
|
-
bool isBinaryLocal;
|
|
303
|
-
try {
|
|
304
|
-
std::tie(messageLocal, isBinaryLocal) = self->m_outgoingMessages.front();
|
|
305
|
-
self->m_outgoingMessages.pop();
|
|
306
|
-
if (isBinaryLocal) {
|
|
307
|
-
self->m_socket.Control().MessageType(SocketMessageType::Binary);
|
|
308
|
-
|
|
309
|
-
auto buffer = CryptographicBuffer::DecodeFromBase64String(winrt::to_hstring(messageLocal));
|
|
310
|
-
if (buffer) {
|
|
311
|
-
length = buffer.Length();
|
|
312
|
-
self->m_writer.WriteBuffer(buffer);
|
|
313
|
-
}
|
|
314
|
-
} else {
|
|
315
|
-
self->m_socket.Control().MessageType(SocketMessageType::Utf8);
|
|
294
|
+
try {
|
|
295
|
+
if (isBinary) {
|
|
296
|
+
self->m_socket.Control().MessageType(SocketMessageType::Binary);
|
|
316
297
|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
CheckedReinterpretCast<const uint8_t *>(messageLocal.c_str()) + messageLocal.length());
|
|
321
|
-
self->m_writer.WriteBytes(view);
|
|
298
|
+
auto buffer = CryptographicBuffer::DecodeFromBase64String(winrt::to_hstring(message));
|
|
299
|
+
if (buffer) {
|
|
300
|
+
self->m_writer.WriteBuffer(buffer);
|
|
322
301
|
}
|
|
323
|
-
}
|
|
324
|
-
self->
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
302
|
+
} else {
|
|
303
|
+
self->m_socket.Control().MessageType(SocketMessageType::Utf8);
|
|
304
|
+
|
|
305
|
+
winrt::array_view<const uint8_t> view(
|
|
306
|
+
CheckedReinterpretCast<const uint8_t *>(message.c_str()),
|
|
307
|
+
CheckedReinterpretCast<const uint8_t *>(message.c_str()) + message.length());
|
|
308
|
+
self->m_writer.WriteBytes(view);
|
|
329
309
|
}
|
|
310
|
+
} catch (hresult_error const &e) { // TODO: Remove after fixing unit tests exceptions.
|
|
311
|
+
self->Fail(e, ErrorType::Send);
|
|
312
|
+
} catch (const std::exception &e) {
|
|
313
|
+
self->Fail(e.what(), ErrorType::Send);
|
|
314
|
+
}
|
|
330
315
|
|
|
331
|
-
|
|
332
|
-
|
|
316
|
+
co_await resume_in_queue(self->m_backgroundQueue);
|
|
317
|
+
// If an exception occurred, abort write process.
|
|
318
|
+
if (self->m_readyState != ReadyState::Open) {
|
|
319
|
+
co_return;
|
|
320
|
+
}
|
|
333
321
|
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
322
|
+
auto async = self->m_writer.StoreAsync();
|
|
323
|
+
co_await lessthrow_await_adapter<DataWriterStoreOperation>{async};
|
|
324
|
+
|
|
325
|
+
auto result = async.ErrorCode();
|
|
326
|
+
if (result < 0) {
|
|
327
|
+
self->Fail(std::move(result), ErrorType::Send);
|
|
338
328
|
}
|
|
339
329
|
}
|
|
340
330
|
|
|
@@ -388,11 +378,7 @@ void WinRTWebSocketResource2::Connect(string &&url, const Protocols &protocols,
|
|
|
388
378
|
m_socket.SetRequestHeader(L"Origin", std::move(origin));
|
|
389
379
|
}
|
|
390
380
|
} catch (hresult_error const &e) {
|
|
391
|
-
Fail(e, ErrorType::Connection);
|
|
392
|
-
|
|
393
|
-
SetEvent(m_connectPerformed.get());
|
|
394
|
-
|
|
395
|
-
return;
|
|
381
|
+
return Fail(e, ErrorType::Connection);
|
|
396
382
|
}
|
|
397
383
|
|
|
398
384
|
PerformConnect(std::move(uri));
|
|
@@ -401,11 +387,11 @@ void WinRTWebSocketResource2::Connect(string &&url, const Protocols &protocols,
|
|
|
401
387
|
void WinRTWebSocketResource2::Ping() noexcept {}
|
|
402
388
|
|
|
403
389
|
void WinRTWebSocketResource2::Send(string &&message) noexcept {
|
|
404
|
-
|
|
390
|
+
EnqueueWrite(std::move(message), false);
|
|
405
391
|
}
|
|
406
392
|
|
|
407
393
|
void WinRTWebSocketResource2::SendBinary(string &&base64String) noexcept {
|
|
408
|
-
|
|
394
|
+
EnqueueWrite(std::move(base64String), true);
|
|
409
395
|
}
|
|
410
396
|
|
|
411
397
|
void WinRTWebSocketResource2::Close(CloseCode code, const string &reason) noexcept {
|
|
@@ -18,17 +18,101 @@ namespace Microsoft::React::Networking {
|
|
|
18
18
|
|
|
19
19
|
class WinRTWebSocketResource2 : public IWebSocketResource,
|
|
20
20
|
public std::enable_shared_from_this<WinRTWebSocketResource2> {
|
|
21
|
-
winrt::Windows::Networking::Sockets::IMessageWebSocket m_socket;
|
|
22
|
-
|
|
23
21
|
///
|
|
24
|
-
//
|
|
22
|
+
// See https://devblogs.microsoft.com/oldnewthing/20250328-00/?p=111016
|
|
25
23
|
///
|
|
26
|
-
|
|
24
|
+
struct TaskSequencer {
|
|
25
|
+
TaskSequencer() = default;
|
|
26
|
+
TaskSequencer(const TaskSequencer &) = delete;
|
|
27
|
+
void operator=(const TaskSequencer &) = delete;
|
|
28
|
+
|
|
29
|
+
private:
|
|
30
|
+
using CoroHandle = std::experimental::coroutine_handle<>;
|
|
31
|
+
|
|
32
|
+
struct Suspender {
|
|
33
|
+
CoroHandle m_handle;
|
|
34
|
+
|
|
35
|
+
bool await_ready() const noexcept {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
void await_suspend(CoroHandle h) noexcept {
|
|
40
|
+
m_handle = h;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
void await_resume() const noexcept {}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
static void *Completed() {
|
|
47
|
+
return reinterpret_cast<void *>(1);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
struct ChainedTask {
|
|
51
|
+
private:
|
|
52
|
+
std::atomic<void *> m_next;
|
|
53
|
+
|
|
54
|
+
public:
|
|
55
|
+
ChainedTask(void *state = nullptr) : m_next(state) {}
|
|
56
|
+
|
|
57
|
+
void ContinueWith(CoroHandle h) {
|
|
58
|
+
if (m_next.exchange(h.address(), std::memory_order_acquire) != nullptr) {
|
|
59
|
+
h();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
void Complete() {
|
|
64
|
+
auto resumeAddress = m_next.exchange(Completed());
|
|
65
|
+
if (resumeAddress) {
|
|
66
|
+
CoroHandle::from_address(resumeAddress).resume();
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
};
|
|
27
70
|
|
|
71
|
+
struct Completer {
|
|
72
|
+
std::shared_ptr<ChainedTask> m_chain;
|
|
73
|
+
|
|
74
|
+
~Completer() {
|
|
75
|
+
m_chain->Complete();
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
winrt::slim_mutex m_mutex;
|
|
80
|
+
std::shared_ptr<ChainedTask> m_latest = std::make_shared<ChainedTask>(Completed());
|
|
81
|
+
|
|
82
|
+
public:
|
|
83
|
+
template <typename Maker>
|
|
84
|
+
auto QueueTaskAsync(Maker &&maker) -> decltype(maker()) {
|
|
85
|
+
auto node = std::make_shared<ChainedTask>();
|
|
86
|
+
Suspender suspend;
|
|
87
|
+
|
|
88
|
+
using Async = decltype(maker());
|
|
89
|
+
auto task = [&node, &suspend, &maker]() -> Async {
|
|
90
|
+
Completer completer{node};
|
|
91
|
+
auto localMaker = std::forward<Maker>(maker);
|
|
92
|
+
auto context = winrt::apartment_context();
|
|
93
|
+
|
|
94
|
+
co_await suspend;
|
|
95
|
+
co_await context;
|
|
96
|
+
|
|
97
|
+
co_return co_await localMaker();
|
|
98
|
+
}();
|
|
99
|
+
|
|
100
|
+
{
|
|
101
|
+
winrt::slim_lock_guard guard(m_mutex);
|
|
102
|
+
m_latest.swap(node);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
node->ContinueWith(suspend.m_handle);
|
|
106
|
+
|
|
107
|
+
return task;
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
winrt::Windows::Networking::Sockets::IMessageWebSocket m_socket;
|
|
28
112
|
ReadyState m_readyState;
|
|
113
|
+
TaskSequencer m_sequencer;
|
|
29
114
|
Mso::DispatchQueue m_callingQueue;
|
|
30
115
|
Mso::DispatchQueue m_backgroundQueue;
|
|
31
|
-
std::queue<std::pair<std::string, bool>> m_outgoingMessages;
|
|
32
116
|
CloseCode m_closeCode{CloseCode::Normal};
|
|
33
117
|
std::string m_closeReason;
|
|
34
118
|
|
|
@@ -52,9 +136,9 @@ class WinRTWebSocketResource2 : public IWebSocketResource,
|
|
|
52
136
|
winrt::Windows::Networking::Sockets::IWebSocketClosedEventArgs const &args);
|
|
53
137
|
|
|
54
138
|
winrt::fire_and_forget PerformConnect(winrt::Windows::Foundation::Uri &&uri) noexcept;
|
|
55
|
-
winrt::fire_and_forget
|
|
139
|
+
winrt::fire_and_forget EnqueueWrite(std::string &&message, bool isBinary) noexcept;
|
|
140
|
+
winrt::Windows::Foundation::IAsyncAction PerformWrite(std::string &&message, bool isBinary) noexcept;
|
|
56
141
|
winrt::fire_and_forget PerformClose() noexcept;
|
|
57
|
-
winrt::Windows::Foundation::IAsyncAction SendPendingMessages() noexcept;
|
|
58
142
|
|
|
59
143
|
WinRTWebSocketResource2(
|
|
60
144
|
winrt::Windows::Networking::Sockets::IMessageWebSocket &&socket,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-windows",
|
|
3
|
-
"version": "0.75.
|
|
3
|
+
"version": "0.75.17",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -26,15 +26,15 @@
|
|
|
26
26
|
"@react-native-community/cli": "14.1.0",
|
|
27
27
|
"@react-native-community/cli-platform-android": "14.1.0",
|
|
28
28
|
"@react-native-community/cli-platform-ios": "14.1.0",
|
|
29
|
-
"@react-native-windows/cli": "0.75.
|
|
29
|
+
"@react-native-windows/cli": "0.75.9",
|
|
30
30
|
"@react-native/assets": "1.0.0",
|
|
31
|
-
"@react-native/assets-registry": "0.75.
|
|
32
|
-
"@react-native/codegen": "0.75.
|
|
33
|
-
"@react-native/community-cli-plugin": "0.75.
|
|
34
|
-
"@react-native/gradle-plugin": "0.75.
|
|
35
|
-
"@react-native/js-polyfills": "0.75.
|
|
36
|
-
"@react-native/normalize-colors": "0.75.
|
|
37
|
-
"@react-native/virtualized-lists": "0.75.
|
|
31
|
+
"@react-native/assets-registry": "0.75.5",
|
|
32
|
+
"@react-native/codegen": "0.75.5",
|
|
33
|
+
"@react-native/community-cli-plugin": "0.75.5",
|
|
34
|
+
"@react-native/gradle-plugin": "0.75.5",
|
|
35
|
+
"@react-native/js-polyfills": "0.75.5",
|
|
36
|
+
"@react-native/normalize-colors": "0.75.5",
|
|
37
|
+
"@react-native/virtualized-lists": "0.75.5",
|
|
38
38
|
"abort-controller": "^3.0.0",
|
|
39
39
|
"anser": "^1.4.9",
|
|
40
40
|
"ansi-regex": "^5.0.0",
|
|
@@ -67,8 +67,8 @@
|
|
|
67
67
|
"yargs": "^17.6.2"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
|
-
"@react-native-windows/codegen": "0.75.
|
|
71
|
-
"@react-native/metro-config": "0.75.
|
|
70
|
+
"@react-native-windows/codegen": "0.75.7",
|
|
71
|
+
"@react-native/metro-config": "0.75.5",
|
|
72
72
|
"@rnw-scripts/babel-react-native-config": "0.0.0",
|
|
73
73
|
"@rnw-scripts/eslint-config": "1.2.23",
|
|
74
74
|
"@rnw-scripts/jest-out-of-tree-snapshot-resolver": "^1.1.27",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"just-scripts": "^1.3.3",
|
|
84
84
|
"prettier": "2.8.8",
|
|
85
85
|
"react": "18.3.1",
|
|
86
|
-
"react-native": "0.75.
|
|
86
|
+
"react-native": "0.75.5",
|
|
87
87
|
"react-native-platform-override": "^1.9.42",
|
|
88
88
|
"react-refresh": "^0.14.0",
|
|
89
89
|
"typescript": "5.0.4"
|