Skip to content

Commit 8526195

Browse files
authored
Fix js-confdefs.h includes (#521)
* Add streams available test Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * try Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Fix usages of FI Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * try Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * fmt Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> --------- Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
1 parent 3a0a5f0 commit 8526195

File tree

3 files changed

+29
-12
lines changed

3 files changed

+29
-12
lines changed

mozjs-sys/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "mozjs_sys"
33
description = "System crate for the Mozilla SpiderMonkey JavaScript engine."
44
repository.workspace = true
5-
version = "0.128.3-3"
5+
version = "0.128.3-4"
66
authors = ["Mozilla"]
77
links = "mozjs"
88
build = "build.rs"

mozjs-sys/build.rs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,8 @@ mod jsglue {
704704

705705
let confdefs_path: PathBuf = outdir.join("js/src/js-confdefs.h");
706706
let msvc = if build.get_compiler().is_like_msvc() {
707-
build.flag(&format!("-FI{}", confdefs_path.to_string_lossy()));
707+
build.flag("-FI");
708+
build.flag(&confdefs_path);
708709
build.define("WIN32", "");
709710
build.flag("-Zi");
710711
build.flag("-GR-");
@@ -733,19 +734,13 @@ mod jsglue {
733734
.clang_args(["-I", &include_path.to_string_lossy()])
734735
.enable_cxx_namespaces()
735736
.allowlist_file("./src/jsglue.cpp")
736-
.allowlist_recursively(false);
737+
.allowlist_recursively(false)
738+
.clang_args(["-include", &confdefs_path.to_str().expect("UTF-8")]);
737739

738740
if msvc {
739-
builder = builder.clang_args([
740-
"-fms-compatibility",
741-
&format!("-FI{}", confdefs_path.to_string_lossy()),
742-
"-DWIN32",
743-
"-std=c++17",
744-
])
741+
builder = builder.clang_args(["-fms-compatibility", "-DWIN32", "-std=c++17"])
745742
} else {
746-
builder = builder
747-
.clang_args(["-fPIC", "-fno-rtti", "-std=c++17"])
748-
.clang_args(["-include", &confdefs_path.to_str().expect("UTF-8")])
743+
builder = builder.clang_args(["-fPIC", "-fno-rtti", "-std=c++17"])
749744
}
750745

751746
for ty in BLACKLIST_TYPES {

mozjs-sys/tests/streams_available.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/* This Source Code Form is subject to the terms of the Mozilla Public
2+
* License, v. 2.0. If a copy of the MPL was not distributed with this
3+
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4+
5+
#![cfg(feature = "streams")]
6+
7+
use mozjs_sys::glue::ReadableStreamUnderlyingSourceTraps;
8+
9+
static UNDERLYING_SOURCE_TRAPS: ReadableStreamUnderlyingSourceTraps =
10+
ReadableStreamUnderlyingSourceTraps {
11+
requestData: None,
12+
writeIntoReadRequestBuffer: None,
13+
cancel: None,
14+
onClosed: None,
15+
onErrored: None,
16+
finalize: None,
17+
};
18+
19+
#[test]
20+
fn test_ok() {
21+
assert!(UNDERLYING_SOURCE_TRAPS.requestData.is_none());
22+
}

0 commit comments

Comments
 (0)