Most likely the relevant code - the code that has a syntax error - is the part that you redacted with "/*My Javascript code here*/"
On Wed, Oct 21, 2020 at 3:16 AM 'P5music' via CodenameOne Discussions < [email protected]> wrote: > IntelliJ IDEA 2020.2.3 (Community Edition) > Build #IC-202.7660.26, built on October 6, 2020 > Runtime version: 11.0.8+10-b944.34 amd64 > VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. > Linux 5.4.0-48-generic > GC: ParNew, ConcurrentMarkSweep > Memory: 949M > Cores: 4 > Non-Bundled Plugins: com.kaylerrenslow.plugin.armaplugin.id, > com.codename1.plugin.intellij > Current Desktop: ubuntu:GNOME > > I am using the executeAndWait instruction (but there are other similar > instructions) on a BrowserComponent (subclass of). > I get the error below when trying to inject Javascript. It complains about > unexpected '}' char. > In fact in that code there are 21 '{' hars and 22 '}' chars. > > %28function%28%29%7Bvar%20base%5Furl%3D%27 > https://www.codenameone.com/!cn1return/';function doCallback(val) { var > url = BASE_URL + encodeURIComponent(JSON.stringify(val)); if > (window.cefQuery) { window.cefQuery({request:'shouldNavigate:'+url, > onSuccess: function(response){}, onFailure:function(error_code, > error_message) { console.log(error_message)}});} else if > (window.cn1application && window.cn1application.shouldNavigate) { > window.cn1application.shouldNavigate(url) } else if (true) > {window._cn1ready = window._cn1ready || []; > window._cn1ready.push(function(){window.cn1application.shouldNavigate(url)});} > else {window.location.href=url}} var result = {value:null, type:null, > errorMessage:null, errorCode:0, callbackId:1};var callback = { onSucess: > function(val) { this.onSuccess(val);}, onSuccess: function(val) { > result.value = val; result.type = typeof(val); if (val !== null && typeof > val === 'object') {result.value = val.toString();} doCallback(result);}, > onError: function(message, code) { if (message instanceof Error) > {result.errorMessage = message.message; result.errorCode = 0;} else > {result.errorMessage = message; result.errorCode = code;} > doCallback(result);}};try { /* My Javascript code here*/ } catch (e) {try > {callback.onError(e.message, 0);} catch (e2) {callback.onError('Unknown > error', 0);}}})(); (1) > > Regards > > -- > You received this message because you are subscribed to the Google Groups > "CodenameOne Discussions" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/codenameone-discussions/42b10660-5eb9-4161-b411-fa99d18c7c70n%40googlegroups.com > <https://groups.google.com/d/msgid/codenameone-discussions/42b10660-5eb9-4161-b411-fa99d18c7c70n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- Steve Hannah Software Developer Codename One http://www.codenameone.com -- You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/CAGOYrKVWZbZK%2BDOVJ4AtwMjefr_SjdJR0un35zOUWdrpHNkKug%40mail.gmail.com.
