зеркало из https://github.com/mozilla/gecko-dev.git
deCOMtaminate nsIDocument by changing methods to use return value instead of out-params, eliminating unused nsresult return values, moving some members to nsIDocument and inlining the getters/setters. Bug 222134, r=bzbarsky, sr=jst.
This commit is contained in:
Родитель
b9f4e41b49
Коммит
35815f1fe7
|
@ -298,7 +298,7 @@ PRBool URIUtils::CanCallerAccess(nsIDOMNode *aNode)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!principal) {
|
if (!principal) {
|
||||||
doc->GetPrincipal(getter_AddRefs(principal));
|
principal = doc->GetPrincipal();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!principal) {
|
if (!principal) {
|
||||||
|
@ -336,22 +336,18 @@ URIUtils::ResetWithSource(nsIDocument *aNewDoc, nsIDOMNode *aSourceNode)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsILoadGroup> loadGroup;
|
|
||||||
nsCOMPtr<nsIChannel> channel;
|
nsCOMPtr<nsIChannel> channel;
|
||||||
sourceDoc->GetDocumentLoadGroup(getter_AddRefs(loadGroup));
|
nsCOMPtr<nsILoadGroup> loadGroup = sourceDoc->GetDocumentLoadGroup();
|
||||||
nsCOMPtr<nsIIOService> serv = do_GetService(NS_IOSERVICE_CONTRACTID);
|
nsCOMPtr<nsIIOService> serv = do_GetService(NS_IOSERVICE_CONTRACTID);
|
||||||
if (serv) {
|
if (serv) {
|
||||||
// Create a temporary channel to get nsIDocument->Reset to
|
// Create a temporary channel to get nsIDocument->Reset to
|
||||||
// do the right thing. We want the output document to get
|
// do the right thing. We want the output document to get
|
||||||
// much of the input document's characteristics.
|
// much of the input document's characteristics.
|
||||||
nsCOMPtr<nsIURI> docURL;
|
serv->NewChannelFromURI(sourceDoc->GetDocumentURL(),
|
||||||
sourceDoc->GetDocumentURL(getter_AddRefs(docURL));
|
getter_AddRefs(channel));
|
||||||
serv->NewChannelFromURI(docURL, getter_AddRefs(channel));
|
|
||||||
}
|
}
|
||||||
aNewDoc->Reset(channel, loadGroup);
|
aNewDoc->Reset(channel, loadGroup);
|
||||||
nsCOMPtr<nsIURI> baseURL;
|
aNewDoc->SetBaseURL(sourceDoc->GetBaseURL());
|
||||||
sourceDoc->GetBaseURL(getter_AddRefs(baseURL));
|
|
||||||
aNewDoc->SetBaseURL(baseURL);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -81,10 +81,8 @@ txParseDocumentFromURI(const nsAString& aHref, const nsAString& aReferrer,
|
||||||
nsCOMPtr<nsIDOMDocument> theDocument;
|
nsCOMPtr<nsIDOMDocument> theDocument;
|
||||||
nsCOMPtr<nsIDocument> loaderDocument =
|
nsCOMPtr<nsIDocument> loaderDocument =
|
||||||
do_QueryInterface(aLoader->getNSObj());
|
do_QueryInterface(aLoader->getNSObj());
|
||||||
nsCOMPtr<nsILoadGroup> loadGroup;
|
nsCOMPtr<nsILoadGroup> loadGroup = loaderDocument->GetDocumentLoadGroup();
|
||||||
nsCOMPtr<nsIURI> loaderUri;
|
nsIURI *loaderUri = loaderDocument->GetDocumentURL();
|
||||||
loaderDocument->GetDocumentLoadGroup(getter_AddRefs(loadGroup));
|
|
||||||
loaderDocument->GetDocumentURL(getter_AddRefs(loaderUri));
|
|
||||||
NS_ENSURE_TRUE(loaderUri, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(loaderUri, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
nsCOMPtr<nsIChannel> channel;
|
nsCOMPtr<nsIChannel> channel;
|
||||||
|
|
|
@ -34,6 +34,7 @@ REQUIRES = string \
|
||||||
ifndef TX_EXE
|
ifndef TX_EXE
|
||||||
REQUIRES += dom \
|
REQUIRES += dom \
|
||||||
content \
|
content \
|
||||||
|
necko \
|
||||||
widget \
|
widget \
|
||||||
xpconnect \
|
xpconnect \
|
||||||
js \
|
js \
|
||||||
|
|
|
@ -756,8 +756,7 @@ TX_CompileStylesheet(nsIDOMNode* aNode, txStylesheet** aStylesheet)
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIDocument> doc = do_QueryInterface(document);
|
nsCOMPtr<nsIDocument> doc = do_QueryInterface(document);
|
||||||
nsCOMPtr<nsIURI> uri;
|
nsIURI *uri = doc->GetBaseURL();
|
||||||
doc->GetBaseURL(getter_AddRefs(uri));
|
|
||||||
nsCAutoString baseURI;
|
nsCAutoString baseURI;
|
||||||
uri->GetSpec(baseURI);
|
uri->GetSpec(baseURI);
|
||||||
|
|
||||||
|
|
|
@ -168,23 +168,19 @@ void txMozillaTextOutput::createResultDocument(nsIDOMDocument* aSourceDocument,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset and set up document
|
// Reset and set up document
|
||||||
nsCOMPtr<nsILoadGroup> loadGroup;
|
|
||||||
nsCOMPtr<nsIChannel> channel;
|
nsCOMPtr<nsIChannel> channel;
|
||||||
nsCOMPtr<nsIDocument> sourceDoc = do_QueryInterface(aSourceDocument);
|
nsCOMPtr<nsIDocument> sourceDoc = do_QueryInterface(aSourceDocument);
|
||||||
sourceDoc->GetDocumentLoadGroup(getter_AddRefs(loadGroup));
|
nsCOMPtr<nsILoadGroup> loadGroup = sourceDoc->GetDocumentLoadGroup();
|
||||||
nsCOMPtr<nsIIOService> serv = do_GetService(NS_IOSERVICE_CONTRACTID);
|
nsCOMPtr<nsIIOService> serv = do_GetService(NS_IOSERVICE_CONTRACTID);
|
||||||
if (serv) {
|
if (serv) {
|
||||||
// Create a temporary channel to get nsIDocument->Reset to
|
// Create a temporary channel to get nsIDocument->Reset to
|
||||||
// do the right thing. We want the output document to get
|
// do the right thing. We want the output document to get
|
||||||
// much of the input document's characteristics.
|
// much of the input document's characteristics.
|
||||||
nsCOMPtr<nsIURI> docURL;
|
serv->NewChannelFromURI(sourceDoc->GetDocumentURL(),
|
||||||
sourceDoc->GetDocumentURL(getter_AddRefs(docURL));
|
getter_AddRefs(channel));
|
||||||
serv->NewChannelFromURI(docURL, getter_AddRefs(channel));
|
|
||||||
}
|
}
|
||||||
doc->Reset(channel, loadGroup);
|
doc->Reset(channel, loadGroup);
|
||||||
nsCOMPtr<nsIURI> baseURL;
|
doc->SetBaseURL(sourceDoc->GetBaseURL());
|
||||||
sourceDoc->GetBaseURL(getter_AddRefs(baseURL));
|
|
||||||
doc->SetBaseURL(baseURL);
|
|
||||||
|
|
||||||
// Notify the contentsink that the document is created
|
// Notify the contentsink that the document is created
|
||||||
nsCOMPtr<nsITransformObserver> observer = do_QueryReferent(mObserver);
|
nsCOMPtr<nsITransformObserver> observer = do_QueryReferent(mObserver);
|
||||||
|
@ -236,11 +232,7 @@ void txMozillaTextOutput::createResultDocument(nsIDOMDocument* aSourceDocument,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = doc->SetRootContent(rootContent);
|
doc->SetRootContent(rootContent);
|
||||||
NS_ASSERTION(NS_SUCCEEDED(rv), "Failed to set the root content");
|
|
||||||
if (NS_FAILED(rv)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
mDocument->CreateElementNS(XHTML_NSURI,
|
mDocument->CreateElementNS(XHTML_NSURI,
|
||||||
NS_LITERAL_STRING("head"),
|
NS_LITERAL_STRING("head"),
|
||||||
|
|
|
@ -208,16 +208,14 @@ void txMozillaXMLOutput::endDocument()
|
||||||
|
|
||||||
if (!mRefreshString.IsEmpty()) {
|
if (!mRefreshString.IsEmpty()) {
|
||||||
nsCOMPtr<nsIDocument> doc = do_QueryInterface(mDocument);
|
nsCOMPtr<nsIDocument> doc = do_QueryInterface(mDocument);
|
||||||
nsCOMPtr<nsIScriptGlobalObject> sgo;
|
nsIScriptGlobalObject *sgo = doc->GetScriptGlobalObject();
|
||||||
doc->GetScriptGlobalObject(getter_AddRefs(sgo));
|
|
||||||
if (sgo) {
|
if (sgo) {
|
||||||
nsCOMPtr<nsIDocShell> docShell;
|
nsCOMPtr<nsIDocShell> docShell;
|
||||||
sgo->GetDocShell(getter_AddRefs(docShell));
|
sgo->GetDocShell(getter_AddRefs(docShell));
|
||||||
nsCOMPtr<nsIRefreshURI> refURI = do_QueryInterface(docShell);
|
nsCOMPtr<nsIRefreshURI> refURI = do_QueryInterface(docShell);
|
||||||
if (refURI) {
|
if (refURI) {
|
||||||
nsCOMPtr<nsIURI> baseURI;
|
refURI->SetupRefreshURIFromHeader(doc->GetBaseURL(),
|
||||||
doc->GetBaseURL(getter_AddRefs(baseURI));
|
mRefreshString);
|
||||||
refURI->SetupRefreshURIFromHeader(baseURI, mRefreshString);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -739,8 +737,7 @@ txMozillaXMLOutput::createResultDocument(const nsAString& aName, PRInt32 aNsID,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set up script loader of the result document.
|
// Set up script loader of the result document.
|
||||||
nsCOMPtr<nsIScriptLoader> loader;
|
nsIScriptLoader *loader = doc->GetScriptLoader();
|
||||||
doc->GetScriptLoader(getter_AddRefs(loader));
|
|
||||||
if (loader) {
|
if (loader) {
|
||||||
if (mNotifier) {
|
if (mNotifier) {
|
||||||
loader->AddObserver(mNotifier);
|
loader->AddObserver(mNotifier);
|
||||||
|
@ -904,9 +901,8 @@ txTransformNotifier::SignalTransformEnd()
|
||||||
|
|
||||||
// XXX Need a better way to determine transform success/failure
|
// XXX Need a better way to determine transform success/failure
|
||||||
if (mDocument) {
|
if (mDocument) {
|
||||||
nsCOMPtr<nsIScriptLoader> loader;
|
|
||||||
nsCOMPtr<nsIDocument> doc = do_QueryInterface(mDocument);
|
nsCOMPtr<nsIDocument> doc = do_QueryInterface(mDocument);
|
||||||
doc->GetScriptLoader(getter_AddRefs(loader));
|
nsIScriptLoader *loader = doc->GetScriptLoader();
|
||||||
if (loader) {
|
if (loader) {
|
||||||
loader->RemoveObserver(this);
|
loader->RemoveObserver(this);
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче