| 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 27 matching lines...) Expand all Loading... |
| 38 #include "wtf/PassRefPtr.h" | 38 #include "wtf/PassRefPtr.h" |
| 39 #include "wtf/RefCounted.h" | 39 #include "wtf/RefCounted.h" |
| 40 #include "wtf/RefPtr.h" | 40 #include "wtf/RefPtr.h" |
| 41 #include "wtf/text/WTFString.h" | 41 #include "wtf/text/WTFString.h" |
| 42 | 42 |
| 43 namespace WebCore { | 43 namespace WebCore { |
| 44 | 44 |
| 45 class DOMDataStore; | 45 class DOMDataStore; |
| 46 class ScriptExecutionContext; | 46 class ScriptExecutionContext; |
| 47 | 47 |
| 48 enum IsolatedWorldConstants { |
| 49 EmbedderWorldIdLimit = (1 << 29), |
| 50 ScriptPreprocessorIsolatedWorldId |
| 51 }; |
| 52 |
| 48 // This class represent a collection of DOM wrappers for a specific world. | 53 // This class represent a collection of DOM wrappers for a specific world. |
| 49 class DOMWrapperWorld : public RefCounted<DOMWrapperWorld> { | 54 class DOMWrapperWorld : public RefCounted<DOMWrapperWorld> { |
| 50 public: | 55 public: |
| 51 static const int mainWorldId = 0; | 56 static const int mainWorldId = 0; |
| 52 static const int mainWorldExtensionGroup = 0; | 57 static const int mainWorldExtensionGroup = 0; |
| 53 static PassRefPtr<DOMWrapperWorld> ensureIsolatedWorld(int worldId, int exte
nsionGroup); | 58 static PassRefPtr<DOMWrapperWorld> ensureIsolatedWorld(int worldId, int exte
nsionGroup); |
| 54 ~DOMWrapperWorld(); | 59 ~DOMWrapperWorld(); |
| 55 | 60 |
| 56 static bool isolatedWorldsExist() { return isolatedWorldCount; } | 61 static bool isolatedWorldsExist() { return isolatedWorldCount; } |
| 57 static bool isIsolatedWorldId(int worldId) { return worldId > mainWorldId; } | 62 static bool isIsolatedWorldId(int worldId) { return worldId > mainWorldId; } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 81 // main world's. | 86 // main world's. |
| 82 // | 87 // |
| 83 // FIXME: Right now, resource injection simply bypasses the main world's | 88 // FIXME: Right now, resource injection simply bypasses the main world's |
| 84 // DOM. More work is necessary to allow the isolated world's policy to be | 89 // DOM. More work is necessary to allow the isolated world's policy to be |
| 85 // applied correctly. | 90 // applied correctly. |
| 86 static void setIsolatedWorldContentSecurityPolicy(int worldID, const String&
policy); | 91 static void setIsolatedWorldContentSecurityPolicy(int worldID, const String&
policy); |
| 87 static void clearIsolatedWorldContentSecurityPolicy(int worldID); | 92 static void clearIsolatedWorldContentSecurityPolicy(int worldID); |
| 88 bool isolatedWorldHasContentSecurityPolicy(); | 93 bool isolatedWorldHasContentSecurityPolicy(); |
| 89 | 94 |
| 90 // Associate a logger with the world identified by worldId (worlId may be 0 | 95 // Associate a logger with the world identified by worldId (worlId may be 0 |
| 91 // identifying the main world). | 96 // identifying the main world). |
| 92 static void setActivityLogger(int worldId, PassOwnPtr<V8DOMActivityLogger>); | 97 static void setActivityLogger(int worldId, PassOwnPtr<V8DOMActivityLogger>); |
| 93 static V8DOMActivityLogger* activityLogger(int worldId); | 98 static V8DOMActivityLogger* activityLogger(int worldId); |
| 94 | 99 |
| 95 bool isMainWorld() const { return m_worldId == mainWorldId; } | 100 bool isMainWorld() const { return m_worldId == mainWorldId; } |
| 96 bool isIsolatedWorld() const { return isIsolatedWorldId(m_worldId); } | 101 bool isIsolatedWorld() const { return isIsolatedWorldId(m_worldId); } |
| 97 | 102 |
| 98 int worldId() const { return m_worldId; } | 103 int worldId() const { return m_worldId; } |
| 99 int extensionGroup() const { return m_extensionGroup; } | 104 int extensionGroup() const { return m_extensionGroup; } |
| 100 DOMDataStore* isolatedWorldDOMDataStore() const | 105 DOMDataStore* isolatedWorldDOMDataStore() const |
| 101 { | 106 { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 122 | 127 |
| 123 DOMWrapperWorld* mainThreadNormalWorld(); | 128 DOMWrapperWorld* mainThreadNormalWorld(); |
| 124 | 129 |
| 125 // FIXME: this is a workaround for a problem in ScriptController | 130 // FIXME: this is a workaround for a problem in ScriptController |
| 126 // Do not use this anywhere else!! | 131 // Do not use this anywhere else!! |
| 127 DOMWrapperWorld* existingWindowShellWorkaroundWorld(); | 132 DOMWrapperWorld* existingWindowShellWorkaroundWorld(); |
| 128 | 133 |
| 129 } // namespace WebCore | 134 } // namespace WebCore |
| 130 | 135 |
| 131 #endif // DOMWrapperWorld_h | 136 #endif // DOMWrapperWorld_h |
| OLD | NEW |