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

fast-render break Meteor v1.5 under IE11 bugfix #191

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

theosp
Copy link

@theosp theosp commented Jun 26, 2017

Note, since this repository is no longer maintained, the fix below and another fix to issue #12 were published in the package: meteorspark:fast-render .


In Meteor v1.5.0, unlike previous versions, Meteor._localStorage is a
direct reference to window.localStorage.

IE11 (earlier IE versions weren't checked) doesn't handle attempts to
replace methods of window.localStorage with different functions properly.
Such attempt will result in the String of the function we try to set
saved as the function, destroying the ability to use this function.

I couldn't find a way to tell in advance whether an attempt to set window.localStorage
will result in correct function write or not (I intentionally avoid browser
version detection, which is considered a bad practice). If such attempt will fail
we won't have a way to restore the original function.

Note 1, the situation is even worse than that. If for exapmle we'll try to set
window.localStorage.setItem = function () {} the String value 'function () {}'
will be saved instead of the function - not only for the current session, but
as part of the localStorage (!) meaning that we'll have to ask users affected by
this bug to clear the cache to fix the situation.

Note 2, the following won't work:

Meteor._localStorage = window.localStorage // Just to make example clear.
originalSetItem = Meteor._localStorage.setItem
Meteor._localStorage.setItem = function () {}
Meteor._localStorage.setItem = originalSetItem

typeof Meteor._localStorage.setItem -> string

I therefore decided to bring back the original pre-Meteor v1.5.0 code of
Meteor._localStorage below which isn't a reference to window.localStorage

theosp referenced this pull request in jamiter/meteor Jun 26, 2017
Although Meteor._localStorage has historically been used only in browsers,
it can be helpful on the server for writing isomorphic code.
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 this pull request may close these issues.

1 participant