Skip to content

Commit ab83685

Browse files
camillobruniV8 LUCI CQ
authored andcommitted
[api] Remove deprecated HostImportModuleDynamicallyCallback
Deprecation happend in v9.4 Bug: v8:11165 Change-Id: I7a28a9c50c25dbaad91cf254b9153154065108b9 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3173678 Auto-Submit: Camillo Bruni <[email protected]> Reviewed-by: Michael Lippautz <[email protected]> Reviewed-by: Jakob Gruber <[email protected]> Commit-Queue: Jakob Gruber <[email protected]> Cr-Commit-Position: refs/heads/main@{#77002}
1 parent d5b48f1 commit ab83685

File tree

5 files changed

+12
-90
lines changed

5 files changed

+12
-90
lines changed

include/v8-callbacks.h

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -210,32 +210,6 @@ using CreateHistogramCallback = void* (*)(const char* name, int min, int max,
210210

211211
using AddHistogramSampleCallback = void (*)(void* histogram, int sample);
212212

213-
/**
214-
* HostImportModuleDynamicallyCallback is called when we require the
215-
* embedder to load a module. This is used as part of the dynamic
216-
* import syntax.
217-
*
218-
* The referrer contains metadata about the script/module that calls
219-
* import.
220-
*
221-
* The specifier is the name of the module that should be imported.
222-
*
223-
* The embedder must compile, instantiate, evaluate the Module, and
224-
* obtain its namespace object.
225-
*
226-
* The Promise returned from this function is forwarded to userland
227-
* JavaScript. The embedder must resolve this promise with the module
228-
* namespace object. In case of an exception, the embedder must reject
229-
* this promise with the exception. If the promise creation itself
230-
* fails (e.g. due to stack overflow), the embedder must propagate
231-
* that exception by returning an empty MaybeLocal.
232-
*/
233-
using HostImportModuleDynamicallyCallback V8_DEPRECATED(
234-
"Use HostImportModuleDynamicallyWithImportAssertionsCallback instead") =
235-
MaybeLocal<Promise> (*)(Local<Context> context,
236-
Local<ScriptOrModule> referrer,
237-
Local<String> specifier);
238-
239213
// --- Exceptions ---
240214

241215
using FatalErrorCallback = void (*)(const char* location, const char* message);

include/v8-isolate.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -613,16 +613,6 @@ class V8_EXPORT Isolate {
613613
void SetAbortOnUncaughtExceptionCallback(
614614
AbortOnUncaughtExceptionCallback callback);
615615

616-
/**
617-
* This specifies the callback called by the upcoming dynamic
618-
* import() language feature to load modules.
619-
*/
620-
V8_DEPRECATED(
621-
"Use the version of SetHostImportModuleDynamicallyCallback that takes a "
622-
"HostImportModuleDynamicallyWithImportAssertionsCallback instead")
623-
void SetHostImportModuleDynamicallyCallback(
624-
HostImportModuleDynamicallyCallback callback);
625-
626616
/**
627617
* This specifies the callback called by the upcoming dynamic
628618
* import() language feature to load modules.

src/api/api.cc

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8561,12 +8561,6 @@ void Isolate::SetAbortOnUncaughtExceptionCallback(
85618561
isolate->SetAbortOnUncaughtExceptionCallback(callback);
85628562
}
85638563

8564-
void Isolate::SetHostImportModuleDynamicallyCallback(
8565-
i::Isolate::DeprecatedHostImportModuleDynamicallyCallback callback) {
8566-
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
8567-
isolate->SetHostImportModuleDynamicallyCallback(callback);
8568-
}
8569-
85708564
void Isolate::SetHostImportModuleDynamicallyCallback(
85718565
HostImportModuleDynamicallyWithImportAssertionsCallback callback) {
85728566
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);

src/execution/isolate.cc

Lines changed: 12 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4272,12 +4272,8 @@ MaybeHandle<JSPromise> Isolate::RunHostImportModuleDynamicallyCallback(
42724272
MaybeHandle<Object> maybe_import_assertions_argument) {
42734273
v8::Local<v8::Context> api_context =
42744274
v8::Utils::ToLocal(Handle<Context>(native_context()));
4275-
DCHECK(host_import_module_dynamically_callback_ == nullptr ||
4276-
host_import_module_dynamically_with_import_assertions_callback_ ==
4277-
nullptr);
4278-
if (host_import_module_dynamically_callback_ == nullptr &&
4279-
host_import_module_dynamically_with_import_assertions_callback_ ==
4280-
nullptr) {
4275+
if (host_import_module_dynamically_with_import_assertions_callback_ ==
4276+
nullptr) {
42814277
Handle<Object> exception =
42824278
factory()->NewError(error_function(), MessageTemplate::kUnsupported);
42834279
return NewRejectedPromise(this, api_context, exception);
@@ -4293,34 +4289,21 @@ MaybeHandle<JSPromise> Isolate::RunHostImportModuleDynamicallyCallback(
42934289
DCHECK(!has_pending_exception());
42944290

42954291
v8::Local<v8::Promise> promise;
4296-
4297-
if (host_import_module_dynamically_with_import_assertions_callback_) {
4298-
Handle<FixedArray> import_assertions_array;
4299-
if (GetImportAssertionsFromArgument(maybe_import_assertions_argument)
4300-
.ToHandle(&import_assertions_array)) {
4301-
ASSIGN_RETURN_ON_SCHEDULED_EXCEPTION_VALUE(
4302-
this, promise,
4303-
host_import_module_dynamically_with_import_assertions_callback_(
4304-
api_context, v8::Utils::ScriptOrModuleToLocal(referrer),
4305-
v8::Utils::ToLocal(specifier_str),
4306-
ToApiHandle<v8::FixedArray>(import_assertions_array)),
4307-
MaybeHandle<JSPromise>());
4308-
return v8::Utils::OpenHandle(*promise);
4309-
} else {
4310-
Handle<Object> exception(pending_exception(), this);
4311-
clear_pending_exception();
4312-
return NewRejectedPromise(this, api_context, exception);
4313-
}
4314-
4315-
} else {
4316-
DCHECK_NOT_NULL(host_import_module_dynamically_callback_);
4292+
Handle<FixedArray> import_assertions_array;
4293+
if (GetImportAssertionsFromArgument(maybe_import_assertions_argument)
4294+
.ToHandle(&import_assertions_array)) {
43174295
ASSIGN_RETURN_ON_SCHEDULED_EXCEPTION_VALUE(
43184296
this, promise,
4319-
host_import_module_dynamically_callback_(
4297+
host_import_module_dynamically_with_import_assertions_callback_(
43204298
api_context, v8::Utils::ScriptOrModuleToLocal(referrer),
4321-
v8::Utils::ToLocal(specifier_str)),
4299+
v8::Utils::ToLocal(specifier_str),
4300+
ToApiHandle<v8::FixedArray>(import_assertions_array)),
43224301
MaybeHandle<JSPromise>());
43234302
return v8::Utils::OpenHandle(*promise);
4303+
} else {
4304+
Handle<Object> exception(pending_exception(), this);
4305+
clear_pending_exception();
4306+
return NewRejectedPromise(this, api_context, exception);
43244307
}
43254308
}
43264309

@@ -4411,11 +4394,6 @@ MaybeHandle<FixedArray> Isolate::GetImportAssertionsFromArgument(
44114394

44124395
void Isolate::ClearKeptObjects() { heap()->ClearKeptObjects(); }
44134396

4414-
void Isolate::SetHostImportModuleDynamicallyCallback(
4415-
DeprecatedHostImportModuleDynamicallyCallback callback) {
4416-
host_import_module_dynamically_callback_ = callback;
4417-
}
4418-
44194397
void Isolate::SetHostImportModuleDynamicallyCallback(
44204398
HostImportModuleDynamicallyWithImportAssertionsCallback callback) {
44214399
host_import_module_dynamically_with_import_assertions_callback_ = callback;

src/execution/isolate.h

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1647,18 +1647,6 @@ class V8_EXPORT_PRIVATE Isolate final : private HiddenFactory {
16471647

16481648
void ClearKeptObjects();
16491649

1650-
// While deprecating v8::HostImportModuleDynamicallyCallback in v8.h we still
1651-
// need to support the version of the API that uses it, but we can't directly
1652-
// reference the deprecated version because of the enusing build warnings. So,
1653-
// we declare this matching type for temporary internal use.
1654-
// TODO(v8:10958) Delete this declaration and all references to it once
1655-
// v8::HostImportModuleDynamicallyCallback is removed.
1656-
typedef MaybeLocal<Promise> (*DeprecatedHostImportModuleDynamicallyCallback)(
1657-
v8::Local<v8::Context> context, v8::Local<v8::ScriptOrModule> referrer,
1658-
v8::Local<v8::String> specifier);
1659-
1660-
void SetHostImportModuleDynamicallyCallback(
1661-
DeprecatedHostImportModuleDynamicallyCallback callback);
16621650
void SetHostImportModuleDynamicallyCallback(
16631651
HostImportModuleDynamicallyWithImportAssertionsCallback callback);
16641652
MaybeHandle<JSPromise> RunHostImportModuleDynamicallyCallback(
@@ -2025,8 +2013,6 @@ class V8_EXPORT_PRIVATE Isolate final : private HiddenFactory {
20252013
v8::Isolate::AtomicsWaitCallback atomics_wait_callback_ = nullptr;
20262014
void* atomics_wait_callback_data_ = nullptr;
20272015
PromiseHook promise_hook_ = nullptr;
2028-
DeprecatedHostImportModuleDynamicallyCallback
2029-
host_import_module_dynamically_callback_ = nullptr;
20302016
HostImportModuleDynamicallyWithImportAssertionsCallback
20312017
host_import_module_dynamically_with_import_assertions_callback_ = nullptr;
20322018
std::atomic<debug::CoverageMode> code_coverage_mode_{

0 commit comments

Comments
 (0)