#1 2014-07-10 19:37:00

warleyalex
Member
From: Sete Lagoas-MG, Brasil
Registered: 2013-01-20
Posts: 250

Project 29 - SmartMobileStudio Client

SMart 2.1.0 beta 2
Delphi 7
---------------------------------------
Project 27 - CrossPlatform Clients folder
---------------------------------------
In order to test SmartMS project, you have to run the RegressionTestsServer.dpr.

I have to comment some lines:

unit PeopleServer;
//mORMotWrappers,

In RegressionTests I added this:

program RegressionTests;
line 51    //    StopServer;
line 77          StopServer;

---------------------------------------
Project 29 - SmartMobileStudio Client
---------------------------------------
When I connect: 873 requests are performed and 26 errors (400 status code).
-----------------------------------------------
Creating Data Model index.html:1194
Connecting to the server at 127.0.0.1:888 index.html:1194

Uncaught InvalidStateError: An attempt was made to use an object that is not, or is no longer, usable. index.html:7598

ServerTimeStamp=135158500722 index.html:1194
Safely connected with SessionID=5823594 index.html:1194
{"RowID":1,"Data":"","FirstName":"First1","LastName":"Last1","YearOfBirth":1801,"YearOfDeath":1826} index.html:1194

Testing remote CRUD methods index.html:1194

GET http://127.0.0.1:888/root/People/16?ses … 2b755daa48 400 (Bad Request) index.html:6188
GET http://127.0.0.1:888/root/People/32?ses … 2d62fcd821 400 (Bad Request) index.html:6188
GET http://127.0.0.1:888/root/People/48?ses … 2f65ee1669 400 (Bad Request) index.html:6188
GET http://127.0.0.1:888/root/People/64?ses … 31e59e4279 400 (Bad Request) index.html:6188
GET http://127.0.0.1:888/root/People/80?ses … 344ff71565 400 (Bad Request) index.html:6188
GET http://127.0.0.1:888/root/People/96?ses … 3617093080 400 (Bad Request) index.html:6188
GET http://127.0.0.1:888/root/People/112?se … 3896aa05c9 400 (Bad Request) index.html:6188
GET http://127.0.0.1:888/root/People/128?se … 3b61b8cd5c 400 (Bad Request) index.html:6188
GET http://127.0.0.1:888/root/People/144?se … 3d6dc54f15 400 (Bad Request) index.html:6188
GET http://127.0.0.1:888/root/People/160?se … 3fdf3ecced 400 (Bad Request) index.html:6188
GET http://127.0.0.1:888/root/People/176?se … 413a7414c3 400 (Bad Request) index.html:6188
GET http://127.0.0.1:888/root/People/192?se … 44d9c32042 400 (Bad Request) index.html:6188

Disconnect from server index.html:1194
ORM: 39480.000ms index.html:8015
ServerTimeStamp=135158500721 index.html:1194

Safely connected with SessionID=5823589 index.html:1194
{"RowID":1,"Data":"","FirstName":"First1","LastName":"Last1","YearOfBirth":1801,"YearOfDeath":1826} index.html:1194
Testing remote CRUD methods index.html:1194
GET http://127.0.0.1:888/root/People/16?ses … 5558c1704c 400 (Bad Request) index.html:6188
GET http://127.0.0.1:888/root/People/32?ses … 589194a4db 400 (Bad Request) index.html:6188
GET http://127.0.0.1:888/root/People/48?ses … 5ac6eb285f 400 (Bad Request) index.html:6188
GET http://127.0.0.1:888/root/People/64?ses … 5c55edb767 400 (Bad Request) index.html:6188
GET http://127.0.0.1:888/root/People/80?ses … 5eeef98a02 400 (Bad Request) index.html:6188
GET http://127.0.0.1:888/root/People/96?ses … 6133ac2bd5 400 (Bad Request) index.html:6188
GET http://127.0.0.1:888/root/People/112?se … 632aadd661 400 (Bad Request) index.html:6188
GET http://127.0.0.1:888/root/People/128?se … 65b2c40558 400 (Bad Request) index.html:6188
GET http://127.0.0.1:888/root/People/144?se … 676a88cb96 400 (Bad Request) index.html:6188
GET http://127.0.0.1:888/root/People/160?se … 6ac41bcc8d 400 (Bad Request) index.html:6188
GET http://127.0.0.1:888/root/People/176?se … 6b1dabec0b 400 (Bad Request) index.html:6188
GET http://127.0.0.1:888/root/People/192?se … 6e79bcfde9 400 (Bad Request) index.html:6188
Disconnect from server index.html:1194

-------------------------------------------------------------------------------------
for example in "http://127.0.0.1:888/root/People/192?se … 6e79bcfde9" I have:

Request URL:http://127.0.0.1:888/root/People/192?session_signature=0058dc65d67d476e79bcfde9
Request Method:GET
Status Code:400 Bad Request
Request Headersview source
Accept:*/*
Accept-Encoding:gzip,deflate,sdch
Accept-Language:pt-BR,pt;q=0.8,en-US;q=0.6,en;q=0.4
Connection:keep-alive
content-type:text/plain
Host:127.0.0.1:888
Origin:null
User-Agent:Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.101 Safari/537.36
Query String Parametersview sourceview URL encoded
session_signature:0058dc65d67d476e79bcfde9
Response Headersview source
Accept-Encoding:synlz,deflate
Access-Control-Allow-Methods:POST, PUT, GET, DELETE, LOCK, OPTIONS
Access-Control-Allow-Origin:*
Access-Control-Expose-Headers:content-length,location,server-internalstate
Access-Control-Max-Age:1728000
Content-Length:49
Content-Type:application/json; charset=UTF-8
Date:Fri, 10 Jan 2014 16:55:10 GMT
Server:Microsoft-HTTPAPI/1.0
Server-InternalState:0
X-Powered-By:Synopse mORMot 1.18 http://synopse.info

------------------------------------------------------------
In SmartMS 2.1 version, some warnings:

[INFO] Compiling solution WebForm ..
Warning: "W3System" has been deprecated: Use SmartCL.System instead [line: 66, column: 3, file: SynCrossPlatformCrypto]
Warning: "W3System" has been deprecated: Use SmartCL.System instead [line: 85, column: 3, file: SynCrossPlatformSpecific]
Warning: "W3Inet" has been deprecated: Use SmartCL.Inet instead [line: 86, column: 3, file: SynCrossPlatformSpecific]
Warning: "W3System" has been deprecated: Use SmartCL.System instead [line: 66, column: 3, file: SynCrossPlatformREST]
Warning: "W3System" has been deprecated: Use SmartCL.System instead [line: 6, column: 3, file: SmartTests]
Warning: "W3System" has been deprecated: Use SmartCL.System instead [line: 6, column: 3, file: LoginForm]
Warning: "W3Graphics" has been deprecated: Use SmartCL.Graphics instead [line: 6, column: 13, file: LoginForm]
Warning: "W3Components" has been deprecated: Use SmartCL.Components instead [line: 6, column: 25, file: LoginForm]
Warning: "W3Forms" has been deprecated: Use SmartCL.Forms instead [line: 6, column: 39, file: LoginForm]
Warning: "W3Fonts" has been deprecated: Use SmartCL.Fonts instead [line: 6, column: 48, file: LoginForm]
Warning: "W3Borders" has been deprecated: Use SmartCL.Borders instead [line: 6, column: 57, file: LoginForm]
Warning: "W3Application" has been deprecated: Use SmartCL.Application instead [line: 6, column: 68, file: LoginForm]
Warning: "W3Label" has been deprecated: Use SmartCL.Controls.Label instead [line: 8, column: 3, file: LoginForm]
Warning: "W3Editbox" has been deprecated: Use SmartCL.Controls.EditBox instead [line: 8, column: 12, file: LoginForm]
Warning: "W3Panel" has been deprecated: Use SmartCL.Controls.Panel instead [line: 8, column: 23, file: LoginForm]
Warning: "W3Button" has been deprecated: Use SmartCL.Controls.Button instead [line: 8, column: 32, file: LoginForm]
[INFO] Generating JavaScript...
[INFO] Compilation successfull [3 seconds,685 msec.]
---------------------------------------------------------------------------------------------------------------

It is important to inform you that SMSC.EXE (command-line compiler) is made free to the community. I think you can compile .PAS to .JS but I don't find a way.

Offline

#2 2014-07-10 20:10:23

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,655
Website

Re: Project 29 - SmartMobileStudio Client

Errors are OK.

In fact they are part of the tests, and mean that a deleted record has been really deleted.

Where did you get the 2.1 beta?

Offline

#3 2014-07-10 20:52:25

warleyalex
Member
From: Sete Lagoas-MG, Brasil
Registered: 2013-01-20
Posts: 250

Offline

#4 2014-07-11 08:45:53

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,655
Website

Re: Project 29 - SmartMobileStudio Client

Thanks for the links.

The 2.1 beta is a great version.
Internal debugger is a great idea... but I was not able to make it work yet!
I made several support tickets.
Hope they will stabilize the beast!
smile

Offline

#5 2014-08-06 21:00:23

warleyalex
Member
From: Sete Lagoas-MG, Brasil
Registered: 2013-01-20
Posts: 250

Re: Project 29 - SmartMobileStudio Client

Project29 with Chrome, I always get a bunch of these errors:
----------------------
Uncaught InvalidStateError: An attempt was made to use an object that is not, or is no longer, usable.
index.html:7907

GetOutHeader index.html:7907
TSQLRestClientURI.URI index.html:7027
TSQLRestClientURI.CallRemoteServiceInternal index.html:6775
TSQLRestClientURI.CallRemoteService index.html:6757
TServiceCalculator.Add$2 index.html:8909
SOATest index.html:8142
(anonymous function) index.html:8334
Call$15.OnSuccess index.html:6971
Call$2.XHR.onreadystatechange
---------------------------
FF don't capture this errors.
---------------------------

If result is null, this error has vanished!

{PlatformREST}
function GetOutHeader(const Call: TSQLRestURIParams; const Name: string): string;
  {$ifdef ISSMS}inline;{$endif}
begin
{$ifdef ISSMS} // faster direct retrieval
//  result := Call.XHR.getResponseHeader(Name);
  result := null;

{$else}
  result := FindHeader(Call.OutHead,Name+':');
{$endif}
end;
--------
line 7907

function GetOutHeader(Call$19, Name$8) {
   return ""+Call$19.XHR.getResponseHeader(Name$8);
};

{PlatformEspecific}
procedure TSMSHttpConnectionClass.URI(var Call: TSQLRestURIParams;
  const InDataType: string; KeepAlive: integer);
begin
  asm
    @Call.XHR = new XMLHttpRequest();
  end;
....
line 6228
procedure TSMSHttpConnectionClass.URI
    Call$2.XHR = new XMLHttpRequest();

------
// I suspect that Call$19 should be Call$2.XHR

Offline

#6 2014-08-06 21:23:46

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,655
Website

Re: Project 29 - SmartMobileStudio Client

I did not have issue with chrome.

But I will check tomorrow.
Perhaps the asm is wrong somewhat...

Offline

#7 2014-08-07 06:17:50

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,655
Website

Re: Project 29 - SmartMobileStudio Client

On our side, no problem at all with the generated code, using SMS 2.1 beta 3.

Call$19 is a local parameter, so its name depends on the function context, but is consistent AFAIK.

If we enable obfuscation and/or compaction, code still works as expected.

For instance, with obfuscation:

   /// procedure TSMSHttpConnectionClass.URI(var Call: TSQLRestURIParams; const InDataType: String; KeepAlive: Integer)
   ///  [line: 833, column: 35, file: SynCrossPlatformSpecific]
   ,Vc:function(Self, KL, gIV, aK) {
      var aB = {v:0};
      var oQc = {};
      oQc.v = "";
      var VG1 = 0;
      var HZJ = "";
      var k2F = "";
      
    KL.Cv = new XMLHttpRequest();
  if (KL.Av) {
         KL.Cv.onreadystatechange = function () {

Sounds perfectly fine to me.
I honestly do not understand what's wrong on your side.

Offline

#8 2014-08-07 12:47:35

warleyalex
Member
From: Sete Lagoas-MG, Brasil
Registered: 2013-01-20
Posts: 250

Re: Project 29 - SmartMobileStudio Client

Sounds like the problem is my old Chrome 30.0.1599.101 m

var X1 = {
	$ClassName : "TSMSHttpConnectionClass",
	$Parent : VX,
	$Init : function ($) {
		VX.$Init($)
	},
	QU : function (S, n3, fI, by) {
		var co = {
			v : 0
		};
		var ca = {};
		ca.v = "";
		var zd = 0;
		var wC = "";
		var rjU = "";
		n3.ut = new XMLHttpRequest();
		if (n3.vi) {
			n3.ut.onreadystatechange = function () {

Offline

#9 2014-08-07 16:37:50

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,655
Website

Re: Project 29 - SmartMobileStudio Client

I'm using Chrome 36...

Offline

#10 2014-08-08 01:54:18

warleyalex
Member
From: Sete Lagoas-MG, Brasil
Registered: 2013-01-20
Posts: 250

Re: Project 29 - SmartMobileStudio Client

Firefox doesn’t complain about this, and Chrome only seems to care about this annoying cryptic error message.

Chrome 19:
INVALID_STATE_ERR: DOM Exception 11: An attempt was made to use an object that is not, or is no longer, usable.
index.html:7907

Chrome 30:
Uncaught InvalidStateError: An attempt was made to use an object that is not, or is no longer, usable.
index.html:7907

Chrome 31:
Uncaught InvalidStateError: Failed to execute 'getResponseHeader' on 'XMLHttpRequest': the object's state must not be UNSENT or OPENED. index.html:7907

The getResponseHeader(header) method must run these steps:

If the state is UNSENT or OPENED, return null.

If the error flag is set, return null.

If header is a case-insensitive match for Set-Cookie or Set-Cookie2, return null.

If header is a case-insensitive match for multiple response headers, return the values of these headers as a single concatenated string separated from each other by a U+002C COMMA U+0020 SPACE character pair.

If header is a case-insensitive match for a single response header, return the value of that header.

Return null.



I think the last line is causing this annoying cryptic error. If I comment this line, Chrome 19,30 and 31 + FF, no annoying messages anymore.

{CrossPlatformREST}

procedure TSQLRestClientURI.URI(var Call: TSQLRestURIParams);
var sign: string;
begin
  Call.OutStatus := HTML_UNAVAILABLE;
  Call.OutInternalState := 0;
  if self=nil then
    exit;
  if (fAuthentication<>nil) and (fAuthentication.SessionID<>0) then begin
    if Pos('?',Call.Url)=0 then
      sign := '?session_signature=' else
      sign := '&session_signature=';
    Call.Url := Call.Url+sign+
      fAuthentication.ClientSessionComputeSignature(self,Call.Url);
  end;
  InternalURI(Call);
 // Call.OutInternalState := StrToIntDef(GetOutHeader(Call,'Server-InternalState'),0);
end;

Offline

#11 2014-08-08 10:52:24

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,655
Website

Re: Project 29 - SmartMobileStudio Client

So we tried to avoid calling XHR.getResponseHeader() which is broken with some browsers...
See http://synopse.info/fossil/info/3a37921d7928

I hope it will fix your issue.
Performance may be only slightly slower (we optimized the FindHeader() function somewhat).
Profiling (in both IE and Chrome) states that most of the time is spent within HTTP communication, not in our SmartPascal/JavaScript code.

Offline

#12 2014-08-08 18:23:48

warleyalex
Member
From: Sete Lagoas-MG, Brasil
Registered: 2013-01-20
Posts: 250

Re: Project 29 - SmartMobileStudio Client

Yes! It works perfectly fine now.

Offline

#13 2015-11-18 06:42:33

igors233
Member
Registered: 2012-09-10
Posts: 241

Re: Project 29 - SmartMobileStudio Client

Hi all,

I'm trying to run WebForm.sproj (from this sample) in latest SMS 2.2, but it doesn't compile, it's complaining about missing WebForm.pas.
Is there perhaps an updated sample (same thing with one in latests nightly build)?

Regards,
Igor

Offline

Board footer

Powered by FluxBB