Backed out changeset eeb73d8c0542 (bug 1364570) for static analysis failures on a CLOSED TREE.

This commit is contained in:
Ryan VanderMeulen 2017-05-23 15:31:16 -04:00
Родитель c8ba76db41
Коммит 41f95294f5
3 изменённых файлов: 11 добавлений и 40 удалений

Просмотреть файл

@ -39,13 +39,6 @@ AsyncEventDispatcher::Run()
if (mCanceled) {
return NS_OK;
}
if (mCheckStillInDoc) {
nsCOMPtr<nsINode> node = do_QueryInterface(mTarget);
MOZ_ASSERT(node);
if (!node->IsInComposedDoc()) {
return NS_OK;
}
}
mTarget->AsyncEventRunning(this);
RefPtr<Event> event = mEvent ? mEvent->InternalDOMEvent() : nullptr;
if (!event) {
@ -95,15 +88,6 @@ AsyncEventDispatcher::RunDOMEventWhenSafe()
nsContentUtils::AddScriptRunner(this);
}
void
AsyncEventDispatcher::RequireNodeInDocument()
{
nsCOMPtr<nsINode> node = do_QueryInterface(mTarget);
MOZ_ASSERT(node);
mCheckStillInDoc = true;
}
/******************************************************************************
* mozilla::LoadBlockingAsyncEventDispatcher
******************************************************************************/

Просмотреть файл

@ -64,18 +64,12 @@ public:
nsresult PostDOMEvent();
void RunDOMEventWhenSafe();
// Calling this causes the Run() method to check that
// mTarget->IsInComposedDoc(). mTarget must be an nsINode or else we'll
// assert.
void RequireNodeInDocument();
nsCOMPtr<dom::EventTarget> mTarget;
nsCOMPtr<nsIDOMEvent> mEvent;
nsString mEventType;
bool mBubbles = false;
bool mOnlyChromeDispatch = false;
bool mCanceled = false;
bool mCheckStillInDoc = false;
};
class LoadBlockingAsyncEventDispatcher final : public AsyncEventDispatcher

Просмотреть файл

@ -4,13 +4,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsPrefetchService.h"
#include "mozilla/AsyncEventDispatcher.h"
#include "mozilla/Attributes.h"
#include "mozilla/CORSMode.h"
#include "mozilla/dom/HTMLLinkElement.h"
#include "mozilla/Preferences.h"
#include "nsICacheEntry.h"
#include "nsIServiceManager.h"
#include "nsICategoryManager.h"
@ -32,6 +25,10 @@
#include "mozilla/Logging.h"
#include "plstr.h"
#include "nsIAsyncVerifyRedirectCallback.h"
#include "mozilla/Preferences.h"
#include "mozilla/Attributes.h"
#include "mozilla/CORSMode.h"
#include "mozilla/dom/HTMLLinkElement.h"
#include "nsIDOMNode.h"
#include "nsINode.h"
#include "nsIDocument.h"
@ -497,17 +494,13 @@ nsPrefetchService::DispatchEvent(nsPrefetchNode *node, bool aSuccess)
for (uint32_t i = 0; i < node->mSources.Length(); i++) {
nsCOMPtr<nsINode> domNode = do_QueryReferent(node->mSources.ElementAt(i));
if (domNode && domNode->IsInComposedDoc()) {
// We don't dispatch synchronously since |node| might be in a DocGroup
// that we're not allowed to touch. (Our network request happens in the
// DocGroup of one of the mSources nodes--not necessarily this one).
RefPtr<AsyncEventDispatcher> dispatcher =
new AsyncEventDispatcher(domNode,
aSuccess ?
NS_LITERAL_STRING("load") :
NS_LITERAL_STRING("error"),
/* aCanBubble = */ false);
dispatcher->RequireNodeInDocument();
dispatcher->PostDOMEvent();
nsContentUtils::DispatchTrustedEvent(domNode->OwnerDoc(),
domNode,
aSuccess ?
NS_LITERAL_STRING("load") :
NS_LITERAL_STRING("error"),
/* aCanBubble = */ false,
/* aCancelable = */ false);
}
}
}