diff --git a/content/html/document/src/nsHTMLDocument.cpp b/content/html/document/src/nsHTMLDocument.cpp
index 123b9169282..296b9f1c5f5 100644
--- a/content/html/document/src/nsHTMLDocument.cpp
+++ b/content/html/document/src/nsHTMLDocument.cpp
@@ -548,6 +548,9 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
NS_PRECONDITION(nsnull != aContainer, "No content viewer container");
aContainer->QueryInterface(kIWebShellIID, getter_AddRefs(webShell));
+ //
+ // The following logic is mirrored in nsWebShell::Embed!
+ //
nsCOMPtr muCV;
nsCOMPtr cv;
webShell->GetContentViewer(getter_AddRefs(cv));
diff --git a/layout/html/document/src/nsHTMLDocument.cpp b/layout/html/document/src/nsHTMLDocument.cpp
index 123b9169282..296b9f1c5f5 100644
--- a/layout/html/document/src/nsHTMLDocument.cpp
+++ b/layout/html/document/src/nsHTMLDocument.cpp
@@ -548,6 +548,9 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
NS_PRECONDITION(nsnull != aContainer, "No content viewer container");
aContainer->QueryInterface(kIWebShellIID, getter_AddRefs(webShell));
+ //
+ // The following logic is mirrored in nsWebShell::Embed!
+ //
nsCOMPtr muCV;
nsCOMPtr cv;
webShell->GetContentViewer(getter_AddRefs(cv));