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

Unified Diff: content/browser/service_worker/service_worker_utils.cc

Issue 813673005: Service Worker: Improve some exception messages (Chromium). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: typo Created 5 years, 11 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
Index: content/browser/service_worker/service_worker_utils.cc
diff --git a/content/browser/service_worker/service_worker_utils.cc b/content/browser/service_worker/service_worker_utils.cc
index c3c8bfceb3ee7fb8bdb186bc716c92d0699788d4..9d7e3db1e13d6e3b8ebdd11e8a27022565491c92 100644
--- a/content/browser/service_worker/service_worker_utils.cc
+++ b/content/browser/service_worker/service_worker_utils.cc
@@ -13,11 +13,6 @@ namespace content {
namespace {
-const char kDisallowedCharacterErrorMessage[] =
- "The scope/script URL includes disallowed escaped character.";
-const char kPathRestrictionErrorMessage[] =
- "The scope must be under the directory of the script URL.";
-
bool ContainsDisallowedCharacter(const GURL& url) {
std::string path = url.path();
DCHECK(base::IsStringUTF8(path));
@@ -65,13 +60,18 @@ bool ServiceWorkerUtils::IsPathRestrictionSatisfied(
if (ContainsDisallowedCharacter(scope) ||
ContainsDisallowedCharacter(script_url)) {
- *error_message = kDisallowedCharacterErrorMessage;
+ *error_message = "The provided scope ('" + scope.spec() +
+ "') or scriptURL ('" + script_url.spec() +
dominicc (has gone to gerrit) 2015/01/14 06:16:38 script URL with a space? WDYT?
dominicc (has gone to gerrit) 2015/01/14 06:16:38 script URL with a space? Ditto below. WDYT?
dominicc (has gone to gerrit) 2015/01/14 06:16:38 script URL with a space? WDYT?
falken 2015/01/14 07:29:21 I like "scriptURL" as it's the parameter to Servic
+ "') includes a disallowed escape character.";
return false;
}
// |scope|'s path should be under the |script_url|'s directory.
if (!StartsWithASCII(scope.path(), GetDirectoryPath(script_url), true)) {
- *error_message = kPathRestrictionErrorMessage;
+ *error_message =
+ "The path of the provided scope ('" + scope.spec() +
+ "') is not under the directory of the provided scriptURL ('" +
+ script_url.spec() + "').";
return false;
}
return true;

Powered by Google App Engine
This is Rietveld 408576698