-
Notifications
You must be signed in to change notification settings - Fork 40
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
Build SpiderMonkey from mozilla-central
#367
Conversation
Switching to mozilla-central from the ESR versions could save us from bugs that were solved several months ago in upstream SpiderMonkey tip but haven't been backported to ESR. The mozilla-central commit hash to be used is stored in the `mozcentral.version` file.
…K version The latest version of SpiderMonkey on macOS requires at least Xcode SDK 14.4, but none is available on Github Actions runner's macOS 13 image. See https://github.com/actions/runner-images/blob/main/images/macos/macos-13-Readme.md#installed-sdks ERROR: SDK version "13.3" is too old. Please upgrade to at least 14.4. Try updating your system Xcode.
…macOS SDK version" The hacky solution doesn't work. This reverts commit e4c37db.
…DK in 126 alpha Using the commit for mozilla-central tag `FIREFOX_NIGHTLY_125_END`
Using the commit for mozilla-central tag `FIREFOX_NIGHTLY_120_END`
Using the commit for mozilla-central tag `FIREFOX_NIGHTLY_115_END`
This reverts commit 275b0bf.
This reverts commit 3a07532.
…he use of `JS::ColumnNumberOneOrigin` class after upgrading SpiderMonkey to mozilla-central tip
…iningStopped` virtual method after upgrading SpiderMonkey to mozilla-central tip
…rapped in a `mozilla::UniquePtr` instead of passing it directly to the function
… (`mozilla::UniquePtr<char[], ...>`) instead of a pure `char[]` after upgrading SpiderMonkey to mozilla-central tip
…resent on `JS::RealmCreationOptions` after upgrading SpiderMonkey to mozilla-central tip
Probably due to a bug in the build system, we could not use `JS::Prefs::setAtStartup_weakrefs(true);` or `JS::Prefs::setAtStartup_experimental_iterator_helpers(true);`: ``` undefined symbol: _ZN2JS5Prefs9weakrefs_E ``` Further more, the file `js/PrefsGenerated.h` does not get copied into the installation location of SpiderMonkey, but stays in `/js/src/_build/js/public/PrefsGenerated.h`.
…UTF8CharsZ` instead of a pure `char*` after upgrading SpiderMonkey to mozilla-central tip
Fixed in 3883b62 |
This reverts commit 04d028b.
…em-zlib` option is not available on Windows
The current SpiderMonkey requires Visual Studio 2022 or newer. The Windows 2019 runner only has Visual Studio Enterprise 2019 installed. See https://github.com/actions/runner-images/blob/main/images/windows/Windows2019-Readme.md#visual-studio-enterprise-2019
…fter reporting it in the firefox Matrix chat, updating SpiderMonkey to mozilla-central tip See https://bugzilla.mozilla.org/show_bug.cgi?id=1904747
TODO
|
…when mozilla-central is updated
include/JobQueue.hh
Outdated
@@ -78,6 +78,11 @@ void runJobs(JSContext *cx) override; | |||
*/ | |||
bool empty() const override; | |||
|
|||
/** | |||
* @return true if the job queue stops draining, which results in `empty()` being false after `runJobs()`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @return true if the job queue stops draining, which results in `empty()` being false after `runJobs()`. | |
* @return true if the job queue stopped draining, which results in `empty()` being false after `runJobs()`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I copied this from https://hg.mozilla.org/mozilla-central/file/d25c9bd/js/public/Promise.h#l84.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't understand why you'll need to change this.
Is this grammatically incorrect?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indeed, yes, "stops" refers to the present or future, whereas "stopped" refers to the past
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 | ||
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 | ||
sed -i'' -e 's/return JS::GetWeakRefsEnabled() == JS::WeakRefSpecifier::Disabled/return false/' ./js/src/vm/GlobalObject.cpp # forcibly enable FinalizationRegistry | ||
sed -i'' -e 's/return !IsIteratorHelpersEnabled()/return false/' ./js/src/vm/GlobalObject.cpp # forcibly enable iterator helpers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@caleb-distributive is this truly needed? Doesn't the switch in PyInit_pythonmonkey cover this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See the commit message in 42e3f53
@@ -276,7 +276,7 @@ JSObject *ExceptionType::toJsError(JSContext *cx, PyObject *exceptionValue, PyOb | |||
JS::RootedString filename(cx, JS_NewStringCopyZ(cx, PyUnicode_AsUTF8(fileName))); | |||
JS::RootedString message(cx, JS_NewStringCopyZ(cx, msgStream.str().c_str())); | |||
// stack argument cannot be passed in as a string anymore (deprecated), and could not find a proper example using the new argument type | |||
if (!JS::CreateError(cx, JSExnType::JSEXN_ERR, nullptr, filename, lineno, 0, nullptr, message, JS::NothingHandleValue, &rval)) { | |||
if (!JS::CreateError(cx, JSExnType::JSEXN_ERR, nullptr, filename, lineno, JS::ColumnNumberOneOrigin(1), nullptr, message, JS::NothingHandleValue, &rval)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why no longer 0?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JS::ColumnNumberOneOrigin(1)
One Origin
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JS::CreateError()
's function signature changed to CreateError(..., JS::ColumnNumberOneOrigin column,...)
See https://hg.mozilla.org/mozilla-central/file/d25c9bd/js/public/ErrorReport.h#l537
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JS::ColumnNumberOneOrigin
is defined in https://hg.mozilla.org/mozilla-central/file/d25c9bd/js/public/ColumnNumber.h#l324
} | ||
|
||
bool JobQueue::isDrainingStopped() const { | ||
// TODO (Tom Tang): implement this by detecting if the Python event-loop is still running |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's the specific challenge in implementing this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would have to modify the internal implementation of Python's asyncio
event-loop.
@@ -549,8 +550,6 @@ PyMODINIT_FUNC PyInit_pythonmonkey(void) | |||
|
|||
JS::RealmCreationOptions creationOptions = JS::RealmCreationOptions(); | |||
JS::RealmBehaviors behaviours = JS::RealmBehaviors(); | |||
creationOptions.setWeakRefsEnabled(JS::WeakRefSpecifier::EnabledWithoutCleanupSome); // enable FinalizationRegistry | |||
creationOptions.setIteratorHelpersEnabled(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@caleb-distributive please double-check with change above: why is this new way better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -1098,7 +1098,8 @@ class Counter { | |||
assert (False) | |||
except Exception as e: | |||
assert str(type(e)) == "<class 'pythonmonkey.SpiderMonkeyError'>" | |||
assert str(e).__contains__("TypeError: this is null") | |||
assert "TypeError:" in str(e) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in
is a basic operator in Python syntax.
https://realpython.com/python-in-operator/#strings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
__contains__
is the magic method for user-defined classes to implement the in
operator, which shouldn't be used directly.
https://docs.python.org/3/reference/expressions.html#membership-test-details
For the string and bytes types, x in y is True if and only if x is a substring of y. An equivalent test is y.find(x) != -1. Empty strings are always considered to be a substring of any other string, so "" in "abc" will return True.
For user-defined classes which define the
__contains__()
method, x in y returns True ify.__contains__(x)
returns a true value, and False otherwise.
|
Switching to mozilla-central from the ESR versions could save us from bugs that were solved several months ago in upstream SpiderMonkey tip but haven't been backported to ESR.
In order to make the target version consistent,
the mozilla-central commit hash to be used is stored in the
mozcentral.version
file.