From 1591607ff03650592851e5fc64d772658cb64fdf Mon Sep 17 00:00:00 2001 From: "av%netscape.com" Date: Sun, 31 Mar 2002 05:12:19 +0000 Subject: [PATCH] Bug 133662 -- update Tester plugin, not part of the build git-svn-id: svn://10.0.0.236/trunk@117774 18797224-902f-48f8-a5cc-f745e15eee43 --- .../plugin/tools/tester/common/loghlp.cpp | 17 +++++++++++++---- .../plugin/tools/tester/common/plugbase.cpp | 10 +++++++++- .../plugin/tools/tester/common/scrpthlp.cpp | 1 + .../plugin/tools/tester/common/strconv.cpp | 2 ++ .../plugin/tools/tester/include/profile.h | 1 + .../plugin/tools/tester/windows/dlgman.cpp | 5 +++-- .../plugin/tools/tester/windows/guihlp.cpp | 9 +++++++++ 7 files changed, 38 insertions(+), 7 deletions(-) diff --git a/mozilla/modules/plugin/tools/tester/common/loghlp.cpp b/mozilla/modules/plugin/tools/tester/common/loghlp.cpp index db2ba7f3ada..b9b80ee5a57 100644 --- a/mozilla/modules/plugin/tools/tester/common/loghlp.cpp +++ b/mozilla/modules/plugin/tools/tester/common/loghlp.cpp @@ -166,6 +166,9 @@ LPSTR FormatNPPVariable(NPPVariable var) case NPPVpluginWindowSize: wsprintf(szVar, "NPPVpluginWindowSize"); break; + case NPPVpluginKeepLibraryInMemory: + wsprintf(szVar, "NPPVpluginKeepLibraryInMemory"); + break; default: wsprintf(szVar, "Unlisted variable"); break; @@ -434,14 +437,17 @@ LogItemStruct * makeLogItemStruct(NPAPI_Action action, memcpy(plis->arg3.pData, (LPVOID)dw3, plis->arg3.iLength); break; case action_npn_set_value: - if(((NPPVariable)dw2 == NPPVpluginNameString) || ((NPPVariable)dw2 == NPPVpluginDescriptionString)) + if(((NPPVariable)dw2 == NPPVpluginNameString) || + ((NPPVariable)dw2 == NPPVpluginDescriptionString)) { makeAbbreviatedString(szBuf, sizeof(szBuf), dw3, strlen((char *)dw3), iWrap); plis->arg3.iLength = strlen(szBuf) + 1; plis->arg3.pData = new char[plis->arg3.iLength]; memcpy(plis->arg3.pData, (LPVOID)&szBuf[0], plis->arg3.iLength); } - else if(((NPPVariable)dw2 == NPPVpluginWindowBool) || ((NPPVariable)dw2 == NPPVpluginTransparentBool)) + else if(((NPPVariable)dw2 == NPPVpluginWindowBool) || + ((NPPVariable)dw2 == NPPVpluginTransparentBool) || + ((NPPVariable)dw2 == NPPVpluginKeepLibraryInMemory)) { plis->arg3.iLength = sizeof(NPBool); plis->arg3.pData = new char[plis->arg3.iLength]; @@ -735,12 +741,15 @@ int formatLogItem(LogItemStruct * plis, LPSTR szOutput, LPSTR szEndOfItem, BOOL case action_npn_set_value: wsprintf(szRet, "Returns: %s%s", FormatNPAPIError((int)plis->dwReturnValue),szEOL); - if(((NPPVariable)dw2 == NPPVpluginNameString) || ((NPPVariable)dw2 == NPPVpluginDescriptionString)) + if(((NPPVariable)dw2 == NPPVpluginNameString) || + ((NPPVariable)dw2 == NPPVpluginDescriptionString)) { FormatPCHARArgument(sz3, sizeof(sz3), &plis->arg3); wsprintf(szString, "NPN_SetValue(%#08lx, %s, %s)%s%s", dw1,FormatNPPVariable((NPPVariable)dw2),sz3,szEOL,szRet); } - else if(((NPPVariable)dw2 == NPPVpluginWindowBool) || ((NPPVariable)dw2 == NPPVpluginTransparentBool)) + else if(((NPPVariable)dw2 == NPPVpluginWindowBool) || + ((NPPVariable)dw2 == NPPVpluginTransparentBool) || + ((NPPVariable)dw2 == NPPVpluginKeepLibraryInMemory)) { FormatPBOOLArgument(sz3, sizeof(sz3), &plis->arg3); wsprintf(szString, "NPN_SetValue(%#08lx, %s, %s)%s%s", diff --git a/mozilla/modules/plugin/tools/tester/common/plugbase.cpp b/mozilla/modules/plugin/tools/tester/common/plugbase.cpp index 53f8b1c2dfc..456a9251629 100644 --- a/mozilla/modules/plugin/tools/tester/common/plugbase.cpp +++ b/mozilla/modules/plugin/tools/tester/common/plugbase.cpp @@ -359,7 +359,15 @@ DWORD CPluginBase::makeNPNCall(NPAPI_Action action, DWORD dw1, DWORD dw2, DWORD dw1 = (DWORD)m_pNPInstance; if(dw3 == DEFAULT_DWARG_VALUE) dw3 = (DWORD)m_pValue; - dwRet = (DWORD)NPN_SetValue((NPP)dw1, (NPPVariable)dw2, (void *)dw3); + + // note that Mozilla expects boolean values not as a pointer to BOOL + // but rather as simply null and not null, let's convert + if((dw2 == NPPVpluginWindowBool) || + (dw2 == NPPVpluginTransparentBool) || + (dw2 == NPPVpluginKeepLibraryInMemory)) { + dwRet = (DWORD)NPN_SetValue((NPP)dw1, (NPPVariable)dw2, (void *)(*(BOOL *)dw3)); + } else + dwRet = (DWORD)NPN_SetValue((NPP)dw1, (NPPVariable)dw2, (void *)dw3); break; case action_npn_invalidate_rect: if(dw1 == DEFAULT_DWARG_VALUE) diff --git a/mozilla/modules/plugin/tools/tester/common/scrpthlp.cpp b/mozilla/modules/plugin/tools/tester/common/scrpthlp.cpp index 3d63df64d9e..63b14e4e453 100644 --- a/mozilla/modules/plugin/tools/tester/common/scrpthlp.cpp +++ b/mozilla/modules/plugin/tools/tester/common/scrpthlp.cpp @@ -215,6 +215,7 @@ ScriptItemStruct * makeScriptItemStruct(NPAPI_Action action, DWORD dw1, DWORD dw break; case NPPVpluginWindowBool: case NPPVpluginTransparentBool: + case NPPVpluginKeepLibraryInMemory: dwTNVFlags = convertStringToBOOL1(&dw3); makeDataEntry(&psis->arg3, dw3, (dwTNVFlags & fTNV1) ? 0 : sizeof(NPBool)); break; diff --git a/mozilla/modules/plugin/tools/tester/common/strconv.cpp b/mozilla/modules/plugin/tools/tester/common/strconv.cpp index 30419b3593f..4a180e30bce 100644 --- a/mozilla/modules/plugin/tools/tester/common/strconv.cpp +++ b/mozilla/modules/plugin/tools/tester/common/strconv.cpp @@ -274,6 +274,8 @@ static NPPVariable convertStringToNPPVariable(LPSTR szString) return NPPVpluginWindowBool; else if(strcmpi(ENTRY_NPPVPLUGINTRANSPARENTBOOL, szString) == 0) return NPPVpluginTransparentBool; + else if(strcmpi(ENTRY_NPPVPLUGINKEEPLIBRARYINMEMORY, szString) == 0) + return NPPVpluginKeepLibraryInMemory; else if(strcmpi(ENTRY_NPPVPLUGINWINDOWSIZE, szString) == 0) return NPPVpluginWindowSize; else diff --git a/mozilla/modules/plugin/tools/tester/include/profile.h b/mozilla/modules/plugin/tools/tester/include/profile.h index 0a2bbb14979..a101162a53f 100644 --- a/mozilla/modules/plugin/tools/tester/include/profile.h +++ b/mozilla/modules/plugin/tools/tester/include/profile.h @@ -81,6 +81,7 @@ ScriptItemStruct * readProfileSectionAndCreateScriptItemStruct(LPSTR szFileName, #define ENTRY_NPPVPLUGINWINDOWBOOL "NPPVpluginWindowBool" #define ENTRY_NPPVPLUGINTRANSPARENTBOOL "NPPVpluginTransparentBool" #define ENTRY_NPPVPLUGINWINDOWSIZE "NPPVpluginWindowSize" +#define ENTRY_NPPVPLUGINKEEPLIBRARYINMEMORY "NPPVpluginKeepLibraryInMemory" // NPNVariable #define ENTRY_NPNVXDISPLAY "NPNVxDisplay" diff --git a/mozilla/modules/plugin/tools/tester/windows/dlgman.cpp b/mozilla/modules/plugin/tools/tester/windows/dlgman.cpp index 17e07380080..b9ddea53792 100644 --- a/mozilla/modules/plugin/tools/tester/windows/dlgman.cpp +++ b/mozilla/modules/plugin/tools/tester/windows/dlgman.cpp @@ -137,8 +137,9 @@ static void onCommand(HWND hWnd, int id, HWND hWndCtl, UINT codeNotify) { iIndex = ComboBox_GetCurSel(GetDlgItem(hWnd, IDC_COMBO_ARG2)); ComboBox_GetLBText(GetDlgItem(hWnd, IDC_COMBO_ARG2), iIndex, szString); - if( (strcmp(szString, "NPPVpluginWindowBool") == 0) - || (strcmp(szString, "NPPVpluginTransparentBool") == 0)) + if((strcmp(szString, "NPPVpluginWindowBool") == 0) || + (strcmp(szString, "NPPVpluginTransparentBool") == 0) || + (strcmp(szString, "NPPVpluginKeepLibraryInMemory") == 0)) { HWND hWndCombo = GetDlgItem(hWnd, IDC_COMBO_ARG3); ComboBox_ResetContent(hWndCombo); diff --git a/mozilla/modules/plugin/tools/tester/windows/guihlp.cpp b/mozilla/modules/plugin/tools/tester/windows/guihlp.cpp index 65e57c65263..76dcdabbe1a 100644 --- a/mozilla/modules/plugin/tools/tester/windows/guihlp.cpp +++ b/mozilla/modules/plugin/tools/tester/windows/guihlp.cpp @@ -395,6 +395,7 @@ void updateUI(HWND hWnd) ComboBox_AddString(hWndCombo, "NPPVpluginWindowBool"); ComboBox_AddString(hWndCombo, "NPPVpluginTransparentBool"); ComboBox_AddString(hWndCombo, "NPPVpluginWindowSize"); + ComboBox_AddString(hWndCombo, "NPPVpluginKeepLibraryInMemory"); ComboBox_SetCurSel(hWndCombo, 0); ShowWindow(GetDlgItem(hWnd, IDC_BUTTON_PASTE), SW_HIDE); } @@ -664,6 +665,14 @@ void onGo(HWND hWnd) npsize.height = GetDlgItemInt(hWnd, IDC_EDIT_ARG4, &bTranslated, TRUE); pPlugin->m_pValue = (void *)&npsize; } + else if(strcmp(sz1, "NPPVpluginKeepLibraryInMemory") == 0) + { + variable = NPPVpluginKeepLibraryInMemory; + index = ComboBox_GetCurSel(GetDlgItem(hWnd, IDC_COMBO_ARG3)); + ComboBox_GetLBText(GetDlgItem(hWnd, IDC_COMBO_ARG3), index, szStringValue); + bBoolValue = (strcmp(szStringValue, "TRUE") == 0) ? TRUE : FALSE; + pPlugin->m_pValue = (void *)&bBoolValue; + } pPlugin->makeNPNCall(action_npn_set_value, DEFAULT_DWARG_VALUE, (DWORD)variable, DEFAULT_DWARG_VALUE); } else if(strcmp(szString, STRING_NPN_INVALIDATERECT) == 0)