| Index: third_party/WebKit/Source/bindings/core/v8/DOMWrapperWorld.h
|
| diff --git a/third_party/WebKit/Source/bindings/core/v8/DOMWrapperWorld.h b/third_party/WebKit/Source/bindings/core/v8/DOMWrapperWorld.h
|
| index aeadf0611815e4309a02ae1ff14b3d0e32f98888..f92d0291f6a73447c1fd516b39fbc7955807a187 100644
|
| --- a/third_party/WebKit/Source/bindings/core/v8/DOMWrapperWorld.h
|
| +++ b/third_party/WebKit/Source/bindings/core/v8/DOMWrapperWorld.h
|
| @@ -60,6 +60,27 @@ template<typename T> class DOMObjectHolder;
|
| // This class represent a collection of DOM wrappers for a specific world.
|
| class CORE_EXPORT DOMWrapperWorld : public RefCounted<DOMWrapperWorld> {
|
| public:
|
| + class ParentWorldIdPusher {
|
| + public:
|
| + explicit ParentWorldIdPusher(DOMWrapperWorld& domWrapperWorld, int newParentWorldId)
|
| + : m_oldParentWorldId(domWrapperWorld.originWorldId())
|
| + , m_domWrapperWorld(domWrapperWorld)
|
| + {
|
| + // "Push" the parent world id.
|
| + m_domWrapperWorld.setParentWorldId(newParentWorldId);
|
| + }
|
| +
|
| + ~ParentWorldIdPusher()
|
| + {
|
| + // "Pop" the parent world id to avoid tainting the entire document.
|
| + m_domWrapperWorld.setParentWorldId(m_oldParentWorldId);
|
| + }
|
| +
|
| + private:
|
| + int m_oldParentWorldId;
|
| + DOMWrapperWorld& m_domWrapperWorld;
|
| + };
|
| +
|
| static PassRefPtr<DOMWrapperWorld> create(v8::Isolate*, int worldId = -1, int extensionGroup = -1);
|
|
|
| static const int mainWorldExtensionGroup = 0;
|
| @@ -117,7 +138,19 @@ public:
|
| bool isIsolatedWorld() const { return MainWorldId < m_worldId && m_worldId < IsolatedWorldIdLimit; }
|
|
|
| int worldId() const { return m_worldId; }
|
| + int originWorldId() const { return isIsolatedWorld() ? m_worldId : m_parentWorldId; }
|
| int extensionGroup() const { return m_extensionGroup; }
|
| + bool isOfIsolatedWorldOrigin() const
|
| + {
|
| + int worldId = originWorldId();
|
| + return MainWorldId < worldId && worldId < IsolatedWorldIdLimit;
|
| + };
|
| + void setParentWorldId(int worldId)
|
| + {
|
| + m_parentWorldId = worldId;
|
| + ASSERT(isMainWorld() || isIsolatedWorld());
|
| + };
|
| +
|
| DOMDataStore& domDataStore() const { return *m_domDataStore; }
|
|
|
| static void setWorldOfInitializingWindow(DOMWrapperWorld* world)
|
| @@ -142,6 +175,7 @@ private:
|
|
|
| const int m_worldId;
|
| const int m_extensionGroup;
|
| + int m_parentWorldId;
|
| OwnPtr<DOMDataStore> m_domDataStore;
|
| HashSet<OwnPtr<DOMObjectHolderBase>> m_domObjectHolders;
|
| };
|
|
|