Bug 168490 -- extra blank window during plugin xpi install, r=serge, sr=darin

git-svn-id: svn://10.0.0.236/trunk@131408 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
av%netscape.com
2002-10-08 06:31:13 +00:00
parent c609c78dfd
commit bfc7a45fc3
4 changed files with 58 additions and 18 deletions

View File

@@ -52,7 +52,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib advapi32.lib libc.lib /nologo /subsystem:windows /dll /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib advapi32.lib /nologo /subsystem:windows /dll /machine:I386
!ELSEIF "$(CFG)" == "Npnul32 - Win32 Debug"

View File

@@ -231,7 +231,10 @@ NPP_NewStream(NPP pInstance,
CPlugin * pPlugin = (CPlugin *)pInstance->pdata;
assert(pPlugin != NULL);
return NPERR_NO_ERROR;
if (!pPlugin)
return NPERR_GENERIC_ERROR;
return pPlugin->newStream(type, stream, seekable, stype);
}
//------------------------------------------------------------------------------------
@@ -263,7 +266,7 @@ NPP_Write(NPP pInstance, NPStream *stream, int32 offset, int32 len, void *buffer
CPlugin * pPlugin = (CPlugin *)pInstance->pdata;
assert(pPlugin != NULL);
return -1; // tell Nav to abort the stream, don't need it
return -1; // tell the browser to abort the stream, don't need it
}
//------------------------------------------------------------------------------------
@@ -279,7 +282,10 @@ NPP_DestroyStream(NPP pInstance, NPStream *stream, NPError reason)
CPlugin * pPlugin = (CPlugin *)pInstance->pdata;
assert(pPlugin != NULL);
return NPERR_NO_ERROR;
if (!pPlugin)
return NPERR_GENERIC_ERROR;
return pPlugin->destroyStream(stream, reason);
}
//------------------------------------------------------------------------------------

View File

@@ -118,6 +118,8 @@ CPlugin::CPlugin(HINSTANCE hInst,
m_bSmartUpdate(TRUE),
m_szURLString(NULL),
m_szCommandMessage(NULL),
m_bWaitingStreamFromPFS(FALSE),
m_PFSStream(NULL),
m_bHidden(bHidden)
{
dbgOut1("CPlugin::CPlugin()");
@@ -434,7 +436,8 @@ void CPlugin::getPluginRegular()
dbgOut3("CPlugin::getPluginRegular(), %#08x '%s'", m_pNPInstance, szURL);
NPN_GetURL(m_pNPInstance, szURL, "_blank");
NPN_GetURL(m_pNPInstance, szURL, NULL);
m_bWaitingStreamFromPFS = TRUE;
}
void CPlugin::getPluginSmart()
@@ -554,6 +557,32 @@ void CPlugin::URLNotify(const char * szURL)
NPN_DestroyStream(m_pNPInstance, pStream, NPRES_DONE);
}
NPError CPlugin::newStream(NPMIMEType type, NPStream *stream, NPBool seekable, uint16 *stype)
{
if (!m_bWaitingStreamFromPFS)
return NPERR_NO_ERROR;
m_bWaitingStreamFromPFS = FALSE;
m_PFSStream = stream;
if (stream) {
if (type && !strcmp(type, "application/x-xpinstall"))
NPN_GetURL(m_pNPInstance, stream->url, "_self");
else
NPN_GetURL(m_pNPInstance, stream->url, "_blank");
}
return NPERR_NO_ERROR;
}
NPError CPlugin::destroyStream(NPStream *stream, NPError reason)
{
if (stream == m_PFSStream)
m_PFSStream = NULL;
return NPERR_NO_ERROR;
}
BOOL CPlugin::readyToRefresh()
{
char szString[1024] = {'\0'};

View File

@@ -44,22 +44,24 @@ class CPlugin
{
private:
HINSTANCE m_hInst;
NPP m_pNPInstance;
WORD m_wMode;
HWND m_hWnd;
HWND m_hWndParent;
HICON m_hIcon;
char * m_szURLString;
NPP m_pNPInstance;
WORD m_wMode;
HWND m_hWnd;
HWND m_hWndParent;
HICON m_hIcon;
char* m_szURLString;
char * m_szCommandMessage;
char* m_szCommandMessage;
BOOL m_bWaitingStreamFromPFS;
NPStream* m_PFSStream;
public:
BOOL m_bHidden;
BOOL m_bHidden;
NPMIMEType m_pNPMIMEType;
LPSTR m_szPageURL; // Location of plug-in HTML page
LPSTR m_szFileURL; // Location of plug-in JAR file
LPSTR m_szFileExtension; // File extension associated with the of the unknown mimetype
HWND m_hWndDialog;
LPSTR m_szPageURL; // Location of plug-in HTML page
LPSTR m_szFileURL; // Location of plug-in JAR file
LPSTR m_szFileExtension; // File extension associated with the of the unknown mimetype
HWND m_hWndDialog;
// environment
BOOL m_bOnline;
@@ -93,15 +95,18 @@ public:
BOOL readyToRefresh();
// NP API handlers
void resize();
void print(NPPrint * pNPPrint);
void URLNotify(const char * szURL);
NPError newStream(NPMIMEType type, NPStream *stream, NPBool seekable, uint16 *stype);
NPError destroyStream(NPStream *stream, NPError reason);
// Windows message handlers
void onCreate(HWND hWnd);
void onLButtonUp(HWND hWnd, int x, int y, UINT keyFlags);
void onRButtonUp(HWND hWnd, int x, int y, UINT keyFlags);
void onPaint(HWND hWnd);
void resize();
};