diff --git a/mozilla/content/html/document/src/nsHTMLDocument.cpp b/mozilla/content/html/document/src/nsHTMLDocument.cpp
index 7ea2496dfa9..8ce7b03a27e 100644
--- a/mozilla/content/html/document/src/nsHTMLDocument.cpp
+++ b/mozilla/content/html/document/src/nsHTMLDocument.cpp
@@ -75,6 +75,7 @@
#include "nsICookieService.h"
#include "nsIServiceManager.h"
+#include "nsIConsoleService.h"
#include "nsIFormManager.h"
#include "nsIComponentManager.h"
#include "nsParserCIID.h"
@@ -89,6 +90,7 @@
#include "nsIFile.h"
#include "nsIEventListenerManager.h"
#include "nsISelectElement.h"
+#include "nsIFrameSelection.h"
#include "nsICharsetDetector.h"
#include "nsICharsetDetectionAdaptor.h"
@@ -2449,9 +2451,35 @@ nsHTMLDocument::GetPlugins(nsIDOMHTMLCollection** aPlugins)
NS_IMETHODIMP
nsHTMLDocument::GetSelection(nsString& aReturn)
{
- //XXX TBImplemented
aReturn.Truncate();
- return NS_OK;
+
+ nsIPresShell* shell = (nsIPresShell*) mPresShells.ElementAt(0);
+
+ if (!shell)
+ return NS_OK;
+
+ nsCOMPtr selection;
+ shell->GetFrameSelection(getter_AddRefs(selection));
+
+ if (!selection)
+ return NS_OK;
+
+ nsCOMPtr domSelection;
+
+ selection->GetSelection(nsISelectionController::SELECTION_NORMAL,
+ getter_AddRefs(domSelection));
+
+ if (!domSelection)
+ return NS_OK;
+
+ nsCOMPtr consoleService
+ (do_GetService("mozilla.consoleservice.1"));
+
+ if (consoleService) {
+ consoleService->LogStringMessage(NS_ConvertASCIItoUCS2("Depricated method document.getSelection() called, use window.getSelection() in stead!").GetUnicode());
+ }
+
+ return domSelection->ToString(aReturn);
}
NS_IMETHODIMP
diff --git a/mozilla/layout/html/document/src/nsHTMLDocument.cpp b/mozilla/layout/html/document/src/nsHTMLDocument.cpp
index 7ea2496dfa9..8ce7b03a27e 100644
--- a/mozilla/layout/html/document/src/nsHTMLDocument.cpp
+++ b/mozilla/layout/html/document/src/nsHTMLDocument.cpp
@@ -75,6 +75,7 @@
#include "nsICookieService.h"
#include "nsIServiceManager.h"
+#include "nsIConsoleService.h"
#include "nsIFormManager.h"
#include "nsIComponentManager.h"
#include "nsParserCIID.h"
@@ -89,6 +90,7 @@
#include "nsIFile.h"
#include "nsIEventListenerManager.h"
#include "nsISelectElement.h"
+#include "nsIFrameSelection.h"
#include "nsICharsetDetector.h"
#include "nsICharsetDetectionAdaptor.h"
@@ -2449,9 +2451,35 @@ nsHTMLDocument::GetPlugins(nsIDOMHTMLCollection** aPlugins)
NS_IMETHODIMP
nsHTMLDocument::GetSelection(nsString& aReturn)
{
- //XXX TBImplemented
aReturn.Truncate();
- return NS_OK;
+
+ nsIPresShell* shell = (nsIPresShell*) mPresShells.ElementAt(0);
+
+ if (!shell)
+ return NS_OK;
+
+ nsCOMPtr selection;
+ shell->GetFrameSelection(getter_AddRefs(selection));
+
+ if (!selection)
+ return NS_OK;
+
+ nsCOMPtr domSelection;
+
+ selection->GetSelection(nsISelectionController::SELECTION_NORMAL,
+ getter_AddRefs(domSelection));
+
+ if (!domSelection)
+ return NS_OK;
+
+ nsCOMPtr consoleService
+ (do_GetService("mozilla.consoleservice.1"));
+
+ if (consoleService) {
+ consoleService->LogStringMessage(NS_ConvertASCIItoUCS2("Depricated method document.getSelection() called, use window.getSelection() in stead!").GetUnicode());
+ }
+
+ return domSelection->ToString(aReturn);
}
NS_IMETHODIMP