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

Typed-functions breaks mathjs for iOS 9.3 #1062

Closed
jean-emmanuel opened this Issue Mar 14, 2018 · 6 comments

Comments

Projects
None yet
4 participants
@jean-emmanuel
Contributor

jean-emmanuel commented Mar 14, 2018

https://github.com/josdejong/typed-function/blob/master/typed-function.js#L1096
This throws TypeError: Attempting to change value of a readonly property. thus preventing mathjs to load.
Tested with iOS 9.3 (can be reproduced with desktop safari 9.1).

@harrysarson

This comment has been minimized.

Collaborator

harrysarson commented Mar 14, 2018

I think the 'name' property of a function is configurable (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/name) and so we can delete it first and then reassign it a value to work around this.

I don't think this will work on older browsers though. Is the name of a function used apart from as a debugging tool? If not then this entire line could be surrounded by a try-catch so that typed-function can still work when this breaks.

@jean-emmanuel

This comment has been minimized.

Contributor

jean-emmanuel commented Mar 14, 2018

I don't think this will work on older browsers though.

I confirm, just tested that on safari 9.1 :
screenshot-2018-03-14-15 15 49

@josdejong josdejong added the bug label Mar 14, 2018

@josdejong

This comment has been minimized.

Owner

josdejong commented Mar 14, 2018

Thanks for reporting this issue!

It should be easy to make a fallback for older browsers and browser that don't allow replacing a function name, will look into it within a few days.

@blackdynamo

This comment has been minimized.

blackdynamo commented Mar 14, 2018

I am also seeing this on older android versions. Threw me for a loop cause didn't have a clue where the error was coming and it's just including the mathjs@4.0.0 release.

josdejong added a commit to josdejong/typed-function that referenced this issue Mar 17, 2018

Fixed typed-function not working on browsers that don't allow
  setting the `name` property of a function (see josdejong/mathjs#1062)

@josdejong josdejong closed this in 4ce942e Mar 17, 2018

@josdejong

This comment has been minimized.

Owner

josdejong commented Mar 17, 2018

This should be fixed now in v4.0.1

@jean-emmanuel

This comment has been minimized.

Contributor

jean-emmanuel commented Mar 18, 2018

Thanks a lot !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment