Skip to content

Commit

Permalink
Add a DCHECK in Suborigin::SetName()
Browse files Browse the repository at this point in the history
SetName() is never called with an empty String. This DCHECK clarifies
that to make it easy to understand that SecurityOrigin::HasSuborigin()
is equivalent to checking whether WebSecurityOrigin::Suborigin() is
empty or not.

It might also good to replace the IsEmpty() call in WebCORS.cpp with
IsNull(), but even with that, this change is just good to do, I think.

Bug: 
Change-Id: I6b49cfaa7293c8577dbec1403dff0fc58ada4fc8
Reviewed-on: https://chromium-review.googlesource.com/606757
Reviewed-by: Mike West <mkwst@chromium.org>
Commit-Queue: Takeshi Yoshino <tyoshino@chromium.org>
Cr-Commit-Position: refs/heads/master@{#495117}
  • Loading branch information
tyoshino authored and Commit Bot committed Aug 17, 2017
1 parent c57b17b commit 9eda730
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion third_party/WebKit/Source/platform/weborigin/Suborigin.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ class PLATFORM_EXPORT Suborigin {

void SetTo(const Suborigin&);
String GetName() const { return name_; }
void SetName(const String& name) { name_ = name; }
void SetName(const String& name) {
DCHECK(!name.IsEmpty());
name_ = name;
}
void AddPolicyOption(SuboriginPolicyOptions);
bool PolicyContains(SuboriginPolicyOptions) const;
void Clear();
Expand Down

0 comments on commit 9eda730

Please sign in to comment.