Skip to content

Commit

Permalink
synch SyNode with github repo
Browse files Browse the repository at this point in the history
  • Loading branch information
Arnaud Bouchez committed Jul 17, 2018
1 parent 222ff58 commit 3ecbf30
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 43 deletions.
33 changes: 2 additions & 31 deletions SyNode/SpiderMonkey.pas
Expand Up @@ -486,19 +486,7 @@ interface
PJSStringFinalizer = ^JSStringFinalizer;

// jsid
JSIdType = (
JSID_TYPE_STRING = $0,
JSID_TYPE_INT = $1,
JSID_TYPE_VOID = $2,
JSID_TYPE_SYMBOL = $4
);

jsid = record
asBits: size_t;
function isString: Boolean;
function asJSString: PJSString;
end;

jsid = size_t;
TjsidVector = array[0..(MaxInt div sizeof(jsid))-2] of jsid;
PjsidVector = ^TjsidVector;

Expand Down Expand Up @@ -3444,6 +3432,7 @@ procedure ShutDownJS;
JS_ShutDown;
end;


{ JSString }

procedure JSString.ToJSONString(cx: PJSContext; W: TTextWriter);
Expand Down Expand Up @@ -5040,24 +5029,6 @@ function JSArgRec.getThisObject(cx: PJSContext): PJSObject;
Result := this[cx].asObject;
end;

{ jsid }

const
JSID_TYPE_MASK = $7;

function jsid.isString: Boolean;
begin
Result := JSIdType(asBits and JSID_TYPE_MASK) = JSID_TYPE_STRING;
end;

function jsid.asJSString: PJSString;
begin
{$ifdef WITHASSERT}
Assert(isString);
{$endif}
Result := PJSString(asBits);
end;

{ JSIdArray }

procedure JSIdArray.init(cx: PJSContext);
Expand Down
20 changes: 9 additions & 11 deletions SyNode/SyNodeRemoteDebugger.pas
Expand Up @@ -438,7 +438,6 @@ procedure TSMRemoteDebuggerCommunicationThread.HandleMessage(const request: Vari
data: RawUTF8;
i: integer;
debuggerIndex: integer;
debugger: TSMDebugger;
Writer: TTextWriter;
engine: TSMEngine;
begin
Expand All @@ -450,33 +449,32 @@ procedure TSMRemoteDebuggerCommunicationThread.HandleMessage(const request: Vari
fParent.fDebuggers.Safe.Lock;
try
for I := 0 to fParent.fDebuggers.Count - 1 do begin
debugger := TSMDebugger(fParent.fDebuggers[i]);
engine := fParent.fManager.EngineForThread(debugger.fSmThreadID);
engine := fParent.fManager.EngineForThread(TSMDebugger(fParent.fDebuggers[i]).fSmThreadID);
if engine <> nil then begin
// Actor represent debug thread here, setting proper name with coxtext thread id
// Writer.AddShort('{"actor":"server1.conn1.addon');
// Writer.Add(TSMDebugger(fParent.fDebuggers[i]).fIndex);
Writer.AddShort('{"actor":"');
Writer.AddShort(debugger.fDebuggerName);
Writer.AddShort(TSMDebugger(fParent.fDebuggers[i]).fDebuggerName);
Writer.AddShort('.conn1.thread_');
{ TODO : check that in multithread mode this field equal thread id with js context that we debug, otherwire replace with proper assigment }
Writer.Add(debugger.fSmThreadID);
Writer.Add(TSMDebugger(fParent.fDebuggers[i]).fSmThreadID);
// id should be addon id, value from DoOnGetEngineName event
// Writer.AddShort('","id":"server1.conn1.addon');
// Writer.Add(TSMDebugger(fParent.fDebuggers[i]).fIndex);
Writer.AddShort('","id":"');
Writer.AddString(debugger.fNameForDebug);
Writer.AddString(TSMDebugger(fParent.fDebuggers[i]).fNameForDebug);
Writer.AddShort('","name":"');
Writer.AddString(debugger.fNameForDebug);
Writer.AddString(TSMDebugger(fParent.fDebuggers[i]).fNameForDebug);
// url most likly should be addon folder in format: file:///drive:/path/
// Writer.AddShort('","url":"server1.conn1.addon');
// Writer.Add(TSMDebugger(fParent.fDebuggers[i]).fIndex);
{ TODO : replace with path generation, should be context home dir in format file:///drive:/path/ }
Writer.AddShort('","url":"file:///' + StringReplaceAll(debugger.fWebAppRootPath, '\', '/'));
Writer.AddShort('","url":"file:///' + StringReplaceAll(TSMDebugger(fParent.fDebuggers[i]).fWebAppRootPath, '\', '/'));
Writer.AddShort('","debuggable":');
Writer.Add(debugger.fCommunicationThread = nil);
Writer.Add(TSMDebugger(fParent.fDebuggers[i]).fCommunicationThread = nil);
Writer.AddShort(',"consoleActor":"console');
Writer.Add(debugger.fIndex);
Writer.Add(TSMDebugger(fParent.fDebuggers[i]).fIndex);
Writer.AddShort('"},');
end;
end;
Expand Down Expand Up @@ -576,7 +574,7 @@ procedure TSMRemoteDebuggerCommunicationThread.sockWrite(const packet: RawUTF8);
fCommunicationSock.SockSend(@tmp[1], length(tmp));
fCommunicationSock.SockSend(@sep[1], length(sep));
fCommunicationSock.SockSend(@packet[1], length(packet));
fCommunicationSock.SockSendFlush('');
fCommunicationSock.SockSendFlush;
end;

procedure TSMRemoteDebuggerCommunicationThread.startListening(socket: TCrtSocket);
Expand Down
2 changes: 1 addition & 1 deletion SynopseCommit.inc
@@ -1 +1 @@
'1.18.4667'
'1.18.4668'

0 comments on commit 3ecbf30

Please sign in to comment.