Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: messageResponder.js

Issue 29338005: Issue 3761 - Don't clear user input when filter validation failed (Closed)
Patch Set: Created March 9, 2016, 8:14 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | options.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: messageResponder.js
===================================================================
--- a/messageResponder.js
+++ b/messageResponder.js
@@ -184,10 +184,12 @@
break;
case "filters.add":
var result = require("filterValidation").parseFilter(message.text);
+ var errors = [];
if (result.error)
- sendMessage("app", "error", [result.error.toString()], sender.page);
+ errors.push(result.error.toString());
else if (result.filter)
FilterStorage.addFilter(result.filter);
+ callback(errors);
break;
case "filters.blocked":
var filter = defaultMatcher.matchesAny(message.url, message.requestType,
@@ -237,11 +239,9 @@
errors.push(error.toString());
}
+ callback(errors);
if (errors.length > 0)
- {
- sendMessage("app", "error", errors, sender.page);
return;
- }
var seenFilter = Object.create(null);
for (var i = 0; i < result.filters.length; i++)
« no previous file with comments | « no previous file | options.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld