diff --git a/layout/generic/nsHTMLFrame.cpp b/layout/generic/nsHTMLFrame.cpp
index 560bdabe325..b4cd3d06def 100644
--- a/layout/generic/nsHTMLFrame.cpp
+++ b/layout/generic/nsHTMLFrame.cpp
@@ -144,7 +144,8 @@ RootFrame::Reflow(nsIPresContext& aPresContext,
deletedFrame->GetNextSibling(mFirstChild);
} else {
nsIFrame* prevSibling = nsnull;
- for (nsIFrame* f = mFirstChild; nsnull != f; f->GetNextSibling(f)) {
+ nsIFrame* f;
+ for (f = mFirstChild; nsnull != f; f->GetNextSibling(f)) {
if (f == deletedFrame) {
break;
}
diff --git a/layout/html/base/src/nsHTMLFrame.cpp b/layout/html/base/src/nsHTMLFrame.cpp
index 560bdabe325..b4cd3d06def 100644
--- a/layout/html/base/src/nsHTMLFrame.cpp
+++ b/layout/html/base/src/nsHTMLFrame.cpp
@@ -144,7 +144,8 @@ RootFrame::Reflow(nsIPresContext& aPresContext,
deletedFrame->GetNextSibling(mFirstChild);
} else {
nsIFrame* prevSibling = nsnull;
- for (nsIFrame* f = mFirstChild; nsnull != f; f->GetNextSibling(f)) {
+ nsIFrame* f;
+ for (f = mFirstChild; nsnull != f; f->GetNextSibling(f)) {
if (f == deletedFrame) {
break;
}