summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Smith <brian@dbsoft.org>2022-06-15 01:27:04 -0500
committerBrian Smith <brian@dbsoft.org>2022-06-15 01:27:04 -0500
commitf924d979d537fe9ed871ad9753b71e043b740d96 (patch)
tree5a3ab1dc39bd11b2f9df5ac112db5b2be0102027
parent2d9b9a9617626d879e41ae3277c4253b32d0286c (diff)
downloaduxp-f924d979d537fe9ed871ad9753b71e043b740d96.tar.gz
Issue #1905 - Part 4b - Fix issue loading the profile and saving changes to the profile.
Based on the following Mozilla bugs: 1659904, 1659905 and 1659077.
-rw-r--r--dom/system/OSFileConstants.cpp8
-rw-r--r--js/src/ctypes/CTypes.cpp15
-rw-r--r--toolkit/components/osfile/modules/osfile_shared_allthreads.jsm8
-rw-r--r--toolkit/components/osfile/modules/osfile_unix_back.jsm2
-rw-r--r--toolkit/components/osfile/modules/osfile_unix_front.jsm4
5 files changed, 24 insertions, 13 deletions
diff --git a/dom/system/OSFileConstants.cpp b/dom/system/OSFileConstants.cpp
index 551ed5773f..2f985f45d6 100644
--- a/dom/system/OSFileConstants.cpp
+++ b/dom/system/OSFileConstants.cpp
@@ -704,10 +704,10 @@ static const dom::ConstantSpec gLibcProperties[] =
// Under MacOSX, to avoid using deprecated functions that do not
// match the constants we define in this object (including
// |sizeof|/|offsetof| stuff, but not only), for a number of
- // functions, we need to adapt the name of the symbols we are using,
- // whenever macro _DARWIN_FEATURE_64_BIT_INODE is set. We export
- // this value to be able to do so from JavaScript.
-#if defined(_DARWIN_FEATURE_64_BIT_INODE)
+ // functions, we need to use functions with a $INODE64 suffix.
+ // That is true on Intel-based mac when the _DARWIN_FEATURE_64_BIT_INODE
+ // macro is set. But not on Apple Silicon.
+#if defined(_DARWIN_FEATURE_64_BIT_INODE) && !defined(__aarch64__)
{ "_DARWIN_FEATURE_64_BIT_INODE", JS::Int32Value(1) },
#endif // defined(_DARWIN_FEATURE_64_BIT_INODE)
diff --git a/js/src/ctypes/CTypes.cpp b/js/src/ctypes/CTypes.cpp
index b75b42072f..3bc249e015 100644
--- a/js/src/ctypes/CTypes.cpp
+++ b/js/src/ctypes/CTypes.cpp
@@ -6708,12 +6708,15 @@ PrepareCIF(JSContext* cx,
if (!rtype)
return false;
- ffi_status status =
- ffi_prep_cif(&fninfo->mCIF,
- abi,
- fninfo->mFFITypes.length(),
- rtype,
- fninfo->mFFITypes.begin());
+ ffi_status status;
+ if (fninfo->mIsVariadic) {
+ status = ffi_prep_cif_var(&fninfo->mCIF, abi, fninfo->mArgTypes.length(),
+ fninfo->mFFITypes.length(), rtype,
+ fninfo->mFFITypes.begin());
+ } else {
+ status = ffi_prep_cif(&fninfo->mCIF, abi, fninfo->mFFITypes.length(), rtype,
+ fninfo->mFFITypes.begin());
+ }
switch (status) {
case FFI_OK:
diff --git a/toolkit/components/osfile/modules/osfile_shared_allthreads.jsm b/toolkit/components/osfile/modules/osfile_shared_allthreads.jsm
index c5c5051026..5d09d765c3 100644
--- a/toolkit/components/osfile/modules/osfile_shared_allthreads.jsm
+++ b/toolkit/components/osfile/modules/osfile_shared_allthreads.jsm
@@ -1130,6 +1130,14 @@ var declareFFI = function declareFFI(lib, symbol, abi,
throw new TypeError("Missing type for argument " + ( i - 3 ) +
" of symbol " + symbol);
}
+ // Ellipsis for variadic arguments.
+ if (current == "...") {
+ if (i != arguments.length - 1) {
+ throw new TypeError("Variadic ellipsis must be the last argument");
+ }
+ signature.push(current);
+ continue;
+ }
if (!current.implementation) {
throw new TypeError("Missing implementation for argument " + (i - 3)
+ " of symbol " + symbol
diff --git a/toolkit/components/osfile/modules/osfile_unix_back.jsm b/toolkit/components/osfile/modules/osfile_unix_back.jsm
index 4cc4445673..6678edf25b 100644
--- a/toolkit/components/osfile/modules/osfile_unix_back.jsm
+++ b/toolkit/components/osfile/modules/osfile_unix_back.jsm
@@ -435,7 +435,7 @@
/*return*/ Type.negativeone_or_fd,
/*path*/ Type.path,
/*oflags*/ Type.int,
- /*mode*/ Type.int);
+ "...");
if (OS.Constants.Sys.Name == "NetBSD") {
libc.declareLazyFFI(SysFile, "opendir",
diff --git a/toolkit/components/osfile/modules/osfile_unix_front.jsm b/toolkit/components/osfile/modules/osfile_unix_front.jsm
index 4e41036dfc..44454daf1d 100644
--- a/toolkit/components/osfile/modules/osfile_unix_front.jsm
+++ b/toolkit/components/osfile/modules/osfile_unix_front.jsm
@@ -320,7 +320,7 @@
flags |= Const.O_APPEND;
}
}
- return error_or_file(UnixFile.open(path, flags, omode), path);
+ return error_or_file(UnixFile.open(path, flags, ctypes.int(omode)), path);
};
/**
@@ -675,7 +675,7 @@
// If necessary, fail if the destination file exists
if (options.noOverwrite) {
- let fd = UnixFile.open(destPath, Const.O_RDONLY, 0);
+ let fd = UnixFile.open(destPath, Const.O_RDONLY);
if (fd != -1) {
fd.dispose();
// The file exists and we have access