[Gambas-user] Help for gb.web.gui

Benoit Minisini benoit.minisini at gambas-basic.org
Tue Aug 9 12:47:33 CEST 2022


Le 09/08/2022 à 03:49, T Lee Davidson a écrit :
> On 8/8/22 17:48, Benoit Minisini wrote:
>> Le 07/08/2022 à 22:43, T Lee Davidson a écrit :
>>>
>>> I think there is a bug in the lib.js file that gb.web.gui uses. I am 
>>> using stable Gambas 3.17.3, and I see that lib.js is different in the 
>>> developer branch at the very spot where my browser developer console 
>>> reports a Syntax Error in that file:
>>> Uncaught SyntaxError: unexpected token: ':' lib:0.0.1.js:1:19
>>>      answer http://localhost:8080/lib:0.0.1.js:275
>>>      onreadystatechange http://localhost:8080/lib:0.0.1.js:324
>>>      sendNewCommand http://localhost:8080/lib:0.0.1.js:324
>>>      answer http://localhost:8080/lib:0.0.1.js:295
>>>      onreadystatechange http://localhost:8080/lib:0.0.1.js:324
>>>      sendNewCommand http://localhost:8080/lib:0.0.1.js:324
>>>      send http://localhost:8080/lib:0.0.1.js:345
>>>      update http://localhost:8080/lib:0.0.1.js:355
>>>      onFocus http://localhost:8080/lib:0.0.1.js:431
>>>      answer http://localhost:8080/lib:0.0.1.js:275
>>>      onreadystatechange http://localhost:8080/lib:0.0.1.js:324
>>>      (Async: EventHandlerNonNull)
>>>      sendNewCommand http://localhost:8080/lib:0.0.1.js:324
>>>      answer http://localhost:8080/lib:0.0.1.js:295
>>>      onreadystatechange http://localhost:8080/lib:0.0.1.js:324
>>>      (Async: EventHandlerNonNull)
>>>      sendNewCommand http://localhost:8080/lib:0.0.1.js:324
>>>      send http://localhost:8080/lib:0.0.1.js:345
>>>      update http://localhost:8080/lib:0.0.1.js:355
>>>      onFocus http://localhost:8080/lib:0.0.1.js:431
>>>
>>>
>>> Benoît, have you fixed this already?
>>>
>>
>> Where is the bug exactly? I find nothing suspicious in the 'lib.js' of 
>> Gambas 3.17.3.
> 
> I do not know where the bug is exactly; nor if it actually is a bug 
> though it appears to be.
> 
> What I do know is that the developer console stack trace shows it to 
> occur in the 'answer' function in lib.js at line 275 which is:
> eval(expr);
> 
> And, at the time of the error 'expr' has the value:
> "Content-Disposition: attachment;filename=\"data.csv\""
> 
> Javascript is obviously choking on the colon. And, I don't understand 
> why we are commanding Javascript to evaluate text.
> 
> The entire content of 'xhr.responseText' at the time of the error is:
> "0;1;2;3;4;5;6;7;8;9;10\n0;1;2;3;4;5;6;7;8;9;10\n0;1;2;3;4;5;6;7;8;9;10\n0;1;2;3;4;5;6;7;8;9;10\n0;1;2;3;4;5;6;7;8;9;10\n0;1;2;3;4;5;6;7;8;9;10\n0;1;2;3;4;5;6;7;8;9;10\n0;1;2;3;4;5;6;7;8;9;10\n0;1;2;3;4;5;6;7;8;9;10\n0;1;2;3;4;5;6;7;8;9;10\n0;1;2;3;4;5;6;7;8;9;10\nContent-Disposition: 
> attachment;filename=\"data.csv\"\r\nContent-type: 
> text/javascript;charset=utf-8\r\nContent-Length: 22\r\n\ngw.needKeyPress 
> = {}\r\n"
> In that, Content-type is set to "text/javascript" even though the 
> project's Webform1.class sets it to "text/plain" on line 26:
> Response.SendFile(sPath, "text/plain")
> 
> I don't know from where "text/javascript" comes, because I don't see it 
> in either Response.SendFile nor in Response.GetContentTypeFrom.
> 
> 
> BTW, I am unable to use Print and Debug in the Webform1.class. I get no 
> output in the IDE console (except for the expected "gb.httpd: bind 
> 0.0.0.0 - Address already in use"). Is this normal? Do I need to set 
> something in the Debug Configuration menu to enable printing to the IDE 
> console?
> 
> 

Apparently that does not come from 'gb.web.gui' (it does not send 'csv' 
files by itself) but from the project using it.

Can you send the project?

-- 
Benoît Minisini.


More information about the User mailing list