Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(client-utils): only call
fetch
as a function, not a method (#10671
) closes: #XXXX refs: endojs/endo#31 (comment) ## Description Testing on Brave, the browser's global `fetch` function works when called with its `this` bound to either `undefined` or the browser global object, but does not work if its `this` is bound to something else. The code this PR fixes was misbehaving because it was calling `powers.fetch(...)`, i.e., happening to call it as a method with its `this` bound to the irrelevant `powers` object. This refactor just expresses the intention of this code, which is just to call the `fetch` function without passing it some object as its `this` binding. This seems to fix the problem. Not at all addressed by this PR: The fact that this problem happened from a programming patterns that seems correct and would have passed review indicates a deeper hazard. This PR does nothing to mitigate this deeper hazard. It only fixes this case where we fell into the hazard. ### Security Considerations none ### Scaling Considerations none ### Documentation Considerations none, except as needed to address the more general hazard. ### Testing Considerations Only tested `fetch` behavior on Brave. Based on that, proceeding under untested assumption that this refactor will work on all supported browsers. ### Upgrade Considerations none
- Loading branch information