Bug 1748608 - Remove unused aSink argument from Document::StartDocumentLoad. r=edgar

Differential Revision: https://phabricator.services.mozilla.com/D135111
This commit is contained in:
Henri Sivonen 2022-01-05 13:38:56 +00:00
parent a2b23f44a9
commit 93300ee850
11 changed files with 35 additions and 70 deletions

View File

@ -3297,7 +3297,7 @@ nsresult Document::StartDocumentLoad(const char* aCommand, nsIChannel* aChannel,
nsILoadGroup* aLoadGroup,
nsISupports* aContainer,
nsIStreamListener** aDocListener,
bool aReset, nsIContentSink* aSink) {
bool aReset) {
if (MOZ_LOG_TEST(gDocumentLeakPRLog, LogLevel::Debug)) {
nsCOMPtr<nsIURI> uri;
aChannel->GetURI(getter_AddRefs(uri));

View File

@ -722,12 +722,6 @@ class Document : public nsINode,
* is false, the document will NOT set its principal to the
* channel's owner, will not clear any event listeners that are
* already set on it, etc.
* @param aSink The content sink to use for the data. If this is null and
* the document needs a content sink, it will create one based
* on whatever it knows about the data it's going to load.
* This MUST be null if the underlying document is an HTML
* document. Even in the XML case, please don't add new calls
* with non-null sink.
*
* Once this has been called, the document will return false for
* MayStartLayout() until SetMayStartLayout(true) is called on it. Making
@ -741,8 +735,7 @@ class Document : public nsINode,
nsILoadGroup* aLoadGroup,
nsISupports* aContainer,
nsIStreamListener** aDocListener,
bool aReset,
nsIContentSink* aSink = nullptr) = 0;
bool aReset) = 0;
void StopDocumentLoad();
virtual void SetSuppressParserErrorElement(bool aSuppress) {}

View File

@ -163,14 +163,11 @@ JSObject* ImageDocument::WrapNode(JSContext* aCx,
return ImageDocument_Binding::Wrap(aCx, this, aGivenProto);
}
nsresult ImageDocument::StartDocumentLoad(const char* aCommand,
nsIChannel* aChannel,
nsILoadGroup* aLoadGroup,
nsISupports* aContainer,
nsIStreamListener** aDocListener,
bool aReset, nsIContentSink* aSink) {
nsresult ImageDocument::StartDocumentLoad(
const char* aCommand, nsIChannel* aChannel, nsILoadGroup* aLoadGroup,
nsISupports* aContainer, nsIStreamListener** aDocListener, bool aReset) {
nsresult rv = MediaDocument::StartDocumentLoad(
aCommand, aChannel, aLoadGroup, aContainer, aDocListener, aReset, aSink);
aCommand, aChannel, aLoadGroup, aContainer, aDocListener, aReset);
if (NS_FAILED(rv)) {
return rv;
}

View File

@ -33,8 +33,7 @@ class ImageDocument final : public MediaDocument,
nsresult StartDocumentLoad(const char* aCommand, nsIChannel* aChannel,
nsILoadGroup* aLoadGroup, nsISupports* aContainer,
nsIStreamListener** aDocListener,
bool aReset = true,
nsIContentSink* aSink = nullptr) override;
bool aReset = true) override;
void SetScriptGlobalObject(nsIScriptGlobalObject*) override;
void Destroy() override;

View File

@ -126,14 +126,11 @@ nsresult MediaDocument::Init() {
return NS_OK;
}
nsresult MediaDocument::StartDocumentLoad(const char* aCommand,
nsIChannel* aChannel,
nsILoadGroup* aLoadGroup,
nsISupports* aContainer,
nsIStreamListener** aDocListener,
bool aReset, nsIContentSink* aSink) {
nsresult rv = Document::StartDocumentLoad(
aCommand, aChannel, aLoadGroup, aContainer, aDocListener, aReset, aSink);
nsresult MediaDocument::StartDocumentLoad(
const char* aCommand, nsIChannel* aChannel, nsILoadGroup* aLoadGroup,
nsISupports* aContainer, nsIStreamListener** aDocListener, bool aReset) {
nsresult rv = Document::StartDocumentLoad(aCommand, aChannel, aLoadGroup,
aContainer, aDocListener, aReset);
if (NS_FAILED(rv)) {
return rv;
}

View File

@ -36,8 +36,7 @@ class MediaDocument : public nsHTMLDocument {
nsILoadGroup* aLoadGroup,
nsISupports* aContainer,
nsIStreamListener** aDocListener,
bool aReset = true,
nsIContentSink* aSink = nullptr) override;
bool aReset = true) override;
virtual bool WillIgnoreCharsetOverride() override { return true; }

View File

@ -25,8 +25,7 @@ class VideoDocument final : public MediaDocument {
nsILoadGroup* aLoadGroup,
nsISupports* aContainer,
nsIStreamListener** aDocListener,
bool aReset = true,
nsIContentSink* aSink = nullptr) override;
bool aReset = true) override;
virtual void SetScriptGlobalObject(
nsIScriptGlobalObject* aScriptGlobalObject) override;
@ -47,14 +46,11 @@ class VideoDocument final : public MediaDocument {
RefPtr<MediaDocumentStreamListener> mStreamListener;
};
nsresult VideoDocument::StartDocumentLoad(const char* aCommand,
nsIChannel* aChannel,
nsILoadGroup* aLoadGroup,
nsISupports* aContainer,
nsIStreamListener** aDocListener,
bool aReset, nsIContentSink* aSink) {
nsresult VideoDocument::StartDocumentLoad(
const char* aCommand, nsIChannel* aChannel, nsILoadGroup* aLoadGroup,
nsISupports* aContainer, nsIStreamListener** aDocListener, bool aReset) {
nsresult rv = MediaDocument::StartDocumentLoad(
aCommand, aChannel, aLoadGroup, aContainer, aDocListener, aReset, aSink);
aCommand, aChannel, aLoadGroup, aContainer, aDocListener, aReset);
NS_ENSURE_SUCCESS(rv, rv);
mStreamListener = new MediaDocumentStreamListener(this);

View File

@ -289,20 +289,13 @@ bool ShouldUsePrototypeDocument(nsIChannel* aChannel, Document* aDoc) {
return nsContentUtils::IsChromeDoc(aDoc);
}
nsresult nsHTMLDocument::StartDocumentLoad(const char* aCommand,
nsIChannel* aChannel,
nsILoadGroup* aLoadGroup,
nsISupports* aContainer,
nsIStreamListener** aDocListener,
bool aReset, nsIContentSink* aSink) {
nsresult nsHTMLDocument::StartDocumentLoad(
const char* aCommand, nsIChannel* aChannel, nsILoadGroup* aLoadGroup,
nsISupports* aContainer, nsIStreamListener** aDocListener, bool aReset) {
if (!aCommand) {
MOZ_ASSERT(false, "Command is mandatory");
return NS_ERROR_INVALID_POINTER;
}
if (aSink) {
MOZ_ASSERT(false, "Got a sink override. Should not happen for HTML doc.");
return NS_ERROR_INVALID_ARG;
}
if (mType != eHTML) {
MOZ_ASSERT(mType == eXHTML);
MOZ_ASSERT(false, "Must not set HTML doc to XHTML mode before load start.");

View File

@ -56,8 +56,7 @@ class nsHTMLDocument : public mozilla::dom::Document {
nsILoadGroup* aLoadGroup,
nsISupports* aContainer,
nsIStreamListener** aDocListener,
bool aReset = true,
nsIContentSink* aSink = nullptr) override;
bool aReset = true) override;
protected:
virtual bool UseWidthDeviceWidthFallbackViewport() const override;

View File

@ -243,14 +243,11 @@ bool XMLDocument::SuppressParserErrorConsoleMessages() {
return mSuppressParserErrorConsoleMessages;
}
nsresult XMLDocument::StartDocumentLoad(const char* aCommand,
nsIChannel* aChannel,
nsILoadGroup* aLoadGroup,
nsISupports* aContainer,
nsIStreamListener** aDocListener,
bool aReset, nsIContentSink* aSink) {
nsresult rv = Document::StartDocumentLoad(
aCommand, aChannel, aLoadGroup, aContainer, aDocListener, aReset, aSink);
nsresult XMLDocument::StartDocumentLoad(
const char* aCommand, nsIChannel* aChannel, nsILoadGroup* aLoadGroup,
nsISupports* aContainer, nsIStreamListener** aDocListener, bool aReset) {
nsresult rv = Document::StartDocumentLoad(aCommand, aChannel, aLoadGroup,
aContainer, aDocListener, aReset);
if (NS_FAILED(rv)) return rv;
int32_t charsetSource = kCharsetFromDocTypeDefault;
@ -268,18 +265,14 @@ nsresult XMLDocument::StartDocumentLoad(const char* aCommand,
nsCOMPtr<nsIXMLContentSink> sink;
if (aSink) {
sink = do_QueryInterface(aSink);
} else {
nsCOMPtr<nsIDocShell> docShell;
if (aContainer) {
docShell = do_QueryInterface(aContainer);
NS_ENSURE_TRUE(docShell, NS_ERROR_FAILURE);
}
rv = NS_NewXMLContentSink(getter_AddRefs(sink), this, aUrl, docShell,
aChannel);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIDocShell> docShell;
if (aContainer) {
docShell = do_QueryInterface(aContainer);
NS_ENSURE_TRUE(docShell, NS_ERROR_FAILURE);
}
rv = NS_NewXMLContentSink(getter_AddRefs(sink), this, aUrl, docShell,
aChannel);
NS_ENSURE_SUCCESS(rv, rv);
// Set the parser as the stream listener for the document loader...
rv = CallQueryInterface(mParser, aDocListener);

View File

@ -39,8 +39,7 @@ class XMLDocument : public Document {
nsILoadGroup* aLoadGroup,
nsISupports* aContainer,
nsIStreamListener** aDocListener,
bool aReset = true,
nsIContentSink* aSink = nullptr) override;
bool aReset = true) override;
// TODO: Convert this to MOZ_CAN_RUN_SCRIPT (bug 1415230, bug 1535398)
MOZ_CAN_RUN_SCRIPT_BOUNDARY virtual void EndLoad() override;