godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.6k stars 21.28k forks source link

Interacting with browser from web-exported game results in `Aborted(to do setValue(i64) use WASM_BIGINT)` [regression between Emscripten 3.1.39 and 3.1.53] #88249

Closed DusanFedorcak closed 9 months ago

DusanFedorcak commented 9 months ago

Tested versions

System information

MacOS Ventura 13.5.2 (22G91), Chrome 121.0.6167.160 (arm64)

Issue description

Almost any interaction with browser from a running web-exported game results in Aborted(to do setValue(i64) use WASM_BIGINT) e.g.

Steps to reproduce

extends Node2D

var _document = JavaScriptBridge.get_interface('document')
var _window = JavaScriptBridge.get_interface('window')
var _console = JavaScriptBridge.get_interface('console')

# Called when the node enters the scene tree for the first time.
func _ready():
    _add_js_function()

func _add_js_function():
    _console.log("HELLO FROM GODOT!")   
    var script_txt = "function testFunction() { console.log('Hello from test function!') }"
    # Create the block - here it raises the error
    var script_block = _document.createElement('script')
    script_block.id = 'testFunction'
    var text_block = _document.createTextNode(script_txt)
    script_block.appendChild(text_block)
    _document.head.appendChild(script_block)
    _console.log("FINISH!")

Minimal reproduction project (MRP)

web3_test_dev4.3.zip

Production edit: added the gdscript syntax highlighting

mfmoreno commented 9 months ago

Works fine with 4.3dev2. It seems this issue was introduced on 4.3dev3

TechnoLukas commented 9 months ago

Confirm. Having same issue on 4.3dev3.

akien-mga commented 9 months ago

For 4.3-dev3 we updated Emscripten from 3.1.39 to 3.1.53. The error is likely caused by this.

akien-mga commented 9 months ago

I bisected Emscripten versions, the issue was introduced in 3.1.41: https://github.com/emscripten-core/emscripten/blob/main/ChangeLog.md#3141---060623

    A new setting (CHECK_NULL_WRITES) was added to disabled the checking of address zero that is normally done when STACK_OVERFLOW_CHECK is enabled. (#19487)
    compiler-rt updated to LLVM 16. (#19506)
    libcxx and libcxxabi updated to LLVM 16. (#)