microsoft / microsoft/reflect-metadata

Cross-browser error

Open
#85 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
3.4k
Forks
190
Avg merge
13h 52m
Merged PRs (30d)
1

Description

In 0.1.5, the function GenRandomBytes was changed - instead of writing an array into a variable, passing it as a parameter to crypto.getRandomValues and then returning that variable, it now returns the return value of crypto.getRandomValues directly.
According to the TS lib declaration file, this is correct - but I have found that on certain older browsers (such as the Android browser) crypto.getRandomValues returns no value and only mutates the parameter. Since version 0.1.5, this library therefore causes a TypeError on these browsers.
I would like to request the change to GenRandomBytes be reverted in the interest of cross-browser compatibility.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the GenRandomBytes change linked in the issue and compare its handling of crypto.getRandomValues with the behavior described for older Android browsers. Restore behavior that works when the browser mutates the parameter without returning a value, then verify that the TypeError no longer occurs in the affected browsers.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
web-dev
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.