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

Issue 15495008: Defending from failing APIs (Closed)

Created:
7 years, 7 months ago by vadimt
Modified:
7 years, 4 months ago
CC:
chromium-reviews, arv+watch_chromium.org, stromme, govind1
Visibility:
Public.

Description

Defending from failing APIs. Some chrome.* API calls may legitimately fail. Also, chrome.runtime.onInstalled/onStartup callbacks may not happen due to implementation bugs. We need to rewrite the extension to degrade as little as possible in such cases. In practice, this only means initializing values retrieved from chrome.storage. Since we initialize them upon retrieval, there is no need to initialize them from installed/startup callbacks, so I'm removing them from there. The only remaining initialization if for activeNotifications; it will be take care of when I start using notifications.getAll API call. BUG=164227 TEST=Existing tests should work Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=201921

Patch Set 1 #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+11 lines, -5 lines) Patch
M chrome/browser/resources/google_now/background.js View 7 chunks +11 lines, -5 lines 1 comment Download

Messages

Total messages: 10 (0 generated)
vadimt
7 years, 7 months ago (2013-05-21 00:19:17 UTC) #1
rgustafson
lgtm Just leaving a note addressing the concern we talked about: If storage.get fails, the ...
7 years, 7 months ago (2013-05-22 22:04:43 UTC) #2
vadimt
On 2013/05/22 22:04:43, rgustafson wrote: > lgtm > > Just leaving a note addressing the ...
7 years, 7 months ago (2013-05-22 22:15:15 UTC) #3
skare_
lgtm
7 years, 7 months ago (2013-05-23 00:21:45 UTC) #4
vadimt
estade@, please provide OWNERs approval
7 years, 7 months ago (2013-05-23 00:25:09 UTC) #5
Evan Stade
rslgtm
7 years, 7 months ago (2013-05-23 00:54:18 UTC) #6
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/vadimt@chromium.org/15495008/1
7 years, 7 months ago (2013-05-23 17:40:21 UTC) #7
commit-bot: I haz the power
Change committed as 201921
7 years, 7 months ago (2013-05-23 23:16:15 UTC) #8
not at google - send to devlin
https://chromiumcodereview.appspot.com/15495008/diff/1/chrome/browser/resources/google_now/background.js File chrome/browser/resources/google_now/background.js (right): https://chromiumcodereview.appspot.com/15495008/diff/1/chrome/browser/resources/google_now/background.js#newcode246 chrome/browser/resources/google_now/background.js:246: storage.get(['activeNotifications', 'recentDismissals'], function(items) { instead you could call storage.get({ ...
7 years, 7 months ago (2013-05-24 00:01:12 UTC) #9
vadimt
7 years, 4 months ago (2013-08-21 01:55:43 UTC) #10
Message was sent while issue was closed.
On 2013/05/24 00:01:12, kalman wrote:
>
https://chromiumcodereview.appspot.com/15495008/diff/1/chrome/browser/resourc...
> File chrome/browser/resources/google_now/background.js (right):
> 
>
https://chromiumcodereview.appspot.com/15495008/diff/1/chrome/browser/resourc...
> chrome/browser/resources/google_now/background.js:246:
> storage.get(['activeNotifications', 'recentDismissals'], function(items) {
> instead you could call
> 
> storage.get({
>   'activeNotifications': {},
>   'recentDismissals': {}
> }, function(items) {
>   ...
> });
> 
> which does the default value handling for you.

Will this default value mechanism work in case of errors? Like, the database is
corrupted or unavailable: will I get default values (and no error in lastError)?

Powered by Google App Engine
This is Rietveld 408576698