More necko changes. Changed nsIPluginTagInfo2::GetDocumentBase to copy string.

This commit is contained in:
warren%netscape.com 1999-06-23 19:55:21 +00:00
Родитель 58460640a8
Коммит 5e8dccf3fe
22 изменённых файлов: 230 добавлений и 462 удалений

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

@ -44,11 +44,10 @@
#include "nsISupportsArray.h"
#include "nsIURL.h"
#ifdef NECKO
#include "nsIIOService.h"
#include "nsIURL.h"
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
#endif // NECKO
#include "nsNeckoUtil.h"
#else
#include "nsIURLGroup.h"
#endif // NECKO
#include "nsStyleConsts.h"
#include "nsXIFConverter.h"
#include "nsFrame.h"
@ -995,29 +994,20 @@ nsGenericHTMLElement::GetBaseURL(nsIHTMLAttributes* aAttributes,
value.GetStringValue(baseHref);
nsIURI* url = nsnull;
#ifndef NECKO
nsIURLGroup* urlGroup = nsnull;
docBaseURL->GetURLGroup(&urlGroup);
if (urlGroup) {
result = urlGroup->CreateURL(&url, docBaseURL, baseHref, nsnull);
NS_RELEASE(urlGroup);
}
else {
else
#endif
{
#ifndef NECKO
result = NS_NewURL(&url, baseHref, docBaseURL);
#else
NS_WITH_SERVICE(nsIIOService, service, kIOServiceCID, &result);
if (NS_FAILED(result)) return result;
nsIURI *uri = nsnull, *baseUri = nsnull;
result = docBaseURL->QueryInterface(nsIURI::GetIID(), (void**)&baseUri);
if (NS_FAILED(result)) return result;
const char *uriStr = baseHref.GetBuffer();
result = service->NewURI(uriStr, baseUri, &uri);
NS_RELEASE(baseUri);
if (NS_FAILED(result)) return result;
result = uri->QueryInterface(nsIURI::GetIID(), (void**)&url);
result = NS_NewURI(&url, baseHref, docBaseURL);
#endif // NECKO
}
*aBaseURL = url;
@ -1962,19 +1952,7 @@ nsGenericHTMLElement::MapBackgroundAttributesInto(nsIHTMLAttributes* aAttributes
#ifndef NECKO
rv = NS_MakeAbsoluteURL(docURL, "", spec, absURLSpec);
#else
NS_WITH_SERVICE(nsIIOService, service, kIOServiceCID, &rv);
if (NS_FAILED(rv)) return;
nsIURI *baseUri = nsnull;
rv = docURL->QueryInterface(nsIURI::GetIID(), (void**)&baseUri);
if (NS_FAILED(rv)) return;
char *absUrlStr = nsnull;
const char *urlSpec = spec.GetBuffer();
rv = service->MakeAbsolute(urlSpec, baseUri, &absUrlStr);
NS_RELEASE(baseUri);
absURLSpec = absUrlStr;
delete [] absUrlStr;
rv = NS_MakeAbsoluteURI(spec, docURL, absURLSpec);
#endif // NECKO
if (NS_SUCCEEDED(rv)) {
nsStyleColor* color = (nsStyleColor*)

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

@ -21,18 +21,17 @@
#include "nsICSSStyleSheet.h"
#include "nsICSSLoader.h"
#include "nsIUnicharInputStream.h"
#include "nsIUnicharStreamLoader.h"
#include "nsIHTMLContent.h"
#include "nsIHTMLContentContainer.h"
#include "nsIURL.h"
#ifdef NECKO
#include "nsIIOService.h"
#include "nsIURL.h"
#include "nsIServiceManager.h"
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
#endif // NECKO
#include "nsNeckoUtil.h"
class nsIUnicharStreamLoader : public nsISupports {}; // XXX what?
#else
#include "nsIUnicharStreamLoader.h"
#include "nsIURLGroup.h"
#include "nsIHttpURL.h"
#endif // NECKO
#include "nsIPresShell.h"
#include "nsIPresContext.h"
#include "nsIViewManager.h"
@ -90,7 +89,9 @@ static NS_DEFINE_IID(kIDOMHTMLTextAreaElementIID, NS_IDOMHTMLTEXTAREAELEMENT_IID
static NS_DEFINE_IID(kIDOMHTMLOptionElementIID, NS_IDOMHTMLOPTIONELEMENT_IID);
static NS_DEFINE_IID(kIFormControlIID, NS_IFORMCONTROL_IID);
static NS_DEFINE_IID(kIHTMLContentSinkIID, NS_IHTML_CONTENT_SINK_IID);
#ifndef NECKO
static NS_DEFINE_IID(kIHTTPURLIID, NS_IHTTPURL_IID);
#endif
static NS_DEFINE_IID(kIScrollableViewIID, NS_ISCROLLABLEVIEW_IID);
static NS_DEFINE_IID(kIHTMLDocumentIID, NS_IHTMLDOCUMENT_IID);
static NS_DEFINE_IID(kIHTMLContentContainerIID, NS_IHTMLCONTENTCONTAINER_IID);
@ -1503,12 +1504,18 @@ HTMLContentSink::Init(nsIDocument* aDoc,
mCurrentContext->Begin(eHTMLTag_html, mRoot);
mContextStack.AppendElement(mCurrentContext);
#ifdef NECKO
char* spec;
#else
const char* spec;
#endif
(void)aURL->GetSpec(&spec);
SINK_TRACE(SINK_TRACE_CALLS,
("HTMLContentSink::Init: this=%p url='%s'",
this, spec));
#ifdef NECKO
nsCRT::free(spec);
#endif
return NS_OK;
}
@ -2032,10 +2039,23 @@ HTMLContentSink::StartLayout()
// If the document we are loading has a reference or it is a
// frameset document, disable the scroll bars on the views.
#ifdef NECKO
char* ref;
nsIURL* url;
nsresult rv = mDocumentURL->QueryInterface(nsIURL::GetIID(), (void**)&url);
if (NS_SUCCEEDED(rv)) {
rv = url->GetRef(&ref);
NS_RELEASE(url);
}
#else
const char* ref;
nsresult rv = mDocumentURL->GetRef(&ref);
#endif
if (rv == NS_OK) {
mRef = new nsString(ref);
#ifdef NECKO
nsCRT::free(ref);
#endif
}
if ((nsnull != ref) || mFrameset) {
@ -2469,31 +2489,20 @@ HTMLContentSink::ProcessStyleLink(nsIHTMLContent* aElement,
if ((0 == mimeType.Length()) || mimeType.EqualsIgnoreCase("text/css")) {
nsIURI* url = nsnull;
#ifndef NECKO
nsIURLGroup* urlGroup = nsnull;
mDocumentBaseURL->GetURLGroup(&urlGroup);
if (urlGroup) {
result = urlGroup->CreateURL(&url, mDocumentBaseURL, aHref, nsnull);
NS_RELEASE(urlGroup);
}
else {
else
#endif
{
#ifndef NECKO
result = NS_NewURL(&url, aHref, mDocumentBaseURL);
#else
NS_WITH_SERVICE(nsIIOService, service, kIOServiceCID, &result);
if (NS_FAILED(result)) return result;
nsIURI *uri = nsnull, *baseUri = nsnull;
result = mDocumentBaseURL->QueryInterface(nsIURI::GetIID(), (void**)&baseUri);
if (NS_FAILED(result)) return result;
const char *uriStr = aHref.GetBuffer();
result = service->NewURI(uriStr, baseUri, &uri);
NS_RELEASE(baseUri);
if (NS_FAILED(result)) return result;
result = uri->QueryInterface(nsIURI::GetIID(), (void**)&url);
NS_RELEASE(uri);
result = NS_NewURI(&url, aHref, mDocumentBaseURL);
#endif // NECKO
}
if (NS_OK != result) {
@ -2658,10 +2667,12 @@ HTMLContentSink::ProcessMETATag(const nsIParserNode& aNode)
}
mHead->AppendChildTo(it, PR_FALSE);
#ifndef NECKO
// If we are processing an HTTP url, handle meta http-equiv cases
nsIHttpURL* httpUrl = nsnull;
rv = mDocumentURL->QueryInterface(kIHTTPURLIID, (void **)&httpUrl);
#endif
// set any HTTP-EQUIV data into document's header data as well as url
nsAutoString header;
it->GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::httpEquiv, header);
@ -2669,6 +2680,9 @@ HTMLContentSink::ProcessMETATag(const nsIParserNode& aNode)
nsAutoString result;
it->GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::content, result);
if (result.Length() > 0) {
#ifdef NECKO
NS_ASSERTION(0, "how does necko add mime headers?");
#else
if (nsnull != httpUrl) {
char* value = result.ToNewCString(), *csHeader;
if (!value) {
@ -2685,6 +2699,7 @@ HTMLContentSink::ProcessMETATag(const nsIParserNode& aNode)
delete[] csHeader;
delete[] value;
}
#endif
header.ToLowerCase();
nsIAtom* fieldAtom = NS_NewAtom(header);
@ -2706,7 +2721,9 @@ HTMLContentSink::ProcessMETATag(const nsIParserNode& aNode)
NS_IF_RELEASE(fieldAtom);
}
}
#ifndef NECKO
NS_IF_RELEASE(httpUrl);
#endif
NS_RELEASE(it);
}
@ -2822,7 +2839,11 @@ HTMLContentSink::EvaluateScript(nsString& aScript,
nsAutoString ret;
nsIURI* docURL = mDocument->GetDocumentURL();
#ifdef NECKO
char* url;
#else
const char* url;
#endif
if (docURL) {
(void)docURL->GetSpec(&url);
}
@ -2911,31 +2932,20 @@ HTMLContentSink::ProcessSCRIPTTag(const nsIParserNode& aNode)
if (src.Length() > 0) {
// Use the SRC attribute value to load the URL
nsIURI* url = nsnull;
#ifndef NECKO
nsIURLGroup* urlGroup = nsnull;
mDocumentBaseURL->GetURLGroup(&urlGroup);
if (urlGroup) {
rv = urlGroup->CreateURL(&url, mDocumentBaseURL, src, nsnull);
NS_RELEASE(urlGroup);
}
else {
else
#endif
{
#ifndef NECKO
rv = NS_NewURL(&url, src, mDocumentBaseURL);
#else
NS_WITH_SERVICE(nsIIOService, service, kIOServiceCID, &rv);
if (NS_FAILED(rv)) return rv;
nsIURI *uri = nsnull, *baseUri = nsnull;
rv = mDocumentBaseURL->QueryInterface(nsIURI::GetIID(), (void**)&baseUri);
if (NS_FAILED(rv)) return rv;
const char *uriStr = src.GetBuffer();
rv = service->NewURI(uriStr, baseUri, &uri);
NS_RELEASE(baseUri);
if (NS_FAILED(rv)) return rv;
rv = uri->QueryInterface(nsIURI::GetIID(), (void**)&url);
NS_RELEASE(uri);
rv = NS_NewURI(&url, src, mDocumentBaseURL);
#endif // NECKO
}
if (NS_OK != rv) {
@ -2946,11 +2956,15 @@ HTMLContentSink::ProcessSCRIPTTag(const nsIParserNode& aNode)
// onto it as opaque data.
NS_ADDREF(this);
#ifdef NECKO
NS_ASSERTION(0, "fix me");
#else
nsIUnicharStreamLoader* loader;
rv = NS_NewUnicharStreamLoader(&loader,
url,
(nsStreamCompleteFunc)nsDoneLoadingScript,
(void *)this);
#endif
NS_RELEASE(url);
if (NS_OK == rv) {
rv = NS_ERROR_HTMLPARSER_BLOCK;
@ -3079,31 +3093,20 @@ HTMLContentSink::ProcessSTYLETag(const nsIParserNode& aNode)
// XXX what does nav do?
// Use the SRC attribute value to load the URL
nsIURI* url = nsnull;
#ifndef NECKO
nsIURLGroup* urlGroup = nsnull;
mDocumentBaseURL->GetURLGroup(&urlGroup);
if (urlGroup) {
rv = urlGroup->CreateURL(&url, mDocumentBaseURL, src, nsnull);
NS_RELEASE(urlGroup);
}
else {
else
#endif
{
#ifndef NECKO
rv = NS_NewURL(&url, src, mDocumentBaseURL);
#else
NS_WITH_SERVICE(nsIIOService, service, kIOServiceCID, &rv);
if (NS_FAILED(rv)) return rv;
nsIURI *uri = nsnull, *baseUri = nsnull;
rv = mDocumentBaseURL->QueryInterface(nsIURI::GetIID(), (void**)&baseUri);
if (NS_FAILED(rv)) return rv;
const char *uriStr = src.GetBuffer();
rv = service->NewURI(uriStr, baseUri, &uri);
NS_RELEASE(baseUri);
if (NS_FAILED(rv)) return rv;
rv = uri->QueryInterface(nsIURI::GetIID(), (void**)&url);
NS_RELEASE(uri);
rv = NS_NewURI(&url, src, mDocumentBaseURL);
#endif // NECKO
}
if (NS_OK != rv) {

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

@ -34,14 +34,15 @@
#include "nsIDOMComment.h"
#include "nsIDOMWindow.h"
#include "nsIDOMHTMLFormElement.h"
#include "nsIPostToServer.h"
#include "nsIStreamListener.h"
#include "nsIURL.h"
#ifdef NECKO
#include "nsIIOService.h"
#include "nsIURL.h"
#endif // NECKO
#else
#include "nsIPostToServer.h"
#include "nsIURLGroup.h"
#endif // NECKO
#include "nsIContentViewerContainer.h"
#include "nsIWebShell.h"
#include "nsIDocumentLoader.h"
@ -570,31 +571,20 @@ nsHTMLDocument:: SetBaseURL(const nsString& aURLSpec)
NS_IF_RELEASE(mBaseURL);
if (0 < aURLSpec.Length()) {
#ifndef NECKO
nsIURLGroup* urlGroup = nsnull;
(void)mDocumentURL->GetURLGroup(&urlGroup);
if (urlGroup) {
result = urlGroup->CreateURL(&mBaseURL, mDocumentURL, aURLSpec, nsnull);
NS_RELEASE(urlGroup);
}
else {
else
#endif
{
#ifndef NECKO
result = NS_NewURL(&mBaseURL, aURLSpec, mDocumentURL);
#else
NS_WITH_SERVICE(nsIIOService, service, kIOServiceCID, &result);
if (NS_FAILED(result)) return result;
nsIURI *uri = nsnull, *baseUri = nsnull;
result = mDocumentURL->QueryInterface(nsIURI::GetIID(), (void**)&baseUri);
if (NS_FAILED(result)) return result;
const char *uriStr = aURLSpec.GetBuffer();
result = service->NewURI(uriStr, baseUri, &uri);
NS_RELEASE(baseUri);
if (NS_FAILED(result)) return result;
result = uri->QueryInterface(nsIURI::GetIID(), (void**)&mBaseURL);
NS_RELEASE(uri);
result = NS_NewURI(&mBaseURL, aURLSpec, mDocumentURL);
#endif // NECKO
}
}
@ -1202,8 +1192,8 @@ nsHTMLDocument::GetCookie(nsString& aCookie)
#ifndef NECKO
nsINetService *service;
nsresult res = nsServiceManager::GetService(kNetServiceCID,
kINetServiceIID,
(nsISupports **)&service);
kINetServiceIID,
(nsISupports **)&service);
if ((NS_OK == res) && (nsnull != service) && (nsnull != mDocumentURL)) {
res = service->GetCookieString(mDocumentURL, aCookie);
@ -1274,16 +1264,7 @@ nsHTMLDocument::GetSourceDocumentURL(JSContext* cx,
#ifndef NECKO
result = NS_NewURL(sourceURL, url);
#else
NS_WITH_SERVICE(nsIIOService, service, kIOServiceCID, &result);
if (NS_FAILED(result)) return result;
nsIURI *uri = nsnull;
const char *uriStr = url.GetBuffer();
result = service->NewURI(uriStr, nsnull, &uri);
if (NS_FAILED(result)) return result;
result = uri->QueryInterface(nsIURI::GetIID(), (void**)sourceURL);
NS_RELEASE(uri);
result = NS_NewURI(sourceURL, url);
#endif // NECKO
}
}
@ -1359,15 +1340,7 @@ nsHTMLDocument::Open()
#ifndef NECKO
result = NS_NewURL(&sourceURL, "about:blank");
#else
NS_WITH_SERVICE(nsIIOService, service, kIOServiceCID, &result);
if (NS_FAILED(result)) return result;
nsIURI *uri = nsnull;
result = service->NewURI("about:blank", nsnull, &uri);
if (NS_FAILED(result)) return result;
result = uri->QueryInterface(nsIURI::GetIID(), (void**)&sourceURL);
NS_RELEASE(uri);
result = NS_NewURL(&sourceURL, "about:blank");
#endif // NECKO
if (NS_SUCCEEDED(result)) {
@ -1392,15 +1365,7 @@ nsHTMLDocument::Open(JSContext *cx, jsval *argv, PRUint32 argc)
#ifndef NECKO
result = NS_NewURL(&sourceURL, "about:blank");
#else
NS_WITH_SERVICE(nsIIOService, service, kIOServiceCID, &result);
if (NS_FAILED(result)) return result;
nsIURI *uri = nsnull;
result = service->NewURI("about:blank", nsnull, &uri);
if (NS_FAILED(result)) return result;
result = uri->QueryInterface(nsIURI::GetIID(), (void**)&sourceURL);
NS_RELEASE(uri);
result = NS_NewURI(&sourceURL, "about:blank");
#endif // NECKO
}

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

@ -21,10 +21,12 @@
#include "xp.h"
#include "plstr.h"
#include "prmem.h"
#ifndef NECKO
#include "netutils.h"
#include "mkselect.h"
#include "mktcp.h"
#include "mkgeturl.h"
#endif
#include <stddef.h>
#include <memory.h>
@ -32,7 +34,9 @@
#include "net.h"
#include "jsurl.h"
#include "nsIURL.h"
#ifndef NECKO
#include "nsIConnectionInfo.h"
#endif
#include "nsIStreamListener.h"
#include "nsIScriptContextOwner.h"
#include "nsIScriptContext.h"
@ -434,7 +438,7 @@ PR_IMPLEMENT(void)
NET_InitJavaScriptProtocol(void)
{
#ifdef NECKO
NS_WARNING(0, "Brendan said he would implement the javascript: protocol.");
NS_WARNING("Brendan said he would implement the javascript: protocol.");
#else
static NET_ProtoImpl mocha_proto_impl;

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

@ -111,7 +111,7 @@ public:
NS_IMETHOD GetParameter(const char* name, const char* *result);
NS_IMETHOD GetDocumentBase(const char* *result);
NS_IMETHOD GetDocumentBase(char* *result);
NS_IMETHOD GetDocumentEncoding(const char* *result);
@ -225,11 +225,7 @@ protected:
nsHTMLReflowMetrics& aDesiredSize);
#ifdef NECKO
nsresult SetFullURL(nsIURI* aURL);
#else
nsresult SetFullURL(nsIURI* aURL);
#endif
nsresult InstantiateWidget(nsIPresContext& aPresContext,
nsHTMLReflowMetrics& aMetrics,
@ -241,12 +237,7 @@ protected:
const nsHTMLReflowState& aReflowState,
nsIPluginHost* aPluginHost,
const char* aMimetype,
#ifdef NECKO
nsIURI* aURL
#else
nsIURI* aURL
#endif
);
nsIURI* aURL);
nsresult HandleImage(nsIPresContext& aPresContext,
nsHTMLReflowMetrics& aMetrics,
@ -254,19 +245,11 @@ protected:
nsReflowStatus& aStatus,
nsIFrame* child);
#ifdef NECKO
nsresult GetBaseURL(nsIURI* &aURL);
#else
nsresult GetBaseURL(nsIURI* &aURL);
#endif
private:
nsPluginInstanceOwner *mInstanceOwner;
#ifdef NECKO
nsIURI *mFullURL;
#else
nsIURI *mFullURL;
#endif
nsIFrame *mFirstChild;
nsIWidget *mWidget;
};
@ -585,13 +568,8 @@ nsObjectFrame::Reflow(nsIPresContext& aPresContext,
nsISupports *container = nsnull;
nsIPluginHost *pluginHost = nsnull;
nsIContentViewerContainer *cv = nsnull;
#ifdef NECKO
nsIURI* baseURL = nsnull;
nsIURI* fullURL = nsnull;
#else
nsIURI* baseURL = nsnull;
nsIURI* fullURL = nsnull;
#endif
nsAutoString classid;
PRInt32 nameSpaceID;
@ -625,14 +603,10 @@ nsObjectFrame::Reflow(nsIPresContext& aPresContext,
if(NS_CONTENT_ATTR_HAS_VALUE == mContent->GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::codebase, codeBase) &&
classid != JAVA_CLASS_ID)
{
nsIURI* codeBaseURL = nsnull;
#ifdef NECKO
nsIURI* codeBaseURL = nsnull;
char* codeBaseStr = codeBase.ToNewCString();
NS_ASSERTION(codeBaseStr, "out of memory");
rv = NS_NewURI(&codeBaseURL, codeBaseStr, baseURL);
nsCRT::free(codeBaseStr);
rv = NS_NewURI(&codeBaseURL, codeBase, baseURL);
#else
nsIURI* codeBaseURL = nsnull;
rv = NS_NewURL(&codeBaseURL, codeBase, baseURL, nsnull, group);
#endif
if(rv == NS_OK)
@ -652,10 +626,7 @@ nsObjectFrame::Reflow(nsIPresContext& aPresContext,
// Create an absolute URL
if(classid != JAVA_CLASS_ID) {
#ifdef NECKO
char* classidStr = classid.ToNewCString();
NS_ASSERTION(classidStr, "out of memory");
rv = NS_NewURI(&fullURL, classidStr, baseURL);
nsCRT::free(classidStr);
rv = NS_NewURI(&fullURL, classid, baseURL);
#else
rv = NS_NewURL(&fullURL, classid, baseURL, nsnull, group);
#endif
@ -715,10 +686,7 @@ nsObjectFrame::Reflow(nsIPresContext& aPresContext,
{
nsIURI* codeBaseURL = nsnull;
#ifdef NECKO
char* codeBaseStr = codeBase.ToNewCString();
NS_ASSERTION(codeBaseStr, "out of memory");
rv = NS_NewURI(&fullURL, codeBaseStr, baseURL);
nsCRT::free(codeBaseStr);
rv = NS_NewURI(&fullURL, codeBase, baseURL);
#else
rv = NS_NewURL(&fullURL, codeBase, baseURL, nsnull, group);
#endif
@ -826,14 +794,10 @@ nsObjectFrame::Reflow(nsIPresContext& aPresContext,
nsAutoString codeBase;
if (NS_CONTENT_ATTR_HAS_VALUE == mContent->GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::codebase, codeBase))
{
nsIURI* codeBaseURL = nsnull;
#ifdef NECKO
nsIURI* codeBaseURL = nsnull;
char* codeBaseStr = codeBase.ToNewCString();
NS_ASSERTION(codeBasestr, "out of memory");
rv = NS_NewURI(&codeBaseURL, codeBaseStr, baseURL);
nsCRT::free(codeBaseStr);
rv = NS_NewURI(&codeBaseURL, codeBase, baseURL);
#else
nsIURI* codeBaseURL = nsnull;
rv = NS_NewURL(&codeBaseURL, codeBase, baseURL, nsnull, group);
#endif
if(rv == NS_OK)
@ -845,10 +809,7 @@ nsObjectFrame::Reflow(nsIPresContext& aPresContext,
// Create an absolute URL
#ifdef NECKO
char* srcStr = src.ToNewCString();
NS_ASSERTION(srcStr, "out of memory");
rv = NS_NewURI(&fullURL, srcStr, baseURL);
nsCRT::free(srcStr);
rv = NS_NewURI(&fullURL, src, baseURL);
#else
rv = NS_NewURL(&fullURL, src, baseURL, nsnull, group);
NS_IF_RELEASE(group);
@ -875,10 +836,7 @@ nsObjectFrame::Reflow(nsIPresContext& aPresContext,
{
#ifdef NECKO
// Create an absolute URL
char* srcStr = src.ToNewCString();
NS_ASSERTION(srcStr, "out of memory");
rv = NS_NewURL(&fullURL, srcStr, baseURL);
nsCRT::free(srcStr);
rv = NS_NewURI(&fullURL, src, baseURL);
#else
nsIURLGroup* group = nsnull;
if (nsnull != baseURL)
@ -893,10 +851,7 @@ nsObjectFrame::Reflow(nsIPresContext& aPresContext,
{
#ifdef NECKO
// Create an absolute URL
char* srcStr = src.ToNewCString();
NS_ASSERTION(srcStr, "out of memory");
rv = NS_NewURI(&fullURL, srcStr, baseURL);
nsCRT::free(srcStr);
rv = NS_NewURI(&fullURL, src, baseURL);
#else
nsIURLGroup* group = nsnull;
if (nsnull != baseURL)
@ -992,12 +947,7 @@ nsObjectFrame::InstantiatePlugin(nsIPresContext& aPresContext,
const nsHTMLReflowState& aReflowState,
nsIPluginHost* aPluginHost,
const char* aMimetype,
#ifdef NECKO
nsIURI* aURL
#else
nsIURI* aURL
#endif
)
nsIURI* aURL)
{
nsIView *parentWithView;
nsPoint origin;
@ -1109,20 +1059,12 @@ nsObjectFrame::HandleImage(nsIPresContext& aPresContext,
nsresult
#ifdef NECKO
nsObjectFrame::GetBaseURL(nsIURI* &aURL)
#else
nsObjectFrame::GetBaseURL(nsIURI* &aURL)
#endif
{
nsIHTMLContent* htmlContent;
if (NS_SUCCEEDED(mContent->QueryInterface(kIHTMLContentIID, (void**)&htmlContent)))
{
#ifdef NECKO
htmlContent->GetBaseURI(aURL);
#else
htmlContent->GetBaseURL(aURL);
#endif
NS_RELEASE(htmlContent);
}
else
@ -1367,11 +1309,7 @@ nsObjectFrame::Scrolled(nsIView *aView)
}
nsresult
#ifdef NECKO
nsObjectFrame::SetFullURL(nsIURI* aURL)
#else
nsObjectFrame::SetFullURL(nsIURI* aURL)
#endif
{
NS_IF_RELEASE(mFullURL);
mFullURL = aURL;
@ -1746,19 +1684,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetURL(const char *aURL, const char *aTarge
#ifndef NECKO
rv = NS_MakeAbsoluteURL(baseURL, nsString(), uniurl, fullurl);
#else
NS_WITH_SERVICE(nsIIOService, service, kIOServiceCID, &rv);
if (NS_FAILED(rv)) return rv;
nsIURI *baseUri = nsnull;
rv = baseURL->QueryInterface(nsIURI::GetIID(), (void**)&baseUri);
if (NS_FAILED(rv)) return rv;
char *absUrlStr = nsnull;
const char *urlSpec = uniurl.GetBuffer();
rv = service->MakeAbsolute(urlSpec, baseUri, &absUrlStr);
NS_RELEASE(baseUri);
fullurl = absUrlStr;
delete [] absUrlStr;
rv = NS_MakeAbsoluteURI(uniurl, baseURL, fullurl);
#endif // NECKO
NS_IF_RELEASE(baseURL);
@ -2053,7 +1979,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetParameter(const char* name, const char*
return NS_OK;
}
NS_IMETHODIMP nsPluginInstanceOwner::GetDocumentBase(const char* *result)
NS_IMETHODIMP nsPluginInstanceOwner::GetDocumentBase(char* *result)
{
if (nsnull != mContext)
{
@ -2065,7 +1991,16 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetDocumentBase(const char* *result)
nsCOMPtr<nsIURI> docURL( dont_AddRef(doc->GetDocumentURL()) );
#ifdef NECKO
nsresult rv = docURL->GetSpec(result);
#else
const char* spec;
nsresult rv = docURL->GetSpec(&spec);
if (NS_FAILED(rv)) return rv;
*result = nsCRT::strdup(spec);
if (*result == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
#endif
return rv;
}

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

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

@ -111,7 +111,7 @@ public:
NS_IMETHOD GetParameter(const char* name, const char* *result);
NS_IMETHOD GetDocumentBase(const char* *result);
NS_IMETHOD GetDocumentBase(char* *result);
NS_IMETHOD GetDocumentEncoding(const char* *result);
@ -225,11 +225,7 @@ protected:
nsHTMLReflowMetrics& aDesiredSize);
#ifdef NECKO
nsresult SetFullURL(nsIURI* aURL);
#else
nsresult SetFullURL(nsIURI* aURL);
#endif
nsresult InstantiateWidget(nsIPresContext& aPresContext,
nsHTMLReflowMetrics& aMetrics,
@ -241,12 +237,7 @@ protected:
const nsHTMLReflowState& aReflowState,
nsIPluginHost* aPluginHost,
const char* aMimetype,
#ifdef NECKO
nsIURI* aURL
#else
nsIURI* aURL
#endif
);
nsIURI* aURL);
nsresult HandleImage(nsIPresContext& aPresContext,
nsHTMLReflowMetrics& aMetrics,
@ -254,19 +245,11 @@ protected:
nsReflowStatus& aStatus,
nsIFrame* child);
#ifdef NECKO
nsresult GetBaseURL(nsIURI* &aURL);
#else
nsresult GetBaseURL(nsIURI* &aURL);
#endif
private:
nsPluginInstanceOwner *mInstanceOwner;
#ifdef NECKO
nsIURI *mFullURL;
#else
nsIURI *mFullURL;
#endif
nsIFrame *mFirstChild;
nsIWidget *mWidget;
};
@ -585,13 +568,8 @@ nsObjectFrame::Reflow(nsIPresContext& aPresContext,
nsISupports *container = nsnull;
nsIPluginHost *pluginHost = nsnull;
nsIContentViewerContainer *cv = nsnull;
#ifdef NECKO
nsIURI* baseURL = nsnull;
nsIURI* fullURL = nsnull;
#else
nsIURI* baseURL = nsnull;
nsIURI* fullURL = nsnull;
#endif
nsAutoString classid;
PRInt32 nameSpaceID;
@ -625,14 +603,10 @@ nsObjectFrame::Reflow(nsIPresContext& aPresContext,
if(NS_CONTENT_ATTR_HAS_VALUE == mContent->GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::codebase, codeBase) &&
classid != JAVA_CLASS_ID)
{
nsIURI* codeBaseURL = nsnull;
#ifdef NECKO
nsIURI* codeBaseURL = nsnull;
char* codeBaseStr = codeBase.ToNewCString();
NS_ASSERTION(codeBaseStr, "out of memory");
rv = NS_NewURI(&codeBaseURL, codeBaseStr, baseURL);
nsCRT::free(codeBaseStr);
rv = NS_NewURI(&codeBaseURL, codeBase, baseURL);
#else
nsIURI* codeBaseURL = nsnull;
rv = NS_NewURL(&codeBaseURL, codeBase, baseURL, nsnull, group);
#endif
if(rv == NS_OK)
@ -652,10 +626,7 @@ nsObjectFrame::Reflow(nsIPresContext& aPresContext,
// Create an absolute URL
if(classid != JAVA_CLASS_ID) {
#ifdef NECKO
char* classidStr = classid.ToNewCString();
NS_ASSERTION(classidStr, "out of memory");
rv = NS_NewURI(&fullURL, classidStr, baseURL);
nsCRT::free(classidStr);
rv = NS_NewURI(&fullURL, classid, baseURL);
#else
rv = NS_NewURL(&fullURL, classid, baseURL, nsnull, group);
#endif
@ -715,10 +686,7 @@ nsObjectFrame::Reflow(nsIPresContext& aPresContext,
{
nsIURI* codeBaseURL = nsnull;
#ifdef NECKO
char* codeBaseStr = codeBase.ToNewCString();
NS_ASSERTION(codeBaseStr, "out of memory");
rv = NS_NewURI(&fullURL, codeBaseStr, baseURL);
nsCRT::free(codeBaseStr);
rv = NS_NewURI(&fullURL, codeBase, baseURL);
#else
rv = NS_NewURL(&fullURL, codeBase, baseURL, nsnull, group);
#endif
@ -826,14 +794,10 @@ nsObjectFrame::Reflow(nsIPresContext& aPresContext,
nsAutoString codeBase;
if (NS_CONTENT_ATTR_HAS_VALUE == mContent->GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::codebase, codeBase))
{
nsIURI* codeBaseURL = nsnull;
#ifdef NECKO
nsIURI* codeBaseURL = nsnull;
char* codeBaseStr = codeBase.ToNewCString();
NS_ASSERTION(codeBasestr, "out of memory");
rv = NS_NewURI(&codeBaseURL, codeBaseStr, baseURL);
nsCRT::free(codeBaseStr);
rv = NS_NewURI(&codeBaseURL, codeBase, baseURL);
#else
nsIURI* codeBaseURL = nsnull;
rv = NS_NewURL(&codeBaseURL, codeBase, baseURL, nsnull, group);
#endif
if(rv == NS_OK)
@ -845,10 +809,7 @@ nsObjectFrame::Reflow(nsIPresContext& aPresContext,
// Create an absolute URL
#ifdef NECKO
char* srcStr = src.ToNewCString();
NS_ASSERTION(srcStr, "out of memory");
rv = NS_NewURI(&fullURL, srcStr, baseURL);
nsCRT::free(srcStr);
rv = NS_NewURI(&fullURL, src, baseURL);
#else
rv = NS_NewURL(&fullURL, src, baseURL, nsnull, group);
NS_IF_RELEASE(group);
@ -875,10 +836,7 @@ nsObjectFrame::Reflow(nsIPresContext& aPresContext,
{
#ifdef NECKO
// Create an absolute URL
char* srcStr = src.ToNewCString();
NS_ASSERTION(srcStr, "out of memory");
rv = NS_NewURL(&fullURL, srcStr, baseURL);
nsCRT::free(srcStr);
rv = NS_NewURI(&fullURL, src, baseURL);
#else
nsIURLGroup* group = nsnull;
if (nsnull != baseURL)
@ -893,10 +851,7 @@ nsObjectFrame::Reflow(nsIPresContext& aPresContext,
{
#ifdef NECKO
// Create an absolute URL
char* srcStr = src.ToNewCString();
NS_ASSERTION(srcStr, "out of memory");
rv = NS_NewURI(&fullURL, srcStr, baseURL);
nsCRT::free(srcStr);
rv = NS_NewURI(&fullURL, src, baseURL);
#else
nsIURLGroup* group = nsnull;
if (nsnull != baseURL)
@ -992,12 +947,7 @@ nsObjectFrame::InstantiatePlugin(nsIPresContext& aPresContext,
const nsHTMLReflowState& aReflowState,
nsIPluginHost* aPluginHost,
const char* aMimetype,
#ifdef NECKO
nsIURI* aURL
#else
nsIURI* aURL
#endif
)
nsIURI* aURL)
{
nsIView *parentWithView;
nsPoint origin;
@ -1109,20 +1059,12 @@ nsObjectFrame::HandleImage(nsIPresContext& aPresContext,
nsresult
#ifdef NECKO
nsObjectFrame::GetBaseURL(nsIURI* &aURL)
#else
nsObjectFrame::GetBaseURL(nsIURI* &aURL)
#endif
{
nsIHTMLContent* htmlContent;
if (NS_SUCCEEDED(mContent->QueryInterface(kIHTMLContentIID, (void**)&htmlContent)))
{
#ifdef NECKO
htmlContent->GetBaseURI(aURL);
#else
htmlContent->GetBaseURL(aURL);
#endif
NS_RELEASE(htmlContent);
}
else
@ -1367,11 +1309,7 @@ nsObjectFrame::Scrolled(nsIView *aView)
}
nsresult
#ifdef NECKO
nsObjectFrame::SetFullURL(nsIURI* aURL)
#else
nsObjectFrame::SetFullURL(nsIURI* aURL)
#endif
{
NS_IF_RELEASE(mFullURL);
mFullURL = aURL;
@ -1746,19 +1684,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetURL(const char *aURL, const char *aTarge
#ifndef NECKO
rv = NS_MakeAbsoluteURL(baseURL, nsString(), uniurl, fullurl);
#else
NS_WITH_SERVICE(nsIIOService, service, kIOServiceCID, &rv);
if (NS_FAILED(rv)) return rv;
nsIURI *baseUri = nsnull;
rv = baseURL->QueryInterface(nsIURI::GetIID(), (void**)&baseUri);
if (NS_FAILED(rv)) return rv;
char *absUrlStr = nsnull;
const char *urlSpec = uniurl.GetBuffer();
rv = service->MakeAbsolute(urlSpec, baseUri, &absUrlStr);
NS_RELEASE(baseUri);
fullurl = absUrlStr;
delete [] absUrlStr;
rv = NS_MakeAbsoluteURI(uniurl, baseURL, fullurl);
#endif // NECKO
NS_IF_RELEASE(baseURL);
@ -2053,7 +1979,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetParameter(const char* name, const char*
return NS_OK;
}
NS_IMETHODIMP nsPluginInstanceOwner::GetDocumentBase(const char* *result)
NS_IMETHODIMP nsPluginInstanceOwner::GetDocumentBase(char* *result)
{
if (nsnull != mContext)
{
@ -2065,7 +1991,16 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetDocumentBase(const char* *result)
nsCOMPtr<nsIURI> docURL( dont_AddRef(doc->GetDocumentURL()) );
#ifdef NECKO
nsresult rv = docURL->GetSpec(result);
#else
const char* spec;
nsresult rv = docURL->GetSpec(&spec);
if (NS_FAILED(rv)) return rv;
*result = nsCRT::strdup(spec);
if (*result == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
#endif
return rv;
}

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

@ -44,11 +44,10 @@
#include "nsISupportsArray.h"
#include "nsIURL.h"
#ifdef NECKO
#include "nsIIOService.h"
#include "nsIURL.h"
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
#endif // NECKO
#include "nsNeckoUtil.h"
#else
#include "nsIURLGroup.h"
#endif // NECKO
#include "nsStyleConsts.h"
#include "nsXIFConverter.h"
#include "nsFrame.h"
@ -995,29 +994,20 @@ nsGenericHTMLElement::GetBaseURL(nsIHTMLAttributes* aAttributes,
value.GetStringValue(baseHref);
nsIURI* url = nsnull;
#ifndef NECKO
nsIURLGroup* urlGroup = nsnull;
docBaseURL->GetURLGroup(&urlGroup);
if (urlGroup) {
result = urlGroup->CreateURL(&url, docBaseURL, baseHref, nsnull);
NS_RELEASE(urlGroup);
}
else {
else
#endif
{
#ifndef NECKO
result = NS_NewURL(&url, baseHref, docBaseURL);
#else
NS_WITH_SERVICE(nsIIOService, service, kIOServiceCID, &result);
if (NS_FAILED(result)) return result;
nsIURI *uri = nsnull, *baseUri = nsnull;
result = docBaseURL->QueryInterface(nsIURI::GetIID(), (void**)&baseUri);
if (NS_FAILED(result)) return result;
const char *uriStr = baseHref.GetBuffer();
result = service->NewURI(uriStr, baseUri, &uri);
NS_RELEASE(baseUri);
if (NS_FAILED(result)) return result;
result = uri->QueryInterface(nsIURI::GetIID(), (void**)&url);
result = NS_NewURI(&url, baseHref, docBaseURL);
#endif // NECKO
}
*aBaseURL = url;
@ -1962,19 +1952,7 @@ nsGenericHTMLElement::MapBackgroundAttributesInto(nsIHTMLAttributes* aAttributes
#ifndef NECKO
rv = NS_MakeAbsoluteURL(docURL, "", spec, absURLSpec);
#else
NS_WITH_SERVICE(nsIIOService, service, kIOServiceCID, &rv);
if (NS_FAILED(rv)) return;
nsIURI *baseUri = nsnull;
rv = docURL->QueryInterface(nsIURI::GetIID(), (void**)&baseUri);
if (NS_FAILED(rv)) return;
char *absUrlStr = nsnull;
const char *urlSpec = spec.GetBuffer();
rv = service->MakeAbsolute(urlSpec, baseUri, &absUrlStr);
NS_RELEASE(baseUri);
absURLSpec = absUrlStr;
delete [] absUrlStr;
rv = NS_MakeAbsoluteURI(spec, docURL, absURLSpec);
#endif // NECKO
if (NS_SUCCEEDED(rv)) {
nsStyleColor* color = (nsStyleColor*)

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

@ -21,18 +21,17 @@
#include "nsICSSStyleSheet.h"
#include "nsICSSLoader.h"
#include "nsIUnicharInputStream.h"
#include "nsIUnicharStreamLoader.h"
#include "nsIHTMLContent.h"
#include "nsIHTMLContentContainer.h"
#include "nsIURL.h"
#ifdef NECKO
#include "nsIIOService.h"
#include "nsIURL.h"
#include "nsIServiceManager.h"
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
#endif // NECKO
#include "nsNeckoUtil.h"
class nsIUnicharStreamLoader : public nsISupports {}; // XXX what?
#else
#include "nsIUnicharStreamLoader.h"
#include "nsIURLGroup.h"
#include "nsIHttpURL.h"
#endif // NECKO
#include "nsIPresShell.h"
#include "nsIPresContext.h"
#include "nsIViewManager.h"
@ -90,7 +89,9 @@ static NS_DEFINE_IID(kIDOMHTMLTextAreaElementIID, NS_IDOMHTMLTEXTAREAELEMENT_IID
static NS_DEFINE_IID(kIDOMHTMLOptionElementIID, NS_IDOMHTMLOPTIONELEMENT_IID);
static NS_DEFINE_IID(kIFormControlIID, NS_IFORMCONTROL_IID);
static NS_DEFINE_IID(kIHTMLContentSinkIID, NS_IHTML_CONTENT_SINK_IID);
#ifndef NECKO
static NS_DEFINE_IID(kIHTTPURLIID, NS_IHTTPURL_IID);
#endif
static NS_DEFINE_IID(kIScrollableViewIID, NS_ISCROLLABLEVIEW_IID);
static NS_DEFINE_IID(kIHTMLDocumentIID, NS_IHTMLDOCUMENT_IID);
static NS_DEFINE_IID(kIHTMLContentContainerIID, NS_IHTMLCONTENTCONTAINER_IID);
@ -1503,12 +1504,18 @@ HTMLContentSink::Init(nsIDocument* aDoc,
mCurrentContext->Begin(eHTMLTag_html, mRoot);
mContextStack.AppendElement(mCurrentContext);
#ifdef NECKO
char* spec;
#else
const char* spec;
#endif
(void)aURL->GetSpec(&spec);
SINK_TRACE(SINK_TRACE_CALLS,
("HTMLContentSink::Init: this=%p url='%s'",
this, spec));
#ifdef NECKO
nsCRT::free(spec);
#endif
return NS_OK;
}
@ -2032,10 +2039,23 @@ HTMLContentSink::StartLayout()
// If the document we are loading has a reference or it is a
// frameset document, disable the scroll bars on the views.
#ifdef NECKO
char* ref;
nsIURL* url;
nsresult rv = mDocumentURL->QueryInterface(nsIURL::GetIID(), (void**)&url);
if (NS_SUCCEEDED(rv)) {
rv = url->GetRef(&ref);
NS_RELEASE(url);
}
#else
const char* ref;
nsresult rv = mDocumentURL->GetRef(&ref);
#endif
if (rv == NS_OK) {
mRef = new nsString(ref);
#ifdef NECKO
nsCRT::free(ref);
#endif
}
if ((nsnull != ref) || mFrameset) {
@ -2469,31 +2489,20 @@ HTMLContentSink::ProcessStyleLink(nsIHTMLContent* aElement,
if ((0 == mimeType.Length()) || mimeType.EqualsIgnoreCase("text/css")) {
nsIURI* url = nsnull;
#ifndef NECKO
nsIURLGroup* urlGroup = nsnull;
mDocumentBaseURL->GetURLGroup(&urlGroup);
if (urlGroup) {
result = urlGroup->CreateURL(&url, mDocumentBaseURL, aHref, nsnull);
NS_RELEASE(urlGroup);
}
else {
else
#endif
{
#ifndef NECKO
result = NS_NewURL(&url, aHref, mDocumentBaseURL);
#else
NS_WITH_SERVICE(nsIIOService, service, kIOServiceCID, &result);
if (NS_FAILED(result)) return result;
nsIURI *uri = nsnull, *baseUri = nsnull;
result = mDocumentBaseURL->QueryInterface(nsIURI::GetIID(), (void**)&baseUri);
if (NS_FAILED(result)) return result;
const char *uriStr = aHref.GetBuffer();
result = service->NewURI(uriStr, baseUri, &uri);
NS_RELEASE(baseUri);
if (NS_FAILED(result)) return result;
result = uri->QueryInterface(nsIURI::GetIID(), (void**)&url);
NS_RELEASE(uri);
result = NS_NewURI(&url, aHref, mDocumentBaseURL);
#endif // NECKO
}
if (NS_OK != result) {
@ -2658,10 +2667,12 @@ HTMLContentSink::ProcessMETATag(const nsIParserNode& aNode)
}
mHead->AppendChildTo(it, PR_FALSE);
#ifndef NECKO
// If we are processing an HTTP url, handle meta http-equiv cases
nsIHttpURL* httpUrl = nsnull;
rv = mDocumentURL->QueryInterface(kIHTTPURLIID, (void **)&httpUrl);
#endif
// set any HTTP-EQUIV data into document's header data as well as url
nsAutoString header;
it->GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::httpEquiv, header);
@ -2669,6 +2680,9 @@ HTMLContentSink::ProcessMETATag(const nsIParserNode& aNode)
nsAutoString result;
it->GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::content, result);
if (result.Length() > 0) {
#ifdef NECKO
NS_ASSERTION(0, "how does necko add mime headers?");
#else
if (nsnull != httpUrl) {
char* value = result.ToNewCString(), *csHeader;
if (!value) {
@ -2685,6 +2699,7 @@ HTMLContentSink::ProcessMETATag(const nsIParserNode& aNode)
delete[] csHeader;
delete[] value;
}
#endif
header.ToLowerCase();
nsIAtom* fieldAtom = NS_NewAtom(header);
@ -2706,7 +2721,9 @@ HTMLContentSink::ProcessMETATag(const nsIParserNode& aNode)
NS_IF_RELEASE(fieldAtom);
}
}
#ifndef NECKO
NS_IF_RELEASE(httpUrl);
#endif
NS_RELEASE(it);
}
@ -2822,7 +2839,11 @@ HTMLContentSink::EvaluateScript(nsString& aScript,
nsAutoString ret;
nsIURI* docURL = mDocument->GetDocumentURL();
#ifdef NECKO
char* url;
#else
const char* url;
#endif
if (docURL) {
(void)docURL->GetSpec(&url);
}
@ -2911,31 +2932,20 @@ HTMLContentSink::ProcessSCRIPTTag(const nsIParserNode& aNode)
if (src.Length() > 0) {
// Use the SRC attribute value to load the URL
nsIURI* url = nsnull;
#ifndef NECKO
nsIURLGroup* urlGroup = nsnull;
mDocumentBaseURL->GetURLGroup(&urlGroup);
if (urlGroup) {
rv = urlGroup->CreateURL(&url, mDocumentBaseURL, src, nsnull);
NS_RELEASE(urlGroup);
}
else {
else
#endif
{
#ifndef NECKO
rv = NS_NewURL(&url, src, mDocumentBaseURL);
#else
NS_WITH_SERVICE(nsIIOService, service, kIOServiceCID, &rv);
if (NS_FAILED(rv)) return rv;
nsIURI *uri = nsnull, *baseUri = nsnull;
rv = mDocumentBaseURL->QueryInterface(nsIURI::GetIID(), (void**)&baseUri);
if (NS_FAILED(rv)) return rv;
const char *uriStr = src.GetBuffer();
rv = service->NewURI(uriStr, baseUri, &uri);
NS_RELEASE(baseUri);
if (NS_FAILED(rv)) return rv;
rv = uri->QueryInterface(nsIURI::GetIID(), (void**)&url);
NS_RELEASE(uri);
rv = NS_NewURI(&url, src, mDocumentBaseURL);
#endif // NECKO
}
if (NS_OK != rv) {
@ -2946,11 +2956,15 @@ HTMLContentSink::ProcessSCRIPTTag(const nsIParserNode& aNode)
// onto it as opaque data.
NS_ADDREF(this);
#ifdef NECKO
NS_ASSERTION(0, "fix me");
#else
nsIUnicharStreamLoader* loader;
rv = NS_NewUnicharStreamLoader(&loader,
url,
(nsStreamCompleteFunc)nsDoneLoadingScript,
(void *)this);
#endif
NS_RELEASE(url);
if (NS_OK == rv) {
rv = NS_ERROR_HTMLPARSER_BLOCK;
@ -3079,31 +3093,20 @@ HTMLContentSink::ProcessSTYLETag(const nsIParserNode& aNode)
// XXX what does nav do?
// Use the SRC attribute value to load the URL
nsIURI* url = nsnull;
#ifndef NECKO
nsIURLGroup* urlGroup = nsnull;
mDocumentBaseURL->GetURLGroup(&urlGroup);
if (urlGroup) {
rv = urlGroup->CreateURL(&url, mDocumentBaseURL, src, nsnull);
NS_RELEASE(urlGroup);
}
else {
else
#endif
{
#ifndef NECKO
rv = NS_NewURL(&url, src, mDocumentBaseURL);
#else
NS_WITH_SERVICE(nsIIOService, service, kIOServiceCID, &rv);
if (NS_FAILED(rv)) return rv;
nsIURI *uri = nsnull, *baseUri = nsnull;
rv = mDocumentBaseURL->QueryInterface(nsIURI::GetIID(), (void**)&baseUri);
if (NS_FAILED(rv)) return rv;
const char *uriStr = src.GetBuffer();
rv = service->NewURI(uriStr, baseUri, &uri);
NS_RELEASE(baseUri);
if (NS_FAILED(rv)) return rv;
rv = uri->QueryInterface(nsIURI::GetIID(), (void**)&url);
NS_RELEASE(uri);
rv = NS_NewURI(&url, src, mDocumentBaseURL);
#endif // NECKO
}
if (NS_OK != rv) {

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

@ -34,14 +34,15 @@
#include "nsIDOMComment.h"
#include "nsIDOMWindow.h"
#include "nsIDOMHTMLFormElement.h"
#include "nsIPostToServer.h"
#include "nsIStreamListener.h"
#include "nsIURL.h"
#ifdef NECKO
#include "nsIIOService.h"
#include "nsIURL.h"
#endif // NECKO
#else
#include "nsIPostToServer.h"
#include "nsIURLGroup.h"
#endif // NECKO
#include "nsIContentViewerContainer.h"
#include "nsIWebShell.h"
#include "nsIDocumentLoader.h"
@ -570,31 +571,20 @@ nsHTMLDocument:: SetBaseURL(const nsString& aURLSpec)
NS_IF_RELEASE(mBaseURL);
if (0 < aURLSpec.Length()) {
#ifndef NECKO
nsIURLGroup* urlGroup = nsnull;
(void)mDocumentURL->GetURLGroup(&urlGroup);
if (urlGroup) {
result = urlGroup->CreateURL(&mBaseURL, mDocumentURL, aURLSpec, nsnull);
NS_RELEASE(urlGroup);
}
else {
else
#endif
{
#ifndef NECKO
result = NS_NewURL(&mBaseURL, aURLSpec, mDocumentURL);
#else
NS_WITH_SERVICE(nsIIOService, service, kIOServiceCID, &result);
if (NS_FAILED(result)) return result;
nsIURI *uri = nsnull, *baseUri = nsnull;
result = mDocumentURL->QueryInterface(nsIURI::GetIID(), (void**)&baseUri);
if (NS_FAILED(result)) return result;
const char *uriStr = aURLSpec.GetBuffer();
result = service->NewURI(uriStr, baseUri, &uri);
NS_RELEASE(baseUri);
if (NS_FAILED(result)) return result;
result = uri->QueryInterface(nsIURI::GetIID(), (void**)&mBaseURL);
NS_RELEASE(uri);
result = NS_NewURI(&mBaseURL, aURLSpec, mDocumentURL);
#endif // NECKO
}
}
@ -1202,8 +1192,8 @@ nsHTMLDocument::GetCookie(nsString& aCookie)
#ifndef NECKO
nsINetService *service;
nsresult res = nsServiceManager::GetService(kNetServiceCID,
kINetServiceIID,
(nsISupports **)&service);
kINetServiceIID,
(nsISupports **)&service);
if ((NS_OK == res) && (nsnull != service) && (nsnull != mDocumentURL)) {
res = service->GetCookieString(mDocumentURL, aCookie);
@ -1274,16 +1264,7 @@ nsHTMLDocument::GetSourceDocumentURL(JSContext* cx,
#ifndef NECKO
result = NS_NewURL(sourceURL, url);
#else
NS_WITH_SERVICE(nsIIOService, service, kIOServiceCID, &result);
if (NS_FAILED(result)) return result;
nsIURI *uri = nsnull;
const char *uriStr = url.GetBuffer();
result = service->NewURI(uriStr, nsnull, &uri);
if (NS_FAILED(result)) return result;
result = uri->QueryInterface(nsIURI::GetIID(), (void**)sourceURL);
NS_RELEASE(uri);
result = NS_NewURI(sourceURL, url);
#endif // NECKO
}
}
@ -1359,15 +1340,7 @@ nsHTMLDocument::Open()
#ifndef NECKO
result = NS_NewURL(&sourceURL, "about:blank");
#else
NS_WITH_SERVICE(nsIIOService, service, kIOServiceCID, &result);
if (NS_FAILED(result)) return result;
nsIURI *uri = nsnull;
result = service->NewURI("about:blank", nsnull, &uri);
if (NS_FAILED(result)) return result;
result = uri->QueryInterface(nsIURI::GetIID(), (void**)&sourceURL);
NS_RELEASE(uri);
result = NS_NewURL(&sourceURL, "about:blank");
#endif // NECKO
if (NS_SUCCEEDED(result)) {
@ -1392,15 +1365,7 @@ nsHTMLDocument::Open(JSContext *cx, jsval *argv, PRUint32 argc)
#ifndef NECKO
result = NS_NewURL(&sourceURL, "about:blank");
#else
NS_WITH_SERVICE(nsIIOService, service, kIOServiceCID, &result);
if (NS_FAILED(result)) return result;
nsIURI *uri = nsnull;
result = service->NewURI("about:blank", nsnull, &uri);
if (NS_FAILED(result)) return result;
result = uri->QueryInterface(nsIURI::GetIID(), (void**)&sourceURL);
NS_RELEASE(uri);
result = NS_NewURI(&sourceURL, "about:blank");
#endif // NECKO
}

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

@ -19,6 +19,7 @@
#include "nsJVMPluginTagInfo.h"
#include "nsIPluginTagInfo2.h"
#include "plstr.h"
#include "nsCRT.h" // mixing metaphors with plstr.h!
#ifdef XP_UNIX
#undef Bool
#endif
@ -130,7 +131,7 @@ nsJVMPluginTagInfo::GetCodeBase(const char* *result)
}
// Okay, we'll need to simulate it from the layout tag's base URL.
const char* docBase;
char* docBase;
err = fPluginTagInfo->GetDocumentBase(&docBase);
if (err != NS_OK) return err;
PA_LOCK(codebase, const char*, docBase);
@ -145,6 +146,7 @@ nsJVMPluginTagInfo::GetCodeBase(const char* *result)
}
PA_UNLOCK(docBase);
nsCRT::free(docBase);
*result = fSimulatedCodebase;
return NS_OK;
}

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

@ -87,7 +87,7 @@ public:
GetParameter(const char* name, const char* *result) = 0;
NS_IMETHOD
GetDocumentBase(const char* *result) = 0;
GetDocumentBase(char* *result) = 0;
// Return an encoding whose name is specified in:
// http://java.sun.com/products/jdk/1.1/docs/guide/intl/intl.doc.html#25303

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

@ -452,7 +452,7 @@ NS_IMETHODIMP nsPluginInstancePeerImpl::GetParameter(const char* name, const cha
}
}
NS_IMETHODIMP nsPluginInstancePeerImpl::GetDocumentBase(const char* *result)
NS_IMETHODIMP nsPluginInstancePeerImpl::GetDocumentBase(char* *result)
{
if (nsnull != mOwner)
{

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

@ -109,7 +109,7 @@ public:
GetParameter(const char* name, const char* *result);
NS_IMETHOD
GetDocumentBase(const char* *result);
GetDocumentBase(char* *result);
NS_IMETHOD
GetDocumentEncoding(const char* *result);

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

@ -452,7 +452,7 @@ NS_IMETHODIMP nsPluginInstancePeerImpl::GetParameter(const char* name, const cha
}
}
NS_IMETHODIMP nsPluginInstancePeerImpl::GetDocumentBase(const char* *result)
NS_IMETHODIMP nsPluginInstancePeerImpl::GetDocumentBase(char* *result)
{
if (nsnull != mOwner)
{

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

@ -109,7 +109,7 @@ public:
GetParameter(const char* name, const char* *result);
NS_IMETHOD
GetDocumentBase(const char* *result);
GetDocumentBase(char* *result);
NS_IMETHOD
GetDocumentEncoding(const char* *result);

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

@ -87,7 +87,7 @@ public:
GetParameter(const char* name, const char* *result) = 0;
NS_IMETHOD
GetDocumentBase(const char* *result) = 0;
GetDocumentBase(char* *result) = 0;
// Return an encoding whose name is specified in:
// http://java.sun.com/products/jdk/1.1/docs/guide/intl/intl.doc.html#25303

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

@ -602,7 +602,7 @@ public:
GetParameter(const char* name, const char* *result);
NS_IMETHOD
GetDocumentBase(const char* *result);
GetDocumentBase(char* *result);
// Return an encoding whose name is specified in:
// http://java.sun.com/products/jdk/1.1/docs/guide/intl/intl.doc.html#25303

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

@ -232,10 +232,10 @@ nsPluginTagInfo::GetParameter(const char* name, const char* *result)
}
NS_METHOD
nsPluginTagInfo::GetDocumentBase(const char* *result)
nsPluginTagInfo::GetDocumentBase(char* *result)
{
*result = (const char*)GetLayoutElement()->base_url;
return NS_OK;
*result = nsCRT::strdup(GetLayoutElement()->base_url);
return *result ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
}
NS_METHOD

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

@ -68,7 +68,7 @@ public:
GetParameter(const char* name, const char* *result);
NS_IMETHOD
GetDocumentBase(const char* *result);
GetDocumentBase(char* *result);
// Return an encoding whose name is specified in:
// http://java.sun.com/products/jdk/1.1/docs/guide/intl/intl.doc.html#25303

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

@ -1503,10 +1503,10 @@ nsPluginTagInfo::GetParameter(const char* name, const char* *result)
}
NS_METHOD
nsPluginTagInfo::GetDocumentBase(const char* *result)
nsPluginTagInfo::GetDocumentBase(char* *result)
{
*result = (const char*)GetLayoutElement()->base_url;
return NS_OK;
*result = nsCRT::strdup(GetLayoutElement()->base_url);
return *result ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
}
NS_METHOD

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