mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 841608 - 'Assertion: Uh, inner window set as event target! with FireMozTimeChangeEvent'. r=smaug.
This commit is contained in:
parent
b6bde00c89
commit
be5abc59e7
@ -39,14 +39,17 @@ nsSystemTimeChangeObserver::FireMozTimeChangeEvent()
|
||||
ListenerArray::ForwardIterator iter(mWindowListeners);
|
||||
while (iter.HasMore()) {
|
||||
nsWeakPtr weakWindow = iter.GetNext();
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(weakWindow);
|
||||
nsCOMPtr<nsPIDOMWindow> innerWindow = do_QueryReferent(weakWindow);
|
||||
nsCOMPtr<nsPIDOMWindow> outerWindow;
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
if (!window || !(document = window->GetDoc())) {
|
||||
if (!innerWindow ||
|
||||
!(document = innerWindow->GetExtantDoc()) ||
|
||||
!(outerWindow = innerWindow->GetOuterWindow())) {
|
||||
mWindowListeners.RemoveElement(weakWindow);
|
||||
continue;
|
||||
}
|
||||
|
||||
nsContentUtils::DispatchTrustedEvent(document, window,
|
||||
nsContentUtils::DispatchTrustedEvent(document, outerWindow,
|
||||
NS_LITERAL_STRING("moztimechange"), /* bubbles = */ true,
|
||||
/* canceable = */ false);
|
||||
}
|
||||
@ -75,18 +78,25 @@ nsSystemTimeChangeObserver::Notify(
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSystemTimeChangeObserver::AddWindowListener(nsIDOMWindow* aWindow)
|
||||
nsSystemTimeChangeObserver::AddWindowListener(nsPIDOMWindow* aWindow)
|
||||
{
|
||||
return GetInstance()->AddWindowListenerImpl(aWindow);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSystemTimeChangeObserver::AddWindowListenerImpl(nsIDOMWindow* aWindow)
|
||||
nsSystemTimeChangeObserver::AddWindowListenerImpl(nsPIDOMWindow* aWindow)
|
||||
{
|
||||
if (!aWindow) {
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
|
||||
if (aWindow->IsOuterWindow()) {
|
||||
aWindow = aWindow->GetCurrentInnerWindow();
|
||||
if (!aWindow) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
nsWeakPtr windowWeakRef = do_GetWeakReference(aWindow);
|
||||
NS_ASSERTION(windowWeakRef, "nsIDOMWindow implementations shuld support weak ref");
|
||||
|
||||
@ -105,7 +115,7 @@ nsSystemTimeChangeObserver::AddWindowListenerImpl(nsIDOMWindow* aWindow)
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSystemTimeChangeObserver::RemoveWindowListener(nsIDOMWindow* aWindow)
|
||||
nsSystemTimeChangeObserver::RemoveWindowListener(nsPIDOMWindow* aWindow)
|
||||
{
|
||||
if (!sObserver) {
|
||||
return NS_OK;
|
||||
@ -115,8 +125,19 @@ nsSystemTimeChangeObserver::RemoveWindowListener(nsIDOMWindow* aWindow)
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSystemTimeChangeObserver::RemoveWindowListenerImpl(nsIDOMWindow* aWindow)
|
||||
nsSystemTimeChangeObserver::RemoveWindowListenerImpl(nsPIDOMWindow* aWindow)
|
||||
{
|
||||
if (!aWindow) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (aWindow->IsOuterWindow()) {
|
||||
aWindow = aWindow->GetCurrentInnerWindow();
|
||||
if (!aWindow) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
mWindowListeners.RemoveElement(NS_GetWeakReference(aWindow));
|
||||
|
||||
if (mWindowListeners.IsEmpty()) {
|
||||
|
@ -31,11 +31,11 @@ public:
|
||||
void Notify(
|
||||
const mozilla::hal::SystemTimezoneChangeInformation& aSystemTimezoneChangeInfo);
|
||||
|
||||
static nsresult AddWindowListener(nsIDOMWindow* aWindow);
|
||||
static nsresult RemoveWindowListener(nsIDOMWindow* aWindow);
|
||||
static nsresult AddWindowListener(nsPIDOMWindow* aWindow);
|
||||
static nsresult RemoveWindowListener(nsPIDOMWindow* aWindow);
|
||||
private:
|
||||
nsresult AddWindowListenerImpl(nsIDOMWindow* aWindow);
|
||||
nsresult RemoveWindowListenerImpl(nsIDOMWindow* aWindow);
|
||||
nsresult AddWindowListenerImpl(nsPIDOMWindow* aWindow);
|
||||
nsresult RemoveWindowListenerImpl(nsPIDOMWindow* aWindow);
|
||||
nsSystemTimeChangeObserver() { };
|
||||
ListenerArray mWindowListeners;
|
||||
void FireMozTimeChangeEvent();
|
||||
|
Loading…
Reference in New Issue
Block a user