big-r81 opened a new pull request, #5677:
URL: https://github.com/apache/couchdb/pull/5677
Tried to add SM v140. There are again some internal SpiderMonkey API changes.
Tried to compile against SpiderMonkey v140 and got following errors:
```
==> couch (compile)
Compiling
/Users/big-r/Documents/Developer/CouchDB/couchdb/src/couch/priv/couch_js/140/main.cpp
In file included from
/Users/big-r/Documents/Developer/CouchDB/couchdb/src/couch/priv/couch_js/140/main.cpp:24:
In file included from /usr/local/include/mozjs-140/jsapi.h:30:
In file included from /usr/local/include/mozjs-140/js/CallAndConstruct.h:15:
/usr/local/include/mozjs-140/js/RootingAPI.h:1169:34: warning: unknown
warning group '-Wdangling-pointer', ignored [-Wunknown-warning-option]
1169 | # pragma GCC diagnostic ignored "-Wdangling-pointer"
| ^
/Users/big-r/Documents/Developer/CouchDB/couchdb/src/couch/priv/couch_js/140/main.cpp:241:5:
error: cannot initialize a member subobject of type 'JSCSPEvalChecker' (aka
'bool (*)(JSContext *, JS::RuntimeCode, JS::Handle<JSString *>,
JS::CompilationType, JS::Handle<JS::StackGCVector<JSString *>>,
JS::Handle<JSString *>, JS::Handle<JS::StackGCVector<JS::Value>>,
JS::Handle<JS::Value>, bool *)') with an lvalue of type 'bool (JSContext *,
JS::RuntimeCode, JS::HandleString)' (aka 'bool (JSContext *, JS::RuntimeCode,
Handle<JSString *>)'): different number of parameters (9 vs 3)
241 | csp_allows,
| ^~~~~~~~~~
1 warning and 1 error generated.
ERROR: compile failed while processing
/Users/big-r/Documents/Developer/CouchDB/couchdb/src/couch: rebar_abort
make: *** [couch] Error 1
```
I changed the csp_allow method signature to fit the `typedef` in
`js/public/Principals.h`. I don't know if there is a better solution.
Before:
```cpp
static bool
csp_allows(JSContext* cx, JS::RuntimeCode kind, JS::HandleString code)
{
couch_args* args = static_cast<couch_args*>(JS_GetContextPrivate(cx));
if(args->eval) {
return true;
} else {
return false;
}
}
static JSSecurityCallbacks security_callbacks = {
csp_allows,
nullptr
};
```
After:
```cpp
static bool
csp_allows(JSContext* cx,
JS::RuntimeCode kind, JS::Handle<JSString*> codeString,
JS::CompilationType compilationType,
JS::Handle<JS::StackGCVector<JSString*>> parameterStrings,
JS::Handle<JSString*> bodyString,
JS::Handle<JS::StackGCVector<JS::Value>> parameterArgs,
JS::Handle<JS::Value> bodyArg, bool* outCanCompileStrings)
{
couch_args* args = static_cast<couch_args*>(JS_GetContextPrivate(cx));
if(args->eval) {
return true;
} else {
return false;
}
}
static JSSecurityCallbacks security_callbacks = {
csp_allows, //JSCSPEvalChecker contentSecurityPolicyAllows;
nullptr, //JSCodeForEvalOp codeForEvalGets;
nullptr //JSSubsumesOp subsumes;
};
```
Here are some additional
[infos](https://github.com/mozilla-spidermonkey/spidermonkey-embedding-examples/blob/esr140/docs/Migration%20Guide.md#esr-128-to-esr-140)
what changed in SpiderMonkey from 128 -> 140.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]