Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

"Uncaught RuntimeError: memory access out of bounds" when calling JSApi.JS_NewObject in WebGL #47

Open
jo32 opened this issue Aug 11, 2021 · 0 comments

Comments

@jo32
Copy link

jo32 commented Aug 11, 2021

I wrote a test file like:

using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using UnityEngine;
using QuickJS.Native;

public class TestBehaviourScript : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {
        var _rt = JSApi.JS_NewRuntime();
        var _ctx = JSApi.JS_NewContext(_rt);
        JSApi.JS_SetContextOpaque(_ctx, (IntPtr)1);
        JSApi.JS_AddIntrinsicOperators(_ctx);
        // var _atoms = new AtomCache(_ctx);
        // var _stringCache = new JSStringCache(_ctx);
        var _moduleCache = JSApi.JS_NewObject(_ctx);
        var _globalObject = JSApi.JS_GetGlobalObject(_ctx);
        var _objectConstructor = JSApi.JS_GetProperty(_ctx, _globalObject, JSApi.JS_ATOM_Object);
        var _numberConstructor = JSApi.JS_GetProperty(_ctx, _globalObject, JSApi.JS_ATOM_Number);
        var _proxyConstructor = JSApi.JS_GetProperty(_ctx, _globalObject, JSApi.JS_ATOM_Proxy);
        var _stringConstructor = JSApi.JS_GetProperty(_ctx, _globalObject, JSApi.JS_ATOM_String);
        var _functionConstructor = JSApi.JS_GetProperty(_ctx, _globalObject, JSApi.JS_ATOM_Function);
    }

    // Update is called once per frame
    void Update()
    {
        
    }
}

And it failed on WebGL built. project files are provided in this project:

https://github.com/jo32/jsb-unity-test

image

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants