diff --git a/mozilla/content/html/style/src/nsCSSParser.cpp b/mozilla/content/html/style/src/nsCSSParser.cpp
index 5a85b020ab1..9c8e694319e 100644
--- a/mozilla/content/html/style/src/nsCSSParser.cpp
+++ b/mozilla/content/html/style/src/nsCSSParser.cpp
@@ -625,7 +625,7 @@ CSSParserImpl::ParseStyleAttribute(const nsAReadableString& aAttributeValue,
// XXXldb XXXperf nsIUnicharInputStream is horrible! It makes us make
// a copy.
- nsString* str = new nsString(aAttributeValue);
+ nsString* str = new nsAutoString(aAttributeValue);
if (nsnull == str) {
return NS_ERROR_OUT_OF_MEMORY;
}
@@ -791,7 +791,7 @@ CSSParserImpl::ParseProperty(const nsAReadableString& aPropName,
NS_ASSERTION(nsnull != aBaseURL, "need base URL");
NS_ASSERTION(nsnull != aDeclaration, "Need declaration to parse into!");
- nsString* str = new nsString(aPropValue);
+ nsString* str = new nsAutoString(aPropValue);
if (!str) {
return NS_ERROR_OUT_OF_MEMORY;
}
diff --git a/mozilla/layout/generic/nsHTMLReflowCommand.cpp b/mozilla/layout/generic/nsHTMLReflowCommand.cpp
index 2b8177828af..19d62790076 100644
--- a/mozilla/layout/generic/nsHTMLReflowCommand.cpp
+++ b/mozilla/layout/generic/nsHTMLReflowCommand.cpp
@@ -55,16 +55,18 @@ NS_NewHTMLReflowCommand(nsIReflowCommand** aInstancePtrResult,
nsIFrame* aChildFrame,
nsIAtom* aAttribute)
{
- NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
- if (nsnull == aInstancePtrResult) {
- return NS_ERROR_NULL_POINTER;
- }
- nsHTMLReflowCommand* cmd = new nsHTMLReflowCommand(aTargetFrame, aReflowType, aChildFrame, aAttribute);
- if (nsnull == cmd) {
+ NS_ASSERTION(aInstancePtrResult,
+ "null result passed to NS_NewHTMLReflowCommand");
+
+ *aInstancePtrResult = new nsHTMLReflowCommand(aTargetFrame, aReflowType,
+ aChildFrame, aAttribute);
+ if (!*aInstancePtrResult) {
return NS_ERROR_OUT_OF_MEMORY;
}
- return cmd->QueryInterface(NS_GET_IID(nsIReflowCommand), (void**)aInstancePtrResult);
+ NS_ADDREF(*aInstancePtrResult);
+
+ return NS_OK;
}
#ifdef DEBUG_jesup
diff --git a/mozilla/layout/html/base/src/nsHTMLReflowCommand.cpp b/mozilla/layout/html/base/src/nsHTMLReflowCommand.cpp
index 2b8177828af..19d62790076 100644
--- a/mozilla/layout/html/base/src/nsHTMLReflowCommand.cpp
+++ b/mozilla/layout/html/base/src/nsHTMLReflowCommand.cpp
@@ -55,16 +55,18 @@ NS_NewHTMLReflowCommand(nsIReflowCommand** aInstancePtrResult,
nsIFrame* aChildFrame,
nsIAtom* aAttribute)
{
- NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
- if (nsnull == aInstancePtrResult) {
- return NS_ERROR_NULL_POINTER;
- }
- nsHTMLReflowCommand* cmd = new nsHTMLReflowCommand(aTargetFrame, aReflowType, aChildFrame, aAttribute);
- if (nsnull == cmd) {
+ NS_ASSERTION(aInstancePtrResult,
+ "null result passed to NS_NewHTMLReflowCommand");
+
+ *aInstancePtrResult = new nsHTMLReflowCommand(aTargetFrame, aReflowType,
+ aChildFrame, aAttribute);
+ if (!*aInstancePtrResult) {
return NS_ERROR_OUT_OF_MEMORY;
}
- return cmd->QueryInterface(NS_GET_IID(nsIReflowCommand), (void**)aInstancePtrResult);
+ NS_ADDREF(*aInstancePtrResult);
+
+ return NS_OK;
}
#ifdef DEBUG_jesup
diff --git a/mozilla/layout/style/nsCSSParser.cpp b/mozilla/layout/style/nsCSSParser.cpp
index 5a85b020ab1..9c8e694319e 100644
--- a/mozilla/layout/style/nsCSSParser.cpp
+++ b/mozilla/layout/style/nsCSSParser.cpp
@@ -625,7 +625,7 @@ CSSParserImpl::ParseStyleAttribute(const nsAReadableString& aAttributeValue,
// XXXldb XXXperf nsIUnicharInputStream is horrible! It makes us make
// a copy.
- nsString* str = new nsString(aAttributeValue);
+ nsString* str = new nsAutoString(aAttributeValue);
if (nsnull == str) {
return NS_ERROR_OUT_OF_MEMORY;
}
@@ -791,7 +791,7 @@ CSSParserImpl::ParseProperty(const nsAReadableString& aPropName,
NS_ASSERTION(nsnull != aBaseURL, "need base URL");
NS_ASSERTION(nsnull != aDeclaration, "Need declaration to parse into!");
- nsString* str = new nsString(aPropValue);
+ nsString* str = new nsAutoString(aPropValue);
if (!str) {
return NS_ERROR_OUT_OF_MEMORY;
}