Skip to content

Commit 376ccd3

Browse files
authored
Merge branch 'main' into Xmader/fix/xhr-poll-error
2 parents 17d778a + c2de958 commit 376ccd3

File tree

6 files changed

+24
-24
lines changed

6 files changed

+24
-24
lines changed

.github/workflows/test-and-publish.yaml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ jobs:
5959
strategy:
6060
fail-fast: false
6161
matrix:
62-
# Use Ubuntu 20.04 / Ubuntu 24.04 / macOS 13 x86_64 / macOS 14 arm64 + Python 3.10 to build SpiderMonkey
63-
os: [ 'ubuntu-20.04', 'ubuntu-24.04', 'macos-13', 'macos-14' ] # macOS 14 runner exclusively runs on M1 hardwares
64-
# see https://github.blog/changelog/2024-01-30-github-actions-macos-14-sonoma-is-now-available
62+
# Use Ubuntu 20.04 / macOS 13 x86_64 / macOS 14 arm64 + Python 3.10 to build SpiderMonkey
63+
os: [ 'ubuntu-20.04', 'macos-13', 'macos-14', 'pi' ] # macOS 14 runner exclusively runs on M1 hardwares
64+
# see https://github.blog/changelog/2024-01-30-github-actions-macos-14-sonoma-is-now-available
6565
python_version: [ '3.10' ]
6666
runs-on: ${{ matrix.os }}
6767
steps:
@@ -127,7 +127,7 @@ jobs:
127127
strategy:
128128
fail-fast: false
129129
matrix:
130-
os: [ 'ubuntu-20.04', 'ubuntu-24.04', 'macos-12', 'macos-14', 'windows-2022' ]
130+
os: [ 'ubuntu-20.04', 'macos-12', 'macos-14', 'windows-2022', 'pi' ]
131131
python_version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ]
132132
exclude:
133133
# actions/setup-python: The version '3.8'/'3.9' with architecture 'arm64' was not found for macOS.
@@ -146,6 +146,9 @@ jobs:
146146
- uses: actions/setup-python@v5
147147
with:
148148
python-version: ${{ matrix.python_version }}
149+
- name: Remove old poetry cache
150+
run: rm -rf ~/.cache/pypoetry
151+
if: ${{ matrix.os == 'pi' }}
149152
- name: Setup Poetry
150153
uses: snok/install-poetry@v1
151154
with:
@@ -162,9 +165,11 @@ jobs:
162165
fi
163166
echo "Installing python deps"
164167
poetry self add "poetry-dynamic-versioning[plugin]"
165-
poetry env use python3 # use the correct Python version we've set up
168+
poetry env use python$PYTHON_VERSION || poetry env use python3 # use the correct Python version we've set up
166169
poetry install --no-root --only=dev
167170
echo "Installed Dependencies"
171+
env:
172+
PYTHON_VERSION: ${{ matrix.python_version }}
168173
- name: Build Docs # only build docs once
169174
if: ${{ matrix.os == 'ubuntu-20.04' && matrix.python_version == '3.11' }}
170175
run: |

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ using the Python engine to provide the Javascript host environment.
88

99
We feature JavaScript Array and Object methods implemented on Python List and Dictionaries using the cPython C API, and the inverse using the Mozilla Firefox Spidermonkey JavaScript C++ API.
1010

11-
This product is in an advanced stage, approximately 95% to MVP as of March 2024. It is under active development by [Distributive](https://distributive.network/).
11+
This product is in an advanced stage, approximately 98% to MVP as of August 2024. It is under active development by [Distributive](https://distributive.network/).
1212

1313
External contributions and feedback are welcome and encouraged.
1414

mozcentral.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
bc4609b7aa7a3dff961f43d527bc66c5c85f6f4b
1+
8a28ad54f9f516c41ceddfa7ea32368fccf4a0eb

python/pythonmonkey/builtin_modules/base64.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88

99

1010
def atob(b64):
11-
return str(base64.standard_b64decode(b64), 'latin1')
11+
padding = '=' * (4 - (len(b64) & 3))
12+
return str(base64.standard_b64decode(b64 + padding), 'latin1')
1213

1314

1415
def btoa(data):

setup.sh

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,11 @@ if [[ "$OSTYPE" == "linux-gnu"* ]]; then # Linux
1313
SUDO='sudo'
1414
fi
1515
echo "Installing apt packages"
16-
$SUDO apt-get install --yes cmake graphviz llvm clang pkg-config m4 unzip \
16+
$SUDO apt-get install --yes cmake llvm clang pkg-config m4 unzip \
1717
wget curl python3-dev
18-
# Install Doxygen
19-
# the newest version in Ubuntu 20.04 repository is 1.8.17, but we need Doxygen 1.9 series
20-
echo "Installing doxygen"
21-
wget -c -q https://www.doxygen.nl/files/doxygen-1.9.7.linux.bin.tar.gz
22-
tar xf doxygen-1.9.7.linux.bin.tar.gz
23-
cd doxygen-1.9.7 && $SUDO make install && cd -
24-
rm -rf doxygen-1.9.7 doxygen-1.9.7.linux.bin.tar.gz
2518
elif [[ "$OSTYPE" == "darwin"* ]]; then # macOS
2619
brew update || true # allow failure
27-
brew install cmake doxygen pkg-config wget unzip coreutils # `coreutils` installs the `realpath` command
20+
brew install cmake pkg-config wget unzip coreutils # `coreutils` installs the `realpath` command
2821
elif [[ "$OSTYPE" == "msys"* ]]; then # Windows
2922
echo "Dependencies are not going to be installed automatically on Windows."
3023
else
@@ -34,15 +27,15 @@ fi
3427
# Install rust compiler
3528
echo "Installing rust compiler"
3629
curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain 1.76
37-
. $HOME/.cargo/env
38-
cargo install cbindgen
30+
CARGO_BIN="$HOME/.cargo/bin/cargo" # also works for Windows. On Windows this equals to %USERPROFILE%\.cargo\bin\cargo
31+
$CARGO_BIN install cbindgen
3932
# Setup Poetry
4033
echo "Installing poetry"
4134
curl -sSL https://install.python-poetry.org | python3 - --version "1.7.1"
4235
if [[ "$OSTYPE" == "msys"* ]]; then # Windows
4336
POETRY_BIN="$APPDATA/Python/Scripts/poetry"
4437
else
45-
POETRY_BIN=`echo ~/.local/bin/poetry` # expand tilde
38+
POETRY_BIN="$HOME/.local/bin/poetry"
4639
fi
4740
$POETRY_BIN self add 'poetry-dynamic-versioning[plugin]'
4841
echo "Done installing dependencies"
@@ -63,7 +56,8 @@ sed -i'' -e '/"winheap.cpp"/d' ./memory/mozalloc/moz.build # https://bugzilla.mo
6356
sed -i'' -e 's/"install-name-tool"/"install_name_tool"/' ./moz.configure # `install-name-tool` does not exist, but we have `install_name_tool`
6457
sed -i'' -e 's/bool Unbox/JS_PUBLIC_API bool Unbox/g' ./js/public/Class.h # need to manually add JS_PUBLIC_API to js::Unbox until it gets fixed in Spidermonkey
6558
sed -i'' -e 's/bool js::Unbox/JS_PUBLIC_API bool js::Unbox/g' ./js/src/vm/JSObject.cpp # same here
66-
sed -i'' -e 's/shared_lib = self._pretty_path(libdef.output_path, backend_file)/shared_lib = libdef.lib_name/' ./python/mozbuild/mozbuild/backend/recursivemake.py
59+
sed -i'' -e 's/shared_lib = self._pretty_path(libdef.output_path, backend_file)/shared_lib = libdef.lib_name/' ./python/mozbuild/mozbuild/backend/recursivemake.py # would generate a Makefile to install the binary files from an invalid path prefix
60+
sed -i'' -e 's/% self._pretty_path(libdef.import_path, backend_file)/% libdef.import_name/' ./python/mozbuild/mozbuild/backend/recursivemake.py # same as above. Shall we file a bug in bugzilla?
6761
sed -i'' -e 's/if version < Version(mac_sdk_min_version())/if False/' ./build/moz.configure/toolchain.configure # do not verify the macOS SDK version as the required version is not available on Github Actions runner
6862
sed -i'' -e 's/return JS::GetWeakRefsEnabled() == JS::WeakRefSpecifier::Disabled/return false/' ./js/src/vm/GlobalObject.cpp # forcibly enable FinalizationRegistry
6963
sed -i'' -e 's/return !IsIteratorHelpersEnabled()/return false/' ./js/src/vm/GlobalObject.cpp # forcibly enable iterator helpers
@@ -73,7 +67,7 @@ cd js/src
7367
mkdir -p _build
7468
cd _build
7569
mkdir -p ../../../../_spidermonkey_install/
76-
../configure \
70+
../configure --target=$(clang --print-target-triple) \
7771
--prefix=$(realpath $PWD/../../../../_spidermonkey_install) \
7872
--with-intl-api \
7973
$(if [[ "$OSTYPE" != "msys"* ]]; then echo "--without-system-zlib"; fi) \

src/JSObjectProxy.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ bool JSObjectProxyMethodDefinitions::JSObjectProxy_richcompare_helper(JSObjectPr
245245
if (!js::GetPropertyKeys(GLOBAL_CX, *(self->jsObject), JSITER_OWNONLY, &props))
246246
{
247247
PyErr_Format(PyExc_SystemError, "%s JSAPI call failed", JSObjectProxyType.tp_name);
248-
return NULL;
248+
return false;
249249
}
250250

251251
// iterate recursively through members of self and check for equality
@@ -442,7 +442,7 @@ PyObject *JSObjectProxyMethodDefinitions::JSObjectProxy_repr(JSObjectProxy *self
442442
PyErr_Clear();
443443
}
444444

445-
if (_PyUnicodeWriter_WriteASCIIString(&writer, "<cannot repr type>", 19) < 0) {
445+
if (_PyUnicodeWriter_WriteASCIIString(&writer, "<cannot repr type>", 19) < 0) {
446446
goto error;
447447
}
448448
}

0 commit comments

Comments
 (0)