From 1ef0a34ad233dc664a1e28f36c72af82da760925 Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Tue, 19 Aug 2014 12:02:06 -0700 Subject: [PATCH] Bug 796938 - Switch to GetEntryDocument in GetDocumentCharacterSetForURI. r=smaug --- dom/base/nsLocation.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/dom/base/nsLocation.cpp b/dom/base/nsLocation.cpp index d16e6c720804..ab0da0498148 100644 --- a/dom/base/nsLocation.cpp +++ b/dom/base/nsLocation.cpp @@ -42,15 +42,8 @@ GetDocumentCharacterSetForURI(const nsAString& aHref, nsACString& aCharset) { aCharset.Truncate(); - JSContext *cx = nsContentUtils::GetCurrentJSContext(); - if (cx) { - nsCOMPtr window = - do_QueryInterface(nsJSUtils::GetDynamicScriptGlobal(cx)); - NS_ENSURE_TRUE(window, NS_ERROR_FAILURE); - - if (nsIDocument* doc = window->GetDoc()) { - aCharset = doc->GetDocumentCharacterSet(); - } + if (nsIDocument* doc = GetEntryDocument()) { + aCharset = doc->GetDocumentCharacterSet(); } return NS_OK;