From 182f6664ff573cabb01e8e64d97887ae3f2e113e Mon Sep 17 00:00:00 2001 From: "peterlubczynski%netscape.com" Date: Sat, 28 Apr 2001 02:21:25 +0000 Subject: [PATCH] Patch to fix from submit on Mac for Acrobat bug 76932 r=av sr=attinasi git-svn-id: svn://10.0.0.236/trunk@93353 18797224-902f-48f8-a5cc-f745e15eee43 --- .../plugin/base/src/nsPluginHostImpl.cpp | 25 +++++++++++++------ .../plugin/nglsrc/nsPluginHostImpl.cpp | 25 +++++++++++++------ 2 files changed, 34 insertions(+), 16 deletions(-) diff --git a/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp b/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp index be03a39e43e..1181b0b7c23 100644 --- a/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp +++ b/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp @@ -93,6 +93,7 @@ #include "nsIMIMEService.h" #include "nsCExternalHandlerService.h" #include "nsILocalFile.h" +#include "nsIFileChannel.h" #ifdef XP_UNIX #if defined(MOZ_WIDGET_GTK) @@ -4019,16 +4020,24 @@ NS_IMETHODIMP nsPluginHostImpl::NewPluginURLStream(const nsString& aURL, // In the file case, hand the filename off to NewPostDataStream if (aIsFile) { - // If the filename does not start with file:///, try - // passing it through unmodified - const char *filename = aPostData; - if (! PL_strncasecmp("file:///", filename, 8)) - filename += 8; + nsXPIDLCString filename; - // tell the listener about it so it will delete the file later - listenerPeer->SetLocalFile(filename); + nsCOMPtr url; + NS_NewURI(getter_AddRefs(url), aPostData); + nsCOMPtr fileURL(do_QueryInterface(url)); + if (fileURL) { + nsCOMPtr file; + fileURL->GetFile(getter_AddRefs(file)); + nsCOMPtr localFile(do_QueryInterface(file)); + if (localFile) { + localFile->GetPath(getter_Copies(filename)); - NS_NewPostDataStream(getter_AddRefs(postDataStream), aIsFile, filename, 0); + // tell the listener about it so it will delete the file later + listenerPeer->SetLocalFile(filename); + + NS_NewPostDataStream(getter_AddRefs(postDataStream), aIsFile, filename, 0); + } + } } else { diff --git a/mozilla/modules/plugin/nglsrc/nsPluginHostImpl.cpp b/mozilla/modules/plugin/nglsrc/nsPluginHostImpl.cpp index be03a39e43e..1181b0b7c23 100644 --- a/mozilla/modules/plugin/nglsrc/nsPluginHostImpl.cpp +++ b/mozilla/modules/plugin/nglsrc/nsPluginHostImpl.cpp @@ -93,6 +93,7 @@ #include "nsIMIMEService.h" #include "nsCExternalHandlerService.h" #include "nsILocalFile.h" +#include "nsIFileChannel.h" #ifdef XP_UNIX #if defined(MOZ_WIDGET_GTK) @@ -4019,16 +4020,24 @@ NS_IMETHODIMP nsPluginHostImpl::NewPluginURLStream(const nsString& aURL, // In the file case, hand the filename off to NewPostDataStream if (aIsFile) { - // If the filename does not start with file:///, try - // passing it through unmodified - const char *filename = aPostData; - if (! PL_strncasecmp("file:///", filename, 8)) - filename += 8; + nsXPIDLCString filename; - // tell the listener about it so it will delete the file later - listenerPeer->SetLocalFile(filename); + nsCOMPtr url; + NS_NewURI(getter_AddRefs(url), aPostData); + nsCOMPtr fileURL(do_QueryInterface(url)); + if (fileURL) { + nsCOMPtr file; + fileURL->GetFile(getter_AddRefs(file)); + nsCOMPtr localFile(do_QueryInterface(file)); + if (localFile) { + localFile->GetPath(getter_Copies(filename)); - NS_NewPostDataStream(getter_AddRefs(postDataStream), aIsFile, filename, 0); + // tell the listener about it so it will delete the file later + listenerPeer->SetLocalFile(filename); + + NS_NewPostDataStream(getter_AddRefs(postDataStream), aIsFile, filename, 0); + } + } } else {