Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FBDCursor broken in release/minimised build #65

Closed
radicalapps opened this issue Jun 19, 2021 · 1 comment
Closed

FBDCursor broken in release/minimised build #65

radicalapps opened this issue Jun 19, 2021 · 1 comment

Comments

@radicalapps
Copy link

When build in release-optimised mode, the FDB Cursor no longer works, due to erroneous runtime type-checking.

The outcome is that a null or undefined value is returned from any Cursor Read operation. No exception is thrown, so it's difficult to debug. Everything works just fine in a normal development environment. To replicate the issue something like the Webpack Terser plugin must be used to optimise the javascript output.

Summary: code similar to the following occurs 3 times in FDBCursor.cs. In an optimised build, the name of the constructor will be different, causing these conditions to never be fulfilled.

if ( !this._keyOnly && this.constructor.name === "FDBCursorWithValue" ) {
Resolution: Since both FDBCursor and the derived class FDBCursorWithValue already implement a toString() function, a quick fix is as follows:

if ( !this._keyOnly && this.toString() === "[object IDBCursorWithValue]" ) {

@dumbmatter
Copy link
Owner

Thanks! Probably not a lot of people are minifying it, but your suggested fix sounds reasonable and all the tests still pass, so I just put it in v3.1.3.

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

No branches or pull requests

2 participants