Bug 1265072 part 3. Get rid of the use of GetDocumentFromScriptContext in DOMEventTargetHelper. r=smaug

This commit is contained in:
Boris Zbarsky 2016-04-20 18:04:36 -04:00
parent fb36e28a0d
commit 4091ff6549

View File

@ -377,11 +377,10 @@ DOMEventTargetHelper::GetContextForEventHandlers(nsresult* aRv)
nsresult
DOMEventTargetHelper::WantsUntrusted(bool* aRetVal)
{
nsresult rv;
nsIScriptContext* context = GetContextForEventHandlers(&rv);
nsresult rv = CheckInnerWindowCorrectness();
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIDocument> doc =
nsContentUtils::GetDocumentFromScriptContext(context);
nsCOMPtr<nsIDocument> doc = GetDocumentIfCurrent();
// We can let listeners on workers to always handle all the events.
*aRetVal = (doc && !nsContentUtils::IsChromeDoc(doc)) || !NS_IsMainThread();
return rv;