Bug 1297300 - Add missing checks to GetSpec() calls in parser/. r=hsivonen.

--HG--
extra : rebase_source : 7d60e8d05180a84072ecd148ab5fe74c256acbd1
This commit is contained in:
Nicholas Nethercote 2016-08-31 12:13:59 +10:00
parent d7c5cd2ed2
commit 9554ec97fa
5 changed files with 16 additions and 8 deletions

View File

@ -286,7 +286,10 @@ nsHtml5StreamParser::SetViewSourceTitle(nsIURI* aURL)
// UTF-8 for an ellipsis.
mViewSourceTitle.AssignLiteral("data:\xE2\x80\xA6");
} else {
temp->GetSpec(mViewSourceTitle);
nsresult rv = temp->GetSpec(mViewSourceTitle);
if (NS_FAILED(rv)) {
mViewSourceTitle.AssignLiteral("\xE2\x80\xA6");
}
}
}
}

View File

@ -899,7 +899,8 @@ bool
nsHtml5TreeOpExecutor::ShouldPreloadURI(nsIURI *aURI)
{
nsAutoCString spec;
aURI->GetSpec(spec);
nsresult rv = aURI->GetSpec(spec);
NS_ENSURE_SUCCESS(rv, false);
if (mPreloadedURLs.Contains(spec)) {
return false;
}

View File

@ -911,7 +911,8 @@ nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder,
}
nsAutoCString spec;
uri->GetSpec(spec);
rv = uri->GetSpec(spec);
NS_ENSURE_SUCCESS(rv, rv);
viewSourceUrl.Append(spec);
@ -919,7 +920,7 @@ nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder,
CopyUTF8toUTF16(viewSourceUrl, utf16);
node->SetAttr(kNameSpaceID_None, nsGkAtoms::href, utf16, true);
return rv;
return NS_OK;
}
case eTreeOpAddViewSourceBase: {
char16_t* buffer = mTwo.unicharPtr;

View File

@ -160,6 +160,7 @@ nsParserUtils::ParseFragment(const nsAString& aFragment,
// Wrap things in a div or body for parsing, but it won't show up in
// the fragment.
nsresult rv = NS_OK;
AutoTArray<nsString, 2> tagStack;
nsAutoCString base, spec;
if (aIsXML) {
@ -167,7 +168,8 @@ nsParserUtils::ParseFragment(const nsAString& aFragment,
if (aBaseURI) {
base.AppendLiteral(XHTML_DIV_TAG);
base.AppendLiteral(" xml:base=\"");
aBaseURI->GetSpec(spec);
rv = aBaseURI->GetSpec(spec);
NS_ENSURE_SUCCESS(rv, rv);
// nsEscapeHTML is good enough, because we only need to get
// quotes, ampersands, and angle brackets
char* escapedSpec = nsEscapeHTML(spec.get());
@ -181,7 +183,6 @@ nsParserUtils::ParseFragment(const nsAString& aFragment,
}
}
nsresult rv = NS_OK;
nsCOMPtr<nsIContent> fragment;
if (aIsXML) {
rv = nsContentUtils::ParseFragmentXML(aFragment,
@ -201,7 +202,8 @@ nsParserUtils::ParseFragment(const nsAString& aFragment,
true);
// Now, set the base URI on all subtree roots.
if (aBaseURI) {
aBaseURI->GetSpec(spec);
nsresult rv2 = aBaseURI->GetSpec(spec);
NS_ENSURE_SUCCESS(rv2, rv2);
nsAutoString spec16;
CopyUTF8toUTF16(spec, spec16);
nsIContent* node = fragment->GetFirstChild();

View File

@ -805,7 +805,8 @@ nsExpatDriver::OpenInputStreamFromExternalDTD(const char16_t* aFPIStr,
NS_ENSURE_SUCCESS(rv, rv);
nsAutoCString absURL;
uri->GetSpec(absURL);
rv = uri->GetSpec(absURL);
NS_ENSURE_SUCCESS(rv, rv);
CopyUTF8toUTF16(absURL, aAbsURL);
channel->SetContentType(NS_LITERAL_CSTRING("application/xml"));