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

Bug 484559

Summary: Code Edit widget: Latest build(I20151216-2218) is broken on javascript plugin.
Product: [ECD] Orion Reporter: libing wang <libingw>
Component: ClientAssignee: Curtis Windatt <curtis.windatt.public>
Status: RESOLVED FIXED QA Contact:
Severity: critical    
Priority: P2 CC: curtis.windatt.public, Michael_Rennie, pwebster, steve_northover
Version: 11.0   
Target Milestone: 11.0   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Workaround fix for JS plugin none

Description libing wang CLA 2015-12-17 07:33:54 EST
I've run my demo page with the latest widget build and got the following error during the page startup.

Uncaught TypeError: Cannot read property 'request' of undefined
In javascriptplugin.js:


        P.prototype.postMessage = function(e, t) {
            var n = "start_server" === e.request;
Comment 1 libing wang CLA 2015-12-17 07:35:05 EST
My gut feeling is that the recent js tooling improvements introduced this.
Comment 2 libing wang CLA 2015-12-17 08:45:08 EST
It is also reproducible in the non build version of the widget demo page:
http://yourseldHostName..orion.eclipse.org:9000/embeddedEditor/demo/demoCodeEdit.html
Comment 3 Curtis Windatt CLA 2015-12-17 10:23:09 EST
Created attachment 258765 [details]
Workaround fix for JS plugin
Comment 4 Curtis Windatt CLA 2015-12-17 10:33:00 EST
http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=493a137b12949418a7939b1f7a35e7cdf839ebf9
Pushed my change

There are two operations happening at startup
1) TernProjectManager listens for an inputChangedEvent
2) The JS web worker finishes starting and starts the Tern server

In Orion, (1) happens first which sets pending options for the server (2)
In CodeEdit (1) never happens, when (2) happens, there are no pending options and the postMessage chokes.

This fix works by posting default options for the server (2) if no custom options (1) has been run.

If for whatever reason the timings are reversed (2) happens before (1), the server will start up with default options, then restart with the custom options.  This is what we were doing by default last month and is a relatively minor performance hit.
Comment 5 libing wang CLA 2015-12-17 10:58:46 EST
Pulled the latest code and tested the non build version of the demo page, the issue has been fixed.
Waiting for the build and will test the built version of the demo.
Comment 6 libing wang CLA 2015-12-17 11:43:15 EST
Verified with the latest build(I20151217-1108). The issue is fixed.