| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 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 are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 | 157 |
| 158 void DOMWrapperWorld::setIsolatedWorldSecurityOrigin(int worldId, PassRefPtr<Sec
urityOrigin> securityOrigin) | 158 void DOMWrapperWorld::setIsolatedWorldSecurityOrigin(int worldId, PassRefPtr<Sec
urityOrigin> securityOrigin) |
| 159 { | 159 { |
| 160 ASSERT(isIsolatedWorldId(worldId)); | 160 ASSERT(isIsolatedWorldId(worldId)); |
| 161 if (securityOrigin) | 161 if (securityOrigin) |
| 162 isolatedWorldSecurityOrigins().set(worldId, securityOrigin); | 162 isolatedWorldSecurityOrigins().set(worldId, securityOrigin); |
| 163 else | 163 else |
| 164 isolatedWorldSecurityOrigins().remove(worldId); | 164 isolatedWorldSecurityOrigins().remove(worldId); |
| 165 } | 165 } |
| 166 | 166 |
| 167 void DOMWrapperWorld::clearIsolatedWorldSecurityOrigin(int worldId) | |
| 168 { | |
| 169 ASSERT(isIsolatedWorldId(worldId)); | |
| 170 isolatedWorldSecurityOrigins().remove(worldId); | |
| 171 } | |
| 172 | |
| 173 typedef HashMap<int, bool> IsolatedWorldContentSecurityPolicyMap; | 167 typedef HashMap<int, bool> IsolatedWorldContentSecurityPolicyMap; |
| 174 static IsolatedWorldContentSecurityPolicyMap& isolatedWorldContentSecurityPolici
es() | 168 static IsolatedWorldContentSecurityPolicyMap& isolatedWorldContentSecurityPolici
es() |
| 175 { | 169 { |
| 176 ASSERT(isMainThread()); | 170 ASSERT(isMainThread()); |
| 177 DEFINE_STATIC_LOCAL(IsolatedWorldContentSecurityPolicyMap, map, ()); | 171 DEFINE_STATIC_LOCAL(IsolatedWorldContentSecurityPolicyMap, map, ()); |
| 178 return map; | 172 return map; |
| 179 } | 173 } |
| 180 | 174 |
| 181 bool DOMWrapperWorld::isolatedWorldHasContentSecurityPolicy() | 175 bool DOMWrapperWorld::isolatedWorldHasContentSecurityPolicy() |
| 182 { | 176 { |
| 183 ASSERT(this->isIsolatedWorld()); | 177 ASSERT(this->isIsolatedWorld()); |
| 184 IsolatedWorldContentSecurityPolicyMap& policies = isolatedWorldContentSecuri
tyPolicies(); | 178 IsolatedWorldContentSecurityPolicyMap& policies = isolatedWorldContentSecuri
tyPolicies(); |
| 185 IsolatedWorldContentSecurityPolicyMap::iterator it = policies.find(worldId()
); | 179 IsolatedWorldContentSecurityPolicyMap::iterator it = policies.find(worldId()
); |
| 186 return it == policies.end() ? false : it->value; | 180 return it == policies.end() ? false : it->value; |
| 187 } | 181 } |
| 188 | 182 |
| 189 void DOMWrapperWorld::setIsolatedWorldContentSecurityPolicy(int worldId, const S
tring& policy) | 183 void DOMWrapperWorld::setIsolatedWorldContentSecurityPolicy(int worldId, const S
tring& policy) |
| 190 { | 184 { |
| 191 ASSERT(isIsolatedWorldId(worldId)); | 185 ASSERT(isIsolatedWorldId(worldId)); |
| 192 if (!policy.isEmpty()) | 186 if (!policy.isEmpty()) |
| 193 isolatedWorldContentSecurityPolicies().set(worldId, true); | 187 isolatedWorldContentSecurityPolicies().set(worldId, true); |
| 194 else | 188 else |
| 195 isolatedWorldContentSecurityPolicies().remove(worldId); | 189 isolatedWorldContentSecurityPolicies().remove(worldId); |
| 196 } | 190 } |
| 197 | 191 |
| 198 void DOMWrapperWorld::clearIsolatedWorldContentSecurityPolicy(int worldId) | |
| 199 { | |
| 200 ASSERT(isIsolatedWorldId(worldId)); | |
| 201 isolatedWorldContentSecurityPolicies().remove(worldId); | |
| 202 } | |
| 203 | |
| 204 } // namespace WebCore | 192 } // namespace WebCore |
| OLD | NEW |