Ignore empty data in profile update.

This commit is contained in:
FelisCatus 2015-02-09 11:11:58 +08:00
parent ec5a35682c
commit 674f501ada
2 changed files with 8 additions and 1 deletions

View File

@ -41,7 +41,10 @@ class ChromeTabs
@_badgeTab = null
if not tab.url? or tab.url.indexOf("chrome") == 0
if @_defaultAction
chrome.browserAction.setTitle(title: @_defaultAction.title, tabId: tab.id)
chrome.browserAction.setTitle({
title: @_defaultAction.title
tabId: tab.id
})
@clearIcon tab.id
return
@actionForUrl(tab.url).then (action) =>

View File

@ -619,6 +619,10 @@ class Options
url = OmegaPac.Profiles.updateUrl(profile)
if url
results[key] = @fetchUrl(url, opt_bypass_cache).then((data) =>
# Errors and unsuccessful response codes shoud have been already
# rejected by fetchUrl and will not end up here.
# So empty data indicates success without any update (e.g. 304).
return profile unless data
profile = OmegaPac.Profiles.byKey(key, @_options)
profile.lastUpdate = new Date().toISOString()
if OmegaPac.Profiles.update(profile, data)