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

Bug 362674

Summary: Can't open editors in I20111102-0922
Product: [ECD] Orion Reporter: John Arthorne <john.arthorne>
Component: ClientAssignee: Silenio Quarti <Silenio_Quarti>
Status: RESOLVED FIXED QA Contact:
Severity: blocker    
Priority: P3 CC: eclipse.felipe, mamacdon, Silenio_Quarti
Version: 0.3   
Target Milestone: 0.4 M1   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description John Arthorne CLA 2011-11-02 09:50:58 EDT
I still can't open a JavaScript editor in this build:

On Chrome I get:

Uncaught Error: Mismatched anonymous require.def modules
built-edit.js:380Uncaught Error: declare dijit.TooltipDialog: mixin #0 is unknown. Did you use dojo.require to pull it in?

On Firefox 7.0.1 I get:

declare dijit.TooltipDialog: mixin #0 is unknown. Did you use dojo.require to pull it in?
[Break On This Error] define("dijit/_base/wai",["dojo","diji...)?"addClass":"removeClass"](b.body(),
Comment 1 Mark Macdonald CLA 2011-11-02 13:38:09 EDT
This is a build problem. The requirejs build has an optimization step where it statically rewrites anonymous module definitions into named ones and resolves their dependencies. This magic only works for simple cases: it literally just walks the AST looking for a call to "define" or "require". It can't deal with the "(define || defineGlobal(..))(deps, callback)" pattern used by the editor code.

The result is that every editor file gets dumped into built-js as an anonymous module, and that causes the runtime error (requirejs does not allow more than 1 anonymous module in a file).
Comment 2 Felipe Heidrich CLA 2011-11-02 14:23:57 EDT
can this be fixed in the build ?
Comment 3 Mark Macdonald CLA 2011-11-02 17:44:02 EDT
(In reply to comment #2)
> can this be fixed in the build ?

Not really... the code that does this comes from RequireJS. I think we have to play well with whatever they're doing.
Comment 4 Silenio Quarti CLA 2011-11-02 21:17:21 EDT
I pushed a possible fix to a new branch. This fix declares the function define if it is not declared yet. The new function has the same signature of the requireJS define function with an extra paramater at the "end" for the moduleName. Would this fix the build?

http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/log/?h=bug362674
Comment 5 Felipe Heidrich CLA 2011-11-03 09:37:25 EDT
(In reply to comment #4)
> I pushed a possible fix to a new branch. This fix declares the function define
> if it is not declared yet. The new function has the same signature of the
> requireJS define function with an extra paramater at the "end" for the
> moduleName. Would this fix the build?
> 
> http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/log/?h=bug362674

I hope this work, IMO this solution is the cleanest solution for the non-requirejs case.
+1
Comment 6 Mark Macdonald CLA 2011-11-03 09:59:16 EDT
(In reply to comment #4)
> I pushed a possible fix to a new branch. This fix declares the function define
> if it is not declared yet. The new function has the same signature of the
> requireJS define function with an extra paramater at the "end" for the
> moduleName. Would this fix the build?
> 
> http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/log/?h=bug362674

It looks like requireJS will tolerate the extra parameter, so I think this will work.
+1 also
Comment 7 John Arthorne CLA 2011-11-03 10:55:26 EDT
The change we made last night fixed the problem. If you guys prefer Silenio's new style feel free to push those changes to master and I will run another build.
Comment 8 John Arthorne CLA 2011-11-03 11:07:48 EDT
And reviewing the changes, I like Silenio's pattern too.
Comment 9 Felipe Heidrich CLA 2011-11-03 11:29:38 EDT
I pushed the code to master
http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=f649e26807181eb10d4f0204e75c73e6b75c8867

please try a build.
Comment 10 John Arthorne CLA 2011-11-03 15:22:06 EDT
(In reply to comment #9)
> I pushed the code to master
> http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=f649e26807181eb10d4f0204e75c73e6b75c8867
> 
> please try a build.

I started build I20111103-1522.