summaryrefslogtreecommitdiff
path: root/Source/WebCore/bindings/v8/DOMWrapperWorld.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/bindings/v8/DOMWrapperWorld.cpp')
-rw-r--r--Source/WebCore/bindings/v8/DOMWrapperWorld.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/Source/WebCore/bindings/v8/DOMWrapperWorld.cpp b/Source/WebCore/bindings/v8/DOMWrapperWorld.cpp
index a0a60dbf1..6df0b72d5 100644
--- a/Source/WebCore/bindings/v8/DOMWrapperWorld.cpp
+++ b/Source/WebCore/bindings/v8/DOMWrapperWorld.cpp
@@ -112,4 +112,35 @@ PassRefPtr<DOMWrapperWorld> DOMWrapperWorld::ensureIsolatedWorld(int worldId, in
return world.release();
}
+typedef HashMap<int, RefPtr<SecurityOrigin> > IsolatedWorldSecurityOriginMap;
+static IsolatedWorldSecurityOriginMap& isolatedWorldSecurityOrigins()
+{
+ ASSERT(isMainThread());
+ DEFINE_STATIC_LOCAL(IsolatedWorldSecurityOriginMap, map, ());
+ return map;
+}
+
+SecurityOrigin* DOMWrapperWorld::isolatedWorldSecurityOrigin()
+{
+ ASSERT(this->isIsolatedWorld());
+ IsolatedWorldSecurityOriginMap& origins = isolatedWorldSecurityOrigins();
+ IsolatedWorldSecurityOriginMap::iterator it = origins.find(worldId());
+ return it == origins.end() ? 0 : it->value.get();
+}
+
+void DOMWrapperWorld::setIsolatedWorldSecurityOrigin(int worldID, PassRefPtr<SecurityOrigin> securityOrigin)
+{
+ ASSERT(DOMWrapperWorld::isIsolatedWorldId(worldID));
+ if (securityOrigin)
+ isolatedWorldSecurityOrigins().set(worldID, securityOrigin);
+ else
+ isolatedWorldSecurityOrigins().remove(worldID);
+}
+
+void DOMWrapperWorld::clearIsolatedWorldSecurityOrigin(int worldID)
+{
+ ASSERT(DOMWrapperWorld::isIsolatedWorldId(worldID));
+ isolatedWorldSecurityOrigins().remove(worldID);
+}
+
} // namespace WebCore