Backed out changeset 17b7d2222f14 (bug 855407) for likely causing leaks.

This commit is contained in:
Ryan VanderMeulen 2013-03-29 10:28:05 -04:00
parent 3c3d0ade81
commit 5c0425d09e
2 changed files with 0 additions and 60 deletions

View File

@ -10,8 +10,6 @@
#if defined(XP_WIN)
#include <windows.h>
#include <stdlib.h>
#include <io.h>
#include <fcntl.h>
#elif defined(XP_UNIX)
#include <sys/time.h>
#include <sys/resource.h>
@ -51,11 +49,7 @@ using namespace mozilla;
#define kDesktopFolder "browser"
#define kMetroFolder "metro"
#define kMetroAppIniFilename "metroapp.ini"
#ifdef XP_WIN
#define kMetroTestFile "tests.ini"
const char* kMetroConsoleIdParam = "testconsoleid=";
const int kMetroConsoleIdParamLen = strlen(kMetroConsoleIdParam);
#endif
static void Output(const char *fmt, ... )
{
@ -107,42 +101,6 @@ static bool IsArg(const char* arg, const char* s)
return false;
}
#ifdef XP_WIN
/*
* AttachToTestsConsole - Windows helper for when we are running
* in the immersive environment. Firefox is launched by Windows in
* response to a request by metrotestharness, which is launched by
* runtests.py. As such stdout in fx doesn't point to the right
* stream. This helper touches up stdout such that test output gets
* routed to the console the tests are run in.
*/
static void AttachToTestsConsole(DWORD aProcessId)
{
if (!AttachConsole(aProcessId)) {
OutputDebugStringW(L"Could not attach to console.\n");
return;
}
HANDLE winOut = CreateFileA("CONOUT$",
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_WRITE, 0,
OPEN_EXISTING, 0, 0);
if (winOut == INVALID_HANDLE_VALUE) {
OutputDebugStringW(L"Could not attach to console.\n");
return;
}
// Set the c runtime handle
int stdOut = _open_osfhandle((intptr_t)winOut, _O_APPEND);
if (stdOut == -1) {
OutputDebugStringW(L"Could not open c-runtime handle.\n");
return;
}
FILE *fp = _fdopen(stdOut, "a");
*stdout = *fp;
}
#endif
XRE_GetFileFromPathType XRE_GetFileFromPath;
XRE_CreateAppDataType XRE_CreateAppData;
XRE_FreeAppDataType XRE_FreeAppData;
@ -356,15 +314,6 @@ static int do_main(int argc, char* argv[], nsIFile *xreDirectory)
if (isspace(*ptr)) {
*ptr = '\0';
ptr++;
// Check for the console id the metrotestharness passes in, we need
// to connect up to this so test output goes to the right place.
if (ptr && !strncmp(ptr, kMetroConsoleIdParam, kMetroConsoleIdParamLen)) {
DWORD processId = strtol(ptr + kMetroConsoleIdParamLen, nullptr, 10);
if (processId > 0) {
AttachToTestsConsole(processId);
}
continue;
}
newArgv[newArgc] = ptr;
newArgc++;
continue;

View File

@ -156,14 +156,6 @@ public:
}
};
static void AddConsoleIdToParams()
{
DWORD dwId = GetCurrentProcessId();
CString tmp;
tmp.Format(L" testconsoleid=%d", dwId);
sAppParams += tmp;
}
static bool Launch()
{
Log(L"Launching browser...");
@ -307,7 +299,6 @@ int wmain(int argc, WCHAR* argv[])
if (sFirefoxPath.GetLength()) {
Log(L"firefoxpath: '%s'", sFirefoxPath);
}
AddConsoleIdToParams();
Log(L"args: '%s'", sAppParams);
Launch();