Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 481427

Summary: [IE] SCRIPT1028 error in IE9
Product: [ECD] Orion Reporter: Anton Kosyakov <anton>
Component: EditorAssignee: Carolyn MacLeod <Carolyn_MacLeod>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: Carolyn_MacLeod, libingw, Silenio_Quarti
Version: 10.0   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X   
See Also: https://git.eclipse.org/r/59684
https://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=0f275e31561bb2fb5af373d04f62850220731e81
Whiteboard:

Description Anton Kosyakov CLA 2015-11-04 11:05:15 EST
I am getting SCRIPT1028 error in IE9 in built-codeEdit-amd.js at 5560:2.

It seems to happen because of unnecessary commas, e.g:
return {
    handleKeyEvent: handleKeyEvent,
    CommandsProxy: CommandsProxy, // comma in this line
};
Comment 1 Carolyn MacLeod CLA 2015-11-04 12:03:56 EST
The spec says "An object is rendered as an opening left brace followed by zero or more properties, separated with commas, closed with a right brace.".
I guess IE9 interpreted it literally, and was less forgiving.
Comment 2 Anton Kosyakov CLA 2015-11-04 12:06:49 EST
(In reply to Carolyn MacLeod from comment #1)
> The spec says "An object is rendered as an opening left brace followed by
> zero or more properties, separated with commas, closed with a right brace.".
> I guess IE9 interpreted it literally, and was less forgiving.

So removing a trailing comma will allow to use Orion with IE9, is not it? Could you do it?
Comment 3 Eclipse Genie CLA 2015-11-04 12:44:11 EST
New Gerrit change created: https://git.eclipse.org/r/59684
Comment 4 Carolyn MacLeod CLA 2015-11-04 13:00:08 EST
Yep - done. Just needs a committer to review.
Comment 5 Anton Kosyakov CLA 2015-11-04 13:01:14 EST
(In reply to Carolyn MacLeod from comment #4)
> Yep - done. Just needs a committer to review.

Are you sure that you don't have other such places in the code? It was just an example.
Comment 6 Carolyn MacLeod CLA 2015-11-04 13:25:29 EST
I looked for other similar cases (looked at the 32 other files that return module exports objects), and did not find any.

If you trip over another case (because IE9 gives you another script error), please open a new bug. Thanks!
Comment 7 Carolyn MacLeod CLA 2015-11-04 13:34:53 EST
Correction - I did a regular expression search (,\s}) and found one more place that had a trailing comma in an object. I added a fix for that. Hope I did the "ammend previous commit" correctly...
Comment 8 Anton Kosyakov CLA 2015-11-04 15:32:57 EST
(In reply to Carolyn MacLeod from comment #6)
> I looked for other similar cases (looked at the 32 other files that return
> module exports objects), and did not find any.
> 
> If you trip over another case (because IE9 gives you another script error),
> please open a new bug. Thanks!

Which versions of IE Orion support reliably? Against which versions did you really test it? We need to use Orion in a customer project with IE9 - 11.
Comment 9 Carolyn MacLeod CLA 2015-11-04 19:13:57 EST
SSQ, please see comment 8.
Comment 10 Anton Kosyakov CLA 2015-11-06 09:23:09 EST
(In reply to Carolyn MacLeod from comment #7)
> Correction - I did a regular expression search (,\s}) and found one more
> place that had a trailing comma in an object. I added a fix for that. Hope I
> did the "ammend previous commit" correctly...

There are a lot of other places with trailing commas in addition to fixed in the change.

I played with different compatibility modes for IE9 and found out that in IE9-Standard mode trailing commas are allowed. To switch on this mode one should add <!DOCTYPE html> at the beginning of a document or <meta http-equiv="X-UA-Compatible" content="IE=edge">.
Comment 12 Carolyn MacLeod CLA 2015-11-06 15:09:19 EST
(In reply to Anton Kosyakov from comment #8)
> Which versions of IE Orion support reliably? Against which versions did you
> really test it? We need to use Orion in a customer project with IE9 - 11.

I'm afraid we only support IE11.
Just so you know, Microsoft announced end of life on 12 January 2016 for versions of IE prior to IE11.

I removed trailing commas from object declarations because it was harmless and simple.

I guess you've now found trailing commas in array declarations. I can fix those too, but as for anything else, we are no longer supporting IE9.

To find out the browser versions that Orion supports, you can check the browserData minVersion in file org.eclipse.orion.client.ui/web/orion/browserCompatibility.js
Comment 13 Carolyn MacLeod CLA 2015-11-06 15:34:14 EST
Anton, in case it's useful, here's a link to the official project plan for Orion 10.0, which lists the supported browsers.
https://projects.eclipse.org/projects/ecd.orion/releases/10.0/plan
Comment 14 Carolyn MacLeod CLA 2015-11-08 14:58:06 EST
(In reply to Anton Kosyakov from comment #10)
> There are a lot of other places with trailing commas in addition to fixed in the change.

I regex-searched for ,\s] and it only shows up in a test file. I don't want to change those, because they may be there intentionally for testing, and they are not affecting the product.

So I was wrong - there really aren't any trailing commas in arrays.
What are the "other places" that you mention?
Comment 15 Carolyn MacLeod CLA 2015-11-11 10:13:58 EST
(In reply to Anton Kosyakov from comment #10)
> I played with different compatibility modes for IE9 and found out that in
> IE9-Standard mode trailing commas are allowed. To switch on this mode one
> should add <!DOCTYPE html> at the beginning of a document or 
> <meta http-equiv="X-UA-Compatible" content="IE=edge">.

Orion distributes a JS library for `built-codeEdit` but not an HTML page.
So we have nowhere to put the meta tag even if we wanted to.
The code that is embedding the component would have to do this.

I am going to mark this bug as "fixed" because the original problem in comment 0 has been fixed (plus one more place in comment 7). If you have another specific place that causes an error, please open a new bug.
Comment 16 Anton Kosyakov CLA 2015-11-11 10:21:56 EST
(In reply to Carolyn MacLeod from comment #15)
> (In reply to Anton Kosyakov from comment #10)
> > I played with different compatibility modes for IE9 and found out that in
> > IE9-Standard mode trailing commas are allowed. To switch on this mode one
> > should add <!DOCTYPE html> at the beginning of a document or 
> > <meta http-equiv="X-UA-Compatible" content="IE=edge">.
> 
> Orion distributes a JS library for `built-codeEdit` but not an HTML page.
> So we have nowhere to put the meta tag even if we wanted to.
> The code that is embedding the component would have to do this.
> 

Sure the tag should be added to client html code.

> I am going to mark this bug as "fixed" because the original problem in
> comment 0 has been fixed (plus one more place in comment 7). If you have
> another specific place that causes an error, please open a new bug.

It is fine with me, with general lack of support for IE9 this bug does not make much sense.