Skip to content

Commit

Permalink
Backout f1acc52a59da (bug 719983) & 6771bd53e267 (bug 699247) for 30%…
Browse files Browse the repository at this point in the history
… WinXp Ts regression
  • Loading branch information
Ed Morley committed Feb 8, 2012
1 parent 5247018 commit 91422f0
Show file tree
Hide file tree
Showing 37 changed files with 1,554 additions and 351 deletions.
10 changes: 10 additions & 0 deletions dom/plugins/base/nsNPAPIPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,16 @@ nsNPAPIPlugin::RunPluginOOP(const nsPluginTag *aPluginTag)
}
#endif

#ifdef XP_WIN
OSVERSIONINFO osVerInfo = {0};
osVerInfo.dwOSVersionInfoSize = sizeof(osVerInfo);
GetVersionEx(&osVerInfo);
// Always disabled on 2K or less. (bug 536303)
if (osVerInfo.dwMajorVersion < 5 ||
(osVerInfo.dwMajorVersion == 5 && osVerInfo.dwMinorVersion == 0))
return false;
#endif

nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
if (!prefs) {
return false;
Expand Down
5 changes: 3 additions & 2 deletions dom/plugins/base/nsPluginsDirWin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
#include "nsString.h"
#include "nsILocalFile.h"
#include "nsUnicharUtils.h"
#include "nsSetDllDirectory.h"

using namespace mozilla;

Expand Down Expand Up @@ -302,15 +303,15 @@ nsresult nsPluginFile::LoadPlugin(PRLibrary **outLibrary)
}

if (protectCurrentDirectory) {
SetDllDirectory(NULL);
mozilla::NS_SetDllDirectory(NULL);
}

nsresult rv = plugin->Load(outLibrary);
if (NS_FAILED(rv))
*outLibrary = NULL;

if (protectCurrentDirectory) {
SetDllDirectory(L"");
mozilla::NS_SetDllDirectory(L"");
}

if (restoreOrigDir) {
Expand Down
2 changes: 1 addition & 1 deletion dom/plugins/ipc/PluginProcessChild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ PluginProcessChild::Init()
}
if (protectCurrentDirectory) {
SanitizeEnvironmentVariables();
SetDllDirectory(L"");
NS_SetDllDirectory(L"");
}

#else
Expand Down
21 changes: 20 additions & 1 deletion extensions/auth/nsAuthSSPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,33 @@ static const char *MapErrorCode(int rc)

//-----------------------------------------------------------------------------

static HINSTANCE sspi_lib;
static PSecurityFunctionTableW sspi;

static nsresult
InitSSPI()
{
PSecurityFunctionTableW (*initFun)(void);

LOG((" InitSSPI\n"));

sspi = InitSecurityInterfaceW();
sspi_lib = LoadLibraryW(L"secur32.dll");
if (!sspi_lib) {
sspi_lib = LoadLibraryW(L"security.dll");
if (!sspi_lib) {
LOG(("SSPI library not found"));
return NS_ERROR_UNEXPECTED;
}
}

initFun = (PSecurityFunctionTableW (*)(void))
GetProcAddress(sspi_lib, "InitSecurityInterfaceW");
if (!initFun) {
LOG(("InitSecurityInterfaceW not found"));
return NS_ERROR_UNEXPECTED;
}

sspi = initFun();
if (!sspi) {
LOG(("InitSecurityInterfaceW failed"));
return NS_ERROR_UNEXPECTED;
Expand Down
16 changes: 16 additions & 0 deletions gfx/thebes/gfxDWriteFonts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,29 @@ GetCairoAntialiasOption(gfxFont::AntialiasOption anAntialiasOption)
#define FE_FONTSMOOTHINGCLEARTYPE 2
#endif

static bool
HasClearType()
{
OSVERSIONINFO versionInfo;
versionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);

return (GetVersionEx(&versionInfo) &&
(versionInfo.dwMajorVersion > 5 ||
(versionInfo.dwMajorVersion == 5 &&
versionInfo.dwMinorVersion >= 1))); // XP or newer
}

static bool
UsingClearType()
{
BOOL fontSmoothing;
if (!SystemParametersInfo(SPI_GETFONTSMOOTHING, 0, &fontSmoothing, 0) ||
!fontSmoothing)
{
return false;
}

if (!HasClearType()) {
return false;
}

Expand Down
72 changes: 65 additions & 7 deletions gfx/thebes/gfxGDIFontList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@
#include "mozilla/Telemetry.h"

#include <usp10.h>
#include <t2embapi.h>

using namespace mozilla;

Expand Down Expand Up @@ -103,6 +102,50 @@ BuildKeyNameFromFontName(nsAString &aName)
// Implementation of gfxPlatformFontList for Win32 GDI,
// using GDI font enumeration APIs to get the list of fonts

// from t2embapi.h, included in Platform SDK 6.1 but not 6.0

#ifndef __t2embapi__

#define TTLOAD_PRIVATE 0x00000001
#define LICENSE_PREVIEWPRINT 0x0004
#define E_NONE 0x0000L

typedef unsigned long( WINAPIV *READEMBEDPROC ) ( void*, void*, const unsigned long );

typedef struct
{
unsigned short usStructSize; // size in bytes of structure client should set to sizeof(TTLOADINFO)
unsigned short usRefStrSize; // size in wide characters of pusRefStr including NULL terminator
unsigned short *pusRefStr; // reference or actual string.
}TTLOADINFO;

LONG WINAPI TTLoadEmbeddedFont
(
HANDLE* phFontReference, // on completion, contains handle to identify embedded font installed
// on system
ULONG ulFlags, // flags specifying the request
ULONG* pulPrivStatus, // on completion, contains the embedding status
ULONG ulPrivs, // allows for the reduction of licensing privileges
ULONG* pulStatus, // on completion, may contain status flags for request
READEMBEDPROC lpfnReadFromStream, // callback function for doc/disk reads
LPVOID lpvReadStream, // the input stream tokin
LPWSTR szWinFamilyName, // the new 16 bit windows family name can be NULL
LPSTR szMacFamilyName, // the new 8 bit mac family name can be NULL
TTLOADINFO* pTTLoadInfo // optional security
);

#endif // __t2embapi__

typedef LONG( WINAPI *TTLoadEmbeddedFontProc ) (HANDLE* phFontReference, ULONG ulFlags, ULONG* pulPrivStatus, ULONG ulPrivs, ULONG* pulStatus,
READEMBEDPROC lpfnReadFromStream, LPVOID lpvReadStream, LPWSTR szWinFamilyName,
LPSTR szMacFamilyName, TTLOADINFO* pTTLoadInfo);

typedef LONG( WINAPI *TTDeleteEmbeddedFontProc ) (HANDLE hFontReference, ULONG ulFlags, ULONG* pulStatus);


static TTLoadEmbeddedFontProc TTLoadEmbeddedFontPtr = nsnull;
static TTDeleteEmbeddedFontProc TTDeleteEmbeddedFontPtr = nsnull;

class WinUserFontData : public gfxUserFontData {
public:
WinUserFontData(HANDLE aFontRef, bool aIsEmbedded)
Expand All @@ -114,7 +157,7 @@ class WinUserFontData : public gfxUserFontData {
if (mIsEmbedded) {
ULONG pulStatus;
LONG err;
err = TTDeleteEmbeddedFont(mFontRef, 0, &pulStatus);
err = TTDeleteEmbeddedFontPtr(mFontRef, 0, &pulStatus);
#if DEBUG
if (err != E_NONE) {
char buf[256];
Expand Down Expand Up @@ -551,6 +594,8 @@ GDIFontFamily::FindStyleVariations()
gfxGDIFontList::gfxGDIFontList()
{
mFontSubstitutes.Init(50);

InitializeFontEmbeddingProcs();
}

static void
Expand Down Expand Up @@ -737,6 +782,15 @@ gfxGDIFontList::LookupLocalFont(const gfxProxyFontEntry *aProxyEntry,
return fe;
}

void gfxGDIFontList::InitializeFontEmbeddingProcs()
{
HMODULE fontlib = LoadLibraryW(L"t2embed.dll");
if (!fontlib)
return;
TTLoadEmbeddedFontPtr = (TTLoadEmbeddedFontProc) GetProcAddress(fontlib, "TTLoadEmbeddedFont");
TTDeleteEmbeddedFontPtr = (TTDeleteEmbeddedFontProc) GetProcAddress(fontlib, "TTDeleteEmbeddedFont");
}

// used to control stream read by Windows TTLoadEmbeddedFont API

class EOTFontStreamReader {
Expand Down Expand Up @@ -840,6 +894,10 @@ gfxGDIFontList::MakePlatformFont(const gfxProxyFontEntry *aProxyEntry,
};
FontDataDeleter autoDelete(aFontData);

// if calls aren't available, bail
if (!TTLoadEmbeddedFontPtr || !TTDeleteEmbeddedFontPtr)
return nsnull;

bool hasVertical;
bool isCFF = gfxFontUtils::IsCffFont(aFontData, hasVertical);

Expand Down Expand Up @@ -878,11 +936,11 @@ gfxGDIFontList::MakePlatformFont(const gfxProxyFontEntry *aProxyEntry,
EOTFontStreamReader eotReader(aFontData, aLength, buffer, eotlen,
&overlayNameData);

ret = TTLoadEmbeddedFont(&fontRef, TTLOAD_PRIVATE, &privStatus,
LICENSE_PREVIEWPRINT, &pulStatus,
EOTFontStreamReader::ReadEOTStream,
&eotReader,
(PRUnichar*)(fontName.get()), 0, 0);
ret = TTLoadEmbeddedFontPtr(&fontRef, TTLOAD_PRIVATE, &privStatus,
LICENSE_PREVIEWPRINT, &pulStatus,
EOTFontStreamReader::ReadEOTStream,
&eotReader,
(PRUnichar*)(fontName.get()), 0, 0);
if (ret != E_NONE) {
fontRef = nsnull;
char buf[256];
Expand Down
1 change: 1 addition & 0 deletions gfx/thebes/gfxWindowsPlatform.h
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ class THEBES_API gfxWindowsPlatform : public gfxPlatform {
// based on http://msdn.microsoft.com/en-us/library/ms724834(VS.85).aspx
enum {
kWindowsUnknown = 0,
kWindows2000 = 0x50000,
kWindowsXP = 0x50001,
kWindowsServer2003 = 0x50002,
kWindowsVista = 0x60000,
Expand Down
2 changes: 1 addition & 1 deletion hal/windows/WindowsBattery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ EnableBatteryNotifications()
} else
#endif
{
// for Windows XP. If we remove Windows XP support,
// for Windows 2000 and Windwos XP. If we remove Windows XP support,
// we should remove timer-based power notification
sUpdateTimer = do_CreateInstance(NS_TIMER_CONTRACTID);
if (sUpdateTimer) {
Expand Down
2 changes: 1 addition & 1 deletion ipc/app/MozillaRuntimeMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ main(int argc, char* argv[])
// the details.
if (proctype != GeckoProcessType_Plugin) {
mozilla::SanitizeEnvironmentVariables();
SetDllDirectory(L"");
mozilla::NS_SetDllDirectory(L"");
}
#endif

Expand Down
56 changes: 42 additions & 14 deletions netwerk/base/src/nsAutodialWin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ nsAutodial::nsAutodial()
mNumRASConnectionEntries(0),
mAutodialServiceDialingLocation(-1)
{
mOSVerInfo.dwOSVersionInfoSize = sizeof(mOSVerInfo);
GetVersionEx(&mOSVerInfo);

// Initializations that can be made again since RAS OS settings can
// change.
Init();
Expand Down Expand Up @@ -429,27 +432,22 @@ nsresult nsAutodial::GetDefaultEntryName(PRUnichar* entryName, int bufferSize)
//
// For Windows XP: HKCU/Software/Microsoft/RAS Autodial/Default/DefaultInternet.
// or HKLM/Software/Microsoft/RAS Autodial/Default/DefaultInternet.
// For Windows 2K: HKCU/RemoteAccess/InternetProfile.

const PRUnichar* key = L"Software\\Microsoft\\RAS Autodial\\Default";
const PRUnichar* val = L"DefaultInternet";
const PRUnichar* key = nsnull;
const PRUnichar* val = nsnull;

HKEY hKey = 0;
LONG result = 0;


// Try HKCU first.
result = ::RegOpenKeyExW(
HKEY_CURRENT_USER,
key,
0,
KEY_READ,
&hKey);

if (result != ERROR_SUCCESS)
// Windows 2000
if ((mOSVerInfo.dwMajorVersion == 5) && (mOSVerInfo.dwMinorVersion == 0)) // Windows 2000
{
// If not present, try HKLM.
key = L"RemoteAccess";
val = L"InternetProfile";

result = ::RegOpenKeyExW(
HKEY_LOCAL_MACHINE,
HKEY_CURRENT_USER,
key,
0,
KEY_READ,
Expand All @@ -460,6 +458,36 @@ nsresult nsAutodial::GetDefaultEntryName(PRUnichar* entryName, int bufferSize)
return NS_ERROR_FAILURE;
}
}
else // Windows XP
{
key = L"Software\\Microsoft\\RAS Autodial\\Default";
val = L"DefaultInternet";


// Try HKCU first.
result = ::RegOpenKeyExW(
HKEY_CURRENT_USER,
key,
0,
KEY_READ,
&hKey);

if (result != ERROR_SUCCESS)
{
// If not present, try HKLM.
result = ::RegOpenKeyExW(
HKEY_LOCAL_MACHINE,
key,
0,
KEY_READ,
&hKey);

if (result != ERROR_SUCCESS)
{
return NS_ERROR_FAILURE;
}
}
}


DWORD entryType = 0;
Expand Down
3 changes: 3 additions & 0 deletions netwerk/base/src/nsAutodialWin.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ class nsAutodial
// Don't try to dial again within a few seconds of when user pressed cancel.
static PRIntervalTime mDontRetryUntil;

// OS version info.
OSVERSIONINFO mOSVerInfo;

public:

// ctor
Expand Down
12 changes: 11 additions & 1 deletion netwerk/base/src/nsSocketTransportService2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -960,8 +960,18 @@ nsSocketTransportService::DiscoverMaxCount()
gMaxCount = rlimitData.rlim_cur - 250;

#elif defined(XP_WIN) && !defined(WIN_CE)
// win 95, 98, etc had a limit of 100 - so we will just
// use the historical 50 in every case older than XP (0x501).
// >= XP is confirmed to have at least 1000
gMaxCount = SOCKET_LIMIT_TARGET;

OSVERSIONINFO osInfo = { sizeof(OSVERSIONINFO) };
if (GetVersionEx(&osInfo)) {
PRInt32 version =
(osInfo.dwMajorVersion & 0xff) << 8 |
(osInfo.dwMinorVersion & 0xff);
if (version >= 0x501) /* xp or later */
gMaxCount = SOCKET_LIMIT_TARGET;
}
#else
// other platforms are harder to test - so leave at safe legacy value
#endif
Expand Down
7 changes: 6 additions & 1 deletion netwerk/protocol/http/nsHttpHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,8 @@ nsHttpHandler::BuildUserAgent()
}

#ifdef XP_WIN
typedef BOOL (WINAPI *IsWow64ProcessP) (HANDLE, PBOOL);

#define WNT_BASE "Windows NT %ld.%ld"
#define W64_PREFIX "; Win64"
#endif
Expand Down Expand Up @@ -715,7 +717,10 @@ nsHttpHandler::InitUserAgentComponents()
format = WNT_BASE W64_PREFIX "; x64";
#else
BOOL isWow64 = FALSE;
if (!IsWow64Process(GetCurrentProcess(), &isWow64)) {
IsWow64ProcessP fnIsWow64Process = (IsWow64ProcessP)
GetProcAddress(GetModuleHandleW(L"kernel32"), "IsWow64Process");
if (fnIsWow64Process &&
!fnIsWow64Process(GetCurrentProcess(), &isWow64)) {
isWow64 = FALSE;
}
format = isWow64
Expand Down
Loading

0 comments on commit 91422f0

Please sign in to comment.