[Extensions] Remove GetURL TODO and add a DCHECK on the returned url

It was decided that this return should never end up being invalid, so
rather than tracking invalid results we just add a DCHECK.

Bug: 987749
Change-Id: I695f4fa2e6cfd79145cac4462e4e92e4c76c0392
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1730096
Commit-Queue: Tim Judkins <[email protected]>
Reviewed-by: Devlin <[email protected]>
Cr-Commit-Position: refs/heads/master@{#684531}
diff --git a/extensions/renderer/runtime_hooks_delegate.cc b/extensions/renderer/runtime_hooks_delegate.cc
index 6dc92ed..d25bd6cd 100644
--- a/extensions/renderer/runtime_hooks_delegate.cc
+++ b/extensions/renderer/runtime_hooks_delegate.cc
@@ -104,10 +104,10 @@
   std::string url = base::StringPrintf(
       "chrome-extension://%s%s%s", script_context->extension()->id().c_str(),
       !path.empty() && path[0] == '/' ? "" : "/", path.c_str());
+  // GURL considers any possible path valid. Since the argument is only appended
+  // as part of the path, there should be no way this could conceivably fail.
+  DCHECK(GURL(url).is_valid());
   result.return_value = gin::StringToV8(isolate, url);
-  // TODO(tjudkins): Gather data on how often this is passed a bad URL (i.e. not
-  // a relative file path for the extension), so we can decide if it's fine to
-  // throw an error in those cases.
   return result;
 }