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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 static PassRefPtr<DOMWrapperWorld> create(int worldId = -1, int extensionGro
up = -1); | 62 static PassRefPtr<DOMWrapperWorld> create(int worldId = -1, int extensionGro
up = -1); |
63 | 63 |
64 static const int mainWorldExtensionGroup = 0; | 64 static const int mainWorldExtensionGroup = 0; |
65 static PassRefPtr<DOMWrapperWorld> ensureIsolatedWorld(int worldId, int exte
nsionGroup); | 65 static PassRefPtr<DOMWrapperWorld> ensureIsolatedWorld(int worldId, int exte
nsionGroup); |
66 ~DOMWrapperWorld(); | 66 ~DOMWrapperWorld(); |
67 void dispose(); | 67 void dispose(); |
68 | 68 |
69 static bool isolatedWorldsExist() { return isolatedWorldCount; } | 69 static bool isolatedWorldsExist() { return isolatedWorldCount; } |
70 static void allWorldsInMainThread(Vector<RefPtr<DOMWrapperWorld> >& worlds); | 70 static void allWorldsInMainThread(Vector<RefPtr<DOMWrapperWorld> >& worlds); |
71 | 71 |
72 static DOMWrapperWorld* world(v8::Handle<v8::Context> context) | 72 static DOMWrapperWorld& world(v8::Handle<v8::Context> context) |
73 { | 73 { |
74 ASSERT(!context.IsEmpty()); | 74 ASSERT(!context.IsEmpty()); |
75 return V8PerContextData::world(context); | 75 return V8PerContextData::world(context); |
76 } | 76 } |
77 | 77 |
78 // Will return null if there is no DOMWrapperWorld for the current context. | 78 static DOMWrapperWorld& current(v8::Isolate* isolate) |
79 static DOMWrapperWorld* current(v8::Isolate* isolate) | |
80 { | 79 { |
81 if (isMainThread() && worldOfInitializingWindow) { | 80 if (isMainThread() && worldOfInitializingWindow) { |
82 // It's possible that current() is being called while window is bein
g initialized. | 81 // It's possible that current() is being called while window is bein
g initialized. |
83 // In order to make current() workable during the initialization pha
se, | 82 // In order to make current() workable during the initialization pha
se, |
84 // we cache the world of the initializing window on worldOfInitializ
ingWindow. | 83 // we cache the world of the initializing window on worldOfInitializ
ingWindow. |
85 // If there is no initiazing window, worldOfInitializingWindow is 0. | 84 // If there is no initiazing window, worldOfInitializingWindow is 0. |
86 return worldOfInitializingWindow; | 85 return *worldOfInitializingWindow; |
87 } | 86 } |
88 return world(isolate->GetCurrentContext()); | 87 return world(isolate->GetCurrentContext()); |
89 } | 88 } |
90 | 89 |
91 static DOMWrapperWorld* mainWorld(); | 90 static DOMWrapperWorld& mainWorld(); |
92 | 91 |
93 // Associates an isolated world (see above for description) with a security | 92 // Associates an isolated world (see above for description) with a security |
94 // origin. XMLHttpRequest instances used in that world will be considered | 93 // origin. XMLHttpRequest instances used in that world will be considered |
95 // to come from that origin, not the frame's. | 94 // to come from that origin, not the frame's. |
96 static void setIsolatedWorldSecurityOrigin(int worldID, PassRefPtr<SecurityO
rigin>); | 95 static void setIsolatedWorldSecurityOrigin(int worldID, PassRefPtr<SecurityO
rigin>); |
97 static void clearIsolatedWorldSecurityOrigin(int worldID); | 96 static void clearIsolatedWorldSecurityOrigin(int worldID); |
98 SecurityOrigin* isolatedWorldSecurityOrigin(); | 97 SecurityOrigin* isolatedWorldSecurityOrigin(); |
99 | 98 |
100 // Associated an isolated world with a Content Security Policy. Resources | 99 // Associated an isolated world with a Content Security Policy. Resources |
101 // embedded into the main world's DOM from script executed in an isolated | 100 // embedded into the main world's DOM from script executed in an isolated |
(...skipping 30 matching lines...) Expand all Loading... |
132 static DOMWrapperWorld* worldOfInitializingWindow; | 131 static DOMWrapperWorld* worldOfInitializingWindow; |
133 | 132 |
134 const int m_worldId; | 133 const int m_worldId; |
135 const int m_extensionGroup; | 134 const int m_extensionGroup; |
136 OwnPtr<DOMDataStore> m_domDataStore; | 135 OwnPtr<DOMDataStore> m_domDataStore; |
137 }; | 136 }; |
138 | 137 |
139 } // namespace WebCore | 138 } // namespace WebCore |
140 | 139 |
141 #endif // DOMWrapperWorld_h | 140 #endif // DOMWrapperWorld_h |
OLD | NEW |