Bug 1359548: Fix incorrectly specified ABIs in js-ctypes declaration in migration code; r?Gijs
MozReview-Commit-ID: LH1MOyuXVos
--- 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");
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.