janl opened a new pull request #3421:
URL: https://github.com/apache/couchdb/pull/3421


   This is mainly in preparation for natively supporting Apple Silicon, as the 
build system required for SM68 is not support there.
   
   The main bulk is copied from the SM68 implementation, this is the effective 
diff:
   
   ```diff
   --- 68/main.cpp      2021-03-13 13:03:33.000000000 +0100
   +++ 86/main.cpp      2021-03-13 13:50:54.000000000 +0100
   @@ -22,17 +22,20 @@
    #endif
    
    #include <jsapi.h>
   +#include <js/Initialization.h>
    #include <js/CompilationAndEvaluation.h>
    #include <js/Conversions.h>
    #include <js/Initialization.h>
    #include <js/SourceText.h>
    #include <js/Warnings.h>
    #include <js/Wrapper.h>
   +#include <js/StableStringChars.h>
    
    #include "config.h"
    #include "util.h"
    
    static bool enableSharedMemory = true;
   +static bool enableToSource = true;
    
    static JSClassOps global_ops = {
        nullptr,
   @@ -61,6 +64,8 @@
        JS::RealmOptions options;
        
options.creationOptions().setSharedMemoryAndAtomicsEnabled(enableSharedMemory);
        options.creationOptions().setNewCompartmentAndZone();
   +    // we need this in the query server error handling
   +    options.creationOptions().setToSourceEnabled(enableToSource);
        JS::RootedObject obj(cx, JS_NewGlobalObject(cx, &global_class, nullptr,
                                                JS::DontFireOnNewGlobalHook, 
options));
        if (!obj)
   @@ -234,7 +239,7 @@
    
    
    static bool
   -csp_allows(JSContext* cx, JS::HandleValue code)
   +csp_allows(JSContext* cx, JS::HandleString code)
    {
        couch_args* args = static_cast<couch_args*>(JS_GetContextPrivate(cx));
        if(args->eval) {
   @@ -260,7 +265,7 @@
        couch_args* args = couch_parse_args(argc, argv);
    
        JS_Init();
   -    cx = JS_NewContext(args->stack_size, 8L * 1024L);
   +    cx = JS_NewContext(args->stack_size);
        if(cx == NULL)
            return 1;
    
   ```


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to