Closed TechWizEric closed 9 years ago
The issue seems to occur even after restarting the workbench, when activating the Tools window, but it did not occur before the initial deletion of the application's data folder.
Tested with RC2 on OSX 10.9 and the error did not reproduce.
The error can be reproduced by having an Evothings Client running that is connected to the Workbench:
When you have removed the existing data folder the Workbench crashes as soon as a client connects.
Works with the original data folder.
This turns out to be a problem caused to console being undefined when another window is open.
In context "global" console is undefined, it is defined in context "window". When another window is open it seems the code that crashes is using the context "global".
This commit fixes the problem:
https://github.com/divineprog/HyperReload/commit/9f84d15fff94c4fde8db949fe0c38f3c2beaeb5c
Tested build of ETS including the fixes in https://github.com/divineprog/HyperReload/commit/9f84d15fff94c4fde8db949fe0c38f3c2beaeb5c . The issue remains, and the following error is shown.
Uncaught node.js Error
TypeError: Cannot read property 'log' of undefined
at GetFileStatus (/Applications/EvothingsStudio_Mac_64_1.1.0 RC/hyper/server/webserver.js:369:10)
at ServeFile (/Applications/EvothingsStudio_Mac_64_1.1.0 RC/hyper/server/webserver.js:295:14)
at Server.HandleRequest (/Applications/EvothingsStudio_Mac_64_1.1.0 RC/hyper/server/webserver.js:289:3)
at Server.
That line reads console.log('GetFileStatus exception: ' + ex)
, so if you don't have a console, it would fail.
A thought: wouldn't it be better to ensure that console
is always defined?
Yes it would be best to ensure console is defined.
Current solution is to specify context by using window.console which we assume is always defined. But it would be better (more safe) I guess to do something like:
if (!window.console) { window.console = {} }
if (!window.console.log) { window.console.log = function(message){} }
This is the commit that updates the code to use window.console where it is needed: https://github.com/divineprog/HyperReload/commit/7f8580a52ac22c716a35eca428803d8f44bca3cd
ETS 1.0.0 through 1.1.0 RC2, but not e.g. v. 0.7.3, displays an Uncaught node.js Error in the Workbench window and freezes when a client connects while the Welcome- or Tools window is visible.
This has been observed in OS X 10.10.1 and Windows 8.0. This is believed to occur due to that the scope within which the scripts are run is changed and this must be handled either in node-webkit or by us.
The issue does not occur if a data folder (e.g. ~/Library/Application Support/Evothings Workbench) from an older version (<1.0.0) of Evothings Workbench is present.
Steps to reproduce:
Actual result: Workbench window shows "Uncaught node.js Error" (see screenshot below).
Expected result: Workbench launches correctly and displays projects list.