Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 364194 - Cannot debug RUI - getting "Cannot read property 'fileName' of undefined" error
Summary: Cannot debug RUI - getting "Cannot read property 'fileName' of undefined" error
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: EDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P1 major (vote)
Target Milestone: ---   Edit
Assignee: Yun Feng Ma CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-18 14:52 EST by Will Smythe CLA
Modified: 2017-02-23 14:17 EST (History)
6 users (show)

See Also:


Attachments
See client.MainSnippetsView. There is no need to have a database, you'll see the error before the handler loads. (147.87 KB, application/x-zip-compressed)
2011-11-18 14:52 EST, Will Smythe CLA
no flags Details
Patch (1.67 KB, patch)
2011-11-22 03:57 EST, Yun Feng Ma CLA
lasher: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Will Smythe CLA 2011-11-18 14:52:09 EST
Created attachment 207245 [details]
See client.MainSnippetsView. There is no need to have a database, you'll see the error before the handler loads.

I have a fairly simple handler (client.MainSnippetsView) that I cannot debug. Launching this via Debug As > EGL RUI Application causes a new browser to open, but the following error is displayed:

Could not render UI
TypeError: Cannot read property 'fileName' of undefined at Function.atLine (egl_development.js:825:19) at [object Object].eze$$setEmpty (MainSnippetsView.js?contextKey=17:42:8) at [object Object].eze$$setInitial (MainSnippetsView.js?contextKey=17:52:10) at new (MainSnippetsView.js?contextKey=17:24:9) at [object Object].eze$$thisClass (edt_runtime_all.js:801:27) at MainSnippetsView.html?contextKey=17:82:21 at Function.eze$$loadScripts (MainSnippetsView.html?contextKey=17:54:3) at MainSnippetsView.html?contextKey=17:52:43 at HTMLScriptElement. (MainSnippetsView.html?contextKey=17:40:4)

Cannot read property 'fileName' of undefined
[CRRUI2095E] Could not find the EGL function calls leading to this error

Uncaught TypeError: Cannot read property 'fileName' of undefined
snippets/client/MainSnippetsView.html?contextKey=17:100
[CRRUI2095E] Could not find the EGL function calls leading to this error
Comment 1 Will Smythe CLA 2011-11-18 15:58:46 EST
Using a different machine and Firefox as my default external browser, this same handler doesn't come up when launching into Debug mode and a different error message is displayed:

Could not render UI

      ("client/MainSnippetsView.egl",63,2831,41,[object Object])
      egl_development.js:827 ()
      MainSnippetsView.js?contextKey=16:42 ()
      MainSnippetsView.js?contextKey=16:52 ()
      MainSnippetsView.js?contextKey=16:24 ()
      edt_runtime_all.js:801 ()
      MainSnippetsView.html?contextKey=16:82 ([object Array],(function () {egl.localeInfo = {locale: "en_US", nlsCode: "ENU", shortMask: "MM/dd/yyyy", mediumMask: "MM-dd-yyyy", longMask: "MM-dd-yyyy", currencySymbol: "$", decimalSeparator: ".", groupingSeparator: ","};try {egl.startHandleIDEEvent();egl.rootHandler = new (egl.client.MainSnippetsView);if (egl.rootHandler.targetWidget || !egl.rootHandler.egl$isWidget) {egl.rootHandler.setParent(egl.Document);} else {var package = egl.rootHandler.eze$$package;var typename = egl.rootHandler.eze$$typename;egl.rootHandler = egl.Document;egl.rootHandler.eze$$package = package;egl.rootHandler.eze$$typename = typename;}egl.startup();} catch (e) {if (e instanceof egl.egl.debug.DebugTermination) {if (e.msg) {egl.println(e.msg);}} else {egl.crashTerminateSession();if (!egl.client.MainSnippetsView) {egl.println("Internal generation error. Found no definition for client.MainSnippetsView. Try Project > Clean...", e);} else {egl.printError("Could not render UI", e);throw e;}}}}))
      MainSnippetsView.html?contextKey=16:54 ()
      MainSnippetsView.html?contextKey=16:52 ([object Event])
      MainSnippetsView.html?contextKey=16:40 


bottomStack is undefined
[CRRUI2095E] Could not find the EGL function calls leading to this error

    DojoButton.setData() at line 827
bottomStack is undefined
snippets/runtime/egl_development.js:827
[CRRUI2095E] Could not find the EGL function calls leading to this error
Comment 2 Will Smythe CLA 2011-11-18 16:00:55 EST
Here is the message I get when trying to launch in IE 8 (note that this is similar to the message I get in Chrome, which was the first browser I tried):

Could not render UI
'fileName' is null or not an object
[CRRUI2095E] Could not find the EGL function calls leading to this error

'fileName' is null or not an object
snippets/runtime/egl_development.js:827
[CRRUI2095E] Could not find the EGL function calls leading to this error
Comment 3 Justin Spadea CLA 2011-11-21 17:03:27 EST
What's happening is the file StringHelper.js is not being found, so an error is returned to the browser. This causes egl.printError() to be invoked, and that method is trashing the debug stack. I will open a separate defect for the debug stack being reset in this method, we're not sure what we would break by changing it to not reset the stack when in debug mode, and don't want to change that for 0.7.0.

I'm reassigning this to IDE UI since the root problem is that StringHelper.js is not being found (even though everything in the EGL project looks correct). If this gets fixed then debug's stack will no longer be reset. In XULRunner I see:

[CRRUI2091E] Cannot send event to the Eclipse IDE: ___loadScript?fileName=snippets/client/formatter/StringHelper.js

Notice how it says the wrong package - the file is util/StringHelper.js. You can reproduce this error by opening in an external Firefox but delete the contextKey parameter from the URL (so that it uses the generated files and not the VE's live copy. If I don't delete the contextKey parameter then I'm not seeing the error.
Comment 4 Huo Zhen Zhong CLA 2011-11-22 00:41:40 EST
This is because the StringHelper.egl and StringHelper.js are in different path structure, JS Gen did not generate the right path to request EV Server (it use the path of StringHelper.egl instead of StringHelper.js). RBD has the same problem. Change the owner to Yun Feng.
Comment 5 Yun Feng Ma CLA 2011-11-22 03:57:21 EST
Created attachment 207348 [details]
Patch

The root cause is that __loadscript is using the external egl part's package nake as the path, but the real js file is located in the path specified in relativePath.

Here is a patch, which will load the file using the relativePath, instead of the package name.

I've tested RUI Samples and DojoSamples, and tested VE with Dojo widgets. Thanks a lot.
Comment 6 Tony Chen CLA 2011-11-22 07:52:24 EST
Yufeng, will __loadscript ever be used to load anything in debug mode (and in "run as RUI application" mode)? It seems that if the path is correct, __loadscript just won't do anything. I'm good with the fix, but maybe we should revisit this'dynamic load' for development environment solution after 0.7. 


(In reply to comment #5)
> Created attachment 207348 [details]
> Patch
> 
> The root cause is that __loadscript is using the external egl part's package
> nake as the path, but the real js file is located in the path specified in
> relativePath.
> 
> Here is a patch, which will load the file using the relativePath, instead of
> the package name.
> 
> I've tested RUI Samples and DojoSamples, and tested VE with Dojo widgets.
> Thanks a lot.
Comment 7 Yun Feng Ma CLA 2011-11-22 09:32:16 EST
The patch has some issues: JSGen always uses the "relativePath" and "externalName" as the package name and part name.
For below ET:
package client.formatter;

import eglx.javascript.JavaScriptObject;

ExternalType StringHelper type JavaScriptObject{
		relativePath = "utils",
        externalName = "StringHelper1"
        }

    function concat(array String[] in) returns(String);   
    function strlen(s String in) returns(int);    

end
and define a variable in another part: helper StringHelper{};
The genreated code is: this.helper = new egl.utils.StringHelper1();
So the patch should not use the part package name and part name if the relativePath and externalName are null.

Defer this bug, a workaround is that using the package name as the folder name for external js file. Thanks.
Comment 8 Will Smythe CLA 2011-11-22 09:35:14 EST
I updated the external type to make the relativePath match the path of my part (i.e. "client/formatter"), then moved the .js into this directory under webcontent, and I can now debug.

I don't think this has to be fixed in 0.7, considering the potential risk and the low odds of someone else running into it immediately.
Comment 9 Yun Feng Ma CLA 2011-12-14 00:40:36 EST
Fixed. Using "relativePath" and "externalName" as the js path in loadScript.