In my CodenameOne app some Javascript code is injected to create a DOM,
made of IFRAMES with HTML code inside.
The HTML code is correct but I am debugging in Chrome and I see that when
the HTML code starts an error is detected (the error is also in the
IntelliJ IDEA console):
The following text is the function that is made from the executeAndWait
method:
(function(){var BASE_URL='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:3};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 { var
div=document.createElement('DIV');div.addEventListener('mousedown',
function (event)
{callMouseDown(div.getAttribute("id"));});div.addEventListener('mouseup',
function (event) {callMouseUp(div.getAttribute("id"));});var
iframe=document.createElement("IFRAME");iframe.style.zIndex="0";iframe.style.pointerEvents="none";div.style.position="relative";div.id="0";iframe.setAttribute("scrolling","no");iframe.setAttribute("frameborder","no");iframe.setAttribute("noresize","noresize");iframe.setAttribute("height","100");
iframe.innerText="FALLBACK";iframe.setAttribute("srcdoc","<!DOCTYPE html>
I did not paste all the function body. I stopped when the first HTML code
begins for the first IFRAME and the error is there.
As you can see in the attached image the red error starts at the comma
(Uncaught SyntaxError: Invalid or unexpected token).
(The HTML code is a text with other quotes inside as it is in normal HTML
but it is correctly escaped)
Can you help me? Do you see something? Could this be caused by the calling
function?
Thanks in advance
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/42678b68-78f9-40fa-adb1-7f4740b9796fn%40googlegroups.com.