| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2009 Apple Inc. All rights reserved. | 3 * Copyright (C) 2009 Apple Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 return windowShell(mainThreadNormalWorld())->isContextInitialized(); | 224 return windowShell(mainThreadNormalWorld())->isContextInitialized(); |
| 225 } | 225 } |
| 226 | 226 |
| 227 V8WindowShell* ScriptController::existingWindowShell(DOMWrapperWorld* world) | 227 V8WindowShell* ScriptController::existingWindowShell(DOMWrapperWorld* world) |
| 228 { | 228 { |
| 229 ASSERT(world); | 229 ASSERT(world); |
| 230 | 230 |
| 231 if (world->isMainWorld()) | 231 if (world->isMainWorld()) |
| 232 return m_windowShell->isContextInitialized() ? m_windowShell.get() : 0; | 232 return m_windowShell->isContextInitialized() ? m_windowShell.get() : 0; |
| 233 | 233 |
| 234 // FIXME: Remove this block. See comment with existingWindowShellWorkaroundW
orld(). | |
| 235 if (world == existingWindowShellWorkaroundWorld()) | |
| 236 return m_windowShell.get(); | |
| 237 | |
| 238 IsolatedWorldMap::iterator iter = m_isolatedWorlds.find(world->worldId()); | 234 IsolatedWorldMap::iterator iter = m_isolatedWorlds.find(world->worldId()); |
| 239 if (iter == m_isolatedWorlds.end()) | 235 if (iter == m_isolatedWorlds.end()) |
| 240 return 0; | 236 return 0; |
| 241 return iter->value->isContextInitialized() ? iter->value.get() : 0; | 237 return iter->value->isContextInitialized() ? iter->value.get() : 0; |
| 242 } | 238 } |
| 243 | 239 |
| 244 V8WindowShell* ScriptController::windowShell(DOMWrapperWorld* world) | 240 V8WindowShell* ScriptController::windowShell(DOMWrapperWorld* world) |
| 245 { | 241 { |
| 246 ASSERT(world); | 242 ASSERT(world); |
| 247 | 243 |
| 248 V8WindowShell* shell = 0; | 244 V8WindowShell* shell = 0; |
| 249 if (world->isMainWorld()) | 245 if (world->isMainWorld()) |
| 250 shell = m_windowShell.get(); | 246 shell = m_windowShell.get(); |
| 251 else { | 247 else { |
| 252 IsolatedWorldMap::iterator iter = m_isolatedWorlds.find(world->worldId()
); | 248 IsolatedWorldMap::iterator iter = m_isolatedWorlds.find(world->worldId()
); |
| 253 if (iter != m_isolatedWorlds.end()) | 249 if (iter != m_isolatedWorlds.end()) |
| 254 shell = iter->value.get(); | 250 shell = iter->value.get(); |
| 255 else { | 251 else { |
| 256 OwnPtr<V8WindowShell> isolatedWorldShell = V8WindowShell::create(m_f
rame, world, m_isolate); | 252 OwnPtr<V8WindowShell> isolatedWorldShell = V8WindowShell::create(m_f
rame, world, m_isolate); |
| 257 shell = isolatedWorldShell.get(); | 253 shell = isolatedWorldShell.get(); |
| 258 m_isolatedWorlds.set(world->worldId(), isolatedWorldShell.release())
; | 254 m_isolatedWorlds.set(world->worldId(), isolatedWorldShell.release())
; |
| 259 } | 255 } |
| 260 } | 256 } |
| 261 if (!shell->isContextInitialized() && shell->initializeIfNeeded()) { | 257 if (!shell->isContextInitialized() && shell->initializeIfNeeded()) |
| 262 if (world->isMainWorld()) { | 258 m_frame->loader().dispatchDidClearWindowObjectInWorld(world); |
| 263 // FIXME: Remove this if clause. See comment with existingWindowShel
lWorkaroundWorld(). | |
| 264 m_frame->loader().dispatchDidClearWindowObjectInWorld(existingWindow
ShellWorkaroundWorld()); | |
| 265 } else { | |
| 266 m_frame->loader().dispatchDidClearWindowObjectInWorld(world); | |
| 267 } | |
| 268 } | |
| 269 return shell; | 259 return shell; |
| 270 } | 260 } |
| 271 | 261 |
| 272 bool ScriptController::shouldBypassMainWorldContentSecurityPolicy() | 262 bool ScriptController::shouldBypassMainWorldContentSecurityPolicy() |
| 273 { | 263 { |
| 274 if (DOMWrapperWorld* world = isolatedWorldForEnteredContext(m_isolate)) | 264 if (DOMWrapperWorld* world = isolatedWorldForEnteredContext(m_isolate)) |
| 275 return world->isolatedWorldHasContentSecurityPolicy(); | 265 return world->isolatedWorldHasContentSecurityPolicy(); |
| 276 return false; | 266 return false; |
| 277 } | 267 } |
| 278 | 268 |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 693 v8Results = evaluateHandleScope.Escape(resultArray); | 683 v8Results = evaluateHandleScope.Escape(resultArray); |
| 694 } | 684 } |
| 695 | 685 |
| 696 if (results && !v8Results.IsEmpty()) { | 686 if (results && !v8Results.IsEmpty()) { |
| 697 for (size_t i = 0; i < v8Results->Length(); ++i) | 687 for (size_t i = 0; i < v8Results->Length(); ++i) |
| 698 results->append(ScriptValue(v8Results->Get(i), m_isolate)); | 688 results->append(ScriptValue(v8Results->Get(i), m_isolate)); |
| 699 } | 689 } |
| 700 } | 690 } |
| 701 | 691 |
| 702 } // namespace WebCore | 692 } // namespace WebCore |
| OLD | NEW |