OSSP CVS Repository

ossp - Ticket #159
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Attach]  [Edit]  [History

Ticket 159: js portability issues for Windows

I'm embedding OSSP js in a project and I found the following problems:

1. There's a bug in the function js_FreeRuntimeScriptState at jsscript.c:994. If you create a runtime and then destroy it before creating any contexts, the statement:

JS_REMOVE_LINK(&sfp->links);

causes a segfault because sfp is NULL. I didn't have the time or inclination to investigate this, but adding:

if(! sfp) break;

before that statement eliminated the crash.

According to the SpiderMonkey team:

"I don't know what version OSSP is using, but this sounds like bug 345350 (¤https://bugzilla.mozilla.org/show_bug.cgi?id=345350). Your patch just detects this in the loop, but that adds an if test to every iteration that runs when the table has not been finished. The patch in bug 345350 tests before the loop."

2. I had to build a Visual Studio solution for js since I need to deploy on Windows as well as UNIX (and mingw/cygwin were not an option). I ran into the following portability problems:

a. prjmtime.c fails to compile because the two #include statements at line 61 are not sufficient; I got lots of errors about LPCONTEXT and such being undefined. I replaced these with a single "#include <windows.h >" to solve the problem.

b. I copied config.h.in to config.h and added the following at the bottom:

#define __VA_COPY_USE __VA_COPY_USE_CPP

But this caused compiler errors because the #define of that macro has a typo: one of the close parens is in the wrong place. It should be: #define __VA_COPY_USE_CPP(d, s) memcpy((void *)(d), (void *)(s), sizeof(*(s)))

It looks like __VA_COPY_USE_CPS has the same problem.

c. The following macros have to be defined globally for the project to eliminate the hundreds of VC++ compiler warnings I got. This should be documented in a README or somewhere:

XP_WIN

OSSP

EXPORT_JS_API

_CRT_SECURE_NO_DEPRECATE

_USE_32BIT_TIME_T

Also I had to turn off the "Detect 64-bit Portability Issues" option (no /Wp64 switch to the compiler).

I will happily contribute my Visual Studio 2005 Solution and Project files if you're willing to add them to the OSSP js distro (it's just 3 small XML files).

[Add remarks]

Remarks:

Properties:

Type: code           Version: 1.6.20070208 
Status: new          Created: 2007-Sep-17 07:32
Severity:          Last Change: 2007-Sep-17 07:32
Priority:          Subsystem: js 
Assigned To: rse           Derived From:  
Creator: anonymous 

CVSTrac 2.0.1