diff --git a/mozilla/content/html/document/src/nsHTMLContentSink.cpp b/mozilla/content/html/document/src/nsHTMLContentSink.cpp
index d3e8a5d4aec..8f21027d665 100644
--- a/mozilla/content/html/document/src/nsHTMLContentSink.cpp
+++ b/mozilla/content/html/document/src/nsHTMLContentSink.cpp
@@ -74,6 +74,7 @@
#include "nsIParserService.h"
#include "nsParserCIID.h"
+#include "nsISelectElement.h"
// XXX Go through a factory for this one
#include "nsICSSParser.h"
@@ -1252,7 +1253,6 @@ SinkContext::CloseContainer(const nsIParserNode& aNode)
DidAddContent(content, mSink->IsInScript());
- NS_IF_RELEASE(content);
// Special handling for certain tags
switch (nodeType) {
@@ -1276,10 +1276,23 @@ SinkContext::CloseContainer(const nsIParserNode& aNode)
mSink->mNumOpenIFRAMES--;
break;
+ case eHTMLTag_select:
+ {
+ nsCOMPtr select = do_QueryInterface(content, &result);
+
+ if (NS_SUCCEEDED(result)) {
+ result = select->DoneAddingContent();
+ }
+ }
+ break;
+
default:
break;
+
}
+ NS_IF_RELEASE(content);
+
#ifdef DEBUG
if (mPreAppend &&
SINK_LOG_TEST(gSinkLogModuleInfo,SINK_ALWAYS_REFLOW)) {
diff --git a/mozilla/layout/html/document/src/nsHTMLContentSink.cpp b/mozilla/layout/html/document/src/nsHTMLContentSink.cpp
index d3e8a5d4aec..8f21027d665 100644
--- a/mozilla/layout/html/document/src/nsHTMLContentSink.cpp
+++ b/mozilla/layout/html/document/src/nsHTMLContentSink.cpp
@@ -74,6 +74,7 @@
#include "nsIParserService.h"
#include "nsParserCIID.h"
+#include "nsISelectElement.h"
// XXX Go through a factory for this one
#include "nsICSSParser.h"
@@ -1252,7 +1253,6 @@ SinkContext::CloseContainer(const nsIParserNode& aNode)
DidAddContent(content, mSink->IsInScript());
- NS_IF_RELEASE(content);
// Special handling for certain tags
switch (nodeType) {
@@ -1276,10 +1276,23 @@ SinkContext::CloseContainer(const nsIParserNode& aNode)
mSink->mNumOpenIFRAMES--;
break;
+ case eHTMLTag_select:
+ {
+ nsCOMPtr select = do_QueryInterface(content, &result);
+
+ if (NS_SUCCEEDED(result)) {
+ result = select->DoneAddingContent();
+ }
+ }
+ break;
+
default:
break;
+
}
+ NS_IF_RELEASE(content);
+
#ifdef DEBUG
if (mPreAppend &&
SINK_LOG_TEST(gSinkLogModuleInfo,SINK_ALWAYS_REFLOW)) {