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

Error with Object.Freeze() in IE 11 #2318

Closed
christopherpickering opened this issue Dec 11, 2019 · 11 comments · Fixed by #2319
Closed

Error with Object.Freeze() in IE 11 #2318

christopherpickering opened this issue Dec 11, 2019 · 11 comments · Fixed by #2319

Comments

@christopherpickering
Copy link

Hi, Thanks for the plugin!

When my site is run in IE 11 there is an error with the "object.freeze()". Do you know a workaround I can put in? Thanks!
image

@joshgoebel
Copy link
Member

joshgoebel commented Dec 11, 2019

If I float a fix are you capable of building a new distributable locally to test?

I’m guessing this is the issue:

salesforce/akita@8a63065
brandonroberts/ngrx-store-freeze#7

Technically we don’t support IE11 any more but my intention was to try and not break it until 10.0 (which is likely the next release) and then officially end support.

@christopherpickering
Copy link
Author

christopherpickering commented Dec 11, 2019 via email

@joshgoebel
Copy link
Member

Build a new version against #2319 and test please.

@christopherpickering
Copy link
Author

Thanks, I built and tested, but still get the same error. I think the function Object.freeze(o); just doesn't exist in IE 11.

image

If this section of the code is removed it still works well (not sure what else is affected!) but in my app its cool.. maybe performance is slightly affected? I'm using highlight.js for a handful of sql code blocks.

If you have another idea I'd appreciate it! - otherwise I can use the code w/ this block commented out. (lines 1130 - 1151 in src/highlight.js)

image

@joshgoebel
Copy link
Member

joshgoebel commented Dec 12, 2019

Freeze exists. The error is telling you that much.

Could you add some logging and console.log both the object and property right before freeze is called and let me know which item or property it’s blowing up on?

Commenting it out will probably work as a quick fix. This code prevents language plugins from corrupting the parser itself by modifying the shared regexes - which it turns out our own languages were doing in the past (by accident).

@christopherpickering
Copy link
Author

Good point 👍

Yes - here's a few few pics. It seems to be because the first object is a string, not an "object" -

image

image

To test out, I changed the order of the object array to put one of the "objects" first to see if the function would successfully complete. It fails in my console.log at the freeze check with the object error, but should not hit this at runtime because the first conditions are true.

image

Here is rerun with the console.log removed from that section:
Now it works until it gets to a string in the array.

image

What do you think?

@christopherpickering
Copy link
Author

btw, I apologize for using ie 11 😭 my personal feeling is that IE does not qualify as a browser 😄

@joshgoebel
Copy link
Member

joshgoebel commented Dec 12, 2019

In ES5, if the argument to this method is not an object (a primitive), then it will cause a TypeError. In ES2015, a non-object argument will be treated as if it were a frozen ordinary object, and be simply returned.

Ah. Can you try the PR again? I modified it so we don't try to freeze any of the strings now.

@joshgoebel
Copy link
Member

btw, I apologize for using ie 11

No problem. I appreciate your reporting this. My intention was always for 9.x to be a stable release series that people could continue to use for a while if they needed support for IE11 and older browsers while 10.0 moves on to newer things. So I'd def like to see this fixed if we can. :)

But we don't actively test new changes in IE11.

@christopherpickering
Copy link
Author

Thanks, that works very well. I appreciate it!

@joshgoebel
Copy link
Member

Releasing 9.17.1 with the fix.

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

Successfully merging a pull request may close this issue.

2 participants