Bug 1359548 - Fix incorrectly specified ABIs in js-ctypes declaration in migration code. r=Gijs, a=gchang
authorAaron Klotz <aklotz@mozilla.com>
Tue, 25 Apr 2017 13:02:32 -0600
changeset 396067 67059080981c3de0a35a65b360ae833ddc30df50
parent 396066 0ee6d3ac7a062d7546676f0e61c258aaf8c1f1c0
child 396068 f825d935914655487138fb5934ed10d933ae0da0
push id1468
push userasasaki@mozilla.com
push dateMon, 05 Jun 2017 19:31:07 +0000
treeherdermozilla-release@0641fc6ee9d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs, gchang
bugs1359548
milestone54.0
Bug 1359548 - Fix incorrectly specified ABIs in js-ctypes declaration in migration code. r=Gijs, a=gchang MozReview-Commit-ID: LH1MOyuXVos
browser/components/migration/ESEDBReader.jsm
browser/components/migration/tests/unit/test_Edge_db_migration.js
browser/components/migration/tests/unit/test_IE_cookies.js
--- a/browser/components/migration/ESEDBReader.jsm
+++ b/browser/components/migration/ESEDBReader.jsm
@@ -230,17 +230,17 @@ function unloadLibraries() {
   delete gLibs.kernel;
 }
 
 function loadLibraries() {
   Services.obs.addObserver(unloadLibraries, "xpcom-shutdown", false);
   gLibs.ese = ctypes.open("esent.dll");
   gLibs.kernel = ctypes.open("kernel32.dll");
   KERNEL.FileTimeToSystemTime = gLibs.kernel.declare("FileTimeToSystemTime",
-    ctypes.default_abi, ctypes.int, KERNEL.FILETIME.ptr, KERNEL.SYSTEMTIME.ptr);
+    ctypes.winapi_abi, ctypes.int, KERNEL.FILETIME.ptr, KERNEL.SYSTEMTIME.ptr);
 
   declareESEFunctions();
 }
 
 function ESEDB(rootPath, dbPath, logPath) {
   log.info("Created db");
   this.rootPath = rootPath;
   this.dbPath = dbPath;
--- a/browser/components/migration/tests/unit/test_Edge_db_migration.js
+++ b/browser/components/migration/tests/unit/test_Edge_db_migration.js
@@ -166,17 +166,17 @@ let initializedESE = false;
 
 let eseDBWritingHelpers = {
   setupDB(dbFile, tables) {
     if (!initializedESE) {
       initializedESE = true;
       loadLibraries();
 
       KERNEL.SystemTimeToFileTime = gLibs.kernel.declare("SystemTimeToFileTime",
-          ctypes.default_abi, ctypes.bool, KERNEL.SYSTEMTIME.ptr, KERNEL.FILETIME.ptr);
+          ctypes.winapi_abi, ctypes.bool, KERNEL.SYSTEMTIME.ptr, KERNEL.FILETIME.ptr);
 
       declareESEFunction("CreateDatabaseW", ESE.JET_SESID, ESE.JET_PCWSTR,
                          ESE.JET_PCWSTR, ESE.JET_DBID.ptr, ESE.JET_GRBIT);
       declareESEFunction("CreateTableColumnIndexW", ESE.JET_SESID, ESE.JET_DBID,
                          ESE.JET_TABLECREATE_W.ptr);
       declareESEFunction("BeginTransaction", ESE.JET_SESID);
       declareESEFunction("CommitTransaction", ESE.JET_SESID, ESE.JET_GRBIT);
       declareESEFunction("PrepareUpdate", ESE.JET_SESID, ESE.JET_TABLEID,
--- a/browser/components/migration/tests/unit/test_IE_cookies.js
+++ b/browser/components/migration/tests/unit/test_IE_cookies.js
@@ -17,33 +17,39 @@ add_task(function* () {
 
   /*
   BOOL InternetSetCookieW(
     _In_  LPCTSTR lpszUrl,
     _In_  LPCTSTR lpszCookieName,
     _In_  LPCTSTR lpszCookieData
   );
   */
+  // NOTE: Even though MSDN documentation does not indicate a calling convention,
+  // InternetSetCookieW is declared in SDK headers as __stdcall but is exported
+  // from wininet.dll without name mangling, so it is effectively winapi_abi
   let setIECookie = wininet.declare("InternetSetCookieW",
-                                    ctypes.default_abi,
+                                    ctypes.winapi_abi,
                                     BOOL,
                                     LPCTSTR,
                                     LPCTSTR,
                                     LPCTSTR);
 
   /*
   BOOL InternetGetCookieW(
     _In_    LPCTSTR lpszUrl,
     _In_    LPCTSTR lpszCookieName,
     _Out_   LPCTSTR  lpszCookieData,
     _Inout_ LPDWORD lpdwSize
   );
   */
+  // NOTE: Even though MSDN documentation does not indicate a calling convention,
+  // InternetGetCookieW is declared in SDK headers as __stdcall but is exported
+  // from wininet.dll without name mangling, so it is effectively winapi_abi
   let getIECookie = wininet.declare("InternetGetCookieW",
-                                    ctypes.default_abi,
+                                    ctypes.winapi_abi,
                                     BOOL,
                                     LPCTSTR,
                                     LPCTSTR,
                                     LPCTSTR,
                                     LPDWORD);
 
   // We need to randomize the cookie to avoid clashing with other cookies
   // that might have been set by previous tests and not properly cleared.