diff --git a/mozilla/content/html/document/src/nsHTMLDocument.cpp b/mozilla/content/html/document/src/nsHTMLDocument.cpp
index 7bd9b201ad2..17521d2f0ec 100644
--- a/mozilla/content/html/document/src/nsHTMLDocument.cpp
+++ b/mozilla/content/html/document/src/nsHTMLDocument.cpp
@@ -53,6 +53,7 @@
#include "nsIContentViewer.h"
#include "nsIMarkupDocumentViewer.h"
#include "nsIWebShell.h"
+#include "nsIBaseWindow.h"
#include "nsIWebShellServices.h"
#include "nsIDocumentLoader.h"
#include "CNavDTD.h"
@@ -695,14 +696,13 @@ NS_IMETHODIMP nsHTMLDocument::SetTitle(const nsString& aTitle)
nsIPresShell* shell = (nsIPresShell*) mPresShells.ElementAt(i);
nsCOMPtr cx;
shell->GetPresContext(getter_AddRefs(cx));
- nsISupports* container;
- if (NS_OK == cx->GetContainer(&container)) {
- if (nsnull != container) {
- nsCOMPtr webShell = do_QueryInterface(container);
- if (webShell) {
+ nsCOMPtr container;
+ if (NS_OK == cx->GetContainer(getter_AddRefs(container))) {
+ if (container) {
+ nsCOMPtr webShell(do_QueryInterface(container));
+ if(webShell) {
webShell->SetTitle(aTitle.GetUnicode());
}
- NS_RELEASE(container);
}
}
}
diff --git a/mozilla/layout/html/document/src/nsHTMLDocument.cpp b/mozilla/layout/html/document/src/nsHTMLDocument.cpp
index 7bd9b201ad2..17521d2f0ec 100644
--- a/mozilla/layout/html/document/src/nsHTMLDocument.cpp
+++ b/mozilla/layout/html/document/src/nsHTMLDocument.cpp
@@ -53,6 +53,7 @@
#include "nsIContentViewer.h"
#include "nsIMarkupDocumentViewer.h"
#include "nsIWebShell.h"
+#include "nsIBaseWindow.h"
#include "nsIWebShellServices.h"
#include "nsIDocumentLoader.h"
#include "CNavDTD.h"
@@ -695,14 +696,13 @@ NS_IMETHODIMP nsHTMLDocument::SetTitle(const nsString& aTitle)
nsIPresShell* shell = (nsIPresShell*) mPresShells.ElementAt(i);
nsCOMPtr cx;
shell->GetPresContext(getter_AddRefs(cx));
- nsISupports* container;
- if (NS_OK == cx->GetContainer(&container)) {
- if (nsnull != container) {
- nsCOMPtr webShell = do_QueryInterface(container);
- if (webShell) {
+ nsCOMPtr container;
+ if (NS_OK == cx->GetContainer(getter_AddRefs(container))) {
+ if (container) {
+ nsCOMPtr webShell(do_QueryInterface(container));
+ if(webShell) {
webShell->SetTitle(aTitle.GetUnicode());
}
- NS_RELEASE(container);
}
}
}