зеркало из https://github.com/mozilla/gecko-dev.git
Bug 950076 - Propagate OOM errors to innerHTML getters. r=jst
This commit is contained in:
Родитель
1a0a307fb0
Коммит
9479a9eb9d
|
@ -1240,9 +1240,10 @@ public:
|
||||||
* @param aDeep If true child elements of aNode are recursivly descended
|
* @param aDeep If true child elements of aNode are recursivly descended
|
||||||
* into to find text children.
|
* into to find text children.
|
||||||
* @param aResult the result. Out param.
|
* @param aResult the result. Out param.
|
||||||
|
* @return false on out of memory errors, true otherwise.
|
||||||
*/
|
*/
|
||||||
static void GetNodeTextContent(nsINode* aNode, bool aDeep,
|
static bool GetNodeTextContent(nsINode* aNode, bool aDeep,
|
||||||
nsAString& aResult);
|
nsAString& aResult) NS_WARN_UNUSED_RESULT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Same as GetNodeTextContents but appends the result rather than sets it.
|
* Same as GetNodeTextContents but appends the result rather than sets it.
|
||||||
|
|
|
@ -6587,11 +6587,11 @@ nsContentUtils::DOMWindowDumpEnabled()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
bool
|
||||||
nsContentUtils::GetNodeTextContent(nsINode* aNode, bool aDeep, nsAString& aResult)
|
nsContentUtils::GetNodeTextContent(nsINode* aNode, bool aDeep, nsAString& aResult)
|
||||||
{
|
{
|
||||||
aResult.Truncate();
|
aResult.Truncate();
|
||||||
AppendNodeTextContent(aNode, aDeep, aResult, mozilla::fallible_t());
|
return AppendNodeTextContent(aNode, aDeep, aResult, mozilla::fallible_t());
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -49,7 +49,9 @@ HTMLElement::GetInnerHTML(nsAString& aInnerHTML)
|
||||||
*/
|
*/
|
||||||
if (mNodeInfo->Equals(nsGkAtoms::xmp) ||
|
if (mNodeInfo->Equals(nsGkAtoms::xmp) ||
|
||||||
mNodeInfo->Equals(nsGkAtoms::plaintext)) {
|
mNodeInfo->Equals(nsGkAtoms::plaintext)) {
|
||||||
nsContentUtils::GetNodeTextContent(this, false, aInnerHTML);
|
if (!nsContentUtils::GetNodeTextContent(this, false, aInnerHTML)) {
|
||||||
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
|
}
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -227,7 +227,9 @@ HTMLScriptElement::AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
HTMLScriptElement::GetInnerHTML(nsAString& aInnerHTML)
|
HTMLScriptElement::GetInnerHTML(nsAString& aInnerHTML)
|
||||||
{
|
{
|
||||||
nsContentUtils::GetNodeTextContent(this, false, aInnerHTML);
|
if (!nsContentUtils::GetNodeTextContent(this, false, aInnerHTML)) {
|
||||||
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
|
}
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -204,7 +204,9 @@ HTMLStyleElement::UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
HTMLStyleElement::GetInnerHTML(nsAString& aInnerHTML)
|
HTMLStyleElement::GetInnerHTML(nsAString& aInnerHTML)
|
||||||
{
|
{
|
||||||
nsContentUtils::GetNodeTextContent(this, false, aInnerHTML);
|
if (!nsContentUtils::GetNodeTextContent(this, false, aInnerHTML)) {
|
||||||
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
|
}
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче