Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4993)

Unified Diff: chrome/renderer/resources/extensions/notifications_custom_bindings.js

Issue 855813002: Mark create/update/clear callbacks of notification API as optional (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/renderer/resources/extensions/notifications_custom_bindings.js
diff --git a/chrome/renderer/resources/extensions/notifications_custom_bindings.js b/chrome/renderer/resources/extensions/notifications_custom_bindings.js
index eebf2900920287f0b539b04e32d48e6219a2c444..5c278ec0e78f65ca6363b412031d0ae1b95ee36f 100644
--- a/chrome/renderer/resources/extensions/notifications_custom_bindings.js
+++ b/chrome/renderer/resources/extensions/notifications_custom_bindings.js
@@ -7,6 +7,7 @@
var binding = require('binding').Binding.create('notifications');
var sendRequest = require('sendRequest').sendRequest;
+var exceptionHandler = require('uncaught_exception_handler');
var imageUtil = require('imageUtil');
var lastError = require('lastError');
var notificationsPrivate = requireNative('notifications_private');
@@ -111,20 +112,23 @@ function genHandle(name, failure_function) {
return function(id, input_notification_details, callback) {
// TODO(dewittj): Remove this hack. This is used as a way to deep
not at google - send to devlin 2015/01/20 17:41:35 The best way to deep copy would be to expose a nat
robwu 2015/01/20 22:34:01 Recursive objects are invalid for this API, so tha
dewittj 2015/01/20 22:46:51 The JSON copy has 2 important properties: 1) Custo
robwu 2015/01/20 22:58:44 There are many other extension APIs that suffer fr
not at google - send to devlin 2015/01/21 22:21:19 I'm sure that copying is necessary. I was addressi
robwu 2015/01/21 23:21:09 Yep, I understood that, and I pointed out that cop
// copy a complex JSON object.
- var notification_details = JSON.parse(
- JSON.stringify(input_notification_details));
+ var notification_details = $JSON.parse(
+ $JSON.stringify(input_notification_details));
var that = this;
+ var stack = exceptionHandler.getExtensionStackTrace();
replaceNotificationOptionURLs(notification_details, function(success) {
if (success) {
sendRequest(that.name,
[id, notification_details, callback],
- that.definition.parameters);
+ that.definition.parameters, {stack: stack});
return;
}
- lastError.run(name,
- 'Unable to download all specified images.',
- null,
- failure_function, [callback, id])
+ var error = 'Unable to download all specified images.';
+ if (callback) {
+ lastError.run(name, error, stack, failure_function, [callback, id]);
+ } else {
+ lastError.reportUncheckedLastError(name, error, stack);
+ }
not at google - send to devlin 2015/01/21 22:21:19 You could avoid needing to expose reportUncheckedL
robwu 2015/01/21 23:21:09 Done. Though reportUncheckedLastError has to be pu
});
};
}

Powered by Google App Engine
This is Rietveld 408576698