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

When running on IE11, the browser screen becomes inoperable. #64

Open
rnanba opened this issue Nov 16, 2019 · 0 comments
Open

When running on IE11, the browser screen becomes inoperable. #64

rnanba opened this issue Nov 16, 2019 · 0 comments

Comments

@rnanba
Copy link
Contributor

rnanba commented Nov 16, 2019

Browsing http://slowe.github.io/VirtualSky/ or https://slowe.github.io/VirtualSky/custom with Internet Explorer 11 hungs up the browser screen.

When I checked whith the vevelopment tool, loading of the language file en.json was repeated infinitely.

The cause of this problem is that following line in stuquery.js causes an error on IE11.

if(typeof rsp==="string") rsp = JSON.parse(rsp.replace(/[\n\r]/g,"\\n").replace(/^([^\(]+)\((.*)\)([^\)]*)$/,function(e,a,b,c){ return (a==cb) ? b:''; }).replace(/\\n/g,"\n"));

Replacing this line with if(typeof rsp==="string") rsp = JSON.parse(rsp); makes work fine.

replace(/^([^\(]+)\((.*)\)([^\)]*)$/,function(e,a,b,c){ return (a==cb) ? b:''; }) does not work as intended if the string value in JSON contains parentheses and return a broken JSON string, so JSON.parse() fails.

As a result, data is passed as a string value to the loadJSON()'s handler in loadLanguage() of virtualsky.js, so the following assignment opreration fails.

this.langs[l].loaded = true;

As a result, this.langs[code].loaded in the following line becomes undefined, loadLanguage() is called again, and the same language file is loaded infinitely.

if(!this.langs[code].loaded) this.loadLanguage(code,fn);

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

1 participant