Skip to content

Allow String as execute_script name parameter #1069

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
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 core/runtime/jsruntime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1507,7 +1507,8 @@ impl JsRuntime {
/// the global scope by default, and it is possible to maintain local JS state and invoke
/// this method multiple times.
///
/// `name` can be a filepath or any other string, but it is required to be 7-bit ASCII, eg.
/// `name` may be any type that implements the internal [`IntoModuleName`] trait.
/// It can be a filepath or any other string, but it is required to be 7-bit ASCII, eg.
///
/// - "/some/file/path.js"
/// - "<anon>"
Expand All @@ -1523,13 +1524,13 @@ impl JsRuntime {
/// `Error` can usually be downcast to `JsError`.
pub fn execute_script(
&mut self,
name: &'static str,
name: impl IntoModuleName,
source_code: impl IntoModuleCodeString,
) -> Result<v8::Global<v8::Value>, CoreError> {
let isolate = &mut self.inner.v8_isolate;
self.inner.main_realm.execute_script(
isolate,
FastString::from_static(name),
name.into_module_name(),
source_code.into_module_code(),
)
}
Expand Down
Loading