From 952b08a151ac9b42d51093500a8a8e2cbfacb91a Mon Sep 17 00:00:00 2001 From: sagudev <16504129+sagudev@users.noreply.github.com> Date: Mon, 4 Nov 2024 06:25:07 +0100 Subject: [PATCH 1/5] Add streams available test Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> --- mozjs-sys/tests/streams_available.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 mozjs-sys/tests/streams_available.rs diff --git a/mozjs-sys/tests/streams_available.rs b/mozjs-sys/tests/streams_available.rs new file mode 100644 index 00000000000..d0f11fcdb27 --- /dev/null +++ b/mozjs-sys/tests/streams_available.rs @@ -0,0 +1,22 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#![cfg(feature = "streams")] + +use mozjs_sys::glue::ReadableStreamUnderlyingSourceTraps; + +static UNDERLYING_SOURCE_TRAPS: ReadableStreamUnderlyingSourceTraps = + ReadableStreamUnderlyingSourceTraps { + requestData: None, + writeIntoReadRequestBuffer: None, + cancel: None, + onClosed: None, + onErrored: None, + finalize: None, + }; + +#[test] +fn test_ok() { + assert!(UNDERLYING_SOURCE_TRAPS.requestData.is_none()); +} From 79ad056a7f0399ac61b1615f8cbfdd1f07de3bb5 Mon Sep 17 00:00:00 2001 From: sagudev <16504129+sagudev@users.noreply.github.com> Date: Mon, 4 Nov 2024 07:15:03 +0100 Subject: [PATCH 2/5] try Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> --- mozjs-sys/Cargo.toml | 2 +- mozjs-sys/build.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mozjs-sys/Cargo.toml b/mozjs-sys/Cargo.toml index 99eb8538330..5587fdb84c6 100644 --- a/mozjs-sys/Cargo.toml +++ b/mozjs-sys/Cargo.toml @@ -2,7 +2,7 @@ name = "mozjs_sys" description = "System crate for the Mozilla SpiderMonkey JavaScript engine." repository.workspace = true -version = "0.128.3-3" +version = "0.128.3-4" authors = ["Mozilla"] links = "mozjs" build = "build.rs" diff --git a/mozjs-sys/build.rs b/mozjs-sys/build.rs index f45db78240f..392c80feabe 100644 --- a/mozjs-sys/build.rs +++ b/mozjs-sys/build.rs @@ -738,7 +738,7 @@ mod jsglue { if msvc { builder = builder.clang_args([ "-fms-compatibility", - &format!("-FI{}", confdefs_path.to_string_lossy()), + &format!("-FI {}", confdefs_path.to_string_lossy()), "-DWIN32", "-std=c++17", ]) From f0b685d8600df7d706cb52cdf5c828d54857eb0c Mon Sep 17 00:00:00 2001 From: sagudev <16504129+sagudev@users.noreply.github.com> Date: Mon, 4 Nov 2024 07:28:41 +0100 Subject: [PATCH 3/5] Fix usages of FI Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> --- mozjs-sys/build.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/mozjs-sys/build.rs b/mozjs-sys/build.rs index 392c80feabe..8ffa3d1eac7 100644 --- a/mozjs-sys/build.rs +++ b/mozjs-sys/build.rs @@ -704,7 +704,8 @@ mod jsglue { let confdefs_path: PathBuf = outdir.join("js/src/js-confdefs.h"); let msvc = if build.get_compiler().is_like_msvc() { - build.flag(&format!("-FI{}", confdefs_path.to_string_lossy())); + build.flag("-FI"); + build.flag(&confdefs_path); build.define("WIN32", ""); build.flag("-Zi"); build.flag("-GR-"); @@ -736,12 +737,9 @@ mod jsglue { .allowlist_recursively(false); if msvc { - builder = builder.clang_args([ - "-fms-compatibility", - &format!("-FI {}", confdefs_path.to_string_lossy()), - "-DWIN32", - "-std=c++17", - ]) + builder = builder + .clang_args(["-fms-compatibility", "-DWIN32", "-std=c++17"]) + .clang_args(["-FI", &confdefs_path.to_str().expect("UTF-8")]); } else { builder = builder .clang_args(["-fPIC", "-fno-rtti", "-std=c++17"]) From 4a9fafc5f6572296c68a3f89e94fbbe45b222e8c Mon Sep 17 00:00:00 2001 From: sagudev <16504129+sagudev@users.noreply.github.com> Date: Mon, 4 Nov 2024 07:39:37 +0100 Subject: [PATCH 4/5] try Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> --- mozjs-sys/build.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mozjs-sys/build.rs b/mozjs-sys/build.rs index 8ffa3d1eac7..86e81f3088e 100644 --- a/mozjs-sys/build.rs +++ b/mozjs-sys/build.rs @@ -734,16 +734,15 @@ mod jsglue { .clang_args(["-I", &include_path.to_string_lossy()]) .enable_cxx_namespaces() .allowlist_file("./src/jsglue.cpp") - .allowlist_recursively(false); + .allowlist_recursively(false) + .clang_args(["-include", &confdefs_path.to_str().expect("UTF-8")]); if msvc { builder = builder .clang_args(["-fms-compatibility", "-DWIN32", "-std=c++17"]) - .clang_args(["-FI", &confdefs_path.to_str().expect("UTF-8")]); } else { builder = builder .clang_args(["-fPIC", "-fno-rtti", "-std=c++17"]) - .clang_args(["-include", &confdefs_path.to_str().expect("UTF-8")]) } for ty in BLACKLIST_TYPES { From 88929f08a2a9dd8e51a30d4543dc7e2e9bc4c508 Mon Sep 17 00:00:00 2001 From: sagudev <16504129+sagudev@users.noreply.github.com> Date: Mon, 4 Nov 2024 07:56:27 +0100 Subject: [PATCH 5/5] fmt Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> --- mozjs-sys/build.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/mozjs-sys/build.rs b/mozjs-sys/build.rs index 86e81f3088e..10f14f30733 100644 --- a/mozjs-sys/build.rs +++ b/mozjs-sys/build.rs @@ -738,11 +738,9 @@ mod jsglue { .clang_args(["-include", &confdefs_path.to_str().expect("UTF-8")]); if msvc { - builder = builder - .clang_args(["-fms-compatibility", "-DWIN32", "-std=c++17"]) + builder = builder.clang_args(["-fms-compatibility", "-DWIN32", "-std=c++17"]) } else { - builder = builder - .clang_args(["-fPIC", "-fno-rtti", "-std=c++17"]) + builder = builder.clang_args(["-fPIC", "-fno-rtti", "-std=c++17"]) } for ty in BLACKLIST_TYPES {