kaitai_struct_webide
kaitai_struct_webide copied to clipboard
Imports not working, no error displayed in IDE
Hi!
I'm loving the web IDE so far, but it seems imports aren't working.
If I copy the imports example from http://doc.kaitai.io/user_guide.html#_importing_types_from_other_files and open the filelist.ksy
file in the IDE, the object tree is not updated (it stays blank or open on the previous ksy file) but there are no errors visible in the IDE.
If I open the browser console, I can see these errors:
As text:
localforage.js:836 [performance/29.891] YAML parsing took 1 milliseconds.
localforage.js:836 import yaml: date, mode: rel
localforage.js:836 import yaml: date, mode: rel
localforage.js:836 GET https://ide.kaitai.io/formats/date.ksy 404 ()
send @ jquery-3.1.1.min.js:4
ajax @ jquery-3.1.1.min.js:4
get @ /js/app.files.js:55
(anonymous) @ /js/app.js:37
importYaml @ /js/app.js:35
$c_Lio_kaitai_struct_format_JavaScriptClassSpecs.doImport__T__T__s_concurrent_Future @ kaitai-struct-compiler-fastopt.js:68200
$c_Lio_kaitai_struct_precompile_LoadImports.io$kaitai$struct$precompile$LoadImports$$loadImport__T__sci_List__s_Option__s_concurrent_Future @ kaitai-struct-compiler-fastopt.js:7953
(anonymous) @ kaitai-struct-compiler-fastopt.js:7825
$c_Lio_kaitai_struct_precompile_LoadImports.processClass__Lio_kaitai_struct_format_ClassSpec__s_concurrent_Future @ kaitai-struct-compiler-fastopt.js:7838
$c_Lio_kaitai_struct_Main$.importAndPrecompile__Lio_kaitai_struct_format_ClassSpecs__Lio_kaitai_struct_RuntimeConfig__s_concurrent_Future @ kaitai-struct-compiler-fastopt.js:4719
$c_Lio_kaitai_struct_MainJs$.compile__T__sjs_js_Object__Lio_kaitai_struct_JavaScriptImporter__Z__sjs_js_Promise @ kaitai-struct-compiler-fastopt.js:4892
$c_Lio_kaitai_struct_MainJs$.$$js$exported$meth$compile__T__sjs_js_Object__Lio_kaitai_struct_JavaScriptImporter__Z__O @ kaitai-struct-compiler-fastopt.js:4821
$c_Lio_kaitai_struct_MainJs$.compile @ kaitai-struct-compiler-fastopt.js:4945
compile @ /js/app.js:100
copyPromise.then.then @ /js/app.js:127
Promise resolved (async)
copyPromise.then @ /js/app.js:126
Promise resolved (async)
localforage.getItem.then.ksyFsItem @ /js/app.js:123
Promise resolved (async)
req.onsuccess @ localforage.js:836
IndexedDB (async)
(anonymous) @ localforage.js:826
localforage.js:836 XHR finished loading: GET "https://ide.kaitai.io/formats/date.ksy".
send @ jquery-3.1.1.min.js:4
ajax @ jquery-3.1.1.min.js:4
get @ /js/app.files.js:55
(anonymous) @ /js/app.js:37
importYaml @ /js/app.js:35
$c_Lio_kaitai_struct_format_JavaScriptClassSpecs.doImport__T__T__s_concurrent_Future @ kaitai-struct-compiler-fastopt.js:68200
$c_Lio_kaitai_struct_precompile_LoadImports.io$kaitai$struct$precompile$LoadImports$$loadImport__T__sci_List__s_Option__s_concurrent_Future @ kaitai-struct-compiler-fastopt.js:7953
(anonymous) @ kaitai-struct-compiler-fastopt.js:7825
$c_Lio_kaitai_struct_precompile_LoadImports.processClass__Lio_kaitai_struct_format_ClassSpec__s_concurrent_Future @ kaitai-struct-compiler-fastopt.js:7838
$c_Lio_kaitai_struct_Main$.importAndPrecompile__Lio_kaitai_struct_format_ClassSpecs__Lio_kaitai_struct_RuntimeConfig__s_concurrent_Future @ kaitai-struct-compiler-fastopt.js:4719
$c_Lio_kaitai_struct_MainJs$.compile__T__sjs_js_Object__Lio_kaitai_struct_JavaScriptImporter__Z__sjs_js_Promise @ kaitai-struct-compiler-fastopt.js:4892
$c_Lio_kaitai_struct_MainJs$.$$js$exported$meth$compile__T__sjs_js_Object__Lio_kaitai_struct_JavaScriptImporter__Z__O @ kaitai-struct-compiler-fastopt.js:4821
$c_Lio_kaitai_struct_MainJs$.compile @ kaitai-struct-compiler-fastopt.js:4945
compile @ /js/app.js:100
copyPromise.then.then @ /js/app.js:127
Promise resolved (async)
copyPromise.then @ /js/app.js:126
Promise resolved (async)
localforage.getItem.then.ksyFsItem @ /js/app.js:123
Promise resolved (async)
req.onsuccess @ localforage.js:836
IndexedDB (async)
(anonymous) @ localforage.js:826
/#:1 Uncaught (in promise) Object {readyState: 4, getResponseHeader: function, getAllResponseHeaders: function, setRequestHeader: function, overrideMimeType: function…}
Promise rejected (async)
j @ jquery-3.1.1.min.js:2
k @ jquery-3.1.1.min.js:2
setTimeout (async)
(anonymous) @ jquery-3.1.1.min.js:2
i @ jquery-3.1.1.min.js:2
fireWith @ jquery-3.1.1.min.js:2
fire @ jquery-3.1.1.min.js:2
i @ jquery-3.1.1.min.js:2
fireWith @ jquery-3.1.1.min.js:2
A @ jquery-3.1.1.min.js:4
(anonymous) @ jquery-3.1.1.min.js:4
XMLHttpRequest.send (async)
send @ jquery-3.1.1.min.js:4
ajax @ jquery-3.1.1.min.js:4
get @ /js/app.files.js:55
(anonymous) @ /js/app.js:37
importYaml @ /js/app.js:35
$c_Lio_kaitai_struct_format_JavaScriptClassSpecs.doImport__T__T__s_concurrent_Future @ kaitai-struct-compiler-fastopt.js:68200
$c_Lio_kaitai_struct_precompile_LoadImports.io$kaitai$struct$precompile$LoadImports$$loadImport__T__sci_List__s_Option__s_concurrent_Future @ kaitai-struct-compiler-fastopt.js:7953
(anonymous) @ kaitai-struct-compiler-fastopt.js:7825
$c_Lio_kaitai_struct_precompile_LoadImports.processClass__Lio_kaitai_struct_format_ClassSpec__s_concurrent_Future @ kaitai-struct-compiler-fastopt.js:7838
$c_Lio_kaitai_struct_Main$.importAndPrecompile__Lio_kaitai_struct_format_ClassSpecs__Lio_kaitai_struct_RuntimeConfig__s_concurrent_Future @ kaitai-struct-compiler-fastopt.js:4719
$c_Lio_kaitai_struct_MainJs$.compile__T__sjs_js_Object__Lio_kaitai_struct_JavaScriptImporter__Z__sjs_js_Promise @ kaitai-struct-compiler-fastopt.js:4892
$c_Lio_kaitai_struct_MainJs$.$$js$exported$meth$compile__T__sjs_js_Object__Lio_kaitai_struct_JavaScriptImporter__Z__O @ kaitai-struct-compiler-fastopt.js:4821
$c_Lio_kaitai_struct_MainJs$.compile @ kaitai-struct-compiler-fastopt.js:4945
compile @ /js/app.js:100
copyPromise.then.then @ /js/app.js:127
Promise resolved (async)
copyPromise.then @ /js/app.js:126
Promise resolved (async)
localforage.getItem.then.ksyFsItem @ /js/app.js:123
Promise resolved (async)
req.onsuccess @ localforage.js:836
IndexedDB (async)
(anonymous) @ localforage.js:826
localforage.js:836 GET https://ide.kaitai.io/formats/date.ksy 404 ()
send @ jquery-3.1.1.min.js:4
ajax @ jquery-3.1.1.min.js:4
get @ /js/app.files.js:55
(anonymous) @ /js/app.js:37
importYaml @ /js/app.js:35
$c_Lio_kaitai_struct_format_JavaScriptClassSpecs.doImport__T__T__s_concurrent_Future @ kaitai-struct-compiler-fastopt.js:68200
$c_Lio_kaitai_struct_precompile_LoadImports.io$kaitai$struct$precompile$LoadImports$$loadImport__T__sci_List__s_Option__s_concurrent_Future @ kaitai-struct-compiler-fastopt.js:7953
(anonymous) @ kaitai-struct-compiler-fastopt.js:7825
$c_Lio_kaitai_struct_precompile_LoadImports.processClass__Lio_kaitai_struct_format_ClassSpec__s_concurrent_Future @ kaitai-struct-compiler-fastopt.js:7838
$c_Lio_kaitai_struct_Main$.importAndPrecompile__Lio_kaitai_struct_format_ClassSpecs__Lio_kaitai_struct_RuntimeConfig__s_concurrent_Future @ kaitai-struct-compiler-fastopt.js:4719
$c_Lio_kaitai_struct_MainJs$.compile__T__sjs_js_Object__Lio_kaitai_struct_JavaScriptImporter__Z__sjs_js_Promise @ kaitai-struct-compiler-fastopt.js:4892
$c_Lio_kaitai_struct_MainJs$.$$js$exported$meth$compile__T__sjs_js_Object__Lio_kaitai_struct_JavaScriptImporter__Z__O @ kaitai-struct-compiler-fastopt.js:4821
$c_Lio_kaitai_struct_MainJs$.compile @ kaitai-struct-compiler-fastopt.js:4945
compile @ /js/app.js:101
copyPromise.then.then @ /js/app.js:127
Promise resolved (async)
copyPromise.then @ /js/app.js:126
Promise resolved (async)
localforage.getItem.then.ksyFsItem @ /js/app.js:123
Promise resolved (async)
req.onsuccess @ localforage.js:836
IndexedDB (async)
(anonymous) @ localforage.js:826
localforage.js:836 XHR finished loading: GET "https://ide.kaitai.io/formats/date.ksy".
send @ jquery-3.1.1.min.js:4
ajax @ jquery-3.1.1.min.js:4
get @ /js/app.files.js:55
(anonymous) @ /js/app.js:37
importYaml @ /js/app.js:35
$c_Lio_kaitai_struct_format_JavaScriptClassSpecs.doImport__T__T__s_concurrent_Future @ kaitai-struct-compiler-fastopt.js:68200
$c_Lio_kaitai_struct_precompile_LoadImports.io$kaitai$struct$precompile$LoadImports$$loadImport__T__sci_List__s_Option__s_concurrent_Future @ kaitai-struct-compiler-fastopt.js:7953
(anonymous) @ kaitai-struct-compiler-fastopt.js:7825
$c_Lio_kaitai_struct_precompile_LoadImports.processClass__Lio_kaitai_struct_format_ClassSpec__s_concurrent_Future @ kaitai-struct-compiler-fastopt.js:7838
$c_Lio_kaitai_struct_Main$.importAndPrecompile__Lio_kaitai_struct_format_ClassSpecs__Lio_kaitai_struct_RuntimeConfig__s_concurrent_Future @ kaitai-struct-compiler-fastopt.js:4719
$c_Lio_kaitai_struct_MainJs$.compile__T__sjs_js_Object__Lio_kaitai_struct_JavaScriptImporter__Z__sjs_js_Promise @ kaitai-struct-compiler-fastopt.js:4892
$c_Lio_kaitai_struct_MainJs$.$$js$exported$meth$compile__T__sjs_js_Object__Lio_kaitai_struct_JavaScriptImporter__Z__O @ kaitai-struct-compiler-fastopt.js:4821
$c_Lio_kaitai_struct_MainJs$.compile @ kaitai-struct-compiler-fastopt.js:4945
compile @ /js/app.js:101
copyPromise.then.then @ /js/app.js:127
Promise resolved (async)
copyPromise.then @ /js/app.js:126
Promise resolved (async)
localforage.getItem.then.ksyFsItem @ /js/app.js:123
Promise resolved (async)
req.onsuccess @ localforage.js:836
IndexedDB (async)
(anonymous) @ localforage.js:826
/#:1 Uncaught (in promise) Object {readyState: 4, getResponseHeader: function, getAllResponseHeaders: function, setRequestHeader: function, overrideMimeType: function…}
It looks like it's trying to retrieve the date.ksy
file from https://ide.kaitai.io/formats/date.ksy
, but that's returning a 404 which is not caught.
Kaitai WebIDE version: 0.1.0.2207 (license)
Kaitai compiler version: 0.7 (2017-04-26 20:06:21.086)
Chrome version 58.0.3029.110 (64-bit)
Windows 10 64-bit
Thanks for reporting!
I'll try to fix in the next days.
(Connected issue: #24)
Great, thanks! 😄
Hopefully fixed with https://github.com/kaitai-io/kaitai_struct_webide/commit/2b47c9aa52d26e5e2a472f354f93c1fa344624cd. (only on stable, I did not port the patch to /devel yet).
@koczkatamas thanks for picking this up! Relative imports in the same directory work now, but it throws an error in the browser console if you try to use subdirectories:
It looks like subdirectories don't work fully in the first place.
If you create a file in the root with some name, e.g. vsval
, and then create a file with the same name in a subdirectory, the new file overwrites the old one even though they're in different directories.
See screen recording: https://puu.sh/wxdLl/70735a4110.mp4
Yeah sorry for that, it's actually a different issue. The whole file handling is a big hack in the current WebIDE, the files actually are stored by their name only (vsval.ksy
in both cases) and there is no warning or what so ever if you overwrite files this way. Renaming also causes this kind of inconsistency.
These hopefully will be fixed in V2, but there is no ETA when it will be released.
Till then please only use flat file structure. Sorry again for that :S
No worries, but it may be a good compromise to disable the create folder button on production in the meantime.
Edit: Or perhaps add a simple window.confirm
call to warn the user about this limitation when it's about to overwrite a file.