Bug 293987 Mozilla cannot open PDF document via proxy and It crash after close the tab when it loaded.

Patch by leon.sha@sun.com
darin: review+
shaver: superreview+
This commit is contained in:
leon.sha%sun.com 2006-02-14 08:13:51 +00:00
Родитель 7ad0f586df
Коммит 7a083a5f23
2 изменённых файлов: 17 добавлений и 6 удалений

Просмотреть файл

@ -1138,16 +1138,18 @@ NS_IMETHODIMP ns4xPluginInstance::SetWindow(nsPluginWindow* window)
} }
// Allocate and fill out the ws_info data // Allocate and fill out the ws_info data
if (!window->ws_info) { if (!window->ws_info || !mXtBin) {
if (!window->ws_info) {
#ifdef NS_DEBUG #ifdef NS_DEBUG
printf("About to create new ws_info...\n"); printf("About to create new ws_info...\n");
#endif #endif
// allocate a new NPSetWindowCallbackStruct structure at ws_info // allocate a new NPSetWindowCallbackStruct structure at ws_info
window->ws_info = (NPSetWindowCallbackStruct *)PR_MALLOC(sizeof(NPSetWindowCallbackStruct)); window->ws_info = (NPSetWindowCallbackStruct *)PR_MALLOC(sizeof(NPSetWindowCallbackStruct));
if (!window->ws_info) if (!window->ws_info)
return NS_ERROR_OUT_OF_MEMORY; return NS_ERROR_OUT_OF_MEMORY;
}
ws = (NPSetWindowCallbackStruct *)window->ws_info; ws = (NPSetWindowCallbackStruct *)window->ws_info;

Просмотреть файл

@ -6740,6 +6740,15 @@ nsresult nsPluginStreamListenerPeer::ServeStreamAsFile(nsIRequest *request,
if (owner) { if (owner) {
nsPluginWindow *window = nsnull; nsPluginWindow *window = nsnull;
owner->GetWindow(window); owner->GetWindow(window);
#if defined (MOZ_WIDGET_GTK) || defined (MOZ_WIDGET_GTK2)
// Should call GetPluginPort() here.
// This part is copied from nsPluginInstanceOwner::GetPluginPort().
nsCOMPtr<nsIWidget> widget;
((nsPluginNativeWindow*)window)->GetPluginWidget(getter_AddRefs(widget));
if (widget) {
window->window = (nsPluginPort*) widget->GetNativeData(NS_NATIVE_PLUGIN_PORT);
}
#endif
if (window->window) if (window->window)
{ {
nsCOMPtr<nsIPluginInstance> inst = mInstance; nsCOMPtr<nsIPluginInstance> inst = mInstance;