Suppress any crash in requestPermission

This commit is contained in:
Guangcong Luo
2013-05-21 17:14:22 -05:00
parent f9b553f379
commit 13f6e623bb

View File

@@ -1325,16 +1325,18 @@
// notifications
requestNotifications: function() {
if (window.webkitNotifications && webkitNotifications.requestPermission) {
// Notification.requestPermission crashes Chrome 23:
// https://code.google.com/p/chromium/issues/detail?id=139594
// In lieu of a way to detect Chrome 23, we'll just use the old
// requestPermission API, which works to request permissions for
// the new Notification spec anyway.
webkitNotifications.requestPermission();
} else if (window.Notification && Notification.requestPermission) {
Notification.requestPermission(function(permission) {});
}
try {
if (window.webkitNotifications && webkitNotifications.requestPermission) {
// Notification.requestPermission crashes Chrome 23:
// https://code.google.com/p/chromium/issues/detail?id=139594
// In lieu of a way to detect Chrome 23, we'll just use the old
// requestPermission API, which works to request permissions for
// the new Notification spec anyway.
webkitNotifications.requestPermission();
} else if (window.Notification && Notification.requestPermission) {
Notification.requestPermission(function(permission) {});
}
} catch (e) {}
},
notifications: null,
notify: function(title, body, tag, once) {