Skip to content

Commit 6809dbf

Browse files
author
Yael Aharon
committed
2010-07-21 Yael Aharon <yael.aharon@nokia.com>
Reviewed by Darin Adler. Crash in Notification::disconnectFrame() triggered by Frame::lifeSupportTimerFired() https://bugs.webkit.org/show_bug.cgi?id=42534 Call NotificationsCenter::disconnectFrame() when the frame is disconnected from the page. Calling it from the destructor of Frame is too late and sometimes causes access violation. I was not able to reproduce this crash, so did not add new tests. This patch is based on the error reported in http://code.google.com/p/chromium/issues/detail?id=49323. * page/DOMWindow.cpp: (WebCore::DOMWindow::pageDestroyed): * page/DOMWindow.h: * page/Frame.cpp: (WebCore::Frame::pageDestroyed): Canonical link: https://commits.webkit.org/54684@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@63847 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 0ec4ec0 commit 6809dbf

5 files changed

Lines changed: 40 additions & 0 deletions

File tree

WebCore/ChangeLog

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
2010-07-21 Yael Aharon <yael.aharon@nokia.com>
2+
3+
Reviewed by Darin Adler.
4+
5+
Crash in Notification::disconnectFrame() triggered by Frame::lifeSupportTimerFired()
6+
https://bugs.webkit.org/show_bug.cgi?id=42534
7+
8+
Call NotificationsCenter::disconnectFrame() when the frame is disconnected from the page.
9+
Calling it from the destructor of Frame is too late and sometimes causes access violation.
10+
I was not able to reproduce this crash, so did not add new tests.
11+
This patch is based on the error reported in
12+
http://code.google.com/p/chromium/issues/detail?id=49323.
13+
14+
* page/DOMWindow.cpp:
15+
(WebCore::DOMWindow::pageDestroyed):
16+
* page/DOMWindow.h:
17+
* page/Frame.cpp:
18+
(WebCore::Frame::pageDestroyed):
19+
120
2010-07-21 Anders Carlsson <andersca@apple.com>
221

322
Reviewed by Sam Weinig.

WebCore/notifications/NotificationCenter.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ void NotificationCenter::requestPermission(PassRefPtr<VoidCallback> callback)
6161

6262
void NotificationCenter::disconnectFrame()
6363
{
64+
// m_notificationPresenter should never be 0. But just to be safe, we check it here.
65+
// Due to the mysterious bug http://code.google.com/p/chromium/issues/detail?id=49323.
66+
ASSERT(m_notificationPresenter);
67+
if (!m_notificationPresenter)
68+
return;
6469
m_notificationPresenter->cancelRequestsForPermission(m_scriptExecutionContext);
6570
m_notificationPresenter = 0;
6671
}

WebCore/page/DOMWindow.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -673,6 +673,17 @@ NotificationCenter* DOMWindow::webkitNotifications() const
673673
}
674674
#endif
675675

676+
void DOMWindow::pageDestroyed()
677+
{
678+
#if ENABLE(NOTIFICATIONS)
679+
// Clearing Notifications requests involves accessing the client so it must be done
680+
// before the frame is detached.
681+
if (m_notifications)
682+
m_notifications->disconnectFrame();
683+
m_notifications = 0;
684+
#endif
685+
}
686+
676687
#if ENABLE(INDEXED_DATABASE)
677688
IndexedDatabaseRequest* DOMWindow::indexedDB() const
678689
{

WebCore/page/DOMWindow.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,8 @@ namespace WebCore {
228228
NotificationCenter* webkitNotifications() const;
229229
#endif
230230

231+
void pageDestroyed();
232+
231233
#if ENABLE(INDEXED_DATABASE)
232234
IndexedDatabaseRequest* indexedDB() const;
233235
#endif

WebCore/page/Frame.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1347,6 +1347,9 @@ void Frame::pageDestroyed()
13471347
if (Frame* parent = tree()->parent())
13481348
parent->loader()->checkLoadComplete();
13491349

1350+
if (m_domWindow)
1351+
m_domWindow->pageDestroyed();
1352+
13501353
// FIXME: It's unclear as to why this is called more than once, but it is,
13511354
// so page() could be NULL.
13521355
if (page() && page()->focusController()->focusedFrame() == this)

0 commit comments

Comments
 (0)