Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions NativeScript/runtime/Worker.mm
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,9 @@ throw NativeScriptException(

void Worker::OnMessageCallback(Isolate* isolate, Local<Object> receiver,
std::shared_ptr<worker::Message> message) {
// Callers drain a whole batch under one scope; without this the handles of
// every message in the batch stay alive until the batch ends.
HandleScope handleScope(isolate);
WorkerEventsState* state = Caches::StateFor<WorkerEventsState>(isolate);
if (state == nullptr || state->emitMessage.IsEmpty()) {
return;
Expand Down
7 changes: 4 additions & 3 deletions TestRunner/app/tests/MessagingTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,11 @@ describe("Messaging runtime edges", function () {
var got = [];
worker.on("message", function (value) {
got.push(value);
if (got.length === 3) {
if (got.length === 4) {
setTimeout(function () {
// Three messages: the once() registration fires only
// for the first, the on() one for all three.
// Three messages: the on() registration fires for all
// three, the once() one only for the first. The settle
// window catches a fifth reply.
expect(got).toEqual([1, 2, 3, 4]);
worker.terminate();
done();
Expand Down
5 changes: 4 additions & 1 deletion TestRunner/app/tests/RuntimeImplementedAPIs.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,12 @@ describe("DOMException canary", () => {
});

it("serializes through structuredClone on this runtime", () => {
const clone = structuredClone(new DOMException("x", "AbortError"));
const original = new DOMException("x", "AbortError");
original.stack = "DOMException stack sentinel";
const clone = structuredClone(original);
expect(clone instanceof DOMException).toBe(true);
expect(clone.name).toBe("AbortError");
expect(clone.stack).toBe("DOMException stack sentinel");
});

// Once an isolate holds a DOMException the serializer claims host objects
Expand Down
Loading