Skip to content

Commit

Permalink
Merge pull request #3194 from cloudflare/dlapid/new_wrapper_for_context
Browse files Browse the repository at this point in the history
Enable using context-specific typewrapper instances.
  • Loading branch information
danlapid authored Dec 7, 2024
2 parents 03ea5e3 + 32191ee commit 52168e3
Show file tree
Hide file tree
Showing 6 changed files with 174 additions and 345 deletions.
8 changes: 8 additions & 0 deletions src/workerd/io/worker.c++
Original file line number Diff line number Diff line change
Expand Up @@ -1279,6 +1279,10 @@ Worker::Script::Script(kj::Own<const Isolate> isolateParam,
// (Undocumented, as usual.)
context =
v8::Context::New(lock.v8Isolate, nullptr, v8::ObjectTemplate::New(lock.v8Isolate));
// We need to set the highest used index in every context we create to be a nullptr
// This is because we might later on call GetAlignedPointerFromEmbedderData which fails with
// a fatal error if the array is smaller than the given index.
context->SetAlignedPointerInEmbedderData(3, nullptr);
}

JSG_WITHIN_CONTEXT_SCOPE(lock, context, [&](jsg::Lock& js) {
Expand Down Expand Up @@ -2594,6 +2598,10 @@ class Worker::Isolate::InspectorChannelImpl final: public v8_inspector::V8Inspec
// We don't know which contexts exist in this isolate, so I guess we have to
// create one. Ugh.
auto dummyContext = v8::Context::New(lock->v8Isolate);
// We need to set the highest used index in every context we create to be a nullptr
// This is because we might later on call GetAlignedPointerFromEmbedderData which fails with
// a fatal error if the array is smaller than the given index.
dummyContext->SetAlignedPointerInEmbedderData(3, nullptr);
auto& inspector = *KJ_ASSERT_NONNULL(isolate.impl->inspector);
inspector.contextCreated(v8_inspector::V8ContextInfo(dummyContext, 1,
v8_inspector::StringView(reinterpret_cast<const uint8_t*>("Worker"), 6)));
Expand Down
9 changes: 0 additions & 9 deletions src/workerd/jsg/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ wd_cc_library(
"resource-test.c++",
"rtti-test.c++",
"url-test.c++",
"disable-memoize-test.c++",
],
)]

Expand Down Expand Up @@ -230,11 +229,3 @@ kj_test(
":resource_test_capnp",
],
)

kj_test(
src = "disable-memoize-test.c++",
deps = [
"//src/workerd/io",
"//src/workerd/jsg",
],
)
183 changes: 0 additions & 183 deletions src/workerd/jsg/disable-memoize-test.c++

This file was deleted.

Loading

0 comments on commit 52168e3

Please sign in to comment.