Title: [109475] trunk/Source/WebKit/blackberry
- Revision
- 109475
- Author
- [email protected]
- Date
- 2012-03-01 17:57:07 -0800 (Thu, 01 Mar 2012)
Log Message
[BlackBerry] Web Notification crashes the browser.
https://bugs.webkit.org/show_bug.cgi?id=79897
Patch by Charles Wei <[email protected]> on 2012-03-01
Reviewed by Antonio Gomes.
The reason of the crash is that it still uses the iterator
after been removed from the container, which invalidates the
iterator.
We should stop processing after we have found the element
and removed from the container through the iterator.
This patch only fixes the crash issue, but not any notification
functionality issue, which is tracked seperatly.
Test case: http://sandbox.gtaero.net/chrome/notifications.php
* WebCoreSupport/NotificationPresenterImpl.cpp:
(WebKit::NotificationPresenterImpl::onPermission):
(WebKit::NotificationPresenterImpl::notificationClicked):
Modified Paths
Diff
Modified: trunk/Source/WebKit/blackberry/ChangeLog (109474 => 109475)
--- trunk/Source/WebKit/blackberry/ChangeLog 2012-03-02 01:57:07 UTC (rev 109474)
+++ trunk/Source/WebKit/blackberry/ChangeLog 2012-03-02 01:57:07 UTC (rev 109475)
@@ -1,3 +1,25 @@
+2012-03-01 Charles Wei <[email protected]>
+
+ [BlackBerry] Web Notification crashes the browser.
+ https://bugs.webkit.org/show_bug.cgi?id=79897
+
+ Reviewed by Antonio Gomes.
+
+ The reason of the crash is that it still uses the iterator
+ after been removed from the container, which invalidates the
+ iterator.
+ We should stop processing after we have found the element
+ and removed from the container through the iterator.
+
+ This patch only fixes the crash issue, but not any notification
+ functionality issue, which is tracked seperatly.
+
+ Test case: http://sandbox.gtaero.net/chrome/notifications.php
+
+ * WebCoreSupport/NotificationPresenterImpl.cpp:
+ (WebKit::NotificationPresenterImpl::onPermission):
+ (WebKit::NotificationPresenterImpl::notificationClicked):
+
2012-03-01 Mike Fenton <[email protected]>
Autocomplete attribute should apply to textarea's.
Modified: trunk/Source/WebKit/blackberry/WebCoreSupport/NotificationPresenterImpl.cpp (109474 => 109475)
--- trunk/Source/WebKit/blackberry/WebCoreSupport/NotificationPresenterImpl.cpp 2012-03-02 01:57:07 UTC (rev 109474)
+++ trunk/Source/WebKit/blackberry/WebCoreSupport/NotificationPresenterImpl.cpp 2012-03-02 01:57:07 UTC (rev 109475)
@@ -108,10 +108,10 @@
ASSERT(!domain.empty());
String domainString = String::fromUTF8(domain.c_str());
PermissionRequestMap::iterator it = m_permissionRequests.begin();
- PermissionRequestMap::iterator end = m_permissionRequests.end();
- for (; it != end; ++it) {
+ for (; it != m_permissionRequests.end(); ++it) {
if (it->first->url().host() != domainString)
continue;
+
if (isAllowed) {
m_allowedDomains.add(domainString);
it->second->handleEvent();
@@ -119,6 +119,7 @@
m_allowedDomains.remove(domainString);
m_permissionRequests.remove(it);
+ return;
}
}
@@ -143,11 +144,12 @@
ASSERT(!id.empty());
String idString = String::fromUTF8(id.c_str());
NotificationMap::iterator it = m_notifications.begin();
- NotificationMap::iterator end = m_notifications.end();
- for (; it != end; ++it) {
+ for (; it != m_notifications.end(); ++it) {
if (it->second == idString && it->first->scriptExecutionContext()) {
+ RefPtr<Notification> notification = it->first;
it->first->dispatchEvent(Event::create(eventNames().clickEvent, false, true));
- m_notifications.remove(it);
+ m_notifications.remove(notification);
+ return;
}
}
}
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes