Bug 1032340: Make Has/SetMutationListeners available on the inner window only. r=smaug

This commit is contained in:
Kyle Huey 2014-06-30 16:02:04 -07:00
parent d2738ad8c9
commit e4cdfadef0
2 changed files with 11 additions and 36 deletions

View File

@ -8898,8 +8898,7 @@ nsDocument::MutationEventDispatched(nsINode* aTarget)
return;
}
nsCOMPtr<nsPIDOMWindow> window;
window = do_QueryInterface(GetWindow());
nsPIDOMWindow* window = GetInnerWindow();
if (window &&
!window->HasMutationListeners(NS_EVENT_BITS_MUTATION_SUBTREEMODIFIED)) {
mSubtreeModifiedTargets.Clear();

View File

@ -122,52 +122,28 @@ public:
bool HasMutationListeners(uint32_t aMutationEventType) const
{
const nsPIDOMWindow *win;
MOZ_ASSERT(IsInnerWindow());
if (IsOuterWindow()) {
win = GetCurrentInnerWindow();
if (!mOuterWindow) {
NS_ERROR("HasMutationListeners() called on orphan inner window!");
if (!win) {
NS_ERROR("No current inner window available!");
return false;
}
} else {
if (!mOuterWindow) {
NS_ERROR("HasMutationListeners() called on orphan inner window!");
return false;
}
win = this;
return false;
}
return (win->mMutationBits & aMutationEventType) != 0;
return (mMutationBits & aMutationEventType) != 0;
}
void SetMutationListeners(uint32_t aType)
{
nsPIDOMWindow *win;
MOZ_ASSERT(IsInnerWindow());
if (IsOuterWindow()) {
win = GetCurrentInnerWindow();
if (!mOuterWindow) {
NS_ERROR("HasMutationListeners() called on orphan inner window!");
if (!win) {
NS_ERROR("No inner window available to set mutation bits on!");
return;
}
} else {
if (!mOuterWindow) {
NS_ERROR("HasMutationListeners() called on orphan inner window!");
return;
}
win = this;
return;
}
win->mMutationBits |= aType;
mMutationBits |= aType;
}
virtual void MaybeUpdateTouchState() {}