This is not part of regular build -- adding new capabilities to the Tester Plugin
git-svn-id: svn://10.0.0.236/trunk@138765 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -203,10 +203,9 @@ Frame:
|
||||
{
|
||||
if(m_bShowImmediately)
|
||||
{
|
||||
if(m_pStream == NULL)
|
||||
NPN_NewStream(m_pPluginInstance, m_szStreamType, m_szTarget, &m_pStream);
|
||||
BOOL dosstyle = (m_pPlugin && m_pPlugin->isStandAlone());
|
||||
|
||||
int iLength = formatLogItem(plis, szOutput, "");
|
||||
int iLength = formatLogItem(plis, szOutput, "", dosstyle);
|
||||
|
||||
// we should fix the output string if it contains symbols <html
|
||||
// If this is the case the browser will display the whole output
|
||||
@@ -214,7 +213,17 @@ Frame:
|
||||
// I do not know if this is a bug in the browser or not.
|
||||
FixUpOutputString(szOutput);
|
||||
|
||||
NPN_Write(m_pPluginInstance, m_pStream, iLength, (void *)szOutput);
|
||||
if (m_pPlugin && m_pPlugin->isStandAlone())
|
||||
{
|
||||
m_pPlugin->outputToNativeWindow(szOutput);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(m_pStream == NULL)
|
||||
NPN_NewStream(m_pPluginInstance, m_szStreamType, m_szTarget, &m_pStream);
|
||||
|
||||
NPN_Write(m_pPluginInstance, m_pStream, iLength, (void *)szOutput);
|
||||
}
|
||||
delete plis;
|
||||
}
|
||||
else
|
||||
@@ -269,15 +278,23 @@ void CLogger::clearLog()
|
||||
|
||||
void CLogger::clearTarget()
|
||||
{
|
||||
if(m_pStream != NULL)
|
||||
NPN_DestroyStream(m_pPluginInstance, m_pStream, NPRES_DONE);
|
||||
NPN_NewStream(m_pPluginInstance, m_szStreamType, m_szTarget, &m_pStream);
|
||||
NPN_Write(m_pPluginInstance, m_pStream, 1, "\n");
|
||||
|
||||
if(!m_bShowImmediately)
|
||||
if (m_pPlugin && m_pPlugin->isStandAlone())
|
||||
{
|
||||
NPN_DestroyStream(m_pPluginInstance, m_pStream, NPRES_DONE);
|
||||
m_pStream = NULL;
|
||||
m_pPlugin->outputToNativeWindow("");
|
||||
}
|
||||
else
|
||||
{
|
||||
if(m_pStream != NULL)
|
||||
NPN_DestroyStream(m_pPluginInstance, m_pStream, NPRES_DONE);
|
||||
|
||||
NPN_NewStream(m_pPluginInstance, m_szStreamType, m_szTarget, &m_pStream);
|
||||
NPN_Write(m_pPluginInstance, m_pStream, 1, "\n");
|
||||
|
||||
if(!m_bShowImmediately)
|
||||
{
|
||||
NPN_DestroyStream(m_pPluginInstance, m_pStream, NPRES_DONE);
|
||||
m_pStream = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -291,24 +308,34 @@ void CLogger::dumpLogToTarget()
|
||||
if(m_pLog == NULL)
|
||||
return;
|
||||
|
||||
BOOL bTemporaryStream = ((m_pStream == NULL) && !getShowImmediatelyFlag());
|
||||
static char szOutput[1024];
|
||||
|
||||
if(m_pStream == NULL)
|
||||
NPN_NewStream(m_pPluginInstance, m_szStreamType, m_szTarget, &m_pStream);
|
||||
|
||||
for(LogItemListElement * plile = m_pLog->m_pFirst; plile != NULL; plile = plile->pNext)
|
||||
if (m_pPlugin && m_pPlugin->isStandAlone())
|
||||
{
|
||||
static char szOutput[1024];
|
||||
|
||||
int iLength = formatLogItem(plile->plis, szOutput, "");
|
||||
|
||||
NPN_Write(m_pPluginInstance, m_pStream, iLength, (void *)szOutput);
|
||||
for(LogItemListElement * plile = m_pLog->m_pFirst; plile != NULL; plile = plile->pNext)
|
||||
{
|
||||
int iLength = formatLogItem(plile->plis, szOutput, "", TRUE);
|
||||
m_pPlugin->outputToNativeWindow(szOutput);
|
||||
}
|
||||
}
|
||||
|
||||
if(bTemporaryStream)
|
||||
else
|
||||
{
|
||||
NPN_DestroyStream(m_pPluginInstance, m_pStream, NPRES_DONE);
|
||||
m_pStream = NULL;
|
||||
BOOL bTemporaryStream = ((m_pStream == NULL) && !getShowImmediatelyFlag());
|
||||
|
||||
if(m_pStream == NULL)
|
||||
NPN_NewStream(m_pPluginInstance, m_szStreamType, m_szTarget, &m_pStream);
|
||||
|
||||
for(LogItemListElement * plile = m_pLog->m_pFirst; plile != NULL; plile = plile->pNext)
|
||||
{
|
||||
int iLength = formatLogItem(plile->plis, szOutput, "");
|
||||
NPN_Write(m_pPluginInstance, m_pStream, iLength, (void *)szOutput);
|
||||
}
|
||||
|
||||
if(bTemporaryStream)
|
||||
{
|
||||
NPN_DestroyStream(m_pPluginInstance, m_pStream, NPRES_DONE);
|
||||
m_pStream = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
#include "logger.h"
|
||||
|
||||
extern CLogger * pLogger;
|
||||
|
||||
static char szINIFile[] = NPAPI_INI_FILE_NAME;
|
||||
static char szTarget[] = LOGGER_DEFAULT_TARGET;
|
||||
|
||||
@@ -77,18 +78,24 @@ NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, ch
|
||||
pLogger = new CLogger(szTarget);
|
||||
}
|
||||
|
||||
pLogger->associate(pPlugin);
|
||||
|
||||
char szFileName[_MAX_PATH];
|
||||
pPlugin->getModulePath(szFileName, sizeof(szFileName));
|
||||
strcat(szFileName, szINIFile);
|
||||
pLogger->restorePreferences(szFileName);
|
||||
|
||||
pLogger->associate(pPlugin);
|
||||
|
||||
if (pPlugin->isStandAlone())
|
||||
pPlugin->initStandAlone();
|
||||
|
||||
Return:
|
||||
DWORD dwTickReturn = XP_GetTickCount();
|
||||
pLogger->appendToLog(action_npp_new, dwTickEnter, dwTickReturn, (DWORD)ret,
|
||||
(DWORD)pluginType, (DWORD)instance,
|
||||
(DWORD)mode, (DWORD)argc, (DWORD)argn, (DWORD)argv, (DWORD)saved);
|
||||
|
||||
pPlugin->autoStartScriptIfNeeded();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -106,6 +113,9 @@ NPError NPP_Destroy (NPP instance, NPSavedData** save)
|
||||
|
||||
pPlugin = (CPluginBase *)instance->pdata;
|
||||
if(pPlugin) {
|
||||
if (pPlugin->isStandAlone())
|
||||
pPlugin->shutStandAlone();
|
||||
|
||||
pPlugin->shut();
|
||||
DestroyPlugin(pPlugin);
|
||||
goto Return;
|
||||
@@ -149,39 +159,42 @@ NPError NPP_SetWindow (NPP instance, NPWindow* pNPWindow)
|
||||
goto Return;
|
||||
}
|
||||
|
||||
// window just created
|
||||
if(!pPlugin->isInitialized() && pNPWindow->window) {
|
||||
if(!pPlugin->init((DWORD)pNPWindow->window)) {
|
||||
delete pPlugin;
|
||||
pPlugin = NULL;
|
||||
ret = NPERR_MODULE_LOAD_FAILED_ERROR;
|
||||
if (!pPlugin->isStandAlone())
|
||||
{
|
||||
// window just created
|
||||
if(!pPlugin->isInitialized() && pNPWindow->window) {
|
||||
if(!pPlugin->init((DWORD)pNPWindow->window)) {
|
||||
delete pPlugin;
|
||||
pPlugin = NULL;
|
||||
ret = NPERR_MODULE_LOAD_FAILED_ERROR;
|
||||
goto Return;
|
||||
}
|
||||
|
||||
if(pLogger->getShowImmediatelyFlag()) {
|
||||
pLogger->dumpLogToTarget();
|
||||
pLogger->clearLog();
|
||||
}
|
||||
goto Return;
|
||||
}
|
||||
|
||||
if(pLogger->getShowImmediatelyFlag()) {
|
||||
pLogger->dumpLogToTarget();
|
||||
pLogger->clearLog();
|
||||
// window goes away
|
||||
if(!pNPWindow->window && pPlugin->isInitialized()) {
|
||||
pPlugin->shut();
|
||||
ret = NPERR_NO_ERROR;
|
||||
goto Return;
|
||||
}
|
||||
goto Return;
|
||||
}
|
||||
|
||||
// window goes away
|
||||
if(!pNPWindow->window && pPlugin->isInitialized()) {
|
||||
pPlugin->shut();
|
||||
ret = NPERR_NO_ERROR;
|
||||
goto Return;
|
||||
}
|
||||
// window resized?
|
||||
if(pPlugin->isInitialized() && pNPWindow->window) {
|
||||
ret = NPERR_NO_ERROR;
|
||||
goto Return;
|
||||
}
|
||||
|
||||
// window resized?
|
||||
if(pPlugin->isInitialized() && pNPWindow->window) {
|
||||
ret = NPERR_NO_ERROR;
|
||||
goto Return;
|
||||
}
|
||||
|
||||
// this should not happen, nothing to do
|
||||
if(!pNPWindow->window && !pPlugin->isInitialized()) {
|
||||
ret = NPERR_NO_ERROR;
|
||||
goto Return;
|
||||
// this should not happen, nothing to do
|
||||
if(!pNPWindow->window && !pPlugin->isInitialized()) {
|
||||
ret = NPERR_NO_ERROR;
|
||||
goto Return;
|
||||
}
|
||||
}
|
||||
|
||||
Return:
|
||||
|
||||
@@ -394,3 +394,7 @@ DWORD CPluginBase::makeNPNCall(NPAPI_Action action, DWORD dw1, DWORD dw2, DWORD
|
||||
|
||||
return dwRet;
|
||||
}
|
||||
|
||||
void CPluginBase::autoStartScriptIfNeeded()
|
||||
{
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user