summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test_ffi/tests/integration_tests.rs2
-rw-r--r--test_ffi/tests/thread_safe_test.js5
-rw-r--r--test_ffi/tests/thread_safe_test_worker.js2
3 files changed, 8 insertions, 1 deletions
diff --git a/test_ffi/tests/integration_tests.rs b/test_ffi/tests/integration_tests.rs
index e850a174a..a4f233e45 100644
--- a/test_ffi/tests/integration_tests.rs
+++ b/test_ffi/tests/integration_tests.rs
@@ -176,8 +176,10 @@ fn thread_safe_callback() {
let expected = "\
Callback on main thread\n\
Callback on worker thread\n\
+ STORED_FUNCTION cleared\n\
Calling callback, isolate should stay asleep until callback is called\n\
Callback being called\n\
+ STORED_FUNCTION cleared\n\
Isolate should now exit\n";
assert_eq!(stdout, expected);
assert_eq!(stderr, "");
diff --git a/test_ffi/tests/thread_safe_test.js b/test_ffi/tests/thread_safe_test.js
index 62c78279d..41ab803be 100644
--- a/test_ffi/tests/thread_safe_test.js
+++ b/test_ffi/tests/thread_safe_test.js
@@ -71,6 +71,8 @@ dylib.symbols.call_stored_function();
// Unref both main and worker thread callbacks and terminate the worker: Note, the stored function pointer in lib is now dangling.
+dylib.symbols.store_function(null);
+
mainThreadCallback.unref();
await sendWorkerMessage("unref");
worker.terminate();
@@ -90,6 +92,9 @@ cleanupCallback.ref();
function cleanup() {
cleanupCallback.unref();
+ dylib.symbols.store_function(null);
+ mainThreadCallback.close();
+ cleanupCallback.close();
console.log("Isolate should now exit");
}
diff --git a/test_ffi/tests/thread_safe_test_worker.js b/test_ffi/tests/thread_safe_test_worker.js
index a87a97556..fb3365bf8 100644
--- a/test_ffi/tests/thread_safe_test_worker.js
+++ b/test_ffi/tests/thread_safe_test_worker.js
@@ -35,7 +35,7 @@ self.addEventListener("message", ({ data }) => {
} else if (data === "call") {
dylib.symbols.call_stored_function();
} else if (data === "unref") {
- callback.unref();
+ callback.close();
}
self.postMessage("done");
});