Skip to content
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

Fix js-confdefs.h includes #521

Merged
merged 5 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion mozjs-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
17 changes: 6 additions & 11 deletions mozjs-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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-");
Expand Down Expand Up @@ -733,19 +734,13 @@ 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",
&format!("-FI{}", confdefs_path.to_string_lossy()),
"-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"])
.clang_args(["-include", &confdefs_path.to_str().expect("UTF-8")])
builder = builder.clang_args(["-fPIC", "-fno-rtti", "-std=c++17"])
}

for ty in BLACKLIST_TYPES {
Expand Down
22 changes: 22 additions & 0 deletions mozjs-sys/tests/streams_available.rs
Original file line number Diff line number Diff line change
@@ -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());
}