mirror of
https://github.com/uNetworking/uWebSockets.js.git
synced 2026-03-28 05:01:24 -04:00
Support symbol-keyed properties in WebSocket UserData (#1228)
* Initial plan * Fix: Support symbol keys in UserData for WebSocket upgrade (issue #1184) Co-authored-by: uNetworkingAB <110806833+uNetworkingAB@users.noreply.github.com> * Remove accidentally committed build artifacts and add .gitignore Co-authored-by: uNetworkingAB <110806833+uNetworkingAB@users.noreply.github.com> * Delete .gitignore --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: uNetworkingAB <110806833+uNetworkingAB@users.noreply.github.com>
This commit is contained in:
@@ -170,6 +170,17 @@ void uWS_App_ws(const FunctionCallbackInfo<Value> &args) {
|
||||
).ToChecked();
|
||||
}
|
||||
}
|
||||
|
||||
/* Also copy symbol properties */
|
||||
Local<Array> symbols;
|
||||
if (userData->GetOwnPropertyNames(isolate->GetCurrentContext(), static_cast<PropertyFilter>(SKIP_STRINGS)).ToLocal(&symbols)) {
|
||||
for (int i = 0; i < symbols->Length(); i++) {
|
||||
wsObject->Set(isolate->GetCurrentContext(),
|
||||
symbols->Get(isolate->GetCurrentContext(), i).ToLocalChecked(),
|
||||
userData->Get(isolate->GetCurrentContext(), symbols->Get(isolate->GetCurrentContext(), i).ToLocalChecked()).ToLocalChecked()
|
||||
).ToChecked();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Attach a new V8 object with pointer to us, to it */
|
||||
|
||||
Reference in New Issue
Block a user