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

Unified Diff: remoting/webapp/crd/js/options_export.js

Issue 2689593005: Send a correctly-formatted response if there are no host options saved. (Closed)
Patch Set: Reviewer feedback. Created 3 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/crd/js/options_export.js
diff --git a/remoting/webapp/crd/js/options_export.js b/remoting/webapp/crd/js/options_export.js
index dbd3a25560c96d3e8fa94fe1fceecc06561bc31e..392b043ee065a1045a777995ba0f2561abfb348f 100644
--- a/remoting/webapp/crd/js/options_export.js
+++ b/remoting/webapp/crd/js/options_export.js
@@ -20,11 +20,17 @@ remoting.OptionsExporter = function() {
remoting.OptionsExporter.migrateSettings_ = function() {
var result = new base.Deferred();
- chrome.storage.local.get('remoting-host-options', function(options) {
+ chrome.storage.local.get(KEY_NAME, function(options) {
+ // If there are no host options stored, reformat the message response so
+ // that the sender doesn't interpret it as an error.
+ if (Object.keys(options).length == 0) {
+ options[KEY_NAME] = '{}';
+ }
result.resolve(options);
})
return result.promise();
};
+var KEY_NAME = 'remoting-host-options';
}());
« 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