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
7 changes: 4 additions & 3 deletions test-app/app/src/main/assets/app/tests/testMessaging.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
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,12 @@ describe("DOMException canary", function () {
});

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

it("clones the isolate's first DOMException even when a getter creates it mid-clone", function (done) {
Expand Down
3 changes: 3 additions & 0 deletions test-app/runtime/src/main/cpp/WorkerEvents.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ void WorkerEvents::Init(Local<Context> context) {

void WorkerEvents::EmitMessage(Isolate* isolate, Local<Object> receiver,
const 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);
auto* state = RuntimeState::For<WorkerEventsState>(isolate);
if (state == nullptr || state->emitMessage.IsEmpty()) {
return;
Expand Down
Loading