Skip to content

Commit

Permalink
deps
Browse files Browse the repository at this point in the history
  • Loading branch information
devsnek committed Oct 19, 2024
1 parent 6f86ed5 commit daf87b9
Show file tree
Hide file tree
Showing 15 changed files with 75 additions and 83 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ jobs:
- name: Install rust
uses: dsherret/rust-toolchain-file@v1

- name: Install binstall
uses: cargo-bins/cargo-binstall@main

- name: Install python
uses: actions/setup-python@v5
with:
Expand Down Expand Up @@ -125,6 +128,9 @@ jobs:
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=/usr/bin/aarch64-linux-gnu-gcc-10" >> ${GITHUB_ENV}
echo "QEMU_LD_PREFIX=/usr/aarch64-linux-gnu" >> ${GITHUB_ENV}
- name: Install nextest
run: cargo binstall cargo-nextest --secure --no-confirm

- name: Write git_submodule_status.txt
run: git submodule status --recursive > git_submodule_status.txt

Expand Down Expand Up @@ -199,7 +205,7 @@ jobs:
SCCACHE_IDLE_TIMEOUT: 0
if: matrix.config.variant == 'debug' || matrix.config.variant == 'release'
run:
${{ matrix.config.cargo }} test -vv --all-targets --locked ${{ env.CARGO_VARIANT_FLAG }}
${{ matrix.config.cargo }} nextest run -v --all-targets --locked ${{ env.CARGO_VARIANT_FLAG }}
--target ${{ matrix.config.target }}

- name: Clippy
Expand Down
2 changes: 1 addition & 1 deletion buildtools
Submodule buildtools updated from a7a84a to 5c5767
16 changes: 8 additions & 8 deletions src/isolate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ pub type HostInitializeImportMetaObjectCallback =
///
/// The specifier is the name of the module that should be imported.
///
/// The import_assertions are import assertions for this request in the form:
/// The import_attributes are import assertions for this request in the form:
/// [key1, value1, key2, value2, ...] where the keys and values are of type
/// v8::String. Note, unlike the FixedArray passed to ResolveModuleCallback and
/// returned from ModuleRequest::GetImportAssertions(), this array does not
Expand All @@ -217,7 +217,7 @@ pub type HostInitializeImportMetaObjectCallback =
/// host_defined_options: v8::Local<'s, v8::Data>,
/// resource_name: v8::Local<'s, v8::Value>,
/// specifier: v8::Local<'s, v8::String>,
/// import_assertions: v8::Local<'s, v8::FixedArray>,
/// import_attributes: v8::Local<'s, v8::FixedArray>,
/// ) -> Option<v8::Local<'s, v8::Promise>> {
/// todo!()
/// }
Expand Down Expand Up @@ -275,15 +275,15 @@ where
host_defined_options: Local<'s, Data>,
resource_name: Local<'s, Value>,
specifier: Local<'s, String>,
import_assertions: Local<'s, FixedArray>,
import_attributes: Local<'s, FixedArray>,
) -> Option<Local<'s, Promise>> {
let scope = &mut unsafe { CallbackScope::new(context) };
(F::get())(
scope,
host_defined_options,
resource_name,
specifier,
import_assertions,
import_attributes,
)
}

Expand All @@ -294,14 +294,14 @@ where
host_defined_options: Local<'s, Data>,
resource_name: Local<'s, Value>,
specifier: Local<'s, String>,
import_assertions: Local<'s, FixedArray>,
import_attributes: Local<'s, FixedArray>,
) -> *mut Promise {
scope_adapter::<F>(
context,
host_defined_options,
resource_name,
specifier,
import_assertions,
import_attributes,
)
.map(|return_value| return_value.as_non_null().as_ptr())
.unwrap_or_else(null_mut)
Expand All @@ -315,7 +315,7 @@ where
host_defined_options: Local<'s, Data>,
resource_name: Local<'s, Value>,
specifier: Local<'s, String>,
import_assertions: Local<'s, FixedArray>,
import_attributes: Local<'s, FixedArray>,
) -> *mut *mut Promise {
unsafe {
std::ptr::write(
Expand All @@ -325,7 +325,7 @@ where
host_defined_options,
resource_name,
specifier,
import_assertions,
import_attributes,
)
.map(|return_value| return_value.as_non_null().as_ptr())
.unwrap_or_else(null_mut),
Expand Down
11 changes: 11 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,3 +187,14 @@ pub const VERSION_STRING: &str =

// TODO(piscisaureus): Ideally this trait would not be exported.
pub use support::MapFnTo;

#[cfg(test)]
pub(crate) fn initialize_v8() {
use std::sync::Once;

static INIT: Once = Once::new();
INIT.call_once(|| {
V8::initialize_platform(new_default_platform(0, false).make_shared());
V8::initialize();
});
}
20 changes: 6 additions & 14 deletions src/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use crate::UnboundModuleScript;
use crate::Value;

/// Called during Module::instantiate_module. Provided with arguments:
/// (context, specifier, import_assertions, referrer). Return None on error.
/// (context, specifier, import_attributes, referrer). Return None on error.
///
/// Note: this callback has an unusual signature due to ABI incompatibilities
/// between Rust and C++. However end users can implement the callback as
Expand All @@ -31,7 +31,7 @@ use crate::Value;
/// fn my_resolve_callback<'a>(
/// context: v8::Local<'a, v8::Context>,
/// specifier: v8::Local<'a, v8::String>,
/// import_assertions: v8::Local<'a, v8::FixedArray>,
/// import_attributes: v8::Local<'a, v8::FixedArray>,
/// referrer: v8::Local<'a, v8::Module>,
/// ) -> Option<v8::Local<'a, v8::Module>> {
/// // ...
Expand Down Expand Up @@ -74,9 +74,9 @@ where
{
#[cfg(not(target_os = "windows"))]
fn mapping() -> Self {
let f = |context, specifier, import_assertions, referrer| {
let f = |context, specifier, import_attributes, referrer| {
ResolveModuleCallbackRet(
(F::get())(context, specifier, import_assertions, referrer)
(F::get())(context, specifier, import_attributes, referrer)
.map(|r| -> *const Module { &*r })
.unwrap_or(null()),
)
Expand All @@ -86,8 +86,8 @@ where

#[cfg(target_os = "windows")]
fn mapping() -> Self {
let f = |ret_ptr, context, specifier, import_assertions, referrer| {
let r = (F::get())(context, specifier, import_assertions, referrer)
let f = |ret_ptr, context, specifier, import_attributes, referrer| {
let r = (F::get())(context, specifier, import_attributes, referrer)
.map(|r| -> *const Module { &*r })
.unwrap_or(null());
unsafe { std::ptr::write(ret_ptr, r) }; // Write result to stack.
Expand Down Expand Up @@ -313,8 +313,6 @@ impl Module {
/// Returns an empty Maybe<bool> if an exception occurred during
/// instantiation. (In the case where the callback throws an exception, that
/// exception is propagated.)
///
/// NOTE: requires to set `--harmony-import-assertions` V8 flag.
#[must_use]
#[inline(always)]
pub fn instantiate_module<'a>(
Expand Down Expand Up @@ -507,10 +505,4 @@ impl ModuleRequest {
unsafe { Local::from_raw(v8__ModuleRequest__GetImportAttributes(self)) }
.unwrap()
}

#[inline(always)]
#[deprecated(note = "Use get_import_attributes instead")]
pub fn get_import_assertions(&self) -> Local<FixedArray> {
self.get_import_attributes()
}
}
15 changes: 2 additions & 13 deletions src/scope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2260,12 +2260,9 @@ mod raw {
#[cfg(test)]
mod tests {
use super::*;
use crate::new_default_platform;
use crate::ContextOptions;
use crate::Global;
use crate::V8;
use std::any::type_name;
use std::sync::Once;

trait SameType {}
impl<A> SameType for (A, A) {}
Expand All @@ -2284,17 +2281,9 @@ mod tests {
}
}

fn initialize_v8() {
static INIT: Once = Once::new();
INIT.call_once(|| {
V8::initialize_platform(new_default_platform(0, false).make_shared());
V8::initialize();
});
}

#[test]
fn deref_types() {
initialize_v8();
crate::initialize_v8();
let isolate = &mut Isolate::new(Default::default());
AssertTypeOf(isolate).is::<OwnedIsolate>();
let l1_hs = &mut HandleScope::new(isolate);
Expand Down Expand Up @@ -2468,7 +2457,7 @@ mod tests {

#[test]
fn new_scope_types() {
initialize_v8();
crate::initialize_v8();
let isolate = &mut Isolate::new(Default::default());
AssertTypeOf(isolate).is::<OwnedIsolate>();
let global_context: Global<Context>;
Expand Down
Loading

0 comments on commit daf87b9

Please sign in to comment.