From ef22100aeba4793512b4af93f87f114177107727 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Thu, 18 Jan 2024 15:11:07 -0800 Subject: [PATCH] Update following a handful of v8 pending deprecations --- src/workerd/api/unsafe.c++ | 4 ++-- src/workerd/jsg/async-context.c++ | 4 ++-- src/workerd/jsg/modules.c++ | 7 +++---- src/workerd/jsg/modules.h | 4 ++-- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/workerd/api/unsafe.c++ b/src/workerd/api/unsafe.c++ index 9e77697b6fd..bf81e80fb66 100644 --- a/src/workerd/api/unsafe.c++ +++ b/src/workerd/api/unsafe.c++ @@ -30,7 +30,7 @@ UnsafeEval::newFunction(jsg::Lock& js, jsg::JsString script, jsg::OptionalGetCurrentContext()->SetContinuationPreservedEmbedderData(value); + isolate->SetContinuationPreservedEmbedderData(value); } } // namespace @@ -53,7 +53,7 @@ kj::Maybe> AsyncContextFrame::currentRef(Lock& js) { } kj::Maybe AsyncContextFrame::current(v8::Isolate* isolate) { - auto value = isolate->GetCurrentContext()->GetContinuationPreservedEmbedderData(); + auto value = isolate->GetContinuationPreservedEmbedderData(); KJ_IF_SOME(wrappable, Wrappable::tryUnwrapOpaque(isolate, value)) { AsyncContextFrame* frame = dynamic_cast(&wrappable); KJ_ASSERT(frame != nullptr); diff --git a/src/workerd/jsg/modules.c++ b/src/workerd/jsg/modules.c++ index 3046bee2234..2449cad6ee3 100644 --- a/src/workerd/jsg/modules.c++ +++ b/src/workerd/jsg/modules.c++ @@ -303,7 +303,7 @@ void NonModuleScript::run(v8::Local context) const { NonModuleScript NonModuleScript::compile(kj::StringPtr code, jsg::Lock& js, kj::StringPtr name) { // Create a dummy script origin for it to appear in Sources panel. auto isolate = js.v8Isolate; - v8::ScriptOrigin origin(isolate, v8StrIntern(isolate, name)); + v8::ScriptOrigin origin(v8StrIntern(isolate, name)); v8::ScriptCompiler::Source source(v8Str(isolate, code), origin); return NonModuleScript(js, check(v8::ScriptCompiler::CompileUnboundScript(isolate, &source))); @@ -375,8 +375,7 @@ v8::Local compileEsmModule( const bool resourceIsOpaque = false; const bool isWasm = false; const bool isModule = true; - v8::ScriptOrigin origin(js.v8Isolate, - v8StrIntern(js.v8Isolate, name), + v8::ScriptOrigin origin(v8StrIntern(js.v8Isolate, name), resourceLineOffset, resourceColumnOffset, resourceIsSharedCrossOrigin, scriptId, {}, @@ -433,7 +432,7 @@ v8::Local createSyntheticModule( return v8::Module::CreateSyntheticModule( js.v8Isolate, v8StrIntern(js.v8Isolate, name), - exportNames, + v8::MemorySpan>(exportNames.data(), exportNames.size()), &evaluateSyntheticModuleCallback); } } // namespace diff --git a/src/workerd/jsg/modules.h b/src/workerd/jsg/modules.h index 4280afc851e..c81128110c0 100644 --- a/src/workerd/jsg/modules.h +++ b/src/workerd/jsg/modules.h @@ -233,7 +233,7 @@ class ModuleRegistry { jsg::Ref& moduleContext, kj::StringPtr name, kj::StringPtr content) { - v8::ScriptOrigin origin(lock.v8Isolate, v8StrIntern(lock.v8Isolate, name)); + v8::ScriptOrigin origin(v8StrIntern(lock.v8Isolate, name)); v8::ScriptCompiler::Source source(v8Str(lock.v8Isolate, content), origin); auto context = lock.v8Context(); auto handle = lock.wrap(context, moduleContext.addRef()); @@ -266,7 +266,7 @@ class ModuleRegistry { Ref& moduleContext, kj::StringPtr name, kj::StringPtr content) { - v8::ScriptOrigin origin(lock.v8Isolate, v8StrIntern(lock.v8Isolate, name)); + v8::ScriptOrigin origin(v8StrIntern(lock.v8Isolate, name)); v8::ScriptCompiler::Source source(v8Str(lock.v8Isolate, content), origin); auto context = lock.v8Context(); auto handle = lock.wrap(context, moduleContext.addRef());