mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 916893 - Patch 3 - Walk up worker chain to find correct window for WorkerNotificationObserver. r=khuey
In case of child workers.
This commit is contained in:
parent
2f49c57d34
commit
2d7713ba4b
@ -981,7 +981,7 @@ NotificationObserver::Observe(nsISupports* aSubject, const char* aTopic,
|
||||
MOZ_ASSERT(notification);
|
||||
if (!strcmp("alertclickcallback", aTopic)) {
|
||||
nsCOMPtr<nsPIDOMWindow> window = notification->GetOwner();
|
||||
if (!window || !window->IsCurrentInnerWindow()) {
|
||||
if (NS_WARN_IF(!window || !window->IsCurrentInnerWindow())) {
|
||||
// Window has been closed, this observer is not valid anymore
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
@ -1017,7 +1017,7 @@ WorkerNotificationObserver::Observe(nsISupports* aSubject, const char* aTopic,
|
||||
// runnables, see the Notification class comment.
|
||||
Notification* notification = mNotificationRef->GetNotification();
|
||||
// We can't assert notification here since the feature could've unset it.
|
||||
if (!notification) {
|
||||
if (NS_WARN_IF(!notification)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
@ -1025,8 +1025,13 @@ WorkerNotificationObserver::Observe(nsISupports* aSubject, const char* aTopic,
|
||||
|
||||
nsRefPtr<WorkerRunnable> r;
|
||||
if (!strcmp("alertclickcallback", aTopic)) {
|
||||
nsCOMPtr<nsPIDOMWindow> window = notification->mWorkerPrivate->GetWindow();
|
||||
if (!window || !window->IsCurrentInnerWindow()) {
|
||||
WorkerPrivate* top = notification->mWorkerPrivate;
|
||||
while (top->GetParent()) {
|
||||
top = top->GetParent();
|
||||
}
|
||||
|
||||
nsPIDOMWindow* window = top->GetWindow();
|
||||
if (NS_WARN_IF(!window || !window->IsCurrentInnerWindow())) {
|
||||
// Window has been closed, this observer is not valid anymore
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user