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

Side by Side Diff: chrome/browser/resources/google_now/background.js

Issue 469943002: Check the Argument to the Catch Function (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 'use strict'; 5 'use strict';
6 6
7 /** 7 /**
8 * @fileoverview The event page for Google Now for Chrome implementation. 8 * @fileoverview The event page for Google Now for Chrome implementation.
9 * The Google Now event page gets Google Now cards from the server and shows 9 * The Google Now event page gets Google Now cards from the server and shows
10 * them as Chrome notifications. 10 * them as Chrome notifications.
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 console.log('requestDismissingCard-onloadend ' + request.status); 811 console.log('requestDismissingCard-onloadend ' + request.status);
812 if (request.status == HTTP_NOCONTENT) 812 if (request.status == HTTP_NOCONTENT)
813 recordEvent(GoogleNowEvent.DISMISS_REQUEST_SUCCESS); 813 recordEvent(GoogleNowEvent.DISMISS_REQUEST_SUCCESS);
814 814
815 // A dismissal doesn't require further retries if it was successful or 815 // A dismissal doesn't require further retries if it was successful or
816 // doesn't have a chance for successful completion. 816 // doesn't have a chance for successful completion.
817 return (request.status == HTTP_NOCONTENT) ? 817 return (request.status == HTTP_NOCONTENT) ?
818 Promise.resolve() : 818 Promise.resolve() :
819 Promise.reject(); 819 Promise.reject();
820 }).catch(function(request) { 820 }).catch(function(request) {
821 request = (typeof request === 'object') ? request : {};
821 return (request.status == HTTP_BAD_REQUEST || 822 return (request.status == HTTP_BAD_REQUEST ||
822 request.status == HTTP_METHOD_NOT_ALLOWED) ? 823 request.status == HTTP_METHOD_NOT_ALLOWED) ?
823 Promise.resolve() : 824 Promise.resolve() :
824 Promise.reject(); 825 Promise.reject();
825 }); 826 });
826 } 827 }
827 828
828 /** 829 /**
829 * Tries to send dismiss requests for all pending dismissals. 830 * Tries to send dismiss requests for all pending dismissals.
830 * @return {Promise} A promise to process the pending dismissals. 831 * @return {Promise} A promise to process the pending dismissals.
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
1361 lastPollNowPayloads: items.lastPollNowPayloads, 1362 lastPollNowPayloads: items.lastPollNowPayloads,
1362 notificationGroups: items.notificationGroups 1363 notificationGroups: items.notificationGroups
1363 }); 1364 });
1364 1365
1365 pollOptedInWithRecheck(); 1366 pollOptedInWithRecheck();
1366 } 1367 }
1367 }); 1368 });
1368 }); 1369 });
1369 } 1370 }
1370 }); 1371 });
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698