зеркало из https://github.com/mozilla/pjs.git
bug 88155, Trunk & M094 crash [@ MSVCRT.DLL - ns4xPluginStreamListener::OnDataAvailable, nsPluginStreamListenerPeer::OnDataAvailable] - seg faults loading http://www.planetjulie.com/, r=av, peterl, sr=waterson
This commit is contained in:
Родитель
058bcc0e0c
Коммит
638970403d
|
@ -92,6 +92,7 @@
|
|||
#include "npapi.h"
|
||||
#include "nsIPrintOptions.h"
|
||||
#include "nsGfxCIID.h"
|
||||
#include "nsHTMLUtils.h"
|
||||
static NS_DEFINE_CID(kPrintOptionsCID, NS_PRINTOPTIONS_CID);
|
||||
|
||||
// headers for plugin scriptability
|
||||
|
@ -852,6 +853,27 @@ nsObjectFrame::GetDesiredSize(nsIPresContext* aPresContext,
|
|||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsObjectFrame::MakeAbsoluteURL(nsIURI* *aFullURI,
|
||||
nsString aSrc,
|
||||
nsIURI* aBaseURI)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
rv = mInstanceOwner->GetDocument(getter_AddRefs(document));
|
||||
|
||||
//trim leading and trailing whitespace
|
||||
aSrc.Trim("\b\t\r\n ", PR_TRUE, PR_TRUE, PR_FALSE);
|
||||
|
||||
//create properly encoded absolute URI using the document charset
|
||||
nsXPIDLCString encodedURI;
|
||||
rv = NS_MakeAbsoluteURIWithCharset(getter_Copies(encodedURI),
|
||||
aSrc, document, aBaseURI,
|
||||
nsHTMLUtils::IOService,
|
||||
nsHTMLUtils::CharsetMgr);
|
||||
rv = NS_NewURI(aFullURI, encodedURI, aBaseURI);
|
||||
return rv;
|
||||
}
|
||||
|
||||
#define JAVA_CLASS_ID "8AD9C840-044E-11D1-B3E9-00805F499D93"
|
||||
|
||||
|
@ -921,7 +943,7 @@ nsObjectFrame::Reflow(nsIPresContext* aPresContext,
|
|||
mContent->GetAttr(kNameSpaceID_HTML, nsHTMLAtoms::codebase, codeBase)) &&
|
||||
!bJavaPluginClsid) {
|
||||
nsCOMPtr<nsIURI> codeBaseURL;
|
||||
rv = NS_NewURI(getter_AddRefs(codeBaseURL), codeBase, baseURL);
|
||||
rv = MakeAbsoluteURL(getter_AddRefs(codeBaseURL), codeBase, baseURL);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
baseURL = codeBaseURL;
|
||||
}
|
||||
|
@ -929,7 +951,7 @@ nsObjectFrame::Reflow(nsIPresContext* aPresContext,
|
|||
|
||||
// Create an absolute URL
|
||||
if(bJavaPluginClsid) {
|
||||
rv = NS_NewURI(getter_AddRefs(fullURL), classid, baseURL);
|
||||
rv = MakeAbsoluteURL(getter_AddRefs(fullURL), classid, baseURL);
|
||||
}
|
||||
else fullURL = baseURL;
|
||||
|
||||
|
@ -958,7 +980,7 @@ nsObjectFrame::Reflow(nsIPresContext* aPresContext,
|
|||
nsAutoString codeBase;
|
||||
if (NS_CONTENT_ATTR_HAS_VALUE == mContent->GetAttr(kNameSpaceID_HTML, nsHTMLAtoms::codebase, codeBase)) {
|
||||
nsCOMPtr<nsIURI> codeBaseURL;
|
||||
rv = NS_NewURI(getter_AddRefs(fullURL), codeBase, baseURL);
|
||||
rv = MakeAbsoluteURL(getter_AddRefs(fullURL), codeBase, baseURL);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
baseURL = codeBaseURL;
|
||||
}
|
||||
|
@ -1005,14 +1027,13 @@ nsObjectFrame::Reflow(nsIPresContext* aPresContext,
|
|||
nsAutoString codeBase;
|
||||
if (NS_CONTENT_ATTR_HAS_VALUE == mContent->GetAttr(kNameSpaceID_HTML, nsHTMLAtoms::codebase, codeBase)) {
|
||||
nsCOMPtr<nsIURI> codeBaseURL;
|
||||
rv = NS_NewURI(getter_AddRefs(codeBaseURL), codeBase, baseURL);
|
||||
rv = MakeAbsoluteURL(getter_AddRefs(codeBaseURL), codeBase, baseURL);
|
||||
if(rv == NS_OK) {
|
||||
baseURL = codeBaseURL;
|
||||
}
|
||||
}
|
||||
|
||||
// Create an absolute URL
|
||||
rv = NS_NewURI(getter_AddRefs(fullURL), src, baseURL);
|
||||
rv = MakeAbsoluteURL(getter_AddRefs(fullURL), src, baseURL);
|
||||
}
|
||||
else
|
||||
fullURL = baseURL;
|
||||
|
@ -1030,9 +1051,8 @@ nsObjectFrame::Reflow(nsIPresContext* aPresContext,
|
|||
//stream in the object source if there is one...
|
||||
if (NS_CONTENT_ATTR_HAS_VALUE ==
|
||||
mContent->GetAttr(kNameSpaceID_HTML, nsHTMLAtoms::src, src)) {
|
||||
src.Trim("\b\t\r\n ", PR_TRUE, PR_TRUE, PR_FALSE); // trim leading and trailing whitespace
|
||||
// Create an absolute URL
|
||||
rv = NS_NewURI(getter_AddRefs(fullURL), src, baseURL);
|
||||
rv = MakeAbsoluteURL(getter_AddRefs(fullURL), src, baseURL);
|
||||
if (NS_FAILED(rv)) {
|
||||
// Failed to create URI, maybe because we didn't
|
||||
// reconize the protocol handler ==> treat like
|
||||
|
@ -1042,9 +1062,8 @@ nsObjectFrame::Reflow(nsIPresContext* aPresContext,
|
|||
}
|
||||
else if (NS_CONTENT_ATTR_HAS_VALUE ==
|
||||
mContent->GetAttr(kNameSpaceID_HTML, nsHTMLAtoms::data, src)) {
|
||||
src.Trim("\b\t\r\n ", PR_TRUE, PR_TRUE, PR_FALSE); // trim leading and trailing whitespace
|
||||
// Create an absolute URL
|
||||
rv = NS_NewURI(getter_AddRefs(fullURL), src, baseURL);
|
||||
rv = MakeAbsoluteURL(getter_AddRefs(fullURL), src, baseURL);
|
||||
if (NS_FAILED(rv)) {
|
||||
// Failed to create URI, maybe because we didn't
|
||||
// reconize the protocol handler ==> treat like
|
||||
|
|
|
@ -91,6 +91,10 @@ public:
|
|||
nsISupports* aSubContent);
|
||||
NS_IMETHOD GetPluginInstance(nsIPluginInstance*& aPluginInstance);
|
||||
|
||||
//i18n helper
|
||||
nsresult MakeAbsoluteURL(nsIURI* *aFullURI,
|
||||
nsString aSrc,
|
||||
nsIURI* aBaseURI);
|
||||
//local methods
|
||||
nsresult CreateWidget(nsIPresContext* aPresContext,
|
||||
nscoord aWidth,
|
||||
|
|
|
@ -92,6 +92,7 @@
|
|||
#include "npapi.h"
|
||||
#include "nsIPrintOptions.h"
|
||||
#include "nsGfxCIID.h"
|
||||
#include "nsHTMLUtils.h"
|
||||
static NS_DEFINE_CID(kPrintOptionsCID, NS_PRINTOPTIONS_CID);
|
||||
|
||||
// headers for plugin scriptability
|
||||
|
@ -852,6 +853,27 @@ nsObjectFrame::GetDesiredSize(nsIPresContext* aPresContext,
|
|||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsObjectFrame::MakeAbsoluteURL(nsIURI* *aFullURI,
|
||||
nsString aSrc,
|
||||
nsIURI* aBaseURI)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
rv = mInstanceOwner->GetDocument(getter_AddRefs(document));
|
||||
|
||||
//trim leading and trailing whitespace
|
||||
aSrc.Trim("\b\t\r\n ", PR_TRUE, PR_TRUE, PR_FALSE);
|
||||
|
||||
//create properly encoded absolute URI using the document charset
|
||||
nsXPIDLCString encodedURI;
|
||||
rv = NS_MakeAbsoluteURIWithCharset(getter_Copies(encodedURI),
|
||||
aSrc, document, aBaseURI,
|
||||
nsHTMLUtils::IOService,
|
||||
nsHTMLUtils::CharsetMgr);
|
||||
rv = NS_NewURI(aFullURI, encodedURI, aBaseURI);
|
||||
return rv;
|
||||
}
|
||||
|
||||
#define JAVA_CLASS_ID "8AD9C840-044E-11D1-B3E9-00805F499D93"
|
||||
|
||||
|
@ -921,7 +943,7 @@ nsObjectFrame::Reflow(nsIPresContext* aPresContext,
|
|||
mContent->GetAttr(kNameSpaceID_HTML, nsHTMLAtoms::codebase, codeBase)) &&
|
||||
!bJavaPluginClsid) {
|
||||
nsCOMPtr<nsIURI> codeBaseURL;
|
||||
rv = NS_NewURI(getter_AddRefs(codeBaseURL), codeBase, baseURL);
|
||||
rv = MakeAbsoluteURL(getter_AddRefs(codeBaseURL), codeBase, baseURL);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
baseURL = codeBaseURL;
|
||||
}
|
||||
|
@ -929,7 +951,7 @@ nsObjectFrame::Reflow(nsIPresContext* aPresContext,
|
|||
|
||||
// Create an absolute URL
|
||||
if(bJavaPluginClsid) {
|
||||
rv = NS_NewURI(getter_AddRefs(fullURL), classid, baseURL);
|
||||
rv = MakeAbsoluteURL(getter_AddRefs(fullURL), classid, baseURL);
|
||||
}
|
||||
else fullURL = baseURL;
|
||||
|
||||
|
@ -958,7 +980,7 @@ nsObjectFrame::Reflow(nsIPresContext* aPresContext,
|
|||
nsAutoString codeBase;
|
||||
if (NS_CONTENT_ATTR_HAS_VALUE == mContent->GetAttr(kNameSpaceID_HTML, nsHTMLAtoms::codebase, codeBase)) {
|
||||
nsCOMPtr<nsIURI> codeBaseURL;
|
||||
rv = NS_NewURI(getter_AddRefs(fullURL), codeBase, baseURL);
|
||||
rv = MakeAbsoluteURL(getter_AddRefs(fullURL), codeBase, baseURL);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
baseURL = codeBaseURL;
|
||||
}
|
||||
|
@ -1005,14 +1027,13 @@ nsObjectFrame::Reflow(nsIPresContext* aPresContext,
|
|||
nsAutoString codeBase;
|
||||
if (NS_CONTENT_ATTR_HAS_VALUE == mContent->GetAttr(kNameSpaceID_HTML, nsHTMLAtoms::codebase, codeBase)) {
|
||||
nsCOMPtr<nsIURI> codeBaseURL;
|
||||
rv = NS_NewURI(getter_AddRefs(codeBaseURL), codeBase, baseURL);
|
||||
rv = MakeAbsoluteURL(getter_AddRefs(codeBaseURL), codeBase, baseURL);
|
||||
if(rv == NS_OK) {
|
||||
baseURL = codeBaseURL;
|
||||
}
|
||||
}
|
||||
|
||||
// Create an absolute URL
|
||||
rv = NS_NewURI(getter_AddRefs(fullURL), src, baseURL);
|
||||
rv = MakeAbsoluteURL(getter_AddRefs(fullURL), src, baseURL);
|
||||
}
|
||||
else
|
||||
fullURL = baseURL;
|
||||
|
@ -1030,9 +1051,8 @@ nsObjectFrame::Reflow(nsIPresContext* aPresContext,
|
|||
//stream in the object source if there is one...
|
||||
if (NS_CONTENT_ATTR_HAS_VALUE ==
|
||||
mContent->GetAttr(kNameSpaceID_HTML, nsHTMLAtoms::src, src)) {
|
||||
src.Trim("\b\t\r\n ", PR_TRUE, PR_TRUE, PR_FALSE); // trim leading and trailing whitespace
|
||||
// Create an absolute URL
|
||||
rv = NS_NewURI(getter_AddRefs(fullURL), src, baseURL);
|
||||
rv = MakeAbsoluteURL(getter_AddRefs(fullURL), src, baseURL);
|
||||
if (NS_FAILED(rv)) {
|
||||
// Failed to create URI, maybe because we didn't
|
||||
// reconize the protocol handler ==> treat like
|
||||
|
@ -1042,9 +1062,8 @@ nsObjectFrame::Reflow(nsIPresContext* aPresContext,
|
|||
}
|
||||
else if (NS_CONTENT_ATTR_HAS_VALUE ==
|
||||
mContent->GetAttr(kNameSpaceID_HTML, nsHTMLAtoms::data, src)) {
|
||||
src.Trim("\b\t\r\n ", PR_TRUE, PR_TRUE, PR_FALSE); // trim leading and trailing whitespace
|
||||
// Create an absolute URL
|
||||
rv = NS_NewURI(getter_AddRefs(fullURL), src, baseURL);
|
||||
rv = MakeAbsoluteURL(getter_AddRefs(fullURL), src, baseURL);
|
||||
if (NS_FAILED(rv)) {
|
||||
// Failed to create URI, maybe because we didn't
|
||||
// reconize the protocol handler ==> treat like
|
||||
|
|
|
@ -91,6 +91,10 @@ public:
|
|||
nsISupports* aSubContent);
|
||||
NS_IMETHOD GetPluginInstance(nsIPluginInstance*& aPluginInstance);
|
||||
|
||||
//i18n helper
|
||||
nsresult MakeAbsoluteURL(nsIURI* *aFullURI,
|
||||
nsString aSrc,
|
||||
nsIURI* aBaseURI);
|
||||
//local methods
|
||||
nsresult CreateWidget(nsIPresContext* aPresContext,
|
||||
nscoord aWidth,
|
||||
|
|
Загрузка…
Ссылка в новой задаче