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

getNativeStringProperties crashes on Firefox 26 #63

Closed
zliw opened this issue Jan 30, 2014 · 4 comments
Closed

getNativeStringProperties crashes on Firefox 26 #63

zliw opened this issue Jan 30, 2014 · 4 comments

Comments

@zliw
Copy link

zliw commented Jan 30, 2014

Hi,

I don't know yet, if this is triggered by a misconfiguration in my Schemas, but getNativeStringProperties (strings.js:582) crashes in my browser , as the try - catch - Block is probably not working as intended.

//...
      var func = __nsp[name];
      try {
        var type = typeof func.apply('teststring', []);
        retObj[name] = type;
      } catch (e) {}
//...

Apparently func can be undefined in this situation. As a safeguard i added an if - clause around it, which works for me. But I'm not really sure, if this is the correct approach, as I don't understand the module and the implications of this change (yet).

//...
      var func = __nsp[name];
      if (func) {
        try {
          var type = typeof func.apply('teststring', []);
          retObj[name] = type;
        } catch (e) {}
     }
//...
@aldeed
Copy link
Collaborator

aldeed commented Jan 30, 2014

That's an issue with string.js. There looks to be a backlog of open issues here. If this is not one of them, you should submit this issue on that repo.

I think that's used only for inflecting labels, so you should be able to work around this issue by explicitly defining a label for every schema field.

@aldeed aldeed closed this as completed Jan 30, 2014
@zliw
Copy link
Author

zliw commented Jan 30, 2014

Unfortunately defining labels will not circumvent the behavior, as the code in question is executed always, when including string.js.

By trial and error I found out, that Firebug is involved. Somehow it seems, I accidentally activated an option to break on exceptions (i can't even find it again). But fortunately resetting firebug options to defaults solves the issue.

Having looked at the code in question, I assume it tries to gather all native string functions by calling them once on a test string. If they raise any exception, the function is not copied to the new prototype being used as string replacement. I suppose this approach is a compromise to support the panopticon of browsers out there. I guess it wouldn't benefit anyone to start a discussion based on a seldomly used (and not intended) firebug configuration.

Sorry to have bothered you with this, but I didn't know string.js before and assumed it to be part of your project.

@aldeed
Copy link
Collaborator

aldeed commented Jan 30, 2014

No problem.

@darkship
Copy link

darkship commented Jun 5, 2014

I was going sick of this error...

For those who didn't find it, you will find infos at https://getfirebug.com/wiki/index.php/Break_On_...
(I had the "Break On All Errors" on)

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

3 participants