File tree Expand file tree Collapse file tree
ByteCodeTranslator/src/com/codename1/tools/translator
tests/src/test/java/com/codename1/tools/translator Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,6 +19,9 @@ Current State
1919- Worker native-rebind bug identified and fixed:
2020 - Cause: ` translated_app.js ` redefined native stubs after ` port.js ` bind phase in worker startup order.
2121 - Fix: ` worker.js ` now calls ` __parparInstallNativeBindings() ` after imports, before handling ` start ` .
22+ - Bundle generation ordering bug identified and fixed for worker mode:
23+ - Cause: ` worker.js ` was generated before ` port.js ` was copied into the output bundle, so worker never imported JavaScriptPort natives.
24+ - Fix: copy JavaScriptPort assets before ` worker.js ` generation and keep service-worker/shell scripts excluded from worker imports.
2225- Latest CI artifacts now run worker mode but fail early before suite start with:
2326 - ` PARPAR:DIAG:FIRST_FAILURE:category=runtime_error `
2427 - ` TypeError: Cannot read properties of null (reading '__classDef') `
Original file line number Diff line number Diff line change @@ -23,8 +23,8 @@ private JavascriptBundleWriter() {
2323 static void write (File outputDirectory , List <ByteCodeClass > classes ) throws IOException {
2424 writeRuntime (outputDirectory );
2525 writeTranslatedClasses (outputDirectory , classes );
26- writeWorker (outputDirectory );
2726 copyJavaScriptPortWebAppAssets (outputDirectory );
27+ writeWorker (outputDirectory );
2828 writeBrowserBridge (outputDirectory );
2929 writeIndex (outputDirectory );
3030 writeProtocol (outputDirectory );
@@ -92,7 +92,11 @@ private static void writeWorker(File outputDirectory) throws IOException {
9292 if (!name .endsWith (".js" )) {
9393 continue ;
9494 }
95- if ("parparvm_runtime.js" .equals (name ) || "translated_app.js" .equals (name ) || "worker.js" .equals (name )) {
95+ if ("parparvm_runtime.js" .equals (name )
96+ || "translated_app.js" .equals (name )
97+ || "worker.js" .equals (name )
98+ || "sw.js" .equals (name )
99+ || "browser_bridge.js" .equals (name )) {
96100 continue ;
97101 }
98102 nativeScripts .add (name );
Original file line number Diff line number Diff line change @@ -82,6 +82,8 @@ void generatesBrowserBundleForJavascriptTarget(CompilerHelper.CompilerConfig con
8282 "Unsupported filesystem natives should fail with an explicit JS-mode message when translated" );
8383 assertTrue (worker .contains ("importScripts('parparvm_runtime.js');" ),
8484 "Worker bootstrap should load the runtime first" );
85+ assertTrue (worker .contains ("importScripts('port.js');" ),
86+ "Worker bootstrap should load JavaScriptPort native bindings" );
8587 assertTrue (worker .contains ("__parparInstallNativeBindings" ),
8688 "Worker bootstrap should reapply runtime native bindings after translated app load" );
8789 assertTrue (index .contains ("browser_bridge.js" ) && index .contains ("js/fontmetrics.js" ) && index .contains ("codenameone-canvas" ),
You can’t perform that action at this time.
0 commit comments