Skip to content

Commit b8ad165

Browse files
committed
feedback
1 parent f5cede0 commit b8ad165

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/mono/wasm/runtime/binding_support.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,10 @@ var BindingSupportLib = {
170170

171171
this._js_owned_object_table = new Map ();
172172
// NOTE: FinalizationRegistry and WeakRef are missing on Safari below 14.1
173-
this._is_finalizarion_registry_supported = typeof globalThis.FinalizationRegistry === "function";
174-
this._is_weak_ref_supported = typeof globalThis.WeakRef === "function";
173+
this._use_finalization_registry = typeof globalThis.FinalizationRegistry === "function";
174+
this._use_weak_ref = typeof globalThis.WeakRef === "function";
175175

176-
if (this._is_finalizarion_registry_supported) {
176+
if (this._use_finalization_registry) {
177177
this._js_owned_object_registry = new globalThis.FinalizationRegistry(this._js_owned_object_finalized.bind(this));
178178
}
179179
},
@@ -201,7 +201,7 @@ var BindingSupportLib = {
201201

202202
_register_js_owned_object: function (gc_handle, js_obj) {
203203
var wr;
204-
if (this._is_weak_ref_supported) {
204+
if (this._use_weak_ref) {
205205
wr = new WeakRef(js_obj);
206206
}
207207
else {
@@ -235,7 +235,7 @@ var BindingSupportLib = {
235235
this._mono_wasm_release_js_handle(thenable_js_handle);
236236

237237
// when FinalizationRegistry is not supported by this browser, we will do immediate cleanup after use
238-
if (!this._is_finalizarion_registry_supported) {
238+
if (!this._use_finalization_registry) {
239239
this._release_js_owned_object_by_gc_handle(tcs_gc_handle);
240240
}
241241
}, (reason) => {
@@ -244,13 +244,13 @@ var BindingSupportLib = {
244244
this._mono_wasm_release_js_handle(thenable_js_handle);
245245

246246
// when FinalizationRegistry is not supported by this browser, we will do immediate cleanup after use
247-
if (!this._is_finalizarion_registry_supported) {
247+
if (!this._use_finalization_registry) {
248248
this._release_js_owned_object_by_gc_handle(tcs_gc_handle);
249249
}
250250
});
251251

252252
// collect the TaskCompletionSource with its Task after js doesn't hold the thenable anymore
253-
if (this._is_finalizarion_registry_supported) {
253+
if (this._use_finalization_registry) {
254254
this._js_owned_object_registry.register(thenable, tcs_gc_handle);
255255
}
256256

@@ -280,7 +280,7 @@ var BindingSupportLib = {
280280
// note that we do not implement promise/task roundtrip
281281
// With more complexity we could recover original instance when this promise is marshaled back to C#.
282282
var result = new Promise(function (resolve, reject) {
283-
if (self._is_finalizarion_registry_supported) {
283+
if (self._use_finalization_registry) {
284284
cont_obj = {
285285
resolve: resolve,
286286
reject: reject
@@ -308,7 +308,7 @@ var BindingSupportLib = {
308308
this._setup_js_cont (root.value, cont_obj );
309309

310310
// register for GC of the Task after the JS side is done with the promise
311-
if (this._is_finalizarion_registry_supported) {
311+
if (this._use_finalization_registry) {
312312
this._js_owned_object_registry.register(result, gc_handle);
313313
}
314314

@@ -349,7 +349,7 @@ var BindingSupportLib = {
349349
result[BINDING.js_owned_gc_handle_symbol]=gc_handle;
350350

351351
// NOTE: this would be leaking C# objects when the browser doesn't support FinalizationRegistry/WeakRef
352-
if (this._is_finalizarion_registry_supported) {
352+
if (this._use_finalization_registry) {
353353
// register for GC of the C# object after the JS side is done with the object
354354
this._js_owned_object_registry.register(result, gc_handle);
355355
}
@@ -408,7 +408,7 @@ var BindingSupportLib = {
408408
}
409409

410410
// NOTE: this would be leaking C# objects when the browser doesn't support FinalizationRegistry. Except in case of EventListener where we cleanup after unregistration.
411-
if (this._is_finalizarion_registry_supported) {
411+
if (this._use_finalization_registry) {
412412
// register for GC of the deleate after the JS side is done with the function
413413
this._js_owned_object_registry.register(result, gc_handle);
414414
}
@@ -2050,7 +2050,7 @@ var BindingSupportLib = {
20502050
? BINDING.mono_wasm_get_jsobj_from_js_handle(optionsHandle)
20512051
: null;
20522052

2053-
if(!BINDING._is_finalizarion_registry_supported){
2053+
if(!BINDING._use_finalization_registry){
20542054
// we are counting registrations because same delegate could be registered into multiple sources
20552055
listener[BINDING.listener_registration_count_symbol] = listener[BINDING.listener_registration_count_symbol] ? listener[BINDING.listener_registration_count_symbol] + 1 : 1;
20562056
}
@@ -2086,7 +2086,7 @@ var BindingSupportLib = {
20862086
// and trigger the FinalizationRegistry handler if it's unused
20872087

20882088
// When FinalizationRegistry is not supported by this browser, we cleanup manuall after unregistration
2089-
if (!BINDING._is_finalizarion_registry_supported) {
2089+
if (!BINDING._use_finalization_registry) {
20902090
listener[BINDING.listener_registration_count_symbol]--;
20912091
if (listener[BINDING.listener_registration_count_symbol] === 0) {
20922092
BINDING._js_owned_object_table.delete(listener_gc_handle);

0 commit comments

Comments
 (0)