Merge.
authorAndreas Gal <gal@mozilla.com>
Wed, 24 Sep 2008 19:33:04 -0700
changeset 19971 39e3922ebb5d6c74edc50407145084fe78236534
parent 19970 7e106fd14850d45bb94af6f6ebee0717152341b2 (current diff)
parent 19969 ad40929b3424871f1a603bbd96a433d64d0f999e (diff)
child 19972 ce14c596ab60bd05ad85c76131f4ee71bfd3098a
child 19974 3a16ec28613e4e2629f2b2b88fbd9df9b3bc7d94
push id2577
push userbrendan@mozilla.com
push dateWed, 01 Oct 2008 04:35:27 +0000
treeherdermozilla-central@a613924403d6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone1.9.1b1pre
Merge.
js/src/jsinterp.cpp
js/src/jstracer.cpp
xpfe/components/history/src/nsHistoryLoadListener.h
xpfe/global/resources/content/nsWidgetStateManager.js
--- a/.hgtags
+++ b/.hgtags
@@ -5,8 +5,11 @@ caeba7562e495a9f604984df0b48b6f99bec3e2e
 9d9941eacb14827fdab4716710042fdde84eb60d FIREFOX_3_1a1_RELEASE
 9d9941eacb14827fdab4716710042fdde84eb60d FIREFOX_3_1a1_BUILD1
 c1d7e318a27574c995631fec166ad42672475702 FIREFOX_3_1a1_BUILD2
 c1d7e318a27574c995631fec166ad42672475702 FIREFOX_3_1a1_RELEASE
 afc4ee509d9ca3bb4031015c3c22963dcb4b7e7f FIREFOX_3_1a1_RELEASE
 afc4ee509d9ca3bb4031015c3c22963dcb4b7e7f FIREFOX_3_1a1_BUILD2
 f197b51bbc29a30860e750ee87fd0a047a024f2e FIREFOX_3_1a2_BUILD1
 f197b51bbc29a30860e750ee87fd0a047a024f2e FIREFOX_3_1a2_RELEASE
+269af1ed75649989575d41f53a12048015c6d50e FENNEC_M8
+920a4326d1087b174c2fa2b9a8358e12c697022c SEAMONKEY_2_0a1_BUILD1
+920a4326d1087b174c2fa2b9a8358e12c697022c SEAMONKEY_2_0a1_RELEASE
--- a/browser/components/places/content/toolbar.xml
+++ b/browser/components/places/content/toolbar.xml
@@ -1192,17 +1192,17 @@
             !PlacesControllerDragHelper.getSession())
           this._openedMenuButton = null;
       ]]></handler>
 
       <handler event="mousedown"><![CDATA[
         // Allow drag and drop of folders in Linux.
         // We must prevent popupshowing event from firing when shift is pressed.
         var target = event.originalTarget;
-        if (event.button == 1 && event.shiftKey &&
+        if (event.button == 0 && event.shiftKey &&
             target.localName == "toolbarbutton" && target.type == "menu")
           this._draggingContainer = true;
       ]]></handler>
 
       <handler event="mousemove"><![CDATA[
         if (this._openedMenuButton == null ||
             PlacesControllerDragHelper.getSession())
           return;
old mode 100644
new mode 100755
--- a/build/wince/shunt/assert.cpp
+++ b/build/wince/shunt/assert.cpp
@@ -42,19 +42,17 @@
 
 extern "C" {
 #if 0
 }
 #endif
 
 MOZCE_SHUNT_API void mozce_assert(int inExpression)
 {
-#ifdef API_LOGGING
-    mozce_printf("mozce_assert called\n");
-#endif
+    WINCE_LOG_API_CALL("mozce_assert called\n");
 
     if(0 == inExpression)
     {
         DebugBreak();
     }
 }
 
 #if 0
--- a/build/wince/shunt/direct.cpp
+++ b/build/wince/shunt/direct.cpp
@@ -44,19 +44,17 @@
 extern "C" {
 #if 0
 }
 #endif
 
 
 MOZCE_SHUNT_API int mkdir(const char* inDirname)
 {
-#ifdef API_LOGGING
-    mozce_printf("mkdir called\n");
-#endif
+    WINCE_LOG_API_CALL("mkdir called\n");
     
     int retval = -1;
     
     if(NULL != inDirname)
     {
         unsigned short wDirname[MAX_PATH];
         
         if(0 != a2w_buffer(inDirname, -1, wDirname, sizeof(wDirname) / sizeof(unsigned short)))
@@ -69,19 +67,17 @@ MOZCE_SHUNT_API int mkdir(const char* in
     }
     
     return retval;
 }
 
 
 MOZCE_SHUNT_API int rmdir(const char* inDirname)
 {
-#ifdef API_LOGGING
-    mozce_printf("rmdir called (%s)\n", inDirname);
-#endif
+    WINCE_LOG_API_CALL_1("rmdir called (%s)\n", inDirname);
     
     int retval = -1;
     
     if(NULL != inDirname)
     {
         unsigned short wDirname[MAX_PATH];
         
         if(0 != a2w_buffer(inDirname, -1, wDirname, sizeof(wDirname) / sizeof(unsigned short)))
new file mode 100644
--- /dev/null
+++ b/build/wince/shunt/include/aclapi.h
@@ -0,0 +1,2 @@
+#include "mozce_shunt.h"
+
--- a/build/wince/shunt/include/mozce_defs.h
+++ b/build/wince/shunt/include/mozce_defs.h
@@ -172,17 +172,19 @@ typedef INT_PTR intptr_t;
 
 // From sys/stat.h
 #if !defined(_STAT_DEFINED)
 #define _STAT_DEFINED
 #define _S_IFDIR    0040000 /* stat, is a directory */
 #define _S_IFREG    0100000 /* stat, is a normal file */
 #define _S_IREAD    0000400 /* stat, can read */
 #define _S_IWRITE   0000200 /* stat, can write */
-#define	_S_IEXEC	0000100
+#define _S_IEXEC    0000100
+
+#define S_IFREG     0x8000
 
 struct stat
 {
     unsigned short st_mode;
     _off_t st_size;
     time_t st_ctime;
     time_t st_atime;
     time_t st_mtime;
@@ -301,28 +303,28 @@ typedef struct MAT2 {
 //
 // alpha format flags
 //
 
 #define AC_SRC_ALPHA                0x01
 
   
 struct color{
-	unsigned char Red;
-	unsigned char Green;
-	unsigned char Blue;
-	double Alpha;
+    unsigned char Red;
+    unsigned char Green;
+    unsigned char Blue;
+    double Alpha;
 };
 
 #ifndef SEE_MASK_FLAG_DDEWAIT
-#define SEE_MASK_FLAG_DDEWAIT	0
+#define SEE_MASK_FLAG_DDEWAIT   0
 #endif
 
 #ifndef SEE_MASK_INVOKEIDLIST
-#define SEE_MASK_INVOKEIDLIST	0
+#define SEE_MASK_INVOKEIDLIST   0
 #endif
 
 
 
 // if using WINCE 5.0 SDK, you need these:
 #define LPRASPBDLG void*
 #define LPRASDIALDLG void*
 
@@ -794,9 +796,34 @@ typedef struct
 
 #define SHGetPathFromIDListW SHGetPathFromIDList 
 #define GetUserNameW         GetUserName
 #define RemovePropW          RemoveProp
 #define GetPropW             GetProp
 #define SetPropW             SetProp
 #define FONTENUMPROCW        FONTENUMPROC
 #define GetLongPathNameW     GetLongPathName
+
+// ACL Defines
+
+
+typedef enum _SE_OBJECT_TYPE {
+  SE_UNKNOWN_OBJECT_TYPE       = 0,
+  SE_FILE_OBJECT,
+  SE_SERVICE,
+  SE_PRINTER,
+  SE_REGISTRY_KEY,
+  SE_LMSHARE,
+  SE_KERNEL_OBJECT,
+  SE_WINDOW_OBJECT,
+  SE_DS_OBJECT,
+  SE_DS_OBJECT_ALL,
+  SE_PROVIDER_DEFINED_OBJECT,
+  SE_WMIGUID_OBJECT,
+  SE_REGISTRY_WOW64_32KEY 
+} SE_OBJECT_TYPE;
+
+typedef DWORD SECURITY_INFORMATION, *PSECURITY_INFORMATION;
+
+#define UNPROTECTED_DACL_SECURITY_INFORMATION 0x0
+
+
 #endif // _MOZCE_DEFS
--- a/build/wince/shunt/include/mozce_shunt.h
+++ b/build/wince/shunt/include/mozce_shunt.h
@@ -56,17 +56,16 @@
 #ifndef MOZCE_SHUNT_EXPORTS
 
 #define _mkdir		mkdir
 #define _rmdir		rmdir
 #define _chmod		chmod
 #define _isatty		isatty
 #undef fileno
 #define fileno      (int)_fileno
-#define fstat       (int)_fstat
 #define _mbctolower tolower
 #define _mbsicmp    mbsicmp
 #define _mbsdec     mbsdec
 #define _getpid		getpid
 #define _access		access
 #define	_fdopen		fdopen
 #define _getcwd     getcwd
 #define _open open
@@ -145,16 +144,25 @@
 //////////////////////////////////////////////////////////
 // Function Declarations
 //////////////////////////////////////////////////////////
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
+  MOZCE_SHUNT_API BOOL InitializeAcl(PACL apAcl, DWORD len, DWORD rev);
+  MOZCE_SHUNT_API DWORD SetNamedSecurityInfoW(unsigned short* pObjectName,
+					      SE_OBJECT_TYPE ObjectType,
+					      SECURITY_INFORMATION SecurityInfo,
+					      PSID psidOwner,
+					      PSID psidGroup,
+					      PACL pDacl,
+					      PACL pSacl);
+
   // From assert.cpp
   MOZCE_SHUNT_API void mozce_assert(int inExpression);
 
   // From direct.cpp
   MOZCE_SHUNT_API int mkdir(const char* inDirname);
   MOZCE_SHUNT_API int rmdir(const char* inDirname);
 
   // From errno.cpp
@@ -203,16 +211,17 @@ extern "C" {
 
   MOZCE_SHUNT_API int open(const char *pathname, int flags, int mode);
   MOZCE_SHUNT_API int close(int fp);
   MOZCE_SHUNT_API size_t read(int fp, void* buffer, size_t count);
   MOZCE_SHUNT_API size_t write(int fp, const void* buffer, size_t count);
   MOZCE_SHUNT_API int unlink(const char *pathname);
   MOZCE_SHUNT_API int lseek(int fildes, int offset, int whence);
 
+  MOZCE_SHUNT_API int fstat(FILE* handle, struct stat* buff);
 
   // From stdlib.cpp
   MOZCE_SHUNT_API void splitpath(const char* inPath, char* outDrive, char* outDir, char* outFname, char* outExt);
   MOZCE_SHUNT_API void makepath(char* outPath, const char* inDrive, const char* inDir, const char* inFname, const char* inExt);
   MOZCE_SHUNT_API char* fullpath(char *, const char *, size_t);
   MOZCE_SHUNT_API int _unlink(const char *filename );
 
   // From string.cpp
--- a/build/wince/shunt/io.cpp
+++ b/build/wince/shunt/io.cpp
@@ -46,19 +46,17 @@ extern "C" {
 #endif
 
 MOZCE_SHUNT_API void setbuf(FILE *, char *)
 {
 }
 
 MOZCE_SHUNT_API int chmod(const char* inFilename, int inMode)
 {
-#ifdef API_LOGGING
-    mozce_printf("chmod called\n");
-#endif
+    WINCE_LOG_API_CALL("chmod called\n");
     
     int retval = -1;
     
     if(NULL != inFilename)
     {
         unsigned short buffer[MAX_PATH];
         
         int convRes = a2w_buffer(inFilename, -1, buffer, sizeof(buffer) / sizeof(unsigned short));
@@ -88,19 +86,17 @@ MOZCE_SHUNT_API int chmod(const char* in
     }
     
     return retval;
 }
 
 
 MOZCE_SHUNT_API int isatty(int inHandle)
 {
-#ifdef API_LOGGING
-    mozce_printf("-- isatty called\n");
-#endif
+    WINCE_LOG_API_CALL("-- isatty called\n");
     
     int retval = 0;
     
     return retval;
 }
 
 
 #if 0
--- a/build/wince/shunt/mbstring.cpp
+++ b/build/wince/shunt/mbstring.cpp
@@ -48,71 +48,59 @@ extern "C" {
 /*
 **  One day, these multi-byte routines will need to really do thier job.
 **
 **  Right now, bail with a default implementation.
 */
 
 MOZCE_SHUNT_API unsigned char* _mbsinc(const unsigned char* inCurrent)
 {
-#ifdef API_LOGGING
-    mozce_printf("mbsinc called\n");
-#endif
+    WINCE_LOG_API_CALL("mbsinc called\n");
     //IsDBCSLeadByte(path[len-1])
     return (unsigned char*)(inCurrent + 1);
 }
 
 
 MOZCE_SHUNT_API unsigned char* _mbspbrk(const unsigned char* inString, const unsigned char* inStrCharSet)
 {
-#ifdef API_LOGGING
-    mozce_printf("mbspbrk called\n");
-#endif
+    WINCE_LOG_API_CALL("mbspbrk called\n");
 
     LPWSTR wstring = a2w_malloc((const char *)inString, -1, NULL);
     LPWSTR wset    = a2w_malloc((const char *)inStrCharSet, -1, NULL);
     LPWSTR result  = wcspbrk(wstring, wset);
     free(wstring);
     free(wset);
     return (unsigned char *)result;
 }
 
 
 MOZCE_SHUNT_API unsigned char* mbsrchr(const unsigned char* inString, unsigned int inC)
 {
-#ifdef API_LOGGING
-    mozce_printf("mbsrchr called\n");
-#endif
+    WINCE_LOG_API_CALL("mbsrchr called\n");
 
     return (unsigned char*) strrchr((char*)inString, inC);
 }
 
 
 MOZCE_SHUNT_API unsigned char* mbschr(const unsigned char* inString, unsigned int inC)
 {
-#ifdef API_LOGGING
-    mozce_printf("mbschr called\n");
-#endif
+    WINCE_LOG_API_CALL("mbschr called\n");
     return (unsigned char*)strchr((const char*)inString, (int)inC);
 }
 
 
 MOZCE_SHUNT_API int mbsicmp(const unsigned char *string1, const unsigned char *string2)
 {
-#ifdef API_LOGGING
-    mozce_printf("mbsicmp called\n");
-#endif
+    WINCE_LOG_API_CALL("mbsicmp called\n");
     return _stricmp((const char*)string1, (const char*)string2);
 }
 
 MOZCE_SHUNT_API unsigned char* mbsdec(const unsigned char *string1, const unsigned char *string2)
 {
-#ifdef API_LOGGING
-    mozce_printf("mbsdec called\n");
-#endif
+    WINCE_LOG_API_CALL("mbsdec called\n");
     
     if (string1 == string2)
         return 0;
     
     return (unsigned char *)string2 - 1;
 }
 
 #if 0
--- a/build/wince/shunt/mozce_internal.h
+++ b/build/wince/shunt/mozce_internal.h
@@ -150,16 +150,44 @@ char* w2a_malloc(unsigned short* inWideS
 
 // We use this API internally as well as externally.
 #ifdef __cplusplus
 extern "C" {
 #endif
 
 	MOZCE_SHUNT_API int mozce_printf(const char *, ...);
 
+#ifdef SHUNT_LOG_ENABLED
+    void mozce_DebugInit();
+    void mozce_DebugDeinit();
+    void mozce_DebugWriteToLog(char * str);
+#endif
+
+#ifdef API_LOGGING
+
+#ifdef WINCE_MEMORY_CHECKPOINTING
+    MOZCE_SHUNT_API void mozce_MemoryCheckpoint();
+
+#define WINCE_LOG_API_CALL(x)          mozce_MemoryCheckpoint(); mozce_printf(x)
+#define WINCE_LOG_API_CALL_1(x,y)      mozce_MemoryCheckpoint(); mozce_printf(x,y)
+#define WINCE_LOG_API_CALL_2(x,y,z)    mozce_MemoryCheckpoint(); mozce_printf(x,y,z)
+#else
+#define WINCE_LOG_API_CALL(x)          mozce_printf(x)
+#define WINCE_LOG_API_CALL_1(x,y)      mozce_printf(x,y)
+#define WINCE_LOG_API_CALL_2(x,y,z)    mozce_printf(x,y,z)
+#endif
+
+#else
+
+#define WINCE_LOG_API_CALL(x)
+#define WINCE_LOG_API_CALL_1(x,y)
+#define WINCE_LOG_API_CALL_2(x,y,z)
+
+#endif          // #ifdef API_LOGGING
+
 #ifdef __cplusplus
 };
 #endif
 
 int nclog (const char *fmt, ...);
 void nclograw(const char* data, long length);
 
 #endif /* __mozce_internal_h */
--- a/build/wince/shunt/process.cpp
+++ b/build/wince/shunt/process.cpp
@@ -48,54 +48,49 @@ extern "C" {
 #if 0
 }
 #endif
 
 #include "kfuncs.h"
 
 MOZCE_SHUNT_API void abort(void)
 {
-#ifdef API_LOGGING
-    mozce_printf("abort called\n");
-#endif
+    WINCE_LOG_API_CALL("abort called\n");
 
 #if defined(DEBUG)
     DebugBreak();
 #endif
     TerminateProcess((HANDLE) GetCurrentProcessId(), 3);
 }
 
 
 MOZCE_SHUNT_API char* getenv(const char* inName)
 {
     return map_get(inName);
 }
 
 MOZCE_SHUNT_API int putenv(const char *a)
 {
-#ifdef API_LOGGING
-    mozce_printf("putenv called %s\n",a);
-#endif
+    WINCE_LOG_API_CALL_1("mozce_PutEnv called %s\n",a);
+
     int len = strlen(a);
     char* key = (char*) malloc(len*sizeof(char));
     strcpy(key,a);
     char* val = strchr(key,'=');
     val[0] = '\0';
     int rv;
     val++;
     rv = map_put(key,val);
     free(key);
     return rv;
 }
 
 MOZCE_SHUNT_API int getpid(void)
 {
-#ifdef API_LOGGING
-    mozce_printf("getpid called\n");
-#endif
+    WINCE_LOG_API_CALL("getpid called\n");
     
     int retval = 0;
     
     retval = (int)GetCurrentProcessId();
     
     return retval;
 }
 
--- a/build/wince/shunt/signal.cpp
+++ b/build/wince/shunt/signal.cpp
@@ -54,19 +54,17 @@ static void defaultSighandler(int inSign
     // From process.cpp
     extern void abort(void);
     abort();
 }
 
 
 MOZCE_SHUNT_API int raise(int inSignal)
 {
-#ifdef API_LOGGING
-    mozce_printf("raise called\n");
-#endif
+    WINCE_LOG_API_CALL("raise called\n");
 
     void (*handler)(int inSignal) = defaultSighandler;
 
     if(inSignal >= 0 && inSignal < _SIGCOUNT)
     {
         if(NULL != sigArray[inSignal])
         {
             handler = sigArray[inSignal];
@@ -75,19 +73,17 @@ MOZCE_SHUNT_API int raise(int inSignal)
 
     handler(inSignal);
     return 0;
 }
 
 
 MOZCE_SHUNT_API _sigsig signal(int inSignal, _sigsig inFunc)
 {
-#ifdef API_LOGGING
-    mozce_printf("signal called\n");
-#endif
+    WINCE_LOG_API_CALL("signal called\n");
 
     void (*retval)(int inSignal) = defaultSighandler;
 
     if(inSignal >= 0 && inSignal < _SIGCOUNT)
     {
         if(NULL != sigArray[inSignal])
         {
             retval = sigArray[inSignal];
--- a/build/wince/shunt/stat.cpp
+++ b/build/wince/shunt/stat.cpp
@@ -42,22 +42,46 @@
 #include "mozce_defs.h"
 #include "time_conversions.h"
 
 extern "C" {
 #if 0
 }
 #endif
 
+MOZCE_SHUNT_API int fstat(FILE* handle, struct stat* buff)
+{
+    WINCE_LOG_API_CALL("fstat called\n");
+
+    int position = ftell(handle);
+    if (position < 0)
+        return -1;
+
+    if (fseek(handle, 0, SEEK_END) < 0)
+        return -1;
+
+    buff->st_size = ftell(handle);
+
+    if (fseek(handle, position, SEEK_SET) < 0)
+        return -1;
+
+    if (buff->st_size < 0)
+        return -1;
+
+    buff->st_mode = _S_IFREG | _S_IREAD | _S_IWRITE | _S_IEXEC;
+    /* can't get time from a file handle on wince */
+    buff->st_ctime = 0;
+    buff->st_atime = 0;
+    buff->st_mtime = 0;
+    return 0;
+}
 
 MOZCE_SHUNT_API int stat(const char* inPath, struct stat* outStats)
 {
-#ifdef API_LOGGING
-        mozce_printf("stat called\n");
-#endif
+    WINCE_LOG_API_CALL("stat called\n");
     
     int retval = -1;
     
     if(NULL != outStats)
     {
         memset(outStats, 0, sizeof(struct stat));
         
         if(NULL != inPath)
@@ -68,17 +92,16 @@ MOZCE_SHUNT_API int stat(const char* inP
             if(0 != convRes)
             {
                 HANDLE readHandle;
                 WIN32_FIND_DATA findData;
                 readHandle = FindFirstFileW(wPath, &findData); 
                 
                 if (readHandle != INVALID_HANDLE_VALUE && readHandle != NULL)
                 {
-                    
                     retval = 0;
                     outStats->st_size = findData.nFileSizeLow;
                     
                     if(findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
                     {
                         outStats->st_mode = _S_IFDIR;
                     }
                     else
--- a/build/wince/shunt/stdio.cpp
+++ b/build/wince/shunt/stdio.cpp
@@ -90,72 +90,59 @@ int
     }
     
     return -1;
 }
 
 
 MOZCE_SHUNT_API int _waccess(const wchar_t *path, int mode)
 {
-#ifdef API_LOGGING
-    mozce_printf("-- _waccess called\n");
-#endif
+    WINCE_LOG_API_CALL("-- _waccess called\n");
     
     return 0;
 }
 
 
 MOZCE_SHUNT_API int access(const char *path, int mode)
 {
-#ifdef API_LOGGING
-    mozce_printf("-- access called\n");
-#endif
+    WINCE_LOG_API_CALL("-- access called\n");
     
     return 0;
 }
 
 MOZCE_SHUNT_API void rewind(FILE* inStream)
 {
-#ifdef API_LOGGING
-        mozce_printf("rewind called\n");
-#endif
+    WINCE_LOG_API_CALL("rewind called\n");
     
     fseek(inStream, 0, SEEK_SET);
 }
 
 
 MOZCE_SHUNT_API FILE* fdopen(int fd, const char* inMode)
 {
-#ifdef API_LOGGING
-        mozce_printf("-- fdopen called (mode is ignored!) \n");
-#endif
-    
+    WINCE_LOG_API_CALL("-- fdopen called (mode is ignored!) \n");
     
     if(fd < 0 || fd >= MAXFDS || _fdtab[fd].fd == -1)
         return 0;
     
     return _fdtab[fd].file;
 }
 
 
 MOZCE_SHUNT_API void perror(const char* inString)
 {
-#ifdef API_LOGGING
-        mozce_printf("perror called\n");
-#endif
+    WINCE_LOG_API_CALL("perror called\n");
     
     fprintf(stderr, "%s", inString);
 }
 
 
 MOZCE_SHUNT_API int remove(const char* inPath)
 {
-#ifdef API_LOGGING
-        mozce_printf("remove called on %s\n", inPath);
-#endif
+    WINCE_LOG_API_CALL_1("remove called on %s\n", inPath);
     
     int retval = -1;
     
     if(NULL != inPath)
     {
         unsigned short wPath[MAX_PATH];
         
         if(0 != a2w_buffer(inPath, -1, wPath, sizeof(wPath) / sizeof(unsigned short)))
@@ -168,19 +155,18 @@ MOZCE_SHUNT_API int remove(const char* i
         }
     }
     
     return retval;
 }
 
 MOZCE_SHUNT_API char* getcwd(char* buff, size_t size)
 {
-#ifdef API_LOGGING
-        mozce_printf("getcwd called.\n");
-#endif
+    WINCE_LOG_API_CALL("getcwd called.\n");
+
     int i;
     unsigned short dir[MAX_PATH];
     GetModuleFileName(GetModuleHandle (NULL), dir, MAX_PATH);
     for (i = _tcslen(dir); i && dir[i] != TEXT('\\'); i--) {}
     dir[i + 1] = TCHAR('\0');
     
     w2a_buffer(dir, -1, buff, size);
     
@@ -198,16 +184,20 @@ MOZCE_SHUNT_API int mozce_printf(const c
     
     va_list ptr;
     va_start(ptr,format);
     vsprintf(buf,format,ptr);
     
     mbstowcs(tBuf, buf, MAX_CHARS_IN_VARIABLE_STRING);
     
     OutputDebugString(tBuf);
+
+#ifdef SHUNT_LOG_ENABLED
+    mozce_DebugWriteToLog(buf);
+#endif
     
     return 1;
     //#endif
 
     return 0;
 }
 
 static void mode2binstr(int mode, char* buffer)
@@ -235,19 +225,17 @@ static void mode2binstr(int mode, char* 
     else if (mode & O_RDONLY)
     {
         strcpy(buffer, "rb");
     }
 }
 
 MOZCE_SHUNT_API int open(const char *pathname, int flags, int mode)
 {
-#ifdef API_LOGGING
-        mozce_printf("open called\n");
-#endif
+    WINCE_LOG_API_CALL("open called\n");
     
     _initfds();
     
     
     char modestr[10];
     *modestr = '\0';
     
     mode2binstr(mode, modestr);
@@ -271,83 +259,68 @@ MOZCE_SHUNT_API int open(const char *pat
     }
     
     return fd;
 }
 
 
 MOZCE_SHUNT_API int close(int fd)
 {
-#ifdef API_LOGGING
-        mozce_printf("close called\n");
-#endif
-    
-    
-    
+    WINCE_LOG_API_CALL("close called\n");
     
     if(fd < 0 || fd >= MAXFDS || _fdtab[fd].fd == -1)
         return -1;
     
-    
     fclose(_fdtab[fd].file);
     _fdtab[fd].fd = -1;
     
     return 0;
 }
 
 MOZCE_SHUNT_API size_t read(int fd, void* buffer, size_t count)
 {
-#ifdef API_LOGGING
-        mozce_printf("read called\n");
-#endif
+    WINCE_LOG_API_CALL("read called\n");
     
     if(fd < 0 || fd >= MAXFDS || _fdtab[fd].fd == -1)
         return -1;
     
     size_t num = fread(buffer, 1, count, _fdtab[fd].file);
     
     if (ferror(_fdtab[fd].file))
         return -1;
     
     return num;
 }
 
 
 MOZCE_SHUNT_API size_t write(int fd, const void* buffer, size_t count)
 {
-#ifdef API_LOGGING
-        mozce_printf("write called\n");
-#endif
+    WINCE_LOG_API_CALL("write called\n");
     
     if(fd < 0 || fd >= MAXFDS || _fdtab[fd].fd == -1)
         return -1;
     
     size_t num = fwrite(buffer, 1, count, _fdtab[fd].file);
     if (ferror(_fdtab[fd].file))
         return -1;
     
     return num;
 }
 
 
 MOZCE_SHUNT_API int unlink(const char *pathname)
 {
-#ifdef API_LOGGING
-        mozce_printf("unlink called\n");
-#endif
+    WINCE_LOG_API_CALL("unlink called\n");
     return remove(pathname);
 }
 
 
 MOZCE_SHUNT_API int lseek(int fd, int offset, int whence)
 {
-#ifdef API_LOGGING
-        mozce_printf("lseek called\n");
-#endif
-    
+    WINCE_LOG_API_CALL("lseek called\n");
     
     if(fd < 0 || fd >= MAXFDS || _fdtab[fd].fd == -1)
         return -1;
     
     int newpos = -1;
     int error = fseek(_fdtab[fd].file, offset, whence);
     
     if (!error)
--- a/build/wince/shunt/stdlib.cpp
+++ b/build/wince/shunt/stdlib.cpp
@@ -48,19 +48,17 @@
 
 extern "C" {
 #if 0
 }
 #endif
 
 MOZCE_SHUNT_API char *fullpath(char *absPath, const char *relPath, size_t maxLength)
 {
-#ifdef API_LOGGING
-    mozce_printf("fullpath called\n");
-#endif
+    WINCE_LOG_API_CALL("fullpath called\n");
 
     if (relPath[0] != '\\') 
     {
         int i;
         unsigned short dir[MAX_PATH];
         GetModuleFileName(GetModuleHandle (NULL), dir, MAX_PATH);
         for (i = _tcslen(dir); i && dir[i] != TEXT('\\'); i--) {}
         
@@ -70,19 +68,18 @@ MOZCE_SHUNT_API char *fullpath(char *abs
     }
     strcpy(absPath, relPath);
     
     return absPath;
 }
 
 MOZCE_SHUNT_API void splitpath(const char* inPath, char* outDrive, char* outDir, char* outFname, char* outExt)
 {
-#ifdef API_LOGGING
-    mozce_printf("splitpath called\n");
-#endif
+    WINCE_LOG_API_CALL("splitpath called\n");
+
     if(NULL != outDrive)
     {
         *outDrive = '\0';
     }
     if(NULL != outDir)
     {
         *outDir = '\0';
     }
@@ -177,19 +174,18 @@ MOZCE_SHUNT_API void splitpath(const cha
             free(dup);
         }
     }
 }
 
 
 MOZCE_SHUNT_API void makepath(char* outPath, const char* inDrive, const char* inDir, const char* inFname, const char* inExt)
 {
-#ifdef API_LOGGING
-    mozce_printf("makepath called\n");
-#endif
+    WINCE_LOG_API_CALL("makepath called\n");
+
     if(NULL != outPath)
     {
         int dirLen = 0;
         if(NULL != inDir)
         {
             dirLen = strlen(inDir);
             if(dirLen)
             {
@@ -203,19 +199,18 @@ MOZCE_SHUNT_API void makepath(char* outP
                   (NULL != inExt && '.' != inExt[0]) ? "." : "",
                   (NULL != inExt) ? inExt : ""
                   );
     }
 }
 
 MOZCE_SHUNT_API int mozce_strcmpi(const char *dest, const char *src)
 {
-#ifdef API_LOGGING
-    mozce_printf("mozce_strcmpi called\n");
-#endif
+    WINCE_LOG_API_CALL("mozce_strcmpi called\n");
+
     int f,l;
     
     do {
         if ( ((f = (unsigned char)(*(dest++))) >= 'A') && (f <= 'Z') )
             f -= ('A' - 'a');
         
         if ( ((l = (unsigned char)(*(src++))) >= 'A') && (l <= 'Z') )
             l -= ('A' - 'a');
--- a/build/wince/shunt/string.cpp
+++ b/build/wince/shunt/string.cpp
@@ -42,19 +42,17 @@
 
 extern "C" {
 #if 0
 }
 #endif
 
 MOZCE_SHUNT_API char* strerror(int inErrno)
 {
-#ifdef API_LOGGING
-    mozce_printf("strerror called\n");
-#endif
+    WINCE_LOG_API_CALL("strerror called\n");
     return "Unknown Error";
 }
 
 #if 0
 {
 #endif
 } /* extern "C" */
 
--- a/build/wince/shunt/time.cpp
+++ b/build/wince/shunt/time.cpp
@@ -65,29 +65,24 @@ static const int sDaysOfYear[12] = {
 static struct tm tmStorage;
 
 #ifdef strftime
 #undef strftime
 #endif
 
 MOZCE_SHUNT_API size_t strftime(char *, size_t, const char *, const struct tm *)
 {
-#ifdef API_LOGGING
-    mozce_printf("mozce_strftime called\n");
-#endif
-
+    WINCE_LOG_API_CALL("mozce_strftime called\n");
     return 0;
 }
 
 
 MOZCE_SHUNT_API struct tm* mozce_localtime_r(const time_t* inTimeT,struct tm* outRetval)
 {
-#ifdef API_LOGGING
-    mozce_printf("tm* mozce_localtime_r called\n");
-#endif
+    WINCE_LOG_API_CALL("tm* mozce_localtime_r called\n");
 
     struct tm* retval = NULL;
 
     if(NULL != inTimeT && NULL != outRetval)
     {
         SYSTEMTIME winLocalTime;
         
         time_t_2_LOCALSYSTEMTIME(winLocalTime, *inTimeT);
@@ -124,29 +119,25 @@ MOZCE_SHUNT_API struct tm* mozce_localti
     }
 
     return retval;
 }
 
 
 MOZCE_SHUNT_API struct tm* localtime(const time_t* inTimeT)
 {
-#ifdef API_LOGGING
-    mozce_printf("tm* mozce_localtime called\n");
-#endif
+    WINCE_LOG_API_CALL("tm* mozce_localtime called\n");
 
     return mozce_localtime_r(inTimeT, &tmStorage);
 }
 
 
 MOZCE_SHUNT_API struct tm* mozce_gmtime_r(const time_t* inTimeT, struct tm* outRetval)
 {
-#ifdef API_LOGGING
-    mozce_printf("tm* mozce_gmtime_r called\n");
-#endif
+    WINCE_LOG_API_CALL("tm* mozce_gmtime_r called\n");
 
     struct tm* retval = NULL;
 
     if(NULL != inTimeT)
     {
         SYSTEMTIME winGMTime;
         
         time_t_2_SYSTEMTIME(winGMTime, *inTimeT);
@@ -183,29 +174,25 @@ MOZCE_SHUNT_API struct tm* mozce_gmtime_
     }
 
     return retval;
 }
 
 
 MOZCE_SHUNT_API struct tm* gmtime(const time_t* inTimeT)
 {
-#ifdef API_LOGGING
-    mozce_printf("tm* mozce_gmtime called\n");
-#endif
+    WINCE_LOG_API_CALL("tm* mozce_gmtime called\n");
 
     return mozce_gmtime_r(inTimeT, &tmStorage);
 }
 
 
 MOZCE_SHUNT_API time_t mktime(struct tm* inTM)
 {
-#ifdef API_LOGGING
-    mozce_printf("mozce_mktime called\n");
-#endif
+    WINCE_LOG_API_CALL("mozce_mktime called\n");
 
     time_t retval = (time_t)-1;
 
     if(NULL != inTM)
     {
         SYSTEMTIME winTime;
         struct tm* gmTime = NULL;
 
--- a/build/wince/shunt/win32.cpp
+++ b/build/wince/shunt/win32.cpp
@@ -62,23 +62,50 @@ extern "C" {
 #define MOZCE_NOT_IMPLEMENTED_RV(fname, rv) \
   SetLastError(0); \
   mozce_printf("-- " fname  " called\n"); \
   SetLastError(ERROR_CALL_NOT_IMPLEMENTED); \
   return rv;
 
 #define wcharcount(array) (sizeof(array) / sizeof(TCHAR))
 
+
+
+static int memory_checkpoint_count = 0;
+
+MOZCE_SHUNT_API void mozce_MemoryCheckpoint()
+{
+#ifdef API_LOGGING
+#ifdef WINCE_MEMORY_CHECKPOINTING
+    MEMORYSTATUS memInfo;
+    STORE_INFORMATION si;
+
+    // Program memory.
+    memInfo.dwLength = sizeof(memInfo);
+    GlobalMemoryStatus(&memInfo);
+    GetStoreInformation(&si);
+    // OUTPUT: MEM_CHECKPOINT_STRING, counter, Storage Memory Free, RAM TOTAL, RAM FREE, RAM USED
+    // Can then grep for "MEM, ", put all those lines into one file,
+    // save the file, and use the resulting text file as 
+    // comma-delimited-text-file input into excel.
+    //   -- wolfe@lobo.us
+    if (memory_checkpoint_count == 0)
+        mozce_printf("MEM, counter, Storage Memory Free, RAM TOTAL, RAM FREE, RAM USED\n");
+
+    mozce_printf("MEM, %d, %d, %d, %d, %d\n", memory_checkpoint_count, si.dwFreeSize, memInfo.dwTotalPhys, memInfo.dwAvailPhys, memInfo.dwTotalPhys - memInfo.dwAvailPhys);
+    memory_checkpoint_count++;
+#endif
+#endif
+}
+
 /*this is defined in the WM6 header commdlg.h, but the sdk is missing commdlg.lib*/
 
 MOZCE_SHUNT_API DWORD CommDlgExtendedError()
 {
-#ifdef API_LOGGING
-    mozce_printf("CommDlgExtendedError called\n");
-#endif
+    WINCE_LOG_API_CALL("CommDlgExtendedError called\n");
     
     return -1 /*CDERR_DIALOGFAILURE*/;
 }
 
 
 MOZCE_SHUNT_API HBITMAP CreateDIBitmap(HDC inDC, CONST BITMAPINFOHEADER *inBMIH, DWORD inInit, CONST VOID *inBInit, CONST BITMAPINFO *inBMI, UINT inUsage)
 {
     MOZCE_NOT_IMPLEMENTED(__FUNCTION__);
@@ -114,19 +141,17 @@ MOZCE_SHUNT_API BOOL LPtoDP(HDC inDC, LP
 
 MOZCE_SHUNT_API BOOL LineDDA(int inXStart, int inYStart, int inXEnd, int inYEnd, LINEDDAPROC inLineFunc, LPARAM inData)
 {
     MOZCE_NOT_IMPLEMENTED(__FUNCTION__);
 }
 
 MOZCE_SHUNT_API int ExtSelectClipRgn(HDC inDC, HRGN inRGN, int inMode)
 {
-#ifdef API_LOGGING
-    mozce_printf("ExtSelectClipRgn called\n");
-#endif
+    WINCE_LOG_API_CALL("ExtSelectClipRgn called\n");
 
     // inModes are defined as:
     // RGN_AND = 1
     // RGN_OR = 2
     // RGN_XOR = 3
     // RGN_DIFF = 4
     // RGN_COPY = 5
 
@@ -180,19 +205,17 @@ MOZCE_SHUNT_API int ExtSelectClipRgn(HDC
     DeleteObject(rgn);
 
     return result;
 }
 
 
 MOZCE_SHUNT_API int FrameRect(HDC inDC, CONST RECT *inRect, HBRUSH inBrush)
 {
-#ifdef API_LOGGING
-    mozce_printf("FrameRect called\n");
-#endif
+    WINCE_LOG_API_CALL("FrameRect called\n");
 
     HBRUSH oldBrush = (HBRUSH)SelectObject(inDC, inBrush);
     RECT myRect = *inRect;
     InflateRect(&myRect, 1, 1); // The width and height of
                                 // the border are always one
                                 // logical unit.
 
     // 1  ---->   2
@@ -217,38 +240,33 @@ MOZCE_SHUNT_API int FrameRect(HDC inDC, 
 
     return 1;
 }
 
 
 
 MOZCE_SHUNT_API UINT GetTextCharset(HDC inDC)
 {
-
-#ifdef API_LOGGING
-    mozce_printf("GetTextCharset called\n");
-#endif
+    WINCE_LOG_API_CALL("GetTextCharset called\n");
 
     UINT retval = DEFAULT_CHARSET;
 
     TEXTMETRIC tm;
     if(GetTextMetrics(inDC, &tm))
     {
         retval = tm.tmCharSet;
     }
 
     return retval;
 }
 
 
 MOZCE_SHUNT_API UINT GetTextCharsetInfo(HDC inDC, LPFONTSIGNATURE outSig, DWORD inFlags)
 {
-#ifdef API_LOGGING
-    mozce_printf("GetTextCharsetInfo called\n");
-#endif
+    WINCE_LOG_API_CALL("GetTextCharsetInfo called\n");
 
     // Zero out the FONTSIGNATURE as we do not know how to fill it out properly.
     if(NULL != outSig)
     {
         memset(outSig, 0, sizeof(FONTSIGNATURE));
     }
 
     return GetTextCharset(inDC);
@@ -278,46 +296,40 @@ static int CALLBACK collectProc(CONST LO
         }
     }
 
     return retval;
 }
 
 MOZCE_SHUNT_API int GetMapMode(HDC inDC)
 {
-#ifdef API_LOGGING
-    mozce_printf("GetMapMode called\n");
-#endif
+    WINCE_LOG_API_CALL("GetMapMode called\n");
 
     int retval = MM_TEXT;
     return retval;
 }
 
 
 
 MOZCE_SHUNT_API LONG RegCreateKey(HKEY inKey, LPCTSTR inSubKey, PHKEY outResult)
 {
-#ifdef API_LOGGING
-    mozce_printf("RegCreateKey called\n");
-#endif
+    WINCE_LOG_API_CALL("RegCreateKey called\n");
 
     LONG retval = ERROR_SUCCESS;
     DWORD disp = 0;
 
     retval = RegCreateKeyEx(inKey, inSubKey, 0, NULL, 0, 0, NULL, outResult, &disp);
 
     return retval;
 }
 
 
 MOZCE_SHUNT_API BOOL WaitMessage(VOID)
 {
-#ifdef API_LOGGING
-    mozce_printf("WaitMessage called\n");
-#endif
+    WINCE_LOG_API_CALL("WaitMessage called\n");
 
     BOOL retval = TRUE;
 
     HANDLE hThread = GetCurrentThread();
     DWORD waitRes = MsgWaitForMultipleObjectsEx(1, &hThread, INFINITE, QS_ALLEVENTS, 0);
     if((DWORD)-1 == waitRes)
     {
         retval = FALSE;
@@ -349,19 +361,17 @@ static BOOL CALLBACK MyEnumWindowsProc(H
         return myParams->func(hwnd, myParams->params);
     }
 
     return TRUE;
 }
 
 MOZCE_SHUNT_API BOOL EnumChildWindows(HWND inParent, WNDENUMPROC inFunc, LPARAM inParam)
 {
-#ifdef API_LOGGING
-    mozce_printf("EnumChildWindows called\n");
-#endif
+    WINCE_LOG_API_CALL("EnumChildWindows called\n");
 
     ECWWindows myParams;
     myParams.params = inParam;
     myParams.func   = inFunc;
     myParams.parent = inParent;
 
     return EnumWindows(MyEnumWindowsProc, (LPARAM) &myParams);
 }
@@ -376,19 +386,17 @@ MOZCE_SHUNT_API BOOL EnumThreadWindows(D
 MOZCE_SHUNT_API BOOL IsIconic(HWND inWnd)
 {
     return false;
 }
 
 
 MOZCE_SHUNT_API BOOL OpenIcon(HWND inWnd)
 {
-#ifdef API_LOGGING
-    mozce_printf("OpenIcon called\n");
-#endif
+    WINCE_LOG_API_CALL("OpenIcon called\n");
     return SetActiveWindow(inWnd) ? 1:0;
 }
 
 
 MOZCE_SHUNT_API HHOOK SetWindowsHookEx(int inType, void* inFunc, HINSTANCE inMod, DWORD inThreadId)
 {
    MOZCE_NOT_IMPLEMENTED_RV(__FUNCTION__, NULL);
 }
@@ -411,37 +419,33 @@ MOZCE_SHUNT_API BOOL InvertRgn(HDC inDC,
 {
    MOZCE_NOT_IMPLEMENTED_RV(__FUNCTION__, FALSE);
 
 }
 
 
 MOZCE_SHUNT_API int GetScrollPos(HWND inWnd, int inBar)
 {
-#ifdef API_LOGGING
-    mozce_printf("GetScrollPos called\n");
-#endif
+    WINCE_LOG_API_CALL("GetScrollPos called\n");
 
     int retval = 0;
     SCROLLINFO info;
 
     if(GetScrollInfo(inWnd, inBar, &info))
     {
         return info.nPos;
     }
 
     return retval;
 }
 
 
 MOZCE_SHUNT_API BOOL GetScrollRange(HWND inWnd, int inBar, LPINT outMinPos, LPINT outMaxPos)
 {
- #ifdef API_LOGGING
-    mozce_printf("GetScrollRange called\n");
-#endif
+    WINCE_LOG_API_CALL("GetScrollRange called\n");
 
     BOOL retval = FALSE;
     SCROLLINFO info;
 
     if((retval = GetScrollInfo(inWnd, inBar, &info)))
     {
         if(NULL != outMinPos)
         {
@@ -454,19 +458,17 @@ MOZCE_SHUNT_API BOOL GetScrollRange(HWND
     }
 
     return retval;
 }
 
 
 MOZCE_SHUNT_API HRESULT CoLockObjectExternal(IUnknown* inUnk, BOOL inLock, BOOL inLastUnlockReleases)
 {
-#ifdef API_LOGGING
-    mozce_printf("CoLockObjectExternal called\n");
-#endif
+    WINCE_LOG_API_CALL("CoLockObjectExternal called\n");
 
     HRESULT retval = S_OK;
 
     if(NULL != inUnk)
     {
         if(FALSE == inLock)
         {
             inUnk->Release();
@@ -538,42 +540,36 @@ MOZCE_SHUNT_API DWORD GetEnvironmentVari
     return GetEnvironmentVariableW((LPCWSTR)lpName,(LPWSTR)lpBuffer,nSize);
 #else
 	return get(lpName,lpBuffer);
 #endif
 }
 
 MOZCE_SHUNT_API void GetSystemTimeAsFileTime(LPFILETIME lpSystemTimeAsFileTime)
 {
-#ifdef API_LOGGING
-    mozce_printf("GetSystemTimeAsFileTime called\n");
-#endif
+    WINCE_LOG_API_CALL("GetSystemTimeAsFileTime called\n");
 
     SYSTEMTIME st;
     GetSystemTime(&st);
     SystemTimeToFileTime(&st,lpSystemTimeAsFileTime);
 }
 
 MOZCE_SHUNT_API DWORD GetLongPathNameW(LPCWSTR lpszShortPath, LPCWSTR lpszLongPath, DWORD cchBuffer)
 {
-#ifdef API_LOGGING
-    mozce_printf("GetLongPathNameW called\n");
-#endif
+    WINCE_LOG_API_CALL("GetLongPathNameW called\n");
 
     return 0;
 }
 
 MOZCE_SHUNT_API DWORD GetFullPathName(const char* lpFileName,
                                       DWORD nBufferLength,
                                       const char* lpBuffer,
                                       const char** lpFilePart)
 {
-#ifdef API_LOGGING
-    mozce_printf("GetFullPathName called\n");
-#endif
+    WINCE_LOG_API_CALL("GetFullPathName called\n");
 
     DWORD len = strlen(lpFileName);
     if (len > nBufferLength)
         return len;
 
     strncpy((char*)lpBuffer, lpFileName, len);
     ((char*)lpBuffer)[len] = '\0';
 
@@ -583,65 +579,57 @@ MOZCE_SHUNT_API DWORD GetFullPathName(co
         if (sep) {
             sep++; // pass the seperator
             *lpFilePart = sep;
         }
         else
             *lpFilePart = lpBuffer;
     }
 
-#ifdef API_LOGGING
-    mozce_printf("GetFullPathName called %s (%s)\n", lpBuffer, *lpFilePart);
-#endif
+    WINCE_LOG_API_CALL_2("GetFullPathName called %s (%s)\n", lpBuffer, *lpFilePart);
     return len;
 }
 
 static LONG gGetMessageTime = 0;
 
 MOZCE_SHUNT_API BOOL mozce_GetMessage(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax )
 {
     SetLastError(0);
 
-#ifdef API_LOGGING
-    mozce_printf("mozce_GetMessage called\n");
-#endif
+    WINCE_LOG_API_CALL("mozce_GetMessage called\n");
 
     BOOL b = GetMessage(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMin);
 
     if (b)
         gGetMessageTime = lpMsg->time;
 
     return b;
 }
 
 
 MOZCE_SHUNT_API BOOL mozce_PeekMessage(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax, UINT wRemoveMsg)
 {
     SetLastError(0);
 
-#ifdef API_LOGGING
-    mozce_printf("mozce_PeekMessageA called\n");
-#endif
+    WINCE_LOG_API_CALL("mozce_PeekMessageA called\n");
 
     BOOL b = PeekMessageW(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax, wRemoveMsg);
 
     if (b && wRemoveMsg == PM_REMOVE)
         gGetMessageTime = lpMsg->time;
 
     return b;
 }
 
 
 MOZCE_SHUNT_API LONG GetMessageTime(void)
 {
     SetLastError(0);
 
-#ifdef API_LOGGING
-    mozce_printf("GetMessageTime called\n");
-#endif
+    WINCE_LOG_API_CALL("GetMessageTime called\n");
 
   return gGetMessageTime;
 }
 
 MOZCE_SHUNT_API DWORD ExpandEnvironmentStrings(LPCTSTR lpSrc, LPTSTR lpDst, DWORD nSize)
 {
     MOZCE_NOT_IMPLEMENTED_RV(__FUNCTION__, 0);
 }
@@ -655,19 +643,17 @@ MOZCE_SHUNT_API BOOL GdiFlush(void)
 {
     return TRUE;
 }
 
 MOZCE_SHUNT_API BOOL GetWindowPlacement(HWND hWnd, WINDOWPLACEMENT *lpwndpl)
 {
     SetLastError(0);
 
-#ifdef API_LOGGING
-    mozce_printf("GetWindowPlacement called\n");
-#endif
+    WINCE_LOG_API_CALL("GetWindowPlacement called\n");
 
    memset(lpwndpl, 0, sizeof(WINDOWPLACEMENT));
 
    // This is wrong when the window is minimized.
    lpwndpl->showCmd = SW_SHOWNORMAL;
    GetWindowRect(hWnd, &lpwndpl->rcNormalPosition);
 
    return TRUE;
@@ -707,22 +693,19 @@ MOZCE_SHUNT_API HINSTANCE ShellExecute(H
     if (dir)
         free(dir);
 
     return (HINSTANCE) info.hProcess;
 }
 
 MOZCE_SHUNT_API HINSTANCE ShellExecuteW(HWND hwnd, LPCWSTR lpOperation, LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd)
 {
-
     SetLastError(0);
 
-#ifdef API_LOGGING
-    mozce_printf("ShellExecuteW called\n");
-#endif
+    WINCE_LOG_API_CALL("ShellExecuteW called\n");
 
     SHELLEXECUTEINFO info;
     info.cbSize = sizeof(SHELLEXECUTEINFO);
     info.fMask  = SEE_MASK_NOCLOSEPROCESS;
     info.hwnd   = hwnd;
     info.lpVerb = lpOperation;
     info.lpFile = lpFile;
     info.lpParameters = lpParameters;
@@ -753,19 +736,17 @@ struct lconv s_locale_conv =
     1,     /* n_cs_precedes */
     1,     /* n_sep_by_space */
     1,     /* p_sign_posn */
     1,     /* n_sign_posn */
 };
 
 MOZCE_SHUNT_API struct lconv * mozce_localeconv(void)
 {
-#ifdef API_LOGGING
-    mozce_printf("mozce_localeconv called\n");
-#endif
+    WINCE_LOG_API_CALL("mozce_localeconv called\n");
     return &s_locale_conv;
 }
 
 MOZCE_SHUNT_API BOOL CreatePipe(PHANDLE hReadPipe, PHANDLE hWritePipe, LPSECURITY_ATTRIBUTES lpPipeAttributes, DWORD nSize)
 {
     MOZCE_NOT_IMPLEMENTED_RV(__FUNCTION__, FALSE);
 }
 MOZCE_SHUNT_API DWORD_PTR SetThreadAffinityMask(HANDLE hThread, DWORD_PTR dwThreadAffinityMask)
@@ -1050,19 +1031,17 @@ MOZCE_SHUNT_API int WINAPI SetMapMode(HD
 
 MOZCE_SHUNT_API DWORD WINAPI GetCharacterPlacementW(  __in HDC hdc, __in_ecount(nCount) LPCWSTR lpString, __in int nCount, __in int nMexExtent, __inout LPGCP_RESULTSW lpResults, __in DWORD dwFlags)
 {
     MOZCE_NOT_IMPLEMENTED(__FUNCTION__);
 }
 
 MOZCE_SHUNT_API wchar_t* wgetcwd(wchar_t* dir, size_t size)
 {
-#ifdef API_LOGGING
-        mozce_printf("getcwd called.\n");
-#endif
+    WINCE_LOG_API_CALL("getcwd called.\n");
     int i;
 
     GetModuleFileName(GetModuleHandle (NULL), dir, MAX_PATH);
     for (i = _tcslen(dir); i && dir[i] != TEXT('\\'); i--) {}
     dir[i + 1] = TCHAR('\0');
 
     return dir;
 }
@@ -1079,19 +1058,17 @@ MOZCE_SHUNT_API int  _wrmdir(const wchar
 
 MOZCE_SHUNT_API int _wremove(const wchar_t * _Filename)
 {
     return ::DeleteFileW(_Filename);
 }
 
 MOZCE_SHUNT_API int wchmod(const wchar_t * buffer, int inMode)
 {
-#ifdef API_LOGGING
-    mozce_printf("wchmod called\n");
-#endif
+    WINCE_LOG_API_CALL("wchmod called\n");
 
     int retval = -1;
 
     if(NULL != buffer)
     {
 
             DWORD attribs = 0;
 
@@ -1194,12 +1171,30 @@ MOZCE_SHUNT_API HWND GetAncestor(HWND hw
             break;
         default:
             return NULL;
     }
 
     return(hwndParent);
 }
 
+MOZCE_SHUNT_API BOOL InitializeAcl(PACL apAcl, DWORD len, DWORD rev)
+{
+    return FALSE;
+}
+
+MOZCE_SHUNT_API DWORD SetNamedSecurityInfoW(unsigned short* pObjectName,
+                                            SE_OBJECT_TYPE ObjectType,
+                                            SECURITY_INFORMATION SecurityInfo,
+                                            PSID psidOwner,
+                                            PSID psidGroup,
+                                            PACL pDacl,
+                                            PACL pSacl)
+{
+    return 0;
+}
+
+
+
 #if 0
 {
 #endif
 } /* extern "C" */
--- a/content/base/src/nsDocument.cpp
+++ b/content/base/src/nsDocument.cpp
@@ -5256,31 +5256,36 @@ BlastSubtreeToPieces(nsINode *aNode)
   if (aNode->IsNodeOfType(nsINode::eELEMENT)) {
     nsGenericElement *element = static_cast<nsGenericElement*>(aNode);
     const nsDOMAttributeMap *map = element->GetAttributeMap();
     if (map) {
       nsCOMPtr<nsIAttribute> attr;
       while (map->Enumerate(BlastFunc, &attr) > 0) {
         BlastSubtreeToPieces(attr);
 
-        nsresult rv = element->UnsetAttr(attr->NodeInfo()->NamespaceID(),
-                                         attr->NodeInfo()->NameAtom(),
-                                         PR_FALSE);
+#ifdef DEBUG
+        nsresult rv =
+#endif
+          element->UnsetAttr(attr->NodeInfo()->NamespaceID(),
+                             attr->NodeInfo()->NameAtom(),
+                             PR_FALSE);
 
         // XXX Should we abort here?
         NS_ASSERTION(NS_SUCCEEDED(rv), "Uhoh, UnsetAttr shouldn't fail!");
       }
     }
   }
 
   count = aNode->GetChildCount();
   for (i = 0; i < count; ++i) {
     BlastSubtreeToPieces(aNode->GetChildAt(0));
-
-    nsresult rv = aNode->RemoveChildAt(0, PR_FALSE);
+#ifdef DEBUG
+    nsresult rv =
+#endif
+      aNode->RemoveChildAt(0, PR_FALSE);
 
     // XXX Should we abort here?
     NS_ASSERTION(NS_SUCCEEDED(rv), "Uhoh, RemoveChildAt shouldn't fail!");
   }
 }
 
 NS_IMETHODIMP
 nsDocument::AdoptNode(nsIDOMNode *aAdoptedNode, nsIDOMNode **aResult)
--- a/content/base/src/nsObjectLoadingContent.cpp
+++ b/content/base/src/nsObjectLoadingContent.cpp
@@ -1674,17 +1674,17 @@ nsObjectLoadingContent::TryInstantiate(c
 {
   nsIObjectFrame* frame = GetExistingFrame(eFlushContent);
   if (!frame) {
     LOG(("OBJLC [%p]: No frame yet\n", this));
     return NS_OK; // Not a failure to have no frame
   }
 
   nsCOMPtr<nsIPluginInstance> instance;
-  nsresult rv = frame->GetPluginInstance(*getter_AddRefs(instance));
+  frame->GetPluginInstance(*getter_AddRefs(instance));
 
   if (!instance) {
     // The frame has no plugin instance yet. If the frame hasn't been
     // reflown yet, do nothing as once the reflow happens we'll end up
     // instantiating the plugin with the correct size n' all (which
     // isn't known until we've done the first reflow). But if the
     // frame does have a plugin instance already, be sure to
     // re-instantiate the plugin as its source or whatnot might have
--- a/content/canvas/src/nsCanvasRenderingContext2D.cpp
+++ b/content/canvas/src/nsCanvasRenderingContext2D.cpp
@@ -2148,17 +2148,20 @@ nsCanvasRenderingContext2D::GetMozTextSt
     // font and mozTextStyle are the same value
     return GetFont(textStyle);
 }
 
 gfxFontGroup *nsCanvasRenderingContext2D::GetCurrentFontStyle()
 {
     // use lazy initilization for the font group since it's rather expensive
     if(!CurrentState().fontGroup) {
-        nsresult res = SetMozTextStyle(NS_LITERAL_STRING("10px sans-serif"));
+#ifdef DEBUG
+        nsresult res =
+#endif
+            SetMozTextStyle(NS_LITERAL_STRING("10px sans-serif"));
         NS_ASSERTION(res == NS_OK, "Default canvas font is invalid");
     }
 
     return CurrentState().fontGroup;
 }
 
 NS_IMETHODIMP
 nsCanvasRenderingContext2D::MozDrawText(const nsAString& textToDraw)
--- a/content/html/document/src/nsImageDocument.cpp
+++ b/content/html/document/src/nsImageDocument.cpp
@@ -366,17 +366,20 @@ nsImageDocument::SetScriptGlobalObject(n
 
   // Set the script global object on the superclass before doing
   // anything that might require it....
   nsHTMLDocument::SetScriptGlobalObject(aScriptGlobalObject);
 
   if (aScriptGlobalObject) {
     if (!GetRootContent()) {
       // Create synthetic document
-      nsresult rv = CreateSyntheticDocument();
+#ifdef DEBUG
+      nsresult rv =
+#endif
+        CreateSyntheticDocument();
       NS_ASSERTION(NS_SUCCEEDED(rv), "failed to create synthetic document");
 
       target = do_QueryInterface(mImageContent);
       target->AddEventListener(NS_LITERAL_STRING("click"), this, PR_FALSE);
     }
 
     target = do_QueryInterface(aScriptGlobalObject);
     target->AddEventListener(NS_LITERAL_STRING("resize"), this, PR_FALSE);
--- a/content/xbl/src/nsBindingManager.cpp
+++ b/content/xbl/src/nsBindingManager.cpp
@@ -985,17 +985,16 @@ nsBindingManager::DoProcessAttachedQueue
 void
 nsBindingManager::ProcessAttachedQueue(PRUint32 aSkipSize)
 {
   if (mProcessingAttachedStack || mAttachedStack.Length() <= aSkipSize)
     return;
 
   mProcessingAttachedStack = PR_TRUE;
 
-  PRUint32 currentIndex = aSkipSize;
   // Excute constructors. Do this from high index to low
   while (mAttachedStack.Length() > aSkipSize) {
     PRUint32 lastItem = mAttachedStack.Length() - 1;
     nsRefPtr<nsXBLBinding> binding = mAttachedStack.ElementAt(lastItem);
     mAttachedStack.RemoveElementAt(lastItem);
     if (binding) {
       binding->ExecuteAttachedHandler();
     }
--- a/gfx/thebes/src/gfxWindowsFonts.cpp
+++ b/gfx/thebes/src/gfxWindowsFonts.cpp
@@ -644,17 +644,17 @@ gfxWindowsFont::ComputeMetrics()
     SIZE size;
     GetTextExtentPoint32W(dc, L" ", 1, &size);
     mMetrics->spaceWidth = ROUND(size.cx);
 
     // Cache the width of digit zero.
     // XXX MSDN (http://msdn.microsoft.com/en-us/library/ms534223.aspx)
     // does not say what the failure modes for GetTextExtentPoint32 are -
     // is it safe to assume it will fail iff the font has no '0'?
-    if (GetTextExtentPoint32(dc, "0", 1, &size))
+    if (GetTextExtentPoint32W(dc, L"0", 1, &size))
         mMetrics->zeroOrAveCharWidth = ROUND(size.cx);
     else
         mMetrics->zeroOrAveCharWidth = mMetrics->aveCharWidth;
 
     mSpaceGlyph = 0;
     if (metrics.tmPitchAndFamily & TMPF_TRUETYPE) {
         WORD glyph;
         DWORD ret = GetGlyphIndicesW(dc, L" ", 1, &glyph,
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -5833,17 +5833,17 @@ JS_PUBLIC_API(void)
 JS_SetGCZeal(JSContext *cx, uint8 zeal)
 {
     cx->runtime->gcZeal = zeal;
 }
 #endif
 
 /************************************************************************/
 
-#if !defined(STATIC_JS_API) && defined(XP_WIN)
+#if !defined(STATIC_JS_API) && defined(XP_WIN) && !defined (WINCE)
 
 #include <windows.h>
 
 /*
  * Initialization routine for the JS DLL.
  */
 BOOL WINAPI DllMain (HINSTANCE hDLL, DWORD dwReason, LPVOID lpReserved)
 {
--- a/js/src/jsinterp.cpp
+++ b/js/src/jsinterp.cpp
@@ -4578,25 +4578,26 @@ js_Interpret(JSContext *cx)
 
                     atom = js_FullTestPropertyCache(cx, regs.pc, &obj, &obj2,
                                                     &entry);
                     if (atom) {
                         PCMETER(cache->misses++);
                         PCMETER(cache->setmisses++);
                     } else {
                         ASSERT_VALID_PROPERTY_CACHE_HIT(0, obj, obj2, entry);
+                        sprop = NULL;
                         if (obj == obj2) {
                             JS_ASSERT(PCVAL_IS_SPROP(entry->vword));
                             sprop = PCVAL_TO_SPROP(entry->vword);
                             JS_ASSERT(!(sprop->attrs & JSPROP_READONLY));
                             JS_ASSERT(!SCOPE_IS_SEALED(OBJ_SCOPE(obj2)));
                             NATIVE_SET(cx, obj, sprop, &rval);
                         }
                         JS_UNLOCK_OBJ(cx, obj2);
-                        if (obj == obj2) {
+                        if (sprop) {
                             TRACE_2(SetPropHit, entry, sprop);
                             break;
                         }
                     }
                 }
 
                 if (!atom)
                     LOAD_ATOM(0);
--- a/js/src/jstracer.cpp
+++ b/js/src/jstracer.cpp
@@ -98,19 +98,19 @@
 #define ABORT_TRACE(msg)   return false
 #endif
 
 #ifdef DEBUG
 struct __jitstats {
 #define JITSTAT(x) uint64 x;
 #include "jitstats.tbl"
 #undef JITSTAT
-} stat = { 0LL, };
-
-JS_STATIC_ASSERT(sizeof(stat) % sizeof(uint64) == 0);
+} jitstats = { 0LL, };
+
+JS_STATIC_ASSERT(sizeof(jitstats) % sizeof(uint64) == 0);
 
 enum jitstat_ids {
 #define JITSTAT(x) STAT ## x ## ID,
 #include "jitstats.tbl"
 #undef JITSTAT
     STAT_IDS_TOTAL
 };
 
@@ -134,17 +134,17 @@ jitstats_getProperty(JSContext *cx, JSOb
         }
     }
 
     if (JSVAL_IS_INT(id))
         index = JSVAL_TO_INT(id);
 
     uint64 result = 0;
     switch (index) {
-#define JITSTAT(x) case STAT ## x ## ID: result = stat.x; break;
+#define JITSTAT(x) case STAT ## x ## ID: result = jitstats.x; break;
 #include "jitstats.tbl"
 #undef JITSTAT
     default:
         *vp = JSVAL_VOID;
         return JS_TRUE;
     }
 
     if (result < JSVAL_INT_MAX) {
@@ -168,17 +168,17 @@ JSClass jitstats_class = {
 };
 
 void
 js_InitJITStatsClass(JSContext *cx, JSObject *glob)
 {
     JS_InitClass(cx, glob, NULL, &jitstats_class, NULL, 0, jitstats_props, NULL, NULL, NULL);
 }
 
-#define AUDIT(x) (stat.x++)
+#define AUDIT(x) (jitstats.x++)
 #else
 #define AUDIT(x) ((void)0)
 #endif
 
 #define INS_CONST(c)    addName(lir->insImm(c), #c)
 #define INS_CONSTPTR(p) addName(lir->insImmPtr((void*) (p)), #p)
 
 using namespace avmplus;
@@ -2814,33 +2814,33 @@ js_InitJIT(JSTraceMonitor *tm)
         Fragmento* fragmento = new (&gc) Fragmento(core, 24);
         verbose_only(fragmento->labels = new (&gc) LabelMap(core, NULL);)
         fragmento->assm()->setCallTable(builtins);
         tm->fragmento = fragmento;
         tm->globalSlots = new (&gc) SlotList();
         tm->globalTypeMap = new (&gc) TypeMap();
     }
 #if !defined XP_WIN
-    debug_only(memset(&stat, 0, sizeof(stat)));
+    debug_only(memset(&jitstats, 0, sizeof(jitstats)));
 #endif
 }
 
 extern void
 js_FinishJIT(JSTraceMonitor *tm)
 {
 #ifdef DEBUG
     printf("recorder: started(%llu), aborted(%llu), completed(%llu), different header(%llu), "
            "trees trashed(%llu), slot promoted(%llu), unstable loop variable(%llu), "
            "breaks(%llu), returns(%llu)\n",
-           stat.recorderStarted, stat.recorderAborted, stat.traceCompleted,
-           stat.returnToDifferentLoopHeader, stat.treesTrashed, stat.slotPromoted,
-           stat.unstableLoopVariable, stat.breakLoopExits, stat.returnLoopExits);
+           jitstats.recorderStarted, jitstats.recorderAborted, jitstats.traceCompleted,
+           jitstats.returnToDifferentLoopHeader, jitstats.treesTrashed, jitstats.slotPromoted,
+           jitstats.unstableLoopVariable, jitstats.breakLoopExits, jitstats.returnLoopExits);
     printf("monitor: triggered(%llu), exits(%llu), type mismatch(%llu), "
-           "global mismatch(%llu)\n", stat.traceTriggered, stat.sideExitIntoInterpreter,
-           stat.typeMapMismatchAtEntry, stat.globalShapeMismatchAtEntry);
+           "global mismatch(%llu)\n", jitstats.traceTriggered, jitstats.sideExitIntoInterpreter,
+           jitstats.typeMapMismatchAtEntry, jitstats.globalShapeMismatchAtEntry);
 #endif
     if (tm->fragmento != NULL) {
         JS_ASSERT(tm->globalSlots && tm->globalTypeMap);
         verbose_only(delete tm->fragmento->labels;)
         delete tm->fragmento;
         tm->fragmento = NULL;
         delete tm->globalSlots;
         tm->globalSlots = NULL;
new file mode 100755
--- /dev/null
+++ b/js/tests/e4x/Namespace/regress-444608-02.js
@@ -0,0 +1,55 @@
+/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2008
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Igor Bukanov
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'regress-444608-02.js';
+
+var summary = '13.2 Namespaces - call constructors directly';
+var BUGNUMBER = 444608;
+var actual = 'No Crash';
+var expect = 'No Crash';
+
+printBugNumber(BUGNUMBER);
+START(summary);
+
+var x = <xml/>;
+Namespace = function() { return 10; };
+x.removeNamespace("x");
+
+TEST(1, expect, actual);
+
+END();
new file mode 100755
--- /dev/null
+++ b/js/tests/e4x/Namespace/regress-444608.js
@@ -0,0 +1,55 @@
+/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2008
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Igor Bukanov
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'regress-444608.js';
+
+var summary = '13.2 Namespaces - call constructors directly';
+var BUGNUMBER = 444608;
+var actual = 'No Crash';
+var expect = 'No Crash';
+
+printBugNumber(BUGNUMBER);
+START(summary);
+
+var x = <xml/>;
+Namespace = function() { return 10; };
+x.addNamespace("x");
+
+TEST(1, expect, actual);
+
+END();
new file mode 100755
--- /dev/null
+++ b/js/tests/e4x/QName/regress-444608.js
@@ -0,0 +1,56 @@
+/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2008
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Igor Bukanov
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'regress-444608.js';
+
+var summary = '13.3 QNames - call constructors directly';
+var BUGNUMBER = 444608;
+var actual = 'No Crash';
+var expect = 'No Crash';
+
+printBugNumber(BUGNUMBER);
+START(summary);
+
+
+var x = <a><b/></a>;
+QName = function() { return 10; };
+x.replace("b", 10);
+
+TEST(1, expect, actual);
+
+END();
old mode 100755
new mode 100644
old mode 100755
new mode 100644
new file mode 100755
--- /dev/null
+++ b/js/tests/ecma_3/extensions/regress-430740.js
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2007
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Dave Reed
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'regress-430740.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 430740;
+var summary = 'Do not strip format-control characters from string literals';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+  enterFunc ('test');
+  printBugNumber(BUGNUMBER);
+  printStatus (summary);
+ 
+  function doevil() {
+    print('evildone');
+    return 'evildone';
+  }
+
+  expect = 'a%E2%80%8D,+doevil()%5D)//';
+  actual += eval("(['a\\\u200d', '+doevil()])//'])");
+  actual = encodeURI(actual);
+  reportCompare(expect, actual, summary);
+
+  expect = 'a%EF%BF%BE,+doevil()%5D)//';
+  actual = eval("(['a\\\ufffe', '+doevil()])//'])"); 
+  actual = encodeURI(actual);
+  reportCompare(expect, actual, summary);
+
+  exitFunc ('test');
+}
old mode 100755
new mode 100644
old mode 100755
new mode 100644
old mode 100755
new mode 100644
old mode 100755
new mode 100644
old mode 100755
new mode 100644
old mode 100755
new mode 100644
old mode 100755
new mode 100644
old mode 100755
new mode 100644
old mode 100755
new mode 100644
old mode 100755
new mode 100644
old mode 100755
new mode 100644
old mode 100755
new mode 100644
old mode 100755
new mode 100644
old mode 100755
new mode 100644
old mode 100755
new mode 100644
old mode 100755
new mode 100644
old mode 100755
new mode 100644
old mode 100755
new mode 100644
old mode 100755
new mode 100644
old mode 100755
new mode 100644
old mode 100755
new mode 100644
old mode 100755
new mode 100644
old mode 100755
new mode 100644
old mode 100755
new mode 100644
old mode 100755
new mode 100644
old mode 100755
new mode 100644
old mode 100755
new mode 100644
old mode 100755
new mode 100644
old mode 100755
new mode 100644
old mode 100755
new mode 100644
old mode 100755
new mode 100644
old mode 100755
new mode 100644
old mode 100755
new mode 100644
old mode 100755
new mode 100644
old mode 100755
new mode 100644
old mode 100755
new mode 100644
old mode 100755
new mode 100644
old mode 100755
new mode 100644
old mode 100755
new mode 100644
old mode 100755
new mode 100644
old mode 100755
new mode 100644
old mode 100755
new mode 100644
old mode 100755
new mode 100644
--- a/js/tests/spidermonkey-n-1.9.1.tests
+++ b/js/tests/spidermonkey-n-1.9.1.tests
@@ -99,8 +99,10 @@ js1_5/extensions/regress-355622.js
 js1_5/extensions/regress-418730.js
 js1_5/GetSet/regress-353264.js
 js1_5/Regress/regress-249211.js
 js1_5/Regress/regress-350692.js
 js1_5/Regress/regress-354924.js
 js1_5/Regress/regress-362583.js
 js1_7/extensions/regress-353214-01.js
 js1_7/lexical/regress-346642-03.js
+# bug 450275
+js1_5/extensions/regress-434837-01.js
--- a/layout/base/nsCSSRendering.cpp
+++ b/layout/base/nsCSSRendering.cpp
@@ -1253,26 +1253,26 @@ nsCSSRendering::PaintBoxShadow(nsPresCon
 }
 
 void
 nsCSSRendering::PaintBackground(nsPresContext* aPresContext,
                                 nsIRenderingContext& aRenderingContext,
                                 nsIFrame* aForFrame,
                                 const nsRect& aDirtyRect,
                                 const nsRect& aBorderArea,
-                                const nsStyleBorder& aBorder,
-                                const nsStylePadding& aPadding,
                                 PRBool aUsePrintSettings,
                                 nsRect* aBGClipRect)
 {
   NS_PRECONDITION(aForFrame,
                   "Frame is expected to be provided to PaintBackground");
 
   PRBool isCanvas;
   const nsStyleBackground *color;
+  const nsStylePadding* padding = aForFrame->GetStylePadding();
+  const nsStyleBorder* border = aForFrame->GetStyleBorder();
 
   if (!FindBackground(aPresContext, aForFrame, &color, &isCanvas)) {
     // we don't want to bail out of moz-appearance is set on a root
     // node. If it has a parent content node, bail because it's not
     // a root, other wise keep going in order to let the theme stuff
     // draw the background. The canvas really should be drawing the
     // bg, but there's no way to hook that up via css.
     if (!aForFrame->GetStyleDisplay()->mAppearance) {
@@ -1283,18 +1283,18 @@ nsCSSRendering::PaintBackground(nsPresCo
     if (!content || content->GetParent()) {
       return;
     }
         
     color = aForFrame->GetStyleBackground();
   }
   if (!isCanvas) {
     PaintBackgroundWithSC(aPresContext, aRenderingContext, aForFrame,
-                          aDirtyRect, aBorderArea, *color, aBorder,
-                          aPadding, aUsePrintSettings, aBGClipRect);
+                          aDirtyRect, aBorderArea, *color, *border,
+                          *padding, aUsePrintSettings, aBGClipRect);
     return;
   }
 
   nsStyleBackground canvasColor(*color);
 
   nsIViewManager* vm = aPresContext->GetViewManager();
 
   if (NS_GET_A(canvasColor.mBackgroundColor) < 255) {
@@ -1314,17 +1314,17 @@ nsCSSRendering::PaintBackground(nsPresCo
         NS_ComposeColors(backColor, canvasColor.mBackgroundColor);
     }
   }
 
   vm->SetDefaultBackgroundColor(canvasColor.mBackgroundColor);
 
   PaintBackgroundWithSC(aPresContext, aRenderingContext, aForFrame,
                         aDirtyRect, aBorderArea, canvasColor,
-                        aBorder, aPadding, aUsePrintSettings, aBGClipRect);
+                        *border, *padding, aUsePrintSettings, aBGClipRect);
 }
 
 inline nscoord IntDivFloor(nscoord aDividend, nscoord aDivisor)
 {
   NS_PRECONDITION(aDivisor > 0,
                   "this function only works for positive divisors");
   // ANSI C, ISO 9899:1999 section 6.5.5 defines integer division as
   // truncation of the result towards zero.  Earlier C standards, as
--- a/layout/base/nsCSSRendering.h
+++ b/layout/base/nsCSSRendering.h
@@ -139,24 +139,22 @@ public:
    * Both aDirtyRect and aBorderArea are in the local coordinate space
    * of aForFrame
    */
   static void PaintBackground(nsPresContext* aPresContext,
                               nsIRenderingContext& aRenderingContext,
                               nsIFrame* aForFrame,
                               const nsRect& aDirtyRect,
                               const nsRect& aBorderArea,
-                              const nsStyleBorder& aBorder,
-                              const nsStylePadding& aPadding,
                               PRBool aUsePrintSettings,
                               nsRect* aBGClipRect = nsnull);
 
   /**
-   * Same as |PaintBackground|, except using the provided style context
-   * (which short-circuits the code that ensures that the root element's
+   * Same as |PaintBackground|, except using the provided style structs.
+   * This short-circuits the code that ensures that the root element's
    * background is drawn on the canvas.
    */
   static void PaintBackgroundWithSC(nsPresContext* aPresContext,
                                     nsIRenderingContext& aRenderingContext,
                                     nsIFrame* aForFrame,
                                     const nsRect& aDirtyRect,
                                     const nsRect& aBorderArea,
                                     const nsStyleBackground& aColor,
--- a/layout/base/nsDisplayList.cpp
+++ b/layout/base/nsDisplayList.cpp
@@ -550,18 +550,16 @@ nsDisplayBackground::IsVaryingRelativeTo
 }
 
 void
 nsDisplayBackground::Paint(nsDisplayListBuilder* aBuilder,
      nsIRenderingContext* aCtx, const nsRect& aDirtyRect) {
   nsPoint offset = aBuilder->ToReferenceFrame(mFrame);
   nsCSSRendering::PaintBackground(mFrame->PresContext(), *aCtx, mFrame,
                                   aDirtyRect, nsRect(offset, mFrame->GetSize()),
-                                  *mFrame->GetStyleBorder(),
-                                  *mFrame->GetStylePadding(),
                                   mFrame->HonorPrintBackgroundSettings());
 }
 
 nsRect
 nsDisplayBackground::GetBounds(nsDisplayListBuilder* aBuilder) {
   if (mIsThemed)
     return mFrame->GetOverflowRect() + aBuilder->ToReferenceFrame(mFrame);
 
--- a/layout/forms/nsButtonFrameRenderer.cpp
+++ b/layout/forms/nsButtonFrameRenderer.cpp
@@ -218,21 +218,19 @@ nsButtonFrameRenderer::PaintBorderAndBac
 {
   // get the button rect this is inside the focus and outline rects
   nsRect buttonRect;
   GetButtonRect(aRect, buttonRect);
 
   nsStyleContext* context = mFrame->GetStyleContext();
 
   const nsStyleBorder* border = context->GetStyleBorder();
-  const nsStylePadding* padding = context->GetStylePadding();
 
   nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, mFrame,
-                                  aDirtyRect, buttonRect, *border, *padding,
-                                  PR_FALSE);
+                                  aDirtyRect, buttonRect, PR_FALSE);
   nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, mFrame,
                               aDirtyRect, buttonRect, *border, context);
 }
 
 
 void
 nsButtonFrameRenderer::GetButtonOuterFocusRect(const nsRect& aRect, nsRect& focusRect)
 {
--- a/layout/forms/nsFieldSetFrame.cpp
+++ b/layout/forms/nsFieldSetFrame.cpp
@@ -255,32 +255,30 @@ nsFieldSetFrame::BuildDisplayList(nsDisp
 }
 
 void
 nsFieldSetFrame::PaintBorderBackground(nsIRenderingContext& aRenderingContext,
     nsPoint aPt, const nsRect& aDirtyRect)
 {
   PRIntn skipSides = GetSkipSides();
   const nsStyleBorder* borderStyle = GetStyleBorder();
-  const nsStylePadding* paddingStyle = GetStylePadding();
        
   nscoord topBorder = borderStyle->GetActualBorderWidth(NS_SIDE_TOP);
   nscoord yoff = 0;
   nsPresContext* presContext = PresContext();
      
   // if the border is smaller than the legend. Move the border down
   // to be centered on the legend. 
   if (topBorder < mLegendRect.height)
     yoff = (mLegendRect.height - topBorder)/2;
       
   nsRect rect(aPt.x, aPt.y + yoff, mRect.width, mRect.height - yoff);
 
   nsCSSRendering::PaintBackground(presContext, aRenderingContext, this,
-                                  aDirtyRect, rect, *borderStyle,
-                                  *paddingStyle, PR_TRUE);
+                                  aDirtyRect, rect, PR_TRUE);
 
    if (mLegendFrame) {
 
     // Use the rect of the legend frame, not mLegendRect, so we draw our
     // border under the legend's left and right margins.
     nsRect legendRect = mLegendFrame->GetRect() + aPt;
     
     // we should probably use PaintBorderEdges to do this but for now just use clipping
--- a/layout/generic/nsHTMLFrame.cpp
+++ b/layout/generic/nsHTMLFrame.cpp
@@ -435,21 +435,21 @@ public:
   }
 
   virtual void Paint(nsDisplayListBuilder* aBuilder,
                      nsIRenderingContext* aCtx, const nsRect& aDirtyRect)
   {
     CanvasFrame* frame = static_cast<CanvasFrame*>(mFrame);
     nsPoint offset = aBuilder->ToReferenceFrame(mFrame);
     nsRect bgClipRect = frame->CanvasArea() + offset;
+    // XXXzw This is the only use of the bgClipRect argument.  Does this
+    // path need the propagation-of-root-background-to-viewport logic?
     nsCSSRendering::PaintBackground(mFrame->PresContext(), *aCtx, mFrame,
                                     aDirtyRect,
                                     nsRect(offset, mFrame->GetSize()),
-                                    *mFrame->GetStyleBorder(),
-                                    *mFrame->GetStylePadding(),
                                     mFrame->HonorPrintBackgroundSettings(),
                                     &bgClipRect);
   }
 
   NS_DISPLAY_DECL_NAME("CanvasBackground")
 };
 
 /**
--- a/layout/generic/nsPageFrame.cpp
+++ b/layout/generic/nsPageFrame.cpp
@@ -566,22 +566,19 @@ nsPageFrame::PaintPageContent(nsIRenderi
     clipRect.y = NSToCoordCeil((-pageContentFrame->GetRect().y + 
                                 mPD->mReflowMargin.top) / scale);
     clipRect.height = expectedPageContentHeight;
     NS_ASSERTION(clipRect.y < pageContentFrame->GetSize().height,
                  "Should be clipping to region inside the page content bounds");
   }
   aRenderingContext.SetClipRect(clipRect, nsClipCombine_kIntersect);
 
-  const nsStyleBorder* border = GetStyleBorder();
-  const nsStylePadding* padding = GetStylePadding();
   nsRect backgroundRect = nsRect(nsPoint(0, 0), pageContentFrame->GetSize());
   nsCSSRendering::PaintBackground(PresContext(), aRenderingContext, this,
-                                  rect, backgroundRect, *border, *padding,
-                                  PR_TRUE);
+                                  rect, backgroundRect, PR_TRUE);
 
   nsLayoutUtils::PaintFrame(&aRenderingContext, pageContentFrame,
                             nsRegion(rect), NS_RGBA(0,0,0,0));
 
   aRenderingContext.PopState();
 }
 
 void
--- a/layout/mathml/base/src/nsMathMLChar.cpp
+++ b/layout/mathml/base/src/nsMathMLChar.cpp
@@ -2047,21 +2047,18 @@ nsMathMLChar::Display(nsDisplayListBuild
   else if (mRect.width && mRect.height) {
     const nsStyleBackground* backg = styleContext->GetStyleBackground();
     if (styleContext != parentContext &&
         NS_GET_A(backg->mBackgroundColor) > 0) {
       rv = aLists.BorderBackground()->AppendNewToTop(new (aBuilder)
           nsDisplayMathMLCharBackground(aForFrame, mRect, styleContext));
       NS_ENSURE_SUCCESS(rv, rv);
     }
-
     //else
     //  our container frame will take care of painting its background
-    //  nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, aForFrame,
-    //                                  aDirtyRect, rect, *border, *padding, PR_TRUE);
 
 #if defined(NS_DEBUG) && defined(SHOW_BOUNDING_BOX)
     // for visual debug
     rv = aLists.BorderBackground()->AppendToTop(new (aBuilder)
         nsDisplayMathMLCharDebug(aForFrame, mRect));
     NS_ENSURE_SUCCESS(rv, rv);
 #endif
   }
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/444928-1-ref.html
@@ -0,0 +1,17 @@
+<html>
+<head>
+<style type="text/css">
+table{ width: 500px; }
+
+</style>
+</head>
+<body>
+<table class="grid" cellspacing="50" cellpadding="0" border>
+<col width="10%"/>
+<col width="1" span="2"/>
+<tbody>
+<tr><th class="top" colspan="3"> Some Text</th></tr>
+</tbody>
+</table>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/444928-1.html
@@ -0,0 +1,17 @@
+<html>
+<head>
+<style type="text/css">
+table{table-layout: fixed; width: 500px; }
+
+</style>
+</head>
+<body>
+<table class="grid" cellspacing="50" cellpadding="0" border>
+<col width="10%"/>
+<col width="1" span="2"/>
+<tbody>
+<tr><th class="top" colspan="3"> Some Text</th></tr>
+</tbody>
+</table>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/444928-2-ref.html
@@ -0,0 +1,18 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<title>Examples for bug 444928</title>
+</head>
+<body>
+
+<table cellspacing="50" cellpadding="0" style="table-layout:fixed" width="652">
+<col width="150">
+<col width="150">
+<col>
+<tr><td colspan="2" style="background:yellow">1-2</td><td style="background:fuchsia">3</td></tr>
+<tr style="color:transparent"><td>1</td><td>2</td><td>3</td></tr>
+</tbody>
+</table>
+
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/444928-2.html
@@ -0,0 +1,17 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<title>Examples for bug 444928</title>
+</head>
+<body>
+
+<table cellspacing="50" cellpadding="0" style="table-layout:fixed" width="652">
+<col width="150">
+<col width="150">
+<col>
+<tr><td colspan="2" style="background:yellow">1-2</td><td style="background:fuchsia">3</td></tr>
+</tbody>
+</table>
+
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/444928-3-notref.html
@@ -0,0 +1,18 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<title>Examples for bug 444928</title>
+</head>
+<body>
+
+<table cellspacing="50" cellpadding="0" width="652">
+<col width="150">
+<col width="150">
+<col>
+<tr><td colspan="2" style="background:yellow">1-2</td><td style="background:fuchsia">3</td></tr>
+<tr style="color:transparent"><td>1</td><td>2</td><td>3</td></tr>
+</tbody>
+</table>
+
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/444928-3.html
@@ -0,0 +1,17 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<title>Examples for bug 444928</title>
+</head>
+<body>
+
+<table cellspacing="50" cellpadding="0" width="652">
+<col width="150">
+<col width="150">
+<col>
+<tr><td colspan="2" style="background:yellow">1-2</td><td style="background:fuchsia">3</td></tr>
+</tbody>
+</table>
+
+</body>
+</html>
--- a/layout/reftests/bugs/reftest.list
+++ b/layout/reftests/bugs/reftest.list
@@ -903,17 +903,19 @@ random == 429849-1.html 429849-1-ref.htm
 == 438987-2c.html 438987-2-ref.html
 != about:blank 438987-2-ref.html # check that backgrounds work at all 
 == 439004-1.html 439004-1-ref.html
 == 439639-1.html 439639-1-ref.html
 == 439910.html 439910-ref.html
 == 441259-1.html 441259-1-ref.html
 fails == 441259-2.html 441259-2-ref.html # bug 441400
 == 444015-1.html 444015-1-ref.html
+== 444928-1.html 444928-1-ref.html
+== 444928-2.html 444928-2-ref.html
+!= 444928-3.html 444928-3-notref.html
 # == 448987.html 448987-ref.html  # Disabled for now - it needs privileges
 == 449171-1.html 449171-ref.html
 == 449519-1.html 449519-1-ref.html
 # == 449653-1.html 449653-1-ref.html # Disabled for now - it needs privileges
 == 450670-1.html 450670-1-ref.html
 == 451168-1.html 451168-1-ref.html
 == 454361.html about:blank
 == 455280-1.xhtml 455280-1-ref.xhtml
-
--- a/layout/tables/BasicTableLayoutStrategy.cpp
+++ b/layout/tables/BasicTableLayoutStrategy.cpp
@@ -46,17 +46,18 @@
 #include "nsTableCellFrame.h"
 #include "nsLayoutUtils.h"
 #include "nsGkAtoms.h"
 #include "SpanningCellSorter.h"
 
 #undef  DEBUG_TABLE_STRATEGY 
 
 BasicTableLayoutStrategy::BasicTableLayoutStrategy(nsTableFrame *aTableFrame)
-  : mTableFrame(aTableFrame)
+  : nsITableLayoutStrategy(nsITableLayoutStrategy::Auto)
+  , mTableFrame(aTableFrame)
 {
     MarkIntrinsicWidthsDirty();
 }
 
 /* virtual */
 BasicTableLayoutStrategy::~BasicTableLayoutStrategy()
 {
 }
@@ -416,17 +417,17 @@ BasicTableLayoutStrategy::ComputeIntrins
                            // where a cell originates
 
     for (PRInt32 col = 0; col < colCount; ++col) {
         nsTableColFrame *colFrame = mTableFrame->GetColFrame(col);
         if (!colFrame) {
             NS_ERROR("column frames out of sync with cell map");
             continue;
         }
-        if (mTableFrame->GetNumCellsOriginatingInCol(col)) {
+        if (mTableFrame->ColumnHasCellSpacingBefore(col)) {
             add += spacing;
         }
         min += colFrame->GetMinCoord();
         pref = NSCoordSaturatingAdd(pref, colFrame->GetPrefCoord());
 
         // Percentages are of the table, so we have to reverse them for
         // intrinsic widths.
         float p = colFrame->GetPrefPercent();
@@ -625,17 +626,17 @@ BasicTableLayoutStrategy::DistributeWidt
 
     // border-spacing isn't part of the basis for percentages.
     nscoord spacing = mTableFrame->GetCellSpacingX();
     nscoord subtract = 0;    
     // aWidth initially includes border-spacing for the boundaries in between
     // each of the columns. We start at aFirstCol + 1 because the first
     // in-between boundary would be at the left edge of column aFirstCol + 1
     for (PRInt32 col = aFirstCol + 1; col < aFirstCol + aColCount; ++col) {
-        if (mTableFrame->GetNumCellsOriginatingInCol(col)) {
+        if (mTableFrame->ColumnHasCellSpacingBefore(col)) {
             subtract += spacing;
         }
     }
     if (aWidthType == BTLS_FINAL_WIDTH) {
         // If we're computing final col-width, then aWidth initially includes
         // border spacing on the table's far left + far right edge, too.  Need
         // to subtract those out, too.
         subtract += spacing * 2;
@@ -734,17 +735,17 @@ BasicTableLayoutStrategy::DistributeWidt
                 // loop
                 nscoord delta = NSCoordSaturatingSubtract(pref_width, 
                                                           min_width, 0);
                 guess_min_spec = NSCoordSaturatingAdd(guess_min_spec, delta);
                 total_fixed_pref = NSCoordSaturatingAdd(total_fixed_pref, 
                                                         pref_width);
             } else if (pref_width == 0) {
                 if (aWidthType == BTLS_FINAL_WIDTH &&
-                    mTableFrame->GetNumCellsOriginatingInCol(col)) {
+                    mTableFrame->ColumnHasCellSpacingBefore(col)) {
                     ++numNonSpecZeroWidthCols;
                 }
             } else {
                 total_flex_pref = NSCoordSaturatingAdd(total_flex_pref,
                                                        pref_width);
             }
         }
     }
@@ -932,17 +933,17 @@ BasicTableLayoutStrategy::DistributeWidt
                 }
                 break;
             case FLEX_FLEX_LARGE_ZERO:
                 NS_ASSERTION(aWidthType == BTLS_FINAL_WIDTH,
                              "FLEX_FLEX_LARGE_ZERO only should be hit "
                              "when we're setting final width.");
                 if (pct == 0.0f &&
                     !colFrame->GetHasSpecifiedCoord() &&
-                    mTableFrame->GetNumCellsOriginatingInCol(col)) {
+                    mTableFrame->ColumnHasCellSpacingBefore(col)) {
 
                     NS_ASSERTION(col_width == 0 &&
                                  colFrame->GetPrefCoord() == 0,
                                  "Since we're in FLEX_FLEX_LARGE_ZERO case, "
                                  "all auto-width cols should have zero pref "
                                  "width.");
                     float c = float(space) / float(basis.c);
                     col_width += NSToCoordRound(c);
--- a/layout/tables/FixedTableLayoutStrategy.cpp
+++ b/layout/tables/FixedTableLayoutStrategy.cpp
@@ -42,17 +42,18 @@
  */
 
 #include "FixedTableLayoutStrategy.h"
 #include "nsTableFrame.h"
 #include "nsTableColFrame.h"
 #include "nsTableCellFrame.h"
 
 FixedTableLayoutStrategy::FixedTableLayoutStrategy(nsTableFrame *aTableFrame)
-  : mTableFrame(aTableFrame)
+  : nsITableLayoutStrategy(nsITableLayoutStrategy::Fixed)
+  , mTableFrame(aTableFrame)
 {
     MarkIntrinsicWidthsDirty();
 }
 
 /* virtual */
 FixedTableLayoutStrategy::~FixedTableLayoutStrategy()
 {
 }
@@ -60,38 +61,37 @@ FixedTableLayoutStrategy::~FixedTableLay
 /* virtual */ nscoord
 FixedTableLayoutStrategy::GetMinWidth(nsIRenderingContext* aRenderingContext)
 {
     DISPLAY_MIN_WIDTH(mTableFrame, mMinWidth);
     if (mMinWidth != NS_INTRINSIC_WIDTH_UNKNOWN)
         return mMinWidth;
 
     // It's theoretically possible to do something much better here that
-    // depends only on the columns and the first row, but it wouldn't be
-    // compatible with other browsers, or with the use of GetMinWidth by
-    // nsHTMLReflowState to determine the width of a fixed-layout table,
-    // since CSS2.1 says:
+    // depends only on the columns and the first row (where we look at
+    // intrinsic widths inside the first row and then reverse the
+    // algorithm to find the narrowest width that would hold all of
+    // those intrinsic widths), but it wouldn't be compatible with other
+    // browsers, or with the use of GetMinWidth by
+    // nsTableFrame::ComputeSize to determine the width of a fixed
+    // layout table, since CSS2.1 says:
     //   The width of the table is then the greater of the value of the
     //   'width' property for the table element and the sum of the
     //   column widths (plus cell spacing or borders).
 
     // XXX Should we really ignore 'min-width' and 'max-width'?
+    // XXX Should we really ignore widths on column groups?
 
     nsTableCellMap *cellMap = mTableFrame->GetCellMap();
     PRInt32 colCount = cellMap->GetColCount();
     nscoord spacing = mTableFrame->GetCellSpacingX();
 
-    // XXX Should this code do any pixel rounding?
-
     nscoord result = 0;
 
-    // XXX Consider widths on columns or column groups?
-
     if (colCount > 0) {
-        // XXX Should only add columns that have cells originating in them!
         result += spacing * (colCount + 1);
     }
 
     for (PRInt32 col = 0; col < colCount; ++col) {
         nsTableColFrame *colFrame = mTableFrame->GetColFrame(col);
         if (!colFrame) {
             NS_ERROR("column frames out of sync with cell map");
             continue;
@@ -146,18 +146,21 @@ FixedTableLayoutStrategy::GetMinWidth(ns
     return (mMinWidth = result);
 }
 
 /* virtual */ nscoord
 FixedTableLayoutStrategy::GetPrefWidth(nsIRenderingContext* aRenderingContext,
                                        PRBool aComputingSize)
 {
     // It's theoretically possible to do something much better here that
-    // depends only on the columns and the first row, but it wouldn't be
-    // compatible with other browsers.
+    // depends only on the columns and the first row (where we look at
+    // intrinsic widths inside the first row and then reverse the
+    // algorithm to find the narrowest width that would hold all of
+    // those intrinsic widths), but it wouldn't be compatible with other
+    // browsers.
     nscoord result = nscoord_MAX;
     DISPLAY_PREF_WIDTH(mTableFrame, result);
     return result;
 }
 
 /* virtual */ void
 FixedTableLayoutStrategy::MarkIntrinsicWidthsDirty()
 {
@@ -173,32 +176,28 @@ FixedTableLayoutStrategy::ComputeColumnW
     if (mLastCalcWidth == tableWidth)
         return;
     mLastCalcWidth = tableWidth;
 
     nsTableCellMap *cellMap = mTableFrame->GetCellMap();
     PRInt32 colCount = cellMap->GetColCount();
     nscoord spacing = mTableFrame->GetCellSpacingX();
 
-    // XXX Should this code do any pixel rounding?
-
-    // border-spacing isn't part of the basis for percentages.
-    if (colCount > 0) {
-        // XXX Should only add columns that have cells originating in them!
-        nscoord subtract = spacing * (colCount + 1);
-        tableWidth -= subtract;
-    } else {
+    if (colCount == 0) {
         // No Columns - nothing to compute
         return;
     }
 
+    // border-spacing isn't part of the basis for percentages.
+    tableWidth -= spacing * (colCount + 1);
+
     // XXX This ignores the 'min-width' and 'max-width' properties
     // throughout.  Then again, that's what the CSS spec says to do.
 
-    // XXX Consider widths on columns or column groups?
+    // XXX Should we really ignore widths on column groups?
 
     PRUint32 unassignedCount = 0;
     nscoord unassignedSpace = tableWidth;
     const nscoord unassignedMarker = nscoord_MIN;
 
     // We use the PrefPercent on the columns to store the percentages
     // used to compute column widths in case we need to reduce their
     // basis.
--- a/layout/tables/nsITableLayoutStrategy.h
+++ b/layout/tables/nsITableLayoutStrategy.h
@@ -65,11 +65,23 @@ public:
     /** Implement nsIFrame::MarkIntrinsicWidthsDirty for the table */
     virtual void MarkIntrinsicWidthsDirty() = 0;
 
     /**
      * Compute final column widths based on the intrinsic width data and
      * the available width.
      */
     virtual void ComputeColumnWidths(const nsHTMLReflowState& aReflowState) = 0;
+
+    /**
+     * Return the type of table layout strategy, without the cost of
+     * a virtual function call
+     */
+    enum Type { Auto, Fixed };
+    Type GetType() const { return mType; }
+
+protected:
+    nsITableLayoutStrategy(Type aType) : mType(aType) {}
+private:
+    Type mType;
 };
 
 #endif /* !defined(nsITableLayoutStrategy_h_) */
--- a/layout/tables/nsTableCellFrame.cpp
+++ b/layout/tables/nsTableCellFrame.cpp
@@ -340,18 +340,17 @@ nsTableCellFrame::DecorateForSelection(n
 
 void
 nsTableCellFrame::PaintBackground(nsIRenderingContext& aRenderingContext,
                                   const nsRect&        aDirtyRect,
                                   nsPoint              aPt)
 {
   nsRect rect(aPt, GetSize());
   nsCSSRendering::PaintBackground(PresContext(), aRenderingContext, this,
-                                  aDirtyRect, rect, *GetStyleBorder(),
-                                  *GetStylePadding(), PR_TRUE);
+                                  aDirtyRect, rect, PR_TRUE);
 }
 
 // Called by nsTablePainter
 void
 nsTableCellFrame::PaintCellBackground(nsIRenderingContext& aRenderingContext,
                                       const nsRect& aDirtyRect, nsPoint aPt)
 {
   if (!GetStyleVisibility()->IsVisible())
@@ -1197,12 +1196,15 @@ nsBCTableCellFrame::PaintBackground(nsIR
 
   nsStyleBorder myBorder(*GetStyleBorder());
 
   NS_FOR_CSS_SIDES(side) {
     myBorder.SetBorderWidth(side, borderWidth.side(side));
   }
 
   nsRect rect(aPt, GetSize());
-  nsCSSRendering::PaintBackground(PresContext(), aRenderingContext, this,
-                                  aDirtyRect, rect, myBorder, *GetStylePadding(),
-                                  PR_TRUE);
+  // bypassing nsCSSRendering::PaintBackground is safe because this kind
+  // of frame cannot be used for the root element
+  nsCSSRendering::PaintBackgroundWithSC(PresContext(), aRenderingContext, this,
+                                        aDirtyRect, rect,
+                                        *GetStyleBackground(), myBorder,
+                                        *GetStylePadding(), PR_TRUE, nsnull);
 }
--- a/layout/tables/nsTableFrame.cpp
+++ b/layout/tables/nsTableFrame.cpp
@@ -425,22 +425,28 @@ void nsTableFrame::AttributeChangedFor(n
 
 
 /* ****** CellMap methods ******* */
 
 /* return the effective col count */
 PRInt32 nsTableFrame::GetEffectiveColCount() const
 {
   PRInt32 colCount = GetColCount();
-  // don't count cols at the end that don't have originating cells
-  for (PRInt32 colX = colCount - 1; colX >= 0; colX--) {
-    if (GetNumCellsOriginatingInCol(colX) <= 0) { 
+  if (LayoutStrategy()->GetType() == nsITableLayoutStrategy::Auto) {
+    nsTableCellMap* cellMap = GetCellMap();
+    if (!cellMap) {
+      return 0;
+    }
+    // don't count cols at the end that don't have originating cells
+    for (PRInt32 colX = colCount - 1; colX >= 0; colX--) {
+      if (cellMap->GetNumCellsOriginatingInCol(colX) > 0) { 
+        break;
+      }
       colCount--;
     }
-    else break;
   }
   return colCount;
 }
 
 PRInt32 nsTableFrame::GetIndexOfLastRealCol()
 {
   PRInt32 numCols = mColFrames.Count();
   if (numCols > 0) {
@@ -1608,18 +1614,17 @@ nsTableFrame::ProcessRowInserted(nscoord
       childFrame = childFrame->GetNextSibling();
     }
   }
 }
 
 /* virtual */ void
 nsTableFrame::MarkIntrinsicWidthsDirty()
 {
-  static_cast<nsTableFrame*>(GetFirstInFlow())->
-    mTableLayoutStrategy->MarkIntrinsicWidthsDirty();
+  LayoutStrategy()->MarkIntrinsicWidthsDirty();
 
   // XXXldb Call SetBCDamageArea?
 
   nsHTMLContainerFrame::MarkIntrinsicWidthsDirty();
 }
 
 /* virtual */ nscoord
 nsTableFrame::GetMinWidth(nsIRenderingContext *aRenderingContext)
@@ -2207,17 +2212,17 @@ nsTableFrame::GetCollapsedWidth(nsMargin
       const nsStyleDisplay* colDisplay = colFrame->GetStyleDisplay();
       PRInt32 colX = colFrame->GetColIndex();
       if (NS_STYLE_DISPLAY_TABLE_COLUMN == colDisplay->mDisplay) {
         const nsStyleVisibility* colVis = colFrame->GetStyleVisibility();
         PRBool collapseCol = (NS_STYLE_VISIBILITY_COLLAPSE == colVis->mVisible);
         PRInt32 colWidth = GetColumnWidth(colX);
         if (!collapseGroup && !collapseCol) {
           width += colWidth;
-          if (GetNumCellsOriginatingInCol(colX) > 0)
+          if (ColumnHasCellSpacingBefore(colX))
             width += cellSpacingX;
         }
       }
     }
   }
   return width;
 }
 
@@ -4012,32 +4017,27 @@ nsTableFrame::GetRowAndColumnByIndex(PRI
     return NS_ERROR_NOT_INITIALIZED;
 
   cellMap->GetRowAndColumnByIndex(aIndex, aRow, aColumn);
   return NS_OK;
 }
 
 /*---------------- end of nsITableLayout implementation ------------------*/
 
-PRInt32 nsTableFrame::GetNumCellsOriginatingInCol(PRInt32 aColIndex) const
-{
+PRBool
+nsTableFrame::ColumnHasCellSpacingBefore(PRInt32 aColIndex) const
+{
+  // Since fixed-layout tables should not have their column sizes change
+  // as they load, we assume that all columns are significant.
+  if (LayoutStrategy()->GetType() == nsITableLayoutStrategy::Fixed)
+    return PR_TRUE;
   nsTableCellMap* cellMap = GetCellMap();
-  if (cellMap) 
-    return cellMap->GetNumCellsOriginatingInCol(aColIndex);
-  else
-    return 0;
-}
-
-PRInt32 nsTableFrame::GetNumCellsOriginatingInRow(PRInt32 aRowIndex) const
-{
-  nsTableCellMap* cellMap = GetCellMap();
-  if (cellMap) 
-    return cellMap->GetNumCellsOriginatingInRow(aRowIndex);
-  else
-    return 0;
+  if (!cellMap) 
+    return PR_FALSE;
+  return cellMap->GetNumCellsOriginatingInCol(aColIndex) > 0;
 }
 
 static void
 CheckFixDamageArea(PRInt32 aNumRows,
                    PRInt32 aNumCols,
                    nsRect& aDamageArea)
 {
   if (((aDamageArea.XMost() > aNumCols) && (aDamageArea.width  != 1) && (aNumCols != 0)) || 
--- a/layout/tables/nsTableFrame.h
+++ b/layout/tables/nsTableFrame.h
@@ -525,18 +525,18 @@ public:
 
   virtual void RemoveCol(nsTableColGroupFrame* aColGroupFrame,
                          PRInt32               aColIndex,
                          PRBool                aRemoveFromCache,
                          PRBool                aRemoveFromCellMap);
 
   NS_IMETHOD GetIndexByRowAndColumn(PRInt32 aRow, PRInt32 aColumn, PRInt32 *aIndex);
   NS_IMETHOD GetRowAndColumnByIndex(PRInt32 aIndex, PRInt32 *aRow, PRInt32 *aColumn);
-  PRInt32 GetNumCellsOriginatingInCol(PRInt32 aColIndex) const;
-  PRInt32 GetNumCellsOriginatingInRow(PRInt32 aRowIndex) const;
+
+  PRBool ColumnHasCellSpacingBefore(PRInt32 aColIndex) const;
 
   PRBool HasPctCol() const;
   void SetHasPctCol(PRBool aValue);
 
   PRBool HasCellSpanningPctCol() const;
   void SetHasCellSpanningPctCol(PRBool aValue);
 
   /**
@@ -606,17 +606,17 @@ protected:
   /** Adjust the table for visibilty.collapse set on rowgroups, rows, colgroups
     * and cols
     * @param aDesiredSize    the metrics of the table
     * @param aBorderPadding  the border and padding of the table
     */
   void AdjustForCollapsingRowsCols(nsHTMLReflowMetrics& aDesiredSize,
                                    nsMargin             aBorderPadding);
 
-  nsITableLayoutStrategy* LayoutStrategy() {
+  nsITableLayoutStrategy* LayoutStrategy() const {
     return static_cast<nsTableFrame*>(GetFirstInFlow())->
       mTableLayoutStrategy;
   }
 
 private:
   /* Handle a row that got inserted during reflow.  aNewHeight is the
      new height of the table after reflow. */
   void ProcessRowInserted(nscoord aNewHeight);
--- a/layout/tables/nsTableRowFrame.cpp
+++ b/layout/tables/nsTableRowFrame.cpp
@@ -679,17 +679,17 @@ CalcAvailWidth(nsTableFrame&     aTableF
   for (PRInt32 spanX = 0; spanX < colspan; spanX++) {
     nscoord colWidth = aTableFrame.GetColumnWidth(colIndex + spanX);
     if (NS_UNCONSTRAINEDSIZE == aColAvailWidth) {
       aColAvailWidth = colWidth; 
     }
     else {
       aColAvailWidth += colWidth;
     }
-    if ((spanX > 0) && (aTableFrame.GetNumCellsOriginatingInCol(colIndex + spanX) > 0)) {
+    if ((spanX > 0) && aTableFrame.ColumnHasCellSpacingBefore(colIndex + spanX)) {
       cellSpacing += aCellSpacingX;
     }
   }
   if (NS_UNCONSTRAINEDSIZE != aColAvailWidth) {
     aColAvailWidth += cellSpacing;
   } 
   aCellAvailWidth = aColAvailWidth;
 }
@@ -718,17 +718,17 @@ GetSpaceBetween(PRInt32       aPrevColIn
         nsIFrame* cgFrame = colFrame->GetParent();
         const nsStyleVisibility* groupVis = cgFrame->GetStyleVisibility();
         PRBool collapseGroup = (NS_STYLE_VISIBILITY_COLLAPSE ==
                                 groupVis->mVisible);
         isCollapsed = collapseCol || collapseGroup;
         if (!isCollapsed)
           space += aTableFrame.GetColumnWidth(colX);
       }
-      if (!isCollapsed && (aTableFrame.GetNumCellsOriginatingInCol(colX) > 0)) {
+      if (!isCollapsed && aTableFrame.ColumnHasCellSpacingBefore(colX)) {
         space += aCellSpacingX;
       }
     }
   } 
   else {
     PRInt32 lastCol = aColIndex + aColSpan - 1;
     for (colX = aPrevColIndex - 1; colX > lastCol; colX--) {
       PRBool isCollapsed = PR_FALSE;
@@ -742,17 +742,17 @@ GetSpaceBetween(PRInt32       aPrevColIn
         nsIFrame* cgFrame = colFrame->GetParent();
         const nsStyleVisibility* groupVis = cgFrame->GetStyleVisibility();
         PRBool collapseGroup = (NS_STYLE_VISIBILITY_COLLAPSE ==
                                 groupVis->mVisible);
         isCollapsed = collapseCol || collapseGroup;
         if (!isCollapsed)
           space += aTableFrame.GetColumnWidth(colX);
       }
-      if (!isCollapsed && (aTableFrame.GetNumCellsOriginatingInCol(colX) > 0)) {
+      if (!isCollapsed && aTableFrame.ColumnHasCellSpacingBefore(colX)) {
         space += aCellSpacingX;
       }
     }
   }
   return space;
 }
 
 // subtract the heights of aRow's prev in flows from the unpaginated height
@@ -1237,17 +1237,17 @@ nsTableRowFrame::CollapseRowIfNecessary(
             isVisible = PR_TRUE;
           }
           if (!isCollapsed &&  (actualColSpan > 1)) {
             nsTableColFrame* nextColFrame =
               tableFrame->GetColFrame(colX + colIncrement);
             const nsStyleVisibility* nextColVis =
               nextColFrame->GetStyleVisibility();
             if ( (NS_STYLE_VISIBILITY_COLLAPSE != nextColVis->mVisible) &&
-                (tableFrame->GetNumCellsOriginatingInCol(colX + colIncrement) > 0)) {
+                tableFrame->ColumnHasCellSpacingBefore(colX + colIncrement)) {
               cRect.width += cellSpacingX;
             }
           }
         }
         x += cRect.width;
         if (isVisible)
           x += cellSpacingX;
         PRInt32 actualRowSpan = tableFrame->GetEffectiveRowSpan(*cellFrame);
--- a/layout/xul/base/src/nsGroupBoxFrame.cpp
+++ b/layout/xul/base/src/nsGroupBoxFrame.cpp
@@ -145,17 +145,16 @@ nsGroupBoxFrame::BuildDisplayList(nsDisp
   // REVIEW: Debug borders now painted by nsFrame::BuildDisplayListForChild
 }
 
 void
 nsGroupBoxFrame::PaintBorderBackground(nsIRenderingContext& aRenderingContext,
     nsPoint aPt, const nsRect& aDirtyRect) {
   PRIntn skipSides = 0;
   const nsStyleBorder* borderStyleData = GetStyleBorder();
-  const nsStylePadding* paddingStyleData = GetStylePadding();
   const nsMargin& border = borderStyleData->GetActualBorder();
   nscoord yoff = 0;
   nsPresContext* presContext = PresContext();
 
   nsRect groupRect;
   nsIBox* groupBox = GetCaptionBox(presContext, groupRect);
 
   if (groupBox) {        
@@ -169,18 +168,17 @@ nsGroupBoxFrame::PaintBorderBackground(n
         yoff = (groupRect.height - border.top)/2 + groupRect.y;
   }
 
   nsRect rect(aPt.x, aPt.y + yoff, mRect.width, mRect.height - yoff);
 
   groupRect += aPt;
 
   nsCSSRendering::PaintBackground(presContext, aRenderingContext, this,
-                                  aDirtyRect, rect, *borderStyleData,
-                                  *paddingStyleData, PR_FALSE);
+                                  aDirtyRect, rect, PR_FALSE);
 
   if (groupBox) {
 
     // we should probably use PaintBorderEdges to do this but for now just use clipping
     // to achieve the same effect.
 
     // draw left side
     nsRect clipRect(rect);
--- a/media/libvorbis/README_MOZILLA
+++ b/media/libvorbis/README_MOZILLA
@@ -1,7 +1,11 @@
 The source from this directory was copied from the libvorbis-1.2.0
 source distribution using the update.sh script. The only changes made
 were those applied by update.sh and the addition/upate of Makefile.in
 files for the Mozilla build system.
 
 Some files are renamed during the copy to prevent clashes with object
-file names with other Mozilla libraries.
\ No newline at end of file
+file names with other Mozilla libraries.
+
+BUG 455372 - WinCE LibVorbis No FPU Support on WinMobile, removed FPU
+support for builds with WINCE defined.
+
--- a/media/libvorbis/lib/os.h
+++ b/media/libvorbis/lib/os.h
@@ -74,17 +74,17 @@ void *_alloca(size_t size);
 #ifndef min
 #  define min(x,y)  ((x)>(y)?(y):(x))
 #endif
 
 #ifndef max
 #  define max(x,y)  ((x)<(y)?(y):(x))
 #endif
 
-#if defined(__i386__) && defined(__GNUC__) && !defined(__BEOS__)
+#if defined(__i386__) && defined(__GNUC__) && !defined(__BEOS__) && !defined(WINCE)
 #  define VORBIS_FPU_CONTROL
 /* both GCC and MSVC are kinda stupid about rounding/casting to int.
    Because of encapsulation constraints (GCC can't see inside the asm
    block and so we end up doing stupid things like a store/load that
    is collectively a noop), we do it this way */
 
 /* we must set up the fpu before this works!! */
 
@@ -111,17 +111,17 @@ static inline int vorbis_ftoi(double f){
                                              truncate precision */
   int i;
   __asm__("fistl %0": "=m"(i) : "t"(f));
   return(i);
 }
 #endif
 
 
-#if defined(_WIN32) && !defined(__GNUC__) && !defined(__BORLANDC__)
+#if defined(_WIN32) && !defined(__GNUC__) && !defined(__BORLANDC__) && !defined(WINCE)
 #  define VORBIS_FPU_CONTROL
 
 typedef ogg_int16_t vorbis_fpu_control;
 
 static __inline int vorbis_ftoi(double f){
 	int i;
 	__asm{
 		fld f
--- a/modules/lcms/include/lcms.h
+++ b/modules/lcms/include/lcms.h
@@ -29,17 +29,23 @@
 //   Optimization mode.
 //
 // Note that USE_ASSEMBLER Is fastest by far, but it is limited to Pentium.
 // USE_FLOAT are the generic floating-point routines. USE_C should work on
 // virtually any machine.
 
 //#define USE_FLOAT        1
 // #define USE_C            1
+
+#ifdef WINCE
+// WINCE ARM does not support inline ASM.
+#define USE_C            1
+#else
 #define USE_ASSEMBLER    1
+#endif
 
 // Define this if you are using this package as a DLL (windows only)
 
 // #define LCMS_DLL     1
 // #define LCMS_DLL_BUILD   1
 
 // Uncomment if you are trying the engine in a non-windows environment
 // like linux, SGI, VAX, FreeBSD, BeOS, etc. 
new file mode 100644
--- /dev/null
+++ b/modules/libpr0n/decoders/icon/qt/Makefile.in
@@ -0,0 +1,70 @@
+# ***** BEGIN LICENSE BLOCK *****
+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Original Code is the Mozilla icon channel for Qt.
+#
+# The Initial Developer of the Original Code is Nokia
+# Portions created by the Initial Developer are Copyright (C) 2008
+# the Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+#   Oleg Romashin <romaxa@gmail.com>
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 2 or later (the "GPL"), or
+# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+# in which case the provisions of the GPL or the LGPL are applicable instead
+# of those above. If you wish to allow use of your version of this file only
+# under the terms of either the GPL or the LGPL, and not to allow others to
+# use your version of this file under the terms of the MPL, indicate your
+# decision by deleting the provisions above and replace them with the notice
+# and other provisions required by the GPL or the LGPL. If you do not delete
+# the provisions above, a recipient may use your version of this file under
+# the terms of any one of the MPL, the GPL or the LGPL.
+#
+# ***** END LICENSE BLOCK *****
+
+DEPTH		= ../../../../..
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+MODULE		= imgicon
+LIBRARY_NAME	= imgiconqt_s
+LIBXUL_LIBRARY	= 1
+
+REQUIRES	= xpcom \
+		  string \
+		  necko \
+		  intl \
+		  mimetype \
+		  gtkqticonsconverter \
+		  $(NULL)
+
+CPPSRCS		= nsIconChannel.cpp
+
+LOCAL_INCLUDES += $(MOZ_QT_CFLAGS)
+
+# we don't want the shared lib, but we want to force the creation of a static lib.
+FORCE_STATIC_LIB = 1
+# This library is used by other shared libs in a static build
+FORCE_USE_PIC = 1
+
+DIRS = public
+
+EXTRA_PP_COMPONENTS = gtkqticonsconverter.js
+
+include $(topsrcdir)/config/rules.mk
+
new file mode 100644
--- /dev/null
+++ b/modules/libpr0n/decoders/icon/qt/gtkqticonsconverter.js
@@ -0,0 +1,173 @@
+/* vim:set ts=2 sw=2 sts=2 cin et: */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is the Mozilla icon channel for Qt.
+ *
+ * The Initial Developer of the Original Code is Nokia
+ * Portions created by the Initial Developer are Copyright (C) 2008
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Oleg Romashin <romaxa@gmail.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
+
+
+function GtkQtIconsConverter() { };
+GtkQtIconsConverter.prototype = {
+  classDescription: "Gtk Qt stock icons converter",
+  classID:          Components.ID("{c0783c34-a831-40c6-8c03-98c9f74cca45}"),
+  contractID:       "@mozilla.org/gtkqticonsconverter;1",
+  QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsIGtkQtIconsConverter]),
+  convert: function(icon) { return this._gtk_qt_icons_table[icon]; },
+  _gtk_qt_icons_table: {
+    'about':
+    0,
+    'add':
+    0,
+    'apply':
+    44, /* QStyle::SP_DialogApplyButton */
+    'cancel':
+    39, /* QStyle::SP_DialogCancelButton */
+    'clear':
+    45, /* QStyle::SP_DialogResetButton  */
+    'color-picker':
+    0,
+    'copy':
+    0,
+    'close':
+    43, /* QStyle::SP_DialogCloseButton */
+    'cut':
+    0,
+    'delete':
+    0,
+    'dialog-error':
+    0,
+    'dialog-info':
+    0,
+    'dialog-question':
+    12, /* QStyle::SP_MessageBoxQuestion */
+    'dialog-warning':
+    10, /* QStyle::SP_MessageBoxWarning */
+    'directory':
+    37, /* QStyle::SP_DirIcon */
+    'file':
+    24, /* QStyle::SP_FileIcon */
+    'find':
+    0,
+    'go-back-ltr':
+    53, /* QStyle::SP_ArrowBack */
+    'go-back-rtl':
+    53, /* QStyle::SP_ArrowBack */
+    'go-back':
+    53, /* QStyle::SP_ArrowBack */
+    'go-forward-ltr':
+    54, /* QStyle::SP_ArrowForward */
+    'go-forward-rtl':
+    54, /* QStyle::SP_ArrowForward */
+    'go-forward':
+    54, /* QStyle::SP_ArrowForward */
+    'go-up':
+    49, /* QStyle::SP_ArrowUp */
+    'goto-first':
+    0,
+    'goto-last':
+    0,
+    'help':
+    7, /* QStyle::SP_TitleBarContextHelpButton */
+    'home':
+    55, /* QStyle::SP_DirHomeIcon */
+    'info':
+    9, /* QStyle::SP_MessageBoxInformation */
+    'jump-to':
+    0,
+    'media-pause':
+    0,
+    'media-play':
+    0,
+    'network':
+    20, /* QStyle::SP_DriveNetIcon */
+    'no':
+    48, /* QStyle::SP_DialogNoButton */
+    'ok':
+    38, /* QStyle::SP_DialogOkButton */
+    'open':
+    21, /* QStyle::SP_DirOpenIcon */
+    'orientation-landscape':
+    0,
+    'orientation-portrait':
+    0,
+    'paste':
+    0,
+    'preferences':
+    34, /* QStyle::SP_FileDialogContentsView */
+    'print-preview':
+    0,
+    'print':
+    0,
+    'properties':
+    0,
+    'quit':
+    0,
+    'redo':
+    0,
+    'refresh':
+    58, /* QStyle::SP_BrowserReload */
+    'remove':
+    0,
+    'revert-to-saved':
+    0,
+    'save-as':
+    42, /* QStyle::SP_DialogSaveButton */
+    'save':
+    42, /* QStyle::SP_DialogSaveButton */
+    'select-all':
+    0,
+    'select-font':
+    0,
+    'stop':
+    59, /* QStyle::SP_BrowserStop */
+    'undelete':
+    0,
+    'undo':
+    0,
+    'yes':
+    47, /* QStyle::SP_DialogYesButton */
+    'zoom-100':
+    0,
+    'zoom-in':
+    0,
+    'zoom-out':
+    0
+  },
+}
+var components = [GtkQtIconsConverter];
+function NSGetModule(compMgr, fileSpec) {
+  return XPCOMUtils.generateModule(components);
+}
+
new file mode 100644
--- /dev/null
+++ b/modules/libpr0n/decoders/icon/qt/nsIconChannel.cpp
@@ -0,0 +1,161 @@
+/* vim:set ts=2 sw=2 sts=2 cin et: */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is the Mozilla icon channel for Qt.
+ *
+ * The Initial Developer of the Original Code is Nokia
+ * Portions created by the Initial Developer are Copyright (C) 2008
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Oleg Romashin <romaxa@gmail.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "nsIMIMEService.h"
+
+#include "nsIStringBundle.h"
+
+#include "nsNetUtil.h"
+#include "nsIURL.h"
+#include "prlink.h"
+
+#include "nsIconChannel.h"
+#include "nsGtkQtIconsConverter.h"
+
+#include <QIcon>
+#include <QStyle>
+#include <QApplication>
+
+NS_IMPL_ISUPPORTS2(nsIconChannel,
+                   nsIRequest,
+                   nsIChannel)
+
+static nsresult
+moz_qicon_to_channel(QImage *image, nsIURI *aURI,
+                     nsIChannel **aChannel)
+{
+  NS_ENSURE_ARG_POINTER(image);
+
+  int width = image->width();
+  int height = image->height();
+
+  NS_ENSURE_TRUE(height < 256 && width < 256 && height > 0 && width > 0,
+                 NS_ERROR_UNEXPECTED);
+
+  const int n_channels = 4;
+  long int buf_size = 2 + n_channels * height * width;
+  PRUint8 * const buf = (PRUint8*)NS_Alloc(buf_size);
+  NS_ENSURE_TRUE(buf, NS_ERROR_OUT_OF_MEMORY);
+  PRUint8 *out = buf;
+
+  *(out++) = width;
+  *(out++) = height;
+
+  const uchar * const pixels = image->bits();
+  int rowextra = image->bytesPerLine() - width * n_channels;
+
+  // encode the RGB data and the A data
+  const uchar * in = pixels;
+  for (int y = 0; y < height; ++y, in += rowextra) {
+    for (int x = 0; x < width; ++x) {
+      PRUint8 r = *(in++);
+      PRUint8 g = *(in++);
+      PRUint8 b = *(in++);
+      PRUint8 a = *(in++);
+#define DO_PREMULTIPLY(c_) PRUint8(PRUint16(c_) * PRUint16(a) / PRUint16(255))
+#ifdef IS_LITTLE_ENDIAN
+      *(out++) = DO_PREMULTIPLY(b);
+      *(out++) = DO_PREMULTIPLY(g);
+      *(out++) = DO_PREMULTIPLY(r);
+      *(out++) = a;
+#else
+      *(out++) = a;
+      *(out++) = DO_PREMULTIPLY(r);
+      *(out++) = DO_PREMULTIPLY(g);
+      *(out++) = DO_PREMULTIPLY(b);
+#endif
+#undef DO_PREMULTIPLY
+    }
+  }
+
+  NS_ASSERTION(out == buf + buf_size, "size miscalculation");
+
+  nsresult rv;
+  nsCOMPtr<nsIStringInputStream> stream =
+    do_CreateInstance("@mozilla.org/io/string-input-stream;1", &rv);
+  NS_ENSURE_SUCCESS(rv, rv);
+
+  rv = stream->AdoptData((char*)buf, buf_size);
+  NS_ENSURE_SUCCESS(rv, rv);
+
+  return NS_NewInputStreamChannel(aChannel, aURI, stream,
+                                  NS_LITERAL_CSTRING("image/icon"));
+}
+
+nsresult
+nsIconChannel::Init(nsIURI* aURI)
+{
+
+  nsCOMPtr<nsIMozIconURI> iconURI = do_QueryInterface(aURI);
+  NS_ASSERTION(iconURI, "URI is not an nsIMozIconURI");
+
+  nsCAutoString stockIcon;
+  iconURI->GetStockIcon(stockIcon);
+
+  nsCAutoString iconSizeString;
+  iconURI->GetIconSize(iconSizeString);
+
+  PRUint32 desiredImageSize;
+  iconURI->GetImageSize(&desiredImageSize);
+
+  nsCAutoString iconStateString;
+  iconURI->GetIconState(iconStateString);
+  bool disabled = iconStateString.EqualsLiteral("disabled");
+
+  QStyle::StandardPixmap sp_icon = (QStyle::StandardPixmap)0;
+  nsCOMPtr <nsIGtkQtIconsConverter> converter = do_GetService("@mozilla.org/gtkqticonsconverter;1");
+  if (converter) {
+    PRInt32 res = 0;
+    stockIcon.Cut(0,4);
+    converter->Convert(stockIcon.get(), &res);
+    sp_icon = (QStyle::StandardPixmap)res;
+    // printf("ConvertIcon: icon:'%s' -> res:%i\n", stockIcon.get(), res);
+  }
+  if (!sp_icon)
+    return NS_ERROR_FAILURE;
+
+  QStyle *style = qApp->style();
+  NS_ENSURE_TRUE(style, NS_ERROR_NULL_POINTER);
+  QPixmap pixmap = style->standardIcon(sp_icon).pixmap(desiredImageSize, desiredImageSize, disabled?QIcon::Disabled:QIcon::Normal);
+  QImage image = pixmap.toImage();
+
+  return moz_qicon_to_channel(&image, iconURI,
+                              getter_AddRefs(mRealChannel));
+}
new file mode 100644
--- /dev/null
+++ b/modules/libpr0n/decoders/icon/qt/nsIconChannel.h
@@ -0,0 +1,75 @@
+/* vim:set ts=2 sw=2 sts=2 cin et: */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is the Mozilla icon channel for Qt.
+ *
+ * The Initial Developer of the Original Code is Nokia
+ * Portions created by the Initial Developer are Copyright (C) 2008
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Oleg Romashin <romaxa@gmail.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#ifndef nsIconChannel_h_
+#define nsIconChannel_h_
+
+#include "nsIChannel.h"
+#include "nsIStreamListener.h"
+#include "nsIURI.h"
+#include "nsIIconURI.h"
+#include "nsCOMPtr.h"
+
+/**
+ * This class is the gnome implementation of nsIconChannel. It basically asks
+ * qt for an icon, and creates a new channel for
+ * that file to which all calls will be proxied.
+ */
+class nsIconChannel : public nsIChannel {
+  public:
+    NS_DECL_ISUPPORTS
+    NS_FORWARD_NSIREQUEST(mRealChannel->)
+    NS_FORWARD_NSICHANNEL(mRealChannel->)
+
+    nsIconChannel() {}
+    ~nsIconChannel() {}
+
+    /**
+     * Called by nsIconProtocolHandler after it creates this channel.
+     * Must be called before calling any other function on this object.
+     * If this method fails, no other function must be called on this object.
+     */
+    NS_HIDDEN_(nsresult) Init(nsIURI* aURI);
+  private:
+    /**
+     * The channel to the temp icon file (e.g. to /tmp/2qy9wjqw.html).
+     * Will always be non-null after a successful Init.
+     */
+    nsCOMPtr<nsIChannel> mRealChannel;
+};
+
+#endif
new file mode 100644
--- /dev/null
+++ b/modules/libpr0n/decoders/icon/qt/public/Makefile.in
@@ -0,0 +1,50 @@
+# ***** BEGIN LICENSE BLOCK *****
+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Original Code is the Mozilla icon channel for Qt.
+#
+# The Initial Developer of the Original Code is Nokia
+# Portions created by the Initial Developer are Copyright (C) 2008
+# the Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+#   Oleg Romashin <romaxa@gmail.com>
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 2 or later (the "GPL"), or
+# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+# in which case the provisions of the GPL or the LGPL are applicable instead
+# of those above. If you wish to allow use of your version of this file only
+# under the terms of either the GPL or the LGPL, and not to allow others to
+# use your version of this file under the terms of the MPL, indicate your
+# decision by deleting the provisions above and replace them with the notice
+# and other provisions required by the GPL or the LGPL. If you do not delete
+# the provisions above, a recipient may use your version of this file under
+# the terms of any one of the MPL, the GPL or the LGPL.
+#
+# ***** END LICENSE BLOCK *****
+
+DEPTH		= ../../../../../..
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+MODULE		= gtkqticonsconverter
+XPIDL_MODULE	= gtkqticonsconverter
+
+XPIDLSRCS	= nsGtkQtIconsConverter.idl
+
+include $(topsrcdir)/config/rules.mk
+
new file mode 100644
--- /dev/null
+++ b/modules/libpr0n/decoders/icon/qt/public/nsGtkQtIconsConverter.idl
@@ -0,0 +1,44 @@
+/* vim:set ts=2 sw=2 sts=2 cin et: */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is the Mozilla icon channel for Qt.
+ *
+ * The Initial Developer of the Original Code is Nokia
+ * Portions created by the Initial Developer are Copyright (C) 2008
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Oleg Romashin <romaxa@gmail.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include "nsISupports.idl"
+
+[scriptable, uuid(c0783c34-a831-40c6-8c03-98c9f74cca45)]
+interface nsIGtkQtIconsConverter : nsISupports
+{
+  long convert(in string icon);
+};
--- a/storage/public/mozIStorageError.idl
+++ b/storage/public/mozIStorageError.idl
@@ -34,16 +34,22 @@
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsISupports.idl"
 
+%{C++
+#ifdef ERROR
+#undef ERROR
+#endif
+%}
+
 [scriptable, uuid(1f350f96-7023-434a-8864-40a1c493aac1)]
 interface mozIStorageError : nsISupports {
 
   /**
    * General SQL error or missing database.
    */
   const long ERROR = 1;
 
--- a/storage/src/mozStorageRow.cpp
+++ b/storage/src/mozStorageRow.cpp
@@ -220,18 +220,18 @@ mozStorageRow::GetString(PRUint32 aIndex
 
 NS_IMETHODIMP
 mozStorageRow::GetBlob(PRUint32 aIndex, PRUint32 *_size, PRUint8 **_blob)
 {
   if (aIndex >= mNumCols)
     return NS_ERROR_ILLEGAL_VALUE;
 
   PRUint16 type;
-  nsIID interface;
-  return mData.ObjectAt(aIndex)->GetAsArray(&type, &interface, _size,
+  nsIID interfaceIID;
+  return mData.ObjectAt(aIndex)->GetAsArray(&type, &interfaceIID, _size,
                                             reinterpret_cast<void **>(_blob));
 }
 
 NS_IMETHODIMP
 mozStorageRow::GetIsNull(PRUint32 aIndex, PRBool *_isNull)
 {
   if (aIndex >= mNumCols)
     return NS_ERROR_ILLEGAL_VALUE;
--- a/testing/mochitest/harness-overlay.xul
+++ b/testing/mochitest/harness-overlay.xul
@@ -41,18 +41,21 @@
       var srvScope = {};
       scriptLoader.loadSubScript("chrome://mochikit/content/server.js",
                                  srvScope);
 
       // generate our test list
       srvScope.makeTags();
       var url = "chrome://mochikit/content/" + dir + "/";
       var [links, count] = srvScope.list(url, chromeDir, true);
-      var tableContent = srvScope.linksToTableRows(links, 0);
+      var listContent = srvScope.linksToListItems(links);
+      var tableContent = srvScope.linksToTableRows(links);
       function populate() {
+        $("list-holder").setAttribute("rowspan", 1 + count);
+        $("test-list").innerHTML += listContent;
         $("test-table").innerHTML += tableContent;
         $("wrapper").innerHTML += " "; // redraw the table
       }
       gTestList = eval(srvScope.jsonArrayOfTestFiles(links));
       populate();
       hookup();
 
       // if we got passed a test path, just run that single test
@@ -91,17 +94,19 @@
           <br />
         </div>
         <div id="wrapper">
           <table cellpadding="0" cellspacing="0" id="test-table">
             <tr>
               <td>Passed</td>
               <td>Failed</td>
               <td>Todo</td>
-              <td>Test Files</td>
+              <td id="list-holder">
+                <ul class="top" id="test-list"><li><b>Test Files</b></li></ul>
+              </td>
             </tr>
           </table>
         </div>
       </div>
     </body>
   </vbox>
 </window>
 
--- a/testing/mochitest/server.js
+++ b/testing/mochitest/server.js
@@ -394,55 +394,30 @@ function linksToListItems(links)
 
   }
   return response;
 }
 
 /**
  * Transform nested hashtables of paths to a flat table rows.
  */
-function linksToTableRows(links, recursionLevel)
+function linksToTableRows(links)
 {
   var response = "";
   for (var [link, value] in links) {
     var classVal = (!isTest(link) && !(value instanceof Object))
       ? "non-test invisible"
       : "";
-
-    spacer = "padding-left: " + (10 * recursionLevel) + "px";
-
     if (value instanceof Object) {
       response += TR({class: "dir", id: "tr-" + link },
-                     TD({colspan: "3"}, "&#160;"),
-                     TD({style: spacer},
-                        A({href: link}, link)));
-      response += linksToTableRows(value, recursionLevel + 1);
+                     TD({colspan: "3"},"&#160;"));
+      response += linksToTableRows(value);
     } else {
-      var bug_title = link.match(/test_bug\S+/);
-      var bug_num = null;
-      if (bug_title != null) {
-          bug_num = bug_title[0].match(/\d+/);
-      }
-      if ((bug_title == null) || (bug_num == null)) {
-        response += TR({class: classVal, id: "tr-" + link },
-                       TD("0"),
-                       TD("0"),
-                       TD("0"),
-                       TD({style: spacer},
-                          A({href: link}, link)));
-      } else {
-        var bug_url = "https://bugzilla.mozilla.org/show_bug.cgi?id=" + bug_num;
-        response += TR({class: classVal, id: "tr-" + link },
-                       TD("0"),
-                       TD("0"),
-                       TD("0"),
-                       TD({style: spacer},
-                          A({href: link}, link), " - ",
-                          A({href: bug_url}, "Bug " + bug_num)));
-      }
+      response += TR({class: classVal, id: "tr-" + link},
+                     TD("0"), TD("0"), TD("0"));
     }
   }
   return response;
 }
 
 function arrayOfTestFiles(linkArray, fileArray, testPattern) {
   for (var [link, value] in linkArray) {
     if (value instanceof Object) {
@@ -544,18 +519,25 @@ function testListing(metadata, response)
           ),
           DIV({class: "clear"}),
           DIV({class: "toggle"},
             A({href: "#", id: "toggleNonTests"}, "Show Non-Tests"),
             BR()
           ),
     
           TABLE({cellpadding: 0, cellspacing: 0, id: "test-table"},
-            TR(TD("Passed"), TD("Failed"), TD("Todo"), TD("Test Files")),
-            linksToTableRows(links, 0)
+            TR(TD("Passed"), TD("Failed"), TD("Todo"), 
+                TD({rowspan: count+1},
+                   UL({class: "top"},
+                      LI(B("Test Files")),        
+                      linksToListItems(links)
+                      )
+                )
+            ),
+            linksToTableRows(links)
           ),
           DIV({class: "clear"})
         )
       )
     )
   );
 }
 
--- a/testing/mochitest/tests/SimpleTest/TestRunner.js
+++ b/testing/mochitest/tests/SimpleTest/TestRunner.js
@@ -192,16 +192,17 @@ TestRunner.updateUI = function() {
   } else if (passCount > 0) {
     indicator.innerHTML = "Status: Pass";
     indicator.style.backgroundColor = "green";
   }
 
   // Set the table values
   var trID = "tr-" + $('current-test-path').innerHTML;
   var row = $(trID);
-  var tds = row.getElementsByTagName("td");
-  tds[0].style.backgroundColor = results.notOK > 0 ? "#f00" : "#0d0";
-  tds[0].textContent = results.OK;
-  tds[1].style.backgroundColor = results.notOK > 0 ? "#f00" : "#0d0";
-  tds[1].textContent = results.notOK;
-  tds[2].style.backgroundColor = results.todo > 0 ? "orange" : "#0d0";
-  tds[2].textContent = results.todo;
+  replaceChildNodes(row,
+    TD({'style':
+        {'backgroundColor': results.notOK > 0 ? "#f00":"#0d0"}}, results.OK),
+    TD({'style':
+        {'backgroundColor': results.notOK > 0 ? "#f00":"#0d0"}}, results.notOK),
+    TD({'style': {'backgroundColor':
+                   results.todo > 0 ? "orange":"#0d0"}}, results.todo)
+  );
 }
--- a/toolkit/components/Makefile.in
+++ b/toolkit/components/Makefile.in
@@ -48,21 +48,16 @@ include $(topsrcdir)/config/config.mk
 ifdef MOZ_ENABLE_XREMOTE
 DIRS += remote
 endif
 DIRS += \
         urlformatter \
         contentprefs \
         microformats \
         places \
-        $(NULL)
-
-# These component dirs are built only for XUL apps
-
-DIRS += \
 	apppicker \
 	filepicker \
 	console \
 	exthelper \
 	viewconfig \
 	typeaheadfind \
 	parentalcontrols \
 	$(NULL)
@@ -90,28 +85,29 @@ DIRS +=	viewsource
 endif
 
 ifndef MOZ_SUITE
 ifndef MOZ_THUNDERBIRD
 DIRS +=	search
 endif
 endif
 
-ifdef MOZ_THUNDERBIRD
-DIRS += autocomplete/public
-else
+ifdef MOZ_XUL
+DIRS += \
+	autocomplete \
+	$(NULL)
+endif
+
+ifndef MOZ_THUNDERBIRD
 DIRS +=	\
 	cookie \
 	$(NULL)
 
 ifdef MOZ_XUL
-DIRS += \
-	autocomplete \
-	satchel \
-	$(NULL)
+DIRS += satchel
 endif # MOZ_XUL
 
 ifdef MOZ_SUITE
 # Suite can't use passwordmgr because mail still depends on wallet (bug 239131)
 DIRS += passwordmgr/public
 else
 DIRS += passwordmgr
 endif # MOZ_SUITE
--- a/toolkit/components/passwordmgr/src/storage-Legacy.js
+++ b/toolkit/components/passwordmgr/src/storage-Legacy.js
@@ -857,17 +857,21 @@ LoginManagerStorage_legacy.prototype = {
                         PASSFIELD : 5, PASSVALUE : 6, ACTIONURL : 7,
                         FILLER : 8 };
         var parseState = STATE.HEADER;
 
         var processEntry = false;
 
         do {
             var hasMore = lineStream.readLine(line);
-            line.value = this._utfConverter.ConvertToUnicode(line.value);
+            try {
+              line.value = this._utfConverter.ConvertToUnicode(line.value);
+            } catch (e) {
+              this.log("Bad UTF8 conversion: " + line.value);
+            }
 
             switch (parseState) {
                 // Check file header
                 case STATE.HEADER:
                     if (line.value == "#2c") {
                         formatVersion = 0x2c;
                     } else if (line.value == "#2d") {
                         formatVersion = 0x2d;
new file mode 100644
--- /dev/null
+++ b/toolkit/components/passwordmgr/test/unit/data/signons-454708.txt
@@ -0,0 +1,10 @@
+#2e
+.
+https://FcK.jp
+put_user_here
+MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECEnlbhAkNBbBBBCexD5eaffSLGH/ORiFlQ4X
+*put_pw_here
+MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECHmiTaseYjkkBBAA0ILJTFSa5CnlpD5PTEYR
+https://FcK.jp
+---
+.
--- a/toolkit/components/passwordmgr/test/unit/test_storage_legacy_3.js
+++ b/toolkit/components/passwordmgr/test/unit/test_storage_legacy_3.js
@@ -581,14 +581,41 @@ storage.setLoginSavingEnabled(utfHost, f
 
 LoginTest.checkStorageData(storage, [utfHost], [utfUser1, utfUser2]);
 
 testdesc = "[flush and reload for verification]"
 storage = LoginTest.reloadStorage(OUTDIR, "output-451155.txt");
 LoginTest.checkStorageData(storage, [utfHost], [utfUser1, utfUser2]);
 
 
+/*
+ * ---------------------- Bug 454708 ----------------------
+ * Check that previous saved entries that are not valid UTF8
+ * are read without blowing up.
+ */
+
+/* ========== 16 ========== */
+testnum++;
+testdesc = "ensure bogus UTF8 strings don't cause failures."
+
+var badHost = "https://FcK" + String.fromCharCode(0x8a) + ".jp";
+var bad8User = Cc["@mozilla.org/login-manager/loginInfo;1"].
+               createInstance(Ci.nsILoginInfo);
+bad8User.init(badHost, badHost, null,
+              "dummydude", "itsasecret", "put_user_here", "put_pw_here");
+
+storage = LoginTest.initStorage(INDIR, "signons-454708.txt",
+                               OUTDIR, "output-454708.txt");
+LoginTest.checkStorageData(storage, [], [bad8User]);
+
+// The output file should contain valid UTF8 now, but the resulting
+// JS string value remains the same.
+
+testdesc = "[flush and reload for verification]"
+storage = LoginTest.reloadStorage(OUTDIR, "output-454708.txt");
+LoginTest.checkStorageData(storage, [], [bad8User]);
+
 /* ========== end ========== */
 } catch (e) {
     throw ("FAILED in test #" + testnum + " -- " + testdesc + ": " + e);
 }
 
 };
old mode 100755
new mode 100644
old mode 100755
new mode 100644
--- a/toolkit/content/Makefile.in
+++ b/toolkit/content/Makefile.in
@@ -53,27 +53,29 @@ DEFINES += \
   -DCC_VERSION="$(CC_VERSION)" \
   -DCFLAGS="$(CFLAGS)" \
   -DCXX="$(CXX)" \
   -DCXX_VERSION="$(CXX_VERSION)" \
   -DCXXFLAGS="$(CXXFLAGS)" \
   -DCPPFLAGS="$(CPPFLAGS)" \
   $(NULL)
 
-CHANGESET := $(shell cd $(topsrcdir) ; hg identify 2>/dev/null | cut -f1 -d' ')
+CHANGESET := $(shell cd $(topsrcdir) && hg identify 2>/dev/null | cut -f1 -d' ')
 ifdef CHANGESET
 DEFINES += -DSOURCE_CHANGESET="$(CHANGESET)"
 endif
 
 # strip a trailing slash from the repo URL because it's not always present,
 # and we want to construct a working URL in buildconfig.html
 # make+shell+sed = awful
 _dollar=$$
-SOURCE_REPO := $(shell hg -R $(topsrcdir) showconfig paths.default 2>/dev/null | sed -e "s/^ssh:/http:/" -e "s/\/$(_dollar)//" )
-ifdef SOURCE_REPO
+SOURCE_REPO := $(shell cd $(topsrcdir) && hg showconfig paths.default 2>/dev/null | head -n1 | sed -e "s/^ssh:/http:/" -e "s/\/$(_dollar)//" )
+# extra sanity check for old versions of hg
+# that don't support showconfig
+ifeq (http,$(patsubst http%,http,$(SOURCE_REPO)))
 DEFINES += -DSOURCE_REPO="$(SOURCE_REPO)"
 endif
 
 ifdef ENABLE_TESTS
 DIRS += tests
 endif
 
 EXTRA_JS_MODULES = debug.js
--- a/tools/jprof/leaky.cpp
+++ b/tools/jprof/leaky.cpp
@@ -286,18 +286,18 @@ void leaky::open()
 
 //----------------------------------------------------------------------
 
 
 static int symbolOrder(void const* a, void const* b)
 {
   Symbol const* ap = (Symbol const *)a;
   Symbol const* bp = (Symbol const *)b;
-  ptrdiff_t diff = ap->address - bp->address;
-  return (diff == 0) ? 0 : ((diff > 0) ? 1 : -1);
+  return ap->address == bp->address ? 0 :
+    (ap->address > bp->address ? 1 : -1);
 }
 
 void leaky::ReadSharedLibrarySymbols()
 {
   LoadMapEntry* lme = loadMap;
   while (NULL != lme) {
     ReadSymbols(lme->name, lme->address);
     lme = lme->next;
--- a/tools/test-harness/xpcshell-simple/test_one.sh
+++ b/tools/test-harness/xpcshell-simple/test_one.sh
@@ -127,22 +127,22 @@ do
     fi
 done
 
 
 ############
 # RUN TEST #
 ############
 
-echo "NATIVE_TOPSRCDIR='$native_topsrcdir' TOPSRCDIR='$topsrcdir' $xpcshell -s $headfiles -f $testdir/$target_dir/$target_js $tailfiles 2>&1"
+echo "NATIVE_TOPSRCDIR='$native_topsrcdir' TOPSRCDIR='$topsrcdir' $xpcshell -j -s $headfiles -f $testdir/$target_dir/$target_js $tailfiles 2>&1"
 echo -n "$target_js: "
 if [ ! "$interactive_mode" = "1" ]; then
-    NATIVE_TOPSRCDIR="$native_topsrcdir" TOPSRCDIR="$topsrcdir" $xpcshell -s $headfiles -f $testdir/$target_dir/$target_js $tailfiles  2> $testdir/$target_dir/$target_js.log 1>&2
+    NATIVE_TOPSRCDIR="$native_topsrcdir" TOPSRCDIR="$topsrcdir" $xpcshell -j -s $headfiles -f $testdir/$target_dir/$target_js $tailfiles  2> $testdir/$target_dir/$target_js.log 1>&2
 else
-    NATIVE_TOPSRCDIR="$native_topsrcdir" TOPSRCDIR="$topsrcdir" $xpcshell -s $headfiles -f $testdir/$target_dir/$target_js $tailfiles -i 2>&1
+    NATIVE_TOPSRCDIR="$native_topsrcdir" TOPSRCDIR="$topsrcdir" $xpcshell -j -s $headfiles -f $testdir/$target_dir/$target_js $tailfiles -i 2>&1
 fi
 rv="$?"
 if [ ! "$rv" = "0"  -o \
      `grep -c '\*\*\* PASS' $testdir/$target_dir/$target_js.log` = 0 ]
 then
     echo "FAIL"
     echo "$target_js.log:"
     echo ">>>>>>>"
--- a/uriloader/exthandler/tests/unit/test_punycodeURIs.js
+++ b/uriloader/exthandler/tests/unit/test_punycodeURIs.js
@@ -75,16 +75,27 @@ function checkFile() {
   // have to check for the argument mac gives us.
   if (data.substring(0, 7) != "-psn_0_")
     do_check_eq(data, kExpectedURI);
 
   do_test_finished();
 }
 
 function run_test() {
+  // don't run the test on Mac OS 10.4 - see bug 447999
+  const httpHandler =
+    Components.classes["@mozilla.org/network/protocol;1?name=http"]
+              .getService(Components.interfaces.nsIHttpProtocolHandler);
+  const oscpu = httpHandler.oscpu;
+  if (oscpu.match(/Mac OS X 10.4/)) {
+    dump("This test is not run on Mac OS 10.4 because it fails for unknown " +
+         "reasons. See bug 447999.\n");
+    return;
+  }
+
   // set up the uri to test with
   var ioService = Components.classes["@mozilla.org/network/io-service;1"].
     getService(Components.interfaces.nsIIOService);
 
   // set up the local handler object
   var localHandler = 
     Components.classes["@mozilla.org/uriloader/local-handler-app;1"].
     createInstance(Components.interfaces.nsILocalHandlerApp);
--- a/widget/src/windows/nsWindow.cpp
+++ b/widget/src/windows/nsWindow.cpp
@@ -3527,16 +3527,17 @@ SetupKeyModifiersSequence(nsTArray<KeyPa
 
 nsresult
 nsWindow::SynthesizeNativeKeyEvent(PRInt32 aNativeKeyboardLayout,
                                    PRInt32 aNativeKeyCode,
                                    PRUint32 aModifierFlags,
                                    const nsAString& aCharacters,
                                    const nsAString& aUnmodifiedCharacters)
 {
+#ifndef WINCE  //Win CE doesn't support many of the calls used in this method, perhaps theres another way
   nsPrintfCString layoutName("%08x", aNativeKeyboardLayout);
   HKL loadedLayout = LoadKeyboardLayoutA(layoutName.get(), KLF_NOTELLSHELL);
   if (loadedLayout == NULL)
     return NS_ERROR_NOT_AVAILABLE;
 
   // Setup clean key state and load desired layout
   BYTE originalKbdState[256];
   ::GetKeyboardState(originalKbdState);
@@ -3588,16 +3589,19 @@ nsWindow::SynthesizeNativeKeyEvent(PRInt
   // Restore old key state and layout
   ::SetKeyboardState(originalKbdState);
   gKeyboardLayout = oldLayout;
   gKbdLayout.LoadLayout(gKeyboardLayout);
   SetupModKeyState();
   
   UnloadKeyboardLayout(loadedLayout);
   return NS_OK;
+#else  //XXX: is there another way to do this?
+  return NS_ERROR_NOT_IMPLEMENTED;
+#endif  
 }
 
 void nsWindow::ConstrainZLevel(HWND *aAfter)
 {
   nsZLevelEvent  event(PR_TRUE, NS_SETZLEVEL, this);
   nsWindow      *aboveWindow = 0;
 
   InitEvent(event);
@@ -4137,16 +4141,17 @@ PRBool nsWindow::ProcessMessage(UINT msg
         nsMenuEvent event(PR_TRUE, NS_MENU_SELECTED, this);
         event.mCommand = LOWORD(wParam);
         InitEvent(event);
         result = DispatchWindowEvent(&event);
       }
     }
     break;
 
+#ifndef WINCE
     // WM_QUERYENDSESSION must be handled by all windows.
     // Otherwise Windows thinks the window can just be killed at will.
     case WM_QUERYENDSESSION:
       if (sCanQuit == TRI_UNKNOWN)
       {
         // Ask if it's ok to quit, and store the answer until we
         // get WM_ENDSESSION signaling the round is complete.
         nsCOMPtr<nsIObserverService> obsServ =
@@ -4181,18 +4186,17 @@ PRBool nsWindow::ProcessMessage(UINT msg
         obsServ->NotifyObservers(nsnull, "profile-change-teardown", context.get());
         obsServ->NotifyObservers(nsnull, "profile-before-change", context.get());
         // Then a controlled but very quick exit.
         _exit(0);
       }
       sCanQuit = TRI_UNKNOWN;
       result = PR_TRUE;
       break;
-    
-#ifndef WINCE
+
     case WM_DISPLAYCHANGE:
       DispatchStandardEvent(NS_DISPLAYCHANGED);
       break;
 #endif
 
     case WM_SYSCOLORCHANGE:
       // Note: This is sent for child windows as well as top-level windows.
       // The Win32 toolkit normally only sends these events to top-level windows.
@@ -4734,31 +4738,32 @@ PRBool nsWindow::ProcessMessage(UINT msg
             *aRetValue = MA_NOACTIVATE;
 
           if (gSwitchKeyboardLayout && mLastKeyboardLayout)
             ActivateKeyboardLayout(mLastKeyboardLayout, 0);
         }
       }
       break;
 
+#ifndef WINCE
+
     case WM_MOUSEACTIVATE:
       if (mWindowType == eWindowType_popup) {
         // a popup with a parent owner should not be activated when clicked
         // but should still allow the mouse event to be fired, so the return
         // value is set to MA_NOACTIVATE. But if the owner isn't the frontmost
         // window, just use default processing so that the window is activated.
         HWND owner = ::GetWindow(mWnd, GW_OWNER);
         if (owner && owner == ::GetForegroundWindow()) {
           *aRetValue = MA_NOACTIVATE;
           result = PR_TRUE;
         }
       }
       break;
 
-#ifndef WINCE
     case WM_WINDOWPOSCHANGING:
     {
       LPWINDOWPOS info = (LPWINDOWPOS) lParam;
       // enforce local z-order rules
       if (!(info->flags & SWP_NOZORDER))
         ConstrainZLevel(&info->hwndInsertAfter);
       // prevent rude external programs from making hidden window visible
       if (mWindowType == eWindowType_invisible)
@@ -6920,17 +6925,17 @@ BOOL nsWindow::OnIMEComposition(LPARAM a
 
     sIMEAttributeArrayLength = attrStrLen;
 
     //--------------------------------------------------------
     // 4. Get GCS_CURSOPOS
     //--------------------------------------------------------
     sIMECursorPosition = ::ImmGetCompositionStringW(hIMEContext, GCS_CURSORPOS, NULL, 0);
 
-    NS_ASSERTION(sIMECursorPosition <= sIMECompUnicode->Length(), "illegal pos");
+    NS_ASSERTION(sIMECursorPosition <= (long)sIMECompUnicode->Length(), "illegal pos");
 
 #ifdef DEBUG_IME
     printf("sIMECursorPosition(Unicode): %d\n", sIMECursorPosition);
 #endif
     //--------------------------------------------------------
     // 5. Send the text event
     //--------------------------------------------------------
     HandleTextEvent(hIMEContext);
deleted file mode 100644
--- a/xpfe/components/history/src/nsHistoryLoadListener.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
- *
- * ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Mozilla Communicator client code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Alec Flett <alecf@netscape.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-
-#include "nsIWebProgressListener.h"
-#include "nsIBrowserHistory.h"
-#include "nsCOMPtr.h"
-#include "nsIComponentManager.h"
-#include "nsWeakReference.h"
-#include "nsIGenericFactory.h"
-
-class nsHistoryLoadListener : public nsIWebProgressListener,
-                              public nsSupportsWeakReference
-{
- public:
-    nsHistoryLoadListener(nsIBrowserHistory *);
-    virtual ~nsHistoryLoadListener();
-
-    nsresult Init();
-
-    NS_DECL_ISUPPORTS
-    NS_DECL_NSIWEBPROGRESSLISTENER
-        
- protected:
-    nsCOMPtr<nsIBrowserHistory> mHistory;
-
-};
-
deleted file mode 100644
--- a/xpfe/global/resources/content/nsWidgetStateManager.js
+++ /dev/null
@@ -1,425 +0,0 @@
-/* -*- Mode: Java; tab-width: 2; c-basic-offset: 2; -*-
- *
- * ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org Code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Ben Goodger <ben@netscape.com> (Original Author)
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-/** Presenting widgetStateManager the Third.
- *   a production of ye olde bard Ben Goodger and his Merry XUL Widget Crewe.
- *  =>> MODIFICATIONS MUST BE REVIEWED BY ben@netscape.com!!! <<=
- **/
-
-var wsm;
-
-function nsWidgetStateManager (aFrameID)
-{
-
-  this.dataManager = {
-    /** Persisted Data Hash Table
-     *  Page_ID -> Element_ID -> Property -> Value
-     **/
-    pageData: { },
-
-    setPageData: function (aPageTag, aDataObject)
-    {
-      this.pageData[aPageTag] = aDataObject;
-    },
-
-    getPageData: function (aPageTag)
-    {
-      if (!(aPageTag in this.pageData))
-        this.pageData[aPageTag] = { };
-      return this.pageData[aPageTag];
-    },
-
-    setItemData: function (aPageTag, aItemID, aDataObject)
-    {
-      if (!(aPageTag in this.pageData))
-        this.pageData[aPageTag] = new Object();
-      
-      this.pageData[aPageTag][aItemID] = aDataObject;
-    },
-
-    getItemData: function (aPageTag, aItemID)
-    {
-      if (!(aItemID in this.pageData[aPageTag]))
-        this.pageData[aPageTag][aItemID] = new Object();
-      return this.pageData[aPageTag][aItemID];
-    }
-  }
-
-  this.contentID    = aFrameID;
-
-  wsm               = this;
-
-  /** Element Handlers
-   *  Provides default get and set handler functions for supported
-   *  widgets. Clients can override or add new widgets.
-   **/
-  this.handlers     = {
-    colorpicker:
-      {  get: wsm.get_Colorpicker, set: wsm.set_Colorpicker   },
-    menulist:
-      {  get: wsm.get_Menulist,    set: wsm.set_Menulist      },
-    radiogroup:
-      {  get: wsm.get_Radiogroup,  set: wsm.set_Radiogroup    },
-    checkbox:
-      {  get: wsm.get_Checkbox,    set: wsm.set_Checkbox      },
-    textbox:
-      {  get: wsm.get_Textbox,     set: wsm.set_Textbox       },
-    listitem:
-      {  get: wsm.get_Listitem,    set: wsm.set_Listitem      },
-    data:
-      {  get: wsm.get_Data,        set: wsm.set_Data          },
-    default_handler:
-      {  get: wsm.get_Default,     set: wsm.set_Default       }
-  }
-
-  // extra attributes to scan and save.
-  this.attributes   = [];
-}
-
-nsWidgetStateManager.prototype =
-{
-  get contentArea ()
-  {
-    return window.frames[this.contentID];
-  },
-
-  savePageData: function (aPageTag)
-  {
-    if (!(aPageTag in this.dataManager.pageData))
-      return;
-
-    // Automatic element retrieval. This is done in two ways.
-    // 1) if an element id array is present in the document, this is
-    //    used to build a list of elements to persist. <-- performant
-    // 2) otherwise, all elements with "wsm_persist" set to true
-    //    are persisted <-- non-performant.
-    var elements;
-    if ("_elementIDs" in this.contentArea) {
-      elements = [];
-      for (var i = 0; i < this.contentArea._elementIDs.length; i++) {
-        var elt = this.contentArea.document.getElementById(this.contentArea._elementIDs[i]);
-        if (elt)
-          elements[elements.length] = elt;
-        else {
-          // see bug #40329. People forget this too often, and it breaks Prefs
-          dump("*** FIX ME: '_elementIDs' in '" + this.contentArea.location.href.split('/').pop() +
-               "' contains a reference to a non-existent element ID '" +
-          this.contentArea._elementIDs[i] + "'.\n");
-        }
-      }
-    }
-    else 
-      elements = this.contentArea.document.getElementsByAttribute("wsm_persist", "true");
-
-    for (var ii = 0; ii < elements.length; ii++) {
-      var elementID   = elements[ii].id;
-      var elementType = elements[ii].localName;
-
-      if (!(aPageTag in this.dataManager.pageData))
-        this.dataManager.pageData[aPageTag] = [];
-      this.dataManager.pageData[aPageTag][elementID] = [];
-
-      // persist attributes
-      var get_Func = (elementType in this.handlers) ?
-      this.handlers[elementType].get :
-      this.handlers.default_handler.get;
-      this.dataManager.setItemData(aPageTag, elementID, get_Func(elementID));
-    }
-
-    if ("GetFields" in this.contentArea) {
-      // save page data based on user supplied function in content area
-      var dataObject = this.dataManager.getPageData(aPageTag);
-      dataObject = this.contentArea.GetFields(dataObject);
-      if (dataObject)        
-        this.dataManager.setPageData(aPageTag, dataObject);
-    }
-  },
-
-  setPageData: function (aPageTag)
-  {
-    var pageData = this.dataManager.getPageData(aPageTag);
-    if ("SetFields" in this.contentArea) {
-      if (!this.contentArea.SetFields(pageData))
-      {
-        // If the function returns false (or null/undefined) then it
-        // doesn't want *us* to process the page data.
-        return;
-      }
-    }
-
-    for (var elementID in pageData) {
-      var element = this.contentArea.document.getElementById(elementID);
-      if (element) {
-        var elementType = element.localName;
-        var set_Func = (elementType in this.handlers) ?
-          this.handlers[elementType].set :
-          this.handlers.default_handler.set;
-        set_Func(elementID, pageData[elementID]);
-      }
-    }
-  },
-
-
-  /** Widget Get/Set Function Implementations
-   *  These can be overridden by the client.
-   **/
-  generic_Set: function (aElement, aDataObject)
-  {
-    if (aElement) {
-      for (var property in aDataObject) {
-        if (property == "localname")
-          continue;
-        if (!aDataObject[property] && typeof aDataObject[property] == "boolean")
-          aElement.removeAttribute(property);
-        else
-          aElement.setAttribute(property, aDataObject[property]);
-      }
-      
-      if (!aElement.getAttribute("disabled","true"))
-        aElement.removeAttribute("disabled");
-    }
-  },
-
-  generic_Get: function (aElement)
-  {
-    if (aElement) {
-      var dataObject = new Object();
-      var wsmAttributes = aElement.getAttribute("wsm_attributes");
-      var attributes = wsm.attributes;              // make a copy
-      if (wsmAttributes != "")
-        attributes.push(wsmAttributes.split(" "));  // modify the copy
-
-      for (var i = 0; i < attributes.length; i++)
-        dataObject[attributes[i]] = aElement.getAttribute(attributes[i]);
-
-      dataObject.localname = aElement.localName;
-      return dataObject;
-    }
-    return null;
-  },
-
-  // <colorpicker>
-  set_Colorpicker: function (aElementID, aDataObject)
-  {
-    var element = wsm.contentArea.document.getElementById(aElementID);
-    // set all generic properties
-    wsm.generic_Set(element, aDataObject);
-    // set colorpicker specific properties
-    if ('color' in aDataObject) {
-      try {
-        element.color = aDataObject.color;
-      }
-      catch (ex) {
-        dump(aElementID +", ex: " + ex + "\n");
-      }
-    }
-  },
-
-  get_Colorpicker: function (aElementID)
-  {
-    var element     = wsm.contentArea.document.getElementById(aElementID);
-    // retrieve all generic attributes
-    var dataObject  = wsm.generic_Get(element);
-    // retrieve all colorpicker specific attributes
-    if (dataObject) {
-      dataObject.color = element.color;
-      return dataObject;
-    }
-    return null;
-  },
-
-  // <menulist>
-  set_Menulist: function (aElementID, aDataObject)
-  {
-    var element = wsm.contentArea.document.getElementById(aElementID);
-    // set all generic properties
-    wsm.generic_Set(element, aDataObject);
-    // set menulist specific properties
-    if ("value" in aDataObject) {
-      try {
-        element.value = aDataObject.value;
-      }
-      catch (ex) {
-        dump(aElementID + ", ex: " + ex + "\n");
-      }
-    }
-  },
-
-  get_Menulist: function (aElementID)
-  {
-    var element     = wsm.contentArea.document.getElementById(aElementID);
-    // retrieve all generic attributes
-    var dataObject  = wsm.generic_Get(element);
-    // retrieve all menulist specific attributes
-    if (dataObject) {
-      dataObject.value = element.getAttribute("value");
-      return dataObject;
-    }
-    return null;
-  },
-
-  // <radiogroup>
-  set_Radiogroup: function (aElementID, aDataObject)
-  {
-    var element = wsm.contentArea.document.getElementById(aElementID);
-    wsm.generic_Set(element, aDataObject);
-    if ("value" in aDataObject)
-      element.value = aDataObject.value;
-    if ("disabled" in aDataObject)
-      element.disabled = aDataObject.disabled;
-  },
-
-  get_Radiogroup: function (aElementID)
-  {
-    var element = wsm.contentArea.document.getElementById(aElementID);
-    var dataObject = wsm.generic_Get(element);
-    if (dataObject) {
-      dataObject.value = element.getAttribute("value");
-      return dataObject;
-    }
-    return null;
-  },
-
-  // <textbox>
-  set_Textbox: function (aElementID, aDataObject)
-  {
-    var element = wsm.contentArea.document.getElementById(aElementID);
-    wsm.generic_Set(element, aDataObject);
-  },
-
-  get_Textbox: function (aElementID)
-  {
-    var element = wsm.contentArea.document.getElementById(aElementID);
-    var dataObject = wsm.generic_Get(element);
-    if (dataObject) {
-      dataObject.value = element.value;
-      return dataObject;
-    }
-    return null;
-  },
-
-  // <checkbox>
-  set_Checkbox: function (aElementID, aDataObject)
-  {
-    var element = wsm.contentArea.document.getElementById(aElementID);
-    // Set generic properites. 
-    wsm.generic_Set(element, aDataObject);
-    // Handle reversed boolean values.
-    if ("checked" in aDataObject && element.hasAttribute("reversed"))
-      element.checked = !aDataObject.checked; 
-  },
-
-  get_Checkbox: function (aElementID)
-  {
-    var element = wsm.contentArea.document.getElementById(aElementID);
-    var dataObject = wsm.generic_Get(element);
-    if (dataObject) {
-      var checked = element.checked;
-      dataObject.checked = element.getAttribute("reversed") == "true" ? !checked : checked;
-      return dataObject;
-    }
-    return null;
-  },
-
-  // <listitem>
-  set_Listitem: function (aElementID, aDataObject)
-  {
-    var element = wsm.contentArea.document.getElementById(aElementID);
-    wsm.generic_Set(element, aDataObject);
-    // Handle reversed boolean values.
-    if ("checked" in aDataObject && element.hasAttribute("reversed"))
-      element.checked = !aDataObject.checked; 
-  },
-
-  get_Listitem: function (aElementID)
-  {
-    var element = wsm.contentArea.document.getElementById(aElementID);
-    var dataObject = wsm.generic_Get(element);
-    if (dataObject) {
-      if (element.getAttribute("type") == "checkbox") {
-        var checked = element.checked;
-        dataObject.checked = element.getAttribute("reversed") == "true" ? !checked : checked;
-      }
-      return dataObject;
-    }
-    return null;
-  },
-
-  // <data>
-  set_Data: function (aElementID, aDataObject)
-  {
-    var element = wsm.contentArea.document.getElementById(aElementID);
-    wsm.generic_Set(element, aDataObject);
-    if ("value" in aDataObject)
-      element.setAttribute("value", aDataObject.value);
-  },
-
-  get_Data: function (aElementID)
-  {
-    var element = wsm.contentArea.document.getElementById(aElementID);
-    var dataObject = wsm.generic_Get(element);
-    if (dataObject) {
-      dataObject.value = element.getAttribute("value");
-      return dataObject;
-    }
-    return null;
-  },
-
-  // <default>
-  set_Default: function (aElementID, aDataObject)
-  {
-    var element = wsm.contentArea.document.getElementById(aElementID);
-    wsm.generic_Set(element, aDataObject);
-  },
-
-  get_Default: function (aElementID)
-  {
-    var element = wsm.contentArea.document.getElementById(aElementID);
-    var dataObject = wsm.generic_Get(element);
-    return dataObject ? dataObject : null;
-  }
-}
-
-
-// M:tHoF Greatest Hits Section (Append one line per edit):
-// it will be dark soon 
-// MANOS MADE ME PERMANENT! 
-// there is no way out of here
-// [The Master] not dead as you know it. He is with us always.
-