Commit b6bec5fd authored by sigbjornf's avatar sigbjornf Committed by Commit bot

IsAccessWhiteListed(): avoid unnecessary stringification.

The origin whitelist may well be empty, so check that first
before taking on the stringification of the security origin.

R=
BUG=

Review-Url: https://codereview.chromium.org/2855133005
Cr-Commit-Position: refs/heads/master@{#469300}
parent a3019246
......@@ -179,8 +179,10 @@ bool SecurityPolicy::IsUrlWhiteListedTrustworthy(const KURL& url) {
bool SecurityPolicy::IsAccessWhiteListed(const SecurityOrigin* active_origin,
const SecurityOrigin* target_origin) {
if (OriginAccessWhiteList* list =
GetOriginAccessMap().at(active_origin->ToString())) {
const OriginAccessMap& map = GetOriginAccessMap();
if (map.IsEmpty())
return false;
if (OriginAccessWhiteList* list = map.at(active_origin->ToString())) {
for (size_t i = 0; i < list->size(); ++i) {
if (list->at(i).MatchesOrigin(*target_origin) !=
OriginAccessEntry::kDoesNotMatchOrigin)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment