Changeset 52653 in webkit
- Timestamp:
- Dec 30, 2009 4:34:40 AM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r52648 r52653 1 2009-12-30 Yury Semikhatsky <yurys@chromium.org> 2 3 Reviewed by Dimitri Glazkov. 4 5 [v8] Use current isolated world's context for ScriptCallStack. 6 7 https://bugs.webkit.org/show_bug.cgi?id=33016 8 9 * bindings/v8/ScriptCallStack.cpp: 10 (WebCore::ScriptCallStack::ScriptCallStack): 11 * bindings/v8/ScriptCallStack.h: 12 (WebCore::ScriptCallStack::state): 13 * bindings/v8/ScriptController.cpp: 14 (WebCore::ScriptController::mainWorldScriptState): 15 (WebCore::ScriptController::currentScriptState): 16 (WebCore::ScriptController::clearWindowShell): 17 * bindings/v8/ScriptController.h: 18 * bindings/v8/V8IsolatedWorld.cpp: 19 (WebCore::V8IsolatedWorld::scriptState): 20 * bindings/v8/V8IsolatedWorld.h: 21 1 22 2009-12-30 Laszlo Gombos <laszlo.1.gombos@nokia.com> 2 23 -
trunk/WebCore/bindings/v8/ScriptCallStack.cpp
r50327 r52653 32 32 #include "ScriptCallStack.h" 33 33 34 #include "ScriptController.h" 35 34 36 #include <v8.h> 35 37 … … 54 56 ScriptCallStack::ScriptCallStack(const v8::Arguments& arguments, unsigned skipArgumentCount, String sourceName, int sourceLineNumber) 55 57 : m_lastCaller(String(), sourceName, sourceLineNumber, arguments, skipArgumentCount) 56 , m_scriptState( new ScriptState(V8Proxy::retrieveFrameForCurrentContext()))58 , m_scriptState(ScriptController::currentScriptState()) 57 59 { 58 60 } -
trunk/WebCore/bindings/v8/ScriptCallStack.h
r50327 r52653 36 36 #include "ScriptValue.h" 37 37 #include <wtf/Noncopyable.h> 38 #include <wtf/OwnPtr.h>39 38 40 39 namespace v8 { … … 53 52 unsigned size() const { return 1; } 54 53 55 ScriptState* state() const { return m_scriptState .get(); }54 ScriptState* state() const { return m_scriptState; } 56 55 57 56 private: … … 59 58 60 59 ScriptCallFrame m_lastCaller; 61 OwnPtr<ScriptState>m_scriptState;60 ScriptState* m_scriptState; 62 61 }; 63 62 -
trunk/WebCore/bindings/v8/ScriptController.cpp
r52080 r52653 52 52 #include "V8Binding.h" 53 53 #include "V8BindingState.h" 54 #include "V8IsolatedWorld.h" 54 55 #include "V8NPObject.h" 55 56 #include "V8Proxy.h" … … 365 366 ScriptState* ScriptController::mainWorldScriptState() 366 367 { 367 if (!m_mainWorldScriptState) 368 if (!m_mainWorldScriptState) { 369 v8::HandleScope handleScope; 368 370 m_mainWorldScriptState.set(new ScriptState(m_frame, V8Proxy::mainWorldContext(m_frame))); 371 } 369 372 return m_mainWorldScriptState.get(); 373 } 374 375 ScriptState* ScriptController::currentScriptState() 376 { 377 if (V8IsolatedWorld* world = V8IsolatedWorld::getEntered()) 378 return world->scriptState(); 379 Frame* frame = V8Proxy::retrieveFrameForCurrentContext(); 380 ASSERT(frame); 381 return frame->script()->mainWorldScriptState(); 370 382 } 371 383 … … 432 444 void ScriptController::clearWindowShell() 433 445 { 446 m_mainWorldScriptState.clear(); 447 434 448 // V8 binding expects ScriptController::clearWindowShell only be called 435 449 // when a frame is loading a new page. V8Proxy::clearForNavigation -
trunk/WebCore/bindings/v8/ScriptController.h
r52043 r52653 176 176 ScriptState* mainWorldScriptState(); 177 177 178 // Returns ScriptState for current context. 179 static ScriptState* currentScriptState(); 180 178 181 private: 179 182 Frame* m_frame; -
trunk/WebCore/bindings/v8/V8IsolatedWorld.cpp
r51416 r52653 92 92 } 93 93 94 ScriptState* V8IsolatedWorld::scriptState() 95 { 96 if (!m_scriptState) { 97 v8::HandleScope scope; 98 v8::Handle<v8::Context> context = m_context.get()->get(); 99 m_scriptState.set(new ScriptState(V8Proxy::retrieveFrame(context), context)); 100 } 101 return m_scriptState.get(); 102 } 103 94 104 } // namespace WebCore -
trunk/WebCore/bindings/v8/V8IsolatedWorld.h
r51416 r52653 96 96 DOMDataStore* getDOMDataStore() const { return m_domDataStore.getStore(); } 97 97 98 ScriptState* scriptState(); 99 98 100 private: 99 101 static v8::Handle<v8::Object> getGlobalObject(v8::Handle<v8::Context> context) … … 115 117 DOMDataStoreHandle m_domDataStore; 116 118 119 // FIXME: get rid of redundant m_context field. The context can be retrieved from the ScriptState. 120 OwnPtr<ScriptState> m_scriptState; 121 117 122 static int isolatedWorldCount; 118 123 };
Note: See TracChangeset
for help on using the changeset viewer.