From 5c0425d09e1683949e0c35cd40a1be697913ceb5 Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Fri, 29 Mar 2013 10:28:05 -0400 Subject: [PATCH] Backed out changeset 17b7d2222f14 (bug 855407) for likely causing leaks. --- browser/app/nsBrowserApp.cpp | 51 ------------------- .../metro/shell/testing/metrotestharness.cpp | 9 ---- 2 files changed, 60 deletions(-) diff --git a/browser/app/nsBrowserApp.cpp b/browser/app/nsBrowserApp.cpp index 7bc65bd4baa..1bb81ef8cfe 100644 --- a/browser/app/nsBrowserApp.cpp +++ b/browser/app/nsBrowserApp.cpp @@ -10,8 +10,6 @@ #if defined(XP_WIN) #include #include -#include -#include #elif defined(XP_UNIX) #include #include @@ -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; diff --git a/browser/metro/shell/testing/metrotestharness.cpp b/browser/metro/shell/testing/metrotestharness.cpp index 6f4ee1b3b6f..ae418dd7c50 100644 --- a/browser/metro/shell/testing/metrotestharness.cpp +++ b/browser/metro/shell/testing/metrotestharness.cpp @@ -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();