Skip to content
This repository was archived by the owner on Aug 2, 2022. It is now read-only.

Replace the use of "Proxy" in ripemd.js to make eosjs compatible to IE11#411

Merged
c0d3ster merged 1 commit intoEOSIO:masterfrom
terrylks:ripemd160-remove-proxy
Nov 1, 2018
Merged

Replace the use of "Proxy" in ripemd.js to make eosjs compatible to IE11#411
c0d3ster merged 1 commit intoEOSIO:masterfrom
terrylks:ripemd160-remove-proxy

Conversation

@terrylks
Copy link
Copy Markdown
Contributor

@tbfleming @chris-allnutt
Please refer this pull request to EOSIO/eosjs2#76
I am proposing the fix here since we have migrated eosjs2 to this repo.

Background:
While calculating the RIPEMD160 hash with ripemd.js in eosjs, Proxy is used during the calculation. Proxy is not supported in IE11 hence eosjs did not work in IE11.
https://github.com/EOSIO/eosjs/blob/master/src/ripemd.js#L382
https://github.com/EOSIO/eosjs/blob/master/src/ripemd.es5.js#L331

Fix:
Replace the way to access the DataView object with an anonymous function instead of a Proxy. Access it by calling the function directly.

Test:
I have put about 10 input cases for the fixed ripemd160 hash function and the result values are same as the original.
I have included the fix locally for the simple-boilerplate-dapp and the game Elemental Battles. After the fix, both dapps works fine in IE11 now and also works fine in other browsers.

Remark:
Although only ripemd.es5.js will be built to the /dist folder, I have done the fix on ripemd.js first and use babel to compile it into ripemd.es5.js. This pull request include fixes for both JS files.

cc @jeffreyssmith2nd @chris-allnutt @rickykung @andriantolie

…ion instead of a Proxy. Access it by calling the function directly.
@rickykung
Copy link
Copy Markdown
Contributor

@ChristianDunst

Copy link
Copy Markdown
Contributor

@c0d3ster c0d3ster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! We were discussing this the other day actually. It looks good to me, but I'd give @tbfleming a chance to look it over before merging

Copy link
Copy Markdown
Contributor

@tbfleming tbfleming left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passes abieos tests, which checks key conversions

@c0d3ster c0d3ster merged commit 941c92a into EOSIO:master Nov 1, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants