Backed out changeset a6878c4ee086 (bug 932309) for assertions

This commit is contained in:
Ed Morley 2013-11-01 11:14:56 +00:00
parent 339e4d3302
commit 73c1d04905
3 changed files with 11 additions and 24 deletions

View File

@ -1509,6 +1509,7 @@ nsGlobalWindow::FreeInnerObjects()
}
// Remove our reference to the document and the document principal.
mDoc = nullptr;
mFocusedNode = nullptr;
if (mApplicationCache) {
@ -8910,9 +8911,6 @@ NS_IMPL_REMOVE_SYSTEM_EVENT_LISTENER(nsGlobalWindow)
NS_IMETHODIMP
nsGlobalWindow::DispatchEvent(nsIDOMEvent* aEvent, bool* aRetVal)
{
MOZ_ASSERT(!IsInnerWindow() || IsCurrentInnerWindow(),
"We should only fire events on the current inner window.");
FORWARD_TO_INNER(DispatchEvent, (aEvent, aRetVal), NS_OK);
if (!mDoc) {
@ -9042,7 +9040,10 @@ nsIScriptContext*
nsGlobalWindow::GetContextForEventHandlers(nsresult* aRv)
{
*aRv = NS_ERROR_UNEXPECTED;
NS_ENSURE_TRUE(!IsInnerWindow() || IsCurrentInnerWindow(), nullptr);
if (IsInnerWindow()) {
nsPIDOMWindow* outer = GetOuterWindow();
NS_ENSURE_TRUE(outer && outer->GetCurrentInnerWindow() == this, nullptr);
}
nsIScriptContext* scx;
if ((scx = GetContext())) {
@ -10698,7 +10699,7 @@ nsGlobalWindow::Observe(nsISupports* aSubject, const char* aTopic,
// need to fire only one idle event while the window is frozen.
mNotifyIdleObserversIdleOnThaw = true;
mNotifyIdleObserversActiveOnThaw = false;
} else if (IsCurrentInnerWindow()) {
} else if (mOuterWindow && mOuterWindow->GetCurrentInnerWindow() == this) {
HandleIdleActiveEvent();
}
return NS_OK;
@ -10709,17 +10710,13 @@ nsGlobalWindow::Observe(nsISupports* aSubject, const char* aTopic,
if (IsFrozen()) {
mNotifyIdleObserversActiveOnThaw = true;
mNotifyIdleObserversIdleOnThaw = false;
} else if (IsCurrentInnerWindow()) {
} else if (mOuterWindow && mOuterWindow->GetCurrentInnerWindow() == this) {
ScheduleActiveTimerCallback();
}
return NS_OK;
}
if (!nsCRT::strcmp(aTopic, "dom-storage2-changed")) {
if (!IsInnerWindow() || !IsCurrentInnerWindow()) {
return NS_OK;
}
if (IsInnerWindow() && !nsCRT::strcmp(aTopic, "dom-storage2-changed")) {
nsIPrincipal *principal;
nsresult rv;

View File

@ -327,15 +327,6 @@ public:
return mIsInnerWindow;
}
// Returns true if this object has an outer window and it is the current inner
// window of that outer. Only call this on inner windows.
bool IsCurrentInnerWindow() const
{
MOZ_ASSERT(IsInnerWindow(),
"It doesn't make sense to call this on outer windows.");
return mOuterWindow && mOuterWindow->GetCurrentInnerWindow() == this;
}
bool IsOuterWindow() const
{
return !IsInnerWindow();

View File

@ -209,7 +209,7 @@ GamepadService::NewButtonEvent(uint32_t aIndex, uint32_t aButton, bool aPressed,
--i;
// Only send events to non-background windows
if (!listeners[i]->IsCurrentInnerWindow() ||
if (!listeners[i]->GetOuterWindow() ||
listeners[i]->GetOuterWindow()->IsBackground()) {
continue;
}
@ -274,7 +274,7 @@ GamepadService::NewAxisMoveEvent(uint32_t aIndex, uint32_t aAxis, double aValue)
--i;
// Only send events to non-background windows
if (!listeners[i]->IsCurrentInnerWindow() ||
if (!listeners[i]->GetOuterWindow() ||
listeners[i]->GetOuterWindow()->IsBackground()) {
continue;
}
@ -340,7 +340,7 @@ GamepadService::NewConnectionEvent(uint32_t aIndex, bool aConnected)
--i;
// Only send events to non-background windows
if (!listeners[i]->IsCurrentInnerWindow() ||
if (!listeners[i]->GetOuterWindow() ||
listeners[i]->GetOuterWindow()->IsBackground()) {
continue;
}
@ -525,7 +525,6 @@ GamepadServiceTest::CreateService()
GamepadServiceTest::GamepadServiceTest()
{
/* member initializers and constructor code */
nsRefPtr<GamepadService> service = GamepadService::GetService();
}
/* uint32_t addGamepad (in string id, in unsigned long mapping, in unsigned long numButtons, in unsigned long numAxes); */