Skip to content

Commit 17d778a

Browse files
Merge branch 'main' into Xmader/fix/xhr-poll-error
2 parents 1c09b2b + 5fc6ce0 commit 17d778a

26 files changed

+1093
-188
lines changed

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

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ jobs:
5959
strategy:
6060
fail-fast: false
6161
matrix:
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' ] # macOS 14 runner exclusively runs on M1 hardwares
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
6464
# 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 }}
@@ -81,8 +81,7 @@ jobs:
8181
lookup-only: true # skip download
8282
- name: Setup XCode
8383
if: ${{ (matrix.os == 'macos-13' || matrix.os == 'macos-14') && steps.cache-spidermonkey.outputs.cache-hit != 'true' }}
84-
# SpiderMonkey 115 ESR requires XCode SDK version at least 13.3
85-
# https://github.com/actions/runner-images/blob/main/images/macos/macos-13-Readme.md#installed-sdks
84+
# SpiderMonkey requires XCode SDK version at least 13.3
8685
run: sudo xcode-select -switch /Applications/Xcode_14.3.app
8786
- name: Build spidermonkey
8887
if: ${{ steps.cache-spidermonkey.outputs.cache-hit != 'true' }}
@@ -128,8 +127,7 @@ jobs:
128127
strategy:
129128
fail-fast: false
130129
matrix:
131-
# The lowest supported version is Ubuntu 20.04 + Python 3.8 or macOS 12 + Python 3.9
132-
os: [ 'ubuntu-20.04', 'macos-12', 'macos-14', 'windows-2022' ]
130+
os: [ 'ubuntu-20.04', 'ubuntu-24.04', 'macos-12', 'macos-14', 'windows-2022' ]
133131
python_version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ]
134132
exclude:
135133
# actions/setup-python: The version '3.8'/'3.9' with architecture 'arm64' was not found for macOS.
@@ -274,6 +272,19 @@ jobs:
274272
with:
275273
name: wheel-${{ github.run_id }}-${{ github.sha }}
276274
path: ./dist/
275+
check-install-from-sdist:
276+
needs: sdist
277+
runs-on: ubuntu-24.04
278+
steps:
279+
- uses: actions/setup-python@v5
280+
with:
281+
python-version: '3.10'
282+
- name: Download wheels built
283+
uses: actions/download-artifact@v3
284+
with:
285+
name: wheel-${{ github.run_id }}-${{ github.sha }}
286+
path: ./dist/
287+
- run: pip install ./dist/pythonmonkey-*.tar.gz
277288
publish:
278289
needs: [build-and-test, sdist]
279290
runs-on: ubuntu-20.04

.github/workflows/update-mozcentral-version.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,16 @@ jobs:
2424
jq --join-output '(.lastpushid | tostring) as $pushid | empty, .pushes[$pushid].changesets[0]'
2525
)
2626
echo "MOZCENTRAL_VERSION=$COMMIT_HASH" >> $GITHUB_ENV
27+
echo "MOZCENTRAL_VERSION_SHORT=${COMMIT_HASH:0:7}" >> $GITHUB_ENV
2728
- name: Update `mozcentral.version` File
28-
run: echo $MOZCENTRAL_VERSION > mozcentral.version
29+
run: echo -n $MOZCENTRAL_VERSION > mozcentral.version
2930
- name: Create Pull Request
3031
uses: peter-evans/create-pull-request@v6
3132
with:
3233
add-paths: mozcentral.version
3334
commit-message: |
3435
chore(deps): upgrade SpiderMonkey to `${{ env.MOZCENTRAL_VERSION }}`
35-
branch: chore/upgrade-spidermonkey-to-${{ env.MOZCENTRAL_VERSION }}
36+
branch: chore/upgrade-spidermonkey-to-${{ env.MOZCENTRAL_VERSION_SHORT }}
3637
title: Upgrade SpiderMonkey to mozilla-central commit `${{ env.MOZCENTRAL_VERSION }}`
3738
body: |
3839
Changeset: https://hg.mozilla.org/mozilla-central/rev/${{ env.MOZCENTRAL_VERSION }}

include/JSStringProxy.hh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,35 @@ public:
3636
* @param self - The JSStringProxy to be free'd
3737
*/
3838
static void JSStringProxy_dealloc(JSStringProxy *self);
39+
40+
/**
41+
* @brief copy protocol method for both copy and deepcopy
42+
*
43+
* @param self - The JSObjectProxy
44+
* @return a copy of the string
45+
*/
46+
static PyObject *JSStringProxy_copy_method(JSStringProxy *self);
47+
};
48+
49+
// docs for methods, copied from cpython
50+
PyDoc_STRVAR(stringproxy_deepcopy__doc__,
51+
"__deepcopy__($self, memo, /)\n"
52+
"--\n"
53+
"\n");
54+
55+
PyDoc_STRVAR(stringproxy_copy__doc__,
56+
"__copy__($self, /)\n"
57+
"--\n"
58+
"\n");
59+
60+
/**
61+
* @brief Struct for the other methods
62+
*
63+
*/
64+
static PyMethodDef JSStringProxy_methods[] = {
65+
{"__deepcopy__", (PyCFunction)JSStringProxyMethodDefinitions::JSStringProxy_copy_method, METH_O, stringproxy_deepcopy__doc__}, // ignores any memo argument
66+
{"__copy__", (PyCFunction)JSStringProxyMethodDefinitions::JSStringProxy_copy_method, METH_NOARGS, stringproxy_copy__doc__},
67+
{NULL, NULL} /* sentinel */
3968
};
4069

4170
/**

include/JobQueue.hh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ void runJobs(JSContext *cx) override;
7979
bool empty() const override;
8080

8181
/**
82-
* @return true if the job queue stops draining, which results in `empty()` being false after `runJobs()`.
82+
* @return true if the job queue stopped draining, which results in `empty()` being false after `runJobs()`.
8383
*/
8484
bool isDrainingStopped() const override;
8585

include/PyBaseProxyHandler.hh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public:
3030
bool isExtensible(JSContext *cx, JS::HandleObject proxy, bool *extensible) const override final;
3131
};
3232

33-
enum ProxySlots {PyObjectSlot};
33+
enum ProxySlots {PyObjectSlot, OtherSlot};
3434

3535
typedef struct {
3636
const char *name; /* The name of the method */

include/PyBytesProxyHandler.hh

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/**
2+
* @file PyBytesProxyHandler.hh
3+
* @author Philippe Laporte ([email protected])
4+
* @brief Struct for creating JS Uint8Array-like proxy objects for immutable bytes objects
5+
* @date 2024-07-23
6+
*
7+
* @copyright Copyright (c) 2024 Distributive Corp.
8+
*
9+
*/
10+
11+
#ifndef PythonMonkey_PyBytesProxy_
12+
#define PythonMonkey_PyBytesProxy_
13+
14+
15+
#include "include/PyObjectProxyHandler.hh"
16+
17+
18+
/**
19+
* @brief This struct is the ProxyHandler for JS Proxy Iterable pythonmonkey creates to handle coercion from python iterables to JS Objects
20+
*
21+
*/
22+
struct PyBytesProxyHandler : public PyObjectProxyHandler {
23+
public:
24+
PyBytesProxyHandler() : PyObjectProxyHandler(&family) {};
25+
static const char family;
26+
27+
/**
28+
* @brief [[Set]]
29+
*
30+
* @param cx pointer to JSContext
31+
* @param proxy The proxy object who's property we wish to set
32+
* @param id Key of the property we wish to set
33+
* @param v Value that we wish to set the property to
34+
* @param receiver The `this` value to use when executing any code
35+
* @param result whether or not the call succeeded
36+
* @return true call succeed
37+
* @return false call failed and an exception has been raised
38+
*/
39+
bool set(JSContext *cx, JS::HandleObject proxy, JS::HandleId id,
40+
JS::HandleValue v, JS::HandleValue receiver,
41+
JS::ObjectOpResult &result) const override;
42+
43+
bool getOwnPropertyDescriptor(
44+
JSContext *cx, JS::HandleObject proxy, JS::HandleId id,
45+
JS::MutableHandle<mozilla::Maybe<JS::PropertyDescriptor>> desc
46+
) const override;
47+
48+
/**
49+
* @brief Handles python object reference count when JS Proxy object is finalized
50+
*
51+
* @param gcx pointer to JS::GCContext
52+
* @param proxy the proxy object being finalized
53+
*/
54+
void finalize(JS::GCContext *gcx, JSObject *proxy) const override;
55+
};
56+
57+
#endif

include/PyIterableProxyHandler.hh

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,6 @@ public:
2828
JSContext *cx, JS::HandleObject proxy, JS::HandleId id,
2929
JS::MutableHandle<mozilla::Maybe<JS::PropertyDescriptor>> desc
3030
) const override;
31-
32-
/**
33-
* @brief An array of method definitions for Iterable prototype methods
34-
*
35-
*/
36-
static JSMethodDef iterable_methods[];
3731
};
3832

3933
#endif

include/PyObjectProxyHandler.hh

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -190,12 +190,6 @@ public:
190190
JS::ObjectOpResult &result) const override;
191191

192192
bool getBuiltinClass(JSContext *cx, JS::HandleObject proxy, js::ESClass *cls) const override;
193-
194-
/**
195-
* @brief An array of method definitions for Object prototype methods
196-
*
197-
*/
198-
static JSMethodDef object_methods[];
199193
};
200194

201195
#endif

include/StrType.hh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ public:
3737
static PyObject *getPyObject(JSContext *cx, JS::HandleValue str);
3838

3939
static const char *getValue(JSContext *cx, JS::HandleValue str);
40+
41+
static PyObject *proxifyString(JSContext *cx, JS::HandleValue str);
4042
};
4143

4244
#endif

mozcentral.version

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

0 commit comments

Comments
 (0)