Skip to content

Commit cc4d4da

Browse files
committed
Merge branch 'main' into Xmader/feat/url
2 parents 3ea52a7 + 50bc2b8 commit cc4d4da

File tree

5 files changed

+23
-12
lines changed

5 files changed

+23
-12
lines changed

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

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ jobs:
2525
strategy:
2626
fail-fast: false
2727
matrix:
28-
# Use Ubuntu 20.04 / macOS 12 + Python 3.10 to build SpiderMonkey
29-
os: [ 'ubuntu-20.04', 'macos-12', 'm2ci' ]
28+
# Use Ubuntu 20.04 / macOS 13 + Python 3.10 to build SpiderMonkey
29+
os: [ 'ubuntu-20.04', 'macos-13', 'm2ci' ]
3030
python_version: [ '3.10' ]
3131
runs-on: ${{ matrix.os }}
3232
steps:
@@ -40,13 +40,18 @@ jobs:
4040
with:
4141
path: |
4242
./_spidermonkey_install/*
43-
key: spidermonkey102.13-${{ runner.os }}-${{ runner.arch }}
43+
key: spidermonkey115.1.0-${{ runner.os }}-${{ runner.arch }}
4444
lookup-only: true # skip download
4545
- name: Setup Poetry
4646
if: ${{ steps.cache-spidermonkey.outputs.cache-hit != 'true' }}
4747
uses: snok/install-poetry@v1
4848
with:
4949
version: 1.5.1
50+
- name: Setup XCode
51+
if: ${{ matrix.os == 'macos-13' && steps.cache-spidermonkey.outputs.cache-hit != 'true' }}
52+
# SpiderMonkey 115 ESR requires XCode SDK version at least 13.3
53+
# https://github.com/actions/runner-images/blob/main/images/macos/macos-13-Readme.md#installed-sdks
54+
run: sudo xcode-select -switch /Applications/Xcode_14.3.app
5055
- name: Build spidermonkey
5156
if: ${{ steps.cache-spidermonkey.outputs.cache-hit != 'true' }}
5257
run: ./setup.sh
@@ -60,7 +65,7 @@ jobs:
6065
with:
6166
path: |
6267
./_spidermonkey_install/*
63-
key: spidermonkey102.13-${{ runner.os }}-${{ runner.arch }}
68+
key: spidermonkey115.1.0-${{ runner.os }}-${{ runner.arch }}
6469
lookup-only: true # skip download
6570
- name: Setup Poetry
6671
if: ${{ steps.cache-spidermonkey.outputs.cache-hit != 'true' }}
@@ -135,7 +140,7 @@ jobs:
135140
with:
136141
path: |
137142
./_spidermonkey_install/*
138-
key: spidermonkey102.13-${{ runner.os }}-${{ runner.arch }}
143+
key: spidermonkey115.1.0-${{ runner.os }}-${{ runner.arch }}
139144
fail-on-cache-miss: true # SpiderMonkey is expected to be cached in its dedicated job
140145
- name: Build pminit
141146
run: |

cmake/modules/FindSpiderMonkey.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ set(SPIDERMONKEY_PATHS
5959
set(SPIDERMONKEY_HEADERS jsapi.h js/RequiredDefines.h)
6060

6161
# SpiderMonkey include suffix paths
62-
set(SPIDERMONKEY_INCLUDE_SUFFIX_PATHS dist/include js/src include include/js include/mozjs-48a1 include/mozjs-102/)
62+
set(SPIDERMONKEY_INCLUDE_SUFFIX_PATHS include/mozjs-115/)
6363

6464
# Find SpiderMonkey include path
6565
find_path(SPIDERMONKEY_INCLUDE_DIR ${SPIDERMONKEY_HEADERS}
@@ -70,7 +70,7 @@ find_path(SPIDERMONKEY_INCLUDE_DIR ${SPIDERMONKEY_HEADERS}
7070
)
7171

7272
# SpiderMonkey libs
73-
set(SPIDERMONKEY_LIBRARY_NAMES libmozjs-102.so libmozjs-102.dylib mozjs-102.lib)
73+
set(SPIDERMONKEY_LIBRARY_NAMES libmozjs-115.so libmozjs-115.dylib mozjs-115.lib)
7474

7575
set(SPIDERMONKEY_LIB_SUFFIX_PATHS js/src/build lib)
7676

setup.sh

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ CPUS=$(getconf _NPROCESSORS_ONLN 2>/dev/null || getconf NPROCESSORS_ONLN 2>/dev/
99
echo "Installing dependencies"
1010
if [[ "$OSTYPE" == "linux-gnu"* ]]; then # Linux
1111
sudo apt-get update --yes
12-
sudo apt-get install --yes cmake doxygen graphviz llvm g++ pkg-config m4 \
12+
sudo apt-get install --yes cmake doxygen graphviz llvm clang pkg-config m4 \
1313
wget curl python3-distutils python3-dev
1414
elif [[ "$OSTYPE" == "darwin"* ]]; then # macOS
1515
brew update || true # allow failure
@@ -28,9 +28,9 @@ poetry self add "poetry-dynamic-versioning[plugin]"
2828
echo "Done installing dependencies"
2929

3030
echo "Downloading spidermonkey source code"
31-
wget -c -q https://ftp.mozilla.org/pub/firefox/releases/102.13.0esr/source/firefox-102.13.0esr.source.tar.xz
31+
wget -c -q https://ftp.mozilla.org/pub/firefox/releases/115.1.0esr/source/firefox-115.1.0esr.source.tar.xz
3232
mkdir -p firefox-source
33-
tar xf firefox-102.13.0esr.source.tar.xz -C firefox-source --strip-components=1 # strip the root folder
33+
tar xf firefox-115.1.0esr.source.tar.xz -C firefox-source --strip-components=1 # strip the root folder
3434
echo "Done downloading spidermonkey source code"
3535

3636
echo "Building spidermonkey"
@@ -39,11 +39,10 @@ cd firefox-source
3939
sed -i'' -e 's/os not in ("WINNT", "OSX", "Android")/os not in ("WINNT", "Android")/' ./build/moz.configure/pkg.configure # use pkg-config on macOS
4040
sed -i'' -e '/"WindowsDllMain.cpp"/d' ./mozglue/misc/moz.build # https://discourse.mozilla.org/t/105671, https://bugzilla.mozilla.org/show_bug.cgi?id=1751561
4141
sed -i'' -e '/"winheap.cpp"/d' ./memory/mozalloc/moz.build # https://bugzilla.mozilla.org/show_bug.cgi?id=1802675
42+
sed -i'' -e 's/"install-name-tool"/"install_name_tool"/' ./moz.configure # `install-name-tool` does not exist, but we have `install_name_tool`
4243
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
4344
sed -i'' -e 's/bool js::Unbox/JS_PUBLIC_API bool js::Unbox/g' ./js/src/vm/JSObject.cpp # same here
4445
cd js/src
45-
cp ./configure.in ./configure
46-
chmod +x ./configure
4746
mkdir -p _build
4847
cd _build
4948
mkdir -p ../../../../_spidermonkey_install/

src/modules/pythonmonkey/pythonmonkey.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,9 @@ static PyObject *eval(PyObject *self, PyObject *args) {
253253
js::ESClass cls = js::ESClass::Other; // placeholder if `rval` is not a JSObject
254254
if (rval->isObject()) {
255255
JS::GetBuiltinClass(GLOBAL_CX, JS::RootedObject(GLOBAL_CX, &rval->toObject()), &cls);
256+
if (JS_ObjectIsBoundFunction(&rval->toObject())) {
257+
cls = js::ESClass::Function; // In SpiderMonkey 115 ESR, bound function is no longer a JSFunction but a js::BoundFunctionObject.
258+
}
256259
}
257260
bool rvalIsFunction = cls == js::ESClass::Function; // function object
258261
bool rvalIsString = rval->isString() || cls == js::ESClass::String; // string primitive or boxed String object

src/pyTypeFactory.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@ PyType *pyTypeFactory(JSContext *cx, JS::Rooted<JSObject *> *thisObj, JS::Rooted
106106
}
107107
js::ESClass cls;
108108
JS::GetBuiltinClass(cx, obj, &cls);
109+
if (JS_ObjectIsBoundFunction(obj)) {
110+
cls = js::ESClass::Function; // In SpiderMonkey 115 ESR, bound function is no longer a JSFunction but a js::BoundFunctionObject.
111+
// js::ESClass::Function only assigns to JSFunction objects by JS::GetBuiltinClass.
112+
}
109113
switch (cls) {
110114
case js::ESClass::Boolean: {
111115
// TODO (Caleb Aikens): refactor out all `js::Unbox` calls

0 commit comments

Comments
 (0)