Skip to content

Commit

Permalink
Merge pull request #1554 from cloudflare/jsnell/handful-of-v8-depreca…
Browse files Browse the repository at this point in the history
…tions
  • Loading branch information
jasnell authored Jan 19, 2024
2 parents fbd170a + ef22100 commit f9e50d8
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/workerd/api/unsafe.c++
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ UnsafeEval::newFunction(jsg::Lock& js, jsg::JsString script, jsg::Optional<kj::S
KJ_DEFER(js.setAllowEval(false));

auto nameStr = js.str(getName(name, ANON_STR));
v8::ScriptOrigin origin(js.v8Isolate, nameStr);
v8::ScriptOrigin origin(nameStr);
v8::ScriptCompiler::Source source(script, origin);

auto argNames = KJ_MAP(arg, args) {
Expand Down Expand Up @@ -79,7 +79,7 @@ UnsafeEval::newAsyncFunction(jsg::Lock& js, jsg::JsString script, jsg::Optional<
prepared = v8::String::Concat(js.v8Isolate, prepared, js.strIntern(";"));
prepared = v8::String::Concat(js.v8Isolate, prepared, nameStr);

v8::ScriptOrigin origin(js.v8Isolate, nameStr);
v8::ScriptOrigin origin(nameStr);
v8::ScriptCompiler::Source source(prepared, origin);

auto compiled = jsg::check(v8::ScriptCompiler::Compile(js.v8Context(), &source));
Expand Down
4 changes: 2 additions & 2 deletions src/workerd/jsg/async-context.c++
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ inline void maybeSetV8ContinuationContext(
} else {
value = v8::Undefined(isolate);
}
isolate->GetCurrentContext()->SetContinuationPreservedEmbedderData(value);
isolate->SetContinuationPreservedEmbedderData(value);
}
} // namespace

Expand Down Expand Up @@ -53,7 +53,7 @@ kj::Maybe<Ref<AsyncContextFrame>> AsyncContextFrame::currentRef(Lock& js) {
}

kj::Maybe<AsyncContextFrame&> 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<AsyncContextFrame*>(&wrappable);
KJ_ASSERT(frame != nullptr);
Expand Down
7 changes: 3 additions & 4 deletions src/workerd/jsg/modules.c++
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ void NonModuleScript::run(v8::Local<v8::Context> 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)));
Expand Down Expand Up @@ -375,8 +375,7 @@ v8::Local<v8::Module> 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, {},
Expand Down Expand Up @@ -433,7 +432,7 @@ v8::Local<v8::Module> createSyntheticModule(
return v8::Module::CreateSyntheticModule(
js.v8Isolate,
v8StrIntern(js.v8Isolate, name),
exportNames,
v8::MemorySpan<const v8::Local<v8::String>>(exportNames.data(), exportNames.size()),
&evaluateSyntheticModuleCallback);
}
} // namespace
Expand Down
4 changes: 2 additions & 2 deletions src/workerd/jsg/modules.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ class ModuleRegistry {
jsg::Ref<jsg::Object>& 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());
Expand Down Expand Up @@ -266,7 +266,7 @@ class ModuleRegistry {
Ref<CommonJsModuleContext>& 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());
Expand Down

0 comments on commit f9e50d8

Please sign in to comment.