| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 bool URLIsSecureURL = url.protocolIs("https"); | 63 bool URLIsSecureURL = url.protocolIs("https"); |
| 64 | 64 |
| 65 return !URLIsSecureURL; | 65 return !URLIsSecureURL; |
| 66 } | 66 } |
| 67 | 67 |
| 68 String SecurityPolicy::generateReferrerHeader(ReferrerPolicy referrerPolicy, con
st KURL& url, const String& referrer) | 68 String SecurityPolicy::generateReferrerHeader(ReferrerPolicy referrerPolicy, con
st KURL& url, const String& referrer) |
| 69 { | 69 { |
| 70 if (referrer.isEmpty()) | 70 if (referrer.isEmpty()) |
| 71 return String(); | 71 return String(); |
| 72 | 72 |
| 73 if (!(protocolIs(referrer, "https") || protocolIs(referrer, "http"))) | |
| 74 return String(); | |
| 75 | |
| 76 switch (referrerPolicy) { | 73 switch (referrerPolicy) { |
| 77 case ReferrerPolicyNever: | 74 case ReferrerPolicyNever: |
| 78 return String(); | 75 return String(); |
| 79 case ReferrerPolicyAlways: | 76 case ReferrerPolicyAlways: |
| 80 return referrer; | 77 return referrer; |
| 81 case ReferrerPolicyOrigin: { | 78 case ReferrerPolicyOrigin: { |
| 82 String origin = SecurityOrigin::createFromString(referrer)->toString(); | 79 String origin = SecurityOrigin::createFromString(referrer)->toString(); |
| 83 if (origin == "null") | 80 if (origin == "null") |
| 84 return String(); | 81 return String(); |
| 85 // A security origin is not a canonical URL as it lacks a path. Add / | 82 // A security origin is not a canonical URL as it lacks a path. Add / |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 map.remove(it); | 147 map.remove(it); |
| 151 } | 148 } |
| 152 | 149 |
| 153 void SecurityPolicy::resetOriginAccessWhitelists() | 150 void SecurityPolicy::resetOriginAccessWhitelists() |
| 154 { | 151 { |
| 155 ASSERT(isMainThread()); | 152 ASSERT(isMainThread()); |
| 156 originAccessMap().clear(); | 153 originAccessMap().clear(); |
| 157 } | 154 } |
| 158 | 155 |
| 159 } // namespace WebCore | 156 } // namespace WebCore |
| OLD | NEW |