swiftwasm / JavaScriptKit

Swift framework to interact with JavaScript through WebAssembly.
https://swiftpackageindex.com/swiftwasm/JavaScriptKit/main/documentation/javascriptkit
MIT License
693 stars 45 forks source link

Improve JSKit diagnostics for use-after-free of JSClosure #195

Closed kateinoigakukun closed 2 years ago

kateinoigakukun commented 2 years ago

The current JSKit’s diagnostics for use-after-free of JSClosure is unclear for developers to find which JSClosure is used. To mitigate the debugging difficulties, JSKit should provide more information in diagnostics for use-after-free of JSClosure

Before

The function was already released Unreachable code should not be executed

After

Error: The JSClosure was already released by Swift side. The closure is created at PrimaryTests/main.swift:247

github-actions[bot] commented 2 years ago

Time Change: +217ms (1%)

Total Time: 17,357ms

View Unchanged | Test name | Duration | Change | | :--- | :---: | :---: | | Serialization/Write JavaScript number directly | 387ms | -7ms (1%) | | Serialization/Write JavaScript string directly | 429ms | +0ms | | Serialization/Swift Int to JavaScript | 5,428ms | +19ms (0%) | | Serialization/Swift String to JavaScript | 5,591ms | +56ms (0%) | | Object heap/Increment and decrement RC | 5,522ms | +150ms (2%) |